{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s922437874", "group_id": "codeNet:p00001", "input_text": "import sys\n\nheights = []\n\nfor height in sys.stdin:\n heights.append(int(height.rstrip()))\n\nheights.reverse()\n\nfor i in range(3):\n print heights[i]", "language": "Python", "metadata": {"date": 1482931200, "filename_ext": "py", "original_language": "Python", "problem_description_relpath": "problem_descriptions/p00001.html", "problem_id": "p00001", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p00001/input.txt", "sample_output_relpath": "derived/input_output/data/p00001/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p00001/Python/s922437874.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s922437874", "user_id": "u252414452"}, "prompt_components": {"gold_output": "3776\n2848\n2840\n", "input_to_evaluate": "import sys\n\nheights = []\n\nfor height in sys.stdin:\n heights.append(int(height.rstrip()))\n\nheights.reverse()\n\nfor i in range(3):\n print heights[i]", "problem_context": "List of Top 3 Hills\n\nThere is a data which provides heights (in meter) of mountains. The data is only for ten mountains.\n\nWrite a program which prints heights of the top three mountains in descending order.\n\nInput\n\nHeight of mountain 1\nHeight of mountain 2\nHeight of mountain 3\n.\n.\nHeight of mountain 10\n\nConstraints\n\n0 ≤ height of mountain (integer) ≤ 10,000\n\nOutput\n\nHeight of the 1st mountain\nHeight of the 2nd mountain\nHeight of the 3rd mountain\n\nSample Input 1\n\n1819\n2003\n876\n2840\n1723\n1673\n3776\n2848\n1592\n922\n\nOutput for the Sample Input 1\n\n3776\n2848\n2840\n\nSample Input 2\n\n100\n200\n300\n400\n500\n600\n700\n800\n900\n900\n\nOutput for the Sample Input 2\n\n900\n900\n800", "sample_input": "1819\n2003\n876\n2840\n1723\n1673\n3776\n2848\n1592\n922\n"}, "reference_outputs": ["3776\n2848\n2840\n"], "source_document_id": "p00001", "source_text": "List of Top 3 Hills\n\nThere is a data which provides heights (in meter) of mountains. The data is only for ten mountains.\n\nWrite a program which prints heights of the top three mountains in descending order.\n\nInput\n\nHeight of mountain 1\nHeight of mountain 2\nHeight of mountain 3\n.\n.\nHeight of mountain 10\n\nConstraints\n\n0 ≤ height of mountain (integer) ≤ 10,000\n\nOutput\n\nHeight of the 1st mountain\nHeight of the 2nd mountain\nHeight of the 3rd mountain\n\nSample Input 1\n\n1819\n2003\n876\n2840\n1723\n1673\n3776\n2848\n1592\n922\n\nOutput for the Sample Input 1\n\n3776\n2848\n2840\n\nSample Input 2\n\n100\n200\n300\n400\n500\n600\n700\n800\n900\n900\n\nOutput for the Sample Input 2\n\n900\n900\n800", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 147, "cpu_time_ms": 10, "memory_kb": 6328}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s787008748", "group_id": "codeNet:p00006", "input_text": "n = input()\nrn = n[::-1]\nprint(rn)\n", "language": "Python", "metadata": {"date": 1596444175, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p00006.html", "problem_id": "p00006", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p00006/input.txt", "sample_output_relpath": "derived/input_output/data/p00006/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p00006/Python/s787008748.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s787008748", "user_id": "u826807985"}, "prompt_components": {"gold_output": "admin23w\n", "input_to_evaluate": "n = input()\nrn = n[::-1]\nprint(rn)\n", "problem_context": "Reverse Sequence\n\nWrite a program which reverses a given string str.\n\nInput\n\nstr (the size of str ≤ 20) is given in a line.\n\nOutput\n\nPrint the reversed str in a line.\n\nSample Input\n\nw32nimda\n\nOutput for the Sample Input\n\nadmin23w", "sample_input": "w32nimda\n"}, "reference_outputs": ["admin23w\n"], "source_document_id": "p00006", "source_text": "Reverse Sequence\n\nWrite a program which reverses a given string str.\n\nInput\n\nstr (the size of str ≤ 20) is given in a line.\n\nOutput\n\nPrint the reversed str in a line.\n\nSample Input\n\nw32nimda\n\nOutput for the Sample Input\n\nadmin23w", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 35, "cpu_time_ms": 20, "memory_kb": 5540}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s532963938", "group_id": "codeNet:p00044", "input_text": "import bisect\n\nMAX = 50050\n\n#エラトステネスの篩\nis_prime = [True for _ in range(MAX)]\nis_prime[0] = is_prime[1] = False\nfor i in range(2, int(MAX ** (1 / 2)) + 1):\n if is_prime[i]:\n for j in range(i ** 2, MAX, i):\n is_prime[j] = False\n\nprimes = [i for i in range(MAX) if is_prime[i]]\n\nwhile True:\n try:\n n = int(input())\n ind = bisect.bisect_left(primes, n)\n if primes[ind] == n:\n print(primes[ind - 1], primes[ind + 1])\n else:\n print(primes[ind - 1], primes[ind])\n\n except EOFError:\n break\n", "language": "Python", "metadata": {"date": 1527515364, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p00044.html", "problem_id": "p00044", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p00044/input.txt", "sample_output_relpath": "derived/input_output/data/p00044/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p00044/Python/s532963938.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s532963938", "user_id": "u352394527"}, "prompt_components": {"gold_output": "17 23\n3511 3527\n", "input_to_evaluate": "import bisect\n\nMAX = 50050\n\n#エラトステネスの篩\nis_prime = [True for _ in range(MAX)]\nis_prime[0] = is_prime[1] = False\nfor i in range(2, int(MAX ** (1 / 2)) + 1):\n if is_prime[i]:\n for j in range(i ** 2, MAX, i):\n is_prime[j] = False\n\nprimes = [i for i in range(MAX) if is_prime[i]]\n\nwhile True:\n try:\n n = int(input())\n ind = bisect.bisect_left(primes, n)\n if primes[ind] == n:\n print(primes[ind - 1], primes[ind + 1])\n else:\n print(primes[ind - 1], primes[ind])\n\n except EOFError:\n break\n", "problem_context": "素数 II\n\n素数というのは、1 よりも大きくそれ自身か 1 でしか割りきれない整数をいいます。例えば、2 は、2 と 1 でしか割り切れないので素数ですが、12 は、12 と 1 のほかに、2, 3, 4, 6 で割りきれる数なので素数ではありません。\n\n整数 n を入力したとき、n より小さい素数のうち最も大きいものと、n より大きい素数のうち最も小さいものを出力するプログラムを作成してください。\n\nInput\n\n複数のデータセットが与えられます。各データセットに n (3 ≤ n ≤ 50,000) が1行に与えられます。\n\nデータセットの数は 50 を超えません。\n\nOutput\n\n各データセットに対して、n より小さい素数のうち最大のものと、n より大きい素数のうち最小のものを1つのスペースで区切って1行に出力して下さい。\n\nSample Input\n\n19\n3517\n\nOutput for the Sample Input\n\n17 23\n3511 3527", "sample_input": "19\n3517\n"}, "reference_outputs": ["17 23\n3511 3527\n"], "source_document_id": "p00044", "source_text": "素数 II\n\n素数というのは、1 よりも大きくそれ自身か 1 でしか割りきれない整数をいいます。例えば、2 は、2 と 1 でしか割り切れないので素数ですが、12 は、12 と 1 のほかに、2, 3, 4, 6 で割りきれる数なので素数ではありません。\n\n整数 n を入力したとき、n より小さい素数のうち最も大きいものと、n より大きい素数のうち最も小さいものを出力するプログラムを作成してください。\n\nInput\n\n複数のデータセットが与えられます。各データセットに n (3 ≤ n ≤ 50,000) が1行に与えられます。\n\nデータセットの数は 50 を超えません。\n\nOutput\n\n各データセットに対して、n より小さい素数のうち最大のものと、n より大きい素数のうち最小のものを1つのスペースで区切って1行に出力して下さい。\n\nSample Input\n\n19\n3517\n\nOutput for the Sample Input\n\n17 23\n3511 3527", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 536, "cpu_time_ms": 50, "memory_kb": 6088}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s806707800", "group_id": "codeNet:p00047", "input_text": "import sys\narr = [1,0,0]\nfor line in sys.stdin:\n s = line.split(',')\n if s[0] == 'A':\n n = 0\n elif s[0] == 'B':\n n = 1\n else:\n n = 2\n if s[1] == 'A':\n m = 0\n elif s[1] == 'B':\n m = 1\n else:\n m = 2\n \n if arr[n] == 1 or arr[m] == 1:\n t = arr[n]\n arr[n] = arr[m]\n arr[m] = t\n\nfor i in range(len(arr)):\n if arr[i] == 1:\n if i == 0:\n print('A')\n elif i == 1:\n print('B')\n else:\n print('C')", "language": "Python", "metadata": {"date": 1467035527, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p00047.html", "problem_id": "p00047", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p00047/input.txt", "sample_output_relpath": "derived/input_output/data/p00047/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p00047/Python/s806707800.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s806707800", "user_id": "u203261375"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "import sys\narr = [1,0,0]\nfor line in sys.stdin:\n s = line.split(',')\n if s[0] == 'A':\n n = 0\n elif s[0] == 'B':\n n = 1\n else:\n n = 2\n if s[1] == 'A':\n m = 0\n elif s[1] == 'B':\n m = 1\n else:\n m = 2\n \n if arr[n] == 1 or arr[m] == 1:\n t = arr[n]\n arr[n] = arr[m]\n arr[m] = t\n\nfor i in range(len(arr)):\n if arr[i] == 1:\n if i == 0:\n print('A')\n elif i == 1:\n print('B')\n else:\n print('C')", "problem_context": "カップゲーム\n\n3 つのカップがふせて置かれています。カップの置かれている場所を、順に A,B,C と呼ぶことにします。最初は A に置かれているカップの中にボールが隠されているとします。カップの位置を入れ替えると、中に入っているボールも一緒に移動します。\n\n入れ替える2つのカップの位置を読み込んで、最終的にどの場所のカップにボールが隠されているかを出力するプログラムを作成してください。\n\nInput\n\n入れ替える2つのカップの位置が順番に複数行にわたり与えられます。各行に、入れ替える2つのカップの位置を表す文字(A, B, または C)がカンマ区切りで与えられます。\n\n入れ替える操作は 50 回を超えません。\n\nOutput\n\nボールが入っているカップの場所(A, B, または C)を1行に出力します。\n\nSample Input\n\nB,C\nA,C\nC,B\nA,B\nC,B\n\nOutput for the Sample Input\n\nA", "sample_input": "B,C\nA,C\nC,B\nA,B\nC,B\n"}, "reference_outputs": ["A\n"], "source_document_id": "p00047", "source_text": "カップゲーム\n\n3 つのカップがふせて置かれています。カップの置かれている場所を、順に A,B,C と呼ぶことにします。最初は A に置かれているカップの中にボールが隠されているとします。カップの位置を入れ替えると、中に入っているボールも一緒に移動します。\n\n入れ替える2つのカップの位置を読み込んで、最終的にどの場所のカップにボールが隠されているかを出力するプログラムを作成してください。\n\nInput\n\n入れ替える2つのカップの位置が順番に複数行にわたり与えられます。各行に、入れ替える2つのカップの位置を表す文字(A, B, または C)がカンマ区切りで与えられます。\n\n入れ替える操作は 50 回を超えません。\n\nOutput\n\nボールが入っているカップの場所(A, B, または C)を1行に出力します。\n\nSample Input\n\nB,C\nA,C\nC,B\nA,B\nC,B\n\nOutput for the Sample Input\n\nA", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 531, "cpu_time_ms": 30, "memory_kb": 7476}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s116871662", "group_id": "codeNet:p00049", "input_text": "d = {};\nd[\"A\"] = 0;\nd[\"B\"] = 0;\nd[\"AB\"] = 0;\nd[\"O\"] = 0;\n\nwhile True:\n try:\n b = raw_input().strip().split(\",\")[1]\n d[b] += 1;\n except:\n break;\n\nprint d[\"A\"]\nprint d[\"B\"]\nprint d[\"AB\"]\nprint d[\"O\"]", "language": "Python", "metadata": {"date": 1410782369, "filename_ext": "py", "original_language": "Python", "problem_description_relpath": "problem_descriptions/p00049.html", "problem_id": "p00049", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p00049/input.txt", "sample_output_relpath": "derived/input_output/data/p00049/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p00049/Python/s116871662.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s116871662", "user_id": "u560838141"}, "prompt_components": {"gold_output": "5\n4\n3\n2\n", "input_to_evaluate": "d = {};\nd[\"A\"] = 0;\nd[\"B\"] = 0;\nd[\"AB\"] = 0;\nd[\"O\"] = 0;\n\nwhile True:\n try:\n b = raw_input().strip().split(\",\")[1]\n d[b] += 1;\n except:\n break;\n\nprint d[\"A\"]\nprint d[\"B\"]\nprint d[\"AB\"]\nprint d[\"O\"]", "problem_context": "血液型\n\nある学級の生徒の出席番号と ABO 血液型を保存したデータを読み込んで、おのおのの血液型の人数を出力するプログラムを作成してください。なお、ABO 血液型には、A 型、B 型、AB 型、O 型の4種類の血液型があります。\n\nInput\n\nカンマで区切られた出席番号と血液型の組が、複数行に渡って与えられます。出席番号は 1 以上 50 以下の整数、血液型は文字列 \"A\", \"B\", \"AB\" または \"O\" のいずれかです。生徒の人数は 50 を超えません。\n\nOutput\n\n1行目に A 型の人数\n\n2行目に B 型の人数\n\n3行目に AB 型の人数\n\n4行目に O 型の人数\n\nを出力します。\n\nSample Input\n\n1,B\n2,A\n3,B\n4,AB\n5,B\n6,O\n7,A\n8,O\n9,AB\n10,A\n11,A\n12,B\n13,AB\n14,A\n\nOutput for the Sample Input\n\n5\n4\n3\n2", "sample_input": "1,B\n2,A\n3,B\n4,AB\n5,B\n6,O\n7,A\n8,O\n9,AB\n10,A\n11,A\n12,B\n13,AB\n14,A\n"}, "reference_outputs": ["5\n4\n3\n2\n"], "source_document_id": "p00049", "source_text": "血液型\n\nある学級の生徒の出席番号と ABO 血液型を保存したデータを読み込んで、おのおのの血液型の人数を出力するプログラムを作成してください。なお、ABO 血液型には、A 型、B 型、AB 型、O 型の4種類の血液型があります。\n\nInput\n\nカンマで区切られた出席番号と血液型の組が、複数行に渡って与えられます。出席番号は 1 以上 50 以下の整数、血液型は文字列 \"A\", \"B\", \"AB\" または \"O\" のいずれかです。生徒の人数は 50 を超えません。\n\nOutput\n\n1行目に A 型の人数\n\n2行目に B 型の人数\n\n3行目に AB 型の人数\n\n4行目に O 型の人数\n\nを出力します。\n\nSample Input\n\n1,B\n2,A\n3,B\n4,AB\n5,B\n6,O\n7,A\n8,O\n9,AB\n10,A\n11,A\n12,B\n13,AB\n14,A\n\nOutput for the Sample Input\n\n5\n4\n3\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 200, "cpu_time_ms": 10, "memory_kb": 4208}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s688025531", "group_id": "codeNet:p00055", "input_text": "import sys\n\n\ndef solve(n):\n sum = n\n current_value = n\n for i in range(2, 11):\n if i%2 == 0:\n next_value = current_value * 2.0\n else:\n next_value = current_value / 3.0\n sum += next_value\n current_value = next_value\n return sum\n\n\nif __name__ == '__main__':\n # ??????????????\\?????¨???????????????\n for line in sys.stdin:\n n = float(line.strip())\n result = solve(n)\n print('{:.8f}'.format(result))", "language": "Python", "metadata": {"date": 1503224719, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p00055.html", "problem_id": "p00055", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p00055/input.txt", "sample_output_relpath": "derived/input_output/data/p00055/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p00055/Python/s688025531.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s688025531", "user_id": "u811733736"}, "prompt_components": {"gold_output": "7.81481481\n15.62962963\n23.44444444\n", "input_to_evaluate": "import sys\n\n\ndef solve(n):\n sum = n\n current_value = n\n for i in range(2, 11):\n if i%2 == 0:\n next_value = current_value * 2.0\n else:\n next_value = current_value / 3.0\n sum += next_value\n current_value = next_value\n return sum\n\n\nif __name__ == '__main__':\n # ??????????????\\?????¨???????????????\n for line in sys.stdin:\n n = float(line.strip())\n result = solve(n)\n print('{:.8f}'.format(result))", "problem_context": "数列\n\n次のように定義されている数列があります。\n\nすべての偶数番目の項は一つ前の項に 2 を掛けたものと等しい数である。\n\nすべての奇数番目の項は一つ前の項を 3 で割ったものと等しい数である。\n\nこの数列の初項 a を読み込み、初項から第 10 項までの和 s(10) を出力するプログラムを作成してください。\n\nInput\n\n入力は複数のテストケースからなります。各テストケースとして、数列の初項を表す実数 a (1.0 ≤ a ≤ 10.0) が1行に与えられます。\n\nテストケースの数は 50 を超えません。\n\nOutput\n\nテストケースごとに s(10) を1行に出力します。\n\n出力は0.000001以下の誤差を含んでもよい。\n\nSample Input\n\n1.0\n2.0\n3.0\n\nOutput for the Sample Input\n\n7.81481481\n15.62962963\n23.44444444", "sample_input": "1.0\n2.0\n3.0\n"}, "reference_outputs": ["7.81481481\n15.62962963\n23.44444444\n"], "source_document_id": "p00055", "source_text": "数列\n\n次のように定義されている数列があります。\n\nすべての偶数番目の項は一つ前の項に 2 を掛けたものと等しい数である。\n\nすべての奇数番目の項は一つ前の項を 3 で割ったものと等しい数である。\n\nこの数列の初項 a を読み込み、初項から第 10 項までの和 s(10) を出力するプログラムを作成してください。\n\nInput\n\n入力は複数のテストケースからなります。各テストケースとして、数列の初項を表す実数 a (1.0 ≤ a ≤ 10.0) が1行に与えられます。\n\nテストケースの数は 50 を超えません。\n\nOutput\n\nテストケースごとに s(10) を1行に出力します。\n\n出力は0.000001以下の誤差を含んでもよい。\n\nSample Input\n\n1.0\n2.0\n3.0\n\nOutput for the Sample Input\n\n7.81481481\n15.62962963\n23.44444444", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 485, "cpu_time_ms": 20, "memory_kb": 7412}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s086017549", "group_id": "codeNet:p00061", "input_text": "def get_input():\n while True:\n try:\n yield ''.join(input())\n except EOFError:\n break\n\nteams = [0 for i in range(101)]\npoints = [False for i in range(31)]\nwhile True:\n a,b = [int(i) for i in input().split(\",\")]\n if a == 0 and b == 0:\n break\n\n teams[a] = b\n points[b] = True\n\nN = list(get_input())\nfor l in range(len(N)):\n q = int(N[l])\n p = teams[q]\n ans = 0\n for i in range(30,-1,-1):\n if points[i]:\n ans += 1\n if i == p:\n break\n print(ans)\n\n", "language": "Python", "metadata": {"date": 1518625266, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p00061.html", "problem_id": "p00061", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p00061/input.txt", "sample_output_relpath": "derived/input_output/data/p00061/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p00061/Python/s086017549.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s086017549", "user_id": "u043254318"}, "prompt_components": {"gold_output": "2\n2\n3\n3\n", "input_to_evaluate": "def get_input():\n while True:\n try:\n yield ''.join(input())\n except EOFError:\n break\n\nteams = [0 for i in range(101)]\npoints = [False for i in range(31)]\nwhile True:\n a,b = [int(i) for i in input().split(\",\")]\n if a == 0 and b == 0:\n break\n\n teams[a] = b\n points[b] = True\n\nN = list(get_input())\nfor l in range(len(N)):\n q = int(N[l])\n p = teams[q]\n ans = 0\n for i in range(30,-1,-1):\n if points[i]:\n ans += 1\n if i == p:\n break\n print(ans)\n\n", "problem_context": "Rank Checker\n\n時は2020 年。パソコン甲子園 2020 の予選結果を保存したデータがあります。このデータには、各チームに振られる整理番号と正解数が保存されています。ここでは、正解数で順位を決定するものとし、正解数の多いほうから順に 1 位、2 位 ... と順位をつけていくこととします。\n\n予選結果のデータと整理番号をキーボードから入力して、その番号のチームの順位を出力するプログラムを作成してください。\n\nInput\n\n入力データは2つの部分からなります。前半の部分は、予選結果のデータ、後半の部分は順位を知りたいチーム番号の問い合わせです。予選結果のデータの形式は以下の通りです。\n\np1,s1\np2,s2\n...\n...\n0,0\n\npi (1 ≤ pi ≤ 100 )、 si (0 ≤ si ≤ 30) はそれぞれ i チーム目の整理番号と正解数を表す整数です。整理番号と正解数がともに 0 のときこのデータの入力が終わるものとします。\n\n続いて後半の問い合わせが複数与えられます。問い合わせの形式は以下の通りです。\n\nq1\nq2\n:\n\n各問い合わせは1行に整理番号 qi (1 ≤ qi ≤ 30) が与えられます。これを入力の最後まで処理して下さい。問い合わせの数は 100 を超えません。\n\nOutput\n\n各問い合わせについて、チームの順位を1行に出力して下さい。\n\nSample Input\n\n1,20\n2,20\n3,30\n4,10\n5,10\n6,20\n0,0\n1\n2\n4\n5\n\nOutput for the Sample Input\n\n2\n2\n3\n3\n\nNote\n\n入力例のデータにおいて、チームを正解数順に整列すると:\n\n3,30\n1,20\n2,20\n6,20\n4,10\n5,10\n\nとなります。ここでは、正解数を基に順位を決定するため、30問正解チームを1位、20問正解チームを2位、10問正解チームを3位とします(上位のチーム数を考慮し、10問正解チームを5位とする通常の順位付けとは異なることに注意して下さい)。", "sample_input": "1,20\n2,20\n3,30\n4,10\n5,10\n6,20\n0,0\n1\n2\n4\n5\n"}, "reference_outputs": ["2\n2\n3\n3\n"], "source_document_id": "p00061", "source_text": "Rank Checker\n\n時は2020 年。パソコン甲子園 2020 の予選結果を保存したデータがあります。このデータには、各チームに振られる整理番号と正解数が保存されています。ここでは、正解数で順位を決定するものとし、正解数の多いほうから順に 1 位、2 位 ... と順位をつけていくこととします。\n\n予選結果のデータと整理番号をキーボードから入力して、その番号のチームの順位を出力するプログラムを作成してください。\n\nInput\n\n入力データは2つの部分からなります。前半の部分は、予選結果のデータ、後半の部分は順位を知りたいチーム番号の問い合わせです。予選結果のデータの形式は以下の通りです。\n\np1,s1\np2,s2\n...\n...\n0,0\n\npi (1 ≤ pi ≤ 100 )、 si (0 ≤ si ≤ 30) はそれぞれ i チーム目の整理番号と正解数を表す整数です。整理番号と正解数がともに 0 のときこのデータの入力が終わるものとします。\n\n続いて後半の問い合わせが複数与えられます。問い合わせの形式は以下の通りです。\n\nq1\nq2\n:\n\n各問い合わせは1行に整理番号 qi (1 ≤ qi ≤ 30) が与えられます。これを入力の最後まで処理して下さい。問い合わせの数は 100 を超えません。\n\nOutput\n\n各問い合わせについて、チームの順位を1行に出力して下さい。\n\nSample Input\n\n1,20\n2,20\n3,30\n4,10\n5,10\n6,20\n0,0\n1\n2\n4\n5\n\nOutput for the Sample Input\n\n2\n2\n3\n3\n\nNote\n\n入力例のデータにおいて、チームを正解数順に整列すると:\n\n3,30\n1,20\n2,20\n6,20\n4,10\n5,10\n\nとなります。ここでは、正解数を基に順位を決定するため、30問正解チームを1位、20問正解チームを2位、10問正解チームを3位とします(上位のチーム数を考慮し、10問正解チームを5位とする通常の順位付けとは異なることに注意して下さい)。", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 551, "cpu_time_ms": 20, "memory_kb": 5600}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s302203043", "group_id": "codeNet:p00082", "input_text": "import sys\n##device \nd = [1,4,1,4,1,2,1,2]\n\n\"\"\" \ndd = [] \nfor i in range(8): \n dd = d[i:] + d[-8:i-8] \n print dd \n\"\"\"\nmin = 10000\nr = -1\n\nfor i in range(2):\n g = map(int,raw_input().split())\n for j in range(8):\n dd = d[j:] + d[-8:j-8]\n t = []\n for k in range(8):\n if dd[k] - g[k] > 0:\n t.append(dd[k] - g[k])\n else:\n t.append(g[k] - dd[k])\n if sum(t) < min:\n min = sum(t)\n r = j\n re = d[r:] + d[-8:r-8]\n print re", "language": "Python", "metadata": {"date": 1378169020, "filename_ext": "py", "original_language": "Python", "problem_description_relpath": "problem_descriptions/p00082.html", "problem_id": "p00082", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p00082/input.txt", "sample_output_relpath": "derived/input_output/data/p00082/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p00082/Python/s302203043.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s302203043", "user_id": "u454358619"}, "prompt_components": {"gold_output": "1 4 1 4 1 2 1 2\n4 1 4 1 2 1 2 1\n", "input_to_evaluate": "import sys\n##device \nd = [1,4,1,4,1,2,1,2]\n\n\"\"\" \ndd = [] \nfor i in range(8): \n dd = d[i:] + d[-8:i-8] \n print dd \n\"\"\"\nmin = 10000\nr = -1\n\nfor i in range(2):\n g = map(int,raw_input().split())\n for j in range(8):\n dd = d[j:] + d[-8:j-8]\n t = []\n for k in range(8):\n if dd[k] - g[k] > 0:\n t.append(dd[k] - g[k])\n else:\n t.append(g[k] - dd[k])\n if sum(t) < min:\n min = sum(t)\n r = j\n re = d[r:] + d[-8:r-8]\n print re", "problem_context": "メリーゴーランド\n\n遊園地にあるメリーゴーランドはご存じでしょう。大きな円盤の上に馬や馬車などの乗り物が固定されていて、円盤が回転すると同時に乗り物が上下に揺れる、定番の遊具です。ある遊園地のメリーゴーランドは、4人乗りの馬車が2台、2人乗りの車2台、1人乗りの馬が4台、計8台の乗り物が図1のような順序で備えられています。そして、遊園地においでのお客様は、図1に示す乗り場0〜7のどこかで待つようになっています。\n\nこの遊園地のメリーゴーランドは、かならず乗り物が乗り場にぴったりと合う位置に停止します。そして、0〜7のそれぞれで待っているお客さまは、目の前にとまった乗り物に乗ることになっています。急いで他の乗り場へ移動してそこから乗るということはできません。効率よく、お客さまにたのしんでいただくためには、メリーゴーランドの停止する位置をうまく調整して、乗れないお客さまをできるだけ少なくするようにしなければなりません。\n\n乗り場0〜7で待っているお客さまの人数を読み込んで、どの位置にどの乗り物が来るように止めれば乗れないお客さまが最も少なくなるかを出力するプログラムを作成してください。\n\n入力\n\n入力は複数のデータセットからなります。各データセットは以下の形式で与えられます。\n\np0 p1 p2 p3 p4 p5 p6 p7\n\n乗り場 0, 1, ..., 7 で待っているお客様の人数を表す整数 p0, p1,... , p7 ( 0 ≤ pi ≤ 10,000) が空白区切りで1行に与えられます。\n\n出力\n\nメリーゴーランドの乗り物の馬車を 4、車を 2、馬を 1 で表すこととします。乗り場 0, 1, ... , 7 にとめる乗り物を、それぞれ c0, c1,..., c7 とします。データセットごとに、c0, c1,..., c7 を空白区切りで 1 行に出力します。\n\nなお、乗れなくなるお客さまが最小となるとめ方が複数ある場合は、c0c1c2c3c4c5c6c7 を 8 桁の整数 V とみなし、V が最小となるとめ方を選ぶものとします。\n\nデータセットの数は 100 を超えません。\n\nSample Input\n\n2 3 1 4 0 1 0 1\n4 2 3 2 2 2 1 1\n\nOutput for the Sample Input\n\n1 4 1 4 1 2 1 2\n4 1 4 1 2 1 2 1", "sample_input": "2 3 1 4 0 1 0 1\n4 2 3 2 2 2 1 1\n"}, "reference_outputs": ["1 4 1 4 1 2 1 2\n4 1 4 1 2 1 2 1\n"], "source_document_id": "p00082", "source_text": "メリーゴーランド\n\n遊園地にあるメリーゴーランドはご存じでしょう。大きな円盤の上に馬や馬車などの乗り物が固定されていて、円盤が回転すると同時に乗り物が上下に揺れる、定番の遊具です。ある遊園地のメリーゴーランドは、4人乗りの馬車が2台、2人乗りの車2台、1人乗りの馬が4台、計8台の乗り物が図1のような順序で備えられています。そして、遊園地においでのお客様は、図1に示す乗り場0〜7のどこかで待つようになっています。\n\nこの遊園地のメリーゴーランドは、かならず乗り物が乗り場にぴったりと合う位置に停止します。そして、0〜7のそれぞれで待っているお客さまは、目の前にとまった乗り物に乗ることになっています。急いで他の乗り場へ移動してそこから乗るということはできません。効率よく、お客さまにたのしんでいただくためには、メリーゴーランドの停止する位置をうまく調整して、乗れないお客さまをできるだけ少なくするようにしなければなりません。\n\n乗り場0〜7で待っているお客さまの人数を読み込んで、どの位置にどの乗り物が来るように止めれば乗れないお客さまが最も少なくなるかを出力するプログラムを作成してください。\n\n入力\n\n入力は複数のデータセットからなります。各データセットは以下の形式で与えられます。\n\np0 p1 p2 p3 p4 p5 p6 p7\n\n乗り場 0, 1, ..., 7 で待っているお客様の人数を表す整数 p0, p1,... , p7 ( 0 ≤ pi ≤ 10,000) が空白区切りで1行に与えられます。\n\n出力\n\nメリーゴーランドの乗り物の馬車を 4、車を 2、馬を 1 で表すこととします。乗り場 0, 1, ... , 7 にとめる乗り物を、それぞれ c0, c1,..., c7 とします。データセットごとに、c0, c1,..., c7 を空白区切りで 1 行に出力します。\n\nなお、乗れなくなるお客さまが最小となるとめ方が複数ある場合は、c0c1c2c3c4c5c6c7 を 8 桁の整数 V とみなし、V が最小となるとめ方を選ぶものとします。\n\nデータセットの数は 100 を超えません。\n\nSample Input\n\n2 3 1 4 0 1 0 1\n4 2 3 2 2 2 1 1\n\nOutput for the Sample Input\n\n1 4 1 4 1 2 1 2\n4 1 4 1 2 1 2 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 932, "cpu_time_ms": 20, "memory_kb": 4260}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s326426934", "group_id": "codeNet:p00091", "input_text": "n_drop, cloth = int(input()), [[int(i) for i in input().split()] for _ in range(10)]\nn_stain = sum(sum(i) for i in cloth)\nn = (n_stain - 5 * n_drop) // 4\n\ndrops_candidate = []\ndl = 0\nwhile 2 * dl <= n:\n dm = n - 2 * dl\n ds = n_drop - dm - dl\n if ds >= 0:\n drops_candidate.append([ds, dm, dl])\n dl += 1\n\ndx = (0, -1, 1, 0, 0, -1, -1, 1, 1, -2, 2, 0, 0)\ndy = (0, 0, 0, -1, 1, -1, 1, -1, 1, 0, 0, -2, 2)\ndd = (5, 9, 13)\n\n\ndef find(cloth, drops, pointer):\n global dy, dx, dd\n for p in range(pointer, 100):\n if cloth[p // 10][p % 10]:\n break\n pointer += 1\n for d in range(3):\n if not drops[d]:\n continue\n dn = dd[d]\n mir = int(d == 2)\n mar = 9 - mir\n for i in range(dn):\n x, y = pointer % 10 + dx[i], pointer // 10 + dy[i]\n if not mir < x < mar or not mir < y < mar:\n continue\n for j in range(dn):\n if not cloth[y + dy[j]][x + dx[j]]:\n break\n else:\n for j in range(dn):\n cloth[y + dy[j]][x + dx[j]] -= 1\n drops[d] -= 1\n if sum(drops):\n result = find(cloth, drops, pointer)\n if result:\n result.append((x, y, d + 1))\n return result\n for i in range(dn):\n cloth[y + dy[i]][x + dx[i]] += 1\n drops[d] += 1\n else:\n return [(x, y, d + 1)]\n return False\n\n\nfor drops in drops_candidate:\n history = find(cloth, drops, 0)\n if history != False:\n for h in history:\n print(*h)\n break", "language": "Python", "metadata": {"date": 1452959687, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p00091.html", "problem_id": "p00091", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p00091/input.txt", "sample_output_relpath": "derived/input_output/data/p00091/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p00091/Python/s326426934.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s326426934", "user_id": "u797673668"}, "prompt_components": {"gold_output": "3 2 1\n8 4 2\n", "input_to_evaluate": "n_drop, cloth = int(input()), [[int(i) for i in input().split()] for _ in range(10)]\nn_stain = sum(sum(i) for i in cloth)\nn = (n_stain - 5 * n_drop) // 4\n\ndrops_candidate = []\ndl = 0\nwhile 2 * dl <= n:\n dm = n - 2 * dl\n ds = n_drop - dm - dl\n if ds >= 0:\n drops_candidate.append([ds, dm, dl])\n dl += 1\n\ndx = (0, -1, 1, 0, 0, -1, -1, 1, 1, -2, 2, 0, 0)\ndy = (0, 0, 0, -1, 1, -1, 1, -1, 1, 0, 0, -2, 2)\ndd = (5, 9, 13)\n\n\ndef find(cloth, drops, pointer):\n global dy, dx, dd\n for p in range(pointer, 100):\n if cloth[p // 10][p % 10]:\n break\n pointer += 1\n for d in range(3):\n if not drops[d]:\n continue\n dn = dd[d]\n mir = int(d == 2)\n mar = 9 - mir\n for i in range(dn):\n x, y = pointer % 10 + dx[i], pointer // 10 + dy[i]\n if not mir < x < mar or not mir < y < mar:\n continue\n for j in range(dn):\n if not cloth[y + dy[j]][x + dx[j]]:\n break\n else:\n for j in range(dn):\n cloth[y + dy[j]][x + dx[j]] -= 1\n drops[d] -= 1\n if sum(drops):\n result = find(cloth, drops, pointer)\n if result:\n result.append((x, y, d + 1))\n return result\n for i in range(dn):\n cloth[y + dy[i]][x + dx[i]] += 1\n drops[d] += 1\n else:\n return [(x, y, d + 1)]\n return False\n\n\nfor drops in drops_candidate:\n history = find(cloth, drops, 0)\n if history != False:\n for h in history:\n print(*h)\n break", "problem_context": "Blur\n\n図 1 のような 10×10 のマス目の「布」があり、(1,2)のようにX座標・Y座標の値の対でマス目を示すことにします。座標値は 0 から始まる整数とします。例えば、図 1 の◎の座標は (1, 2) です。\nこの「布」に染料を少しずつたらして染物を作ります。たらす染料の滴には「大」「中」「小」の 3 サイズがあり、染料の滴の落ちたマス目を中心に図 1 のように周囲も色がつきます。図 1 で☆が中心、○が色のにじむ範囲です。\n\n「布」は、最初は「まっしろ」つまり、どのマス目も色の濃さを示す値が 0 とします。染料の滴が落ちるごとに値が 1 ずつ増えていきます。「小」が(1, 2)、「中」が(3, 2)に落ちた場合、各マス目の値は図 2 の左のようになります。染料がもったいないので、図 2 の右に示すようなにじむ範囲が布の外にはみ出すような染料の落とし方はしないことになっています。また、同じ場所に複数の染料をたらすこともあります。\n\nこのような作業を何回か繰り返した結果、布にすばらしい模様が浮かび上がりましたが、残念なことに、うっかり作業経過を記録し忘れてしまいました。どうにもさっぱり思い出せませんが、かろうじて、落とした染料の滴数は覚えていました。あなたは、すばらしい染物を再現しなければなりません。すばらしい染物のデータを読みこんで、どこに、どのような染料をたらしたかを出力するプログラムを作成してください。なお、落とした染料の滴数は 12 以下とします。\n\n入力\n\n入力の形式は以下のとおりです:\n\n最初の 1 行に落とした染料の滴数 n が与えられます。次の行から 10 行に各座標の色の濃さが空白区切りで与えられます。\n\n出力\n\n出力は n 行からなります。染料の滴の「大」を 3、「中」を 2、「小」を 1 で表し、落とした染料ごとに、そのX座標、Y座標、滴の大きさを空白で区切って1行に出力してください。\n\n染料のたらし方はどのような順番で出力しても良いものとします。\n\n入力例1\n\n2\n0 0 0 0 0 0 0 0 0 0\n0 0 0 1 0 0 0 0 0 0\n0 0 1 1 1 0 0 0 0 0\n0 0 0 1 0 0 0 1 1 1\n0 0 0 0 0 0 0 1 1 1\n0 0 0 0 0 0 0 1 1 1\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n\n出力例1\n\n3 2 1\n8 4 2\n\n入力例2\n\n6\n0 0 1 0 0 0 0 0 0 0\n0 1 1 1 0 0 0 0 0 0\n1 1 1 1 1 1 1 1 0 0\n0 1 1 1 1 1 1 1 0 0\n0 0 1 1 1 3 1 1 0 0\n0 0 1 1 3 1 1 1 0 0\n0 0 1 1 1 1 1 1 1 0\n0 0 1 1 1 1 1 1 1 1\n0 0 0 0 0 0 1 1 1 0\n0 0 0 0 0 0 0 1 0 0\n\n出力例2\n\n2 2 3\n7 7 3\n6 3 2\n3 6 2\n4 4 1\n5 5 1", "sample_input": "2\n0 0 0 0 0 0 0 0 0 0\n0 0 0 1 0 0 0 0 0 0\n0 0 1 1 1 0 0 0 0 0\n0 0 0 1 0 0 0 1 1 1\n0 0 0 0 0 0 0 1 1 1\n0 0 0 0 0 0 0 1 1 1\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n"}, "reference_outputs": ["3 2 1\n8 4 2\n"], "source_document_id": "p00091", "source_text": "Blur\n\n図 1 のような 10×10 のマス目の「布」があり、(1,2)のようにX座標・Y座標の値の対でマス目を示すことにします。座標値は 0 から始まる整数とします。例えば、図 1 の◎の座標は (1, 2) です。\nこの「布」に染料を少しずつたらして染物を作ります。たらす染料の滴には「大」「中」「小」の 3 サイズがあり、染料の滴の落ちたマス目を中心に図 1 のように周囲も色がつきます。図 1 で☆が中心、○が色のにじむ範囲です。\n\n「布」は、最初は「まっしろ」つまり、どのマス目も色の濃さを示す値が 0 とします。染料の滴が落ちるごとに値が 1 ずつ増えていきます。「小」が(1, 2)、「中」が(3, 2)に落ちた場合、各マス目の値は図 2 の左のようになります。染料がもったいないので、図 2 の右に示すようなにじむ範囲が布の外にはみ出すような染料の落とし方はしないことになっています。また、同じ場所に複数の染料をたらすこともあります。\n\nこのような作業を何回か繰り返した結果、布にすばらしい模様が浮かび上がりましたが、残念なことに、うっかり作業経過を記録し忘れてしまいました。どうにもさっぱり思い出せませんが、かろうじて、落とした染料の滴数は覚えていました。あなたは、すばらしい染物を再現しなければなりません。すばらしい染物のデータを読みこんで、どこに、どのような染料をたらしたかを出力するプログラムを作成してください。なお、落とした染料の滴数は 12 以下とします。\n\n入力\n\n入力の形式は以下のとおりです:\n\n最初の 1 行に落とした染料の滴数 n が与えられます。次の行から 10 行に各座標の色の濃さが空白区切りで与えられます。\n\n出力\n\n出力は n 行からなります。染料の滴の「大」を 3、「中」を 2、「小」を 1 で表し、落とした染料ごとに、そのX座標、Y座標、滴の大きさを空白で区切って1行に出力してください。\n\n染料のたらし方はどのような順番で出力しても良いものとします。\n\n入力例1\n\n2\n0 0 0 0 0 0 0 0 0 0\n0 0 0 1 0 0 0 0 0 0\n0 0 1 1 1 0 0 0 0 0\n0 0 0 1 0 0 0 1 1 1\n0 0 0 0 0 0 0 1 1 1\n0 0 0 0 0 0 0 1 1 1\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n\n出力例1\n\n3 2 1\n8 4 2\n\n入力例2\n\n6\n0 0 1 0 0 0 0 0 0 0\n0 1 1 1 0 0 0 0 0 0\n1 1 1 1 1 1 1 1 0 0\n0 1 1 1 1 1 1 1 0 0\n0 0 1 1 1 3 1 1 0 0\n0 0 1 1 3 1 1 1 0 0\n0 0 1 1 1 1 1 1 1 0\n0 0 1 1 1 1 1 1 1 1\n0 0 0 0 0 0 1 1 1 0\n0 0 0 0 0 0 0 1 0 0\n\n出力例2\n\n2 2 3\n7 7 3\n6 3 2\n3 6 2\n4 4 1\n5 5 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1732, "cpu_time_ms": 40, "memory_kb": 7916}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s845310303", "group_id": "codeNet:p00163", "input_text": "# Highway Toll\n\nPRICE_LIST = (\n (0, 0, 0, 0, 0, 0, 0, 0),\n (0, 0, 300, 500, 600, 700, 1350, 1650),\n (0, 6, 0, 350, 450, 600, 1150, 1500),\n (0, 13, 7, 0, 250, 400, 1000, 1350),\n (0, 18, 12, 5, 0, 250, 850, 1300),\n (0, 23, 17, 10, 5, 0, 600, 1150),\n (0, 43, 37, 30, 25, 20, 0, 500),\n (0, 58, 52, 45, 40, 35, 15, 0),\n)\n\nwhile True:\n i = int(raw_input())\n if i == 0:\n break\n\n it = int(raw_input().strip().replace(' ', ''))\n o = int(raw_input())\n ot = int(raw_input().strip().replace(' ', ''))\n\n half = False\n if 1730 <= it <= 1930 or 1730 <= ot <= 1930:\n half = True\n\n if PRICE_LIST[o][i] <= 40:\n half &= True\n\n p = PRICE_LIST[i][o]\n if half:\n print (p // 100) * 50 if p % 100 == 0 else (p // 100 + 1) * 50\n else:\n print p", "language": "Python", "metadata": {"date": 1373454680, "filename_ext": "py", "original_language": "Python", "problem_description_relpath": "problem_descriptions/p00163.html", "problem_id": "p00163", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p00163/input.txt", "sample_output_relpath": "derived/input_output/data/p00163/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p00163/Python/s845310303.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s845310303", "user_id": "u759934006"}, "prompt_components": {"gold_output": "250\n1300\n", "input_to_evaluate": "# Highway Toll\n\nPRICE_LIST = (\n (0, 0, 0, 0, 0, 0, 0, 0),\n (0, 0, 300, 500, 600, 700, 1350, 1650),\n (0, 6, 0, 350, 450, 600, 1150, 1500),\n (0, 13, 7, 0, 250, 400, 1000, 1350),\n (0, 18, 12, 5, 0, 250, 850, 1300),\n (0, 23, 17, 10, 5, 0, 600, 1150),\n (0, 43, 37, 30, 25, 20, 0, 500),\n (0, 58, 52, 45, 40, 35, 15, 0),\n)\n\nwhile True:\n i = int(raw_input())\n if i == 0:\n break\n\n it = int(raw_input().strip().replace(' ', ''))\n o = int(raw_input())\n ot = int(raw_input().strip().replace(' ', ''))\n\n half = False\n if 1730 <= it <= 1930 or 1730 <= ot <= 1930:\n half = True\n\n if PRICE_LIST[o][i] <= 40:\n half &= True\n\n p = PRICE_LIST[i][o]\n if half:\n print (p // 100) * 50 if p % 100 == 0 else (p // 100 + 1) * 50\n else:\n print p", "problem_context": "有料道路通行料\n\n20XX年に喜多方市熱塩加納町から南会津町までの6区間、総距離58kmの会津中央道路が完成し開通する予定です。\n\n開通後、半年間は利用促進のため17時30分〜19時30分までに出発ICか到着ICを通過し、なおかつ走行距離が40km以下の車に対する通行料金は半額になります。ただし料金は50円単位とし、端数は切り上げます。下記の表は料金と距離の一覧表です。\n\n例えば喜多方(2)から会津若松(4)までは料金が450円、距離が12kmとなります。半額時間帯であれば250円になります。\n\n出発IC、出発IC通過時刻、到着IC、到着IC通過時刻を入力とし、料金を計算して出力するプログラムを作成してください。ただし、入力される時刻は24 時間表記の値とします。なお、17時30分および19時30分ちょうどに通過した場合も半額時間帯に含めます。\n\nInput\n\n複数のデータセットの並びが入力として与えられます。入力の終わりはゼロひとつの行で示されます。\n各データセットは以下の形式で与えられます。\n\nd\nhd md\na\nha ma\n\n1行目に出発ICの番号 d (1 ≤ d ≤ 7)、2行目に出発ICの通過時刻の時間 hd (0 ≤ hd ≤ 23) と分 md (0 ≤ md ≤ 59) が与えられます。\n\n3行目に到着ICの番号 a (1 ≤ a ≤ 7)、4行目に到着ICの通過時刻の時間 ha (0 ≤ ha ≤ 23) と分 ma (0 ≤ ma ≤ 59) が与えられます。\n\nOutput\n\nデータセットごとに通行料金(整数)を1行に出力します。\n\nSample Input\n\n2\n17 25\n4\n17 45\n4\n17 25\n7\n19 35\n0\n\nOutput for the Sample Input\n\n250\n1300", "sample_input": "2\n17 25\n4\n17 45\n4\n17 25\n7\n19 35\n0\n"}, "reference_outputs": ["250\n1300\n"], "source_document_id": "p00163", "source_text": "有料道路通行料\n\n20XX年に喜多方市熱塩加納町から南会津町までの6区間、総距離58kmの会津中央道路が完成し開通する予定です。\n\n開通後、半年間は利用促進のため17時30分〜19時30分までに出発ICか到着ICを通過し、なおかつ走行距離が40km以下の車に対する通行料金は半額になります。ただし料金は50円単位とし、端数は切り上げます。下記の表は料金と距離の一覧表です。\n\n例えば喜多方(2)から会津若松(4)までは料金が450円、距離が12kmとなります。半額時間帯であれば250円になります。\n\n出発IC、出発IC通過時刻、到着IC、到着IC通過時刻を入力とし、料金を計算して出力するプログラムを作成してください。ただし、入力される時刻は24 時間表記の値とします。なお、17時30分および19時30分ちょうどに通過した場合も半額時間帯に含めます。\n\nInput\n\n複数のデータセットの並びが入力として与えられます。入力の終わりはゼロひとつの行で示されます。\n各データセットは以下の形式で与えられます。\n\nd\nhd md\na\nha ma\n\n1行目に出発ICの番号 d (1 ≤ d ≤ 7)、2行目に出発ICの通過時刻の時間 hd (0 ≤ hd ≤ 23) と分 md (0 ≤ md ≤ 59) が与えられます。\n\n3行目に到着ICの番号 a (1 ≤ a ≤ 7)、4行目に到着ICの通過時刻の時間 ha (0 ≤ ha ≤ 23) と分 ma (0 ≤ ma ≤ 59) が与えられます。\n\nOutput\n\nデータセットごとに通行料金(整数)を1行に出力します。\n\nSample Input\n\n2\n17 25\n4\n17 45\n4\n17 25\n7\n19 35\n0\n\nOutput for the Sample Input\n\n250\n1300", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 810, "cpu_time_ms": 20, "memory_kb": 4296}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s587416852", "group_id": "codeNet:p00188", "input_text": "def bisect(L,a):\n n = len(L)\n if n < 1 or L[n/2] == a:\n return 1\n if L[n/2] > a:\n return bisect(L[:n/2],a) + 1\n return bisect(L[n/2+1:],a) + 1\n\nwhile True:\n n = input()\n if n == 0:\n break\n print bisect([input() for _ in xrange(n)],input())", "language": "Python", "metadata": {"date": 1385099373, "filename_ext": "py", "original_language": "Python", "problem_description_relpath": "problem_descriptions/p00188.html", "problem_id": "p00188", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p00188/input.txt", "sample_output_relpath": "derived/input_output/data/p00188/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p00188/Python/s587416852.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s587416852", "user_id": "u647766105"}, "prompt_components": {"gold_output": "3\n3\n", "input_to_evaluate": "def bisect(L,a):\n n = len(L)\n if n < 1 or L[n/2] == a:\n return 1\n if L[n/2] > a:\n return bisect(L[:n/2],a) + 1\n return bisect(L[n/2+1:],a) + 1\n\nwhile True:\n n = input()\n if n == 0:\n break\n print bisect([input() for _ in xrange(n)],input())", "problem_context": "探索\n\n「探索」とは、たくさんの情報の中から望みの情報を得る操作のことです。身近な例では、合格発表の時の「たくさんの受験番号から自分の受験番号を見つける」ことや、電話帳から「会津太郎さんの電話番号を見つける」ときなどがあります。この探索という操作はコンピュータの分野でも広く用いられています。\n\n探索の方法は沢山あります。探索の対象となるデータが、小さい順(または大きい順)に並べられている場合に使うことができる探索の方法を考えます。\n\n小さい順(または大きい順)に並べられているデータ列の中央に位置する値と目的の値との大小関係を用いて、中央に位置する値から前半部分を探索範囲にするか後半部分を探索範囲にするかを決めることで、探索の範囲を絞っていく方法があります。手順は以下のようになります。\n\nデータの列の全体を探索の範囲とします。\n\n探索の範囲の中央に位置する値を調べます。\n\n目的の値と中央に位置する値が一致すれば探索を終了します。\n\n目的の値と中央に位置する値よりも小さければ前半部分を探索の範囲とし、大きければ後半部分を探索の範囲として2.へ戻ります。\n\n以下は上述した探索の方法の例です。この例での目的の値は51です。それぞれのデータには番号\n(index)が振られており、この番号は0から始まっています。\n\nステップ1: 最初は番号0~6全体を探索の範囲とします。\n\nステップ2: 探索の範囲の中央に位置する値を調べます。ただし、「中央に位置する値」とは、(左側の番号+右側の番号)を2で割った番号の位置にある値とします。つまり、この場合、(0 + 6) ÷ 2 を計算し、番号3にある値(36)が中央に位置する値となります。\n\nステップ3:目的の値(51)と中央に位置する値(36)を比較します。\n\nステップ4:ステップ3の結果から、目的の値は中央に位置する値より大きいので、後半部分にあたる番号4 (中央に位置する値の隣)以降を探索の範囲とします。同様の手順で探索の範囲の中央に位置する値を調べ、目的の値が中央に位置する値より小さければ前半部分を探索の範囲とし、大きければ後半部分を探索の範囲として、探索の範囲を小さくしていきます。(ステップ2~ステップ4の繰り返し)目的の値が中央に位置する値と一致するか、探索の範囲がつきてしまった時に探索を終了します。\n\nn 個の数値の配列を入力とし、目的の値と中央に位置する値を比較した回数を出力するプログラムを作成してください。ただし、中央に位置する値の番号を計算したとき、割り切れない場合は、小数点以下を切り捨てた値をその番号とすることとします。\n与えられるデータ列は小さい順に整列されているものとします。\n\nInput\n\n複数のデータセットの並びが入力として与えられます。入力の終わりはゼロひとつの行で示されます。 各データセットは以下の形式で与えられます。\n\nn\na1\na2\n:\nan\nk\n\n1 行目に数値の数 n (1 ≤ n ≤ 100) 、続く n 行に i 個目の数値 ai (1 ≤ ai ≤ 100000, 整数) が与えられます。\n\n続く行に探索する値 k (1 ≤ k ≤ 100000) が与えられます。\n\nOutput\n\nデータセット毎に探索が終わるまでの比較回数を1行に出力します。\n\nSample Input\n\n7\n11\n15\n23\n36\n51\n61\n86\n51\n4\n1\n2\n3\n5\n4\n0\n\nOutput for the Sample Input\n\n3\n3", "sample_input": "7\n11\n15\n23\n36\n51\n61\n86\n51\n4\n1\n2\n3\n5\n4\n0\n"}, "reference_outputs": ["3\n3\n"], "source_document_id": "p00188", "source_text": "探索\n\n「探索」とは、たくさんの情報の中から望みの情報を得る操作のことです。身近な例では、合格発表の時の「たくさんの受験番号から自分の受験番号を見つける」ことや、電話帳から「会津太郎さんの電話番号を見つける」ときなどがあります。この探索という操作はコンピュータの分野でも広く用いられています。\n\n探索の方法は沢山あります。探索の対象となるデータが、小さい順(または大きい順)に並べられている場合に使うことができる探索の方法を考えます。\n\n小さい順(または大きい順)に並べられているデータ列の中央に位置する値と目的の値との大小関係を用いて、中央に位置する値から前半部分を探索範囲にするか後半部分を探索範囲にするかを決めることで、探索の範囲を絞っていく方法があります。手順は以下のようになります。\n\nデータの列の全体を探索の範囲とします。\n\n探索の範囲の中央に位置する値を調べます。\n\n目的の値と中央に位置する値が一致すれば探索を終了します。\n\n目的の値と中央に位置する値よりも小さければ前半部分を探索の範囲とし、大きければ後半部分を探索の範囲として2.へ戻ります。\n\n以下は上述した探索の方法の例です。この例での目的の値は51です。それぞれのデータには番号\n(index)が振られており、この番号は0から始まっています。\n\nステップ1: 最初は番号0~6全体を探索の範囲とします。\n\nステップ2: 探索の範囲の中央に位置する値を調べます。ただし、「中央に位置する値」とは、(左側の番号+右側の番号)を2で割った番号の位置にある値とします。つまり、この場合、(0 + 6) ÷ 2 を計算し、番号3にある値(36)が中央に位置する値となります。\n\nステップ3:目的の値(51)と中央に位置する値(36)を比較します。\n\nステップ4:ステップ3の結果から、目的の値は中央に位置する値より大きいので、後半部分にあたる番号4 (中央に位置する値の隣)以降を探索の範囲とします。同様の手順で探索の範囲の中央に位置する値を調べ、目的の値が中央に位置する値より小さければ前半部分を探索の範囲とし、大きければ後半部分を探索の範囲として、探索の範囲を小さくしていきます。(ステップ2~ステップ4の繰り返し)目的の値が中央に位置する値と一致するか、探索の範囲がつきてしまった時に探索を終了します。\n\nn 個の数値の配列を入力とし、目的の値と中央に位置する値を比較した回数を出力するプログラムを作成してください。ただし、中央に位置する値の番号を計算したとき、割り切れない場合は、小数点以下を切り捨てた値をその番号とすることとします。\n与えられるデータ列は小さい順に整列されているものとします。\n\nInput\n\n複数のデータセットの並びが入力として与えられます。入力の終わりはゼロひとつの行で示されます。 各データセットは以下の形式で与えられます。\n\nn\na1\na2\n:\nan\nk\n\n1 行目に数値の数 n (1 ≤ n ≤ 100) 、続く n 行に i 個目の数値 ai (1 ≤ ai ≤ 100000, 整数) が与えられます。\n\n続く行に探索する値 k (1 ≤ k ≤ 100000) が与えられます。\n\nOutput\n\nデータセット毎に探索が終わるまでの比較回数を1行に出力します。\n\nSample Input\n\n7\n11\n15\n23\n36\n51\n61\n86\n51\n4\n1\n2\n3\n5\n4\n0\n\nOutput for the Sample Input\n\n3\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 281, "cpu_time_ms": 20, "memory_kb": 4220}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s222504748", "group_id": "codeNet:p00271", "input_text": "def put_dif():\n a, b = map(int, input().split())\n print(a - b)\n\nfor _ in range(7):\n put_dif()\n\n", "language": "Python", "metadata": {"date": 1530265871, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p00271.html", "problem_id": "p00271", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p00271/input.txt", "sample_output_relpath": "derived/input_output/data/p00271/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p00271/Python/s222504748.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s222504748", "user_id": "u352394527"}, "prompt_components": {"gold_output": "11\n19\n1\n5\n1\n13\n20\n", "input_to_evaluate": "def put_dif():\n a, b = map(int, input().split())\n print(a - b)\n\nfor _ in range(7):\n put_dif()\n\n", "problem_context": "気温の差\n\n選手の皆さん、パソコン甲子園にようこそ。イベントに参加するには体調管理が大切です。気温が大きく変動する季節の変わり目には体に負担がかかり、風邪をひきやすいと言われています。一番気を付けなければいけない日は、最高気温と最低気温の差が最も大きい日です。1日の最高気温と最低気温が7日分与えられたとき、それぞれの日について最高気温から最低気温を引いた値を出力するプログラムを作成してください。\n\n入力\n\n入力データは以下の形式で与えられる。\n\na1 b1\na2 b2\n:\na7 b7\n\n入力は7行からなり、i行目にはi日目の最高気温 ai(-40 ≤ ai ≤ 40)と最低気温 bi(-40 ≤ bi ≤ 40)を表す整数が与えられる。すべての日において、最高気温 ai は必ず最低気温 bi 以上となっている。\n\n出力\n\n7日分の気温の差を7行に出力する。\n\n入力例\n\n30 19\n39 20\n19 18\n25 20\n22 21\n23 10\n10 -10\n\n出力例\n\n11\n19\n1\n5\n1\n13\n20", "sample_input": "30 19\n39 20\n19 18\n25 20\n22 21\n23 10\n10 -10\n"}, "reference_outputs": ["11\n19\n1\n5\n1\n13\n20\n"], "source_document_id": "p00271", "source_text": "気温の差\n\n選手の皆さん、パソコン甲子園にようこそ。イベントに参加するには体調管理が大切です。気温が大きく変動する季節の変わり目には体に負担がかかり、風邪をひきやすいと言われています。一番気を付けなければいけない日は、最高気温と最低気温の差が最も大きい日です。1日の最高気温と最低気温が7日分与えられたとき、それぞれの日について最高気温から最低気温を引いた値を出力するプログラムを作成してください。\n\n入力\n\n入力データは以下の形式で与えられる。\n\na1 b1\na2 b2\n:\na7 b7\n\n入力は7行からなり、i行目にはi日目の最高気温 ai(-40 ≤ ai ≤ 40)と最低気温 bi(-40 ≤ bi ≤ 40)を表す整数が与えられる。すべての日において、最高気温 ai は必ず最低気温 bi 以上となっている。\n\n出力\n\n7日分の気温の差を7行に出力する。\n\n入力例\n\n30 19\n39 20\n19 18\n25 20\n22 21\n23 10\n10 -10\n\n出力例\n\n11\n19\n1\n5\n1\n13\n20", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 98, "cpu_time_ms": 20, "memory_kb": 5592}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s755521387", "group_id": "codeNet:p00297", "input_text": "from math import ceil\nclass sqrt_tree:\n def __init__(self,dat,f):\n self.dat = dat\n self.sq = int(len(dat) ** 0.5)\n self.f = f\n self.baqet = [self.f(dat[i * self.sq:(i + 1) * self.sq]) for i in range(self.sq)]\n \n #query\n def q(self,l,r):\n r += 1\n if ceil(l / self.sq) >= r // self.sq:\n return self.f(self.dat[l:r])\n ret = self.f(self.baqet[ceil(l / self.sq):r // self.sq])\n if l % self.sq:\n ret = self.f(ret,self.f(self.dat[l:l + self.sq]))\n if r % self.sq:\n ret = self.f(ret,self.f(self.dat[r - r % self.sq:r]))\n return ret\n\nimport sys\nf = sys.stdin\n\n_, d = map(int, f.readline().split())\n\nx,y = {},{}\nfor line in f:\n xi, yi, bi = map(int, line.split())\n if bi not in x:\n x[bi],y[bi] = [],[]\n x[bi].append(xi)\n y[bi].append(yi)\n\nb = sorted(x.keys())\n\nxmax = sqrt_tree([max(x[bi]) for bi in b],max)\nxmin = sqrt_tree([min(x[bi]) for bi in b],min)\nymax = sqrt_tree([max(y[bi]) for bi in b],max)\nymin = sqrt_tree([min(y[bi]) for bi in b],min)\n\ndef get_lr(b,d):\n l = r = 0\n while r < len(b) - 1:\n while b[l] + d < b[r]:\n l += 1\n for k in range(l,len(b)):\n if b[l] + d < b[k]:\n break\n r = k\n yield l,r\n r += 1\n l += 1\n \nmax_size = max((xmax.q(l,r) - xmin.q(l,r)) * (ymax.q(l,r) - ymin.q(l,r)) for l,r in get_lr(b,d))\nprint(max_size)", "language": "Python", "metadata": {"date": 1425080007, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p00297.html", "problem_id": "p00297", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p00297/input.txt", "sample_output_relpath": "derived/input_output/data/p00297/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p00297/Python/s755521387.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s755521387", "user_id": "u567380442"}, "prompt_components": {"gold_output": "16\n", "input_to_evaluate": "from math import ceil\nclass sqrt_tree:\n def __init__(self,dat,f):\n self.dat = dat\n self.sq = int(len(dat) ** 0.5)\n self.f = f\n self.baqet = [self.f(dat[i * self.sq:(i + 1) * self.sq]) for i in range(self.sq)]\n \n #query\n def q(self,l,r):\n r += 1\n if ceil(l / self.sq) >= r // self.sq:\n return self.f(self.dat[l:r])\n ret = self.f(self.baqet[ceil(l / self.sq):r // self.sq])\n if l % self.sq:\n ret = self.f(ret,self.f(self.dat[l:l + self.sq]))\n if r % self.sq:\n ret = self.f(ret,self.f(self.dat[r - r % self.sq:r]))\n return ret\n\nimport sys\nf = sys.stdin\n\n_, d = map(int, f.readline().split())\n\nx,y = {},{}\nfor line in f:\n xi, yi, bi = map(int, line.split())\n if bi not in x:\n x[bi],y[bi] = [],[]\n x[bi].append(xi)\n y[bi].append(yi)\n\nb = sorted(x.keys())\n\nxmax = sqrt_tree([max(x[bi]) for bi in b],max)\nxmin = sqrt_tree([min(x[bi]) for bi in b],min)\nymax = sqrt_tree([max(y[bi]) for bi in b],max)\nymin = sqrt_tree([min(y[bi]) for bi in b],min)\n\ndef get_lr(b,d):\n l = r = 0\n while r < len(b) - 1:\n while b[l] + d < b[r]:\n l += 1\n for k in range(l,len(b)):\n if b[l] + d < b[k]:\n break\n r = k\n yield l,r\n r += 1\n l += 1\n \nmax_size = max((xmax.q(l,r) - xmin.q(l,r)) * (ymax.q(l,r) - ymin.q(l,r)) for l,r in get_lr(b,d))\nprint(max_size)", "problem_context": "天体観測\n\nある晴れた夜の帰り道、空を見上げるとそこには無数の星。強く輝く星々、かすかに見える星々、いろ\nいろな明るさの星々が夜空を彩っています。\n\nあなたはふと思いました。この星空に自分の星座があったらどんなに素敵だろうと。そこであなたはひとつの基準を決め、部屋の窓から見える星々を適当につなげて自分の星座を作ることにしました。その基準とは、「どの2つの星を選んでも、それらの明るさの差がある定数 d 以下になるような星のグループを作り、その中で一番大きいものを自分の星座にしよう!」というものです。例えば、図のような窓から見える夜空を考えてみましょう(外側の長方形は窓枠です)。\n\nこの夜空には、明るさがそれぞれ 1,12, 2,4,1,8, 3,5,4 の9つの星がありますが、d = 2 とすると例えば以下のような3つの星座 A, B, C ができます。\n\n大きさが 12 の星座 A\n\n大きさが 10 の星座 B\n\n大きさが 16 の星座 C\n\n星座の大きさを次のように決めることにしました。ある星座の星をすべて含むような、窓枠に平行な辺からなる長方形のうち、面積が最も小さいものを選びます。この長方形の面積をその星座の大きさとします。例えば、上の夜空では星座 A, B, Cの大きさはそれぞれ12, 10, 16になるので、星座Cが最も大きい星座となります。\n\nN 個の星の位置と明るさ、および整数 d が与えられたとき、一番大きい星座の面積を求めるプログラムを作成してください。星の位置は窓枠の左下隅を原点とした座標で与えられ、軸は図のような向きとします。星座を構成する星が1つの場合や、星々が軸に平行な直線上にある場合は、その星座の面積は 0 となることに注意してください。\n\n入力\n\n入力は以下の形式で与えられる。\n\nN d\nx1 y1 b1\nx2 y2 b2\n:\nxN yN bN\n\n1 行目に星の数 N (1 ≤ N ≤ 200000) と整数 d (0 ≤ d ≤ 109) が与えられる。続く N 行に、i 番目の星の座標を表す整数 xi (0 ≤ xi ≤ 2000000) と yi (0 ≤ yi ≤ 2000000)、明るさを表す整数 bi (0 ≤ bi ≤ 109) が与えられる。入力される星の座標はすべて異なる。\n\n出力\n\n一番大きい星座の面積を1行に出力する。\n\n入出力例\n\n入力例\n\n9 2\n1 1 1\n1 5 12\n2 3 2\n3 2 4\n4 4 1\n5 1 3\n5 3 8\n6 5 5\n7 2 4\n\n出力例\n\n16", "sample_input": "9 2\n1 1 1\n1 5 12\n2 3 2\n3 2 4\n4 4 1\n5 1 3\n5 3 8\n6 5 5\n7 2 4\n"}, "reference_outputs": ["16\n"], "source_document_id": "p00297", "source_text": "天体観測\n\nある晴れた夜の帰り道、空を見上げるとそこには無数の星。強く輝く星々、かすかに見える星々、いろ\nいろな明るさの星々が夜空を彩っています。\n\nあなたはふと思いました。この星空に自分の星座があったらどんなに素敵だろうと。そこであなたはひとつの基準を決め、部屋の窓から見える星々を適当につなげて自分の星座を作ることにしました。その基準とは、「どの2つの星を選んでも、それらの明るさの差がある定数 d 以下になるような星のグループを作り、その中で一番大きいものを自分の星座にしよう!」というものです。例えば、図のような窓から見える夜空を考えてみましょう(外側の長方形は窓枠です)。\n\nこの夜空には、明るさがそれぞれ 1,12, 2,4,1,8, 3,5,4 の9つの星がありますが、d = 2 とすると例えば以下のような3つの星座 A, B, C ができます。\n\n大きさが 12 の星座 A\n\n大きさが 10 の星座 B\n\n大きさが 16 の星座 C\n\n星座の大きさを次のように決めることにしました。ある星座の星をすべて含むような、窓枠に平行な辺からなる長方形のうち、面積が最も小さいものを選びます。この長方形の面積をその星座の大きさとします。例えば、上の夜空では星座 A, B, Cの大きさはそれぞれ12, 10, 16になるので、星座Cが最も大きい星座となります。\n\nN 個の星の位置と明るさ、および整数 d が与えられたとき、一番大きい星座の面積を求めるプログラムを作成してください。星の位置は窓枠の左下隅を原点とした座標で与えられ、軸は図のような向きとします。星座を構成する星が1つの場合や、星々が軸に平行な直線上にある場合は、その星座の面積は 0 となることに注意してください。\n\n入力\n\n入力は以下の形式で与えられる。\n\nN d\nx1 y1 b1\nx2 y2 b2\n:\nxN yN bN\n\n1 行目に星の数 N (1 ≤ N ≤ 200000) と整数 d (0 ≤ d ≤ 109) が与えられる。続く N 行に、i 番目の星の座標を表す整数 xi (0 ≤ xi ≤ 2000000) と yi (0 ≤ yi ≤ 2000000)、明るさを表す整数 bi (0 ≤ bi ≤ 109) が与えられる。入力される星の座標はすべて異なる。\n\n出力\n\n一番大きい星座の面積を1行に出力する。\n\n入出力例\n\n入力例\n\n9 2\n1 1 1\n1 5 12\n2 3 2\n3 2 4\n4 4 1\n5 1 3\n5 3 8\n6 5 5\n7 2 4\n\n出力例\n\n16", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1451, "cpu_time_ms": 30, "memory_kb": 6952}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s266964025", "group_id": "codeNet:p00297", "input_text": "data = map(int, raw_input().split())\nstars = data[0]\nlightrange = data[1]\na = []\nfor i in range(stars):\n a.append(map(int, raw_input().split()))\na.sort(key=lambda x:x[2])\nscale = 0\nwhile(len(a)>1):\n minx=maxx=a[0][0]\n miny=maxy=a[0][1]\n l=1\n if (a[l][2] <= a[0][2] + lightrange):\n if(a[l][0]maxx):\n maxx=a[l][0]\n if(a[l][1]maxy):\n maxy=a[l][1]\n area = (maxx-minx)*(maxy-miny)\n if (area > scale):\n scale = area\n del a[0]\nprint scale", "language": "Python", "metadata": {"date": 1440572102, "filename_ext": "py", "original_language": "Python", "problem_description_relpath": "problem_descriptions/p00297.html", "problem_id": "p00297", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p00297/input.txt", "sample_output_relpath": "derived/input_output/data/p00297/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p00297/Python/s266964025.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s266964025", "user_id": "u727466163"}, "prompt_components": {"gold_output": "16\n", "input_to_evaluate": "data = map(int, raw_input().split())\nstars = data[0]\nlightrange = data[1]\na = []\nfor i in range(stars):\n a.append(map(int, raw_input().split()))\na.sort(key=lambda x:x[2])\nscale = 0\nwhile(len(a)>1):\n minx=maxx=a[0][0]\n miny=maxy=a[0][1]\n l=1\n if (a[l][2] <= a[0][2] + lightrange):\n if(a[l][0]maxx):\n maxx=a[l][0]\n if(a[l][1]maxy):\n maxy=a[l][1]\n area = (maxx-minx)*(maxy-miny)\n if (area > scale):\n scale = area\n del a[0]\nprint scale", "problem_context": "天体観測\n\nある晴れた夜の帰り道、空を見上げるとそこには無数の星。強く輝く星々、かすかに見える星々、いろ\nいろな明るさの星々が夜空を彩っています。\n\nあなたはふと思いました。この星空に自分の星座があったらどんなに素敵だろうと。そこであなたはひとつの基準を決め、部屋の窓から見える星々を適当につなげて自分の星座を作ることにしました。その基準とは、「どの2つの星を選んでも、それらの明るさの差がある定数 d 以下になるような星のグループを作り、その中で一番大きいものを自分の星座にしよう!」というものです。例えば、図のような窓から見える夜空を考えてみましょう(外側の長方形は窓枠です)。\n\nこの夜空には、明るさがそれぞれ 1,12, 2,4,1,8, 3,5,4 の9つの星がありますが、d = 2 とすると例えば以下のような3つの星座 A, B, C ができます。\n\n大きさが 12 の星座 A\n\n大きさが 10 の星座 B\n\n大きさが 16 の星座 C\n\n星座の大きさを次のように決めることにしました。ある星座の星をすべて含むような、窓枠に平行な辺からなる長方形のうち、面積が最も小さいものを選びます。この長方形の面積をその星座の大きさとします。例えば、上の夜空では星座 A, B, Cの大きさはそれぞれ12, 10, 16になるので、星座Cが最も大きい星座となります。\n\nN 個の星の位置と明るさ、および整数 d が与えられたとき、一番大きい星座の面積を求めるプログラムを作成してください。星の位置は窓枠の左下隅を原点とした座標で与えられ、軸は図のような向きとします。星座を構成する星が1つの場合や、星々が軸に平行な直線上にある場合は、その星座の面積は 0 となることに注意してください。\n\n入力\n\n入力は以下の形式で与えられる。\n\nN d\nx1 y1 b1\nx2 y2 b2\n:\nxN yN bN\n\n1 行目に星の数 N (1 ≤ N ≤ 200000) と整数 d (0 ≤ d ≤ 109) が与えられる。続く N 行に、i 番目の星の座標を表す整数 xi (0 ≤ xi ≤ 2000000) と yi (0 ≤ yi ≤ 2000000)、明るさを表す整数 bi (0 ≤ bi ≤ 109) が与えられる。入力される星の座標はすべて異なる。\n\n出力\n\n一番大きい星座の面積を1行に出力する。\n\n入出力例\n\n入力例\n\n9 2\n1 1 1\n1 5 12\n2 3 2\n3 2 4\n4 4 1\n5 1 3\n5 3 8\n6 5 5\n7 2 4\n\n出力例\n\n16", "sample_input": "9 2\n1 1 1\n1 5 12\n2 3 2\n3 2 4\n4 4 1\n5 1 3\n5 3 8\n6 5 5\n7 2 4\n"}, "reference_outputs": ["16\n"], "source_document_id": "p00297", "source_text": "天体観測\n\nある晴れた夜の帰り道、空を見上げるとそこには無数の星。強く輝く星々、かすかに見える星々、いろ\nいろな明るさの星々が夜空を彩っています。\n\nあなたはふと思いました。この星空に自分の星座があったらどんなに素敵だろうと。そこであなたはひとつの基準を決め、部屋の窓から見える星々を適当につなげて自分の星座を作ることにしました。その基準とは、「どの2つの星を選んでも、それらの明るさの差がある定数 d 以下になるような星のグループを作り、その中で一番大きいものを自分の星座にしよう!」というものです。例えば、図のような窓から見える夜空を考えてみましょう(外側の長方形は窓枠です)。\n\nこの夜空には、明るさがそれぞれ 1,12, 2,4,1,8, 3,5,4 の9つの星がありますが、d = 2 とすると例えば以下のような3つの星座 A, B, C ができます。\n\n大きさが 12 の星座 A\n\n大きさが 10 の星座 B\n\n大きさが 16 の星座 C\n\n星座の大きさを次のように決めることにしました。ある星座の星をすべて含むような、窓枠に平行な辺からなる長方形のうち、面積が最も小さいものを選びます。この長方形の面積をその星座の大きさとします。例えば、上の夜空では星座 A, B, Cの大きさはそれぞれ12, 10, 16になるので、星座Cが最も大きい星座となります。\n\nN 個の星の位置と明るさ、および整数 d が与えられたとき、一番大きい星座の面積を求めるプログラムを作成してください。星の位置は窓枠の左下隅を原点とした座標で与えられ、軸は図のような向きとします。星座を構成する星が1つの場合や、星々が軸に平行な直線上にある場合は、その星座の面積は 0 となることに注意してください。\n\n入力\n\n入力は以下の形式で与えられる。\n\nN d\nx1 y1 b1\nx2 y2 b2\n:\nxN yN bN\n\n1 行目に星の数 N (1 ≤ N ≤ 200000) と整数 d (0 ≤ d ≤ 109) が与えられる。続く N 行に、i 番目の星の座標を表す整数 xi (0 ≤ xi ≤ 2000000) と yi (0 ≤ yi ≤ 2000000)、明るさを表す整数 bi (0 ≤ bi ≤ 109) が与えられる。入力される星の座標はすべて異なる。\n\n出力\n\n一番大きい星座の面積を1行に出力する。\n\n入出力例\n\n入力例\n\n9 2\n1 1 1\n1 5 12\n2 3 2\n3 2 4\n4 4 1\n5 1 3\n5 3 8\n6 5 5\n7 2 4\n\n出力例\n\n16", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 602, "cpu_time_ms": 10, "memory_kb": 6352}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s552085775", "group_id": "codeNet:p00424", "input_text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nwhile True:\n dic = {}\n n = int(input())\n if n == 0:\n break\n\n for i in range(n):\n key, value = input().split()\n dic[key] = value\n\n ret = ''\n\n m = int(input())\n for i in range(m):\n s = input().strip()\n ret += dic.get(s, s)\n\n print(ret)", "language": "Python", "metadata": {"date": 1426593794, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p00424.html", "problem_id": "p00424", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p00424/input.txt", "sample_output_relpath": "derived/input_output/data/p00424/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p00424/Python/s552085775.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s552085775", "user_id": "u355726239"}, "prompt_components": {"gold_output": "aBC5144aba\naBC5144aba\n", "input_to_evaluate": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nwhile True:\n dic = {}\n n = int(input())\n if n == 0:\n break\n\n for i in range(n):\n key, value = input().split()\n dic[key] = value\n\n ret = ''\n\n m = int(input())\n for i in range(m):\n s = input().strip()\n ret += dic.get(s, s)\n\n print(ret)", "problem_context": "与えられた変換表にもとづき,データを変換するプログラムを作成しなさい.\n\nデータに使われている文字は英字か数字で,英字は大文字と小文字を区別する.変換表に現れる文字の順序に規則性はない.\n\n変換表は空白をはさんで前と後ろの 2 つの文字がある(文字列ではない).変換方法は,変換表のある行の前の文字がデータに現れたら,そのたびにその文字を後ろの文字に変換し出力する.変換は 1 度だけで,変換した文字がまた変換対象の文字になっても変換しない.変換表に現れない文字は変換せず,そのまま出力する.\n\n入力ファイルには,変換表(最初の n + 1 行)に続き変換するデータ(n + 2 行目以降)が書いてある. 1 行目に変換表の行数 n,続く n 行の各行は,空白をはさんで 2 つの文字,さらに続けて, n + 2 行目に変換するデータの行数 m,続く m 行の各行は 1 文字である. m ≤ 105 とする.出力は,出力例のように途中に空白や改行は入れず 1 行とせよ.\n\n入力例\n\n3\n\nA a\n\n0 5\n\n5 4\n\n10\n\nA\n\nB\n\nC\n\n0\n\n1\n\n4\n\n5\n\na\n\nb\n\nA\n\n \n\n出力例\n\naBC5144aba\n\n入力\n\n入力は複数のデータセットからなる.n が 0 のとき入力が終了する.データセットの数は 5 を超えない.\n\n出力\n\nデータセットごとに、変換後の文字列を1行に出力する.\n\n入力例\n\n3\nA a\n0 5\n5 4\n10\nA\nB\nC\n0\n1\n4\n5\na\nb\nA\n3\nA a\n0 5\n5 4\n10\nA\nB\nC\n0\n1\n4\n5\na\nb\nA\n0\n\n出力例\n\naBC5144aba\naBC5144aba\n\n各データセットの出力(変換後の文字列)の後に改行を入れること.\n\n上記問題文と自動審判に使われるデータは、情報オリンピック日本委員会が作成し公開している問題文と採点用テストデータです。", "sample_input": "3\nA a\n0 5\n5 4\n10\nA\nB\nC\n0\n1\n4\n5\na\nb\nA\n3\nA a\n0 5\n5 4\n10\nA\nB\nC\n0\n1\n4\n5\na\nb\nA\n0\n"}, "reference_outputs": ["aBC5144aba\naBC5144aba\n"], "source_document_id": "p00424", "source_text": "与えられた変換表にもとづき,データを変換するプログラムを作成しなさい.\n\nデータに使われている文字は英字か数字で,英字は大文字と小文字を区別する.変換表に現れる文字の順序に規則性はない.\n\n変換表は空白をはさんで前と後ろの 2 つの文字がある(文字列ではない).変換方法は,変換表のある行の前の文字がデータに現れたら,そのたびにその文字を後ろの文字に変換し出力する.変換は 1 度だけで,変換した文字がまた変換対象の文字になっても変換しない.変換表に現れない文字は変換せず,そのまま出力する.\n\n入力ファイルには,変換表(最初の n + 1 行)に続き変換するデータ(n + 2 行目以降)が書いてある. 1 行目に変換表の行数 n,続く n 行の各行は,空白をはさんで 2 つの文字,さらに続けて, n + 2 行目に変換するデータの行数 m,続く m 行の各行は 1 文字である. m ≤ 105 とする.出力は,出力例のように途中に空白や改行は入れず 1 行とせよ.\n\n入力例\n\n3\n\nA a\n\n0 5\n\n5 4\n\n10\n\nA\n\nB\n\nC\n\n0\n\n1\n\n4\n\n5\n\na\n\nb\n\nA\n\n \n\n出力例\n\naBC5144aba\n\n入力\n\n入力は複数のデータセットからなる.n が 0 のとき入力が終了する.データセットの数は 5 を超えない.\n\n出力\n\nデータセットごとに、変換後の文字列を1行に出力する.\n\n入力例\n\n3\nA a\n0 5\n5 4\n10\nA\nB\nC\n0\n1\n4\n5\na\nb\nA\n3\nA a\n0 5\n5 4\n10\nA\nB\nC\n0\n1\n4\n5\na\nb\nA\n0\n\n出力例\n\naBC5144aba\naBC5144aba\n\n各データセットの出力(変換後の文字列)の後に改行を入れること.\n\n上記問題文と自動審判に使われるデータは、情報オリンピック日本委員会が作成し公開している問題文と採点用テストデータです。", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 339, "cpu_time_ms": 340, "memory_kb": 7168}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s900830923", "group_id": "codeNet:p00762", "input_text": "#! cat input | python3 main.py\ndef debug():\n for X in field[size//2:] + field[:size//2]:\n print(X[size//2:], X[:size//2])\n\ndice_data = [[],\n [4, 2, 3, 5],\n [4, 6, 3, 1],\n [6, 5, 1, 2],\n [1, 5, 6, 2],\n [4, 1, 3, 6],\n [4, 5, 3, 2],\n ]\ndef dice(t, f):\n i = dice_data[t].index(f)\n return [dice_data[t][x%4] for x in range(i, i + 4)]\n\nsize = 6\nmove = [[-1, 0], [0, 1], [1, 0], [0, -1]]\n\ndef drop(t, f, nowl, nowr):\n target = list(map(lambda x: x > 3, dice(t, f)))\n now = [nowl, nowr]\n \n now_field = field[now[0]][now[1]]\n for i, tg in enumerate(target):\n if tg:\n nb_field = field[now[0] + move[i][0]][now[1] + move[i][1]]\n if nb_field[1] >= now_field[1]:\n target[i] = False\n for i, v in sorted(enumerate(dice(t, f)), key=lambda x: x[1], reverse=True):\n if target[i]:\n if i == 0:\n f = t\n elif i == 2:\n f = 7 - t\n t = 7 - v\n drop(t, f, now[0] + move[i][0], now[1] + move[i][1])\n break\n else:\n change = field[now[0]][now[1]]\n change[0] = t\n change[1] += 1\n\nwhile True:\n n = int(input())\n if not n: break\n field = [[[0, 0] for i in range(size)] for j in range(size)]\n\n tfs = [list(map(int, input().split())) for x in range(n)]\n for t, f in tfs:\n drop(t, f, 0, 0)\n cnt = [0 for x in range(7)]\n for row in field:\n for cell in row:\n cnt[cell[0]] += 1\n print(*cnt[1:])", "language": "Python", "metadata": {"date": 1499740247, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p00762.html", "problem_id": "p00762", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p00762/input.txt", "sample_output_relpath": "derived/input_output/data/p00762/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p00762/Python/s900830923.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s900830923", "user_id": "u667806071"}, "prompt_components": {"gold_output": "0 1 1 0 0 1\n1 0 0 0 1 0\n1 2 2 1 0 0\n2 3 0 0 0 0\n", "input_to_evaluate": "#! cat input | python3 main.py\ndef debug():\n for X in field[size//2:] + field[:size//2]:\n print(X[size//2:], X[:size//2])\n\ndice_data = [[],\n [4, 2, 3, 5],\n [4, 6, 3, 1],\n [6, 5, 1, 2],\n [1, 5, 6, 2],\n [4, 1, 3, 6],\n [4, 5, 3, 2],\n ]\ndef dice(t, f):\n i = dice_data[t].index(f)\n return [dice_data[t][x%4] for x in range(i, i + 4)]\n\nsize = 6\nmove = [[-1, 0], [0, 1], [1, 0], [0, -1]]\n\ndef drop(t, f, nowl, nowr):\n target = list(map(lambda x: x > 3, dice(t, f)))\n now = [nowl, nowr]\n \n now_field = field[now[0]][now[1]]\n for i, tg in enumerate(target):\n if tg:\n nb_field = field[now[0] + move[i][0]][now[1] + move[i][1]]\n if nb_field[1] >= now_field[1]:\n target[i] = False\n for i, v in sorted(enumerate(dice(t, f)), key=lambda x: x[1], reverse=True):\n if target[i]:\n if i == 0:\n f = t\n elif i == 2:\n f = 7 - t\n t = 7 - v\n drop(t, f, now[0] + move[i][0], now[1] + move[i][1])\n break\n else:\n change = field[now[0]][now[1]]\n change[0] = t\n change[1] += 1\n\nwhile True:\n n = int(input())\n if not n: break\n field = [[[0, 0] for i in range(size)] for j in range(size)]\n\n tfs = [list(map(int, input().split())) for x in range(n)]\n for t, f in tfs:\n drop(t, f, 0, 0)\n cnt = [0 for x in range(7)]\n for row in field:\n for cell in row:\n cnt[cell[0]] += 1\n print(*cnt[1:])", "problem_context": "Biased Dice\n\nProfessor Random, known for his research on randomized algorithms, is now conducting an experiment on biased dice. His experiment consists of dropping a number of dice onto a plane, one after another from a fixed position above the plane. The dice fall onto the plane or dice already there, without rotating, and may roll and fall according to their property. Then he observes and records the status of the stack formed on the plane, specifically, how many times each number appears on the faces visible from above. All the dice have the same size and their face numbering is identical, which we show in Figure C-1.\n\nFigure C-1: Numbering of a die\n\nThe dice have very special properties, as in the following.\n\n(1) Ordinary dice can roll in four directions, but the dice used in this experiment never roll in the directions of faces 1, 2 and 3; they can only roll in the directions of faces 4, 5 and 6. In the situation shown in Figure C-2, our die can only roll to one of two directions.\n\nFigure C-2: An ordinary die and a biased die\n\n(2) The die can only roll when it will fall down after rolling, as shown in Figure C-3. When multiple possibilities exist, the die rolls towards the face with the largest number among those directions it can roll to.\n\nFigure C-3: A die can roll only when it can fall\n\n(3) When a die rolls, it rolls exactly 90 degrees, and then falls straight down until its bottom face touches another die or the plane, as in the case [B] or [C] of Figure C-4.\n\n(4) After rolling and falling, the die repeatedly does so according to the rules (1) to (3) above.\n\nFigure C-4: Example stacking of biased dice\n\nFor example, when we drop four dice all in the same orientation, 6 at the top and 4 at the front, then a stack will be formed as shown in Figure C-4.\n\nFigure C-5: Example records\n\nAfter forming the stack, we count the numbers of faces with 1 through 6 visible from above and record them. For example, in the left case of Figure C-5, the record will be \"0 2 1 0 0 0\", and in the right case, \"0 1 1 0 0 1\".\n\nInput\n\nThe input consists of several datasets each in the following format.\n\nn\n\nt1  f1\n\nt2  f2\n\n...\n\ntn  fn\n\nHere, n (1 ≤ n ≤ 100) is an integer and is the number of the dice to be dropped. ti and fi (1 ≤ ti, fi ≤ 6) are two integers separated by a space and represent the numbers on the top and the front faces of the i-th die, when it is released, respectively.\n\nThe end of the input is indicated by a line containing a single zero.\n\nOutput\n\nFor each dataset, output six integers separated by a space. The integers represent the numbers of faces with 1 through 6 correspondingly, visible from above. There may not be any other characters in the output.\n\nSample Input\n\n4\n6 4\n6 4\n6 4\n6 4\n2\n5 3\n5 3\n8\n4 2\n4 2\n4 2\n4 2\n4 2\n4 2\n4 2\n4 2\n6\n4 6\n1 5\n2 3\n5 3\n2 4\n4 2\n0\n\nOutput for the Sample Input\n\n0 1 1 0 0 1\n1 0 0 0 1 0\n1 2 2 1 0 0\n2 3 0 0 0 0", "sample_input": "4\n6 4\n6 4\n6 4\n6 4\n2\n5 3\n5 3\n8\n4 2\n4 2\n4 2\n4 2\n4 2\n4 2\n4 2\n4 2\n6\n4 6\n1 5\n2 3\n5 3\n2 4\n4 2\n0\n"}, "reference_outputs": ["0 1 1 0 0 1\n1 0 0 0 1 0\n1 2 2 1 0 0\n2 3 0 0 0 0\n"], "source_document_id": "p00762", "source_text": "Biased Dice\n\nProfessor Random, known for his research on randomized algorithms, is now conducting an experiment on biased dice. His experiment consists of dropping a number of dice onto a plane, one after another from a fixed position above the plane. The dice fall onto the plane or dice already there, without rotating, and may roll and fall according to their property. Then he observes and records the status of the stack formed on the plane, specifically, how many times each number appears on the faces visible from above. All the dice have the same size and their face numbering is identical, which we show in Figure C-1.\n\nFigure C-1: Numbering of a die\n\nThe dice have very special properties, as in the following.\n\n(1) Ordinary dice can roll in four directions, but the dice used in this experiment never roll in the directions of faces 1, 2 and 3; they can only roll in the directions of faces 4, 5 and 6. In the situation shown in Figure C-2, our die can only roll to one of two directions.\n\nFigure C-2: An ordinary die and a biased die\n\n(2) The die can only roll when it will fall down after rolling, as shown in Figure C-3. When multiple possibilities exist, the die rolls towards the face with the largest number among those directions it can roll to.\n\nFigure C-3: A die can roll only when it can fall\n\n(3) When a die rolls, it rolls exactly 90 degrees, and then falls straight down until its bottom face touches another die or the plane, as in the case [B] or [C] of Figure C-4.\n\n(4) After rolling and falling, the die repeatedly does so according to the rules (1) to (3) above.\n\nFigure C-4: Example stacking of biased dice\n\nFor example, when we drop four dice all in the same orientation, 6 at the top and 4 at the front, then a stack will be formed as shown in Figure C-4.\n\nFigure C-5: Example records\n\nAfter forming the stack, we count the numbers of faces with 1 through 6 visible from above and record them. For example, in the left case of Figure C-5, the record will be \"0 2 1 0 0 0\", and in the right case, \"0 1 1 0 0 1\".\n\nInput\n\nThe input consists of several datasets each in the following format.\n\nn\n\nt1  f1\n\nt2  f2\n\n...\n\ntn  fn\n\nHere, n (1 ≤ n ≤ 100) is an integer and is the number of the dice to be dropped. ti and fi (1 ≤ ti, fi ≤ 6) are two integers separated by a space and represent the numbers on the top and the front faces of the i-th die, when it is released, respectively.\n\nThe end of the input is indicated by a line containing a single zero.\n\nOutput\n\nFor each dataset, output six integers separated by a space. The integers represent the numbers of faces with 1 through 6 correspondingly, visible from above. There may not be any other characters in the output.\n\nSample Input\n\n4\n6 4\n6 4\n6 4\n6 4\n2\n5 3\n5 3\n8\n4 2\n4 2\n4 2\n4 2\n4 2\n4 2\n4 2\n4 2\n6\n4 6\n1 5\n2 3\n5 3\n2 4\n4 2\n0\n\nOutput for the Sample Input\n\n0 1 1 0 0 1\n1 0 0 0 1 0\n1 2 2 1 0 0\n2 3 0 0 0 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1547, "cpu_time_ms": 190, "memory_kb": 7844}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s707911842", "group_id": "codeNet:p00790", "input_text": "while 1:\n n = input()\n if n == 0:break\n D = range(1,7)\n ans = set(D)\n for i in range(n):\n c = raw_input()[0]\n if c == \"s\": S = [1,5,2,3,0,4]\n elif c == \"n\": S = [4,0,2,3,5,1]\n elif c == \"w\": S = [3,1,0,5,4,2]\n elif c == \"e\": S = [2,1,5,0,4,3]\n D = [D[s] for s in S]\n print D[0]", "language": "Python", "metadata": {"date": 1399799130, "filename_ext": "py", "original_language": "Python", "problem_description_relpath": "problem_descriptions/p00790.html", "problem_id": "p00790", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p00790/input.txt", "sample_output_relpath": "derived/input_output/data/p00790/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p00790/Python/s707911842.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s707911842", "user_id": "u633068244"}, "prompt_components": {"gold_output": "5\n1\n", "input_to_evaluate": "while 1:\n n = input()\n if n == 0:break\n D = range(1,7)\n ans = set(D)\n for i in range(n):\n c = raw_input()[0]\n if c == \"s\": S = [1,5,2,3,0,4]\n elif c == \"n\": S = [4,0,2,3,5,1]\n elif c == \"w\": S = [3,1,0,5,4,2]\n elif c == \"e\": S = [2,1,5,0,4,3]\n D = [D[s] for s in S]\n print D[0]", "problem_context": "Problem C: Die Game\n\nLife is not easy. Sometimes it is beyond your control. Now, as contestants of ACM ICPC, you might be just tasting the bitter of life. But don't worry! Do not look only on the dark side of life, but look also on the bright side. Life may be an enjoyable game of chance, like throwing dice. Do or die! Then, at last, you might be able to find the route to victory.\n\nThis problem comes from a game using a die. By the way, do you know a die? It has nothing to do with \"death.\" A die is a cubic object with six faces, each of which represents a different number from one to six and is marked with the corresponding number of spots. Since it is usually used in pair, \"a die\" is rarely used word. You might have heard a famous phrase \"the die is cast,\" though.\n\nWhen a game starts, a die stands still on a flat table. During the game, the die is tumbled in all directions by the dealer. You will win the game if you can predict the number seen on the top face at the time when the die stops tumbling.\n\nNow you are requested to write a program that simulates the rolling of a die. For simplicity, we assume that the die neither slip nor jumps but just rolls on the table in four directions, that is, north, east, south, and west. At the beginning of every game, the dealer puts the die at the center of the table and adjusts its direction so that the numbers one, two, and three are seen on the top, north, and west faces, respectively. For the other three faces, we do not explicitly specify anything but tell you the golden rule: the sum of the numbers on any pair of opposite faces is always seven.\n\nYour program should accept a sequence of commands, each of which is either \"north\", \"east\", \"south\", or \"west\". A \"north\" command tumbles the die down to north, that is, the top face becomes the new north, the north becomes the new bottom, and so on. More precisely, the die is rotated around its north bottom edge to the north direction and the rotation angle is 9 degrees. Other commands also tumble the die accordingly to their own directions. Your program should calculate the number finally shown on the top after performing the commands in the sequence. Note that the table is sufficiently large and the die never falls off during the game.\n\nInput\n\nThe input consists of one or more command sequences, each of which corresponds to a single game. The first line of a command sequence contains a positive integer, representing the number of the following command lines in the sequence. You may assume that this number is less than or equal to 1024. A line containing a zero indicates the end of the input. Each command line includes a command that is one of north, east, south, and west. You may assume that no white space occurs in any line.\n\nOutput\n\nFor each command sequence, output one line containing solely the number of the top face at the time when the game is finished.\n\nSample Input\n\n1\nnorth\n3\nnorth\neast\nsouth\n0\n\nOutput for the Sample Input\n\n5\n1", "sample_input": "1\nnorth\n3\nnorth\neast\nsouth\n0\n"}, "reference_outputs": ["5\n1\n"], "source_document_id": "p00790", "source_text": "Problem C: Die Game\n\nLife is not easy. Sometimes it is beyond your control. Now, as contestants of ACM ICPC, you might be just tasting the bitter of life. But don't worry! Do not look only on the dark side of life, but look also on the bright side. Life may be an enjoyable game of chance, like throwing dice. Do or die! Then, at last, you might be able to find the route to victory.\n\nThis problem comes from a game using a die. By the way, do you know a die? It has nothing to do with \"death.\" A die is a cubic object with six faces, each of which represents a different number from one to six and is marked with the corresponding number of spots. Since it is usually used in pair, \"a die\" is rarely used word. You might have heard a famous phrase \"the die is cast,\" though.\n\nWhen a game starts, a die stands still on a flat table. During the game, the die is tumbled in all directions by the dealer. You will win the game if you can predict the number seen on the top face at the time when the die stops tumbling.\n\nNow you are requested to write a program that simulates the rolling of a die. For simplicity, we assume that the die neither slip nor jumps but just rolls on the table in four directions, that is, north, east, south, and west. At the beginning of every game, the dealer puts the die at the center of the table and adjusts its direction so that the numbers one, two, and three are seen on the top, north, and west faces, respectively. For the other three faces, we do not explicitly specify anything but tell you the golden rule: the sum of the numbers on any pair of opposite faces is always seven.\n\nYour program should accept a sequence of commands, each of which is either \"north\", \"east\", \"south\", or \"west\". A \"north\" command tumbles the die down to north, that is, the top face becomes the new north, the north becomes the new bottom, and so on. More precisely, the die is rotated around its north bottom edge to the north direction and the rotation angle is 9 degrees. Other commands also tumble the die accordingly to their own directions. Your program should calculate the number finally shown on the top after performing the commands in the sequence. Note that the table is sufficiently large and the die never falls off during the game.\n\nInput\n\nThe input consists of one or more command sequences, each of which corresponds to a single game. The first line of a command sequence contains a positive integer, representing the number of the following command lines in the sequence. You may assume that this number is less than or equal to 1024. A line containing a zero indicates the end of the input. Each command line includes a command that is one of north, east, south, and west. You may assume that no white space occurs in any line.\n\nOutput\n\nFor each command sequence, output one line containing solely the number of the top face at the time when the game is finished.\n\nSample Input\n\n1\nnorth\n3\nnorth\neast\nsouth\n0\n\nOutput for the Sample Input\n\n5\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 339, "cpu_time_ms": 20, "memory_kb": 4260}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s833416327", "group_id": "codeNet:p01102", "input_text": "while (True):\n s1=input()\n if (s1==\".\"):\n break\n s2=input()\n l1=s1.split(\"\\\"\")\n l2=s2.split(\"\\\"\")\n #print(l1,l2)\n if (len(l1)!=len(l2)):\n print(\"DIFFERENT\")\n continue\n error=0\n for i in range(len(l1)):\n #print(l1,l2,i)\n if (l1[i]!=l2[i] and i%2==0):\n print(\"DIFFERENT\")\n error=-1\n break\n if (len(l1[i])!=len(l2[i])):\n error+=1\n else:\n for j in range(min(len(l1[i]),len(l2[i]))):\n # print(l1[i][j],l2[i][j])\n if (l1[i][j]!=l2[i][j]):\n error+=1\n break\n\n if (error==0):\n print(\"IDENTICAL\")\n elif (error==1):\n print(\"CLOSE\")\n elif(error>=2):\n print(\"DIFFERENT\")\n", "language": "Python", "metadata": {"date": 1559008845, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p01102.html", "problem_id": "p01102", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p01102/input.txt", "sample_output_relpath": "derived/input_output/data/p01102/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p01102/Python/s833416327.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s833416327", "user_id": "u856952517"}, "prompt_components": {"gold_output": "IDENTICAL\nCLOSE\nDIFFERENT\nCLOSE\nDIFFERENT\nDIFFERENT\nDIFFERENT\nCLOSE\nDIFFERENT\n", "input_to_evaluate": "while (True):\n s1=input()\n if (s1==\".\"):\n break\n s2=input()\n l1=s1.split(\"\\\"\")\n l2=s2.split(\"\\\"\")\n #print(l1,l2)\n if (len(l1)!=len(l2)):\n print(\"DIFFERENT\")\n continue\n error=0\n for i in range(len(l1)):\n #print(l1,l2,i)\n if (l1[i]!=l2[i] and i%2==0):\n print(\"DIFFERENT\")\n error=-1\n break\n if (len(l1[i])!=len(l2[i])):\n error+=1\n else:\n for j in range(min(len(l1[i]),len(l2[i]))):\n # print(l1[i][j],l2[i][j])\n if (l1[i][j]!=l2[i][j]):\n error+=1\n break\n\n if (error==0):\n print(\"IDENTICAL\")\n elif (error==1):\n print(\"CLOSE\")\n elif(error>=2):\n print(\"DIFFERENT\")\n", "problem_context": "Almost Identical Programs\n\nThe programming contest named\nConcours de Programmation Comtemporaine Interuniversitaire (CPCI)\nhas a judging system similar to that of ICPC;\ncontestants have to submit correct outputs for two different inputs\nto be accepted as a correct solution.\n\nEach of the submissions should include the program that generated\nthe output. A pair of submissions is judged to be a correct\nsolution when, in addition to the correctness of the outputs, they\ninclude an identical program.\n\nMany contestants, however, do not stop including a different version\nof their programs in their second submissions, after modifying a\nsingle string literal in their programs representing\nthe input file name, attempting to process different input.\n\nThe organizers of CPCI are exploring the possibility of showing a\nspecial error message for such close submissions,\nindicating contestants what's wrong with such submissions.\n\nYour task is to detect such close submissions.\n\nInput\n\nThe input consists of at most 100 datasets, each in the following format.\n\ns1\ns2\n\nEach of s1 and s2 is\na string written in a line, with the length between 1 and 200, inclusive.\nThey are the first and the second submitted programs respectively.\n\nA program consists of lowercase letters (a, b, ..., z), uppercase letters (A, B, ..., Z),\ndigits (0, 1, ..., 9), double quotes (\"), and semicolons (;).\nWhen double quotes occur in a program, there are always even number of them.\n\nThe end of the input is indicated by a line containing one '.' (period).\n\nOutput\n\nFor each dataset, print the judge result in a line.\n\nIf the given two programs are identical, print IDENTICAL.\nIf two programs differ with only one corresponding string literal, print CLOSE.\nOtherwise, print DIFFERENT.\n\nA string literal is a possibly empty sequence of characters between an\nodd-numbered occurrence of a double quote and the next occurrence of\na double quote.\n\nSample Input\n\nprint\"hello\";print123\nprint\"hello\";print123\nread\"B1input\";solve;output;\nread\"B2\";solve;output;\nread\"C1\";solve;output\"C1ans\";\nread\"C2\";solve;output\"C2ans\";\n\"\"\"\"\"\"\"\"\n\"\"\"42\"\"\"\"\"\nslow\"program\"\nfast\"code\"\n\"super\"fast\"program\"\n\"super\"faster\"program\"\nX\"\"\nX\nI\"S\"\"CREAM\"\nI\"CE\"\"CREAM\"\n11\"22\"11\n1\"33\"111\n.\n\nOutput for the Sample Input\n\nIDENTICAL\nCLOSE\nDIFFERENT\nCLOSE\nDIFFERENT\nDIFFERENT\nDIFFERENT\nCLOSE\nDIFFERENT", "sample_input": "print\"hello\";print123\nprint\"hello\";print123\nread\"B1input\";solve;output;\nread\"B2\";solve;output;\nread\"C1\";solve;output\"C1ans\";\nread\"C2\";solve;output\"C2ans\";\n\"\"\"\"\"\"\"\"\n\"\"\"42\"\"\"\"\"\nslow\"program\"\nfast\"code\"\n\"super\"fast\"program\"\n\"super\"faster\"program\"\nX\"\"\nX\nI\"S\"\"CREAM\"\nI\"CE\"\"CREAM\"\n11\"22\"11\n1\"33\"111\n.\n"}, "reference_outputs": ["IDENTICAL\nCLOSE\nDIFFERENT\nCLOSE\nDIFFERENT\nDIFFERENT\nDIFFERENT\nCLOSE\nDIFFERENT\n"], "source_document_id": "p01102", "source_text": "Almost Identical Programs\n\nThe programming contest named\nConcours de Programmation Comtemporaine Interuniversitaire (CPCI)\nhas a judging system similar to that of ICPC;\ncontestants have to submit correct outputs for two different inputs\nto be accepted as a correct solution.\n\nEach of the submissions should include the program that generated\nthe output. A pair of submissions is judged to be a correct\nsolution when, in addition to the correctness of the outputs, they\ninclude an identical program.\n\nMany contestants, however, do not stop including a different version\nof their programs in their second submissions, after modifying a\nsingle string literal in their programs representing\nthe input file name, attempting to process different input.\n\nThe organizers of CPCI are exploring the possibility of showing a\nspecial error message for such close submissions,\nindicating contestants what's wrong with such submissions.\n\nYour task is to detect such close submissions.\n\nInput\n\nThe input consists of at most 100 datasets, each in the following format.\n\ns1\ns2\n\nEach of s1 and s2 is\na string written in a line, with the length between 1 and 200, inclusive.\nThey are the first and the second submitted programs respectively.\n\nA program consists of lowercase letters (a, b, ..., z), uppercase letters (A, B, ..., Z),\ndigits (0, 1, ..., 9), double quotes (\"), and semicolons (;).\nWhen double quotes occur in a program, there are always even number of them.\n\nThe end of the input is indicated by a line containing one '.' (period).\n\nOutput\n\nFor each dataset, print the judge result in a line.\n\nIf the given two programs are identical, print IDENTICAL.\nIf two programs differ with only one corresponding string literal, print CLOSE.\nOtherwise, print DIFFERENT.\n\nA string literal is a possibly empty sequence of characters between an\nodd-numbered occurrence of a double quote and the next occurrence of\na double quote.\n\nSample Input\n\nprint\"hello\";print123\nprint\"hello\";print123\nread\"B1input\";solve;output;\nread\"B2\";solve;output;\nread\"C1\";solve;output\"C1ans\";\nread\"C2\";solve;output\"C2ans\";\n\"\"\"\"\"\"\"\"\n\"\"\"42\"\"\"\"\"\nslow\"program\"\nfast\"code\"\n\"super\"fast\"program\"\n\"super\"faster\"program\"\nX\"\"\nX\nI\"S\"\"CREAM\"\nI\"CE\"\"CREAM\"\n11\"22\"11\n1\"33\"111\n.\n\nOutput for the Sample Input\n\nIDENTICAL\nCLOSE\nDIFFERENT\nCLOSE\nDIFFERENT\nDIFFERENT\nDIFFERENT\nCLOSE\nDIFFERENT", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 784, "cpu_time_ms": 30, "memory_kb": 5588}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s677554978", "group_id": "codeNet:p02250", "input_text": "from collections import defaultdict, Counter\nfrom math import floor, ceil, log\nfrom heapq import heapreplace, heappush\nimport time\n\nclass TreeIndex:\n\n class Node:\n __slots__ = ('level', 'keys', 'values', 'keylen', '_cache', '_cacheq')\n\n def __init__(self, level):\n self.level = level\n self.values = []\n self.keys = {}\n self.keylen = 2 ** self.level\n self._init_cache()\n\n def add(self, text, value):\n def _add(node, t):\n if len(t) == 0:\n node.values.append(value)\n return node\n\n pre = t[:node.keylen]\n post = t[node.keylen:]\n if pre not in node.keys:\n node.keys[pre] = self.__class__(node.level+1)\n return _add(node.keys[pre], post)\n\n node = self._get_cache(text)\n if node is not None:\n _add(node, '')\n else:\n self._set_cache(text, _add(self, text))\n\n def index(self, text):\n def _index(node, t):\n if len(t) == 0:\n return node\n\n pre = t[:node.keylen]\n post = t[node.keylen:]\n if pre in node.keys:\n return _index(node.keys[pre], post)\n else:\n return None\n\n node = self._get_cache(text)\n if node is not None:\n return node.values\n else:\n node = _index(self, text)\n if node is not None:\n self._set_cache(text, node)\n return node.values\n return []\n\n def __contains__(self, text):\n if len(text) > self.keylen:\n pre = text[:self.keylen]\n post = text[self.keylen:]\n return (pre in self.keys and post in self.keys[pre])\n else:\n return any(key.startswith(text) for key in self.keys)\n\n def _init_cache(self):\n self._cache = {}\n self._cacheq = []\n\n def _set_cache(self, text, node):\n if text not in self._cache:\n if len(self._cacheq) > 65535:\n _, txt = heapreplace(self._cacheq, (time.clock(), text))\n del self._cache[txt]\n else:\n heappush(self._cacheq, (time.clock(), text))\n self._cache[text] = node\n\n def _get_cache(self, text):\n if text in self._cache:\n return self._cache[text]\n else:\n return None\n\n def __str__(self):\n return ('(' + ','.join([\"{}->{}\".format(k, v)\n for k, v in self.keys.items()]) + ')')\n\n def __init__(self, text):\n self._keylen(text)\n self._create_index(text)\n\n def _keylen(self, text):\n chars = Counter(list(text))\n ent = 0.0\n total = len(text)\n base = len(chars) + 1\n for c, cnt in chars.items():\n p = cnt / total\n ent -= p * log(p, base)\n self.keylen = max(2 ** ceil(10 * (1 - ent)) - 1, 15)\n\n def _create_index(self, text):\n tree = self.Node(0)\n length = len(text)\n for i in range(length):\n tree.add(text[i:i+self.keylen], i)\n self.tree = tree\n self.text = text\n\n def match(self, search_text):\n def _match_partial(lo, hi):\n split = self.keylen\n if search_text[lo+split:hi] in self.tree:\n for i in self.tree.index(search_text[lo:lo+split]):\n if (self.text[i+split:i+hi-lo]\n == search_text[lo+split:hi]):\n yield i\n\n def _match(lo, hi):\n length = hi - lo\n\n if length == self.keylen:\n return (i for i in self.tree.index(search_text[lo:hi]))\n\n if length < self.keylen*2:\n return _match_partial(lo, hi)\n\n mid = lo + length // 2\n pre = _match(lo, mid)\n post = _match(mid, hi)\n\n return _merge(pre, post, mid-lo)\n\n def _merge(idx1, idx2, shift):\n i2 = next(idx2)\n for i1 in idx1:\n while i1 + shift > i2:\n i2 = next(idx2)\n if i1 + shift == i2:\n yield i1\n\n length = len(search_text)\n if length < self.keylen:\n return search_text in self.tree\n\n # align by key length\n k = floor(log(length/self.keylen, 2))\n b = self.keylen * 2**k\n if length - self.keylen < b < length and k > 0:\n b = self.keylen * 2**(k-1)\n\n try:\n if b + self.keylen < length:\n match = _merge(_match(0, b), _match(b, length), b)\n else:\n match = _match(0, length)\n next(match)\n return True\n except StopIteration:\n return False\n\n\ndef run():\n s1 = input()\n n = int(input())\n\n index = TreeIndex(s1)\n for _ in range(n):\n s2 = input()\n if index.match(s2):\n print(1)\n else:\n print(0)\n\n\nif __name__ == '__main__':\n run()\n\n", "language": "Python", "metadata": {"date": 1527565250, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02250.html", "problem_id": "p02250", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02250/input.txt", "sample_output_relpath": "derived/input_output/data/p02250/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02250/Python/s677554978.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Memory Limit Exceeded", "submission_id": "s677554978", "user_id": "u138546245"}, "prompt_components": {"gold_output": "1\n1\n0\n0\n", "input_to_evaluate": "from collections import defaultdict, Counter\nfrom math import floor, ceil, log\nfrom heapq import heapreplace, heappush\nimport time\n\nclass TreeIndex:\n\n class Node:\n __slots__ = ('level', 'keys', 'values', 'keylen', '_cache', '_cacheq')\n\n def __init__(self, level):\n self.level = level\n self.values = []\n self.keys = {}\n self.keylen = 2 ** self.level\n self._init_cache()\n\n def add(self, text, value):\n def _add(node, t):\n if len(t) == 0:\n node.values.append(value)\n return node\n\n pre = t[:node.keylen]\n post = t[node.keylen:]\n if pre not in node.keys:\n node.keys[pre] = self.__class__(node.level+1)\n return _add(node.keys[pre], post)\n\n node = self._get_cache(text)\n if node is not None:\n _add(node, '')\n else:\n self._set_cache(text, _add(self, text))\n\n def index(self, text):\n def _index(node, t):\n if len(t) == 0:\n return node\n\n pre = t[:node.keylen]\n post = t[node.keylen:]\n if pre in node.keys:\n return _index(node.keys[pre], post)\n else:\n return None\n\n node = self._get_cache(text)\n if node is not None:\n return node.values\n else:\n node = _index(self, text)\n if node is not None:\n self._set_cache(text, node)\n return node.values\n return []\n\n def __contains__(self, text):\n if len(text) > self.keylen:\n pre = text[:self.keylen]\n post = text[self.keylen:]\n return (pre in self.keys and post in self.keys[pre])\n else:\n return any(key.startswith(text) for key in self.keys)\n\n def _init_cache(self):\n self._cache = {}\n self._cacheq = []\n\n def _set_cache(self, text, node):\n if text not in self._cache:\n if len(self._cacheq) > 65535:\n _, txt = heapreplace(self._cacheq, (time.clock(), text))\n del self._cache[txt]\n else:\n heappush(self._cacheq, (time.clock(), text))\n self._cache[text] = node\n\n def _get_cache(self, text):\n if text in self._cache:\n return self._cache[text]\n else:\n return None\n\n def __str__(self):\n return ('(' + ','.join([\"{}->{}\".format(k, v)\n for k, v in self.keys.items()]) + ')')\n\n def __init__(self, text):\n self._keylen(text)\n self._create_index(text)\n\n def _keylen(self, text):\n chars = Counter(list(text))\n ent = 0.0\n total = len(text)\n base = len(chars) + 1\n for c, cnt in chars.items():\n p = cnt / total\n ent -= p * log(p, base)\n self.keylen = max(2 ** ceil(10 * (1 - ent)) - 1, 15)\n\n def _create_index(self, text):\n tree = self.Node(0)\n length = len(text)\n for i in range(length):\n tree.add(text[i:i+self.keylen], i)\n self.tree = tree\n self.text = text\n\n def match(self, search_text):\n def _match_partial(lo, hi):\n split = self.keylen\n if search_text[lo+split:hi] in self.tree:\n for i in self.tree.index(search_text[lo:lo+split]):\n if (self.text[i+split:i+hi-lo]\n == search_text[lo+split:hi]):\n yield i\n\n def _match(lo, hi):\n length = hi - lo\n\n if length == self.keylen:\n return (i for i in self.tree.index(search_text[lo:hi]))\n\n if length < self.keylen*2:\n return _match_partial(lo, hi)\n\n mid = lo + length // 2\n pre = _match(lo, mid)\n post = _match(mid, hi)\n\n return _merge(pre, post, mid-lo)\n\n def _merge(idx1, idx2, shift):\n i2 = next(idx2)\n for i1 in idx1:\n while i1 + shift > i2:\n i2 = next(idx2)\n if i1 + shift == i2:\n yield i1\n\n length = len(search_text)\n if length < self.keylen:\n return search_text in self.tree\n\n # align by key length\n k = floor(log(length/self.keylen, 2))\n b = self.keylen * 2**k\n if length - self.keylen < b < length and k > 0:\n b = self.keylen * 2**(k-1)\n\n try:\n if b + self.keylen < length:\n match = _merge(_match(0, b), _match(b, length), b)\n else:\n match = _match(0, length)\n next(match)\n return True\n except StopIteration:\n return False\n\n\ndef run():\n s1 = input()\n n = int(input())\n\n index = TreeIndex(s1)\n for _ in range(n):\n s2 = input()\n if index.match(s2):\n print(1)\n else:\n print(0)\n\n\nif __name__ == '__main__':\n run()\n\n", "problem_context": "String Search\n\nDetermine whether a text T includes a pattern P. Your program should answer for given queries consisting of P_i.\n\nInput\n\nIn the first line, a text T is given. In the second line, an integer Q denoting the number of queries is given. In the following Q lines, the patterns P_i are given respectively.\n\nOutput\n\nFor each question, print 1 if the text includes P_i, or print 0 otherwise.\n\nConstraints\n\n1 ≤ length of T ≤ 1000000\n\n1 ≤ length of P_i ≤ 1000\n\n1 ≤ Q ≤ 10000\n\nThe input consists of alphabetical characters and digits\n\nSample Input 1\n\naabaaa\n4\naa\nba\nbb\nxyz\n\nSample Output 1\n\n1\n1\n0\n0", "sample_input": "aabaaa\n4\naa\nba\nbb\nxyz\n"}, "reference_outputs": ["1\n1\n0\n0\n"], "source_document_id": "p02250", "source_text": "String Search\n\nDetermine whether a text T includes a pattern P. Your program should answer for given queries consisting of P_i.\n\nInput\n\nIn the first line, a text T is given. In the second line, an integer Q denoting the number of queries is given. In the following Q lines, the patterns P_i are given respectively.\n\nOutput\n\nFor each question, print 1 if the text includes P_i, or print 0 otherwise.\n\nConstraints\n\n1 ≤ length of T ≤ 1000000\n\n1 ≤ length of P_i ≤ 1000\n\n1 ≤ Q ≤ 10000\n\nThe input consists of alphabetical characters and digits\n\nSample Input 1\n\naabaaa\n4\naa\nba\nbb\nxyz\n\nSample Output 1\n\n1\n1\n0\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 5281, "cpu_time_ms": 20000, "memory_kb": 1660332}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s050615102", "group_id": "codeNet:p02255", "input_text": "N = int(input())\nseq = list(map(int, input().split()))\nprint(\" \".join(map(str, seq)))\nfor i in range(1, N):\n key = seq[i]\n j = i-1\n while j >= 0 and seq[j] > key:\n seq[j+1] = seq[j]\n j -= 1\n seq[j+1] = key\n print(\" \".join(map(str, seq)))", "language": "Python", "metadata": {"date": 1479624777, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02255.html", "problem_id": "p02255", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02255/input.txt", "sample_output_relpath": "derived/input_output/data/p02255/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02255/Python/s050615102.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s050615102", "user_id": "u546285759"}, "prompt_components": {"gold_output": "5 2 4 6 1 3\n2 5 4 6 1 3\n2 4 5 6 1 3\n2 4 5 6 1 3\n1 2 4 5 6 3\n1 2 3 4 5 6\n", "input_to_evaluate": "N = int(input())\nseq = list(map(int, input().split()))\nprint(\" \".join(map(str, seq)))\nfor i in range(1, N):\n key = seq[i]\n j = i-1\n while j >= 0 and seq[j] > key:\n seq[j+1] = seq[j]\n j -= 1\n seq[j+1] = key\n print(\" \".join(map(str, seq)))", "problem_context": "Insertion Sort\n\nWrite a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:\n\nfor i = 1 to A.length-1\nkey = A[i]\n/* insert A[i] into the sorted sequence A[0,...,j-1] */\nj = i - 1\nwhile j >= 0 and A[j] > key\nA[j+1] = A[j]\nj--\nA[j+1] = key\n\nNote that, indices for array elements are based on 0-origin.\n\nTo illustrate the algorithms, your program should trace intermediate result for each step.\n\nInput\n\nThe first line of the input includes an integer N, the number of elements in the sequence.\n\nIn the second line, N elements of the sequence are given separated by a single space.\n\nOutput\n\nThe output consists of N lines. Please output the intermediate sequence in a line for each step. Elements of the sequence should be separated by single space.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nSample Input 1\n\n6\n5 2 4 6 1 3\n\nSample Output 1\n\n5 2 4 6 1 3\n2 5 4 6 1 3\n2 4 5 6 1 3\n2 4 5 6 1 3\n1 2 4 5 6 3\n1 2 3 4 5 6\n\nSample Input 2\n\n3\n1 2 3\n\nSample Output 2\n\n1 2 3\n1 2 3\n1 2 3\n\nHint\n\nTemplate in C", "sample_input": "6\n5 2 4 6 1 3\n"}, "reference_outputs": ["5 2 4 6 1 3\n2 5 4 6 1 3\n2 4 5 6 1 3\n2 4 5 6 1 3\n1 2 4 5 6 3\n1 2 3 4 5 6\n"], "source_document_id": "p02255", "source_text": "Insertion Sort\n\nWrite a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:\n\nfor i = 1 to A.length-1\nkey = A[i]\n/* insert A[i] into the sorted sequence A[0,...,j-1] */\nj = i - 1\nwhile j >= 0 and A[j] > key\nA[j+1] = A[j]\nj--\nA[j+1] = key\n\nNote that, indices for array elements are based on 0-origin.\n\nTo illustrate the algorithms, your program should trace intermediate result for each step.\n\nInput\n\nThe first line of the input includes an integer N, the number of elements in the sequence.\n\nIn the second line, N elements of the sequence are given separated by a single space.\n\nOutput\n\nThe output consists of N lines. Please output the intermediate sequence in a line for each step. Elements of the sequence should be separated by single space.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nSample Input 1\n\n6\n5 2 4 6 1 3\n\nSample Output 1\n\n5 2 4 6 1 3\n2 5 4 6 1 3\n2 4 5 6 1 3\n2 4 5 6 1 3\n1 2 4 5 6 3\n1 2 3 4 5 6\n\nSample Input 2\n\n3\n1 2 3\n\nSample Output 2\n\n1 2 3\n1 2 3\n1 2 3\n\nHint\n\nTemplate in C", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 266, "cpu_time_ms": 20, "memory_kb": 7652}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s720688957", "group_id": "codeNet:p02258", "input_text": "N = int(input())\nR = [int(input()) for i in range(N)]\n\nmin_v = R[0]\nmax_v = R[1] - R[0]\nfor i in range(1, len(R)):\n if min_v > R[i - 1]:\n min_v = R[i - 1]\n if max_v < R[i] - min_v:\n max_v = R[i] - min_v\nprint(max_v)\n", "language": "Python", "metadata": {"date": 1546406152, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02258.html", "problem_id": "p02258", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02258/input.txt", "sample_output_relpath": "derived/input_output/data/p02258/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02258/Python/s720688957.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s720688957", "user_id": "u874395007"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "N = int(input())\nR = [int(input()) for i in range(N)]\n\nmin_v = R[0]\nmax_v = R[1] - R[0]\nfor i in range(1, len(R)):\n if min_v > R[i - 1]:\n min_v = R[i - 1]\n if max_v < R[i] - min_v:\n max_v = R[i] - min_v\nprint(max_v)\n", "problem_context": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nMaximum Profit\n\nYou can obtain profits from foreign exchange margin transactions. For example, if you buy 1000 dollar at a rate of 100 yen per dollar, and sell them at a rate of 108 yen per dollar, you can obtain (108 - 100) × 1000 = 8000 yen.\n\nWrite a program which reads values of a currency $R_t$ at a certain time $t$ ($t = 0, 1, 2, ... n-1$), and reports the maximum value of $R_j - R_i$ where $j > i$ .\n\nInput\n\nThe first line contains an integer $n$. In the following $n$ lines, $R_t$ ($t = 0, 1, 2, ... n-1$) are given in order.\n\nOutput\n\nPrint the maximum value in a line.\n\nConstraints\n\n$2 \\leq n \\leq 200,000$\n\n$1 \\leq R_t \\leq 10^9$\n\nSample Input 1\n\n6\n5\n3\n1\n3\n4\n3\n\nSample Output 1\n\n3\n\nSample Input 2\n\n3\n4\n3\n2\n\nSample Output 2\n\n-1", "sample_input": "6\n5\n3\n1\n3\n4\n3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02258", "source_text": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nMaximum Profit\n\nYou can obtain profits from foreign exchange margin transactions. For example, if you buy 1000 dollar at a rate of 100 yen per dollar, and sell them at a rate of 108 yen per dollar, you can obtain (108 - 100) × 1000 = 8000 yen.\n\nWrite a program which reads values of a currency $R_t$ at a certain time $t$ ($t = 0, 1, 2, ... n-1$), and reports the maximum value of $R_j - R_i$ where $j > i$ .\n\nInput\n\nThe first line contains an integer $n$. In the following $n$ lines, $R_t$ ($t = 0, 1, 2, ... n-1$) are given in order.\n\nOutput\n\nPrint the maximum value in a line.\n\nConstraints\n\n$2 \\leq n \\leq 200,000$\n\n$1 \\leq R_t \\leq 10^9$\n\nSample Input 1\n\n6\n5\n3\n1\n3\n4\n3\n\nSample Output 1\n\n3\n\nSample Input 2\n\n3\n4\n3\n2\n\nSample Output 2\n\n-1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 236, "cpu_time_ms": 470, "memory_kb": 13592}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s161308319", "group_id": "codeNet:p02258", "input_text": "n = int(input())\nR = [int(input()) for i in range(n)]\nprofit= R[1] - R[0]\nfor i in range(n):\n for j in range(i+1,n):\n tmp = R[j]-R[i]\n if profit < tmp:\n profit = tmp\n\nprint(profit)", "language": "Python", "metadata": {"date": 1487604349, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02258.html", "problem_id": "p02258", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02258/input.txt", "sample_output_relpath": "derived/input_output/data/p02258/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02258/Python/s161308319.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s161308319", "user_id": "u144068724"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "n = int(input())\nR = [int(input()) for i in range(n)]\nprofit= R[1] - R[0]\nfor i in range(n):\n for j in range(i+1,n):\n tmp = R[j]-R[i]\n if profit < tmp:\n profit = tmp\n\nprint(profit)", "problem_context": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nMaximum Profit\n\nYou can obtain profits from foreign exchange margin transactions. For example, if you buy 1000 dollar at a rate of 100 yen per dollar, and sell them at a rate of 108 yen per dollar, you can obtain (108 - 100) × 1000 = 8000 yen.\n\nWrite a program which reads values of a currency $R_t$ at a certain time $t$ ($t = 0, 1, 2, ... n-1$), and reports the maximum value of $R_j - R_i$ where $j > i$ .\n\nInput\n\nThe first line contains an integer $n$. In the following $n$ lines, $R_t$ ($t = 0, 1, 2, ... n-1$) are given in order.\n\nOutput\n\nPrint the maximum value in a line.\n\nConstraints\n\n$2 \\leq n \\leq 200,000$\n\n$1 \\leq R_t \\leq 10^9$\n\nSample Input 1\n\n6\n5\n3\n1\n3\n4\n3\n\nSample Output 1\n\n3\n\nSample Input 2\n\n3\n4\n3\n2\n\nSample Output 2\n\n-1", "sample_input": "6\n5\n3\n1\n3\n4\n3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02258", "source_text": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nMaximum Profit\n\nYou can obtain profits from foreign exchange margin transactions. For example, if you buy 1000 dollar at a rate of 100 yen per dollar, and sell them at a rate of 108 yen per dollar, you can obtain (108 - 100) × 1000 = 8000 yen.\n\nWrite a program which reads values of a currency $R_t$ at a certain time $t$ ($t = 0, 1, 2, ... n-1$), and reports the maximum value of $R_j - R_i$ where $j > i$ .\n\nInput\n\nThe first line contains an integer $n$. In the following $n$ lines, $R_t$ ($t = 0, 1, 2, ... n-1$) are given in order.\n\nOutput\n\nPrint the maximum value in a line.\n\nConstraints\n\n$2 \\leq n \\leq 200,000$\n\n$1 \\leq R_t \\leq 10^9$\n\nSample Input 1\n\n6\n5\n3\n1\n3\n4\n3\n\nSample Output 1\n\n3\n\nSample Input 2\n\n3\n4\n3\n2\n\nSample Output 2\n\n-1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 208, "cpu_time_ms": 15320, "memory_kb": 8140}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s798194633", "group_id": "codeNet:p02259", "input_text": "N = int(raw_input())\nA = map(int, raw_input().split())\ni = 0\nflag = 1\nwhile flag:\n flag = 0\n for j in range(N-1, 0, -1):\n if A[j] < A[j-1]:\n A_j = A[j]\n A[j] = A[j-1]\n A[j-1] = A_j\n flag = 1\n i += 1\nprint \" \".join(map(str, A))\nprint i", "language": "Python", "metadata": {"date": 1456812802, "filename_ext": "py", "original_language": "Python", "problem_description_relpath": "problem_descriptions/p02259.html", "problem_id": "p02259", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02259/input.txt", "sample_output_relpath": "derived/input_output/data/p02259/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02259/Python/s798194633.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s798194633", "user_id": "u233232390"}, "prompt_components": {"gold_output": "1 2 3 4 5\n8\n", "input_to_evaluate": "N = int(raw_input())\nA = map(int, raw_input().split())\ni = 0\nflag = 1\nwhile flag:\n flag = 0\n for j in range(N-1, 0, -1):\n if A[j] < A[j-1]:\n A_j = A[j]\n A[j] = A[j-1]\n A[j-1] = A_j\n flag = 1\n i += 1\nprint \" \".join(map(str, A))\nprint i", "problem_context": "Bubble Sort\n\nWrite a program of the Bubble Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:\n\nBubbleSort(A)\n1 for i = 0 to A.length-1\n2 for j = A.length-1 downto i+1\n3 if A[j] < A[j-1]\n4 swap A[j] and A[j-1]\n\nNote that, indices for array elements are based on 0-origin.\n\nYour program should also print the number of swap operations defined in line 4 of the pseudocode.\n\nInput\n\nThe first line of the input includes an integer N, the number of elements in the sequence.\n\nIn the second line, N elements of the sequence are given separated by spaces characters.\n\nOutput\n\nThe output consists of 2 lines.\n\nIn the first line, please print the sorted sequence. Two contiguous elements of the sequence should be separated by a space character.\n\nIn the second line, please print the number of swap operations.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nSample Input 1\n\n5\n5 3 2 4 1\n\nSample Output 1\n\n1 2 3 4 5\n8\n\nSample Input 2\n\n6\n5 2 4 6 1 3\n\nSample Output 2\n\n1 2 3 4 5 6\n9", "sample_input": "5\n5 3 2 4 1\n"}, "reference_outputs": ["1 2 3 4 5\n8\n"], "source_document_id": "p02259", "source_text": "Bubble Sort\n\nWrite a program of the Bubble Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:\n\nBubbleSort(A)\n1 for i = 0 to A.length-1\n2 for j = A.length-1 downto i+1\n3 if A[j] < A[j-1]\n4 swap A[j] and A[j-1]\n\nNote that, indices for array elements are based on 0-origin.\n\nYour program should also print the number of swap operations defined in line 4 of the pseudocode.\n\nInput\n\nThe first line of the input includes an integer N, the number of elements in the sequence.\n\nIn the second line, N elements of the sequence are given separated by spaces characters.\n\nOutput\n\nThe output consists of 2 lines.\n\nIn the first line, please print the sorted sequence. Two contiguous elements of the sequence should be separated by a space character.\n\nIn the second line, please print the number of swap operations.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nSample Input 1\n\n5\n5 3 2 4 1\n\nSample Output 1\n\n1 2 3 4 5\n8\n\nSample Input 2\n\n6\n5 2 4 6 1 3\n\nSample Output 2\n\n1 2 3 4 5 6\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 302, "cpu_time_ms": 10, "memory_kb": 6452}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s284357356", "group_id": "codeNet:p02259", "input_text": "def babble_sort(n, data):\n __count = 0\n for i in range(n-1):\n for j in range(n-i-1):\n if data[j] > data[j+1]:\n tmp = data[j+1]\n data[j+1] = data[j]\n data[j] = tmp\n __count += 1\n return data, __count\n\ndef show(data, count):\n for i in range(len(data)):\n if i != (len(data)-1):\n print(data[i], end = \" \")\n else:\n print(data[i])\n print(count)\n\nif \"__main__\" == __name__:\n n = int(input())\n data = list(map(int, input().rsplit()))\n data, count = babble_sort(n, data)\n show(data, count)\n", "language": "Python", "metadata": {"date": 1580890314, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02259.html", "problem_id": "p02259", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02259/input.txt", "sample_output_relpath": "derived/input_output/data/p02259/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02259/Python/s284357356.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s284357356", "user_id": "u514854274"}, "prompt_components": {"gold_output": "1 2 3 4 5\n8\n", "input_to_evaluate": "def babble_sort(n, data):\n __count = 0\n for i in range(n-1):\n for j in range(n-i-1):\n if data[j] > data[j+1]:\n tmp = data[j+1]\n data[j+1] = data[j]\n data[j] = tmp\n __count += 1\n return data, __count\n\ndef show(data, count):\n for i in range(len(data)):\n if i != (len(data)-1):\n print(data[i], end = \" \")\n else:\n print(data[i])\n print(count)\n\nif \"__main__\" == __name__:\n n = int(input())\n data = list(map(int, input().rsplit()))\n data, count = babble_sort(n, data)\n show(data, count)\n", "problem_context": "Bubble Sort\n\nWrite a program of the Bubble Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:\n\nBubbleSort(A)\n1 for i = 0 to A.length-1\n2 for j = A.length-1 downto i+1\n3 if A[j] < A[j-1]\n4 swap A[j] and A[j-1]\n\nNote that, indices for array elements are based on 0-origin.\n\nYour program should also print the number of swap operations defined in line 4 of the pseudocode.\n\nInput\n\nThe first line of the input includes an integer N, the number of elements in the sequence.\n\nIn the second line, N elements of the sequence are given separated by spaces characters.\n\nOutput\n\nThe output consists of 2 lines.\n\nIn the first line, please print the sorted sequence. Two contiguous elements of the sequence should be separated by a space character.\n\nIn the second line, please print the number of swap operations.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nSample Input 1\n\n5\n5 3 2 4 1\n\nSample Output 1\n\n1 2 3 4 5\n8\n\nSample Input 2\n\n6\n5 2 4 6 1 3\n\nSample Output 2\n\n1 2 3 4 5 6\n9", "sample_input": "5\n5 3 2 4 1\n"}, "reference_outputs": ["1 2 3 4 5\n8\n"], "source_document_id": "p02259", "source_text": "Bubble Sort\n\nWrite a program of the Bubble Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:\n\nBubbleSort(A)\n1 for i = 0 to A.length-1\n2 for j = A.length-1 downto i+1\n3 if A[j] < A[j-1]\n4 swap A[j] and A[j-1]\n\nNote that, indices for array elements are based on 0-origin.\n\nYour program should also print the number of swap operations defined in line 4 of the pseudocode.\n\nInput\n\nThe first line of the input includes an integer N, the number of elements in the sequence.\n\nIn the second line, N elements of the sequence are given separated by spaces characters.\n\nOutput\n\nThe output consists of 2 lines.\n\nIn the first line, please print the sorted sequence. Two contiguous elements of the sequence should be separated by a space character.\n\nIn the second line, please print the number of swap operations.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nSample Input 1\n\n5\n5 3 2 4 1\n\nSample Output 1\n\n1 2 3 4 5\n8\n\nSample Input 2\n\n6\n5 2 4 6 1 3\n\nSample Output 2\n\n1 2 3 4 5 6\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 622, "cpu_time_ms": 20, "memory_kb": 5608}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s707026314", "group_id": "codeNet:p02259", "input_text": "def main():\n n = int(input())\n a = list(map(int, input().split(' ')))\n c = 0\n flag = 1\n while flag:\n flag = 0\n j = 0\n for i in range(n-1, j, -1):\n if a[i] < a[i-1]:\n a[i], a[i-1] = a[i-1], a[i]\n c += 1\n flag = 1\n j -= 1\n print(' '.join(map(str, a)))\n print(c)\n\n\nif __name__ == '__main__':\n main()\n", "language": "Python", "metadata": {"date": 1565015245, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02259.html", "problem_id": "p02259", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02259/input.txt", "sample_output_relpath": "derived/input_output/data/p02259/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02259/Python/s707026314.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s707026314", "user_id": "u778810039"}, "prompt_components": {"gold_output": "1 2 3 4 5\n8\n", "input_to_evaluate": "def main():\n n = int(input())\n a = list(map(int, input().split(' ')))\n c = 0\n flag = 1\n while flag:\n flag = 0\n j = 0\n for i in range(n-1, j, -1):\n if a[i] < a[i-1]:\n a[i], a[i-1] = a[i-1], a[i]\n c += 1\n flag = 1\n j -= 1\n print(' '.join(map(str, a)))\n print(c)\n\n\nif __name__ == '__main__':\n main()\n", "problem_context": "Bubble Sort\n\nWrite a program of the Bubble Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:\n\nBubbleSort(A)\n1 for i = 0 to A.length-1\n2 for j = A.length-1 downto i+1\n3 if A[j] < A[j-1]\n4 swap A[j] and A[j-1]\n\nNote that, indices for array elements are based on 0-origin.\n\nYour program should also print the number of swap operations defined in line 4 of the pseudocode.\n\nInput\n\nThe first line of the input includes an integer N, the number of elements in the sequence.\n\nIn the second line, N elements of the sequence are given separated by spaces characters.\n\nOutput\n\nThe output consists of 2 lines.\n\nIn the first line, please print the sorted sequence. Two contiguous elements of the sequence should be separated by a space character.\n\nIn the second line, please print the number of swap operations.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nSample Input 1\n\n5\n5 3 2 4 1\n\nSample Output 1\n\n1 2 3 4 5\n8\n\nSample Input 2\n\n6\n5 2 4 6 1 3\n\nSample Output 2\n\n1 2 3 4 5 6\n9", "sample_input": "5\n5 3 2 4 1\n"}, "reference_outputs": ["1 2 3 4 5\n8\n"], "source_document_id": "p02259", "source_text": "Bubble Sort\n\nWrite a program of the Bubble Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:\n\nBubbleSort(A)\n1 for i = 0 to A.length-1\n2 for j = A.length-1 downto i+1\n3 if A[j] < A[j-1]\n4 swap A[j] and A[j-1]\n\nNote that, indices for array elements are based on 0-origin.\n\nYour program should also print the number of swap operations defined in line 4 of the pseudocode.\n\nInput\n\nThe first line of the input includes an integer N, the number of elements in the sequence.\n\nIn the second line, N elements of the sequence are given separated by spaces characters.\n\nOutput\n\nThe output consists of 2 lines.\n\nIn the first line, please print the sorted sequence. Two contiguous elements of the sequence should be separated by a space character.\n\nIn the second line, please print the number of swap operations.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nSample Input 1\n\n5\n5 3 2 4 1\n\nSample Output 1\n\n1 2 3 4 5\n8\n\nSample Input 2\n\n6\n5 2 4 6 1 3\n\nSample Output 2\n\n1 2 3 4 5 6\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 405, "cpu_time_ms": 20, "memory_kb": 5600}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s604047483", "group_id": "codeNet:p02260", "input_text": "n = int(input())\nA = [int(x) for x in input().split()]\n\ncount = 0\nfor i in range(n):\n minj = i\n for j in range(i,n):\n if (A[j] < A[minj]):\n minj = j\n\n if (minj != i):\n A[i],A[minj] = A[minj],A[i]\n count += 1\n\nfor k in range(n-1):\n print(str(A[k])+\" \",end = \"\")\nprint(str(A[n-1]))\nprint(count)\n\n", "language": "Python", "metadata": {"date": 1597657478, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02260.html", "problem_id": "p02260", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02260/input.txt", "sample_output_relpath": "derived/input_output/data/p02260/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02260/Python/s604047483.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s604047483", "user_id": "u333677472"}, "prompt_components": {"gold_output": "1 2 3 4 5 6\n4\n", "input_to_evaluate": "n = int(input())\nA = [int(x) for x in input().split()]\n\ncount = 0\nfor i in range(n):\n minj = i\n for j in range(i,n):\n if (A[j] < A[minj]):\n minj = j\n\n if (minj != i):\n A[i],A[minj] = A[minj],A[i]\n count += 1\n\nfor k in range(n-1):\n print(str(A[k])+\" \",end = \"\")\nprint(str(A[n-1]))\nprint(count)\n\n", "problem_context": "Selection Sort\n\nWrite a program of the Selection Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:\n\nSelectionSort(A)\n1 for i = 0 to A.length-1\n2 mini = i\n3 for j = i to A.length-1\n4 if A[j] < A[mini]\n5 mini = j\n6 swap A[i] and A[mini]\n\nNote that, indices for array elements are based on 0-origin.\n\nYour program should also print the number of swap operations defined in line 6 of the pseudocode in the case where i ≠ mini.\n\nInput\n\nThe first line of the input includes an integer N, the number of elements in the sequence.\n\nIn the second line, N elements of the sequence are given separated by space characters.\n\nOutput\n\nThe output consists of 2 lines.\n\nIn the first line, please print the sorted sequence. Two contiguous elements of the sequence should be separated by a space character.\n\nIn the second line, please print the number of swap operations.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nSample Input 1\n\n6\n5 6 4 2 1 3\n\nSample Output 1\n\n1 2 3 4 5 6\n4\n\nSample Input 2\n\n6\n5 2 4 6 1 3\n\nSample Output 2\n\n1 2 3 4 5 6\n3", "sample_input": "6\n5 6 4 2 1 3\n"}, "reference_outputs": ["1 2 3 4 5 6\n4\n"], "source_document_id": "p02260", "source_text": "Selection Sort\n\nWrite a program of the Selection Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:\n\nSelectionSort(A)\n1 for i = 0 to A.length-1\n2 mini = i\n3 for j = i to A.length-1\n4 if A[j] < A[mini]\n5 mini = j\n6 swap A[i] and A[mini]\n\nNote that, indices for array elements are based on 0-origin.\n\nYour program should also print the number of swap operations defined in line 6 of the pseudocode in the case where i ≠ mini.\n\nInput\n\nThe first line of the input includes an integer N, the number of elements in the sequence.\n\nIn the second line, N elements of the sequence are given separated by space characters.\n\nOutput\n\nThe output consists of 2 lines.\n\nIn the first line, please print the sorted sequence. Two contiguous elements of the sequence should be separated by a space character.\n\nIn the second line, please print the number of swap operations.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nSample Input 1\n\n6\n5 6 4 2 1 3\n\nSample Output 1\n\n1 2 3 4 5 6\n4\n\nSample Input 2\n\n6\n5 2 4 6 1 3\n\nSample Output 2\n\n1 2 3 4 5 6\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 338, "cpu_time_ms": 20, "memory_kb": 5608}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s973804221", "group_id": "codeNet:p02268", "input_text": "def binarySearch(t):\n\tleft,right = 0,n\n\twhile right > left+1:\n\t\tmid = (left+right) // 2\n\t\tif S[mid] == t:\n\t\t\treturn True\n\t\telif S[mid] > t:\n\t\t\tright = mid\n\t\telse:\n\t\t\tleft = mid\n\treturn False\n\nn = int(input())\nS = [int(s) for s in input().split()]\nq = int(input())\nT = [int(s) for s in input().split()]\n\nprint(sum([binarySearch(t) for t in T]))", "language": "Python", "metadata": {"date": 1500447128, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02268.html", "problem_id": "p02268", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02268/input.txt", "sample_output_relpath": "derived/input_output/data/p02268/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02268/Python/s973804221.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s973804221", "user_id": "u264972437"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "def binarySearch(t):\n\tleft,right = 0,n\n\twhile right > left+1:\n\t\tmid = (left+right) // 2\n\t\tif S[mid] == t:\n\t\t\treturn True\n\t\telif S[mid] > t:\n\t\t\tright = mid\n\t\telse:\n\t\t\tleft = mid\n\treturn False\n\nn = int(input())\nS = [int(s) for s in input().split()]\nq = int(input())\nT = [int(s) for s in input().split()]\n\nprint(sum([binarySearch(t) for t in T]))", "problem_context": "Search II\n\nYou are given a sequence of n integers S and a sequence of different q integers T. Write a program which outputs C, the number of integers in T which are also in the set S.\n\nInput\n\nIn the first line n is given. In the second line, n integers are given. In the third line q is given. Then, in the fourth line, q integers are given.\n\nOutput\n\nPrint C in a line.\n\nConstraints\n\nElements in S is sorted in ascending order\n\nn ≤ 100000\n\nq ≤ 50000\n\n0 ≤ an element in S ≤ 109\n\n0 ≤ an element in T ≤ 109\n\nSample Input 1\n\n5\n1 2 3 4 5\n3\n3 4 1\n\nSample Output 1\n\n3\n\nSample Input 2\n\n3\n1 2 3\n1\n5\n\nSample Output 2\n\n0\n\nSample Input 3\n\n5\n1 1 2 2 3\n2\n1 2\n\nSample Output 3\n\n2\n\nNotes", "sample_input": "5\n1 2 3 4 5\n3\n3 4 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02268", "source_text": "Search II\n\nYou are given a sequence of n integers S and a sequence of different q integers T. Write a program which outputs C, the number of integers in T which are also in the set S.\n\nInput\n\nIn the first line n is given. In the second line, n integers are given. In the third line q is given. Then, in the fourth line, q integers are given.\n\nOutput\n\nPrint C in a line.\n\nConstraints\n\nElements in S is sorted in ascending order\n\nn ≤ 100000\n\nq ≤ 50000\n\n0 ≤ an element in S ≤ 109\n\n0 ≤ an element in T ≤ 109\n\nSample Input 1\n\n5\n1 2 3 4 5\n3\n3 4 1\n\nSample Output 1\n\n3\n\nSample Input 2\n\n3\n1 2 3\n1\n5\n\nSample Output 2\n\n0\n\nSample Input 3\n\n5\n1 1 2 2 3\n2\n1 2\n\nSample Output 3\n\n2\n\nNotes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 343, "cpu_time_ms": 350, "memory_kb": 18656}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s988090400", "group_id": "codeNet:p02270", "input_text": "def check(P):\n i = 0\n for j in range(k):\n s = 0\n while s + T[i] <= P:\n s += T[i]\n i += 1\n if i == n: return n\n return i\n\ndef solve():\n left, right = 0, 100000*10000\n while right - left > 1:\n mid = (left + right) / 2\n v = check(mid)\n if v >= n: right = mid\n else: left = mid\n return right\n\nif __name__ == '__main__':\n T = []\n n, k = [int(x) for x in input().split()]\n for i in range(n): T.append(int(input())) \n print(int(solve()))\n", "language": "Python", "metadata": {"date": 1575543290, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02270.html", "problem_id": "p02270", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02270/input.txt", "sample_output_relpath": "derived/input_output/data/p02270/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02270/Python/s988090400.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s988090400", "user_id": "u586920078"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "def check(P):\n i = 0\n for j in range(k):\n s = 0\n while s + T[i] <= P:\n s += T[i]\n i += 1\n if i == n: return n\n return i\n\ndef solve():\n left, right = 0, 100000*10000\n while right - left > 1:\n mid = (left + right) / 2\n v = check(mid)\n if v >= n: right = mid\n else: left = mid\n return right\n\nif __name__ == '__main__':\n T = []\n n, k = [int(x) for x in input().split()]\n for i in range(n): T.append(int(input())) \n print(int(solve()))\n", "problem_context": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nYou are given $n$ packages of $w_i$ kg from a belt conveyor in order ($i = 0, 1, ... n-1$). You should load all packages onto $k$ trucks which have the common maximum load $P$. Each truck can load consecutive packages (more than or equals to zero) from the belt conveyor unless the total weights of the packages in the sequence does not exceed the maximum load $P$.\n\nWrite a program which reads $n$, $k$ and $w_i$, and reports the minimum value of the maximum load $P$ to load all packages from the belt conveyor.\n\nInput\n\nIn the first line, two integers $n$ and $k$ are given separated by a space character. In the following $n$ lines, $w_i$ are given respectively.\n\nOutput\n\nPrint the minimum value of $P$ in a line.\n\nConstraints\n\n$1 \\leq n \\leq 100,000$\n\n$1 \\leq k \\leq 100,000$\n\n$1 \\leq w_i \\leq 10,000$\n\nSample Input 1\n\n5 3\n8\n1\n7\n3\n9\n\nSample Output 1\n\n10\n\nIf the first truck loads two packages of $\\{8, 1\\}$, the second truck loads two packages of $\\{7, 3\\}$ and the third truck loads a package of $\\{9\\}$, then the minimum value of the maximum load $P$ shall be 10.\n\nSample Input 2\n\n4 2\n1\n2\n2\n6\n\nSample Output 2\n\n6\n\nIf the first truck loads three packages of $\\{1, 2, 2\\}$ and the second truck loads a package of $\\{6\\}$, then the minimum value of the maximum load $P$ shall be 6.", "sample_input": "5 3\n8\n1\n7\n3\n9\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02270", "source_text": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nYou are given $n$ packages of $w_i$ kg from a belt conveyor in order ($i = 0, 1, ... n-1$). You should load all packages onto $k$ trucks which have the common maximum load $P$. Each truck can load consecutive packages (more than or equals to zero) from the belt conveyor unless the total weights of the packages in the sequence does not exceed the maximum load $P$.\n\nWrite a program which reads $n$, $k$ and $w_i$, and reports the minimum value of the maximum load $P$ to load all packages from the belt conveyor.\n\nInput\n\nIn the first line, two integers $n$ and $k$ are given separated by a space character. In the following $n$ lines, $w_i$ are given respectively.\n\nOutput\n\nPrint the minimum value of $P$ in a line.\n\nConstraints\n\n$1 \\leq n \\leq 100,000$\n\n$1 \\leq k \\leq 100,000$\n\n$1 \\leq w_i \\leq 10,000$\n\nSample Input 1\n\n5 3\n8\n1\n7\n3\n9\n\nSample Output 1\n\n10\n\nIf the first truck loads two packages of $\\{8, 1\\}$, the second truck loads two packages of $\\{7, 3\\}$ and the third truck loads a package of $\\{9\\}$, then the minimum value of the maximum load $P$ shall be 10.\n\nSample Input 2\n\n4 2\n1\n2\n2\n6\n\nSample Output 2\n\n6\n\nIf the first truck loads three packages of $\\{1, 2, 2\\}$ and the second truck loads a package of $\\{6\\}$, then the minimum value of the maximum load $P$ shall be 6.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 539, "cpu_time_ms": 1180, "memory_kb": 9560}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s677086583", "group_id": "codeNet:p02271", "input_text": "n = int(input())\nA = list(map(int, input().split()))\nA.sort()\n\nq = int(input())\nm = list(map(int, input().split()))\n\ndef f(A, s, res):\n if res[0]:\n return\n if s == 0:\n res[0] = True\n return\n for i, a in enumerate(A):\n if a > s:\n break\n f(A[i+1:], s-a, res)\n\nfor mi in m:\n res = [False]\n f(A, mi, res)\n if res[0]:\n print(\"yes\")\n else:\n print(\"no\")", "language": "Python", "metadata": {"date": 1495654072, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02271.html", "problem_id": "p02271", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02271/input.txt", "sample_output_relpath": "derived/input_output/data/p02271/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02271/Python/s677086583.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s677086583", "user_id": "u003309334"}, "prompt_components": {"gold_output": "no\nno\nyes\nyes\nyes\nyes\nno\nno\n", "input_to_evaluate": "n = int(input())\nA = list(map(int, input().split()))\nA.sort()\n\nq = int(input())\nm = list(map(int, input().split()))\n\ndef f(A, s, res):\n if res[0]:\n return\n if s == 0:\n res[0] = True\n return\n for i, a in enumerate(A):\n if a > s:\n break\n f(A[i+1:], s-a, res)\n\nfor mi in m:\n res = [False]\n f(A, mi, res)\n if res[0]:\n print(\"yes\")\n else:\n print(\"no\")", "problem_context": "Exhaustive Search\n\nWrite a program which reads a sequence A of n elements and an integer M, and outputs \"yes\" if you can make M by adding elements in A, otherwise \"no\". You can use an element only once.\n\nYou are given the sequence A and q questions where each question contains Mi.\n\nInput\n\nIn the first line n is given. In the second line, n integers are given. In the third line q is given. Then, in the fourth line, q integers (Mi) are given.\n\nOutput\n\nFor each question Mi, print yes or no.\n\nConstraints\n\nn ≤ 20\n\nq ≤ 200\n\n1 ≤ elements in A ≤ 2000\n\n1 ≤ Mi ≤ 2000\n\nSample Input 1\n\n5\n1 5 7 10 21\n8\n2 4 17 8 22 21 100 35\n\nSample Output 1\n\nno\nno\nyes\nyes\nyes\nyes\nno\nno\n\nNotes\n\nYou can solve this problem by a Burte Force approach. Suppose solve(p, t) is a function which checkes whether you can make t by selecting elements after p-th element (inclusive). Then you can recursively call the following functions:\n\nsolve(0, M)\n\nsolve(1, M-{sum created from elements before 1st element})\n\nsolve(2, M-{sum created from elements before 2nd element})\n\n...\n\nThe recursive function has two choices: you selected p-th element and not. So, you can check solve(p+1, t-A[p]) and solve(p+1, t) in solve(p, t) to check the all combinations.\n\nFor example, the following figure shows that 8 can be made by A[0] + A[2].", "sample_input": "5\n1 5 7 10 21\n8\n2 4 17 8 22 21 100 35\n"}, "reference_outputs": ["no\nno\nyes\nyes\nyes\nyes\nno\nno\n"], "source_document_id": "p02271", "source_text": "Exhaustive Search\n\nWrite a program which reads a sequence A of n elements and an integer M, and outputs \"yes\" if you can make M by adding elements in A, otherwise \"no\". You can use an element only once.\n\nYou are given the sequence A and q questions where each question contains Mi.\n\nInput\n\nIn the first line n is given. In the second line, n integers are given. In the third line q is given. Then, in the fourth line, q integers (Mi) are given.\n\nOutput\n\nFor each question Mi, print yes or no.\n\nConstraints\n\nn ≤ 20\n\nq ≤ 200\n\n1 ≤ elements in A ≤ 2000\n\n1 ≤ Mi ≤ 2000\n\nSample Input 1\n\n5\n1 5 7 10 21\n8\n2 4 17 8 22 21 100 35\n\nSample Output 1\n\nno\nno\nyes\nyes\nyes\nyes\nno\nno\n\nNotes\n\nYou can solve this problem by a Burte Force approach. Suppose solve(p, t) is a function which checkes whether you can make t by selecting elements after p-th element (inclusive). Then you can recursively call the following functions:\n\nsolve(0, M)\n\nsolve(1, M-{sum created from elements before 1st element})\n\nsolve(2, M-{sum created from elements before 2nd element})\n\n...\n\nThe recursive function has two choices: you selected p-th element and not. So, you can check solve(p+1, t-A[p]) and solve(p+1, t) in solve(p, t) to check the all combinations.\n\nFor example, the following figure shows that 8 can be made by A[0] + A[2].", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 379, "cpu_time_ms": 40000, "memory_kb": 7720}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s837415595", "group_id": "codeNet:p02293", "input_text": "# -*- coding: utf-8 -*-\n\nimport sys\nimport os\nimport pprint\n\n#fd = os.open('CGL_2_A.txt', os.O_RDONLY)\n#os.dup2(fd, sys.stdin.fileno())\n\ndef judge(lst):\n x0, y0, x1, y1, x2, y2, x3, y3 = lst\n v0 = (x1 - x0, y1 - y0)\n v1 = (x3 - x2, y3 - y2)\n\n dot = v0[0] * v1[0] + v0[1] * v1[1]\n cross = v0[0] * v1[1] - v0[1] * v1[0]\n\n if dot == 0:\n print(1)\n elif cross == 0:\n print(2)\n else:\n print(0)\n\n\nN = int(input())\nfor i in range(N):\n lst = list(map(int, input().split()))\n judge(lst)", "language": "Python", "metadata": {"date": 1490696402, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02293.html", "problem_id": "p02293", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02293/input.txt", "sample_output_relpath": "derived/input_output/data/p02293/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02293/Python/s837415595.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s837415595", "user_id": "u462831976"}, "prompt_components": {"gold_output": "2\n1\n0\n", "input_to_evaluate": "# -*- coding: utf-8 -*-\n\nimport sys\nimport os\nimport pprint\n\n#fd = os.open('CGL_2_A.txt', os.O_RDONLY)\n#os.dup2(fd, sys.stdin.fileno())\n\ndef judge(lst):\n x0, y0, x1, y1, x2, y2, x3, y3 = lst\n v0 = (x1 - x0, y1 - y0)\n v1 = (x3 - x2, y3 - y2)\n\n dot = v0[0] * v1[0] + v0[1] * v1[1]\n cross = v0[0] * v1[1] - v0[1] * v1[0]\n\n if dot == 0:\n print(1)\n elif cross == 0:\n print(2)\n else:\n print(0)\n\n\nN = int(input())\nfor i in range(N):\n lst = list(map(int, input().split()))\n judge(lst)", "problem_context": "Parallel/Orthogonal\n\nFor given two lines s1 and s2, print \"2\" if they are parallel, \"1\" if they are orthogonal, or \"0\" otherwise.\n\ns1 crosses points p0 and p1, and\ns2 crosses points p2 and p3.\n\nInput\n\nThe entire input looks like:\n\nq (the number of queries)\n1st query\n2nd query\n...\nqth query\n\nEach query consists of integer coordinates of the points p0, p1, p2, p3 in the following format:\n\nxp0 yp0 xp1 yp1 xp2 yp2 xp3 yp3\n\nOutput\n\nFor each query, print \"2\", \"1\" or \"0\".\n\nConstraints\n\n1 ≤ q ≤ 1000\n\n-10000 ≤ xpi, ypi ≤ 10000\n\np0 ≠ p1 and\np2 ≠ p3.\n\nSample Input 1\n\n3\n0 0 3 0 0 2 3 2\n0 0 3 0 1 1 1 4\n0 0 3 0 1 1 2 2\n\nSample Output 1\n\n2\n1\n0", "sample_input": "3\n0 0 3 0 0 2 3 2\n0 0 3 0 1 1 1 4\n0 0 3 0 1 1 2 2\n"}, "reference_outputs": ["2\n1\n0\n"], "source_document_id": "p02293", "source_text": "Parallel/Orthogonal\n\nFor given two lines s1 and s2, print \"2\" if they are parallel, \"1\" if they are orthogonal, or \"0\" otherwise.\n\ns1 crosses points p0 and p1, and\ns2 crosses points p2 and p3.\n\nInput\n\nThe entire input looks like:\n\nq (the number of queries)\n1st query\n2nd query\n...\nqth query\n\nEach query consists of integer coordinates of the points p0, p1, p2, p3 in the following format:\n\nxp0 yp0 xp1 yp1 xp2 yp2 xp3 yp3\n\nOutput\n\nFor each query, print \"2\", \"1\" or \"0\".\n\nConstraints\n\n1 ≤ q ≤ 1000\n\n-10000 ≤ xpi, ypi ≤ 10000\n\np0 ≠ p1 and\np2 ≠ p3.\n\nSample Input 1\n\n3\n0 0 3 0 0 2 3 2\n0 0 3 0 1 1 1 4\n0 0 3 0 1 1 2 2\n\nSample Output 1\n\n2\n1\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 527, "cpu_time_ms": 40, "memory_kb": 8316}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s615629840", "group_id": "codeNet:p02314", "input_text": "n, m = map(int, input().strip().split())\nd = [i for i in map(int, input().strip().split())]\nassert len(d) == m\n\ncands = sorted(d)\ndata = [i for i in range(n+1)]\n\nfor c in cands:\n for i in range(n+1):\n if i + c <= n and data[i+c] > data[i] + 1:\n data[i+c] = data[i] + 1\nprint(data[-1])\n\n", "language": "Python", "metadata": {"date": 1539263725, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02314.html", "problem_id": "p02314", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02314/input.txt", "sample_output_relpath": "derived/input_output/data/p02314/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02314/Python/s615629840.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s615629840", "user_id": "u009773980"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n, m = map(int, input().strip().split())\nd = [i for i in map(int, input().strip().split())]\nassert len(d) == m\n\ncands = sorted(d)\ndata = [i for i in range(n+1)]\n\nfor c in cands:\n for i in range(n+1):\n if i + c <= n and data[i+c] > data[i] + 1:\n data[i+c] = data[i] + 1\nprint(data[-1])\n\n", "problem_context": "Coin Changing Problem\n\nFind the minimum number of coins to make change for n cents using coins of denominations d1, d2,.., dm. The coins can be used any number of times.\n\nInput\n\nn m\nd1 d2 ... dm\n\nTwo integers n and m are given in the first line. The available denominations are given in the second line.\n\nOutput\n\nPrint the minimum number of coins in a line.\n\nConstraints\n\n1 ≤ n ≤ 50000\n\n1 ≤ m ≤ 20\n\n1 ≤ denomination ≤ 10000\n\nThe denominations are all different and contain 1.\n\nSample Input 1\n\n55 4\n1 5 10 50\n\nSample Output 1\n\n2\n\nSample Input 2\n\n15 6\n1 2 7 8 12 50\n\nSample Output 2\n\n2\n\nSample Input 3\n\n65 6\n1 2 7 8 12 50\n\nSample Output 3\n\n3", "sample_input": "55 4\n1 5 10 50\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02314", "source_text": "Coin Changing Problem\n\nFind the minimum number of coins to make change for n cents using coins of denominations d1, d2,.., dm. The coins can be used any number of times.\n\nInput\n\nn m\nd1 d2 ... dm\n\nTwo integers n and m are given in the first line. The available denominations are given in the second line.\n\nOutput\n\nPrint the minimum number of coins in a line.\n\nConstraints\n\n1 ≤ n ≤ 50000\n\n1 ≤ m ≤ 20\n\n1 ≤ denomination ≤ 10000\n\nThe denominations are all different and contain 1.\n\nSample Input 1\n\n55 4\n1 5 10 50\n\nSample Output 1\n\n2\n\nSample Input 2\n\n15 6\n1 2 7 8 12 50\n\nSample Output 2\n\n2\n\nSample Input 3\n\n65 6\n1 2 7 8 12 50\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 307, "cpu_time_ms": 620, "memory_kb": 7640}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s709882685", "group_id": "codeNet:p02361", "input_text": "#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A&lang=jp\n\nclass Dijkstra():\n \"\"\" ダイクストラ法\n 重み付きグラフにおける単一始点最短路アルゴリズム\n\n * 使用条件\n - 負のコストがないこと\n - 有向グラフ、無向グラフともにOK\n \n * 計算量はO(E*log(V))\n\n * ベルマンフォード法より高速なので、負のコストがないならばこちらを使うとよい\n \"\"\" \n def __init__(self):\n \"\"\" 重み付き有向辺 \n 無向辺を表現したいときは、_fromと_toを逆にした有向辺を加えればよい\n\n Args:\n V(int): 頂点数\n - 頂点数が与えられたときは、すべての辺をINFで初期化する\n \"\"\"\n self.edges = {} # edges[(u,v)] = cost := 辺(u,v)のコストcost\n self.v_set = set() # 頂点の集合\n\n @property\n def E(self):\n \"\"\" 辺数 \n 無向グラフのときは、辺数は有向グラフの倍になる\n \"\"\"\n return len(self.edges)\n \n @property\n def V(self):\n \"\"\" 頂点数 \"\"\"\n return len(self.v_set)\n \n def add(self, _from, _to, _cost):\n \"\"\" 2頂点と、辺のコストを追加する \"\"\"\n self.edges[(_from, _to)] = _cost\n self.v_set.add(_from)\n self.v_set.add(_to)\n \n def shortest_path(self, s):\n \"\"\" 始点sから頂点iまでの最短路を格納したリストを返す \n Args:\n s(int): 始点s\n Returns:\n d(list): d[i] := 始点sから頂点iまでの最短路\n \"\"\"\n import heapq\n que = [] # プライオリティキュー(ヒープ木)\n d = [float(\"inf\")] * self.V\n d[s] = 0\n heapq.heappush(que, (0, s)) # (最短距離, 頂点の番号)をヒープに追加する\n\n while len(que) != 0:\n prov_cost, v = heapq.heappop(que) # prov_cost := 暫定的な最短距離\n # キューに格納されている暫定的な最短距離が、現在計算できている最短距離より大きければ、dの更新をする必要はない\n if d[v] < prov_cost: continue\n\n # 他の頂点の探索\n for i in range(self.V):\n \"\"\"(1)遅い\n try:\n self.edges[(v,i)]\n except KeyError:\n continue\n \"\"\"\n \n cost = self.edges.get((v,i), float(\"inf\")) # vからiへのコスト\n if d[i] > d[v] + cost:\n d[i] = d[v] + cost # dの更新\n heapq.heappush(que, (d[i], i)) # キューに新たな仮の距離の情報をpush\n return d\n\nif __name__ == \"__main__\":\n V, E, s = list(map(int, input().split()))\n djk = Dijkstra()\n if V == 1:\n print(0)\n exit()\n \n if E == 0:\n for i in range(V-1):\n djk.add(i, i+1, float(\"INF\"))\n else:\n for i in range(E):\n _from, to, cost = list(map(int, input().split()))\n djk.add(_from, to, cost)\n\n for i in range(V):\n # 入力に存在しない頂点があるとき、適当にINFの辺を作成する\n if not i in djk.v_set:\n djk.add(i, 0, float(\"inf\"))\n\n d = djk.shortest_path(s)\n \n for i in range(V):\n if i >= len(d):\n print(\"INF\")\n continue\n\n cost = d[i]\n if cost == float(\"inf\"):\n print(\"INF\")\n else:\n print(cost)\n\n", "language": "Python", "metadata": {"date": 1559457052, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02361.html", "problem_id": "p02361", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02361/input.txt", "sample_output_relpath": "derived/input_output/data/p02361/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02361/Python/s709882685.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s709882685", "user_id": "u822971508"}, "prompt_components": {"gold_output": "0\n1\n3\n4\n", "input_to_evaluate": "#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A&lang=jp\n\nclass Dijkstra():\n \"\"\" ダイクストラ法\n 重み付きグラフにおける単一始点最短路アルゴリズム\n\n * 使用条件\n - 負のコストがないこと\n - 有向グラフ、無向グラフともにOK\n \n * 計算量はO(E*log(V))\n\n * ベルマンフォード法より高速なので、負のコストがないならばこちらを使うとよい\n \"\"\" \n def __init__(self):\n \"\"\" 重み付き有向辺 \n 無向辺を表現したいときは、_fromと_toを逆にした有向辺を加えればよい\n\n Args:\n V(int): 頂点数\n - 頂点数が与えられたときは、すべての辺をINFで初期化する\n \"\"\"\n self.edges = {} # edges[(u,v)] = cost := 辺(u,v)のコストcost\n self.v_set = set() # 頂点の集合\n\n @property\n def E(self):\n \"\"\" 辺数 \n 無向グラフのときは、辺数は有向グラフの倍になる\n \"\"\"\n return len(self.edges)\n \n @property\n def V(self):\n \"\"\" 頂点数 \"\"\"\n return len(self.v_set)\n \n def add(self, _from, _to, _cost):\n \"\"\" 2頂点と、辺のコストを追加する \"\"\"\n self.edges[(_from, _to)] = _cost\n self.v_set.add(_from)\n self.v_set.add(_to)\n \n def shortest_path(self, s):\n \"\"\" 始点sから頂点iまでの最短路を格納したリストを返す \n Args:\n s(int): 始点s\n Returns:\n d(list): d[i] := 始点sから頂点iまでの最短路\n \"\"\"\n import heapq\n que = [] # プライオリティキュー(ヒープ木)\n d = [float(\"inf\")] * self.V\n d[s] = 0\n heapq.heappush(que, (0, s)) # (最短距離, 頂点の番号)をヒープに追加する\n\n while len(que) != 0:\n prov_cost, v = heapq.heappop(que) # prov_cost := 暫定的な最短距離\n # キューに格納されている暫定的な最短距離が、現在計算できている最短距離より大きければ、dの更新をする必要はない\n if d[v] < prov_cost: continue\n\n # 他の頂点の探索\n for i in range(self.V):\n \"\"\"(1)遅い\n try:\n self.edges[(v,i)]\n except KeyError:\n continue\n \"\"\"\n \n cost = self.edges.get((v,i), float(\"inf\")) # vからiへのコスト\n if d[i] > d[v] + cost:\n d[i] = d[v] + cost # dの更新\n heapq.heappush(que, (d[i], i)) # キューに新たな仮の距離の情報をpush\n return d\n\nif __name__ == \"__main__\":\n V, E, s = list(map(int, input().split()))\n djk = Dijkstra()\n if V == 1:\n print(0)\n exit()\n \n if E == 0:\n for i in range(V-1):\n djk.add(i, i+1, float(\"INF\"))\n else:\n for i in range(E):\n _from, to, cost = list(map(int, input().split()))\n djk.add(_from, to, cost)\n\n for i in range(V):\n # 入力に存在しない頂点があるとき、適当にINFの辺を作成する\n if not i in djk.v_set:\n djk.add(i, 0, float(\"inf\"))\n\n d = djk.shortest_path(s)\n \n for i in range(V):\n if i >= len(d):\n print(\"INF\")\n continue\n\n cost = d[i]\n if cost == float(\"inf\"):\n print(\"INF\")\n else:\n print(cost)\n\n", "problem_context": "Single Source Shortest Path\n\nFor a given weighted graph G(V, E) and a source r, find the source shortest path to each vertex from the source (SSSP: Single Source Shortest Path).\n\nInput\n\nAn edge-weighted graph G (V, E) and the source r.\n\n|V| |E| r\ns0 t0 d0\ns1 t1 d1\n:\ns|E|-1 t|E|-1 d|E|-1\n\n|V| is the number of vertices and |E| is the number of edges in G. The graph vertices are named with the numbers 0, 1,..., |V|-1 respectively. r is the source of the graph.\n\nsi and ti represent source and target vertices of i-th edge (directed) and di represents the cost of the i-th edge.\n\nOutput\n\nPrint the costs of SSSP in the following format.\n\nc0\nc1\n:\nc|V|-1\n\nThe output consists of |V| lines. Print the cost of the shortest path from the source r to each vertex 0, 1, ... |V|-1 in order. If there is no path from the source to a vertex, print INF.\n\nConstraints\n\n1 ≤ |V| ≤ 100000\n\n0 ≤ di ≤ 10000\n\n0 ≤ |E| ≤ 500000\n\nThere are no parallel edges\n\nThere are no self-loops\n\nSample Input 1\n\n4 5 0\n0 1 1\n0 2 4\n1 2 2\n2 3 1\n1 3 5\n\nSample Output 1\n\n0\n1\n3\n4\n\nSample Input 2\n\n4 6 1\n0 1 1\n0 2 4\n2 0 1\n1 2 2\n3 1 1\n3 2 5\n\nSample Output 2\n\n3\n0\n2\nINF", "sample_input": "4 5 0\n0 1 1\n0 2 4\n1 2 2\n2 3 1\n1 3 5\n"}, "reference_outputs": ["0\n1\n3\n4\n"], "source_document_id": "p02361", "source_text": "Single Source Shortest Path\n\nFor a given weighted graph G(V, E) and a source r, find the source shortest path to each vertex from the source (SSSP: Single Source Shortest Path).\n\nInput\n\nAn edge-weighted graph G (V, E) and the source r.\n\n|V| |E| r\ns0 t0 d0\ns1 t1 d1\n:\ns|E|-1 t|E|-1 d|E|-1\n\n|V| is the number of vertices and |E| is the number of edges in G. The graph vertices are named with the numbers 0, 1,..., |V|-1 respectively. r is the source of the graph.\n\nsi and ti represent source and target vertices of i-th edge (directed) and di represents the cost of the i-th edge.\n\nOutput\n\nPrint the costs of SSSP in the following format.\n\nc0\nc1\n:\nc|V|-1\n\nThe output consists of |V| lines. Print the cost of the shortest path from the source r to each vertex 0, 1, ... |V|-1 in order. If there is no path from the source to a vertex, print INF.\n\nConstraints\n\n1 ≤ |V| ≤ 100000\n\n0 ≤ di ≤ 10000\n\n0 ≤ |E| ≤ 500000\n\nThere are no parallel edges\n\nThere are no self-loops\n\nSample Input 1\n\n4 5 0\n0 1 1\n0 2 4\n1 2 2\n2 3 1\n1 3 5\n\nSample Output 1\n\n0\n1\n3\n4\n\nSample Input 2\n\n4 6 1\n0 1 1\n0 2 4\n2 0 1\n1 2 2\n3 1 1\n3 2 5\n\nSample Output 2\n\n3\n0\n2\nINF", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3615, "cpu_time_ms": 29990, "memory_kb": 8264}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s432110073", "group_id": "codeNet:p02370", "input_text": "from sys import stdin\nfrom collections import deque\n\ndef read_graph(n, k):\n A = [ [] for _ in range(n) ]\n for _ in range(k):\n line = stdin.readline().strip().split()\n A[int(line[0])].append(int(line[1]))\n return A\n\ndef topological_sort(n, A):\n color = [\"WHITE\"] * n\n Q = deque([])\n out = []\n\n indeg = [0] * n\n for i in range(n):\n for j in A[i]:\n indeg[j] = indeg[j] + 1\n\n def bfs(s):\n nonlocal color\n nonlocal indeg\n nonlocal Q\n color[s] = \"GRAY\"\n Q.append(s)\n\n while Q:\n u = Q.popleft()\n out.append(u)\n\n for v in A[u]:\n indeg[v] = indeg[v] - 1\n if indeg[v] == 0 and color[v] == \"WHITE\":\n color[v] = \"GRAY\"\n Q.append(v)\n\n for i in range(n):\n if indeg[i] == 0 and color[i] == \"WHITE\":\n bfs(i)\n\n return out\n\nn, k = [int(i) for i in input().split()]\nA = read_graph(n, k)\nB = topological_sort(n, A)\nfor i in B:\n print(i)\n\n", "language": "Python", "metadata": {"date": 1549701815, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02370.html", "problem_id": "p02370", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02370/input.txt", "sample_output_relpath": "derived/input_output/data/p02370/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02370/Python/s432110073.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s432110073", "user_id": "u637322311"}, "prompt_components": {"gold_output": "0\n3\n1\n4\n5\n2\n", "input_to_evaluate": "from sys import stdin\nfrom collections import deque\n\ndef read_graph(n, k):\n A = [ [] for _ in range(n) ]\n for _ in range(k):\n line = stdin.readline().strip().split()\n A[int(line[0])].append(int(line[1]))\n return A\n\ndef topological_sort(n, A):\n color = [\"WHITE\"] * n\n Q = deque([])\n out = []\n\n indeg = [0] * n\n for i in range(n):\n for j in A[i]:\n indeg[j] = indeg[j] + 1\n\n def bfs(s):\n nonlocal color\n nonlocal indeg\n nonlocal Q\n color[s] = \"GRAY\"\n Q.append(s)\n\n while Q:\n u = Q.popleft()\n out.append(u)\n\n for v in A[u]:\n indeg[v] = indeg[v] - 1\n if indeg[v] == 0 and color[v] == \"WHITE\":\n color[v] = \"GRAY\"\n Q.append(v)\n\n for i in range(n):\n if indeg[i] == 0 and color[i] == \"WHITE\":\n bfs(i)\n\n return out\n\nn, k = [int(i) for i in input().split()]\nA = read_graph(n, k)\nB = topological_sort(n, A)\nfor i in B:\n print(i)\n\n", "problem_context": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nTopological Sort\n\nA directed acyclic graph (DAG) can be used to represent the ordering of tasks. Tasks are represented by vertices and constraints where one task can begin before another, are represented by edges. For example, in the above example, you can undertake task B after both task A and task B are finished. You can obtain the proper sequence of all the tasks by a topological sort.\n\nGiven a DAG $G$, print the order of vertices after the topological sort.\n\nInput\n\nA directed graph $G$ is given in the following format:\n\n$|V|\\;|E|$\n\n$s_0 \\; t_0$\n\n$s_1 \\; t_1$\n\n:\n\n$s_{|E|-1} \\; t_{|E|-1}$\n\n$|V|$ is the number of vertices and $|E|$ is the number of edges in the graph. The graph vertices are named with the numbers $0, 1,..., |V|-1$ respectively.\n\n$s_i$ and $t_i$ represent source and target nodes of $i$-th edge (directed).\n\nOutput\n\nPrint the vertices numbers in order. Print a number in a line.\n\nIf there are multiple possible solutions, print any one of them (the solution is judged by a special validator).\n\nConstraints\n\n$1 \\leq |V| \\leq 10,000$\n\n$0 \\leq |E| \\leq 100,000$\n\nThere are no parallel edges in $G$\n\nThere are no self loops in $G$\n\nSample Input\n\n6 6\n0 1\n1 2\n3 1\n3 4\n4 5\n5 2\n\nSample Output\n\n0\n3\n1\n4\n5\n2", "sample_input": "6 6\n0 1\n1 2\n3 1\n3 4\n4 5\n5 2\n"}, "reference_outputs": ["0\n3\n1\n4\n5\n2\n"], "source_document_id": "p02370", "source_text": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nTopological Sort\n\nA directed acyclic graph (DAG) can be used to represent the ordering of tasks. Tasks are represented by vertices and constraints where one task can begin before another, are represented by edges. For example, in the above example, you can undertake task B after both task A and task B are finished. You can obtain the proper sequence of all the tasks by a topological sort.\n\nGiven a DAG $G$, print the order of vertices after the topological sort.\n\nInput\n\nA directed graph $G$ is given in the following format:\n\n$|V|\\;|E|$\n\n$s_0 \\; t_0$\n\n$s_1 \\; t_1$\n\n:\n\n$s_{|E|-1} \\; t_{|E|-1}$\n\n$|V|$ is the number of vertices and $|E|$ is the number of edges in the graph. The graph vertices are named with the numbers $0, 1,..., |V|-1$ respectively.\n\n$s_i$ and $t_i$ represent source and target nodes of $i$-th edge (directed).\n\nOutput\n\nPrint the vertices numbers in order. Print a number in a line.\n\nIf there are multiple possible solutions, print any one of them (the solution is judged by a special validator).\n\nConstraints\n\n$1 \\leq |V| \\leq 10,000$\n\n$0 \\leq |E| \\leq 100,000$\n\nThere are no parallel edges in $G$\n\nThere are no self loops in $G$\n\nSample Input\n\n6 6\n0 1\n1 2\n3 1\n3 4\n4 5\n5 2\n\nSample Output\n\n0\n3\n1\n4\n5\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1047, "cpu_time_ms": 150, "memory_kb": 9148}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s720273800", "group_id": "codeNet:p02379", "input_text": "import math\n\n(x1, y1, x2, y2) = [float(i) for i in input().split()]\n\ndistance = math.hypot((x2 - x1), (y2 - y1))\nprint('{0:.5f}'.format(distance))", "language": "Python", "metadata": {"date": 1423532924, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02379.html", "problem_id": "p02379", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02379/input.txt", "sample_output_relpath": "derived/input_output/data/p02379/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02379/Python/s720273800.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s720273800", "user_id": "u131984977"}, "prompt_components": {"gold_output": "1.41421356\n", "input_to_evaluate": "import math\n\n(x1, y1, x2, y2) = [float(i) for i in input().split()]\n\ndistance = math.hypot((x2 - x1), (y2 - y1))\nprint('{0:.5f}'.format(distance))", "problem_context": "Distance\n\nWrite a program which calculates the distance between two points P1(x1, y1) and P2(x2, y2).\n\nInput\n\nFour real numbers x1, y1, x2 and y2 are given in a line.\n\nOutput\n\nPrint the distance in real number. The output should not contain an absolute error greater than 10-4.\n\nSample Input\n\n0 0 1 1\n\nSample Output\n\n1.41421356", "sample_input": "0 0 1 1\n"}, "reference_outputs": ["1.41421356\n"], "source_document_id": "p02379", "source_text": "Distance\n\nWrite a program which calculates the distance between two points P1(x1, y1) and P2(x2, y2).\n\nInput\n\nFour real numbers x1, y1, x2 and y2 are given in a line.\n\nOutput\n\nPrint the distance in real number. The output should not contain an absolute error greater than 10-4.\n\nSample Input\n\n0 0 1 1\n\nSample Output\n\n1.41421356", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 146, "cpu_time_ms": 30, "memory_kb": 6820}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s557889183", "group_id": "codeNet:p02388", "input_text": "x = raw_input()\nx = int(x)\nprint x*x*x", "language": "Python", "metadata": {"date": 1452048885, "filename_ext": "py", "original_language": "Python", "problem_description_relpath": "problem_descriptions/p02388.html", "problem_id": "p02388", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02388/input.txt", "sample_output_relpath": "derived/input_output/data/p02388/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02388/Python/s557889183.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s557889183", "user_id": "u824204304"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "x = raw_input()\nx = int(x)\nprint x*x*x", "problem_context": "X Cubic\n\nWrite a program which calculates the cube of a given integer x.\n\nInput\n\nAn integer x is given in a line.\n\nOutput\n\nPrint the cube of x in a line.\n\nConstraints\n\n1 ≤ x ≤ 100\n\nSample Input 1\n\n2\n\nSample Output 1\n\n8\n\nSample Input 2\n\n3\n\nSample Output 2\n\n27", "sample_input": "2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02388", "source_text": "X Cubic\n\nWrite a program which calculates the cube of a given integer x.\n\nInput\n\nAn integer x is given in a line.\n\nOutput\n\nPrint the cube of x in a line.\n\nConstraints\n\n1 ≤ x ≤ 100\n\nSample Input 1\n\n2\n\nSample Output 1\n\n8\n\nSample Input 2\n\n3\n\nSample Output 2\n\n27", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 38, "cpu_time_ms": 10, "memory_kb": 6420}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s569912931", "group_id": "codeNet:p02388", "input_text": "x = int(input())\nprint(x**3)", "language": "Python", "metadata": {"date": 1477543642, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02388.html", "problem_id": "p02388", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02388/input.txt", "sample_output_relpath": "derived/input_output/data/p02388/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02388/Python/s569912931.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s569912931", "user_id": "u250482563"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "x = int(input())\nprint(x**3)", "problem_context": "X Cubic\n\nWrite a program which calculates the cube of a given integer x.\n\nInput\n\nAn integer x is given in a line.\n\nOutput\n\nPrint the cube of x in a line.\n\nConstraints\n\n1 ≤ x ≤ 100\n\nSample Input 1\n\n2\n\nSample Output 1\n\n8\n\nSample Input 2\n\n3\n\nSample Output 2\n\n27", "sample_input": "2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02388", "source_text": "X Cubic\n\nWrite a program which calculates the cube of a given integer x.\n\nInput\n\nAn integer x is given in a line.\n\nOutput\n\nPrint the cube of x in a line.\n\nConstraints\n\n1 ≤ x ≤ 100\n\nSample Input 1\n\n2\n\nSample Output 1\n\n8\n\nSample Input 2\n\n3\n\nSample Output 2\n\n27", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 28, "cpu_time_ms": 20, "memory_kb": 7624}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s206567124", "group_id": "codeNet:p02389", "input_text": "A,B = map(int,input().split())\n\nprint(A*B,2*(A+B))\n", "language": "Python", "metadata": {"date": 1586615701, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02389.html", "problem_id": "p02389", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02389/input.txt", "sample_output_relpath": "derived/input_output/data/p02389/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02389/Python/s206567124.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s206567124", "user_id": "u235213249"}, "prompt_components": {"gold_output": "15 16\n", "input_to_evaluate": "A,B = map(int,input().split())\n\nprint(A*B,2*(A+B))\n", "problem_context": "Rectangle\n\nWrite a program which calculates the area and perimeter of a given rectangle.\n\nInput\n\nThe length a and breadth b of the rectangle are given in a line separated by a single space.\n\nOutput\n\nPrint the area and perimeter of the rectangle in a line. The two integers should be separated by a single space.\n\nConstraints\n\n1 ≤ a, b ≤ 100\n\nSample Input 1\n\n3 5\n\nSample Output 1\n\n15 16", "sample_input": "3 5\n"}, "reference_outputs": ["15 16\n"], "source_document_id": "p02389", "source_text": "Rectangle\n\nWrite a program which calculates the area and perimeter of a given rectangle.\n\nInput\n\nThe length a and breadth b of the rectangle are given in a line separated by a single space.\n\nOutput\n\nPrint the area and perimeter of the rectangle in a line. The two integers should be separated by a single space.\n\nConstraints\n\n1 ≤ a, b ≤ 100\n\nSample Input 1\n\n3 5\n\nSample Output 1\n\n15 16", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 51, "cpu_time_ms": 20, "memory_kb": 5584}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s425781043", "group_id": "codeNet:p02389", "input_text": "a, b = map(int,input().split())\nprint(a*b,(a+b)*2)\n", "language": "Python", "metadata": {"date": 1558599258, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02389.html", "problem_id": "p02389", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02389/input.txt", "sample_output_relpath": "derived/input_output/data/p02389/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02389/Python/s425781043.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s425781043", "user_id": "u099676733"}, "prompt_components": {"gold_output": "15 16\n", "input_to_evaluate": "a, b = map(int,input().split())\nprint(a*b,(a+b)*2)\n", "problem_context": "Rectangle\n\nWrite a program which calculates the area and perimeter of a given rectangle.\n\nInput\n\nThe length a and breadth b of the rectangle are given in a line separated by a single space.\n\nOutput\n\nPrint the area and perimeter of the rectangle in a line. The two integers should be separated by a single space.\n\nConstraints\n\n1 ≤ a, b ≤ 100\n\nSample Input 1\n\n3 5\n\nSample Output 1\n\n15 16", "sample_input": "3 5\n"}, "reference_outputs": ["15 16\n"], "source_document_id": "p02389", "source_text": "Rectangle\n\nWrite a program which calculates the area and perimeter of a given rectangle.\n\nInput\n\nThe length a and breadth b of the rectangle are given in a line separated by a single space.\n\nOutput\n\nPrint the area and perimeter of the rectangle in a line. The two integers should be separated by a single space.\n\nConstraints\n\n1 ≤ a, b ≤ 100\n\nSample Input 1\n\n3 5\n\nSample Output 1\n\n15 16", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 51, "cpu_time_ms": 20, "memory_kb": 5580}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s850161692", "group_id": "codeNet:p02390", "input_text": "time = input()\ntime = int(time)\nh = time//3600\nremain = time%3600\nm = remain//60\ns= remain%60\nprint('{}:{}:{}'.format(h,m,s))\n", "language": "Python", "metadata": {"date": 1596466540, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02390.html", "problem_id": "p02390", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02390/input.txt", "sample_output_relpath": "derived/input_output/data/p02390/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02390/Python/s850161692.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s850161692", "user_id": "u752414506"}, "prompt_components": {"gold_output": "13:2:59\n", "input_to_evaluate": "time = input()\ntime = int(time)\nh = time//3600\nremain = time%3600\nm = remain//60\ns= remain%60\nprint('{}:{}:{}'.format(h,m,s))\n", "problem_context": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nWatch\n\nWrite a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively.\n\nInput\n\nAn integer $S$ is given in a line.\n\nOutput\n\nPrint $h$, $m$ and $s$ separated by ':'. You do not need to put '0' for a value, which consists of a digit.\n\nConstraints\n\n$0 \\leq S \\leq 86400$\n\nSample Input 1\n\n46979\n\nSample Output 1\n\n13:2:59", "sample_input": "46979\n"}, "reference_outputs": ["13:2:59\n"], "source_document_id": "p02390", "source_text": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nWatch\n\nWrite a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively.\n\nInput\n\nAn integer $S$ is given in a line.\n\nOutput\n\nPrint $h$, $m$ and $s$ separated by ':'. You do not need to put '0' for a value, which consists of a digit.\n\nConstraints\n\n$0 \\leq S \\leq 86400$\n\nSample Input 1\n\n46979\n\nSample Output 1\n\n13:2:59", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 126, "cpu_time_ms": 20, "memory_kb": 5584}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s339359491", "group_id": "codeNet:p02390", "input_text": "s = int(input())\nh = s // 3600\nm = s % 3600 // 60\ns = s % 60\nprint(f\"{h}:{m}:{s}\")\n", "language": "Python", "metadata": {"date": 1582455827, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02390.html", "problem_id": "p02390", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02390/input.txt", "sample_output_relpath": "derived/input_output/data/p02390/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02390/Python/s339359491.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s339359491", "user_id": "u714602798"}, "prompt_components": {"gold_output": "13:2:59\n", "input_to_evaluate": "s = int(input())\nh = s // 3600\nm = s % 3600 // 60\ns = s % 60\nprint(f\"{h}:{m}:{s}\")\n", "problem_context": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nWatch\n\nWrite a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively.\n\nInput\n\nAn integer $S$ is given in a line.\n\nOutput\n\nPrint $h$, $m$ and $s$ separated by ':'. You do not need to put '0' for a value, which consists of a digit.\n\nConstraints\n\n$0 \\leq S \\leq 86400$\n\nSample Input 1\n\n46979\n\nSample Output 1\n\n13:2:59", "sample_input": "46979\n"}, "reference_outputs": ["13:2:59\n"], "source_document_id": "p02390", "source_text": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nWatch\n\nWrite a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively.\n\nInput\n\nAn integer $S$ is given in a line.\n\nOutput\n\nPrint $h$, $m$ and $s$ separated by ':'. You do not need to put '0' for a value, which consists of a digit.\n\nConstraints\n\n$0 \\leq S \\leq 86400$\n\nSample Input 1\n\n46979\n\nSample Output 1\n\n13:2:59", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 83, "cpu_time_ms": 20, "memory_kb": 5588}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s908568827", "group_id": "codeNet:p02391", "input_text": "a,b=map(int,input().split())\nif ab:\n print(\"a > b\")\nelif a==b:\n print(\"a == b\")\n", "language": "Python", "metadata": {"date": 1595523408, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02391.html", "problem_id": "p02391", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02391/input.txt", "sample_output_relpath": "derived/input_output/data/p02391/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02391/Python/s908568827.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s908568827", "user_id": "u700103612"}, "prompt_components": {"gold_output": "a\n", "input_to_evaluate": "a,b=map(int,input().split())\nif ab:\n print(\"a > b\")\nelif a==b:\n print(\"a == b\")\n", "problem_context": "Small, Large, or Equal\n\nWrite a program which prints small/large/equal relation of given two integers a and b.\n\nInput\n\nTwo integers a and b separated by a single space are given in a line.\n\nOutput\n\nFor given two integers a and b, print\n\na < b\n\nif a is less than b,\n\na > b\n\nif a is greater than b, and\n\na == b\n\nif a equals to b.\n\nConstraints\n\n-1000 ≤ a, b ≤ 1000\n\nSample Input 1\n\n1 2\n\nSample Output 1\n\na < b\n\nSample Input 2\n\n4 3\n\nSample Output 2\n\na > b\n\nSample Input 3\n\n5 5\n\nSample Output 3\n\na == b", "sample_input": "1 2\n"}, "reference_outputs": ["a\n"], "source_document_id": "p02391", "source_text": "Small, Large, or Equal\n\nWrite a program which prints small/large/equal relation of given two integers a and b.\n\nInput\n\nTwo integers a and b separated by a single space are given in a line.\n\nOutput\n\nFor given two integers a and b, print\n\na < b\n\nif a is less than b,\n\na > b\n\nif a is greater than b, and\n\na == b\n\nif a equals to b.\n\nConstraints\n\n-1000 ≤ a, b ≤ 1000\n\nSample Input 1\n\n1 2\n\nSample Output 1\n\na < b\n\nSample Input 2\n\n4 3\n\nSample Output 2\n\na > b\n\nSample Input 3\n\n5 5\n\nSample Output 3\n\na == b", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 116, "cpu_time_ms": 20, "memory_kb": 5596}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s622520995", "group_id": "codeNet:p02393", "input_text": "a,b,c = map(int, raw_input().split(' '))\nprint ' '.join(map(str, (sorted([a, b, c]))))", "language": "Python", "metadata": {"date": 1451370862, "filename_ext": "py", "original_language": "Python", "problem_description_relpath": "problem_descriptions/p02393.html", "problem_id": "p02393", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02393/input.txt", "sample_output_relpath": "derived/input_output/data/p02393/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02393/Python/s622520995.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s622520995", "user_id": "u587712547"}, "prompt_components": {"gold_output": "1 3 8\n", "input_to_evaluate": "a,b,c = map(int, raw_input().split(' '))\nprint ' '.join(map(str, (sorted([a, b, c]))))", "problem_context": "Sorting Three Numbers\n\nWrite a program which reads three integers, and prints them in ascending order.\n\nInput\n\nThree integers separated by a single space are given in a line.\n\nOutput\n\nPrint the given integers in ascending order in a line. Put a single space between two integers.\n\nConstraints\n\n1 ≤ the three integers ≤ 10000\n\nSample Input 1\n\n3 8 1\n\nSample Output 1\n\n1 3 8", "sample_input": "3 8 1\n"}, "reference_outputs": ["1 3 8\n"], "source_document_id": "p02393", "source_text": "Sorting Three Numbers\n\nWrite a program which reads three integers, and prints them in ascending order.\n\nInput\n\nThree integers separated by a single space are given in a line.\n\nOutput\n\nPrint the given integers in ascending order in a line. Put a single space between two integers.\n\nConstraints\n\n1 ≤ the three integers ≤ 10000\n\nSample Input 1\n\n3 8 1\n\nSample Output 1\n\n1 3 8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 86, "cpu_time_ms": 10, "memory_kb": 6380}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s887439920", "group_id": "codeNet:p02393", "input_text": "def check(in_list):\n flag = True\n for i in in_list:\n if 1 <= i <= 10000:\n continue\n flag = False\n return flag\na = list(map(int, input().split()))\nif check(a):\n print(\" \".join(map(str, sorted(a))))", "language": "Python", "metadata": {"date": 1511703763, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02393.html", "problem_id": "p02393", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02393/input.txt", "sample_output_relpath": "derived/input_output/data/p02393/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02393/Python/s887439920.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s887439920", "user_id": "u217069758"}, "prompt_components": {"gold_output": "1 3 8\n", "input_to_evaluate": "def check(in_list):\n flag = True\n for i in in_list:\n if 1 <= i <= 10000:\n continue\n flag = False\n return flag\na = list(map(int, input().split()))\nif check(a):\n print(\" \".join(map(str, sorted(a))))", "problem_context": "Sorting Three Numbers\n\nWrite a program which reads three integers, and prints them in ascending order.\n\nInput\n\nThree integers separated by a single space are given in a line.\n\nOutput\n\nPrint the given integers in ascending order in a line. Put a single space between two integers.\n\nConstraints\n\n1 ≤ the three integers ≤ 10000\n\nSample Input 1\n\n3 8 1\n\nSample Output 1\n\n1 3 8", "sample_input": "3 8 1\n"}, "reference_outputs": ["1 3 8\n"], "source_document_id": "p02393", "source_text": "Sorting Three Numbers\n\nWrite a program which reads three integers, and prints them in ascending order.\n\nInput\n\nThree integers separated by a single space are given in a line.\n\nOutput\n\nPrint the given integers in ascending order in a line. Put a single space between two integers.\n\nConstraints\n\n1 ≤ the three integers ≤ 10000\n\nSample Input 1\n\n3 8 1\n\nSample Output 1\n\n1 3 8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 233, "cpu_time_ms": 20, "memory_kb": 7772}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s317364087", "group_id": "codeNet:p02393", "input_text": "a,b,c = map(int,input().split())\nif a > b:\n b,a = a,b\n\nif b > c:\n c,b = b,c\n\nif a > b:\n b,a = a,b\n\nprint(a,b,c)\n", "language": "Python", "metadata": {"date": 1584971211, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02393.html", "problem_id": "p02393", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02393/input.txt", "sample_output_relpath": "derived/input_output/data/p02393/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02393/Python/s317364087.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s317364087", "user_id": "u460204669"}, "prompt_components": {"gold_output": "1 3 8\n", "input_to_evaluate": "a,b,c = map(int,input().split())\nif a > b:\n b,a = a,b\n\nif b > c:\n c,b = b,c\n\nif a > b:\n b,a = a,b\n\nprint(a,b,c)\n", "problem_context": "Sorting Three Numbers\n\nWrite a program which reads three integers, and prints them in ascending order.\n\nInput\n\nThree integers separated by a single space are given in a line.\n\nOutput\n\nPrint the given integers in ascending order in a line. Put a single space between two integers.\n\nConstraints\n\n1 ≤ the three integers ≤ 10000\n\nSample Input 1\n\n3 8 1\n\nSample Output 1\n\n1 3 8", "sample_input": "3 8 1\n"}, "reference_outputs": ["1 3 8\n"], "source_document_id": "p02393", "source_text": "Sorting Three Numbers\n\nWrite a program which reads three integers, and prints them in ascending order.\n\nInput\n\nThree integers separated by a single space are given in a line.\n\nOutput\n\nPrint the given integers in ascending order in a line. Put a single space between two integers.\n\nConstraints\n\n1 ≤ the three integers ≤ 10000\n\nSample Input 1\n\n3 8 1\n\nSample Output 1\n\n1 3 8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 121, "cpu_time_ms": 20, "memory_kb": 5596}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s781757007", "group_id": "codeNet:p02393", "input_text": "s = input()\nsss = s.split()\nsss.sort()\na = int(sss[0])\nb = int(sss[1])\nc = int(sss[2])\nprint(a,b,c)\n", "language": "Python", "metadata": {"date": 1573102286, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02393.html", "problem_id": "p02393", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02393/input.txt", "sample_output_relpath": "derived/input_output/data/p02393/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02393/Python/s781757007.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s781757007", "user_id": "u945779370"}, "prompt_components": {"gold_output": "1 3 8\n", "input_to_evaluate": "s = input()\nsss = s.split()\nsss.sort()\na = int(sss[0])\nb = int(sss[1])\nc = int(sss[2])\nprint(a,b,c)\n", "problem_context": "Sorting Three Numbers\n\nWrite a program which reads three integers, and prints them in ascending order.\n\nInput\n\nThree integers separated by a single space are given in a line.\n\nOutput\n\nPrint the given integers in ascending order in a line. Put a single space between two integers.\n\nConstraints\n\n1 ≤ the three integers ≤ 10000\n\nSample Input 1\n\n3 8 1\n\nSample Output 1\n\n1 3 8", "sample_input": "3 8 1\n"}, "reference_outputs": ["1 3 8\n"], "source_document_id": "p02393", "source_text": "Sorting Three Numbers\n\nWrite a program which reads three integers, and prints them in ascending order.\n\nInput\n\nThree integers separated by a single space are given in a line.\n\nOutput\n\nPrint the given integers in ascending order in a line. Put a single space between two integers.\n\nConstraints\n\n1 ≤ the three integers ≤ 10000\n\nSample Input 1\n\n3 8 1\n\nSample Output 1\n\n1 3 8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 100, "cpu_time_ms": 20, "memory_kb": 5592}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s462080389", "group_id": "codeNet:p02394", "input_text": "#!usr/bin/env python3\n\ndef string_five_numbers_spliter():\n \"\"\"Split a given space-separated five numbers in a string into integers\n\n Return five integer values from a given space-separated five integers in a string.\n\n Returns:\n Five integer values; namely, w, h, x, y and r\n \"\"\"\n w, h, x, y, r = [int(i) for i in input().split()]\n return w, h, x, y, r\n\n\ndef main():\n # Given that there are a rectangle and a circle.\n # Let w, h, x, y and r be such that:\n # w = width of the rectangle\n # h = height of thek rectangle\n # x = x coordinate for the centre of the circle\n # y = y coordinate for the centre of the circle\n # r = diameter of the circle\n w, h, x, y, r = string_five_numbers_spliter()\n\n if (not (x < 0) and not (y < 0) and\n not (x + r < 0) and not (y + r < 0) and\n not (x + r > w) and not (y + r > h)):\n print('Yes')\n else:\n print('No')\n\n\nif __name__ == '__main__':\n main()", "language": "Python", "metadata": {"date": 1486016836, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02394.html", "problem_id": "p02394", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02394/input.txt", "sample_output_relpath": "derived/input_output/data/p02394/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02394/Python/s462080389.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s462080389", "user_id": "u104171359"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "#!usr/bin/env python3\n\ndef string_five_numbers_spliter():\n \"\"\"Split a given space-separated five numbers in a string into integers\n\n Return five integer values from a given space-separated five integers in a string.\n\n Returns:\n Five integer values; namely, w, h, x, y and r\n \"\"\"\n w, h, x, y, r = [int(i) for i in input().split()]\n return w, h, x, y, r\n\n\ndef main():\n # Given that there are a rectangle and a circle.\n # Let w, h, x, y and r be such that:\n # w = width of the rectangle\n # h = height of thek rectangle\n # x = x coordinate for the centre of the circle\n # y = y coordinate for the centre of the circle\n # r = diameter of the circle\n w, h, x, y, r = string_five_numbers_spliter()\n\n if (not (x < 0) and not (y < 0) and\n not (x + r < 0) and not (y + r < 0) and\n not (x + r > w) and not (y + r > h)):\n print('Yes')\n else:\n print('No')\n\n\nif __name__ == '__main__':\n main()", "problem_context": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nCircle in a Rectangle\n\nWrite a program which reads a rectangle and a circle, and determines whether the circle is arranged inside the rectangle. As shown in the following figures, the upper right coordinate $(W, H)$ of the rectangle and the central coordinate $(x, y)$ and radius $r$ of the circle are given.\n\nInput\n\nFive integers $W$, $H$, $x$, $y$ and $r$ separated by a single space are given in a line.\n\nOutput\n\nPrint \"Yes\" if the circle is placed inside the rectangle, otherwise \"No\" in a line.\n\nConstraints\n\n$ -100 \\leq x, y \\leq 100$\n\n$ 0 < W, H, r \\leq 100$\n\nSample Input 1\n\n5 4 2 2 1\n\nSample Output 1\n\nYes\n\nSample Input 2\n\n5 4 2 4 1\n\nSample Output 2\n\nNo", "sample_input": "5 4 2 2 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02394", "source_text": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nCircle in a Rectangle\n\nWrite a program which reads a rectangle and a circle, and determines whether the circle is arranged inside the rectangle. As shown in the following figures, the upper right coordinate $(W, H)$ of the rectangle and the central coordinate $(x, y)$ and radius $r$ of the circle are given.\n\nInput\n\nFive integers $W$, $H$, $x$, $y$ and $r$ separated by a single space are given in a line.\n\nOutput\n\nPrint \"Yes\" if the circle is placed inside the rectangle, otherwise \"No\" in a line.\n\nConstraints\n\n$ -100 \\leq x, y \\leq 100$\n\n$ 0 < W, H, r \\leq 100$\n\nSample Input 1\n\n5 4 2 2 1\n\nSample Output 1\n\nYes\n\nSample Input 2\n\n5 4 2 4 1\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 965, "cpu_time_ms": 30, "memory_kb": 7764}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s583253486", "group_id": "codeNet:p02396", "input_text": "for i in range(10000):\n x = input()\n if x == \"0\":\n break\n print(\"Case {}: {}\".format(i, x))", "language": "Python", "metadata": {"date": 1482504513, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02396.html", "problem_id": "p02396", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02396/input.txt", "sample_output_relpath": "derived/input_output/data/p02396/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02396/Python/s583253486.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s583253486", "user_id": "u865138391"}, "prompt_components": {"gold_output": "Case 1: 3\nCase 2: 5\nCase 3: 11\nCase 4: 7\nCase 5: 8\nCase 6: 19\n", "input_to_evaluate": "for i in range(10000):\n x = input()\n if x == \"0\":\n break\n print(\"Case {}: {}\".format(i, x))", "problem_context": "Print Test Cases\n\nIn the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets.\n\nWrite a program which reads an integer x and print it as is. Note that multiple datasets are given for this problem.\n\nInput\n\nThe input consists of multiple datasets. Each dataset consists of an integer x in a line.\n\nThe input ends with an integer 0. You program should not process (print) for this terminal symbol.\n\nOutput\n\nFor each dataset, print x in the following format:\n\nCase i: x\n\nwhere i is the case number which starts with 1. Put a single space between \"Case\" and i. Also, put a single space between ':' and x.\n\nConstraints\n\n1 ≤ x ≤ 10000\n\nThe number of datasets ≤ 10000\n\nSample Input\n\n3\n5\n11\n7\n8\n19\n0\n\nSample Output\n\nCase 1: 3\nCase 2: 5\nCase 3: 11\nCase 4: 7\nCase 5: 8\nCase 6: 19", "sample_input": "3\n5\n11\n7\n8\n19\n0\n"}, "reference_outputs": ["Case 1: 3\nCase 2: 5\nCase 3: 11\nCase 4: 7\nCase 5: 8\nCase 6: 19\n"], "source_document_id": "p02396", "source_text": "Print Test Cases\n\nIn the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets.\n\nWrite a program which reads an integer x and print it as is. Note that multiple datasets are given for this problem.\n\nInput\n\nThe input consists of multiple datasets. Each dataset consists of an integer x in a line.\n\nThe input ends with an integer 0. You program should not process (print) for this terminal symbol.\n\nOutput\n\nFor each dataset, print x in the following format:\n\nCase i: x\n\nwhere i is the case number which starts with 1. Put a single space between \"Case\" and i. Also, put a single space between ':' and x.\n\nConstraints\n\n1 ≤ x ≤ 10000\n\nThe number of datasets ≤ 10000\n\nSample Input\n\n3\n5\n11\n7\n8\n19\n0\n\nSample Output\n\nCase 1: 3\nCase 2: 5\nCase 3: 11\nCase 4: 7\nCase 5: 8\nCase 6: 19", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 107, "cpu_time_ms": 130, "memory_kb": 7476}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s894085634", "group_id": "codeNet:p02397", "input_text": "while True:\n x,y = map(int,input().split())\n if x == 0 and y == 0:\n break\n if x > y:\n print(y,x)\n else:\n print(x,y)\n", "language": "Python", "metadata": {"date": 1558328478, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02397.html", "problem_id": "p02397", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02397/input.txt", "sample_output_relpath": "derived/input_output/data/p02397/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02397/Python/s894085634.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s894085634", "user_id": "u013648252"}, "prompt_components": {"gold_output": "2 3\n2 2\n3 5\n", "input_to_evaluate": "while True:\n x,y = map(int,input().split())\n if x == 0 and y == 0:\n break\n if x > y:\n print(y,x)\n else:\n print(x,y)\n", "problem_context": "Swapping Two Numbers\n\nWrite a program which reads two integers x and y, and prints them in ascending order.\n\nInput\n\nThe input consists of multiple datasets. Each dataset consists of two integers x and y separated by a single space.\n\nThe input ends with two 0 (when both x and y are zero). Your program should not process for these terminal symbols.\n\nOutput\n\nFor each dataset, print x and y in ascending order in a line. Put a single space between x and y.\n\nConstraints\n\n0 ≤ x, y ≤ 10000\n\nthe number of datasets ≤ 3000\n\nSample Input\n\n3 2\n2 2\n5 3\n0 0\n\nSample Output\n\n2 3\n2 2\n3 5", "sample_input": "3 2\n2 2\n5 3\n0 0\n"}, "reference_outputs": ["2 3\n2 2\n3 5\n"], "source_document_id": "p02397", "source_text": "Swapping Two Numbers\n\nWrite a program which reads two integers x and y, and prints them in ascending order.\n\nInput\n\nThe input consists of multiple datasets. Each dataset consists of two integers x and y separated by a single space.\n\nThe input ends with two 0 (when both x and y are zero). Your program should not process for these terminal symbols.\n\nOutput\n\nFor each dataset, print x and y in ascending order in a line. Put a single space between x and y.\n\nConstraints\n\n0 ≤ x, y ≤ 10000\n\nthe number of datasets ≤ 3000\n\nSample Input\n\n3 2\n2 2\n5 3\n0 0\n\nSample Output\n\n2 3\n2 2\n3 5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 129, "cpu_time_ms": 50, "memory_kb": 5612}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s933671793", "group_id": "codeNet:p02399", "input_text": "while True:\n a, b = map(int, input().split())\n if a >= 1 and a <= 1000000000:\n if b >= 1 and b <= 1000000000: break\n\nd = a//b\nr = a%b\nf = a/b\n \nprint('{0} {1} {2:.8g}' .format(d, r, f))\n", "language": "Python", "metadata": {"date": 1518878452, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02399.html", "problem_id": "p02399", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02399/input.txt", "sample_output_relpath": "derived/input_output/data/p02399/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02399/Python/s933671793.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s933671793", "user_id": "u585184379"}, "prompt_components": {"gold_output": "1 1 1.50000\n", "input_to_evaluate": "while True:\n a, b = map(int, input().split())\n if a >= 1 and a <= 1000000000:\n if b >= 1 and b <= 1000000000: break\n\nd = a//b\nr = a%b\nf = a/b\n \nprint('{0} {1} {2:.8g}' .format(d, r, f))\n", "problem_context": "A/B Problem\n\nWrite a program which reads two integers a and b, and calculates the following values:\n\na ÷ b: d (in integer)\n\nremainder of a ÷ b: r (in integer)\n\na ÷ b: f (in real number)\n\nInput\n\nTwo integers a and b are given in a line.\n\nOutput\n\nPrint d, r and f separated by a space in a line. For f, the output should not contain an absolute error greater than 10-5.\n\nConstraints\n\n1 ≤ a, b ≤ 109\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n1 1 1.50000", "sample_input": "3 2\n"}, "reference_outputs": ["1 1 1.50000\n"], "source_document_id": "p02399", "source_text": "A/B Problem\n\nWrite a program which reads two integers a and b, and calculates the following values:\n\na ÷ b: d (in integer)\n\nremainder of a ÷ b: r (in integer)\n\na ÷ b: f (in real number)\n\nInput\n\nTwo integers a and b are given in a line.\n\nOutput\n\nPrint d, r and f separated by a space in a line. For f, the output should not contain an absolute error greater than 10-5.\n\nConstraints\n\n1 ≤ a, b ≤ 109\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n1 1 1.50000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 223, "cpu_time_ms": 20, "memory_kb": 5612}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s528686353", "group_id": "codeNet:p02400", "input_text": "import math\npi = math.pi\nr = float(input())\nprint('%.6f %.6f' % (pi*r**2, 2*pi*r))\n", "language": "Python", "metadata": {"date": 1546095980, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02400.html", "problem_id": "p02400", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02400/input.txt", "sample_output_relpath": "derived/input_output/data/p02400/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02400/Python/s528686353.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s528686353", "user_id": "u879471116"}, "prompt_components": {"gold_output": "12.566371 12.566371\n", "input_to_evaluate": "import math\npi = math.pi\nr = float(input())\nprint('%.6f %.6f' % (pi*r**2, 2*pi*r))\n", "problem_context": "Circle\n\nWrite a program which calculates the area and circumference of a circle for given radius r.\n\nInput\n\nA real number r is given.\n\nOutput\n\nPrint the area and circumference of the circle in a line. Put a single space between them. The output should not contain an absolute error greater than 10-5.\n\nConstraints\n\n0 < r < 10000\n\nSample Input 1\n\n2\n\nSample Output 1\n\n12.566371 12.566371\n\nSample Input 2\n\n3\n\nSample Output 2\n\n28.274334 18.849556", "sample_input": "2\n"}, "reference_outputs": ["12.566371 12.566371\n"], "source_document_id": "p02400", "source_text": "Circle\n\nWrite a program which calculates the area and circumference of a circle for given radius r.\n\nInput\n\nA real number r is given.\n\nOutput\n\nPrint the area and circumference of the circle in a line. Put a single space between them. The output should not contain an absolute error greater than 10-5.\n\nConstraints\n\n0 < r < 10000\n\nSample Input 1\n\n2\n\nSample Output 1\n\n12.566371 12.566371\n\nSample Input 2\n\n3\n\nSample Output 2\n\n28.274334 18.849556", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 83, "cpu_time_ms": 20, "memory_kb": 5636}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s410749607", "group_id": "codeNet:p02400", "input_text": "import math\nr = float(input())\ncc = r * r * math.pi\nab = (r + r) * math.pi\nprint(\"%.6f\"%(cc), \"%.6f\"%(ab))", "language": "Python", "metadata": {"date": 1505365248, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02400.html", "problem_id": "p02400", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02400/input.txt", "sample_output_relpath": "derived/input_output/data/p02400/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02400/Python/s410749607.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s410749607", "user_id": "u027634846"}, "prompt_components": {"gold_output": "12.566371 12.566371\n", "input_to_evaluate": "import math\nr = float(input())\ncc = r * r * math.pi\nab = (r + r) * math.pi\nprint(\"%.6f\"%(cc), \"%.6f\"%(ab))", "problem_context": "Circle\n\nWrite a program which calculates the area and circumference of a circle for given radius r.\n\nInput\n\nA real number r is given.\n\nOutput\n\nPrint the area and circumference of the circle in a line. Put a single space between them. The output should not contain an absolute error greater than 10-5.\n\nConstraints\n\n0 < r < 10000\n\nSample Input 1\n\n2\n\nSample Output 1\n\n12.566371 12.566371\n\nSample Input 2\n\n3\n\nSample Output 2\n\n28.274334 18.849556", "sample_input": "2\n"}, "reference_outputs": ["12.566371 12.566371\n"], "source_document_id": "p02400", "source_text": "Circle\n\nWrite a program which calculates the area and circumference of a circle for given radius r.\n\nInput\n\nA real number r is given.\n\nOutput\n\nPrint the area and circumference of the circle in a line. Put a single space between them. The output should not contain an absolute error greater than 10-5.\n\nConstraints\n\n0 < r < 10000\n\nSample Input 1\n\n2\n\nSample Output 1\n\n12.566371 12.566371\n\nSample Input 2\n\n3\n\nSample Output 2\n\n28.274334 18.849556", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 106, "cpu_time_ms": 30, "memory_kb": 7420}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s938584027", "group_id": "codeNet:p02401", "input_text": "# coding: utf-8\n# Your code here!\n# ITP1_4_C\n\n\nwhile(True):\n x,k,y=input().split()\n x=int(x)\n y=int(y)\n if k=='?':\n break\n else:\n if k=='+':\n print(x+y)\n elif k=='-':\n print(x-y)\n elif k=='*':\n print(x*y)\n elif k=='/':\n print(int(x/y))\n", "language": "Python", "metadata": {"date": 1535627843, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02401.html", "problem_id": "p02401", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02401/input.txt", "sample_output_relpath": "derived/input_output/data/p02401/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02401/Python/s938584027.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s938584027", "user_id": "u096070545"}, "prompt_components": {"gold_output": "3\n38\n26\n10\n108\n", "input_to_evaluate": "# coding: utf-8\n# Your code here!\n# ITP1_4_C\n\n\nwhile(True):\n x,k,y=input().split()\n x=int(x)\n y=int(y)\n if k=='?':\n break\n else:\n if k=='+':\n print(x+y)\n elif k=='-':\n print(x-y)\n elif k=='*':\n print(x*y)\n elif k=='/':\n print(int(x/y))\n", "problem_context": "Simple Calculator\n\nWrite a program which reads two integers a, b and an operator op, and then prints the value of a op b.\n\nThe operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part.\n\nInput\n\nThe input consists of multiple datasets. Each dataset is given in the following format.\n\na op b\n\nThe input ends with a dataset where op = '?'. Your program should not process for this dataset.\n\nOutput\n\nFor each dataset, print the value in a line.\n\nConstraints\n\n0 ≤ a, b ≤ 20000\n\nNo divisions by zero are given.\n\nSample Input 1\n\n1 + 2\n56 - 18\n13 * 2\n100 / 10\n27 + 81\n0 ? 0\n\nSample Output 1\n\n3\n38\n26\n10\n108", "sample_input": "1 + 2\n56 - 18\n13 * 2\n100 / 10\n27 + 81\n0 ? 0\n"}, "reference_outputs": ["3\n38\n26\n10\n108\n"], "source_document_id": "p02401", "source_text": "Simple Calculator\n\nWrite a program which reads two integers a, b and an operator op, and then prints the value of a op b.\n\nThe operator op is '+', '-', '*' or '/' (sum, difference, product or quotient). The division should truncate any fractional part.\n\nInput\n\nThe input consists of multiple datasets. Each dataset is given in the following format.\n\na op b\n\nThe input ends with a dataset where op = '?'. Your program should not process for this dataset.\n\nOutput\n\nFor each dataset, print the value in a line.\n\nConstraints\n\n0 ≤ a, b ≤ 20000\n\nNo divisions by zero are given.\n\nSample Input 1\n\n1 + 2\n56 - 18\n13 * 2\n100 / 10\n27 + 81\n0 ? 0\n\nSample Output 1\n\n3\n38\n26\n10\n108", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 330, "cpu_time_ms": 20, "memory_kb": 5600}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s875021643", "group_id": "codeNet:p02402", "input_text": "n=int(input())\nnlist = list(map(int,input().split()))\n\na = min(nlist)\nb = max(nlist) \nc = sum(nlist)\nprint(a,b,c)\n", "language": "Python", "metadata": {"date": 1592266737, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02402.html", "problem_id": "p02402", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02402/input.txt", "sample_output_relpath": "derived/input_output/data/p02402/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02402/Python/s875021643.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s875021643", "user_id": "u397004753"}, "prompt_components": {"gold_output": "1 17 37\n", "input_to_evaluate": "n=int(input())\nnlist = list(map(int,input().split()))\n\na = min(nlist)\nb = max(nlist) \nc = sum(nlist)\nprint(a,b,c)\n", "problem_context": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nMin, Max and Sum\n\nWrite a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence.\n\nInput\n\nIn the first line, an integer $n$ is given. In the next line, $n$ integers $a_i$ are given in a line.\n\nOutput\n\nPrint the minimum value, maximum value and sum in a line. Put a single space between the values.\n\nConstraints\n\n$0 < n \\leq 10000$\n\n$-1000000 \\leq a_i \\leq 1000000$\n\nSample Input\n\n5\n10 1 5 4 17\n\nSample Output\n\n1 17 37", "sample_input": "5\n10 1 5 4 17\n"}, "reference_outputs": ["1 17 37\n"], "source_document_id": "p02402", "source_text": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nMin, Max and Sum\n\nWrite a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence.\n\nInput\n\nIn the first line, an integer $n$ is given. In the next line, $n$ integers $a_i$ are given in a line.\n\nOutput\n\nPrint the minimum value, maximum value and sum in a line. Put a single space between the values.\n\nConstraints\n\n$0 < n \\leq 10000$\n\n$-1000000 \\leq a_i \\leq 1000000$\n\nSample Input\n\n5\n10 1 5 4 17\n\nSample Output\n\n1 17 37", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 114, "cpu_time_ms": 20, "memory_kb": 6584}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s765086045", "group_id": "codeNet:p02402", "input_text": "mina=+1000*1000;maxa=-1000*1000;suma=0\ninput()\nfor a in tuple(map(int,input().split())):\n mina=min(mina,a);maxa=max(maxa,a);suma+=a\nprint(mina,maxa,suma)\n", "language": "Python", "metadata": {"date": 1567507552, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02402.html", "problem_id": "p02402", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02402/input.txt", "sample_output_relpath": "derived/input_output/data/p02402/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02402/Python/s765086045.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s765086045", "user_id": "u003984259"}, "prompt_components": {"gold_output": "1 17 37\n", "input_to_evaluate": "mina=+1000*1000;maxa=-1000*1000;suma=0\ninput()\nfor a in tuple(map(int,input().split())):\n mina=min(mina,a);maxa=max(maxa,a);suma+=a\nprint(mina,maxa,suma)\n", "problem_context": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nMin, Max and Sum\n\nWrite a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence.\n\nInput\n\nIn the first line, an integer $n$ is given. In the next line, $n$ integers $a_i$ are given in a line.\n\nOutput\n\nPrint the minimum value, maximum value and sum in a line. Put a single space between the values.\n\nConstraints\n\n$0 < n \\leq 10000$\n\n$-1000000 \\leq a_i \\leq 1000000$\n\nSample Input\n\n5\n10 1 5 4 17\n\nSample Output\n\n1 17 37", "sample_input": "5\n10 1 5 4 17\n"}, "reference_outputs": ["1 17 37\n"], "source_document_id": "p02402", "source_text": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nMin, Max and Sum\n\nWrite a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence.\n\nInput\n\nIn the first line, an integer $n$ is given. In the next line, $n$ integers $a_i$ are given in a line.\n\nOutput\n\nPrint the minimum value, maximum value and sum in a line. Put a single space between the values.\n\nConstraints\n\n$0 < n \\leq 10000$\n\n$-1000000 \\leq a_i \\leq 1000000$\n\nSample Input\n\n5\n10 1 5 4 17\n\nSample Output\n\n1 17 37", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 157, "cpu_time_ms": 20, "memory_kb": 6548}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s818508910", "group_id": "codeNet:p02403", "input_text": "while(True):\n h, w = map(int, input().split())\n if(h == 0 and w == 0):\n break\n for _ in range(h):\n print('#' * w)\n print()\n", "language": "Python", "metadata": {"date": 1556177217, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02403.html", "problem_id": "p02403", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02403/input.txt", "sample_output_relpath": "derived/input_output/data/p02403/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02403/Python/s818508910.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s818508910", "user_id": "u252054808"}, "prompt_components": {"gold_output": "####\n####\n####\n\n######\n######\n######\n######\n######\n\n##\n##\n", "input_to_evaluate": "while(True):\n h, w = map(int, input().split())\n if(h == 0 and w == 0):\n break\n for _ in range(h):\n print('#' * w)\n print()\n", "problem_context": "Print a Rectangle\n\nDraw a rectangle which has a height of H cm and a width of W cm. Draw a 1-cm square by single '#'.\n\nInput\n\nThe input consists of multiple datasets. Each dataset consists of two integers H and W separated by a single space.\n\nThe input ends with two 0 (when both H and W are zero).\n\nOutput\n\nFor each dataset, print the rectangle made of H × W '#'.\n\nPrint a blank line after each dataset.\n\nConstraints\n\n1 ≤ H ≤ 300\n\n1 ≤ W ≤ 300\n\nSample Input\n\n3 4\n5 6\n2 2\n0 0\n\nSample Output\n\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n##\n##", "sample_input": "3 4\n5 6\n2 2\n0 0\n"}, "reference_outputs": ["####\n####\n####\n\n######\n######\n######\n######\n######\n\n##\n##\n"], "source_document_id": "p02403", "source_text": "Print a Rectangle\n\nDraw a rectangle which has a height of H cm and a width of W cm. Draw a 1-cm square by single '#'.\n\nInput\n\nThe input consists of multiple datasets. Each dataset consists of two integers H and W separated by a single space.\n\nThe input ends with two 0 (when both H and W are zero).\n\nOutput\n\nFor each dataset, print the rectangle made of H × W '#'.\n\nPrint a blank line after each dataset.\n\nConstraints\n\n1 ≤ H ≤ 300\n\n1 ≤ W ≤ 300\n\nSample Input\n\n3 4\n5 6\n2 2\n0 0\n\nSample Output\n\n####\n####\n####\n\n######\n######\n######\n######\n######\n\n##\n##", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 149, "cpu_time_ms": 20, "memory_kb": 5612}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s961162168", "group_id": "codeNet:p02404", "input_text": "i=0\nwhile True:\n H,W=map(int,input().split())\n if H==0 and W==0:\n break\n for j in range(H):\n for k in range(W):\n if j==0 or j==(H-1) or k==0 or k==(W-1):\n print(\"#\",end=\"\")\n else:\n print(\".\",end=\"\")\n print(\"\\n\",end=\"\")\n print(\"\\n\",end=\"\")\n i+=1\n", "language": "Python", "metadata": {"date": 1590455798, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02404.html", "problem_id": "p02404", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02404/input.txt", "sample_output_relpath": "derived/input_output/data/p02404/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02404/Python/s961162168.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s961162168", "user_id": "u918533241"}, "prompt_components": {"gold_output": "####\n#..#\n####\n\n######\n#....#\n#....#\n#....#\n######\n\n###\n#.#\n###\n", "input_to_evaluate": "i=0\nwhile True:\n H,W=map(int,input().split())\n if H==0 and W==0:\n break\n for j in range(H):\n for k in range(W):\n if j==0 or j==(H-1) or k==0 or k==(W-1):\n print(\"#\",end=\"\")\n else:\n print(\".\",end=\"\")\n print(\"\\n\",end=\"\")\n print(\"\\n\",end=\"\")\n i+=1\n", "problem_context": "Print a Frame\n\nDraw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm.\n\n##########\n#........#\n#........#\n#........#\n#........#\n##########\n\nInput\n\nThe input consists of multiple datasets. Each dataset consists of two integers H and W separated by a single space.\n\nThe input ends with two 0 (when both H and W are zero).\n\nOutput\n\nFor each dataset, print the frame made of '#' and '.'.\n\nPrint a blank line after each dataset.\n\nConstraints\n\n3 ≤ H ≤ 300\n\n3 ≤ W ≤ 300\n\nSample Input\n\n3 4\n5 6\n3 3\n0 0\n\nSample Output\n\n####\n#..#\n####\n\n######\n#....#\n#....#\n#....#\n######\n\n###\n#.#\n###", "sample_input": "3 4\n5 6\n3 3\n0 0\n"}, "reference_outputs": ["####\n#..#\n####\n\n######\n#....#\n#....#\n#....#\n######\n\n###\n#.#\n###\n"], "source_document_id": "p02404", "source_text": "Print a Frame\n\nDraw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm.\n\n##########\n#........#\n#........#\n#........#\n#........#\n##########\n\nInput\n\nThe input consists of multiple datasets. Each dataset consists of two integers H and W separated by a single space.\n\nThe input ends with two 0 (when both H and W are zero).\n\nOutput\n\nFor each dataset, print the frame made of '#' and '.'.\n\nPrint a blank line after each dataset.\n\nConstraints\n\n3 ≤ H ≤ 300\n\n3 ≤ W ≤ 300\n\nSample Input\n\n3 4\n5 6\n3 3\n0 0\n\nSample Output\n\n####\n#..#\n####\n\n######\n#....#\n#....#\n#....#\n######\n\n###\n#.#\n###", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 333, "cpu_time_ms": 90, "memory_kb": 7012}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s365380636", "group_id": "codeNet:p02405", "input_text": "def even_line(w):\n s=''\n for i in range(0,w):\n if i%2 == 0:\n s=s+'#'\n else:\n s=s+'.'\n print(s)\n\ndef odd_line(w):\n s=''\n for i in range(0,w):\n if i%2 == 0:\n s=s+'.'\n else:\n s=s+'#'\n\n print(s)\n\nif __name__ == '__main__':\n\n h, w = map(int, input().split())\n\n while (h != 0) and (w != 0):\n for i in range(0,h):\n if i%2==0:\n even_line(w)\n else:\n odd_line(w)\n print()\n h, w = map(int, input().split())\n\n", "language": "Python", "metadata": {"date": 1519038226, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02405.html", "problem_id": "p02405", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02405/input.txt", "sample_output_relpath": "derived/input_output/data/p02405/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02405/Python/s365380636.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "WA: Presentation Error", "submission_id": "s365380636", "user_id": "u641357568"}, "prompt_components": {"gold_output": "#.#.\n.#.#\n#.#.\n\n#.#.#.\n.#.#.#\n#.#.#.\n.#.#.#\n#.#.#.\n\n#.#\n.#.\n#.#\n\n#.\n.#\n\n#\n", "input_to_evaluate": "def even_line(w):\n s=''\n for i in range(0,w):\n if i%2 == 0:\n s=s+'#'\n else:\n s=s+'.'\n print(s)\n\ndef odd_line(w):\n s=''\n for i in range(0,w):\n if i%2 == 0:\n s=s+'.'\n else:\n s=s+'#'\n\n print(s)\n\nif __name__ == '__main__':\n\n h, w = map(int, input().split())\n\n while (h != 0) and (w != 0):\n for i in range(0,h):\n if i%2==0:\n even_line(w)\n else:\n odd_line(w)\n print()\n h, w = map(int, input().split())\n\n", "problem_context": "Print a Chessboard\n\nDraw a chessboard which has a height of H cm and a width of W cm. For example, the following figure shows a chessboard which has a height of 6 cm and a width of 10 cm.\n\n#.#.#.#.#.\n.#.#.#.#.#\n#.#.#.#.#.\n.#.#.#.#.#\n#.#.#.#.#.\n.#.#.#.#.#\n\nNote that the top left corner should be drawn by '#'.\n\nInput\n\nThe input consists of multiple datasets. Each dataset consists of two integers H and W separated by a single space.\n\nThe input ends with two 0 (when both H and W are zero).\n\nOutput\n\nFor each dataset, print the chessboard made of '#' and '.'.\n\nPrint a blank line after each dataset.\n\nConstraints\n\n1 ≤ H ≤ 300\n\n1 ≤ W ≤ 300\n\nSample Input\n\n3 4\n5 6\n3 3\n2 2\n1 1\n0 0\n\nSample Output\n\n#.#.\n.#.#\n#.#.\n\n#.#.#.\n.#.#.#\n#.#.#.\n.#.#.#\n#.#.#.\n\n#.#\n.#.\n#.#\n\n#.\n.#\n\n#", "sample_input": "3 4\n5 6\n3 3\n2 2\n1 1\n0 0\n"}, "reference_outputs": ["#.#.\n.#.#\n#.#.\n\n#.#.#.\n.#.#.#\n#.#.#.\n.#.#.#\n#.#.#.\n\n#.#\n.#.\n#.#\n\n#.\n.#\n\n#\n"], "source_document_id": "p02405", "source_text": "Print a Chessboard\n\nDraw a chessboard which has a height of H cm and a width of W cm. For example, the following figure shows a chessboard which has a height of 6 cm and a width of 10 cm.\n\n#.#.#.#.#.\n.#.#.#.#.#\n#.#.#.#.#.\n.#.#.#.#.#\n#.#.#.#.#.\n.#.#.#.#.#\n\nNote that the top left corner should be drawn by '#'.\n\nInput\n\nThe input consists of multiple datasets. Each dataset consists of two integers H and W separated by a single space.\n\nThe input ends with two 0 (when both H and W are zero).\n\nOutput\n\nFor each dataset, print the chessboard made of '#' and '.'.\n\nPrint a blank line after each dataset.\n\nConstraints\n\n1 ≤ H ≤ 300\n\n1 ≤ W ≤ 300\n\nSample Input\n\n3 4\n5 6\n3 3\n2 2\n1 1\n0 0\n\nSample Output\n\n#.#.\n.#.#\n#.#.\n\n#.#.#.\n.#.#.#\n#.#.#.\n.#.#.#\n#.#.#.\n\n#.#\n.#.\n#.#\n\n#.\n.#\n\n#", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 570, "cpu_time_ms": 30, "memory_kb": 5596}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s940257542", "group_id": "codeNet:p02406", "input_text": "import sys\ntry:\n\twhile 1:\n\t\tN=input()\n\t\ti = 1\n\t\twhile 1:\n\t\t\tif (i % 3) == 0 :\n\t\t\t\tsys.stdout.write(\" \")\n\t\t\t\tsys.stdout.write(\"%d\" % i)\n\t\t\telse:\n\t\t\t\tif (i % 10 ) == 3 or (i/10)%10 == 3:\n\t\t\t\t\tsys.stdout.write(' ')\n\t\t\t\t\tsys.stdout.write(\"%d\" % i)\n\t\t\tif i+1 > N:\n\t\t\t\tsys.stdout.write('\\n')\n\t\t\t\traise Exception\n\t\t\ti += 1\nexcept Exception:\n\tpass", "language": "Python", "metadata": {"date": 1486048987, "filename_ext": "py", "original_language": "Python", "problem_description_relpath": "problem_descriptions/p02406.html", "problem_id": "p02406", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02406/input.txt", "sample_output_relpath": "derived/input_output/data/p02406/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02406/Python/s940257542.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s940257542", "user_id": "u307520683"}, "prompt_components": {"gold_output": " 3 6 9 12 13 15 18 21 23 24 27 30\n", "input_to_evaluate": "import sys\ntry:\n\twhile 1:\n\t\tN=input()\n\t\ti = 1\n\t\twhile 1:\n\t\t\tif (i % 3) == 0 :\n\t\t\t\tsys.stdout.write(\" \")\n\t\t\t\tsys.stdout.write(\"%d\" % i)\n\t\t\telse:\n\t\t\t\tif (i % 10 ) == 3 or (i/10)%10 == 3:\n\t\t\t\t\tsys.stdout.write(' ')\n\t\t\t\t\tsys.stdout.write(\"%d\" % i)\n\t\t\tif i+1 > N:\n\t\t\t\tsys.stdout.write('\\n')\n\t\t\t\traise Exception\n\t\t\ti += 1\nexcept Exception:\n\tpass", "problem_context": "Structured Programming\n\nIn programming languages like C/C++, a goto statement provides an unconditional jump from the \"goto\" to a labeled statement. For example, a statement \"goto CHECK_NUM;\" is executed, control of the program jumps to CHECK_NUM. Using these constructs, you can implement, for example, loops.\n\nNote that use of goto statement is highly discouraged, because it is difficult to trace the control flow of a program which includes goto.\n\nWrite a program which does precisely the same thing as the following program (this example is wrtten in C++). Let's try to write the program without goto statements.\n\nvoid call(int n){\nint i = 1;\nCHECK_NUM:\nint x = i;\nif ( x % 3 == 0 ){\ncout << \" \" << i;\ngoto END_CHECK_NUM;\n}\nINCLUDE3:\nif ( x % 10 == 3 ){\ncout << \" \" << i;\ngoto END_CHECK_NUM;\n}\nx /= 10;\nif ( x ) goto INCLUDE3;\nEND_CHECK_NUM:\nif ( ++i <= n ) goto CHECK_NUM;\n\ncout << endl;\n}\n\nInput\n\nAn integer n is given in a line.\n\nOutput\n\nPrint the output result of the above program for given integer n.\n\nConstraints\n\n3 ≤ n ≤ 10000\n\nSample Input\n\n30\n\nSample Output\n\n3 6 9 12 13 15 18 21 23 24 27 30\n\nPut a single space character before each element.", "sample_input": "30\n"}, "reference_outputs": [" 3 6 9 12 13 15 18 21 23 24 27 30\n"], "source_document_id": "p02406", "source_text": "Structured Programming\n\nIn programming languages like C/C++, a goto statement provides an unconditional jump from the \"goto\" to a labeled statement. For example, a statement \"goto CHECK_NUM;\" is executed, control of the program jumps to CHECK_NUM. Using these constructs, you can implement, for example, loops.\n\nNote that use of goto statement is highly discouraged, because it is difficult to trace the control flow of a program which includes goto.\n\nWrite a program which does precisely the same thing as the following program (this example is wrtten in C++). Let's try to write the program without goto statements.\n\nvoid call(int n){\nint i = 1;\nCHECK_NUM:\nint x = i;\nif ( x % 3 == 0 ){\ncout << \" \" << i;\ngoto END_CHECK_NUM;\n}\nINCLUDE3:\nif ( x % 10 == 3 ){\ncout << \" \" << i;\ngoto END_CHECK_NUM;\n}\nx /= 10;\nif ( x ) goto INCLUDE3;\nEND_CHECK_NUM:\nif ( ++i <= n ) goto CHECK_NUM;\n\ncout << endl;\n}\n\nInput\n\nAn integer n is given in a line.\n\nOutput\n\nPrint the output result of the above program for given integer n.\n\nConstraints\n\n3 ≤ n ≤ 10000\n\nSample Input\n\n30\n\nSample Output\n\n3 6 9 12 13 15 18 21 23 24 27 30\n\nPut a single space character before each element.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 10, "memory_kb": 6440}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s617517649", "group_id": "codeNet:p02407", "input_text": "n = int(input())\na = list(map(int, input().split()))\nfor i in range(n-1, -1, -1):\n if i == 0:\n print(a[i])\n else:\n print(a[i], end=' ')\n\n", "language": "Python", "metadata": {"date": 1597762942, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02407.html", "problem_id": "p02407", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02407/input.txt", "sample_output_relpath": "derived/input_output/data/p02407/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02407/Python/s617517649.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s617517649", "user_id": "u440762960"}, "prompt_components": {"gold_output": "5 4 3 2 1\n", "input_to_evaluate": "n = int(input())\na = list(map(int, input().split()))\nfor i in range(n-1, -1, -1):\n if i == 0:\n print(a[i])\n else:\n print(a[i], end=' ')\n\n", "problem_context": "Reversing Numbers\n\nWrite a program which reads a sequence and prints it in the reverse order.\n\nInput\n\nThe input is given in the following format:\n\nn\na1 a2 . . . an\n\nn is the size of the sequence and ai is the ith element of the sequence.\n\nOutput\n\nPrint the reversed sequence in a line. Print a single space character between adjacent elements (Note that your program should not put a space character after the last element).\n\nConstraints\n\nn ≤ 100\n\n0 ≤ ai < 1000\n\nSample Input 1\n\n5\n1 2 3 4 5\n\nSample Output 1\n\n5 4 3 2 1\n\nSample Input 2\n\n8\n3 3 4 4 5 8 7 9\n\nSample Output 2\n\n9 7 8 5 4 4 3 3\n\nNote\n\n      解説", "sample_input": "5\n1 2 3 4 5\n"}, "reference_outputs": ["5 4 3 2 1\n"], "source_document_id": "p02407", "source_text": "Reversing Numbers\n\nWrite a program which reads a sequence and prints it in the reverse order.\n\nInput\n\nThe input is given in the following format:\n\nn\na1 a2 . . . an\n\nn is the size of the sequence and ai is the ith element of the sequence.\n\nOutput\n\nPrint the reversed sequence in a line. Print a single space character between adjacent elements (Note that your program should not put a space character after the last element).\n\nConstraints\n\nn ≤ 100\n\n0 ≤ ai < 1000\n\nSample Input 1\n\n5\n1 2 3 4 5\n\nSample Output 1\n\n5 4 3 2 1\n\nSample Input 2\n\n8\n3 3 4 4 5 8 7 9\n\nSample Output 2\n\n9 7 8 5 4 4 3 3\n\nNote\n\n      解説", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 157, "cpu_time_ms": 20, "memory_kb": 5600}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s210027001", "group_id": "codeNet:p02408", "input_text": "from sys import stdin\nimport copy\n\ndef output(string, lis):\n for num in lis:\n print(string, num)\n\nn = int(stdin.readline())\n\n#ナンバーリスト作成\nslist = []\nfor i in range(1,14):\n slist.append(i)\n\nhlist = copy.copy(slist)\nclist = copy.copy(slist)\ndlist = copy.copy(slist)\n\nfor _ in range(n):\n mark, number = map(str, stdin.readline().split())\n if mark == 'S':\n slist.remove(int(number))\n elif mark == 'H':\n hlist.remove(int(number))\n elif mark == 'C':\n clist.remove(int(number))\n elif mark == 'D':\n dlist.remove(int(number))\n\noutput('S', slist)\noutput('H', hlist)\noutput('C', clist)\noutput('D', dlist)\n", "language": "Python", "metadata": {"date": 1588818611, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02408.html", "problem_id": "p02408", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02408/input.txt", "sample_output_relpath": "derived/input_output/data/p02408/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02408/Python/s210027001.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s210027001", "user_id": "u864060739"}, "prompt_components": {"gold_output": "S 1\nH 3\nH 7\nC 12\nD 8\n", "input_to_evaluate": "from sys import stdin\nimport copy\n\ndef output(string, lis):\n for num in lis:\n print(string, num)\n\nn = int(stdin.readline())\n\n#ナンバーリスト作成\nslist = []\nfor i in range(1,14):\n slist.append(i)\n\nhlist = copy.copy(slist)\nclist = copy.copy(slist)\ndlist = copy.copy(slist)\n\nfor _ in range(n):\n mark, number = map(str, stdin.readline().split())\n if mark == 'S':\n slist.remove(int(number))\n elif mark == 'H':\n hlist.remove(int(number))\n elif mark == 'C':\n clist.remove(int(number))\n elif mark == 'D':\n dlist.remove(int(number))\n\noutput('S', slist)\noutput('H', hlist)\noutput('C', clist)\noutput('D', dlist)\n", "problem_context": "Finding Missing Cards\n\nTaro is going to play a card game. However, now he has only n cards, even though there should be 52 cards (he has no Jokers).\n\nThe 52 cards include 13 ranks of each of the four suits: spade, heart, club and diamond.\n\nInput\n\nIn the first line, the number of cards n (n ≤ 52) is given.\n\nIn the following n lines, data of the n cards are given. Each card is given by a pair of a character and an integer which represent its suit and rank respectively. A suit is represented by 'S', 'H', 'C' and 'D' for spades, hearts, clubs and diamonds respectively. A rank is represented by an integer from 1 to 13.\n\nOutput\n\nPrint the missing cards. The same as the input format, each card should be printed with a character and an integer separated by a space character in a line.\nArrange the missing cards in the following priorities:\n\nPrint cards of spades, hearts, clubs and diamonds in this order.\n\nIf the suits are equal, print cards with lower ranks first.\n\nSample Input\n\n47\nS 10\nS 11\nS 12\nS 13\nH 1\nH 2\nS 6\nS 7\nS 8\nS 9\nH 6\nH 8\nH 9\nH 10\nH 11\nH 4\nH 5\nS 2\nS 3\nS 4\nS 5\nH 12\nH 13\nC 1\nC 2\nD 1\nD 2\nD 3\nD 4\nD 5\nD 6\nD 7\nC 3\nC 4\nC 5\nC 6\nC 7\nC 8\nC 9\nC 10\nC 11\nC 13\nD 9\nD 10\nD 11\nD 12\nD 13\n\nSample Output\n\nS 1\nH 3\nH 7\nC 12\nD 8\n\nNote\n\n      解説", "sample_input": "47\nS 10\nS 11\nS 12\nS 13\nH 1\nH 2\nS 6\nS 7\nS 8\nS 9\nH 6\nH 8\nH 9\nH 10\nH 11\nH 4\nH 5\nS 2\nS 3\nS 4\nS 5\nH 12\nH 13\nC 1\nC 2\nD 1\nD 2\nD 3\nD 4\nD 5\nD 6\nD 7\nC 3\nC 4\nC 5\nC 6\nC 7\nC 8\nC 9\nC 10\nC 11\nC 13\nD 9\nD 10\nD 11\nD 12\nD 13\n"}, "reference_outputs": ["S 1\nH 3\nH 7\nC 12\nD 8\n"], "source_document_id": "p02408", "source_text": "Finding Missing Cards\n\nTaro is going to play a card game. However, now he has only n cards, even though there should be 52 cards (he has no Jokers).\n\nThe 52 cards include 13 ranks of each of the four suits: spade, heart, club and diamond.\n\nInput\n\nIn the first line, the number of cards n (n ≤ 52) is given.\n\nIn the following n lines, data of the n cards are given. Each card is given by a pair of a character and an integer which represent its suit and rank respectively. A suit is represented by 'S', 'H', 'C' and 'D' for spades, hearts, clubs and diamonds respectively. A rank is represented by an integer from 1 to 13.\n\nOutput\n\nPrint the missing cards. The same as the input format, each card should be printed with a character and an integer separated by a space character in a line.\nArrange the missing cards in the following priorities:\n\nPrint cards of spades, hearts, clubs and diamonds in this order.\n\nIf the suits are equal, print cards with lower ranks first.\n\nSample Input\n\n47\nS 10\nS 11\nS 12\nS 13\nH 1\nH 2\nS 6\nS 7\nS 8\nS 9\nH 6\nH 8\nH 9\nH 10\nH 11\nH 4\nH 5\nS 2\nS 3\nS 4\nS 5\nH 12\nH 13\nC 1\nC 2\nD 1\nD 2\nD 3\nD 4\nD 5\nD 6\nD 7\nC 3\nC 4\nC 5\nC 6\nC 7\nC 8\nC 9\nC 10\nC 11\nC 13\nD 9\nD 10\nD 11\nD 12\nD 13\n\nSample Output\n\nS 1\nH 3\nH 7\nC 12\nD 8\n\nNote\n\n      解説", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 666, "cpu_time_ms": 30, "memory_kb": 6336}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s883025157", "group_id": "codeNet:p02409", "input_text": "#!/usr/bin/env python3\n\nn = int(input())\nmatrix = []\nwhile n > 0:\n values = [int(x) for x in input().split()]\n matrix.append(values)\n n -= 1\n\nofficial_house = [[[0 for z in range(10)] for y in range(3)] for x in range(4)]\n\nfor b, f, r, v in matrix:\n official_house[b - 1][f - 1][r - 1] += v\n\nfor i in range(4):\n for j in range(3):\n print('',' '.join(str(x) for x in official_house[i][j]))\n print('#' * 20)", "language": "Python", "metadata": {"date": 1480427985, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02409.html", "problem_id": "p02409", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02409/input.txt", "sample_output_relpath": "derived/input_output/data/p02409/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02409/Python/s883025157.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s883025157", "user_id": "u435300817"}, "prompt_components": {"gold_output": " 0 0 8 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n####################\n 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n####################\n 0 0 0 0 0 0 0 0 0 0\n 0 7 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n####################\n 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 1 0 0\n", "input_to_evaluate": "#!/usr/bin/env python3\n\nn = int(input())\nmatrix = []\nwhile n > 0:\n values = [int(x) for x in input().split()]\n matrix.append(values)\n n -= 1\n\nofficial_house = [[[0 for z in range(10)] for y in range(3)] for x in range(4)]\n\nfor b, f, r, v in matrix:\n official_house[b - 1][f - 1][r - 1] += v\n\nfor i in range(4):\n for j in range(3):\n print('',' '.join(str(x) for x in official_house[i][j]))\n print('#' * 20)", "problem_context": "Official House\n\nYou manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room.\n\nFor each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth floor at building b. If v is negative, it means that −v persons left.\n\nAssume that initially no person lives in the building.\n\nInput\n\nIn the first line, the number of notices n is given. In the following n lines, a set of four integers b, f, r and v which represents ith notice is given in a line.\n\nOutput\n\nFor each building, print the information of 1st, 2nd and 3rd floor in this order. For each floor information, print the number of tenants of 1st, 2nd, .. and 10th room in this order. Print a single space character before the number of tenants. Print \"####################\" (20 '#') between buildings.\n\nConstraints\n\nNo incorrect building, floor and room numbers are given.\n\n0 ≤ the number of tenants during the management ≤ 9\n\nSample Input\n\n3\n1 1 3 8\n3 2 2 7\n4 3 8 1\n\nSample Output\n\n0 0 8 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n####################\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n####################\n0 0 0 0 0 0 0 0 0 0\n0 7 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n####################\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 1 0 0", "sample_input": "3\n1 1 3 8\n3 2 2 7\n4 3 8 1\n"}, "reference_outputs": [" 0 0 8 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n####################\n 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n####################\n 0 0 0 0 0 0 0 0 0 0\n 0 7 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n####################\n 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 1 0 0\n"], "source_document_id": "p02409", "source_text": "Official House\n\nYou manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room.\n\nFor each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth floor at building b. If v is negative, it means that −v persons left.\n\nAssume that initially no person lives in the building.\n\nInput\n\nIn the first line, the number of notices n is given. In the following n lines, a set of four integers b, f, r and v which represents ith notice is given in a line.\n\nOutput\n\nFor each building, print the information of 1st, 2nd and 3rd floor in this order. For each floor information, print the number of tenants of 1st, 2nd, .. and 10th room in this order. Print a single space character before the number of tenants. Print \"####################\" (20 '#') between buildings.\n\nConstraints\n\nNo incorrect building, floor and room numbers are given.\n\n0 ≤ the number of tenants during the management ≤ 9\n\nSample Input\n\n3\n1 1 3 8\n3 2 2 7\n4 3 8 1\n\nSample Output\n\n0 0 8 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n####################\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n####################\n0 0 0 0 0 0 0 0 0 0\n0 7 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n####################\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 1 0 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 430, "cpu_time_ms": 20, "memory_kb": 7572}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s069371675", "group_id": "codeNet:p02410", "input_text": "n,m = map(int,input().split())\n\nA = []\nb = []\ntotal = 0\n\nfor i in range(n):\n A.append(list(map(int,input().split())))\n\nfor i in range(m):\n b.append(int(input()))\n\nfor i in range(n):\n for j in range(m):\n total += A[i][j] * b[j]\n print(total)\n total = 0\n", "language": "Python", "metadata": {"date": 1591166243, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02410.html", "problem_id": "p02410", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02410/input.txt", "sample_output_relpath": "derived/input_output/data/p02410/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02410/Python/s069371675.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s069371675", "user_id": "u500034977"}, "prompt_components": {"gold_output": "5\n6\n9\n", "input_to_evaluate": "n,m = map(int,input().split())\n\nA = []\nb = []\ntotal = 0\n\nfor i in range(n):\n A.append(list(map(int,input().split())))\n\nfor i in range(m):\n b.append(int(input()))\n\nfor i in range(n):\n for j in range(m):\n total += A[i][j] * b[j]\n print(total)\n total = 0\n", "problem_context": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nMatrix Vector Multiplication\n\nWrite a program which reads a $ n \\times m$ matrix $A$ and a $m \\times 1$ vector $b$, and prints their product $Ab$.\n\nA column vector with m elements is represented by the following equation.\n\n\\[\nb = \\left(\n\\begin{array}{c}\nb_1 \\\\\nb_2 \\\\\n: \\\\\nb_m \\\\\n\\end{array}\n\\right)\n\\]\n\nA $n \\times m$ matrix with $m$ column vectors, each of which consists of $n$ elements, is represented by the following equation.\n\n\\[\nA = \\left(\n\\begin{array}{cccc}\na_{11} & a_{12} & ... & a_{1m} \\\\\na_{21} & a_{22} & ... & a_{2m} \\\\\n: & : & : & : \\\\\na_{n1} & a_{n2} & ... & a_{nm} \\\\\n\\end{array}\n\\right)\n\\]\n\n$i$-th element of a $m \\times 1$ column vector $b$ is represented by $b_i$ ($i = 1, 2, ..., m$), and the element in $i$-th row and $j$-th column of a matrix $A$ is represented by $a_{ij}$ ($i = 1, 2, ..., n,$ $j = 1, 2, ..., m$).\n\nThe product of a $n \\times m$ matrix $A$ and a $m \\times 1$ column vector $b$ is a $n \\times 1$ column vector $c$, and $c_i$ is obtained by the following formula:\n\n\\[\nc_i = \\sum_{j=1}^m a_{ij}b_j = a_{i1}b_1 + a_{i2}b_2 + ... + a_{im}b_m\n\\]\n\nInput\n\nIn the first line, two integers $n$ and $m$ are given. In the following $n$ lines, $a_{ij}$ are given separated by a single space character. In the next $m$ lines, $b_i$ is given in a line.\n\nOutput\n\nThe output consists of $n$ lines. Print $c_i$ in a line.\n\nConstraints\n\n$1 \\leq n, m \\leq 100$\n\n$0 \\leq b_i, a_{ij} \\leq 1000$\n\nSample Input\n\n3 4\n1 2 0 1\n0 3 0 1\n4 1 1 0\n1\n2\n3\n0\n\nSample Output\n\n5\n6\n9", "sample_input": "3 4\n1 2 0 1\n0 3 0 1\n4 1 1 0\n1\n2\n3\n0\n"}, "reference_outputs": ["5\n6\n9\n"], "source_document_id": "p02410", "source_text": "MathJax.Hub.Config({ tex2jax: { inlineMath: [[\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"]], processEscapes: true }});\n\nMatrix Vector Multiplication\n\nWrite a program which reads a $ n \\times m$ matrix $A$ and a $m \\times 1$ vector $b$, and prints their product $Ab$.\n\nA column vector with m elements is represented by the following equation.\n\n\\[\nb = \\left(\n\\begin{array}{c}\nb_1 \\\\\nb_2 \\\\\n: \\\\\nb_m \\\\\n\\end{array}\n\\right)\n\\]\n\nA $n \\times m$ matrix with $m$ column vectors, each of which consists of $n$ elements, is represented by the following equation.\n\n\\[\nA = \\left(\n\\begin{array}{cccc}\na_{11} & a_{12} & ... & a_{1m} \\\\\na_{21} & a_{22} & ... & a_{2m} \\\\\n: & : & : & : \\\\\na_{n1} & a_{n2} & ... & a_{nm} \\\\\n\\end{array}\n\\right)\n\\]\n\n$i$-th element of a $m \\times 1$ column vector $b$ is represented by $b_i$ ($i = 1, 2, ..., m$), and the element in $i$-th row and $j$-th column of a matrix $A$ is represented by $a_{ij}$ ($i = 1, 2, ..., n,$ $j = 1, 2, ..., m$).\n\nThe product of a $n \\times m$ matrix $A$ and a $m \\times 1$ column vector $b$ is a $n \\times 1$ column vector $c$, and $c_i$ is obtained by the following formula:\n\n\\[\nc_i = \\sum_{j=1}^m a_{ij}b_j = a_{i1}b_1 + a_{i2}b_2 + ... + a_{im}b_m\n\\]\n\nInput\n\nIn the first line, two integers $n$ and $m$ are given. In the following $n$ lines, $a_{ij}$ are given separated by a single space character. In the next $m$ lines, $b_i$ is given in a line.\n\nOutput\n\nThe output consists of $n$ lines. Print $c_i$ in a line.\n\nConstraints\n\n$1 \\leq n, m \\leq 100$\n\n$0 \\leq b_i, a_{ij} \\leq 1000$\n\nSample Input\n\n3 4\n1 2 0 1\n0 3 0 1\n4 1 1 0\n1\n2\n3\n0\n\nSample Output\n\n5\n6\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 274, "cpu_time_ms": 20, "memory_kb": 6012}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s290693099", "group_id": "codeNet:p02419", "input_text": "import sys\n\nW = input().lower()\nT = sys.stdin.read().lower()\n\nprint(T.split().count(W))", "language": "Python", "metadata": {"date": 1486311849, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02419.html", "problem_id": "p02419", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02419/input.txt", "sample_output_relpath": "derived/input_output/data/p02419/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02419/Python/s290693099.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s290693099", "user_id": "u144068724"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import sys\n\nW = input().lower()\nT = sys.stdin.read().lower()\n\nprint(T.split().count(W))", "problem_context": "Finding a Word\n\nWrite a program which reads a word W and a text T, and prints the number of word W which appears in text T\n\nT consists of string Ti separated by space characters and newlines. Count the number of Ti which equals to W. The word and text are case insensitive.\n\nConstraints\n\nThe length of W ≤ 10\n\nW consists of lower case letters\n\nThe length of T in a line ≤ 1000\n\nInput\n\nIn the first line, the word W is given. In the following lines, the text T is given separated by space characters and newlines.\n\n\"END_OF_TEXT\" indicates the end of the text.\n\nOutput\n\nPrint the number of W in the text.\n\nSample Input\n\ncomputer\nNurtures computer scientists and highly-skilled computer engineers\nwho will create and exploit \"knowledge\" for the new era.\nProvides an outstanding computer environment.\nEND_OF_TEXT\n\nSample Output\n\n3", "sample_input": "computer\nNurtures computer scientists and highly-skilled computer engineers\nwho will create and exploit \"knowledge\" for the new era.\nProvides an outstanding computer environment.\nEND_OF_TEXT\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02419", "source_text": "Finding a Word\n\nWrite a program which reads a word W and a text T, and prints the number of word W which appears in text T\n\nT consists of string Ti separated by space characters and newlines. Count the number of Ti which equals to W. The word and text are case insensitive.\n\nConstraints\n\nThe length of W ≤ 10\n\nW consists of lower case letters\n\nThe length of T in a line ≤ 1000\n\nInput\n\nIn the first line, the word W is given. In the following lines, the text T is given separated by space characters and newlines.\n\n\"END_OF_TEXT\" indicates the end of the text.\n\nOutput\n\nPrint the number of W in the text.\n\nSample Input\n\ncomputer\nNurtures computer scientists and highly-skilled computer engineers\nwho will create and exploit \"knowledge\" for the new era.\nProvides an outstanding computer environment.\nEND_OF_TEXT\n\nSample Output\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 87, "cpu_time_ms": 30, "memory_kb": 7480}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s949654899", "group_id": "codeNet:p02421", "input_text": "n = int(input())\nlistA = []\nlistB = []\npntA = pntB = 0 \n\nfor i in range(n):\n A, B = map(str, input().split())\n listA.append(A)\n listB.append(B)\n\n if listA[i] > listB[i]:\n pntA += 3\n elif listA[i] == listB[i]:\n pntA += 1\n pntB += 1\n else:\n pntB += 3\n\nprint(str(pntA) + ' ' + str(pntB)) \n", "language": "Python", "metadata": {"date": 1537318909, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02421.html", "problem_id": "p02421", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02421/input.txt", "sample_output_relpath": "derived/input_output/data/p02421/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02421/Python/s949654899.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s949654899", "user_id": "u247705495"}, "prompt_components": {"gold_output": "1 7\n", "input_to_evaluate": "n = int(input())\nlistA = []\nlistB = []\npntA = pntB = 0 \n\nfor i in range(n):\n A, B = map(str, input().split())\n listA.append(A)\n listB.append(B)\n\n if listA[i] > listB[i]:\n pntA += 3\n elif listA[i] == listB[i]:\n pntA += 1\n pntB += 1\n else:\n pntB += 3\n\nprint(str(pntA) + ' ' + str(pntB)) \n", "problem_context": "Card Game\n\nTaro and Hanako are playing card games. They have n cards each, and they compete n turns. At each turn Taro and Hanako respectively puts out a card.\nThe name of the animal consisting of alphabetical letters is written on each card, and the bigger one in lexicographical order becomes the winner of that turn. The winner obtains 3 points. In the case of a draw, they obtain 1 point each.\n\nWrite a program which reads a sequence of cards Taro and Hanako have and reports the final scores of the game.\n\nInput\n\nIn the first line, the number of cards n is given. In the following n lines, the cards for n turns are given respectively. For each line, the first string represents the Taro's card and the second one represents Hanako's card.\n\nConstraints\n\nn ≤ 1000\n\nThe length of the string ≤ 100\n\nOutput\n\nPrint the final scores of Taro and Hanako respectively. Put a single space character between them.\n\nSample Input\n\n3\ncat dog\nfish fish\nlion tiger\n\nSample Output\n\n1 7", "sample_input": "3\ncat dog\nfish fish\nlion tiger\n"}, "reference_outputs": ["1 7\n"], "source_document_id": "p02421", "source_text": "Card Game\n\nTaro and Hanako are playing card games. They have n cards each, and they compete n turns. At each turn Taro and Hanako respectively puts out a card.\nThe name of the animal consisting of alphabetical letters is written on each card, and the bigger one in lexicographical order becomes the winner of that turn. The winner obtains 3 points. In the case of a draw, they obtain 1 point each.\n\nWrite a program which reads a sequence of cards Taro and Hanako have and reports the final scores of the game.\n\nInput\n\nIn the first line, the number of cards n is given. In the following n lines, the cards for n turns are given respectively. For each line, the first string represents the Taro's card and the second one represents Hanako's card.\n\nConstraints\n\nn ≤ 1000\n\nThe length of the string ≤ 100\n\nOutput\n\nPrint the final scores of Taro and Hanako respectively. Put a single space character between them.\n\nSample Input\n\n3\ncat dog\nfish fish\nlion tiger\n\nSample Output\n\n1 7", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 332, "cpu_time_ms": 20, "memory_kb": 5628}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s309118969", "group_id": "codeNet:p02471", "input_text": "def calc_gcd(x, y):\n \n if x < y:\n x, y = y, x\n\n while y > 0:\n x, y = y, x % y\n\n return x\n\n\na, b = map(int, input().split())\n\ngcd = calc_gcd(a, b)\n\nx1 = 1\ny1 = 0\nz1 = a_prime = a / gcd\n\nx2 = 0\ny2 = 1\nz2 = b_prime = b / gcd\n\nwhile z2 != 1:\n q = (z1 - (z1 % z2)) / z2\n\n (x1, y1, z1), (x2, y2, z2) = (x2, y2, z2), (x1 - (q * x2), y1 - (q * y2), z1 - (q * z2))\n\n\nt = 0\nx = x2 + b_prime * t\ny = y2 + a_prime * t\n\nprint(int(x), int(y))\n", "language": "Python", "metadata": {"date": 1561536338, "filename_ext": "py", "original_language": "Python3", "problem_description_relpath": "problem_descriptions/p02471.html", "problem_id": "p02471", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02471/input.txt", "sample_output_relpath": "derived/input_output/data/p02471/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02471/Python/s309118969.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s309118969", "user_id": "u902579831"}, "prompt_components": {"gold_output": "1 0\n", "input_to_evaluate": "def calc_gcd(x, y):\n \n if x < y:\n x, y = y, x\n\n while y > 0:\n x, y = y, x % y\n\n return x\n\n\na, b = map(int, input().split())\n\ngcd = calc_gcd(a, b)\n\nx1 = 1\ny1 = 0\nz1 = a_prime = a / gcd\n\nx2 = 0\ny2 = 1\nz2 = b_prime = b / gcd\n\nwhile z2 != 1:\n q = (z1 - (z1 % z2)) / z2\n\n (x1, y1, z1), (x2, y2, z2) = (x2, y2, z2), (x1 - (q * x2), y1 - (q * y2), z1 - (q * z2))\n\n\nt = 0\nx = x2 + b_prime * t\ny = y2 + a_prime * t\n\nprint(int(x), int(y))\n", "problem_context": "Extended Euclid Algorithm\n\nGiven positive integers a and b, find the integer solution (x, y) to ax + by = gcd(a, b), where gcd(a, b) is the greatest common divisor of a and b.\n\nInput\n\na b\n\nTwo positive integers a and b are given separated by a space in a line.\n\nOutput\n\nPrint two integers x and y separated by a space. If there are several pairs of such x and y, print that pair for which |x| + |y| is the minimal (primarily) and x ≤ y (secondarily).\n\nConstraints\n\n1 ≤ a, b ≤ 109\n\nSample Input 1\n\n4 12\n\nSample Output 1\n\n1 0\n\nSample Input 2\n\n3 8\n\nSample Output 2\n\n3 -1", "sample_input": "4 12\n"}, "reference_outputs": ["1 0\n"], "source_document_id": "p02471", "source_text": "Extended Euclid Algorithm\n\nGiven positive integers a and b, find the integer solution (x, y) to ax + by = gcd(a, b), where gcd(a, b) is the greatest common divisor of a and b.\n\nInput\n\na b\n\nTwo positive integers a and b are given separated by a space in a line.\n\nOutput\n\nPrint two integers x and y separated by a space. If there are several pairs of such x and y, print that pair for which |x| + |y| is the minimal (primarily) and x ≤ y (secondarily).\n\nConstraints\n\n1 ≤ a, b ≤ 109\n\nSample Input 1\n\n4 12\n\nSample Output 1\n\n1 0\n\nSample Input 2\n\n3 8\n\nSample Output 2\n\n3 -1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 461, "cpu_time_ms": 20, "memory_kb": 5608}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s473656476", "group_id": "codeNet:p02536", "input_text": "class UnionFind:\n pairs = {}\n def __init__(self, n):\n for i in range(n):\n self.pairs[i] = i\n\n def set(self, s, t):\n if s in self.pairs and self.pairs[s] == s:\n self.pairs[s] = self.root(t)\n else:\n self.pairs[t] = self.root(s)\n\n def root(self, x):\n if self.pairs[x] == x:\n return x\n self.pairs[x] = self.root(self.pairs[x])\n return self.pairs[x]\n\n def unite(self, x, y):\n rx = self.root(x)\n ry = self.root(y)\n if rx == ry :\n return\n self.pairs[rx] = ry\n def same(self, x, y ):\n rx = self.root(x)\n ry = self.root(y)\n if rx == ry:\n return True\n else:\n return False\n \ndef main():\n n, m = map(int, input().split())\n\n uf = UnionFind(n)\n pairs =[]\n for i in range(m):\n s, t = map(int,input().split())\n if uf.same(s-1, t-1) == False:\n uf.unite(s-1,t-1)\n #pairs.append([s-1,t-1])\n\n # pairs.sort()\n # for pair in pairs:\n # uf.set(pair[0], pair[1])\n #\n # for pair in pairs:\n # uf.set(pair[0], pair[1])\n\n root = []\n for i in range(n):\n root.append(uf.root(i))\n # print(i, uf.root(i))\n single_root = set(root)\n\n print(len(single_root)-1)\nmain()\n", "language": "Python", "metadata": {"date": 1601174959, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02536.html", "problem_id": "p02536", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02536/input.txt", "sample_output_relpath": "derived/input_output/data/p02536/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02536/Python/s473656476.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s473656476", "user_id": "u944396627"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "class UnionFind:\n pairs = {}\n def __init__(self, n):\n for i in range(n):\n self.pairs[i] = i\n\n def set(self, s, t):\n if s in self.pairs and self.pairs[s] == s:\n self.pairs[s] = self.root(t)\n else:\n self.pairs[t] = self.root(s)\n\n def root(self, x):\n if self.pairs[x] == x:\n return x\n self.pairs[x] = self.root(self.pairs[x])\n return self.pairs[x]\n\n def unite(self, x, y):\n rx = self.root(x)\n ry = self.root(y)\n if rx == ry :\n return\n self.pairs[rx] = ry\n def same(self, x, y ):\n rx = self.root(x)\n ry = self.root(y)\n if rx == ry:\n return True\n else:\n return False\n \ndef main():\n n, m = map(int, input().split())\n\n uf = UnionFind(n)\n pairs =[]\n for i in range(m):\n s, t = map(int,input().split())\n if uf.same(s-1, t-1) == False:\n uf.unite(s-1,t-1)\n #pairs.append([s-1,t-1])\n\n # pairs.sort()\n # for pair in pairs:\n # uf.set(pair[0], pair[1])\n #\n # for pair in pairs:\n # uf.set(pair[0], pair[1])\n\n root = []\n for i in range(n):\n root.append(uf.root(i))\n # print(i, uf.root(i))\n single_root = set(root)\n\n print(len(single_root)-1)\nmain()\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N cities numbered 1 through N, and M bidirectional roads numbered 1 through M.\nRoad i connects City A_i and City B_i.\n\nSnuke can perform the following operation zero or more times:\n\nChoose two distinct cities that are not directly connected by a road, and build a new road between the two cities.\n\nAfter he finishes the operations, it must be possible to travel from any city to any other cities by following roads (possibly multiple times).\n\nWhat is the minimum number of roads he must build to achieve the goal?\n\nConstraints\n\n2 \\leq N \\leq 100,000\n\n1 \\leq M \\leq 100,000\n\n1 \\leq A_i < B_i \\leq N\n\nNo two roads connect the same pair of cities.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_M B_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 1\n1 2\n\nSample Output 1\n\n1\n\nInitially, there are three cities, and there is a road between City 1 and City 2.\n\nSnuke can achieve the goal by building one new road, for example, between City 1 and City 3.\nAfter that,\n\nWe can travel between 1 and 2 directly.\n\nWe can travel between 1 and 3 directly.\n\nWe can travel between 2 and 3 by following both roads (2 - 1 - 3).", "sample_input": "3 1\n1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02536", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N cities numbered 1 through N, and M bidirectional roads numbered 1 through M.\nRoad i connects City A_i and City B_i.\n\nSnuke can perform the following operation zero or more times:\n\nChoose two distinct cities that are not directly connected by a road, and build a new road between the two cities.\n\nAfter he finishes the operations, it must be possible to travel from any city to any other cities by following roads (possibly multiple times).\n\nWhat is the minimum number of roads he must build to achieve the goal?\n\nConstraints\n\n2 \\leq N \\leq 100,000\n\n1 \\leq M \\leq 100,000\n\n1 \\leq A_i < B_i \\leq N\n\nNo two roads connect the same pair of cities.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_M B_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 1\n1 2\n\nSample Output 1\n\n1\n\nInitially, there are three cities, and there is a road between City 1 and City 2.\n\nSnuke can achieve the goal by building one new road, for example, between City 1 and City 3.\nAfter that,\n\nWe can travel between 1 and 2 directly.\n\nWe can travel between 1 and 3 directly.\n\nWe can travel between 2 and 3 by following both roads (2 - 1 - 3).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1327, "cpu_time_ms": 526, "memory_kb": 24276}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s350147244", "group_id": "codeNet:p02540", "input_text": "import sys\ninput = sys.stdin.readline\n\nclass Unionfind:\n \n def __init__(self,n):\n self.uf = [-1]*n\n \n def find(self,x):\n if self.uf[x] < 0:\n return x\n else:\n self.uf[x] = self.find(self.uf[x])\n return self.uf[x]\n \n def same(self,x,y):\n return self.find(x) == self.find(y)\n \n def union(self,x,y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return False\n if self.uf[x] > self.uf[y]:\n x,y = y,x\n self.uf[x] += self.uf[y]\n self.uf[y] = x\n return True\n \n def size(self,x):\n x = self.find(x)\n return -self.uf[x]\n\ndef main():\n n = int(input())\n xy = [list(map(int,input().split())) for i in range(n)]\n xy2 = [[x[0],x[1],i] for (i,x) in enumerate(xy)]\n xy2.sort()\n u = Unionfind(n)\n\n l = []\n for x,y,ind in xy2:\n M = y\n le = ind\n while l and xy[l[-1]][1] < y:\n v = l.pop()\n if M > xy[v][1]:\n M = xy[v][1]\n le = v\n u.union(ind,v)\n l.append(le)\n for i in range(n):\n print(u.size(i))\n\nif __name__ == \"__main__\":\n main()", "language": "Python", "metadata": {"date": 1600662670, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02540.html", "problem_id": "p02540", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02540/input.txt", "sample_output_relpath": "derived/input_output/data/p02540/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02540/Python/s350147244.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s350147244", "user_id": "u368796742"}, "prompt_components": {"gold_output": "1\n1\n2\n2\n", "input_to_evaluate": "import sys\ninput = sys.stdin.readline\n\nclass Unionfind:\n \n def __init__(self,n):\n self.uf = [-1]*n\n \n def find(self,x):\n if self.uf[x] < 0:\n return x\n else:\n self.uf[x] = self.find(self.uf[x])\n return self.uf[x]\n \n def same(self,x,y):\n return self.find(x) == self.find(y)\n \n def union(self,x,y):\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return False\n if self.uf[x] > self.uf[y]:\n x,y = y,x\n self.uf[x] += self.uf[y]\n self.uf[y] = x\n return True\n \n def size(self,x):\n x = self.find(x)\n return -self.uf[x]\n\ndef main():\n n = int(input())\n xy = [list(map(int,input().split())) for i in range(n)]\n xy2 = [[x[0],x[1],i] for (i,x) in enumerate(xy)]\n xy2.sort()\n u = Unionfind(n)\n\n l = []\n for x,y,ind in xy2:\n M = y\n le = ind\n while l and xy[l[-1]][1] < y:\n v = l.pop()\n if M > xy[v][1]:\n M = xy[v][1]\n le = v\n u.union(ind,v)\n l.append(le)\n for i in range(n):\n print(u.size(i))\n\nif __name__ == \"__main__\":\n main()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N cities on a 2D plane. The coordinate of the i-th city is (x_i, y_i). Here (x_1, x_2, \\dots, x_N) and (y_1, y_2, \\dots, y_N) are both permuations of (1, 2, \\dots, N).\n\nFor each k = 1,2,\\dots,N, find the answer to the following question:\n\nRng is in City k.\nRng can perform the following move arbitrarily many times:\n\nmove to another city that has a smaller x-coordinate and a smaller y-coordinate, or a larger x-coordinate and a larger y-coordinate, than the city he is currently in.\n\nHow many cities (including City k) are reachable from City k?\n\nConstraints\n\n1 \\leq N \\leq 200,000\n\n(x_1, x_2, \\dots, x_N) is a permutation of (1, 2, \\dots, N).\n\n(y_1, y_2, \\dots, y_N) is a permutation of (1, 2, \\dots, N).\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\nx_2 y_2\n:\nx_N y_N\n\nOutput\n\nPrint N lines. In i-th line print the answer to the question when k = i.\n\nSample Input 1\n\n4\n1 4\n2 3\n3 1\n4 2\n\nSample Output 1\n\n1\n1\n2\n2\n\nRng can reach City 4 from City 3, or conversely City 3 from City 4.\n\nSample Input 2\n\n7\n6 4\n4 3\n3 5\n7 1\n2 7\n5 2\n1 6\n\nSample Output 2\n\n3\n3\n1\n1\n2\n3\n2", "sample_input": "4\n1 4\n2 3\n3 1\n4 2\n"}, "reference_outputs": ["1\n1\n2\n2\n"], "source_document_id": "p02540", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N cities on a 2D plane. The coordinate of the i-th city is (x_i, y_i). Here (x_1, x_2, \\dots, x_N) and (y_1, y_2, \\dots, y_N) are both permuations of (1, 2, \\dots, N).\n\nFor each k = 1,2,\\dots,N, find the answer to the following question:\n\nRng is in City k.\nRng can perform the following move arbitrarily many times:\n\nmove to another city that has a smaller x-coordinate and a smaller y-coordinate, or a larger x-coordinate and a larger y-coordinate, than the city he is currently in.\n\nHow many cities (including City k) are reachable from City k?\n\nConstraints\n\n1 \\leq N \\leq 200,000\n\n(x_1, x_2, \\dots, x_N) is a permutation of (1, 2, \\dots, N).\n\n(y_1, y_2, \\dots, y_N) is a permutation of (1, 2, \\dots, N).\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\nx_2 y_2\n:\nx_N y_N\n\nOutput\n\nPrint N lines. In i-th line print the answer to the question when k = i.\n\nSample Input 1\n\n4\n1 4\n2 3\n3 1\n4 2\n\nSample Output 1\n\n1\n1\n2\n2\n\nRng can reach City 4 from City 3, or conversely City 3 from City 4.\n\nSample Input 2\n\n7\n6 4\n4 3\n3 5\n7 1\n2 7\n5 2\n1 6\n\nSample Output 2\n\n3\n3\n1\n1\n2\n3\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1204, "cpu_time_ms": 814, "memory_kb": 128452}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s104400343", "group_id": "codeNet:p02546", "input_text": "n = input()\nif n[-1] == 's':\n print(n+'es')\nelse:\n print(n+'s')", "language": "Python", "metadata": {"date": 1600542077, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02546.html", "problem_id": "p02546", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02546/input.txt", "sample_output_relpath": "derived/input_output/data/p02546/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02546/Python/s104400343.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s104400343", "user_id": "u992455162"}, "prompt_components": {"gold_output": "apples\n", "input_to_evaluate": "n = input()\nif n[-1] == 's':\n print(n+'es')\nelse:\n print(n+'s')", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn the Kingdom of AtCoder, people use a language called Taknese, which uses lowercase English letters.\n\nIn Taknese, the plural form of a noun is spelled based on the following rules:\n\nIf a noun's singular form does not end with s, append s to the end of the singular form.\n\nIf a noun's singular form ends with s, append es to the end of the singular form.\n\nYou are given the singular form S of a Taknese noun. Output its plural form.\n\nConstraints\n\nS is a string of length 1 between 1000, inclusive.\n\nS contains only lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the plural form of the given Taknese word.\n\nSample Input 1\n\napple\n\nSample Output 1\n\napples\n\napple ends with e, so its plural form is apples.\n\nSample Input 2\n\nbus\n\nSample Output 2\n\nbuses\n\nbus ends with s, so its plural form is buses.\n\nSample Input 3\n\nbox\n\nSample Output 3\n\nboxs", "sample_input": "apple\n"}, "reference_outputs": ["apples\n"], "source_document_id": "p02546", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn the Kingdom of AtCoder, people use a language called Taknese, which uses lowercase English letters.\n\nIn Taknese, the plural form of a noun is spelled based on the following rules:\n\nIf a noun's singular form does not end with s, append s to the end of the singular form.\n\nIf a noun's singular form ends with s, append es to the end of the singular form.\n\nYou are given the singular form S of a Taknese noun. Output its plural form.\n\nConstraints\n\nS is a string of length 1 between 1000, inclusive.\n\nS contains only lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the plural form of the given Taknese word.\n\nSample Input 1\n\napple\n\nSample Output 1\n\napples\n\napple ends with e, so its plural form is apples.\n\nSample Input 2\n\nbus\n\nSample Output 2\n\nbuses\n\nbus ends with s, so its plural form is buses.\n\nSample Input 3\n\nbox\n\nSample Output 3\n\nboxs", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 65, "cpu_time_ms": 31, "memory_kb": 9080}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s466286408", "group_id": "codeNet:p02548", "input_text": "N = int(input())\n\nans = 0\nfor i in range(1, N + 1):\n ans += (N - 1) // i\n\nprint(ans)", "language": "Python", "metadata": {"date": 1600550871, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02548.html", "problem_id": "p02548", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02548/input.txt", "sample_output_relpath": "derived/input_output/data/p02548/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02548/Python/s466286408.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s466286408", "user_id": "u926412290"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "N = int(input())\n\nans = 0\nfor i in range(1, N + 1):\n ans += (N - 1) // i\n\nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a positive integer N.\nHow many tuples (A,B,C) of positive integers satisfy A \\times B + C = N?\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n3\n\nThere are 3 tuples of integers that satisfy A \\times B + C = 3: (A, B, C) = (1, 1, 2), (1, 2, 1), (2, 1, 1).\n\nSample Input 2\n\n100\n\nSample Output 2\n\n473\n\nSample Input 3\n\n1000000\n\nSample Output 3\n\n13969985", "sample_input": "3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02548", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a positive integer N.\nHow many tuples (A,B,C) of positive integers satisfy A \\times B + C = N?\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n3\n\nThere are 3 tuples of integers that satisfy A \\times B + C = 3: (A, B, C) = (1, 1, 2), (1, 2, 1), (2, 1, 1).\n\nSample Input 2\n\n100\n\nSample Output 2\n\n473\n\nSample Input 3\n\n1000000\n\nSample Output 3\n\n13969985", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 87, "cpu_time_ms": 160, "memory_kb": 9104}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s547100649", "group_id": "codeNet:p02548", "input_text": "import math as mt\n\nMAXN = 1000001\n\nspf = [0 for i in range(MAXN)]\n\n\n\ndef sieve():\n spf[1] = 1\n for i in range(2, MAXN):\n\n \n spf[i] = i\n\n for i in range(4, MAXN, 2):\n spf[i] = 2\n\n for i in range(3, mt.ceil(mt.sqrt(MAXN))):\n\n if (spf[i] == i):\n\n for j in range(i * i, MAXN, i):\n\n if (spf[j] == j):\n spf[j] = i\n\n\n\ndef getFactorization(x):\n ret = [0]*(x+1)\n while (x != 1):\n ret[spf[x]]+=1\n x = x // spf[x]\n\n return ret\n\nsieve()\nx = int(input())\nans = 0\nfor i in range(1,x):\n p = getFactorization(x-i)\n sumi=1\n for i in range(len(p)):\n sumi*=(1+p[i])\n ans+=sumi\nprint(ans)\n", "language": "Python", "metadata": {"date": 1600545044, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02548.html", "problem_id": "p02548", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02548/input.txt", "sample_output_relpath": "derived/input_output/data/p02548/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02548/Python/s547100649.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s547100649", "user_id": "u554064385"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import math as mt\n\nMAXN = 1000001\n\nspf = [0 for i in range(MAXN)]\n\n\n\ndef sieve():\n spf[1] = 1\n for i in range(2, MAXN):\n\n \n spf[i] = i\n\n for i in range(4, MAXN, 2):\n spf[i] = 2\n\n for i in range(3, mt.ceil(mt.sqrt(MAXN))):\n\n if (spf[i] == i):\n\n for j in range(i * i, MAXN, i):\n\n if (spf[j] == j):\n spf[j] = i\n\n\n\ndef getFactorization(x):\n ret = [0]*(x+1)\n while (x != 1):\n ret[spf[x]]+=1\n x = x // spf[x]\n\n return ret\n\nsieve()\nx = int(input())\nans = 0\nfor i in range(1,x):\n p = getFactorization(x-i)\n sumi=1\n for i in range(len(p)):\n sumi*=(1+p[i])\n ans+=sumi\nprint(ans)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a positive integer N.\nHow many tuples (A,B,C) of positive integers satisfy A \\times B + C = N?\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n3\n\nThere are 3 tuples of integers that satisfy A \\times B + C = 3: (A, B, C) = (1, 1, 2), (1, 2, 1), (2, 1, 1).\n\nSample Input 2\n\n100\n\nSample Output 2\n\n473\n\nSample Input 3\n\n1000000\n\nSample Output 3\n\n13969985", "sample_input": "3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02548", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a positive integer N.\nHow many tuples (A,B,C) of positive integers satisfy A \\times B + C = N?\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n3\n\nThere are 3 tuples of integers that satisfy A \\times B + C = 3: (A, B, C) = (1, 1, 2), (1, 2, 1), (2, 1, 1).\n\nSample Input 2\n\n100\n\nSample Output 2\n\n473\n\nSample Input 3\n\n1000000\n\nSample Output 3\n\n13969985", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 696, "cpu_time_ms": 2211, "memory_kb": 173844}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s834274718", "group_id": "codeNet:p02549", "input_text": "import numpy as np\n\nmod = 998244353\nn, k = map(int, input().split())\nleft = []\nright = []\nfor _ in range(k):\n l, r = map(int, input().split())\n left.append(l)\n right.append(r)\ndp = np.zeros(n, dtype=np.int)\ndp[0] = 1\nfor i in range(n-1):\n for j in range(k):\n dp[i + left[j] : i + right[j] + 1] += dp[i]\n dp[i + left[j] : i + right[j] + 1] %= mod\nprint(dp[-1])", "language": "Python", "metadata": {"date": 1600584136, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02549.html", "problem_id": "p02549", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02549/input.txt", "sample_output_relpath": "derived/input_output/data/p02549/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02549/Python/s834274718.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s834274718", "user_id": "u686230543"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import numpy as np\n\nmod = 998244353\nn, k = map(int, input().split())\nleft = []\nright = []\nfor _ in range(k):\n l, r = map(int, input().split())\n left.append(l)\n right.append(r)\ndp = np.zeros(n, dtype=np.int)\ndp[0] = 1\nfor i in range(n-1):\n for j in range(k):\n dp[i + left[j] : i + right[j] + 1] += dp[i]\n dp[i + left[j] : i + right[j] + 1] %= mod\nprint(dp[-1])", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N cells arranged in a row, numbered 1, 2, \\ldots, N from left to right.\n\nTak lives in these cells and is currently on Cell 1. He is trying to reach Cell N by using the procedure described below.\n\nYou are given an integer K that is less than or equal to 10, and K non-intersecting segments [L_1, R_1], [L_2, R_2], \\ldots, [L_K, R_K].\nLet S be the union of these K segments.\nHere, the segment [l, r] denotes the set consisting of all integers i that satisfy l \\leq i \\leq r.\n\n\bWhen you are on Cell i, pick an integer d from S and move to Cell i + d. You cannot move out of the cells.\n\nTo help Tak, find the number of ways to go to Cell N, modulo 998244353.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq \\min(N, 10)\n\n1 \\leq L_i \\leq R_i \\leq N\n\n[L_i, R_i] and [L_j, R_j] do not intersect (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nL_1 R_1\nL_2 R_2\n:\nL_K R_K\n\nOutput\n\nPrint the number of ways for Tak to go from Cell 1 to Cell N, modulo 998244353.\n\nSample Input 1\n\n5 2\n1 1\n3 4\n\nSample Output 1\n\n4\n\nThe set S is the union of the segment [1, 1] and the segment [3, 4], therefore S = \\{ 1, 3, 4 \\} holds.\n\nThere are 4 possible ways to get to Cell 5:\n\n1 \\to 2 \\to 3 \\to 4 \\to 5,\n\n1 \\to 2 \\to 5,\n\n1 \\to 4 \\to 5 and\n\n1 \\to 5.\n\nSample Input 2\n\n5 2\n3 3\n5 5\n\nSample Output 2\n\n0\n\nBecause S = \\{ 3, 5 \\} holds, you cannot reach to Cell 5.\nPrint 0.\n\nSample Input 3\n\n5 1\n1 2\n\nSample Output 3\n\n5\n\nSample Input 4\n\n60 3\n5 8\n1 3\n10 15\n\nSample Output 4\n\n221823067\n\nNote that you have to print the answer modulo 998244353.", "sample_input": "5 2\n1 1\n3 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02549", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N cells arranged in a row, numbered 1, 2, \\ldots, N from left to right.\n\nTak lives in these cells and is currently on Cell 1. He is trying to reach Cell N by using the procedure described below.\n\nYou are given an integer K that is less than or equal to 10, and K non-intersecting segments [L_1, R_1], [L_2, R_2], \\ldots, [L_K, R_K].\nLet S be the union of these K segments.\nHere, the segment [l, r] denotes the set consisting of all integers i that satisfy l \\leq i \\leq r.\n\n\bWhen you are on Cell i, pick an integer d from S and move to Cell i + d. You cannot move out of the cells.\n\nTo help Tak, find the number of ways to go to Cell N, modulo 998244353.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq \\min(N, 10)\n\n1 \\leq L_i \\leq R_i \\leq N\n\n[L_i, R_i] and [L_j, R_j] do not intersect (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nL_1 R_1\nL_2 R_2\n:\nL_K R_K\n\nOutput\n\nPrint the number of ways for Tak to go from Cell 1 to Cell N, modulo 998244353.\n\nSample Input 1\n\n5 2\n1 1\n3 4\n\nSample Output 1\n\n4\n\nThe set S is the union of the segment [1, 1] and the segment [3, 4], therefore S = \\{ 1, 3, 4 \\} holds.\n\nThere are 4 possible ways to get to Cell 5:\n\n1 \\to 2 \\to 3 \\to 4 \\to 5,\n\n1 \\to 2 \\to 5,\n\n1 \\to 4 \\to 5 and\n\n1 \\to 5.\n\nSample Input 2\n\n5 2\n3 3\n5 5\n\nSample Output 2\n\n0\n\nBecause S = \\{ 3, 5 \\} holds, you cannot reach to Cell 5.\nPrint 0.\n\nSample Input 3\n\n5 1\n1 2\n\nSample Output 3\n\n5\n\nSample Input 4\n\n60 3\n5 8\n1 3\n10 15\n\nSample Output 4\n\n221823067\n\nNote that you have to print the answer modulo 998244353.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 369, "cpu_time_ms": 2206, "memory_kb": 28388}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s077106102", "group_id": "codeNet:p02549", "input_text": "N,K=map(int,input().split(\" \"))\na=[]\nd=[]\ne=[]\nfor k in range(K):\n l,r=map(int,input().split(\" \"))\n d.append(l)\n e.append(r)\nd.sort()\ne.sort()\nfor k in range(K):\n a+=list(range(d[k],e[k]+1))\na.sort()\nb=[0 for i in range(a[-1]-1)]\nb.append(1)\nfor i in range(N-1):\n b.append(0)\n for j in a:\n b[-1]+=b[-j-1]\nprint(b[-1]%998244353)", "language": "Python", "metadata": {"date": 1600546822, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02549.html", "problem_id": "p02549", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02549/input.txt", "sample_output_relpath": "derived/input_output/data/p02549/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02549/Python/s077106102.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s077106102", "user_id": "u081060730"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "N,K=map(int,input().split(\" \"))\na=[]\nd=[]\ne=[]\nfor k in range(K):\n l,r=map(int,input().split(\" \"))\n d.append(l)\n e.append(r)\nd.sort()\ne.sort()\nfor k in range(K):\n a+=list(range(d[k],e[k]+1))\na.sort()\nb=[0 for i in range(a[-1]-1)]\nb.append(1)\nfor i in range(N-1):\n b.append(0)\n for j in a:\n b[-1]+=b[-j-1]\nprint(b[-1]%998244353)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N cells arranged in a row, numbered 1, 2, \\ldots, N from left to right.\n\nTak lives in these cells and is currently on Cell 1. He is trying to reach Cell N by using the procedure described below.\n\nYou are given an integer K that is less than or equal to 10, and K non-intersecting segments [L_1, R_1], [L_2, R_2], \\ldots, [L_K, R_K].\nLet S be the union of these K segments.\nHere, the segment [l, r] denotes the set consisting of all integers i that satisfy l \\leq i \\leq r.\n\n\bWhen you are on Cell i, pick an integer d from S and move to Cell i + d. You cannot move out of the cells.\n\nTo help Tak, find the number of ways to go to Cell N, modulo 998244353.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq \\min(N, 10)\n\n1 \\leq L_i \\leq R_i \\leq N\n\n[L_i, R_i] and [L_j, R_j] do not intersect (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nL_1 R_1\nL_2 R_2\n:\nL_K R_K\n\nOutput\n\nPrint the number of ways for Tak to go from Cell 1 to Cell N, modulo 998244353.\n\nSample Input 1\n\n5 2\n1 1\n3 4\n\nSample Output 1\n\n4\n\nThe set S is the union of the segment [1, 1] and the segment [3, 4], therefore S = \\{ 1, 3, 4 \\} holds.\n\nThere are 4 possible ways to get to Cell 5:\n\n1 \\to 2 \\to 3 \\to 4 \\to 5,\n\n1 \\to 2 \\to 5,\n\n1 \\to 4 \\to 5 and\n\n1 \\to 5.\n\nSample Input 2\n\n5 2\n3 3\n5 5\n\nSample Output 2\n\n0\n\nBecause S = \\{ 3, 5 \\} holds, you cannot reach to Cell 5.\nPrint 0.\n\nSample Input 3\n\n5 1\n1 2\n\nSample Output 3\n\n5\n\nSample Input 4\n\n60 3\n5 8\n1 3\n10 15\n\nSample Output 4\n\n221823067\n\nNote that you have to print the answer modulo 998244353.", "sample_input": "5 2\n1 1\n3 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02549", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N cells arranged in a row, numbered 1, 2, \\ldots, N from left to right.\n\nTak lives in these cells and is currently on Cell 1. He is trying to reach Cell N by using the procedure described below.\n\nYou are given an integer K that is less than or equal to 10, and K non-intersecting segments [L_1, R_1], [L_2, R_2], \\ldots, [L_K, R_K].\nLet S be the union of these K segments.\nHere, the segment [l, r] denotes the set consisting of all integers i that satisfy l \\leq i \\leq r.\n\n\bWhen you are on Cell i, pick an integer d from S and move to Cell i + d. You cannot move out of the cells.\n\nTo help Tak, find the number of ways to go to Cell N, modulo 998244353.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq \\min(N, 10)\n\n1 \\leq L_i \\leq R_i \\leq N\n\n[L_i, R_i] and [L_j, R_j] do not intersect (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nL_1 R_1\nL_2 R_2\n:\nL_K R_K\n\nOutput\n\nPrint the number of ways for Tak to go from Cell 1 to Cell N, modulo 998244353.\n\nSample Input 1\n\n5 2\n1 1\n3 4\n\nSample Output 1\n\n4\n\nThe set S is the union of the segment [1, 1] and the segment [3, 4], therefore S = \\{ 1, 3, 4 \\} holds.\n\nThere are 4 possible ways to get to Cell 5:\n\n1 \\to 2 \\to 3 \\to 4 \\to 5,\n\n1 \\to 2 \\to 5,\n\n1 \\to 4 \\to 5 and\n\n1 \\to 5.\n\nSample Input 2\n\n5 2\n3 3\n5 5\n\nSample Output 2\n\n0\n\nBecause S = \\{ 3, 5 \\} holds, you cannot reach to Cell 5.\nPrint 0.\n\nSample Input 3\n\n5 1\n1 2\n\nSample Output 3\n\n5\n\nSample Input 4\n\n60 3\n5 8\n1 3\n10 15\n\nSample Output 4\n\n221823067\n\nNote that you have to print the answer modulo 998244353.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 352, "cpu_time_ms": 2206, "memory_kb": 19632}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s040251563", "group_id": "codeNet:p02552", "input_text": "print(1 if input()==\"0\" else 0)", "language": "Python", "metadata": {"date": 1600248381, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02552.html", "problem_id": "p02552", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02552/input.txt", "sample_output_relpath": "derived/input_output/data/p02552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02552/Python/s040251563.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s040251563", "user_id": "u014139588"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "print(1 if input()==\"0\" else 0)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer x that is greater than or equal to 0, and less than or equal to 1.\nOutput 1 if x is equal to 0, or 0 if x is equal to 1.\n\nConstraints\n\n0 \\leq x \\leq 1\n\nx is an integer\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint 1 if x is equal to 0, or 0 if x is equal to 1.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n0\n\nSample Input 2\n\n0\n\nSample Output 2\n\n1", "sample_input": "1\n"}, "reference_outputs": ["0\n"], "source_document_id": "p02552", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer x that is greater than or equal to 0, and less than or equal to 1.\nOutput 1 if x is equal to 0, or 0 if x is equal to 1.\n\nConstraints\n\n0 \\leq x \\leq 1\n\nx is an integer\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint 1 if x is equal to 0, or 0 if x is equal to 1.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n0\n\nSample Input 2\n\n0\n\nSample Output 2\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 31, "cpu_time_ms": 30, "memory_kb": 9000}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s590190779", "group_id": "codeNet:p02552", "input_text": "while True:\n\tx = input()\n\tif x == 1:\n \t\tprint(0)\n \t\tbreak\n\telif x ==0:\n \t\tprint(1)\n break\n else:\n continue\n", "language": "Python", "metadata": {"date": 1600119334, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02552.html", "problem_id": "p02552", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02552/input.txt", "sample_output_relpath": "derived/input_output/data/p02552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02552/Python/s590190779.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s590190779", "user_id": "u430621070"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "while True:\n\tx = input()\n\tif x == 1:\n \t\tprint(0)\n \t\tbreak\n\telif x ==0:\n \t\tprint(1)\n break\n else:\n continue\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer x that is greater than or equal to 0, and less than or equal to 1.\nOutput 1 if x is equal to 0, or 0 if x is equal to 1.\n\nConstraints\n\n0 \\leq x \\leq 1\n\nx is an integer\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint 1 if x is equal to 0, or 0 if x is equal to 1.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n0\n\nSample Input 2\n\n0\n\nSample Output 2\n\n1", "sample_input": "1\n"}, "reference_outputs": ["0\n"], "source_document_id": "p02552", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer x that is greater than or equal to 0, and less than or equal to 1.\nOutput 1 if x is equal to 0, or 0 if x is equal to 1.\n\nConstraints\n\n0 \\leq x \\leq 1\n\nx is an integer\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint 1 if x is equal to 0, or 0 if x is equal to 1.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n0\n\nSample Input 2\n\n0\n\nSample Output 2\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 126, "cpu_time_ms": 24, "memory_kb": 8864}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s199404142", "group_id": "codeNet:p02552", "input_text": "n = int(input())\nprint( (n==0)*1 )", "language": "Python", "metadata": {"date": 1600023673, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02552.html", "problem_id": "p02552", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02552/input.txt", "sample_output_relpath": "derived/input_output/data/p02552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02552/Python/s199404142.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s199404142", "user_id": "u405276711"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "n = int(input())\nprint( (n==0)*1 )", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer x that is greater than or equal to 0, and less than or equal to 1.\nOutput 1 if x is equal to 0, or 0 if x is equal to 1.\n\nConstraints\n\n0 \\leq x \\leq 1\n\nx is an integer\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint 1 if x is equal to 0, or 0 if x is equal to 1.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n0\n\nSample Input 2\n\n0\n\nSample Output 2\n\n1", "sample_input": "1\n"}, "reference_outputs": ["0\n"], "source_document_id": "p02552", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer x that is greater than or equal to 0, and less than or equal to 1.\nOutput 1 if x is equal to 0, or 0 if x is equal to 1.\n\nConstraints\n\n0 \\leq x \\leq 1\n\nx is an integer\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint 1 if x is equal to 0, or 0 if x is equal to 1.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n0\n\nSample Input 2\n\n0\n\nSample Output 2\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 34, "cpu_time_ms": 72, "memory_kb": 61868}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s730996880", "group_id": "codeNet:p02552", "input_text": "from sys import stdin\ninp = lambda : stdin.readline().strip()\n\nn = int(inp())\nif n == 1:\n print(0)\nelse:\n print(1)", "language": "Python", "metadata": {"date": 1600023670, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02552.html", "problem_id": "p02552", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02552/input.txt", "sample_output_relpath": "derived/input_output/data/p02552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02552/Python/s730996880.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s730996880", "user_id": "u382114513"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "from sys import stdin\ninp = lambda : stdin.readline().strip()\n\nn = int(inp())\nif n == 1:\n print(0)\nelse:\n print(1)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer x that is greater than or equal to 0, and less than or equal to 1.\nOutput 1 if x is equal to 0, or 0 if x is equal to 1.\n\nConstraints\n\n0 \\leq x \\leq 1\n\nx is an integer\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint 1 if x is equal to 0, or 0 if x is equal to 1.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n0\n\nSample Input 2\n\n0\n\nSample Output 2\n\n1", "sample_input": "1\n"}, "reference_outputs": ["0\n"], "source_document_id": "p02552", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer x that is greater than or equal to 0, and less than or equal to 1.\nOutput 1 if x is equal to 0, or 0 if x is equal to 1.\n\nConstraints\n\n0 \\leq x \\leq 1\n\nx is an integer\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint 1 if x is equal to 0, or 0 if x is equal to 1.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n0\n\nSample Input 2\n\n0\n\nSample Output 2\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 120, "cpu_time_ms": 92, "memory_kb": 61564}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s879067978", "group_id": "codeNet:p02553", "input_text": "a,b,c,d=map(int,input().split())\n\nf=1\ng=1 \nans=1\nprint(max(a*c,a*d,b*c,b*d))", "language": "Python", "metadata": {"date": 1600028379, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02553.html", "problem_id": "p02553", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02553/input.txt", "sample_output_relpath": "derived/input_output/data/p02553/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02553/Python/s879067978.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s879067978", "user_id": "u859059120"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "a,b,c,d=map(int,input().split())\n\nf=1\ng=1 \nans=1\nprint(max(a*c,a*d,b*c,b*d))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "sample_input": "1 2 1 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02553", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 76, "cpu_time_ms": 28, "memory_kb": 9164}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s581303534", "group_id": "codeNet:p02553", "input_text": "# abc178_b.py\na,b,c,d = map(int,input().split())\nprint(max(a*c,b*c,a*d,b*d))\n", "language": "Python", "metadata": {"date": 1600023906, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02553.html", "problem_id": "p02553", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02553/input.txt", "sample_output_relpath": "derived/input_output/data/p02553/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02553/Python/s581303534.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s581303534", "user_id": "u371132735"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "# abc178_b.py\na,b,c,d = map(int,input().split())\nprint(max(a*c,b*c,a*d,b*d))\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "sample_input": "1 2 1 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02553", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 77, "cpu_time_ms": 33, "memory_kb": 9144}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s975876472", "group_id": "codeNet:p02555", "input_text": "from itertools import combinations\nS = int(input())\nn = S // 3\nans = -1\nfor k in range(n + 1):\n ans = ans + 1\nprint(ans)", "language": "Python", "metadata": {"date": 1600683769, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02555.html", "problem_id": "p02555", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02555/input.txt", "sample_output_relpath": "derived/input_output/data/p02555/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02555/Python/s975876472.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s975876472", "user_id": "u921676506"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "from itertools import combinations\nS = int(input())\nn = S // 3\nans = -1\nfor k in range(n + 1):\n ans = ans + 1\nprint(ans)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is an integer S.\nFind how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S.\nThe answer can be very large, so output it modulo 10^9 + 7.\n\nConstraints\n\n1 \\leq S \\leq 2000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n3\n\n3 sequences satisfy the condition: \\{3,4\\}, \\{4,3\\} and \\{7\\}.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n0\n\nThere are no sequences that satisfy the condition.\n\nSample Input 3\n\n1729\n\nSample Output 3\n\n294867501", "sample_input": "7\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02555", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is an integer S.\nFind how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S.\nThe answer can be very large, so output it modulo 10^9 + 7.\n\nConstraints\n\n1 \\leq S \\leq 2000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n3\n\n3 sequences satisfy the condition: \\{3,4\\}, \\{4,3\\} and \\{7\\}.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n0\n\nThere are no sequences that satisfy the condition.\n\nSample Input 3\n\n1729\n\nSample Output 3\n\n294867501", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 121, "cpu_time_ms": 28, "memory_kb": 9176}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s292406691", "group_id": "codeNet:p02556", "input_text": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sun Sep 13 20:41:42 2020\n\n@author: liang\n\"\"\"\n#E\nN = int(input())\nd = list()\nfor i in range(N):\n x, y = map(int,input().split())\n d.append((x,y))\n\nd.sort(key=lambda x:x[0]+x[1])\n#print(d)\n\nans1 = abs(d[0][0] - d[N-1][0]) + abs(d[0][1] - d[N-1][1])\n\nd.sort(key=lambda x:x[0]-x[1])\n\nans2 = abs(d[0][0] - d[N-1][0]) + abs(d[0][1] - d[N-1][1])\n\nans = max(ans1, ans2)\n\nprint(ans)", "language": "Python", "metadata": {"date": 1600028254, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02556.html", "problem_id": "p02556", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02556/input.txt", "sample_output_relpath": "derived/input_output/data/p02556/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02556/Python/s292406691.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s292406691", "user_id": "u628285938"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sun Sep 13 20:41:42 2020\n\n@author: liang\n\"\"\"\n#E\nN = int(input())\nd = list()\nfor i in range(N):\n x, y = map(int,input().split())\n d.append((x,y))\n\nd.sort(key=lambda x:x[0]+x[1])\n#print(d)\n\nans1 = abs(d[0][0] - d[N-1][0]) + abs(d[0][1] - d[N-1][1])\n\nd.sort(key=lambda x:x[0]-x[1])\n\nans2 = abs(d[0][0] - d[N-1][0]) + abs(d[0][1] - d[N-1][1])\n\nans = max(ans1, ans2)\n\nprint(ans)", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N points on the 2D plane, i-th of which is located on (x_i, y_i).\nThere can be multiple points that share the same coordinate.\nWhat is the maximum possible Manhattan distance between two distinct points?\n\nHere, the Manhattan distance between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_i-y_j|.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq x_i,y_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\nx_2 y_2\n:\nx_N y_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 1\n2 4\n3 2\n\nSample Output 1\n\n4\n\nThe Manhattan distance between the first point and the second point is |1-2|+|1-4|=4, which is maximum possible.\n\nSample Input 2\n\n2\n1 1\n1 1\n\nSample Output 2\n\n0", "sample_input": "3\n1 1\n2 4\n3 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02556", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N points on the 2D plane, i-th of which is located on (x_i, y_i).\nThere can be multiple points that share the same coordinate.\nWhat is the maximum possible Manhattan distance between two distinct points?\n\nHere, the Manhattan distance between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_i-y_j|.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq x_i,y_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\nx_2 y_2\n:\nx_N y_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 1\n2 4\n3 2\n\nSample Output 1\n\n4\n\nThe Manhattan distance between the first point and the second point is |1-2|+|1-4|=4, which is maximum possible.\n\nSample Input 2\n\n2\n1 1\n1 1\n\nSample Output 2\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 418, "cpu_time_ms": 621, "memory_kb": 45732}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s304120078", "group_id": "codeNet:p02556", "input_text": "def solve():\n N = int(input())\n P = []\n for _ in range(N):\n x, y = input().split()\n P.append((int(x), int(y)))\n ans = 0\n for i in range(N - 1):\n for j in range(i, N):\n ans = max(ans, abs(P[i][0] - P[j][0]) + abs(P[i][1] - P[j][1]))\n print(ans)\n\nif __name__ == \"__main__\":\n solve()\n", "language": "Python", "metadata": {"date": 1600027903, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02556.html", "problem_id": "p02556", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02556/input.txt", "sample_output_relpath": "derived/input_output/data/p02556/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02556/Python/s304120078.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s304120078", "user_id": "u710515311"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "def solve():\n N = int(input())\n P = []\n for _ in range(N):\n x, y = input().split()\n P.append((int(x), int(y)))\n ans = 0\n for i in range(N - 1):\n for j in range(i, N):\n ans = max(ans, abs(P[i][0] - P[j][0]) + abs(P[i][1] - P[j][1]))\n print(ans)\n\nif __name__ == \"__main__\":\n solve()\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N points on the 2D plane, i-th of which is located on (x_i, y_i).\nThere can be multiple points that share the same coordinate.\nWhat is the maximum possible Manhattan distance between two distinct points?\n\nHere, the Manhattan distance between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_i-y_j|.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq x_i,y_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\nx_2 y_2\n:\nx_N y_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 1\n2 4\n3 2\n\nSample Output 1\n\n4\n\nThe Manhattan distance between the first point and the second point is |1-2|+|1-4|=4, which is maximum possible.\n\nSample Input 2\n\n2\n1 1\n1 1\n\nSample Output 2\n\n0", "sample_input": "3\n1 1\n2 4\n3 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02556", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N points on the 2D plane, i-th of which is located on (x_i, y_i).\nThere can be multiple points that share the same coordinate.\nWhat is the maximum possible Manhattan distance between two distinct points?\n\nHere, the Manhattan distance between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_i-y_j|.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq x_i,y_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\nx_2 y_2\n:\nx_N y_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 1\n2 4\n3 2\n\nSample Output 1\n\n4\n\nThe Manhattan distance between the first point and the second point is |1-2|+|1-4|=4, which is maximum possible.\n\nSample Input 2\n\n2\n1 1\n1 1\n\nSample Output 2\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 334, "cpu_time_ms": 2208, "memory_kb": 92512}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s036272030", "group_id": "codeNet:p02558", "input_text": "class UnionFind:\n def __init__(self, N):\n \"\"\"\n N:要素数\n root:各要素の親要素の番号を格納するリスト.\n ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数.\n rank:ランク\n \"\"\"\n self.N = N\n self.root = [-1] * N\n self.rank = [0] * N\n\n def __repr__(self):\n return '\\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())\n\n def find(self, x):\n \"\"\"頂点xの根を見つける\"\"\"\n if self.root[x] < 0:\n return x\n else:\n while self.root[x] >= 0:\n x = self.root[x]\n return x\n\n def union(self, x, y):\n \"\"\"x,yが属する木をunion\"\"\"\n # 根を比較する\n # すでに同じ木に属していた場合は何もしない.\n # 違う木に属していた場合はrankを見てくっつける方を決める.\n # rankが同じ時はrankを1増やす\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n elif self.rank[x] > self.rank[y]:\n self.root[x] += self.root[y]\n self.root[y] = x\n else:\n self.root[y] += self.root[x]\n self.root[x] = y\n if self.rank[x] == self.rank[y]:\n self.rank[y] += 1\n\n def same(self, x, y):\n \"\"\"xとyが同じグループに属するかどうか\"\"\"\n return self.find(x) == self.find(y)\n\n def count(self, x):\n \"\"\"頂点xが属する木のサイズを返す\"\"\"\n return - self.root[self.find(x)]\n\n def members(self, x):\n \"\"\"xが属する木の要素を列挙\"\"\"\n _root = self.find(x)\n return [i for i in range(self.N) if self.find == _root]\n\n def roots(self):\n \"\"\"森の根を列挙\"\"\"\n return [i for i, x in enumerate(self.root) if x < 0]\n\n def group_count(self):\n \"\"\"連結成分の数\"\"\"\n return len(self.roots())\n\n def all_group_members(self):\n \"\"\"{ルート要素: [そのグループに含まれる要素のリスト], ...}の辞書を返す\"\"\"\n return {r: self.members(r) for r in self.roots()}\n\n\nimport sys\ninput = sys.stdin.readline\nn, q = map(int, input().split())\nuf = UnionFind(n)\nfor i in range(q):\n t, u, v = map(int, input().split())\n if t:\n print(int(uf.same(u, v)))\n else:\n uf.union(u, v)\n", "language": "Python", "metadata": {"date": 1599577005, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02558.html", "problem_id": "p02558", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02558/input.txt", "sample_output_relpath": "derived/input_output/data/p02558/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02558/Python/s036272030.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s036272030", "user_id": "u225388820"}, "prompt_components": {"gold_output": "0\n1\n0\n1\n", "input_to_evaluate": "class UnionFind:\n def __init__(self, N):\n \"\"\"\n N:要素数\n root:各要素の親要素の番号を格納するリスト.\n ただし, root[x] < 0 ならその頂点が根で-root[x]が木の要素数.\n rank:ランク\n \"\"\"\n self.N = N\n self.root = [-1] * N\n self.rank = [0] * N\n\n def __repr__(self):\n return '\\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())\n\n def find(self, x):\n \"\"\"頂点xの根を見つける\"\"\"\n if self.root[x] < 0:\n return x\n else:\n while self.root[x] >= 0:\n x = self.root[x]\n return x\n\n def union(self, x, y):\n \"\"\"x,yが属する木をunion\"\"\"\n # 根を比較する\n # すでに同じ木に属していた場合は何もしない.\n # 違う木に属していた場合はrankを見てくっつける方を決める.\n # rankが同じ時はrankを1増やす\n x = self.find(x)\n y = self.find(y)\n if x == y:\n return\n elif self.rank[x] > self.rank[y]:\n self.root[x] += self.root[y]\n self.root[y] = x\n else:\n self.root[y] += self.root[x]\n self.root[x] = y\n if self.rank[x] == self.rank[y]:\n self.rank[y] += 1\n\n def same(self, x, y):\n \"\"\"xとyが同じグループに属するかどうか\"\"\"\n return self.find(x) == self.find(y)\n\n def count(self, x):\n \"\"\"頂点xが属する木のサイズを返す\"\"\"\n return - self.root[self.find(x)]\n\n def members(self, x):\n \"\"\"xが属する木の要素を列挙\"\"\"\n _root = self.find(x)\n return [i for i in range(self.N) if self.find == _root]\n\n def roots(self):\n \"\"\"森の根を列挙\"\"\"\n return [i for i, x in enumerate(self.root) if x < 0]\n\n def group_count(self):\n \"\"\"連結成分の数\"\"\"\n return len(self.roots())\n\n def all_group_members(self):\n \"\"\"{ルート要素: [そのグループに含まれる要素のリスト], ...}の辞書を返す\"\"\"\n return {r: self.members(r) for r in self.roots()}\n\n\nimport sys\ninput = sys.stdin.readline\nn, q = map(int, input().split())\nuf = UnionFind(n)\nfor i in range(q):\n t, u, v = map(int, input().split())\n if t:\n print(int(uf.same(u, v)))\n else:\n uf.union(u, v)\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given an undirected graph with N vertices and 0 edges. Process Q queries of the following types.\n\n0 u v: Add an edge (u, v).\n\n1 u v: Print 1 if u and v are in the same connected component, 0 otherwise.\n\nConstraints\n\n1 \\leq N \\leq 200,000\n\n1 \\leq Q \\leq 200,000\n\n0 \\leq u_i, v_i \\lt N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nt_1 u_1 v_1\nt_2 u_2 v_2\n:\nt_Q u_Q v_Q\n\n出力\n\nFor each query of the latter type, print the answer.\n\nSample Input 1\n\n4 7\n1 0 1\n0 0 1\n0 2 3\n1 0 1\n1 1 2\n0 0 2\n1 1 3\n\nSample Output 1\n\n0\n1\n0\n1", "sample_input": "4 7\n1 0 1\n0 0 1\n0 2 3\n1 0 1\n1 1 2\n0 0 2\n1 1 3\n"}, "reference_outputs": ["0\n1\n0\n1\n"], "source_document_id": "p02558", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given an undirected graph with N vertices and 0 edges. Process Q queries of the following types.\n\n0 u v: Add an edge (u, v).\n\n1 u v: Print 1 if u and v are in the same connected component, 0 otherwise.\n\nConstraints\n\n1 \\leq N \\leq 200,000\n\n1 \\leq Q \\leq 200,000\n\n0 \\leq u_i, v_i \\lt N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nt_1 u_1 v_1\nt_2 u_2 v_2\n:\nt_Q u_Q v_Q\n\n出力\n\nFor each query of the latter type, print the answer.\n\nSample Input 1\n\n4 7\n1 0 1\n0 0 1\n0 2 3\n1 0 1\n1 1 2\n0 0 2\n1 1 3\n\nSample Output 1\n\n0\n1\n0\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2417, "cpu_time_ms": 264, "memory_kb": 75156}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s861287265", "group_id": "codeNet:p02567", "input_text": "import sys\ninput = sys.stdin.readline\n\n\nclass SegTree:\n def __init__(self, v, op, e) -> None:\n self._n = len(v)\n self.log = (self._n - 1).bit_length()\n self.size = 1 << self.log\n self.d = [e for _ in range(2 * self.size)]\n self.op = op\n self.e = e\n for i in range(self._n):\n self.d[self.size + i] = v[i]\n for i in reversed(range(1, self.size)):\n self.__update__(i)\n\n @classmethod\n def init_e(cls, n: int, op, e) -> 'SegTree':\n return cls([e for _ in range(n)], op, e)\n\n def set(self, p: int, x) -> None:\n p += self.size\n self.d[p] = x\n for i in range(1, self.log + 1):\n self.__update__(p >> i)\n\n def get(self, p: int):\n return self.d[p + self.size]\n\n def prod(self, l: int, r: int):\n sml = self.e\n smr = self.e\n l += self.size\n r += self.size\n\n while l < r:\n if l & 1:\n sml = self.op(sml, self.d[l])\n l += 1\n if r & 1:\n r -= 1\n smr = self.op(self.d[r], smr)\n l >>= 1\n r >>= 1\n return self.op(sml, smr)\n\n def all_prod(self):\n return self.d[1]\n\n def max_right(self, l: int, f):\n if l == self._n:\n return self._n\n l += self.size\n sm = self.e\n while True:\n while l & 1 == 0:\n l >>= 1\n if not f(self.op(sm, self.d[l])):\n while l < self.size:\n l <<= 1\n if f(self.op(sm, self.d[l])):\n sm = self.op(sm, self.d[l])\n l += 1\n return l - self.size\n sm = self.op(sm, self.d[l])\n l += 1\n if (l & -l) == l:\n return self._n\n\n def min_left(self, r: int, f):\n if r == 0:\n return 0\n r += self.size\n sm = self.e\n while True:\n r -= 1\n while r > 1 and r & 1:\n r >>= 1\n if not f(self.op(self.d[r], sm)):\n while r < self.size:\n r = (r << 1) + 1\n if f(self.op(self.d[r], sm)):\n sm = self.op(self.d[r], sm)\n r -= 1\n return r + 1 - self.size\n sm = self.op(self.d[r], sm)\n if (r & -r) == r:\n return 0\n\n def __update__(self, k: int) -> None:\n self.d[k] = self.op(self.d[k << 1], self.d[(k << 1) + 1])\n\n\nn, q = map(int, input().split())\na = list(map(int, input().split()))\nseg = SegTree(a, max, -1)\n\nfor _ in range(q):\n t, x, y = map(int, input().split())\n if t == 1:\n seg.set(x - 1, y)\n elif t == 2:\n print(seg.prod(x - 1, y))\n else:\n print(seg.max_right(x - 1, lambda v: v < y) + 1)\n", "language": "Python", "metadata": {"date": 1599942378, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02567.html", "problem_id": "p02567", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02567/input.txt", "sample_output_relpath": "derived/input_output/data/p02567/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02567/Python/s861287265.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s861287265", "user_id": "u571969099"}, "prompt_components": {"gold_output": "3\n3\n2\n6\n", "input_to_evaluate": "import sys\ninput = sys.stdin.readline\n\n\nclass SegTree:\n def __init__(self, v, op, e) -> None:\n self._n = len(v)\n self.log = (self._n - 1).bit_length()\n self.size = 1 << self.log\n self.d = [e for _ in range(2 * self.size)]\n self.op = op\n self.e = e\n for i in range(self._n):\n self.d[self.size + i] = v[i]\n for i in reversed(range(1, self.size)):\n self.__update__(i)\n\n @classmethod\n def init_e(cls, n: int, op, e) -> 'SegTree':\n return cls([e for _ in range(n)], op, e)\n\n def set(self, p: int, x) -> None:\n p += self.size\n self.d[p] = x\n for i in range(1, self.log + 1):\n self.__update__(p >> i)\n\n def get(self, p: int):\n return self.d[p + self.size]\n\n def prod(self, l: int, r: int):\n sml = self.e\n smr = self.e\n l += self.size\n r += self.size\n\n while l < r:\n if l & 1:\n sml = self.op(sml, self.d[l])\n l += 1\n if r & 1:\n r -= 1\n smr = self.op(self.d[r], smr)\n l >>= 1\n r >>= 1\n return self.op(sml, smr)\n\n def all_prod(self):\n return self.d[1]\n\n def max_right(self, l: int, f):\n if l == self._n:\n return self._n\n l += self.size\n sm = self.e\n while True:\n while l & 1 == 0:\n l >>= 1\n if not f(self.op(sm, self.d[l])):\n while l < self.size:\n l <<= 1\n if f(self.op(sm, self.d[l])):\n sm = self.op(sm, self.d[l])\n l += 1\n return l - self.size\n sm = self.op(sm, self.d[l])\n l += 1\n if (l & -l) == l:\n return self._n\n\n def min_left(self, r: int, f):\n if r == 0:\n return 0\n r += self.size\n sm = self.e\n while True:\n r -= 1\n while r > 1 and r & 1:\n r >>= 1\n if not f(self.op(self.d[r], sm)):\n while r < self.size:\n r = (r << 1) + 1\n if f(self.op(self.d[r], sm)):\n sm = self.op(self.d[r], sm)\n r -= 1\n return r + 1 - self.size\n sm = self.op(self.d[r], sm)\n if (r & -r) == r:\n return 0\n\n def __update__(self, k: int) -> None:\n self.d[k] = self.op(self.d[k << 1], self.d[(k << 1) + 1])\n\n\nn, q = map(int, input().split())\na = list(map(int, input().split()))\nseg = SegTree(a, max, -1)\n\nfor _ in range(q):\n t, x, y = map(int, input().split())\n if t == 1:\n seg.set(x - 1, y)\n elif t == 2:\n print(seg.prod(x - 1, y))\n else:\n print(seg.max_right(x - 1, lambda v: v < y) + 1)\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given an array a_0, a_1, ..., a_{N-1} of length N. Process Q queries of the following types.\n\nThe type of i-th query is represented by T_i.\n\nT_i=1: You are given two integers X_i,V_i. Replace the value of A_{X_i} with V_i.\n\nT_i=2: You are given two integers L_i,R_i. Calculate the maximum value among A_{L_i},A_{L_i+1},\\cdots,A_{R_i}.\n\nT_i=3: You are given two integers X_i,V_i. Calculate the minimum j such that X_i \\leq j \\leq N, V_i \\leq A_j. If there is no such j, answer j=N+1 instead.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq A_i \\leq 10^9\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq T_i \\leq 3\n\n1 \\leq X_i \\leq N, 0 \\leq V_i \\leq 10^9 (T_i=1,3)\n\n1 \\leq L_i \\leq R_i \\leq N (T_i=2)\n\nAll values in Input are integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nA_1 A_2 \\cdots A_N\nFirst query\nSecond query\n\\vdots\nQ-th query\n\nEach query is given in the following format:\n\nIf T_i=1,3,\n\nT_i X_i V_i\n\nIf T_i=2,\n\nT_i L_i R_i\n\nOutput\n\nFor each query with T_i=2, 3, print the answer.\n\nSample Input 1\n\n5 5\n1 2 3 2 1\n2 1 5\n3 2 3\n1 3 1\n2 2 4\n3 1 3\n\nSample Output 1\n\n3\n3\n2\n6\n\nFirst query: Print 3, which is the maximum of (A_1,A_2,A_3,A_4,A_5)=(1,2,3,2,1).\n\nSecond query: Since 3>A_2, j=2 does not satisfy the condition.Since 3 \\leq A_3, print j=3.\n\nThird query: Replace the value of A_3 with 1. It becomes A=(1,2,1,2,1).\n\nFourth query: Print 2, which is the maximum of (A_2,A_3,A_4)=(2,1,2).\n\nFifth query: Since there is no j that satisfies the condition, print j=N+1=6.", "sample_input": "5 5\n1 2 3 2 1\n2 1 5\n3 2 3\n1 3 1\n2 2 4\n3 1 3\n"}, "reference_outputs": ["3\n3\n2\n6\n"], "source_document_id": "p02567", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given an array a_0, a_1, ..., a_{N-1} of length N. Process Q queries of the following types.\n\nThe type of i-th query is represented by T_i.\n\nT_i=1: You are given two integers X_i,V_i. Replace the value of A_{X_i} with V_i.\n\nT_i=2: You are given two integers L_i,R_i. Calculate the maximum value among A_{L_i},A_{L_i+1},\\cdots,A_{R_i}.\n\nT_i=3: You are given two integers X_i,V_i. Calculate the minimum j such that X_i \\leq j \\leq N, V_i \\leq A_j. If there is no such j, answer j=N+1 instead.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq A_i \\leq 10^9\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n1 \\leq T_i \\leq 3\n\n1 \\leq X_i \\leq N, 0 \\leq V_i \\leq 10^9 (T_i=1,3)\n\n1 \\leq L_i \\leq R_i \\leq N (T_i=2)\n\nAll values in Input are integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nA_1 A_2 \\cdots A_N\nFirst query\nSecond query\n\\vdots\nQ-th query\n\nEach query is given in the following format:\n\nIf T_i=1,3,\n\nT_i X_i V_i\n\nIf T_i=2,\n\nT_i L_i R_i\n\nOutput\n\nFor each query with T_i=2, 3, print the answer.\n\nSample Input 1\n\n5 5\n1 2 3 2 1\n2 1 5\n3 2 3\n1 3 1\n2 2 4\n3 1 3\n\nSample Output 1\n\n3\n3\n2\n6\n\nFirst query: Print 3, which is the maximum of (A_1,A_2,A_3,A_4,A_5)=(1,2,3,2,1).\n\nSecond query: Since 3>A_2, j=2 does not satisfy the condition.Since 3 \\leq A_3, print j=3.\n\nThird query: Replace the value of A_3 with 1. It becomes A=(1,2,1,2,1).\n\nFourth query: Print 2, which is the maximum of (A_2,A_3,A_4)=(2,1,2).\n\nFifth query: Since there is no j that satisfies the condition, print j=N+1=6.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2878, "cpu_time_ms": 455, "memory_kb": 123480}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s363116327", "group_id": "codeNet:p02570", "input_text": "D, T, S= map(int, input().split())\n\n\nif D/S <= T:\n print(\"Yes\")\nelse:\n print(\"No\")", "language": "Python", "metadata": {"date": 1598727726, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02570.html", "problem_id": "p02570", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02570/input.txt", "sample_output_relpath": "derived/input_output/data/p02570/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02570/Python/s363116327.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s363116327", "user_id": "u455809703"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "D, T, S= map(int, input().split())\n\n\nif D/S <= T:\n print(\"Yes\")\nelse:\n print(\"No\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is meeting up with Aoki.\n\nThey have planned to meet at a place that is D meters away from Takahashi's house in T minutes from now.\n\nTakahashi will leave his house now and go straight to the place at a speed of S meters per minute.\n\nWill he arrive in time?\n\nConstraints\n\n1 \\leq D \\leq 10000\n\n1 \\leq T \\leq 10000\n\n1 \\leq S \\leq 10000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD T S\n\nOutput\n\nIf Takahashi will reach the place in time, print Yes; otherwise, print No.\n\nSample Input 1\n\n1000 15 80\n\nSample Output 1\n\nYes\n\nIt takes 12.5 minutes to go 1000 meters to the place at a speed of 80 meters per minute. They have planned to meet in 15 minutes so he will arrive in time.\n\nSample Input 2\n\n2000 20 100\n\nSample Output 2\n\nYes\n\nIt takes 20 minutes to go 2000 meters to the place at a speed of 100 meters per minute. They have planned to meet in 20 minutes so he will arrive just on time.\n\nSample Input 3\n\n10000 1 1\n\nSample Output 3\n\nNo\n\nHe will be late.", "sample_input": "1000 15 80\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02570", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is meeting up with Aoki.\n\nThey have planned to meet at a place that is D meters away from Takahashi's house in T minutes from now.\n\nTakahashi will leave his house now and go straight to the place at a speed of S meters per minute.\n\nWill he arrive in time?\n\nConstraints\n\n1 \\leq D \\leq 10000\n\n1 \\leq T \\leq 10000\n\n1 \\leq S \\leq 10000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD T S\n\nOutput\n\nIf Takahashi will reach the place in time, print Yes; otherwise, print No.\n\nSample Input 1\n\n1000 15 80\n\nSample Output 1\n\nYes\n\nIt takes 12.5 minutes to go 1000 meters to the place at a speed of 80 meters per minute. They have planned to meet in 15 minutes so he will arrive in time.\n\nSample Input 2\n\n2000 20 100\n\nSample Output 2\n\nYes\n\nIt takes 20 minutes to go 2000 meters to the place at a speed of 100 meters per minute. They have planned to meet in 20 minutes so he will arrive just on time.\n\nSample Input 3\n\n10000 1 1\n\nSample Output 3\n\nNo\n\nHe will be late.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 88, "cpu_time_ms": 33, "memory_kb": 9180}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s764563104", "group_id": "codeNet:p02571", "input_text": "s = list(input())\nt = list(input())\ntmp = 0\nans = len(t)\n# j_tmp = 0\nfor i in range(len(s) - len(t) + 1):\n tmp = 0\n for j in range(len(t)):\n if s[i + j] != t[j]:\n tmp += 1\n if tmp < ans:\n ans = tmp\nprint(ans)\n", "language": "Python", "metadata": {"date": 1598735576, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02571.html", "problem_id": "p02571", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02571/input.txt", "sample_output_relpath": "derived/input_output/data/p02571/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02571/Python/s764563104.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s764563104", "user_id": "u449175559"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "s = list(input())\nt = list(input())\ntmp = 0\nans = len(t)\n# j_tmp = 0\nfor i in range(len(s) - len(t) + 1):\n tmp = 0\n for j in range(len(t)):\n if s[i + j] != t[j]:\n tmp += 1\n if tmp < ans:\n ans = tmp\nprint(ans)\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are two strings S and T.\n\nLet us change some of the characters in S so that T will be a substring of S.\n\nAt least how many characters do we need to change?\n\nHere, a substring is a consecutive subsequence. For example, xxx is a substring of yxxxy, but not a substring of xxyxx.\n\nConstraints\n\nThe lengths of S and T are each at least 1 and at most 1000.\n\nThe length of T is at most that of S.\n\nS and T consist of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the minimum number of characters in S that need to be changed.\n\nSample Input 1\n\ncabacc\nabc\n\nSample Output 1\n\n1\n\nFor example, changing the fourth character a in S to c will match the second through fourth characters in S to T.\n\nSince S itself does not have T as its substring, this number of changes - one - is the minimum needed.\n\nSample Input 2\n\ncodeforces\natcoder\n\nSample Output 2\n\n6", "sample_input": "cabacc\nabc\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02571", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are two strings S and T.\n\nLet us change some of the characters in S so that T will be a substring of S.\n\nAt least how many characters do we need to change?\n\nHere, a substring is a consecutive subsequence. For example, xxx is a substring of yxxxy, but not a substring of xxyxx.\n\nConstraints\n\nThe lengths of S and T are each at least 1 and at most 1000.\n\nThe length of T is at most that of S.\n\nS and T consist of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the minimum number of characters in S that need to be changed.\n\nSample Input 1\n\ncabacc\nabc\n\nSample Output 1\n\n1\n\nFor example, changing the fourth character a in S to c will match the second through fourth characters in S to T.\n\nSince S itself does not have T as its substring, this number of changes - one - is the minimum needed.\n\nSample Input 2\n\ncodeforces\natcoder\n\nSample Output 2\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 243, "cpu_time_ms": 66, "memory_kb": 9072}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s317978054", "group_id": "codeNet:p02571", "input_text": "S = input()\nT = input()\n\nfor i in range(len(T), 0, -1):\n for j in range(len(T)-i+1):\n subst = T[j:i+j]\n# print(subst)\n if S.find(subst, j, len(S)-(len(T)-i-j))>=0:\n print (len(T)-i)\n print(subst)\n# exit(0)\n", "language": "Python", "metadata": {"date": 1598730414, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02571.html", "problem_id": "p02571", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02571/input.txt", "sample_output_relpath": "derived/input_output/data/p02571/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02571/Python/s317978054.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s317978054", "user_id": "u231570044"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "S = input()\nT = input()\n\nfor i in range(len(T), 0, -1):\n for j in range(len(T)-i+1):\n subst = T[j:i+j]\n# print(subst)\n if S.find(subst, j, len(S)-(len(T)-i-j))>=0:\n print (len(T)-i)\n print(subst)\n# exit(0)\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are two strings S and T.\n\nLet us change some of the characters in S so that T will be a substring of S.\n\nAt least how many characters do we need to change?\n\nHere, a substring is a consecutive subsequence. For example, xxx is a substring of yxxxy, but not a substring of xxyxx.\n\nConstraints\n\nThe lengths of S and T are each at least 1 and at most 1000.\n\nThe length of T is at most that of S.\n\nS and T consist of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the minimum number of characters in S that need to be changed.\n\nSample Input 1\n\ncabacc\nabc\n\nSample Output 1\n\n1\n\nFor example, changing the fourth character a in S to c will match the second through fourth characters in S to T.\n\nSince S itself does not have T as its substring, this number of changes - one - is the minimum needed.\n\nSample Input 2\n\ncodeforces\natcoder\n\nSample Output 2\n\n6", "sample_input": "cabacc\nabc\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02571", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are two strings S and T.\n\nLet us change some of the characters in S so that T will be a substring of S.\n\nAt least how many characters do we need to change?\n\nHere, a substring is a consecutive subsequence. For example, xxx is a substring of yxxxy, but not a substring of xxyxx.\n\nConstraints\n\nThe lengths of S and T are each at least 1 and at most 1000.\n\nThe length of T is at most that of S.\n\nS and T consist of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the minimum number of characters in S that need to be changed.\n\nSample Input 1\n\ncabacc\nabc\n\nSample Output 1\n\n1\n\nFor example, changing the fourth character a in S to c will match the second through fourth characters in S to T.\n\nSince S itself does not have T as its substring, this number of changes - one - is the minimum needed.\n\nSample Input 2\n\ncodeforces\natcoder\n\nSample Output 2\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 263, "cpu_time_ms": 2395, "memory_kb": 137884}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s291872538", "group_id": "codeNet:p02571", "input_text": "s = input()\nt = input()\nn = len(s) - len(t) + 1\nans = 1000\nfor i in range(n):\n temp = 0\n for j in range(len(t)):\n if t[j] != s[j+i]:\n temp += 1\n ans = min(temp,ans)\nprint(temp)", "language": "Python", "metadata": {"date": 1598728318, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02571.html", "problem_id": "p02571", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02571/input.txt", "sample_output_relpath": "derived/input_output/data/p02571/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02571/Python/s291872538.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s291872538", "user_id": "u920204936"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "s = input()\nt = input()\nn = len(s) - len(t) + 1\nans = 1000\nfor i in range(n):\n temp = 0\n for j in range(len(t)):\n if t[j] != s[j+i]:\n temp += 1\n ans = min(temp,ans)\nprint(temp)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are two strings S and T.\n\nLet us change some of the characters in S so that T will be a substring of S.\n\nAt least how many characters do we need to change?\n\nHere, a substring is a consecutive subsequence. For example, xxx is a substring of yxxxy, but not a substring of xxyxx.\n\nConstraints\n\nThe lengths of S and T are each at least 1 and at most 1000.\n\nThe length of T is at most that of S.\n\nS and T consist of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the minimum number of characters in S that need to be changed.\n\nSample Input 1\n\ncabacc\nabc\n\nSample Output 1\n\n1\n\nFor example, changing the fourth character a in S to c will match the second through fourth characters in S to T.\n\nSince S itself does not have T as its substring, this number of changes - one - is the minimum needed.\n\nSample Input 2\n\ncodeforces\natcoder\n\nSample Output 2\n\n6", "sample_input": "cabacc\nabc\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02571", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are two strings S and T.\n\nLet us change some of the characters in S so that T will be a substring of S.\n\nAt least how many characters do we need to change?\n\nHere, a substring is a consecutive subsequence. For example, xxx is a substring of yxxxy, but not a substring of xxyxx.\n\nConstraints\n\nThe lengths of S and T are each at least 1 and at most 1000.\n\nThe length of T is at most that of S.\n\nS and T consist of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the minimum number of characters in S that need to be changed.\n\nSample Input 1\n\ncabacc\nabc\n\nSample Output 1\n\n1\n\nFor example, changing the fourth character a in S to c will match the second through fourth characters in S to T.\n\nSince S itself does not have T as its substring, this number of changes - one - is the minimum needed.\n\nSample Input 2\n\ncodeforces\natcoder\n\nSample Output 2\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 203, "cpu_time_ms": 71, "memory_kb": 72848}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s832177967", "group_id": "codeNet:p02573", "input_text": "from collections import Counter\nN, M = map(int, input().split())\ngroups = [0] * (N + 1)\ngroup_num_list = [[0]]\ngroup_num = 1\nfor _ in range(M):\n A, B = map(int, input().split())\n if groups[A] != 0 and groups[B] != 0:\n if groups[A] != groups[B]:\n lower = min(groups[A], groups[B])\n higher = max(groups[A], groups[B])\n for i in group_num_list[higher]:\n groups[i] = lower\n tmp = group_num_list[higher]\n group_num_list[lower].extend(tmp)\n # del group_num_list[higher]\n elif groups[A] != 0:\n groups[B] = groups[A]\n group_num_list[groups[A]].append(B)\n elif groups[B] != 0:\n groups[A] = groups[B]\n group_num_list[groups[B]].append(A)\n else:\n groups[A] = group_num\n groups[B] = group_num\n group_num_list.append([A, B])\n group_num += 1\ncounter = Counter(groups)\n# print(collection)\n# print(group_num_list)\nif counter.most_common()[0][0] != 0:\n print(counter.most_common()[0][1])\nelse:\n print(counter.most_common()[1][1])\n", "language": "Python", "metadata": {"date": 1598732512, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02573.html", "problem_id": "p02573", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02573/input.txt", "sample_output_relpath": "derived/input_output/data/p02573/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02573/Python/s832177967.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s832177967", "user_id": "u581022379"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "from collections import Counter\nN, M = map(int, input().split())\ngroups = [0] * (N + 1)\ngroup_num_list = [[0]]\ngroup_num = 1\nfor _ in range(M):\n A, B = map(int, input().split())\n if groups[A] != 0 and groups[B] != 0:\n if groups[A] != groups[B]:\n lower = min(groups[A], groups[B])\n higher = max(groups[A], groups[B])\n for i in group_num_list[higher]:\n groups[i] = lower\n tmp = group_num_list[higher]\n group_num_list[lower].extend(tmp)\n # del group_num_list[higher]\n elif groups[A] != 0:\n groups[B] = groups[A]\n group_num_list[groups[A]].append(B)\n elif groups[B] != 0:\n groups[A] = groups[B]\n group_num_list[groups[B]].append(A)\n else:\n groups[A] = group_num\n groups[B] = group_num\n group_num_list.append([A, B])\n group_num += 1\ncounter = Counter(groups)\n# print(collection)\n# print(group_num_list)\nif counter.most_common()[0][0] != 0:\n print(counter.most_common()[0][1])\nelse:\n print(counter.most_common()[1][1])\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N persons called Person 1 through Person N.\n\nYou are given M facts that \"Person A_i and Person B_i are friends.\" The same fact may be given multiple times.\n\nIf X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts.\n\nTakahashi the evil wants to divide the N persons into some number of groups so that every person has no friend in his/her group.\n\nAt least how many groups does he need to make?\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\leq M \\leq 2\\times 10^5\n\n1\\leq A_i,B_i\\leq N\n\nA_i \\neq B_i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n\\vdots\nA_M B_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n5 3\n1 2\n3 4\n5 1\n\nSample Output 1\n\n3\n\nDividing them into three groups such as \\{1,3\\}, \\{2,4\\}, and \\{5\\} achieves the goal.\n\nSample Input 2\n\n4 10\n1 2\n2 1\n1 2\n2 1\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4\n\nSample Output 2\n\n4\n\nSample Input 3\n\n10 4\n3 1\n4 1\n5 9\n2 6\n\nSample Output 3\n\n3", "sample_input": "5 3\n1 2\n3 4\n5 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02573", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N persons called Person 1 through Person N.\n\nYou are given M facts that \"Person A_i and Person B_i are friends.\" The same fact may be given multiple times.\n\nIf X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts.\n\nTakahashi the evil wants to divide the N persons into some number of groups so that every person has no friend in his/her group.\n\nAt least how many groups does he need to make?\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\leq M \\leq 2\\times 10^5\n\n1\\leq A_i,B_i\\leq N\n\nA_i \\neq B_i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n\\vdots\nA_M B_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n5 3\n1 2\n3 4\n5 1\n\nSample Output 1\n\n3\n\nDividing them into three groups such as \\{1,3\\}, \\{2,4\\}, and \\{5\\} achieves the goal.\n\nSample Input 2\n\n4 10\n1 2\n2 1\n1 2\n2 1\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4\n\nSample Output 2\n\n4\n\nSample Input 3\n\n10 4\n3 1\n4 1\n5 9\n2 6\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1078, "cpu_time_ms": 658, "memory_kb": 31524}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s345436090", "group_id": "codeNet:p02576", "input_text": "N, X, T = (int(a) for a in input().split())\nprint(math.ceil(N / X) * T)", "language": "Python", "metadata": {"date": 1598212004, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02576.html", "problem_id": "p02576", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02576/input.txt", "sample_output_relpath": "derived/input_output/data/p02576/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02576/Python/s345436090.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s345436090", "user_id": "u855219015"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "N, X, T = (int(a) for a in input().split())\nprint(math.ceil(N / X) * T)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi loves takoyaki - a ball-shaped snack.\n\nWith a takoyaki machine, he can make at most X pieces of takoyaki at a time, taking T minutes regardless of the number of pieces to make.\n\nHow long does it take to make N takoyaki?\n\nConstraints\n\n1 \\leq N,X,T \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X T\n\nOutput\n\nPrint an integer representing the minimum number of minutes needed to make N pieces of takoyaki.\n\nSample Input 1\n\n20 12 6\n\nSample Output 1\n\n12\n\nHe can make 12 pieces of takoyaki in the first 6 minutes and 8 more in the next 6 minutes, so he can make 20 in a total of 12 minutes.\n\nNote that being able to make 12 in 6 minutes does not mean he can make 2 in 1 minute.\n\nSample Input 2\n\n1000 1 1000\n\nSample Output 2\n\n1000000\n\nIt seems to take a long time to make this kind of takoyaki.", "sample_input": "20 12 6\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02576", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi loves takoyaki - a ball-shaped snack.\n\nWith a takoyaki machine, he can make at most X pieces of takoyaki at a time, taking T minutes regardless of the number of pieces to make.\n\nHow long does it take to make N takoyaki?\n\nConstraints\n\n1 \\leq N,X,T \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X T\n\nOutput\n\nPrint an integer representing the minimum number of minutes needed to make N pieces of takoyaki.\n\nSample Input 1\n\n20 12 6\n\nSample Output 1\n\n12\n\nHe can make 12 pieces of takoyaki in the first 6 minutes and 8 more in the next 6 minutes, so he can make 20 in a total of 12 minutes.\n\nNote that being able to make 12 in 6 minutes does not mean he can make 2 in 1 minute.\n\nSample Input 2\n\n1000 1 1000\n\nSample Output 2\n\n1000000\n\nIt seems to take a long time to make this kind of takoyaki.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 71, "cpu_time_ms": 25, "memory_kb": 9112}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s941435385", "group_id": "codeNet:p02576", "input_text": "n,x,t = map(int, input().split())\nko = 0\ntime = 0\nwhile ko < n:\n time += t\n ko += x\nprint(time)\n", "language": "Python", "metadata": {"date": 1598123101, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02576.html", "problem_id": "p02576", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02576/input.txt", "sample_output_relpath": "derived/input_output/data/p02576/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02576/Python/s941435385.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s941435385", "user_id": "u463893436"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "n,x,t = map(int, input().split())\nko = 0\ntime = 0\nwhile ko < n:\n time += t\n ko += x\nprint(time)\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi loves takoyaki - a ball-shaped snack.\n\nWith a takoyaki machine, he can make at most X pieces of takoyaki at a time, taking T minutes regardless of the number of pieces to make.\n\nHow long does it take to make N takoyaki?\n\nConstraints\n\n1 \\leq N,X,T \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X T\n\nOutput\n\nPrint an integer representing the minimum number of minutes needed to make N pieces of takoyaki.\n\nSample Input 1\n\n20 12 6\n\nSample Output 1\n\n12\n\nHe can make 12 pieces of takoyaki in the first 6 minutes and 8 more in the next 6 minutes, so he can make 20 in a total of 12 minutes.\n\nNote that being able to make 12 in 6 minutes does not mean he can make 2 in 1 minute.\n\nSample Input 2\n\n1000 1 1000\n\nSample Output 2\n\n1000000\n\nIt seems to take a long time to make this kind of takoyaki.", "sample_input": "20 12 6\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02576", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi loves takoyaki - a ball-shaped snack.\n\nWith a takoyaki machine, he can make at most X pieces of takoyaki at a time, taking T minutes regardless of the number of pieces to make.\n\nHow long does it take to make N takoyaki?\n\nConstraints\n\n1 \\leq N,X,T \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X T\n\nOutput\n\nPrint an integer representing the minimum number of minutes needed to make N pieces of takoyaki.\n\nSample Input 1\n\n20 12 6\n\nSample Output 1\n\n12\n\nHe can make 12 pieces of takoyaki in the first 6 minutes and 8 more in the next 6 minutes, so he can make 20 in a total of 12 minutes.\n\nNote that being able to make 12 in 6 minutes does not mean he can make 2 in 1 minute.\n\nSample Input 2\n\n1000 1 1000\n\nSample Output 2\n\n1000000\n\nIt seems to take a long time to make this kind of takoyaki.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 102, "cpu_time_ms": 32, "memory_kb": 9156}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s422313495", "group_id": "codeNet:p02576", "input_text": "N, X, T = map(int, input().split())\n\nans = (N + X - 1) // X * T\n\nprint (ans)", "language": "Python", "metadata": {"date": 1598122865, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02576.html", "problem_id": "p02576", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02576/input.txt", "sample_output_relpath": "derived/input_output/data/p02576/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02576/Python/s422313495.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s422313495", "user_id": "u263830634"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "N, X, T = map(int, input().split())\n\nans = (N + X - 1) // X * T\n\nprint (ans)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi loves takoyaki - a ball-shaped snack.\n\nWith a takoyaki machine, he can make at most X pieces of takoyaki at a time, taking T minutes regardless of the number of pieces to make.\n\nHow long does it take to make N takoyaki?\n\nConstraints\n\n1 \\leq N,X,T \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X T\n\nOutput\n\nPrint an integer representing the minimum number of minutes needed to make N pieces of takoyaki.\n\nSample Input 1\n\n20 12 6\n\nSample Output 1\n\n12\n\nHe can make 12 pieces of takoyaki in the first 6 minutes and 8 more in the next 6 minutes, so he can make 20 in a total of 12 minutes.\n\nNote that being able to make 12 in 6 minutes does not mean he can make 2 in 1 minute.\n\nSample Input 2\n\n1000 1 1000\n\nSample Output 2\n\n1000000\n\nIt seems to take a long time to make this kind of takoyaki.", "sample_input": "20 12 6\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02576", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi loves takoyaki - a ball-shaped snack.\n\nWith a takoyaki machine, he can make at most X pieces of takoyaki at a time, taking T minutes regardless of the number of pieces to make.\n\nHow long does it take to make N takoyaki?\n\nConstraints\n\n1 \\leq N,X,T \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X T\n\nOutput\n\nPrint an integer representing the minimum number of minutes needed to make N pieces of takoyaki.\n\nSample Input 1\n\n20 12 6\n\nSample Output 1\n\n12\n\nHe can make 12 pieces of takoyaki in the first 6 minutes and 8 more in the next 6 minutes, so he can make 20 in a total of 12 minutes.\n\nNote that being able to make 12 in 6 minutes does not mean he can make 2 in 1 minute.\n\nSample Input 2\n\n1000 1 1000\n\nSample Output 2\n\n1000000\n\nIt seems to take a long time to make this kind of takoyaki.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 76, "cpu_time_ms": 27, "memory_kb": 9152}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s015646539", "group_id": "codeNet:p02578", "input_text": "N = int(input())\n\nAs = [int(i) for i in input().split(\" \")]\n\n\ncurrent_max_height = 0\n\n\nneed_height = 0\nfor i in range(N):\n\n if As[i] > current_max_height:\n current_max_height = As[i]\n\n need_height += current_max_height - As[i]\n\nprint(need_height)", "language": "Python", "metadata": {"date": 1598124127, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02578.html", "problem_id": "p02578", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02578/input.txt", "sample_output_relpath": "derived/input_output/data/p02578/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02578/Python/s015646539.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s015646539", "user_id": "u821393459"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "N = int(input())\n\nAs = [int(i) for i in input().split(\" \")]\n\n\ncurrent_max_height = 0\n\n\nneed_height = 0\nfor i in range(N):\n\n if As[i] > current_max_height:\n current_max_height = As[i]\n\n need_height += current_max_height - As[i]\n\nprint(need_height)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nN persons are standing in a row. The height of the i-th person from the front is A_i.\n\nWe want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person:\n\nCondition: Nobody in front of the person is taller than the person. Here, the height of a person includes the stool.\n\nFind the minimum total height of the stools needed to meet this goal.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nPrint the minimum total height of the stools needed to meet the goal.\n\nSample Input 1\n\n5\n2 1 5 4 3\n\nSample Output 1\n\n4\n\nIf the persons stand on stools of heights 0, 1, 0, 1, and 2, respectively, their heights will be 2, 2, 5, 5, and 5, satisfying the condition.\n\nWe cannot meet the goal with a smaller total height of the stools.\n\nSample Input 2\n\n5\n3 3 3 3 3\n\nSample Output 2\n\n0\n\nGiving a stool of height 0 to everyone will work.", "sample_input": "5\n2 1 5 4 3\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02578", "source_text": "Score : 300 points\n\nProblem Statement\n\nN persons are standing in a row. The height of the i-th person from the front is A_i.\n\nWe want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person:\n\nCondition: Nobody in front of the person is taller than the person. Here, the height of a person includes the stool.\n\nFind the minimum total height of the stools needed to meet this goal.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nPrint the minimum total height of the stools needed to meet the goal.\n\nSample Input 1\n\n5\n2 1 5 4 3\n\nSample Output 1\n\n4\n\nIf the persons stand on stools of heights 0, 1, 0, 1, and 2, respectively, their heights will be 2, 2, 5, 5, and 5, satisfying the condition.\n\nWe cannot meet the goal with a smaller total height of the stools.\n\nSample Input 2\n\n5\n3 3 3 3 3\n\nSample Output 2\n\n0\n\nGiving a stool of height 0 to everyone will work.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 259, "cpu_time_ms": 122, "memory_kb": 32252}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s809808661", "group_id": "codeNet:p02578", "input_text": "n=int(input())\na=list(map(int,input().split()))\nnum=0\nk=a[0]\nfor i in a:\n if i>k:\n k=i\n if ik:\n k=i\n if i=-1 and j <= 1) or (j==0 and i >=-1 and i <= 1):\n if (pos[0]+i>-1 and pos[0]+i-1 and pos[1]+j-1 and pos[0]+i-1 and pos[1]+jtime+1):\n q.append([[pos[0]+i, pos[1]+j],time+1])\n dt[pos[0]+i][pos[1]+j] = time+1\n\n\nprint(ans)\n", "language": "Python", "metadata": {"date": 1598126646, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02579.html", "problem_id": "p02579", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02579/input.txt", "sample_output_relpath": "derived/input_output/data/p02579/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02579/Python/s331604546.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s331604546", "user_id": "u152334204"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "h,w = map(int,input().split())\nc = list(map(int,input().split()))\nd = list(map(int,input().split()))\ns = [list(input()) for _ in range(h)]\n\nc[0] -= 1\nc[1] -= 1\nd[0] -= 1\nd[1] -= 1\n\nstack = []\nq = [[c, 0]]\nans = -1\ndt = [[h*w for _ in range(w)] for _ in range(h)]\ndt[c[0]][c[1]] = 0\nwhile q:\n #print(\"q: {}\".format(q))\n pos,time = q.pop(0)\n stack = [pos]\n while stack:\n #print(\"stack: {}\".format(stack))\n pos = stack.pop()\n if pos[0] == d[0] and pos[1] == d[1]:\n ans = time\n q = []\n break\n for i in range(-2,3):\n for j in range(-2,3):\n if i==0 and j==0:\n continue\n elif (i==0 and j >=-1 and j <= 1) or (j==0 and i >=-1 and i <= 1):\n if (pos[0]+i>-1 and pos[0]+i-1 and pos[1]+j-1 and pos[0]+i-1 and pos[1]+jtime+1):\n q.append([[pos[0]+i, pos[1]+j],time+1])\n dt[pos[0]+i][pos[1]+j] = time+1\n\n\nprint(ans)\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nA maze is composed of a grid of H \\times W squares - H vertical, W horizontal.\n\nThe square at the i-th row from the top and the j-th column from the left - (i,j) - is a wall if S_{ij} is # and a road if S_{ij} is ..\n\nThere is a magician in (C_h,C_w). He can do the following two kinds of moves:\n\nMove A: Walk to a road square that is vertically or horizontally adjacent to the square he is currently in.\n\nMove B: Use magic to warp himself to a road square in the 5\\times 5 area centered at the square he is currently in.\n\nIn either case, he cannot go out of the maze.\n\nAt least how many times does he need to use the magic to reach (D_h, D_w)?\n\nConstraints\n\n1 \\leq H,W \\leq 10^3\n\n1 \\leq C_h,D_h \\leq H\n\n1 \\leq C_w,D_w \\leq W\n\nS_{ij} is # or ..\n\nS_{C_h C_w} and S_{D_h D_w} are ..\n\n(C_h,C_w) \\neq (D_h,D_w)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nC_h C_w\nD_h D_w\nS_{11}\\ldots S_{1W}\n\\vdots\nS_{H1}\\ldots S_{HW}\n\nOutput\n\nPrint the minimum number of times the magician needs to use the magic. If he cannot reach (D_h,D_w), print -1 instead.\n\nSample Input 1\n\n4 4\n1 1\n4 4\n..#.\n..#.\n.#..\n.#..\n\nSample Output 1\n\n1\n\nFor example, by walking to (2,2) and then using the magic to travel to (4,4), just one use of magic is enough.\n\nNote that he cannot walk diagonally.\n\nSample Input 2\n\n4 4\n1 4\n4 1\n.##.\n####\n####\n.##.\n\nSample Output 2\n\n-1\n\nHe cannot move from there.\n\nSample Input 3\n\n4 4\n2 2\n3 3\n....\n....\n....\n....\n\nSample Output 3\n\n0\n\nNo use of magic is needed.\n\nSample Input 4\n\n4 5\n1 2\n2 5\n#.###\n####.\n#..##\n#..##\n\nSample Output 4\n\n2", "sample_input": "4 4\n1 1\n4 4\n..#.\n..#.\n.#..\n.#..\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02579", "source_text": "Score : 400 points\n\nProblem Statement\n\nA maze is composed of a grid of H \\times W squares - H vertical, W horizontal.\n\nThe square at the i-th row from the top and the j-th column from the left - (i,j) - is a wall if S_{ij} is # and a road if S_{ij} is ..\n\nThere is a magician in (C_h,C_w). He can do the following two kinds of moves:\n\nMove A: Walk to a road square that is vertically or horizontally adjacent to the square he is currently in.\n\nMove B: Use magic to warp himself to a road square in the 5\\times 5 area centered at the square he is currently in.\n\nIn either case, he cannot go out of the maze.\n\nAt least how many times does he need to use the magic to reach (D_h, D_w)?\n\nConstraints\n\n1 \\leq H,W \\leq 10^3\n\n1 \\leq C_h,D_h \\leq H\n\n1 \\leq C_w,D_w \\leq W\n\nS_{ij} is # or ..\n\nS_{C_h C_w} and S_{D_h D_w} are ..\n\n(C_h,C_w) \\neq (D_h,D_w)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nC_h C_w\nD_h D_w\nS_{11}\\ldots S_{1W}\n\\vdots\nS_{H1}\\ldots S_{HW}\n\nOutput\n\nPrint the minimum number of times the magician needs to use the magic. If he cannot reach (D_h,D_w), print -1 instead.\n\nSample Input 1\n\n4 4\n1 1\n4 4\n..#.\n..#.\n.#..\n.#..\n\nSample Output 1\n\n1\n\nFor example, by walking to (2,2) and then using the magic to travel to (4,4), just one use of magic is enough.\n\nNote that he cannot walk diagonally.\n\nSample Input 2\n\n4 4\n1 4\n4 1\n.##.\n####\n####\n.##.\n\nSample Output 2\n\n-1\n\nHe cannot move from there.\n\nSample Input 3\n\n4 4\n2 2\n3 3\n....\n....\n....\n....\n\nSample Output 3\n\n0\n\nNo use of magic is needed.\n\nSample Input 4\n\n4 5\n1 2\n2 5\n#.###\n####.\n#..##\n#..##\n\nSample Output 4\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1214, "cpu_time_ms": 2207, "memory_kb": 58136}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s775652858", "group_id": "codeNet:p02582", "input_text": "# -*- coding: utf-8 -*-\nimport io, sys\n\ndef main():\n S = sys.stdin.readline().rstrip()\n \n prev = \"\"\n cnt = 0\n cnt_max = 0\n\n for char in S:\n if char == \"R\":\n cnt += 1\n elif char == \"S\":\n cnt = 0\n \n cnt_max = max(cnt_max, cnt)\n \n print(cnt_max)\n\n\nif __name__ == \"__main__\":\n main()\n", "language": "Python", "metadata": {"date": 1597518701, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02582.html", "problem_id": "p02582", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02582/input.txt", "sample_output_relpath": "derived/input_output/data/p02582/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02582/Python/s775652858.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s775652858", "user_id": "u530383736"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "# -*- coding: utf-8 -*-\nimport io, sys\n\ndef main():\n S = sys.stdin.readline().rstrip()\n \n prev = \"\"\n cnt = 0\n cnt_max = 0\n\n for char in S:\n if char == \"R\":\n cnt += 1\n elif char == \"S\":\n cnt = 0\n \n cnt_max = max(cnt_max, cnt)\n \n print(cnt_max)\n\n\nif __name__ == \"__main__\":\n main()\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it means it was rainy on that day.\n\nFind the maximum number of consecutive rainy days in this period.\n\nConstraints\n\n|S| = 3\n\nEach character of S is S or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of consecutive rainy days in the period.\n\nSample Input 1\n\nRRS\n\nSample Output 1\n\n2\n\nWe had rain on the 1-st and 2-nd days in the period. Here, the maximum number of consecutive rainy days is 2, so we should print 2.\n\nSample Input 2\n\nSSS\n\nSample Output 2\n\n0\n\nIt was sunny throughout the period. We had no rainy days, so we should print 0.\n\nSample Input 3\n\nRSR\n\nSample Output 3\n\n1\n\nWe had rain on the 1-st and 3-rd days - two \"streaks\" of one rainy day, so we should print 1.", "sample_input": "RRS\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02582", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it means it was rainy on that day.\n\nFind the maximum number of consecutive rainy days in this period.\n\nConstraints\n\n|S| = 3\n\nEach character of S is S or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of consecutive rainy days in the period.\n\nSample Input 1\n\nRRS\n\nSample Output 1\n\n2\n\nWe had rain on the 1-st and 2-nd days in the period. Here, the maximum number of consecutive rainy days is 2, so we should print 2.\n\nSample Input 2\n\nSSS\n\nSample Output 2\n\n0\n\nIt was sunny throughout the period. We had no rainy days, so we should print 0.\n\nSample Input 3\n\nRSR\n\nSample Output 3\n\n1\n\nWe had rain on the 1-st and 3-rd days - two \"streaks\" of one rainy day, so we should print 1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 357, "cpu_time_ms": 31, "memory_kb": 9036}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s500926593", "group_id": "codeNet:p02582", "input_text": "s=input()\n\n\ncon=False\n\nans=0\nfor i in range(3):\n if(s[i]==\"R\" and con):\n ans+=1\n elif(s[i]==\"R\" and not(con)):\n ans=1\n con=True\n else:\n con=False\n \nprint(ans)", "language": "Python", "metadata": {"date": 1597518503, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02582.html", "problem_id": "p02582", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02582/input.txt", "sample_output_relpath": "derived/input_output/data/p02582/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02582/Python/s500926593.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s500926593", "user_id": "u625920333"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "s=input()\n\n\ncon=False\n\nans=0\nfor i in range(3):\n if(s[i]==\"R\" and con):\n ans+=1\n elif(s[i]==\"R\" and not(con)):\n ans=1\n con=True\n else:\n con=False\n \nprint(ans)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it means it was rainy on that day.\n\nFind the maximum number of consecutive rainy days in this period.\n\nConstraints\n\n|S| = 3\n\nEach character of S is S or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of consecutive rainy days in the period.\n\nSample Input 1\n\nRRS\n\nSample Output 1\n\n2\n\nWe had rain on the 1-st and 2-nd days in the period. Here, the maximum number of consecutive rainy days is 2, so we should print 2.\n\nSample Input 2\n\nSSS\n\nSample Output 2\n\n0\n\nIt was sunny throughout the period. We had no rainy days, so we should print 0.\n\nSample Input 3\n\nRSR\n\nSample Output 3\n\n1\n\nWe had rain on the 1-st and 3-rd days - two \"streaks\" of one rainy day, so we should print 1.", "sample_input": "RRS\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02582", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it means it was rainy on that day.\n\nFind the maximum number of consecutive rainy days in this period.\n\nConstraints\n\n|S| = 3\n\nEach character of S is S or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of consecutive rainy days in the period.\n\nSample Input 1\n\nRRS\n\nSample Output 1\n\n2\n\nWe had rain on the 1-st and 2-nd days in the period. Here, the maximum number of consecutive rainy days is 2, so we should print 2.\n\nSample Input 2\n\nSSS\n\nSample Output 2\n\n0\n\nIt was sunny throughout the period. We had no rainy days, so we should print 0.\n\nSample Input 3\n\nRSR\n\nSample Output 3\n\n1\n\nWe had rain on the 1-st and 3-rd days - two \"streaks\" of one rainy day, so we should print 1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 178, "cpu_time_ms": 31, "memory_kb": 8968}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s916655791", "group_id": "codeNet:p02582", "input_text": "S=input().strip(\"¥n\")\n\nif S==\"RRR\":\n\tprint(3)\nelif \"RR\" in S:\n\tprint(2)\nelif \"R\" in S:\n\tprint(1)\nelse:\n\tprint(0)\n\t", "language": "Python", "metadata": {"date": 1597518478, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02582.html", "problem_id": "p02582", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02582/input.txt", "sample_output_relpath": "derived/input_output/data/p02582/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02582/Python/s916655791.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s916655791", "user_id": "u847923740"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "S=input().strip(\"¥n\")\n\nif S==\"RRR\":\n\tprint(3)\nelif \"RR\" in S:\n\tprint(2)\nelif \"R\" in S:\n\tprint(1)\nelse:\n\tprint(0)\n\t", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it means it was rainy on that day.\n\nFind the maximum number of consecutive rainy days in this period.\n\nConstraints\n\n|S| = 3\n\nEach character of S is S or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of consecutive rainy days in the period.\n\nSample Input 1\n\nRRS\n\nSample Output 1\n\n2\n\nWe had rain on the 1-st and 2-nd days in the period. Here, the maximum number of consecutive rainy days is 2, so we should print 2.\n\nSample Input 2\n\nSSS\n\nSample Output 2\n\n0\n\nIt was sunny throughout the period. We had no rainy days, so we should print 0.\n\nSample Input 3\n\nRSR\n\nSample Output 3\n\n1\n\nWe had rain on the 1-st and 3-rd days - two \"streaks\" of one rainy day, so we should print 1.", "sample_input": "RRS\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02582", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it means it was rainy on that day.\n\nFind the maximum number of consecutive rainy days in this period.\n\nConstraints\n\n|S| = 3\n\nEach character of S is S or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of consecutive rainy days in the period.\n\nSample Input 1\n\nRRS\n\nSample Output 1\n\n2\n\nWe had rain on the 1-st and 2-nd days in the period. Here, the maximum number of consecutive rainy days is 2, so we should print 2.\n\nSample Input 2\n\nSSS\n\nSample Output 2\n\n0\n\nIt was sunny throughout the period. We had no rainy days, so we should print 0.\n\nSample Input 3\n\nRSR\n\nSample Output 3\n\n1\n\nWe had rain on the 1-st and 3-rd days - two \"streaks\" of one rainy day, so we should print 1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 115, "cpu_time_ms": 88, "memory_kb": 61556}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s482257172", "group_id": "codeNet:p02582", "input_text": "def resolve():\n S = input()\n if \"RRR\" in S:\n print(3)\n elif \"RR\" in S:\n print(2)\n elif \"R\" in S:\n print(1)\n else:\n print(0) \nresolve()", "language": "Python", "metadata": {"date": 1597518211, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02582.html", "problem_id": "p02582", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02582/input.txt", "sample_output_relpath": "derived/input_output/data/p02582/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02582/Python/s482257172.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s482257172", "user_id": "u307592354"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "def resolve():\n S = input()\n if \"RRR\" in S:\n print(3)\n elif \"RR\" in S:\n print(2)\n elif \"R\" in S:\n print(1)\n else:\n print(0) \nresolve()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it means it was rainy on that day.\n\nFind the maximum number of consecutive rainy days in this period.\n\nConstraints\n\n|S| = 3\n\nEach character of S is S or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of consecutive rainy days in the period.\n\nSample Input 1\n\nRRS\n\nSample Output 1\n\n2\n\nWe had rain on the 1-st and 2-nd days in the period. Here, the maximum number of consecutive rainy days is 2, so we should print 2.\n\nSample Input 2\n\nSSS\n\nSample Output 2\n\n0\n\nIt was sunny throughout the period. We had no rainy days, so we should print 0.\n\nSample Input 3\n\nRSR\n\nSample Output 3\n\n1\n\nWe had rain on the 1-st and 3-rd days - two \"streaks\" of one rainy day, so we should print 1.", "sample_input": "RRS\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02582", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it means it was rainy on that day.\n\nFind the maximum number of consecutive rainy days in this period.\n\nConstraints\n\n|S| = 3\n\nEach character of S is S or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of consecutive rainy days in the period.\n\nSample Input 1\n\nRRS\n\nSample Output 1\n\n2\n\nWe had rain on the 1-st and 2-nd days in the period. Here, the maximum number of consecutive rainy days is 2, so we should print 2.\n\nSample Input 2\n\nSSS\n\nSample Output 2\n\n0\n\nIt was sunny throughout the period. We had no rainy days, so we should print 0.\n\nSample Input 3\n\nRSR\n\nSample Output 3\n\n1\n\nWe had rain on the 1-st and 3-rd days - two \"streaks\" of one rainy day, so we should print 1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 180, "cpu_time_ms": 66, "memory_kb": 61656}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s782603683", "group_id": "codeNet:p02584", "input_text": "x,k,d=map(int, input().split())\n\nif k <= x//d:\n ans = abs(x-k*d)\nelse:\n if (k-x//d)%2!=0:\n ans = abs(x-(x//d+1)*d)\n else:\n ans = abs(x-(x//d)*d)\n\nprint(ans)", "language": "Python", "metadata": {"date": 1597681499, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02584.html", "problem_id": "p02584", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02584/input.txt", "sample_output_relpath": "derived/input_output/data/p02584/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02584/Python/s782603683.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s782603683", "user_id": "u078276601"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "x,k,d=map(int, input().split())\n\nif k <= x//d:\n ans = abs(x-k*d)\nelse:\n if (k-x//d)%2!=0:\n ans = abs(x-(x//d+1)*d)\n else:\n ans = abs(x-(x//d)*d)\n\nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction.\n\nMore specifically, in one move, he can go from coordinate x to x + D or x - D.\n\nHe wants to make K moves so that the absolute value of the coordinate of the destination will be the smallest possible.\n\nFind the minimum possible absolute value of the coordinate of the destination.\n\nConstraints\n\n-10^{15} \\leq X \\leq 10^{15}\n\n1 \\leq K \\leq 10^{15}\n\n1 \\leq D \\leq 10^{15}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX K D\n\nOutput\n\nPrint the minimum possible absolute value of the coordinate of the destination.\n\nSample Input 1\n\n6 2 4\n\nSample Output 1\n\n2\n\nTakahashi is now at coordinate 6. It is optimal to make the following moves:\n\nMove from coordinate 6 to (6 - 4 =) 2.\n\nMove from coordinate 2 to (2 - 4 =) -2.\n\nHere, the absolute value of the coordinate of the destination is 2, and we cannot make it smaller.\n\nSample Input 2\n\n7 4 3\n\nSample Output 2\n\n1\n\nTakahashi is now at coordinate 7. It is optimal to make, for example, the following moves:\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 7.\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 1.\n\nHere, the absolute value of the coordinate of the destination is 1, and we cannot make it smaller.\n\nSample Input 3\n\n10 1 2\n\nSample Output 3\n\n8\n\nSample Input 4\n\n1000000000000000 1000000000000000 1000000000000000\n\nSample Output 4\n\n1000000000000000\n\nThe answer can be enormous.", "sample_input": "6 2 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02584", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction.\n\nMore specifically, in one move, he can go from coordinate x to x + D or x - D.\n\nHe wants to make K moves so that the absolute value of the coordinate of the destination will be the smallest possible.\n\nFind the minimum possible absolute value of the coordinate of the destination.\n\nConstraints\n\n-10^{15} \\leq X \\leq 10^{15}\n\n1 \\leq K \\leq 10^{15}\n\n1 \\leq D \\leq 10^{15}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX K D\n\nOutput\n\nPrint the minimum possible absolute value of the coordinate of the destination.\n\nSample Input 1\n\n6 2 4\n\nSample Output 1\n\n2\n\nTakahashi is now at coordinate 6. It is optimal to make the following moves:\n\nMove from coordinate 6 to (6 - 4 =) 2.\n\nMove from coordinate 2 to (2 - 4 =) -2.\n\nHere, the absolute value of the coordinate of the destination is 2, and we cannot make it smaller.\n\nSample Input 2\n\n7 4 3\n\nSample Output 2\n\n1\n\nTakahashi is now at coordinate 7. It is optimal to make, for example, the following moves:\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 7.\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 1.\n\nHere, the absolute value of the coordinate of the destination is 1, and we cannot make it smaller.\n\nSample Input 3\n\n10 1 2\n\nSample Output 3\n\n8\n\nSample Input 4\n\n1000000000000000 1000000000000000 1000000000000000\n\nSample Output 4\n\n1000000000000000\n\nThe answer can be enormous.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 179, "cpu_time_ms": 30, "memory_kb": 9172}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s840260139", "group_id": "codeNet:p02584", "input_text": "x, k, d = map(int, input().split()) # x現在地,k 移動回数,D移動できる距離\na = x // d # 移動できる回数\nb = x % d # 移動した特のあまり\nif k <= a: # 移動する回数がkより大きいとき\n x = x - (k*d)\nelse:\n k = k - a # ここで最短\n if k % 2 == 0:\n if x >= 0:\n x = x - (a * d)\n else:\n x = x + (a * d)\n else:\n x = x - (a * d)\n if x >= 0:\n x = x - abs(d)\n else:\n x = x + abs(d)\n\nprint(abs(x))\n", "language": "Python", "metadata": {"date": 1597521345, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02584.html", "problem_id": "p02584", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02584/input.txt", "sample_output_relpath": "derived/input_output/data/p02584/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02584/Python/s840260139.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s840260139", "user_id": "u643679148"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "x, k, d = map(int, input().split()) # x現在地,k 移動回数,D移動できる距離\na = x // d # 移動できる回数\nb = x % d # 移動した特のあまり\nif k <= a: # 移動する回数がkより大きいとき\n x = x - (k*d)\nelse:\n k = k - a # ここで最短\n if k % 2 == 0:\n if x >= 0:\n x = x - (a * d)\n else:\n x = x + (a * d)\n else:\n x = x - (a * d)\n if x >= 0:\n x = x - abs(d)\n else:\n x = x + abs(d)\n\nprint(abs(x))\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction.\n\nMore specifically, in one move, he can go from coordinate x to x + D or x - D.\n\nHe wants to make K moves so that the absolute value of the coordinate of the destination will be the smallest possible.\n\nFind the minimum possible absolute value of the coordinate of the destination.\n\nConstraints\n\n-10^{15} \\leq X \\leq 10^{15}\n\n1 \\leq K \\leq 10^{15}\n\n1 \\leq D \\leq 10^{15}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX K D\n\nOutput\n\nPrint the minimum possible absolute value of the coordinate of the destination.\n\nSample Input 1\n\n6 2 4\n\nSample Output 1\n\n2\n\nTakahashi is now at coordinate 6. It is optimal to make the following moves:\n\nMove from coordinate 6 to (6 - 4 =) 2.\n\nMove from coordinate 2 to (2 - 4 =) -2.\n\nHere, the absolute value of the coordinate of the destination is 2, and we cannot make it smaller.\n\nSample Input 2\n\n7 4 3\n\nSample Output 2\n\n1\n\nTakahashi is now at coordinate 7. It is optimal to make, for example, the following moves:\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 7.\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 1.\n\nHere, the absolute value of the coordinate of the destination is 1, and we cannot make it smaller.\n\nSample Input 3\n\n10 1 2\n\nSample Output 3\n\n8\n\nSample Input 4\n\n1000000000000000 1000000000000000 1000000000000000\n\nSample Output 4\n\n1000000000000000\n\nThe answer can be enormous.", "sample_input": "6 2 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02584", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction.\n\nMore specifically, in one move, he can go from coordinate x to x + D or x - D.\n\nHe wants to make K moves so that the absolute value of the coordinate of the destination will be the smallest possible.\n\nFind the minimum possible absolute value of the coordinate of the destination.\n\nConstraints\n\n-10^{15} \\leq X \\leq 10^{15}\n\n1 \\leq K \\leq 10^{15}\n\n1 \\leq D \\leq 10^{15}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX K D\n\nOutput\n\nPrint the minimum possible absolute value of the coordinate of the destination.\n\nSample Input 1\n\n6 2 4\n\nSample Output 1\n\n2\n\nTakahashi is now at coordinate 6. It is optimal to make the following moves:\n\nMove from coordinate 6 to (6 - 4 =) 2.\n\nMove from coordinate 2 to (2 - 4 =) -2.\n\nHere, the absolute value of the coordinate of the destination is 2, and we cannot make it smaller.\n\nSample Input 2\n\n7 4 3\n\nSample Output 2\n\n1\n\nTakahashi is now at coordinate 7. It is optimal to make, for example, the following moves:\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 7.\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 1.\n\nHere, the absolute value of the coordinate of the destination is 1, and we cannot make it smaller.\n\nSample Input 3\n\n10 1 2\n\nSample Output 3\n\n8\n\nSample Input 4\n\n1000000000000000 1000000000000000 1000000000000000\n\nSample Output 4\n\n1000000000000000\n\nThe answer can be enormous.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 524, "cpu_time_ms": 29, "memory_kb": 9192}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s279776594", "group_id": "codeNet:p02584", "input_text": "x,k,d=map(int,input().split())\nx=abs(x)\n\nif x-k*d>=0:\n print(x-k*d)\nelse:\n n=x//d\n k-=n\n a=x-n*d\n if k%2==0:\n print(min(a,2*d-a))\n else:\n print(min(d-a,a+d))", "language": "Python", "metadata": {"date": 1597519763, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02584.html", "problem_id": "p02584", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02584/input.txt", "sample_output_relpath": "derived/input_output/data/p02584/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02584/Python/s279776594.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s279776594", "user_id": "u730107446"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "x,k,d=map(int,input().split())\nx=abs(x)\n\nif x-k*d>=0:\n print(x-k*d)\nelse:\n n=x//d\n k-=n\n a=x-n*d\n if k%2==0:\n print(min(a,2*d-a))\n else:\n print(min(d-a,a+d))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction.\n\nMore specifically, in one move, he can go from coordinate x to x + D or x - D.\n\nHe wants to make K moves so that the absolute value of the coordinate of the destination will be the smallest possible.\n\nFind the minimum possible absolute value of the coordinate of the destination.\n\nConstraints\n\n-10^{15} \\leq X \\leq 10^{15}\n\n1 \\leq K \\leq 10^{15}\n\n1 \\leq D \\leq 10^{15}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX K D\n\nOutput\n\nPrint the minimum possible absolute value of the coordinate of the destination.\n\nSample Input 1\n\n6 2 4\n\nSample Output 1\n\n2\n\nTakahashi is now at coordinate 6. It is optimal to make the following moves:\n\nMove from coordinate 6 to (6 - 4 =) 2.\n\nMove from coordinate 2 to (2 - 4 =) -2.\n\nHere, the absolute value of the coordinate of the destination is 2, and we cannot make it smaller.\n\nSample Input 2\n\n7 4 3\n\nSample Output 2\n\n1\n\nTakahashi is now at coordinate 7. It is optimal to make, for example, the following moves:\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 7.\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 1.\n\nHere, the absolute value of the coordinate of the destination is 1, and we cannot make it smaller.\n\nSample Input 3\n\n10 1 2\n\nSample Output 3\n\n8\n\nSample Input 4\n\n1000000000000000 1000000000000000 1000000000000000\n\nSample Output 4\n\n1000000000000000\n\nThe answer can be enormous.", "sample_input": "6 2 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02584", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction.\n\nMore specifically, in one move, he can go from coordinate x to x + D or x - D.\n\nHe wants to make K moves so that the absolute value of the coordinate of the destination will be the smallest possible.\n\nFind the minimum possible absolute value of the coordinate of the destination.\n\nConstraints\n\n-10^{15} \\leq X \\leq 10^{15}\n\n1 \\leq K \\leq 10^{15}\n\n1 \\leq D \\leq 10^{15}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX K D\n\nOutput\n\nPrint the minimum possible absolute value of the coordinate of the destination.\n\nSample Input 1\n\n6 2 4\n\nSample Output 1\n\n2\n\nTakahashi is now at coordinate 6. It is optimal to make the following moves:\n\nMove from coordinate 6 to (6 - 4 =) 2.\n\nMove from coordinate 2 to (2 - 4 =) -2.\n\nHere, the absolute value of the coordinate of the destination is 2, and we cannot make it smaller.\n\nSample Input 2\n\n7 4 3\n\nSample Output 2\n\n1\n\nTakahashi is now at coordinate 7. It is optimal to make, for example, the following moves:\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 7.\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 1.\n\nHere, the absolute value of the coordinate of the destination is 1, and we cannot make it smaller.\n\nSample Input 3\n\n10 1 2\n\nSample Output 3\n\n8\n\nSample Input 4\n\n1000000000000000 1000000000000000 1000000000000000\n\nSample Output 4\n\n1000000000000000\n\nThe answer can be enormous.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 189, "cpu_time_ms": 31, "memory_kb": 9176}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s813140564", "group_id": "codeNet:p02585", "input_text": "n, k = map(int, input().split())\nP = [*map(lambda x: int(x)-1, input().split())]\nC = [*map(int, input().split())]\n\nINF = 10**18\nmax_score = -INF\nfor st in range(n):\n lc = 0 # lap count\n lap_sc = 0 # lap score\n nx = st\n while True:\n lc += 1\n lap_sc += C[nx]\n nx = P[nx]\n if nx == st: break\n\n sum_sc = 0\n kc = 0\n while True:\n kc += 1\n if k < kc: break\n\n sum_sc += C[nx]\n score = sum_sc + max(0, lap_sc) * ((k - kc) // lc)\n max_score = max(max_score, score)\n\n nx = P[nx]\n if nx == st: break\n\nprint(max_score)\n\n# print('===')\n# print(n,k)\n# print(P)\n# print(C,end='\\n\\n')\n", "language": "Python", "metadata": {"date": 1597710668, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02585.html", "problem_id": "p02585", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02585/input.txt", "sample_output_relpath": "derived/input_output/data/p02585/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02585/Python/s813140564.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s813140564", "user_id": "u525065967"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "n, k = map(int, input().split())\nP = [*map(lambda x: int(x)-1, input().split())]\nC = [*map(int, input().split())]\n\nINF = 10**18\nmax_score = -INF\nfor st in range(n):\n lc = 0 # lap count\n lap_sc = 0 # lap score\n nx = st\n while True:\n lc += 1\n lap_sc += C[nx]\n nx = P[nx]\n if nx == st: break\n\n sum_sc = 0\n kc = 0\n while True:\n kc += 1\n if k < kc: break\n\n sum_sc += C[nx]\n score = sum_sc + max(0, lap_sc) * ((k - kc) // lc)\n max_score = max(max_score, score)\n\n nx = P[nx]\n if nx == st: break\n\nprint(max_score)\n\n# print('===')\n# print(n,k)\n# print(P)\n# print(C,end='\\n\\n')\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi will play a game using a piece on an array of squares numbered 1, 2, \\cdots, N. Square i has an integer C_i written on it. Also, he is given a permutation of 1, 2, \\cdots, N: P_1, P_2, \\cdots, P_N.\n\nNow, he will choose one square and place the piece on that square. Then, he will make the following move some number of times between 1 and K (inclusive):\n\nIn one move, if the piece is now on Square i (1 \\leq i \\leq N), move it to Square P_i. Here, his score increases by C_{P_i}.\n\nHelp him by finding the maximum possible score at the end of the game. (The score is 0 at the beginning of the game.)\n\nConstraints\n\n2 \\leq N \\leq 5000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq P_i \\leq N\n\nP_i \\neq i\n\nP_1, P_2, \\cdots, P_N are all different.\n\n-10^9 \\leq C_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nP_1 P_2 \\cdots P_N\nC_1 C_2 \\cdots C_N\n\nOutput\n\nPrint the maximum possible score at the end of the game.\n\nSample Input 1\n\n5 2\n2 4 5 1 3\n3 4 -10 -8 8\n\nSample Output 1\n\n8\n\nWhen we start at some square of our choice and make at most two moves, we have the following options:\n\nIf we start at Square 1, making one move sends the piece to Square 2, after which the score is 4. Making another move sends the piece to Square 4, after which the score is 4 + (-8) = -4.\n\nIf we start at Square 2, making one move sends the piece to Square 4, after which the score is -8. Making another move sends the piece to Square 1, after which the score is -8 + 3 = -5.\n\nIf we start at Square 3, making one move sends the piece to Square 5, after which the score is 8. Making another move sends the piece to Square 3, after which the score is 8 + (-10) = -2.\n\nIf we start at Square 4, making one move sends the piece to Square 1, after which the score is 3. Making another move sends the piece to Square 2, after which the score is 3 + 4 = 7.\n\nIf we start at Square 5, making one move sends the piece to Square 3, after which the score is -10. Making another move sends the piece to Square 5, after which the score is -10 + 8 = -2.\n\nThe maximum score achieved is 8.\n\nSample Input 2\n\n2 3\n2 1\n10 -7\n\nSample Output 2\n\n13\n\nSample Input 3\n\n3 3\n3 1 2\n-1000 -2000 -3000\n\nSample Output 3\n\n-1000\n\nWe have to make at least one move.\n\nSample Input 4\n\n10 58\n9 1 6 7 8 4 3 2 10 5\n695279662 988782657 -119067776 382975538 -151885171 -177220596 -169777795 37619092 389386780 980092719\n\nSample Output 4\n\n29507023469\n\nThe absolute value of the answer may be enormous.", "sample_input": "5 2\n2 4 5 1 3\n3 4 -10 -8 8\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02585", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi will play a game using a piece on an array of squares numbered 1, 2, \\cdots, N. Square i has an integer C_i written on it. Also, he is given a permutation of 1, 2, \\cdots, N: P_1, P_2, \\cdots, P_N.\n\nNow, he will choose one square and place the piece on that square. Then, he will make the following move some number of times between 1 and K (inclusive):\n\nIn one move, if the piece is now on Square i (1 \\leq i \\leq N), move it to Square P_i. Here, his score increases by C_{P_i}.\n\nHelp him by finding the maximum possible score at the end of the game. (The score is 0 at the beginning of the game.)\n\nConstraints\n\n2 \\leq N \\leq 5000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq P_i \\leq N\n\nP_i \\neq i\n\nP_1, P_2, \\cdots, P_N are all different.\n\n-10^9 \\leq C_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nP_1 P_2 \\cdots P_N\nC_1 C_2 \\cdots C_N\n\nOutput\n\nPrint the maximum possible score at the end of the game.\n\nSample Input 1\n\n5 2\n2 4 5 1 3\n3 4 -10 -8 8\n\nSample Output 1\n\n8\n\nWhen we start at some square of our choice and make at most two moves, we have the following options:\n\nIf we start at Square 1, making one move sends the piece to Square 2, after which the score is 4. Making another move sends the piece to Square 4, after which the score is 4 + (-8) = -4.\n\nIf we start at Square 2, making one move sends the piece to Square 4, after which the score is -8. Making another move sends the piece to Square 1, after which the score is -8 + 3 = -5.\n\nIf we start at Square 3, making one move sends the piece to Square 5, after which the score is 8. Making another move sends the piece to Square 3, after which the score is 8 + (-10) = -2.\n\nIf we start at Square 4, making one move sends the piece to Square 1, after which the score is 3. Making another move sends the piece to Square 2, after which the score is 3 + 4 = 7.\n\nIf we start at Square 5, making one move sends the piece to Square 3, after which the score is -10. Making another move sends the piece to Square 5, after which the score is -10 + 8 = -2.\n\nThe maximum score achieved is 8.\n\nSample Input 2\n\n2 3\n2 1\n10 -7\n\nSample Output 2\n\n13\n\nSample Input 3\n\n3 3\n3 1 2\n-1000 -2000 -3000\n\nSample Output 3\n\n-1000\n\nWe have to make at least one move.\n\nSample Input 4\n\n10 58\n9 1 6 7 8 4 3 2 10 5\n695279662 988782657 -119067776 382975538 -151885171 -177220596 -169777795 37619092 389386780 980092719\n\nSample Output 4\n\n29507023469\n\nThe absolute value of the answer may be enormous.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 666, "cpu_time_ms": 605, "memory_kb": 73600}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s120625580", "group_id": "codeNet:p02590", "input_text": "import numpy as np\nfrom numpy.fft import rfft,irfft\n\np = 200003\nN = int(input())\nA = list(map(int,input().split()))\na = np.zeros(2*p)\n\ng = 1\nd = {}\np2 = [1]*p\nfor i in range(p):\n d[g] = i\n p2[i] = g\n g *= 2\n g %= p\n\nfor i in range(N):\n if A[i]==0:\n continue\n a[d[A[i]]] += 1\n\nb = rfft(a)\nb = irfft(b*b)\nb = [int(x+0.5) for x in b]\n\nans = 0\nfor i in range(p):\n ans += (b[i]+b[i+p-1])*p2[i]\n\nfor i in range(N):\n ans -= A[i]**2%p\nans //= 2\nprint(ans)", "language": "Python", "metadata": {"date": 1597469792, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02590.html", "problem_id": "p02590", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02590/input.txt", "sample_output_relpath": "derived/input_output/data/p02590/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02590/Python/s120625580.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s120625580", "user_id": "u170201762"}, "prompt_components": {"gold_output": "474287\n", "input_to_evaluate": "import numpy as np\nfrom numpy.fft import rfft,irfft\n\np = 200003\nN = int(input())\nA = list(map(int,input().split()))\na = np.zeros(2*p)\n\ng = 1\nd = {}\np2 = [1]*p\nfor i in range(p):\n d[g] = i\n p2[i] = g\n g *= 2\n g %= p\n\nfor i in range(N):\n if A[i]==0:\n continue\n a[d[A[i]]] += 1\n\nb = rfft(a)\nb = irfft(b*b)\nb = [int(x+0.5) for x in b]\n\nans = 0\nfor i in range(p):\n ans += (b[i]+b[i+p-1])*p2[i]\n\nfor i in range(N):\n ans -= A[i]**2%p\nans //= 2\nprint(ans)", "problem_context": "Score : 800 points\n\nProblem Statement\n\nLet’s take a prime P = 200\\,003.\nYou are given N integers A_1, A_2, \\ldots, A_N.\nFind the sum of ((A_i \\cdot A_j) \\bmod P) over all N \\cdot (N-1) / 2 unordered pairs of elements (i < j).\n\nPlease note that the sum isn't computed modulo P.\n\nConstraints\n\n2 \\leq N \\leq 200\\,000\n\n0 \\leq A_i < P = 200\\,003\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format.\n\nN\nA_1 A_2 \\cdots A_N\n\nOutput\n\nPrint one integer — the sum over ((A_i \\cdot A_j) \\bmod P).\n\nSample Input 1\n\n4\n2019 0 2020 200002\n\nSample Output 1\n\n474287\n\nThe non-zero products are:\n\n2019 \\cdot 2020 \\bmod P = 78320\n\n2019 \\cdot 200002 \\bmod P = 197984\n\n2020 \\cdot 200002 \\bmod P = 197983\n\nSo the answer is 0 + 78320 + 197984 + 0 + 0 + 197983 = 474287.\n\nSample Input 2\n\n5\n1 1 2 2 100000\n\nSample Output 2\n\n600013", "sample_input": "4\n2019 0 2020 200002\n"}, "reference_outputs": ["474287\n"], "source_document_id": "p02590", "source_text": "Score : 800 points\n\nProblem Statement\n\nLet’s take a prime P = 200\\,003.\nYou are given N integers A_1, A_2, \\ldots, A_N.\nFind the sum of ((A_i \\cdot A_j) \\bmod P) over all N \\cdot (N-1) / 2 unordered pairs of elements (i < j).\n\nPlease note that the sum isn't computed modulo P.\n\nConstraints\n\n2 \\leq N \\leq 200\\,000\n\n0 \\leq A_i < P = 200\\,003\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format.\n\nN\nA_1 A_2 \\cdots A_N\n\nOutput\n\nPrint one integer — the sum over ((A_i \\cdot A_j) \\bmod P).\n\nSample Input 1\n\n4\n2019 0 2020 200002\n\nSample Output 1\n\n474287\n\nThe non-zero products are:\n\n2019 \\cdot 2020 \\bmod P = 78320\n\n2019 \\cdot 200002 \\bmod P = 197984\n\n2020 \\cdot 200002 \\bmod P = 197983\n\nSo the answer is 0 + 78320 + 197984 + 0 + 0 + 197983 = 474287.\n\nSample Input 2\n\n5\n1 1 2 2 100000\n\nSample Output 2\n\n600013", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 478, "cpu_time_ms": 905, "memory_kb": 143236}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s601637653", "group_id": "codeNet:p02594", "input_text": "val = int(input())\nif val>=30:\n print('Yes')\nelse:\n print('No')", "language": "Python", "metadata": {"date": 1596418795, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Python/s601637653.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s601637653", "user_id": "u595898714"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "val = int(input())\nif val>=30:\n print('Yes')\nelse:\n print('No')", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 69, "cpu_time_ms": 28, "memory_kb": 9028}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s930996696", "group_id": "codeNet:p02594", "input_text": "X=int(input())\nif X>=30:\n\tprint(\"Yes\")\nelse:\n\tprint(\"No\")", "language": "Python", "metadata": {"date": 1596416760, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Python/s930996696.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s930996696", "user_id": "u367575195"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "X=int(input())\nif X>=30:\n\tprint(\"Yes\")\nelse:\n\tprint(\"No\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 57, "cpu_time_ms": 34, "memory_kb": 9148}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s168834487", "group_id": "codeNet:p02595", "input_text": "# input here\n_INPUT = \"\"\"\\\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\"\"\"\n\ndef main():\n # -*- coding: utf-8 -*-\n # スペース区切りの整数の入力\n N, D = map(int, input().split())\n xy = [list(map(int, input().split())) for i in range(N)]\n \n answer = []\n\n for j in range(len(xy)):\n # 距離求める\n distance = math.sqrt((xy[j][0]**2 + xy[j][1]**2))\n\n # Dとdistance比較する\n if D >= distance:\n answer.append(distance)\n\n print(len(answer))\n\nif __name__ == '__main__':\n import io\n import sys\n import math\n\n # sys.stdin = io.StringIO(_INPUT)\n main()", "language": "Python", "metadata": {"date": 1596985472, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02595.html", "problem_id": "p02595", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02595/input.txt", "sample_output_relpath": "derived/input_output/data/p02595/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02595/Python/s168834487.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s168834487", "user_id": "u934066963"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "# input here\n_INPUT = \"\"\"\\\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\"\"\"\n\ndef main():\n # -*- coding: utf-8 -*-\n # スペース区切りの整数の入力\n N, D = map(int, input().split())\n xy = [list(map(int, input().split())) for i in range(N)]\n \n answer = []\n\n for j in range(len(xy)):\n # 距離求める\n distance = math.sqrt((xy[j][0]**2 + xy[j][1]**2))\n\n # Dとdistance比較する\n if D >= distance:\n answer.append(distance)\n\n print(len(answer))\n\nif __name__ == '__main__':\n import io\n import sys\n import math\n\n # sys.stdin = io.StringIO(_INPUT)\n main()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).\n\nAmong them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?\n\nWe remind you that the distance between the origin and the point (p, q) can be represented as \\sqrt{p^2+q^2}.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n0 \\leq D \\leq 2\\times 10^5\n\n|X_i|,|Y_i| \\leq 2\\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_1 Y_1\n\\vdots\nX_N Y_N\n\nOutput\n\nPrint an integer representing the number of points such that the distance from the origin is at most D.\n\nSample Input 1\n\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\nSample Output 1\n\n3\n\nThe distance between the origin and each of the given points is as follows:\n\n\\sqrt{0^2+5^2}=5\n\n\\sqrt{(-2)^2+4^2}=4.472\\ldots\n\n\\sqrt{3^2+4^2}=5\n\n\\sqrt{4^2+(-4)^2}=5.656\\ldots\n\nThus, we have three points such that the distance from the origin is at most 5.\n\nSample Input 2\n\n12 3\n1 1\n1 1\n1 1\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n\nSample Output 2\n\n7\n\nMultiple points may exist at the same coordinates.\n\nSample Input 3\n\n20 100000\n14309 -32939\n-56855 100340\n151364 25430\n103789 -113141\n147404 -136977\n-37006 -30929\n188810 -49557\n13419 70401\n-88280 165170\n-196399 137941\n-176527 -61904\n46659 115261\n-153551 114185\n98784 -6820\n94111 -86268\n-30401 61477\n-55056 7872\n5901 -163796\n138819 -185986\n-69848 -96669\n\nSample Output 3\n\n6", "sample_input": "4 5\n0 5\n-2 4\n3 4\n4 -4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02595", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).\n\nAmong them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?\n\nWe remind you that the distance between the origin and the point (p, q) can be represented as \\sqrt{p^2+q^2}.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n0 \\leq D \\leq 2\\times 10^5\n\n|X_i|,|Y_i| \\leq 2\\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_1 Y_1\n\\vdots\nX_N Y_N\n\nOutput\n\nPrint an integer representing the number of points such that the distance from the origin is at most D.\n\nSample Input 1\n\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\nSample Output 1\n\n3\n\nThe distance between the origin and each of the given points is as follows:\n\n\\sqrt{0^2+5^2}=5\n\n\\sqrt{(-2)^2+4^2}=4.472\\ldots\n\n\\sqrt{3^2+4^2}=5\n\n\\sqrt{4^2+(-4)^2}=5.656\\ldots\n\nThus, we have three points such that the distance from the origin is at most 5.\n\nSample Input 2\n\n12 3\n1 1\n1 1\n1 1\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n\nSample Output 2\n\n7\n\nMultiple points may exist at the same coordinates.\n\nSample Input 3\n\n20 100000\n14309 -32939\n-56855 100340\n151364 25430\n103789 -113141\n147404 -136977\n-37006 -30929\n188810 -49557\n13419 70401\n-88280 165170\n-196399 137941\n-176527 -61904\n46659 115261\n-153551 114185\n98784 -6820\n94111 -86268\n-30401 61477\n-55056 7872\n5901 -163796\n138819 -185986\n-69848 -96669\n\nSample Output 3\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 617, "cpu_time_ms": 537, "memory_kb": 51696}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s848068832", "group_id": "codeNet:p02596", "input_text": "k = int(input())\nmod = 0\n\nfor i in range(1, k + 1):\n mod = ((mod * 10) % k + 7) % k\n if mod == 0:\n print(i)\n break\nelse:\n print(-1)\n", "language": "Python", "metadata": {"date": 1598226493, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02596.html", "problem_id": "p02596", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02596/input.txt", "sample_output_relpath": "derived/input_output/data/p02596/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02596/Python/s848068832.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s848068832", "user_id": "u699296734"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "k = int(input())\nmod = 0\n\nfor i in range(1, k + 1):\n mod = ((mod * 10) % k + 7) % k\n if mod == 0:\n print(i)\n break\nelse:\n print(-1)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi loves the number 7 and multiples of K.\n\nWhere is the first occurrence of a multiple of K in the sequence 7,77,777,\\ldots? (Also see Output and Sample Input/Output below.)\n\nIf the sequence contains no multiples of K, print -1 instead.\n\nConstraints\n\n1 \\leq K \\leq 10^6\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint an integer representing the position of the first occurrence of a multiple of K. (For example, if the first occurrence is the fourth element of the sequence, print 4.)\n\nSample Input 1\n\n101\n\nSample Output 1\n\n4\n\nNone of 7, 77, and 777 is a multiple of 101, but 7777 is.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n-1\n\nAll elements in the sequence are odd numbers; there are no multiples of 2.\n\nSample Input 3\n\n999983\n\nSample Output 3\n\n999982", "sample_input": "101\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02596", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi loves the number 7 and multiples of K.\n\nWhere is the first occurrence of a multiple of K in the sequence 7,77,777,\\ldots? (Also see Output and Sample Input/Output below.)\n\nIf the sequence contains no multiples of K, print -1 instead.\n\nConstraints\n\n1 \\leq K \\leq 10^6\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint an integer representing the position of the first occurrence of a multiple of K. (For example, if the first occurrence is the fourth element of the sequence, print 4.)\n\nSample Input 1\n\n101\n\nSample Output 1\n\n4\n\nNone of 7, 77, and 777 is a multiple of 101, but 7777 is.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n-1\n\nAll elements in the sequence are odd numbers; there are no multiples of 2.\n\nSample Input 3\n\n999983\n\nSample Output 3\n\n999982", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 155, "cpu_time_ms": 210, "memory_kb": 9112}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s929029032", "group_id": "codeNet:p02596", "input_text": "K = int(input())\n\nN = 0\n\nfor i in range(10001):\n N += 7*(10**i)\n if N%K ==0:\n print(i)\n break\nelse:\n print(-1)\n", "language": "Python", "metadata": {"date": 1596870439, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02596.html", "problem_id": "p02596", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02596/input.txt", "sample_output_relpath": "derived/input_output/data/p02596/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02596/Python/s929029032.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s929029032", "user_id": "u701513230"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "K = int(input())\n\nN = 0\n\nfor i in range(10001):\n N += 7*(10**i)\n if N%K ==0:\n print(i)\n break\nelse:\n print(-1)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi loves the number 7 and multiples of K.\n\nWhere is the first occurrence of a multiple of K in the sequence 7,77,777,\\ldots? (Also see Output and Sample Input/Output below.)\n\nIf the sequence contains no multiples of K, print -1 instead.\n\nConstraints\n\n1 \\leq K \\leq 10^6\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint an integer representing the position of the first occurrence of a multiple of K. (For example, if the first occurrence is the fourth element of the sequence, print 4.)\n\nSample Input 1\n\n101\n\nSample Output 1\n\n4\n\nNone of 7, 77, and 777 is a multiple of 101, but 7777 is.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n-1\n\nAll elements in the sequence are odd numbers; there are no multiples of 2.\n\nSample Input 3\n\n999983\n\nSample Output 3\n\n999982", "sample_input": "101\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02596", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi loves the number 7 and multiples of K.\n\nWhere is the first occurrence of a multiple of K in the sequence 7,77,777,\\ldots? (Also see Output and Sample Input/Output below.)\n\nIf the sequence contains no multiples of K, print -1 instead.\n\nConstraints\n\n1 \\leq K \\leq 10^6\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint an integer representing the position of the first occurrence of a multiple of K. (For example, if the first occurrence is the fourth element of the sequence, print 4.)\n\nSample Input 1\n\n101\n\nSample Output 1\n\n4\n\nNone of 7, 77, and 777 is a multiple of 101, but 7777 is.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n-1\n\nAll elements in the sequence are odd numbers; there are no multiples of 2.\n\nSample Input 3\n\n999983\n\nSample Output 3\n\n999982", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 134, "cpu_time_ms": 547, "memory_kb": 9048}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s095985408", "group_id": "codeNet:p02596", "input_text": "def main(k):\n size, res = 1, 7 % k\n while res and size <= 1_000_000:\n res = (res * 10 + 7) % k\n size += 1\n return -1 if size > 1_000_000 else size\n\n\nif __name__ == '__main__':\n k = int(input())\n print(main(k))\n", "language": "Python", "metadata": {"date": 1596594618, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02596.html", "problem_id": "p02596", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02596/input.txt", "sample_output_relpath": "derived/input_output/data/p02596/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02596/Python/s095985408.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s095985408", "user_id": "u048425194"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "def main(k):\n size, res = 1, 7 % k\n while res and size <= 1_000_000:\n res = (res * 10 + 7) % k\n size += 1\n return -1 if size > 1_000_000 else size\n\n\nif __name__ == '__main__':\n k = int(input())\n print(main(k))\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi loves the number 7 and multiples of K.\n\nWhere is the first occurrence of a multiple of K in the sequence 7,77,777,\\ldots? (Also see Output and Sample Input/Output below.)\n\nIf the sequence contains no multiples of K, print -1 instead.\n\nConstraints\n\n1 \\leq K \\leq 10^6\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint an integer representing the position of the first occurrence of a multiple of K. (For example, if the first occurrence is the fourth element of the sequence, print 4.)\n\nSample Input 1\n\n101\n\nSample Output 1\n\n4\n\nNone of 7, 77, and 777 is a multiple of 101, but 7777 is.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n-1\n\nAll elements in the sequence are odd numbers; there are no multiples of 2.\n\nSample Input 3\n\n999983\n\nSample Output 3\n\n999982", "sample_input": "101\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02596", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi loves the number 7 and multiples of K.\n\nWhere is the first occurrence of a multiple of K in the sequence 7,77,777,\\ldots? (Also see Output and Sample Input/Output below.)\n\nIf the sequence contains no multiples of K, print -1 instead.\n\nConstraints\n\n1 \\leq K \\leq 10^6\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint an integer representing the position of the first occurrence of a multiple of K. (For example, if the first occurrence is the fourth element of the sequence, print 4.)\n\nSample Input 1\n\n101\n\nSample Output 1\n\n4\n\nNone of 7, 77, and 777 is a multiple of 101, but 7777 is.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n-1\n\nAll elements in the sequence are odd numbers; there are no multiples of 2.\n\nSample Input 3\n\n999983\n\nSample Output 3\n\n999982", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 239, "cpu_time_ms": 144, "memory_kb": 9164}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s814288134", "group_id": "codeNet:p02601", "input_text": "A, B, C = input().split()\nA = int(A)\nB = int(B)\nC = int(C)\nK = input()\nK = int(K)\nz = 0\nwhile B > A:\n B = B * 2\n z = z + 1\nwhile C > B:\n C = C * 2\n z = z + 1\nif K < z:\n print('NO')\nelse:\n print('YES')", "language": "Python", "metadata": {"date": 1595725944, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02601.html", "problem_id": "p02601", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02601/input.txt", "sample_output_relpath": "derived/input_output/data/p02601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02601/Python/s814288134.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s814288134", "user_id": "u137346245"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "A, B, C = input().split()\nA = int(A)\nB = int(B)\nC = int(C)\nK = input()\nK = int(K)\nz = 0\nwhile B > A:\n B = B * 2\n z = z + 1\nwhile C > B:\n C = C * 2\n z = z + 1\nif K < z:\n print('NO')\nelse:\n print('YES')", "problem_context": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "sample_input": "7 2 5\n3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02601", "source_text": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 218, "cpu_time_ms": 2206, "memory_kb": 9256}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s434651641", "group_id": "codeNet:p02602", "input_text": "N, K = map(int, input().split())\nA = [int(i) for i in input().split()]\nfor i in range(K,N):\n a = A[i-K]\n b = A[i]\n if an-2*x :\n break\n for y in range(x,101-x):\n ty=tx+y**2+x*y\n if ty>n-x-y :\n break\n ss=(x+y)**2-4*(ty-n)\n if ss<0:\n break\n s=ss**0.5\n if s.is_integer():\n z=int((-1*(x+y)+s)/2)\n if z>=y:\n \n if len(set([x,y,z]))==1:\n ans+=1\n if len(set([x,y,z]))==2:\n ans+=3\n if len(set([x,y,z]))==3:\n ans+=6\n print(ans)", "language": "Python", "metadata": {"date": 1594519351, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02608.html", "problem_id": "p02608", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02608/input.txt", "sample_output_relpath": "derived/input_output/data/p02608/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02608/Python/s195374621.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s195374621", "user_id": "u998262711"}, "prompt_components": {"gold_output": "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n", "input_to_evaluate": "\nN=int(input())\nfor n in range(1,N+1):\n ans=0\n for x in range(1,101):\n tx=x**2\n if tx>n-2*x :\n break\n for y in range(x,101-x):\n ty=tx+y**2+x*y\n if ty>n-x-y :\n break\n ss=(x+y)**2-4*(ty-n)\n if ss<0:\n break\n s=ss**0.5\n if s.is_integer():\n z=int((-1*(x+y)+s)/2)\n if z>=y:\n \n if len(set([x,y,z]))==1:\n ans+=1\n if len(set([x,y,z]))==2:\n ans+=3\n if len(set([x,y,z]))==3:\n ans+=6\n print(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nLet f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:\n\n1 \\leq x,y,z\n\nx^2 + y^2 + z^2 + xy + yz + zx = n\n\nGiven an integer N, find each of f(1),f(2),f(3),\\ldots,f(N).\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint N lines. The i-th line should contain the value f(i).\n\nSample Input 1\n\n20\n\nSample Output 1\n\n0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n\nFor n=6, only (1,1,1) satisfies both of the conditions. Thus, f(6) = 1.\n\nFor n=11, three triples, (1,1,2), (1,2,1), and (2,1,1), satisfy both of the conditions. Thus, f(6) = 3.\n\nFor n=17, three triples, (1,2,2), (2,1,2), and (2,2,1), satisfy both of the conditions. Thus, f(17) = 3.\n\nFor n=18, three triples, (1,1,3), (1,3,1), and (3,1,1), satisfy both of the conditions. Thus, f(18) = 3.", "sample_input": "20\n"}, "reference_outputs": ["0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n"], "source_document_id": "p02608", "source_text": "Score : 300 points\n\nProblem Statement\n\nLet f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:\n\n1 \\leq x,y,z\n\nx^2 + y^2 + z^2 + xy + yz + zx = n\n\nGiven an integer N, find each of f(1),f(2),f(3),\\ldots,f(N).\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint N lines. The i-th line should contain the value f(i).\n\nSample Input 1\n\n20\n\nSample Output 1\n\n0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n\nFor n=6, only (1,1,1) satisfies both of the conditions. Thus, f(6) = 1.\n\nFor n=11, three triples, (1,1,2), (1,2,1), and (2,1,1), satisfy both of the conditions. Thus, f(6) = 3.\n\nFor n=17, three triples, (1,2,2), (2,1,2), and (2,2,1), satisfy both of the conditions. Thus, f(17) = 3.\n\nFor n=18, three triples, (1,1,3), (1,3,1), and (3,1,1), satisfy both of the conditions. Thus, f(18) = 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 695, "cpu_time_ms": 1212, "memory_kb": 70800}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s695227095", "group_id": "codeNet:p02613", "input_text": "import collections\nn = int(input())\ndic = collections.defaultdict(int)\nfor i in range(n):\n dic[input()] += 1\nprint(\"AC x\" + dic[\"AC\"])\nprint(\"WA x\" + dic[\"WA\"])\nprint(\"TLE x\" + dic[\"TLE\"])\nprint(\"RE x\" + dic[\"RE\"])\n", "language": "Python", "metadata": {"date": 1594084736, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02613.html", "problem_id": "p02613", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02613/input.txt", "sample_output_relpath": "derived/input_output/data/p02613/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02613/Python/s695227095.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s695227095", "user_id": "u333139319"}, "prompt_components": {"gold_output": "AC x 3\nWA x 1\nTLE x 2\nRE x 0\n", "input_to_evaluate": "import collections\nn = int(input())\ndic = collections.defaultdict(int)\nfor i in range(n):\n dic[input()] += 1\nprint(\"AC x\" + dic[\"AC\"])\nprint(\"WA x\" + dic[\"WA\"])\nprint(\"TLE x\" + dic[\"TLE\"])\nprint(\"RE x\" + dic[\"RE\"])\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.\n\nThe problem has N test cases.\n\nFor each test case i (1\\leq i \\leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSee the Output section for the output format.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i is AC, WA, TLE, or RE.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n\\vdots\nS_N\n\nOutput\n\nLet C_0, C_1, C_2, and C_3 be the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively. Print the following:\n\nAC x C_0\nWA x C_1\nTLE x C_2\nRE x C_3\n\nSample Input 1\n\n6\nAC\nTLE\nAC\nAC\nWA\nTLE\n\nSample Output 1\n\nAC x 3\nWA x 1\nTLE x 2\nRE x 0\n\nWe have 3, 1, 2, and 0 test case(s) for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSample Input 2\n\n10\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\n\nSample Output 2\n\nAC x 10\nWA x 0\nTLE x 0\nRE x 0", "sample_input": "6\nAC\nTLE\nAC\nAC\nWA\nTLE\n"}, "reference_outputs": ["AC x 3\nWA x 1\nTLE x 2\nRE x 0\n"], "source_document_id": "p02613", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.\n\nThe problem has N test cases.\n\nFor each test case i (1\\leq i \\leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSee the Output section for the output format.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i is AC, WA, TLE, or RE.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n\\vdots\nS_N\n\nOutput\n\nLet C_0, C_1, C_2, and C_3 be the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively. Print the following:\n\nAC x C_0\nWA x C_1\nTLE x C_2\nRE x C_3\n\nSample Input 1\n\n6\nAC\nTLE\nAC\nAC\nWA\nTLE\n\nSample Output 1\n\nAC x 3\nWA x 1\nTLE x 2\nRE x 0\n\nWe have 3, 1, 2, and 0 test case(s) for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSample Input 2\n\n10\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\n\nSample Output 2\n\nAC x 10\nWA x 0\nTLE x 0\nRE x 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 216, "cpu_time_ms": 177, "memory_kb": 76008}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s773073564", "group_id": "codeNet:p02613", "input_text": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10 ** 9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef main():\n N = int(readline())\n S = [readline().strip() for _ in range(N)]\n\n for s in ['AC', 'WA', 'TLE', 'RE']:\n print(f'{s} x {S.count(s)}')\n\n return\n\n\nif __name__ == '__main__':\n main()\n", "language": "Python", "metadata": {"date": 1594006890, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02613.html", "problem_id": "p02613", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02613/input.txt", "sample_output_relpath": "derived/input_output/data/p02613/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02613/Python/s773073564.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s773073564", "user_id": "u968166680"}, "prompt_components": {"gold_output": "AC x 3\nWA x 1\nTLE x 2\nRE x 0\n", "input_to_evaluate": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10 ** 9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef main():\n N = int(readline())\n S = [readline().strip() for _ in range(N)]\n\n for s in ['AC', 'WA', 'TLE', 'RE']:\n print(f'{s} x {S.count(s)}')\n\n return\n\n\nif __name__ == '__main__':\n main()\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.\n\nThe problem has N test cases.\n\nFor each test case i (1\\leq i \\leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSee the Output section for the output format.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i is AC, WA, TLE, or RE.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n\\vdots\nS_N\n\nOutput\n\nLet C_0, C_1, C_2, and C_3 be the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively. Print the following:\n\nAC x C_0\nWA x C_1\nTLE x C_2\nRE x C_3\n\nSample Input 1\n\n6\nAC\nTLE\nAC\nAC\nWA\nTLE\n\nSample Output 1\n\nAC x 3\nWA x 1\nTLE x 2\nRE x 0\n\nWe have 3, 1, 2, and 0 test case(s) for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSample Input 2\n\n10\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\n\nSample Output 2\n\nAC x 10\nWA x 0\nTLE x 0\nRE x 0", "sample_input": "6\nAC\nTLE\nAC\nAC\nWA\nTLE\n"}, "reference_outputs": ["AC x 3\nWA x 1\nTLE x 2\nRE x 0\n"], "source_document_id": "p02613", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.\n\nThe problem has N test cases.\n\nFor each test case i (1\\leq i \\leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSee the Output section for the output format.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i is AC, WA, TLE, or RE.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n\\vdots\nS_N\n\nOutput\n\nLet C_0, C_1, C_2, and C_3 be the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively. Print the following:\n\nAC x C_0\nWA x C_1\nTLE x C_2\nRE x C_3\n\nSample Input 1\n\n6\nAC\nTLE\nAC\nAC\nWA\nTLE\n\nSample Output 1\n\nAC x 3\nWA x 1\nTLE x 2\nRE x 0\n\nWe have 3, 1, 2, and 0 test case(s) for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSample Input 2\n\n10\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\n\nSample Output 2\n\nAC x 10\nWA x 0\nTLE x 0\nRE x 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 373, "cpu_time_ms": 103, "memory_kb": 73972}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s128539932", "group_id": "codeNet:p02614", "input_text": "# C - H and V\nimport sys\n\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n\ndef main():\n H, W, K = map(int, readline().split())\n C = [line.decode() for line in readlines()]\n res = 0\n for bit in range(1 << (H + W)):\n cnt_black = sum(\n C[i][j] == \"#\" and not (bit >> i) & 1 and not (bit >> (j + H)) & 1\n for i in range(H)\n for j in range(W)\n )\n if cnt_black == K:\n res += 1\n print(res)\n\n\nif __name__ == \"__main__\":\n main()\n", "language": "Python", "metadata": {"date": 1594018972, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02614.html", "problem_id": "p02614", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02614/input.txt", "sample_output_relpath": "derived/input_output/data/p02614/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02614/Python/s128539932.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s128539932", "user_id": "u077291787"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "# C - H and V\nimport sys\n\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n\ndef main():\n H, W, K = map(int, readline().split())\n C = [line.decode() for line in readlines()]\n res = 0\n for bit in range(1 << (H + W)):\n cnt_black = sum(\n C[i][j] == \"#\" and not (bit >> i) & 1 and not (bit >> (j + H)) & 1\n for i in range(H)\n for j in range(W)\n )\n if cnt_black == K:\n res += 1\n print(res)\n\n\nif __name__ == \"__main__\":\n main()\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \\leq i \\leq H, 1 \\leq j \\leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is ., and black if c_{i,j} is #.\n\nConsider doing the following operation:\n\nChoose some number of rows (possibly zero), and some number of columns (possibly zero). Then, paint red all squares in the chosen rows and all squares in the chosen columns.\n\nYou are given a positive integer K. How many choices of rows and columns result in exactly K black squares remaining after the operation? Here, we consider two choices different when there is a row or column chosen in only one of those choices.\n\nConstraints\n\n1 \\leq H, W \\leq 6\n\n1 \\leq K \\leq HW\n\nc_{i,j} is . or #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\nc_{1,1}c_{1,2}...c_{1,W}\nc_{2,1}c_{2,2}...c_{2,W}\n:\nc_{H,1}c_{H,2}...c_{H,W}\n\nOutput\n\nPrint an integer representing the number of choices of rows and columns satisfying the condition.\n\nSample Input 1\n\n2 3 2\n..#\n###\n\nSample Output 1\n\n5\n\nFive choices below satisfy the condition.\n\nThe 1-st row and 1-st column\n\nThe 1-st row and 2-nd column\n\nThe 1-st row and 3-rd column\n\nThe 1-st and 2-nd column\n\nThe 3-rd column\n\nSample Input 2\n\n2 3 4\n..#\n###\n\nSample Output 2\n\n1\n\nOne choice, which is choosing nothing, satisfies the condition.\n\nSample Input 3\n\n2 2 3\n##\n##\n\nSample Output 3\n\n0\n\nSample Input 4\n\n6 6 8\n..##..\n.#..#.\n#....#\n######\n#....#\n#....#\n\nSample Output 4\n\n208", "sample_input": "2 3 2\n..#\n###\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02614", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \\leq i \\leq H, 1 \\leq j \\leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is ., and black if c_{i,j} is #.\n\nConsider doing the following operation:\n\nChoose some number of rows (possibly zero), and some number of columns (possibly zero). Then, paint red all squares in the chosen rows and all squares in the chosen columns.\n\nYou are given a positive integer K. How many choices of rows and columns result in exactly K black squares remaining after the operation? Here, we consider two choices different when there is a row or column chosen in only one of those choices.\n\nConstraints\n\n1 \\leq H, W \\leq 6\n\n1 \\leq K \\leq HW\n\nc_{i,j} is . or #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\nc_{1,1}c_{1,2}...c_{1,W}\nc_{2,1}c_{2,2}...c_{2,W}\n:\nc_{H,1}c_{H,2}...c_{H,W}\n\nOutput\n\nPrint an integer representing the number of choices of rows and columns satisfying the condition.\n\nSample Input 1\n\n2 3 2\n..#\n###\n\nSample Output 1\n\n5\n\nFive choices below satisfy the condition.\n\nThe 1-st row and 1-st column\n\nThe 1-st row and 2-nd column\n\nThe 1-st row and 3-rd column\n\nThe 1-st and 2-nd column\n\nThe 3-rd column\n\nSample Input 2\n\n2 3 4\n..#\n###\n\nSample Output 2\n\n1\n\nOne choice, which is choosing nothing, satisfies the condition.\n\nSample Input 3\n\n2 2 3\n##\n##\n\nSample Output 3\n\n0\n\nSample Input 4\n\n6 6 8\n..##..\n.#..#.\n#....#\n######\n#....#\n#....#\n\nSample Output 4\n\n208", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 60, "memory_kb": 9160}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s670492193", "group_id": "codeNet:p02615", "input_text": "import sys\nimport math\nimport collections\nimport heapq\n\ndef set_debug(debug_mode=False):\n if debug_mode:\n fin = open('input.txt', 'r')\n sys.stdin = fin\n\n\ndef int_input():\n return list(map(int, input().split()))\n\n\nif __name__ == '__main__':\n # set_debug(True)\n\n # t = int(input())\n t = 1\n\n for ti in range(1, t + 1):\n n = int(input())\n\n A = int_input()\n\n A.sort()\n\n res = A[-1]\n for i in range(len(A)-2):\n res += A[-(i//2)-2]\n print(res)\n\n", "language": "Python", "metadata": {"date": 1594084775, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02615.html", "problem_id": "p02615", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02615/input.txt", "sample_output_relpath": "derived/input_output/data/p02615/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02615/Python/s670492193.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s670492193", "user_id": "u736189571"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "import sys\nimport math\nimport collections\nimport heapq\n\ndef set_debug(debug_mode=False):\n if debug_mode:\n fin = open('input.txt', 'r')\n sys.stdin = fin\n\n\ndef int_input():\n return list(map(int, input().split()))\n\n\nif __name__ == '__main__':\n # set_debug(True)\n\n # t = int(input())\n t = 1\n\n for ti in range(1, t + 1):\n n = int(input())\n\n A = int_input()\n\n A.sort()\n\n res = A[-1]\n for i in range(len(A)-2):\n res += A[-(i//2)-2]\n print(res)\n\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nQuickly after finishing the tutorial of the online game ATChat, you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the friendliness of Player i is A_i.\n\nThe N players will arrive at the place one by one in some order. To make sure nobody gets lost, you have set the following rule: players who have already arrived there should form a circle, and a player who has just arrived there should cut into the circle somewhere.\n\nWhen each player, except the first one to arrive, arrives at the place, the player gets comfort equal to the smaller of the friendliness of the clockwise adjacent player and that of the counter-clockwise adjacent player. The first player to arrive there gets the comfort of 0.\n\nWhat is the maximum total comfort the N players can get by optimally choosing the order of arrivals and the positions in the circle to cut into?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the maximum total comfort the N players can get.\n\nSample Input 1\n\n4\n2 2 1 3\n\nSample Output 1\n\n7\n\nBy arriving at the place in the order Player 4, 2, 1, 3, and cutting into the circle as shown in the figure, they can get the total comfort of 7.\n\nThey cannot get the total comfort greater than 7, so the answer is 7.\n\nSample Input 2\n\n7\n1 1 1 1 1 1 1\n\nSample Output 2\n\n6", "sample_input": "4\n2 2 1 3\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02615", "source_text": "Score: 400 points\n\nProblem Statement\n\nQuickly after finishing the tutorial of the online game ATChat, you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the friendliness of Player i is A_i.\n\nThe N players will arrive at the place one by one in some order. To make sure nobody gets lost, you have set the following rule: players who have already arrived there should form a circle, and a player who has just arrived there should cut into the circle somewhere.\n\nWhen each player, except the first one to arrive, arrives at the place, the player gets comfort equal to the smaller of the friendliness of the clockwise adjacent player and that of the counter-clockwise adjacent player. The first player to arrive there gets the comfort of 0.\n\nWhat is the maximum total comfort the N players can get by optimally choosing the order of arrivals and the positions in the circle to cut into?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the maximum total comfort the N players can get.\n\nSample Input 1\n\n4\n2 2 1 3\n\nSample Output 1\n\n7\n\nBy arriving at the place in the order Player 4, 2, 1, 3, and cutting into the circle as shown in the figure, they can get the total comfort of 7.\n\nThey cannot get the total comfort greater than 7, so the answer is 7.\n\nSample Input 2\n\n7\n1 1 1 1 1 1 1\n\nSample Output 2\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 523, "cpu_time_ms": 143, "memory_kb": 32488}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s061242304", "group_id": "codeNet:p02616", "input_text": "#!/usr/bin/env python3\nfrom functools import reduce\n\nmod = 10**9 + 7\nn, k, *a = map(int, open(0).read().split())\na.sort(key=lambda x: abs(x))\nans = reduce(lambda a, b: (a * b) % mod, a[-k:])\n\nc = a[-k:]\nj = sum(i < 0 for i in c) % 2\nif j:\n c = a[-k:]\n neg = [i for i in c if i < 0]\n pos = [i for i in c if i > 0]\n b = sorted(a[:n - k])\n if b == []:\n print(ans)\n exit()\n if neg == []:\n if pos[0] * b[0] < 0:\n ans = ans * pow(pos[0], mod - 2, mod) * b[0] % mod\n else:\n ans = reduce(lambda a, b: (a * b) % mod, a[:k])\n elif pos == []:\n if neg[0] * b[-1] < 0:\n ans = ans * pow(neg[0], mod - 2, mod) * b[-1] % mod\n else:\n ans = reduce(lambda a, b: (a * b) % mod, a[:k])\n elif pos[0] * b[-1] > neg[0] * b[0] and pos[0] * b[0] < 0:\n ans = ans * pow(pos[0], mod - 2, mod) * b[0] % mod\n elif 0 > b[-1] * neg[0]:\n ans = ans * pow(neg[0], mod - 2, mod) * b[-1] % mod\n else:\n ans = reduce(lambda a, b: (a * b) % mod, a[:k])\nprint(ans)\n", "language": "Python", "metadata": {"date": 1595966910, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02616.html", "problem_id": "p02616", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02616/input.txt", "sample_output_relpath": "derived/input_output/data/p02616/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02616/Python/s061242304.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s061242304", "user_id": "u094999522"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "#!/usr/bin/env python3\nfrom functools import reduce\n\nmod = 10**9 + 7\nn, k, *a = map(int, open(0).read().split())\na.sort(key=lambda x: abs(x))\nans = reduce(lambda a, b: (a * b) % mod, a[-k:])\n\nc = a[-k:]\nj = sum(i < 0 for i in c) % 2\nif j:\n c = a[-k:]\n neg = [i for i in c if i < 0]\n pos = [i for i in c if i > 0]\n b = sorted(a[:n - k])\n if b == []:\n print(ans)\n exit()\n if neg == []:\n if pos[0] * b[0] < 0:\n ans = ans * pow(pos[0], mod - 2, mod) * b[0] % mod\n else:\n ans = reduce(lambda a, b: (a * b) % mod, a[:k])\n elif pos == []:\n if neg[0] * b[-1] < 0:\n ans = ans * pow(neg[0], mod - 2, mod) * b[-1] % mod\n else:\n ans = reduce(lambda a, b: (a * b) % mod, a[:k])\n elif pos[0] * b[-1] > neg[0] * b[0] and pos[0] * b[0] < 0:\n ans = ans * pow(pos[0], mod - 2, mod) * b[0] % mod\n elif 0 > b[-1] * neg[0]:\n ans = ans * pow(neg[0], mod - 2, mod) * b[-1] % mod\n else:\n ans = reduce(lambda a, b: (a * b) % mod, a[:k])\nprint(ans)\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nWe will choose exactly K of these elements. Find the maximum possible product of the chosen elements.\n\nThen, print the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive).\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2\\times 10^5\n\n|A_i| \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 \\ldots A_N\n\nOutput\n\nPrint the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive).\n\nSample Input 1\n\n4 2\n1 2 -3 -4\n\nSample Output 1\n\n12\n\nThe possible products of the two chosen elements are 2, -3, -4, -6, -8, and 12, so the maximum product is 12.\n\nSample Input 2\n\n4 3\n-1 -2 -3 -4\n\nSample Output 2\n\n1000000001\n\nThe possible products of the three chosen elements are -24, -12, -8, and -6, so the maximum product is -6.\n\nWe print this value modulo (10^9+7), that is, 1000000001.\n\nSample Input 3\n\n2 1\n-1 1000000000\n\nSample Output 3\n\n1000000000\n\nThe possible products of the one chosen element are -1 and 1000000000, so the maximum product is 1000000000.\n\nSample Input 4\n\n10 10\n1000000000 100000000 10000000 1000000 100000 10000 1000 100 10 1\n\nSample Output 4\n\n999983200\n\nBe sure to print the product modulo (10^9+7).", "sample_input": "4 2\n1 2 -3 -4\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02616", "source_text": "Score : 500 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nWe will choose exactly K of these elements. Find the maximum possible product of the chosen elements.\n\nThen, print the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive).\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2\\times 10^5\n\n|A_i| \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 \\ldots A_N\n\nOutput\n\nPrint the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive).\n\nSample Input 1\n\n4 2\n1 2 -3 -4\n\nSample Output 1\n\n12\n\nThe possible products of the two chosen elements are 2, -3, -4, -6, -8, and 12, so the maximum product is 12.\n\nSample Input 2\n\n4 3\n-1 -2 -3 -4\n\nSample Output 2\n\n1000000001\n\nThe possible products of the three chosen elements are -24, -12, -8, and -6, so the maximum product is -6.\n\nWe print this value modulo (10^9+7), that is, 1000000001.\n\nSample Input 3\n\n2 1\n-1 1000000000\n\nSample Output 3\n\n1000000000\n\nThe possible products of the one chosen element are -1 and 1000000000, so the maximum product is 1000000000.\n\nSample Input 4\n\n10 10\n1000000000 100000000 10000000 1000000 100000 10000 1000 100 10 1\n\nSample Output 4\n\n999983200\n\nBe sure to print the product modulo (10^9+7).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1060, "cpu_time_ms": 212, "memory_kb": 32008}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s952252667", "group_id": "codeNet:p02621", "input_text": "a = int(input())\nprint(a+a**2+a**3)", "language": "Python", "metadata": {"date": 1593306072, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02621.html", "problem_id": "p02621", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02621/input.txt", "sample_output_relpath": "derived/input_output/data/p02621/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02621/Python/s952252667.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s952252667", "user_id": "u760569096"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "a = int(input())\nprint(a+a**2+a**3)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven an integer a as input, print the value a + a^2 + a^3.\n\nConstraints\n\n1 \\leq a \\leq 10\n\na is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\n\nOutput\n\nPrint the value a + a^2 + a^3 as an integer.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n14\n\nWhen a = 2, we have a + a^2 + a^3 = 2 + 2^2 + 2^3 = 2 + 4 + 8 = 14.\n\nPrint the answer as an input. Outputs such as 14.0 will be judged as incorrect.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n1110", "sample_input": "2\n"}, "reference_outputs": ["14\n"], "source_document_id": "p02621", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven an integer a as input, print the value a + a^2 + a^3.\n\nConstraints\n\n1 \\leq a \\leq 10\n\na is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\n\nOutput\n\nPrint the value a + a^2 + a^3 as an integer.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n14\n\nWhen a = 2, we have a + a^2 + a^3 = 2 + 2^2 + 2^3 = 2 + 4 + 8 = 14.\n\nPrint the answer as an input. Outputs such as 14.0 will be judged as incorrect.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n1110", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 35, "cpu_time_ms": 28, "memory_kb": 9172}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s602930683", "group_id": "codeNet:p02622", "input_text": "#[int(i) for i in input().split()]\ns = input()\nt = input()\nans = 0\nfor i in range(len(s)):\n if s[i] != t[i]:\n ans += 1\nprint(ans)\n", "language": "Python", "metadata": {"date": 1593306098, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02622.html", "problem_id": "p02622", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02622/input.txt", "sample_output_relpath": "derived/input_output/data/p02622/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02622/Python/s602930683.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s602930683", "user_id": "u333139319"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "#[int(i) for i in input().split()]\ns = input()\nt = input()\nans = 0\nfor i in range(len(s)):\n if s[i] != t[i]:\n ans += 1\nprint(ans)\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.\n\nOperation: Choose one character of S and replace it with a different character.\n\nConstraints\n\nS and T have lengths between 1 and 2\\times 10^5 (inclusive).\n\nS and T consists of lowercase English letters.\n\nS and T have equal lengths.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\ncupofcoffee\ncupofhottea\n\nSample Output 1\n\n4\n\nWe can achieve the objective in four operations, such as the following:\n\nFirst, replace the sixth character c with h.\n\nSecond, replace the eighth character f with t.\n\nThird, replace the ninth character f with t.\n\nFourth, replace the eleventh character e with a.\n\nSample Input 2\n\nabcde\nbcdea\n\nSample Output 2\n\n5\n\nSample Input 3\n\napple\napple\n\nSample Output 3\n\n0\n\nNo operations may be needed to achieve the objective.", "sample_input": "cupofcoffee\ncupofhottea\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02622", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.\n\nOperation: Choose one character of S and replace it with a different character.\n\nConstraints\n\nS and T have lengths between 1 and 2\\times 10^5 (inclusive).\n\nS and T consists of lowercase English letters.\n\nS and T have equal lengths.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\ncupofcoffee\ncupofhottea\n\nSample Output 1\n\n4\n\nWe can achieve the objective in four operations, such as the following:\n\nFirst, replace the sixth character c with h.\n\nSecond, replace the eighth character f with t.\n\nThird, replace the ninth character f with t.\n\nFourth, replace the eleventh character e with a.\n\nSample Input 2\n\nabcde\nbcdea\n\nSample Output 2\n\n5\n\nSample Input 3\n\napple\napple\n\nSample Output 3\n\n0\n\nNo operations may be needed to achieve the objective.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 140, "cpu_time_ms": 74, "memory_kb": 67852}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s056393615", "group_id": "codeNet:p02625", "input_text": "def prepare(n):\n global MOD\n modFacts = [0] * (n + 1)\n modFacts[0] = 1\n for i in range(n):\n modFacts[i + 1] = (modFacts[i] * (i + 1)) % MOD\n\n invs = [1] * (n + 1)\n invs[n] = pow(modFacts[n], MOD - 2, MOD)\n for i in range(n, 1, -1):\n invs[i - 1] = (invs[i] * i) % MOD\n\n return modFacts, invs\n \n\nN, M = map(int, input().split())\n\nMOD = 10 ** 9 + 7\nmodFacts, invs = prepare(max(N, M))\n\nans = 0\nfor i in range(N + 1):\n Ti = (modFacts[N] * invs[i] * invs[N - i]) % MOD\n Ti *= (modFacts[M] * invs[M - i]) % MOD\n Ti %= MOD\n Ti *= pow(modFacts[M - i] * invs[(M - i) - (N - i)], 2, MOD)\n Ti %= MOD\n ans += pow(-1, i) * Ti\n ans %= MOD\n\nprint(ans)", "language": "Python", "metadata": {"date": 1597442505, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02625.html", "problem_id": "p02625", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02625/input.txt", "sample_output_relpath": "derived/input_output/data/p02625/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02625/Python/s056393615.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s056393615", "user_id": "u570155187"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "def prepare(n):\n global MOD\n modFacts = [0] * (n + 1)\n modFacts[0] = 1\n for i in range(n):\n modFacts[i + 1] = (modFacts[i] * (i + 1)) % MOD\n\n invs = [1] * (n + 1)\n invs[n] = pow(modFacts[n], MOD - 2, MOD)\n for i in range(n, 1, -1):\n invs[i - 1] = (invs[i] * i) % MOD\n\n return modFacts, invs\n \n\nN, M = map(int, input().split())\n\nMOD = 10 ** 9 + 7\nmodFacts, invs = prepare(max(N, M))\n\nans = 0\nfor i in range(N + 1):\n Ti = (modFacts[N] * invs[i] * invs[N - i]) % MOD\n Ti *= (modFacts[M] * invs[M - i]) % MOD\n Ti %= MOD\n Ti *= pow(modFacts[M - i] * invs[(M - i) - (N - i)], 2, MOD)\n Ti %= MOD\n ans += pow(-1, i) * Ti\n ans %= MOD\n\nprint(ans)", "problem_context": "Score : 500 points\n\nProblem Statement\n\nCount the pairs of length-N sequences consisting of integers between 1 and M (inclusive), A_1, A_2, \\cdots, A_{N} and B_1, B_2, \\cdots, B_{N}, that satisfy all of the following conditions:\n\nA_i \\neq B_i, for every i such that 1\\leq i\\leq N.\n\nA_i \\neq A_j and B_i \\neq B_j, for every (i, j) such that 1\\leq i < j\\leq N.\n\nSince the count can be enormous, print it modulo (10^9+7).\n\nConstraints\n\n1\\leq N \\leq M \\leq 5\\times10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the count modulo (10^9+7).\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n2\n\nA_1=1,A_2=2,B_1=2,B_2=1 and A_1=2,A_2=1,B_1=1,B_2=2 satisfy the conditions.\n\nSample Input 2\n\n2 3\n\nSample Output 2\n\n18\n\nSample Input 3\n\n141421 356237\n\nSample Output 3\n\n881613484", "sample_input": "2 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02625", "source_text": "Score : 500 points\n\nProblem Statement\n\nCount the pairs of length-N sequences consisting of integers between 1 and M (inclusive), A_1, A_2, \\cdots, A_{N} and B_1, B_2, \\cdots, B_{N}, that satisfy all of the following conditions:\n\nA_i \\neq B_i, for every i such that 1\\leq i\\leq N.\n\nA_i \\neq A_j and B_i \\neq B_j, for every (i, j) such that 1\\leq i < j\\leq N.\n\nSince the count can be enormous, print it modulo (10^9+7).\n\nConstraints\n\n1\\leq N \\leq M \\leq 5\\times10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the count modulo (10^9+7).\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n2\n\nA_1=1,A_2=2,B_1=2,B_2=1 and A_1=2,A_2=1,B_1=1,B_2=2 satisfy the conditions.\n\nSample Input 2\n\n2 3\n\nSample Output 2\n\n18\n\nSample Input 3\n\n141421 356237\n\nSample Output 3\n\n881613484", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 702, "cpu_time_ms": 1267, "memory_kb": 48364}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s656449090", "group_id": "codeNet:p02627", "input_text": "import sys\nimport math\n#import random\n#sys.setrecursionlimit(1000000)\ninput = sys.stdin.readline\n \n############ ---- USER DEFINED INPUT FUNCTIONS ---- ############\ndef inp():\n return(int(input()))\ndef inara():\n return(list(map(int,input().split())))\ndef insr():\n s = input()\n return(list(s[:len(s) - 1]))\ndef invr():\n return(map(int,input().split()))\n################################################################\n############ ---- THE ACTUAL CODE STARTS BELOW ---- ############\n\na=input()\n\nif a>='a' and a<='z':\n\tprint(\"a\")\nelse:\n\tprint(\"A\")\n", "language": "Python", "metadata": {"date": 1593105187, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02627.html", "problem_id": "p02627", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02627/input.txt", "sample_output_relpath": "derived/input_output/data/p02627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02627/Python/s656449090.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s656449090", "user_id": "u579588275"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "import sys\nimport math\n#import random\n#sys.setrecursionlimit(1000000)\ninput = sys.stdin.readline\n \n############ ---- USER DEFINED INPUT FUNCTIONS ---- ############\ndef inp():\n return(int(input()))\ndef inara():\n return(list(map(int,input().split())))\ndef insr():\n s = input()\n return(list(s[:len(s) - 1]))\ndef invr():\n return(map(int,input().split()))\n################################################################\n############ ---- THE ACTUAL CODE STARTS BELOW ---- ############\n\na=input()\n\nif a>='a' and a<='z':\n\tprint(\"a\")\nelse:\n\tprint(\"A\")\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "sample_input": "B\n"}, "reference_outputs": ["A\n"], "source_document_id": "p02627", "source_text": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 560, "cpu_time_ms": 61, "memory_kb": 62164}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s149157828", "group_id": "codeNet:p02627", "input_text": "def main():\n nmax = 100000\n n = int(input())\n values = [0] * nmax\n a = [int(v) for v in input().split()]\n for v in a:\n values[v-1] += 1\n asum = sum(a)\n\n q = int(input())\n for _ in range(q):\n b, c = [int(v) for v in input().split()]\n asum += values[b-1] * (c - b)\n values[c-1] += values[b-1]\n values[b-1] = 0\n print(asum)\n\nmain()", "language": "Python", "metadata": {"date": 1592791481, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02627.html", "problem_id": "p02627", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02627/input.txt", "sample_output_relpath": "derived/input_output/data/p02627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02627/Python/s149157828.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s149157828", "user_id": "u528181687"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "def main():\n nmax = 100000\n n = int(input())\n values = [0] * nmax\n a = [int(v) for v in input().split()]\n for v in a:\n values[v-1] += 1\n asum = sum(a)\n\n q = int(input())\n for _ in range(q):\n b, c = [int(v) for v in input().split()]\n asum += values[b-1] * (c - b)\n values[c-1] += values[b-1]\n values[b-1] = 0\n print(asum)\n\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "sample_input": "B\n"}, "reference_outputs": ["A\n"], "source_document_id": "p02627", "source_text": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 394, "cpu_time_ms": 30, "memory_kb": 9148}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s874468289", "group_id": "codeNet:p02628", "input_text": "n,k=input().split();print(sum(sorted(map(int,input().split()))[:int(k)]))", "language": "Python", "metadata": {"date": 1592799545, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02628.html", "problem_id": "p02628", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02628/input.txt", "sample_output_relpath": "derived/input_output/data/p02628/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02628/Python/s874468289.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s874468289", "user_id": "u030879708"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "n,k=input().split();print(sum(sorted(map(int,input().split()))[:int(k)]))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "sample_input": "5 3\n50 100 80 120 80\n"}, "reference_outputs": ["210\n"], "source_document_id": "p02628", "source_text": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 73, "cpu_time_ms": 31, "memory_kb": 9160}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s914860572", "group_id": "codeNet:p02628", "input_text": "n = input()\nm = n.split()\nprint(m)\na = [input() for l in range(0,1)]\nb = a[0].split()\nprint(b)\n\nfor i in range(0, len(b)):\n b[i] = int(b[i])\n\nc = sorted(b, reverse=True)\nprint(c)\np = 0\nfor i in range(int(m[0]) - int(m[1]),int(m[0])):\n p = p + int(c[i])\nprint(int(p))", "language": "Python", "metadata": {"date": 1592791786, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02628.html", "problem_id": "p02628", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02628/input.txt", "sample_output_relpath": "derived/input_output/data/p02628/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02628/Python/s914860572.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s914860572", "user_id": "u909359131"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "n = input()\nm = n.split()\nprint(m)\na = [input() for l in range(0,1)]\nb = a[0].split()\nprint(b)\n\nfor i in range(0, len(b)):\n b[i] = int(b[i])\n\nc = sorted(b, reverse=True)\nprint(c)\np = 0\nfor i in range(int(m[0]) - int(m[1]),int(m[0])):\n p = p + int(c[i])\nprint(int(p))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "sample_input": "5 3\n50 100 80 120 80\n"}, "reference_outputs": ["210\n"], "source_document_id": "p02628", "source_text": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 272, "cpu_time_ms": 27, "memory_kb": 9076}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s738500319", "group_id": "codeNet:p02629", "input_text": "def itoa(i):\n return chr(97 + i - 1)\n\n\nN = int(input())\n\nans = \"\"\nwhile N:\n i = N % 26\n N = (N - 1) // 26\n ans += itoa(i)\n\nprint(ans[::-1])", "language": "Python", "metadata": {"date": 1592789882, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02629.html", "problem_id": "p02629", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02629/input.txt", "sample_output_relpath": "derived/input_output/data/p02629/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02629/Python/s738500319.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s738500319", "user_id": "u994988729"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "def itoa(i):\n return chr(97 + i - 1)\n\n\nN = int(input())\n\nans = \"\"\nwhile N:\n i = N % 26\n N = (N - 1) // 26\n ans += itoa(i)\n\nprint(ans[::-1])", "problem_context": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "sample_input": "2\n"}, "reference_outputs": ["b\n"], "source_document_id": "p02629", "source_text": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 151, "cpu_time_ms": 31, "memory_kb": 9176}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s586552943", "group_id": "codeNet:p02629", "input_text": "import math\nN = int(input())\nchar = [chr(i) for i in range(97, 97+26)]\nK = math.floor(math.log(N , 26))\ns = ''\nmod = 26**K\nfor i in range(K+1):\n a = N//(mod)\n N = N % mod\n mod = int(mod/26)\n s += char[a-1]\nprint(s) \n \n", "language": "Python", "metadata": {"date": 1592788702, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02629.html", "problem_id": "p02629", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02629/input.txt", "sample_output_relpath": "derived/input_output/data/p02629/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02629/Python/s586552943.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s586552943", "user_id": "u793821463"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "import math\nN = int(input())\nchar = [chr(i) for i in range(97, 97+26)]\nK = math.floor(math.log(N , 26))\ns = ''\nmod = 26**K\nfor i in range(K+1):\n a = N//(mod)\n N = N % mod\n mod = int(mod/26)\n s += char[a-1]\nprint(s) \n \n", "problem_context": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "sample_input": "2\n"}, "reference_outputs": ["b\n"], "source_document_id": "p02629", "source_text": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 224, "cpu_time_ms": 27, "memory_kb": 9176}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s499864088", "group_id": "codeNet:p02629", "input_text": "To_Acill = 96\n\nN = int(input())\n\nans = []\n\njou26 = 1\nwhile N > 0:\n tmp = N % (jou26*26)\n ans.append(chr(To_Acill + tmp//jou26))\n N = N-tmp\n jou26 = jou26*26\n\nprint(\"\".join(reversed(ans)))\n", "language": "Python", "metadata": {"date": 1592788516, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02629.html", "problem_id": "p02629", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02629/input.txt", "sample_output_relpath": "derived/input_output/data/p02629/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02629/Python/s499864088.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s499864088", "user_id": "u364862909"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "To_Acill = 96\n\nN = int(input())\n\nans = []\n\njou26 = 1\nwhile N > 0:\n tmp = N % (jou26*26)\n ans.append(chr(To_Acill + tmp//jou26))\n N = N-tmp\n jou26 = jou26*26\n\nprint(\"\".join(reversed(ans)))\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "sample_input": "2\n"}, "reference_outputs": ["b\n"], "source_document_id": "p02629", "source_text": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 200, "cpu_time_ms": 64, "memory_kb": 61692}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s606074127", "group_id": "codeNet:p02629", "input_text": "N=int(input())\ns=\"\"\nwhile N>0:\n x=N%26\n if x==0:\n x=26\n N=N//26\n s=chr(96+x)+s\nprint(s)", "language": "Python", "metadata": {"date": 1592788162, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02629.html", "problem_id": "p02629", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02629/input.txt", "sample_output_relpath": "derived/input_output/data/p02629/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02629/Python/s606074127.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s606074127", "user_id": "u611945374"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "N=int(input())\ns=\"\"\nwhile N>0:\n x=N%26\n if x==0:\n x=26\n N=N//26\n s=chr(96+x)+s\nprint(s)", "problem_context": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "sample_input": "2\n"}, "reference_outputs": ["b\n"], "source_document_id": "p02629", "source_text": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 106, "cpu_time_ms": 36, "memory_kb": 9156}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s618773066", "group_id": "codeNet:p02630", "input_text": "l = [0] * 10**5\ntot = 0\nfor i in range(N) :\n l[A[i]]+=1\n tot += A[i]\nfor i in range(Q):\n s0 = S[i][0]\n s1 = S[i][1]\n tot += s1 * (l[s0] + l[s1]) - (s0 * l[s0] + s1*l[s1])\n l[s1] += l[s0]\n l[s0] = 0\n print(tot)", "language": "Python", "metadata": {"date": 1598915629, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02630.html", "problem_id": "p02630", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02630/input.txt", "sample_output_relpath": "derived/input_output/data/p02630/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02630/Python/s618773066.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s618773066", "user_id": "u038676814"}, "prompt_components": {"gold_output": "11\n12\n16\n", "input_to_evaluate": "l = [0] * 10**5\ntot = 0\nfor i in range(N) :\n l[A[i]]+=1\n tot += A[i]\nfor i in range(Q):\n s0 = S[i][0]\n s1 = S[i][1]\n tot += s1 * (l[s0] + l[s1]) - (s0 * l[s0] + s1*l[s1])\n l[s1] += l[s0]\n l[s0] = 0\n print(tot)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou have a sequence A composed of N positive integers: A_{1}, A_{2}, \\cdots, A_{N}.\n\nYou will now successively do the following Q operations:\n\nIn the i-th operation, you replace every element whose value is B_{i} with C_{i}.\n\nFor each i (1 \\leq i \\leq Q), find S_{i}: the sum of all elements in A just after the i-th operation.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, Q, A_{i}, B_{i}, C_{i} \\leq 10^{5}\n\nB_{i} \\neq C_{i}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1} A_{2} \\cdots A_{N}\nQ\nB_{1} C_{1}\nB_{2} C_{2}\n\\vdots\nB_{Q} C_{Q}\n\nOutput\n\nPrint Q integers S_{i} to Standard Output in the following format:\n\nS_{1}\nS_{2}\n\\vdots\nS_{Q}\n\nNote that S_{i} may not fit into a 32-bit integer.\n\nSample Input 1\n\n4\n1 2 3 4\n3\n1 2\n3 4\n2 4\n\nSample Output 1\n\n11\n12\n16\n\nInitially, the sequence A is 1,2,3,4.\n\nAfter each operation, it becomes the following:\n\n2, 2, 3, 4\n\n2, 2, 4, 4\n\n4, 4, 4, 4\n\nSample Input 2\n\n4\n1 1 1 1\n3\n1 2\n2 1\n3 5\n\nSample Output 2\n\n8\n4\n4\n\nNote that the sequence A may not contain an element whose value is B_{i}.\n\nSample Input 3\n\n2\n1 2\n3\n1 100\n2 100\n100 1000\n\nSample Output 3\n\n102\n200\n2000", "sample_input": "4\n1 2 3 4\n3\n1 2\n3 4\n2 4\n"}, "reference_outputs": ["11\n12\n16\n"], "source_document_id": "p02630", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou have a sequence A composed of N positive integers: A_{1}, A_{2}, \\cdots, A_{N}.\n\nYou will now successively do the following Q operations:\n\nIn the i-th operation, you replace every element whose value is B_{i} with C_{i}.\n\nFor each i (1 \\leq i \\leq Q), find S_{i}: the sum of all elements in A just after the i-th operation.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, Q, A_{i}, B_{i}, C_{i} \\leq 10^{5}\n\nB_{i} \\neq C_{i}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1} A_{2} \\cdots A_{N}\nQ\nB_{1} C_{1}\nB_{2} C_{2}\n\\vdots\nB_{Q} C_{Q}\n\nOutput\n\nPrint Q integers S_{i} to Standard Output in the following format:\n\nS_{1}\nS_{2}\n\\vdots\nS_{Q}\n\nNote that S_{i} may not fit into a 32-bit integer.\n\nSample Input 1\n\n4\n1 2 3 4\n3\n1 2\n3 4\n2 4\n\nSample Output 1\n\n11\n12\n16\n\nInitially, the sequence A is 1,2,3,4.\n\nAfter each operation, it becomes the following:\n\n2, 2, 3, 4\n\n2, 2, 4, 4\n\n4, 4, 4, 4\n\nSample Input 2\n\n4\n1 1 1 1\n3\n1 2\n2 1\n3 5\n\nSample Output 2\n\n8\n4\n4\n\nNote that the sequence A may not contain an element whose value is B_{i}.\n\nSample Input 3\n\n2\n1 2\n3\n1 100\n2 100\n100 1000\n\nSample Output 3\n\n102\n200\n2000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 233, "cpu_time_ms": 27, "memory_kb": 9420}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s604248463", "group_id": "codeNet:p02630", "input_text": "n = int(input())\na = list(map(int, input().strip().split()))\nq = int(input())\nbc = [map(int, input().split()) for _ in range(q)]\nb, c = [list(i) for i in zip(*bc)]\n\nfor i in range(q):\n for aa in range(n):\n if(a[aa]==b[i]):\n a[aa]=c[i]\n print(sum(a))", "language": "Python", "metadata": {"date": 1592789363, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02630.html", "problem_id": "p02630", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02630/input.txt", "sample_output_relpath": "derived/input_output/data/p02630/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02630/Python/s604248463.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s604248463", "user_id": "u656801456"}, "prompt_components": {"gold_output": "11\n12\n16\n", "input_to_evaluate": "n = int(input())\na = list(map(int, input().strip().split()))\nq = int(input())\nbc = [map(int, input().split()) for _ in range(q)]\nb, c = [list(i) for i in zip(*bc)]\n\nfor i in range(q):\n for aa in range(n):\n if(a[aa]==b[i]):\n a[aa]=c[i]\n print(sum(a))", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou have a sequence A composed of N positive integers: A_{1}, A_{2}, \\cdots, A_{N}.\n\nYou will now successively do the following Q operations:\n\nIn the i-th operation, you replace every element whose value is B_{i} with C_{i}.\n\nFor each i (1 \\leq i \\leq Q), find S_{i}: the sum of all elements in A just after the i-th operation.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, Q, A_{i}, B_{i}, C_{i} \\leq 10^{5}\n\nB_{i} \\neq C_{i}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1} A_{2} \\cdots A_{N}\nQ\nB_{1} C_{1}\nB_{2} C_{2}\n\\vdots\nB_{Q} C_{Q}\n\nOutput\n\nPrint Q integers S_{i} to Standard Output in the following format:\n\nS_{1}\nS_{2}\n\\vdots\nS_{Q}\n\nNote that S_{i} may not fit into a 32-bit integer.\n\nSample Input 1\n\n4\n1 2 3 4\n3\n1 2\n3 4\n2 4\n\nSample Output 1\n\n11\n12\n16\n\nInitially, the sequence A is 1,2,3,4.\n\nAfter each operation, it becomes the following:\n\n2, 2, 3, 4\n\n2, 2, 4, 4\n\n4, 4, 4, 4\n\nSample Input 2\n\n4\n1 1 1 1\n3\n1 2\n2 1\n3 5\n\nSample Output 2\n\n8\n4\n4\n\nNote that the sequence A may not contain an element whose value is B_{i}.\n\nSample Input 3\n\n2\n1 2\n3\n1 100\n2 100\n100 1000\n\nSample Output 3\n\n102\n200\n2000", "sample_input": "4\n1 2 3 4\n3\n1 2\n3 4\n2 4\n"}, "reference_outputs": ["11\n12\n16\n"], "source_document_id": "p02630", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou have a sequence A composed of N positive integers: A_{1}, A_{2}, \\cdots, A_{N}.\n\nYou will now successively do the following Q operations:\n\nIn the i-th operation, you replace every element whose value is B_{i} with C_{i}.\n\nFor each i (1 \\leq i \\leq Q), find S_{i}: the sum of all elements in A just after the i-th operation.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, Q, A_{i}, B_{i}, C_{i} \\leq 10^{5}\n\nB_{i} \\neq C_{i}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1} A_{2} \\cdots A_{N}\nQ\nB_{1} C_{1}\nB_{2} C_{2}\n\\vdots\nB_{Q} C_{Q}\n\nOutput\n\nPrint Q integers S_{i} to Standard Output in the following format:\n\nS_{1}\nS_{2}\n\\vdots\nS_{Q}\n\nNote that S_{i} may not fit into a 32-bit integer.\n\nSample Input 1\n\n4\n1 2 3 4\n3\n1 2\n3 4\n2 4\n\nSample Output 1\n\n11\n12\n16\n\nInitially, the sequence A is 1,2,3,4.\n\nAfter each operation, it becomes the following:\n\n2, 2, 3, 4\n\n2, 2, 4, 4\n\n4, 4, 4, 4\n\nSample Input 2\n\n4\n1 1 1 1\n3\n1 2\n2 1\n3 5\n\nSample Output 2\n\n8\n4\n4\n\nNote that the sequence A may not contain an element whose value is B_{i}.\n\nSample Input 3\n\n2\n1 2\n3\n1 100\n2 100\n100 1000\n\nSample Output 3\n\n102\n200\n2000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 273, "cpu_time_ms": 2207, "memory_kb": 66908}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s538272608", "group_id": "codeNet:p02632", "input_text": "import numpy as np\nfrom numba import njit\n\n\ndef comb(n, r, p):\n r = min(r, n - r)\n ret = fac[n]\n ret = ret * facinv[r] % p\n return ret * facinv[n - r] % p\n\n\n@njit\ndef comb_init(N_UNTIL, p):\n N_UNTIL += 1\n inv = np.empty(N_UNTIL, np.int64)\n fac = np.empty(N_UNTIL, np.int64)\n facinv = np.empty(N_UNTIL, np.int64)\n inv[0] = 0\n inv[1] = 1\n fac[0] = 1\n facinv[0] = 1\n for i in range(2, N_UNTIL):\n inv[i] = -inv[p % i] * (p // i) % p\n for i in range(1, N_UNTIL):\n fac[i] = fac[i - 1] * i % p\n for i in range(1, N_UNTIL):\n facinv[i] = facinv[i - 1] * inv[i] % p\n return inv, fac, facinv\n\n\nK = int(input())\nS = input()\nN = len(S)\nMOD = 1_000_000_007\ninv, fac, facinv = comb_init(N + K - 1, MOD)\nans = 0\nfor i in range(K + 1):\n tmp = pow(25, K - i, MOD)\n tmp *= comb(N + K - i - 1, K - i, MOD)\n tmp %= MOD\n tmp *= pow(26, i, MOD)\n tmp %= MOD\n ans += tmp\n ans %= MOD\nprint(ans)\n", "language": "Python", "metadata": {"date": 1592836506, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02632.html", "problem_id": "p02632", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02632/input.txt", "sample_output_relpath": "derived/input_output/data/p02632/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02632/Python/s538272608.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s538272608", "user_id": "u888092736"}, "prompt_components": {"gold_output": "575111451\n", "input_to_evaluate": "import numpy as np\nfrom numba import njit\n\n\ndef comb(n, r, p):\n r = min(r, n - r)\n ret = fac[n]\n ret = ret * facinv[r] % p\n return ret * facinv[n - r] % p\n\n\n@njit\ndef comb_init(N_UNTIL, p):\n N_UNTIL += 1\n inv = np.empty(N_UNTIL, np.int64)\n fac = np.empty(N_UNTIL, np.int64)\n facinv = np.empty(N_UNTIL, np.int64)\n inv[0] = 0\n inv[1] = 1\n fac[0] = 1\n facinv[0] = 1\n for i in range(2, N_UNTIL):\n inv[i] = -inv[p % i] * (p // i) % p\n for i in range(1, N_UNTIL):\n fac[i] = fac[i - 1] * i % p\n for i in range(1, N_UNTIL):\n facinv[i] = facinv[i - 1] * inv[i] % p\n return inv, fac, facinv\n\n\nK = int(input())\nS = input()\nN = len(S)\nMOD = 1_000_000_007\ninv, fac, facinv = comb_init(N + K - 1, MOD)\nans = 0\nfor i in range(K + 1):\n tmp = pow(25, K - i, MOD)\n tmp *= comb(N + K - i - 1, K - i, MOD)\n tmp %= MOD\n tmp *= pow(26, i, MOD)\n tmp %= MOD\n ans += tmp\n ans %= MOD\nprint(ans)\n", "problem_context": "Score: 600 points\n\nProblem Statement\n\nHow many strings can be obtained by applying the following operation on a string S exactly K times: \"choose one lowercase English letter and insert it somewhere\"?\n\nThe answer can be enormous, so print it modulo (10^9+7).\n\nConstraints\n\nK is an integer between 1 and 10^6 (inclusive).\n\nS is a string of length between 1 and 10^6 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint the number of strings satisfying the condition, modulo (10^9+7).\n\nSample Input 1\n\n5\noof\n\nSample Output 1\n\n575111451\n\nFor example, we can obtain proofend, moonwolf, and onionpuf, while we cannot obtain oofsix, oofelevennn, voxafolt, or fooooooo.\n\nSample Input 2\n\n37564\nwhydidyoudesertme\n\nSample Output 2\n\n318008117", "sample_input": "5\noof\n"}, "reference_outputs": ["575111451\n"], "source_document_id": "p02632", "source_text": "Score: 600 points\n\nProblem Statement\n\nHow many strings can be obtained by applying the following operation on a string S exactly K times: \"choose one lowercase English letter and insert it somewhere\"?\n\nThe answer can be enormous, so print it modulo (10^9+7).\n\nConstraints\n\nK is an integer between 1 and 10^6 (inclusive).\n\nS is a string of length between 1 and 10^6 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint the number of strings satisfying the condition, modulo (10^9+7).\n\nSample Input 1\n\n5\noof\n\nSample Output 1\n\n575111451\n\nFor example, we can obtain proofend, moonwolf, and onionpuf, while we cannot obtain oofsix, oofelevennn, voxafolt, or fooooooo.\n\nSample Input 2\n\n37564\nwhydidyoudesertme\n\nSample Output 2\n\n318008117", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 959, "cpu_time_ms": 2211, "memory_kb": 159428}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s841256123", "group_id": "codeNet:p02633", "input_text": "x = int(input())\n\nif 360 % x == 0:\n print(360//x)\nelse:\n mod = 360 % x\n n = 360 // x\n print(n * (360 // mod))\n", "language": "Python", "metadata": {"date": 1592707326, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02633.html", "problem_id": "p02633", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02633/input.txt", "sample_output_relpath": "derived/input_output/data/p02633/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02633/Python/s841256123.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s841256123", "user_id": "u193582576"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "x = int(input())\n\nif 360 % x == 0:\n print(360//x)\nelse:\n mod = 360 % x\n n = 360 // x\n print(n * (360 // mod))\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times:\n\nGo one meter in the direction he is facing. Then, turn X degrees counter-clockwise.\n\nConstraints\n\n1 \\leq X \\leq 179\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of times Takahashi will do the action before he is at the starting position again.\n\nSample Input 1\n\n90\n\nSample Output 1\n\n4\n\nTakahashi's path is a square.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n360", "sample_input": "90\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02633", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times:\n\nGo one meter in the direction he is facing. Then, turn X degrees counter-clockwise.\n\nConstraints\n\n1 \\leq X \\leq 179\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of times Takahashi will do the action before he is at the starting position again.\n\nSample Input 1\n\n90\n\nSample Output 1\n\n4\n\nTakahashi's path is a square.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n360", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 122, "cpu_time_ms": 35, "memory_kb": 9148}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s064148112", "group_id": "codeNet:p02639", "input_text": "x = list(map(int,input().split())\n \nfor i in range(5):\n\tif x[i] == 0:\n \tprint(i+1)\n ", "language": "Python", "metadata": {"date": 1592520800, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02639.html", "problem_id": "p02639", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02639/input.txt", "sample_output_relpath": "derived/input_output/data/p02639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02639/Python/s064148112.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s064148112", "user_id": "u853728588"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "x = list(map(int,input().split())\n \nfor i in range(5):\n\tif x[i] == 0:\n \tprint(i+1)\n ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "sample_input": "0 2 3 4 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02639", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 96, "cpu_time_ms": 26, "memory_kb": 8912}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s373679222", "group_id": "codeNet:p02640", "input_text": "X, Y = map(int, input().split())\n ans = 'No'\n for a in range(X + 1):\n b = X - a\n if 2 * a + 4 * b == Y:\n ans = 'Yes'\n print(ans)", "language": "Python", "metadata": {"date": 1592238507, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02640.html", "problem_id": "p02640", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02640/input.txt", "sample_output_relpath": "derived/input_output/data/p02640/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02640/Python/s373679222.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s373679222", "user_id": "u498835115"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "X, Y = map(int, input().split())\n ans = 'No'\n for a in range(X + 1):\n b = X - a\n if 2 * a + 4 * b == Y:\n ans = 'Yes'\n print(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "sample_input": "3 8\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02640", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 128, "cpu_time_ms": 20, "memory_kb": 8956}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s339131301", "group_id": "codeNet:p02640", "input_text": "X,Y=map(int,input().split())\nN=0\nM=0\nA=0\nB=0\nC=0\nN=Y%2\nif N==0:\n M=X*4\n if M>=Y:\n A=Y%X\n B=Y/X\n if A==0:\n if B>2:\n print(\"Yes\")\n else:\n print(\"No\")\n else:\n if A>=0.5:\n C=B+1\n if C>2:\n print(\"Yes\")\n else:\n print(\"No\")\n else:\n if B>2:\n print(\"Yes\")\n else:\n print(\"No\")\n else:\n print(\"No\")\nelse:\n print(\"No\")\n", "language": "Python", "metadata": {"date": 1592188163, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02640.html", "problem_id": "p02640", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02640/input.txt", "sample_output_relpath": "derived/input_output/data/p02640/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02640/Python/s339131301.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s339131301", "user_id": "u497188176"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "X,Y=map(int,input().split())\nN=0\nM=0\nA=0\nB=0\nC=0\nN=Y%2\nif N==0:\n M=X*4\n if M>=Y:\n A=Y%X\n B=Y/X\n if A==0:\n if B>2:\n print(\"Yes\")\n else:\n print(\"No\")\n else:\n if A>=0.5:\n C=B+1\n if C>2:\n print(\"Yes\")\n else:\n print(\"No\")\n else:\n if B>2:\n print(\"Yes\")\n else:\n print(\"No\")\n else:\n print(\"No\")\nelse:\n print(\"No\")\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "sample_input": "3 8\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02640", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 578, "cpu_time_ms": 21, "memory_kb": 9152}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s412719030", "group_id": "codeNet:p02641", "input_text": "X,N=map(int,input().split())\np=list(map(int,input().split()))\n\nfor i in range(110):\n if X-i not in p:\n print(X-i)\n exit()\n if X+i not in p:\n print(X+i)\n exit()\n", "language": "Python", "metadata": {"date": 1592223236, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02641.html", "problem_id": "p02641", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02641/input.txt", "sample_output_relpath": "derived/input_output/data/p02641/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02641/Python/s412719030.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s412719030", "user_id": "u821262411"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "X,N=map(int,input().split())\np=list(map(int,input().split()))\n\nfor i in range(110):\n if X-i not in p:\n print(X-i)\n exit()\n if X+i not in p:\n print(X+i)\n exit()\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are an integer X and an integer sequence of length N: p_1, \\ldots, p_N.\n\nAmong the integers not contained in the sequence p_1, \\ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n0 \\leq N \\leq 100\n\n1 \\leq p_i \\leq 100\n\np_1, \\ldots, p_N are all distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX N\np_1 ... p_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n6 5\n4 7 10 6 5\n\nSample Output 1\n\n8\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the one nearest to 6 is 8.\n\nSample Input 2\n\n10 5\n4 7 10 6 5\n\nSample Output 2\n\n9\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the ones nearest to 10 are 9 and 11. We should print the smaller one, 9.\n\nSample Input 3\n\n100 0\n\nSample Output 3\n\n100\n\nWhen N = 0, the second line in the input will be empty. Also, as seen here, X itself can be the answer.", "sample_input": "6 5\n4 7 10 6 5\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02641", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are an integer X and an integer sequence of length N: p_1, \\ldots, p_N.\n\nAmong the integers not contained in the sequence p_1, \\ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n0 \\leq N \\leq 100\n\n1 \\leq p_i \\leq 100\n\np_1, \\ldots, p_N are all distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX N\np_1 ... p_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n6 5\n4 7 10 6 5\n\nSample Output 1\n\n8\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the one nearest to 6 is 8.\n\nSample Input 2\n\n10 5\n4 7 10 6 5\n\nSample Output 2\n\n9\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the ones nearest to 10 are 9 and 11. We should print the smaller one, 9.\n\nSample Input 3\n\n100 0\n\nSample Output 3\n\n100\n\nWhen N = 0, the second line in the input will be empty. Also, as seen here, X itself can be the answer.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 194, "cpu_time_ms": 25, "memory_kb": 9172}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s880987000", "group_id": "codeNet:p02641", "input_text": "def main():\n x, n = map(int, input().split())\n p = list(map(int, input().split()))\n _near = -1\n for i in range(-1, 102):\n if i in p:\n continue\n if abs(_near - x) > abs(i - x):\n _near = i\n print(_near)\n\n\nif __name__ == \"__main__\":\n main()\n", "language": "Python", "metadata": {"date": 1592187430, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02641.html", "problem_id": "p02641", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02641/input.txt", "sample_output_relpath": "derived/input_output/data/p02641/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02641/Python/s880987000.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s880987000", "user_id": "u173644182"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "def main():\n x, n = map(int, input().split())\n p = list(map(int, input().split()))\n _near = -1\n for i in range(-1, 102):\n if i in p:\n continue\n if abs(_near - x) > abs(i - x):\n _near = i\n print(_near)\n\n\nif __name__ == \"__main__\":\n main()\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are an integer X and an integer sequence of length N: p_1, \\ldots, p_N.\n\nAmong the integers not contained in the sequence p_1, \\ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n0 \\leq N \\leq 100\n\n1 \\leq p_i \\leq 100\n\np_1, \\ldots, p_N are all distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX N\np_1 ... p_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n6 5\n4 7 10 6 5\n\nSample Output 1\n\n8\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the one nearest to 6 is 8.\n\nSample Input 2\n\n10 5\n4 7 10 6 5\n\nSample Output 2\n\n9\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the ones nearest to 10 are 9 and 11. We should print the smaller one, 9.\n\nSample Input 3\n\n100 0\n\nSample Output 3\n\n100\n\nWhen N = 0, the second line in the input will be empty. Also, as seen here, X itself can be the answer.", "sample_input": "6 5\n4 7 10 6 5\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02641", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are an integer X and an integer sequence of length N: p_1, \\ldots, p_N.\n\nAmong the integers not contained in the sequence p_1, \\ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n0 \\leq N \\leq 100\n\n1 \\leq p_i \\leq 100\n\np_1, \\ldots, p_N are all distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX N\np_1 ... p_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n6 5\n4 7 10 6 5\n\nSample Output 1\n\n8\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the one nearest to 6 is 8.\n\nSample Input 2\n\n10 5\n4 7 10 6 5\n\nSample Output 2\n\n9\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the ones nearest to 10 are 9 and 11. We should print the smaller one, 9.\n\nSample Input 3\n\n100 0\n\nSample Output 3\n\n100\n\nWhen N = 0, the second line in the input will be empty. Also, as seen here, X itself can be the answer.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 296, "cpu_time_ms": 23, "memory_kb": 9180}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s873701257", "group_id": "codeNet:p02641", "input_text": "def main():\n X, N = map(int, input().split())\n if N == 0:\n print(X)\n return\n p = tuple(map(int, input().split())) \n if X not in p:\n print(X)\n \n not_p = list(set([i for i in range(max(p)+2)]) - set(p))\n not_p_X = [abs(i - X) for i in not_p]\n print(not_p[not_p_X.index(min(not_p_X))])\n \nmain()\n", "language": "Python", "metadata": {"date": 1592186859, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02641.html", "problem_id": "p02641", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02641/input.txt", "sample_output_relpath": "derived/input_output/data/p02641/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02641/Python/s873701257.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s873701257", "user_id": "u012820749"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "def main():\n X, N = map(int, input().split())\n if N == 0:\n print(X)\n return\n p = tuple(map(int, input().split())) \n if X not in p:\n print(X)\n \n not_p = list(set([i for i in range(max(p)+2)]) - set(p))\n not_p_X = [abs(i - X) for i in not_p]\n print(not_p[not_p_X.index(min(not_p_X))])\n \nmain()\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are an integer X and an integer sequence of length N: p_1, \\ldots, p_N.\n\nAmong the integers not contained in the sequence p_1, \\ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n0 \\leq N \\leq 100\n\n1 \\leq p_i \\leq 100\n\np_1, \\ldots, p_N are all distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX N\np_1 ... p_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n6 5\n4 7 10 6 5\n\nSample Output 1\n\n8\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the one nearest to 6 is 8.\n\nSample Input 2\n\n10 5\n4 7 10 6 5\n\nSample Output 2\n\n9\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the ones nearest to 10 are 9 and 11. We should print the smaller one, 9.\n\nSample Input 3\n\n100 0\n\nSample Output 3\n\n100\n\nWhen N = 0, the second line in the input will be empty. Also, as seen here, X itself can be the answer.", "sample_input": "6 5\n4 7 10 6 5\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02641", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are an integer X and an integer sequence of length N: p_1, \\ldots, p_N.\n\nAmong the integers not contained in the sequence p_1, \\ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n0 \\leq N \\leq 100\n\n1 \\leq p_i \\leq 100\n\np_1, \\ldots, p_N are all distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX N\np_1 ... p_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n6 5\n4 7 10 6 5\n\nSample Output 1\n\n8\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the one nearest to 6 is 8.\n\nSample Input 2\n\n10 5\n4 7 10 6 5\n\nSample Output 2\n\n9\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the ones nearest to 10 are 9 and 11. We should print the smaller one, 9.\n\nSample Input 3\n\n100 0\n\nSample Output 3\n\n100\n\nWhen N = 0, the second line in the input will be empty. Also, as seen here, X itself can be the answer.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 313, "cpu_time_ms": 24, "memory_kb": 9212}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s865773960", "group_id": "codeNet:p02641", "input_text": "##C\nX,N = map(int,input().split())\nP = list(map(int,input().split()))\ni=0\n\nwhile X+i<=100:\n if X+i not in P:\n ans1 = X+i\n break\n i += 1\nwhile X-i>=0:\n if X-i not in P:\n ans2 = X-i\n break\n i += 1\nif ans1-X>=X-ans2:\n print(ans2)\nelse:\n print(ans1)", "language": "Python", "metadata": {"date": 1592186355, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02641.html", "problem_id": "p02641", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02641/input.txt", "sample_output_relpath": "derived/input_output/data/p02641/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02641/Python/s865773960.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s865773960", "user_id": "u799978560"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "##C\nX,N = map(int,input().split())\nP = list(map(int,input().split()))\ni=0\n\nwhile X+i<=100:\n if X+i not in P:\n ans1 = X+i\n break\n i += 1\nwhile X-i>=0:\n if X-i not in P:\n ans2 = X-i\n break\n i += 1\nif ans1-X>=X-ans2:\n print(ans2)\nelse:\n print(ans1)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are an integer X and an integer sequence of length N: p_1, \\ldots, p_N.\n\nAmong the integers not contained in the sequence p_1, \\ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n0 \\leq N \\leq 100\n\n1 \\leq p_i \\leq 100\n\np_1, \\ldots, p_N are all distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX N\np_1 ... p_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n6 5\n4 7 10 6 5\n\nSample Output 1\n\n8\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the one nearest to 6 is 8.\n\nSample Input 2\n\n10 5\n4 7 10 6 5\n\nSample Output 2\n\n9\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the ones nearest to 10 are 9 and 11. We should print the smaller one, 9.\n\nSample Input 3\n\n100 0\n\nSample Output 3\n\n100\n\nWhen N = 0, the second line in the input will be empty. Also, as seen here, X itself can be the answer.", "sample_input": "6 5\n4 7 10 6 5\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02641", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are an integer X and an integer sequence of length N: p_1, \\ldots, p_N.\n\nAmong the integers not contained in the sequence p_1, \\ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n0 \\leq N \\leq 100\n\n1 \\leq p_i \\leq 100\n\np_1, \\ldots, p_N are all distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX N\np_1 ... p_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n6 5\n4 7 10 6 5\n\nSample Output 1\n\n8\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the one nearest to 6 is 8.\n\nSample Input 2\n\n10 5\n4 7 10 6 5\n\nSample Output 2\n\n9\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the ones nearest to 10 are 9 and 11. We should print the smaller one, 9.\n\nSample Input 3\n\n100 0\n\nSample Output 3\n\n100\n\nWhen N = 0, the second line in the input will be empty. Also, as seen here, X itself can be the answer.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 291, "cpu_time_ms": 22, "memory_kb": 9192}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s243265556", "group_id": "codeNet:p02641", "input_text": "x,n = map(int,input().split())\n\nif n==0:\n print(x)\n \nelse:\n a = list(map(int,input().split()))\n if x not in a:\n print(x)\n else:\n for i in range(200):\n if x-i not in a:\n print(x-i)\n break\n if x+i not in a:\n print(x+i)\n break\n \n", "language": "Python", "metadata": {"date": 1592183799, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02641.html", "problem_id": "p02641", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02641/input.txt", "sample_output_relpath": "derived/input_output/data/p02641/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02641/Python/s243265556.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s243265556", "user_id": "u796044734"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "x,n = map(int,input().split())\n\nif n==0:\n print(x)\n \nelse:\n a = list(map(int,input().split()))\n if x not in a:\n print(x)\n else:\n for i in range(200):\n if x-i not in a:\n print(x-i)\n break\n if x+i not in a:\n print(x+i)\n break\n \n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are an integer X and an integer sequence of length N: p_1, \\ldots, p_N.\n\nAmong the integers not contained in the sequence p_1, \\ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n0 \\leq N \\leq 100\n\n1 \\leq p_i \\leq 100\n\np_1, \\ldots, p_N are all distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX N\np_1 ... p_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n6 5\n4 7 10 6 5\n\nSample Output 1\n\n8\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the one nearest to 6 is 8.\n\nSample Input 2\n\n10 5\n4 7 10 6 5\n\nSample Output 2\n\n9\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the ones nearest to 10 are 9 and 11. We should print the smaller one, 9.\n\nSample Input 3\n\n100 0\n\nSample Output 3\n\n100\n\nWhen N = 0, the second line in the input will be empty. Also, as seen here, X itself can be the answer.", "sample_input": "6 5\n4 7 10 6 5\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02641", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are an integer X and an integer sequence of length N: p_1, \\ldots, p_N.\n\nAmong the integers not contained in the sequence p_1, \\ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n0 \\leq N \\leq 100\n\n1 \\leq p_i \\leq 100\n\np_1, \\ldots, p_N are all distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX N\np_1 ... p_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n6 5\n4 7 10 6 5\n\nSample Output 1\n\n8\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the one nearest to 6 is 8.\n\nSample Input 2\n\n10 5\n4 7 10 6 5\n\nSample Output 2\n\n9\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the ones nearest to 10 are 9 and 11. We should print the smaller one, 9.\n\nSample Input 3\n\n100 0\n\nSample Output 3\n\n100\n\nWhen N = 0, the second line in the input will be empty. Also, as seen here, X itself can be the answer.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 282, "cpu_time_ms": 24, "memory_kb": 9124}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s507957622", "group_id": "codeNet:p02645", "input_text": "s = input()\nprint(s[:3])", "language": "Python", "metadata": {"date": 1592097018, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02645.html", "problem_id": "p02645", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02645/input.txt", "sample_output_relpath": "derived/input_output/data/p02645/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02645/Python/s507957622.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s507957622", "user_id": "u436173409"}, "prompt_components": {"gold_output": "tak\n", "input_to_evaluate": "s = input()\nprint(s[:3])", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWhen you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters.\nYou have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him.\n\nConstraints\n\n3 \\leq |S| \\leq 20\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint your answer.\n\nSample Input 1\n\ntakahashi\n\nSample Output 1\n\ntak\n\nSample Input 2\n\nnaohiro\n\nSample Output 2\n\nnao", "sample_input": "takahashi\n"}, "reference_outputs": ["tak\n"], "source_document_id": "p02645", "source_text": "Score : 100 points\n\nProblem Statement\n\nWhen you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters.\nYou have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him.\n\nConstraints\n\n3 \\leq |S| \\leq 20\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint your answer.\n\nSample Input 1\n\ntakahashi\n\nSample Output 1\n\ntak\n\nSample Input 2\n\nnaohiro\n\nSample Output 2\n\nnao", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 24, "cpu_time_ms": 25, "memory_kb": 9056}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s439429874", "group_id": "codeNet:p02646", "input_text": "A, V = [int(n) for n in input().split()]\nB, W = [int(n) for n in input().split()]\nT = int(input())\n\nif V <= W:\n print('NO')\n exit()\n\ntmp = abs(B - A) // abs(V - W)\n\nif B > A:\n va = [A + V * t for t in range(tmp, T+1)]\n vb = [B + W * t for t in range(tmp, T+1)]\nelse:\n va = [A - V * t for t in range(tmp, T+1)]\n vb = [B - W * t for t in range(tmp, T+1)]\n\nva_vb_and = list(set(va) & set(vb))\n\nif va_vb_and:\n print('YES')\n exit()\nprint('NO')\n", "language": "Python", "metadata": {"date": 1592103091, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02646.html", "problem_id": "p02646", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02646/input.txt", "sample_output_relpath": "derived/input_output/data/p02646/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02646/Python/s439429874.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s439429874", "user_id": "u668350270"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "A, V = [int(n) for n in input().split()]\nB, W = [int(n) for n in input().split()]\nT = int(input())\n\nif V <= W:\n print('NO')\n exit()\n\ntmp = abs(B - A) // abs(V - W)\n\nif B > A:\n va = [A + V * t for t in range(tmp, T+1)]\n vb = [B + W * t for t in range(tmp, T+1)]\nelse:\n va = [A - V * t for t in range(tmp, T+1)]\n vb = [B - W * t for t in range(tmp, T+1)]\n\nva_vb_and = list(set(va) & set(vb))\n\nif va_vb_and:\n print('YES')\n exit()\nprint('NO')\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTwo children are playing tag on a number line. (In the game of tag, the child called \"it\" tries to catch the other child.) The child who is \"it\" is now at coordinate A, and he can travel the distance of V per second.\nThe other child is now at coordinate B, and she can travel the distance of W per second.\n\nHe can catch her when his coordinate is the same as hers.\nDetermine whether he can catch her within T seconds (including exactly T seconds later).\nWe assume that both children move optimally.\n\nConstraints\n\n-10^9 \\leq A,B \\leq 10^9\n\n1 \\leq V,W \\leq 10^9\n\n1 \\leq T \\leq 10^9\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA V\nB W\nT\n\nOutput\n\nIf \"it\" can catch the other child, print YES; otherwise, print NO.\n\nSample Input 1\n\n1 2\n3 1\n3\n\nSample Output 1\n\nYES\n\nSample Input 2\n\n1 2\n3 2\n3\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n1 2\n3 3\n3\n\nSample Output 3\n\nNO", "sample_input": "1 2\n3 1\n3\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p02646", "source_text": "Score : 200 points\n\nProblem Statement\n\nTwo children are playing tag on a number line. (In the game of tag, the child called \"it\" tries to catch the other child.) The child who is \"it\" is now at coordinate A, and he can travel the distance of V per second.\nThe other child is now at coordinate B, and she can travel the distance of W per second.\n\nHe can catch her when his coordinate is the same as hers.\nDetermine whether he can catch her within T seconds (including exactly T seconds later).\nWe assume that both children move optimally.\n\nConstraints\n\n-10^9 \\leq A,B \\leq 10^9\n\n1 \\leq V,W \\leq 10^9\n\n1 \\leq T \\leq 10^9\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA V\nB W\nT\n\nOutput\n\nIf \"it\" can catch the other child, print YES; otherwise, print NO.\n\nSample Input 1\n\n1 2\n3 1\n3\n\nSample Output 1\n\nYES\n\nSample Input 2\n\n1 2\n3 2\n3\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n1 2\n3 3\n3\n\nSample Output 3\n\nNO", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 463, "cpu_time_ms": 2237, "memory_kb": 850592}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s896756561", "group_id": "codeNet:p02646", "input_text": "a, v = map(int, input().split())\nb, w = map(int, input().split())\nt = int(input())\ncount = 0\nfor i in range(t+1):\n if v*i == abs(b - a) + w*i:\n count = 1\n break\n else:\n pass\nprint(\"Yes\" if count == 1 else \"No\")", "language": "Python", "metadata": {"date": 1592097253, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02646.html", "problem_id": "p02646", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02646/input.txt", "sample_output_relpath": "derived/input_output/data/p02646/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02646/Python/s896756561.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s896756561", "user_id": "u701077471"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "a, v = map(int, input().split())\nb, w = map(int, input().split())\nt = int(input())\ncount = 0\nfor i in range(t+1):\n if v*i == abs(b - a) + w*i:\n count = 1\n break\n else:\n pass\nprint(\"Yes\" if count == 1 else \"No\")", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTwo children are playing tag on a number line. (In the game of tag, the child called \"it\" tries to catch the other child.) The child who is \"it\" is now at coordinate A, and he can travel the distance of V per second.\nThe other child is now at coordinate B, and she can travel the distance of W per second.\n\nHe can catch her when his coordinate is the same as hers.\nDetermine whether he can catch her within T seconds (including exactly T seconds later).\nWe assume that both children move optimally.\n\nConstraints\n\n-10^9 \\leq A,B \\leq 10^9\n\n1 \\leq V,W \\leq 10^9\n\n1 \\leq T \\leq 10^9\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA V\nB W\nT\n\nOutput\n\nIf \"it\" can catch the other child, print YES; otherwise, print NO.\n\nSample Input 1\n\n1 2\n3 1\n3\n\nSample Output 1\n\nYES\n\nSample Input 2\n\n1 2\n3 2\n3\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n1 2\n3 3\n3\n\nSample Output 3\n\nNO", "sample_input": "1 2\n3 1\n3\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p02646", "source_text": "Score : 200 points\n\nProblem Statement\n\nTwo children are playing tag on a number line. (In the game of tag, the child called \"it\" tries to catch the other child.) The child who is \"it\" is now at coordinate A, and he can travel the distance of V per second.\nThe other child is now at coordinate B, and she can travel the distance of W per second.\n\nHe can catch her when his coordinate is the same as hers.\nDetermine whether he can catch her within T seconds (including exactly T seconds later).\nWe assume that both children move optimally.\n\nConstraints\n\n-10^9 \\leq A,B \\leq 10^9\n\n1 \\leq V,W \\leq 10^9\n\n1 \\leq T \\leq 10^9\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA V\nB W\nT\n\nOutput\n\nIf \"it\" can catch the other child, print YES; otherwise, print NO.\n\nSample Input 1\n\n1 2\n3 1\n3\n\nSample Output 1\n\nYES\n\nSample Input 2\n\n1 2\n3 2\n3\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n1 2\n3 3\n3\n\nSample Output 3\n\nNO", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 237, "cpu_time_ms": 1831, "memory_kb": 63064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s933123468", "group_id": "codeNet:p02657", "input_text": "a, b = map(int, input().split())\nprint(a*b)", "language": "Python", "metadata": {"date": 1590973949, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02657.html", "problem_id": "p02657", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02657/input.txt", "sample_output_relpath": "derived/input_output/data/p02657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02657/Python/s933123468.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s933123468", "user_id": "u732870425"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "a, b = map(int, input().split())\nprint(a*b)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02657", "source_text": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 43, "cpu_time_ms": 24, "memory_kb": 9160}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s511759215", "group_id": "codeNet:p02657", "input_text": "a, b = map(int, input().split())\nprint(a*b)\n", "language": "Python", "metadata": {"date": 1590973488, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02657.html", "problem_id": "p02657", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02657/input.txt", "sample_output_relpath": "derived/input_output/data/p02657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02657/Python/s511759215.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s511759215", "user_id": "u280552586"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "a, b = map(int, input().split())\nprint(a*b)\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02657", "source_text": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 44, "cpu_time_ms": 19, "memory_kb": 9148}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s978753171", "group_id": "codeNet:p02657", "input_text": "a,b=map(int,input().split(' '))\nprint(a*b)", "language": "Python", "metadata": {"date": 1590973444, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02657.html", "problem_id": "p02657", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02657/input.txt", "sample_output_relpath": "derived/input_output/data/p02657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02657/Python/s978753171.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s978753171", "user_id": "u607884285"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "a,b=map(int,input().split(' '))\nprint(a*b)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02657", "source_text": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 42, "cpu_time_ms": 22, "memory_kb": 9148}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s978040815", "group_id": "codeNet:p02657", "input_text": "a,b = map(int,input().split())\nprint(a*b)", "language": "Python", "metadata": {"date": 1590973231, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02657.html", "problem_id": "p02657", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02657/input.txt", "sample_output_relpath": "derived/input_output/data/p02657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02657/Python/s978040815.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s978040815", "user_id": "u958820283"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "a,b = map(int,input().split())\nprint(a*b)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02657", "source_text": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 41, "cpu_time_ms": 23, "memory_kb": 9152}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s376371601", "group_id": "codeNet:p02657", "input_text": "a,b=map(int,input().split())\nprint(a*b)", "language": "Python", "metadata": {"date": 1590973228, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02657.html", "problem_id": "p02657", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02657/input.txt", "sample_output_relpath": "derived/input_output/data/p02657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02657/Python/s376371601.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s376371601", "user_id": "u345483150"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "a,b=map(int,input().split())\nprint(a*b)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02657", "source_text": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 39, "cpu_time_ms": 22, "memory_kb": 9152}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s556868630", "group_id": "codeNet:p02661", "input_text": "def main():\n n = int(input())\n A, B = [None]*n, [None]*n\n for i in range(n):\n A[i], B[i] = map(int, input().split())\n A.sort()\n B.sort()\n if n%2 == 0:\n p = (A[n//2-1] + A[n//2])/2\n q = (B[n//2-1] + B[n//2])/2\n print(int((q-p+0.5)*2))\n else:\n print(B[n//2] - A[n//2] + 1)\n\nif __name__ == \"__main__\":\n main()", "language": "Python", "metadata": {"date": 1591109676, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02661.html", "problem_id": "p02661", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02661/input.txt", "sample_output_relpath": "derived/input_output/data/p02661/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02661/Python/s556868630.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s556868630", "user_id": "u071680334"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "def main():\n n = int(input())\n A, B = [None]*n, [None]*n\n for i in range(n):\n A[i], B[i] = map(int, input().split())\n A.sort()\n B.sort()\n if n%2 == 0:\n p = (A[n//2-1] + A[n//2])/2\n q = (B[n//2-1] + B[n//2])/2\n print(int((q-p+0.5)*2))\n else:\n print(B[n//2] - A[n//2] + 1)\n\nif __name__ == \"__main__\":\n main()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N integers X_1, X_2, \\cdots, X_N, and we know that A_i \\leq X_i \\leq B_i.\nFind the number of different values that the median of X_1, X_2, \\cdots, X_N can take.\n\nNotes\n\nThe median of X_1, X_2, \\cdots, X_N is defined as follows. Let x_1, x_2, \\cdots, x_N be the result of sorting X_1, X_2, \\cdots, X_N in ascending order.\n\nIf N is odd, the median is x_{(N+1)/2};\n\nif N is even, the median is (x_{N/2} + x_{N/2+1}) / 2.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 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\nA_1 B_1\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2\n1 2\n2 3\n\nSample Output 1\n\n3\n\nIf X_1 = 1 and X_2 = 2, the median is \\frac{3}{2};\n\nif X_1 = 1 and X_2 = 3, the median is 2;\n\nif X_1 = 2 and X_2 = 2, the median is 2;\n\nif X_1 = 2 and X_2 = 3, the median is \\frac{5}{2}.\n\nThus, the median can take three values: \\frac{3}{2}, 2, and \\frac{5}{2}.\n\nSample Input 2\n\n3\n100 100\n10 10000\n1 1000000000\n\nSample Output 2\n\n9991", "sample_input": "2\n1 2\n2 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02661", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N integers X_1, X_2, \\cdots, X_N, and we know that A_i \\leq X_i \\leq B_i.\nFind the number of different values that the median of X_1, X_2, \\cdots, X_N can take.\n\nNotes\n\nThe median of X_1, X_2, \\cdots, X_N is defined as follows. Let x_1, x_2, \\cdots, x_N be the result of sorting X_1, X_2, \\cdots, X_N in ascending order.\n\nIf N is odd, the median is x_{(N+1)/2};\n\nif N is even, the median is (x_{N/2} + x_{N/2+1}) / 2.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 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\nA_1 B_1\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2\n1 2\n2 3\n\nSample Output 1\n\n3\n\nIf X_1 = 1 and X_2 = 2, the median is \\frac{3}{2};\n\nif X_1 = 1 and X_2 = 3, the median is 2;\n\nif X_1 = 2 and X_2 = 2, the median is 2;\n\nif X_1 = 2 and X_2 = 3, the median is \\frac{5}{2}.\n\nThus, the median can take three values: \\frac{3}{2}, 2, and \\frac{5}{2}.\n\nSample Input 2\n\n3\n100 100\n10 10000\n1 1000000000\n\nSample Output 2\n\n9991", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 365, "cpu_time_ms": 434, "memory_kb": 25488}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s768692127", "group_id": "codeNet:p02661", "input_text": "n=int(input())\nab = []\nfor _ in range(n):\n a,b=map(int,input().split())\n ab.append((a,b))\n\n\npool = []\nfor a,b in ab:\n af = sum([1 for a1,b1 in list(ab) if a1 <= a <= b1])\n bf = sum([1 for a1,b1 in list(ab) if a1 <= b <= b1])\n pool.append((a,af))\n pool.append((b, bf))\n\n# print(pool)\n\nmax_pool = max([p[1] for p in pool])\npool = [p[0] for p in pool if p[1] >= max_pool-1]\n# print(pool)\n\nif max_pool%2 == 1:\n print(max(pool) - min(pool) + 1)\nelse:\n print(max(pool) - min(pool) + 1)", "language": "Python", "metadata": {"date": 1590977744, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02661.html", "problem_id": "p02661", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02661/input.txt", "sample_output_relpath": "derived/input_output/data/p02661/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02661/Python/s768692127.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s768692127", "user_id": "u693048766"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "n=int(input())\nab = []\nfor _ in range(n):\n a,b=map(int,input().split())\n ab.append((a,b))\n\n\npool = []\nfor a,b in ab:\n af = sum([1 for a1,b1 in list(ab) if a1 <= a <= b1])\n bf = sum([1 for a1,b1 in list(ab) if a1 <= b <= b1])\n pool.append((a,af))\n pool.append((b, bf))\n\n# print(pool)\n\nmax_pool = max([p[1] for p in pool])\npool = [p[0] for p in pool if p[1] >= max_pool-1]\n# print(pool)\n\nif max_pool%2 == 1:\n print(max(pool) - min(pool) + 1)\nelse:\n print(max(pool) - min(pool) + 1)", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N integers X_1, X_2, \\cdots, X_N, and we know that A_i \\leq X_i \\leq B_i.\nFind the number of different values that the median of X_1, X_2, \\cdots, X_N can take.\n\nNotes\n\nThe median of X_1, X_2, \\cdots, X_N is defined as follows. Let x_1, x_2, \\cdots, x_N be the result of sorting X_1, X_2, \\cdots, X_N in ascending order.\n\nIf N is odd, the median is x_{(N+1)/2};\n\nif N is even, the median is (x_{N/2} + x_{N/2+1}) / 2.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 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\nA_1 B_1\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2\n1 2\n2 3\n\nSample Output 1\n\n3\n\nIf X_1 = 1 and X_2 = 2, the median is \\frac{3}{2};\n\nif X_1 = 1 and X_2 = 3, the median is 2;\n\nif X_1 = 2 and X_2 = 2, the median is 2;\n\nif X_1 = 2 and X_2 = 3, the median is \\frac{5}{2}.\n\nThus, the median can take three values: \\frac{3}{2}, 2, and \\frac{5}{2}.\n\nSample Input 2\n\n3\n100 100\n10 10000\n1 1000000000\n\nSample Output 2\n\n9991", "sample_input": "2\n1 2\n2 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02661", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N integers X_1, X_2, \\cdots, X_N, and we know that A_i \\leq X_i \\leq B_i.\nFind the number of different values that the median of X_1, X_2, \\cdots, X_N can take.\n\nNotes\n\nThe median of X_1, X_2, \\cdots, X_N is defined as follows. Let x_1, x_2, \\cdots, x_N be the result of sorting X_1, X_2, \\cdots, X_N in ascending order.\n\nIf N is odd, the median is x_{(N+1)/2};\n\nif N is even, the median is (x_{N/2} + x_{N/2+1}) / 2.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 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\nA_1 B_1\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2\n1 2\n2 3\n\nSample Output 1\n\n3\n\nIf X_1 = 1 and X_2 = 2, the median is \\frac{3}{2};\n\nif X_1 = 1 and X_2 = 3, the median is 2;\n\nif X_1 = 2 and X_2 = 2, the median is 2;\n\nif X_1 = 2 and X_2 = 3, the median is \\frac{5}{2}.\n\nThus, the median can take three values: \\frac{3}{2}, 2, and \\frac{5}{2}.\n\nSample Input 2\n\n3\n100 100\n10 10000\n1 1000000000\n\nSample Output 2\n\n9991", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 503, "cpu_time_ms": 2207, "memory_kb": 38988}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s891203449", "group_id": "codeNet:p02661", "input_text": "def main(sample_file = ''):\n\n \"\"\" convenient functions\n # for i, a in enumerate(iterable)\n # q, mod = divmod(a, b)\n # divmod(x, y) returns the tuple (x//y, x%y)\n # Higher-order function: reduce(operator.mul, xyz_count, 1)\n # manage median(s) using two heapq https://atcoder.jp/contests/abc127/tasks/abc127_f\n \"\"\"\n\n \"\"\"convenient decorator\n # @functools.lru_cache():\n # to facilitate use of recursive function\n # ex:\n # from functools import lru_cache\n # import sys\n # sys.setrecursionlimit(10**9)\n # @lru_cache(maxsize=None)\n # def fib(n):\n # if n < 2:\n # return n\n # return fib(n-1) + fib(n-2)\n # print(fib(1000))\n \"\"\"\n \n # import numpy as np\n import sys\n sys.setrecursionlimit(10**7)\n from itertools import accumulate, combinations, permutations, product # https://docs.python.org/ja/3/library/itertools.html\n # accumulate() returns iterator! to get list: list(accumulate())\n from math import factorial, ceil, floor, sqrt\n def factorize(n):\n \"\"\"return the factors of the Arg and count of each factor\n \n Args:\n n (long): number to be resolved into factors\n \n Returns:\n list of tuples: factorize(220) returns [(2, 2), (5, 1), (11, 1)]\n \"\"\"\n fct = [] # prime factor\n b, e = 2, 0 # base, exponent\n while b * b <= n:\n while n % b == 0:\n n = n // b\n e = e + 1\n if e > 0:\n fct.append((b, e))\n b, e = b + 1, 0\n if n > 1:\n fct.append((n, 1))\n return fct\n def combinations_count(n, r): \n \"\"\"Return the number of selecting r pieces of items from n kinds of items.\n \n Args:\n n (long): number\n r (long): number\n \n Raises:\n Exception: not defined when n or r is negative\n \n Returns:\n long: number\n \"\"\"\n # TODO: How should I do when n - r is negative?\n if n < 0 or r < 0:\n raise Exception('combinations_count(n, r) not defined when n or r is negative')\n if n - r < r: r = n - r\n if r < 0: return 0\n if r == 0: return 1\n if r == 1: return n\n numerator = [n - r + k + 1 for k in range(r)]\n denominator = [k + 1 for k in range(r)]\n for p in range(2,r+1):\n pivot = denominator[p - 1]\n if pivot > 1:\n offset = (n - r) % p\n for k in range(p-1,r,p):\n numerator[k - offset] /= pivot\n denominator[k] /= pivot\n result = 1\n for k in range(r):\n if numerator[k] > 1:\n result *= int(numerator[k])\n return result\n def combinations_with_replacement_count(n, r):\n \"\"\"Return the number of selecting r pieces of items from n kinds of items allowing individual elements to be repeated more than once.\n \n Args:\n n (long): number\n r (long): number\n \n Raises:\n Exception: not defined when n or r is negative\n \n Returns:\n long: number\n \"\"\"\n if n < 0 or r < 0:\n raise Exception('combinations_with_replacement_count(n, r) not defined when n or r is negative')\n elif n == 0:\n return 1\n else:\n return combinations_count(n + r - 1, r)\n from bisect import bisect_left, bisect_right\n from collections import deque, Counter, defaultdict # https://docs.python.org/ja/3/library/collections.html#collections.deque\n from heapq import heapify, heappop, heappush, heappushpop, heapreplace,nlargest,nsmallest # https://docs.python.org/ja/3/library/heapq.html\n from copy import deepcopy, copy # https://docs.python.org/ja/3/library/copy.html\n import operator\n from operator import itemgetter #sort \n # ex1: List.sort(key=itemgetter(1))\n # ex2: sorted(tuples, key=itemgetter(1,2))\n from functools import reduce, lru_cache\n def chmin(x, y):\n \"\"\"change minimum\n if x > y, x = y and return (x, True).\n convenient when solving problems of dp[i]\n \n Args:\n x (long): current minimum value\n y (long): potential minimum value\n \n Returns:\n (x, bool): (x, True) when updated, else (x, False)\n \"\"\"\n if x > y:\n x = y\n return (x, True)\n else:\n return (x, False)\n def chmax(x, y):\n \"\"\"change maximum\n if x < y, x = y and return (x, True).\n convenient when solving problems of dp[i]\n \n Args:\n x (long): current maximum value\n y (long): potential maximum value\n \n Returns:\n (x, bool): (x, True) when updated, else (x, False)\n \"\"\"\n if x < y:\n x = y\n return (x, True)\n else:\n return (x, False)\n\n from fractions import gcd # Deprecated since version 3.5: Use math.gcd() instead.\n def gcds(numbers):\n return reduce(gcd, numbers)\n def lcm(x, y):\n return (x * y) // gcd(x, y)\n def lcms(numbers):\n return reduce(lcm, numbers, 1)\n def make_divisors(n, reversed=False):\n \"\"\"create list of divisors\n \n Args:\n number (int): number from which list of divisors is created\n reversed (bool, optional): ascending order if False. Defaults to False.\n \n Returns:\n list: list of divisors\n \"\"\"\n divisors = set()\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.add(i)\n divisors.add(n//i)\n return sorted(list(divisors),reverse=reversed)\n \n # first create factorial_list\n # fac_list = mod_factorial_list(n)\n INF = 10 ** 18\n MOD = 10 ** 9 + 7\n AtoZ = list('abcdefghijklmnopqrsruvwxyz') # 26\n modpow = lambda a, n, p = MOD: pow(a, n, p) # Recursive function in python is slow!\n def modinv(a, p = MOD):\n # evaluate reciprocal using Fermat's little theorem:\n # a**(p-1) is identical to 1 (mod p) when a and p is coprime\n return modpow(a, p-2, p)\n def modinv_list(n, p = MOD):\n if n <= 1:\n return [0,1][:n+1]\n else:\n inv_t = [0,1]\n for i in range(2, n+1):\n inv_t += [inv_t[p % i] * (p - int(p / i)) % p]\n return inv_t\n def modfactorial_list(n, p = MOD):\n if n == 0:\n return [1]\n else:\n l = [0] * (n+1)\n tmp = 1\n for i in range(1, n+1):\n tmp = tmp * i % p\n l[i] = tmp\n return l\n def modcomb(n, k, fac_list = [], p = MOD):\n # fac_list = modfactorial_list(100)\n # print(modcomb(100, 5, modfactorial_list(100)))\n from math import factorial\n if n < 0 or k < 0 or n < k: return 0\n if n == 0 or k == 0: return 1\n if len(fac_list) <= n:\n a = factorial(n) % p\n b = factorial(k) % p\n c = factorial(n-k) % p\n else:\n a = fac_list[n]\n b = fac_list[k]\n c = fac_list[n-k]\n return (a * modpow(b, p-2, p) * modpow(c, p-2, p)) % p\n def modadd(a, b, p = MOD):\n return (a + b) % MOD\n def modsub(a, b, p = MOD):\n return (a - b) % p\n def modmul(a, b, p = MOD):\n return ((a % p) * (b % p)) % p\n def moddiv(a, b, p = MOD):\n return modmul(a, modpow(b, p-2, p))\n\n class UnionFindTree:\n \"\"\"union find tree class\n TODO: fix this description...\n how to use (example):\n >> uf = UnionFindTree(N) \n >> if uf.find_root(a) == uf.find_root(b):\n >> do something\n >> else:\n >> do something\n >> uf.unite(a, b)\n \"\"\"\n def __init__(self, N):\n self.root = [-1] * (N+1)\n self.rank = [0] * (N+1)\n self.connected_num = [1] * (N+1)\n \n def find_root(self,x):\n root = self.root\n while root[x] != -1:\n x = root[x]\n return x\n \n def unite(self,x,y):\n root = self.root\n rank = self.rank\n connected_num = self.connected_num\n find_root = self.find_root\n \n rx = find_root(x)\n ry = find_root(y)\n if rx != ry:\n if rank[rx] < rank[ry]:\n root[rx] = ry\n rx,ry = ry,rx\n else:\n if rank[rx] == rank[ry]:\n rank[rx] += 1\n root[ry] = rx \n connected_num[rx] += connected_num[ry]\n\n class SegTree:\n \"\"\"\n ref: https://qiita.com/takayg1/items/c811bd07c21923d7ec69\n init(init_val, ide_ele): 配列init_valで初期化 O(N)\n update(k, x): k番目の値をxに更新 O(logN)\n query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)\n \"\"\"\n def __init__(self, init_val, segfunc, ide_ele):\n \"\"\"\n init_val: 配列の初期値\n segfunc: 区間にしたい操作\n ide_ele: 単位元\n n: 要素数\n num: n以上の最小の2のべき乗\n tree: セグメント木(1-index)\n \"\"\"\n n = len(init_val)\n self.segfunc = segfunc\n self.ide_ele = ide_ele\n self.num = 1 << (n - 1).bit_length()\n self.tree = [ide_ele] * 2 * self.num\n # 配列の値を葉にセット\n for i in range(n):\n self.tree[self.num + i] = init_val[i]\n # 構築していく\n for i in range(self.num - 1, 0, -1):\n self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])\n\n def update(self, k, x):\n \"\"\"\n k番目の値をxに更新\n k: index(0-index)\n x: update value\n \"\"\"\n k += self.num\n self.tree[k] = x\n while k > 1:\n self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])\n k >>= 1\n\n def query(self, l, r):\n \"\"\"\n [l, r)のsegfuncしたものを得る\n l: index(0-index)\n r: index(0-index)\n \"\"\"\n res = self.ide_ele\n l += self.num\n r += self.num\n while l < r:\n if l & 1:\n res = self.segfunc(res, self.tree[l])\n l += 1\n if r & 1:\n res = self.segfunc(res, self.tree[r - 1])\n l >>= 1\n r >>= 1\n return res\n\n # ************ Graph ************\n # Graph: https://en.wikipedia.org/wiki/Directed_graph\n # 最短経路問題: https://ja.wikipedia.org/wiki/%E6%9C%80%E7%9F%AD%E7%B5%8C%E8%B7%AF%E5%95%8F%E9%A1%8C\n \n # Bellman-Ford: O(|V||E|). Use this if there exists an edge with negative length in the graph\n # After N steps, the shortest path has converded if there doesn't exist an cycle of edges with negative\n # Watch out: d[N] == d[2*N] doesn't necessarily mean the graph doesn't have negative cycle\n # ref: https://www.youtube.com/watch?v=1Z6ofKN03_Y\n\n def BellmanFord(N, M, ABC, vertex_start, vertex_end, value_if_inf = -1, find_shortest = False):\n \"\"\"to calculate furthest or shortest length between vertex_start and vertex_end using BellmanFord algorithm\n \n Args:\n N (int): number of vertices\n M (int): number of edges\n ABC (list): [(ai, bi, ci) for _ in range(N)] where i-th edge is directed from vertex ai to vertex bi and the length is ci \n vertex_start (int): start vertex. usually use 0.\n vertex_end (int): end vertex. usually use N-1.\n value_if_inf (int or string as you like, optional): value you want when the furthest (or shortest) distance is infinite (or -infinite). Defaults to -1.\n find_shortest (bool, optional): choose False to find furthest path. Defaults to False.\n \n Returns:\n int or string: normally int (but can be str if you set value_if_inf to str)\n \n Example:\n N, M, P = R()\n ABC = [R() for _ in range(M)]\n ABC = [(a-1, b-1, c-P) for a, b, c in ABC]\n print(BellmanFord(N, M, ABC, 0, N-1, value_if_inf = 'inf'))\n\n \"\"\"\n\n def make_reachable_list(N, M, ABC, vertex_start, vertex_end):\n reachable_to_direct = defaultdict(list)\n reachable_from_direct = defaultdict(list)\n reachable_from_start = [False] * N\n reachable_to_end = [False] * N\n reachable_from_start[vertex_start] = True\n reachable_to_end[vertex_end] = True\n reachable_from_both_sides = [False] * N\n dfs_from_start = []\n dfs_to_end = []\n for a, b, c in ABC:\n reachable_to_direct[a].append(b)\n reachable_from_direct[b].append(a)\n if a == vertex_start:\n dfs_from_start.append(b)\n reachable_from_start[b] = True\n if b == vertex_end:\n dfs_to_end.append(a)\n reachable_to_end[a] = True\n while dfs_from_start:\n v = dfs_from_start.pop()\n for i in reachable_to_direct[v]:\n if not reachable_from_start[i]:\n reachable_from_start[i] = True\n dfs_from_start.append(i)\n while dfs_to_end:\n v = dfs_to_end.pop()\n for i in reachable_from_direct[v]:\n if not reachable_to_end[i]:\n reachable_to_end[i] = True\n dfs_to_end.append(i)\n for i in range(N):\n reachable_from_both_sides[i] = reachable_from_start[i] and reachable_to_end[i]\n return reachable_from_both_sides\n \n reachable_from_both_sides = make_reachable_list(N, M, ABC, vertex_start, vertex_end)\n \n if find_shortest:\n dist = [INF for i in range(N)]\n else:\n dist = [-INF for i in range(N)]\n \n dist[vertex_start] = 0\n for i in range(N):\n updated = False\n for a, b, c in ABC:\n if not reachable_from_both_sides[a]:\n continue\n elif find_shortest:\n update_condition = dist[a] + c < dist[b]\n else:\n update_condition = dist[a] + c > dist[b]\n if dist[a] != INF and update_condition:\n dist[b] = dist[a] + c\n updated = True\n if i == N-1:\n return value_if_inf\n if not updated:\n break\n return dist[vertex_end]\n\n # Warshall Floyd O(V**3)\n def warshall_floyd(number_vertex, XYD, shift_one_for_vertex=False):\n # ref: https://juppy.hatenablog.com/entry/2018/11/01/%E8%9F%BB%E6%9C%AC_python_%E5%85%A8%E7%82%B9%E5%AF%BE%E6%9C%80%E7%9F%AD%E7%B5%8C%E8%B7%AF%E6%B3%95%EF%BC%88%E3%83%AF%E3%83%BC%E3%82%B7%E3%83%A3%E3%83%AB%E3%83%95%E3%83%AD%E3%82%A4%E3%83%89%E6%B3%95\n # number_vertex: len(vertex)\n # XYD: list of distance from x to y\n # shift_one_for_vertex: XYDの値が1~Nの時(0~N-1でない時)に調整するフラグ。\n # d[i][j]: iからjへの最短距離\n d = [[float(\"inf\")]*number_vertex for i in range(number_vertex)]\n for x, y, dist in XYD:\n if shift_one_for_vertex:\n x = x - 1\n y = y - 1\n d[x][y] = dist\n d[y][x] = dist\n for i in range(number_vertex):\n d[i][i] = 0 # distance of same vertex is 0\n for k in range(number_vertex):\n for i in range(number_vertex):\n for j in range(number_vertex):\n d[i][j] = min(d[i][j],d[i][k] + d[k][j])\n return d\n\n\n \"\"\" initialize variables and set inputs\n # initialize variables\n # to initialize list, use [0] * n\n # to initialize two dimentional array:\n # ex) [[0] * N for _ in range(N)]\n # ex2) dp = [[0] * (N+1) for _ in range(W*2)]\n # set inputs\n # put inputs between specific values (almost as quickly)\n # ex) S = [-INF] + [int(r()) for _ in range(A)] + [INF]\n # open(0).read() is sometimes useful:\n # ex) n, m, *x = map(int, open(0).read().split())\n # min(x[::2]) - max(x[1::2])\n # ex2) *x, = map(int, open(0).read().split())\n # don't forget to add comma after *x if only one variable is used\n # preprocessing\n # transpose = [x for x in zip(*data)]\n # ex) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [(1, 4, 7), (2, 5, 8), (3, 6, 9)]\n # flat = [flatten for inner in data for flatten in inner]\n # ex) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [1, 2, 3, 4, 5, 6, 7, 8, 9]\n # calculate and output\n # output pattern\n # ex1) print(*l) => when l = [2, 5, 6], printed 2 5 6\n \"\"\"\n\n # functions to read input\n r = lambda: sys.stdin.readline().strip()\n r_int = lambda: int(r())\n r_float = lambda: float(r())\n R = lambda: list(map(int, r().split()))\n R_str = lambda: r().split()\n R_map = lambda: map(int, r().split())\n R_float = lambda: list(map(float, r().split()))\n R_tuple = lambda: tuple(map(int, r().split()))\n\n \"\"\" how to treat input\n # single int: int(r())\n # single string: r()\n # single float: float(r())\n # line int: R()\n # line string: r().split()\n # line (str, int, int): [j if i == 0 else int(j) for i, j in enumerate(r().split())]\n # lines int: [R() for _ in range(n)]\n \"\"\"\n\n # for test\n if sample_file:\n sys.stdin = open(sample_file)\n \n # ----------------------------------\n # main\n #%%\n N = r_int()\n AB = [R() for _ in range(N)]\n \n ab_0 = sorted(AB, key=itemgetter(0))\n ab_1 = sorted(AB, key=itemgetter(1))\n \n if N%2 == 0: # 偶数の時\n left = N//2 - 1\n right = N//2\n l = ab_0[left][0] + ab_0[right][0]\n r = ab_1[left][1] + ab_1[right][1]\n print(r-l+1)\n else:\n c = N//2\n l = ab_0[c][0]\n r = ab_1[c][1]\n print(r-l+1)\n \n #%%\n # end of main\n # ----------------------------------\n\n \"\"\"memo: how to use defaultdict of list\n # initialize\n Dic = defaultdict(list)\n # append / extend\n Dic[x].append(y)\n # three methods for loop: keys(), values(), items()\n for k, v in Dic.items():\n \"\"\"\n \n \"\"\"memo: how to solve binary problems\n # to make binary digits text\n >>> a = 5\n >>> bin_str_a = format(a, '#06b')\n >>> print(bin_str_a)\n 0b0101 # first 2 strings (='0b') indicates it is binary\n \"\"\"\n \n \"\"\"memo: how to solve the problem\n creating simple test/answer\n greed\n simple dp\n graph\n \"\"\"\n\nif __name__ == '__main__':\n main()", "language": "Python", "metadata": {"date": 1590976545, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02661.html", "problem_id": "p02661", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02661/input.txt", "sample_output_relpath": "derived/input_output/data/p02661/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02661/Python/s891203449.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s891203449", "user_id": "u988402778"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "def main(sample_file = ''):\n\n \"\"\" convenient functions\n # for i, a in enumerate(iterable)\n # q, mod = divmod(a, b)\n # divmod(x, y) returns the tuple (x//y, x%y)\n # Higher-order function: reduce(operator.mul, xyz_count, 1)\n # manage median(s) using two heapq https://atcoder.jp/contests/abc127/tasks/abc127_f\n \"\"\"\n\n \"\"\"convenient decorator\n # @functools.lru_cache():\n # to facilitate use of recursive function\n # ex:\n # from functools import lru_cache\n # import sys\n # sys.setrecursionlimit(10**9)\n # @lru_cache(maxsize=None)\n # def fib(n):\n # if n < 2:\n # return n\n # return fib(n-1) + fib(n-2)\n # print(fib(1000))\n \"\"\"\n \n # import numpy as np\n import sys\n sys.setrecursionlimit(10**7)\n from itertools import accumulate, combinations, permutations, product # https://docs.python.org/ja/3/library/itertools.html\n # accumulate() returns iterator! to get list: list(accumulate())\n from math import factorial, ceil, floor, sqrt\n def factorize(n):\n \"\"\"return the factors of the Arg and count of each factor\n \n Args:\n n (long): number to be resolved into factors\n \n Returns:\n list of tuples: factorize(220) returns [(2, 2), (5, 1), (11, 1)]\n \"\"\"\n fct = [] # prime factor\n b, e = 2, 0 # base, exponent\n while b * b <= n:\n while n % b == 0:\n n = n // b\n e = e + 1\n if e > 0:\n fct.append((b, e))\n b, e = b + 1, 0\n if n > 1:\n fct.append((n, 1))\n return fct\n def combinations_count(n, r): \n \"\"\"Return the number of selecting r pieces of items from n kinds of items.\n \n Args:\n n (long): number\n r (long): number\n \n Raises:\n Exception: not defined when n or r is negative\n \n Returns:\n long: number\n \"\"\"\n # TODO: How should I do when n - r is negative?\n if n < 0 or r < 0:\n raise Exception('combinations_count(n, r) not defined when n or r is negative')\n if n - r < r: r = n - r\n if r < 0: return 0\n if r == 0: return 1\n if r == 1: return n\n numerator = [n - r + k + 1 for k in range(r)]\n denominator = [k + 1 for k in range(r)]\n for p in range(2,r+1):\n pivot = denominator[p - 1]\n if pivot > 1:\n offset = (n - r) % p\n for k in range(p-1,r,p):\n numerator[k - offset] /= pivot\n denominator[k] /= pivot\n result = 1\n for k in range(r):\n if numerator[k] > 1:\n result *= int(numerator[k])\n return result\n def combinations_with_replacement_count(n, r):\n \"\"\"Return the number of selecting r pieces of items from n kinds of items allowing individual elements to be repeated more than once.\n \n Args:\n n (long): number\n r (long): number\n \n Raises:\n Exception: not defined when n or r is negative\n \n Returns:\n long: number\n \"\"\"\n if n < 0 or r < 0:\n raise Exception('combinations_with_replacement_count(n, r) not defined when n or r is negative')\n elif n == 0:\n return 1\n else:\n return combinations_count(n + r - 1, r)\n from bisect import bisect_left, bisect_right\n from collections import deque, Counter, defaultdict # https://docs.python.org/ja/3/library/collections.html#collections.deque\n from heapq import heapify, heappop, heappush, heappushpop, heapreplace,nlargest,nsmallest # https://docs.python.org/ja/3/library/heapq.html\n from copy import deepcopy, copy # https://docs.python.org/ja/3/library/copy.html\n import operator\n from operator import itemgetter #sort \n # ex1: List.sort(key=itemgetter(1))\n # ex2: sorted(tuples, key=itemgetter(1,2))\n from functools import reduce, lru_cache\n def chmin(x, y):\n \"\"\"change minimum\n if x > y, x = y and return (x, True).\n convenient when solving problems of dp[i]\n \n Args:\n x (long): current minimum value\n y (long): potential minimum value\n \n Returns:\n (x, bool): (x, True) when updated, else (x, False)\n \"\"\"\n if x > y:\n x = y\n return (x, True)\n else:\n return (x, False)\n def chmax(x, y):\n \"\"\"change maximum\n if x < y, x = y and return (x, True).\n convenient when solving problems of dp[i]\n \n Args:\n x (long): current maximum value\n y (long): potential maximum value\n \n Returns:\n (x, bool): (x, True) when updated, else (x, False)\n \"\"\"\n if x < y:\n x = y\n return (x, True)\n else:\n return (x, False)\n\n from fractions import gcd # Deprecated since version 3.5: Use math.gcd() instead.\n def gcds(numbers):\n return reduce(gcd, numbers)\n def lcm(x, y):\n return (x * y) // gcd(x, y)\n def lcms(numbers):\n return reduce(lcm, numbers, 1)\n def make_divisors(n, reversed=False):\n \"\"\"create list of divisors\n \n Args:\n number (int): number from which list of divisors is created\n reversed (bool, optional): ascending order if False. Defaults to False.\n \n Returns:\n list: list of divisors\n \"\"\"\n divisors = set()\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.add(i)\n divisors.add(n//i)\n return sorted(list(divisors),reverse=reversed)\n \n # first create factorial_list\n # fac_list = mod_factorial_list(n)\n INF = 10 ** 18\n MOD = 10 ** 9 + 7\n AtoZ = list('abcdefghijklmnopqrsruvwxyz') # 26\n modpow = lambda a, n, p = MOD: pow(a, n, p) # Recursive function in python is slow!\n def modinv(a, p = MOD):\n # evaluate reciprocal using Fermat's little theorem:\n # a**(p-1) is identical to 1 (mod p) when a and p is coprime\n return modpow(a, p-2, p)\n def modinv_list(n, p = MOD):\n if n <= 1:\n return [0,1][:n+1]\n else:\n inv_t = [0,1]\n for i in range(2, n+1):\n inv_t += [inv_t[p % i] * (p - int(p / i)) % p]\n return inv_t\n def modfactorial_list(n, p = MOD):\n if n == 0:\n return [1]\n else:\n l = [0] * (n+1)\n tmp = 1\n for i in range(1, n+1):\n tmp = tmp * i % p\n l[i] = tmp\n return l\n def modcomb(n, k, fac_list = [], p = MOD):\n # fac_list = modfactorial_list(100)\n # print(modcomb(100, 5, modfactorial_list(100)))\n from math import factorial\n if n < 0 or k < 0 or n < k: return 0\n if n == 0 or k == 0: return 1\n if len(fac_list) <= n:\n a = factorial(n) % p\n b = factorial(k) % p\n c = factorial(n-k) % p\n else:\n a = fac_list[n]\n b = fac_list[k]\n c = fac_list[n-k]\n return (a * modpow(b, p-2, p) * modpow(c, p-2, p)) % p\n def modadd(a, b, p = MOD):\n return (a + b) % MOD\n def modsub(a, b, p = MOD):\n return (a - b) % p\n def modmul(a, b, p = MOD):\n return ((a % p) * (b % p)) % p\n def moddiv(a, b, p = MOD):\n return modmul(a, modpow(b, p-2, p))\n\n class UnionFindTree:\n \"\"\"union find tree class\n TODO: fix this description...\n how to use (example):\n >> uf = UnionFindTree(N) \n >> if uf.find_root(a) == uf.find_root(b):\n >> do something\n >> else:\n >> do something\n >> uf.unite(a, b)\n \"\"\"\n def __init__(self, N):\n self.root = [-1] * (N+1)\n self.rank = [0] * (N+1)\n self.connected_num = [1] * (N+1)\n \n def find_root(self,x):\n root = self.root\n while root[x] != -1:\n x = root[x]\n return x\n \n def unite(self,x,y):\n root = self.root\n rank = self.rank\n connected_num = self.connected_num\n find_root = self.find_root\n \n rx = find_root(x)\n ry = find_root(y)\n if rx != ry:\n if rank[rx] < rank[ry]:\n root[rx] = ry\n rx,ry = ry,rx\n else:\n if rank[rx] == rank[ry]:\n rank[rx] += 1\n root[ry] = rx \n connected_num[rx] += connected_num[ry]\n\n class SegTree:\n \"\"\"\n ref: https://qiita.com/takayg1/items/c811bd07c21923d7ec69\n init(init_val, ide_ele): 配列init_valで初期化 O(N)\n update(k, x): k番目の値をxに更新 O(logN)\n query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)\n \"\"\"\n def __init__(self, init_val, segfunc, ide_ele):\n \"\"\"\n init_val: 配列の初期値\n segfunc: 区間にしたい操作\n ide_ele: 単位元\n n: 要素数\n num: n以上の最小の2のべき乗\n tree: セグメント木(1-index)\n \"\"\"\n n = len(init_val)\n self.segfunc = segfunc\n self.ide_ele = ide_ele\n self.num = 1 << (n - 1).bit_length()\n self.tree = [ide_ele] * 2 * self.num\n # 配列の値を葉にセット\n for i in range(n):\n self.tree[self.num + i] = init_val[i]\n # 構築していく\n for i in range(self.num - 1, 0, -1):\n self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])\n\n def update(self, k, x):\n \"\"\"\n k番目の値をxに更新\n k: index(0-index)\n x: update value\n \"\"\"\n k += self.num\n self.tree[k] = x\n while k > 1:\n self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])\n k >>= 1\n\n def query(self, l, r):\n \"\"\"\n [l, r)のsegfuncしたものを得る\n l: index(0-index)\n r: index(0-index)\n \"\"\"\n res = self.ide_ele\n l += self.num\n r += self.num\n while l < r:\n if l & 1:\n res = self.segfunc(res, self.tree[l])\n l += 1\n if r & 1:\n res = self.segfunc(res, self.tree[r - 1])\n l >>= 1\n r >>= 1\n return res\n\n # ************ Graph ************\n # Graph: https://en.wikipedia.org/wiki/Directed_graph\n # 最短経路問題: https://ja.wikipedia.org/wiki/%E6%9C%80%E7%9F%AD%E7%B5%8C%E8%B7%AF%E5%95%8F%E9%A1%8C\n \n # Bellman-Ford: O(|V||E|). Use this if there exists an edge with negative length in the graph\n # After N steps, the shortest path has converded if there doesn't exist an cycle of edges with negative\n # Watch out: d[N] == d[2*N] doesn't necessarily mean the graph doesn't have negative cycle\n # ref: https://www.youtube.com/watch?v=1Z6ofKN03_Y\n\n def BellmanFord(N, M, ABC, vertex_start, vertex_end, value_if_inf = -1, find_shortest = False):\n \"\"\"to calculate furthest or shortest length between vertex_start and vertex_end using BellmanFord algorithm\n \n Args:\n N (int): number of vertices\n M (int): number of edges\n ABC (list): [(ai, bi, ci) for _ in range(N)] where i-th edge is directed from vertex ai to vertex bi and the length is ci \n vertex_start (int): start vertex. usually use 0.\n vertex_end (int): end vertex. usually use N-1.\n value_if_inf (int or string as you like, optional): value you want when the furthest (or shortest) distance is infinite (or -infinite). Defaults to -1.\n find_shortest (bool, optional): choose False to find furthest path. Defaults to False.\n \n Returns:\n int or string: normally int (but can be str if you set value_if_inf to str)\n \n Example:\n N, M, P = R()\n ABC = [R() for _ in range(M)]\n ABC = [(a-1, b-1, c-P) for a, b, c in ABC]\n print(BellmanFord(N, M, ABC, 0, N-1, value_if_inf = 'inf'))\n\n \"\"\"\n\n def make_reachable_list(N, M, ABC, vertex_start, vertex_end):\n reachable_to_direct = defaultdict(list)\n reachable_from_direct = defaultdict(list)\n reachable_from_start = [False] * N\n reachable_to_end = [False] * N\n reachable_from_start[vertex_start] = True\n reachable_to_end[vertex_end] = True\n reachable_from_both_sides = [False] * N\n dfs_from_start = []\n dfs_to_end = []\n for a, b, c in ABC:\n reachable_to_direct[a].append(b)\n reachable_from_direct[b].append(a)\n if a == vertex_start:\n dfs_from_start.append(b)\n reachable_from_start[b] = True\n if b == vertex_end:\n dfs_to_end.append(a)\n reachable_to_end[a] = True\n while dfs_from_start:\n v = dfs_from_start.pop()\n for i in reachable_to_direct[v]:\n if not reachable_from_start[i]:\n reachable_from_start[i] = True\n dfs_from_start.append(i)\n while dfs_to_end:\n v = dfs_to_end.pop()\n for i in reachable_from_direct[v]:\n if not reachable_to_end[i]:\n reachable_to_end[i] = True\n dfs_to_end.append(i)\n for i in range(N):\n reachable_from_both_sides[i] = reachable_from_start[i] and reachable_to_end[i]\n return reachable_from_both_sides\n \n reachable_from_both_sides = make_reachable_list(N, M, ABC, vertex_start, vertex_end)\n \n if find_shortest:\n dist = [INF for i in range(N)]\n else:\n dist = [-INF for i in range(N)]\n \n dist[vertex_start] = 0\n for i in range(N):\n updated = False\n for a, b, c in ABC:\n if not reachable_from_both_sides[a]:\n continue\n elif find_shortest:\n update_condition = dist[a] + c < dist[b]\n else:\n update_condition = dist[a] + c > dist[b]\n if dist[a] != INF and update_condition:\n dist[b] = dist[a] + c\n updated = True\n if i == N-1:\n return value_if_inf\n if not updated:\n break\n return dist[vertex_end]\n\n # Warshall Floyd O(V**3)\n def warshall_floyd(number_vertex, XYD, shift_one_for_vertex=False):\n # ref: https://juppy.hatenablog.com/entry/2018/11/01/%E8%9F%BB%E6%9C%AC_python_%E5%85%A8%E7%82%B9%E5%AF%BE%E6%9C%80%E7%9F%AD%E7%B5%8C%E8%B7%AF%E6%B3%95%EF%BC%88%E3%83%AF%E3%83%BC%E3%82%B7%E3%83%A3%E3%83%AB%E3%83%95%E3%83%AD%E3%82%A4%E3%83%89%E6%B3%95\n # number_vertex: len(vertex)\n # XYD: list of distance from x to y\n # shift_one_for_vertex: XYDの値が1~Nの時(0~N-1でない時)に調整するフラグ。\n # d[i][j]: iからjへの最短距離\n d = [[float(\"inf\")]*number_vertex for i in range(number_vertex)]\n for x, y, dist in XYD:\n if shift_one_for_vertex:\n x = x - 1\n y = y - 1\n d[x][y] = dist\n d[y][x] = dist\n for i in range(number_vertex):\n d[i][i] = 0 # distance of same vertex is 0\n for k in range(number_vertex):\n for i in range(number_vertex):\n for j in range(number_vertex):\n d[i][j] = min(d[i][j],d[i][k] + d[k][j])\n return d\n\n\n \"\"\" initialize variables and set inputs\n # initialize variables\n # to initialize list, use [0] * n\n # to initialize two dimentional array:\n # ex) [[0] * N for _ in range(N)]\n # ex2) dp = [[0] * (N+1) for _ in range(W*2)]\n # set inputs\n # put inputs between specific values (almost as quickly)\n # ex) S = [-INF] + [int(r()) for _ in range(A)] + [INF]\n # open(0).read() is sometimes useful:\n # ex) n, m, *x = map(int, open(0).read().split())\n # min(x[::2]) - max(x[1::2])\n # ex2) *x, = map(int, open(0).read().split())\n # don't forget to add comma after *x if only one variable is used\n # preprocessing\n # transpose = [x for x in zip(*data)]\n # ex) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [(1, 4, 7), (2, 5, 8), (3, 6, 9)]\n # flat = [flatten for inner in data for flatten in inner]\n # ex) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [1, 2, 3, 4, 5, 6, 7, 8, 9]\n # calculate and output\n # output pattern\n # ex1) print(*l) => when l = [2, 5, 6], printed 2 5 6\n \"\"\"\n\n # functions to read input\n r = lambda: sys.stdin.readline().strip()\n r_int = lambda: int(r())\n r_float = lambda: float(r())\n R = lambda: list(map(int, r().split()))\n R_str = lambda: r().split()\n R_map = lambda: map(int, r().split())\n R_float = lambda: list(map(float, r().split()))\n R_tuple = lambda: tuple(map(int, r().split()))\n\n \"\"\" how to treat input\n # single int: int(r())\n # single string: r()\n # single float: float(r())\n # line int: R()\n # line string: r().split()\n # line (str, int, int): [j if i == 0 else int(j) for i, j in enumerate(r().split())]\n # lines int: [R() for _ in range(n)]\n \"\"\"\n\n # for test\n if sample_file:\n sys.stdin = open(sample_file)\n \n # ----------------------------------\n # main\n #%%\n N = r_int()\n AB = [R() for _ in range(N)]\n \n ab_0 = sorted(AB, key=itemgetter(0))\n ab_1 = sorted(AB, key=itemgetter(1))\n \n if N%2 == 0: # 偶数の時\n left = N//2 - 1\n right = N//2\n l = ab_0[left][0] + ab_0[right][0]\n r = ab_1[left][1] + ab_1[right][1]\n print(r-l+1)\n else:\n c = N//2\n l = ab_0[c][0]\n r = ab_1[c][1]\n print(r-l+1)\n \n #%%\n # end of main\n # ----------------------------------\n\n \"\"\"memo: how to use defaultdict of list\n # initialize\n Dic = defaultdict(list)\n # append / extend\n Dic[x].append(y)\n # three methods for loop: keys(), values(), items()\n for k, v in Dic.items():\n \"\"\"\n \n \"\"\"memo: how to solve binary problems\n # to make binary digits text\n >>> a = 5\n >>> bin_str_a = format(a, '#06b')\n >>> print(bin_str_a)\n 0b0101 # first 2 strings (='0b') indicates it is binary\n \"\"\"\n \n \"\"\"memo: how to solve the problem\n creating simple test/answer\n greed\n simple dp\n graph\n \"\"\"\n\nif __name__ == '__main__':\n main()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N integers X_1, X_2, \\cdots, X_N, and we know that A_i \\leq X_i \\leq B_i.\nFind the number of different values that the median of X_1, X_2, \\cdots, X_N can take.\n\nNotes\n\nThe median of X_1, X_2, \\cdots, X_N is defined as follows. Let x_1, x_2, \\cdots, x_N be the result of sorting X_1, X_2, \\cdots, X_N in ascending order.\n\nIf N is odd, the median is x_{(N+1)/2};\n\nif N is even, the median is (x_{N/2} + x_{N/2+1}) / 2.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 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\nA_1 B_1\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2\n1 2\n2 3\n\nSample Output 1\n\n3\n\nIf X_1 = 1 and X_2 = 2, the median is \\frac{3}{2};\n\nif X_1 = 1 and X_2 = 3, the median is 2;\n\nif X_1 = 2 and X_2 = 2, the median is 2;\n\nif X_1 = 2 and X_2 = 3, the median is \\frac{5}{2}.\n\nThus, the median can take three values: \\frac{3}{2}, 2, and \\frac{5}{2}.\n\nSample Input 2\n\n3\n100 100\n10 10000\n1 1000000000\n\nSample Output 2\n\n9991", "sample_input": "2\n1 2\n2 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02661", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N integers X_1, X_2, \\cdots, X_N, and we know that A_i \\leq X_i \\leq B_i.\nFind the number of different values that the median of X_1, X_2, \\cdots, X_N can take.\n\nNotes\n\nThe median of X_1, X_2, \\cdots, X_N is defined as follows. Let x_1, x_2, \\cdots, x_N be the result of sorting X_1, X_2, \\cdots, X_N in ascending order.\n\nIf N is odd, the median is x_{(N+1)/2};\n\nif N is even, the median is (x_{N/2} + x_{N/2+1}) / 2.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 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\nA_1 B_1\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2\n1 2\n2 3\n\nSample Output 1\n\n3\n\nIf X_1 = 1 and X_2 = 2, the median is \\frac{3}{2};\n\nif X_1 = 1 and X_2 = 3, the median is 2;\n\nif X_1 = 2 and X_2 = 2, the median is 2;\n\nif X_1 = 2 and X_2 = 3, the median is \\frac{5}{2}.\n\nThus, the median can take three values: \\frac{3}{2}, 2, and \\frac{5}{2}.\n\nSample Input 2\n\n3\n100 100\n10 10000\n1 1000000000\n\nSample Output 2\n\n9991", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 19272, "cpu_time_ms": 637, "memory_kb": 130660}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s718756309", "group_id": "codeNet:p02661", "input_text": "from statistics import median\n\nN = int(input())\nAs = [0] * N\nBs = [0] * N\n\nfor i in range(N):\n As[i], Bs[i] = map(int, input().split())\n\nmed_A = median(As)\nmed_B = median(Bs)\n\nif N%2:\n print(med_B-med_A+1)\nelse:\n print(int((med_B-med_A)*2)+1)\n", "language": "Python", "metadata": {"date": 1590975984, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02661.html", "problem_id": "p02661", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02661/input.txt", "sample_output_relpath": "derived/input_output/data/p02661/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02661/Python/s718756309.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s718756309", "user_id": "u855710796"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "from statistics import median\n\nN = int(input())\nAs = [0] * N\nBs = [0] * N\n\nfor i in range(N):\n As[i], Bs[i] = map(int, input().split())\n\nmed_A = median(As)\nmed_B = median(Bs)\n\nif N%2:\n print(med_B-med_A+1)\nelse:\n print(int((med_B-med_A)*2)+1)\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N integers X_1, X_2, \\cdots, X_N, and we know that A_i \\leq X_i \\leq B_i.\nFind the number of different values that the median of X_1, X_2, \\cdots, X_N can take.\n\nNotes\n\nThe median of X_1, X_2, \\cdots, X_N is defined as follows. Let x_1, x_2, \\cdots, x_N be the result of sorting X_1, X_2, \\cdots, X_N in ascending order.\n\nIf N is odd, the median is x_{(N+1)/2};\n\nif N is even, the median is (x_{N/2} + x_{N/2+1}) / 2.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 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\nA_1 B_1\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2\n1 2\n2 3\n\nSample Output 1\n\n3\n\nIf X_1 = 1 and X_2 = 2, the median is \\frac{3}{2};\n\nif X_1 = 1 and X_2 = 3, the median is 2;\n\nif X_1 = 2 and X_2 = 2, the median is 2;\n\nif X_1 = 2 and X_2 = 3, the median is \\frac{5}{2}.\n\nThus, the median can take three values: \\frac{3}{2}, 2, and \\frac{5}{2}.\n\nSample Input 2\n\n3\n100 100\n10 10000\n1 1000000000\n\nSample Output 2\n\n9991", "sample_input": "2\n1 2\n2 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02661", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N integers X_1, X_2, \\cdots, X_N, and we know that A_i \\leq X_i \\leq B_i.\nFind the number of different values that the median of X_1, X_2, \\cdots, X_N can take.\n\nNotes\n\nThe median of X_1, X_2, \\cdots, X_N is defined as follows. Let x_1, x_2, \\cdots, x_N be the result of sorting X_1, X_2, \\cdots, X_N in ascending order.\n\nIf N is odd, the median is x_{(N+1)/2};\n\nif N is even, the median is (x_{N/2} + x_{N/2+1}) / 2.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 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\nA_1 B_1\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2\n1 2\n2 3\n\nSample Output 1\n\n3\n\nIf X_1 = 1 and X_2 = 2, the median is \\frac{3}{2};\n\nif X_1 = 1 and X_2 = 3, the median is 2;\n\nif X_1 = 2 and X_2 = 2, the median is 2;\n\nif X_1 = 2 and X_2 = 3, the median is \\frac{5}{2}.\n\nThus, the median can take three values: \\frac{3}{2}, 2, and \\frac{5}{2}.\n\nSample Input 2\n\n3\n100 100\n10 10000\n1 1000000000\n\nSample Output 2\n\n9991", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 252, "cpu_time_ms": 463, "memory_kb": 28800}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s139057850", "group_id": "codeNet:p02664", "input_text": "print(''.join(['D' if c == '?' else c for c in input()]))\n", "language": "Python", "metadata": {"date": 1590888272, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02664.html", "problem_id": "p02664", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02664/input.txt", "sample_output_relpath": "derived/input_output/data/p02664/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02664/Python/s139057850.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s139057850", "user_id": "u367965715"}, "prompt_components": {"gold_output": "PDPDPDP\n", "input_to_evaluate": "print(''.join(['D' if c == '?' else c for c in input()]))\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nFor a string S consisting of the uppercase English letters P and D, let the doctoral and postdoctoral quotient of S be the total number of occurrences of D and PD in S as contiguous substrings. For example, if S = PPDDP, it contains two occurrences of D and one occurrence of PD as contiguous substrings, so the doctoral and postdoctoral quotient of S is 3.\n\nWe have a string T consisting of P, D, and ?.\n\nAmong the strings that can be obtained by replacing each ? in T with P or D, find one with the maximum possible doctoral and postdoctoral quotient.\n\nConstraints\n\n1 \\leq |T| \\leq 2 \\times 10^5\n\nT consists of P, D, and ?.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT\n\nOutput\n\nPrint one string with the maximum possible doctoral and postdoctoral quotient among the strings that can be obtained by replacing each ? in T with P or D.\nIf there are multiple such strings, you may print any of them.\n\nSample Input 1\n\nPD?D??P\n\nSample Output 1\n\nPDPDPDP\n\nThis string contains three occurrences of D and three occurrences of PD as contiguous substrings, so its doctoral and postdoctoral quotient is 6, which is the maximum doctoral and postdoctoral quotient of a string obtained by replacing each ? in T with P or D.\n\nSample Input 2\n\nP?P?\n\nSample Output 2\n\nPDPD", "sample_input": "PD?D??P\n"}, "reference_outputs": ["PDPDPDP\n"], "source_document_id": "p02664", "source_text": "Score : 200 points\n\nProblem Statement\n\nFor a string S consisting of the uppercase English letters P and D, let the doctoral and postdoctoral quotient of S be the total number of occurrences of D and PD in S as contiguous substrings. For example, if S = PPDDP, it contains two occurrences of D and one occurrence of PD as contiguous substrings, so the doctoral and postdoctoral quotient of S is 3.\n\nWe have a string T consisting of P, D, and ?.\n\nAmong the strings that can be obtained by replacing each ? in T with P or D, find one with the maximum possible doctoral and postdoctoral quotient.\n\nConstraints\n\n1 \\leq |T| \\leq 2 \\times 10^5\n\nT consists of P, D, and ?.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT\n\nOutput\n\nPrint one string with the maximum possible doctoral and postdoctoral quotient among the strings that can be obtained by replacing each ? in T with P or D.\nIf there are multiple such strings, you may print any of them.\n\nSample Input 1\n\nPD?D??P\n\nSample Output 1\n\nPDPDPDP\n\nThis string contains three occurrences of D and three occurrences of PD as contiguous substrings, so its doctoral and postdoctoral quotient is 6, which is the maximum doctoral and postdoctoral quotient of a string obtained by replacing each ? in T with P or D.\n\nSample Input 2\n\nP?P?\n\nSample Output 2\n\nPDPD", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 58, "cpu_time_ms": 32, "memory_kb": 10836}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s262691548", "group_id": "codeNet:p02665", "input_text": "import math\n\nn = int(input())\nfolia = list(map(int, input().split()))\n#print(n, folia)\n\nseq = [[folia[-1], folia[-1]]]\n\nfor i in range(n): # 深さ'n'分\n tmp = folia[-(i+2)]\n sml = math.ceil(seq[i][0] / 2) + tmp \n big = seq[i][1] + tmp\n seq += [[sml, big]]\n#print(seq)\n\nif not (seq[-1][0] <= 1 <= seq[-1][1]):\n print(-1)\n exit()\n\nans =[1]\nfor j in range(n): # 深さ'n'分\n tmp = min((ans[j] - folia[j]) * 2, seq[-(j+2)][1])\n ans.append(tmp)\nprint(sum(ans))\n", "language": "Python", "metadata": {"date": 1592534064, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02665.html", "problem_id": "p02665", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02665/input.txt", "sample_output_relpath": "derived/input_output/data/p02665/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02665/Python/s262691548.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s262691548", "user_id": "u680851063"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "import math\n\nn = int(input())\nfolia = list(map(int, input().split()))\n#print(n, folia)\n\nseq = [[folia[-1], folia[-1]]]\n\nfor i in range(n): # 深さ'n'分\n tmp = folia[-(i+2)]\n sml = math.ceil(seq[i][0] / 2) + tmp \n big = seq[i][1] + tmp\n seq += [[sml, big]]\n#print(seq)\n\nif not (seq[-1][0] <= 1 <= seq[-1][1]):\n print(-1)\n exit()\n\nans =[1]\nfor j in range(n): # 深さ'n'分\n tmp = min((ans[j] - folia[j]) * 2, seq[-(j+2)][1])\n ans.append(tmp)\nprint(sum(ans))\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nGiven is an integer sequence of length N+1: A_0, A_1, A_2, \\ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \\ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print the maximum possible number of vertices in such a tree; otherwise, print -1.\n\nNotes\n\nA binary tree is a rooted tree such that each vertex has at most two direct children.\n\nA leaf in a binary tree is a vertex with zero children.\n\nThe depth of a vertex v in a binary tree is the distance from the tree's root to v. (The root has the depth of 0.)\n\nThe depth of a binary tree is the maximum depth of a vertex in the tree.\n\nConstraints\n\n0 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{8} (0 \\leq i \\leq N)\n\nA_N \\geq 1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_0 A_1 A_2 \\cdots A_N\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n3\n0 1 1 2\n\nSample Output 1\n\n7\n\nBelow is the tree with the maximum possible number of vertices. It has seven vertices, so we should print 7.\n\nSample Input 2\n\n4\n0 0 1 0 2\n\nSample Output 2\n\n10\n\nSample Input 3\n\n2\n0 3 1\n\nSample Output 3\n\n-1\n\nSample Input 4\n\n1\n1 1\n\nSample Output 4\n\n-1\n\nSample Input 5\n\n10\n0 0 1 1 2 3 5 8 13 21 34\n\nSample Output 5\n\n264", "sample_input": "3\n0 1 1 2\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02665", "source_text": "Score : 600 points\n\nProblem Statement\n\nGiven is an integer sequence of length N+1: A_0, A_1, A_2, \\ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \\ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print the maximum possible number of vertices in such a tree; otherwise, print -1.\n\nNotes\n\nA binary tree is a rooted tree such that each vertex has at most two direct children.\n\nA leaf in a binary tree is a vertex with zero children.\n\nThe depth of a vertex v in a binary tree is the distance from the tree's root to v. (The root has the depth of 0.)\n\nThe depth of a binary tree is the maximum depth of a vertex in the tree.\n\nConstraints\n\n0 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{8} (0 \\leq i \\leq N)\n\nA_N \\geq 1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_0 A_1 A_2 \\cdots A_N\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n3\n0 1 1 2\n\nSample Output 1\n\n7\n\nBelow is the tree with the maximum possible number of vertices. It has seven vertices, so we should print 7.\n\nSample Input 2\n\n4\n0 0 1 0 2\n\nSample Output 2\n\n10\n\nSample Input 3\n\n2\n0 3 1\n\nSample Output 3\n\n-1\n\nSample Input 4\n\n1\n1 1\n\nSample Output 4\n\n-1\n\nSample Input 5\n\n10\n0 0 1 1 2 3 5 8 13 21 34\n\nSample Output 5\n\n264", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 483, "cpu_time_ms": 182, "memory_kb": 33572}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s504105605", "group_id": "codeNet:p02665", "input_text": "#C\nN=int(input())\nA=[int(x) for x in input().split()]\n\nP=[0 for i in range(N+1)]\nP[N]=[A[N],A[N]]\nfor i in range(N-1,-1,-1):\n MIN,MAX=P[i+1]\n mi=int(A[i]+(MIN+MIN%2)/2)\n ma=A[i]+MAX\n P[i]=[mi,ma]\n \n \nif P[0][0]==1:\n Q=[0 for i in range(N+1)]\n Q[0]=1\n cnt=1\n for i in range(N):\n Q[i+1]=min((Q[i]-A[i])*2,P[i+1][1])\n cnt+=Q[i+1]\n print(cnt)\nelse:\n print(\"-1\")", "language": "Python", "metadata": {"date": 1590895436, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02665.html", "problem_id": "p02665", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02665/input.txt", "sample_output_relpath": "derived/input_output/data/p02665/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02665/Python/s504105605.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s504105605", "user_id": "u330728443"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "#C\nN=int(input())\nA=[int(x) for x in input().split()]\n\nP=[0 for i in range(N+1)]\nP[N]=[A[N],A[N]]\nfor i in range(N-1,-1,-1):\n MIN,MAX=P[i+1]\n mi=int(A[i]+(MIN+MIN%2)/2)\n ma=A[i]+MAX\n P[i]=[mi,ma]\n \n \nif P[0][0]==1:\n Q=[0 for i in range(N+1)]\n Q[0]=1\n cnt=1\n for i in range(N):\n Q[i+1]=min((Q[i]-A[i])*2,P[i+1][1])\n cnt+=Q[i+1]\n print(cnt)\nelse:\n print(\"-1\")", "problem_context": "Score : 600 points\n\nProblem Statement\n\nGiven is an integer sequence of length N+1: A_0, A_1, A_2, \\ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \\ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print the maximum possible number of vertices in such a tree; otherwise, print -1.\n\nNotes\n\nA binary tree is a rooted tree such that each vertex has at most two direct children.\n\nA leaf in a binary tree is a vertex with zero children.\n\nThe depth of a vertex v in a binary tree is the distance from the tree's root to v. (The root has the depth of 0.)\n\nThe depth of a binary tree is the maximum depth of a vertex in the tree.\n\nConstraints\n\n0 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{8} (0 \\leq i \\leq N)\n\nA_N \\geq 1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_0 A_1 A_2 \\cdots A_N\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n3\n0 1 1 2\n\nSample Output 1\n\n7\n\nBelow is the tree with the maximum possible number of vertices. It has seven vertices, so we should print 7.\n\nSample Input 2\n\n4\n0 0 1 0 2\n\nSample Output 2\n\n10\n\nSample Input 3\n\n2\n0 3 1\n\nSample Output 3\n\n-1\n\nSample Input 4\n\n1\n1 1\n\nSample Output 4\n\n-1\n\nSample Input 5\n\n10\n0 0 1 1 2 3 5 8 13 21 34\n\nSample Output 5\n\n264", "sample_input": "3\n0 1 1 2\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02665", "source_text": "Score : 600 points\n\nProblem Statement\n\nGiven is an integer sequence of length N+1: A_0, A_1, A_2, \\ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \\ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print the maximum possible number of vertices in such a tree; otherwise, print -1.\n\nNotes\n\nA binary tree is a rooted tree such that each vertex has at most two direct children.\n\nA leaf in a binary tree is a vertex with zero children.\n\nThe depth of a vertex v in a binary tree is the distance from the tree's root to v. (The root has the depth of 0.)\n\nThe depth of a binary tree is the maximum depth of a vertex in the tree.\n\nConstraints\n\n0 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{8} (0 \\leq i \\leq N)\n\nA_N \\geq 1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_0 A_1 A_2 \\cdots A_N\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n3\n0 1 1 2\n\nSample Output 1\n\n7\n\nBelow is the tree with the maximum possible number of vertices. It has seven vertices, so we should print 7.\n\nSample Input 2\n\n4\n0 0 1 0 2\n\nSample Output 2\n\n10\n\nSample Input 3\n\n2\n0 3 1\n\nSample Output 3\n\n-1\n\nSample Input 4\n\n1\n1 1\n\nSample Output 4\n\n-1\n\nSample Input 5\n\n10\n0 0 1 1 2 3 5 8 13 21 34\n\nSample Output 5\n\n264", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 407, "cpu_time_ms": 88, "memory_kb": 88052}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s662445041", "group_id": "codeNet:p02665", "input_text": "from sys import stdin, stdout\nn = int(stdin.readline())\nnmleaves = list(map(int, stdin.readline().strip().split()))\n\n# pref[i]: sum of all elements in nmleaves after i, i.e. sum(nmleaves[i+1:])\nfull = sum(nmleaves)\ntot = 0\npref = [0]*(n+1)\nfor i, l in enumerate(nmleaves):\n tot += l\n pref[i] = full - tot\n\nif n==0:\n print(0)\n\nelse:\n if nmleaves[0]!=0:\n print(-1)\n exit()\n \n ## it exists\n ans = 0\n for level, leaves in enumerate(nmleaves):\n if leaves > 2**(level):\n print(-1)\n exit()\n\n if level == 0:\n ans += 1\n validnom = 1\n else:\n maxup = 2*validnom\n maxnom = maxup - leaves\n\n if level+1 2**(level):\n print(-1)\n exit()\n\n if level == 0:\n ans += 1\n validnom = 1\n else:\n maxup = 2*validnom\n maxnom = maxup - leaves\n\n if level+1 K:\n print(S[0:K] + \"...\")\nelse:\n print(S)", "language": "Python", "metadata": {"date": 1589822858, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02676.html", "problem_id": "p02676", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02676/input.txt", "sample_output_relpath": "derived/input_output/data/p02676/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02676/Python/s621099449.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s621099449", "user_id": "u559157859"}, "prompt_components": {"gold_output": "nikoand...\n", "input_to_evaluate": "K = int(input())\nS = input()\n\ns_l = len(S)\nif s_l > K:\n print(S[0:K] + \"...\")\nelse:\n print(S)", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "sample_input": "7\nnikoandsolstice\n"}, "reference_outputs": ["nikoand...\n"], "source_document_id": "p02676", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 95, "cpu_time_ms": 25, "memory_kb": 9060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s356192645", "group_id": "codeNet:p02676", "input_text": "K = int(input())\nS = input()\n\n\nlength = len(S)\n\nif length <= K:\n\tprint(S)\nelse:\n\tres = S[:K]\n\tprint( res + \"...\")", "language": "Python", "metadata": {"date": 1589764524, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02676.html", "problem_id": "p02676", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02676/input.txt", "sample_output_relpath": "derived/input_output/data/p02676/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02676/Python/s356192645.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s356192645", "user_id": "u061172855"}, "prompt_components": {"gold_output": "nikoand...\n", "input_to_evaluate": "K = int(input())\nS = input()\n\n\nlength = len(S)\n\nif length <= K:\n\tprint(S)\nelse:\n\tres = S[:K]\n\tprint( res + \"...\")", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "sample_input": "7\nnikoandsolstice\n"}, "reference_outputs": ["nikoand...\n"], "source_document_id": "p02676", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 113, "cpu_time_ms": 23, "memory_kb": 9108}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s875590519", "group_id": "codeNet:p02676", "input_text": "K = int(input())\nS = input()\n\nprint( S if K >= len(S) else S[:K] + \"...\")", "language": "Python", "metadata": {"date": 1589764408, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02676.html", "problem_id": "p02676", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02676/input.txt", "sample_output_relpath": "derived/input_output/data/p02676/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02676/Python/s875590519.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s875590519", "user_id": "u161857931"}, "prompt_components": {"gold_output": "nikoand...\n", "input_to_evaluate": "K = int(input())\nS = input()\n\nprint( S if K >= len(S) else S[:K] + \"...\")", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "sample_input": "7\nnikoandsolstice\n"}, "reference_outputs": ["nikoand...\n"], "source_document_id": "p02676", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 73, "cpu_time_ms": 22, "memory_kb": 9104}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s271189085", "group_id": "codeNet:p02677", "input_text": "import sys\ninput = sys.stdin.readline\nimport math\ndef main():\n A, B, H, M = map(int, input().split())\n s_rad = 0\n if H == 0:\n s_rad = math.pi/2\n elif H <= 3:\n s_rad = (3-H)/12*2*math.pi\n else:\n s_rad = math.pi/2 + (12-H)/12*2*math.pi\n l_rad = 0\n if M == 0:\n l_rad = math.pi/2\n elif M <= 15:\n l_rad = (15-M)/60*2*math.pi\n else:\n l_rad = math.pi/2 + (60-M)/60*2*math.pi\n sx = A * math.cos(s_rad)\n sy = A * math.sin(s_rad)\n lx = B * math.cos(l_rad)\n ly = B * math.sin(l_rad)\n ans = math.sqrt(((sx-lx)**2) + ((sy-ly)**2))\n print(ans)\nif __name__ == \"__main__\":\n main()", "language": "Python", "metadata": {"date": 1589767948, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02677.html", "problem_id": "p02677", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02677/input.txt", "sample_output_relpath": "derived/input_output/data/p02677/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02677/Python/s271189085.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s271189085", "user_id": "u004423772"}, "prompt_components": {"gold_output": "5.00000000000000000000\n", "input_to_evaluate": "import sys\ninput = sys.stdin.readline\nimport math\ndef main():\n A, B, H, M = map(int, input().split())\n s_rad = 0\n if H == 0:\n s_rad = math.pi/2\n elif H <= 3:\n s_rad = (3-H)/12*2*math.pi\n else:\n s_rad = math.pi/2 + (12-H)/12*2*math.pi\n l_rad = 0\n if M == 0:\n l_rad = math.pi/2\n elif M <= 15:\n l_rad = (15-M)/60*2*math.pi\n else:\n l_rad = math.pi/2 + (60-M)/60*2*math.pi\n sx = A * math.cos(s_rad)\n sy = A * math.sin(s_rad)\n lx = B * math.cos(l_rad)\n ly = B * math.sin(l_rad)\n ans = math.sqrt(((sx-lx)**2) + ((sy-ly)**2))\n print(ans)\nif __name__ == \"__main__\":\n main()", "problem_context": "Score: 300 points\n\nProblem Statement\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\n\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.\n\nAt 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 1000\n\n0 \\leq H \\leq 11\n\n0 \\leq M \\leq 59\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B H M\n\nOutput\n\nPrint the answer without units. Your output will be accepted when its absolute or relative error from the correct value is at most 10^{-9}.\n\nSample Input 1\n\n3 4 9 0\n\nSample Output 1\n\n5.00000000000000000000\n\nThe two hands will be in the positions shown in the figure below, so the answer is 5 centimeters.\n\nSample Input 2\n\n3 4 10 40\n\nSample Output 2\n\n4.56425719433005567605\n\nThe two hands will be in the positions shown in the figure below. Note that each hand always rotates at constant angular velocity.", "sample_input": "3 4 9 0\n"}, "reference_outputs": ["5.00000000000000000000\n"], "source_document_id": "p02677", "source_text": "Score: 300 points\n\nProblem Statement\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\n\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.\n\nAt 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 1000\n\n0 \\leq H \\leq 11\n\n0 \\leq M \\leq 59\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B H M\n\nOutput\n\nPrint the answer without units. Your output will be accepted when its absolute or relative error from the correct value is at most 10^{-9}.\n\nSample Input 1\n\n3 4 9 0\n\nSample Output 1\n\n5.00000000000000000000\n\nThe two hands will be in the positions shown in the figure below, so the answer is 5 centimeters.\n\nSample Input 2\n\n3 4 10 40\n\nSample Output 2\n\n4.56425719433005567605\n\nThe two hands will be in the positions shown in the figure below. Note that each hand always rotates at constant angular velocity.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 654, "cpu_time_ms": 61, "memory_kb": 62584}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s159151105", "group_id": "codeNet:p02677", "input_text": "# -*- coding: utf-8 -*-\nimport math\nfrom decimal import Decimal\n# 入力\na,b,h,m = map(int,input().split())\n\ntri_m = Decimal(360 / 60 * m )\n\ntri_h = Decimal((360 / 12 * h) + (360 / 12 / 60 * m))\n\n# print(\"tri_m:{},tri_h:{}\".format(tri_m,tri_h))\nangle = Decimal(abs(tri_m - tri_h))\nif angle > 180:\n angle -= 180\n\n# print(\"angle:{}\".format(angle))\n\nans = Decimal(math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(math.radians(angle))))\n\nprint(ans)", "language": "Python", "metadata": {"date": 1589767809, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02677.html", "problem_id": "p02677", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02677/input.txt", "sample_output_relpath": "derived/input_output/data/p02677/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02677/Python/s159151105.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s159151105", "user_id": "u686615670"}, "prompt_components": {"gold_output": "5.00000000000000000000\n", "input_to_evaluate": "# -*- coding: utf-8 -*-\nimport math\nfrom decimal import Decimal\n# 入力\na,b,h,m = map(int,input().split())\n\ntri_m = Decimal(360 / 60 * m )\n\ntri_h = Decimal((360 / 12 * h) + (360 / 12 / 60 * m))\n\n# print(\"tri_m:{},tri_h:{}\".format(tri_m,tri_h))\nangle = Decimal(abs(tri_m - tri_h))\nif angle > 180:\n angle -= 180\n\n# print(\"angle:{}\".format(angle))\n\nans = Decimal(math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(math.radians(angle))))\n\nprint(ans)", "problem_context": "Score: 300 points\n\nProblem Statement\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\n\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.\n\nAt 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 1000\n\n0 \\leq H \\leq 11\n\n0 \\leq M \\leq 59\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B H M\n\nOutput\n\nPrint the answer without units. Your output will be accepted when its absolute or relative error from the correct value is at most 10^{-9}.\n\nSample Input 1\n\n3 4 9 0\n\nSample Output 1\n\n5.00000000000000000000\n\nThe two hands will be in the positions shown in the figure below, so the answer is 5 centimeters.\n\nSample Input 2\n\n3 4 10 40\n\nSample Output 2\n\n4.56425719433005567605\n\nThe two hands will be in the positions shown in the figure below. Note that each hand always rotates at constant angular velocity.", "sample_input": "3 4 9 0\n"}, "reference_outputs": ["5.00000000000000000000\n"], "source_document_id": "p02677", "source_text": "Score: 300 points\n\nProblem Statement\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\n\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.\n\nAt 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 1000\n\n0 \\leq H \\leq 11\n\n0 \\leq M \\leq 59\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B H M\n\nOutput\n\nPrint the answer without units. Your output will be accepted when its absolute or relative error from the correct value is at most 10^{-9}.\n\nSample Input 1\n\n3 4 9 0\n\nSample Output 1\n\n5.00000000000000000000\n\nThe two hands will be in the positions shown in the figure below, so the answer is 5 centimeters.\n\nSample Input 2\n\n3 4 10 40\n\nSample Output 2\n\n4.56425719433005567605\n\nThe two hands will be in the positions shown in the figure below. Note that each hand always rotates at constant angular velocity.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 441, "cpu_time_ms": 27, "memory_kb": 10284}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s486758539", "group_id": "codeNet:p02677", "input_text": "import math\nA,B,H,M = (int(x) for x in input().split())\nh = 360*H/12 + 30*M/60\nm = 360*M/60\nc = abs(h-m)\nif(c > 180):\n c = 360 - c\nC = A**2 + B**2 - 2*A*B*math.cos(math.radians(c))\nif c != 180 and c != 0:\n print(math.sqrt(C))\nelif c == 180:\n print(A+B)\nelse:\n print(abs(A-B))", "language": "Python", "metadata": {"date": 1589765426, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02677.html", "problem_id": "p02677", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02677/input.txt", "sample_output_relpath": "derived/input_output/data/p02677/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02677/Python/s486758539.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s486758539", "user_id": "u107601154"}, "prompt_components": {"gold_output": "5.00000000000000000000\n", "input_to_evaluate": "import math\nA,B,H,M = (int(x) for x in input().split())\nh = 360*H/12 + 30*M/60\nm = 360*M/60\nc = abs(h-m)\nif(c > 180):\n c = 360 - c\nC = A**2 + B**2 - 2*A*B*math.cos(math.radians(c))\nif c != 180 and c != 0:\n print(math.sqrt(C))\nelif c == 180:\n print(A+B)\nelse:\n print(abs(A-B))", "problem_context": "Score: 300 points\n\nProblem Statement\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\n\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.\n\nAt 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 1000\n\n0 \\leq H \\leq 11\n\n0 \\leq M \\leq 59\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B H M\n\nOutput\n\nPrint the answer without units. Your output will be accepted when its absolute or relative error from the correct value is at most 10^{-9}.\n\nSample Input 1\n\n3 4 9 0\n\nSample Output 1\n\n5.00000000000000000000\n\nThe two hands will be in the positions shown in the figure below, so the answer is 5 centimeters.\n\nSample Input 2\n\n3 4 10 40\n\nSample Output 2\n\n4.56425719433005567605\n\nThe two hands will be in the positions shown in the figure below. Note that each hand always rotates at constant angular velocity.", "sample_input": "3 4 9 0\n"}, "reference_outputs": ["5.00000000000000000000\n"], "source_document_id": "p02677", "source_text": "Score: 300 points\n\nProblem Statement\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\n\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.\n\nAt 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 1000\n\n0 \\leq H \\leq 11\n\n0 \\leq M \\leq 59\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B H M\n\nOutput\n\nPrint the answer without units. Your output will be accepted when its absolute or relative error from the correct value is at most 10^{-9}.\n\nSample Input 1\n\n3 4 9 0\n\nSample Output 1\n\n5.00000000000000000000\n\nThe two hands will be in the positions shown in the figure below, so the answer is 5 centimeters.\n\nSample Input 2\n\n3 4 10 40\n\nSample Output 2\n\n4.56425719433005567605\n\nThe two hands will be in the positions shown in the figure below. Note that each hand always rotates at constant angular velocity.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 288, "cpu_time_ms": 23, "memory_kb": 9588}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s420031068", "group_id": "codeNet:p02678", "input_text": "from collections import deque\nN,M = map(int, input().split())\nAB_s = [list(map(int, input().split())) for _ in range(M)]\n\nMAP = [[] for _ in range(N)]\nfor AB in AB_s:\n A, B = map(int, AB)\n MAP[A-1].append(B)\n MAP[B-1].append(A)\nanswer = [0] * N\nqueue = deque([1])\nanswer[0] = N\nwhile len(queue) > 0:\n P = queue.popleft()\n if True:\n for Q in MAP[P-1]:\n if answer[Q-1] == 0:\n answer[Q-1] = P\n queue.append(Q)\nif min(answer) == 0:\n print(\"No\")\nelse:\n print(\"Yes\")\n for i in range(1,N):\n print(answer[i])\n", "language": "Python", "metadata": {"date": 1590164023, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02678.html", "problem_id": "p02678", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02678/input.txt", "sample_output_relpath": "derived/input_output/data/p02678/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02678/Python/s420031068.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s420031068", "user_id": "u309039873"}, "prompt_components": {"gold_output": "Yes\n1\n2\n2\n", "input_to_evaluate": "from collections import deque\nN,M = map(int, input().split())\nAB_s = [list(map(int, input().split())) for _ in range(M)]\n\nMAP = [[] for _ in range(N)]\nfor AB in AB_s:\n A, B = map(int, AB)\n MAP[A-1].append(B)\n MAP[B-1].append(A)\nanswer = [0] * N\nqueue = deque([1])\nanswer[0] = N\nwhile len(queue) > 0:\n P = queue.popleft()\n if True:\n for Q in MAP[P-1]:\n if answer[Q-1] == 0:\n answer[Q-1] = P\n queue.append(Q)\nif min(answer) == 0:\n print(\"No\")\nelse:\n print(\"Yes\")\n for i in range(1,N):\n print(answer[i])\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThere is a cave.\n\nThe cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside.\n\nIt is dark in the cave, so we have decided to place a signpost in each room except Room 1. The signpost in each room will point to one of the rooms directly connected to that room with a passage.\n\nSince it is dangerous in the cave, our objective is to satisfy the condition below for each room except Room 1.\n\nIf you start in that room and repeatedly move to the room indicated by the signpost in the room you are in, you will reach Room 1 after traversing the minimum number of passages possible.\n\nDetermine whether there is a way to place signposts satisfying our objective, and print one such way if it exists.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq N\\ (1 \\leq i \\leq M)\n\nA_i \\neq B_i\\ (1 \\leq i \\leq M)\n\nOne can travel between any two rooms by traversing passages.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_M B_M\n\nOutput\n\nIf there is no way to place signposts satisfying the objective, print No.\n\nOtherwise, print N lines. The first line should contain Yes, and the i-th line (2 \\leq i \\leq N) should contain the integer representing the room indicated by the signpost in Room i.\n\nSample Input 1\n\n4 4\n1 2\n2 3\n3 4\n4 2\n\nSample Output 1\n\nYes\n1\n2\n2\n\nIf we place the signposts as described in the sample output, the following happens:\n\nStarting in Room 2, you will reach Room 1 after traversing one passage: (2) \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 3, you will reach Room 1 after traversing two passages: (3) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 4, you will reach Room 1 after traversing two passages: (4) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nThus, the objective is satisfied.\n\nSample Input 2\n\n6 9\n3 4\n6 1\n2 4\n5 3\n4 6\n1 5\n6 2\n4 5\n5 6\n\nSample Output 2\n\nYes\n6\n5\n5\n1\n1\n\nIf there are multiple solutions, any of them will be accepted.", "sample_input": "4 4\n1 2\n2 3\n3 4\n4 2\n"}, "reference_outputs": ["Yes\n1\n2\n2\n"], "source_document_id": "p02678", "source_text": "Score: 400 points\n\nProblem Statement\n\nThere is a cave.\n\nThe cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside.\n\nIt is dark in the cave, so we have decided to place a signpost in each room except Room 1. The signpost in each room will point to one of the rooms directly connected to that room with a passage.\n\nSince it is dangerous in the cave, our objective is to satisfy the condition below for each room except Room 1.\n\nIf you start in that room and repeatedly move to the room indicated by the signpost in the room you are in, you will reach Room 1 after traversing the minimum number of passages possible.\n\nDetermine whether there is a way to place signposts satisfying our objective, and print one such way if it exists.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq N\\ (1 \\leq i \\leq M)\n\nA_i \\neq B_i\\ (1 \\leq i \\leq M)\n\nOne can travel between any two rooms by traversing passages.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_M B_M\n\nOutput\n\nIf there is no way to place signposts satisfying the objective, print No.\n\nOtherwise, print N lines. The first line should contain Yes, and the i-th line (2 \\leq i \\leq N) should contain the integer representing the room indicated by the signpost in Room i.\n\nSample Input 1\n\n4 4\n1 2\n2 3\n3 4\n4 2\n\nSample Output 1\n\nYes\n1\n2\n2\n\nIf we place the signposts as described in the sample output, the following happens:\n\nStarting in Room 2, you will reach Room 1 after traversing one passage: (2) \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 3, you will reach Room 1 after traversing two passages: (3) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 4, you will reach Room 1 after traversing two passages: (4) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nThus, the objective is satisfied.\n\nSample Input 2\n\n6 9\n3 4\n6 1\n2 4\n5 3\n4 6\n1 5\n6 2\n4 5\n5 6\n\nSample Output 2\n\nYes\n6\n5\n5\n1\n1\n\nIf there are multiple solutions, any of them will be accepted.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 580, "cpu_time_ms": 528, "memory_kb": 119556}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s610295416", "group_id": "codeNet:p02678", "input_text": "N, M = map(int, input().split())\nAB = [list(map(int, input().split())) for _ in range(M)]\n\ngraph = [[] for _ in range(N)]\nfor i, (Ai, Bi) in enumerate(AB):\n graph[Ai - 1].append(Bi - 1)\n graph[Bi - 1].append(Ai - 1)\n\nimport heapq\n \nMY_INF = 1000000007\nq = [(0, 0)]\nd = [MY_INF] * N\nd[0] = 0\nwhile len(q) > 0:\n dist, src = heapq.heappop(q)\n for dst in graph[src]:\n dist_tmp = dist + 1\n if d[dst] > dist_tmp:\n d[dst] = dist_tmp\n heapq.heappush(q, (dist_tmp, dst))\n\nfor src in range(N):\n if src == 0:\n print('Yes')\n continue\n #\n dist_min = MY_INF\n ans = 0\n for dst in graph[src]:\n if dist_min > d[dst]:\n dist_min = d[dst]\n ans = dst + 1\n #\n print(ans)", "language": "Python", "metadata": {"date": 1589764862, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02678.html", "problem_id": "p02678", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02678/input.txt", "sample_output_relpath": "derived/input_output/data/p02678/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02678/Python/s610295416.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s610295416", "user_id": "u726615467"}, "prompt_components": {"gold_output": "Yes\n1\n2\n2\n", "input_to_evaluate": "N, M = map(int, input().split())\nAB = [list(map(int, input().split())) for _ in range(M)]\n\ngraph = [[] for _ in range(N)]\nfor i, (Ai, Bi) in enumerate(AB):\n graph[Ai - 1].append(Bi - 1)\n graph[Bi - 1].append(Ai - 1)\n\nimport heapq\n \nMY_INF = 1000000007\nq = [(0, 0)]\nd = [MY_INF] * N\nd[0] = 0\nwhile len(q) > 0:\n dist, src = heapq.heappop(q)\n for dst in graph[src]:\n dist_tmp = dist + 1\n if d[dst] > dist_tmp:\n d[dst] = dist_tmp\n heapq.heappush(q, (dist_tmp, dst))\n\nfor src in range(N):\n if src == 0:\n print('Yes')\n continue\n #\n dist_min = MY_INF\n ans = 0\n for dst in graph[src]:\n if dist_min > d[dst]:\n dist_min = d[dst]\n ans = dst + 1\n #\n print(ans)", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThere is a cave.\n\nThe cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside.\n\nIt is dark in the cave, so we have decided to place a signpost in each room except Room 1. The signpost in each room will point to one of the rooms directly connected to that room with a passage.\n\nSince it is dangerous in the cave, our objective is to satisfy the condition below for each room except Room 1.\n\nIf you start in that room and repeatedly move to the room indicated by the signpost in the room you are in, you will reach Room 1 after traversing the minimum number of passages possible.\n\nDetermine whether there is a way to place signposts satisfying our objective, and print one such way if it exists.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq N\\ (1 \\leq i \\leq M)\n\nA_i \\neq B_i\\ (1 \\leq i \\leq M)\n\nOne can travel between any two rooms by traversing passages.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_M B_M\n\nOutput\n\nIf there is no way to place signposts satisfying the objective, print No.\n\nOtherwise, print N lines. The first line should contain Yes, and the i-th line (2 \\leq i \\leq N) should contain the integer representing the room indicated by the signpost in Room i.\n\nSample Input 1\n\n4 4\n1 2\n2 3\n3 4\n4 2\n\nSample Output 1\n\nYes\n1\n2\n2\n\nIf we place the signposts as described in the sample output, the following happens:\n\nStarting in Room 2, you will reach Room 1 after traversing one passage: (2) \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 3, you will reach Room 1 after traversing two passages: (3) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 4, you will reach Room 1 after traversing two passages: (4) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nThus, the objective is satisfied.\n\nSample Input 2\n\n6 9\n3 4\n6 1\n2 4\n5 3\n4 6\n1 5\n6 2\n4 5\n5 6\n\nSample Output 2\n\nYes\n6\n5\n5\n1\n1\n\nIf there are multiple solutions, any of them will be accepted.", "sample_input": "4 4\n1 2\n2 3\n3 4\n4 2\n"}, "reference_outputs": ["Yes\n1\n2\n2\n"], "source_document_id": "p02678", "source_text": "Score: 400 points\n\nProblem Statement\n\nThere is a cave.\n\nThe cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside.\n\nIt is dark in the cave, so we have decided to place a signpost in each room except Room 1. The signpost in each room will point to one of the rooms directly connected to that room with a passage.\n\nSince it is dangerous in the cave, our objective is to satisfy the condition below for each room except Room 1.\n\nIf you start in that room and repeatedly move to the room indicated by the signpost in the room you are in, you will reach Room 1 after traversing the minimum number of passages possible.\n\nDetermine whether there is a way to place signposts satisfying our objective, and print one such way if it exists.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq N\\ (1 \\leq i \\leq M)\n\nA_i \\neq B_i\\ (1 \\leq i \\leq M)\n\nOne can travel between any two rooms by traversing passages.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_M B_M\n\nOutput\n\nIf there is no way to place signposts satisfying the objective, print No.\n\nOtherwise, print N lines. The first line should contain Yes, and the i-th line (2 \\leq i \\leq N) should contain the integer representing the room indicated by the signpost in Room i.\n\nSample Input 1\n\n4 4\n1 2\n2 3\n3 4\n4 2\n\nSample Output 1\n\nYes\n1\n2\n2\n\nIf we place the signposts as described in the sample output, the following happens:\n\nStarting in Room 2, you will reach Room 1 after traversing one passage: (2) \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 3, you will reach Room 1 after traversing two passages: (3) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 4, you will reach Room 1 after traversing two passages: (4) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nThus, the objective is satisfied.\n\nSample Input 2\n\n6 9\n3 4\n6 1\n2 4\n5 3\n4 6\n1 5\n6 2\n4 5\n5 6\n\nSample Output 2\n\nYes\n6\n5\n5\n1\n1\n\nIf there are multiple solutions, any of them will be accepted.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 763, "cpu_time_ms": 1025, "memory_kb": 71104}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s442743321", "group_id": "codeNet:p02679", "input_text": "from collections import defaultdict\nfrom math import gcd\n\nn = int(input())\nL = []\nfor i in range(n):\n l = list(map(int, input().split()))\n L.append(l)\n\nMod = 10 ** 9 + 7\n\nPow2 = [1]\nfor i in range(n):\n Pow2.append(Pow2[-1] * 2 % Mod)\n\ndef kikaku(a, b):\n g = gcd(a, b)\n a //= g\n b //= g\n if a < 0:\n return - a, -b\n return a, b\n\nDpos = defaultdict(int)\nDneg = defaultdict(int)\n\nc = 0\nfor l in L:\n a = l[0]\n b = l[1]\n if a == b == 0:\n c += 1\n else:\n a, b = kikaku(a, b)\n if b > 0:\n Dpos[(b, -a)] += 1\n Dneg[(b, -a)] += 0\n else:\n Dpos[(a, b)] += 0\n Dneg[(a, b)] += 1\n\nr = 1\nfor k, v in Dpos.items():\n j = Dneg[k]\n x = Pow2[v] + Pow2[j] - 1\n r = r * x % Mod\nans = (r + c - 1) % Mod\nprint(ans)", "language": "Python", "metadata": {"date": 1590632961, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02679.html", "problem_id": "p02679", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02679/input.txt", "sample_output_relpath": "derived/input_output/data/p02679/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02679/Python/s442743321.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s442743321", "user_id": "u901582103"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "from collections import defaultdict\nfrom math import gcd\n\nn = int(input())\nL = []\nfor i in range(n):\n l = list(map(int, input().split()))\n L.append(l)\n\nMod = 10 ** 9 + 7\n\nPow2 = [1]\nfor i in range(n):\n Pow2.append(Pow2[-1] * 2 % Mod)\n\ndef kikaku(a, b):\n g = gcd(a, b)\n a //= g\n b //= g\n if a < 0:\n return - a, -b\n return a, b\n\nDpos = defaultdict(int)\nDneg = defaultdict(int)\n\nc = 0\nfor l in L:\n a = l[0]\n b = l[1]\n if a == b == 0:\n c += 1\n else:\n a, b = kikaku(a, b)\n if b > 0:\n Dpos[(b, -a)] += 1\n Dneg[(b, -a)] += 0\n else:\n Dpos[(a, b)] += 0\n Dneg[(a, b)] += 1\n\nr = 1\nfor k, v in Dpos.items():\n j = Dneg[k]\n x = Pow2[v] + Pow2[j] - 1\n r = r * x % Mod\nans = (r + c - 1) % Mod\nprint(ans)", "problem_context": "Score: 500 points\n\nProblem Statement\n\nWe have caught N sardines. The deliciousness and fragrantness of the i-th sardine is A_i and B_i, respectively.\n\nWe will choose one or more of these sardines and put them into a cooler. However, two sardines on bad terms cannot be chosen at the same time.\n\nThe i-th and j-th sardines (i \\neq j) are on bad terms if and only if A_i \\cdot A_j + B_i \\cdot B_j = 0.\n\nIn how many ways can we choose the set of sardines to put into the cooler? Since the count can be enormous, print it modulo 1000000007.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n-10^{18} \\leq A_i, B_i \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n:\nA_N B_N\n\nOutput\n\nPrint the count modulo 1000000007.\n\nSample Input 1\n\n3\n1 2\n-1 1\n2 -1\n\nSample Output 1\n\n5\n\nThere are five ways to choose the set of sardines, as follows:\n\nThe 1-st\n\nThe 1-st and 2-nd\n\nThe 2-nd\n\nThe 2-nd and 3-rd\n\nThe 3-rd\n\nSample Input 2\n\n10\n3 2\n3 2\n-1 1\n2 -1\n-3 -9\n-8 12\n7 7\n8 1\n8 2\n8 4\n\nSample Output 2\n\n479", "sample_input": "3\n1 2\n-1 1\n2 -1\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02679", "source_text": "Score: 500 points\n\nProblem Statement\n\nWe have caught N sardines. The deliciousness and fragrantness of the i-th sardine is A_i and B_i, respectively.\n\nWe will choose one or more of these sardines and put them into a cooler. However, two sardines on bad terms cannot be chosen at the same time.\n\nThe i-th and j-th sardines (i \\neq j) are on bad terms if and only if A_i \\cdot A_j + B_i \\cdot B_j = 0.\n\nIn how many ways can we choose the set of sardines to put into the cooler? Since the count can be enormous, print it modulo 1000000007.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n-10^{18} \\leq A_i, B_i \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n:\nA_N B_N\n\nOutput\n\nPrint the count modulo 1000000007.\n\nSample Input 1\n\n3\n1 2\n-1 1\n2 -1\n\nSample Output 1\n\n5\n\nThere are five ways to choose the set of sardines, as follows:\n\nThe 1-st\n\nThe 1-st and 2-nd\n\nThe 2-nd\n\nThe 2-nd and 3-rd\n\nThe 3-rd\n\nSample Input 2\n\n10\n3 2\n3 2\n-1 1\n2 -1\n-3 -9\n-8 12\n7 7\n8 1\n8 2\n8 4\n\nSample Output 2\n\n479", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 811, "cpu_time_ms": 655, "memory_kb": 170512}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s898798260", "group_id": "codeNet:p02681", "input_text": "s = input()\nt = input()\nt_new = t[:-1]\n\nif s == t_new :\n print('Yes')\nelse :\n print('No')", "language": "Python", "metadata": {"date": 1598970595, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02681.html", "problem_id": "p02681", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02681/input.txt", "sample_output_relpath": "derived/input_output/data/p02681/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02681/Python/s898798260.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s898798260", "user_id": "u109272021"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "s = input()\nt = input()\nt_new = t[:-1]\n\nif s == t_new :\n print('Yes')\nelse :\n print('No')", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi wants to be a member of some web service.\n\nHe tried to register himself with the ID S, which turned out to be already used by another user.\n\nThus, he decides to register using a string obtained by appending one character at the end of S as his ID.\n\nHe is now trying to register with the ID T. Determine whether this string satisfies the property above.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\n1 \\leq |S| \\leq 10\n\n|T| = |S| + 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf T satisfies the property in Problem Statement, print Yes; otherwise, print No.\n\nSample Input 1\n\nchokudai\nchokudaiz\n\nSample Output 1\n\nYes\n\nchokudaiz can be obtained by appending z at the end of chokudai.\n\nSample Input 2\n\nsnuke\nsnekee\n\nSample Output 2\n\nNo\n\nsnekee cannot be obtained by appending one character at the end of snuke.\n\nSample Input 3\n\na\naa\n\nSample Output 3\n\nYes", "sample_input": "chokudai\nchokudaiz\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02681", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi wants to be a member of some web service.\n\nHe tried to register himself with the ID S, which turned out to be already used by another user.\n\nThus, he decides to register using a string obtained by appending one character at the end of S as his ID.\n\nHe is now trying to register with the ID T. Determine whether this string satisfies the property above.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\n1 \\leq |S| \\leq 10\n\n|T| = |S| + 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf T satisfies the property in Problem Statement, print Yes; otherwise, print No.\n\nSample Input 1\n\nchokudai\nchokudaiz\n\nSample Output 1\n\nYes\n\nchokudaiz can be obtained by appending z at the end of chokudai.\n\nSample Input 2\n\nsnuke\nsnekee\n\nSample Output 2\n\nNo\n\nsnekee cannot be obtained by appending one character at the end of snuke.\n\nSample Input 3\n\na\naa\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 91, "cpu_time_ms": 28, "memory_kb": 9008}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s723424869", "group_id": "codeNet:p02681", "input_text": "# -*- coding: utf-8 -*-\n\n# 文字列の入力\nS = input()\nT = input()\n\njudge = \"NO\"\n\nif (len(S) + 1 == len(T)):\n if (T.startswith(S)):\n judge = \"YES\"\n\nprint(\"{}\".format(judge))", "language": "Python", "metadata": {"date": 1589160064, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02681.html", "problem_id": "p02681", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02681/input.txt", "sample_output_relpath": "derived/input_output/data/p02681/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02681/Python/s723424869.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s723424869", "user_id": "u099300899"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "# -*- coding: utf-8 -*-\n\n# 文字列の入力\nS = input()\nT = input()\n\njudge = \"NO\"\n\nif (len(S) + 1 == len(T)):\n if (T.startswith(S)):\n judge = \"YES\"\n\nprint(\"{}\".format(judge))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi wants to be a member of some web service.\n\nHe tried to register himself with the ID S, which turned out to be already used by another user.\n\nThus, he decides to register using a string obtained by appending one character at the end of S as his ID.\n\nHe is now trying to register with the ID T. Determine whether this string satisfies the property above.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\n1 \\leq |S| \\leq 10\n\n|T| = |S| + 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf T satisfies the property in Problem Statement, print Yes; otherwise, print No.\n\nSample Input 1\n\nchokudai\nchokudaiz\n\nSample Output 1\n\nYes\n\nchokudaiz can be obtained by appending z at the end of chokudai.\n\nSample Input 2\n\nsnuke\nsnekee\n\nSample Output 2\n\nNo\n\nsnekee cannot be obtained by appending one character at the end of snuke.\n\nSample Input 3\n\na\naa\n\nSample Output 3\n\nYes", "sample_input": "chokudai\nchokudaiz\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02681", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi wants to be a member of some web service.\n\nHe tried to register himself with the ID S, which turned out to be already used by another user.\n\nThus, he decides to register using a string obtained by appending one character at the end of S as his ID.\n\nHe is now trying to register with the ID T. Determine whether this string satisfies the property above.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\n1 \\leq |S| \\leq 10\n\n|T| = |S| + 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf T satisfies the property in Problem Statement, print Yes; otherwise, print No.\n\nSample Input 1\n\nchokudai\nchokudaiz\n\nSample Output 1\n\nYes\n\nchokudaiz can be obtained by appending z at the end of chokudai.\n\nSample Input 2\n\nsnuke\nsnekee\n\nSample Output 2\n\nNo\n\nsnekee cannot be obtained by appending one character at the end of snuke.\n\nSample Input 3\n\na\naa\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 186, "cpu_time_ms": 19, "memory_kb": 9100}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s079367788", "group_id": "codeNet:p02681", "input_text": "def s0():return input()\ndef s1():return input().split()\ndef s2(n):return [input() for x in range(n)]\ndef s3(n):return [[input().split()] for _ in range(n)]\ndef n0():return int(input())\ndef n1():return [int(x) for x in input().split()]\ndef n2(n):return [int(input()) for _ in range(n)]\ndef n3(n):return [[int(x) for x in input().split()] for _ in range(n)]\n\ns=s0()\nt=s0()\nif s==t[:-1]:\n print(\"Yes\")\nelse:\n print(\"No\")", "language": "Python", "metadata": {"date": 1589158916, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02681.html", "problem_id": "p02681", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02681/input.txt", "sample_output_relpath": "derived/input_output/data/p02681/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02681/Python/s079367788.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s079367788", "user_id": "u920103253"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "def s0():return input()\ndef s1():return input().split()\ndef s2(n):return [input() for x in range(n)]\ndef s3(n):return [[input().split()] for _ in range(n)]\ndef n0():return int(input())\ndef n1():return [int(x) for x in input().split()]\ndef n2(n):return [int(input()) for _ in range(n)]\ndef n3(n):return [[int(x) for x in input().split()] for _ in range(n)]\n\ns=s0()\nt=s0()\nif s==t[:-1]:\n print(\"Yes\")\nelse:\n print(\"No\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi wants to be a member of some web service.\n\nHe tried to register himself with the ID S, which turned out to be already used by another user.\n\nThus, he decides to register using a string obtained by appending one character at the end of S as his ID.\n\nHe is now trying to register with the ID T. Determine whether this string satisfies the property above.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\n1 \\leq |S| \\leq 10\n\n|T| = |S| + 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf T satisfies the property in Problem Statement, print Yes; otherwise, print No.\n\nSample Input 1\n\nchokudai\nchokudaiz\n\nSample Output 1\n\nYes\n\nchokudaiz can be obtained by appending z at the end of chokudai.\n\nSample Input 2\n\nsnuke\nsnekee\n\nSample Output 2\n\nNo\n\nsnekee cannot be obtained by appending one character at the end of snuke.\n\nSample Input 3\n\na\naa\n\nSample Output 3\n\nYes", "sample_input": "chokudai\nchokudaiz\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02681", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi wants to be a member of some web service.\n\nHe tried to register himself with the ID S, which turned out to be already used by another user.\n\nThus, he decides to register using a string obtained by appending one character at the end of S as his ID.\n\nHe is now trying to register with the ID T. Determine whether this string satisfies the property above.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\n1 \\leq |S| \\leq 10\n\n|T| = |S| + 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf T satisfies the property in Problem Statement, print Yes; otherwise, print No.\n\nSample Input 1\n\nchokudai\nchokudaiz\n\nSample Output 1\n\nYes\n\nchokudaiz can be obtained by appending z at the end of chokudai.\n\nSample Input 2\n\nsnuke\nsnekee\n\nSample Output 2\n\nNo\n\nsnekee cannot be obtained by appending one character at the end of snuke.\n\nSample Input 3\n\na\naa\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 423, "cpu_time_ms": 27, "memory_kb": 9152}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s489151409", "group_id": "codeNet:p02682", "input_text": "a, b, c, k = list(map(int, input().split()))\n\ns = 0\nif k <= a:\n print(k)\nelif k <= a+b:\n print(a)\nelse:\n print(a-(k-a-b))", "language": "Python", "metadata": {"date": 1589159086, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02682.html", "problem_id": "p02682", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02682/input.txt", "sample_output_relpath": "derived/input_output/data/p02682/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02682/Python/s489151409.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s489151409", "user_id": "u975116284"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "a, b, c, k = list(map(int, input().split()))\n\ns = 0\nif k <= a:\n print(k)\nelif k <= a+b:\n print(a)\nelse:\n print(a-(k-a-b))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, B, C\n\n1 \\leq K \\leq A + B + C \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the maximum possible sum of the numbers written on the cards chosen.\n\nSample Input 1\n\n2 1 1 3\n\nSample Output 1\n\n2\n\nConsider picking up two cards with 1s and one card with a 0.\nIn this case, the sum of the numbers written on the cards is 2, which is the maximum possible value.\n\nSample Input 2\n\n1 2 3 4\n\nSample Output 2\n\n0\n\nSample Input 3\n\n2000000000 0 0 2000000000\n\nSample Output 3\n\n2000000000", "sample_input": "2 1 1 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02682", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, B, C\n\n1 \\leq K \\leq A + B + C \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the maximum possible sum of the numbers written on the cards chosen.\n\nSample Input 1\n\n2 1 1 3\n\nSample Output 1\n\n2\n\nConsider picking up two cards with 1s and one card with a 0.\nIn this case, the sum of the numbers written on the cards is 2, which is the maximum possible value.\n\nSample Input 2\n\n1 2 3 4\n\nSample Output 2\n\n0\n\nSample Input 3\n\n2000000000 0 0 2000000000\n\nSample Output 3\n\n2000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 130, "cpu_time_ms": 21, "memory_kb": 9168}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s362219961", "group_id": "codeNet:p02683", "input_text": "inf = 10**9\nn, m, x = map(int, input().split())\na = [0] * n\nc = [0] * n\ny = [0] * n\nfor i in range(n):\n data = list(map(int, input().split()))\n c[i] = data[0]\n a[i] = data[1:]\nans = inf\nfor i in range(2**n):\n money = 0\n know = [0] * m\n for j in range(n):\n if (i >> j) & 1:\n money += c[j]\n for k in range(m):\n know[k] += a[j][k]\n for z in know:\n if z < x:\n break\n else:\n ans = min(ans, money)\n\nif ans == inf:\n print(-1)\nelse:\n print(ans)", "language": "Python", "metadata": {"date": 1589434830, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02683.html", "problem_id": "p02683", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02683/input.txt", "sample_output_relpath": "derived/input_output/data/p02683/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02683/Python/s362219961.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s362219961", "user_id": "u860657719"}, "prompt_components": {"gold_output": "120\n", "input_to_evaluate": "inf = 10**9\nn, m, x = map(int, input().split())\na = [0] * n\nc = [0] * n\ny = [0] * n\nfor i in range(n):\n data = list(map(int, input().split()))\n c[i] = data[0]\n a[i] = data[1:]\nans = inf\nfor i in range(2**n):\n money = 0\n know = [0] * m\n for j in range(n):\n if (i >> j) & 1:\n money += c[j]\n for k in range(m):\n know[k] += a[j][k]\n for z in know:\n if z < x:\n break\n else:\n ans = min(ans, money)\n\nif ans == inf:\n print(-1)\nelse:\n print(ans)", "problem_context": "Score : 300 points\n\nProblem\n\nTakahashi, who is a novice in competitive programming, wants to learn M algorithms.\nInitially, his understanding level of each of the M algorithms is 0.\n\nTakahashi is visiting a bookstore, where he finds N books on algorithms.\nThe i-th book (1\\leq i\\leq N) is sold for C_i yen (the currency of Japan). If he buys and reads it, his understanding level of the j-th algorithm will increase by A_{i,j} for each j (1\\leq j\\leq M).\nThere is no other way to increase the understanding levels of the algorithms.\n\nTakahashi's objective is to make his understanding levels of all the M algorithms X or higher. Determine whether this objective is achievable. If it is achievable, find the minimum amount of money needed to achieve it.\n\nConstraints\n\nAll values in input are integers.\n\n1\\leq N, M\\leq 12\n\n1\\leq X\\leq 10^5\n\n1\\leq C_i \\leq 10^5\n\n0\\leq A_{i, j} \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X\nC_1 A_{1,1} A_{1,2} \\cdots A_{1,M}\nC_2 A_{2,1} A_{2,2} \\cdots A_{2,M}\n\\vdots\nC_N A_{N,1} A_{N,2} \\cdots A_{N,M}\n\nOutput\n\nIf the objective is not achievable, print -1; otherwise, print the minimum amount of money needed to achieve it.\n\nSample Input 1\n\n3 3 10\n60 2 2 4\n70 8 7 9\n50 2 3 9\n\nSample Output 1\n\n120\n\nBuying the second and third books makes his understanding levels of all the algorithms 10 or higher, at the minimum cost possible.\n\nSample Input 2\n\n3 3 10\n100 3 1 4\n100 1 5 9\n100 2 6 5\n\nSample Output 2\n\n-1\n\nBuying all the books is still not enough to make his understanding levels of all the algorithms 10 or higher.\n\nSample Input 3\n\n8 5 22\n100 3 7 5 3 1\n164 4 5 2 7 8\n334 7 2 7 2 9\n234 4 7 2 8 2\n541 5 4 3 3 6\n235 4 8 6 9 7\n394 3 6 1 6 2\n872 8 4 3 7 2\n\nSample Output 3\n\n1067", "sample_input": "3 3 10\n60 2 2 4\n70 8 7 9\n50 2 3 9\n"}, "reference_outputs": ["120\n"], "source_document_id": "p02683", "source_text": "Score : 300 points\n\nProblem\n\nTakahashi, who is a novice in competitive programming, wants to learn M algorithms.\nInitially, his understanding level of each of the M algorithms is 0.\n\nTakahashi is visiting a bookstore, where he finds N books on algorithms.\nThe i-th book (1\\leq i\\leq N) is sold for C_i yen (the currency of Japan). If he buys and reads it, his understanding level of the j-th algorithm will increase by A_{i,j} for each j (1\\leq j\\leq M).\nThere is no other way to increase the understanding levels of the algorithms.\n\nTakahashi's objective is to make his understanding levels of all the M algorithms X or higher. Determine whether this objective is achievable. If it is achievable, find the minimum amount of money needed to achieve it.\n\nConstraints\n\nAll values in input are integers.\n\n1\\leq N, M\\leq 12\n\n1\\leq X\\leq 10^5\n\n1\\leq C_i \\leq 10^5\n\n0\\leq A_{i, j} \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X\nC_1 A_{1,1} A_{1,2} \\cdots A_{1,M}\nC_2 A_{2,1} A_{2,2} \\cdots A_{2,M}\n\\vdots\nC_N A_{N,1} A_{N,2} \\cdots A_{N,M}\n\nOutput\n\nIf the objective is not achievable, print -1; otherwise, print the minimum amount of money needed to achieve it.\n\nSample Input 1\n\n3 3 10\n60 2 2 4\n70 8 7 9\n50 2 3 9\n\nSample Output 1\n\n120\n\nBuying the second and third books makes his understanding levels of all the algorithms 10 or higher, at the minimum cost possible.\n\nSample Input 2\n\n3 3 10\n100 3 1 4\n100 1 5 9\n100 2 6 5\n\nSample Output 2\n\n-1\n\nBuying all the books is still not enough to make his understanding levels of all the algorithms 10 or higher.\n\nSample Input 3\n\n8 5 22\n100 3 7 5 3 1\n164 4 5 2 7 8\n334 7 2 7 2 9\n234 4 7 2 8 2\n541 5 4 3 3 6\n235 4 8 6 9 7\n394 3 6 1 6 2\n872 8 4 3 7 2\n\nSample Output 3\n\n1067", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 535, "cpu_time_ms": 79, "memory_kb": 68436}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s516578515", "group_id": "codeNet:p02685", "input_text": "n, m, k = map(int, input().split())\nz = 998244353\nif n <= k+1:\n a = 1\n for i in range(n):\n a = a*m%z\n print(a)\nelse:\n a = [m*((m-1)**(n-1))]\n b = [1]\n c = 0\n for i in range(k):\n b.append(int(b[-1]/(i+1)*(n-i-1)%z))\n for i in range(k):\n a.append(int((a[-1]*b[i+1]%z)/b[i]/(m-1)))\n for i in range(k+1):\n c += a[i]\n print(c%z)", "language": "Python", "metadata": {"date": 1589171976, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02685.html", "problem_id": "p02685", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02685/input.txt", "sample_output_relpath": "derived/input_output/data/p02685/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02685/Python/s516578515.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s516578515", "user_id": "u785573018"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "n, m, k = map(int, input().split())\nz = 998244353\nif n <= k+1:\n a = 1\n for i in range(n):\n a = a*m%z\n print(a)\nelse:\n a = [m*((m-1)**(n-1))]\n b = [1]\n c = 0\n for i in range(k):\n b.append(int(b[-1]/(i+1)*(n-i-1)%z))\n for i in range(k):\n a.append(int((a[-1]*b[i+1]%z)/b[i]/(m-1)))\n for i in range(k+1):\n c += a[i]\n print(c%z)", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N blocks arranged in a row. Let us paint these blocks.\n\nWe will consider two ways to paint the blocks different if and only if there is a block painted in different colors in those two ways.\n\nFind the number of ways to paint the blocks under the following conditions:\n\nFor each block, use one of the M colors, Color 1 through Color M, to paint it. It is not mandatory to use all the colors.\n\nThere may be at most K pairs of adjacent blocks that are painted in the same color.\n\nSince the count may be enormous, print it modulo 998244353.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 2 \\times 10^5\n\n0 \\leq K \\leq N - 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2 1\n\nSample Output 1\n\n6\n\nThe following ways to paint the blocks satisfy the conditions: 112, 121, 122, 211, 212, and 221. Here, digits represent the colors of the blocks.\n\nSample Input 2\n\n100 100 0\n\nSample Output 2\n\n73074801\n\nSample Input 3\n\n60522 114575 7559\n\nSample Output 3\n\n479519525", "sample_input": "3 2 1\n"}, "reference_outputs": ["6\n"], "source_document_id": "p02685", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N blocks arranged in a row. Let us paint these blocks.\n\nWe will consider two ways to paint the blocks different if and only if there is a block painted in different colors in those two ways.\n\nFind the number of ways to paint the blocks under the following conditions:\n\nFor each block, use one of the M colors, Color 1 through Color M, to paint it. It is not mandatory to use all the colors.\n\nThere may be at most K pairs of adjacent blocks that are painted in the same color.\n\nSince the count may be enormous, print it modulo 998244353.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 2 \\times 10^5\n\n0 \\leq K \\leq N - 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2 1\n\nSample Output 1\n\n6\n\nThe following ways to paint the blocks satisfy the conditions: 112, 121, 122, 211, 212, and 221. Here, digits represent the colors of the blocks.\n\nSample Input 2\n\n100 100 0\n\nSample Output 2\n\n73074801\n\nSample Input 3\n\n60522 114575 7559\n\nSample Output 3\n\n479519525", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 381, "cpu_time_ms": 1904, "memory_kb": 14900}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s914709316", "group_id": "codeNet:p02687", "input_text": "s = input()\nans = \"ABC\"\nif s ==\"ABC\":\n ans = \"ARC\"\nprint(ans)", "language": "Python", "metadata": {"date": 1588698386, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02687.html", "problem_id": "p02687", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02687/input.txt", "sample_output_relpath": "derived/input_output/data/p02687/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02687/Python/s914709316.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s914709316", "user_id": "u652057333"}, "prompt_components": {"gold_output": "ARC\n", "input_to_evaluate": "s = input()\nans = \"ABC\"\nif s ==\"ABC\":\n ans = \"ARC\"\nprint(ans)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "sample_input": "ABC\n"}, "reference_outputs": ["ARC\n"], "source_document_id": "p02687", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 64, "cpu_time_ms": 61, "memory_kb": 61808}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s770809686", "group_id": "codeNet:p02687", "input_text": "s=input()\nif s==\"ABC\":\n print(\"ARC\")\nelse:\n print(\"ABC\")", "language": "Python", "metadata": {"date": 1588554055, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02687.html", "problem_id": "p02687", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02687/input.txt", "sample_output_relpath": "derived/input_output/data/p02687/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02687/Python/s770809686.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s770809686", "user_id": "u320511454"}, "prompt_components": {"gold_output": "ARC\n", "input_to_evaluate": "s=input()\nif s==\"ABC\":\n print(\"ARC\")\nelse:\n print(\"ABC\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "sample_input": "ABC\n"}, "reference_outputs": ["ARC\n"], "source_document_id": "p02687", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 58, "cpu_time_ms": 24, "memory_kb": 9044}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s957117915", "group_id": "codeNet:p02687", "input_text": "from sys import stdin\nfrom sys import setrecursionlimit\nfrom collections import Counter, deque, defaultdict\nfrom math import floor, ceil\nfrom bisect import bisect_left\nsetrecursionlimit(100000)\n\nINF = int(1e10)\nMOD = int(1e9 + 7)\n\ndef input():\n return stdin.readline()[:-1]\n\ndef main():\n from builtins import int, map\n S = input()\n if S == 'ABC':\n print(\"ARC\")\n else:\n print(\"ABC\")\n\nif __name__ == '__main__':\n main()", "language": "Python", "metadata": {"date": 1588554029, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02687.html", "problem_id": "p02687", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02687/input.txt", "sample_output_relpath": "derived/input_output/data/p02687/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02687/Python/s957117915.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s957117915", "user_id": "u047102107"}, "prompt_components": {"gold_output": "ARC\n", "input_to_evaluate": "from sys import stdin\nfrom sys import setrecursionlimit\nfrom collections import Counter, deque, defaultdict\nfrom math import floor, ceil\nfrom bisect import bisect_left\nsetrecursionlimit(100000)\n\nINF = int(1e10)\nMOD = int(1e9 + 7)\n\ndef input():\n return stdin.readline()[:-1]\n\ndef main():\n from builtins import int, map\n S = input()\n if S == 'ABC':\n print(\"ARC\")\n else:\n print(\"ABC\")\n\nif __name__ == '__main__':\n main()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "sample_input": "ABC\n"}, "reference_outputs": ["ARC\n"], "source_document_id": "p02687", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 449, "cpu_time_ms": 108, "memory_kb": 65216}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s991246066", "group_id": "codeNet:p02688", "input_text": "N, K = list(map(int, input().split()))\n\nSnack = [0] * N\n\nfor i in range(K):\n d = int(input())\n A = list(map(int, input().split()))\n\n for j in range(d):\n Snack[A[j]-1] += 1\n \nsum = 0\nfor i in range(N):\n if (Snack[i] == 0):\n sum += 1\n\nprint(sum)\n", "language": "Python", "metadata": {"date": 1588554610, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02688.html", "problem_id": "p02688", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02688/input.txt", "sample_output_relpath": "derived/input_output/data/p02688/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02688/Python/s991246066.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s991246066", "user_id": "u880400515"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "N, K = list(map(int, input().split()))\n\nSnack = [0] * N\n\nfor i in range(K):\n d = int(input())\n A = list(map(int, input().split()))\n\n for j in range(d):\n Snack[A[j]-1] += 1\n \nsum = 0\nfor i in range(N):\n if (Snack[i] == 0):\n sum += 1\n\nprint(sum)\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cdots, A_{i, {d_i}}.\n\nTakahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n1 \\leq d_i \\leq N\n\n1 \\leq A_{i, 1} < \\cdots < A_{i, d_i} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nd_1\nA_{1, 1} \\cdots A_{1, d_1}\n\\vdots\nd_K\nA_{K, 1} \\cdots A_{K, d_K}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n2\n1 3\n1\n3\n\nSample Output 1\n\n1\n\nSnuke 1 has Snack 1.\n\nSnuke 2 has no snacks.\n\nSnuke 3 has Snack 1 and 2.\n\nThus, there will be one victim: Snuke 2.\n\nSample Input 2\n\n3 3\n1\n3\n1\n3\n1\n3\n\nSample Output 2\n\n2", "sample_input": "3 2\n2\n1 3\n1\n3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02688", "source_text": "Score : 200 points\n\nProblem Statement\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cdots, A_{i, {d_i}}.\n\nTakahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n1 \\leq d_i \\leq N\n\n1 \\leq A_{i, 1} < \\cdots < A_{i, d_i} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nd_1\nA_{1, 1} \\cdots A_{1, d_1}\n\\vdots\nd_K\nA_{K, 1} \\cdots A_{K, d_K}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n2\n1 3\n1\n3\n\nSample Output 1\n\n1\n\nSnuke 1 has Snack 1.\n\nSnuke 2 has no snacks.\n\nSnuke 3 has Snack 1 and 2.\n\nThus, there will be one victim: Snuke 2.\n\nSample Input 2\n\n3 3\n1\n3\n1\n3\n1\n3\n\nSample Output 2\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 273, "cpu_time_ms": 22, "memory_kb": 9132}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s693745707", "group_id": "codeNet:p02688", "input_text": "n,k = map(int,input().split())\nd = [0 for _ in range(k)]\na = []\nfor i in range(k):\n d[i] = int(input())\n a.append(list(map(int,input().split())))\nsn = [0 for _ in range(n)]\nfor i in range(k):\n for j in range(d[i]):\n sn[a[i][j]-1] = 1\nans = 0\nprint(sn.count(0))", "language": "Python", "metadata": {"date": 1588554608, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02688.html", "problem_id": "p02688", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02688/input.txt", "sample_output_relpath": "derived/input_output/data/p02688/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02688/Python/s693745707.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s693745707", "user_id": "u244416763"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "n,k = map(int,input().split())\nd = [0 for _ in range(k)]\na = []\nfor i in range(k):\n d[i] = int(input())\n a.append(list(map(int,input().split())))\nsn = [0 for _ in range(n)]\nfor i in range(k):\n for j in range(d[i]):\n sn[a[i][j]-1] = 1\nans = 0\nprint(sn.count(0))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cdots, A_{i, {d_i}}.\n\nTakahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n1 \\leq d_i \\leq N\n\n1 \\leq A_{i, 1} < \\cdots < A_{i, d_i} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nd_1\nA_{1, 1} \\cdots A_{1, d_1}\n\\vdots\nd_K\nA_{K, 1} \\cdots A_{K, d_K}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n2\n1 3\n1\n3\n\nSample Output 1\n\n1\n\nSnuke 1 has Snack 1.\n\nSnuke 2 has no snacks.\n\nSnuke 3 has Snack 1 and 2.\n\nThus, there will be one victim: Snuke 2.\n\nSample Input 2\n\n3 3\n1\n3\n1\n3\n1\n3\n\nSample Output 2\n\n2", "sample_input": "3 2\n2\n1 3\n1\n3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02688", "source_text": "Score : 200 points\n\nProblem Statement\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cdots, A_{i, {d_i}}.\n\nTakahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n1 \\leq d_i \\leq N\n\n1 \\leq A_{i, 1} < \\cdots < A_{i, d_i} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nd_1\nA_{1, 1} \\cdots A_{1, d_1}\n\\vdots\nd_K\nA_{K, 1} \\cdots A_{K, d_K}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n2\n1 3\n1\n3\n\nSample Output 1\n\n1\n\nSnuke 1 has Snack 1.\n\nSnuke 2 has no snacks.\n\nSnuke 3 has Snack 1 and 2.\n\nThus, there will be one victim: Snuke 2.\n\nSample Input 2\n\n3 3\n1\n3\n1\n3\n1\n3\n\nSample Output 2\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 276, "cpu_time_ms": 20, "memory_kb": 9288}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s544541368", "group_id": "codeNet:p02688", "input_text": "n, k = map(int, input().split())\nb = [0]*102\nfor i in range(k):\n d = int(input())\n a = list(map(int, input().split()))\n for j in a:\n b[j] = 1\nprint(n - sum(b))", "language": "Python", "metadata": {"date": 1588554540, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02688.html", "problem_id": "p02688", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02688/input.txt", "sample_output_relpath": "derived/input_output/data/p02688/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02688/Python/s544541368.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s544541368", "user_id": "u064869465"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "n, k = map(int, input().split())\nb = [0]*102\nfor i in range(k):\n d = int(input())\n a = list(map(int, input().split()))\n for j in a:\n b[j] = 1\nprint(n - sum(b))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cdots, A_{i, {d_i}}.\n\nTakahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n1 \\leq d_i \\leq N\n\n1 \\leq A_{i, 1} < \\cdots < A_{i, d_i} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nd_1\nA_{1, 1} \\cdots A_{1, d_1}\n\\vdots\nd_K\nA_{K, 1} \\cdots A_{K, d_K}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n2\n1 3\n1\n3\n\nSample Output 1\n\n1\n\nSnuke 1 has Snack 1.\n\nSnuke 2 has no snacks.\n\nSnuke 3 has Snack 1 and 2.\n\nThus, there will be one victim: Snuke 2.\n\nSample Input 2\n\n3 3\n1\n3\n1\n3\n1\n3\n\nSample Output 2\n\n2", "sample_input": "3 2\n2\n1 3\n1\n3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02688", "source_text": "Score : 200 points\n\nProblem Statement\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cdots, A_{i, {d_i}}.\n\nTakahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n1 \\leq d_i \\leq N\n\n1 \\leq A_{i, 1} < \\cdots < A_{i, d_i} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nd_1\nA_{1, 1} \\cdots A_{1, d_1}\n\\vdots\nd_K\nA_{K, 1} \\cdots A_{K, d_K}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n2\n1 3\n1\n3\n\nSample Output 1\n\n1\n\nSnuke 1 has Snack 1.\n\nSnuke 2 has no snacks.\n\nSnuke 3 has Snack 1 and 2.\n\nThus, there will be one victim: Snuke 2.\n\nSample Input 2\n\n3 3\n1\n3\n1\n3\n1\n3\n\nSample Output 2\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 176, "cpu_time_ms": 58, "memory_kb": 67356}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s217291991", "group_id": "codeNet:p02689", "input_text": "nobs, nroads = [int(x) for x in input().strip().split()]\nrec = [False]*nobs\nhs = [int(x) for x in input().strip().split()]\nd = {}\nwhile nroads > 0:\n src, dst = [int(x) for x in input().strip().split()]\n if src not in d:\n d[src] = [dst]\n else:\n d[src].append(dst)\n nroads -= 1\ni = 0\ntotal = 0\nfor i in range(nobs):\n if not rec[i]:\n q = [i]\n while len(q) > 0:\n src = q.pop(0)\n found = True\n for dst in d[src]:\n if hs[src] <= hs[dst]:\n found = False\n break\n q.append(dst)\n if found:\n total += 1\nprint(total)\n \n", "language": "Python", "metadata": {"date": 1588563642, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02689.html", "problem_id": "p02689", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02689/input.txt", "sample_output_relpath": "derived/input_output/data/p02689/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02689/Python/s217291991.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s217291991", "user_id": "u778097144"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "nobs, nroads = [int(x) for x in input().strip().split()]\nrec = [False]*nobs\nhs = [int(x) for x in input().strip().split()]\nd = {}\nwhile nroads > 0:\n src, dst = [int(x) for x in input().strip().split()]\n if src not in d:\n d[src] = [dst]\n else:\n d[src].append(dst)\n nroads -= 1\ni = 0\ntotal = 0\nfor i in range(nobs):\n if not rec[i]:\n q = [i]\n while len(q) > 0:\n src = q.pop(0)\n found = True\n for dst in d[src]:\n if hs[src] <= hs[dst]:\n found = False\n break\n q.append(dst)\n if found:\n total += 1\nprint(total)\n \n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i.\nThere are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.\n\nObs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road.\nNote that Obs. i is also good when no observatory can be reached from Obs. i using just one road.\n\nHow many good observatories are there?\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\n1 \\leq A_i,B_i \\leq N\n\nA_i \\neq B_i\n\nMultiple roads may connect the same pair of observatories.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nH_1 H_2 ... H_N\nA_1 B_1\nA_2 B_2\n:\nA_M B_M\n\nOutput\n\nPrint the number of good observatories.\n\nSample Input 1\n\n4 3\n1 2 3 4\n1 3\n2 3\n2 4\n\nSample Output 1\n\n2\n\nFrom Obs. 1, you can reach Obs. 3 using just one road. The elevation of Obs. 1 is not higher than that of Obs. 3, so Obs. 1 is not good.\n\nFrom Obs. 2, you can reach Obs. 3 and 4 using just one road. The elevation of Obs. 2 is not higher than that of Obs. 3, so Obs. 2 is not good.\n\nFrom Obs. 3, you can reach Obs. 1 and 2 using just one road. The elevation of Obs. 3 is higher than those of Obs. 1 and 2, so Obs. 3 is good.\n\nFrom Obs. 4, you can reach Obs. 2 using just one road. The elevation of Obs. 4 is higher than that of Obs. 2, so Obs. 4 is good.\n\nThus, the good observatories are Obs. 3 and 4, so there are two good observatories.\n\nSample Input 2\n\n6 5\n8 6 9 1 2 1\n1 3\n4 2\n4 3\n4 6\n4 6\n\nSample Output 2\n\n3", "sample_input": "4 3\n1 2 3 4\n1 3\n2 3\n2 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02689", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i.\nThere are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.\n\nObs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road.\nNote that Obs. i is also good when no observatory can be reached from Obs. i using just one road.\n\nHow many good observatories are there?\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\n1 \\leq A_i,B_i \\leq N\n\nA_i \\neq B_i\n\nMultiple roads may connect the same pair of observatories.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nH_1 H_2 ... H_N\nA_1 B_1\nA_2 B_2\n:\nA_M B_M\n\nOutput\n\nPrint the number of good observatories.\n\nSample Input 1\n\n4 3\n1 2 3 4\n1 3\n2 3\n2 4\n\nSample Output 1\n\n2\n\nFrom Obs. 1, you can reach Obs. 3 using just one road. The elevation of Obs. 1 is not higher than that of Obs. 3, so Obs. 1 is not good.\n\nFrom Obs. 2, you can reach Obs. 3 and 4 using just one road. The elevation of Obs. 2 is not higher than that of Obs. 3, so Obs. 2 is not good.\n\nFrom Obs. 3, you can reach Obs. 1 and 2 using just one road. The elevation of Obs. 3 is higher than those of Obs. 1 and 2, so Obs. 3 is good.\n\nFrom Obs. 4, you can reach Obs. 2 using just one road. The elevation of Obs. 4 is higher than that of Obs. 2, so Obs. 4 is good.\n\nThus, the good observatories are Obs. 3 and 4, so there are two good observatories.\n\nSample Input 2\n\n6 5\n8 6 9 1 2 1\n1 3\n4 2\n4 3\n4 6\n4 6\n\nSample Output 2\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 584, "cpu_time_ms": 281, "memory_kb": 28180}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s592532689", "group_id": "codeNet:p02690", "input_text": "X=int(input())\n\nfor b in range(10000):\n for a in range(int(X**(1/5))+1):\n if a**5-b**5 == X:\n ans = str(a)+\" \"+str(b)\n break\n if a**5+b**5 == X:\n ans = str(a)+\" \"+str(-b)\n break\nprint(ans)", "language": "Python", "metadata": {"date": 1594586278, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02690.html", "problem_id": "p02690", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02690/input.txt", "sample_output_relpath": "derived/input_output/data/p02690/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02690/Python/s592532689.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s592532689", "user_id": "u507456172"}, "prompt_components": {"gold_output": "2 -1\n", "input_to_evaluate": "X=int(input())\n\nfor b in range(10000):\n for a in range(int(X**(1/5))+1):\n if a**5-b**5 == X:\n ans = str(a)+\" \"+str(b)\n break\n if a**5+b**5 == X:\n ans = str(a)+\" \"+str(-b)\n break\nprint(ans)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGive a pair of integers (A, B) such that A^5-B^5 = X.\nIt is guaranteed that there exists such a pair for the given integer X.\n\nConstraints\n\n1 \\leq X \\leq 10^9\n\nX is an integer.\n\nThere exists a pair of integers (A, B) satisfying the condition in Problem Statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint A and B, with space in between.\nIf there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.\n\nA B\n\nSample Input 1\n\n33\n\nSample Output 1\n\n2 -1\n\nFor A=2 and B=-1, A^5-B^5 = 33.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0 -1", "sample_input": "33\n"}, "reference_outputs": ["2 -1\n"], "source_document_id": "p02690", "source_text": "Score : 400 points\n\nProblem Statement\n\nGive a pair of integers (A, B) such that A^5-B^5 = X.\nIt is guaranteed that there exists such a pair for the given integer X.\n\nConstraints\n\n1 \\leq X \\leq 10^9\n\nX is an integer.\n\nThere exists a pair of integers (A, B) satisfying the condition in Problem Statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint A and B, with space in between.\nIf there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.\n\nA B\n\nSample Input 1\n\n33\n\nSample Output 1\n\n2 -1\n\nFor A=2 and B=-1, A^5-B^5 = 33.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0 -1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 215, "cpu_time_ms": 634, "memory_kb": 9376}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s045587892", "group_id": "codeNet:p02690", "input_text": "x=int(input())\nfor i in range(-120,120):\n for j in range(-120.120):\n if i**5-j**5==x:\n print(i,j)\n break", "language": "Python", "metadata": {"date": 1592741498, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02690.html", "problem_id": "p02690", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02690/input.txt", "sample_output_relpath": "derived/input_output/data/p02690/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02690/Python/s045587892.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s045587892", "user_id": "u768256617"}, "prompt_components": {"gold_output": "2 -1\n", "input_to_evaluate": "x=int(input())\nfor i in range(-120,120):\n for j in range(-120.120):\n if i**5-j**5==x:\n print(i,j)\n break", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGive a pair of integers (A, B) such that A^5-B^5 = X.\nIt is guaranteed that there exists such a pair for the given integer X.\n\nConstraints\n\n1 \\leq X \\leq 10^9\n\nX is an integer.\n\nThere exists a pair of integers (A, B) satisfying the condition in Problem Statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint A and B, with space in between.\nIf there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.\n\nA B\n\nSample Input 1\n\n33\n\nSample Output 1\n\n2 -1\n\nFor A=2 and B=-1, A^5-B^5 = 33.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0 -1", "sample_input": "33\n"}, "reference_outputs": ["2 -1\n"], "source_document_id": "p02690", "source_text": "Score : 400 points\n\nProblem Statement\n\nGive a pair of integers (A, B) such that A^5-B^5 = X.\nIt is guaranteed that there exists such a pair for the given integer X.\n\nConstraints\n\n1 \\leq X \\leq 10^9\n\nX is an integer.\n\nThere exists a pair of integers (A, B) satisfying the condition in Problem Statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint A and B, with space in between.\nIf there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.\n\nA B\n\nSample Input 1\n\n33\n\nSample Output 1\n\n2 -1\n\nFor A=2 and B=-1, A^5-B^5 = 33.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0 -1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 118, "cpu_time_ms": 23, "memory_kb": 9164}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s588734363", "group_id": "codeNet:p02690", "input_text": "X = int(input())\nfor a in range(-200,200):\n for b in range(-200,200):\n if a**5 - b**5 == X:\n print(a,b)\n exit()\n", "language": "Python", "metadata": {"date": 1588560836, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02690.html", "problem_id": "p02690", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02690/input.txt", "sample_output_relpath": "derived/input_output/data/p02690/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02690/Python/s588734363.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s588734363", "user_id": "u267300160"}, "prompt_components": {"gold_output": "2 -1\n", "input_to_evaluate": "X = int(input())\nfor a in range(-200,200):\n for b in range(-200,200):\n if a**5 - b**5 == X:\n print(a,b)\n exit()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGive a pair of integers (A, B) such that A^5-B^5 = X.\nIt is guaranteed that there exists such a pair for the given integer X.\n\nConstraints\n\n1 \\leq X \\leq 10^9\n\nX is an integer.\n\nThere exists a pair of integers (A, B) satisfying the condition in Problem Statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint A and B, with space in between.\nIf there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.\n\nA B\n\nSample Input 1\n\n33\n\nSample Output 1\n\n2 -1\n\nFor A=2 and B=-1, A^5-B^5 = 33.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0 -1", "sample_input": "33\n"}, "reference_outputs": ["2 -1\n"], "source_document_id": "p02690", "source_text": "Score : 400 points\n\nProblem Statement\n\nGive a pair of integers (A, B) such that A^5-B^5 = X.\nIt is guaranteed that there exists such a pair for the given integer X.\n\nConstraints\n\n1 \\leq X \\leq 10^9\n\nX is an integer.\n\nThere exists a pair of integers (A, B) satisfying the condition in Problem Statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint A and B, with space in between.\nIf there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.\n\nA B\n\nSample Input 1\n\n33\n\nSample Output 1\n\n2 -1\n\nFor A=2 and B=-1, A^5-B^5 = 33.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0 -1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 144, "cpu_time_ms": 70, "memory_kb": 9076}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s911286363", "group_id": "codeNet:p02690", "input_text": "# ANSHUL GAUTAM\n# IIIT-D\n\nfrom math import *\nfrom copy import *\t\t\t\t\t# ll = deepcopy(l)\nfrom heapq import *\t\t\t\t\t# heappush(hp,x)\nfrom string import *\t\t\t\t# alpha = ascii_lowercase\nfrom random import *\t\t\t\t# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference\nfrom bisect import *\t\t\t\t# bisect_left(arr,x,start,end) => start and end parameters are temporary\nfrom sys import stdin\t\t\t\t# bisect_left return leftmost position where x should be inserted to keep sorted\nfrom sys import maxsize\t\t\t\t# minn = -maxsize\nfrom operator import *\t\t\t\t# d = sorted(d.items(), key=itemgetter(1))\nfrom itertools import *\t\t\t\t# pre = [0] + list(accumulate(l))\nfrom collections import Counter\t\t# d = dict(Counter(l))\nfrom collections import defaultdict # d = defaultdict(list)\n\n'''\n\n'''\n\ndef solve(x):\n\tl = []\n\td = {}\n\tfor i in range(-1000,1000):\n\t\tzz = i**5\n\t\td[zz] = i\n\t\tl.append(zz)\n\tfor a in range(-2000,2000):\n\t\tzz = a**5\n\t\tif(zz - x in l):\n\t\t\tprint(a,d[zz-x])\n\t\t\treturn\n\nX = int(stdin.readline())\nans = solve(X)\n\n\n", "language": "Python", "metadata": {"date": 1588557235, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02690.html", "problem_id": "p02690", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02690/input.txt", "sample_output_relpath": "derived/input_output/data/p02690/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02690/Python/s911286363.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s911286363", "user_id": "u056977516"}, "prompt_components": {"gold_output": "2 -1\n", "input_to_evaluate": "# ANSHUL GAUTAM\n# IIIT-D\n\nfrom math import *\nfrom copy import *\t\t\t\t\t# ll = deepcopy(l)\nfrom heapq import *\t\t\t\t\t# heappush(hp,x)\nfrom string import *\t\t\t\t# alpha = ascii_lowercase\nfrom random import *\t\t\t\t# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference\nfrom bisect import *\t\t\t\t# bisect_left(arr,x,start,end) => start and end parameters are temporary\nfrom sys import stdin\t\t\t\t# bisect_left return leftmost position where x should be inserted to keep sorted\nfrom sys import maxsize\t\t\t\t# minn = -maxsize\nfrom operator import *\t\t\t\t# d = sorted(d.items(), key=itemgetter(1))\nfrom itertools import *\t\t\t\t# pre = [0] + list(accumulate(l))\nfrom collections import Counter\t\t# d = dict(Counter(l))\nfrom collections import defaultdict # d = defaultdict(list)\n\n'''\n\n'''\n\ndef solve(x):\n\tl = []\n\td = {}\n\tfor i in range(-1000,1000):\n\t\tzz = i**5\n\t\td[zz] = i\n\t\tl.append(zz)\n\tfor a in range(-2000,2000):\n\t\tzz = a**5\n\t\tif(zz - x in l):\n\t\t\tprint(a,d[zz-x])\n\t\t\treturn\n\nX = int(stdin.readline())\nans = solve(X)\n\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGive a pair of integers (A, B) such that A^5-B^5 = X.\nIt is guaranteed that there exists such a pair for the given integer X.\n\nConstraints\n\n1 \\leq X \\leq 10^9\n\nX is an integer.\n\nThere exists a pair of integers (A, B) satisfying the condition in Problem Statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint A and B, with space in between.\nIf there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.\n\nA B\n\nSample Input 1\n\n33\n\nSample Output 1\n\n2 -1\n\nFor A=2 and B=-1, A^5-B^5 = 33.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0 -1", "sample_input": "33\n"}, "reference_outputs": ["2 -1\n"], "source_document_id": "p02690", "source_text": "Score : 400 points\n\nProblem Statement\n\nGive a pair of integers (A, B) such that A^5-B^5 = X.\nIt is guaranteed that there exists such a pair for the given integer X.\n\nConstraints\n\n1 \\leq X \\leq 10^9\n\nX is an integer.\n\nThere exists a pair of integers (A, B) satisfying the condition in Problem Statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint A and B, with space in between.\nIf there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.\n\nA B\n\nSample Input 1\n\n33\n\nSample Output 1\n\n2 -1\n\nFor A=2 and B=-1, A^5-B^5 = 33.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0 -1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1012, "cpu_time_ms": 617, "memory_kb": 76772}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s674359107", "group_id": "codeNet:p02690", "input_text": "import math\n\nX = int(input())\n\n\ndef calculate(x):\n\n loop = True\n b = 0\n while loop:\n tmp1 = x + b ** 5\n a1 = math.pow(tmp1, 1 / 5)\n\n if float.is_integer(a1):\n print(int(a1), int(b))\n break\n\n tmp2 = x + (-1 * b) ** 5\n a2 = math.pow(tmp2, 1 / 5)\n if float.is_integer(a2):\n print(int(a2), int(-1*b))\n break\n b = b + 1\n\n\ncalculate(X)\n", "language": "Python", "metadata": {"date": 1588556895, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02690.html", "problem_id": "p02690", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02690/input.txt", "sample_output_relpath": "derived/input_output/data/p02690/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02690/Python/s674359107.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s674359107", "user_id": "u788068140"}, "prompt_components": {"gold_output": "2 -1\n", "input_to_evaluate": "import math\n\nX = int(input())\n\n\ndef calculate(x):\n\n loop = True\n b = 0\n while loop:\n tmp1 = x + b ** 5\n a1 = math.pow(tmp1, 1 / 5)\n\n if float.is_integer(a1):\n print(int(a1), int(b))\n break\n\n tmp2 = x + (-1 * b) ** 5\n a2 = math.pow(tmp2, 1 / 5)\n if float.is_integer(a2):\n print(int(a2), int(-1*b))\n break\n b = b + 1\n\n\ncalculate(X)\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGive a pair of integers (A, B) such that A^5-B^5 = X.\nIt is guaranteed that there exists such a pair for the given integer X.\n\nConstraints\n\n1 \\leq X \\leq 10^9\n\nX is an integer.\n\nThere exists a pair of integers (A, B) satisfying the condition in Problem Statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint A and B, with space in between.\nIf there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.\n\nA B\n\nSample Input 1\n\n33\n\nSample Output 1\n\n2 -1\n\nFor A=2 and B=-1, A^5-B^5 = 33.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0 -1", "sample_input": "33\n"}, "reference_outputs": ["2 -1\n"], "source_document_id": "p02690", "source_text": "Score : 400 points\n\nProblem Statement\n\nGive a pair of integers (A, B) such that A^5-B^5 = X.\nIt is guaranteed that there exists such a pair for the given integer X.\n\nConstraints\n\n1 \\leq X \\leq 10^9\n\nX is an integer.\n\nThere exists a pair of integers (A, B) satisfying the condition in Problem Statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint A and B, with space in between.\nIf there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.\n\nA B\n\nSample Input 1\n\n33\n\nSample Output 1\n\n2 -1\n\nFor A=2 and B=-1, A^5-B^5 = 33.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0 -1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 432, "cpu_time_ms": 21, "memory_kb": 9452}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s537281876", "group_id": "codeNet:p02691", "input_text": "N = int(input())\nA = list(map(int,input().split()))\ncnt = 0\nfor i in range(1,N):\n for j in range(N):\n if j+i > N-1:\n break\n else:\n if A[j]+A[j+i] == i:\n cnt += 1\nprint(cnt)", "language": "Python", "metadata": {"date": 1588558334, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02691.html", "problem_id": "p02691", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02691/input.txt", "sample_output_relpath": "derived/input_output/data/p02691/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02691/Python/s537281876.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s537281876", "user_id": "u362563655"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "N = int(input())\nA = list(map(int,input().split()))\ncnt = 0\nfor i in range(1,N):\n for j in range(N):\n if j+i > N-1:\n break\n else:\n if A[j]+A[j+i] == i:\n cnt += 1\nprint(cnt)", "problem_context": "Score: 500 points\n\nProblem Statement\n\nYou are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.\n\nThere are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.\n\nAccording to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.\n\nThe absolute difference of their attendee numbers is equal to the sum of their heights.\n\nThere are \\frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?\n\nP.S.: We cannot let you know the secret.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the number of pairs satisfying the condition.\n\nSample Input 1\n\n6\n2 3 3 1 3 1\n\nSample Output 1\n\n3\n\nA_1 + A_4 = 3, so the pair of Attendee 1 and 4 satisfy the condition.\n\nA_2 + A_6 = 4, so the pair of Attendee 2 and 6 satisfy the condition.\n\nA_4 + A_6 = 2, so the pair of Attendee 4 and 6 satisfy the condition.\n\nNo other pair satisfies the condition, so you should print 3.\n\nSample Input 2\n\n6\n5 2 4 2 8 8\n\nSample Output 2\n\n0\n\nNo pair satisfies the condition, so you should print 0.\n\nSample Input 3\n\n32\n3 1 4 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\n\nSample Output 3\n\n22", "sample_input": "6\n2 3 3 1 3 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02691", "source_text": "Score: 500 points\n\nProblem Statement\n\nYou are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.\n\nThere are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.\n\nAccording to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.\n\nThe absolute difference of their attendee numbers is equal to the sum of their heights.\n\nThere are \\frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?\n\nP.S.: We cannot let you know the secret.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the number of pairs satisfying the condition.\n\nSample Input 1\n\n6\n2 3 3 1 3 1\n\nSample Output 1\n\n3\n\nA_1 + A_4 = 3, so the pair of Attendee 1 and 4 satisfy the condition.\n\nA_2 + A_6 = 4, so the pair of Attendee 2 and 6 satisfy the condition.\n\nA_4 + A_6 = 2, so the pair of Attendee 4 and 6 satisfy the condition.\n\nNo other pair satisfies the condition, so you should print 3.\n\nSample Input 2\n\n6\n5 2 4 2 8 8\n\nSample Output 2\n\n0\n\nNo pair satisfies the condition, so you should print 0.\n\nSample Input 3\n\n32\n3 1 4 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\n\nSample Output 3\n\n22", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 226, "cpu_time_ms": 2208, "memory_kb": 92752}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s790731103", "group_id": "codeNet:p02691", "input_text": "n = int(input())\nAs = list(map(int, input().split()))\n\nas1 = [-(a+i) for i,a in enumerate(As)]\nas2 = [a-i for i,a in enumerate(As)]\n\nfrom collections import defaultdict\nd1 = defaultdict(int)\nd2 = defaultdict(int)\ncnt = 0\n\nfor a1,a2 in zip(as1,as2):\n d1[a1] += 1\n d2[a2] += 1\n# print(d1,d2)\n\nfor k in d1.keys():\n cnt += d1[k]*d2[k]\nprint(cnt)\n\n", "language": "Python", "metadata": {"date": 1588557833, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02691.html", "problem_id": "p02691", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02691/input.txt", "sample_output_relpath": "derived/input_output/data/p02691/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02691/Python/s790731103.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s790731103", "user_id": "u545368057"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "n = int(input())\nAs = list(map(int, input().split()))\n\nas1 = [-(a+i) for i,a in enumerate(As)]\nas2 = [a-i for i,a in enumerate(As)]\n\nfrom collections import defaultdict\nd1 = defaultdict(int)\nd2 = defaultdict(int)\ncnt = 0\n\nfor a1,a2 in zip(as1,as2):\n d1[a1] += 1\n d2[a2] += 1\n# print(d1,d2)\n\nfor k in d1.keys():\n cnt += d1[k]*d2[k]\nprint(cnt)\n\n", "problem_context": "Score: 500 points\n\nProblem Statement\n\nYou are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.\n\nThere are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.\n\nAccording to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.\n\nThe absolute difference of their attendee numbers is equal to the sum of their heights.\n\nThere are \\frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?\n\nP.S.: We cannot let you know the secret.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the number of pairs satisfying the condition.\n\nSample Input 1\n\n6\n2 3 3 1 3 1\n\nSample Output 1\n\n3\n\nA_1 + A_4 = 3, so the pair of Attendee 1 and 4 satisfy the condition.\n\nA_2 + A_6 = 4, so the pair of Attendee 2 and 6 satisfy the condition.\n\nA_4 + A_6 = 2, so the pair of Attendee 4 and 6 satisfy the condition.\n\nNo other pair satisfies the condition, so you should print 3.\n\nSample Input 2\n\n6\n5 2 4 2 8 8\n\nSample Output 2\n\n0\n\nNo pair satisfies the condition, so you should print 0.\n\nSample Input 3\n\n32\n3 1 4 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\n\nSample Output 3\n\n22", "sample_input": "6\n2 3 3 1 3 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02691", "source_text": "Score: 500 points\n\nProblem Statement\n\nYou are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.\n\nThere are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.\n\nAccording to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.\n\nThe absolute difference of their attendee numbers is equal to the sum of their heights.\n\nThere are \\frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?\n\nP.S.: We cannot let you know the secret.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the number of pairs satisfying the condition.\n\nSample Input 1\n\n6\n2 3 3 1 3 1\n\nSample Output 1\n\n3\n\nA_1 + A_4 = 3, so the pair of Attendee 1 and 4 satisfy the condition.\n\nA_2 + A_6 = 4, so the pair of Attendee 2 and 6 satisfy the condition.\n\nA_4 + A_6 = 2, so the pair of Attendee 4 and 6 satisfy the condition.\n\nNo other pair satisfies the condition, so you should print 3.\n\nSample Input 2\n\n6\n5 2 4 2 8 8\n\nSample Output 2\n\n0\n\nNo pair satisfies the condition, so you should print 0.\n\nSample Input 3\n\n32\n3 1 4 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\n\nSample Output 3\n\n22", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 352, "cpu_time_ms": 251, "memory_kb": 169488}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s503532427", "group_id": "codeNet:p02691", "input_text": "n = int(input())\na = list(map(int, input().split()))\nplus = {} # i + A[i]\nminus = {} # i - A[i]\nfor i in range(n):\n try:\n plus[i + a[i]] += 1\n except:\n plus[i + a[i]] = 1\n \n if i - a[i] > 0:\n try:\n minus[i - a[i]] += 1\n except:\n minus[i - a[i]] = 1\n\nans = 0\nfor key in plus.keys() & minus.keys():\n ans += plus[key] * minus[key]\nprint(ans)\n", "language": "Python", "metadata": {"date": 1588556189, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02691.html", "problem_id": "p02691", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02691/input.txt", "sample_output_relpath": "derived/input_output/data/p02691/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02691/Python/s503532427.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s503532427", "user_id": "u970523279"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "n = int(input())\na = list(map(int, input().split()))\nplus = {} # i + A[i]\nminus = {} # i - A[i]\nfor i in range(n):\n try:\n plus[i + a[i]] += 1\n except:\n plus[i + a[i]] = 1\n \n if i - a[i] > 0:\n try:\n minus[i - a[i]] += 1\n except:\n minus[i - a[i]] = 1\n\nans = 0\nfor key in plus.keys() & minus.keys():\n ans += plus[key] * minus[key]\nprint(ans)\n", "problem_context": "Score: 500 points\n\nProblem Statement\n\nYou are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.\n\nThere are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.\n\nAccording to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.\n\nThe absolute difference of their attendee numbers is equal to the sum of their heights.\n\nThere are \\frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?\n\nP.S.: We cannot let you know the secret.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the number of pairs satisfying the condition.\n\nSample Input 1\n\n6\n2 3 3 1 3 1\n\nSample Output 1\n\n3\n\nA_1 + A_4 = 3, so the pair of Attendee 1 and 4 satisfy the condition.\n\nA_2 + A_6 = 4, so the pair of Attendee 2 and 6 satisfy the condition.\n\nA_4 + A_6 = 2, so the pair of Attendee 4 and 6 satisfy the condition.\n\nNo other pair satisfies the condition, so you should print 3.\n\nSample Input 2\n\n6\n5 2 4 2 8 8\n\nSample Output 2\n\n0\n\nNo pair satisfies the condition, so you should print 0.\n\nSample Input 3\n\n32\n3 1 4 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\n\nSample Output 3\n\n22", "sample_input": "6\n2 3 3 1 3 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02691", "source_text": "Score: 500 points\n\nProblem Statement\n\nYou are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.\n\nThere are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.\n\nAccording to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.\n\nThe absolute difference of their attendee numbers is equal to the sum of their heights.\n\nThere are \\frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?\n\nP.S.: We cannot let you know the secret.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the number of pairs satisfying the condition.\n\nSample Input 1\n\n6\n2 3 3 1 3 1\n\nSample Output 1\n\n3\n\nA_1 + A_4 = 3, so the pair of Attendee 1 and 4 satisfy the condition.\n\nA_2 + A_6 = 4, so the pair of Attendee 2 and 6 satisfy the condition.\n\nA_4 + A_6 = 2, so the pair of Attendee 4 and 6 satisfy the condition.\n\nNo other pair satisfies the condition, so you should print 3.\n\nSample Input 2\n\n6\n5 2 4 2 8 8\n\nSample Output 2\n\n0\n\nNo pair satisfies the condition, so you should print 0.\n\nSample Input 3\n\n32\n3 1 4 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\n\nSample Output 3\n\n22", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 406, "cpu_time_ms": 162, "memory_kb": 157664}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s215248354", "group_id": "codeNet:p02692", "input_text": "import sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nn, *abc = map(int, input().split())\ns = [input().rstrip()for _ in range(n)]\ncond = {'AB': (0, 1), 'AC': (0, 2), 'BC': (1, 2)}\nlegend = ('A', 'B', 'C')\nans = []\n\n\ndef dfs(i):\n if -1 in abc:\n return 0\n elif i == n:\n print('Yes')\n print(*ans, sep='\\n')\n exit()\n # return 0\n else:\n idx1, idx2 = cond[s[i]]\n abc[idx1] += 1\n abc[idx2] -= 1\n ans.append(legend[idx1])\n dfs(i+1)\n ans.pop()\n abc[idx1] -= 1\n abc[idx2] += 1\n\n abc[idx1] -= 1\n abc[idx2] += 1\n ans.append(legend[idx2])\n dfs(i+1)\n ans.pop()\n abc[idx1] += 1\n abc[idx2] -= 1\n\n\ndfs(0)\nprint('No')\n", "language": "Python", "metadata": {"date": 1588701616, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02692.html", "problem_id": "p02692", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02692/input.txt", "sample_output_relpath": "derived/input_output/data/p02692/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02692/Python/s215248354.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s215248354", "user_id": "u790710233"}, "prompt_components": {"gold_output": "Yes\nA\nC\n", "input_to_evaluate": "import sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\nn, *abc = map(int, input().split())\ns = [input().rstrip()for _ in range(n)]\ncond = {'AB': (0, 1), 'AC': (0, 2), 'BC': (1, 2)}\nlegend = ('A', 'B', 'C')\nans = []\n\n\ndef dfs(i):\n if -1 in abc:\n return 0\n elif i == n:\n print('Yes')\n print(*ans, sep='\\n')\n exit()\n # return 0\n else:\n idx1, idx2 = cond[s[i]]\n abc[idx1] += 1\n abc[idx2] -= 1\n ans.append(legend[idx1])\n dfs(i+1)\n ans.pop()\n abc[idx1] -= 1\n abc[idx2] += 1\n\n abc[idx1] -= 1\n abc[idx2] += 1\n ans.append(legend[idx2])\n dfs(i+1)\n ans.pop()\n abc[idx1] += 1\n abc[idx2] -= 1\n\n\ndfs(0)\nprint('No')\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nThere is a game that involves three variables, denoted A, B, and C.\n\nAs the game progresses, there will be N events where you are asked to make a choice.\nEach of these choices is represented by a string s_i. If s_i is AB, you must add 1 to A or B then subtract 1 from the other; if s_i is AC, you must add 1 to A or C then subtract 1 from the other; if s_i is BC, you must add 1 to B or C then subtract 1 from the other.\n\nAfter each choice, none of A, B, and C should be negative.\n\nDetermine whether it is possible to make N choices under this condition. If it is possible, also give one such way to make the choices.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq A,B,C \\leq 10^9\n\nN, A, B, C are integers.\n\ns_i is AB, AC, or BC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C\ns_1\ns_2\n:\ns_N\n\nOutput\n\nIf it is possible to make N choices under the condition, print Yes; otherwise, print No.\n\nAlso, in the former case, show one such way to make the choices in the subsequent N lines. The (i+1)-th line should contain the name of the variable (A, B, or C) to which you add 1 in the i-th choice.\n\nSample Input 1\n\n2 1 3 0\nAB\nAC\n\nSample Output 1\n\nYes\nA\nC\n\nYou can successfully make two choices, as follows:\n\nIn the first choice, add 1 to A and subtract 1 from B. A becomes 2, and B becomes 2.\n\nIn the second choice, add 1 to C and subtract 1 from A. C becomes 1, and A becomes 1.\n\nSample Input 2\n\n3 1 0 0\nAB\nBC\nAB\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n1 0 9 0\nAC\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n8 6 9 1\nAC\nBC\nAB\nBC\nAC\nBC\nAB\nAB\n\nSample Output 4\n\nYes\nC\nB\nB\nC\nC\nB\nA\nA", "sample_input": "2 1 3 0\nAB\nAC\n"}, "reference_outputs": ["Yes\nA\nC\n"], "source_document_id": "p02692", "source_text": "Score : 600 points\n\nProblem Statement\n\nThere is a game that involves three variables, denoted A, B, and C.\n\nAs the game progresses, there will be N events where you are asked to make a choice.\nEach of these choices is represented by a string s_i. If s_i is AB, you must add 1 to A or B then subtract 1 from the other; if s_i is AC, you must add 1 to A or C then subtract 1 from the other; if s_i is BC, you must add 1 to B or C then subtract 1 from the other.\n\nAfter each choice, none of A, B, and C should be negative.\n\nDetermine whether it is possible to make N choices under this condition. If it is possible, also give one such way to make the choices.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq A,B,C \\leq 10^9\n\nN, A, B, C are integers.\n\ns_i is AB, AC, or BC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C\ns_1\ns_2\n:\ns_N\n\nOutput\n\nIf it is possible to make N choices under the condition, print Yes; otherwise, print No.\n\nAlso, in the former case, show one such way to make the choices in the subsequent N lines. The (i+1)-th line should contain the name of the variable (A, B, or C) to which you add 1 in the i-th choice.\n\nSample Input 1\n\n2 1 3 0\nAB\nAC\n\nSample Output 1\n\nYes\nA\nC\n\nYou can successfully make two choices, as follows:\n\nIn the first choice, add 1 to A and subtract 1 from B. A becomes 2, and B becomes 2.\n\nIn the second choice, add 1 to C and subtract 1 from A. C becomes 1, and A becomes 1.\n\nSample Input 2\n\n3 1 0 0\nAB\nBC\nAB\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n1 0 9 0\nAC\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n8 6 9 1\nAC\nBC\nAB\nBC\nAC\nBC\nAB\nAB\n\nSample Output 4\n\nYes\nC\nB\nB\nC\nC\nB\nA\nA", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 762, "cpu_time_ms": 262, "memory_kb": 105208}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s971023266", "group_id": "codeNet:p02693", "input_text": "k = int(input())\na, b = map(int, input().split())\n\nif b-a >= k:\n print('OK')\nelif a % k < b % k:\n print('NG')\nelse:\n print('OK')", "language": "Python", "metadata": {"date": 1588542023, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02693.html", "problem_id": "p02693", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02693/input.txt", "sample_output_relpath": "derived/input_output/data/p02693/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02693/Python/s971023266.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s971023266", "user_id": "u837383145"}, "prompt_components": {"gold_output": "OK\n", "input_to_evaluate": "k = int(input())\na, b = map(int, input().split())\n\nif b-a >= k:\n print('OK')\nelif a % k < b % k:\n print('NG')\nelse:\n print('OK')", "problem_context": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "sample_input": "7\n500 600\n"}, "reference_outputs": ["OK\n"], "source_document_id": "p02693", "source_text": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 137, "cpu_time_ms": 62, "memory_kb": 61816}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s897143198", "group_id": "codeNet:p02694", "input_text": "\nX = int(input())\nnow_money=100\ni = 0\nt= 100\n\nwhile X >= now_money:\n t += t\n i += 1\nprint(i)", "language": "Python", "metadata": {"date": 1595271660, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02694.html", "problem_id": "p02694", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02694/input.txt", "sample_output_relpath": "derived/input_output/data/p02694/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02694/Python/s897143198.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s897143198", "user_id": "u263483399"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "\nX = int(input())\nnow_money=100\ni = 0\nt= 100\n\nwhile X >= now_money:\n t += t\n i += 1\nprint(i)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "sample_input": "103\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02694", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 98, "cpu_time_ms": 2206, "memory_kb": 9204}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s590353222", "group_id": "codeNet:p02696", "input_text": "A, B, N = map(int, input().split())\nX = min(N, B - 1)\nprint(A * X // B - A * (X // B))", "language": "Python", "metadata": {"date": 1588804924, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02696.html", "problem_id": "p02696", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02696/input.txt", "sample_output_relpath": "derived/input_output/data/p02696/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02696/Python/s590353222.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s590353222", "user_id": "u339503988"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "A, B, N = map(int, input().split())\nX = min(N, B - 1)\nprint(A * X // B - A * (X // B))", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven are integers A, B, and N.\n\nFind the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N.\n\nHere floor(t) denotes the greatest integer not greater than the real number t.\n\nConstraints\n\n1 ≤ A ≤ 10^{6}\n\n1 ≤ B ≤ 10^{12}\n\n1 ≤ N ≤ 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B N\n\nOutput\n\nPrint the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N, as an integer.\n\nSample Input 1\n\n5 7 4\n\nSample Output 1\n\n2\n\nWhen x=3, floor(Ax/B)-A×floor(x/B) = floor(15/7) - 5×floor(3/7) = 2. This is the maximum value possible.\n\nSample Input 2\n\n11 10 9\n\nSample Output 2\n\n9", "sample_input": "5 7 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02696", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven are integers A, B, and N.\n\nFind the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N.\n\nHere floor(t) denotes the greatest integer not greater than the real number t.\n\nConstraints\n\n1 ≤ A ≤ 10^{6}\n\n1 ≤ B ≤ 10^{12}\n\n1 ≤ N ≤ 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B N\n\nOutput\n\nPrint the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N, as an integer.\n\nSample Input 1\n\n5 7 4\n\nSample Output 1\n\n2\n\nWhen x=3, floor(Ax/B)-A×floor(x/B) = floor(15/7) - 5×floor(3/7) = 2. This is the maximum value possible.\n\nSample Input 2\n\n11 10 9\n\nSample Output 2\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 86, "cpu_time_ms": 21, "memory_kb": 9164}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s895581837", "group_id": "codeNet:p02696", "input_text": "from sys import stdin\nimport sys\n\nA, B, N = [int(x) for x in stdin.readline().rstrip().split()]\n# N, M = [int(x) for x in stdin.readline().rstrip().split()]\n# U = input().split()\nans = int((A*N)/B)-A*int(N/B)\nif N >= B:\n n = int(N/B)\n for i in range(n):\n x = i*B\n temp = ans1 = int((A*(x-1))/B)-A*int((x-1)/B)\n if temp > ans:\n ans = temp\n n = n*B\n ans1 = int((A*(n-1))/B)-A*int((n-1)/B)\n ans3 = int((A*(n+1))/B)-A*int((n+1)/B)\n ans2 = int((A*(B-1))/B)-A*int((B-1)/B)\n ans4 = int((A*(B+1))/B)-A*int((B+1)/B)\n ans5 = int((A*(n))/B)-A*int((n)/B)\nelse:\n ans1 = ans\n ans2 = ans\n ans3 = ans\n ans4 = ans\n ans5 = ans\n\n\nprint(max(ans, ans1, ans2, ans3, ans4, ans5))\n", "language": "Python", "metadata": {"date": 1588474127, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02696.html", "problem_id": "p02696", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02696/input.txt", "sample_output_relpath": "derived/input_output/data/p02696/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02696/Python/s895581837.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s895581837", "user_id": "u396210538"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "from sys import stdin\nimport sys\n\nA, B, N = [int(x) for x in stdin.readline().rstrip().split()]\n# N, M = [int(x) for x in stdin.readline().rstrip().split()]\n# U = input().split()\nans = int((A*N)/B)-A*int(N/B)\nif N >= B:\n n = int(N/B)\n for i in range(n):\n x = i*B\n temp = ans1 = int((A*(x-1))/B)-A*int((x-1)/B)\n if temp > ans:\n ans = temp\n n = n*B\n ans1 = int((A*(n-1))/B)-A*int((n-1)/B)\n ans3 = int((A*(n+1))/B)-A*int((n+1)/B)\n ans2 = int((A*(B-1))/B)-A*int((B-1)/B)\n ans4 = int((A*(B+1))/B)-A*int((B+1)/B)\n ans5 = int((A*(n))/B)-A*int((n)/B)\nelse:\n ans1 = ans\n ans2 = ans\n ans3 = ans\n ans4 = ans\n ans5 = ans\n\n\nprint(max(ans, ans1, ans2, ans3, ans4, ans5))\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven are integers A, B, and N.\n\nFind the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N.\n\nHere floor(t) denotes the greatest integer not greater than the real number t.\n\nConstraints\n\n1 ≤ A ≤ 10^{6}\n\n1 ≤ B ≤ 10^{12}\n\n1 ≤ N ≤ 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B N\n\nOutput\n\nPrint the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N, as an integer.\n\nSample Input 1\n\n5 7 4\n\nSample Output 1\n\n2\n\nWhen x=3, floor(Ax/B)-A×floor(x/B) = floor(15/7) - 5×floor(3/7) = 2. This is the maximum value possible.\n\nSample Input 2\n\n11 10 9\n\nSample Output 2\n\n9", "sample_input": "5 7 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02696", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven are integers A, B, and N.\n\nFind the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N.\n\nHere floor(t) denotes the greatest integer not greater than the real number t.\n\nConstraints\n\n1 ≤ A ≤ 10^{6}\n\n1 ≤ B ≤ 10^{12}\n\n1 ≤ N ≤ 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B N\n\nOutput\n\nPrint the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N, as an integer.\n\nSample Input 1\n\n5 7 4\n\nSample Output 1\n\n2\n\nWhen x=3, floor(Ax/B)-A×floor(x/B) = floor(15/7) - 5×floor(3/7) = 2. This is the maximum value possible.\n\nSample Input 2\n\n11 10 9\n\nSample Output 2\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 728, "cpu_time_ms": 2207, "memory_kb": 64296}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s997029596", "group_id": "codeNet:p02696", "input_text": "A,B,N = [int(i) for i in input().split()]\nx = N\nM = A*N//B\nans = -float(\"inf\")\n\nfor _ in range(10**6):\n s = A*x//B - A*(x//B)\n ans = max([ans,s])\n x -= 1\n\nprint(ans)", "language": "Python", "metadata": {"date": 1588472977, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02696.html", "problem_id": "p02696", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02696/input.txt", "sample_output_relpath": "derived/input_output/data/p02696/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02696/Python/s997029596.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s997029596", "user_id": "u851035514"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "A,B,N = [int(i) for i in input().split()]\nx = N\nM = A*N//B\nans = -float(\"inf\")\n\nfor _ in range(10**6):\n s = A*x//B - A*(x//B)\n ans = max([ans,s])\n x -= 1\n\nprint(ans)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven are integers A, B, and N.\n\nFind the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N.\n\nHere floor(t) denotes the greatest integer not greater than the real number t.\n\nConstraints\n\n1 ≤ A ≤ 10^{6}\n\n1 ≤ B ≤ 10^{12}\n\n1 ≤ N ≤ 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B N\n\nOutput\n\nPrint the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N, as an integer.\n\nSample Input 1\n\n5 7 4\n\nSample Output 1\n\n2\n\nWhen x=3, floor(Ax/B)-A×floor(x/B) = floor(15/7) - 5×floor(3/7) = 2. This is the maximum value possible.\n\nSample Input 2\n\n11 10 9\n\nSample Output 2\n\n9", "sample_input": "5 7 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02696", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven are integers A, B, and N.\n\nFind the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N.\n\nHere floor(t) denotes the greatest integer not greater than the real number t.\n\nConstraints\n\n1 ≤ A ≤ 10^{6}\n\n1 ≤ B ≤ 10^{12}\n\n1 ≤ N ≤ 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B N\n\nOutput\n\nPrint the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N, as an integer.\n\nSample Input 1\n\n5 7 4\n\nSample Output 1\n\n2\n\nWhen x=3, floor(Ax/B)-A×floor(x/B) = floor(15/7) - 5×floor(3/7) = 2. This is the maximum value possible.\n\nSample Input 2\n\n11 10 9\n\nSample Output 2\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 174, "cpu_time_ms": 639, "memory_kb": 9192}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s703627400", "group_id": "codeNet:p02696", "input_text": "a, b, n = map(int, input().split())\nx = (int(a*(n-1)/b)-a*int((n-1)/b))\nprint(x)", "language": "Python", "metadata": {"date": 1588472766, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02696.html", "problem_id": "p02696", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02696/input.txt", "sample_output_relpath": "derived/input_output/data/p02696/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02696/Python/s703627400.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s703627400", "user_id": "u764215612"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "a, b, n = map(int, input().split())\nx = (int(a*(n-1)/b)-a*int((n-1)/b))\nprint(x)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven are integers A, B, and N.\n\nFind the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N.\n\nHere floor(t) denotes the greatest integer not greater than the real number t.\n\nConstraints\n\n1 ≤ A ≤ 10^{6}\n\n1 ≤ B ≤ 10^{12}\n\n1 ≤ N ≤ 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B N\n\nOutput\n\nPrint the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N, as an integer.\n\nSample Input 1\n\n5 7 4\n\nSample Output 1\n\n2\n\nWhen x=3, floor(Ax/B)-A×floor(x/B) = floor(15/7) - 5×floor(3/7) = 2. This is the maximum value possible.\n\nSample Input 2\n\n11 10 9\n\nSample Output 2\n\n9", "sample_input": "5 7 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02696", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven are integers A, B, and N.\n\nFind the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N.\n\nHere floor(t) denotes the greatest integer not greater than the real number t.\n\nConstraints\n\n1 ≤ A ≤ 10^{6}\n\n1 ≤ B ≤ 10^{12}\n\n1 ≤ N ≤ 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B N\n\nOutput\n\nPrint the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N, as an integer.\n\nSample Input 1\n\n5 7 4\n\nSample Output 1\n\n2\n\nWhen x=3, floor(Ax/B)-A×floor(x/B) = floor(15/7) - 5×floor(3/7) = 2. This is the maximum value possible.\n\nSample Input 2\n\n11 10 9\n\nSample Output 2\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 80, "cpu_time_ms": 21, "memory_kb": 9156}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s326157067", "group_id": "codeNet:p02696", "input_text": "import math\na,b,n=map(int,input().split())\nans=0\nif b>n:\n ans=math.floor(a*n/b)\nelse:\n for i in range(b,n+1):\n c=math.floor(a*i/b)-a*math.floor(i/b)\n ans=max(ans,c)\nprint(ans)", "language": "Python", "metadata": {"date": 1588472397, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02696.html", "problem_id": "p02696", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02696/input.txt", "sample_output_relpath": "derived/input_output/data/p02696/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02696/Python/s326157067.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s326157067", "user_id": "u344065503"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import math\na,b,n=map(int,input().split())\nans=0\nif b>n:\n ans=math.floor(a*n/b)\nelse:\n for i in range(b,n+1):\n c=math.floor(a*i/b)-a*math.floor(i/b)\n ans=max(ans,c)\nprint(ans)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven are integers A, B, and N.\n\nFind the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N.\n\nHere floor(t) denotes the greatest integer not greater than the real number t.\n\nConstraints\n\n1 ≤ A ≤ 10^{6}\n\n1 ≤ B ≤ 10^{12}\n\n1 ≤ N ≤ 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B N\n\nOutput\n\nPrint the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N, as an integer.\n\nSample Input 1\n\n5 7 4\n\nSample Output 1\n\n2\n\nWhen x=3, floor(Ax/B)-A×floor(x/B) = floor(15/7) - 5×floor(3/7) = 2. This is the maximum value possible.\n\nSample Input 2\n\n11 10 9\n\nSample Output 2\n\n9", "sample_input": "5 7 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02696", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven are integers A, B, and N.\n\nFind the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N.\n\nHere floor(t) denotes the greatest integer not greater than the real number t.\n\nConstraints\n\n1 ≤ A ≤ 10^{6}\n\n1 ≤ B ≤ 10^{12}\n\n1 ≤ N ≤ 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B N\n\nOutput\n\nPrint the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N, as an integer.\n\nSample Input 1\n\n5 7 4\n\nSample Output 1\n\n2\n\nWhen x=3, floor(Ax/B)-A×floor(x/B) = floor(15/7) - 5×floor(3/7) = 2. This is the maximum value possible.\n\nSample Input 2\n\n11 10 9\n\nSample Output 2\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 183, "cpu_time_ms": 2207, "memory_kb": 80292}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s327303729", "group_id": "codeNet:p02697", "input_text": "n, m = map(int, input().split())\nans_i = n//2\nans_j = ans_i+1\nn_list = [0]*(n+1)\nfor _ in range(m):\n if n_list[ans_j-2] == 0 and n_list[ans_j-1]:\n ans_j -= 2\n if n_list[ans_i+2] == 0 and n_list[ans_i+1]:\n ans_i += 2\n \n if abs(ans_j-ans_i) == abs(n-ans_j+ans_i):\n if ans_i <= n-ans_j: ans_j += 1\n else: ans_i -= 1\n print(ans_i, ans_j)\n \n n_list[ans_i] = 1\n n_list[ans_j] = 1\n \n ans_i -= 1\n ans_j += 1", "language": "Python", "metadata": {"date": 1588473924, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02697.html", "problem_id": "p02697", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02697/input.txt", "sample_output_relpath": "derived/input_output/data/p02697/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02697/Python/s327303729.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s327303729", "user_id": "u700805562"}, "prompt_components": {"gold_output": "2 3\n", "input_to_evaluate": "n, m = map(int, input().split())\nans_i = n//2\nans_j = ans_i+1\nn_list = [0]*(n+1)\nfor _ in range(m):\n if n_list[ans_j-2] == 0 and n_list[ans_j-1]:\n ans_j -= 2\n if n_list[ans_i+2] == 0 and n_list[ans_i+1]:\n ans_i += 2\n \n if abs(ans_j-ans_i) == abs(n-ans_j+ans_i):\n if ans_i <= n-ans_j: ans_j += 1\n else: ans_i -= 1\n print(ans_i, ans_j)\n \n n_list[ans_i] = 1\n n_list[ans_j] = 1\n \n ans_i -= 1\n ans_j += 1", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are going to hold a competition of one-to-one game called AtCoder Janken. (Janken is the Japanese name for Rock-paper-scissors.)\nN players will participate in this competition, and they are given distinct integers from 1 through N.\nThe arena has M playing fields for two players. You need to assign each playing field two distinct integers between 1 and N (inclusive).\nYou cannot assign the same integer to multiple playing fields.\nThe competition consists of N rounds, each of which proceeds as follows:\n\nFor each player, if there is a playing field that is assigned the player's integer, the player goes to that field and fight the other player who comes there.\n\nThen, each player adds 1 to its integer. If it becomes N+1, change it to 1.\n\nYou want to ensure that no player fights the same opponent more than once during the N rounds.\nPrint an assignment of integers to the playing fields satisfying this condition.\nIt can be proved that such an assignment always exists under the constraints given.\n\nConstraints\n\n1 \\leq M\n\nM \\times 2 +1 \\leq N \\leq 200000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint M lines in the format below.\nThe i-th line should contain the two integers a_i and b_i assigned to the i-th playing field.\n\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nSample Input 1\n\n4 1\n\nSample Output 1\n\n2 3\n\nLet us call the four players A, B, C, and D, and assume that they are initially given the integers 1, 2, 3, and 4, respectively.\n\nThe 1-st round is fought by B and C, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 2, 3, 4, and 1, respectively.\n\nThe 2-nd round is fought by A and B, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 3, 4, 1, and 2, respectively.\n\nThe 3-rd round is fought by D and A, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 4, 1, 2, and 3, respectively.\n\nThe 4-th round is fought by C and D, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 1, 2, 3, and 4, respectively.\n\nNo player fights the same opponent more than once during the four rounds, so this solution will be accepted.\n\nSample Input 2\n\n7 3\n\nSample Output 2\n\n1 6\n2 5\n3 4", "sample_input": "4 1\n"}, "reference_outputs": ["2 3\n"], "source_document_id": "p02697", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are going to hold a competition of one-to-one game called AtCoder Janken. (Janken is the Japanese name for Rock-paper-scissors.)\nN players will participate in this competition, and they are given distinct integers from 1 through N.\nThe arena has M playing fields for two players. You need to assign each playing field two distinct integers between 1 and N (inclusive).\nYou cannot assign the same integer to multiple playing fields.\nThe competition consists of N rounds, each of which proceeds as follows:\n\nFor each player, if there is a playing field that is assigned the player's integer, the player goes to that field and fight the other player who comes there.\n\nThen, each player adds 1 to its integer. If it becomes N+1, change it to 1.\n\nYou want to ensure that no player fights the same opponent more than once during the N rounds.\nPrint an assignment of integers to the playing fields satisfying this condition.\nIt can be proved that such an assignment always exists under the constraints given.\n\nConstraints\n\n1 \\leq M\n\nM \\times 2 +1 \\leq N \\leq 200000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint M lines in the format below.\nThe i-th line should contain the two integers a_i and b_i assigned to the i-th playing field.\n\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nSample Input 1\n\n4 1\n\nSample Output 1\n\n2 3\n\nLet us call the four players A, B, C, and D, and assume that they are initially given the integers 1, 2, 3, and 4, respectively.\n\nThe 1-st round is fought by B and C, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 2, 3, 4, and 1, respectively.\n\nThe 2-nd round is fought by A and B, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 3, 4, 1, and 2, respectively.\n\nThe 3-rd round is fought by D and A, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 4, 1, 2, and 3, respectively.\n\nThe 4-th round is fought by C and D, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 1, 2, 3, and 4, respectively.\n\nNo player fights the same opponent more than once during the four rounds, so this solution will be accepted.\n\nSample Input 2\n\n7 3\n\nSample Output 2\n\n1 6\n2 5\n3 4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 464, "cpu_time_ms": 116, "memory_kb": 10188}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s473119446", "group_id": "codeNet:p02698", "input_text": "from bisect import bisect_left\nfrom collections import defaultdict as dd\nN = int(input())\nAs = list(map(int, input().split()))\nEs = dd(dict)\nfor _ in range(N-1):\n f, t = map(int, input().split())\n Es[f-1][t-1] = Es[t-1][f-1] = 1\n\nINF = float('inf')\nRET = 0\nPROC = 1\n\nstack = []\nlismin = [INF] * N\nanss = [INF] * N\nvisited = [False] * N\n\nstack.append((RET, 0, INF))\nstack.append((PROC, 0, 0))\nwhile stack:\n cmd, *v = stack.pop()\n if cmd == RET:\n i, backup = v\n lismin[i] = backup\n else:\n node, i = v\n lismin[i] = As[node]\n anss[node] = i+1\n visited[node] = True\n for to in Es[node].keys():\n if not visited[to]:\n x = bisect_left(lismin, As[to])\n stack.append((RET, x, lismin[x]))\n stack.append((PROC, to, x))\nfor ans in anss:\n print(ans)\n\n\n\n", "language": "Python", "metadata": {"date": 1588746022, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02698.html", "problem_id": "p02698", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02698/input.txt", "sample_output_relpath": "derived/input_output/data/p02698/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02698/Python/s473119446.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s473119446", "user_id": "u792078574"}, "prompt_components": {"gold_output": "1\n2\n3\n3\n4\n4\n5\n2\n2\n3\n", "input_to_evaluate": "from bisect import bisect_left\nfrom collections import defaultdict as dd\nN = int(input())\nAs = list(map(int, input().split()))\nEs = dd(dict)\nfor _ in range(N-1):\n f, t = map(int, input().split())\n Es[f-1][t-1] = Es[t-1][f-1] = 1\n\nINF = float('inf')\nRET = 0\nPROC = 1\n\nstack = []\nlismin = [INF] * N\nanss = [INF] * N\nvisited = [False] * N\n\nstack.append((RET, 0, INF))\nstack.append((PROC, 0, 0))\nwhile stack:\n cmd, *v = stack.pop()\n if cmd == RET:\n i, backup = v\n lismin[i] = backup\n else:\n node, i = v\n lismin[i] = As[node]\n anss[node] = i+1\n visited[node] = True\n for to in Es[node].keys():\n if not visited[to]:\n x = bisect_left(lismin, As[to])\n stack.append((RET, x, lismin[x]))\n stack.append((PROC, to, x))\nfor ans in anss:\n print(ans)\n\n\n\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i.\nVertex i has an integer a_i written on it.\nFor every integer k from 1 through N, solve the following problem:\n\nWe will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence.\n\nHere, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \\leq i_1 < i_2 < ... < i_M \\leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq a_i \\leq 10^9\n\n1 \\leq u_i , v_i \\leq N\n\nu_i \\neq v_i\n\nThe given graph is a tree.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\nu_1 v_1\nu_2 v_2\n:\nu_{N-1} v_{N-1}\n\nOutput\n\nPrint N lines. The k-th line, print the length of the longest increasing subsequence of the sequence obtained from the shortest path from Vertex 1 to Vertex k.\n\nSample Input 1\n\n10\n1 2 5 3 4 6 7 3 2 4\n1 2\n2 3\n3 4\n4 5\n3 6\n6 7\n1 8\n8 9\n9 10\n\nSample Output 1\n\n1\n2\n3\n3\n4\n4\n5\n2\n2\n3\n\nFor example, the sequence A obtained from the shortest path from Vertex 1 to Vertex 5 is 1,2,5,3,4. Its longest increasing subsequence is A_1, A_2, A_4, A_5, with the length of 4.", "sample_input": "10\n1 2 5 3 4 6 7 3 2 4\n1 2\n2 3\n3 4\n4 5\n3 6\n6 7\n1 8\n8 9\n9 10\n"}, "reference_outputs": ["1\n2\n3\n3\n4\n4\n5\n2\n2\n3\n"], "source_document_id": "p02698", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i.\nVertex i has an integer a_i written on it.\nFor every integer k from 1 through N, solve the following problem:\n\nWe will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence.\n\nHere, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \\leq i_1 < i_2 < ... < i_M \\leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq a_i \\leq 10^9\n\n1 \\leq u_i , v_i \\leq N\n\nu_i \\neq v_i\n\nThe given graph is a tree.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\nu_1 v_1\nu_2 v_2\n:\nu_{N-1} v_{N-1}\n\nOutput\n\nPrint N lines. The k-th line, print the length of the longest increasing subsequence of the sequence obtained from the shortest path from Vertex 1 to Vertex k.\n\nSample Input 1\n\n10\n1 2 5 3 4 6 7 3 2 4\n1 2\n2 3\n3 4\n4 5\n3 6\n6 7\n1 8\n8 9\n9 10\n\nSample Output 1\n\n1\n2\n3\n3\n4\n4\n5\n2\n2\n3\n\nFor example, the sequence A obtained from the shortest path from Vertex 1 to Vertex 5 is 1,2,5,3,4. Its longest increasing subsequence is A_1, A_2, A_4, A_5, with the length of 4.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 862, "cpu_time_ms": 1228, "memory_kb": 123004}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s758863646", "group_id": "codeNet:p02698", "input_text": "import bisect\nimport sys\nsys.setrecursionlimit(10**9)\n\nN = int(input())\nA = list(map(int, input().split()))\n\ntree = [[] for i in range(N)]\nfor i in range(N-1):\n u, v = map(int, input().split())\n tree[u-1].append(v-1); tree[v-1].append(u-1)\n\n\nans = [0] * N\nans[0] = 1\nINF = 10**10\ndp = [INF] * N\ndp[0] = A[0]\nstack = []\ndef dfs(node, par, n):\n global ans\n global dp\n global stack\n children = tree[node]\n for child in children:\n if child == par:\n continue\n num = A[child]\n idx = bisect.bisect_left(dp, num)\n stack.append([idx, dp[idx]])\n dp[idx] = num\n ans[child] = max(n, idx+1)\n # ans[child] = bisect.bisect_left(dp, INF)\n dfs(child, node, max(n, idx+1))\n # 巻き戻し\n idx, num = stack.pop()\n dp[idx] = num\n\ndfs(0, -1, 1)\nprint(*ans, sep='\\n')", "language": "Python", "metadata": {"date": 1588481028, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02698.html", "problem_id": "p02698", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02698/input.txt", "sample_output_relpath": "derived/input_output/data/p02698/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02698/Python/s758863646.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s758863646", "user_id": "u922449550"}, "prompt_components": {"gold_output": "1\n2\n3\n3\n4\n4\n5\n2\n2\n3\n", "input_to_evaluate": "import bisect\nimport sys\nsys.setrecursionlimit(10**9)\n\nN = int(input())\nA = list(map(int, input().split()))\n\ntree = [[] for i in range(N)]\nfor i in range(N-1):\n u, v = map(int, input().split())\n tree[u-1].append(v-1); tree[v-1].append(u-1)\n\n\nans = [0] * N\nans[0] = 1\nINF = 10**10\ndp = [INF] * N\ndp[0] = A[0]\nstack = []\ndef dfs(node, par, n):\n global ans\n global dp\n global stack\n children = tree[node]\n for child in children:\n if child == par:\n continue\n num = A[child]\n idx = bisect.bisect_left(dp, num)\n stack.append([idx, dp[idx]])\n dp[idx] = num\n ans[child] = max(n, idx+1)\n # ans[child] = bisect.bisect_left(dp, INF)\n dfs(child, node, max(n, idx+1))\n # 巻き戻し\n idx, num = stack.pop()\n dp[idx] = num\n\ndfs(0, -1, 1)\nprint(*ans, sep='\\n')", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i.\nVertex i has an integer a_i written on it.\nFor every integer k from 1 through N, solve the following problem:\n\nWe will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence.\n\nHere, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \\leq i_1 < i_2 < ... < i_M \\leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq a_i \\leq 10^9\n\n1 \\leq u_i , v_i \\leq N\n\nu_i \\neq v_i\n\nThe given graph is a tree.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\nu_1 v_1\nu_2 v_2\n:\nu_{N-1} v_{N-1}\n\nOutput\n\nPrint N lines. The k-th line, print the length of the longest increasing subsequence of the sequence obtained from the shortest path from Vertex 1 to Vertex k.\n\nSample Input 1\n\n10\n1 2 5 3 4 6 7 3 2 4\n1 2\n2 3\n3 4\n4 5\n3 6\n6 7\n1 8\n8 9\n9 10\n\nSample Output 1\n\n1\n2\n3\n3\n4\n4\n5\n2\n2\n3\n\nFor example, the sequence A obtained from the shortest path from Vertex 1 to Vertex 5 is 1,2,5,3,4. Its longest increasing subsequence is A_1, A_2, A_4, A_5, with the length of 4.", "sample_input": "10\n1 2 5 3 4 6 7 3 2 4\n1 2\n2 3\n3 4\n4 5\n3 6\n6 7\n1 8\n8 9\n9 10\n"}, "reference_outputs": ["1\n2\n3\n3\n4\n4\n5\n2\n2\n3\n"], "source_document_id": "p02698", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i.\nVertex i has an integer a_i written on it.\nFor every integer k from 1 through N, solve the following problem:\n\nWe will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence.\n\nHere, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \\leq i_1 < i_2 < ... < i_M \\leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq a_i \\leq 10^9\n\n1 \\leq u_i , v_i \\leq N\n\nu_i \\neq v_i\n\nThe given graph is a tree.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\nu_1 v_1\nu_2 v_2\n:\nu_{N-1} v_{N-1}\n\nOutput\n\nPrint N lines. The k-th line, print the length of the longest increasing subsequence of the sequence obtained from the shortest path from Vertex 1 to Vertex k.\n\nSample Input 1\n\n10\n1 2 5 3 4 6 7 3 2 4\n1 2\n2 3\n3 4\n4 5\n3 6\n6 7\n1 8\n8 9\n9 10\n\nSample Output 1\n\n1\n2\n3\n3\n4\n4\n5\n2\n2\n3\n\nFor example, the sequence A obtained from the shortest path from Vertex 1 to Vertex 5 is 1,2,5,3,4. Its longest increasing subsequence is A_1, A_2, A_4, A_5, with the length of 4.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 791, "cpu_time_ms": 1221, "memory_kb": 248760}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s255929640", "group_id": "codeNet:p02699", "input_text": "n = input()\np=input()\np=p[0:-1]\nif n==p:\n print(\"Yes\")\nelse:\n print(\"No\")", "language": "Python", "metadata": {"date": 1589158978, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Python/s255929640.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s255929640", "user_id": "u771538568"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "n = input()\np=input()\np=p[0:-1]\nif n==p:\n print(\"Yes\")\nelse:\n print(\"No\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 79, "cpu_time_ms": 23, "memory_kb": 9040}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s375616381", "group_id": "codeNet:p02699", "input_text": "s, w = map(int, input().split())\nprint(\"safe\") if s > w else print(\"unsafe\")", "language": "Python", "metadata": {"date": 1587983908, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Python/s375616381.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s375616381", "user_id": "u183422236"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "s, w = map(int, input().split())\nprint(\"safe\") if s > w else print(\"unsafe\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 76, "cpu_time_ms": 20, "memory_kb": 9132}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s908005530", "group_id": "codeNet:p02699", "input_text": "S,W= map(int,input().split())\nif S<=W:\n print(\"unsafe\")\nelse:\n print(\"safe\")\n", "language": "Python", "metadata": {"date": 1587949305, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Python/s908005530.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s908005530", "user_id": "u516566941"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "S,W= map(int,input().split())\nif S<=W:\n print(\"unsafe\")\nelse:\n print(\"safe\")\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 83, "cpu_time_ms": 23, "memory_kb": 9152}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s911845335", "group_id": "codeNet:p02699", "input_text": "s, w = map(int, input().split())\nif s > w:\n print(\"safe\")\nelse:\n print(\"unsafe\")", "language": "Python", "metadata": {"date": 1587949291, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Python/s911845335.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s911845335", "user_id": "u518386853"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "s, w = map(int, input().split())\nif s > w:\n print(\"safe\")\nelse:\n print(\"unsafe\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 82, "cpu_time_ms": 61, "memory_kb": 61548}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s152613429", "group_id": "codeNet:p02701", "input_text": "a = int(input())\nc= [input() for i in range(a)]\nlst = []\n\nfor i in range(len(c)):\n if not(c[i] in lst):\n lst.append(c[i])\nprint(len(lst))", "language": "Python", "metadata": {"date": 1587953548, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Python/s152613429.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s152613429", "user_id": "u771156630"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "a = int(input())\nc= [input() for i in range(a)]\nlst = []\n\nfor i in range(len(c)):\n if not(c[i] in lst):\n lst.append(c[i])\nprint(len(lst))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 147, "cpu_time_ms": 2206, "memory_kb": 23572}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s162067029", "group_id": "codeNet:p02706", "input_text": " = map(int,input().split())\nl = list(map(int,input().split()))\ns = 0\nfor i in range(n):\n s += l[i]\nprint(max(m-s,-1))", "language": "Python", "metadata": {"date": 1587501457, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02706.html", "problem_id": "p02706", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02706/input.txt", "sample_output_relpath": "derived/input_output/data/p02706/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02706/Python/s162067029.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s162067029", "user_id": "u520331522"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": " = map(int,input().split())\nl = list(map(int,input().split()))\ns = 0\nfor i in range(n):\n s += l[i]\nprint(max(m-s,-1))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "sample_input": "41 2\n5 6\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02706", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 118, "cpu_time_ms": 23, "memory_kb": 9008}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s298113270", "group_id": "codeNet:p02706", "input_text": "date0=input().rstrip().split(\" \")\nday=int(date0[0])\nnum=int(date0[1])\ndate1=input().rstrip().split(\" \")\nsum=0\nfor i in range(num):\n sum+=int(date1[i])\nif day-sum>=0:\n print(day-sum)\nelse:\n print(-1)", "language": "Python", "metadata": {"date": 1587346660, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02706.html", "problem_id": "p02706", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02706/input.txt", "sample_output_relpath": "derived/input_output/data/p02706/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02706/Python/s298113270.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s298113270", "user_id": "u654517927"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "date0=input().rstrip().split(\" \")\nday=int(date0[0])\nnum=int(date0[1])\ndate1=input().rstrip().split(\" \")\nsum=0\nfor i in range(num):\n sum+=int(date1[i])\nif day-sum>=0:\n print(day-sum)\nelse:\n print(-1)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "sample_input": "41 2\n5 6\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02706", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 201, "cpu_time_ms": 26, "memory_kb": 9684}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s858353581", "group_id": "codeNet:p02706", "input_text": "#!/usr/bin/env python3\n\nN,M = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\nans = N-sum(A)\n\nif ans < 0:\n print(-1)\nelse:\n print(ans)", "language": "Python", "metadata": {"date": 1587344892, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02706.html", "problem_id": "p02706", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02706/input.txt", "sample_output_relpath": "derived/input_output/data/p02706/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02706/Python/s858353581.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s858353581", "user_id": "u505505186"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "#!/usr/bin/env python3\n\nN,M = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\nans = N-sum(A)\n\nif ans < 0:\n print(-1)\nelse:\n print(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "sample_input": "41 2\n5 6\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02706", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 161, "cpu_time_ms": 60, "memory_kb": 68136}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s698094123", "group_id": "codeNet:p02706", "input_text": "import bisect,collections,copy,heapq,itertools,math,operator,string\ndef I(): return int(input())\ndef S(): return input()\ndef LI(): return list(map(int,input().split()))\ndef LS(): return list(input().split())\n##################################################\nN,M = LI()\nA = LI()\nfor x in A:\n N -= x\nprint(N if N>=0 else -1)\n", "language": "Python", "metadata": {"date": 1587344861, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02706.html", "problem_id": "p02706", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02706/input.txt", "sample_output_relpath": "derived/input_output/data/p02706/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02706/Python/s698094123.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s698094123", "user_id": "u579699847"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "import bisect,collections,copy,heapq,itertools,math,operator,string\ndef I(): return int(input())\ndef S(): return input()\ndef LI(): return list(map(int,input().split()))\ndef LS(): return list(input().split())\n##################################################\nN,M = LI()\nA = LI()\nfor x in A:\n N -= x\nprint(N if N>=0 else -1)\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "sample_input": "41 2\n5 6\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02706", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 327, "cpu_time_ms": 34, "memory_kb": 10776}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s953976401", "group_id": "codeNet:p02707", "input_text": "import sys\nimport os\nimport math\nimport string\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\nfl = lambda: list(map(float, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nsl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\nlcm = lambda x, y: x * y / math.gcd(x, y)\n\nMOD = 10 ** 9 + 7\nMAX = float('inf')\n\n\ndef main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n\n N = ii()\n A = il()\n ret = [0] * N\n for a in A:\n ret[a - 1] += 1\n print(*ret, sep=\"\\n\")\n\n\nif __name__ == '__main__':\n main()\n", "language": "Python", "metadata": {"date": 1587948764, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02707.html", "problem_id": "p02707", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02707/input.txt", "sample_output_relpath": "derived/input_output/data/p02707/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02707/Python/s953976401.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s953976401", "user_id": "u634079249"}, "prompt_components": {"gold_output": "2\n2\n0\n0\n0\n", "input_to_evaluate": "import sys\nimport os\nimport math\nimport string\n\nii = lambda: int(sys.stdin.buffer.readline().rstrip())\nil = lambda: list(map(int, sys.stdin.buffer.readline().split()))\nfl = lambda: list(map(float, sys.stdin.buffer.readline().split()))\niln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]\n\niss = lambda: sys.stdin.buffer.readline().decode().rstrip()\nsl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))\nisn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]\n\nlcm = lambda x, y: x * y / math.gcd(x, y)\n\nMOD = 10 ** 9 + 7\nMAX = float('inf')\n\n\ndef main():\n if os.getenv(\"LOCAL\"):\n sys.stdin = open(\"input.txt\", \"r\")\n\n N = ii()\n A = il()\n ret = [0] * N\n for a in A:\n ret[a - 1] += 1\n print(*ret, sep=\"\\n\")\n\n\nif __name__ == '__main__':\n main()\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "sample_input": "5\n1 1 2 2\n"}, "reference_outputs": ["2\n2\n0\n0\n0\n"], "source_document_id": "p02707", "source_text": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 846, "cpu_time_ms": 123, "memory_kb": 30544}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s193071856", "group_id": "codeNet:p02707", "input_text": "N = int(input())\nnumbers = list(map(int, input().split()))\n\nresult = [0] * N\nfor i in numbers:\n result[i- 1] += 1\n \nfor i in range(N-1):\n print(result[i])\nprint(0)", "language": "Python", "metadata": {"date": 1587352316, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02707.html", "problem_id": "p02707", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02707/input.txt", "sample_output_relpath": "derived/input_output/data/p02707/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02707/Python/s193071856.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s193071856", "user_id": "u892308039"}, "prompt_components": {"gold_output": "2\n2\n0\n0\n0\n", "input_to_evaluate": "N = int(input())\nnumbers = list(map(int, input().split()))\n\nresult = [0] * N\nfor i in numbers:\n result[i- 1] += 1\n \nfor i in range(N-1):\n print(result[i])\nprint(0)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "sample_input": "5\n1 1 2 2\n"}, "reference_outputs": ["2\n2\n0\n0\n0\n"], "source_document_id": "p02707", "source_text": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 172, "cpu_time_ms": 153, "memory_kb": 32316}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s250942576", "group_id": "codeNet:p02709", "input_text": "\nN = int(input())\n\nA = map(int, input().split())\nAI = sorted(((a, i) for i, a in enumerate(A, 1)), reverse=True)\n\ndef solve(a, i, prev):\n pl, pr, ps = i, 0, 0\n for l, r, s in prev:\n yield l, r-1, max(s+abs(r-i)*a, ps+abs(i-pl)*a)\n pl, pr, ps = l, r, s\n yield pl+1, pr, ps+abs(i-pl)*a\n\nprev = [(1, N, 0)]\nfor a,i in AI:\n prev = [*solve(a,i, prev)]\n\nprint(max(s for l, r, s in prev))\n", "language": "Python", "metadata": {"date": 1587572774, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02709.html", "problem_id": "p02709", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02709/input.txt", "sample_output_relpath": "derived/input_output/data/p02709/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02709/Python/s250942576.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s250942576", "user_id": "u837673618"}, "prompt_components": {"gold_output": "20\n", "input_to_evaluate": "\nN = int(input())\n\nA = map(int, input().split())\nAI = sorted(((a, i) for i, a in enumerate(A, 1)), reverse=True)\n\ndef solve(a, i, prev):\n pl, pr, ps = i, 0, 0\n for l, r, s in prev:\n yield l, r-1, max(s+abs(r-i)*a, ps+abs(i-pl)*a)\n pl, pr, ps = l, r, s\n yield pl+1, pr, ps+abs(i-pl)*a\n\nprev = [(1, N, 0)]\nfor a,i in AI:\n prev = [*solve(a,i, prev)]\n\nprint(max(s for l, r, s in prev))\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N children standing in a line from left to right. The activeness of the i-th child from the left is A_i.\n\nYou can rearrange these children just one time in any order you like.\n\nWhen a child who originally occupies the x-th position from the left in the line moves to the y-th position from the left, that child earns A_x \\times |x-y| happiness points.\n\nFind the maximum total happiness points the children can earn.\n\nConstraints\n\n2 \\leq N \\leq 2000\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum total happiness points the children can earn.\n\nSample Input 1\n\n4\n1 3 4 2\n\nSample Output 1\n\n20\n\nIf we move the 1-st child from the left to the 3-rd position from the left, the 2-nd child to the 4-th position, the 3-rd child to the 1-st position, and the 4-th child to the 2-nd position, the children earns 1 \\times |1-3|+3 \\times |2-4|+4 \\times |3-1|+2 \\times |4-2|=20 happiness points in total.\n\nSample Input 2\n\n6\n5 5 6 1 1 1\n\nSample Output 2\n\n58\n\nSample Input 3\n\n6\n8 6 9 1 2 1\n\nSample Output 3\n\n85", "sample_input": "4\n1 3 4 2\n"}, "reference_outputs": ["20\n"], "source_document_id": "p02709", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N children standing in a line from left to right. The activeness of the i-th child from the left is A_i.\n\nYou can rearrange these children just one time in any order you like.\n\nWhen a child who originally occupies the x-th position from the left in the line moves to the y-th position from the left, that child earns A_x \\times |x-y| happiness points.\n\nFind the maximum total happiness points the children can earn.\n\nConstraints\n\n2 \\leq N \\leq 2000\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum total happiness points the children can earn.\n\nSample Input 1\n\n4\n1 3 4 2\n\nSample Output 1\n\n20\n\nIf we move the 1-st child from the left to the 3-rd position from the left, the 2-nd child to the 4-th position, the 3-rd child to the 1-st position, and the 4-th child to the 2-nd position, the children earns 1 \\times |1-3|+3 \\times |2-4|+4 \\times |3-1|+2 \\times |4-2|=20 happiness points in total.\n\nSample Input 2\n\n6\n5 5 6 1 1 1\n\nSample Output 2\n\n58\n\nSample Input 3\n\n6\n8 6 9 1 2 1\n\nSample Output 3\n\n85", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 392, "cpu_time_ms": 838, "memory_kb": 9960}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s141908364", "group_id": "codeNet:p02712", "input_text": "n=int(input())\nans=0\nfor i in range(1,n+1,1):\n if i%3!=0 and i%5!=0:\n ans+=i\nprint(ans)", "language": "Python", "metadata": {"date": 1587583678, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Python/s141908364.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s141908364", "user_id": "u807840714"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "n=int(input())\nans=0\nfor i in range(1,n+1,1):\n if i%3!=0 and i%5!=0:\n ans+=i\nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 91, "cpu_time_ms": 75, "memory_kb": 64752}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s798329209", "group_id": "codeNet:p02712", "input_text": "n = int(input())\nsum = 0\nfor i in range(1, n):\n if i%3!=0:\n if i%5!=0:\n sum+=i\nprint(sum)", "language": "Python", "metadata": {"date": 1586743130, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Python/s798329209.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s798329209", "user_id": "u668615279"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "n = int(input())\nsum = 0\nfor i in range(1, n):\n if i%3!=0:\n if i%5!=0:\n sum+=i\nprint(sum)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 110, "cpu_time_ms": 63, "memory_kb": 64640}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s309192905", "group_id": "codeNet:p02712", "input_text": "N = int(input())\nl = []\nfor i in range(N+1):\n if i%3!=0 and i%5!=0:\n l.append(i)\nprint(sum(l))", "language": "Python", "metadata": {"date": 1586741358, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Python/s309192905.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s309192905", "user_id": "u121879791"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "N = int(input())\nl = []\nfor i in range(N+1):\n if i%3!=0 and i%5!=0:\n l.append(i)\nprint(sum(l))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 104, "cpu_time_ms": 170, "memory_kb": 30120}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s645506885", "group_id": "codeNet:p02712", "input_text": "import numpy as np\n#N=map(int, input().split())\nN=int(input())\ncount=0\nfor i in range(0,N):\n if i%3!=0 and i%5!=0:\n count=count+i\nprint(count)", "language": "Python", "metadata": {"date": 1586740599, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Python/s645506885.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s645506885", "user_id": "u005317312"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "import numpy as np\n#N=map(int, input().split())\nN=int(input())\ncount=0\nfor i in range(0,N):\n if i%3!=0 and i%5!=0:\n count=count+i\nprint(count)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 152, "cpu_time_ms": 242, "memory_kb": 27120}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s714022337", "group_id": "codeNet:p02712", "input_text": "import sys\ninput = sys.stdin.readline\nfrom itertools import *\nfrom functools import *\nfrom collections import *\nfrom heapq import heapify, heappop, heappush, heappushpop\n\nINF = float('inf')\nNIL = - 1\n\n\ndef main():\n N = int(input())\n\n total = 0\n for n in range(1, N + 1):\n if n % 3 == 0 and n % 5 == 0:\n pass\n elif n % 3 == 0:\n pass\n elif n % 5 == 0:\n pass\n else:\n total += n\n print(total)\n\n\nif __name__ == '__main__':\n main()\n", "language": "Python", "metadata": {"date": 1586740441, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Python/s714022337.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s714022337", "user_id": "u554781254"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "import sys\ninput = sys.stdin.readline\nfrom itertools import *\nfrom functools import *\nfrom collections import *\nfrom heapq import heapify, heappop, heappush, heappushpop\n\nINF = float('inf')\nNIL = - 1\n\n\ndef main():\n N = int(input())\n\n total = 0\n for n in range(1, N + 1):\n if n % 3 == 0 and n % 5 == 0:\n pass\n elif n % 3 == 0:\n pass\n elif n % 5 == 0:\n pass\n else:\n total += n\n print(total)\n\n\nif __name__ == '__main__':\n main()\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 513, "cpu_time_ms": 88, "memory_kb": 67972}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s551076318", "group_id": "codeNet:p02712", "input_text": "N = int(input())\nres = 0\nfor tmp in range(N):\n i = tmp+1\n if i % 3 == 0 or i % 5 ==0:\n continue\n res += i \n\nprint(res)\n", "language": "Python", "metadata": {"date": 1586739884, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Python/s551076318.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s551076318", "user_id": "u922487073"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "N = int(input())\nres = 0\nfor tmp in range(N):\n i = tmp+1\n if i % 3 == 0 or i % 5 ==0:\n continue\n res += i \n\nprint(res)\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 135, "cpu_time_ms": 203, "memory_kb": 9152}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s517089420", "group_id": "codeNet:p02716", "input_text": "import sys\n\n# import bisect\n# from collections import Counter, deque, defaultdict\n# import copy\n# from heapq import heappush, heappop, heapify\n# import itertools\n# from operator import attrgetter, itemgetter\n# import math\n\n# from numba import jit\n# import numpy as np\n\nreadline = sys.stdin.readline\nMOD = 10 ** 9 + 7\nINF = float('INF')\nsys.setrecursionlimit(10 ** 5)\n\n\ndef main():\n n = int(input())\n a = [0] + list(map(int, readline().split()))\n\n if n % 2 == 0:\n ans1 = sum(a[::2])\n ans2 = sum(a[1::2])\n print(max(ans1, ans2))\n sys.exit()\n\n dp = [[0] * 2 for _ in range(n + 1)]\n\n # 普通に選ぶ場合\n dp[1][0] = 0\n dp[2][0] = max(a[1], a[2])\n dp[3][0] = max(a[1], a[2], a[3])\n\n # 1個多く選ぶ場合(奇数個のみ)\n dp[1][1] = a[1]\n dp[3][1] = a[1] + a[3]\n\n i = 4\n\n while i < n + 1:\n cur1 = a[i]\n\n # 偶数だよ\n dp[i][0] = max(dp[i - 1][1], dp[i - 2][0] + cur1)\n\n i += 1\n cur2 = a[i]\n\n # 奇数だよ\n dp[i][0] = max(dp[i - 2][0] + cur2, dp[i - 3][0] + cur2, dp[i - 1][0], dp[i - 2][1])\n dp[i][1] = dp[i - 2][1] + cur2\n\n i += 1\n\n print(dp[n][0])\n\n\nif __name__ == '__main__':\n main()\n", "language": "Python", "metadata": {"date": 1586750041, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02716.html", "problem_id": "p02716", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02716/input.txt", "sample_output_relpath": "derived/input_output/data/p02716/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02716/Python/s517089420.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s517089420", "user_id": "u261103969"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "import sys\n\n# import bisect\n# from collections import Counter, deque, defaultdict\n# import copy\n# from heapq import heappush, heappop, heapify\n# import itertools\n# from operator import attrgetter, itemgetter\n# import math\n\n# from numba import jit\n# import numpy as np\n\nreadline = sys.stdin.readline\nMOD = 10 ** 9 + 7\nINF = float('INF')\nsys.setrecursionlimit(10 ** 5)\n\n\ndef main():\n n = int(input())\n a = [0] + list(map(int, readline().split()))\n\n if n % 2 == 0:\n ans1 = sum(a[::2])\n ans2 = sum(a[1::2])\n print(max(ans1, ans2))\n sys.exit()\n\n dp = [[0] * 2 for _ in range(n + 1)]\n\n # 普通に選ぶ場合\n dp[1][0] = 0\n dp[2][0] = max(a[1], a[2])\n dp[3][0] = max(a[1], a[2], a[3])\n\n # 1個多く選ぶ場合(奇数個のみ)\n dp[1][1] = a[1]\n dp[3][1] = a[1] + a[3]\n\n i = 4\n\n while i < n + 1:\n cur1 = a[i]\n\n # 偶数だよ\n dp[i][0] = max(dp[i - 1][1], dp[i - 2][0] + cur1)\n\n i += 1\n cur2 = a[i]\n\n # 奇数だよ\n dp[i][0] = max(dp[i - 2][0] + cur2, dp[i - 3][0] + cur2, dp[i - 1][0], dp[i - 2][1])\n dp[i][1] = dp[i - 2][1] + cur2\n\n i += 1\n\n print(dp[n][0])\n\n\nif __name__ == '__main__':\n main()\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nGiven is an integer sequence A_1, ..., A_N of length N.\n\nWe will choose exactly \\left\\lfloor \\frac{N}{2} \\right\\rfloor elements from this sequence so that no two adjacent elements are chosen.\n\nFind the maximum possible sum of the chosen elements.\n\nHere \\lfloor x \\rfloor denotes the greatest integer not greater than x.\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n|A_i|\\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\n\nOutput\n\nPrint the maximum possible sum of the chosen elements.\n\nSample Input 1\n\n6\n1 2 3 4 5 6\n\nSample Output 1\n\n12\n\nChoosing 2, 4, and 6 makes the sum 12, which is the maximum possible value.\n\nSample Input 2\n\n5\n-1000 -100 -10 0 10\n\nSample Output 2\n\n0\n\nChoosing -10 and 10 makes the sum 0, which is the maximum possible value.\n\nSample Input 3\n\n10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n5000000000\n\nWatch out for overflow.\n\nSample Input 4\n\n27\n18 -28 18 28 -45 90 -45 23 -53 60 28 -74 -71 35 -26 -62 49 -77 57 24 -70 -93 69 -99 59 57 -49\n\nSample Output 4\n\n295", "sample_input": "6\n1 2 3 4 5 6\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02716", "source_text": "Score : 600 points\n\nProblem Statement\n\nGiven is an integer sequence A_1, ..., A_N of length N.\n\nWe will choose exactly \\left\\lfloor \\frac{N}{2} \\right\\rfloor elements from this sequence so that no two adjacent elements are chosen.\n\nFind the maximum possible sum of the chosen elements.\n\nHere \\lfloor x \\rfloor denotes the greatest integer not greater than x.\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n|A_i|\\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\n\nOutput\n\nPrint the maximum possible sum of the chosen elements.\n\nSample Input 1\n\n6\n1 2 3 4 5 6\n\nSample Output 1\n\n12\n\nChoosing 2, 4, and 6 makes the sum 12, which is the maximum possible value.\n\nSample Input 2\n\n5\n-1000 -100 -10 0 10\n\nSample Output 2\n\n0\n\nChoosing -10 and 10 makes the sum 0, which is the maximum possible value.\n\nSample Input 3\n\n10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n5000000000\n\nWatch out for overflow.\n\nSample Input 4\n\n27\n18 -28 18 28 -45 90 -45 23 -53 60 28 -74 -71 35 -26 -62 49 -77 57 24 -70 -93 69 -99 59 57 -49\n\nSample Output 4\n\n295", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1234, "cpu_time_ms": 122, "memory_kb": 112392}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s720109551", "group_id": "codeNet:p02719", "input_text": "import sys\nn, k = map(int, input().split())\n\nn = abs(n - k)\n\nif k == n:\n print(0)\n sys.exit()\nelif k > n:\n print(min(n, k-n))\n sys.exit()\nelse:\n while n > k:\n n %= k\n print(min(n%k, abs(n-k)))", "language": "Python", "metadata": {"date": 1592876142, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02719.html", "problem_id": "p02719", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02719/input.txt", "sample_output_relpath": "derived/input_output/data/p02719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02719/Python/s720109551.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s720109551", "user_id": "u804711544"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import sys\nn, k = map(int, input().split())\n\nn = abs(n - k)\n\nif k == n:\n print(0)\n sys.exit()\nelif k > n:\n print(min(n, k-n))\n sys.exit()\nelse:\n while n > k:\n n %= k\n print(min(n%k, abs(n-k)))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "sample_input": "7 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02719", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 217, "cpu_time_ms": 32, "memory_kb": 9172}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s153735820", "group_id": "codeNet:p02719", "input_text": "N, K = map(int, input().split())\nrem = N % K\nprint(min([rem, K - rem]))", "language": "Python", "metadata": {"date": 1586140851, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02719.html", "problem_id": "p02719", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02719/input.txt", "sample_output_relpath": "derived/input_output/data/p02719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02719/Python/s153735820.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s153735820", "user_id": "u391589398"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "N, K = map(int, input().split())\nrem = N % K\nprint(min([rem, K - rem]))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "sample_input": "7 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02719", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 71, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s607083804", "group_id": "codeNet:p02720", "input_text": "k=int(input())\nt=[2]+[3]*8+[2]\ng=[[1]+[0for i in range(9)]for j in range(100)]\ndef f(x,y):\n if g[x][y]!=0:\n return g[x][y]\n else:\n p=0\n for i in range(x-1,x+2):\n if 0<=i<10:\n p+=f(i,y-1)\n g[x][y]=p\n return p\nc=0\nfor i in range(10):\n for j in range(1,10):\n if c+f(j,i)>=k:\n p=str(j)\n po=j\n for h in range(i-1,-1,-1):\n for w in range(po-1,po+2):\n if 0<=w<10:\n if c+f(w,h)>=k:\n p+=str(w)\n po=w\n break\n c+=f(w,h)\n print(p)\n exit()\n c+=f(j,i)", "language": "Python", "metadata": {"date": 1586057266, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02720.html", "problem_id": "p02720", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02720/input.txt", "sample_output_relpath": "derived/input_output/data/p02720/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02720/Python/s607083804.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s607083804", "user_id": "u619819312"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "k=int(input())\nt=[2]+[3]*8+[2]\ng=[[1]+[0for i in range(9)]for j in range(100)]\ndef f(x,y):\n if g[x][y]!=0:\n return g[x][y]\n else:\n p=0\n for i in range(x-1,x+2):\n if 0<=i<10:\n p+=f(i,y-1)\n g[x][y]=p\n return p\nc=0\nfor i in range(10):\n for j in range(1,10):\n if c+f(j,i)>=k:\n p=str(j)\n po=j\n for h in range(i-1,-1,-1):\n for w in range(po-1,po+2):\n if 0<=w<10:\n if c+f(w,h)>=k:\n p+=str(w)\n po=w\n break\n c+=f(w,h)\n print(p)\n exit()\n c+=f(j,i)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nA positive integer X is said to be a lunlun number if and only if the following condition is satisfied:\n\nIn the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1.\n\nFor example, 1234, 1, and 334 are lunlun numbers, while none of 31415, 119, or 13579 is.\n\nYou are given a positive integer K. Find the K-th smallest lunlun number.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n23\n\nWe will list the 15 smallest lunlun numbers in ascending order:\n\n1,\n2,\n3,\n4,\n5,\n6,\n7,\n8,\n9,\n10,\n11,\n12,\n21,\n22,\n23.\n\nThus, the answer is 23.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n13\n\nSample Output 3\n\n21\n\nSample Input 4\n\n100000\n\nSample Output 4\n\n3234566667\n\nNote that the answer may not fit into the 32-bit signed integer type.", "sample_input": "15\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02720", "source_text": "Score : 400 points\n\nProblem Statement\n\nA positive integer X is said to be a lunlun number if and only if the following condition is satisfied:\n\nIn the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1.\n\nFor example, 1234, 1, and 334 are lunlun numbers, while none of 31415, 119, or 13579 is.\n\nYou are given a positive integer K. Find the K-th smallest lunlun number.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n23\n\nWe will list the 15 smallest lunlun numbers in ascending order:\n\n1,\n2,\n3,\n4,\n5,\n6,\n7,\n8,\n9,\n10,\n11,\n12,\n21,\n22,\n23.\n\nThus, the answer is 23.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n13\n\nSample Output 3\n\n21\n\nSample Input 4\n\n100000\n\nSample Output 4\n\n3234566667\n\nNote that the answer may not fit into the 32-bit signed integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 737, "cpu_time_ms": 19, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s746820350", "group_id": "codeNet:p02720", "input_text": "url = \"https://atcoder.jp/contests/abc161/tasks/abc161_d\"\n\ndef main():\n n = int(input())\n\n end_r = 3234566667\n count = 0\n start = 0\n flg = False\n\n if n <= 12:\n print(n)\n exit()\n elif n <= 50000:\n count = n\n elif n > 50000:\n count = 100000 - n\n start = end_r\n flg = True\n while count != 0:\n if flg:\n start -= 1\n else:\n start += 1\n for i in range(len(str(start)) + 1):\n start_li = [int(v) for v in str(start)]\n if i == len(start_li) - 1:\n count -= 1\n break\n elif abs(start_li[i] - start_li[-1]) >= len(start_li):\n break\n elif abs(start_li[i + 1] - start_li[i]) >= 2:\n break\n\n\n print(start)\n\n\n\n\n\n\n\nif __name__ == '__main__':\n main()\n\n\n", "language": "Python", "metadata": {"date": 1586054874, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02720.html", "problem_id": "p02720", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02720/input.txt", "sample_output_relpath": "derived/input_output/data/p02720/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02720/Python/s746820350.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s746820350", "user_id": "u755180064"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "url = \"https://atcoder.jp/contests/abc161/tasks/abc161_d\"\n\ndef main():\n n = int(input())\n\n end_r = 3234566667\n count = 0\n start = 0\n flg = False\n\n if n <= 12:\n print(n)\n exit()\n elif n <= 50000:\n count = n\n elif n > 50000:\n count = 100000 - n\n start = end_r\n flg = True\n while count != 0:\n if flg:\n start -= 1\n else:\n start += 1\n for i in range(len(str(start)) + 1):\n start_li = [int(v) for v in str(start)]\n if i == len(start_li) - 1:\n count -= 1\n break\n elif abs(start_li[i] - start_li[-1]) >= len(start_li):\n break\n elif abs(start_li[i + 1] - start_li[i]) >= 2:\n break\n\n\n print(start)\n\n\n\n\n\n\n\nif __name__ == '__main__':\n main()\n\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nA positive integer X is said to be a lunlun number if and only if the following condition is satisfied:\n\nIn the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1.\n\nFor example, 1234, 1, and 334 are lunlun numbers, while none of 31415, 119, or 13579 is.\n\nYou are given a positive integer K. Find the K-th smallest lunlun number.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n23\n\nWe will list the 15 smallest lunlun numbers in ascending order:\n\n1,\n2,\n3,\n4,\n5,\n6,\n7,\n8,\n9,\n10,\n11,\n12,\n21,\n22,\n23.\n\nThus, the answer is 23.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n13\n\nSample Output 3\n\n21\n\nSample Input 4\n\n100000\n\nSample Output 4\n\n3234566667\n\nNote that the answer may not fit into the 32-bit signed integer type.", "sample_input": "15\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02720", "source_text": "Score : 400 points\n\nProblem Statement\n\nA positive integer X is said to be a lunlun number if and only if the following condition is satisfied:\n\nIn the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1.\n\nFor example, 1234, 1, and 334 are lunlun numbers, while none of 31415, 119, or 13579 is.\n\nYou are given a positive integer K. Find the K-th smallest lunlun number.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n23\n\nWe will list the 15 smallest lunlun numbers in ascending order:\n\n1,\n2,\n3,\n4,\n5,\n6,\n7,\n8,\n9,\n10,\n11,\n12,\n21,\n22,\n23.\n\nThus, the answer is 23.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n13\n\nSample Output 3\n\n21\n\nSample Input 4\n\n100000\n\nSample Output 4\n\n3234566667\n\nNote that the answer may not fit into the 32-bit signed integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 854, "cpu_time_ms": 2106, "memory_kb": 51328}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s956784187", "group_id": "codeNet:p02721", "input_text": "n,k,c=map(int,input().split())\ns=input()\nl=list();r=list()\nnex=0\nfor i in range(n):\n\tif i= work*shift:\n continue\n pre_day = work\n work_day += 1\n work_list.append(work)\n if work_day == K:\n return work_list\n return []\n\ndef extract(S):\n ret = []\n for idx, s in enumerate(S, 1):\n if s == 'o':\n ret.append(idx)\n return ret\n\nif __name__ == '__main__':\n N, K, C = list(map(int, input().split()))\n S = list(input())\n base = extract(S)\n left = greedy_search(K,C,base,shift=1)\n right= greedy_search(K,C,base,shift=-1)[::-1]\n #print(base)\n #print(left)\n #print(right)\n for i in base:\n left_k = len(left)\n left_margin = left[-1] if left is not [] else -10**10\n for left_idx in range(len(left)):\n if left[left_idx] >= i:\n left_k = left_idx\n left_margin = left[left_idx-1] if left_idx != 0 else -10**10\n break\n right_k = 0\n right_margin = 10 ** 10\n for right_idx in range(len(right)):\n if right[right_idx] > i:\n right_k = len(right) - right_idx\n right_margin = right[right_idx]\n break\n kk = left_k + right_k\n if right_margin - left_margin <= C:\n kk -= 1\n if kk < K:\n print(i)", "language": "Python", "metadata": {"date": 1586119906, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02721.html", "problem_id": "p02721", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02721/input.txt", "sample_output_relpath": "derived/input_output/data/p02721/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02721/Python/s387885150.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s387885150", "user_id": "u044220565"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "# coding: utf-8\n\ndef greedy_search(K, C, workable, shift = 1):\n workable = workable[::shift]\n if workable == []:return []\n work_day = 1\n pre_day = workable[0]\n work_list = [workable[0]]\n if work_day == K:\n return work_list\n if workable[1:] == []:\n return []\n for work in workable[1:]:\n if shift*(pre_day + C *shift) >= work*shift:\n continue\n pre_day = work\n work_day += 1\n work_list.append(work)\n if work_day == K:\n return work_list\n return []\n\ndef extract(S):\n ret = []\n for idx, s in enumerate(S, 1):\n if s == 'o':\n ret.append(idx)\n return ret\n\nif __name__ == '__main__':\n N, K, C = list(map(int, input().split()))\n S = list(input())\n base = extract(S)\n left = greedy_search(K,C,base,shift=1)\n right= greedy_search(K,C,base,shift=-1)[::-1]\n #print(base)\n #print(left)\n #print(right)\n for i in base:\n left_k = len(left)\n left_margin = left[-1] if left is not [] else -10**10\n for left_idx in range(len(left)):\n if left[left_idx] >= i:\n left_k = left_idx\n left_margin = left[left_idx-1] if left_idx != 0 else -10**10\n break\n right_k = 0\n right_margin = 10 ** 10\n for right_idx in range(len(right)):\n if right[right_idx] > i:\n right_k = len(right) - right_idx\n right_margin = right[right_idx]\n break\n kk = left_k + right_k\n if right_margin - left_margin <= C:\n kk -= 1\n if kk < K:\n print(i)", "problem_context": "Score : 500 points\n\nProblem Statement\n\nTakahashi has decided to work on K days of his choice from the N days starting with tomorrow.\n\nYou are given an integer C and a string S. Takahashi will choose his workdays as follows:\n\nAfter working for a day, he will refrain from working on the subsequent C days.\n\nIf the i-th character of S is x, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on.\n\nFind all days on which Takahashi is bound to work.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq N\n\n0 \\leq C \\leq N\n\nThe length of S is N.\n\nEach character of S is o or x.\n\nTakahashi can choose his workdays so that the conditions in Problem Statement are satisfied.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K C\nS\n\nOutput\n\nPrint all days on which Takahashi is bound to work in ascending order, one per line.\n\nSample Input 1\n\n11 3 2\nooxxxoxxxoo\n\nSample Output 1\n\n6\n\nTakahashi is going to work on 3 days out of the 11 days. After working for a day, he will refrain from working on the subsequent 2 days.\n\nThere are four possible choices for his workdays: Day 1,6,10, Day 1,6,11, Day 2,6,10, and Day 2,6,11.\n\nThus, he is bound to work on Day 6.\n\nSample Input 2\n\n5 2 3\nooxoo\n\nSample Output 2\n\n1\n5\n\nThere is only one possible choice for his workdays: Day 1,5.\n\nSample Input 3\n\n5 1 0\nooooo\n\nSample Output 3\n\nThere may be no days on which he is bound to work.\n\nSample Input 4\n\n16 4 3\nooxxoxoxxxoxoxxo\n\nSample Output 4\n\n11\n16", "sample_input": "11 3 2\nooxxxoxxxoo\n"}, "reference_outputs": ["6\n"], "source_document_id": "p02721", "source_text": "Score : 500 points\n\nProblem Statement\n\nTakahashi has decided to work on K days of his choice from the N days starting with tomorrow.\n\nYou are given an integer C and a string S. Takahashi will choose his workdays as follows:\n\nAfter working for a day, he will refrain from working on the subsequent C days.\n\nIf the i-th character of S is x, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on.\n\nFind all days on which Takahashi is bound to work.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq N\n\n0 \\leq C \\leq N\n\nThe length of S is N.\n\nEach character of S is o or x.\n\nTakahashi can choose his workdays so that the conditions in Problem Statement are satisfied.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K C\nS\n\nOutput\n\nPrint all days on which Takahashi is bound to work in ascending order, one per line.\n\nSample Input 1\n\n11 3 2\nooxxxoxxxoo\n\nSample Output 1\n\n6\n\nTakahashi is going to work on 3 days out of the 11 days. After working for a day, he will refrain from working on the subsequent 2 days.\n\nThere are four possible choices for his workdays: Day 1,6,10, Day 1,6,11, Day 2,6,10, and Day 2,6,11.\n\nThus, he is bound to work on Day 6.\n\nSample Input 2\n\n5 2 3\nooxoo\n\nSample Output 2\n\n1\n5\n\nThere is only one possible choice for his workdays: Day 1,5.\n\nSample Input 3\n\n5 1 0\nooooo\n\nSample Output 3\n\nThere may be no days on which he is bound to work.\n\nSample Input 4\n\n16 4 3\nooxxoxoxxxoxoxxo\n\nSample Output 4\n\n11\n16", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1638, "cpu_time_ms": 2105, "memory_kb": 18796}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s821275556", "group_id": "codeNet:p02721", "input_text": "import math\nimport random\nimport sys\n\nsys.setrecursionlimit(10**7)\nMAX_INT = 2**62-1\ndef input() -> str:\n return sys.stdin.readline()\n\ndef main():\n n, k, c = map(int, input().split())\n s = input().strip()\n front = set()\n start = 0\n days = k\n while start < n and days:\n if s[start] == 'x':\n start += 1\n else:\n front.add(start)\n days -= 1\n start += c + 1\n # print(front)\n # if len(front) > k:\n # return\n\n back = set()\n start = n-1\n days = k\n while start >= 0 and days:\n if s[start] == 'x':\n start -= 1\n else:\n back.add(start)\n days -= 1\n start -= c + 1\n # print(back)\n for i in front & back:\n print(i+1)\n\nif __name__ == \"__main__\":\n main()\n", "language": "Python", "metadata": {"date": 1586065018, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02721.html", "problem_id": "p02721", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02721/input.txt", "sample_output_relpath": "derived/input_output/data/p02721/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02721/Python/s821275556.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s821275556", "user_id": "u103198430"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "import math\nimport random\nimport sys\n\nsys.setrecursionlimit(10**7)\nMAX_INT = 2**62-1\ndef input() -> str:\n return sys.stdin.readline()\n\ndef main():\n n, k, c = map(int, input().split())\n s = input().strip()\n front = set()\n start = 0\n days = k\n while start < n and days:\n if s[start] == 'x':\n start += 1\n else:\n front.add(start)\n days -= 1\n start += c + 1\n # print(front)\n # if len(front) > k:\n # return\n\n back = set()\n start = n-1\n days = k\n while start >= 0 and days:\n if s[start] == 'x':\n start -= 1\n else:\n back.add(start)\n days -= 1\n start -= c + 1\n # print(back)\n for i in front & back:\n print(i+1)\n\nif __name__ == \"__main__\":\n main()\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nTakahashi has decided to work on K days of his choice from the N days starting with tomorrow.\n\nYou are given an integer C and a string S. Takahashi will choose his workdays as follows:\n\nAfter working for a day, he will refrain from working on the subsequent C days.\n\nIf the i-th character of S is x, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on.\n\nFind all days on which Takahashi is bound to work.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq N\n\n0 \\leq C \\leq N\n\nThe length of S is N.\n\nEach character of S is o or x.\n\nTakahashi can choose his workdays so that the conditions in Problem Statement are satisfied.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K C\nS\n\nOutput\n\nPrint all days on which Takahashi is bound to work in ascending order, one per line.\n\nSample Input 1\n\n11 3 2\nooxxxoxxxoo\n\nSample Output 1\n\n6\n\nTakahashi is going to work on 3 days out of the 11 days. After working for a day, he will refrain from working on the subsequent 2 days.\n\nThere are four possible choices for his workdays: Day 1,6,10, Day 1,6,11, Day 2,6,10, and Day 2,6,11.\n\nThus, he is bound to work on Day 6.\n\nSample Input 2\n\n5 2 3\nooxoo\n\nSample Output 2\n\n1\n5\n\nThere is only one possible choice for his workdays: Day 1,5.\n\nSample Input 3\n\n5 1 0\nooooo\n\nSample Output 3\n\nThere may be no days on which he is bound to work.\n\nSample Input 4\n\n16 4 3\nooxxoxoxxxoxoxxo\n\nSample Output 4\n\n11\n16", "sample_input": "11 3 2\nooxxxoxxxoo\n"}, "reference_outputs": ["6\n"], "source_document_id": "p02721", "source_text": "Score : 500 points\n\nProblem Statement\n\nTakahashi has decided to work on K days of his choice from the N days starting with tomorrow.\n\nYou are given an integer C and a string S. Takahashi will choose his workdays as follows:\n\nAfter working for a day, he will refrain from working on the subsequent C days.\n\nIf the i-th character of S is x, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on.\n\nFind all days on which Takahashi is bound to work.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq N\n\n0 \\leq C \\leq N\n\nThe length of S is N.\n\nEach character of S is o or x.\n\nTakahashi can choose his workdays so that the conditions in Problem Statement are satisfied.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K C\nS\n\nOutput\n\nPrint all days on which Takahashi is bound to work in ascending order, one per line.\n\nSample Input 1\n\n11 3 2\nooxxxoxxxoo\n\nSample Output 1\n\n6\n\nTakahashi is going to work on 3 days out of the 11 days. After working for a day, he will refrain from working on the subsequent 2 days.\n\nThere are four possible choices for his workdays: Day 1,6,10, Day 1,6,11, Day 2,6,10, and Day 2,6,11.\n\nThus, he is bound to work on Day 6.\n\nSample Input 2\n\n5 2 3\nooxoo\n\nSample Output 2\n\n1\n5\n\nThere is only one possible choice for his workdays: Day 1,5.\n\nSample Input 3\n\n5 1 0\nooooo\n\nSample Output 3\n\nThere may be no days on which he is bound to work.\n\nSample Input 4\n\n16 4 3\nooxxoxoxxxoxoxxo\n\nSample Output 4\n\n11\n16", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 816, "cpu_time_ms": 265, "memory_kb": 48984}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s295888817", "group_id": "codeNet:p02723", "input_text": "inp = input()\nprint('Yes' if inp[2] == inp[3] and inp[4] == inp[5] else 'No')", "language": "Python", "metadata": {"date": 1587248350, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02723.html", "problem_id": "p02723", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02723/input.txt", "sample_output_relpath": "derived/input_output/data/p02723/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02723/Python/s295888817.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s295888817", "user_id": "u376754170"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "inp = input()\nprint('Yes' if inp[2] == inp[3] and inp[4] == inp[5] else 'No')", "problem_context": "Score : 100 points\n\nProblem Statement\n\nA string of length 6 consisting of lowercase English letters is said to be coffee-like if and only if its 3-rd and 4-th characters are equal and its 5-th and 6-th characters are also equal.\n\nGiven a string S, determine whether it is coffee-like.\n\nConstraints\n\nS is a string of length 6 consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is coffee-like, print Yes; otherwise, print No.\n\nSample Input 1\n\nsippuu\n\nSample Output 1\n\nYes\n\nIn sippuu, the 3-rd and 4-th characters are equal, and the 5-th and 6-th characters are also equal.\n\nSample Input 2\n\niphone\n\nSample Output 2\n\nNo\n\nSample Input 3\n\ncoffee\n\nSample Output 3\n\nYes", "sample_input": "sippuu\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02723", "source_text": "Score : 100 points\n\nProblem Statement\n\nA string of length 6 consisting of lowercase English letters is said to be coffee-like if and only if its 3-rd and 4-th characters are equal and its 5-th and 6-th characters are also equal.\n\nGiven a string S, determine whether it is coffee-like.\n\nConstraints\n\nS is a string of length 6 consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is coffee-like, print Yes; otherwise, print No.\n\nSample Input 1\n\nsippuu\n\nSample Output 1\n\nYes\n\nIn sippuu, the 3-rd and 4-th characters are equal, and the 5-th and 6-th characters are also equal.\n\nSample Input 2\n\niphone\n\nSample Output 2\n\nNo\n\nSample Input 3\n\ncoffee\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 77, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s766343585", "group_id": "codeNet:p02723", "input_text": "my=input()\nif my[2]==my[3] and my[4]==my[5]:\n print('Yes')\nelse:\n print('No')", "language": "Python", "metadata": {"date": 1585445837, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02723.html", "problem_id": "p02723", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02723/input.txt", "sample_output_relpath": "derived/input_output/data/p02723/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02723/Python/s766343585.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s766343585", "user_id": "u809000730"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "my=input()\nif my[2]==my[3] and my[4]==my[5]:\n print('Yes')\nelse:\n print('No')", "problem_context": "Score : 100 points\n\nProblem Statement\n\nA string of length 6 consisting of lowercase English letters is said to be coffee-like if and only if its 3-rd and 4-th characters are equal and its 5-th and 6-th characters are also equal.\n\nGiven a string S, determine whether it is coffee-like.\n\nConstraints\n\nS is a string of length 6 consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is coffee-like, print Yes; otherwise, print No.\n\nSample Input 1\n\nsippuu\n\nSample Output 1\n\nYes\n\nIn sippuu, the 3-rd and 4-th characters are equal, and the 5-th and 6-th characters are also equal.\n\nSample Input 2\n\niphone\n\nSample Output 2\n\nNo\n\nSample Input 3\n\ncoffee\n\nSample Output 3\n\nYes", "sample_input": "sippuu\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02723", "source_text": "Score : 100 points\n\nProblem Statement\n\nA string of length 6 consisting of lowercase English letters is said to be coffee-like if and only if its 3-rd and 4-th characters are equal and its 5-th and 6-th characters are also equal.\n\nGiven a string S, determine whether it is coffee-like.\n\nConstraints\n\nS is a string of length 6 consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is coffee-like, print Yes; otherwise, print No.\n\nSample Input 1\n\nsippuu\n\nSample Output 1\n\nYes\n\nIn sippuu, the 3-rd and 4-th characters are equal, and the 5-th and 6-th characters are also equal.\n\nSample Input 2\n\niphone\n\nSample Output 2\n\nNo\n\nSample Input 3\n\ncoffee\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 83, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s379516040", "group_id": "codeNet:p02724", "input_text": "X = int(input())\nA = X//500\nB = (X-500*A)//5\nprint(1000*A+5*B)", "language": "Python", "metadata": {"date": 1585444031, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02724.html", "problem_id": "p02724", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02724/input.txt", "sample_output_relpath": "derived/input_output/data/p02724/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02724/Python/s379516040.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s379516040", "user_id": "u891518152"}, "prompt_components": {"gold_output": "2020\n", "input_to_evaluate": "X = int(input())\nA = X//500\nB = (X-500*A)//5\nprint(1000*A+5*B)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi loves gold coins. He gains 1000 happiness points for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.)\n\nTakahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn?\n\n(We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)\n\nConstraints\n\n0 \\leq X \\leq 10^9\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the maximum number of happiness points that can be earned.\n\nSample Input 1\n\n1024\n\nSample Output 1\n\n2020\n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen coins, he gains 2020 happiness points, which is the maximum number of happiness points that can be earned.\n\nSample Input 2\n\n0\n\nSample Output 2\n\n0\n\nHe is penniless - or yenless.\n\nSample Input 3\n\n1000000000\n\nSample Output 3\n\n2000000000\n\nHe is a billionaire - in yen.", "sample_input": "1024\n"}, "reference_outputs": ["2020\n"], "source_document_id": "p02724", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi loves gold coins. He gains 1000 happiness points for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.)\n\nTakahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn?\n\n(We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)\n\nConstraints\n\n0 \\leq X \\leq 10^9\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the maximum number of happiness points that can be earned.\n\nSample Input 1\n\n1024\n\nSample Output 1\n\n2020\n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen coins, he gains 2020 happiness points, which is the maximum number of happiness points that can be earned.\n\nSample Input 2\n\n0\n\nSample Output 2\n\n0\n\nHe is penniless - or yenless.\n\nSample Input 3\n\n1000000000\n\nSample Output 3\n\n2000000000\n\nHe is a billionaire - in yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 62, "cpu_time_ms": 184, "memory_kb": 38516}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s251668582", "group_id": "codeNet:p02725", "input_text": "K, N = map(int,input().split())\nA = list(map(int, input().split()))\na = A[0]\nsub = []\nfor _ in range(N):\n p = A.pop()\n sub.append(K-p)\n K = p\nsub[0] += a\nsub.remove(max(sub))\nprint(sum(sub))", "language": "Python", "metadata": {"date": 1587683322, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02725.html", "problem_id": "p02725", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02725/input.txt", "sample_output_relpath": "derived/input_output/data/p02725/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02725/Python/s251668582.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s251668582", "user_id": "u646892595"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "K, N = map(int,input().split())\nA = list(map(int, input().split()))\na = A[0]\nsub = []\nfor _ in range(N):\n p = A.pop()\n sub.append(K-p)\n K = p\nsub[0] += a\nsub.remove(max(sub))\nprint(sum(sub))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a circular pond with a perimeter of K meters, and N houses around them.\n\nThe i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond.\n\nWhen traveling between these houses, you can only go around the pond.\n\nFind the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.\n\nConstraints\n\n2 \\leq K \\leq 10^6\n\n2 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq A_1 < ... < A_N < K\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK N\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.\n\nSample Input 1\n\n20 3\n5 10 15\n\nSample Output 1\n\n10\n\nIf you start at the 1-st house and go to the 2-nd and 3-rd houses in this order, the total distance traveled will be 10.\n\nSample Input 2\n\n20 3\n0 5 15\n\nSample Output 2\n\n10\n\nIf you start at the 2-nd house and go to the 1-st and 3-rd houses in this order, the total distance traveled will be 10.", "sample_input": "20 3\n5 10 15\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02725", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a circular pond with a perimeter of K meters, and N houses around them.\n\nThe i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond.\n\nWhen traveling between these houses, you can only go around the pond.\n\nFind the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.\n\nConstraints\n\n2 \\leq K \\leq 10^6\n\n2 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq A_1 < ... < A_N < K\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK N\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.\n\nSample Input 1\n\n20 3\n5 10 15\n\nSample Output 1\n\n10\n\nIf you start at the 1-st house and go to the 2-nd and 3-rd houses in this order, the total distance traveled will be 10.\n\nSample Input 2\n\n20 3\n0 5 15\n\nSample Output 2\n\n10\n\nIf you start at the 2-nd house and go to the 1-st and 3-rd houses in this order, the total distance traveled will be 10.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 199, "cpu_time_ms": 134, "memory_kb": 25452}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s138180368", "group_id": "codeNet:p02726", "input_text": "from collections import deque\n\nn, x, y = map(int, input().split())\n\ng = [[] for _ in range(n)]\n\nfor i in range(n - 1):\n g[i].append(i + 1)\n g[i + 1].append(i)\ng[x - 1].append(y - 1)\ng[y - 1].append(x - 1)\n\n\ndef bfs(g, n_node, start_node):\n dist = [-1] * n_node\n dist[start_node] = 0\n que = deque([start_node])\n\n while que:\n node = que.popleft()\n for j in g[node]:\n if dist[j] != -1:\n continue\n dist[j] = dist[node] + 1\n que.append(j)\n return dist\n\n\nans = [0] * n\n\nfor i in range(n):\n dist = bfs(g, n, i)\n for d in dist:\n ans[d] += 1\n\nfor a in ans[1:]:\n print(a//2)", "language": "Python", "metadata": {"date": 1600702356, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02726.html", "problem_id": "p02726", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02726/input.txt", "sample_output_relpath": "derived/input_output/data/p02726/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02726/Python/s138180368.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s138180368", "user_id": "u350491208"}, "prompt_components": {"gold_output": "5\n4\n1\n0\n", "input_to_evaluate": "from collections import deque\n\nn, x, y = map(int, input().split())\n\ng = [[] for _ in range(n)]\n\nfor i in range(n - 1):\n g[i].append(i + 1)\n g[i + 1].append(i)\ng[x - 1].append(y - 1)\ng[y - 1].append(x - 1)\n\n\ndef bfs(g, n_node, start_node):\n dist = [-1] * n_node\n dist[start_node] = 0\n que = deque([start_node])\n\n while que:\n node = que.popleft()\n for j in g[node]:\n if dist[j] != -1:\n continue\n dist[j] = dist[node] + 1\n que.append(j)\n return dist\n\n\nans = [0] * n\n\nfor i in range(n):\n dist = bfs(g, n, i)\n for d in dist:\n ans[d] += 1\n\nfor a in ans[1:]:\n print(a//2)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have an undirected graph G with N vertices numbered 1 to N and N edges as follows:\n\nFor each i=1,2,...,N-1, there is an edge between Vertex i and Vertex i+1.\n\nThere is an edge between Vertex X and Vertex Y.\n\nFor each k=1,2,...,N-1, solve the problem below:\n\nFind the number of pairs of integers (i,j) (1 \\leq i < j \\leq N) such that the shortest distance between Vertex i and Vertex j in G is k.\n\nConstraints\n\n3 \\leq N \\leq 2 \\times 10^3\n\n1 \\leq X,Y \\leq N\n\nX+1 < Y\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X Y\n\nOutput\n\nFor each k=1, 2, ..., N-1 in this order, print a line containing the answer to the problem.\n\nSample Input 1\n\n5 2 4\n\nSample Output 1\n\n5\n4\n1\n0\n\nThe graph in this input is as follows:\n\nThere are five pairs (i,j) (1 \\leq i < j \\leq N) such that the shortest distance between Vertex i and Vertex j is 1: (1,2)\\,,(2,3)\\,,(2,4)\\,,(3,4)\\,,(4,5).\n\nThere are four pairs (i,j) (1 \\leq i < j \\leq N) such that the shortest distance between Vertex i and Vertex j is 2: (1,3)\\,,(1,4)\\,,(2,5)\\,,(3,5).\n\nThere is one pair (i,j) (1 \\leq i < j \\leq N) such that the shortest distance between Vertex i and Vertex j is 3: (1,5).\n\nThere are no pairs (i,j) (1 \\leq i < j \\leq N) such that the shortest distance between Vertex i and Vertex j is 4.\n\nSample Input 2\n\n3 1 3\n\nSample Output 2\n\n3\n0\n\nThe graph in this input is as follows:\n\nSample Input 3\n\n7 3 7\n\nSample Output 3\n\n7\n8\n4\n2\n0\n0\n\nSample Input 4\n\n10 4 8\n\nSample Output 4\n\n10\n12\n10\n8\n4\n1\n0\n0\n0", "sample_input": "5 2 4\n"}, "reference_outputs": ["5\n4\n1\n0\n"], "source_document_id": "p02726", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have an undirected graph G with N vertices numbered 1 to N and N edges as follows:\n\nFor each i=1,2,...,N-1, there is an edge between Vertex i and Vertex i+1.\n\nThere is an edge between Vertex X and Vertex Y.\n\nFor each k=1,2,...,N-1, solve the problem below:\n\nFind the number of pairs of integers (i,j) (1 \\leq i < j \\leq N) such that the shortest distance between Vertex i and Vertex j in G is k.\n\nConstraints\n\n3 \\leq N \\leq 2 \\times 10^3\n\n1 \\leq X,Y \\leq N\n\nX+1 < Y\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X Y\n\nOutput\n\nFor each k=1, 2, ..., N-1 in this order, print a line containing the answer to the problem.\n\nSample Input 1\n\n5 2 4\n\nSample Output 1\n\n5\n4\n1\n0\n\nThe graph in this input is as follows:\n\nThere are five pairs (i,j) (1 \\leq i < j \\leq N) such that the shortest distance between Vertex i and Vertex j is 1: (1,2)\\,,(2,3)\\,,(2,4)\\,,(3,4)\\,,(4,5).\n\nThere are four pairs (i,j) (1 \\leq i < j \\leq N) such that the shortest distance between Vertex i and Vertex j is 2: (1,3)\\,,(1,4)\\,,(2,5)\\,,(3,5).\n\nThere is one pair (i,j) (1 \\leq i < j \\leq N) such that the shortest distance between Vertex i and Vertex j is 3: (1,5).\n\nThere are no pairs (i,j) (1 \\leq i < j \\leq N) such that the shortest distance between Vertex i and Vertex j is 4.\n\nSample Input 2\n\n3 1 3\n\nSample Output 2\n\n3\n0\n\nThe graph in this input is as follows:\n\nSample Input 3\n\n7 3 7\n\nSample Output 3\n\n7\n8\n4\n2\n0\n0\n\nSample Input 4\n\n10 4 8\n\nSample Output 4\n\n10\n12\n10\n8\n4\n1\n0\n0\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 663, "cpu_time_ms": 1281, "memory_kb": 9848}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s106461620", "group_id": "codeNet:p02729", "input_text": "n, m = map(int, input().split())\n\nans = 0\nif n >= 2:\n ans += (n*(n-1) / 2)\nif m >= 2:\n ans += (m*(m-1) / 2)\n\nprint(int(ans))", "language": "Python", "metadata": {"date": 1593608928, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02729.html", "problem_id": "p02729", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02729/input.txt", "sample_output_relpath": "derived/input_output/data/p02729/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02729/Python/s106461620.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s106461620", "user_id": "u804711544"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "n, m = map(int, input().split())\n\nans = 0\nif n >= 2:\n ans += (n*(n-1) / 2)\nif m >= 2:\n ans += (m*(m-1) / 2)\n\nprint(int(ans))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have N+M balls, each of which has an integer written on it.\n\nIt is known that:\n\nThe numbers written on N of the balls are even.\n\nThe numbers written on M of the balls are odd.\n\nFind the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.\n\nIt can be shown that this count does not depend on the actual values written on the balls.\n\nConstraints\n\n0 \\leq N,M \\leq 100\n\n2 \\leq N+M\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 1\n\nSample Output 1\n\n1\n\nFor example, let us assume that the numbers written on the three balls are 1,2,4.\n\nIf we choose the two balls with 1 and 2, the sum is odd;\n\nIf we choose the two balls with 1 and 4, the sum is odd;\n\nIf we choose the two balls with 2 and 4, the sum is even.\n\nThus, the answer is 1.\n\nSample Input 2\n\n4 3\n\nSample Output 2\n\n9\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n13 3\n\nSample Output 4\n\n81\n\nSample Input 5\n\n0 3\n\nSample Output 5\n\n3", "sample_input": "2 1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02729", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have N+M balls, each of which has an integer written on it.\n\nIt is known that:\n\nThe numbers written on N of the balls are even.\n\nThe numbers written on M of the balls are odd.\n\nFind the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.\n\nIt can be shown that this count does not depend on the actual values written on the balls.\n\nConstraints\n\n0 \\leq N,M \\leq 100\n\n2 \\leq N+M\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 1\n\nSample Output 1\n\n1\n\nFor example, let us assume that the numbers written on the three balls are 1,2,4.\n\nIf we choose the two balls with 1 and 2, the sum is odd;\n\nIf we choose the two balls with 1 and 4, the sum is odd;\n\nIf we choose the two balls with 2 and 4, the sum is even.\n\nThus, the answer is 1.\n\nSample Input 2\n\n4 3\n\nSample Output 2\n\n9\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n13 3\n\nSample Output 4\n\n81\n\nSample Input 5\n\n0 3\n\nSample Output 5\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 130, "cpu_time_ms": 28, "memory_kb": 9112}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s604458991", "group_id": "codeNet:p02729", "input_text": "import math\n\ndef combination_count(n,r):\n return math.factorial(n) // (math.factorial(n-r)*math.factorial(r))\n\nN,M =map(int,input().split())\n\nif N <= 1:\n L = 0\nelse:\n L = combination_count(N,2)\n\nif M <= 1:\n O = 0\nelse:\n O = combination_count(M,2) \n \nnum = L + O \n\nprint(num)", "language": "Python", "metadata": {"date": 1584926037, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02729.html", "problem_id": "p02729", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02729/input.txt", "sample_output_relpath": "derived/input_output/data/p02729/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02729/Python/s604458991.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s604458991", "user_id": "u981864683"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import math\n\ndef combination_count(n,r):\n return math.factorial(n) // (math.factorial(n-r)*math.factorial(r))\n\nN,M =map(int,input().split())\n\nif N <= 1:\n L = 0\nelse:\n L = combination_count(N,2)\n\nif M <= 1:\n O = 0\nelse:\n O = combination_count(M,2) \n \nnum = L + O \n\nprint(num)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have N+M balls, each of which has an integer written on it.\n\nIt is known that:\n\nThe numbers written on N of the balls are even.\n\nThe numbers written on M of the balls are odd.\n\nFind the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.\n\nIt can be shown that this count does not depend on the actual values written on the balls.\n\nConstraints\n\n0 \\leq N,M \\leq 100\n\n2 \\leq N+M\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 1\n\nSample Output 1\n\n1\n\nFor example, let us assume that the numbers written on the three balls are 1,2,4.\n\nIf we choose the two balls with 1 and 2, the sum is odd;\n\nIf we choose the two balls with 1 and 4, the sum is odd;\n\nIf we choose the two balls with 2 and 4, the sum is even.\n\nThus, the answer is 1.\n\nSample Input 2\n\n4 3\n\nSample Output 2\n\n9\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n13 3\n\nSample Output 4\n\n81\n\nSample Input 5\n\n0 3\n\nSample Output 5\n\n3", "sample_input": "2 1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02729", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have N+M balls, each of which has an integer written on it.\n\nIt is known that:\n\nThe numbers written on N of the balls are even.\n\nThe numbers written on M of the balls are odd.\n\nFind the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.\n\nIt can be shown that this count does not depend on the actual values written on the balls.\n\nConstraints\n\n0 \\leq N,M \\leq 100\n\n2 \\leq N+M\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 1\n\nSample Output 1\n\n1\n\nFor example, let us assume that the numbers written on the three balls are 1,2,4.\n\nIf we choose the two balls with 1 and 2, the sum is odd;\n\nIf we choose the two balls with 1 and 4, the sum is odd;\n\nIf we choose the two balls with 2 and 4, the sum is even.\n\nThus, the answer is 1.\n\nSample Input 2\n\n4 3\n\nSample Output 2\n\n9\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n13 3\n\nSample Output 4\n\n81\n\nSample Input 5\n\n0 3\n\nSample Output 5\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 292, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s374935754", "group_id": "codeNet:p02730", "input_text": "l=int(input())\nprint((l/3)**3)", "language": "Python", "metadata": {"date": 1593640358, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02730.html", "problem_id": "p02730", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02730/input.txt", "sample_output_relpath": "derived/input_output/data/p02730/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02730/Python/s374935754.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s374935754", "user_id": "u430726059"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "l=int(input())\nprint((l/3)**3)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied:\n\nS is a palindrome.\n\nLet N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.\n\nThe string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.\n\nDetermine whether S is a strong palindrome.\n\nConstraints\n\nS consists of lowercase English letters.\n\nThe length of S is an odd number between 3 and 99 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a strong palindrome, print Yes;\notherwise, print No.\n\nSample Input 1\n\nakasaka\n\nSample Output 1\n\nYes\n\nS is akasaka.\n\nThe string formed by the 1-st through the 3-rd characters is aka.\n\nThe string formed by the 5-th through the 7-th characters is aka.\nAll of these are palindromes, so S is a strong palindrome.\n\nSample Input 2\n\nlevel\n\nSample Output 2\n\nNo\n\nSample Input 3\n\natcoder\n\nSample Output 3\n\nNo", "sample_input": "akasaka\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02730", "source_text": "Score : 200 points\n\nProblem Statement\n\nA string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied:\n\nS is a palindrome.\n\nLet N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.\n\nThe string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.\n\nDetermine whether S is a strong palindrome.\n\nConstraints\n\nS consists of lowercase English letters.\n\nThe length of S is an odd number between 3 and 99 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a strong palindrome, print Yes;\notherwise, print No.\n\nSample Input 1\n\nakasaka\n\nSample Output 1\n\nYes\n\nS is akasaka.\n\nThe string formed by the 1-st through the 3-rd characters is aka.\n\nThe string formed by the 5-th through the 7-th characters is aka.\nAll of these are palindromes, so S is a strong palindrome.\n\nSample Input 2\n\nlevel\n\nSample Output 2\n\nNo\n\nSample Input 3\n\natcoder\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 30, "cpu_time_ms": 24, "memory_kb": 9036}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s130090456", "group_id": "codeNet:p02730", "input_text": "s= input()\nl = list(s)\nans= \"Yes\"\nif(s != s[::1]):\n ans = \"No\"\n break\nelse:\n s1 = s[:len(s)//2]\n s2 = s[len(s)//2+1:]\n if s1!=s2:\n print(\"No\")\n else:\n print(\"Yes\")\nprint(ans)\n", "language": "Python", "metadata": {"date": 1586766748, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02730.html", "problem_id": "p02730", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02730/input.txt", "sample_output_relpath": "derived/input_output/data/p02730/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02730/Python/s130090456.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s130090456", "user_id": "u088115428"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "s= input()\nl = list(s)\nans= \"Yes\"\nif(s != s[::1]):\n ans = \"No\"\n break\nelse:\n s1 = s[:len(s)//2]\n s2 = s[len(s)//2+1:]\n if s1!=s2:\n print(\"No\")\n else:\n print(\"Yes\")\nprint(ans)\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied:\n\nS is a palindrome.\n\nLet N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.\n\nThe string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.\n\nDetermine whether S is a strong palindrome.\n\nConstraints\n\nS consists of lowercase English letters.\n\nThe length of S is an odd number between 3 and 99 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a strong palindrome, print Yes;\notherwise, print No.\n\nSample Input 1\n\nakasaka\n\nSample Output 1\n\nYes\n\nS is akasaka.\n\nThe string formed by the 1-st through the 3-rd characters is aka.\n\nThe string formed by the 5-th through the 7-th characters is aka.\nAll of these are palindromes, so S is a strong palindrome.\n\nSample Input 2\n\nlevel\n\nSample Output 2\n\nNo\n\nSample Input 3\n\natcoder\n\nSample Output 3\n\nNo", "sample_input": "akasaka\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02730", "source_text": "Score : 200 points\n\nProblem Statement\n\nA string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied:\n\nS is a palindrome.\n\nLet N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.\n\nThe string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.\n\nDetermine whether S is a strong palindrome.\n\nConstraints\n\nS consists of lowercase English letters.\n\nThe length of S is an odd number between 3 and 99 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a strong palindrome, print Yes;\notherwise, print No.\n\nSample Input 1\n\nakasaka\n\nSample Output 1\n\nYes\n\nS is akasaka.\n\nThe string formed by the 1-st through the 3-rd characters is aka.\n\nThe string formed by the 5-th through the 7-th characters is aka.\nAll of these are palindromes, so S is a strong palindrome.\n\nSample Input 2\n\nlevel\n\nSample Output 2\n\nNo\n\nSample Input 3\n\natcoder\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 207, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s728940983", "group_id": "codeNet:p02730", "input_text": "s = input()\n\ndef is_Palindrome(s):\n mid = len(s) // 2\n if len(s[:mid]) < 1 or len(s[mid+1:]) < 1:\n return False\n if s[:mid] == s[mid+1:]:\n return True\n else:\n return False \n\nmid = len(s) // 2\nif is_Palindrome(s) and is_Palindrome(s[:mid]) and is_Palindrome(s[mid+1:]):\n print(\"Yes\")\nelse:\n print(\"No\")", "language": "Python", "metadata": {"date": 1586669448, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02730.html", "problem_id": "p02730", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02730/input.txt", "sample_output_relpath": "derived/input_output/data/p02730/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02730/Python/s728940983.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s728940983", "user_id": "u310012552"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "s = input()\n\ndef is_Palindrome(s):\n mid = len(s) // 2\n if len(s[:mid]) < 1 or len(s[mid+1:]) < 1:\n return False\n if s[:mid] == s[mid+1:]:\n return True\n else:\n return False \n\nmid = len(s) // 2\nif is_Palindrome(s) and is_Palindrome(s[:mid]) and is_Palindrome(s[mid+1:]):\n print(\"Yes\")\nelse:\n print(\"No\")", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied:\n\nS is a palindrome.\n\nLet N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.\n\nThe string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.\n\nDetermine whether S is a strong palindrome.\n\nConstraints\n\nS consists of lowercase English letters.\n\nThe length of S is an odd number between 3 and 99 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a strong palindrome, print Yes;\notherwise, print No.\n\nSample Input 1\n\nakasaka\n\nSample Output 1\n\nYes\n\nS is akasaka.\n\nThe string formed by the 1-st through the 3-rd characters is aka.\n\nThe string formed by the 5-th through the 7-th characters is aka.\nAll of these are palindromes, so S is a strong palindrome.\n\nSample Input 2\n\nlevel\n\nSample Output 2\n\nNo\n\nSample Input 3\n\natcoder\n\nSample Output 3\n\nNo", "sample_input": "akasaka\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02730", "source_text": "Score : 200 points\n\nProblem Statement\n\nA string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied:\n\nS is a palindrome.\n\nLet N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.\n\nThe string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.\n\nDetermine whether S is a strong palindrome.\n\nConstraints\n\nS consists of lowercase English letters.\n\nThe length of S is an odd number between 3 and 99 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a strong palindrome, print Yes;\notherwise, print No.\n\nSample Input 1\n\nakasaka\n\nSample Output 1\n\nYes\n\nS is akasaka.\n\nThe string formed by the 1-st through the 3-rd characters is aka.\n\nThe string formed by the 5-th through the 7-th characters is aka.\nAll of these are palindromes, so S is a strong palindrome.\n\nSample Input 2\n\nlevel\n\nSample Output 2\n\nNo\n\nSample Input 3\n\natcoder\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 319, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s463801978", "group_id": "codeNet:p02731", "input_text": "l = int(input())\nprint((l/3)**3)", "language": "Python", "metadata": {"date": 1597821273, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02731.html", "problem_id": "p02731", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02731/input.txt", "sample_output_relpath": "derived/input_output/data/p02731/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02731/Python/s463801978.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s463801978", "user_id": "u249987458"}, "prompt_components": {"gold_output": "1.000000000000\n", "input_to_evaluate": "l = int(input())\nprint((l/3)**3)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a positive integer L.\nFind the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\n\nConstraints\n\n1 ≤ L ≤ 1000\n\nL is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL\n\nOutput\n\nPrint the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\nYour output is considered correct if its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1.000000000000\n\nFor example, a rectangular cuboid whose dimensions are 0.8, 1, and 1.2 has a volume of 0.96.\n\nOn the other hand, if the dimensions are 1, 1, and 1, the volume of the rectangular cuboid is 1, which is greater.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n36926037.000000000000", "sample_input": "3\n"}, "reference_outputs": ["1.000000000000\n"], "source_document_id": "p02731", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a positive integer L.\nFind the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\n\nConstraints\n\n1 ≤ L ≤ 1000\n\nL is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL\n\nOutput\n\nPrint the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\nYour output is considered correct if its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1.000000000000\n\nFor example, a rectangular cuboid whose dimensions are 0.8, 1, and 1.2 has a volume of 0.96.\n\nOn the other hand, if the dimensions are 1, 1, and 1, the volume of the rectangular cuboid is 1, which is greater.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n36926037.000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 32, "cpu_time_ms": 23, "memory_kb": 9284}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s279895296", "group_id": "codeNet:p02731", "input_text": "S = int(input())\na = S//3\nb = a * 0.8\nc = a * 1.2\nans = a * b * c\nans = ans * (1/0.96)\nprint(\"{0:.12f}\".format(ans))", "language": "Python", "metadata": {"date": 1584930918, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02731.html", "problem_id": "p02731", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02731/input.txt", "sample_output_relpath": "derived/input_output/data/p02731/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02731/Python/s279895296.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s279895296", "user_id": "u740267532"}, "prompt_components": {"gold_output": "1.000000000000\n", "input_to_evaluate": "S = int(input())\na = S//3\nb = a * 0.8\nc = a * 1.2\nans = a * b * c\nans = ans * (1/0.96)\nprint(\"{0:.12f}\".format(ans))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a positive integer L.\nFind the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\n\nConstraints\n\n1 ≤ L ≤ 1000\n\nL is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL\n\nOutput\n\nPrint the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\nYour output is considered correct if its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1.000000000000\n\nFor example, a rectangular cuboid whose dimensions are 0.8, 1, and 1.2 has a volume of 0.96.\n\nOn the other hand, if the dimensions are 1, 1, and 1, the volume of the rectangular cuboid is 1, which is greater.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n36926037.000000000000", "sample_input": "3\n"}, "reference_outputs": ["1.000000000000\n"], "source_document_id": "p02731", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a positive integer L.\nFind the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\n\nConstraints\n\n1 ≤ L ≤ 1000\n\nL is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL\n\nOutput\n\nPrint the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\nYour output is considered correct if its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1.000000000000\n\nFor example, a rectangular cuboid whose dimensions are 0.8, 1, and 1.2 has a volume of 0.96.\n\nOn the other hand, if the dimensions are 1, 1, and 1, the volume of the rectangular cuboid is 1, which is greater.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n36926037.000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 116, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s150156746", "group_id": "codeNet:p02731", "input_text": "L=int(input())\n#D = L//3\n#Amari = L%3\n#if Amari == 0:\n# print(D**3)\n#elif Amari == 1:\n# print(D*D*(D+1))\n#else:\n# print(D*(D+1)*(D+1))\nprint(L**3/27)", "language": "Python", "metadata": {"date": 1584927028, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02731.html", "problem_id": "p02731", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02731/input.txt", "sample_output_relpath": "derived/input_output/data/p02731/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02731/Python/s150156746.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s150156746", "user_id": "u268516119"}, "prompt_components": {"gold_output": "1.000000000000\n", "input_to_evaluate": "L=int(input())\n#D = L//3\n#Amari = L%3\n#if Amari == 0:\n# print(D**3)\n#elif Amari == 1:\n# print(D*D*(D+1))\n#else:\n# print(D*(D+1)*(D+1))\nprint(L**3/27)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a positive integer L.\nFind the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\n\nConstraints\n\n1 ≤ L ≤ 1000\n\nL is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL\n\nOutput\n\nPrint the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\nYour output is considered correct if its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1.000000000000\n\nFor example, a rectangular cuboid whose dimensions are 0.8, 1, and 1.2 has a volume of 0.96.\n\nOn the other hand, if the dimensions are 1, 1, and 1, the volume of the rectangular cuboid is 1, which is greater.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n36926037.000000000000", "sample_input": "3\n"}, "reference_outputs": ["1.000000000000\n"], "source_document_id": "p02731", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a positive integer L.\nFind the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\n\nConstraints\n\n1 ≤ L ≤ 1000\n\nL is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL\n\nOutput\n\nPrint the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\nYour output is considered correct if its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1.000000000000\n\nFor example, a rectangular cuboid whose dimensions are 0.8, 1, and 1.2 has a volume of 0.96.\n\nOn the other hand, if the dimensions are 1, 1, and 1, the volume of the rectangular cuboid is 1, which is greater.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n36926037.000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 158, "cpu_time_ms": 165, "memory_kb": 38256}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s210961732", "group_id": "codeNet:p02732", "input_text": "n = int(input())\nnumbers = list(map(int, input().split(' ')))\n\ncounters = {}\ncevap_list = {}\nsayilar = set(numbers)\nfor i in numbers:\n if i in counters:\n counters[i] += 1\n else:\n counters[i] = 1\n\nsonuc = 0\nfor sayi in counters:\n count = counters[sayi]\n sonuc += int(count * (count - 1) / 2)\n\n\nfor i in range(n):\n print(sonuc-counters[numbers[i]]+1)", "language": "Python", "metadata": {"date": 1584931834, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02732.html", "problem_id": "p02732", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02732/input.txt", "sample_output_relpath": "derived/input_output/data/p02732/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02732/Python/s210961732.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s210961732", "user_id": "u631755487"}, "prompt_components": {"gold_output": "2\n2\n3\n2\n3\n", "input_to_evaluate": "n = int(input())\nnumbers = list(map(int, input().split(' ')))\n\ncounters = {}\ncevap_list = {}\nsayilar = set(numbers)\nfor i in numbers:\n if i in counters:\n counters[i] += 1\n else:\n counters[i] = 1\n\nsonuc = 0\nfor sayi in counters:\n count = counters[sayi]\n sonuc += int(count * (count - 1) / 2)\n\n\nfor i in range(n):\n print(sonuc-counters[numbers[i]]+1)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N balls. The i-th ball has an integer A_i written on it.\n\nFor each k=1, 2, ..., N, solve the following problem and print the answer.\n\nFind the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal.\n\nConstraints\n\n3 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFor each k=1,2,...,N, print a line containing the answer.\n\nSample Input 1\n\n5\n1 1 2 1 2\n\nSample Output 1\n\n2\n2\n3\n2\n3\n\nConsider the case k=1 for example. The numbers written on the remaining balls are 1,2,1,2.\n\nFrom these balls, there are two ways to choose two distinct balls so that the integers written on them are equal.\n\nThus, the answer for k=1 is 2.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n0\n0\n0\n\nNo two balls have equal numbers written on them.\n\nSample Input 3\n\n5\n3 3 3 3 3\n\nSample Output 3\n\n6\n6\n6\n6\n6\n\nAny two balls have equal numbers written on them.\n\nSample Input 4\n\n8\n1 2 1 4 2 1 4 1\n\nSample Output 4\n\n5\n7\n5\n7\n7\n5\n7\n5", "sample_input": "5\n1 1 2 1 2\n"}, "reference_outputs": ["2\n2\n3\n2\n3\n"], "source_document_id": "p02732", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N balls. The i-th ball has an integer A_i written on it.\n\nFor each k=1, 2, ..., N, solve the following problem and print the answer.\n\nFind the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal.\n\nConstraints\n\n3 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFor each k=1,2,...,N, print a line containing the answer.\n\nSample Input 1\n\n5\n1 1 2 1 2\n\nSample Output 1\n\n2\n2\n3\n2\n3\n\nConsider the case k=1 for example. The numbers written on the remaining balls are 1,2,1,2.\n\nFrom these balls, there are two ways to choose two distinct balls so that the integers written on them are equal.\n\nThus, the answer for k=1 is 2.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n0\n0\n0\n\nNo two balls have equal numbers written on them.\n\nSample Input 3\n\n5\n3 3 3 3 3\n\nSample Output 3\n\n6\n6\n6\n6\n6\n\nAny two balls have equal numbers written on them.\n\nSample Input 4\n\n8\n1 2 1 4 2 1 4 1\n\nSample Output 4\n\n5\n7\n5\n7\n7\n5\n7\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 377, "cpu_time_ms": 363, "memory_kb": 29476}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s651016859", "group_id": "codeNet:p02732", "input_text": "def aC(a):\n if a == 0:\n return 0\n return a*(a-1)/2\n \nN = input()\nN = int(N)\nA = list(map(int, input().split()))\nd = {}\n \nfor i in range(0,N):\n pre_A = A[:]\n aaaaa = pre_A[i]\n if aaaaa in d:\n print(d[A[i]])\n else:\n pre_A.pop(i)\n ans = 0\n count = 0\n for i in range(1,N+1):\n aaa = pre_A.count(i)\n ans = ans + aC(aaa)\n print(int(ans))\n d[aaaaa] = int(ans)", "language": "Python", "metadata": {"date": 1584929971, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02732.html", "problem_id": "p02732", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02732/input.txt", "sample_output_relpath": "derived/input_output/data/p02732/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02732/Python/s651016859.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s651016859", "user_id": "u305349402"}, "prompt_components": {"gold_output": "2\n2\n3\n2\n3\n", "input_to_evaluate": "def aC(a):\n if a == 0:\n return 0\n return a*(a-1)/2\n \nN = input()\nN = int(N)\nA = list(map(int, input().split()))\nd = {}\n \nfor i in range(0,N):\n pre_A = A[:]\n aaaaa = pre_A[i]\n if aaaaa in d:\n print(d[A[i]])\n else:\n pre_A.pop(i)\n ans = 0\n count = 0\n for i in range(1,N+1):\n aaa = pre_A.count(i)\n ans = ans + aC(aaa)\n print(int(ans))\n d[aaaaa] = int(ans)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N balls. The i-th ball has an integer A_i written on it.\n\nFor each k=1, 2, ..., N, solve the following problem and print the answer.\n\nFind the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal.\n\nConstraints\n\n3 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFor each k=1,2,...,N, print a line containing the answer.\n\nSample Input 1\n\n5\n1 1 2 1 2\n\nSample Output 1\n\n2\n2\n3\n2\n3\n\nConsider the case k=1 for example. The numbers written on the remaining balls are 1,2,1,2.\n\nFrom these balls, there are two ways to choose two distinct balls so that the integers written on them are equal.\n\nThus, the answer for k=1 is 2.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n0\n0\n0\n\nNo two balls have equal numbers written on them.\n\nSample Input 3\n\n5\n3 3 3 3 3\n\nSample Output 3\n\n6\n6\n6\n6\n6\n\nAny two balls have equal numbers written on them.\n\nSample Input 4\n\n8\n1 2 1 4 2 1 4 1\n\nSample Output 4\n\n5\n7\n5\n7\n7\n5\n7\n5", "sample_input": "5\n1 1 2 1 2\n"}, "reference_outputs": ["2\n2\n3\n2\n3\n"], "source_document_id": "p02732", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N balls. The i-th ball has an integer A_i written on it.\n\nFor each k=1, 2, ..., N, solve the following problem and print the answer.\n\nFind the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal.\n\nConstraints\n\n3 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFor each k=1,2,...,N, print a line containing the answer.\n\nSample Input 1\n\n5\n1 1 2 1 2\n\nSample Output 1\n\n2\n2\n3\n2\n3\n\nConsider the case k=1 for example. The numbers written on the remaining balls are 1,2,1,2.\n\nFrom these balls, there are two ways to choose two distinct balls so that the integers written on them are equal.\n\nThus, the answer for k=1 is 2.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n0\n0\n0\n\nNo two balls have equal numbers written on them.\n\nSample Input 3\n\n5\n3 3 3 3 3\n\nSample Output 3\n\n6\n6\n6\n6\n6\n\nAny two balls have equal numbers written on them.\n\nSample Input 4\n\n8\n1 2 1 4 2 1 4 1\n\nSample Output 4\n\n5\n7\n5\n7\n7\n5\n7\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 392, "cpu_time_ms": 2107, "memory_kb": 78920}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s362032676", "group_id": "codeNet:p02734", "input_text": "import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(100000)\n# mod = 10 ** 9 + 7\nmod = 998244353\n\n\ndef read_values():\n return map(int, input().split())\n\n\ndef read_index():\n return map(lambda x: int(x) - 1, input().split())\n\n\ndef read_list():\n return list(read_values())\n\n\ndef read_lists(N):\n return [read_list() for n in range(N)]\n\n\nclass V:\n def __init__(self, f, v=None):\n self.f = f\n self.v = v\n\n def __str__(self):\n return str(self.v)\n\n def ud(self, n):\n if n is None:\n return\n\n if self.v is None:\n self.v = n\n return\n self.v = self.f(self.v, n)\n\n\ndef main():\n N, S = read_values()\n A = read_list()\n\n dp = [(0, 0, 0) for _ in range(S + 1)]\n dp[0] = (1, 1, 1)\n\n for a in A:\n for s in range(S, -1, -1):\n d1 = dp[s][0]\n d2 = (dp[s][1] + (0 if s - a < 0 else dp[s - a][1]) + d1) % mod\n d3 = (dp[s][2] + (0 if s - a < 0 else dp[s - a][1]) + d2) % mod\n dp[s] = (d1, d2, d3)\n\n print((dp[S][2] - dp[S][1]) % mod)\n\n\nif __name__ == \"__main__\":\n main()\n", "language": "Python", "metadata": {"date": 1587080609, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02734.html", "problem_id": "p02734", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02734/input.txt", "sample_output_relpath": "derived/input_output/data/p02734/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02734/Python/s362032676.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s362032676", "user_id": "u067983636"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import sys\n\ninput = sys.stdin.readline\nsys.setrecursionlimit(100000)\n# mod = 10 ** 9 + 7\nmod = 998244353\n\n\ndef read_values():\n return map(int, input().split())\n\n\ndef read_index():\n return map(lambda x: int(x) - 1, input().split())\n\n\ndef read_list():\n return list(read_values())\n\n\ndef read_lists(N):\n return [read_list() for n in range(N)]\n\n\nclass V:\n def __init__(self, f, v=None):\n self.f = f\n self.v = v\n\n def __str__(self):\n return str(self.v)\n\n def ud(self, n):\n if n is None:\n return\n\n if self.v is None:\n self.v = n\n return\n self.v = self.f(self.v, n)\n\n\ndef main():\n N, S = read_values()\n A = read_list()\n\n dp = [(0, 0, 0) for _ in range(S + 1)]\n dp[0] = (1, 1, 1)\n\n for a in A:\n for s in range(S, -1, -1):\n d1 = dp[s][0]\n d2 = (dp[s][1] + (0 if s - a < 0 else dp[s - a][1]) + d1) % mod\n d3 = (dp[s][2] + (0 if s - a < 0 else dp[s - a][1]) + d2) % mod\n dp[s] = (d1, d2, d3)\n\n print((dp[S][2] - dp[S][1]) % mod)\n\n\nif __name__ == \"__main__\":\n main()\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nGiven are a sequence of N integers A_1, A_2, \\ldots, A_N and a positive integer S.\n\nFor a pair of integers (L, R) such that 1\\leq L \\leq R \\leq N, let us define f(L, R) as follows:\n\nf(L, R) is the number of sequences of integers (x_1, x_2, \\ldots , x_k) such that L \\leq x_1 < x_2 < \\cdots < x_k \\leq R and A_{x_1}+A_{x_2}+\\cdots +A_{x_k} = S.\n\nFind the sum of f(L, R) over all pairs of integers (L, R) such that 1\\leq L \\leq R\\leq N. Since this sum can be enormous, print it modulo 998244353.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3000\n\n1 \\leq S \\leq 3000\n\n1 \\leq A_i \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN S\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the sum of f(L, R), modulo 998244353.\n\nSample Input 1\n\n3 4\n2 2 4\n\nSample Output 1\n\n5\n\nThe value of f(L, R) for each pair is as follows, for a total of 5.\n\nf(1,1) = 0\n\nf(1,2) = 1 (for the sequence (1, 2))\n\nf(1,3) = 2 (for (1, 2) and (3))\n\nf(2,2) = 0\n\nf(2,3) = 1 (for (3))\n\nf(3,3) = 1 (for (3))\n\nSample Input 2\n\n5 8\n9 9 9 9 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n10 10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n152", "sample_input": "3 4\n2 2 4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02734", "source_text": "Score : 600 points\n\nProblem Statement\n\nGiven are a sequence of N integers A_1, A_2, \\ldots, A_N and a positive integer S.\n\nFor a pair of integers (L, R) such that 1\\leq L \\leq R \\leq N, let us define f(L, R) as follows:\n\nf(L, R) is the number of sequences of integers (x_1, x_2, \\ldots , x_k) such that L \\leq x_1 < x_2 < \\cdots < x_k \\leq R and A_{x_1}+A_{x_2}+\\cdots +A_{x_k} = S.\n\nFind the sum of f(L, R) over all pairs of integers (L, R) such that 1\\leq L \\leq R\\leq N. Since this sum can be enormous, print it modulo 998244353.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3000\n\n1 \\leq S \\leq 3000\n\n1 \\leq A_i \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN S\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the sum of f(L, R), modulo 998244353.\n\nSample Input 1\n\n3 4\n2 2 4\n\nSample Output 1\n\n5\n\nThe value of f(L, R) for each pair is as follows, for a total of 5.\n\nf(1,1) = 0\n\nf(1,2) = 1 (for the sequence (1, 2))\n\nf(1,3) = 2 (for (1, 2) and (3))\n\nf(2,2) = 0\n\nf(2,3) = 1 (for (3))\n\nf(3,3) = 1 (for (3))\n\nSample Input 2\n\n5 8\n9 9 9 9 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n10 10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n152", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1122, "cpu_time_ms": 687, "memory_kb": 57308}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s888341477", "group_id": "codeNet:p02735", "input_text": "#!/usr/bin/env python3\nimport sys\n\nmin_r = 200\n\ndef solve(H: int, W: int, s: \"List[str]\"):\n l = H+W\n global min_r\n def cal_c(cmp, y, x, pre):\n global min_r\n if cmp < min_r :\n if ((y==H-1)&(x==W-1)):\n min_r = cmp+((pre ==\".\")&(s[y][x]==\"#\"))*1\n else:\n k = ((pre==\".\")&(s[y][x]==\"#\"))*1\n if y < H-1:\n cal_c(cmp+k, y+1, x, s[y][x])\n if x < W-1:\n cal_c(cmp+k, y, x+1, s[y][x])\n\n cal_c(0, 0, 0, \".\")\n print(min_r)\n\n return\n\n\n# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n H = int(next(tokens)) # type: int\n W = int(next(tokens)) # type: int\n s = [next(tokens) for _ in range(W)] # type: \"List[str]\"\n solve(H, W, s)\n\nif __name__ == '__main__':\n main()\n", "language": "Python", "metadata": {"date": 1584845605, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02735.html", "problem_id": "p02735", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02735/input.txt", "sample_output_relpath": "derived/input_output/data/p02735/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02735/Python/s888341477.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s888341477", "user_id": "u166727624"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "#!/usr/bin/env python3\nimport sys\n\nmin_r = 200\n\ndef solve(H: int, W: int, s: \"List[str]\"):\n l = H+W\n global min_r\n def cal_c(cmp, y, x, pre):\n global min_r\n if cmp < min_r :\n if ((y==H-1)&(x==W-1)):\n min_r = cmp+((pre ==\".\")&(s[y][x]==\"#\"))*1\n else:\n k = ((pre==\".\")&(s[y][x]==\"#\"))*1\n if y < H-1:\n cal_c(cmp+k, y+1, x, s[y][x])\n if x < W-1:\n cal_c(cmp+k, y, x+1, s[y][x])\n\n cal_c(0, 0, 0, \".\")\n print(min_r)\n\n return\n\n\n# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n H = int(next(tokens)) # type: int\n W = int(next(tokens)) # type: int\n s = [next(tokens) for _ in range(W)] # type: \"List[str]\"\n solve(H, W, s)\n\nif __name__ == '__main__':\n main()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nConsider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left.\nEach square is painted black or white.\n\nThe grid is said to be good if and only if the following condition is satisfied:\n\nFrom (1, 1), we can reach (H, W) by moving one square right or down repeatedly, while always being on a white square.\n\nNote that (1, 1) and (H, W) must be white if the grid is good.\n\nYour task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.\n\nChoose four integers r_0, c_0, r_1, c_1(1 \\leq r_0 \\leq r_1 \\leq H, 1 \\leq c_0 \\leq c_1 \\leq W). For each pair r, c (r_0 \\leq r \\leq r_1, c_0 \\leq c \\leq c_1), invert the color of (r, c) - that is, from white to black and vice versa.\n\nConstraints\n\n2 \\leq H, W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{11} s_{12} \\cdots s_{1W}\ns_{21} s_{22} \\cdots s_{2W}\n\\vdots\ns_{H1} s_{H2} \\cdots s_{HW}\n\nHere s_{rc} represents the color of (r, c) - # stands for black, and . stands for white.\n\nOutput\n\nPrint the minimum number of operations needed.\n\nSample Input 1\n\n3 3\n.##\n.#.\n##.\n\nSample Output 1\n\n1\n\nDo the operation with (r_0, c_0, r_1, c_1) = (2, 2, 2, 2) to change just the color of (2, 2), and we are done.\n\nSample Input 2\n\n2 2\n#.\n.#\n\nSample Output 2\n\n2\n\nSample Input 3\n\n4 4\n..##\n#...\n###.\n###.\n\nSample Output 3\n\n0\n\nNo operation may be needed.\n\nSample Input 4\n\n5 5\n.#.#.\n#.#.#\n.#.#.\n#.#.#\n.#.#.\n\nSample Output 4\n\n4", "sample_input": "3 3\n.##\n.#.\n##.\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02735", "source_text": "Score : 400 points\n\nProblem Statement\n\nConsider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left.\nEach square is painted black or white.\n\nThe grid is said to be good if and only if the following condition is satisfied:\n\nFrom (1, 1), we can reach (H, W) by moving one square right or down repeatedly, while always being on a white square.\n\nNote that (1, 1) and (H, W) must be white if the grid is good.\n\nYour task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.\n\nChoose four integers r_0, c_0, r_1, c_1(1 \\leq r_0 \\leq r_1 \\leq H, 1 \\leq c_0 \\leq c_1 \\leq W). For each pair r, c (r_0 \\leq r \\leq r_1, c_0 \\leq c \\leq c_1), invert the color of (r, c) - that is, from white to black and vice versa.\n\nConstraints\n\n2 \\leq H, W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{11} s_{12} \\cdots s_{1W}\ns_{21} s_{22} \\cdots s_{2W}\n\\vdots\ns_{H1} s_{H2} \\cdots s_{HW}\n\nHere s_{rc} represents the color of (r, c) - # stands for black, and . stands for white.\n\nOutput\n\nPrint the minimum number of operations needed.\n\nSample Input 1\n\n3 3\n.##\n.#.\n##.\n\nSample Output 1\n\n1\n\nDo the operation with (r_0, c_0, r_1, c_1) = (2, 2, 2, 2) to change just the color of (2, 2), and we are done.\n\nSample Input 2\n\n2 2\n#.\n.#\n\nSample Output 2\n\n2\n\nSample Input 3\n\n4 4\n..##\n#...\n###.\n###.\n\nSample Output 3\n\n0\n\nNo operation may be needed.\n\nSample Input 4\n\n5 5\n.#.#.\n#.#.#\n.#.#.\n#.#.#\n.#.#.\n\nSample Output 4\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1100, "cpu_time_ms": 2104, "memory_kb": 3188}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s119702091", "group_id": "codeNet:p02735", "input_text": "from collections import deque\nimport sys\nsys.setrecursionlimit(10 ** 9)\n# import numpy as np\n# 答えの提出の時にi+1とj+1は忘れないように\nh, w = map(int, input().split())\nmaze = [[-1 for i in range(w)] for j in range(h)]\n\nINF = h*w\ncountBlack = [[INF for i in range(w)] for j in range(h)]\n\nfor i in range(h):\n maze[i] = input()\n\nsx=0\nsy=0\nqueue = deque()\nqueue.append((sy,sx))\ncountBlack[sy][sx] = int(maze[0][0]== '#')\n\nwhile queue:\n y, x = queue.popleft()\n for i,j in [(1,0),(0,1)]:\n ny, nx = y+i, x+j\n if 0 <= nx < w and 0 <= ny < h:\n if countBlack[ny][nx] >= countBlack[y][x]+1:\n if maze[ny][nx] == '#':\n countBlack[ny][nx] = countBlack[y][x] + 1\n else:\n countBlack[ny][nx] = countBlack[y][x]\n if ny != h-1 or nx != w-1:\n queue.append((ny, nx))\n elif countBlack[ny][nx]==0:\n print(0)\n exit()\n\nprint(countBlack[h-1][w-1])\n", "language": "Python", "metadata": {"date": 1584843303, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02735.html", "problem_id": "p02735", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02735/input.txt", "sample_output_relpath": "derived/input_output/data/p02735/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02735/Python/s119702091.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s119702091", "user_id": "u952467214"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "from collections import deque\nimport sys\nsys.setrecursionlimit(10 ** 9)\n# import numpy as np\n# 答えの提出の時にi+1とj+1は忘れないように\nh, w = map(int, input().split())\nmaze = [[-1 for i in range(w)] for j in range(h)]\n\nINF = h*w\ncountBlack = [[INF for i in range(w)] for j in range(h)]\n\nfor i in range(h):\n maze[i] = input()\n\nsx=0\nsy=0\nqueue = deque()\nqueue.append((sy,sx))\ncountBlack[sy][sx] = int(maze[0][0]== '#')\n\nwhile queue:\n y, x = queue.popleft()\n for i,j in [(1,0),(0,1)]:\n ny, nx = y+i, x+j\n if 0 <= nx < w and 0 <= ny < h:\n if countBlack[ny][nx] >= countBlack[y][x]+1:\n if maze[ny][nx] == '#':\n countBlack[ny][nx] = countBlack[y][x] + 1\n else:\n countBlack[ny][nx] = countBlack[y][x]\n if ny != h-1 or nx != w-1:\n queue.append((ny, nx))\n elif countBlack[ny][nx]==0:\n print(0)\n exit()\n\nprint(countBlack[h-1][w-1])\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nConsider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left.\nEach square is painted black or white.\n\nThe grid is said to be good if and only if the following condition is satisfied:\n\nFrom (1, 1), we can reach (H, W) by moving one square right or down repeatedly, while always being on a white square.\n\nNote that (1, 1) and (H, W) must be white if the grid is good.\n\nYour task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.\n\nChoose four integers r_0, c_0, r_1, c_1(1 \\leq r_0 \\leq r_1 \\leq H, 1 \\leq c_0 \\leq c_1 \\leq W). For each pair r, c (r_0 \\leq r \\leq r_1, c_0 \\leq c \\leq c_1), invert the color of (r, c) - that is, from white to black and vice versa.\n\nConstraints\n\n2 \\leq H, W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{11} s_{12} \\cdots s_{1W}\ns_{21} s_{22} \\cdots s_{2W}\n\\vdots\ns_{H1} s_{H2} \\cdots s_{HW}\n\nHere s_{rc} represents the color of (r, c) - # stands for black, and . stands for white.\n\nOutput\n\nPrint the minimum number of operations needed.\n\nSample Input 1\n\n3 3\n.##\n.#.\n##.\n\nSample Output 1\n\n1\n\nDo the operation with (r_0, c_0, r_1, c_1) = (2, 2, 2, 2) to change just the color of (2, 2), and we are done.\n\nSample Input 2\n\n2 2\n#.\n.#\n\nSample Output 2\n\n2\n\nSample Input 3\n\n4 4\n..##\n#...\n###.\n###.\n\nSample Output 3\n\n0\n\nNo operation may be needed.\n\nSample Input 4\n\n5 5\n.#.#.\n#.#.#\n.#.#.\n#.#.#\n.#.#.\n\nSample Output 4\n\n4", "sample_input": "3 3\n.##\n.#.\n##.\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02735", "source_text": "Score : 400 points\n\nProblem Statement\n\nConsider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left.\nEach square is painted black or white.\n\nThe grid is said to be good if and only if the following condition is satisfied:\n\nFrom (1, 1), we can reach (H, W) by moving one square right or down repeatedly, while always being on a white square.\n\nNote that (1, 1) and (H, W) must be white if the grid is good.\n\nYour task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.\n\nChoose four integers r_0, c_0, r_1, c_1(1 \\leq r_0 \\leq r_1 \\leq H, 1 \\leq c_0 \\leq c_1 \\leq W). For each pair r, c (r_0 \\leq r \\leq r_1, c_0 \\leq c \\leq c_1), invert the color of (r, c) - that is, from white to black and vice versa.\n\nConstraints\n\n2 \\leq H, W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{11} s_{12} \\cdots s_{1W}\ns_{21} s_{22} \\cdots s_{2W}\n\\vdots\ns_{H1} s_{H2} \\cdots s_{HW}\n\nHere s_{rc} represents the color of (r, c) - # stands for black, and . stands for white.\n\nOutput\n\nPrint the minimum number of operations needed.\n\nSample Input 1\n\n3 3\n.##\n.#.\n##.\n\nSample Output 1\n\n1\n\nDo the operation with (r_0, c_0, r_1, c_1) = (2, 2, 2, 2) to change just the color of (2, 2), and we are done.\n\nSample Input 2\n\n2 2\n#.\n.#\n\nSample Output 2\n\n2\n\nSample Input 3\n\n4 4\n..##\n#...\n###.\n###.\n\nSample Output 3\n\n0\n\nNo operation may be needed.\n\nSample Input 4\n\n5 5\n.#.#.\n#.#.#\n.#.#.\n#.#.#\n.#.#.\n\nSample Output 4\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1029, "cpu_time_ms": 2107, "memory_kb": 64876}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s423305444", "group_id": "codeNet:p02735", "input_text": "H,W = [int(i.strip()) for i in input().split(' ')]\n\nMAP = [list(input())for _ in range(H)]\n\nF = [[0] * 10] * 10\n\narrive = {}\nif MAP[0][0] == '#':\n arrive[(0,0)] = 1\nelse:\n arrive[(0,0)] = 0\n\nwhile True:\n A = {}\n for p , v in arrive.items():\n if p[0]+1 < H:\n if MAP[p[0]+1][p[1]] == '.':\n if not (p[0]+1 , p[1]) in A:\n A[(p[0]+1 , p[1])] = v \n else:\n t = A[(p[0]+1 , p[1])]\n A[(p[0]+1 , p[1])] = v if v < t else t\n else:\n if not (p[0]+1 , p[1]) in A:\n A[(p[0]+1, p[1])] = v+1\n else:\n t = A[(p[0]+1 , p[1])]\n A[(p[0]+1 , p[1])] = v + 1 if v + 1 < t else t\n\n if p[1] + 1 < W:\n if MAP[p[0]][p[1] + 1] == '.':\n if not ( p[0] , p[1] + 1) in A:\n A[( p[0] , p[1] + 1)] = v \n else:\n t = A[( p[0] , p[1] + 1)]\n A[( p[0] , p[1] + 1)] = v if v < t else t\n else:\n if not ( p[0] , p[1] + 1) in A:\n A[( p[0] , p[1] + 1)] = v+1\n else:\n t = A[( p[0] , p[1] + 1)]\n A[( p[0] , p[1] + 1)] = v + 1 if v + 1 < t else t\n\n if (H-1,W-1) in A:\n print(A[(H-1,W-1)])\n exit()\n\n else:\n arrive = A.copy()\n", "language": "Python", "metadata": {"date": 1584842191, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02735.html", "problem_id": "p02735", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02735/input.txt", "sample_output_relpath": "derived/input_output/data/p02735/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02735/Python/s423305444.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s423305444", "user_id": "u619144316"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "H,W = [int(i.strip()) for i in input().split(' ')]\n\nMAP = [list(input())for _ in range(H)]\n\nF = [[0] * 10] * 10\n\narrive = {}\nif MAP[0][0] == '#':\n arrive[(0,0)] = 1\nelse:\n arrive[(0,0)] = 0\n\nwhile True:\n A = {}\n for p , v in arrive.items():\n if p[0]+1 < H:\n if MAP[p[0]+1][p[1]] == '.':\n if not (p[0]+1 , p[1]) in A:\n A[(p[0]+1 , p[1])] = v \n else:\n t = A[(p[0]+1 , p[1])]\n A[(p[0]+1 , p[1])] = v if v < t else t\n else:\n if not (p[0]+1 , p[1]) in A:\n A[(p[0]+1, p[1])] = v+1\n else:\n t = A[(p[0]+1 , p[1])]\n A[(p[0]+1 , p[1])] = v + 1 if v + 1 < t else t\n\n if p[1] + 1 < W:\n if MAP[p[0]][p[1] + 1] == '.':\n if not ( p[0] , p[1] + 1) in A:\n A[( p[0] , p[1] + 1)] = v \n else:\n t = A[( p[0] , p[1] + 1)]\n A[( p[0] , p[1] + 1)] = v if v < t else t\n else:\n if not ( p[0] , p[1] + 1) in A:\n A[( p[0] , p[1] + 1)] = v+1\n else:\n t = A[( p[0] , p[1] + 1)]\n A[( p[0] , p[1] + 1)] = v + 1 if v + 1 < t else t\n\n if (H-1,W-1) in A:\n print(A[(H-1,W-1)])\n exit()\n\n else:\n arrive = A.copy()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nConsider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left.\nEach square is painted black or white.\n\nThe grid is said to be good if and only if the following condition is satisfied:\n\nFrom (1, 1), we can reach (H, W) by moving one square right or down repeatedly, while always being on a white square.\n\nNote that (1, 1) and (H, W) must be white if the grid is good.\n\nYour task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.\n\nChoose four integers r_0, c_0, r_1, c_1(1 \\leq r_0 \\leq r_1 \\leq H, 1 \\leq c_0 \\leq c_1 \\leq W). For each pair r, c (r_0 \\leq r \\leq r_1, c_0 \\leq c \\leq c_1), invert the color of (r, c) - that is, from white to black and vice versa.\n\nConstraints\n\n2 \\leq H, W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{11} s_{12} \\cdots s_{1W}\ns_{21} s_{22} \\cdots s_{2W}\n\\vdots\ns_{H1} s_{H2} \\cdots s_{HW}\n\nHere s_{rc} represents the color of (r, c) - # stands for black, and . stands for white.\n\nOutput\n\nPrint the minimum number of operations needed.\n\nSample Input 1\n\n3 3\n.##\n.#.\n##.\n\nSample Output 1\n\n1\n\nDo the operation with (r_0, c_0, r_1, c_1) = (2, 2, 2, 2) to change just the color of (2, 2), and we are done.\n\nSample Input 2\n\n2 2\n#.\n.#\n\nSample Output 2\n\n2\n\nSample Input 3\n\n4 4\n..##\n#...\n###.\n###.\n\nSample Output 3\n\n0\n\nNo operation may be needed.\n\nSample Input 4\n\n5 5\n.#.#.\n#.#.#\n.#.#.\n#.#.#\n.#.#.\n\nSample Output 4\n\n4", "sample_input": "3 3\n.##\n.#.\n##.\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02735", "source_text": "Score : 400 points\n\nProblem Statement\n\nConsider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left.\nEach square is painted black or white.\n\nThe grid is said to be good if and only if the following condition is satisfied:\n\nFrom (1, 1), we can reach (H, W) by moving one square right or down repeatedly, while always being on a white square.\n\nNote that (1, 1) and (H, W) must be white if the grid is good.\n\nYour task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.\n\nChoose four integers r_0, c_0, r_1, c_1(1 \\leq r_0 \\leq r_1 \\leq H, 1 \\leq c_0 \\leq c_1 \\leq W). For each pair r, c (r_0 \\leq r \\leq r_1, c_0 \\leq c \\leq c_1), invert the color of (r, c) - that is, from white to black and vice versa.\n\nConstraints\n\n2 \\leq H, W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{11} s_{12} \\cdots s_{1W}\ns_{21} s_{22} \\cdots s_{2W}\n\\vdots\ns_{H1} s_{H2} \\cdots s_{HW}\n\nHere s_{rc} represents the color of (r, c) - # stands for black, and . stands for white.\n\nOutput\n\nPrint the minimum number of operations needed.\n\nSample Input 1\n\n3 3\n.##\n.#.\n##.\n\nSample Output 1\n\n1\n\nDo the operation with (r_0, c_0, r_1, c_1) = (2, 2, 2, 2) to change just the color of (2, 2), and we are done.\n\nSample Input 2\n\n2 2\n#.\n.#\n\nSample Output 2\n\n2\n\nSample Input 3\n\n4 4\n..##\n#...\n###.\n###.\n\nSample Output 3\n\n0\n\nNo operation may be needed.\n\nSample Input 4\n\n5 5\n.#.#.\n#.#.#\n.#.#.\n#.#.#\n.#.#.\n\nSample Output 4\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1419, "cpu_time_ms": 38, "memory_kb": 3316}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s764505152", "group_id": "codeNet:p02742", "input_text": "from math import ceil\nH,W=map(int,input().split())\n\nif W%2==0:\n print((W//2)*H)\nelse:\n print(ceil(W/2)*ceil(H/2)+(W//2)*(H//2))\n", "language": "Python", "metadata": {"date": 1584839906, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02742.html", "problem_id": "p02742", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02742/input.txt", "sample_output_relpath": "derived/input_output/data/p02742/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02742/Python/s764505152.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s764505152", "user_id": "u995004106"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "from math import ceil\nH,W=map(int,input().split())\n\nif W%2==0:\n print((W//2)*H)\nelse:\n print(ceil(W/2)*ceil(H/2)+(W//2)*(H//2))\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a board with H horizontal rows and W vertical columns of squares.\nThere is a bishop at the top-left square on this board.\nHow many squares can this bishop reach by zero or more movements?\n\nHere the bishop can only move diagonally.\nMore formally, the bishop can move from the square at the r_1-th row (from the top) and the c_1-th column (from the left) to the square at the r_2-th row and the c_2-th column if and only if exactly one of the following holds:\n\nr_1 + c_1 = r_2 + c_2\n\nr_1 - c_1 = r_2 - c_2\n\nFor example, in the following figure, the bishop can move to any of the red squares in one move:\n\nConstraints\n\n1 \\leq H, W \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH \\ W\n\nOutput\n\nPrint the number of squares the bishop can reach.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\n10\n\nThe bishop can reach the cyan squares in the following figure:\n\nSample Input 2\n\n7 3\n\nSample Output 2\n\n11\n\nThe bishop can reach the cyan squares in the following figure:\n\nSample Input 3\n\n1000000000 1000000000\n\nSample Output 3\n\n500000000000000000", "sample_input": "4 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02742", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a board with H horizontal rows and W vertical columns of squares.\nThere is a bishop at the top-left square on this board.\nHow many squares can this bishop reach by zero or more movements?\n\nHere the bishop can only move diagonally.\nMore formally, the bishop can move from the square at the r_1-th row (from the top) and the c_1-th column (from the left) to the square at the r_2-th row and the c_2-th column if and only if exactly one of the following holds:\n\nr_1 + c_1 = r_2 + c_2\n\nr_1 - c_1 = r_2 - c_2\n\nFor example, in the following figure, the bishop can move to any of the red squares in one move:\n\nConstraints\n\n1 \\leq H, W \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH \\ W\n\nOutput\n\nPrint the number of squares the bishop can reach.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\n10\n\nThe bishop can reach the cyan squares in the following figure:\n\nSample Input 2\n\n7 3\n\nSample Output 2\n\n11\n\nThe bishop can reach the cyan squares in the following figure:\n\nSample Input 3\n\n1000000000 1000000000\n\nSample Output 3\n\n500000000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 134, "cpu_time_ms": 165, "memory_kb": 38384}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s388764276", "group_id": "codeNet:p02742", "input_text": "h, w = map(int, input().split())\nif h==1 or w == 1:\n print(0)\nelif h%2==0:\n print(h*w//2)\nelse:\n print(h*w//2 +1)", "language": "Python", "metadata": {"date": 1584273599, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02742.html", "problem_id": "p02742", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02742/input.txt", "sample_output_relpath": "derived/input_output/data/p02742/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02742/Python/s388764276.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s388764276", "user_id": "u413165887"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "h, w = map(int, input().split())\nif h==1 or w == 1:\n print(0)\nelif h%2==0:\n print(h*w//2)\nelse:\n print(h*w//2 +1)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a board with H horizontal rows and W vertical columns of squares.\nThere is a bishop at the top-left square on this board.\nHow many squares can this bishop reach by zero or more movements?\n\nHere the bishop can only move diagonally.\nMore formally, the bishop can move from the square at the r_1-th row (from the top) and the c_1-th column (from the left) to the square at the r_2-th row and the c_2-th column if and only if exactly one of the following holds:\n\nr_1 + c_1 = r_2 + c_2\n\nr_1 - c_1 = r_2 - c_2\n\nFor example, in the following figure, the bishop can move to any of the red squares in one move:\n\nConstraints\n\n1 \\leq H, W \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH \\ W\n\nOutput\n\nPrint the number of squares the bishop can reach.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\n10\n\nThe bishop can reach the cyan squares in the following figure:\n\nSample Input 2\n\n7 3\n\nSample Output 2\n\n11\n\nThe bishop can reach the cyan squares in the following figure:\n\nSample Input 3\n\n1000000000 1000000000\n\nSample Output 3\n\n500000000000000000", "sample_input": "4 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02742", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a board with H horizontal rows and W vertical columns of squares.\nThere is a bishop at the top-left square on this board.\nHow many squares can this bishop reach by zero or more movements?\n\nHere the bishop can only move diagonally.\nMore formally, the bishop can move from the square at the r_1-th row (from the top) and the c_1-th column (from the left) to the square at the r_2-th row and the c_2-th column if and only if exactly one of the following holds:\n\nr_1 + c_1 = r_2 + c_2\n\nr_1 - c_1 = r_2 - c_2\n\nFor example, in the following figure, the bishop can move to any of the red squares in one move:\n\nConstraints\n\n1 \\leq H, W \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH \\ W\n\nOutput\n\nPrint the number of squares the bishop can reach.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\n10\n\nThe bishop can reach the cyan squares in the following figure:\n\nSample Input 2\n\n7 3\n\nSample Output 2\n\n11\n\nThe bishop can reach the cyan squares in the following figure:\n\nSample Input 3\n\n1000000000 1000000000\n\nSample Output 3\n\n500000000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 122, "cpu_time_ms": 18, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s899023898", "group_id": "codeNet:p02742", "input_text": "h,w=input().split()\nh=int(h)\nw=int(w)\nans=h*w//2\nif (h*w%2==1):\n ans+=1\nprint(ans)\n", "language": "Python", "metadata": {"date": 1584235414, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02742.html", "problem_id": "p02742", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02742/input.txt", "sample_output_relpath": "derived/input_output/data/p02742/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02742/Python/s899023898.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s899023898", "user_id": "u273928723"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "h,w=input().split()\nh=int(h)\nw=int(w)\nans=h*w//2\nif (h*w%2==1):\n ans+=1\nprint(ans)\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a board with H horizontal rows and W vertical columns of squares.\nThere is a bishop at the top-left square on this board.\nHow many squares can this bishop reach by zero or more movements?\n\nHere the bishop can only move diagonally.\nMore formally, the bishop can move from the square at the r_1-th row (from the top) and the c_1-th column (from the left) to the square at the r_2-th row and the c_2-th column if and only if exactly one of the following holds:\n\nr_1 + c_1 = r_2 + c_2\n\nr_1 - c_1 = r_2 - c_2\n\nFor example, in the following figure, the bishop can move to any of the red squares in one move:\n\nConstraints\n\n1 \\leq H, W \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH \\ W\n\nOutput\n\nPrint the number of squares the bishop can reach.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\n10\n\nThe bishop can reach the cyan squares in the following figure:\n\nSample Input 2\n\n7 3\n\nSample Output 2\n\n11\n\nThe bishop can reach the cyan squares in the following figure:\n\nSample Input 3\n\n1000000000 1000000000\n\nSample Output 3\n\n500000000000000000", "sample_input": "4 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02742", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a board with H horizontal rows and W vertical columns of squares.\nThere is a bishop at the top-left square on this board.\nHow many squares can this bishop reach by zero or more movements?\n\nHere the bishop can only move diagonally.\nMore formally, the bishop can move from the square at the r_1-th row (from the top) and the c_1-th column (from the left) to the square at the r_2-th row and the c_2-th column if and only if exactly one of the following holds:\n\nr_1 + c_1 = r_2 + c_2\n\nr_1 - c_1 = r_2 - c_2\n\nFor example, in the following figure, the bishop can move to any of the red squares in one move:\n\nConstraints\n\n1 \\leq H, W \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH \\ W\n\nOutput\n\nPrint the number of squares the bishop can reach.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\n10\n\nThe bishop can reach the cyan squares in the following figure:\n\nSample Input 2\n\n7 3\n\nSample Output 2\n\n11\n\nThe bishop can reach the cyan squares in the following figure:\n\nSample Input 3\n\n1000000000 1000000000\n\nSample Output 3\n\n500000000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 86, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s092171010", "group_id": "codeNet:p02744", "input_text": "N = int(input())\n#print(N)\nret = 2 ** (N-1)\nprint(ret)\n", "language": "Python", "metadata": {"date": 1584237710, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02744.html", "problem_id": "p02744", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02744/input.txt", "sample_output_relpath": "derived/input_output/data/p02744/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02744/Python/s092171010.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s092171010", "user_id": "u868606077"}, "prompt_components": {"gold_output": "a\n", "input_to_evaluate": "N = int(input())\n#print(N)\nret = 2 ** (N-1)\nprint(ret)\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nIn this problem, we only consider strings consisting of lowercase English letters.\n\nStrings s and t are said to be isomorphic when the following conditions are satisfied:\n\n|s| = |t| holds.\n\nFor every pair i, j, one of the following holds:\n\ns_i = s_j and t_i = t_j.\n\ns_i \\neq s_j and t_i \\neq t_j.\n\nFor example, abcac and zyxzx are isomorphic, while abcac and ppppp are not.\n\nA string s is said to be in normal form when the following condition is satisfied:\n\nFor every string t that is isomorphic to s, s \\leq t holds. Here \\leq denotes lexicographic comparison.\n\nFor example, abcac is in normal form, but zyxzx is not since it is isomorphic to abcac, which is lexicographically smaller than zyxzx.\n\nYou are given an integer N.\nPrint all strings of length N that are in normal form, in lexicographically ascending order.\n\nConstraints\n\n1 \\leq N \\leq 10\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nAssume that there are K strings of length N that are in normal form: w_1, \\ldots, w_K in lexicographical order.\nOutput should be in the following format:\n\nw_1\n:\nw_K\n\nSample Input 1\n\n1\n\nSample Output 1\n\na\n\nSample Input 2\n\n2\n\nSample Output 2\n\naa\nab", "sample_input": "1\n"}, "reference_outputs": ["a\n"], "source_document_id": "p02744", "source_text": "Score : 400 points\n\nProblem Statement\n\nIn this problem, we only consider strings consisting of lowercase English letters.\n\nStrings s and t are said to be isomorphic when the following conditions are satisfied:\n\n|s| = |t| holds.\n\nFor every pair i, j, one of the following holds:\n\ns_i = s_j and t_i = t_j.\n\ns_i \\neq s_j and t_i \\neq t_j.\n\nFor example, abcac and zyxzx are isomorphic, while abcac and ppppp are not.\n\nA string s is said to be in normal form when the following condition is satisfied:\n\nFor every string t that is isomorphic to s, s \\leq t holds. Here \\leq denotes lexicographic comparison.\n\nFor example, abcac is in normal form, but zyxzx is not since it is isomorphic to abcac, which is lexicographically smaller than zyxzx.\n\nYou are given an integer N.\nPrint all strings of length N that are in normal form, in lexicographically ascending order.\n\nConstraints\n\n1 \\leq N \\leq 10\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nAssume that there are K strings of length N that are in normal form: w_1, \\ldots, w_K in lexicographical order.\nOutput should be in the following format:\n\nw_1\n:\nw_K\n\nSample Input 1\n\n1\n\nSample Output 1\n\na\n\nSample Input 2\n\n2\n\nSample Output 2\n\naa\nab", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 55, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s614039536", "group_id": "codeNet:p02745", "input_text": "s = {}\ns[0] = input()\ns[1] = input()\ns[2] =input()\n\ndef compe(a,b):\n a,b = list(a),list(b)\n L = len(a) if len(a) < len(b) else len(b)\n c = 0\n for i in range(L):\n flg = 0\n for j,(x,y) in enumerate(zip(a[len(a) - i -1:len(a)],b[0:i+1])):\n if x == '?' or y == '?':\n continue\n elif x == y:\n continue\n else:\n flg = 1\n break\n if flg == 0:\n c = i+1\n ab_1 = a + b[c:]\n ab_2 = a[0:len(a)-c] + b\n for i ,(x, y) in enumerate(zip(ab_1,ab_2)):\n if x == '?':\n ab_1[i] = y\n return c,ab_1\n\njunban = [[0,1,2],[0,2,1],[1,0,2],[1,2,0],[2,0,1],[2,1,0]]\nmin_s = 100000\nfor j in junban:\n p,obj = compe(s[j[0]],s[j[1]])\n q,obj2 = compe(obj,s[j[2]])\n L = len(s[0])+len(s[1])+len(s[2]) - p - q\n if min_s > L:\n min_s = L\n\nprint(min_s)", "language": "Python", "metadata": {"date": 1584310046, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02745.html", "problem_id": "p02745", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02745/input.txt", "sample_output_relpath": "derived/input_output/data/p02745/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02745/Python/s614039536.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s614039536", "user_id": "u619144316"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "s = {}\ns[0] = input()\ns[1] = input()\ns[2] =input()\n\ndef compe(a,b):\n a,b = list(a),list(b)\n L = len(a) if len(a) < len(b) else len(b)\n c = 0\n for i in range(L):\n flg = 0\n for j,(x,y) in enumerate(zip(a[len(a) - i -1:len(a)],b[0:i+1])):\n if x == '?' or y == '?':\n continue\n elif x == y:\n continue\n else:\n flg = 1\n break\n if flg == 0:\n c = i+1\n ab_1 = a + b[c:]\n ab_2 = a[0:len(a)-c] + b\n for i ,(x, y) in enumerate(zip(ab_1,ab_2)):\n if x == '?':\n ab_1[i] = y\n return c,ab_1\n\njunban = [[0,1,2],[0,2,1],[1,0,2],[1,2,0],[2,0,1],[2,1,0]]\nmin_s = 100000\nfor j in junban:\n p,obj = compe(s[j[0]],s[j[1]])\n q,obj2 = compe(obj,s[j[2]])\n L = len(s[0])+len(s[1])+len(s[2]) - p - q\n if min_s > L:\n min_s = L\n\nprint(min_s)", "problem_context": "Score : 500 points\n\nProblem Statement\n\nSnuke has a string s.\nFrom this string, Anuke, Bnuke, and Cnuke obtained strings a, b, and c, respectively, as follows:\n\nChoose a non-empty (contiguous) substring of s (possibly s itself). Then, replace some characters (possibly all or none) in it with ?s.\n\nFor example, if s is mississippi, we can choose the substring ssissip and replace its 1-st and 3-rd characters with ? to obtain ?s?ssip.\n\nYou are given the strings a, b, and c.\nFind the minimum possible length of s.\n\nConstraints\n\n1 \\leq |a|, |b|, |c| \\leq 2000\n\na, b, and c consists of lowercase English letters and ?s.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\n\nOutput\n\nPrint the minimum possible length of s.\n\nSample Input 1\n\na?c\nder\ncod\n\nSample Output 1\n\n7\n\nFor example, s could be atcoder.\n\nSample Input 2\n\natcoder\natcoder\n???????\n\nSample Output 2\n\n7\n\na, b, and c may not be distinct.", "sample_input": "a?c\nder\ncod\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02745", "source_text": "Score : 500 points\n\nProblem Statement\n\nSnuke has a string s.\nFrom this string, Anuke, Bnuke, and Cnuke obtained strings a, b, and c, respectively, as follows:\n\nChoose a non-empty (contiguous) substring of s (possibly s itself). Then, replace some characters (possibly all or none) in it with ?s.\n\nFor example, if s is mississippi, we can choose the substring ssissip and replace its 1-st and 3-rd characters with ? to obtain ?s?ssip.\n\nYou are given the strings a, b, and c.\nFind the minimum possible length of s.\n\nConstraints\n\n1 \\leq |a|, |b|, |c| \\leq 2000\n\na, b, and c consists of lowercase English letters and ?s.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\n\nOutput\n\nPrint the minimum possible length of s.\n\nSample Input 1\n\na?c\nder\ncod\n\nSample Output 1\n\n7\n\nFor example, s could be atcoder.\n\nSample Input 2\n\natcoder\natcoder\n???????\n\nSample Output 2\n\n7\n\na, b, and c may not be distinct.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 894, "cpu_time_ms": 1416, "memory_kb": 3444}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s106810469", "group_id": "codeNet:p02747", "input_text": "S = input()\nif S == \"hi\" or S ==\"hihi\" or S ==\"hihihi\" or S ==\"hihihihi\" or S ==\"hihihihihi\":\n print(\"Yes\")\nelse:\n print(\"No\")\n", "language": "Python", "metadata": {"date": 1583715822, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02747.html", "problem_id": "p02747", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02747/input.txt", "sample_output_relpath": "derived/input_output/data/p02747/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02747/Python/s106810469.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s106810469", "user_id": "u864013199"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "S = input()\nif S == \"hi\" or S ==\"hihi\" or S ==\"hihihi\" or S ==\"hihihihi\" or S ==\"hihihihihi\":\n print(\"Yes\")\nelse:\n print(\"No\")\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nA Hitachi string is a concatenation of one or more copies of the string hi.\n\nFor example, hi and hihi are Hitachi strings, while ha and hii are not.\n\nGiven a string S, determine whether S is a Hitachi string.\n\nConstraints\n\nThe length of S is between 1 and 10 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a Hitachi string, print Yes; otherwise, print No.\n\nSample Input 1\n\nhihi\n\nSample Output 1\n\nYes\n\nhihi is the concatenation of two copies of hi, so it is a Hitachi string.\n\nSample Input 2\n\nhi\n\nSample Output 2\n\nYes\n\nSample Input 3\n\nha\n\nSample Output 3\n\nNo", "sample_input": "hihi\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02747", "source_text": "Score : 100 points\n\nProblem Statement\n\nA Hitachi string is a concatenation of one or more copies of the string hi.\n\nFor example, hi and hihi are Hitachi strings, while ha and hii are not.\n\nGiven a string S, determine whether S is a Hitachi string.\n\nConstraints\n\nThe length of S is between 1 and 10 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a Hitachi string, print Yes; otherwise, print No.\n\nSample Input 1\n\nhihi\n\nSample Output 1\n\nYes\n\nhihi is the concatenation of two copies of hi, so it is a Hitachi string.\n\nSample Input 2\n\nhi\n\nSample Output 2\n\nYes\n\nSample Input 3\n\nha\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 133, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s309344684", "group_id": "codeNet:p02748", "input_text": "A, B, M = map(int, input().split())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\na.sort()\nb.sort()\ndisc = []\nfor i in range(M):\n disc.append(list(map(int,input().split())))\nans = a[0] + b[0]\nfor i in range(M):\n if a[disc[i][0]-1] + b[disc[i][1]-1] - disc[i][2] < ans: ans = a[disc[i][0]-1] + b[disc[i][1]-1] - disc[i][2] \n \nprint(ans)\n ", "language": "Python", "metadata": {"date": 1583716730, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02748.html", "problem_id": "p02748", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02748/input.txt", "sample_output_relpath": "derived/input_output/data/p02748/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02748/Python/s309344684.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s309344684", "user_id": "u460185449"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "A, B, M = map(int, input().split())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\na.sort()\nb.sort()\ndisc = []\nfor i in range(M):\n disc.append(list(map(int,input().split())))\nans = a[0] + b[0]\nfor i in range(M):\n if a[disc[i][0]-1] + b[disc[i][1]-1] - disc[i][2] < ans: ans = a[disc[i][0]-1] + b[disc[i][1]-1] - disc[i][2] \n \nprint(ans)\n ", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are visiting a large electronics store to buy a refrigerator and a microwave.\n\nThe store sells A kinds of refrigerators and B kinds of microwaves. The i-th refrigerator ( 1 \\le i \\le A ) is sold at a_i yen (the currency of Japan), and the j-th microwave ( 1 \\le j \\le B ) is sold at b_j yen.\n\nYou have M discount tickets. With the i-th ticket ( 1 \\le i \\le M ), you can get a discount of c_i yen from the total price when buying the x_i-th refrigerator and the y_i-th microwave together. Only one ticket can be used at a time.\n\nYou are planning to buy one refrigerator and one microwave. Find the minimum amount of money required.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\le A \\le 10^5\n\n1 \\le B \\le 10^5\n\n1 \\le M \\le 10^5\n\n1 \\le a_i , b_i , c_i \\le 10^5\n\n1 \\le x_i \\le A\n\n1 \\le y_i \\le B\n\nc_i \\le a_{x_i} + b_{y_i}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B M\na_1 a_2 ... a_A\nb_1 b_2 ... b_B\nx_1 y_1 c_1\n\\vdots\nx_M y_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 3 1\n3 3\n3 3 3\n1 2 1\n\nSample Output 1\n\n5\n\nWith the ticket, you can get the 1-st refrigerator and the 2-nd microwave for 3+3-1=5 yen.\n\nSample Input 2\n\n1 1 2\n10\n10\n1 1 5\n1 1 10\n\nSample Output 2\n\n10\n\nNote that you cannot use more than one ticket at a time.\n\nSample Input 3\n\n2 2 1\n3 5\n3 5\n2 2 2\n\nSample Output 3\n\n6\n\nYou can get the 1-st refrigerator and the 1-st microwave for 6 yen, which is the minimum amount to pay in this case.\nNote that using a ticket is optional.", "sample_input": "2 3 1\n3 3\n3 3 3\n1 2 1\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02748", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are visiting a large electronics store to buy a refrigerator and a microwave.\n\nThe store sells A kinds of refrigerators and B kinds of microwaves. The i-th refrigerator ( 1 \\le i \\le A ) is sold at a_i yen (the currency of Japan), and the j-th microwave ( 1 \\le j \\le B ) is sold at b_j yen.\n\nYou have M discount tickets. With the i-th ticket ( 1 \\le i \\le M ), you can get a discount of c_i yen from the total price when buying the x_i-th refrigerator and the y_i-th microwave together. Only one ticket can be used at a time.\n\nYou are planning to buy one refrigerator and one microwave. Find the minimum amount of money required.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\le A \\le 10^5\n\n1 \\le B \\le 10^5\n\n1 \\le M \\le 10^5\n\n1 \\le a_i , b_i , c_i \\le 10^5\n\n1 \\le x_i \\le A\n\n1 \\le y_i \\le B\n\nc_i \\le a_{x_i} + b_{y_i}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B M\na_1 a_2 ... a_A\nb_1 b_2 ... b_B\nx_1 y_1 c_1\n\\vdots\nx_M y_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 3 1\n3 3\n3 3 3\n1 2 1\n\nSample Output 1\n\n5\n\nWith the ticket, you can get the 1-st refrigerator and the 2-nd microwave for 3+3-1=5 yen.\n\nSample Input 2\n\n1 1 2\n10\n10\n1 1 5\n1 1 10\n\nSample Output 2\n\n10\n\nNote that you cannot use more than one ticket at a time.\n\nSample Input 3\n\n2 2 1\n3 5\n3 5\n2 2 2\n\nSample Output 3\n\n6\n\nYou can get the 1-st refrigerator and the 1-st microwave for 6 yen, which is the minimum amount to pay in this case.\nNote that using a ticket is optional.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 385, "cpu_time_ms": 735, "memory_kb": 82028}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s477374096", "group_id": "codeNet:p02749", "input_text": "#C\n#入力\nN=int(input())\nX=[list(map(int,input().split())) for i in range(N-1)]\n\n#前提関数\ndef c_1(X,n,j):#nとの距離がiのノードを返す\n t=X[n-1]\n s=[]\n for i in range(len(t)):\n if t[i]==j:\n s.append(i+1)\n return s\n\n#処理\nY=[ [ -1 for i in range(N)] for j in range(N)]\nZ=[ [ 0 for i in range(N)] for j in range(N)]\nfor i in range(N):\n Y[i][i]=0\nfor i in X:\n Y[i[0]-1][i[1]-1]=1\n Y[i[1]-1][i[0]-1]=1\n\nfor i in range(2):#三段探索する\n \n for j in range(N):#一列づつ見る\n t=c_1(Y,j+1,i+1)\n for l in t:\n s=c_1(Y,l,1)\n for m in s:\n if Y[j][m-1]==-1:\n Y[j][m-1]=i+2\n", "language": "Python", "metadata": {"date": 1583718706, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02749.html", "problem_id": "p02749", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02749/input.txt", "sample_output_relpath": "derived/input_output/data/p02749/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02749/Python/s477374096.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s477374096", "user_id": "u489155878"}, "prompt_components": {"gold_output": "1 2 5 4 3\n", "input_to_evaluate": "#C\n#入力\nN=int(input())\nX=[list(map(int,input().split())) for i in range(N-1)]\n\n#前提関数\ndef c_1(X,n,j):#nとの距離がiのノードを返す\n t=X[n-1]\n s=[]\n for i in range(len(t)):\n if t[i]==j:\n s.append(i+1)\n return s\n\n#処理\nY=[ [ -1 for i in range(N)] for j in range(N)]\nZ=[ [ 0 for i in range(N)] for j in range(N)]\nfor i in range(N):\n Y[i][i]=0\nfor i in X:\n Y[i[0]-1][i[1]-1]=1\n Y[i[1]-1][i[0]-1]=1\n\nfor i in range(2):#三段探索する\n \n for j in range(N):#一列づつ見る\n t=c_1(Y,j+1,i+1)\n for l in t:\n s=c_1(Y,l,1)\n for m in s:\n if Y[j][m-1]==-1:\n Y[j][m-1]=i+2\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have a tree with N vertices. The vertices are numbered 1 to N, and the i-th edge connects Vertex a_i and Vertex b_i.\n\nTakahashi loves the number 3. He is seeking a permutation p_1, p_2, \\ldots , p_N of integers from 1 to N satisfying the following condition:\n\nFor every pair of vertices (i, j), if the distance between Vertex i and Vertex j is 3, the sum or product of p_i and p_j is a multiple of 3.\n\nHere the distance between Vertex i and Vertex j is the number of edges contained in the shortest path from Vertex i to Vertex j.\n\nHelp Takahashi by finding a permutation that satisfies the condition.\n\nConstraints\n\n2\\leq N\\leq 2\\times 10^5\n\n1\\leq a_i, b_i \\leq N\n\nThe given graph is a tree.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1\na_2 b_2\n\\vdots\na_{N-1} b_{N-1}\n\nOutput\n\nIf no permutation satisfies the condition, print -1.\n\nOtherwise, print a permutation satisfying the condition, with space in between.\nIf there are multiple solutions, you can print any of them.\n\nSample Input 1\n\n5\n1 2\n1 3\n3 4\n3 5\n\nSample Output 1\n\n1 2 5 4 3\n\nThe distance between two vertices is 3 for the two pairs (2, 4) and (2, 5).\n\np_2 + p_4 = 6\n\np_2\\times p_5 = 6\n\nThus, this permutation satisfies the condition.", "sample_input": "5\n1 2\n1 3\n3 4\n3 5\n"}, "reference_outputs": ["1 2 5 4 3\n"], "source_document_id": "p02749", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have a tree with N vertices. The vertices are numbered 1 to N, and the i-th edge connects Vertex a_i and Vertex b_i.\n\nTakahashi loves the number 3. He is seeking a permutation p_1, p_2, \\ldots , p_N of integers from 1 to N satisfying the following condition:\n\nFor every pair of vertices (i, j), if the distance between Vertex i and Vertex j is 3, the sum or product of p_i and p_j is a multiple of 3.\n\nHere the distance between Vertex i and Vertex j is the number of edges contained in the shortest path from Vertex i to Vertex j.\n\nHelp Takahashi by finding a permutation that satisfies the condition.\n\nConstraints\n\n2\\leq N\\leq 2\\times 10^5\n\n1\\leq a_i, b_i \\leq N\n\nThe given graph is a tree.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1\na_2 b_2\n\\vdots\na_{N-1} b_{N-1}\n\nOutput\n\nIf no permutation satisfies the condition, print -1.\n\nOtherwise, print a permutation satisfying the condition, with space in between.\nIf there are multiple solutions, you can print any of them.\n\nSample Input 1\n\n5\n1 2\n1 3\n3 4\n3 5\n\nSample Output 1\n\n1 2 5 4 3\n\nThe distance between two vertices is 3 for the two pairs (2, 4) and (2, 5).\n\np_2 + p_4 = 6\n\np_2\\times p_5 = 6\n\nThus, this permutation satisfies the condition.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 703, "cpu_time_ms": 2132, "memory_kb": 458796}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s376235027", "group_id": "codeNet:p02753", "input_text": "s = input()\n\nif s[0]==s[1] and s[1]==s[2] and s[0]==s[2]:\n print('No')\nelse:\n print('Yes')\n", "language": "Python", "metadata": {"date": 1588512571, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02753.html", "problem_id": "p02753", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02753/input.txt", "sample_output_relpath": "derived/input_output/data/p02753/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02753/Python/s376235027.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s376235027", "user_id": "u235027735"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "s = input()\n\nif s[0]==s[1] and s[1]==s[2] and s[0]==s[2]:\n print('No')\nelse:\n print('Yes')\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn AtCoder City, there are three stations numbered 1, 2, and 3.\n\nEach of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is A, Company A operates Station i; if S_i is B, Company B operates Station i.\n\nTo improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.\n\nDetermine if there is a pair of stations that will be connected by a bus service.\n\nConstraints\n\nEach character of S is A or B.\n\n|S| = 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf there is a pair of stations that will be connected by a bus service, print Yes; otherwise, print No.\n\nSample Input 1\n\nABA\n\nSample Output 1\n\nYes\n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and 3, so print Yes.\n\nSample Input 2\n\nBBA\n\nSample Output 2\n\nYes\n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and 3, so print Yes.\n\nSample Input 3\n\nBBB\n\nSample Output 3\n\nNo\n\nCompany B operates all the stations. Thus, there will be no bus service, so print No.", "sample_input": "ABA\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02753", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn AtCoder City, there are three stations numbered 1, 2, and 3.\n\nEach of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is A, Company A operates Station i; if S_i is B, Company B operates Station i.\n\nTo improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.\n\nDetermine if there is a pair of stations that will be connected by a bus service.\n\nConstraints\n\nEach character of S is A or B.\n\n|S| = 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf there is a pair of stations that will be connected by a bus service, print Yes; otherwise, print No.\n\nSample Input 1\n\nABA\n\nSample Output 1\n\nYes\n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and 3, so print Yes.\n\nSample Input 2\n\nBBA\n\nSample Output 2\n\nYes\n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and 3, so print Yes.\n\nSample Input 3\n\nBBB\n\nSample Output 3\n\nNo\n\nCompany B operates all the stations. Thus, there will be no bus service, so print No.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 97, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s286096113", "group_id": "codeNet:p02753", "input_text": "S = list(input())\nif S[0] == S[1] == S[2]:\n print('No')\nelse:\n print('Yes')", "language": "Python", "metadata": {"date": 1587691798, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02753.html", "problem_id": "p02753", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02753/input.txt", "sample_output_relpath": "derived/input_output/data/p02753/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02753/Python/s286096113.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s286096113", "user_id": "u125389321"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "S = list(input())\nif S[0] == S[1] == S[2]:\n print('No')\nelse:\n print('Yes')", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn AtCoder City, there are three stations numbered 1, 2, and 3.\n\nEach of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is A, Company A operates Station i; if S_i is B, Company B operates Station i.\n\nTo improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.\n\nDetermine if there is a pair of stations that will be connected by a bus service.\n\nConstraints\n\nEach character of S is A or B.\n\n|S| = 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf there is a pair of stations that will be connected by a bus service, print Yes; otherwise, print No.\n\nSample Input 1\n\nABA\n\nSample Output 1\n\nYes\n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and 3, so print Yes.\n\nSample Input 2\n\nBBA\n\nSample Output 2\n\nYes\n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and 3, so print Yes.\n\nSample Input 3\n\nBBB\n\nSample Output 3\n\nNo\n\nCompany B operates all the stations. Thus, there will be no bus service, so print No.", "sample_input": "ABA\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02753", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn AtCoder City, there are three stations numbered 1, 2, and 3.\n\nEach of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is A, Company A operates Station i; if S_i is B, Company B operates Station i.\n\nTo improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.\n\nDetermine if there is a pair of stations that will be connected by a bus service.\n\nConstraints\n\nEach character of S is A or B.\n\n|S| = 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf there is a pair of stations that will be connected by a bus service, print Yes; otherwise, print No.\n\nSample Input 1\n\nABA\n\nSample Output 1\n\nYes\n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and 3, so print Yes.\n\nSample Input 2\n\nBBA\n\nSample Output 2\n\nYes\n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and 3, so print Yes.\n\nSample Input 3\n\nBBB\n\nSample Output 3\n\nNo\n\nCompany B operates all the stations. Thus, there will be no bus service, so print No.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 81, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s526509217", "group_id": "codeNet:p02753", "input_text": "s = input()\nif s == 'AAA' or s == 'BBB':\n ans = 'No'\nelse:\n ans = 'Yes'\nprint(ans)", "language": "Python", "metadata": {"date": 1584634891, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02753.html", "problem_id": "p02753", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02753/input.txt", "sample_output_relpath": "derived/input_output/data/p02753/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02753/Python/s526509217.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s526509217", "user_id": "u157020659"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "s = input()\nif s == 'AAA' or s == 'BBB':\n ans = 'No'\nelse:\n ans = 'Yes'\nprint(ans)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn AtCoder City, there are three stations numbered 1, 2, and 3.\n\nEach of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is A, Company A operates Station i; if S_i is B, Company B operates Station i.\n\nTo improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.\n\nDetermine if there is a pair of stations that will be connected by a bus service.\n\nConstraints\n\nEach character of S is A or B.\n\n|S| = 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf there is a pair of stations that will be connected by a bus service, print Yes; otherwise, print No.\n\nSample Input 1\n\nABA\n\nSample Output 1\n\nYes\n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and 3, so print Yes.\n\nSample Input 2\n\nBBA\n\nSample Output 2\n\nYes\n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and 3, so print Yes.\n\nSample Input 3\n\nBBB\n\nSample Output 3\n\nNo\n\nCompany B operates all the stations. Thus, there will be no bus service, so print No.", "sample_input": "ABA\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02753", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn AtCoder City, there are three stations numbered 1, 2, and 3.\n\nEach of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is A, Company A operates Station i; if S_i is B, Company B operates Station i.\n\nTo improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.\n\nDetermine if there is a pair of stations that will be connected by a bus service.\n\nConstraints\n\nEach character of S is A or B.\n\n|S| = 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf there is a pair of stations that will be connected by a bus service, print Yes; otherwise, print No.\n\nSample Input 1\n\nABA\n\nSample Output 1\n\nYes\n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and 3, so print Yes.\n\nSample Input 2\n\nBBA\n\nSample Output 2\n\nYes\n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and 3, so print Yes.\n\nSample Input 3\n\nBBB\n\nSample Output 3\n\nNo\n\nCompany B operates all the stations. Thus, there will be no bus service, so print No.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 88, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s533713585", "group_id": "codeNet:p02753", "input_text": "s = input()\nif s[0] != s[1] or s[1] != s[2]:\n print(\"Yes\")\nelse:\n print(\"No\")", "language": "Python", "metadata": {"date": 1583632925, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02753.html", "problem_id": "p02753", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02753/input.txt", "sample_output_relpath": "derived/input_output/data/p02753/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02753/Python/s533713585.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s533713585", "user_id": "u952669998"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "s = input()\nif s[0] != s[1] or s[1] != s[2]:\n print(\"Yes\")\nelse:\n print(\"No\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn AtCoder City, there are three stations numbered 1, 2, and 3.\n\nEach of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is A, Company A operates Station i; if S_i is B, Company B operates Station i.\n\nTo improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.\n\nDetermine if there is a pair of stations that will be connected by a bus service.\n\nConstraints\n\nEach character of S is A or B.\n\n|S| = 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf there is a pair of stations that will be connected by a bus service, print Yes; otherwise, print No.\n\nSample Input 1\n\nABA\n\nSample Output 1\n\nYes\n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and 3, so print Yes.\n\nSample Input 2\n\nBBA\n\nSample Output 2\n\nYes\n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and 3, so print Yes.\n\nSample Input 3\n\nBBB\n\nSample Output 3\n\nNo\n\nCompany B operates all the stations. Thus, there will be no bus service, so print No.", "sample_input": "ABA\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02753", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn AtCoder City, there are three stations numbered 1, 2, and 3.\n\nEach of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is A, Company A operates Station i; if S_i is B, Company B operates Station i.\n\nTo improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.\n\nDetermine if there is a pair of stations that will be connected by a bus service.\n\nConstraints\n\nEach character of S is A or B.\n\n|S| = 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf there is a pair of stations that will be connected by a bus service, print Yes; otherwise, print No.\n\nSample Input 1\n\nABA\n\nSample Output 1\n\nYes\n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and 3, so print Yes.\n\nSample Input 2\n\nBBA\n\nSample Output 2\n\nYes\n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and 3, so print Yes.\n\nSample Input 3\n\nBBB\n\nSample Output 3\n\nNo\n\nCompany B operates all the stations. Thus, there will be no bus service, so print No.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 83, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s766912960", "group_id": "codeNet:p02754", "input_text": "n,a,b = map(int, input().split())\nans = n //(a+b) * a\nif n % (a+b) <= a: ans += n%(a+b)\nprint(ans)", "language": "Python", "metadata": {"date": 1589110732, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02754.html", "problem_id": "p02754", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02754/input.txt", "sample_output_relpath": "derived/input_output/data/p02754/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02754/Python/s766912960.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s766912960", "user_id": "u241159583"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "n,a,b = map(int, input().split())\nans = n //(a+b) * a\nif n % (a+b) <= a: ans += n%(a+b)\nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has many red balls and blue balls. Now, he will place them in a row.\n\nInitially, there is no ball placed.\n\nTakahashi, who is very patient, will do the following operation 10^{100} times:\n\nPlace A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.\n\nHow many blue balls will be there among the first N balls in the row of balls made this way?\n\nConstraints\n\n1 \\leq N \\leq 10^{18}\n\nA, B \\geq 0\n\n0 < A + B \\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 A B\n\nOutput\n\nPrint the number of blue balls that will be there among the first N balls in the row of balls.\n\nSample Input 1\n\n8 3 4\n\nSample Output 1\n\n4\n\nLet b denote a blue ball, and r denote a red ball. The first eight balls in the row will be bbbrrrrb, among which there are four blue balls.\n\nSample Input 2\n\n8 0 4\n\nSample Output 2\n\n0\n\nHe placed only red balls from the beginning.\n\nSample Input 3\n\n6 2 4\n\nSample Output 3\n\n2\n\nAmong bbrrrr, there are two blue balls.", "sample_input": "8 3 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02754", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has many red balls and blue balls. Now, he will place them in a row.\n\nInitially, there is no ball placed.\n\nTakahashi, who is very patient, will do the following operation 10^{100} times:\n\nPlace A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.\n\nHow many blue balls will be there among the first N balls in the row of balls made this way?\n\nConstraints\n\n1 \\leq N \\leq 10^{18}\n\nA, B \\geq 0\n\n0 < A + B \\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 A B\n\nOutput\n\nPrint the number of blue balls that will be there among the first N balls in the row of balls.\n\nSample Input 1\n\n8 3 4\n\nSample Output 1\n\n4\n\nLet b denote a blue ball, and r denote a red ball. The first eight balls in the row will be bbbrrrrb, among which there are four blue balls.\n\nSample Input 2\n\n8 0 4\n\nSample Output 2\n\n0\n\nHe placed only red balls from the beginning.\n\nSample Input 3\n\n6 2 4\n\nSample Output 3\n\n2\n\nAmong bbrrrr, there are two blue balls.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 98, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s346392471", "group_id": "codeNet:p02754", "input_text": "# coding: utf-8\n# Your code here!\nN, A, B = map(int, input().split())\ni=0\nc=A+B\nd=0\nList=[]\nwhile i= 1:\n ans += m[r]\n m[r] += 1\n\nprint(ans) \n", "language": "Python", "metadata": {"date": 1583695196, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02757.html", "problem_id": "p02757", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02757/input.txt", "sample_output_relpath": "derived/input_output/data/p02757/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02757/Python/s903804503.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s903804503", "user_id": "u861141787"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "n, p = map(int, input().split())\nS = input()\n\nm = [0 for i in range(p)]\n\nans = 0\nm[0] = 1\n\nif p == 2 or p == 5:\n for i in range(n):\n if int(S[i]) % p == 0:\n ans += i+1\n\nelse:\n cnt = 10 % p\n for i in range(n):\n s = int(S[n-1-i])\n if i == 0:\n r = s%p\n else:\n r = (cnt*s+r) % p\n cnt = cnt * 10 % p\n if m[r] >= 1:\n ans += m[r]\n m[r] += 1\n\nprint(ans) \n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nTakahashi has a string S of length N consisting of digits from 0 through 9.\n\nHe loves the prime number P. He wants to know how many non-empty (contiguous) substrings of S - there are N \\times (N + 1) / 2 of them - are divisible by P when regarded as integers written in base ten.\n\nHere substrings starting with a 0 also count, and substrings originated from different positions in S are distinguished, even if they are equal as strings or integers.\n\nCompute this count to help Takahashi.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS consists of digits.\n\n|S| = N\n\n2 \\leq P \\leq 10000\n\nP is a prime number.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN P\nS\n\nOutput\n\nPrint the number of non-empty (contiguous) substrings of S that are divisible by P when regarded as an integer written in base ten.\n\nSample Input 1\n\n4 3\n3543\n\nSample Output 1\n\n6\n\nHere S = 3543. There are ten non-empty (contiguous) substrings of S:\n\n3: divisible by 3.\n\n35: not divisible by 3.\n\n354: divisible by 3.\n\n3543: divisible by 3.\n\n5: not divisible by 3.\n\n54: divisible by 3.\n\n543: divisible by 3.\n\n4: not divisible by 3.\n\n43: not divisible by 3.\n\n3: divisible by 3.\n\nSix of these are divisible by 3, so print 6.\n\nSample Input 2\n\n4 2\n2020\n\nSample Output 2\n\n10\n\nHere S = 2020. There are ten non-empty (contiguous) substrings of S, all of which are divisible by 2, so print 10.\n\nNote that substrings beginning with a 0 also count.\n\nSample Input 3\n\n20 11\n33883322005544116655\n\nSample Output 3\n\n68", "sample_input": "4 3\n3543\n"}, "reference_outputs": ["6\n"], "source_document_id": "p02757", "source_text": "Score : 500 points\n\nProblem Statement\n\nTakahashi has a string S of length N consisting of digits from 0 through 9.\n\nHe loves the prime number P. He wants to know how many non-empty (contiguous) substrings of S - there are N \\times (N + 1) / 2 of them - are divisible by P when regarded as integers written in base ten.\n\nHere substrings starting with a 0 also count, and substrings originated from different positions in S are distinguished, even if they are equal as strings or integers.\n\nCompute this count to help Takahashi.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS consists of digits.\n\n|S| = N\n\n2 \\leq P \\leq 10000\n\nP is a prime number.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN P\nS\n\nOutput\n\nPrint the number of non-empty (contiguous) substrings of S that are divisible by P when regarded as an integer written in base ten.\n\nSample Input 1\n\n4 3\n3543\n\nSample Output 1\n\n6\n\nHere S = 3543. There are ten non-empty (contiguous) substrings of S:\n\n3: divisible by 3.\n\n35: not divisible by 3.\n\n354: divisible by 3.\n\n3543: divisible by 3.\n\n5: not divisible by 3.\n\n54: divisible by 3.\n\n543: divisible by 3.\n\n4: not divisible by 3.\n\n43: not divisible by 3.\n\n3: divisible by 3.\n\nSix of these are divisible by 3, so print 6.\n\nSample Input 2\n\n4 2\n2020\n\nSample Output 2\n\n10\n\nHere S = 2020. There are ten non-empty (contiguous) substrings of S, all of which are divisible by 2, so print 10.\n\nNote that substrings beginning with a 0 also count.\n\nSample Input 3\n\n20 11\n33883322005544116655\n\nSample Output 3\n\n68", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 453, "cpu_time_ms": 253, "memory_kb": 3500}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s504009264", "group_id": "codeNet:p02760", "input_text": "A=list(map(lambda x: (int(x), False), input().split()))\nA+=list(map(lambda x: (int(x), False), input().split()))\nA+=list(map(lambda x: (int(x), False), input().split()))\n\nN = int(input())\nfor _ in range(N):\n n = int(input())\n for a, b in A:\n if a == n:\n b = True\nif (A[0][1] and ((A[1][1] and A[2][1]) or \\\n (A[3][1] and A[6][1]) or \\\n (A[4][1] and A[8][1]))) or \\\n (A[1][1] and A[4][1] and A[7][1]) or \\\n (A[2][1] and A[5][1] and A[8][1]) or \\\n (A[3][1] and A[4][1] and A[5][1]) or \\\n (A[6][1] and A[7][1] and A[8][1]) or \\\n (A[2][1] and A[4][1] and A[6][1]):\n print(\"YES\")\nelse:\n print(\"No\")\n", "language": "Python", "metadata": {"date": 1600165416, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02760.html", "problem_id": "p02760", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02760/input.txt", "sample_output_relpath": "derived/input_output/data/p02760/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02760/Python/s504009264.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s504009264", "user_id": "u128196936"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "A=list(map(lambda x: (int(x), False), input().split()))\nA+=list(map(lambda x: (int(x), False), input().split()))\nA+=list(map(lambda x: (int(x), False), input().split()))\n\nN = int(input())\nfor _ in range(N):\n n = int(input())\n for a, b in A:\n if a == n:\n b = True\nif (A[0][1] and ((A[1][1] and A[2][1]) or \\\n (A[3][1] and A[6][1]) or \\\n (A[4][1] and A[8][1]))) or \\\n (A[1][1] and A[4][1] and A[7][1]) or \\\n (A[2][1] and A[5][1] and A[8][1]) or \\\n (A[3][1] and A[4][1] and A[5][1]) or \\\n (A[6][1] and A[7][1] and A[8][1]) or \\\n (A[2][1] and A[4][1] and A[6][1]):\n print(\"YES\")\nelse:\n print(\"No\")\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a bingo card with a 3\\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.\n\nThe MC will choose N numbers, b_1, b_2, \\cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet.\n\nDetermine whether we will have a bingo when the N numbers are chosen, that is, the sheet will contain three marked numbers in a row, column, or diagonal.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_{i, j} \\leq 100\n\nA_{i_1, j_1} \\neq A_{i_2, j_2} ((i_1, j_1) \\neq (i_2, j_2))\n\n1 \\leq N \\leq 10\n\n1 \\leq b_i \\leq 100\n\nb_i \\neq b_j (i \\neq j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_{1, 1} A_{1, 2} A_{1, 3}\nA_{2, 1} A_{2, 2} A_{2, 3}\nA_{3, 1} A_{3, 2} A_{3, 3}\nN\nb_1\n\\vdots\nb_N\n\nOutput\n\nIf we will have a bingo, print Yes; otherwise, print No.\n\nSample Input 1\n\n84 97 66\n79 89 11\n61 59 7\n7\n89\n7\n87\n79\n24\n84\n30\n\nSample Output 1\n\nYes\n\nWe will mark A_{1, 1}, A_{2, 1}, A_{2, 2}, A_{3, 3}, and complete the diagonal from the top-left to the bottom-right.\n\nSample Input 2\n\n41 7 46\n26 89 2\n78 92 8\n5\n6\n45\n16\n57\n17\n\nSample Output 2\n\nNo\n\nWe will mark nothing.\n\nSample Input 3\n\n60 88 34\n92 41 43\n65 73 48\n10\n60\n43\n88\n11\n48\n73\n65\n41\n92\n34\n\nSample Output 3\n\nYes\n\nWe will mark all the squares.", "sample_input": "84 97 66\n79 89 11\n61 59 7\n7\n89\n7\n87\n79\n24\n84\n30\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02760", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a bingo card with a 3\\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.\n\nThe MC will choose N numbers, b_1, b_2, \\cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet.\n\nDetermine whether we will have a bingo when the N numbers are chosen, that is, the sheet will contain three marked numbers in a row, column, or diagonal.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_{i, j} \\leq 100\n\nA_{i_1, j_1} \\neq A_{i_2, j_2} ((i_1, j_1) \\neq (i_2, j_2))\n\n1 \\leq N \\leq 10\n\n1 \\leq b_i \\leq 100\n\nb_i \\neq b_j (i \\neq j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_{1, 1} A_{1, 2} A_{1, 3}\nA_{2, 1} A_{2, 2} A_{2, 3}\nA_{3, 1} A_{3, 2} A_{3, 3}\nN\nb_1\n\\vdots\nb_N\n\nOutput\n\nIf we will have a bingo, print Yes; otherwise, print No.\n\nSample Input 1\n\n84 97 66\n79 89 11\n61 59 7\n7\n89\n7\n87\n79\n24\n84\n30\n\nSample Output 1\n\nYes\n\nWe will mark A_{1, 1}, A_{2, 1}, A_{2, 2}, A_{3, 3}, and complete the diagonal from the top-left to the bottom-right.\n\nSample Input 2\n\n41 7 46\n26 89 2\n78 92 8\n5\n6\n45\n16\n57\n17\n\nSample Output 2\n\nNo\n\nWe will mark nothing.\n\nSample Input 3\n\n60 88 34\n92 41 43\n65 73 48\n10\n60\n43\n88\n11\n48\n73\n65\n41\n92\n34\n\nSample Output 3\n\nYes\n\nWe will mark all the squares.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 699, "cpu_time_ms": 28, "memory_kb": 9280}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s706201621", "group_id": "codeNet:p02760", "input_text": "\n#a.append(list(map(int, input().split())))\n#b.append(list(map(int, input().split())))\n#c.append(list(map(int, input().split())))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\n\n\ncount = int(input())\n\nfor num in range(count):\n x = int(input())\n for y in range(3):\n if a[y] == x:\n a[y] = 0\n for y in range(3):\n if b[y] == x:\n b[y] = 0\n for y in range(3):\n if c[y] == x:\n c[y] = 0\n\n#ans = 0\n#ans = a[0] * a[1] * a[2]\n#ans += b[0] * b[1] * b[2]\n#ans += c[0] * c[1] * c[2]\n#ans += a[0] * b[0] * c[0]\n#ans += a[1] * b[1] * c[1]\n#ans += a[2] * b[2] * c[2]\n\n#if ans == 0:\n# print(\"Yes\")\nif a[0]+a[1]+a[2] == 0:\n print(\"Yes\")\nelif b[0]+b[1]+b[2] == 0:\n print(\"Yes\")\nelif c[0]+c[1]+c[2] == 0:\n print(\"Yes\")\nelif a[0] + b[0] + c[0] ==0:\n print(\"Yes\")\nelif a[1] + b[1] + c[1] ==0:\n print(\"Yes\")\nelif a[2] + b[2] + c[2] ==0:\n print(\"Yes\")\nelif a[0] + b[1] + c[2] == 0:\n print(\"Yes\")\nelif a[2] + b[1] + c[0] ==0:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "language": "Python", "metadata": {"date": 1583120028, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02760.html", "problem_id": "p02760", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02760/input.txt", "sample_output_relpath": "derived/input_output/data/p02760/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02760/Python/s706201621.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s706201621", "user_id": "u679970524"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "\n#a.append(list(map(int, input().split())))\n#b.append(list(map(int, input().split())))\n#c.append(list(map(int, input().split())))\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\n\n\ncount = int(input())\n\nfor num in range(count):\n x = int(input())\n for y in range(3):\n if a[y] == x:\n a[y] = 0\n for y in range(3):\n if b[y] == x:\n b[y] = 0\n for y in range(3):\n if c[y] == x:\n c[y] = 0\n\n#ans = 0\n#ans = a[0] * a[1] * a[2]\n#ans += b[0] * b[1] * b[2]\n#ans += c[0] * c[1] * c[2]\n#ans += a[0] * b[0] * c[0]\n#ans += a[1] * b[1] * c[1]\n#ans += a[2] * b[2] * c[2]\n\n#if ans == 0:\n# print(\"Yes\")\nif a[0]+a[1]+a[2] == 0:\n print(\"Yes\")\nelif b[0]+b[1]+b[2] == 0:\n print(\"Yes\")\nelif c[0]+c[1]+c[2] == 0:\n print(\"Yes\")\nelif a[0] + b[0] + c[0] ==0:\n print(\"Yes\")\nelif a[1] + b[1] + c[1] ==0:\n print(\"Yes\")\nelif a[2] + b[2] + c[2] ==0:\n print(\"Yes\")\nelif a[0] + b[1] + c[2] == 0:\n print(\"Yes\")\nelif a[2] + b[1] + c[0] ==0:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a bingo card with a 3\\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.\n\nThe MC will choose N numbers, b_1, b_2, \\cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet.\n\nDetermine whether we will have a bingo when the N numbers are chosen, that is, the sheet will contain three marked numbers in a row, column, or diagonal.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_{i, j} \\leq 100\n\nA_{i_1, j_1} \\neq A_{i_2, j_2} ((i_1, j_1) \\neq (i_2, j_2))\n\n1 \\leq N \\leq 10\n\n1 \\leq b_i \\leq 100\n\nb_i \\neq b_j (i \\neq j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_{1, 1} A_{1, 2} A_{1, 3}\nA_{2, 1} A_{2, 2} A_{2, 3}\nA_{3, 1} A_{3, 2} A_{3, 3}\nN\nb_1\n\\vdots\nb_N\n\nOutput\n\nIf we will have a bingo, print Yes; otherwise, print No.\n\nSample Input 1\n\n84 97 66\n79 89 11\n61 59 7\n7\n89\n7\n87\n79\n24\n84\n30\n\nSample Output 1\n\nYes\n\nWe will mark A_{1, 1}, A_{2, 1}, A_{2, 2}, A_{3, 3}, and complete the diagonal from the top-left to the bottom-right.\n\nSample Input 2\n\n41 7 46\n26 89 2\n78 92 8\n5\n6\n45\n16\n57\n17\n\nSample Output 2\n\nNo\n\nWe will mark nothing.\n\nSample Input 3\n\n60 88 34\n92 41 43\n65 73 48\n10\n60\n43\n88\n11\n48\n73\n65\n41\n92\n34\n\nSample Output 3\n\nYes\n\nWe will mark all the squares.", "sample_input": "84 97 66\n79 89 11\n61 59 7\n7\n89\n7\n87\n79\n24\n84\n30\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02760", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a bingo card with a 3\\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.\n\nThe MC will choose N numbers, b_1, b_2, \\cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet.\n\nDetermine whether we will have a bingo when the N numbers are chosen, that is, the sheet will contain three marked numbers in a row, column, or diagonal.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_{i, j} \\leq 100\n\nA_{i_1, j_1} \\neq A_{i_2, j_2} ((i_1, j_1) \\neq (i_2, j_2))\n\n1 \\leq N \\leq 10\n\n1 \\leq b_i \\leq 100\n\nb_i \\neq b_j (i \\neq j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_{1, 1} A_{1, 2} A_{1, 3}\nA_{2, 1} A_{2, 2} A_{2, 3}\nA_{3, 1} A_{3, 2} A_{3, 3}\nN\nb_1\n\\vdots\nb_N\n\nOutput\n\nIf we will have a bingo, print Yes; otherwise, print No.\n\nSample Input 1\n\n84 97 66\n79 89 11\n61 59 7\n7\n89\n7\n87\n79\n24\n84\n30\n\nSample Output 1\n\nYes\n\nWe will mark A_{1, 1}, A_{2, 1}, A_{2, 2}, A_{3, 3}, and complete the diagonal from the top-left to the bottom-right.\n\nSample Input 2\n\n41 7 46\n26 89 2\n78 92 8\n5\n6\n45\n16\n57\n17\n\nSample Output 2\n\nNo\n\nWe will mark nothing.\n\nSample Input 3\n\n60 88 34\n92 41 43\n65 73 48\n10\n60\n43\n88\n11\n48\n73\n65\n41\n92\n34\n\nSample Output 3\n\nYes\n\nWe will mark all the squares.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1090, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s059600976", "group_id": "codeNet:p02760", "input_text": "\n\nA_List_1 = list(map(int,input().split()))\nA_List_2 = list(map(int,input().split()))\nA_List_3 = list(map(int,input().split()))\n\n\n\nN = int(input())\n#B_List = []\nfor i in range(N):\n n = int(input())\n for j in range(3):\n if n == A_List_1[j]:\n A_List_1[j] = 0\n if n == A_List_2[j]:\n A_List_2[j] = 0\n if n == A_List_3[j]:\n A_List_3[j] = 0\n\n\nsum_1 = A_List_1[0] + A_List_1[1] + A_List_1[2]\nsum_2 = A_List_2[0] + A_List_2[1] + A_List_2[2]\nsum_3 = A_List_3[0] + A_List_3[1] + A_List_3[2]\nnaname_1 = A_List_1[0] + A_List_2[1] + A_List_3[2]\nnaname_2 = A_List_1[2] + A_List_2[1] + A_List_3[0]\ntate_0 = A_List_1[0] + A_List_2[0] + A_List_3[0]\ntate_1 = A_List_1[1] + A_List_2[1] + A_List_3[1]\ntate_2 = A_List_1[2] + A_List_2[2] + A_List_3[2]\n\nif sum_1 == 0 or sum_2 == 0 or sum_3 == 0 or naname_1 == 0 or naname_2 == 0 or tate_0 == 0 or tate_1 == 0 or tate_2 == 0:\n print('Yes')\nelse:\n print('No')", "language": "Python", "metadata": {"date": 1583115866, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02760.html", "problem_id": "p02760", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02760/input.txt", "sample_output_relpath": "derived/input_output/data/p02760/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02760/Python/s059600976.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s059600976", "user_id": "u791977205"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "\n\nA_List_1 = list(map(int,input().split()))\nA_List_2 = list(map(int,input().split()))\nA_List_3 = list(map(int,input().split()))\n\n\n\nN = int(input())\n#B_List = []\nfor i in range(N):\n n = int(input())\n for j in range(3):\n if n == A_List_1[j]:\n A_List_1[j] = 0\n if n == A_List_2[j]:\n A_List_2[j] = 0\n if n == A_List_3[j]:\n A_List_3[j] = 0\n\n\nsum_1 = A_List_1[0] + A_List_1[1] + A_List_1[2]\nsum_2 = A_List_2[0] + A_List_2[1] + A_List_2[2]\nsum_3 = A_List_3[0] + A_List_3[1] + A_List_3[2]\nnaname_1 = A_List_1[0] + A_List_2[1] + A_List_3[2]\nnaname_2 = A_List_1[2] + A_List_2[1] + A_List_3[0]\ntate_0 = A_List_1[0] + A_List_2[0] + A_List_3[0]\ntate_1 = A_List_1[1] + A_List_2[1] + A_List_3[1]\ntate_2 = A_List_1[2] + A_List_2[2] + A_List_3[2]\n\nif sum_1 == 0 or sum_2 == 0 or sum_3 == 0 or naname_1 == 0 or naname_2 == 0 or tate_0 == 0 or tate_1 == 0 or tate_2 == 0:\n print('Yes')\nelse:\n print('No')", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a bingo card with a 3\\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.\n\nThe MC will choose N numbers, b_1, b_2, \\cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet.\n\nDetermine whether we will have a bingo when the N numbers are chosen, that is, the sheet will contain three marked numbers in a row, column, or diagonal.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_{i, j} \\leq 100\n\nA_{i_1, j_1} \\neq A_{i_2, j_2} ((i_1, j_1) \\neq (i_2, j_2))\n\n1 \\leq N \\leq 10\n\n1 \\leq b_i \\leq 100\n\nb_i \\neq b_j (i \\neq j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_{1, 1} A_{1, 2} A_{1, 3}\nA_{2, 1} A_{2, 2} A_{2, 3}\nA_{3, 1} A_{3, 2} A_{3, 3}\nN\nb_1\n\\vdots\nb_N\n\nOutput\n\nIf we will have a bingo, print Yes; otherwise, print No.\n\nSample Input 1\n\n84 97 66\n79 89 11\n61 59 7\n7\n89\n7\n87\n79\n24\n84\n30\n\nSample Output 1\n\nYes\n\nWe will mark A_{1, 1}, A_{2, 1}, A_{2, 2}, A_{3, 3}, and complete the diagonal from the top-left to the bottom-right.\n\nSample Input 2\n\n41 7 46\n26 89 2\n78 92 8\n5\n6\n45\n16\n57\n17\n\nSample Output 2\n\nNo\n\nWe will mark nothing.\n\nSample Input 3\n\n60 88 34\n92 41 43\n65 73 48\n10\n60\n43\n88\n11\n48\n73\n65\n41\n92\n34\n\nSample Output 3\n\nYes\n\nWe will mark all the squares.", "sample_input": "84 97 66\n79 89 11\n61 59 7\n7\n89\n7\n87\n79\n24\n84\n30\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02760", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a bingo card with a 3\\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.\n\nThe MC will choose N numbers, b_1, b_2, \\cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet.\n\nDetermine whether we will have a bingo when the N numbers are chosen, that is, the sheet will contain three marked numbers in a row, column, or diagonal.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_{i, j} \\leq 100\n\nA_{i_1, j_1} \\neq A_{i_2, j_2} ((i_1, j_1) \\neq (i_2, j_2))\n\n1 \\leq N \\leq 10\n\n1 \\leq b_i \\leq 100\n\nb_i \\neq b_j (i \\neq j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_{1, 1} A_{1, 2} A_{1, 3}\nA_{2, 1} A_{2, 2} A_{2, 3}\nA_{3, 1} A_{3, 2} A_{3, 3}\nN\nb_1\n\\vdots\nb_N\n\nOutput\n\nIf we will have a bingo, print Yes; otherwise, print No.\n\nSample Input 1\n\n84 97 66\n79 89 11\n61 59 7\n7\n89\n7\n87\n79\n24\n84\n30\n\nSample Output 1\n\nYes\n\nWe will mark A_{1, 1}, A_{2, 1}, A_{2, 2}, A_{3, 3}, and complete the diagonal from the top-left to the bottom-right.\n\nSample Input 2\n\n41 7 46\n26 89 2\n78 92 8\n5\n6\n45\n16\n57\n17\n\nSample Output 2\n\nNo\n\nWe will mark nothing.\n\nSample Input 3\n\n60 88 34\n92 41 43\n65 73 48\n10\n60\n43\n88\n11\n48\n73\n65\n41\n92\n34\n\nSample Output 3\n\nYes\n\nWe will mark all the squares.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 951, "cpu_time_ms": 17, "memory_kb": 3188}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s617562644", "group_id": "codeNet:p02760", "input_text": "bingo=[list(map(int,input().split())) for _ in range(3)]\nN=int(input())\nB=[int(input()) for _ in range(N)]\nfor i in range(3):\n for b in B:\n if bingo[i][i]==b:\n bingo[i][i]=\"!\"\nfor j in range(3):\n if bingo[j][0]==bingo[j][1]==bingo[j][2]==\"!\":\n print(\"Yes\")\n exit()\n if bingo[0][j]==bingo[1][j]==bingo[2][j]==\"!\":\n print(\"Yes\")\n exit()\n if bingo[0][0]==bingo[1][1]==bingo[2][2]==\"!\":\n print(\"Yes\")\n exit()\n if bingo[0][2]==bingo[1][1]==bingo[2][0]==\"!\":\n print(\"Yes\")\n exit()\nprint(\"No\")", "language": "Python", "metadata": {"date": 1583115189, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02760.html", "problem_id": "p02760", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02760/input.txt", "sample_output_relpath": "derived/input_output/data/p02760/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02760/Python/s617562644.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s617562644", "user_id": "u668503853"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "bingo=[list(map(int,input().split())) for _ in range(3)]\nN=int(input())\nB=[int(input()) for _ in range(N)]\nfor i in range(3):\n for b in B:\n if bingo[i][i]==b:\n bingo[i][i]=\"!\"\nfor j in range(3):\n if bingo[j][0]==bingo[j][1]==bingo[j][2]==\"!\":\n print(\"Yes\")\n exit()\n if bingo[0][j]==bingo[1][j]==bingo[2][j]==\"!\":\n print(\"Yes\")\n exit()\n if bingo[0][0]==bingo[1][1]==bingo[2][2]==\"!\":\n print(\"Yes\")\n exit()\n if bingo[0][2]==bingo[1][1]==bingo[2][0]==\"!\":\n print(\"Yes\")\n exit()\nprint(\"No\")", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a bingo card with a 3\\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.\n\nThe MC will choose N numbers, b_1, b_2, \\cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet.\n\nDetermine whether we will have a bingo when the N numbers are chosen, that is, the sheet will contain three marked numbers in a row, column, or diagonal.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_{i, j} \\leq 100\n\nA_{i_1, j_1} \\neq A_{i_2, j_2} ((i_1, j_1) \\neq (i_2, j_2))\n\n1 \\leq N \\leq 10\n\n1 \\leq b_i \\leq 100\n\nb_i \\neq b_j (i \\neq j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_{1, 1} A_{1, 2} A_{1, 3}\nA_{2, 1} A_{2, 2} A_{2, 3}\nA_{3, 1} A_{3, 2} A_{3, 3}\nN\nb_1\n\\vdots\nb_N\n\nOutput\n\nIf we will have a bingo, print Yes; otherwise, print No.\n\nSample Input 1\n\n84 97 66\n79 89 11\n61 59 7\n7\n89\n7\n87\n79\n24\n84\n30\n\nSample Output 1\n\nYes\n\nWe will mark A_{1, 1}, A_{2, 1}, A_{2, 2}, A_{3, 3}, and complete the diagonal from the top-left to the bottom-right.\n\nSample Input 2\n\n41 7 46\n26 89 2\n78 92 8\n5\n6\n45\n16\n57\n17\n\nSample Output 2\n\nNo\n\nWe will mark nothing.\n\nSample Input 3\n\n60 88 34\n92 41 43\n65 73 48\n10\n60\n43\n88\n11\n48\n73\n65\n41\n92\n34\n\nSample Output 3\n\nYes\n\nWe will mark all the squares.", "sample_input": "84 97 66\n79 89 11\n61 59 7\n7\n89\n7\n87\n79\n24\n84\n30\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02760", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a bingo card with a 3\\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.\n\nThe MC will choose N numbers, b_1, b_2, \\cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet.\n\nDetermine whether we will have a bingo when the N numbers are chosen, that is, the sheet will contain three marked numbers in a row, column, or diagonal.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_{i, j} \\leq 100\n\nA_{i_1, j_1} \\neq A_{i_2, j_2} ((i_1, j_1) \\neq (i_2, j_2))\n\n1 \\leq N \\leq 10\n\n1 \\leq b_i \\leq 100\n\nb_i \\neq b_j (i \\neq j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_{1, 1} A_{1, 2} A_{1, 3}\nA_{2, 1} A_{2, 2} A_{2, 3}\nA_{3, 1} A_{3, 2} A_{3, 3}\nN\nb_1\n\\vdots\nb_N\n\nOutput\n\nIf we will have a bingo, print Yes; otherwise, print No.\n\nSample Input 1\n\n84 97 66\n79 89 11\n61 59 7\n7\n89\n7\n87\n79\n24\n84\n30\n\nSample Output 1\n\nYes\n\nWe will mark A_{1, 1}, A_{2, 1}, A_{2, 2}, A_{3, 3}, and complete the diagonal from the top-left to the bottom-right.\n\nSample Input 2\n\n41 7 46\n26 89 2\n78 92 8\n5\n6\n45\n16\n57\n17\n\nSample Output 2\n\nNo\n\nWe will mark nothing.\n\nSample Input 3\n\n60 88 34\n92 41 43\n65 73 48\n10\n60\n43\n88\n11\n48\n73\n65\n41\n92\n34\n\nSample Output 3\n\nYes\n\nWe will mark all the squares.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 523, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s274540827", "group_id": "codeNet:p02762", "input_text": "from collections import deque\n\nn,m,k = map(int,input().split())\nans = [[0]*n for i in range(n)]\n\nfre = [[] for i in range(n)]\nblo = [[] for i in range(n)]\nfor i in range(m):\n a,b = map(int,input().split())\n fre[a-1].append(b-1)\n fre[b-1].append(a-1)\nfor i in range(k):\n a,b = map(int,input().split())\n blo[a-1].append(b-1)\n blo[b-1].append(a-1)\n\ngroup = [-1]*n\ndef check():\n \n count = 1\n for i in range(n):\n if group[i] == -1:\n dfs(i,count)\n count += 1\n return group\n\ndef dfs(i,count):\n q = deque([])\n q.append(i)\n while q:\n bef = q.pop()\n\n for nex in fre[bef]:\n if group[nex] == -1:\n group[nex] = count\n q.append(nex)\n \ncheck()\nfor i in range(n):\n if group[i] == -1:\n print(0,end=\" \")\n else:\n num = group.count(group[i])\n num -= len(fre[i])\n for j in blo[i]:\n if group[j] == group[i]:\n num -= 1\n print(num-1,end=\" \")\n\n\n\n\n", "language": "Python", "metadata": {"date": 1583203310, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02762.html", "problem_id": "p02762", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02762/input.txt", "sample_output_relpath": "derived/input_output/data/p02762/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02762/Python/s274540827.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s274540827", "user_id": "u368796742"}, "prompt_components": {"gold_output": "0 1 0 1\n", "input_to_evaluate": "from collections import deque\n\nn,m,k = map(int,input().split())\nans = [[0]*n for i in range(n)]\n\nfre = [[] for i in range(n)]\nblo = [[] for i in range(n)]\nfor i in range(m):\n a,b = map(int,input().split())\n fre[a-1].append(b-1)\n fre[b-1].append(a-1)\nfor i in range(k):\n a,b = map(int,input().split())\n blo[a-1].append(b-1)\n blo[b-1].append(a-1)\n\ngroup = [-1]*n\ndef check():\n \n count = 1\n for i in range(n):\n if group[i] == -1:\n dfs(i,count)\n count += 1\n return group\n\ndef dfs(i,count):\n q = deque([])\n q.append(i)\n while q:\n bef = q.pop()\n\n for nex in fre[bef]:\n if group[nex] == -1:\n group[nex] = count\n q.append(nex)\n \ncheck()\nfor i in range(n):\n if group[i] == -1:\n print(0,end=\" \")\n else:\n num = group.count(group[i])\n num -= len(fre[i])\n for j in blo[i]:\n if group[j] == group[i]:\n num -= 1\n print(num-1,end=\" \")\n\n\n\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nAn SNS has N users - User 1, User 2, \\cdots, User N.\n\nBetween these N users, there are some relationships - M friendships and K blockships.\n\nFor each i = 1, 2, \\cdots, M, there is a bidirectional friendship between User A_i and User B_i.\n\nFor each i = 1, 2, \\cdots, K, there is a bidirectional blockship between User C_i and User D_i.\n\nWe define User a to be a friend candidate for User b when all of the following four conditions are satisfied:\n\na \\neq b.\n\nThere is not a friendship between User a and User b.\n\nThere is not a blockship between User a and User b.\n\nThere exists a sequence c_0, c_1, c_2, \\cdots, c_L consisting of integers between 1 and N (inclusive) such that c_0 = a, c_L = b, and there is a friendship between User c_i and c_{i+1} for each i = 0, 1, \\cdots, L - 1.\n\nFor each user i = 1, 2, ... N, how many friend candidates does it have?\n\nConstraints\n\nAll values in input are integers.\n\n2 ≤ N ≤ 10^5\n\n0 \\leq M \\leq 10^5\n\n0 \\leq K \\leq 10^5\n\n1 \\leq A_i, B_i \\leq N\n\nA_i \\neq B_i\n\n1 \\leq C_i, D_i \\leq N\n\nC_i \\neq D_i\n\n(A_i, B_i) \\neq (A_j, B_j) (i \\neq j)\n\n(A_i, B_i) \\neq (B_j, A_j)\n\n(C_i, D_i) \\neq (C_j, D_j) (i \\neq j)\n\n(C_i, D_i) \\neq (D_j, C_j)\n\n(A_i, B_i) \\neq (C_j, D_j)\n\n(A_i, B_i) \\neq (D_j, C_j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\nA_1 B_1\n\\vdots\nA_M B_M\nC_1 D_1\n\\vdots\nC_K D_K\n\nOutput\n\nPrint the answers in order, with space in between.\n\nSample Input 1\n\n4 4 1\n2 1\n1 3\n3 2\n3 4\n4 1\n\nSample Output 1\n\n0 1 0 1\n\nThere is a friendship between User 2 and 3, and between 3 and 4. Also, there is no friendship or blockship between User 2 and 4. Thus, User 4 is a friend candidate for User 2.\n\nHowever, neither User 1 or 3 is a friend candidate for User 2, so User 2 has one friend candidate.\n\nSample Input 2\n\n5 10 0\n1 2\n1 3\n1 4\n1 5\n3 2\n2 4\n2 5\n4 3\n5 3\n4 5\n\nSample Output 2\n\n0 0 0 0 0\n\nEveryone is a friend of everyone else and has no friend candidate.\n\nSample Input 3\n\n10 9 3\n10 1\n6 7\n8 2\n2 5\n8 4\n7 3\n10 9\n6 4\n5 8\n2 6\n7 5\n3 1\n\nSample Output 3\n\n1 3 5 4 3 3 3 3 1 0", "sample_input": "4 4 1\n2 1\n1 3\n3 2\n3 4\n4 1\n"}, "reference_outputs": ["0 1 0 1\n"], "source_document_id": "p02762", "source_text": "Score : 400 points\n\nProblem Statement\n\nAn SNS has N users - User 1, User 2, \\cdots, User N.\n\nBetween these N users, there are some relationships - M friendships and K blockships.\n\nFor each i = 1, 2, \\cdots, M, there is a bidirectional friendship between User A_i and User B_i.\n\nFor each i = 1, 2, \\cdots, K, there is a bidirectional blockship between User C_i and User D_i.\n\nWe define User a to be a friend candidate for User b when all of the following four conditions are satisfied:\n\na \\neq b.\n\nThere is not a friendship between User a and User b.\n\nThere is not a blockship between User a and User b.\n\nThere exists a sequence c_0, c_1, c_2, \\cdots, c_L consisting of integers between 1 and N (inclusive) such that c_0 = a, c_L = b, and there is a friendship between User c_i and c_{i+1} for each i = 0, 1, \\cdots, L - 1.\n\nFor each user i = 1, 2, ... N, how many friend candidates does it have?\n\nConstraints\n\nAll values in input are integers.\n\n2 ≤ N ≤ 10^5\n\n0 \\leq M \\leq 10^5\n\n0 \\leq K \\leq 10^5\n\n1 \\leq A_i, B_i \\leq N\n\nA_i \\neq B_i\n\n1 \\leq C_i, D_i \\leq N\n\nC_i \\neq D_i\n\n(A_i, B_i) \\neq (A_j, B_j) (i \\neq j)\n\n(A_i, B_i) \\neq (B_j, A_j)\n\n(C_i, D_i) \\neq (C_j, D_j) (i \\neq j)\n\n(C_i, D_i) \\neq (D_j, C_j)\n\n(A_i, B_i) \\neq (C_j, D_j)\n\n(A_i, B_i) \\neq (D_j, C_j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\nA_1 B_1\n\\vdots\nA_M B_M\nC_1 D_1\n\\vdots\nC_K D_K\n\nOutput\n\nPrint the answers in order, with space in between.\n\nSample Input 1\n\n4 4 1\n2 1\n1 3\n3 2\n3 4\n4 1\n\nSample Output 1\n\n0 1 0 1\n\nThere is a friendship between User 2 and 3, and between 3 and 4. Also, there is no friendship or blockship between User 2 and 4. Thus, User 4 is a friend candidate for User 2.\n\nHowever, neither User 1 or 3 is a friend candidate for User 2, so User 2 has one friend candidate.\n\nSample Input 2\n\n5 10 0\n1 2\n1 3\n1 4\n1 5\n3 2\n2 4\n2 5\n4 3\n5 3\n4 5\n\nSample Output 2\n\n0 0 0 0 0\n\nEveryone is a friend of everyone else and has no friend candidate.\n\nSample Input 3\n\n10 9 3\n10 1\n6 7\n8 2\n2 5\n8 4\n7 3\n10 9\n6 4\n5 8\n2 6\n7 5\n3 1\n\nSample Output 3\n\n1 3 5 4 3 3 3 3 1 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1015, "cpu_time_ms": 2249, "memory_kb": 2086508}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s154889252", "group_id": "codeNet:p02762", "input_text": "class UnionFind(object):\n \"https://www.kumilog.net/entry/union-find\"\n def __init__(self, n=1):\n self.par = [i for i in range(n)]\n self.rank = [0 for _ in range(n)]\n self.size = [1 for _ in range(n)]\n\n def find(self, x):\n \"\"\"\n x が属するグループを探索\n \"\"\"\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n def union(self, x, y):\n \"\"\"\n x と y のグループを結合\n \"\"\"\n x = self.find(x)\n y = self.find(y)\n if x != y:\n if self.rank[x] < self.rank[y]:\n x, y = y, x\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n self.par[y] = x\n self.size[x] += self.size[y]\n\n def is_same(self, x, y):\n \"\"\"\n x と y が同じグループか否か\n \"\"\"\n return self.find(x) == self.find(y)\n\n def get_size(self, x):\n \"\"\"\n x が属するグループの要素数\n \"\"\"\n x = self.find(x)\n return self.size[x]\n\nN, M, K = map(int, input().split(\" \"))\n\n\nuf = UnionFind(N)\nfr = {}\nfor _ in range(M):\n a, b = map(int, input().split(\" \"))\n a -= 1\n b -= 1\n uf.union(a, b)\n if fr.get(a) is not None:\n fr[a].append(b)\n else:\n fr[a] = [b]\n\n if fr.get(b) is not None:\n fr[b].append(a)\n else:\n fr[b] = [a]\n\nbl = {}\nfor _ in range(K):\n c, d = map(int, input().split(\" \"))\n c -= 1\n d -= 1\n if bl.get(c) is not None:\n bl[c].append(d)\n else:\n bl[c] = [d]\n\n if bl.get(d) is not None:\n bl[d].append(c)\n else:\n bl[d] = [c]\n\n\nfor i in range(N):\n s = uf.get_size(i) - 1\n\n for b in bl.get(i, []):\n if uf.is_same(i, b):\n s -= 1\n\n s -= len(fr.get(i, []))\n print(s)", "language": "Python", "metadata": {"date": 1583119641, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02762.html", "problem_id": "p02762", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02762/input.txt", "sample_output_relpath": "derived/input_output/data/p02762/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02762/Python/s154889252.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s154889252", "user_id": "u660106942"}, "prompt_components": {"gold_output": "0 1 0 1\n", "input_to_evaluate": "class UnionFind(object):\n \"https://www.kumilog.net/entry/union-find\"\n def __init__(self, n=1):\n self.par = [i for i in range(n)]\n self.rank = [0 for _ in range(n)]\n self.size = [1 for _ in range(n)]\n\n def find(self, x):\n \"\"\"\n x が属するグループを探索\n \"\"\"\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n def union(self, x, y):\n \"\"\"\n x と y のグループを結合\n \"\"\"\n x = self.find(x)\n y = self.find(y)\n if x != y:\n if self.rank[x] < self.rank[y]:\n x, y = y, x\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n self.par[y] = x\n self.size[x] += self.size[y]\n\n def is_same(self, x, y):\n \"\"\"\n x と y が同じグループか否か\n \"\"\"\n return self.find(x) == self.find(y)\n\n def get_size(self, x):\n \"\"\"\n x が属するグループの要素数\n \"\"\"\n x = self.find(x)\n return self.size[x]\n\nN, M, K = map(int, input().split(\" \"))\n\n\nuf = UnionFind(N)\nfr = {}\nfor _ in range(M):\n a, b = map(int, input().split(\" \"))\n a -= 1\n b -= 1\n uf.union(a, b)\n if fr.get(a) is not None:\n fr[a].append(b)\n else:\n fr[a] = [b]\n\n if fr.get(b) is not None:\n fr[b].append(a)\n else:\n fr[b] = [a]\n\nbl = {}\nfor _ in range(K):\n c, d = map(int, input().split(\" \"))\n c -= 1\n d -= 1\n if bl.get(c) is not None:\n bl[c].append(d)\n else:\n bl[c] = [d]\n\n if bl.get(d) is not None:\n bl[d].append(c)\n else:\n bl[d] = [c]\n\n\nfor i in range(N):\n s = uf.get_size(i) - 1\n\n for b in bl.get(i, []):\n if uf.is_same(i, b):\n s -= 1\n\n s -= len(fr.get(i, []))\n print(s)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nAn SNS has N users - User 1, User 2, \\cdots, User N.\n\nBetween these N users, there are some relationships - M friendships and K blockships.\n\nFor each i = 1, 2, \\cdots, M, there is a bidirectional friendship between User A_i and User B_i.\n\nFor each i = 1, 2, \\cdots, K, there is a bidirectional blockship between User C_i and User D_i.\n\nWe define User a to be a friend candidate for User b when all of the following four conditions are satisfied:\n\na \\neq b.\n\nThere is not a friendship between User a and User b.\n\nThere is not a blockship between User a and User b.\n\nThere exists a sequence c_0, c_1, c_2, \\cdots, c_L consisting of integers between 1 and N (inclusive) such that c_0 = a, c_L = b, and there is a friendship between User c_i and c_{i+1} for each i = 0, 1, \\cdots, L - 1.\n\nFor each user i = 1, 2, ... N, how many friend candidates does it have?\n\nConstraints\n\nAll values in input are integers.\n\n2 ≤ N ≤ 10^5\n\n0 \\leq M \\leq 10^5\n\n0 \\leq K \\leq 10^5\n\n1 \\leq A_i, B_i \\leq N\n\nA_i \\neq B_i\n\n1 \\leq C_i, D_i \\leq N\n\nC_i \\neq D_i\n\n(A_i, B_i) \\neq (A_j, B_j) (i \\neq j)\n\n(A_i, B_i) \\neq (B_j, A_j)\n\n(C_i, D_i) \\neq (C_j, D_j) (i \\neq j)\n\n(C_i, D_i) \\neq (D_j, C_j)\n\n(A_i, B_i) \\neq (C_j, D_j)\n\n(A_i, B_i) \\neq (D_j, C_j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\nA_1 B_1\n\\vdots\nA_M B_M\nC_1 D_1\n\\vdots\nC_K D_K\n\nOutput\n\nPrint the answers in order, with space in between.\n\nSample Input 1\n\n4 4 1\n2 1\n1 3\n3 2\n3 4\n4 1\n\nSample Output 1\n\n0 1 0 1\n\nThere is a friendship between User 2 and 3, and between 3 and 4. Also, there is no friendship or blockship between User 2 and 4. Thus, User 4 is a friend candidate for User 2.\n\nHowever, neither User 1 or 3 is a friend candidate for User 2, so User 2 has one friend candidate.\n\nSample Input 2\n\n5 10 0\n1 2\n1 3\n1 4\n1 5\n3 2\n2 4\n2 5\n4 3\n5 3\n4 5\n\nSample Output 2\n\n0 0 0 0 0\n\nEveryone is a friend of everyone else and has no friend candidate.\n\nSample Input 3\n\n10 9 3\n10 1\n6 7\n8 2\n2 5\n8 4\n7 3\n10 9\n6 4\n5 8\n2 6\n7 5\n3 1\n\nSample Output 3\n\n1 3 5 4 3 3 3 3 1 0", "sample_input": "4 4 1\n2 1\n1 3\n3 2\n3 4\n4 1\n"}, "reference_outputs": ["0 1 0 1\n"], "source_document_id": "p02762", "source_text": "Score : 400 points\n\nProblem Statement\n\nAn SNS has N users - User 1, User 2, \\cdots, User N.\n\nBetween these N users, there are some relationships - M friendships and K blockships.\n\nFor each i = 1, 2, \\cdots, M, there is a bidirectional friendship between User A_i and User B_i.\n\nFor each i = 1, 2, \\cdots, K, there is a bidirectional blockship between User C_i and User D_i.\n\nWe define User a to be a friend candidate for User b when all of the following four conditions are satisfied:\n\na \\neq b.\n\nThere is not a friendship between User a and User b.\n\nThere is not a blockship between User a and User b.\n\nThere exists a sequence c_0, c_1, c_2, \\cdots, c_L consisting of integers between 1 and N (inclusive) such that c_0 = a, c_L = b, and there is a friendship between User c_i and c_{i+1} for each i = 0, 1, \\cdots, L - 1.\n\nFor each user i = 1, 2, ... N, how many friend candidates does it have?\n\nConstraints\n\nAll values in input are integers.\n\n2 ≤ N ≤ 10^5\n\n0 \\leq M \\leq 10^5\n\n0 \\leq K \\leq 10^5\n\n1 \\leq A_i, B_i \\leq N\n\nA_i \\neq B_i\n\n1 \\leq C_i, D_i \\leq N\n\nC_i \\neq D_i\n\n(A_i, B_i) \\neq (A_j, B_j) (i \\neq j)\n\n(A_i, B_i) \\neq (B_j, A_j)\n\n(C_i, D_i) \\neq (C_j, D_j) (i \\neq j)\n\n(C_i, D_i) \\neq (D_j, C_j)\n\n(A_i, B_i) \\neq (C_j, D_j)\n\n(A_i, B_i) \\neq (D_j, C_j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\nA_1 B_1\n\\vdots\nA_M B_M\nC_1 D_1\n\\vdots\nC_K D_K\n\nOutput\n\nPrint the answers in order, with space in between.\n\nSample Input 1\n\n4 4 1\n2 1\n1 3\n3 2\n3 4\n4 1\n\nSample Output 1\n\n0 1 0 1\n\nThere is a friendship between User 2 and 3, and between 3 and 4. Also, there is no friendship or blockship between User 2 and 4. Thus, User 4 is a friend candidate for User 2.\n\nHowever, neither User 1 or 3 is a friend candidate for User 2, so User 2 has one friend candidate.\n\nSample Input 2\n\n5 10 0\n1 2\n1 3\n1 4\n1 5\n3 2\n2 4\n2 5\n4 3\n5 3\n4 5\n\nSample Output 2\n\n0 0 0 0 0\n\nEveryone is a friend of everyone else and has no friend candidate.\n\nSample Input 3\n\n10 9 3\n10 1\n6 7\n8 2\n2 5\n8 4\n7 3\n10 9\n6 4\n5 8\n2 6\n7 5\n3 1\n\nSample Output 3\n\n1 3 5 4 3 3 3 3 1 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1903, "cpu_time_ms": 2110, "memory_kb": 126364}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s743241040", "group_id": "codeNet:p02762", "input_text": "import sys\nfrom itertools import accumulate\nn, m, k = [int(i) for i in sys.stdin.readline().split()]\n\npar = list(range(n))\nns = [1 for i in range(n)]\n\ndef find(x):\n ls = []\n while x != par[x]:\n ls.append(x)\n x = par[x]\n for l in ls:\n par[l] = x\n return x\n\ndef unite(x, y):\n x = find(x)\n y = find(y)\n if x != y:\n par[x] = y\n ns[y] += ns[x]\n\ndef is_same(x, y):\n if find(x) == find(y):\n return True\n else:\n return False\n\nls = [0 for i in range(n)]\nfriends = [0 for i in range(n-1)]\n\nfor i in range(m):\n a, b = [int(i) for i in sys.stdin.readline().split()]\n a -= 1\n b -= 1\n ls[a] -= 1\n ls[b] -= 1\n unite(a, b)\n\nfor i in range(n):\n root = find(i)\n ls[i] += ns[root]\n\n\nfor i in range(k):\n c, d = [int(i) for i in sys.stdin.readline().split()]\n c -= 1\n d -= 1\n if is_same(c, d):\n ls[c] -= 1\n ls[d] -= 1\n\nprint(\" \".join([str(i - 1) for i in ls]))", "language": "Python", "metadata": {"date": 1583117889, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02762.html", "problem_id": "p02762", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02762/input.txt", "sample_output_relpath": "derived/input_output/data/p02762/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02762/Python/s743241040.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s743241040", "user_id": "u190406011"}, "prompt_components": {"gold_output": "0 1 0 1\n", "input_to_evaluate": "import sys\nfrom itertools import accumulate\nn, m, k = [int(i) for i in sys.stdin.readline().split()]\n\npar = list(range(n))\nns = [1 for i in range(n)]\n\ndef find(x):\n ls = []\n while x != par[x]:\n ls.append(x)\n x = par[x]\n for l in ls:\n par[l] = x\n return x\n\ndef unite(x, y):\n x = find(x)\n y = find(y)\n if x != y:\n par[x] = y\n ns[y] += ns[x]\n\ndef is_same(x, y):\n if find(x) == find(y):\n return True\n else:\n return False\n\nls = [0 for i in range(n)]\nfriends = [0 for i in range(n-1)]\n\nfor i in range(m):\n a, b = [int(i) for i in sys.stdin.readline().split()]\n a -= 1\n b -= 1\n ls[a] -= 1\n ls[b] -= 1\n unite(a, b)\n\nfor i in range(n):\n root = find(i)\n ls[i] += ns[root]\n\n\nfor i in range(k):\n c, d = [int(i) for i in sys.stdin.readline().split()]\n c -= 1\n d -= 1\n if is_same(c, d):\n ls[c] -= 1\n ls[d] -= 1\n\nprint(\" \".join([str(i - 1) for i in ls]))", "problem_context": "Score : 400 points\n\nProblem Statement\n\nAn SNS has N users - User 1, User 2, \\cdots, User N.\n\nBetween these N users, there are some relationships - M friendships and K blockships.\n\nFor each i = 1, 2, \\cdots, M, there is a bidirectional friendship between User A_i and User B_i.\n\nFor each i = 1, 2, \\cdots, K, there is a bidirectional blockship between User C_i and User D_i.\n\nWe define User a to be a friend candidate for User b when all of the following four conditions are satisfied:\n\na \\neq b.\n\nThere is not a friendship between User a and User b.\n\nThere is not a blockship between User a and User b.\n\nThere exists a sequence c_0, c_1, c_2, \\cdots, c_L consisting of integers between 1 and N (inclusive) such that c_0 = a, c_L = b, and there is a friendship between User c_i and c_{i+1} for each i = 0, 1, \\cdots, L - 1.\n\nFor each user i = 1, 2, ... N, how many friend candidates does it have?\n\nConstraints\n\nAll values in input are integers.\n\n2 ≤ N ≤ 10^5\n\n0 \\leq M \\leq 10^5\n\n0 \\leq K \\leq 10^5\n\n1 \\leq A_i, B_i \\leq N\n\nA_i \\neq B_i\n\n1 \\leq C_i, D_i \\leq N\n\nC_i \\neq D_i\n\n(A_i, B_i) \\neq (A_j, B_j) (i \\neq j)\n\n(A_i, B_i) \\neq (B_j, A_j)\n\n(C_i, D_i) \\neq (C_j, D_j) (i \\neq j)\n\n(C_i, D_i) \\neq (D_j, C_j)\n\n(A_i, B_i) \\neq (C_j, D_j)\n\n(A_i, B_i) \\neq (D_j, C_j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\nA_1 B_1\n\\vdots\nA_M B_M\nC_1 D_1\n\\vdots\nC_K D_K\n\nOutput\n\nPrint the answers in order, with space in between.\n\nSample Input 1\n\n4 4 1\n2 1\n1 3\n3 2\n3 4\n4 1\n\nSample Output 1\n\n0 1 0 1\n\nThere is a friendship between User 2 and 3, and between 3 and 4. Also, there is no friendship or blockship between User 2 and 4. Thus, User 4 is a friend candidate for User 2.\n\nHowever, neither User 1 or 3 is a friend candidate for User 2, so User 2 has one friend candidate.\n\nSample Input 2\n\n5 10 0\n1 2\n1 3\n1 4\n1 5\n3 2\n2 4\n2 5\n4 3\n5 3\n4 5\n\nSample Output 2\n\n0 0 0 0 0\n\nEveryone is a friend of everyone else and has no friend candidate.\n\nSample Input 3\n\n10 9 3\n10 1\n6 7\n8 2\n2 5\n8 4\n7 3\n10 9\n6 4\n5 8\n2 6\n7 5\n3 1\n\nSample Output 3\n\n1 3 5 4 3 3 3 3 1 0", "sample_input": "4 4 1\n2 1\n1 3\n3 2\n3 4\n4 1\n"}, "reference_outputs": ["0 1 0 1\n"], "source_document_id": "p02762", "source_text": "Score : 400 points\n\nProblem Statement\n\nAn SNS has N users - User 1, User 2, \\cdots, User N.\n\nBetween these N users, there are some relationships - M friendships and K blockships.\n\nFor each i = 1, 2, \\cdots, M, there is a bidirectional friendship between User A_i and User B_i.\n\nFor each i = 1, 2, \\cdots, K, there is a bidirectional blockship between User C_i and User D_i.\n\nWe define User a to be a friend candidate for User b when all of the following four conditions are satisfied:\n\na \\neq b.\n\nThere is not a friendship between User a and User b.\n\nThere is not a blockship between User a and User b.\n\nThere exists a sequence c_0, c_1, c_2, \\cdots, c_L consisting of integers between 1 and N (inclusive) such that c_0 = a, c_L = b, and there is a friendship between User c_i and c_{i+1} for each i = 0, 1, \\cdots, L - 1.\n\nFor each user i = 1, 2, ... N, how many friend candidates does it have?\n\nConstraints\n\nAll values in input are integers.\n\n2 ≤ N ≤ 10^5\n\n0 \\leq M \\leq 10^5\n\n0 \\leq K \\leq 10^5\n\n1 \\leq A_i, B_i \\leq N\n\nA_i \\neq B_i\n\n1 \\leq C_i, D_i \\leq N\n\nC_i \\neq D_i\n\n(A_i, B_i) \\neq (A_j, B_j) (i \\neq j)\n\n(A_i, B_i) \\neq (B_j, A_j)\n\n(C_i, D_i) \\neq (C_j, D_j) (i \\neq j)\n\n(C_i, D_i) \\neq (D_j, C_j)\n\n(A_i, B_i) \\neq (C_j, D_j)\n\n(A_i, B_i) \\neq (D_j, C_j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\nA_1 B_1\n\\vdots\nA_M B_M\nC_1 D_1\n\\vdots\nC_K D_K\n\nOutput\n\nPrint the answers in order, with space in between.\n\nSample Input 1\n\n4 4 1\n2 1\n1 3\n3 2\n3 4\n4 1\n\nSample Output 1\n\n0 1 0 1\n\nThere is a friendship between User 2 and 3, and between 3 and 4. Also, there is no friendship or blockship between User 2 and 4. Thus, User 4 is a friend candidate for User 2.\n\nHowever, neither User 1 or 3 is a friend candidate for User 2, so User 2 has one friend candidate.\n\nSample Input 2\n\n5 10 0\n1 2\n1 3\n1 4\n1 5\n3 2\n2 4\n2 5\n4 3\n5 3\n4 5\n\nSample Output 2\n\n0 0 0 0 0\n\nEveryone is a friend of everyone else and has no friend candidate.\n\nSample Input 3\n\n10 9 3\n10 1\n6 7\n8 2\n2 5\n8 4\n7 3\n10 9\n6 4\n5 8\n2 6\n7 5\n3 1\n\nSample Output 3\n\n1 3 5 4 3 3 3 3 1 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 965, "cpu_time_ms": 592, "memory_kb": 66992}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s697926727", "group_id": "codeNet:p02765", "input_text": "N,K=map(int, input().split()) \nfor i in range(9000):\n if K**i<=N= 10:\n print(r)\nelse:\n print(r + 100 * (10 - n))", "language": "Python", "metadata": {"date": 1582423365, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02765.html", "problem_id": "p02765", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02765/input.txt", "sample_output_relpath": "derived/input_output/data/p02765/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02765/Python/s008295481.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s008295481", "user_id": "u633355062"}, "prompt_components": {"gold_output": "3719\n", "input_to_evaluate": "n, r = map(int, input().split())\nif n >= 10:\n print(r)\nelse:\n print(r + 100 * (10 - n))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is a member of a programming competition site, ButCoder.\n\nEach member of ButCoder is assigned two values: Inner Rating and Displayed Rating.\n\nThe Displayed Rating of a member is equal to their Inner Rating if the member has participated in 10 or more contests. Otherwise, the Displayed Rating will be their Inner Rating minus 100 \\times (10 - K) when the member has participated in K contests.\n\nTakahashi has participated in N contests, and his Displayed Rating is R. Find his Inner Rating.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n0 \\leq R \\leq 4111\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN R\n\nOutput\n\nPrint his Inner Rating.\n\nSample Input 1\n\n2 2919\n\nSample Output 1\n\n3719\n\nTakahashi has participated in 2 contests, which is less than 10, so his Displayed Rating is his Inner Rating minus 100 \\times (10 - 2) = 800.\n\nThus, Takahashi's Inner Rating is 2919 + 800 = 3719.\n\nSample Input 2\n\n22 3051\n\nSample Output 2\n\n3051", "sample_input": "2 2919\n"}, "reference_outputs": ["3719\n"], "source_document_id": "p02765", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is a member of a programming competition site, ButCoder.\n\nEach member of ButCoder is assigned two values: Inner Rating and Displayed Rating.\n\nThe Displayed Rating of a member is equal to their Inner Rating if the member has participated in 10 or more contests. Otherwise, the Displayed Rating will be their Inner Rating minus 100 \\times (10 - K) when the member has participated in K contests.\n\nTakahashi has participated in N contests, and his Displayed Rating is R. Find his Inner Rating.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n0 \\leq R \\leq 4111\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN R\n\nOutput\n\nPrint his Inner Rating.\n\nSample Input 1\n\n2 2919\n\nSample Output 1\n\n3719\n\nTakahashi has participated in 2 contests, which is less than 10, so his Displayed Rating is his Inner Rating minus 100 \\times (10 - 2) = 800.\n\nThus, Takahashi's Inner Rating is 2919 + 800 = 3719.\n\nSample Input 2\n\n22 3051\n\nSample Output 2\n\n3051", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 93, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s849473294", "group_id": "codeNet:p02766", "input_text": "n,k =map(int,input().split())\n\ni=0\nwhile True:\n i+=1\n if n= t:\n ans += 1\n t=k**(ans)\nif n == 0:\n print(1)\nelse:\n print(ans)", "language": "Python", "metadata": {"date": 1582423877, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02766.html", "problem_id": "p02766", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02766/input.txt", "sample_output_relpath": "derived/input_output/data/p02766/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02766/Python/s041733173.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s041733173", "user_id": "u521323621"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "n, k = map(int, input().split())\n\nans = 0\nt = k**(ans)\nwhile n >= t:\n ans += 1\n t=k**(ans)\nif n == 0:\n print(1)\nelse:\n print(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of digits that N has in base K.\n\nNotes\n\nFor information on base-K representation, see Positional notation - Wikipedia.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^9\n\n2 \\leq K \\leq 10\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of digits that N has in base K.\n\nSample Input 1\n\n11 2\n\nSample Output 1\n\n4\n\nIn binary, 11 is represented as 1011.\n\nSample Input 2\n\n1010101 10\n\nSample Output 2\n\n7\n\nSample Input 3\n\n314159265 3\n\nSample Output 3\n\n18", "sample_input": "11 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02766", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of digits that N has in base K.\n\nNotes\n\nFor information on base-K representation, see Positional notation - Wikipedia.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^9\n\n2 \\leq K \\leq 10\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of digits that N has in base K.\n\nSample Input 1\n\n11 2\n\nSample Output 1\n\n4\n\nIn binary, 11 is represented as 1011.\n\nSample Input 2\n\n1010101 10\n\nSample Output 2\n\n7\n\nSample Input 3\n\n314159265 3\n\nSample Output 3\n\n18", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 133, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s076407447", "group_id": "codeNet:p02767", "input_text": "import numpy as np\nN=int(input())\nx=list(map(int,input().split()))\nm=int(round(np.mean(x),0))\nx_mean=[(y-m)**2 for y in x]\nprint(sum(x_mean))", "language": "Python", "metadata": {"date": 1585102081, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02767.html", "problem_id": "p02767", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02767/input.txt", "sample_output_relpath": "derived/input_output/data/p02767/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02767/Python/s076407447.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s076407447", "user_id": "u639104973"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import numpy as np\nN=int(input())\nx=list(map(int,input().split()))\nm=int(round(np.mean(x),0))\nx_mean=[(y-m)**2 for y in x]\nprint(sum(x_mean))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people living on a number line.\n\nThe i-th person lives at coordinate X_i.\n\nYou are going to hold a meeting that all N people have to attend.\n\nThe meeting can be held at any integer coordinate. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.\n\nFind the minimum total points of stamina the N people have to spend.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq X_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 X_2 ... X_N\n\nOutput\n\nPrint the minimum total stamina the N people have to spend.\n\nSample Input 1\n\n2\n1 4\n\nSample Output 1\n\n5\n\nAssume the meeting is held at coordinate 2. In this case, the first person will spend (1 - 2)^2 points of stamina, and the second person will spend (4 - 2)^2 = 4 points of stamina, for a total of 5 points of stamina. This is the minimum total stamina that the 2 people have to spend.\n\nNote that you can hold the meeting only at an integer coordinate.\n\nSample Input 2\n\n7\n14 14 2 13 56 2 37\n\nSample Output 2\n\n2354", "sample_input": "2\n1 4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02767", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people living on a number line.\n\nThe i-th person lives at coordinate X_i.\n\nYou are going to hold a meeting that all N people have to attend.\n\nThe meeting can be held at any integer coordinate. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.\n\nFind the minimum total points of stamina the N people have to spend.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq X_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 X_2 ... X_N\n\nOutput\n\nPrint the minimum total stamina the N people have to spend.\n\nSample Input 1\n\n2\n1 4\n\nSample Output 1\n\n5\n\nAssume the meeting is held at coordinate 2. In this case, the first person will spend (1 - 2)^2 points of stamina, and the second person will spend (4 - 2)^2 = 4 points of stamina, for a total of 5 points of stamina. This is the minimum total stamina that the 2 people have to spend.\n\nNote that you can hold the meeting only at an integer coordinate.\n\nSample Input 2\n\n7\n14 14 2 13 56 2 37\n\nSample Output 2\n\n2354", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 141, "cpu_time_ms": 152, "memory_kb": 12424}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s308679154", "group_id": "codeNet:p02767", "input_text": "import math\nimport numpy as np\n\nN = int(input())\nx = list(map(int,input().split()))\nA2 = max(x); A1 = min(x)\nk = 0; Solve = np.zeros(A2-A1);\nfor A in range(A1,A2):\n B=0\n for i in range(0,N):\n B = (x[i]-A)**2 + B\n Solve[k] = B\n k += 1\nprint(int(min(Solve)))", "language": "Python", "metadata": {"date": 1583172448, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02767.html", "problem_id": "p02767", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02767/input.txt", "sample_output_relpath": "derived/input_output/data/p02767/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02767/Python/s308679154.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s308679154", "user_id": "u554879783"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import math\nimport numpy as np\n\nN = int(input())\nx = list(map(int,input().split()))\nA2 = max(x); A1 = min(x)\nk = 0; Solve = np.zeros(A2-A1);\nfor A in range(A1,A2):\n B=0\n for i in range(0,N):\n B = (x[i]-A)**2 + B\n Solve[k] = B\n k += 1\nprint(int(min(Solve)))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people living on a number line.\n\nThe i-th person lives at coordinate X_i.\n\nYou are going to hold a meeting that all N people have to attend.\n\nThe meeting can be held at any integer coordinate. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.\n\nFind the minimum total points of stamina the N people have to spend.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq X_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 X_2 ... X_N\n\nOutput\n\nPrint the minimum total stamina the N people have to spend.\n\nSample Input 1\n\n2\n1 4\n\nSample Output 1\n\n5\n\nAssume the meeting is held at coordinate 2. In this case, the first person will spend (1 - 2)^2 points of stamina, and the second person will spend (4 - 2)^2 = 4 points of stamina, for a total of 5 points of stamina. This is the minimum total stamina that the 2 people have to spend.\n\nNote that you can hold the meeting only at an integer coordinate.\n\nSample Input 2\n\n7\n14 14 2 13 56 2 37\n\nSample Output 2\n\n2354", "sample_input": "2\n1 4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02767", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people living on a number line.\n\nThe i-th person lives at coordinate X_i.\n\nYou are going to hold a meeting that all N people have to attend.\n\nThe meeting can be held at any integer coordinate. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.\n\nFind the minimum total points of stamina the N people have to spend.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq X_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 X_2 ... X_N\n\nOutput\n\nPrint the minimum total stamina the N people have to spend.\n\nSample Input 1\n\n2\n1 4\n\nSample Output 1\n\n5\n\nAssume the meeting is held at coordinate 2. In this case, the first person will spend (1 - 2)^2 points of stamina, and the second person will spend (4 - 2)^2 = 4 points of stamina, for a total of 5 points of stamina. This is the minimum total stamina that the 2 people have to spend.\n\nNote that you can hold the meeting only at an integer coordinate.\n\nSample Input 2\n\n7\n14 14 2 13 56 2 37\n\nSample Output 2\n\n2354", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 155, "memory_kb": 12504}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s478312860", "group_id": "codeNet:p02767", "input_text": "n=int(input())\nx=[int(i) for i in input().split(\" \")]\nx=sorted(x)\nmind=-1\nfor i in range(x[0],x[len(x)-1]+1):\n sum=0\n for j in x:\n sum+=(j-i)**2\n if mind>sum or mind==-1:\n mind=sum\n\nprint(mind)\n", "language": "Python", "metadata": {"date": 1582424873, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02767.html", "problem_id": "p02767", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02767/input.txt", "sample_output_relpath": "derived/input_output/data/p02767/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02767/Python/s478312860.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s478312860", "user_id": "u196297781"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "n=int(input())\nx=[int(i) for i in input().split(\" \")]\nx=sorted(x)\nmind=-1\nfor i in range(x[0],x[len(x)-1]+1):\n sum=0\n for j in x:\n sum+=(j-i)**2\n if mind>sum or mind==-1:\n mind=sum\n\nprint(mind)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people living on a number line.\n\nThe i-th person lives at coordinate X_i.\n\nYou are going to hold a meeting that all N people have to attend.\n\nThe meeting can be held at any integer coordinate. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.\n\nFind the minimum total points of stamina the N people have to spend.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq X_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 X_2 ... X_N\n\nOutput\n\nPrint the minimum total stamina the N people have to spend.\n\nSample Input 1\n\n2\n1 4\n\nSample Output 1\n\n5\n\nAssume the meeting is held at coordinate 2. In this case, the first person will spend (1 - 2)^2 points of stamina, and the second person will spend (4 - 2)^2 = 4 points of stamina, for a total of 5 points of stamina. This is the minimum total stamina that the 2 people have to spend.\n\nNote that you can hold the meeting only at an integer coordinate.\n\nSample Input 2\n\n7\n14 14 2 13 56 2 37\n\nSample Output 2\n\n2354", "sample_input": "2\n1 4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02767", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people living on a number line.\n\nThe i-th person lives at coordinate X_i.\n\nYou are going to hold a meeting that all N people have to attend.\n\nThe meeting can be held at any integer coordinate. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.\n\nFind the minimum total points of stamina the N people have to spend.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq X_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 X_2 ... X_N\n\nOutput\n\nPrint the minimum total stamina the N people have to spend.\n\nSample Input 1\n\n2\n1 4\n\nSample Output 1\n\n5\n\nAssume the meeting is held at coordinate 2. In this case, the first person will spend (1 - 2)^2 points of stamina, and the second person will spend (4 - 2)^2 = 4 points of stamina, for a total of 5 points of stamina. This is the minimum total stamina that the 2 people have to spend.\n\nNote that you can hold the meeting only at an integer coordinate.\n\nSample Input 2\n\n7\n14 14 2 13 56 2 37\n\nSample Output 2\n\n2354", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 217, "cpu_time_ms": 21, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s624831365", "group_id": "codeNet:p02768", "input_text": "from __future__ import print_function\n\nimport sys\n\nimport re\nimport array\nimport copy\nimport functools\nimport operator\n\nimport math\nimport string\nimport fractions\nfrom fractions import Fraction\nfrom fractions import gcd\n# fractions.gcd() を用いること\n# math.log2()はatcoderでは対応していない.留意せよ.\n\nimport collections\nimport itertools\nimport bisect\n\nimport random\nimport time\n\nimport heapq\nfrom heapq import heappush\nfrom heapq import heappop\nfrom heapq import heappushpop\nfrom heapq import heapify\nfrom heapq import heapreplace\nfrom queue import PriorityQueue as pq\nfrom queue import Queue\n\nfrom itertools import accumulate\n\nfrom collections import deque\nfrom collections import Counter\n\nfrom operator import mul\nfrom functools import reduce\n\ninput = sys.stdin.readline\n\n\ndef eprint(*args, **kwargs):\n print(*args, file=sys.stderr, **kwargs)\n return\n\n\ndef lcm(n, m):\n return int(n * m / gcd(n, m))\n\n\ndef coprimize(p, q):\n common = fractions.gcd(p, q)\n return (p // common, q // common)\n\n\ndef combinations_count(n, r):\n r = min(r, n - r)\n numer = reduce(mul, range(n, n - r, -1), 1)\n denom = reduce(mul, range(1, r + 1), 1)\n return numer // denom\n\n\ndef find_gcd(list_l):\n x = reduce(gcd, list_l)\n return x\n\n\np = 10**9+7\n\ndef cmb(n, r):\n temp1 = 1\n temp2 = 1\n for i in range(n-r+1, n+1):\n temp1 *= i\n temp1 %= p\n for i in range(1, r+1):\n temp2 *= i\n temp2 %= p\n return temp1 * pow(temp2,p-2,p) % p \n\n\ndef main():\n n, a, b = map(int, input().strip().split()) \n # eprint('pow(2,n,p) - cmb(n, a) - cmb(n, b) - 1 ',end=':\\n')\n # eprint(pow(2,n,p) - cmb(n, a) - cmb(n, b) - 1)\n\n # eprint('pow(2,n,p) ',end=':\\n')\n # eprint(pow(2,n,p))\n # eprint('cmb(n,a) ',end=':\\n')\n # eprint(cmb(n,a))\n # eprint('cmb(n,b) ',end=':\\n')\n # eprint(cmb(n,b))\n\n # if pow(2,n,p) - cmb(n, a) - cmb(n, b) - 1<-1:\n # print(pow(2,n,p) - cmb(n, a) - cmb(n, b) - 1 + p)\n # elif pow(2,n,p) - cmb(n, a) - cmb(n, b) - 1 == -1:\n # print(0)\n # else:\n # print(max( (pow(2,n,p) - cmb(n, a) - cmb(n, b) - 1) , 0 ))\n\n #\n eprint('pow(2,n,p) ',end=':\\n')\n eprint(pow(2,n,p))\n\n #\n xxx = pow(2,n,p) - cmb(n, a) - cmb(n, b)\n if xxx<0:\n print(xxx-1+p)\n elif xxx == 0:\n print(0)\n else:\n print(xxx-1)\n\n\nif __name__ == '__main__':\n main()\n", "language": "Python", "metadata": {"date": 1585186459, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02768.html", "problem_id": "p02768", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02768/input.txt", "sample_output_relpath": "derived/input_output/data/p02768/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02768/Python/s624831365.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s624831365", "user_id": "u185249212"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "from __future__ import print_function\n\nimport sys\n\nimport re\nimport array\nimport copy\nimport functools\nimport operator\n\nimport math\nimport string\nimport fractions\nfrom fractions import Fraction\nfrom fractions import gcd\n# fractions.gcd() を用いること\n# math.log2()はatcoderでは対応していない.留意せよ.\n\nimport collections\nimport itertools\nimport bisect\n\nimport random\nimport time\n\nimport heapq\nfrom heapq import heappush\nfrom heapq import heappop\nfrom heapq import heappushpop\nfrom heapq import heapify\nfrom heapq import heapreplace\nfrom queue import PriorityQueue as pq\nfrom queue import Queue\n\nfrom itertools import accumulate\n\nfrom collections import deque\nfrom collections import Counter\n\nfrom operator import mul\nfrom functools import reduce\n\ninput = sys.stdin.readline\n\n\ndef eprint(*args, **kwargs):\n print(*args, file=sys.stderr, **kwargs)\n return\n\n\ndef lcm(n, m):\n return int(n * m / gcd(n, m))\n\n\ndef coprimize(p, q):\n common = fractions.gcd(p, q)\n return (p // common, q // common)\n\n\ndef combinations_count(n, r):\n r = min(r, n - r)\n numer = reduce(mul, range(n, n - r, -1), 1)\n denom = reduce(mul, range(1, r + 1), 1)\n return numer // denom\n\n\ndef find_gcd(list_l):\n x = reduce(gcd, list_l)\n return x\n\n\np = 10**9+7\n\ndef cmb(n, r):\n temp1 = 1\n temp2 = 1\n for i in range(n-r+1, n+1):\n temp1 *= i\n temp1 %= p\n for i in range(1, r+1):\n temp2 *= i\n temp2 %= p\n return temp1 * pow(temp2,p-2,p) % p \n\n\ndef main():\n n, a, b = map(int, input().strip().split()) \n # eprint('pow(2,n,p) - cmb(n, a) - cmb(n, b) - 1 ',end=':\\n')\n # eprint(pow(2,n,p) - cmb(n, a) - cmb(n, b) - 1)\n\n # eprint('pow(2,n,p) ',end=':\\n')\n # eprint(pow(2,n,p))\n # eprint('cmb(n,a) ',end=':\\n')\n # eprint(cmb(n,a))\n # eprint('cmb(n,b) ',end=':\\n')\n # eprint(cmb(n,b))\n\n # if pow(2,n,p) - cmb(n, a) - cmb(n, b) - 1<-1:\n # print(pow(2,n,p) - cmb(n, a) - cmb(n, b) - 1 + p)\n # elif pow(2,n,p) - cmb(n, a) - cmb(n, b) - 1 == -1:\n # print(0)\n # else:\n # print(max( (pow(2,n,p) - cmb(n, a) - cmb(n, b) - 1) , 0 ))\n\n #\n eprint('pow(2,n,p) ',end=':\\n')\n eprint(pow(2,n,p))\n\n #\n xxx = pow(2,n,p) - cmb(n, a) - cmb(n, b)\n if xxx<0:\n print(xxx-1+p)\n elif xxx == 0:\n print(0)\n else:\n print(xxx-1)\n\n\nif __name__ == '__main__':\n main()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nAkari has n kinds of flowers, one of each kind.\n\nShe is going to choose one or more of these flowers to make a bouquet.\n\nHowever, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b.\n\nHow many different bouquets are there that Akari can make?\n\nFind the count modulo (10^9 + 7).\n\nHere, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq n \\leq 10^9\n\n1 \\leq a < b \\leq \\textrm{min}(n, 2 \\times 10^5)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn a b\n\nOutput\n\nPrint the number of bouquets that Akari can make, modulo (10^9 + 7). (If there are no such bouquets, print 0.)\n\nSample Input 1\n\n4 1 3\n\nSample Output 1\n\n7\n\nIn this case, Akari can choose 2 or 4 flowers to make the bouquet.\n\nThere are 6 ways to choose 2 out of the 4 flowers, and 1 way to choose 4, so there are a total of 7 different bouquets that Akari can make.\n\nSample Input 2\n\n1000000000 141421 173205\n\nSample Output 2\n\n34076506\n\nPrint the count modulo (10^9 + 7).", "sample_input": "4 1 3\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02768", "source_text": "Score : 400 points\n\nProblem Statement\n\nAkari has n kinds of flowers, one of each kind.\n\nShe is going to choose one or more of these flowers to make a bouquet.\n\nHowever, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b.\n\nHow many different bouquets are there that Akari can make?\n\nFind the count modulo (10^9 + 7).\n\nHere, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq n \\leq 10^9\n\n1 \\leq a < b \\leq \\textrm{min}(n, 2 \\times 10^5)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn a b\n\nOutput\n\nPrint the number of bouquets that Akari can make, modulo (10^9 + 7). (If there are no such bouquets, print 0.)\n\nSample Input 1\n\n4 1 3\n\nSample Output 1\n\n7\n\nIn this case, Akari can choose 2 or 4 flowers to make the bouquet.\n\nThere are 6 ways to choose 2 out of the 4 flowers, and 1 way to choose 4, so there are a total of 7 different bouquets that Akari can make.\n\nSample Input 2\n\n1000000000 141421 173205\n\nSample Output 2\n\n34076506\n\nPrint the count modulo (10^9 + 7).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2401, "cpu_time_ms": 293, "memory_kb": 61036}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s963508962", "group_id": "codeNet:p02768", "input_text": "n,a,b=map(int,input().split())\nmod=10**9+7\n\ndef cmb(n, r):\n if n - r < r: r = n - r\n if r == 0: return 1\n if r == 1: return n\n\n numerator = [n - r + k + 1 for k in range(r)]\n denominator = [k + 1 for k in range(r)]\n\n for p in range(2,r+1):\n pivot = denominator[p - 1]\n if pivot > 1:\n offset = (n - r) % p\n for k in range(p-1,r,p):\n numerator[k - offset] /= pivot\n denominator[k] /= pivot\n\n result = 1\n for k in range(r):\n if numerator[k] > 1:\n result *= int(numerator[k])\n result%=mod\n\n return result\n\n\nallp=pow(2,n,mod)-1\nans=(allp-cmb(n,a)%mod-cmb(n,b)%mod+mod)%mod\nif n==2:\n ans=0\n\nprint(ans)", "language": "Python", "metadata": {"date": 1582403848, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02768.html", "problem_id": "p02768", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02768/input.txt", "sample_output_relpath": "derived/input_output/data/p02768/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02768/Python/s963508962.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s963508962", "user_id": "u498487134"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "n,a,b=map(int,input().split())\nmod=10**9+7\n\ndef cmb(n, r):\n if n - r < r: r = n - r\n if r == 0: return 1\n if r == 1: return n\n\n numerator = [n - r + k + 1 for k in range(r)]\n denominator = [k + 1 for k in range(r)]\n\n for p in range(2,r+1):\n pivot = denominator[p - 1]\n if pivot > 1:\n offset = (n - r) % p\n for k in range(p-1,r,p):\n numerator[k - offset] /= pivot\n denominator[k] /= pivot\n\n result = 1\n for k in range(r):\n if numerator[k] > 1:\n result *= int(numerator[k])\n result%=mod\n\n return result\n\n\nallp=pow(2,n,mod)-1\nans=(allp-cmb(n,a)%mod-cmb(n,b)%mod+mod)%mod\nif n==2:\n ans=0\n\nprint(ans)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nAkari has n kinds of flowers, one of each kind.\n\nShe is going to choose one or more of these flowers to make a bouquet.\n\nHowever, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b.\n\nHow many different bouquets are there that Akari can make?\n\nFind the count modulo (10^9 + 7).\n\nHere, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq n \\leq 10^9\n\n1 \\leq a < b \\leq \\textrm{min}(n, 2 \\times 10^5)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn a b\n\nOutput\n\nPrint the number of bouquets that Akari can make, modulo (10^9 + 7). (If there are no such bouquets, print 0.)\n\nSample Input 1\n\n4 1 3\n\nSample Output 1\n\n7\n\nIn this case, Akari can choose 2 or 4 flowers to make the bouquet.\n\nThere are 6 ways to choose 2 out of the 4 flowers, and 1 way to choose 4, so there are a total of 7 different bouquets that Akari can make.\n\nSample Input 2\n\n1000000000 141421 173205\n\nSample Output 2\n\n34076506\n\nPrint the count modulo (10^9 + 7).", "sample_input": "4 1 3\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02768", "source_text": "Score : 400 points\n\nProblem Statement\n\nAkari has n kinds of flowers, one of each kind.\n\nShe is going to choose one or more of these flowers to make a bouquet.\n\nHowever, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b.\n\nHow many different bouquets are there that Akari can make?\n\nFind the count modulo (10^9 + 7).\n\nHere, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq n \\leq 10^9\n\n1 \\leq a < b \\leq \\textrm{min}(n, 2 \\times 10^5)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn a b\n\nOutput\n\nPrint the number of bouquets that Akari can make, modulo (10^9 + 7). (If there are no such bouquets, print 0.)\n\nSample Input 1\n\n4 1 3\n\nSample Output 1\n\n7\n\nIn this case, Akari can choose 2 or 4 flowers to make the bouquet.\n\nThere are 6 ways to choose 2 out of the 4 flowers, and 1 way to choose 4, so there are a total of 7 different bouquets that Akari can make.\n\nSample Input 2\n\n1000000000 141421 173205\n\nSample Output 2\n\n34076506\n\nPrint the count modulo (10^9 + 7).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 720, "cpu_time_ms": 372, "memory_kb": 108236}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s672558695", "group_id": "codeNet:p02769", "input_text": "MAX = 1000005\nMOD = 10**9+7\nfactrial = [0]*MAX\ninverse = [0]*MAX\nfactrial_inverse = [0]*MAX\n\n\n# テーブルを作る前処理\ndef COMinit():\n global factrial, inverse, factrial_inverse\n factrial[0] = 1\n factrial[1] = 1\n inverse[1] = 1\n factrial_inverse[0] = 1\n factrial_inverse[1] = 1\n for i in range(2, MAX):\n factrial[i] = factrial[i-1] * i % MOD\n inverse[i] = MOD - inverse[MOD % i] * (MOD//i) % MOD\n factrial_inverse[i] = factrial_inverse[i-1] * inverse[i] % MOD\n\n\n# 二項係数計算\ndef COM(n, k):\n global factrial, inverse, factrial_inverse\n if n < k:\n return 0\n if n < 0 or k < 0:\n return 0\n return factrial[n] * (factrial_inverse[k] * factrial_inverse[n-k] % MOD) % MOD\n\n\n# 前処理完了\nCOMinit()\n\n\nN, K = map(int, input().split())\nans = 0\nfor i in range(min(K, N)+1): # 空にできるのはK部屋または、N-1部屋までのみ。\n ans += COM(N, i) * COM(N-1, i)\n ans %= MOD\nprint(ans)\n", "language": "Python", "metadata": {"date": 1582641320, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02769.html", "problem_id": "p02769", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02769/input.txt", "sample_output_relpath": "derived/input_output/data/p02769/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02769/Python/s672558695.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s672558695", "user_id": "u708255304"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "MAX = 1000005\nMOD = 10**9+7\nfactrial = [0]*MAX\ninverse = [0]*MAX\nfactrial_inverse = [0]*MAX\n\n\n# テーブルを作る前処理\ndef COMinit():\n global factrial, inverse, factrial_inverse\n factrial[0] = 1\n factrial[1] = 1\n inverse[1] = 1\n factrial_inverse[0] = 1\n factrial_inverse[1] = 1\n for i in range(2, MAX):\n factrial[i] = factrial[i-1] * i % MOD\n inverse[i] = MOD - inverse[MOD % i] * (MOD//i) % MOD\n factrial_inverse[i] = factrial_inverse[i-1] * inverse[i] % MOD\n\n\n# 二項係数計算\ndef COM(n, k):\n global factrial, inverse, factrial_inverse\n if n < k:\n return 0\n if n < 0 or k < 0:\n return 0\n return factrial[n] * (factrial_inverse[k] * factrial_inverse[n-k] % MOD) % MOD\n\n\n# 前処理完了\nCOMinit()\n\n\nN, K = map(int, input().split())\nans = 0\nfor i in range(min(K, N)+1): # 空にできるのはK部屋または、N-1部屋までのみ。\n ans += COM(N, i) * COM(N-1, i)\n ans %= MOD\nprint(ans)\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is a building with n rooms, numbered 1 to n.\n\nWe can move from any room to any other room in the building.\n\nLet us call the following event a move: a person in some room i goes to another room j~ (i \\neq j).\n\nInitially, there was one person in each room in the building.\n\nAfter that, we know that there were exactly k moves happened up to now.\n\nWe are interested in the number of people in each of the n rooms now. How many combinations of numbers of people in the n rooms are possible?\n\nFind the count modulo (10^9 + 7).\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq n \\leq 2 \\times 10^5\n\n2 \\leq k \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn k\n\nOutput\n\nPrint the number of possible combinations of numbers of people in the n rooms now, modulo (10^9 + 7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nLet c_1, c_2, and c_3 be the number of people in Room 1, 2, and 3 now, respectively. There are 10 possible combination of (c_1, c_2, c_3):\n\n(0, 0, 3)\n\n(0, 1, 2)\n\n(0, 2, 1)\n\n(0, 3, 0)\n\n(1, 0, 2)\n\n(1, 1, 1)\n\n(1, 2, 0)\n\n(2, 0, 1)\n\n(2, 1, 0)\n\n(3, 0, 0)\n\nFor example, (c_1, c_2, c_3) will be (0, 1, 2) if the person in Room 1 goes to Room 2 and then one of the persons in Room 2 goes to Room 3.\n\nSample Input 2\n\n200000 1000000000\n\nSample Output 2\n\n607923868\n\nPrint the count modulo (10^9 + 7).\n\nSample Input 3\n\n15 6\n\nSample Output 3\n\n22583772", "sample_input": "3 2\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02769", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is a building with n rooms, numbered 1 to n.\n\nWe can move from any room to any other room in the building.\n\nLet us call the following event a move: a person in some room i goes to another room j~ (i \\neq j).\n\nInitially, there was one person in each room in the building.\n\nAfter that, we know that there were exactly k moves happened up to now.\n\nWe are interested in the number of people in each of the n rooms now. How many combinations of numbers of people in the n rooms are possible?\n\nFind the count modulo (10^9 + 7).\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq n \\leq 2 \\times 10^5\n\n2 \\leq k \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn k\n\nOutput\n\nPrint the number of possible combinations of numbers of people in the n rooms now, modulo (10^9 + 7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nLet c_1, c_2, and c_3 be the number of people in Room 1, 2, and 3 now, respectively. There are 10 possible combination of (c_1, c_2, c_3):\n\n(0, 0, 3)\n\n(0, 1, 2)\n\n(0, 2, 1)\n\n(0, 3, 0)\n\n(1, 0, 2)\n\n(1, 1, 1)\n\n(1, 2, 0)\n\n(2, 0, 1)\n\n(2, 1, 0)\n\n(3, 0, 0)\n\nFor example, (c_1, c_2, c_3) will be (0, 1, 2) if the person in Room 1 goes to Room 2 and then one of the persons in Room 2 goes to Room 3.\n\nSample Input 2\n\n200000 1000000000\n\nSample Output 2\n\n607923868\n\nPrint the count modulo (10^9 + 7).\n\nSample Input 3\n\n15 6\n\nSample Output 3\n\n22583772", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 980, "cpu_time_ms": 1411, "memory_kb": 121716}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s397561652", "group_id": "codeNet:p02771", "input_text": "a=list(input().split())\n\nif len(set(a))==2:\n print(\"Yes\")\nelse:\n print(\"No\")", "language": "Python", "metadata": {"date": 1587410267, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02771.html", "problem_id": "p02771", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02771/input.txt", "sample_output_relpath": "derived/input_output/data/p02771/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02771/Python/s397561652.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s397561652", "user_id": "u798093965"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "a=list(input().split())\n\nif len(set(a))==2:\n print(\"Yes\")\nelse:\n print(\"No\")", "problem_context": "Score: 100 points\n\nProblem Statement\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\nConstraints\n\nA, B, and C are all integers between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the given triple is poor, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\nYes\n\nA and C are equal, but B is different from those two numbers, so this triple is poor.\n\nSample Input 2\n\n4 4 4\n\nSample Output 2\n\nNo\n\nA, B, and C are all equal, so this triple is not poor.\n\nSample Input 3\n\n4 9 6\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3 3 4\n\nSample Output 4\n\nYes", "sample_input": "5 7 5\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02771", "source_text": "Score: 100 points\n\nProblem Statement\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\nConstraints\n\nA, B, and C are all integers between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the given triple is poor, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\nYes\n\nA and C are equal, but B is different from those two numbers, so this triple is poor.\n\nSample Input 2\n\n4 4 4\n\nSample Output 2\n\nNo\n\nA, B, and C are all equal, so this triple is not poor.\n\nSample Input 3\n\n4 9 6\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3 3 4\n\nSample Output 4\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 82, "cpu_time_ms": 177, "memory_kb": 38384}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s754239163", "group_id": "codeNet:p02771", "input_text": "n = list(map(int,input().split()))\nif len(set(n)) == 2:\n print('Yes')\nelse:\n print('No')", "language": "Python", "metadata": {"date": 1582581987, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02771.html", "problem_id": "p02771", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02771/input.txt", "sample_output_relpath": "derived/input_output/data/p02771/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02771/Python/s754239163.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s754239163", "user_id": "u385309449"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "n = list(map(int,input().split()))\nif len(set(n)) == 2:\n print('Yes')\nelse:\n print('No')", "problem_context": "Score: 100 points\n\nProblem Statement\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\nConstraints\n\nA, B, and C are all integers between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the given triple is poor, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\nYes\n\nA and C are equal, but B is different from those two numbers, so this triple is poor.\n\nSample Input 2\n\n4 4 4\n\nSample Output 2\n\nNo\n\nA, B, and C are all equal, so this triple is not poor.\n\nSample Input 3\n\n4 9 6\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3 3 4\n\nSample Output 4\n\nYes", "sample_input": "5 7 5\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02771", "source_text": "Score: 100 points\n\nProblem Statement\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\nConstraints\n\nA, B, and C are all integers between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the given triple is poor, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\nYes\n\nA and C are equal, but B is different from those two numbers, so this triple is poor.\n\nSample Input 2\n\n4 4 4\n\nSample Output 2\n\nNo\n\nA, B, and C are all equal, so this triple is not poor.\n\nSample Input 3\n\n4 9 6\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3 3 4\n\nSample Output 4\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 90, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s197849894", "group_id": "codeNet:p02771", "input_text": "a,b,c = map(int, input().split())\nif a == b == c:\n print('No')\nelif a == b or b == c or c == a:\n print('Yes')\nelse:\n print('No')", "language": "Python", "metadata": {"date": 1581885737, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02771.html", "problem_id": "p02771", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02771/input.txt", "sample_output_relpath": "derived/input_output/data/p02771/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02771/Python/s197849894.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s197849894", "user_id": "u329049771"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "a,b,c = map(int, input().split())\nif a == b == c:\n print('No')\nelif a == b or b == c or c == a:\n print('Yes')\nelse:\n print('No')", "problem_context": "Score: 100 points\n\nProblem Statement\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\nConstraints\n\nA, B, and C are all integers between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the given triple is poor, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\nYes\n\nA and C are equal, but B is different from those two numbers, so this triple is poor.\n\nSample Input 2\n\n4 4 4\n\nSample Output 2\n\nNo\n\nA, B, and C are all equal, so this triple is not poor.\n\nSample Input 3\n\n4 9 6\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3 3 4\n\nSample Output 4\n\nYes", "sample_input": "5 7 5\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02771", "source_text": "Score: 100 points\n\nProblem Statement\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\nConstraints\n\nA, B, and C are all integers between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the given triple is poor, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\nYes\n\nA and C are equal, but B is different from those two numbers, so this triple is poor.\n\nSample Input 2\n\n4 4 4\n\nSample Output 2\n\nNo\n\nA, B, and C are all equal, so this triple is not poor.\n\nSample Input 3\n\n4 9 6\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3 3 4\n\nSample Output 4\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 137, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s567733852", "group_id": "codeNet:p02771", "input_text": "a, b, c = map(int, input().split())\n\nif a == b and b != c:\n print(\"Yes\")\nelif a != b and b == c:\n print(\"Yes\")\nelif a == c and a != b:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "language": "Python", "metadata": {"date": 1581883392, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02771.html", "problem_id": "p02771", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02771/input.txt", "sample_output_relpath": "derived/input_output/data/p02771/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02771/Python/s567733852.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s567733852", "user_id": "u679439110"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "a, b, c = map(int, input().split())\n\nif a == b and b != c:\n print(\"Yes\")\nelif a != b and b == c:\n print(\"Yes\")\nelif a == c and a != b:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\nConstraints\n\nA, B, and C are all integers between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the given triple is poor, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\nYes\n\nA and C are equal, but B is different from those two numbers, so this triple is poor.\n\nSample Input 2\n\n4 4 4\n\nSample Output 2\n\nNo\n\nA, B, and C are all equal, so this triple is not poor.\n\nSample Input 3\n\n4 9 6\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3 3 4\n\nSample Output 4\n\nYes", "sample_input": "5 7 5\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02771", "source_text": "Score: 100 points\n\nProblem Statement\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\nConstraints\n\nA, B, and C are all integers between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the given triple is poor, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\nYes\n\nA and C are equal, but B is different from those two numbers, so this triple is poor.\n\nSample Input 2\n\n4 4 4\n\nSample Output 2\n\nNo\n\nA, B, and C are all equal, so this triple is not poor.\n\nSample Input 3\n\n4 9 6\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3 3 4\n\nSample Output 4\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 180, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s001983106", "group_id": "codeNet:p02771", "input_text": "a,b,c = map(int,input().split())\n\nif len(set([a,b,c])) == 2:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "language": "Python", "metadata": {"date": 1581883334, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02771.html", "problem_id": "p02771", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02771/input.txt", "sample_output_relpath": "derived/input_output/data/p02771/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02771/Python/s001983106.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s001983106", "user_id": "u683134447"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "a,b,c = map(int,input().split())\n\nif len(set([a,b,c])) == 2:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\nConstraints\n\nA, B, and C are all integers between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the given triple is poor, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\nYes\n\nA and C are equal, but B is different from those two numbers, so this triple is poor.\n\nSample Input 2\n\n4 4 4\n\nSample Output 2\n\nNo\n\nA, B, and C are all equal, so this triple is not poor.\n\nSample Input 3\n\n4 9 6\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3 3 4\n\nSample Output 4\n\nYes", "sample_input": "5 7 5\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02771", "source_text": "Score: 100 points\n\nProblem Statement\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\nConstraints\n\nA, B, and C are all integers between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the given triple is poor, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\nYes\n\nA and C are equal, but B is different from those two numbers, so this triple is poor.\n\nSample Input 2\n\n4 4 4\n\nSample Output 2\n\nNo\n\nA, B, and C are all equal, so this triple is not poor.\n\nSample Input 3\n\n4 9 6\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3 3 4\n\nSample Output 4\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 100, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s330678576", "group_id": "codeNet:p02772", "input_text": "N = int(input())\n\na = [0]*N\na = list(map(int, input().split()))\nfor i in range(N):\n \n if a[i]%2 == 0:\n if a[i]%3 != 0 and a[i]%5 != 0:\n print('DENIED')\n break\n if i == N-1:\n print('APPROVE')", "language": "Python", "metadata": {"date": 1586363222, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02772.html", "problem_id": "p02772", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02772/input.txt", "sample_output_relpath": "derived/input_output/data/p02772/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02772/Python/s330678576.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s330678576", "user_id": "u067273593"}, "prompt_components": {"gold_output": "APPROVED\n", "input_to_evaluate": "N = int(input())\n\na = [0]*N\na = list(map(int, input().split()))\nfor i in range(N):\n \n if a[i]%2 == 0:\n if a[i]%3 != 0 and a[i]%5 != 0:\n print('DENIED')\n break\n if i == N-1:\n print('APPROVE')", "problem_context": "Score: 200 points\n\nProblem Statement\n\nYou are an immigration officer in the Kingdom of AtCoder. The document carried by an immigrant has some number of integers written on it, and you need to check whether they meet certain criteria.\n\nAccording to the regulation, the immigrant should be allowed entry to the kingdom if and only if the following condition is satisfied:\n\nAll even numbers written on the document are divisible by 3 or 5.\n\nIf the immigrant should be allowed entry according to the regulation, output APPROVED; otherwise, print DENIED.\n\nNotes\n\nThe condition in the statement can be rephrased as \"If x is an even number written on the document, x is divisible by 3 or 5\".\nHere \"if\" and \"or\" are logical terms.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nIf the immigrant should be allowed entry according to the regulation, print APPROVED; otherwise, print DENIED.\n\nSample Input 1\n\n5\n6 7 9 10 31\n\nSample Output 1\n\nAPPROVED\n\nThe even numbers written on the document are 6 and 10.\n\nAll of them are divisible by 3 or 5, so the immigrant should be allowed entry.\n\nSample Input 2\n\n3\n28 27 24\n\nSample Output 2\n\nDENIED\n\n28 violates the condition, so the immigrant should not be allowed entry.", "sample_input": "5\n6 7 9 10 31\n"}, "reference_outputs": ["APPROVED\n"], "source_document_id": "p02772", "source_text": "Score: 200 points\n\nProblem Statement\n\nYou are an immigration officer in the Kingdom of AtCoder. The document carried by an immigrant has some number of integers written on it, and you need to check whether they meet certain criteria.\n\nAccording to the regulation, the immigrant should be allowed entry to the kingdom if and only if the following condition is satisfied:\n\nAll even numbers written on the document are divisible by 3 or 5.\n\nIf the immigrant should be allowed entry according to the regulation, output APPROVED; otherwise, print DENIED.\n\nNotes\n\nThe condition in the statement can be rephrased as \"If x is an even number written on the document, x is divisible by 3 or 5\".\nHere \"if\" and \"or\" are logical terms.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nIf the immigrant should be allowed entry according to the regulation, print APPROVED; otherwise, print DENIED.\n\nSample Input 1\n\n5\n6 7 9 10 31\n\nSample Output 1\n\nAPPROVED\n\nThe even numbers written on the document are 6 and 10.\n\nAll of them are divisible by 3 or 5, so the immigrant should be allowed entry.\n\nSample Input 2\n\n3\n28 27 24\n\nSample Output 2\n\nDENIED\n\n28 violates the condition, so the immigrant should not be allowed entry.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 209, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s776859019", "group_id": "codeNet:p02773", "input_text": "n=int(input())\nb = ''\nfor i in range(n):\n b += (input() + ' ')\na = list(b.split())\na_count = [a.count(i) for i in a]\nprint('\\n'.join(sorted(set([a[i] for i in range(len(a_count)) if a_count[i] == max(a_count)]))))\n", "language": "Python", "metadata": {"date": 1585242473, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02773.html", "problem_id": "p02773", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02773/input.txt", "sample_output_relpath": "derived/input_output/data/p02773/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02773/Python/s776859019.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s776859019", "user_id": "u060793972"}, "prompt_components": {"gold_output": "beet\nvet\n", "input_to_evaluate": "n=int(input())\nb = ''\nfor i in range(n):\n b += (input() + ' ')\na = list(b.split())\na_count = [a.count(i) for i in a]\nprint('\\n'.join(sorted(set([a[i] for i in range(len(a_count)) if a_count[i] == max(a_count)]))))\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "sample_input": "7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n"}, "reference_outputs": ["beet\nvet\n"], "source_document_id": "p02773", "source_text": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 217, "cpu_time_ms": 2105, "memory_kb": 20500}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s894852448", "group_id": "codeNet:p02773", "input_text": "N = int(input())\nstr = {}\nfor i in range(N):\n key = input()\n if(key in str.keys()):\n str[key] += 1\n else:\n str[key] = 1\nm = max(str.values())\nstr = sorted(str.items(),key=lambda x:x[1],reverse=True)\nz = []\nfor i in range(len(str)):\n if(str[i][1] == m):\n z.append(str[i][0])\nz.sort()\nfor i in z:print(i)\n", "language": "Python", "metadata": {"date": 1583505280, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02773.html", "problem_id": "p02773", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02773/input.txt", "sample_output_relpath": "derived/input_output/data/p02773/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02773/Python/s894852448.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s894852448", "user_id": "u803865203"}, "prompt_components": {"gold_output": "beet\nvet\n", "input_to_evaluate": "N = int(input())\nstr = {}\nfor i in range(N):\n key = input()\n if(key in str.keys()):\n str[key] += 1\n else:\n str[key] = 1\nm = max(str.values())\nstr = sorted(str.items(),key=lambda x:x[1],reverse=True)\nz = []\nfor i in range(len(str)):\n if(str[i][1] == m):\n z.append(str[i][0])\nz.sort()\nfor i in z:print(i)\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "sample_input": "7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n"}, "reference_outputs": ["beet\nvet\n"], "source_document_id": "p02773", "source_text": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 336, "cpu_time_ms": 732, "memory_kb": 43224}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s335960076", "group_id": "codeNet:p02773", "input_text": "import collections\n\nN=int(input())\ndata=[input() for i in range(N)]\nc = collections.Counter(data)\nscore=c\ncom=c.most_common()\n\nscore_sorted = sorted(score.items(), key=lambda x:x[1], reverse=True)\n\nval=score_sorted\n\ncount=\"Yes\"\nii=0\nansa=1\nwhile count==\"Yes\":\n if val[ii][1]==val[ii+1][1]:\n ii+=1\n ansa+=1\n else:\n count=\"No\"\ndata2=[]\nfor i in range(ansa):\n data2.append(val[i][0])\n \ndata2.sort()\nfor i in range(ansa):\n print(data2[i])", "language": "Python", "metadata": {"date": 1581887636, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02773.html", "problem_id": "p02773", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02773/input.txt", "sample_output_relpath": "derived/input_output/data/p02773/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02773/Python/s335960076.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s335960076", "user_id": "u872184182"}, "prompt_components": {"gold_output": "beet\nvet\n", "input_to_evaluate": "import collections\n\nN=int(input())\ndata=[input() for i in range(N)]\nc = collections.Counter(data)\nscore=c\ncom=c.most_common()\n\nscore_sorted = sorted(score.items(), key=lambda x:x[1], reverse=True)\n\nval=score_sorted\n\ncount=\"Yes\"\nii=0\nansa=1\nwhile count==\"Yes\":\n if val[ii][1]==val[ii+1][1]:\n ii+=1\n ansa+=1\n else:\n count=\"No\"\ndata2=[]\nfor i in range(ansa):\n data2.append(val[i][0])\n \ndata2.sort()\nfor i in range(ansa):\n print(data2[i])", "problem_context": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "sample_input": "7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n"}, "reference_outputs": ["beet\nvet\n"], "source_document_id": "p02773", "source_text": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 470, "cpu_time_ms": 542, "memory_kb": 59380}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s923716153", "group_id": "codeNet:p02773", "input_text": "from collections import defaultdict\nN = int(input())\nS = defaultdict(int)\nS2 = []\nmax = 0\nfor _ in range(N):\n s = input()\n S[s] += 1\n if max < S[s]:\n max = S[s]\nfor k, v in sorted(S.items(), key=lambda x: -x[1]):\n if max == v:\n S2.append(k)\n else:\n break\nfor s in sorted(S2):\n print(s)", "language": "Python", "metadata": {"date": 1581886104, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02773.html", "problem_id": "p02773", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02773/input.txt", "sample_output_relpath": "derived/input_output/data/p02773/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02773/Python/s923716153.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s923716153", "user_id": "u761720628"}, "prompt_components": {"gold_output": "beet\nvet\n", "input_to_evaluate": "from collections import defaultdict\nN = int(input())\nS = defaultdict(int)\nS2 = []\nmax = 0\nfor _ in range(N):\n s = input()\n S[s] += 1\n if max < S[s]:\n max = S[s]\nfor k, v in sorted(S.items(), key=lambda x: -x[1]):\n if max == v:\n S2.append(k)\n else:\n break\nfor s in sorted(S2):\n print(s)", "problem_context": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "sample_input": "7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n"}, "reference_outputs": ["beet\nvet\n"], "source_document_id": "p02773", "source_text": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 324, "cpu_time_ms": 849, "memory_kb": 43484}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s749734126", "group_id": "codeNet:p02775", "input_text": "from itertools import groupby\n\ndef fivefunction(num):\n if num>=5:\n return 1\n else:\n return 0\n\nN=input()\nA=[int(N[i]) for i in range(0,len(N))]\nfiveonlyzone=0\nfor i in range(0,len(N)):\n if i==0:\n if A[i]==5 and A[i+1]<5:\n fiveonlyzone+=1\n elif i==len(N)-1:\n if A[i-1]<5 and A[i]==5:\n fiveonlyzone+=1\n else:\n if A[i-1]<5 and A[i]==5 and A[i+1]<5:\n fiveonlyzone+=1\n\nNdigitsum=sum(A)\ndata=[fivefunction(A[i]) for i in range(0,len(N))]\nAdigitsum=0\nfor i in range(0,len(N)):\n if fivefunction(A[i])==0:\n Adigitsum+=A[i]\nX=groupby(data)\nzone=0\ndigit=0\nfor key,group in X:\n g=len(list(group))\n if key==1:\n zone+=1\n digit+=g\nprint(9*digit+2*zone+2*Adigitsum-Ndigitsum-fiveonlyzone)", "language": "Python", "metadata": {"date": 1581892843, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02775.html", "problem_id": "p02775", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02775/input.txt", "sample_output_relpath": "derived/input_output/data/p02775/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02775/Python/s749734126.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s749734126", "user_id": "u488401358"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "from itertools import groupby\n\ndef fivefunction(num):\n if num>=5:\n return 1\n else:\n return 0\n\nN=input()\nA=[int(N[i]) for i in range(0,len(N))]\nfiveonlyzone=0\nfor i in range(0,len(N)):\n if i==0:\n if A[i]==5 and A[i+1]<5:\n fiveonlyzone+=1\n elif i==len(N)-1:\n if A[i-1]<5 and A[i]==5:\n fiveonlyzone+=1\n else:\n if A[i-1]<5 and A[i]==5 and A[i+1]<5:\n fiveonlyzone+=1\n\nNdigitsum=sum(A)\ndata=[fivefunction(A[i]) for i in range(0,len(N))]\nAdigitsum=0\nfor i in range(0,len(N)):\n if fivefunction(A[i])==0:\n Adigitsum+=A[i]\nX=groupby(data)\nzone=0\ndigit=0\nfor key,group in X:\n g=len(list(group))\n if key==1:\n zone+=1\n digit+=g\nprint(9*digit+2*zone+2*Adigitsum-Ndigitsum-fiveonlyzone)", "problem_context": "Score: 500 points\n\nProblem Statement\n\nIn the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \\dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. (Takoyaki is the name of a Japanese snack.)\n\nTo make the payment, you will choose some amount of money which is at least N and give it to the clerk. Then, the clerk gives you back the change, which is the amount of money you give minus N.\n\nWhat will be the minimum possible number of total banknotes used by you and the clerk, when both choose the combination of banknotes to minimize this count?\n\nAssume that you have sufficient numbers of banknotes, and so does the clerk.\n\nConstraints\n\nN is an integer between 1 and 10^{1,000,000} (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum possible number of total banknotes used by you and the clerk.\n\nSample Input 1\n\n36\n\nSample Output 1\n\n8\n\nIf you give four banknotes of value 10 each, and the clerk gives you back four banknotes of value 1 each, a total of eight banknotes are used.\n\nThe payment cannot be made with less than eight banknotes in total, so the answer is 8.\n\nSample Input 2\n\n91\n\nSample Output 2\n\n3\n\nIf you give two banknotes of value 100, 1, and the clerk gives you back one banknote of value 10, a total of three banknotes are used.\n\nSample Input 3\n\n314159265358979323846264338327950288419716939937551058209749445923078164062862089986280348253421170\n\nSample Output 3\n\n243", "sample_input": "36\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02775", "source_text": "Score: 500 points\n\nProblem Statement\n\nIn the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \\dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. (Takoyaki is the name of a Japanese snack.)\n\nTo make the payment, you will choose some amount of money which is at least N and give it to the clerk. Then, the clerk gives you back the change, which is the amount of money you give minus N.\n\nWhat will be the minimum possible number of total banknotes used by you and the clerk, when both choose the combination of banknotes to minimize this count?\n\nAssume that you have sufficient numbers of banknotes, and so does the clerk.\n\nConstraints\n\nN is an integer between 1 and 10^{1,000,000} (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum possible number of total banknotes used by you and the clerk.\n\nSample Input 1\n\n36\n\nSample Output 1\n\n8\n\nIf you give four banknotes of value 10 each, and the clerk gives you back four banknotes of value 1 each, a total of eight banknotes are used.\n\nThe payment cannot be made with less than eight banknotes in total, so the answer is 8.\n\nSample Input 2\n\n91\n\nSample Output 2\n\n3\n\nIf you give two banknotes of value 100, 1, and the clerk gives you back one banknote of value 10, a total of three banknotes are used.\n\nSample Input 3\n\n314159265358979323846264338327950288419716939937551058209749445923078164062862089986280348253421170\n\nSample Output 3\n\n243", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 784, "cpu_time_ms": 1309, "memory_kb": 29380}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s260379742", "group_id": "codeNet:p02777", "input_text": "s, t = list(input().split())\na, b = list(map(int, input().split()))\nu = input()\nif u==s:\n\ta-=1\nelif u==t:\n\tb-=1\nprint(a,b)", "language": "Python", "metadata": {"date": 1594461387, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02777.html", "problem_id": "p02777", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02777/input.txt", "sample_output_relpath": "derived/input_output/data/p02777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02777/Python/s260379742.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s260379742", "user_id": "u693105608"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "s, t = list(input().split())\na, b = list(map(int, input().split()))\nu = input()\nif u==s:\n\ta-=1\nelif u==t:\n\tb-=1\nprint(a,b)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "sample_input": "red blue\n3 4\nred\n"}, "reference_outputs": ["2 4\n"], "source_document_id": "p02777", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 122, "cpu_time_ms": 29, "memory_kb": 9112}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s688787499", "group_id": "codeNet:p02777", "input_text": "S,T=input().split()\nA,B=map(int,input().split())\nU=input()\nprint(A-1,B) if U==S else print(A,B-1)", "language": "Python", "metadata": {"date": 1587230495, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02777.html", "problem_id": "p02777", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02777/input.txt", "sample_output_relpath": "derived/input_output/data/p02777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02777/Python/s688787499.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s688787499", "user_id": "u233183615"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "S,T=input().split()\nA,B=map(int,input().split())\nU=input()\nprint(A-1,B) if U==S else print(A,B-1)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "sample_input": "red blue\n3 4\nred\n"}, "reference_outputs": ["2 4\n"], "source_document_id": "p02777", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 97, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s256658974", "group_id": "codeNet:p02777", "input_text": "s,t=input().split()\na,b=map(int,input().split())\nu=input()\nif s==u:\n print(a-1,b)\nelse:\n print(a,b-1)\n", "language": "Python", "metadata": {"date": 1583331713, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02777.html", "problem_id": "p02777", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02777/input.txt", "sample_output_relpath": "derived/input_output/data/p02777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02777/Python/s256658974.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s256658974", "user_id": "u366959492"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "s,t=input().split()\na,b=map(int,input().split())\nu=input()\nif s==u:\n print(a-1,b)\nelse:\n print(a,b-1)\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "sample_input": "red blue\n3 4\nred\n"}, "reference_outputs": ["2 4\n"], "source_document_id": "p02777", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 108, "cpu_time_ms": 179, "memory_kb": 38256}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s006051681", "group_id": "codeNet:p02777", "input_text": "a=list(map(str,input().split()))\nb=list(map(int,input().split()))\nb[a.index(input())]-=1\nprint(*b)", "language": "Python", "metadata": {"date": 1583200806, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02777.html", "problem_id": "p02777", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02777/input.txt", "sample_output_relpath": "derived/input_output/data/p02777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02777/Python/s006051681.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s006051681", "user_id": "u092301301"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "a=list(map(str,input().split()))\nb=list(map(int,input().split()))\nb[a.index(input())]-=1\nprint(*b)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "sample_input": "red blue\n3 4\nred\n"}, "reference_outputs": ["2 4\n"], "source_document_id": "p02777", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 98, "cpu_time_ms": 181, "memory_kb": 38384}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s037265901", "group_id": "codeNet:p02778", "input_text": "print(\"x\"*len(input()))", "language": "Python", "metadata": {"date": 1594975953, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02778.html", "problem_id": "p02778", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02778/input.txt", "sample_output_relpath": "derived/input_output/data/p02778/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02778/Python/s037265901.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s037265901", "user_id": "u440478998"}, "prompt_components": {"gold_output": "xxxxxxx\n", "input_to_evaluate": "print(\"x\"*len(input()))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is a string S. Replace every character in S with x and print the result.\n\nConstraints\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nReplace every character in S with x and print the result.\n\nSample Input 1\n\nsardine\n\nSample Output 1\n\nxxxxxxx\n\nReplacing every character in S with x results in xxxxxxx.\n\nSample Input 2\n\nxxxx\n\nSample Output 2\n\nxxxx\n\nSample Input 3\n\ngone\n\nSample Output 3\n\nxxxx", "sample_input": "sardine\n"}, "reference_outputs": ["xxxxxxx\n"], "source_document_id": "p02778", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is a string S. Replace every character in S with x and print the result.\n\nConstraints\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nReplace every character in S with x and print the result.\n\nSample Input 1\n\nsardine\n\nSample Output 1\n\nxxxxxxx\n\nReplacing every character in S with x results in xxxxxxx.\n\nSample Input 2\n\nxxxx\n\nSample Output 2\n\nxxxx\n\nSample Input 3\n\ngone\n\nSample Output 3\n\nxxxx", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 23, "cpu_time_ms": 32, "memory_kb": 9076}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s171021309", "group_id": "codeNet:p02778", "input_text": "s = input()\nprint('x' * len(s))", "language": "Python", "metadata": {"date": 1581278673, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02778.html", "problem_id": "p02778", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02778/input.txt", "sample_output_relpath": "derived/input_output/data/p02778/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02778/Python/s171021309.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s171021309", "user_id": "u833509814"}, "prompt_components": {"gold_output": "xxxxxxx\n", "input_to_evaluate": "s = input()\nprint('x' * len(s))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is a string S. Replace every character in S with x and print the result.\n\nConstraints\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nReplace every character in S with x and print the result.\n\nSample Input 1\n\nsardine\n\nSample Output 1\n\nxxxxxxx\n\nReplacing every character in S with x results in xxxxxxx.\n\nSample Input 2\n\nxxxx\n\nSample Output 2\n\nxxxx\n\nSample Input 3\n\ngone\n\nSample Output 3\n\nxxxx", "sample_input": "sardine\n"}, "reference_outputs": ["xxxxxxx\n"], "source_document_id": "p02778", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is a string S. Replace every character in S with x and print the result.\n\nConstraints\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nReplace every character in S with x and print the result.\n\nSample Input 1\n\nsardine\n\nSample Output 1\n\nxxxxxxx\n\nReplacing every character in S with x results in xxxxxxx.\n\nSample Input 2\n\nxxxx\n\nSample Output 2\n\nxxxx\n\nSample Input 3\n\ngone\n\nSample Output 3\n\nxxxx", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 31, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s067496054", "group_id": "codeNet:p02779", "input_text": "n = int(input())\nprint(['NO','YES'][len(set(list(map(int, input().split()))))==n])", "language": "Python", "metadata": {"date": 1588417287, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02779.html", "problem_id": "p02779", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02779/input.txt", "sample_output_relpath": "derived/input_output/data/p02779/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02779/Python/s067496054.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s067496054", "user_id": "u252964975"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "n = int(input())\nprint(['NO','YES'][len(set(list(map(int, input().split()))))==n])", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a sequence of integers A_1, A_2, ..., A_N.\nIf its elements are pairwise distinct, print YES; otherwise, print NO.\n\nConstraints\n\n2 ≤ N ≤ 200000\n\n1 ≤ A_i ≤ 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\n\nOutput\n\nIf the elements of the sequence are pairwise distinct, print YES; otherwise, print NO.\n\nSample Input 1\n\n5\n2 6 1 4 5\n\nSample Output 1\n\nYES\n\nThe elements are pairwise distinct.\n\nSample Input 2\n\n6\n4 1 3 1 6 2\n\nSample Output 2\n\nNO\n\nThe second and fourth elements are identical.\n\nSample Input 3\n\n2\n10000000 10000000\n\nSample Output 3\n\nNO", "sample_input": "5\n2 6 1 4 5\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p02779", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a sequence of integers A_1, A_2, ..., A_N.\nIf its elements are pairwise distinct, print YES; otherwise, print NO.\n\nConstraints\n\n2 ≤ N ≤ 200000\n\n1 ≤ A_i ≤ 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\n\nOutput\n\nIf the elements of the sequence are pairwise distinct, print YES; otherwise, print NO.\n\nSample Input 1\n\n5\n2 6 1 4 5\n\nSample Output 1\n\nYES\n\nThe elements are pairwise distinct.\n\nSample Input 2\n\n6\n4 1 3 1 6 2\n\nSample Output 2\n\nNO\n\nThe second and fourth elements are identical.\n\nSample Input 3\n\n2\n10000000 10000000\n\nSample Output 3\n\nNO", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 82, "cpu_time_ms": 85, "memory_kb": 25172}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s265135593", "group_id": "codeNet:p02780", "input_text": "from itertools import accumulate\nN, K = map(int, input().split())\nP = [0]+list(map(int, input().split()))\nPsum = list(accumulate(P))\ntotal = 0\nfor i in range(K, N+1):\n if Psum[i]-Psum[i-K] > total:\n total = Psum[i]-Psum[i-K]\n index = i\nans = 0\nfor i in range(index, index-K, -1):\n ans += (P[i]+1)*0.5\n\nprint(ans)\n", "language": "Python", "metadata": {"date": 1593522403, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02780.html", "problem_id": "p02780", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02780/input.txt", "sample_output_relpath": "derived/input_output/data/p02780/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02780/Python/s265135593.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s265135593", "user_id": "u815763296"}, "prompt_components": {"gold_output": "7.000000000000\n", "input_to_evaluate": "from itertools import accumulate\nN, K = map(int, input().split())\nP = [0]+list(map(int, input().split()))\nPsum = list(accumulate(P))\ntotal = 0\nfor i in range(K, N+1):\n if Psum[i]-Psum[i-K] > total:\n total = Psum[i]-Psum[i-K]\n index = i\nans = 0\nfor i in range(index, index-K, -1):\n ans += (P[i]+1)*0.5\n\nprint(ans)\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "sample_input": "5 3\n1 2 2 4 5\n"}, "reference_outputs": ["7.000000000000\n"], "source_document_id": "p02780", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 333, "cpu_time_ms": 118, "memory_kb": 32124}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s555833035", "group_id": "codeNet:p02780", "input_text": "N,K = map(int,input().split())\nruiseki = [0]*(N+1)\nnow = 0\nmaximum = -999999999\nans = 0\np = list(map(int,input().split()))\nfor i in range(N):\n now += p[i]\n ruiseki[i+1] = now\nfor i in range(0,N-K+1):\n P = ruiseki[i+K]-ruiseki[i]\n if P > maximum:\n maximum = P\n Q = p[i:i+K]\nfor i in range(len(Q)):\n ans += (0.5*Q[i]*(Q[i]+1))/Q[i]\nprint(ans)", "language": "Python", "metadata": {"date": 1586545895, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02780.html", "problem_id": "p02780", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02780/input.txt", "sample_output_relpath": "derived/input_output/data/p02780/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02780/Python/s555833035.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s555833035", "user_id": "u556589653"}, "prompt_components": {"gold_output": "7.000000000000\n", "input_to_evaluate": "N,K = map(int,input().split())\nruiseki = [0]*(N+1)\nnow = 0\nmaximum = -999999999\nans = 0\np = list(map(int,input().split()))\nfor i in range(N):\n now += p[i]\n ruiseki[i+1] = now\nfor i in range(0,N-K+1):\n P = ruiseki[i+K]-ruiseki[i]\n if P > maximum:\n maximum = P\n Q = p[i:i+K]\nfor i in range(len(Q)):\n ans += (0.5*Q[i]*(Q[i]+1))/Q[i]\nprint(ans)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "sample_input": "5 3\n1 2 2 4 5\n"}, "reference_outputs": ["7.000000000000\n"], "source_document_id": "p02780", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 369, "cpu_time_ms": 451, "memory_kb": 26912}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s849541724", "group_id": "codeNet:p02780", "input_text": "N,K=map(int,input().split(\" \"))\np_list=list(map(int,input().split(\" \")))\ndef expect(i):\n return 0.5*(p_list[i]+1)\n\ne_list=[expect(i) for i in range(N)]\n\nexpect_list=[sum(e_list[i:K+i]) for i in range(0,N-K+1+1)]\n\nprint(max(expect_list))", "language": "Python", "metadata": {"date": 1582033797, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02780.html", "problem_id": "p02780", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02780/input.txt", "sample_output_relpath": "derived/input_output/data/p02780/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02780/Python/s849541724.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s849541724", "user_id": "u334928930"}, "prompt_components": {"gold_output": "7.000000000000\n", "input_to_evaluate": "N,K=map(int,input().split(\" \"))\np_list=list(map(int,input().split(\" \")))\ndef expect(i):\n return 0.5*(p_list[i]+1)\n\ne_list=[expect(i) for i in range(N)]\n\nexpect_list=[sum(e_list[i:K+i]) for i in range(0,N-K+1+1)]\n\nprint(max(expect_list))", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "sample_input": "5 3\n1 2 2 4 5\n"}, "reference_outputs": ["7.000000000000\n"], "source_document_id": "p02780", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 239, "cpu_time_ms": 2105, "memory_kb": 25060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s736965062", "group_id": "codeNet:p02780", "input_text": "import java.util.*;\n\n//update 2020/1/1 23:01\n\npublic class Main{\n\n static Scanner sc = new Scanner(System.in);\n static StringBuilder sb = new StringBuilder();\n\n public static void main(String[] args) {\n\n int n = nextInt();\n int k = nextInt();\n double[] p = new double[n];\n for(int i=0;i=97){\n c -= 32;\n }\n return String.valueOf(c);\n }\n */\n\n static String toSmall(String s){\n return s.toLowerCase();\n }\n\n static String toBig(String s){\n return s.toUpperCase();\n }\n\n static String next(){\n return sc.next();\n }\n\n static int nextInt(){\n return Integer.parseInt(sc.next());\n }\n\n static long nextLong(){\n return Long.parseLong(sc.next());\n }\n\n static double nextDouble(){\n return Double.parseDouble(sc.next());\n }\n\n static String[] splitString(String s){\n return s.split(\"\");\n }\n\n static char[] splitChar(String s){\n return s.toCharArray();\n }\n\n static int charToInt(char a){\n return a - 48;\n }\n\n////////////////////////////////////////////\n public static int max(int[] a){\n int lng = a.length;\n int max = a[0];\n for(int i=1;i=97){\n c -= 32;\n }\n return String.valueOf(c);\n }\n */\n\n static String toSmall(String s){\n return s.toLowerCase();\n }\n\n static String toBig(String s){\n return s.toUpperCase();\n }\n\n static String next(){\n return sc.next();\n }\n\n static int nextInt(){\n return Integer.parseInt(sc.next());\n }\n\n static long nextLong(){\n return Long.parseLong(sc.next());\n }\n\n static double nextDouble(){\n return Double.parseDouble(sc.next());\n }\n\n static String[] splitString(String s){\n return s.split(\"\");\n }\n\n static char[] splitChar(String s){\n return s.toCharArray();\n }\n\n static int charToInt(char a){\n return a - 48;\n }\n\n////////////////////////////////////////////\n public static int max(int[] a){\n int lng = a.length;\n int max = a[0];\n for(int i=1;i sum(maxs):\n maxs = vs\n\nresult = 0\nfor m in maxs:\n result += (m + 1)/2\nprint(result)", "language": "Python", "metadata": {"date": 1581280942, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02780.html", "problem_id": "p02780", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02780/input.txt", "sample_output_relpath": "derived/input_output/data/p02780/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02780/Python/s986043770.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s986043770", "user_id": "u121700322"}, "prompt_components": {"gold_output": "7.000000000000\n", "input_to_evaluate": "n, k = map(int, input().split())\nps = list(map(int, input().split()))\n\nmaxs = [0]\n# print(ps)\nfor i in range(n-k + 1):\n\n vs = ps[i:i+k]\n # print(i, vs)\n if sum(vs) > sum(maxs):\n maxs = vs\n\nresult = 0\nfor m in maxs:\n result += (m + 1)/2\nprint(result)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "sample_input": "5 3\n1 2 2 4 5\n"}, "reference_outputs": ["7.000000000000\n"], "source_document_id": "p02780", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 268, "cpu_time_ms": 2104, "memory_kb": 25060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s823981674", "group_id": "codeNet:p02780", "input_text": "n,k = map(int,input().split())\nl = list(map(int,input().split()))\nans = 0\ntmp = sum(l[:k])\nfor i in range(k,n):\n tmp += l[i]-l[i-k]\n ans = max(ans, tmp)\nprint((ans+k)/2)", "language": "Python", "metadata": {"date": 1581280486, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02780.html", "problem_id": "p02780", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02780/input.txt", "sample_output_relpath": "derived/input_output/data/p02780/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02780/Python/s823981674.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s823981674", "user_id": "u133936772"}, "prompt_components": {"gold_output": "7.000000000000\n", "input_to_evaluate": "n,k = map(int,input().split())\nl = list(map(int,input().split()))\nans = 0\ntmp = sum(l[:k])\nfor i in range(k,n):\n tmp += l[i]-l[i-k]\n ans = max(ans, tmp)\nprint((ans+k)/2)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "sample_input": "5 3\n1 2 2 4 5\n"}, "reference_outputs": ["7.000000000000\n"], "source_document_id": "p02780", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 171, "cpu_time_ms": 154, "memory_kb": 24816}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s468507486", "group_id": "codeNet:p02780", "input_text": "n, k = (int(i) for i in input().split())\np = [int(i) for i in input().split()]\n\nfor i in range(n):\n p[i] = (p[i]+1) / 2\n_max = -1\nfor i in range(n-k+1):\n _sum = 0\n for j in range(k):\n _sum += p[i+j]\n _max = max(_sum, _max)\n\nprint(_max)\n \n \n ", "language": "Python", "metadata": {"date": 1581279771, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02780.html", "problem_id": "p02780", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02780/input.txt", "sample_output_relpath": "derived/input_output/data/p02780/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02780/Python/s468507486.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s468507486", "user_id": "u058592821"}, "prompt_components": {"gold_output": "7.000000000000\n", "input_to_evaluate": "n, k = (int(i) for i in input().split())\np = [int(i) for i in input().split()]\n\nfor i in range(n):\n p[i] = (p[i]+1) / 2\n_max = -1\nfor i in range(n-k+1):\n _sum = 0\n for j in range(k):\n _sum += p[i+j]\n _max = max(_sum, _max)\n\nprint(_max)\n \n \n ", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "sample_input": "5 3\n1 2 2 4 5\n"}, "reference_outputs": ["7.000000000000\n"], "source_document_id": "p02780", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 280, "cpu_time_ms": 2104, "memory_kb": 24676}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s575121468", "group_id": "codeNet:p02781", "input_text": "s = input()\nl = len(s)\nK = int(input())\ndef com(x,y):\n child = 1\n mother = 1\n for i in range(y):\n child = child * (x-i)\n mother = mother * (i+1)\n if x == 1 and y >=2:\n return 0\n else: \n return int(child / mother)\ntasumae = (9**K)*com(l-1,K) #与えられた数字よりも一桁少ない999999999・・・までの個数\nli = list(s)\ndoko = []\nif l < K:\n print(0)\n exit()\nif K == 1:\n print(tasumae+int(li[0]))\n exit()\nfor i in range(1,l):\n if li[i] != \"0\":\n doko.append(i)\nif K == 2:\n if not doko:\n print(tasumae)\n exit()\n ans = int(li[doko[0]]) + 9*(l-1-doko[0]) + tasumae + (int(li[0])-1)*com(l-1,1)*9\n print(ans)\n exit()\nif len(doko) <= 1:\n print(tasumae)\n exit()\nans = (int(li[0])-1)*com(l-1,2)*(9**2) + (int(li[doko[0]])-1) * 9 * (l-1-doko[0]) + int(li[doko[1]]) + 9*(l-1-doko[1]) + com(l-1-doko[0],2)*(9**2) + tasumae\nprint(ans)", "language": "Python", "metadata": {"date": 1587491727, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02781.html", "problem_id": "p02781", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02781/input.txt", "sample_output_relpath": "derived/input_output/data/p02781/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02781/Python/s575121468.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s575121468", "user_id": "u708019102"}, "prompt_components": {"gold_output": "19\n", "input_to_evaluate": "s = input()\nl = len(s)\nK = int(input())\ndef com(x,y):\n child = 1\n mother = 1\n for i in range(y):\n child = child * (x-i)\n mother = mother * (i+1)\n if x == 1 and y >=2:\n return 0\n else: \n return int(child / mother)\ntasumae = (9**K)*com(l-1,K) #与えられた数字よりも一桁少ない999999999・・・までの個数\nli = list(s)\ndoko = []\nif l < K:\n print(0)\n exit()\nif K == 1:\n print(tasumae+int(li[0]))\n exit()\nfor i in range(1,l):\n if li[i] != \"0\":\n doko.append(i)\nif K == 2:\n if not doko:\n print(tasumae)\n exit()\n ans = int(li[doko[0]]) + 9*(l-1-doko[0]) + tasumae + (int(li[0])-1)*com(l-1,1)*9\n print(ans)\n exit()\nif len(doko) <= 1:\n print(tasumae)\n exit()\nans = (int(li[0])-1)*com(l-1,2)*(9**2) + (int(li[doko[0]])-1) * 9 * (l-1-doko[0]) + int(li[doko[1]]) + 9*(l-1-doko[1]) + com(l-1-doko[0],2)*(9**2) + tasumae\nprint(ans)", "problem_context": "Score : 500 points\n\nProblem Statement\n\nFind the number of integers between 1 and N (inclusive) that contains exactly K non-zero digits when written in base ten.\n\nConstraints\n\n1 \\leq N < 10^{100}\n\n1 \\leq K \\leq 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nK\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n100\n1\n\nSample Output 1\n\n19\n\nThe following 19 integers satisfy the condition:\n\n1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100\n\nSample Input 2\n\n25\n2\n\nSample Output 2\n\n14\n\nThe following 14 integers satisfy the condition:\n\n11,12,13,14,15,16,17,18,19,21,22,23,24,25\n\nSample Input 3\n\n314159\n2\n\nSample Output 3\n\n937\n\nSample Input 4\n\n9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n3\n\nSample Output 4\n\n117879300", "sample_input": "100\n1\n"}, "reference_outputs": ["19\n"], "source_document_id": "p02781", "source_text": "Score : 500 points\n\nProblem Statement\n\nFind the number of integers between 1 and N (inclusive) that contains exactly K non-zero digits when written in base ten.\n\nConstraints\n\n1 \\leq N < 10^{100}\n\n1 \\leq K \\leq 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nK\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n100\n1\n\nSample Output 1\n\n19\n\nThe following 19 integers satisfy the condition:\n\n1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100\n\nSample Input 2\n\n25\n2\n\nSample Output 2\n\n14\n\nThe following 14 integers satisfy the condition:\n\n11,12,13,14,15,16,17,18,19,21,22,23,24,25\n\nSample Input 3\n\n314159\n2\n\nSample Output 3\n\n937\n\nSample Input 4\n\n9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n3\n\nSample Output 4\n\n117879300", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 934, "cpu_time_ms": 20, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s610421553", "group_id": "codeNet:p02781", "input_text": "import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\ndef input(): return sys.stdin.readline().strip()\ndef STR(): return input()\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef S_MAP(): return map(str, input().split())\ndef LIST(): return list(map(int, input().split()))\ndef S_LIST(): return list(map(str, input().split()))\nsys.setrecursionlimit(10 ** 9)\ninf = sys.maxsize\nmod = 10 ** 9 + 7\n\nn = [int(i) for i in STR()]\nk = INT()\nl = len(n)\ndp = [[[0, 0] for _ in range(l)] for _ in range(k + 1)] #dp[i個の0以外][j桁目まで][0:未満 1:未決定]\ndp[0][0][0] = 1 #0\ndp[1][0][1] = 1 #n[0]\ndp[1][0][0] = n[0] - 1 #1からn[0] - 1\nfor j in range(1, l):\n dp[0][j][0] = dp[0][j - 1][0] #全部0\n\n for i in range(1, k + 1):\n dp[i][j][0] += dp[i - 1][j - 1][0] * 9 #0以外i-1個に0以外を\n dp[i][j][0] += dp[i - 1][j - 1][1] * (n[j] - 1) if n[j] > 0 else 0 #0以外i個の未満未決定にn[j]未満の数を\n dp[i][j][0] += dp[i][j - 1][0] #0以外i個かつ未満に0を\n dp[i][j][0] += dp[i][j - 1][1] if n[j] > 0 else 0 #0以外i個かつ未満未決定に0を\n\n dp[i][j][1] += dp[i][j - 1][1] if n[j] == 0 else 0 #0以外i個の未満未決定にn[j]を\n dp[i][j][1] += dp[i - 1][j - 1][1] if n[j] > 0 else 0 #0以外i-1個の未満未決定にn[j]を\nprint(sum(dp[k][l - 1]))", "language": "Python", "metadata": {"date": 1585206862, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02781.html", "problem_id": "p02781", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02781/input.txt", "sample_output_relpath": "derived/input_output/data/p02781/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02781/Python/s610421553.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s610421553", "user_id": "u287500079"}, "prompt_components": {"gold_output": "19\n", "input_to_evaluate": "import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\ndef input(): return sys.stdin.readline().strip()\ndef STR(): return input()\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef S_MAP(): return map(str, input().split())\ndef LIST(): return list(map(int, input().split()))\ndef S_LIST(): return list(map(str, input().split()))\nsys.setrecursionlimit(10 ** 9)\ninf = sys.maxsize\nmod = 10 ** 9 + 7\n\nn = [int(i) for i in STR()]\nk = INT()\nl = len(n)\ndp = [[[0, 0] for _ in range(l)] for _ in range(k + 1)] #dp[i個の0以外][j桁目まで][0:未満 1:未決定]\ndp[0][0][0] = 1 #0\ndp[1][0][1] = 1 #n[0]\ndp[1][0][0] = n[0] - 1 #1からn[0] - 1\nfor j in range(1, l):\n dp[0][j][0] = dp[0][j - 1][0] #全部0\n\n for i in range(1, k + 1):\n dp[i][j][0] += dp[i - 1][j - 1][0] * 9 #0以外i-1個に0以外を\n dp[i][j][0] += dp[i - 1][j - 1][1] * (n[j] - 1) if n[j] > 0 else 0 #0以外i個の未満未決定にn[j]未満の数を\n dp[i][j][0] += dp[i][j - 1][0] #0以外i個かつ未満に0を\n dp[i][j][0] += dp[i][j - 1][1] if n[j] > 0 else 0 #0以外i個かつ未満未決定に0を\n\n dp[i][j][1] += dp[i][j - 1][1] if n[j] == 0 else 0 #0以外i個の未満未決定にn[j]を\n dp[i][j][1] += dp[i - 1][j - 1][1] if n[j] > 0 else 0 #0以外i-1個の未満未決定にn[j]を\nprint(sum(dp[k][l - 1]))", "problem_context": "Score : 500 points\n\nProblem Statement\n\nFind the number of integers between 1 and N (inclusive) that contains exactly K non-zero digits when written in base ten.\n\nConstraints\n\n1 \\leq N < 10^{100}\n\n1 \\leq K \\leq 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nK\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n100\n1\n\nSample Output 1\n\n19\n\nThe following 19 integers satisfy the condition:\n\n1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100\n\nSample Input 2\n\n25\n2\n\nSample Output 2\n\n14\n\nThe following 14 integers satisfy the condition:\n\n11,12,13,14,15,16,17,18,19,21,22,23,24,25\n\nSample Input 3\n\n314159\n2\n\nSample Output 3\n\n937\n\nSample Input 4\n\n9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n3\n\nSample Output 4\n\n117879300", "sample_input": "100\n1\n"}, "reference_outputs": ["19\n"], "source_document_id": "p02781", "source_text": "Score : 500 points\n\nProblem Statement\n\nFind the number of integers between 1 and N (inclusive) that contains exactly K non-zero digits when written in base ten.\n\nConstraints\n\n1 \\leq N < 10^{100}\n\n1 \\leq K \\leq 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nK\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n100\n1\n\nSample Output 1\n\n19\n\nThe following 19 integers satisfy the condition:\n\n1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100\n\nSample Input 2\n\n25\n2\n\nSample Output 2\n\n14\n\nThe following 14 integers satisfy the condition:\n\n11,12,13,14,15,16,17,18,19,21,22,23,24,25\n\nSample Input 3\n\n314159\n2\n\nSample Output 3\n\n937\n\nSample Input 4\n\n9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n3\n\nSample Output 4\n\n117879300", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1687, "cpu_time_ms": 323, "memory_kb": 62060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s110020963", "group_id": "codeNet:p02781", "input_text": "n=input()\nk=input()\nsum=0\nfor i in range(1,k+1):\n a=list(str(i))\n if list.count(0)=k:\n sum+=1\nprint(sum) ", "language": "Python", "metadata": {"date": 1584736005, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02781.html", "problem_id": "p02781", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02781/input.txt", "sample_output_relpath": "derived/input_output/data/p02781/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02781/Python/s110020963.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s110020963", "user_id": "u106778233"}, "prompt_components": {"gold_output": "19\n", "input_to_evaluate": "n=input()\nk=input()\nsum=0\nfor i in range(1,k+1):\n a=list(str(i))\n if list.count(0)=k:\n sum+=1\nprint(sum) ", "problem_context": "Score : 500 points\n\nProblem Statement\n\nFind the number of integers between 1 and N (inclusive) that contains exactly K non-zero digits when written in base ten.\n\nConstraints\n\n1 \\leq N < 10^{100}\n\n1 \\leq K \\leq 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nK\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n100\n1\n\nSample Output 1\n\n19\n\nThe following 19 integers satisfy the condition:\n\n1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100\n\nSample Input 2\n\n25\n2\n\nSample Output 2\n\n14\n\nThe following 14 integers satisfy the condition:\n\n11,12,13,14,15,16,17,18,19,21,22,23,24,25\n\nSample Input 3\n\n314159\n2\n\nSample Output 3\n\n937\n\nSample Input 4\n\n9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n3\n\nSample Output 4\n\n117879300", "sample_input": "100\n1\n"}, "reference_outputs": ["19\n"], "source_document_id": "p02781", "source_text": "Score : 500 points\n\nProblem Statement\n\nFind the number of integers between 1 and N (inclusive) that contains exactly K non-zero digits when written in base ten.\n\nConstraints\n\n1 \\leq N < 10^{100}\n\n1 \\leq K \\leq 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nK\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n100\n1\n\nSample Output 1\n\n19\n\nThe following 19 integers satisfy the condition:\n\n1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100\n\nSample Input 2\n\n25\n2\n\nSample Output 2\n\n14\n\nThe following 14 integers satisfy the condition:\n\n11,12,13,14,15,16,17,18,19,21,22,23,24,25\n\nSample Input 3\n\n314159\n2\n\nSample Output 3\n\n937\n\nSample Input 4\n\n9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n3\n\nSample Output 4\n\n117879300", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 120, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s694520828", "group_id": "codeNet:p02781", "input_text": "def factorial(a):\n r = 1\n for i in range(a):\n r *= i+1\n return r\n\ndef combinations(a, b):\n if a>=0 and b>=0 and a >= b:\n return pow(9, b) * factorial(a) // factorial(b) // factorial(a-b)\n else:\n return 0\n\ndef count(m, a, b):\n # return the count of numbers in range [0, m x 10^a] with b non zero digitals\n ## the count of numbers in range [0, m x 10^a) with b non zero digitals\n r = combinations(a-1, b) + (m-1) * combinations(a-1, b-1)\n if b == 1:\n ## m x 10^a\n r += 1\n return r\n\nN = int(input())\nK = int(input())\n\ndigit = list(map(int, str(N)))\nM = len(digit)\n\nC = 0\nfor i in range(K):\n C += count(digit[i], M-i, K-i)\n\nprint(C) ", "language": "Python", "metadata": {"date": 1581550132, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02781.html", "problem_id": "p02781", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02781/input.txt", "sample_output_relpath": "derived/input_output/data/p02781/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02781/Python/s694520828.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s694520828", "user_id": "u292746386"}, "prompt_components": {"gold_output": "19\n", "input_to_evaluate": "def factorial(a):\n r = 1\n for i in range(a):\n r *= i+1\n return r\n\ndef combinations(a, b):\n if a>=0 and b>=0 and a >= b:\n return pow(9, b) * factorial(a) // factorial(b) // factorial(a-b)\n else:\n return 0\n\ndef count(m, a, b):\n # return the count of numbers in range [0, m x 10^a] with b non zero digitals\n ## the count of numbers in range [0, m x 10^a) with b non zero digitals\n r = combinations(a-1, b) + (m-1) * combinations(a-1, b-1)\n if b == 1:\n ## m x 10^a\n r += 1\n return r\n\nN = int(input())\nK = int(input())\n\ndigit = list(map(int, str(N)))\nM = len(digit)\n\nC = 0\nfor i in range(K):\n C += count(digit[i], M-i, K-i)\n\nprint(C) ", "problem_context": "Score : 500 points\n\nProblem Statement\n\nFind the number of integers between 1 and N (inclusive) that contains exactly K non-zero digits when written in base ten.\n\nConstraints\n\n1 \\leq N < 10^{100}\n\n1 \\leq K \\leq 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nK\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n100\n1\n\nSample Output 1\n\n19\n\nThe following 19 integers satisfy the condition:\n\n1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100\n\nSample Input 2\n\n25\n2\n\nSample Output 2\n\n14\n\nThe following 14 integers satisfy the condition:\n\n11,12,13,14,15,16,17,18,19,21,22,23,24,25\n\nSample Input 3\n\n314159\n2\n\nSample Output 3\n\n937\n\nSample Input 4\n\n9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n3\n\nSample Output 4\n\n117879300", "sample_input": "100\n1\n"}, "reference_outputs": ["19\n"], "source_document_id": "p02781", "source_text": "Score : 500 points\n\nProblem Statement\n\nFind the number of integers between 1 and N (inclusive) that contains exactly K non-zero digits when written in base ten.\n\nConstraints\n\n1 \\leq N < 10^{100}\n\n1 \\leq K \\leq 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nK\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n100\n1\n\nSample Output 1\n\n19\n\nThe following 19 integers satisfy the condition:\n\n1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100\n\nSample Input 2\n\n25\n2\n\nSample Output 2\n\n14\n\nThe following 14 integers satisfy the condition:\n\n11,12,13,14,15,16,17,18,19,21,22,23,24,25\n\nSample Input 3\n\n314159\n2\n\nSample Output 3\n\n937\n\nSample Input 4\n\n9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n3\n\nSample Output 4\n\n117879300", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 700, "cpu_time_ms": 18, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s462036594", "group_id": "codeNet:p02783", "input_text": "import math\nH,A=map(int, input().split())\nprint(math.ceil(H/A))", "language": "Python", "metadata": {"date": 1594622141, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Python/s462036594.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s462036594", "user_id": "u799428010"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import math\nH,A=map(int, input().split())\nprint(math.ceil(H/A))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 63, "cpu_time_ms": 23, "memory_kb": 9116}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s281064655", "group_id": "codeNet:p02783", "input_text": "h,a = list(map(int,input().split()))\nans = 0\nsyou = h // a\nmod = h % a\nans = syou\nif(mod != 0):\n ans += 1\nprint(ans)", "language": "Python", "metadata": {"date": 1582400389, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Python/s281064655.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s281064655", "user_id": "u178304274"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "h,a = list(map(int,input().split()))\nans = 0\nsyou = h // a\nmod = h % a\nans = syou\nif(mod != 0):\n ans += 1\nprint(ans)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 119, "cpu_time_ms": 18, "memory_kb": 3316}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s490031831", "group_id": "codeNet:p02783", "input_text": "H, A = map(int, input().split())\n\na = int(H/A)\nb = int(H%A)\n\nif b==2:\n b+=1\n\nprint(b)", "language": "Python", "metadata": {"date": 1580706694, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Python/s490031831.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s490031831", "user_id": "u507237474"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "H, A = map(int, input().split())\n\na = int(H/A)\nb = int(H%A)\n\nif b==2:\n b+=1\n\nprint(b)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 86, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s467404430", "group_id": "codeNet:p02783", "input_text": "h, a = map(int, input().split())\nprint(int((h-0.1)//a + 1))", "language": "Python", "metadata": {"date": 1580069324, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Python/s467404430.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s467404430", "user_id": "u243572357"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "h, a = map(int, input().split())\nprint(int((h-0.1)//a + 1))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 59, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s976914844", "group_id": "codeNet:p02784", "input_text": "H,N = list(map(int,input().split()))\nA = list(map(int,input().split()))\nif H <= sum(A):\n print('Yes')\nelse:\n print('No')", "language": "Python", "metadata": {"date": 1584645290, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02784.html", "problem_id": "p02784", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02784/input.txt", "sample_output_relpath": "derived/input_output/data/p02784/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02784/Python/s976914844.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s976914844", "user_id": "u514118270"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "H,N = list(map(int,input().split()))\nA = list(map(int,input().split()))\nif H <= sum(A):\n print('Yes')\nelse:\n print('No')", "problem_context": "Score : 200 points\n\nProblem Statement\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's health.\n\nRaccoon wins when the monster's health becomes 0 or below.\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH N\nA_1 A_2 ... A_N\n\nOutput\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n10 3\n4 5 6\n\nSample Output 1\n\nYes\n\nThe monster's health will become 0 or below after, for example, using the second and third moves.\n\nSample Input 2\n\n20 3\n4 5 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n210 5\n31 41 59 26 53\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n211 5\n31 41 59 26 53\n\nSample Output 4\n\nNo", "sample_input": "10 3\n4 5 6\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02784", "source_text": "Score : 200 points\n\nProblem Statement\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's health.\n\nRaccoon wins when the monster's health becomes 0 or below.\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH N\nA_1 A_2 ... A_N\n\nOutput\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n10 3\n4 5 6\n\nSample Output 1\n\nYes\n\nThe monster's health will become 0 or below after, for example, using the second and third moves.\n\nSample Input 2\n\n20 3\n4 5 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n210 5\n31 41 59 26 53\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n211 5\n31 41 59 26 53\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 122, "cpu_time_ms": 41, "memory_kb": 13964}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s903784171", "group_id": "codeNet:p02784", "input_text": "def win(h,n,arr):\n \tcnt=0\n \tfor i in range(n):\n \th-=arr[i]\n if h<=0:\n cnt=1\n return cnt\n \nh=int(input())\nn=int(input())\narr=[]\nfor i in range(n):\n a=int(input())\n arr.append(a)\nl=win(h,n,arr)\nif l=1:\n print(\"yes\")\nelse\n\tprint(\"no\")", "language": "Python", "metadata": {"date": 1580070027, "filename_ext": "py", "original_language": "Python (2.7.6)", "problem_description_relpath": "problem_descriptions/p02784.html", "problem_id": "p02784", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02784/input.txt", "sample_output_relpath": "derived/input_output/data/p02784/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02784/Python/s903784171.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s903784171", "user_id": "u523041487"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "def win(h,n,arr):\n \tcnt=0\n \tfor i in range(n):\n \th-=arr[i]\n if h<=0:\n cnt=1\n return cnt\n \nh=int(input())\nn=int(input())\narr=[]\nfor i in range(n):\n a=int(input())\n arr.append(a)\nl=win(h,n,arr)\nif l=1:\n print(\"yes\")\nelse\n\tprint(\"no\")", "problem_context": "Score : 200 points\n\nProblem Statement\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's health.\n\nRaccoon wins when the monster's health becomes 0 or below.\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH N\nA_1 A_2 ... A_N\n\nOutput\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n10 3\n4 5 6\n\nSample Output 1\n\nYes\n\nThe monster's health will become 0 or below after, for example, using the second and third moves.\n\nSample Input 2\n\n20 3\n4 5 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n210 5\n31 41 59 26 53\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n211 5\n31 41 59 26 53\n\nSample Output 4\n\nNo", "sample_input": "10 3\n4 5 6\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02784", "source_text": "Score : 200 points\n\nProblem Statement\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's health.\n\nRaccoon wins when the monster's health becomes 0 or below.\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH N\nA_1 A_2 ... A_N\n\nOutput\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n10 3\n4 5 6\n\nSample Output 1\n\nYes\n\nThe monster's health will become 0 or below after, for example, using the second and third moves.\n\nSample Input 2\n\n20 3\n4 5 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n210 5\n31 41 59 26 53\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n211 5\n31 41 59 26 53\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 251, "cpu_time_ms": 10, "memory_kb": 2568}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s341269607", "group_id": "codeNet:p02785", "input_text": "N,K = map(int,input().split())\nif N<=K :\n print(0)\nelse :\n H = list(map(int,input().split()))\n H.sort()\n if 0 0:\n dp[i] = min(dp[i], dp[i - x] + y)\n else:\n dp[i] = min(dp[i], y)\n\nprint(dp[h])\n", "language": "Python", "metadata": {"date": 1580486430, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02787.html", "problem_id": "p02787", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02787/input.txt", "sample_output_relpath": "derived/input_output/data/p02787/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02787/Python/s607295408.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s607295408", "user_id": "u226873514"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "h, n = map(int, input().split())\nab = [list(map(int, input().split())) for _ in range(n)]\na = [_[0] for _ in ab]\n\ninf = float('inf')\ndp = [inf] * (h + max(a) + 1)\n\nfor i in range(1, len(dp)):\n for x, y in ab:\n if i - x > 0:\n dp[i] = min(dp[i], dp[i - x] + y)\n else:\n dp[i] = min(dp[i], y)\n\nprint(dp[h])\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nIbis is fighting with a monster.\n\nThe health of the monster is H.\n\nIbis can cast N kinds of spells. Casting the i-th spell decreases the monster's health by A_i, at the cost of B_i Magic Points.\n\nThe same spell can be cast multiple times. There is no way other than spells to decrease the monster's health.\n\nIbis wins when the health of the monster becomes 0 or below.\n\nFind the minimum total Magic Points that have to be consumed before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq N \\leq 10^3\n\n1 \\leq A_i \\leq 10^4\n\n1 \\leq B_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH N\nA_1 B_1\n:\nA_N B_N\n\nOutput\n\nPrint the minimum total Magic Points that have to be consumed before winning.\n\nSample Input 1\n\n9 3\n8 3\n4 2\n2 1\n\nSample Output 1\n\n4\n\nFirst, let us cast the first spell to decrease the monster's health by 8, at the cost of 3 Magic Points. The monster's health is now 1.\n\nThen, cast the third spell to decrease the monster's health by 2, at the cost of 1 Magic Point. The monster's health is now -1.\n\nIn this way, we can win at the total cost of 4 Magic Points.\n\nSample Input 2\n\n100 6\n1 1\n2 3\n3 9\n4 27\n5 81\n6 243\n\nSample Output 2\n\n100\n\nIt is optimal to cast the first spell 100 times.\n\nSample Input 3\n\n9999 10\n540 7550\n691 9680\n700 9790\n510 7150\n415 5818\n551 7712\n587 8227\n619 8671\n588 8228\n176 2461\n\nSample Output 3\n\n139815", "sample_input": "9 3\n8 3\n4 2\n2 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02787", "source_text": "Score : 500 points\n\nProblem Statement\n\nIbis is fighting with a monster.\n\nThe health of the monster is H.\n\nIbis can cast N kinds of spells. Casting the i-th spell decreases the monster's health by A_i, at the cost of B_i Magic Points.\n\nThe same spell can be cast multiple times. There is no way other than spells to decrease the monster's health.\n\nIbis wins when the health of the monster becomes 0 or below.\n\nFind the minimum total Magic Points that have to be consumed before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq N \\leq 10^3\n\n1 \\leq A_i \\leq 10^4\n\n1 \\leq B_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH N\nA_1 B_1\n:\nA_N B_N\n\nOutput\n\nPrint the minimum total Magic Points that have to be consumed before winning.\n\nSample Input 1\n\n9 3\n8 3\n4 2\n2 1\n\nSample Output 1\n\n4\n\nFirst, let us cast the first spell to decrease the monster's health by 8, at the cost of 3 Magic Points. The monster's health is now 1.\n\nThen, cast the third spell to decrease the monster's health by 2, at the cost of 1 Magic Point. The monster's health is now -1.\n\nIn this way, we can win at the total cost of 4 Magic Points.\n\nSample Input 2\n\n100 6\n1 1\n2 3\n3 9\n4 27\n5 81\n6 243\n\nSample Output 2\n\n100\n\nIt is optimal to cast the first spell 100 times.\n\nSample Input 3\n\n9999 10\n540 7550\n691 9680\n700 9790\n510 7150\n415 5818\n551 7712\n587 8227\n619 8671\n588 8228\n176 2461\n\nSample Output 3\n\n139815", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 551, "memory_kb": 42604}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s269554355", "group_id": "codeNet:p02788", "input_text": "from bisect import bisect_right\nimport sys\ninput=sys.stdin.readline\n \n \nclass LazySegTree():\n def __init__(self, N):\n self.INF = 2**31-1\n self.LV = (N-1).bit_length()\n self.N0 = 2**self.LV\n self.data = [0]*(2*self.N0)\n self.lazy = [0]*(2*self.N0)\n \n def gindex(self, l, r):\n L = (l + self.N0) >> 1; R = (r + self.N0) >> 1\n lc = 0 if l & 1 else (L & -L).bit_length()\n rc = 0 if r & 1 else (R & -R).bit_length()\n \n m = []\n for i in range(self.LV):\n if rc <= i:\n m.append(R)\n if L < R and lc <= i:\n m.append(L)\n L >>= 1; R >>= 1\n \n return m\n \n # 遅延伝搬処理\n def propagates(self, ids):\n for i in reversed(ids):\n v = self.lazy[i-1]\n if not v:\n continue\n self.lazy[2*i-1] += v; self.lazy[2*i] += v\n self.data[2*i-1] += v; self.data[2*i] += v\n self.lazy[i-1] = 0\n \n # 区間[l, r)にxを加算\n def update(self, l, r, x):\n ids = self.gindex(l, r)\n self.propagates(ids)\n \n L = self.N0 + l; R = self.N0 + r\n while L < R:\n if R & 1:\n R -= 1\n self.lazy[R-1] += x; self.data[R-1] += x\n if L & 1:\n self.lazy[L-1] += x; self.data[L-1] += x\n L += 1\n L >>= 1; R >>= 1\n for i in ids:\n self.data[i-1] = max(self.data[2*i-1], self.data[2*i])\n \n # 区間[l, r)内の最小値を求める\n def query(self, l, r):\n self.propagates(self.gindex(l, r))\n L = self.N0 + l; R = self.N0 + r\n \n s = -self.INF\n while L < R:\n if R & 1:\n R -= 1\n s = max(s, self.data[R-1])\n if L & 1:\n s = max(s, self.data[L-1])\n L += 1\n L >>= 1; R >>= 1\n return s\n \n def set_list(self, l, N):\n for i in range(N):\n self.data[i+self.N0-1] = l[i]\n for i in range(self.N0-1)[::-1]:\n self.data[i] = max(self.data[2*i+1], self.data[2*i+2])\n\n\ndef solve():\n N, D, A = map(int, input().split())\n l = [list(map(int, input().split())) for _ in range(N)]\n\n l.sort()\n lh = [h for x,h in l]\n lx = [x for x,h in l]\n tree = LazySegTree(N)\n tree.set_list(lh, N)\n ans = 0\n\n for i in range(N):\n v = tree.query(i, i+1)\n if v>0:\n c = (v+A-1)//A\n tree.update(i, min(N, i+2*D+1), -c*A)\n ans += c\n\n print(ans)\n\n\nif __name__ == \"__main__\":\n solve()\n", "language": "Python", "metadata": {"date": 1592038198, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02788.html", "problem_id": "p02788", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02788/input.txt", "sample_output_relpath": "derived/input_output/data/p02788/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02788/Python/s269554355.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s269554355", "user_id": "u690536347"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "from bisect import bisect_right\nimport sys\ninput=sys.stdin.readline\n \n \nclass LazySegTree():\n def __init__(self, N):\n self.INF = 2**31-1\n self.LV = (N-1).bit_length()\n self.N0 = 2**self.LV\n self.data = [0]*(2*self.N0)\n self.lazy = [0]*(2*self.N0)\n \n def gindex(self, l, r):\n L = (l + self.N0) >> 1; R = (r + self.N0) >> 1\n lc = 0 if l & 1 else (L & -L).bit_length()\n rc = 0 if r & 1 else (R & -R).bit_length()\n \n m = []\n for i in range(self.LV):\n if rc <= i:\n m.append(R)\n if L < R and lc <= i:\n m.append(L)\n L >>= 1; R >>= 1\n \n return m\n \n # 遅延伝搬処理\n def propagates(self, ids):\n for i in reversed(ids):\n v = self.lazy[i-1]\n if not v:\n continue\n self.lazy[2*i-1] += v; self.lazy[2*i] += v\n self.data[2*i-1] += v; self.data[2*i] += v\n self.lazy[i-1] = 0\n \n # 区間[l, r)にxを加算\n def update(self, l, r, x):\n ids = self.gindex(l, r)\n self.propagates(ids)\n \n L = self.N0 + l; R = self.N0 + r\n while L < R:\n if R & 1:\n R -= 1\n self.lazy[R-1] += x; self.data[R-1] += x\n if L & 1:\n self.lazy[L-1] += x; self.data[L-1] += x\n L += 1\n L >>= 1; R >>= 1\n for i in ids:\n self.data[i-1] = max(self.data[2*i-1], self.data[2*i])\n \n # 区間[l, r)内の最小値を求める\n def query(self, l, r):\n self.propagates(self.gindex(l, r))\n L = self.N0 + l; R = self.N0 + r\n \n s = -self.INF\n while L < R:\n if R & 1:\n R -= 1\n s = max(s, self.data[R-1])\n if L & 1:\n s = max(s, self.data[L-1])\n L += 1\n L >>= 1; R >>= 1\n return s\n \n def set_list(self, l, N):\n for i in range(N):\n self.data[i+self.N0-1] = l[i]\n for i in range(self.N0-1)[::-1]:\n self.data[i] = max(self.data[2*i+1], self.data[2*i+2])\n\n\ndef solve():\n N, D, A = map(int, input().split())\n l = [list(map(int, input().split())) for _ in range(N)]\n\n l.sort()\n lh = [h for x,h in l]\n lx = [x for x,h in l]\n tree = LazySegTree(N)\n tree.set_list(lh, N)\n ans = 0\n\n for i in range(N):\n v = tree.query(i, i+1)\n if v>0:\n c = (v+A-1)//A\n tree.update(i, min(N, i+2*D+1), -c*A)\n ans += c\n\n print(ans)\n\n\nif __name__ == \"__main__\":\n solve()\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nSilver Fox is fighting with N monsters.\n\nThe monsters are standing in a row, and we can assume them to be standing on a number line. The i-th monster, standing at the coordinate X_i, has the health of H_i.\n\nSilver Fox can use bombs to attack the monsters.\nUsing a bomb at the coordinate x decreases the healths of all monsters between the coordinates x-D and x+D (inclusive) by A.\nThere is no way other than bombs to decrease the monster's health.\n\nSilver Fox wins when all the monsters' healths become 0 or below.\n\nFind the minimum number of bombs needed to win.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq D \\leq 10^9\n\n1 \\leq A \\leq 10^9\n\n0 \\leq X_i \\leq 10^9\n\n1 \\leq H_i \\leq 10^9\n\nX_i are distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D A\nX_1 H_1\n:\nX_N H_N\n\nOutput\n\nPrint the minimum number of bombs needed to win.\n\nSample Input 1\n\n3 3 2\n1 2\n5 4\n9 2\n\nSample Output 1\n\n2\n\nFirst, let us use a bomb at the coordinate 4 to decrease the first and second monsters' health by 2.\n\nThen, use a bomb at the coordinate 6 to decrease the second and third monsters' health by 2.\n\nNow, all the monsters' healths are 0.\nWe cannot make all the monsters' health drop to 0 or below with just one bomb.\n\nSample Input 2\n\n9 4 1\n1 5\n2 4\n3 3\n4 2\n5 1\n6 2\n7 3\n8 4\n9 5\n\nSample Output 2\n\n5\n\nWe should use five bombs at the coordinate 5.\n\nSample Input 3\n\n3 0 1\n300000000 1000000000\n100000000 1000000000\n200000000 1000000000\n\nSample Output 3\n\n3000000000\n\nWatch out for overflow.", "sample_input": "3 3 2\n1 2\n5 4\n9 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02788", "source_text": "Score : 600 points\n\nProblem Statement\n\nSilver Fox is fighting with N monsters.\n\nThe monsters are standing in a row, and we can assume them to be standing on a number line. The i-th monster, standing at the coordinate X_i, has the health of H_i.\n\nSilver Fox can use bombs to attack the monsters.\nUsing a bomb at the coordinate x decreases the healths of all monsters between the coordinates x-D and x+D (inclusive) by A.\nThere is no way other than bombs to decrease the monster's health.\n\nSilver Fox wins when all the monsters' healths become 0 or below.\n\nFind the minimum number of bombs needed to win.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq D \\leq 10^9\n\n1 \\leq A \\leq 10^9\n\n0 \\leq X_i \\leq 10^9\n\n1 \\leq H_i \\leq 10^9\n\nX_i are distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D A\nX_1 H_1\n:\nX_N H_N\n\nOutput\n\nPrint the minimum number of bombs needed to win.\n\nSample Input 1\n\n3 3 2\n1 2\n5 4\n9 2\n\nSample Output 1\n\n2\n\nFirst, let us use a bomb at the coordinate 4 to decrease the first and second monsters' health by 2.\n\nThen, use a bomb at the coordinate 6 to decrease the second and third monsters' health by 2.\n\nNow, all the monsters' healths are 0.\nWe cannot make all the monsters' health drop to 0 or below with just one bomb.\n\nSample Input 2\n\n9 4 1\n1 5\n2 4\n3 3\n4 2\n5 1\n6 2\n7 3\n8 4\n9 5\n\nSample Output 2\n\n5\n\nWe should use five bombs at the coordinate 5.\n\nSample Input 3\n\n3 0 1\n300000000 1000000000\n100000000 1000000000\n200000000 1000000000\n\nSample Output 3\n\n3000000000\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2623, "cpu_time_ms": 1424, "memory_kb": 96528}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s986610772", "group_id": "codeNet:p02789", "input_text": "import sys\ninput=sys.stdin.readline\nn,m=map(int,input().split())\nif n==m:\n print('Yes')\nelse:\n print('No')\n\n\n", "language": "Python", "metadata": {"date": 1585508692, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02789.html", "problem_id": "p02789", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02789/input.txt", "sample_output_relpath": "derived/input_output/data/p02789/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02789/Python/s986610772.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s986610772", "user_id": "u877470159"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import sys\ninput=sys.stdin.readline\nn,m=map(int,input().split())\nif n==m:\n print('Yes')\nelse:\n print('No')\n\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A.\n\nThe problem has N test cases, all of which must be passed to get an AC verdict.\n\nTakahashi's submission has passed M cases out of the N test cases.\n\nDetermine whether Takahashi's submission gets an AC.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq M \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nIf Takahashi's submission gets an AC, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 3\n\nSample Output 1\n\nYes\n\nAll three test cases have been passed, so his submission gets an AC.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\nNo\n\nOnly two out of the three test cases have been passed, so his submission does not get an AC.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\nYes", "sample_input": "3 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02789", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A.\n\nThe problem has N test cases, all of which must be passed to get an AC verdict.\n\nTakahashi's submission has passed M cases out of the N test cases.\n\nDetermine whether Takahashi's submission gets an AC.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq M \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nIf Takahashi's submission gets an AC, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 3\n\nSample Output 1\n\nYes\n\nAll three test cases have been passed, so his submission gets an AC.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\nNo\n\nOnly two out of the three test cases have been passed, so his submission does not get an AC.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 115, "cpu_time_ms": 181, "memory_kb": 38288}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s785425787", "group_id": "codeNet:p02789", "input_text": "N,M = map(int,input().split())\n\nif (N==M):\n print(\"Yes\")\nelse:\n print(\"No\")\n", "language": "Python", "metadata": {"date": 1579467778, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02789.html", "problem_id": "p02789", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02789/input.txt", "sample_output_relpath": "derived/input_output/data/p02789/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02789/Python/s785425787.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s785425787", "user_id": "u620549327"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "N,M = map(int,input().split())\n\nif (N==M):\n print(\"Yes\")\nelse:\n print(\"No\")\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A.\n\nThe problem has N test cases, all of which must be passed to get an AC verdict.\n\nTakahashi's submission has passed M cases out of the N test cases.\n\nDetermine whether Takahashi's submission gets an AC.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq M \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nIf Takahashi's submission gets an AC, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 3\n\nSample Output 1\n\nYes\n\nAll three test cases have been passed, so his submission gets an AC.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\nNo\n\nOnly two out of the three test cases have been passed, so his submission does not get an AC.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\nYes", "sample_input": "3 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02789", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A.\n\nThe problem has N test cases, all of which must be passed to get an AC verdict.\n\nTakahashi's submission has passed M cases out of the N test cases.\n\nDetermine whether Takahashi's submission gets an AC.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq M \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nIf Takahashi's submission gets an AC, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 3\n\nSample Output 1\n\nYes\n\nAll three test cases have been passed, so his submission gets an AC.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\nNo\n\nOnly two out of the three test cases have been passed, so his submission does not get an AC.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 78, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s101978263", "group_id": "codeNet:p02789", "input_text": "n, m = tuple(map(int, input().split()))\nprint(\"Yes\" if (n == m) else \"No\")\n", "language": "Python", "metadata": {"date": 1579464073, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02789.html", "problem_id": "p02789", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02789/input.txt", "sample_output_relpath": "derived/input_output/data/p02789/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02789/Python/s101978263.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s101978263", "user_id": "u757919796"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "n, m = tuple(map(int, input().split()))\nprint(\"Yes\" if (n == m) else \"No\")\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A.\n\nThe problem has N test cases, all of which must be passed to get an AC verdict.\n\nTakahashi's submission has passed M cases out of the N test cases.\n\nDetermine whether Takahashi's submission gets an AC.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq M \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nIf Takahashi's submission gets an AC, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 3\n\nSample Output 1\n\nYes\n\nAll three test cases have been passed, so his submission gets an AC.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\nNo\n\nOnly two out of the three test cases have been passed, so his submission does not get an AC.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\nYes", "sample_input": "3 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02789", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A.\n\nThe problem has N test cases, all of which must be passed to get an AC verdict.\n\nTakahashi's submission has passed M cases out of the N test cases.\n\nDetermine whether Takahashi's submission gets an AC.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq M \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nIf Takahashi's submission gets an AC, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 3\n\nSample Output 1\n\nYes\n\nAll three test cases have been passed, so his submission gets an AC.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\nNo\n\nOnly two out of the three test cases have been passed, so his submission does not get an AC.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 75, "cpu_time_ms": 18, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s231104049", "group_id": "codeNet:p02790", "input_text": "\na, b = map(int, input().split())\n\nA = \"\"\nB = \"\"\n\nfor i in range(b):\n A += str(a)\n\nfor i in range(a):\n B += str(b)\n\nprint(min(A, B))", "language": "Python", "metadata": {"date": 1579463582, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02790.html", "problem_id": "p02790", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02790/input.txt", "sample_output_relpath": "derived/input_output/data/p02790/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02790/Python/s231104049.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s231104049", "user_id": "u687053495"}, "prompt_components": {"gold_output": "3333\n", "input_to_evaluate": "\na, b = map(int, input().split())\n\nA = \"\"\nB = \"\"\n\nfor i in range(b):\n A += str(a)\n\nfor i in range(a):\n B += str(b)\n\nprint(min(A, B))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are 1-digit positive integers a and b. Consider these two strings: the concatenation of b copies of the digit a, and the concatenation of a copies of the digit b. Which of these is lexicographically smaller?\n\nConstraints\n\n1 \\leq a \\leq 9\n\n1 \\leq b \\leq 9\n\na and b are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nPrint the lexicographically smaller of the two strings. (If the two strings are equal, print one of them.)\n\nSample Input 1\n\n4 3\n\nSample Output 1\n\n3333\n\nWe have two strings 444 and 3333. Between them, 3333 is the lexicographically smaller.\n\nSample Input 2\n\n7 7\n\nSample Output 2\n\n7777777", "sample_input": "4 3\n"}, "reference_outputs": ["3333\n"], "source_document_id": "p02790", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are 1-digit positive integers a and b. Consider these two strings: the concatenation of b copies of the digit a, and the concatenation of a copies of the digit b. Which of these is lexicographically smaller?\n\nConstraints\n\n1 \\leq a \\leq 9\n\n1 \\leq b \\leq 9\n\na and b are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nPrint the lexicographically smaller of the two strings. (If the two strings are equal, print one of them.)\n\nSample Input 1\n\n4 3\n\nSample Output 1\n\n3333\n\nWe have two strings 444 and 3333. Between them, 3333 is the lexicographically smaller.\n\nSample Input 2\n\n7 7\n\nSample Output 2\n\n7777777", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 134, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s311837613", "group_id": "codeNet:p02791", "input_text": "n = int(input())\np = list(map(int, input().split()))\n\nans = 0\nm = p[0]\n\nfor i in p:\n\tif m >= i:\n\t\tans += 1\n\t\tm = i\n\nprint(ans)", "language": "Python", "metadata": {"date": 1600540763, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02791.html", "problem_id": "p02791", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02791/input.txt", "sample_output_relpath": "derived/input_output/data/p02791/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02791/Python/s311837613.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s311837613", "user_id": "u344030307"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "n = int(input())\np = list(map(int, input().split()))\n\nans = 0\nm = p[0]\n\nfor i in p:\n\tif m >= i:\n\t\tans += 1\n\t\tm = i\n\nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a permutation P_1, \\ldots, P_N of 1, \\ldots, N.\nFind the number of integers i (1 \\leq i \\leq N) that satisfy the following condition:\n\nFor any integer j (1 \\leq j \\leq i), P_i \\leq P_j.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nP_1, \\ldots, P_N is a permutation of 1, \\ldots, N.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 ... P_N\n\nOutput\n\nPrint the number of integers i that satisfy the condition.\n\nSample Input 1\n\n5\n4 2 5 1 3\n\nSample Output 1\n\n3\n\ni=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.\n\nSimilarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.\n\nSample Input 2\n\n4\n4 3 2 1\n\nSample Output 2\n\n4\n\nAll integers i (1 \\leq i \\leq N) satisfy the condition.\n\nSample Input 3\n\n6\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n\nOnly i=1 satisfies the condition.\n\nSample Input 4\n\n8\n5 7 4 2 6 8 1 3\n\nSample Output 4\n\n4\n\nSample Input 5\n\n1\n1\n\nSample Output 5\n\n1", "sample_input": "5\n4 2 5 1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02791", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a permutation P_1, \\ldots, P_N of 1, \\ldots, N.\nFind the number of integers i (1 \\leq i \\leq N) that satisfy the following condition:\n\nFor any integer j (1 \\leq j \\leq i), P_i \\leq P_j.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nP_1, \\ldots, P_N is a permutation of 1, \\ldots, N.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 ... P_N\n\nOutput\n\nPrint the number of integers i that satisfy the condition.\n\nSample Input 1\n\n5\n4 2 5 1 3\n\nSample Output 1\n\n3\n\ni=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.\n\nSimilarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.\n\nSample Input 2\n\n4\n4 3 2 1\n\nSample Output 2\n\n4\n\nAll integers i (1 \\leq i \\leq N) satisfy the condition.\n\nSample Input 3\n\n6\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n\nOnly i=1 satisfies the condition.\n\nSample Input 4\n\n8\n5 7 4 2 6 8 1 3\n\nSample Output 4\n\n4\n\nSample Input 5\n\n1\n1\n\nSample Output 5\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 126, "cpu_time_ms": 87, "memory_kb": 32328}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s523643738", "group_id": "codeNet:p02791", "input_text": "n = int(input())\nlst = list(map(int, input().split()))\nnowmin = 10 ** 9\nres = 0\nfor i in range(n):\n if nowmin >= lst[i]:\n res += 1\n nowmin = lst[i]\nprint(res)", "language": "Python", "metadata": {"date": 1593532091, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02791.html", "problem_id": "p02791", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02791/input.txt", "sample_output_relpath": "derived/input_output/data/p02791/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02791/Python/s523643738.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s523643738", "user_id": "u088553842"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "n = int(input())\nlst = list(map(int, input().split()))\nnowmin = 10 ** 9\nres = 0\nfor i in range(n):\n if nowmin >= lst[i]:\n res += 1\n nowmin = lst[i]\nprint(res)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a permutation P_1, \\ldots, P_N of 1, \\ldots, N.\nFind the number of integers i (1 \\leq i \\leq N) that satisfy the following condition:\n\nFor any integer j (1 \\leq j \\leq i), P_i \\leq P_j.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nP_1, \\ldots, P_N is a permutation of 1, \\ldots, N.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 ... P_N\n\nOutput\n\nPrint the number of integers i that satisfy the condition.\n\nSample Input 1\n\n5\n4 2 5 1 3\n\nSample Output 1\n\n3\n\ni=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.\n\nSimilarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.\n\nSample Input 2\n\n4\n4 3 2 1\n\nSample Output 2\n\n4\n\nAll integers i (1 \\leq i \\leq N) satisfy the condition.\n\nSample Input 3\n\n6\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n\nOnly i=1 satisfies the condition.\n\nSample Input 4\n\n8\n5 7 4 2 6 8 1 3\n\nSample Output 4\n\n4\n\nSample Input 5\n\n1\n1\n\nSample Output 5\n\n1", "sample_input": "5\n4 2 5 1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02791", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a permutation P_1, \\ldots, P_N of 1, \\ldots, N.\nFind the number of integers i (1 \\leq i \\leq N) that satisfy the following condition:\n\nFor any integer j (1 \\leq j \\leq i), P_i \\leq P_j.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nP_1, \\ldots, P_N is a permutation of 1, \\ldots, N.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 ... P_N\n\nOutput\n\nPrint the number of integers i that satisfy the condition.\n\nSample Input 1\n\n5\n4 2 5 1 3\n\nSample Output 1\n\n3\n\ni=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.\n\nSimilarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.\n\nSample Input 2\n\n4\n4 3 2 1\n\nSample Output 2\n\n4\n\nAll integers i (1 \\leq i \\leq N) satisfy the condition.\n\nSample Input 3\n\n6\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n\nOnly i=1 satisfies the condition.\n\nSample Input 4\n\n8\n5 7 4 2 6 8 1 3\n\nSample Output 4\n\n4\n\nSample Input 5\n\n1\n1\n\nSample Output 5\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 165, "cpu_time_ms": 103, "memory_kb": 32296}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s164662539", "group_id": "codeNet:p02791", "input_text": "n = int(input())\np = list(map(int, input().split()))\n\nans = 1\nmin_val = p[0]\n\nfor i in range(1, n):\n min_val = min(p[i], min_val)\n if min_val == p[i]:\n ans += 1\n \nprint(ans)", "language": "Python", "metadata": {"date": 1581350777, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02791.html", "problem_id": "p02791", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02791/input.txt", "sample_output_relpath": "derived/input_output/data/p02791/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02791/Python/s164662539.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s164662539", "user_id": "u750838232"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "n = int(input())\np = list(map(int, input().split()))\n\nans = 1\nmin_val = p[0]\n\nfor i in range(1, n):\n min_val = min(p[i], min_val)\n if min_val == p[i]:\n ans += 1\n \nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a permutation P_1, \\ldots, P_N of 1, \\ldots, N.\nFind the number of integers i (1 \\leq i \\leq N) that satisfy the following condition:\n\nFor any integer j (1 \\leq j \\leq i), P_i \\leq P_j.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nP_1, \\ldots, P_N is a permutation of 1, \\ldots, N.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 ... P_N\n\nOutput\n\nPrint the number of integers i that satisfy the condition.\n\nSample Input 1\n\n5\n4 2 5 1 3\n\nSample Output 1\n\n3\n\ni=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.\n\nSimilarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.\n\nSample Input 2\n\n4\n4 3 2 1\n\nSample Output 2\n\n4\n\nAll integers i (1 \\leq i \\leq N) satisfy the condition.\n\nSample Input 3\n\n6\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n\nOnly i=1 satisfies the condition.\n\nSample Input 4\n\n8\n5 7 4 2 6 8 1 3\n\nSample Output 4\n\n4\n\nSample Input 5\n\n1\n1\n\nSample Output 5\n\n1", "sample_input": "5\n4 2 5 1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02791", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a permutation P_1, \\ldots, P_N of 1, \\ldots, N.\nFind the number of integers i (1 \\leq i \\leq N) that satisfy the following condition:\n\nFor any integer j (1 \\leq j \\leq i), P_i \\leq P_j.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nP_1, \\ldots, P_N is a permutation of 1, \\ldots, N.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 ... P_N\n\nOutput\n\nPrint the number of integers i that satisfy the condition.\n\nSample Input 1\n\n5\n4 2 5 1 3\n\nSample Output 1\n\n3\n\ni=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.\n\nSimilarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.\n\nSample Input 2\n\n4\n4 3 2 1\n\nSample Output 2\n\n4\n\nAll integers i (1 \\leq i \\leq N) satisfy the condition.\n\nSample Input 3\n\n6\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n\nOnly i=1 satisfies the condition.\n\nSample Input 4\n\n8\n5 7 4 2 6 8 1 3\n\nSample Output 4\n\n4\n\nSample Input 5\n\n1\n1\n\nSample Output 5\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 181, "cpu_time_ms": 144, "memory_kb": 24744}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s644846058", "group_id": "codeNet:p02793", "input_text": "\"\"\"\nthe condition is quite simple actually.\neach element of A and B must multiply to the same value.\nto minimise the total of B, simply make that value as small\nas possible (since A is fixed).\n\nlcm(2, 3, 4) = 12\ntherefore B is\n12/2, 12/3, 12/4\nand the sum of B is\n12/2 + 12/3 + 12/4\n\nlcd of a list is loop: lcd(partial, new_value)\nlcd(a, b) = ab / gcd(a, b)\n\"\"\"\n\ndef gcd(x, y):\n return 1\n\n\ndef lcm(list_ints):\n lcm_ongoing = 1\n for val in list_ints:\n lcm_ongoing = int(round(val*lcm_ongoing/gcd(val, lcm_ongoing)))\n return lcm_ongoing\n\n\ndef flatten(N, A):\n # get lcm\n lcm_of_A = lcm(A)\n # get sum of lcm/values\n ans = sum(int(round(lcm_of_A/value)) for value in A)\n modulo_value = int(int(10e9)+7)\n return ans % modulo_value\n\n\nif __name__ == \"__main__\":\n test1 = \\\n\"\"\"3\n2 3 4\"\"\"\n test2 = \\\n\"\"\"5\n12 12 12 12 12\"\"\"\n test3 = \\\n\"\"\"3\n1000000 999999 999998\"\"\"\n test = test3\n # N = int(test.split(\"\\n\")[0])\n # A = list(map(int, test.split(\"\\n\")[1].split()))\n N = int(input())\n A = list(map(int, input().split()))\n print(flatten(N, A))\n", "language": "Python", "metadata": {"date": 1579987919, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02793.html", "problem_id": "p02793", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02793/input.txt", "sample_output_relpath": "derived/input_output/data/p02793/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02793/Python/s644846058.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s644846058", "user_id": "u460375306"}, "prompt_components": {"gold_output": "13\n", "input_to_evaluate": "\"\"\"\nthe condition is quite simple actually.\neach element of A and B must multiply to the same value.\nto minimise the total of B, simply make that value as small\nas possible (since A is fixed).\n\nlcm(2, 3, 4) = 12\ntherefore B is\n12/2, 12/3, 12/4\nand the sum of B is\n12/2 + 12/3 + 12/4\n\nlcd of a list is loop: lcd(partial, new_value)\nlcd(a, b) = ab / gcd(a, b)\n\"\"\"\n\ndef gcd(x, y):\n return 1\n\n\ndef lcm(list_ints):\n lcm_ongoing = 1\n for val in list_ints:\n lcm_ongoing = int(round(val*lcm_ongoing/gcd(val, lcm_ongoing)))\n return lcm_ongoing\n\n\ndef flatten(N, A):\n # get lcm\n lcm_of_A = lcm(A)\n # get sum of lcm/values\n ans = sum(int(round(lcm_of_A/value)) for value in A)\n modulo_value = int(int(10e9)+7)\n return ans % modulo_value\n\n\nif __name__ == \"__main__\":\n test1 = \\\n\"\"\"3\n2 3 4\"\"\"\n test2 = \\\n\"\"\"5\n12 12 12 12 12\"\"\"\n test3 = \\\n\"\"\"3\n1000000 999999 999998\"\"\"\n test = test3\n # N = int(test.split(\"\\n\")[0])\n # A = list(map(int, test.split(\"\\n\")[1].split()))\n N = int(input())\n A = list(map(int, input().split()))\n print(flatten(N, A))\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nGiven are N positive integers A_1,...,A_N.\n\nConsider positive integers B_1, ..., B_N that satisfy the following condition.\n\nCondition: For any i, j such that 1 \\leq i < j \\leq N, A_i B_i = A_j B_j holds.\n\nFind the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.\n\nSince the answer can be enormous, print the sum modulo (10^9 +7).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A_i \\leq 10^6\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 minimum possible value of B_1 + ... + B_N for B_1,...,B_N that satisfy the condition, modulo (10^9 +7).\n\nSample Input 1\n\n3\n2 3 4\n\nSample Output 1\n\n13\n\nLet B_1=6, B_2=4, and B_3=3, and the condition will be satisfied.\n\nSample Input 2\n\n5\n12 12 12 12 12\n\nSample Output 2\n\n5\n\nWe can let all B_i be 1.\n\nSample Input 3\n\n3\n1000000 999999 999998\n\nSample Output 3\n\n996989508\n\nPrint the sum modulo (10^9+7).", "sample_input": "3\n2 3 4\n"}, "reference_outputs": ["13\n"], "source_document_id": "p02793", "source_text": "Score : 500 points\n\nProblem Statement\n\nGiven are N positive integers A_1,...,A_N.\n\nConsider positive integers B_1, ..., B_N that satisfy the following condition.\n\nCondition: For any i, j such that 1 \\leq i < j \\leq N, A_i B_i = A_j B_j holds.\n\nFind the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.\n\nSince the answer can be enormous, print the sum modulo (10^9 +7).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A_i \\leq 10^6\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 minimum possible value of B_1 + ... + B_N for B_1,...,B_N that satisfy the condition, modulo (10^9 +7).\n\nSample Input 1\n\n3\n2 3 4\n\nSample Output 1\n\n13\n\nLet B_1=6, B_2=4, and B_3=3, and the condition will be satisfied.\n\nSample Input 2\n\n5\n12 12 12 12 12\n\nSample Output 2\n\n5\n\nWe can let all B_i be 1.\n\nSample Input 3\n\n3\n1000000 999999 999998\n\nSample Output 3\n\n996989508\n\nPrint the sum modulo (10^9+7).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1090, "cpu_time_ms": 20, "memory_kb": 4084}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s135183589", "group_id": "codeNet:p02793", "input_text": "n = int(input())\na = list(map(int,input().split()))\n\ndef gcd(a,b):\n return a if b == 0 else gcd(b,a%b)\n\nlcm = 1\nfor v in a:\n lcm = lcm * v // gcd(lcm, v)\n\nMOD = 1000000007\nans = 0\nfor v in a:\n ans += lcm // v\n ans %= MOD;\n\nprint(ans)\n", "language": "Python", "metadata": {"date": 1579525750, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02793.html", "problem_id": "p02793", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02793/input.txt", "sample_output_relpath": "derived/input_output/data/p02793/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02793/Python/s135183589.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s135183589", "user_id": "u960524878"}, "prompt_components": {"gold_output": "13\n", "input_to_evaluate": "n = int(input())\na = list(map(int,input().split()))\n\ndef gcd(a,b):\n return a if b == 0 else gcd(b,a%b)\n\nlcm = 1\nfor v in a:\n lcm = lcm * v // gcd(lcm, v)\n\nMOD = 1000000007\nans = 0\nfor v in a:\n ans += lcm // v\n ans %= MOD;\n\nprint(ans)\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nGiven are N positive integers A_1,...,A_N.\n\nConsider positive integers B_1, ..., B_N that satisfy the following condition.\n\nCondition: For any i, j such that 1 \\leq i < j \\leq N, A_i B_i = A_j B_j holds.\n\nFind the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.\n\nSince the answer can be enormous, print the sum modulo (10^9 +7).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A_i \\leq 10^6\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 minimum possible value of B_1 + ... + B_N for B_1,...,B_N that satisfy the condition, modulo (10^9 +7).\n\nSample Input 1\n\n3\n2 3 4\n\nSample Output 1\n\n13\n\nLet B_1=6, B_2=4, and B_3=3, and the condition will be satisfied.\n\nSample Input 2\n\n5\n12 12 12 12 12\n\nSample Output 2\n\n5\n\nWe can let all B_i be 1.\n\nSample Input 3\n\n3\n1000000 999999 999998\n\nSample Output 3\n\n996989508\n\nPrint the sum modulo (10^9+7).", "sample_input": "3\n2 3 4\n"}, "reference_outputs": ["13\n"], "source_document_id": "p02793", "source_text": "Score : 500 points\n\nProblem Statement\n\nGiven are N positive integers A_1,...,A_N.\n\nConsider positive integers B_1, ..., B_N that satisfy the following condition.\n\nCondition: For any i, j such that 1 \\leq i < j \\leq N, A_i B_i = A_j B_j holds.\n\nFind the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.\n\nSince the answer can be enormous, print the sum modulo (10^9 +7).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A_i \\leq 10^6\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 minimum possible value of B_1 + ... + B_N for B_1,...,B_N that satisfy the condition, modulo (10^9 +7).\n\nSample Input 1\n\n3\n2 3 4\n\nSample Output 1\n\n13\n\nLet B_1=6, B_2=4, and B_3=3, and the condition will be satisfied.\n\nSample Input 2\n\n5\n12 12 12 12 12\n\nSample Output 2\n\n5\n\nWe can let all B_i be 1.\n\nSample Input 3\n\n3\n1000000 999999 999998\n\nSample Output 3\n\n996989508\n\nPrint the sum modulo (10^9+7).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 246, "cpu_time_ms": 2104, "memory_kb": 4084}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s920349719", "group_id": "codeNet:p02795", "input_text": "import sys\nreadline = sys.stdin.readline\n\ndef main():\n H = int(readline())\n W = int(readline())\n N = int(readline())\n print(-(-N // max(H, W)))\n\nif __name__ == '__main__':\n main()", "language": "Python", "metadata": {"date": 1592403426, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02795.html", "problem_id": "p02795", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02795/input.txt", "sample_output_relpath": "derived/input_output/data/p02795/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02795/Python/s920349719.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s920349719", "user_id": "u969850098"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import sys\nreadline = sys.stdin.readline\n\ndef main():\n H = int(readline())\n W = int(readline())\n N = int(readline())\n print(-(-N // max(H, W)))\n\nif __name__ == '__main__':\n main()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns, where all the squares are initially white.\n\nYou will perform some number of painting operations on the grid.\nIn one operation, you can do one of the following two actions:\n\nChoose one row, then paint all the squares in that row black.\n\nChoose one column, then paint all the squares in that column black.\n\nAt least how many operations do you need in order to have N or more black squares in the grid?\nIt is guaranteed that, under the conditions in Constraints, having N or more black squares is always possible by performing some number of operations.\n\nConstraints\n\n1 \\leq H \\leq 100\n\n1 \\leq W \\leq 100\n\n1 \\leq N \\leq H \\times W\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH\nW\nN\n\nOutput\n\nPrint the minimum number of operations needed.\n\nSample Input 1\n\n3\n7\n10\n\nSample Output 1\n\n2\n\nYou can have 14 black squares in the grid by performing the \"row\" operation twice, on different rows.\n\nSample Input 2\n\n14\n12\n112\n\nSample Output 2\n\n8\n\nSample Input 3\n\n2\n100\n200\n\nSample Output 3\n\n2", "sample_input": "3\n7\n10\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02795", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns, where all the squares are initially white.\n\nYou will perform some number of painting operations on the grid.\nIn one operation, you can do one of the following two actions:\n\nChoose one row, then paint all the squares in that row black.\n\nChoose one column, then paint all the squares in that column black.\n\nAt least how many operations do you need in order to have N or more black squares in the grid?\nIt is guaranteed that, under the conditions in Constraints, having N or more black squares is always possible by performing some number of operations.\n\nConstraints\n\n1 \\leq H \\leq 100\n\n1 \\leq W \\leq 100\n\n1 \\leq N \\leq H \\times W\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH\nW\nN\n\nOutput\n\nPrint the minimum number of operations needed.\n\nSample Input 1\n\n3\n7\n10\n\nSample Output 1\n\n2\n\nYou can have 14 black squares in the grid by performing the \"row\" operation twice, on different rows.\n\nSample Input 2\n\n14\n12\n112\n\nSample Output 2\n\n8\n\nSample Input 3\n\n2\n100\n200\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 194, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s505510334", "group_id": "codeNet:p02796", "input_text": "N = int(input())\n\np = []\nfor i in range(N):\n a,b = map(int,input().split())\n p.append([max(0,a - b),a + b])\n \nq = sorted(p,key=lambda x:x[1]) \n\ncnt = 0\nd = q[0][1]\nfor j,k in q[1:]:\n if j < d:\n cnt += 1\n else:\n d = k\n\nprint(N-cnt) ", "language": "Python", "metadata": {"date": 1580151017, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02796.html", "problem_id": "p02796", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02796/input.txt", "sample_output_relpath": "derived/input_output/data/p02796/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02796/Python/s505510334.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s505510334", "user_id": "u822044226"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "N = int(input())\n\np = []\nfor i in range(N):\n a,b = map(int,input().split())\n p.append([max(0,a - b),a + b])\n \nq = sorted(p,key=lambda x:x[1]) \n\ncnt = 0\nd = q[0][1]\nfor j,k in q[1:]:\n if j < d:\n cnt += 1\n else:\n d = k\n\nprint(N-cnt) ", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIn a factory, there are N robots placed on a number line.\nRobot i is placed at coordinate X_i and can extend its arms of length L_i in both directions, positive and negative.\n\nWe want to remove zero or more robots so that the movable ranges of arms of no two remaining robots intersect.\nHere, for each i (1 \\leq i \\leq N), the movable range of arms of Robot i is the part of the number line between the coordinates X_i - L_i and X_i + L_i, excluding the endpoints.\n\nFind the maximum number of robots that we can keep.\n\nConstraints\n\n1 \\leq N \\leq 100,000\n\n0 \\leq X_i \\leq 10^9 (1 \\leq i \\leq N)\n\n1 \\leq L_i \\leq 10^9 (1 \\leq i \\leq N)\n\nIf i \\neq j, X_i \\neq X_j.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 L_1\nX_2 L_2\n\\vdots\nX_N L_N\n\nOutput\n\nPrint the maximum number of robots that we can keep.\n\nSample Input 1\n\n4\n2 4\n4 3\n9 3\n100 5\n\nSample Output 1\n\n3\n\nBy removing Robot 2, we can keep the other three robots.\n\nSample Input 2\n\n2\n8 20\n1 10\n\nSample Output 2\n\n1\n\nSample Input 3\n\n5\n10 1\n2 1\n4 1\n6 1\n8 1\n\nSample Output 3\n\n5", "sample_input": "4\n2 4\n4 3\n9 3\n100 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02796", "source_text": "Score : 200 points\n\nProblem Statement\n\nIn a factory, there are N robots placed on a number line.\nRobot i is placed at coordinate X_i and can extend its arms of length L_i in both directions, positive and negative.\n\nWe want to remove zero or more robots so that the movable ranges of arms of no two remaining robots intersect.\nHere, for each i (1 \\leq i \\leq N), the movable range of arms of Robot i is the part of the number line between the coordinates X_i - L_i and X_i + L_i, excluding the endpoints.\n\nFind the maximum number of robots that we can keep.\n\nConstraints\n\n1 \\leq N \\leq 100,000\n\n0 \\leq X_i \\leq 10^9 (1 \\leq i \\leq N)\n\n1 \\leq L_i \\leq 10^9 (1 \\leq i \\leq N)\n\nIf i \\neq j, X_i \\neq X_j.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 L_1\nX_2 L_2\n\\vdots\nX_N L_N\n\nOutput\n\nPrint the maximum number of robots that we can keep.\n\nSample Input 1\n\n4\n2 4\n4 3\n9 3\n100 5\n\nSample Output 1\n\n3\n\nBy removing Robot 2, we can keep the other three robots.\n\nSample Input 2\n\n2\n8 20\n1 10\n\nSample Output 2\n\n1\n\nSample Input 3\n\n5\n10 1\n2 1\n4 1\n6 1\n8 1\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 243, "cpu_time_ms": 462, "memory_kb": 22104}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s226840141", "group_id": "codeNet:p02796", "input_text": "N = int(input())\nA = []\nfor _ in range(N):\n X, L = map(int, input().split())\n A.append((X-L, X+L))\n\nA = sorted(A, key=lambda x:x[1])\np = -10**10\nans = 0\nfor l, r in A:\n if l>=p:\n ans += 1\n p = r\nprint(ans)", "language": "Python", "metadata": {"date": 1579378351, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02796.html", "problem_id": "p02796", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02796/input.txt", "sample_output_relpath": "derived/input_output/data/p02796/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02796/Python/s226840141.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s226840141", "user_id": "u047816928"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "N = int(input())\nA = []\nfor _ in range(N):\n X, L = map(int, input().split())\n A.append((X-L, X+L))\n\nA = sorted(A, key=lambda x:x[1])\np = -10**10\nans = 0\nfor l, r in A:\n if l>=p:\n ans += 1\n p = r\nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIn a factory, there are N robots placed on a number line.\nRobot i is placed at coordinate X_i and can extend its arms of length L_i in both directions, positive and negative.\n\nWe want to remove zero or more robots so that the movable ranges of arms of no two remaining robots intersect.\nHere, for each i (1 \\leq i \\leq N), the movable range of arms of Robot i is the part of the number line between the coordinates X_i - L_i and X_i + L_i, excluding the endpoints.\n\nFind the maximum number of robots that we can keep.\n\nConstraints\n\n1 \\leq N \\leq 100,000\n\n0 \\leq X_i \\leq 10^9 (1 \\leq i \\leq N)\n\n1 \\leq L_i \\leq 10^9 (1 \\leq i \\leq N)\n\nIf i \\neq j, X_i \\neq X_j.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 L_1\nX_2 L_2\n\\vdots\nX_N L_N\n\nOutput\n\nPrint the maximum number of robots that we can keep.\n\nSample Input 1\n\n4\n2 4\n4 3\n9 3\n100 5\n\nSample Output 1\n\n3\n\nBy removing Robot 2, we can keep the other three robots.\n\nSample Input 2\n\n2\n8 20\n1 10\n\nSample Output 2\n\n1\n\nSample Input 3\n\n5\n10 1\n2 1\n4 1\n6 1\n8 1\n\nSample Output 3\n\n5", "sample_input": "4\n2 4\n4 3\n9 3\n100 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02796", "source_text": "Score : 200 points\n\nProblem Statement\n\nIn a factory, there are N robots placed on a number line.\nRobot i is placed at coordinate X_i and can extend its arms of length L_i in both directions, positive and negative.\n\nWe want to remove zero or more robots so that the movable ranges of arms of no two remaining robots intersect.\nHere, for each i (1 \\leq i \\leq N), the movable range of arms of Robot i is the part of the number line between the coordinates X_i - L_i and X_i + L_i, excluding the endpoints.\n\nFind the maximum number of robots that we can keep.\n\nConstraints\n\n1 \\leq N \\leq 100,000\n\n0 \\leq X_i \\leq 10^9 (1 \\leq i \\leq N)\n\n1 \\leq L_i \\leq 10^9 (1 \\leq i \\leq N)\n\nIf i \\neq j, X_i \\neq X_j.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 L_1\nX_2 L_2\n\\vdots\nX_N L_N\n\nOutput\n\nPrint the maximum number of robots that we can keep.\n\nSample Input 1\n\n4\n2 4\n4 3\n9 3\n100 5\n\nSample Output 1\n\n3\n\nBy removing Robot 2, we can keep the other three robots.\n\nSample Input 2\n\n2\n8 20\n1 10\n\nSample Output 2\n\n1\n\nSample Input 3\n\n5\n10 1\n2 1\n4 1\n6 1\n8 1\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 228, "cpu_time_ms": 399, "memory_kb": 19028}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s399319764", "group_id": "codeNet:p02797", "input_text": "import sys\n\nsys.setrecursionlimit(10**7)\ndef I(): return int(sys.stdin.readline().rstrip())\ndef MI(): return map(int,sys.stdin.readline().rstrip().split())\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり\ndef LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし\ndef S(): return sys.stdin.readline().rstrip()\ndef LS(): return list(sys.stdin.readline().rstrip().split()) #空白あり\ndef LS2(): return list(sys.stdin.readline().rstrip()) #空白なし\n\n\nN,K,S = MI()\nif S == 10**9:\n ANS = [10**9]*K + [1]*(N-K)\nelse:\n ANS = [S]*K + [10**9]*(N-K)\n\nprint(*ANS)\n", "language": "Python", "metadata": {"date": 1598641880, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02797.html", "problem_id": "p02797", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02797/input.txt", "sample_output_relpath": "derived/input_output/data/p02797/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02797/Python/s399319764.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s399319764", "user_id": "u119148115"}, "prompt_components": {"gold_output": "1 2 3 4\n", "input_to_evaluate": "import sys\n\nsys.setrecursionlimit(10**7)\ndef I(): return int(sys.stdin.readline().rstrip())\ndef MI(): return map(int,sys.stdin.readline().rstrip().split())\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり\ndef LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし\ndef S(): return sys.stdin.readline().rstrip()\ndef LS(): return list(sys.stdin.readline().rstrip().split()) #空白あり\ndef LS2(): return list(sys.stdin.readline().rstrip()) #空白なし\n\n\nN,K,S = MI()\nif S == 10**9:\n ANS = [10**9]*K + [1]*(N-K)\nelse:\n ANS = [S]*K + [10**9]*(N-K)\n\nprint(*ANS)\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven are three integers N, K, and S.\n\nFind a sequence A_1, A_2, ..., A_N of N integers between 1 and 10^9 (inclusive) that satisfies the condition below.\nWe can prove that, under the conditions in Constraints, such a sequence always exists.\n\nThere are exactly K pairs (l, r) of integers such that 1 \\leq l \\leq r \\leq N and A_l + A_{l + 1} + \\cdots + A_r = S.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq K \\leq N\n\n1 \\leq S \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K S\n\nOutput\n\nPrint a sequence satisfying the condition, in the following format:\n\nA_1 A_2 ... A_N\n\nSample Input 1\n\n4 2 3\n\nSample Output 1\n\n1 2 3 4\n\nTwo pairs (l, r) = (1, 2) and (3, 3) satisfy the condition in the statement.\n\nSample Input 2\n\n5 3 100\n\nSample Output 2\n\n50 50 50 30 70", "sample_input": "4 2 3\n"}, "reference_outputs": ["1 2 3 4\n"], "source_document_id": "p02797", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven are three integers N, K, and S.\n\nFind a sequence A_1, A_2, ..., A_N of N integers between 1 and 10^9 (inclusive) that satisfies the condition below.\nWe can prove that, under the conditions in Constraints, such a sequence always exists.\n\nThere are exactly K pairs (l, r) of integers such that 1 \\leq l \\leq r \\leq N and A_l + A_{l + 1} + \\cdots + A_r = S.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq K \\leq N\n\n1 \\leq S \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K S\n\nOutput\n\nPrint a sequence satisfying the condition, in the following format:\n\nA_1 A_2 ... A_N\n\nSample Input 1\n\n4 2 3\n\nSample Output 1\n\n1 2 3 4\n\nTwo pairs (l, r) = (1, 2) and (3, 3) satisfy the condition in the statement.\n\nSample Input 2\n\n5 3 100\n\nSample Output 2\n\n50 50 50 30 70", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 623, "cpu_time_ms": 87, "memory_kb": 80016}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s339546593", "group_id": "codeNet:p02801", "input_text": "al = list(\"abcdefghijklmnopqistuvwxyz\")\n\nc = input()\n\nprint(al[al.index(c)+1])", "language": "Python", "metadata": {"date": 1583496010, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02801.html", "problem_id": "p02801", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02801/input.txt", "sample_output_relpath": "derived/input_output/data/p02801/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02801/Python/s339546593.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s339546593", "user_id": "u752522099"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "al = list(\"abcdefghijklmnopqistuvwxyz\")\n\nc = input()\n\nprint(al[al.index(c)+1])", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is a lowercase English letter C that is not z. Print the letter that follows C in alphabetical order.\n\nConstraints\n\nC is a lowercase English letter that is not z.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nC\n\nOutput\n\nPrint the letter that follows C in alphabetical order.\n\nSample Input 1\n\na\n\nSample Output 1\n\nb\n\na is followed by b.\n\nSample Input 2\n\ny\n\nSample Output 2\n\nz\n\ny is followed by z.", "sample_input": "a\n"}, "reference_outputs": ["b\n"], "source_document_id": "p02801", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is a lowercase English letter C that is not z. Print the letter that follows C in alphabetical order.\n\nConstraints\n\nC is a lowercase English letter that is not z.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nC\n\nOutput\n\nPrint the letter that follows C in alphabetical order.\n\nSample Input 1\n\na\n\nSample Output 1\n\nb\n\na is followed by b.\n\nSample Input 2\n\ny\n\nSample Output 2\n\nz\n\ny is followed by z.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 78, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s393300290", "group_id": "codeNet:p02801", "input_text": "import string\nc = input()\n\nupper = string.ascii_lowercase\nind = upper.index(c)\nprint(upper[ind+1])", "language": "Python", "metadata": {"date": 1578859431, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02801.html", "problem_id": "p02801", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02801/input.txt", "sample_output_relpath": "derived/input_output/data/p02801/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02801/Python/s393300290.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s393300290", "user_id": "u273010357"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "import string\nc = input()\n\nupper = string.ascii_lowercase\nind = upper.index(c)\nprint(upper[ind+1])", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is a lowercase English letter C that is not z. Print the letter that follows C in alphabetical order.\n\nConstraints\n\nC is a lowercase English letter that is not z.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nC\n\nOutput\n\nPrint the letter that follows C in alphabetical order.\n\nSample Input 1\n\na\n\nSample Output 1\n\nb\n\na is followed by b.\n\nSample Input 2\n\ny\n\nSample Output 2\n\nz\n\ny is followed by z.", "sample_input": "a\n"}, "reference_outputs": ["b\n"], "source_document_id": "p02801", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is a lowercase English letter C that is not z. Print the letter that follows C in alphabetical order.\n\nConstraints\n\nC is a lowercase English letter that is not z.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nC\n\nOutput\n\nPrint the letter that follows C in alphabetical order.\n\nSample Input 1\n\na\n\nSample Output 1\n\nb\n\na is followed by b.\n\nSample Input 2\n\ny\n\nSample Output 2\n\nz\n\ny is followed by z.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 98, "cpu_time_ms": 24, "memory_kb": 3768}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s516255310", "group_id": "codeNet:p02801", "input_text": "alphabet = {chr(i):chr(i+1) for i in range(97, 123)}\na = input()\nprint(alphabet[a])", "language": "Python", "metadata": {"date": 1578859364, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02801.html", "problem_id": "p02801", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02801/input.txt", "sample_output_relpath": "derived/input_output/data/p02801/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02801/Python/s516255310.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s516255310", "user_id": "u371763408"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "alphabet = {chr(i):chr(i+1) for i in range(97, 123)}\na = input()\nprint(alphabet[a])", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is a lowercase English letter C that is not z. Print the letter that follows C in alphabetical order.\n\nConstraints\n\nC is a lowercase English letter that is not z.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nC\n\nOutput\n\nPrint the letter that follows C in alphabetical order.\n\nSample Input 1\n\na\n\nSample Output 1\n\nb\n\na is followed by b.\n\nSample Input 2\n\ny\n\nSample Output 2\n\nz\n\ny is followed by z.", "sample_input": "a\n"}, "reference_outputs": ["b\n"], "source_document_id": "p02801", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is a lowercase English letter C that is not z. Print the letter that follows C in alphabetical order.\n\nConstraints\n\nC is a lowercase English letter that is not z.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nC\n\nOutput\n\nPrint the letter that follows C in alphabetical order.\n\nSample Input 1\n\na\n\nSample Output 1\n\nb\n\na is followed by b.\n\nSample Input 2\n\ny\n\nSample Output 2\n\nz\n\ny is followed by z.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 83, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s453469192", "group_id": "codeNet:p02802", "input_text": "N, M = [int(s) for s in input().split(' ')]\n\nacd = dict()\nac = 0\npc = 0\nfor i in range(M):\n p, S = input().split(' ')\n if int(p) <= N and p not in acd:\n if S == 'AC':\n acd[p] = 1\n ac += 1\n elif S == 'WA':\n pc += 1\n\nprint(\"{} {}\".format(ac, pc))\n", "language": "Python", "metadata": {"date": 1578885615, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02802.html", "problem_id": "p02802", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02802/input.txt", "sample_output_relpath": "derived/input_output/data/p02802/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02802/Python/s453469192.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s453469192", "user_id": "u826554341"}, "prompt_components": {"gold_output": "2 2\n", "input_to_evaluate": "N, M = [int(s) for s in input().split(' ')]\n\nacd = dict()\nac = 0\npc = 0\nfor i in range(M):\n p, S = input().split(' ')\n if int(p) <= N and p not in acd:\n if S == 'AC':\n acd[p] = 1\n ac += 1\n elif S == 'WA':\n pc += 1\n\nprint(\"{} {}\".format(ac, pc))\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\n\nThe number of Takahashi's correct answers is the number of problems on which he received an AC once or more.\n\nThe number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.\n\nFind the numbers of Takahashi's correct answers and penalties.\n\nConstraints\n\nN, M, and p_i are integers.\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq 10^5\n\n1 \\leq p_i \\leq N\n\nS_i is AC or WA.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 S_1\n:\np_M S_M\n\nOutput\n\nPrint the number of Takahashi's correct answers and the number of Takahashi's penalties.\n\nSample Input 1\n\n2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n\nSample Output 1\n\n2 2\n\nIn his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.\n\nIn his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.\n\nThus, he has two correct answers and two penalties.\n\nSample Input 2\n\n100000 3\n7777 AC\n7777 AC\n7777 AC\n\nSample Output 2\n\n1 0\n\nNote that it is pointless to get an AC more than once on the same problem.\n\nSample Input 3\n\n6 0\n\nSample Output 3\n\n0 0", "sample_input": "2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n"}, "reference_outputs": ["2 2\n"], "source_document_id": "p02802", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\n\nThe number of Takahashi's correct answers is the number of problems on which he received an AC once or more.\n\nThe number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.\n\nFind the numbers of Takahashi's correct answers and penalties.\n\nConstraints\n\nN, M, and p_i are integers.\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq 10^5\n\n1 \\leq p_i \\leq N\n\nS_i is AC or WA.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 S_1\n:\np_M S_M\n\nOutput\n\nPrint the number of Takahashi's correct answers and the number of Takahashi's penalties.\n\nSample Input 1\n\n2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n\nSample Output 1\n\n2 2\n\nIn his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.\n\nIn his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.\n\nThus, he has two correct answers and two penalties.\n\nSample Input 2\n\n100000 3\n7777 AC\n7777 AC\n7777 AC\n\nSample Output 2\n\n1 0\n\nNote that it is pointless to get an AC more than once on the same problem.\n\nSample Input 3\n\n6 0\n\nSample Output 3\n\n0 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 298, "cpu_time_ms": 585, "memory_kb": 58308}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s714615791", "group_id": "codeNet:p02802", "input_text": "n, m= map(int, input().split())\np = \"\"\ns = \"\"\nl = []\nans = 0\n\nfor i in range(m):\n p, s =input().split()\n if s == \"AC\":\n if p in l:\n continue\n else:\n l.append(p)\n else:\n if p not in l:\n ans += 1\n\nprint(len(l), end=\" \")\nprint(ans)", "language": "Python", "metadata": {"date": 1578882999, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02802.html", "problem_id": "p02802", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02802/input.txt", "sample_output_relpath": "derived/input_output/data/p02802/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02802/Python/s714615791.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s714615791", "user_id": "u971091945"}, "prompt_components": {"gold_output": "2 2\n", "input_to_evaluate": "n, m= map(int, input().split())\np = \"\"\ns = \"\"\nl = []\nans = 0\n\nfor i in range(m):\n p, s =input().split()\n if s == \"AC\":\n if p in l:\n continue\n else:\n l.append(p)\n else:\n if p not in l:\n ans += 1\n\nprint(len(l), end=\" \")\nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\n\nThe number of Takahashi's correct answers is the number of problems on which he received an AC once or more.\n\nThe number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.\n\nFind the numbers of Takahashi's correct answers and penalties.\n\nConstraints\n\nN, M, and p_i are integers.\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq 10^5\n\n1 \\leq p_i \\leq N\n\nS_i is AC or WA.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 S_1\n:\np_M S_M\n\nOutput\n\nPrint the number of Takahashi's correct answers and the number of Takahashi's penalties.\n\nSample Input 1\n\n2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n\nSample Output 1\n\n2 2\n\nIn his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.\n\nIn his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.\n\nThus, he has two correct answers and two penalties.\n\nSample Input 2\n\n100000 3\n7777 AC\n7777 AC\n7777 AC\n\nSample Output 2\n\n1 0\n\nNote that it is pointless to get an AC more than once on the same problem.\n\nSample Input 3\n\n6 0\n\nSample Output 3\n\n0 0", "sample_input": "2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n"}, "reference_outputs": ["2 2\n"], "source_document_id": "p02802", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\n\nThe number of Takahashi's correct answers is the number of problems on which he received an AC once or more.\n\nThe number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.\n\nFind the numbers of Takahashi's correct answers and penalties.\n\nConstraints\n\nN, M, and p_i are integers.\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq 10^5\n\n1 \\leq p_i \\leq N\n\nS_i is AC or WA.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 S_1\n:\np_M S_M\n\nOutput\n\nPrint the number of Takahashi's correct answers and the number of Takahashi's penalties.\n\nSample Input 1\n\n2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n\nSample Output 1\n\n2 2\n\nIn his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.\n\nIn his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.\n\nThus, he has two correct answers and two penalties.\n\nSample Input 2\n\n100000 3\n7777 AC\n7777 AC\n7777 AC\n\nSample Output 2\n\n1 0\n\nNote that it is pointless to get an AC more than once on the same problem.\n\nSample Input 3\n\n6 0\n\nSample Output 3\n\n0 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 291, "cpu_time_ms": 2104, "memory_kb": 3956}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s306061371", "group_id": "codeNet:p02803", "input_text": "# Author: cr4zjh0bp\n# Created: Tue Mar 17 19:50:06 UTC 2020\nimport sys\n \nstdin = sys.stdin\ninf = 1 << 60\nmod = 1000000007\n \nni = lambda: int(ns())\nnin = lambda y: [ni() for _ in range(y)]\nna = lambda: list(map(int, stdin.readline().split()))\nnan = lambda y: [na() for _ in range(y)]\nnf = lambda: float(ns())\nnfn = lambda y: [nf() for _ in range(y)]\nnfa = lambda: list(map(float, stdin.readline().split()))\nnfan = lambda y: [nfa() for _ in range(y)]\nns = lambda: stdin.readline().rstrip()\nnsn = lambda y: [ns() for _ in range(y)]\nncl = lambda y: [list(ns()) for _ in range(y)]\nnas = lambda: stdin.readline().split()\n\nh, w = na()\nm = nsn(h)\n\ndist = [[inf] * (h * w) for _ in range(h * w)]\ndx, dy = [0, 1, -1, 0], [1, 0, 0, -1]\nfor i in range(h):\n for j in range(w):\n for k in range(4):\n ni, nj = i + dy[k], j + dx[k]\n if ni >= 0 and ni < h and nj >= 0 and nj < w and m[ni][nj] != '#' and m[i][j] != '#':\n dist[i * h + j][ni * h + nj] = 1\n dist[i * h + j][i * h + j] = 0\n\ndef floyd_warshall(n, dist):\n for i in range(n):\n for j in range(n):\n for k in range(n):\n dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k])\n\nfloyd_warshall(h * w, dist)\n\nans = 0\nfor i in range(h * w):\n for j in range(h * w):\n if dist[i][j] != inf:\n ans = max(ans, dist[i][j])\n\nprint(ans)", "language": "Python", "metadata": {"date": 1584583043, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02803.html", "problem_id": "p02803", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02803/input.txt", "sample_output_relpath": "derived/input_output/data/p02803/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02803/Python/s306061371.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s306061371", "user_id": "u535423069"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "# Author: cr4zjh0bp\n# Created: Tue Mar 17 19:50:06 UTC 2020\nimport sys\n \nstdin = sys.stdin\ninf = 1 << 60\nmod = 1000000007\n \nni = lambda: int(ns())\nnin = lambda y: [ni() for _ in range(y)]\nna = lambda: list(map(int, stdin.readline().split()))\nnan = lambda y: [na() for _ in range(y)]\nnf = lambda: float(ns())\nnfn = lambda y: [nf() for _ in range(y)]\nnfa = lambda: list(map(float, stdin.readline().split()))\nnfan = lambda y: [nfa() for _ in range(y)]\nns = lambda: stdin.readline().rstrip()\nnsn = lambda y: [ns() for _ in range(y)]\nncl = lambda y: [list(ns()) for _ in range(y)]\nnas = lambda: stdin.readline().split()\n\nh, w = na()\nm = nsn(h)\n\ndist = [[inf] * (h * w) for _ in range(h * w)]\ndx, dy = [0, 1, -1, 0], [1, 0, 0, -1]\nfor i in range(h):\n for j in range(w):\n for k in range(4):\n ni, nj = i + dy[k], j + dx[k]\n if ni >= 0 and ni < h and nj >= 0 and nj < w and m[ni][nj] != '#' and m[i][j] != '#':\n dist[i * h + j][ni * h + nj] = 1\n dist[i * h + j][i * h + j] = 0\n\ndef floyd_warshall(n, dist):\n for i in range(n):\n for j in range(n):\n for k in range(n):\n dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k])\n\nfloyd_warshall(h * w, dist)\n\nans = 0\nfor i in range(h * w):\n for j in range(h * w):\n if dist[i][j] != inf:\n ans = max(ans, dist[i][j])\n\nprint(ans)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi has a maze, which is a grid of H \\times W squares with H horizontal rows and W vertical columns.\n\nThe square at the i-th row from the top and the j-th column is a \"wall\" square if S_{ij} is #, and a \"road\" square if S_{ij} is ..\n\nFrom a road square, you can move to a horizontally or vertically adjacent road square.\n\nYou cannot move out of the maze, move to a wall square, or move diagonally.\n\nTakahashi will choose a starting square and a goal square, which can be any road squares, and give the maze to Aoki.\n\nAoki will then travel from the starting square to the goal square, in the minimum number of moves required.\n\nIn this situation, find the maximum possible number of moves Aoki has to make.\n\nConstraints\n\n1 \\leq H,W \\leq 20\n\nS_{ij} is . or #.\n\nS contains at least two occurrences of ..\n\nAny road square can be reached from any road square in zero or more moves.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nS_{11}...S_{1W}\n:\nS_{H1}...S_{HW}\n\nOutput\n\nPrint the maximum possible number of moves Aoki has to make.\n\nSample Input 1\n\n3 3\n...\n...\n...\n\nSample Output 1\n\n4\n\nIf Takahashi chooses the top-left square as the starting square and the bottom-right square as the goal square, Aoki has to make four moves.\n\nSample Input 2\n\n3 5\n...#.\n.#.#.\n.#...\n\nSample Output 2\n\n10\n\nIf Takahashi chooses the bottom-left square as the starting square and the top-right square as the goal square, Aoki has to make ten moves.", "sample_input": "3 3\n...\n...\n...\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02803", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi has a maze, which is a grid of H \\times W squares with H horizontal rows and W vertical columns.\n\nThe square at the i-th row from the top and the j-th column is a \"wall\" square if S_{ij} is #, and a \"road\" square if S_{ij} is ..\n\nFrom a road square, you can move to a horizontally or vertically adjacent road square.\n\nYou cannot move out of the maze, move to a wall square, or move diagonally.\n\nTakahashi will choose a starting square and a goal square, which can be any road squares, and give the maze to Aoki.\n\nAoki will then travel from the starting square to the goal square, in the minimum number of moves required.\n\nIn this situation, find the maximum possible number of moves Aoki has to make.\n\nConstraints\n\n1 \\leq H,W \\leq 20\n\nS_{ij} is . or #.\n\nS contains at least two occurrences of ..\n\nAny road square can be reached from any road square in zero or more moves.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nS_{11}...S_{1W}\n:\nS_{H1}...S_{HW}\n\nOutput\n\nPrint the maximum possible number of moves Aoki has to make.\n\nSample Input 1\n\n3 3\n...\n...\n...\n\nSample Output 1\n\n4\n\nIf Takahashi chooses the top-left square as the starting square and the bottom-right square as the goal square, Aoki has to make four moves.\n\nSample Input 2\n\n3 5\n...#.\n.#.#.\n.#...\n\nSample Output 2\n\n10\n\nIf Takahashi chooses the bottom-left square as the starting square and the top-right square as the goal square, Aoki has to make ten moves.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1422, "cpu_time_ms": 2104, "memory_kb": 4340}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s305988761", "group_id": "codeNet:p02803", "input_text": "from collections import deque\n\nINF = -1\n\nsizeI, sizeJ = map(int, input().split())\na = [input().rstrip() for _ in range(sizeI)]\n\ndef bfs(startI, startJ):\n dist = [[INF for _ in range(sizeJ)] for _ in range(sizeI)]\n dist[startI][startJ] = 0\n q = deque([(startI, startJ)])\n while q:\n i, j = q.pop()\n curDist = dist[i][j]\n for di, dj in ((1, 0), (-1, 0), (0, 1), (0, -1)):\n ni, nj = i + di, j + dj\n if 0 <= ni < sizeI and 0 <= nj < sizeJ and dist[ni][nj] == INF and a[ni][nj] == '.':\n dist[ni][nj] = 1 + curDist\n q.appendleft((ni, nj))\n return max([max(row) for row in dist])\n\nret = -float('inf')\nfor i in range(sizeI):\n for j in range(sizeJ):\n if a[i][j] == '.':\n ret = max(ret, bfs(i, j))\nprint(ret)", "language": "Python", "metadata": {"date": 1578946898, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02803.html", "problem_id": "p02803", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02803/input.txt", "sample_output_relpath": "derived/input_output/data/p02803/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02803/Python/s305988761.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s305988761", "user_id": "u953237709"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "from collections import deque\n\nINF = -1\n\nsizeI, sizeJ = map(int, input().split())\na = [input().rstrip() for _ in range(sizeI)]\n\ndef bfs(startI, startJ):\n dist = [[INF for _ in range(sizeJ)] for _ in range(sizeI)]\n dist[startI][startJ] = 0\n q = deque([(startI, startJ)])\n while q:\n i, j = q.pop()\n curDist = dist[i][j]\n for di, dj in ((1, 0), (-1, 0), (0, 1), (0, -1)):\n ni, nj = i + di, j + dj\n if 0 <= ni < sizeI and 0 <= nj < sizeJ and dist[ni][nj] == INF and a[ni][nj] == '.':\n dist[ni][nj] = 1 + curDist\n q.appendleft((ni, nj))\n return max([max(row) for row in dist])\n\nret = -float('inf')\nfor i in range(sizeI):\n for j in range(sizeJ):\n if a[i][j] == '.':\n ret = max(ret, bfs(i, j))\nprint(ret)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi has a maze, which is a grid of H \\times W squares with H horizontal rows and W vertical columns.\n\nThe square at the i-th row from the top and the j-th column is a \"wall\" square if S_{ij} is #, and a \"road\" square if S_{ij} is ..\n\nFrom a road square, you can move to a horizontally or vertically adjacent road square.\n\nYou cannot move out of the maze, move to a wall square, or move diagonally.\n\nTakahashi will choose a starting square and a goal square, which can be any road squares, and give the maze to Aoki.\n\nAoki will then travel from the starting square to the goal square, in the minimum number of moves required.\n\nIn this situation, find the maximum possible number of moves Aoki has to make.\n\nConstraints\n\n1 \\leq H,W \\leq 20\n\nS_{ij} is . or #.\n\nS contains at least two occurrences of ..\n\nAny road square can be reached from any road square in zero or more moves.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nS_{11}...S_{1W}\n:\nS_{H1}...S_{HW}\n\nOutput\n\nPrint the maximum possible number of moves Aoki has to make.\n\nSample Input 1\n\n3 3\n...\n...\n...\n\nSample Output 1\n\n4\n\nIf Takahashi chooses the top-left square as the starting square and the bottom-right square as the goal square, Aoki has to make four moves.\n\nSample Input 2\n\n3 5\n...#.\n.#.#.\n.#...\n\nSample Output 2\n\n10\n\nIf Takahashi chooses the bottom-left square as the starting square and the top-right square as the goal square, Aoki has to make ten moves.", "sample_input": "3 3\n...\n...\n...\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02803", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi has a maze, which is a grid of H \\times W squares with H horizontal rows and W vertical columns.\n\nThe square at the i-th row from the top and the j-th column is a \"wall\" square if S_{ij} is #, and a \"road\" square if S_{ij} is ..\n\nFrom a road square, you can move to a horizontally or vertically adjacent road square.\n\nYou cannot move out of the maze, move to a wall square, or move diagonally.\n\nTakahashi will choose a starting square and a goal square, which can be any road squares, and give the maze to Aoki.\n\nAoki will then travel from the starting square to the goal square, in the minimum number of moves required.\n\nIn this situation, find the maximum possible number of moves Aoki has to make.\n\nConstraints\n\n1 \\leq H,W \\leq 20\n\nS_{ij} is . or #.\n\nS contains at least two occurrences of ..\n\nAny road square can be reached from any road square in zero or more moves.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nS_{11}...S_{1W}\n:\nS_{H1}...S_{HW}\n\nOutput\n\nPrint the maximum possible number of moves Aoki has to make.\n\nSample Input 1\n\n3 3\n...\n...\n...\n\nSample Output 1\n\n4\n\nIf Takahashi chooses the top-left square as the starting square and the bottom-right square as the goal square, Aoki has to make four moves.\n\nSample Input 2\n\n3 5\n...#.\n.#.#.\n.#...\n\nSample Output 2\n\n10\n\nIf Takahashi chooses the bottom-left square as the starting square and the top-right square as the goal square, Aoki has to make ten moves.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 806, "cpu_time_ms": 283, "memory_kb": 3316}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s567212806", "group_id": "codeNet:p02804", "input_text": "N, K = map(int, input().split())\nA = list(map(int, input().split()))\nmod = 10 ** 9 + 7\n\n\ndef extgcd(a,b):\n a0,b0=a,b\n x0,y0=1,0\n x1,y1=0,1\n\n while b0!=0:\n q = a0 // b0\n r = a0 % b0\n\n a0,b0=b0,r\n x0,x1=x1,x0-q*x1\n y0,y1=y1,y0-q*y1\n\n return a0,x0,y0\n\ndef mo(x,mod):\n return (mod+x%mod)%mod\n\ndef inv(a,mod):\n g,x,y=extgcd(a,mod)\n ans=mo(x,mod)\n return ans\n\ndef combi_mod(n,k):\n invlist = [1]\n for i in range(1, k + 1):\n temp = inv(i, mod)\n invlist.append(temp)\n k1 = 1\n k3 = 1\n\n for i in range(n, 0, -1):\n\n if i > n - k:\n k1 *= i\n if i < k + 1:\n k3 *= invlist[i]\n ans = k1 * k3\n ans = ans % mod\n return ans\n\nA.sort()\n\nans=0\n\nfor i in range(N-1,K-2,-1):\n ans+=(A[i]-A[(N-1)-i])*combi_mod(i,K-1)\n\n\nans%=mod\n\nprint(ans)\n", "language": "Python", "metadata": {"date": 1578951079, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02804.html", "problem_id": "p02804", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02804/input.txt", "sample_output_relpath": "derived/input_output/data/p02804/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02804/Python/s567212806.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s567212806", "user_id": "u948524308"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "N, K = map(int, input().split())\nA = list(map(int, input().split()))\nmod = 10 ** 9 + 7\n\n\ndef extgcd(a,b):\n a0,b0=a,b\n x0,y0=1,0\n x1,y1=0,1\n\n while b0!=0:\n q = a0 // b0\n r = a0 % b0\n\n a0,b0=b0,r\n x0,x1=x1,x0-q*x1\n y0,y1=y1,y0-q*y1\n\n return a0,x0,y0\n\ndef mo(x,mod):\n return (mod+x%mod)%mod\n\ndef inv(a,mod):\n g,x,y=extgcd(a,mod)\n ans=mo(x,mod)\n return ans\n\ndef combi_mod(n,k):\n invlist = [1]\n for i in range(1, k + 1):\n temp = inv(i, mod)\n invlist.append(temp)\n k1 = 1\n k3 = 1\n\n for i in range(n, 0, -1):\n\n if i > n - k:\n k1 *= i\n if i < k + 1:\n k3 *= invlist[i]\n ans = k1 * k3\n ans = ans % mod\n return ans\n\nA.sort()\n\nans=0\n\nfor i in range(N-1,K-2,-1):\n ans+=(A[i]-A[(N-1)-i])*combi_mod(i,K-1)\n\n\nans%=mod\n\nprint(ans)\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nFor a finite set of integers X, let f(X)=\\max X - \\min X.\n\nGiven are N integers A_1,...,A_N.\n\nWe will choose K of them and let S be the set of the integers chosen. If we distinguish elements with different indices even when their values are the same, there are {}_N C_K ways to make this choice. Find the sum of f(S) over all those ways.\n\nSince the answer can be enormous, print it \\bmod (10^9+7).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\n|A_i| \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 ... A_N\n\nOutput\n\nPrint the answer \\bmod (10^9+7).\n\nSample Input 1\n\n4 2\n1 1 3 4\n\nSample Output 1\n\n11\n\nThere are six ways to choose S: \\{1,1\\},\\{1,3\\},\\{1,4\\},\\{1,3\\},\\{1,4\\}, \\{3,4\\} (we distinguish the two 1s). The value of f(S) for these choices are 0,2,3,2,3,1, respectively, for the total of 11.\n\nSample Input 2\n\n6 3\n10 10 10 -10 -10 -10\n\nSample Output 2\n\n360\n\nThere are 20 ways to choose S. In 18 of them, f(S)=20, and in 2 of them, f(S)=0.\n\nSample Input 3\n\n3 1\n1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n10 6\n1000000000 1000000000 1000000000 1000000000 1000000000 0 0 0 0 0\n\nSample Output 4\n\n999998537\n\nPrint the sum \\bmod (10^9+7).", "sample_input": "4 2\n1 1 3 4\n"}, "reference_outputs": ["11\n"], "source_document_id": "p02804", "source_text": "Score : 500 points\n\nProblem Statement\n\nFor a finite set of integers X, let f(X)=\\max X - \\min X.\n\nGiven are N integers A_1,...,A_N.\n\nWe will choose K of them and let S be the set of the integers chosen. If we distinguish elements with different indices even when their values are the same, there are {}_N C_K ways to make this choice. Find the sum of f(S) over all those ways.\n\nSince the answer can be enormous, print it \\bmod (10^9+7).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\n|A_i| \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 ... A_N\n\nOutput\n\nPrint the answer \\bmod (10^9+7).\n\nSample Input 1\n\n4 2\n1 1 3 4\n\nSample Output 1\n\n11\n\nThere are six ways to choose S: \\{1,1\\},\\{1,3\\},\\{1,4\\},\\{1,3\\},\\{1,4\\}, \\{3,4\\} (we distinguish the two 1s). The value of f(S) for these choices are 0,2,3,2,3,1, respectively, for the total of 11.\n\nSample Input 2\n\n6 3\n10 10 10 -10 -10 -10\n\nSample Output 2\n\n360\n\nThere are 20 ways to choose S. In 18 of them, f(S)=20, and in 2 of them, f(S)=0.\n\nSample Input 3\n\n3 1\n1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n10 6\n1000000000 1000000000 1000000000 1000000000 1000000000 0 0 0 0 0\n\nSample Output 4\n\n999998537\n\nPrint the sum \\bmod (10^9+7).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 853, "cpu_time_ms": 2104, "memory_kb": 14416}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s115951693", "group_id": "codeNet:p02806", "input_text": "N = int(input())\n\nS = list()\nT = list()\n\nfor i in range(N):\n s,t = input().split()\n t = int(t)\n S.append(s)\n T.append(t)\n \nX = input()\n\nA = T[S.index(X)+1:]\nprint(sum(A))", "language": "Python", "metadata": {"date": 1578791213, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02806.html", "problem_id": "p02806", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02806/input.txt", "sample_output_relpath": "derived/input_output/data/p02806/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02806/Python/s115951693.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s115951693", "user_id": "u100277898"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "N = int(input())\n\nS = list()\nT = list()\n\nfor i in range(N):\n s,t = input().split()\n t = int(t)\n S.append(s)\n T.append(t)\n \nX = input()\n\nA = T[S.index(X)+1:]\nprint(sum(A))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nNiwango created a playlist of N songs.\nThe title and the duration of the i-th song are s_i and t_i seconds, respectively.\nIt is guaranteed that s_1,\\ldots,s_N are all distinct.\n\nNiwango was doing some work while playing this playlist. (That is, all the songs were played once, in the order they appear in the playlist, without any pause in between.)\nHowever, he fell asleep during his work, and he woke up after all the songs were played.\nAccording to his record, it turned out that he fell asleep at the very end of the song titled X.\n\nFind the duration of time when some song was played while Niwango was asleep.\n\nConstraints\n\n1 \\leq N \\leq 50\n\ns_i and X are strings of length between 1 and 100 (inclusive) consisting of lowercase English letters.\n\ns_1,\\ldots,s_N are distinct.\n\nThere exists an integer i such that s_i = X.\n\n1 \\leq t_i \\leq 1000\n\nt_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1 t_1\n\\vdots\ns_{N} t_N\nX\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\ndwango 2\nsixth 5\nprelims 25\ndwango\n\nSample Output 1\n\n30\n\nWhile Niwango was asleep, two songs were played: sixth and prelims.\n\nThe answer is the total duration of these songs, 30.\n\nSample Input 2\n\n1\nabcde 1000\nabcde\n\nSample Output 2\n\n0\n\nNo songs were played while Niwango was asleep.\n\nIn such a case, the total duration of songs is 0.\n\nSample Input 3\n\n15\nypnxn 279\nkgjgwx 464\nqquhuwq 327\nrxing 549\npmuduhznoaqu 832\ndagktgdarveusju 595\nwunfagppcoi 200\ndhavrncwfw 720\njpcmigg 658\nwrczqxycivdqn 639\nmcmkkbnjfeod 992\nhtqvkgkbhtytsz 130\ntwflegsjz 467\ndswxxrxuzzfhkp 989\nszfwtzfpnscgue 958\npmuduhznoaqu\n\nSample Output 3\n\n6348", "sample_input": "3\ndwango 2\nsixth 5\nprelims 25\ndwango\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02806", "source_text": "Score : 200 points\n\nProblem Statement\n\nNiwango created a playlist of N songs.\nThe title and the duration of the i-th song are s_i and t_i seconds, respectively.\nIt is guaranteed that s_1,\\ldots,s_N are all distinct.\n\nNiwango was doing some work while playing this playlist. (That is, all the songs were played once, in the order they appear in the playlist, without any pause in between.)\nHowever, he fell asleep during his work, and he woke up after all the songs were played.\nAccording to his record, it turned out that he fell asleep at the very end of the song titled X.\n\nFind the duration of time when some song was played while Niwango was asleep.\n\nConstraints\n\n1 \\leq N \\leq 50\n\ns_i and X are strings of length between 1 and 100 (inclusive) consisting of lowercase English letters.\n\ns_1,\\ldots,s_N are distinct.\n\nThere exists an integer i such that s_i = X.\n\n1 \\leq t_i \\leq 1000\n\nt_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1 t_1\n\\vdots\ns_{N} t_N\nX\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\ndwango 2\nsixth 5\nprelims 25\ndwango\n\nSample Output 1\n\n30\n\nWhile Niwango was asleep, two songs were played: sixth and prelims.\n\nThe answer is the total duration of these songs, 30.\n\nSample Input 2\n\n1\nabcde 1000\nabcde\n\nSample Output 2\n\n0\n\nNo songs were played while Niwango was asleep.\n\nIn such a case, the total duration of songs is 0.\n\nSample Input 3\n\n15\nypnxn 279\nkgjgwx 464\nqquhuwq 327\nrxing 549\npmuduhznoaqu 832\ndagktgdarveusju 595\nwunfagppcoi 200\ndhavrncwfw 720\njpcmigg 658\nwrczqxycivdqn 639\nmcmkkbnjfeod 992\nhtqvkgkbhtytsz 130\ntwflegsjz 467\ndswxxrxuzzfhkp 989\nszfwtzfpnscgue 958\npmuduhznoaqu\n\nSample Output 3\n\n6348", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 175, "cpu_time_ms": 18, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s973351814", "group_id": "codeNet:p02807", "input_text": "n=int(input())\nx=list(map(int,input().split()))\na=1\nB=[1,1]\nmod=10**9+7\nfor i in range(2,n):\n a=a*i%mod\n B.append(pow(i,mod-2,mod))\nd=[0]*(n-1)\nfor i in range(n-1):\n d[i]=x[i+1]-x[i]\nD=[d[-1]]\nfor i in range(n-2):\n D.append(D[-1]+d[-2-i])\nD=D[::-1]\nans=0\nfor i in range(n-1):\n ans=(ans+D[i]*a*B[i+1])%mod\nprint(ans)", "language": "Python", "metadata": {"date": 1584344615, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02807.html", "problem_id": "p02807", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02807/input.txt", "sample_output_relpath": "derived/input_output/data/p02807/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02807/Python/s973351814.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s973351814", "user_id": "u968846084"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "n=int(input())\nx=list(map(int,input().split()))\na=1\nB=[1,1]\nmod=10**9+7\nfor i in range(2,n):\n a=a*i%mod\n B.append(pow(i,mod-2,mod))\nd=[0]*(n-1)\nfor i in range(n-1):\n d[i]=x[i+1]-x[i]\nD=[d[-1]]\nfor i in range(n-2):\n D.append(D[-1]+d[-2-i])\nD=D[::-1]\nans=0\nfor i in range(n-1):\n ans=(ans+D[i]*a*B[i+1])%mod\nprint(ans)", "problem_context": "Score : 600 points\n\nProblem Statement\n\nThere are N slimes standing on a number line.\nThe i-th slime from the left is at position x_i.\n\nIt is guaruanteed that 1 \\leq x_1 < x_2 < \\ldots < x_N \\leq 10^{9}.\n\nNiwango will perform N-1 operations. The i-th operation consists of the following procedures:\n\nChoose an integer k between 1 and N-i (inclusive) with equal probability.\n\nMove the k-th slime from the left, to the position of the neighboring slime to the right.\n\nFuse the two slimes at the same position into one slime.\n\nFind the total distance traveled by the slimes multiplied by (N-1)! (we can show that this value is an integer), modulo (10^{9}+7). If a slime is born by a fuse and that slime moves, we count it as just one slime.\n\nConstraints\n\n2 \\leq N \\leq 10^{5}\n\n1 \\leq x_1 < x_2 < \\ldots < x_N \\leq 10^{9}\n\nx_i is an integer.\n\nSubtasks\n\n400 points will be awarded for passing the test cases satisfying N \\leq 2000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 x_2 \\ldots x_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n5\n\nWith probability \\frac{1}{2}, the leftmost slime is chosen in the first operation, in which case the total distance traveled is 2.\n\nWith probability \\frac{1}{2}, the middle slime is chosen in the first operation, in which case the total distance traveled is 3.\n\nThe answer is the expected total distance traveled, 2.5, multiplied by 2!, which is 5.\n\nSample Input 2\n\n12\n161735902 211047202 430302156 450968417 628894325 707723857 731963982 822804784 880895728 923078537 971407775 982631932\n\nSample Output 2\n\n750927044\n\nFind the expected value multiplied by (N-1)!, modulo (10^9+7).", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02807", "source_text": "Score : 600 points\n\nProblem Statement\n\nThere are N slimes standing on a number line.\nThe i-th slime from the left is at position x_i.\n\nIt is guaruanteed that 1 \\leq x_1 < x_2 < \\ldots < x_N \\leq 10^{9}.\n\nNiwango will perform N-1 operations. The i-th operation consists of the following procedures:\n\nChoose an integer k between 1 and N-i (inclusive) with equal probability.\n\nMove the k-th slime from the left, to the position of the neighboring slime to the right.\n\nFuse the two slimes at the same position into one slime.\n\nFind the total distance traveled by the slimes multiplied by (N-1)! (we can show that this value is an integer), modulo (10^{9}+7). If a slime is born by a fuse and that slime moves, we count it as just one slime.\n\nConstraints\n\n2 \\leq N \\leq 10^{5}\n\n1 \\leq x_1 < x_2 < \\ldots < x_N \\leq 10^{9}\n\nx_i is an integer.\n\nSubtasks\n\n400 points will be awarded for passing the test cases satisfying N \\leq 2000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 x_2 \\ldots x_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n5\n\nWith probability \\frac{1}{2}, the leftmost slime is chosen in the first operation, in which case the total distance traveled is 2.\n\nWith probability \\frac{1}{2}, the middle slime is chosen in the first operation, in which case the total distance traveled is 3.\n\nThe answer is the expected total distance traveled, 2.5, multiplied by 2!, which is 5.\n\nSample Input 2\n\n12\n161735902 211047202 430302156 450968417 628894325 707723857 731963982 822804784 880895728 923078537 971407775 982631932\n\nSample Output 2\n\n750927044\n\nFind the expected value multiplied by (N-1)!, modulo (10^9+7).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 320, "cpu_time_ms": 544, "memory_kb": 19940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s051921343", "group_id": "codeNet:p02807", "input_text": "LARGE = 10 ** 9 + 7\n\n\ndef solve(n, x_list):\n\n n_1_fac = 1\n for i in range(2, n):\n n_1_fac *= i\n n_1_fac %= LARGE\n\n res = 0\n for i in range(n - 1):\n res += (x_list[n - 1] - x_list[i]) * n_1_fac * pow(n - 1 - i, LARGE - 2, LARGE)\n res %= LARGE\n\n x_left = 0\n x_right = 0\n for k in range(1, n - 1):\n x_right += x_list[n - 1 - k]\n x_left += x_list[k - 1]\n res += (x_right - x_left) * n_1_fac * pow(k, LARGE - 2, LARGE) * pow(k + 1, LARGE - 2, LARGE)\n res %= LARGE\n return res\n\n\ndef main():\n n = int(input())\n x_list = list(map(int, input().split()))\n res = solve(n, x_list)\n print(res)\n\n\ndef test():\n assert solve(3, [1, 2, 3]) == 5\n assert solve(12, [\n 161735902, 211047202, 430302156, 450968417, 628894325, 707723857,\n 731963982, 822804784, 880895728, 923078537, 971407775, 982631932\n ]) == 750927044\n\n\nif __name__ == \"__main__\":\n test()\n main()\n", "language": "Python", "metadata": {"date": 1578793726, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02807.html", "problem_id": "p02807", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02807/input.txt", "sample_output_relpath": "derived/input_output/data/p02807/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02807/Python/s051921343.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s051921343", "user_id": "u104282757"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "LARGE = 10 ** 9 + 7\n\n\ndef solve(n, x_list):\n\n n_1_fac = 1\n for i in range(2, n):\n n_1_fac *= i\n n_1_fac %= LARGE\n\n res = 0\n for i in range(n - 1):\n res += (x_list[n - 1] - x_list[i]) * n_1_fac * pow(n - 1 - i, LARGE - 2, LARGE)\n res %= LARGE\n\n x_left = 0\n x_right = 0\n for k in range(1, n - 1):\n x_right += x_list[n - 1 - k]\n x_left += x_list[k - 1]\n res += (x_right - x_left) * n_1_fac * pow(k, LARGE - 2, LARGE) * pow(k + 1, LARGE - 2, LARGE)\n res %= LARGE\n return res\n\n\ndef main():\n n = int(input())\n x_list = list(map(int, input().split()))\n res = solve(n, x_list)\n print(res)\n\n\ndef test():\n assert solve(3, [1, 2, 3]) == 5\n assert solve(12, [\n 161735902, 211047202, 430302156, 450968417, 628894325, 707723857,\n 731963982, 822804784, 880895728, 923078537, 971407775, 982631932\n ]) == 750927044\n\n\nif __name__ == \"__main__\":\n test()\n main()\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nThere are N slimes standing on a number line.\nThe i-th slime from the left is at position x_i.\n\nIt is guaruanteed that 1 \\leq x_1 < x_2 < \\ldots < x_N \\leq 10^{9}.\n\nNiwango will perform N-1 operations. The i-th operation consists of the following procedures:\n\nChoose an integer k between 1 and N-i (inclusive) with equal probability.\n\nMove the k-th slime from the left, to the position of the neighboring slime to the right.\n\nFuse the two slimes at the same position into one slime.\n\nFind the total distance traveled by the slimes multiplied by (N-1)! (we can show that this value is an integer), modulo (10^{9}+7). If a slime is born by a fuse and that slime moves, we count it as just one slime.\n\nConstraints\n\n2 \\leq N \\leq 10^{5}\n\n1 \\leq x_1 < x_2 < \\ldots < x_N \\leq 10^{9}\n\nx_i is an integer.\n\nSubtasks\n\n400 points will be awarded for passing the test cases satisfying N \\leq 2000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 x_2 \\ldots x_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n5\n\nWith probability \\frac{1}{2}, the leftmost slime is chosen in the first operation, in which case the total distance traveled is 2.\n\nWith probability \\frac{1}{2}, the middle slime is chosen in the first operation, in which case the total distance traveled is 3.\n\nThe answer is the expected total distance traveled, 2.5, multiplied by 2!, which is 5.\n\nSample Input 2\n\n12\n161735902 211047202 430302156 450968417 628894325 707723857 731963982 822804784 880895728 923078537 971407775 982631932\n\nSample Output 2\n\n750927044\n\nFind the expected value multiplied by (N-1)!, modulo (10^9+7).", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02807", "source_text": "Score : 600 points\n\nProblem Statement\n\nThere are N slimes standing on a number line.\nThe i-th slime from the left is at position x_i.\n\nIt is guaruanteed that 1 \\leq x_1 < x_2 < \\ldots < x_N \\leq 10^{9}.\n\nNiwango will perform N-1 operations. The i-th operation consists of the following procedures:\n\nChoose an integer k between 1 and N-i (inclusive) with equal probability.\n\nMove the k-th slime from the left, to the position of the neighboring slime to the right.\n\nFuse the two slimes at the same position into one slime.\n\nFind the total distance traveled by the slimes multiplied by (N-1)! (we can show that this value is an integer), modulo (10^{9}+7). If a slime is born by a fuse and that slime moves, we count it as just one slime.\n\nConstraints\n\n2 \\leq N \\leq 10^{5}\n\n1 \\leq x_1 < x_2 < \\ldots < x_N \\leq 10^{9}\n\nx_i is an integer.\n\nSubtasks\n\n400 points will be awarded for passing the test cases satisfying N \\leq 2000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 x_2 \\ldots x_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n5\n\nWith probability \\frac{1}{2}, the leftmost slime is chosen in the first operation, in which case the total distance traveled is 2.\n\nWith probability \\frac{1}{2}, the middle slime is chosen in the first operation, in which case the total distance traveled is 3.\n\nThe answer is the expected total distance traveled, 2.5, multiplied by 2!, which is 5.\n\nSample Input 2\n\n12\n161735902 211047202 430302156 450968417 628894325 707723857 731963982 822804784 880895728 923078537 971407775 982631932\n\nSample Output 2\n\n750927044\n\nFind the expected value multiplied by (N-1)!, modulo (10^9+7).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 964, "cpu_time_ms": 1219, "memory_kb": 14480}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s943985259", "group_id": "codeNet:p02811", "input_text": "K,X = map (int, input ().split ())\nif K*500 < X:\n print ('No')\nelse:\n print ('Yes')", "language": "Python", "metadata": {"date": 1598317939, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02811.html", "problem_id": "p02811", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02811/input.txt", "sample_output_relpath": "derived/input_output/data/p02811/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02811/Python/s943985259.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s943985259", "user_id": "u316603606"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "K,X = map (int, input ().split ())\nif K*500 < X:\n print ('No')\nelse:\n print ('Yes')", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "sample_input": "2 900\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02811", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 85, "cpu_time_ms": 24, "memory_kb": 9056}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s656929138", "group_id": "codeNet:p02811", "input_text": "K, X = map(int, input().split())\n\nif K * 500 >= X:\n print('Yes')\nelse:\n print('No')\n", "language": "Python", "metadata": {"date": 1578708381, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02811.html", "problem_id": "p02811", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02811/input.txt", "sample_output_relpath": "derived/input_output/data/p02811/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02811/Python/s656929138.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s656929138", "user_id": "u353099601"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "K, X = map(int, input().split())\n\nif K * 500 >= X:\n print('Yes')\nelse:\n print('No')\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "sample_input": "2 900\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02811", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 86, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s125095811", "group_id": "codeNet:p02812", "input_text": "n = int(input())\ns = input()\nprint(s.count(\"ABC\"))", "language": "Python", "metadata": {"date": 1581314585, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02812.html", "problem_id": "p02812", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02812/input.txt", "sample_output_relpath": "derived/input_output/data/p02812/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02812/Python/s125095811.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s125095811", "user_id": "u745687363"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n = int(input())\ns = input()\nprint(s.count(\"ABC\"))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a string S of length N consisting of uppercase English letters.\n\nHow many times does ABC occur in S as contiguous subsequences (see Sample Inputs and Outputs)?\n\nConstraints\n\n3 \\leq N \\leq 50\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint number of occurrences of ABC in S as contiguous subsequences.\n\nSample Input 1\n\n10\nZABCDBABCQ\n\nSample Output 1\n\n2\n\nTwo contiguous subsequences of S are equal to ABC: the 2-nd through 4-th characters, and the 7-th through 9-th characters.\n\nSample Input 2\n\n19\nTHREEONEFOURONEFIVE\n\nSample Output 2\n\n0\n\nNo contiguous subsequences of S are equal to ABC.\n\nSample Input 3\n\n33\nABCCABCBABCCABACBCBBABCBCBCBCABCB\n\nSample Output 3\n\n5", "sample_input": "10\nZABCDBABCQ\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02812", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a string S of length N consisting of uppercase English letters.\n\nHow many times does ABC occur in S as contiguous subsequences (see Sample Inputs and Outputs)?\n\nConstraints\n\n3 \\leq N \\leq 50\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint number of occurrences of ABC in S as contiguous subsequences.\n\nSample Input 1\n\n10\nZABCDBABCQ\n\nSample Output 1\n\n2\n\nTwo contiguous subsequences of S are equal to ABC: the 2-nd through 4-th characters, and the 7-th through 9-th characters.\n\nSample Input 2\n\n19\nTHREEONEFOURONEFIVE\n\nSample Output 2\n\n0\n\nNo contiguous subsequences of S are equal to ABC.\n\nSample Input 3\n\n33\nABCCABCBABCCABACBCBBABCBCBCBCABCB\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 50, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s565743691", "group_id": "codeNet:p02812", "input_text": "n = int(input())\ns = input()\nprint(s.count(\"ABC\"))", "language": "Python", "metadata": {"date": 1578708710, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02812.html", "problem_id": "p02812", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02812/input.txt", "sample_output_relpath": "derived/input_output/data/p02812/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02812/Python/s565743691.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s565743691", "user_id": "u038136206"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n = int(input())\ns = input()\nprint(s.count(\"ABC\"))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a string S of length N consisting of uppercase English letters.\n\nHow many times does ABC occur in S as contiguous subsequences (see Sample Inputs and Outputs)?\n\nConstraints\n\n3 \\leq N \\leq 50\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint number of occurrences of ABC in S as contiguous subsequences.\n\nSample Input 1\n\n10\nZABCDBABCQ\n\nSample Output 1\n\n2\n\nTwo contiguous subsequences of S are equal to ABC: the 2-nd through 4-th characters, and the 7-th through 9-th characters.\n\nSample Input 2\n\n19\nTHREEONEFOURONEFIVE\n\nSample Output 2\n\n0\n\nNo contiguous subsequences of S are equal to ABC.\n\nSample Input 3\n\n33\nABCCABCBABCCABACBCBBABCBCBCBCABCB\n\nSample Output 3\n\n5", "sample_input": "10\nZABCDBABCQ\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02812", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a string S of length N consisting of uppercase English letters.\n\nHow many times does ABC occur in S as contiguous subsequences (see Sample Inputs and Outputs)?\n\nConstraints\n\n3 \\leq N \\leq 50\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint number of occurrences of ABC in S as contiguous subsequences.\n\nSample Input 1\n\n10\nZABCDBABCQ\n\nSample Output 1\n\n2\n\nTwo contiguous subsequences of S are equal to ABC: the 2-nd through 4-th characters, and the 7-th through 9-th characters.\n\nSample Input 2\n\n19\nTHREEONEFOURONEFIVE\n\nSample Output 2\n\n0\n\nNo contiguous subsequences of S are equal to ABC.\n\nSample Input 3\n\n33\nABCCABCBABCCABACBCBBABCBCBCBCABCB\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 50, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s258230568", "group_id": "codeNet:p02813", "input_text": "import itertools\nimport math\n\nN = int(input())\nP = int(''.join(input().split()))\nQ = int(''.join(input().split()))\n\nN_list = []\nfor i in itertools.permutations(range(1,N+1)):\n N_list.append(int(''.join([str(x) for x in i])))\n\npointer1 = 0\npointer2 = 0\n\nfor i,x in enumerate(N_list):\n if x == P:\n pointer1 = i\n if x == Q:\n pointer2 = i\n \nprint(abs(pointer1 - pointer2))", "language": "Python", "metadata": {"date": 1578710988, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02813.html", "problem_id": "p02813", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02813/input.txt", "sample_output_relpath": "derived/input_output/data/p02813/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02813/Python/s258230568.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s258230568", "user_id": "u013956357"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import itertools\nimport math\n\nN = int(input())\nP = int(''.join(input().split()))\nQ = int(''.join(input().split()))\n\nN_list = []\nfor i in itertools.permutations(range(1,N+1)):\n N_list.append(int(''.join([str(x) for x in i])))\n\npointer1 = 0\npointer2 = 0\n\nfor i,x in enumerate(N_list):\n if x == P:\n pointer1 = i\n if x == Q:\n pointer2 = i\n \nprint(abs(pointer1 - pointer2))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two permutations P and Q of size N (that is, P and Q are both rearrangements of (1,~2,~...,~N)).\n\nThere are N! possible permutations of size N. Among them, let P and Q be the a-th and b-th lexicographically smallest permutations, respectively. Find |a - b|.\n\nNotes\n\nFor two sequences X and Y, X is said to be lexicographically smaller than Y if and only if there exists an integer k such that X_i = Y_i~(1 \\leq i < k) and X_k < Y_k.\n\nConstraints\n\n2 \\leq N \\leq 8\n\nP and Q are permutations of size N.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 P_2 ... P_N\nQ_1 Q_2 ... Q_N\n\nOutput\n\nPrint |a - b|.\n\nSample Input 1\n\n3\n1 3 2\n3 1 2\n\nSample Output 1\n\n3\n\nThere are 6 permutations of size 3: (1,~2,~3), (1,~3,~2), (2,~1,~3), (2,~3,~1), (3,~1,~2), and (3,~2,~1). Among them, (1,~3,~2) and (3,~1,~2) come 2-nd and 5-th in lexicographical order, so the answer is |2 - 5| = 3.\n\nSample Input 2\n\n8\n7 3 5 4 2 1 6 8\n3 8 2 5 4 6 7 1\n\nSample Output 2\n\n17517\n\nSample Input 3\n\n3\n1 2 3\n1 2 3\n\nSample Output 3\n\n0", "sample_input": "3\n1 3 2\n3 1 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02813", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two permutations P and Q of size N (that is, P and Q are both rearrangements of (1,~2,~...,~N)).\n\nThere are N! possible permutations of size N. Among them, let P and Q be the a-th and b-th lexicographically smallest permutations, respectively. Find |a - b|.\n\nNotes\n\nFor two sequences X and Y, X is said to be lexicographically smaller than Y if and only if there exists an integer k such that X_i = Y_i~(1 \\leq i < k) and X_k < Y_k.\n\nConstraints\n\n2 \\leq N \\leq 8\n\nP and Q are permutations of size N.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 P_2 ... P_N\nQ_1 Q_2 ... Q_N\n\nOutput\n\nPrint |a - b|.\n\nSample Input 1\n\n3\n1 3 2\n3 1 2\n\nSample Output 1\n\n3\n\nThere are 6 permutations of size 3: (1,~2,~3), (1,~3,~2), (2,~1,~3), (2,~3,~1), (3,~1,~2), and (3,~2,~1). Among them, (1,~3,~2) and (3,~1,~2) come 2-nd and 5-th in lexicographical order, so the answer is |2 - 5| = 3.\n\nSample Input 2\n\n8\n7 3 5 4 2 1 6 8\n3 8 2 5 4 6 7 1\n\nSample Output 2\n\n17517\n\nSample Input 3\n\n3\n1 2 3\n1 2 3\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 382, "cpu_time_ms": 112, "memory_kb": 4752}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s864980896", "group_id": "codeNet:p02814", "input_text": "import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\nfrom bisect import bisect\n\ndef input(): return sys.stdin.readline().strip()\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef LIST(): return list(map(int, input().split()))\nsys.setrecursionlimit(10 ** 9)\nINF = float('inf')\nmod = 10 ** 9 + 7\n\nN, M = MAP()\n\na = LIST()\n\n# a = [x//2 for x in a]\n# if a[0] % 2 == 0: # 偶数の時\n# \tfor x in a:\n# \t\tif x % 2 == 1:\n# \t\t\tprint(0)\n# \t\t\tsys.exit(0)\n# \tfor x in a:\n# \t\tif a[0] != x and abs(a[0]-x)%gcd(2*a[0], 2*x) != 0:\n# \t\t\tprint(0)\n# \t\t\tsys.exit()\n\n# \ttmp = 1\n# \tfor x in a:\n# \t\ttmp = x*tmp//gcd(x, tmp)\n# \tprint((M-tmp)//(tmp*2)+1)\n\n# else:\n# \tfor x in a:\n# \t\tif x % 2 == 0:\n# \t\t\tprint(0)\n# \t\t\tsys.exit(0)\n# \ttmp = 1\n# \tfor x in a: # 奇数の時\n# \t\ttmp = x*tmp//gcd(x, tmp)\n# \tprint((M-tmp)//(tmp*2)+1)\n\nfor i in range(1, N):\n\tif abs(a[0]//2-a[i]//2) % gcd(a[0], a[i]) != 0:\n\t\tprint(0)\n\t\tsys.exit()\ntmp = 1\nfor x in a:\n\ttmp = x//2*tmp//gcd(x//2, tmp)\nprint((M-tmp)//(tmp*2)+1)\n", "language": "Python", "metadata": {"date": 1578714969, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02814.html", "problem_id": "p02814", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02814/input.txt", "sample_output_relpath": "derived/input_output/data/p02814/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02814/Python/s864980896.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s864980896", "user_id": "u279493135"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\nfrom bisect import bisect\n\ndef input(): return sys.stdin.readline().strip()\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef LIST(): return list(map(int, input().split()))\nsys.setrecursionlimit(10 ** 9)\nINF = float('inf')\nmod = 10 ** 9 + 7\n\nN, M = MAP()\n\na = LIST()\n\n# a = [x//2 for x in a]\n# if a[0] % 2 == 0: # 偶数の時\n# \tfor x in a:\n# \t\tif x % 2 == 1:\n# \t\t\tprint(0)\n# \t\t\tsys.exit(0)\n# \tfor x in a:\n# \t\tif a[0] != x and abs(a[0]-x)%gcd(2*a[0], 2*x) != 0:\n# \t\t\tprint(0)\n# \t\t\tsys.exit()\n\n# \ttmp = 1\n# \tfor x in a:\n# \t\ttmp = x*tmp//gcd(x, tmp)\n# \tprint((M-tmp)//(tmp*2)+1)\n\n# else:\n# \tfor x in a:\n# \t\tif x % 2 == 0:\n# \t\t\tprint(0)\n# \t\t\tsys.exit(0)\n# \ttmp = 1\n# \tfor x in a: # 奇数の時\n# \t\ttmp = x*tmp//gcd(x, tmp)\n# \tprint((M-tmp)//(tmp*2)+1)\n\nfor i in range(1, N):\n\tif abs(a[0]//2-a[i]//2) % gcd(a[0], a[i]) != 0:\n\t\tprint(0)\n\t\tsys.exit()\ntmp = 1\nfor x in a:\n\ttmp = x//2*tmp//gcd(x//2, tmp)\nprint((M-tmp)//(tmp*2)+1)\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M.\n\nLet a semi-common multiple of A be a positive integer X that satisfies the following condition for every k (1 \\leq k \\leq N):\n\nThere exists a non-negative integer p such that X= a_k \\times (p+0.5).\n\nFind the number of semi-common multiples of A among the integers between 1 and M (inclusive).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^9\n\n2 \\leq a_i \\leq 10^9\n\na_i is an even number.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 a_2 ... a_N\n\nOutput\n\nPrint the number of semi-common multiples of A among the integers between 1 and M (inclusive).\n\nSample Input 1\n\n2 50\n6 10\n\nSample Output 1\n\n2\n\n15 = 6 \\times 2.5\n\n15 = 10 \\times 1.5\n\n45 = 6 \\times 7.5\n\n45 = 10 \\times 4.5\n\nThus, 15 and 45 are semi-common multiples of A. There are no other semi-common multiples of A between 1 and 50, so the answer is 2.\n\nSample Input 2\n\n3 100\n14 22 40\n\nSample Output 2\n\n0\n\nThe answer can be 0.\n\nSample Input 3\n\n5 1000000000\n6 6 2 6 2\n\nSample Output 3\n\n166666667", "sample_input": "2 50\n6 10\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02814", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M.\n\nLet a semi-common multiple of A be a positive integer X that satisfies the following condition for every k (1 \\leq k \\leq N):\n\nThere exists a non-negative integer p such that X= a_k \\times (p+0.5).\n\nFind the number of semi-common multiples of A among the integers between 1 and M (inclusive).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^9\n\n2 \\leq a_i \\leq 10^9\n\na_i is an even number.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 a_2 ... a_N\n\nOutput\n\nPrint the number of semi-common multiples of A among the integers between 1 and M (inclusive).\n\nSample Input 1\n\n2 50\n6 10\n\nSample Output 1\n\n2\n\n15 = 6 \\times 2.5\n\n15 = 10 \\times 1.5\n\n45 = 6 \\times 7.5\n\n45 = 10 \\times 4.5\n\nThus, 15 and 45 are semi-common multiples of A. There are no other semi-common multiples of A between 1 and 50, so the answer is 2.\n\nSample Input 2\n\n3 100\n14 22 40\n\nSample Output 2\n\n0\n\nThe answer can be 0.\n\nSample Input 3\n\n5 1000000000\n6 6 2 6 2\n\nSample Output 3\n\n166666667", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1326, "cpu_time_ms": 427, "memory_kb": 85100}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s829030296", "group_id": "codeNet:p02818", "input_text": "a, b, k = map(int, input().split())\n\nif a >= k:\n print(a - k, b)\nelse:\n print(0, max(0, a + b - k))", "language": "Python", "metadata": {"date": 1583804059, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02818.html", "problem_id": "p02818", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02818/input.txt", "sample_output_relpath": "derived/input_output/data/p02818/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02818/Python/s829030296.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s829030296", "user_id": "u718706790"}, "prompt_components": {"gold_output": "0 2\n", "input_to_evaluate": "a, b, k = map(int, input().split())\n\nif a >= k:\n print(a - k, b)\nelse:\n print(0, max(0, a + b - k))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n\nIf Takahashi has one or more cookies, eat one of his cookies.\n\nOtherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n\nIf they both have no cookies, do nothing.\n\nIn the end, how many cookies will Takahashi and Aoki have, respectively?\n\nConstraints\n\n0 \\leq A \\leq 10^{12}\n\n0 \\leq B \\leq 10^{12}\n\n0 \\leq K \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the numbers of Takahashi's and Aoki's cookies after K actions.\n\nSample Input 1\n\n2 3 3\n\nSample Output 1\n\n0 2\n\nTakahashi will do the following:\n\nHe has two cookies, so he eats one of them.\n\nNow he has one cookie left, and he eats it.\n\nNow he has no cookies left, but Aoki has three, so Takahashi eats one of them.\n\nThus, in the end, Takahashi will have 0 cookies, and Aoki will have 2.\n\nSample Input 2\n\n500000000000 500000000000 1000000000000\n\nSample Output 2\n\n0 0\n\nWatch out for overflows.", "sample_input": "2 3 3\n"}, "reference_outputs": ["0 2\n"], "source_document_id": "p02818", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n\nIf Takahashi has one or more cookies, eat one of his cookies.\n\nOtherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n\nIf they both have no cookies, do nothing.\n\nIn the end, how many cookies will Takahashi and Aoki have, respectively?\n\nConstraints\n\n0 \\leq A \\leq 10^{12}\n\n0 \\leq B \\leq 10^{12}\n\n0 \\leq K \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the numbers of Takahashi's and Aoki's cookies after K actions.\n\nSample Input 1\n\n2 3 3\n\nSample Output 1\n\n0 2\n\nTakahashi will do the following:\n\nHe has two cookies, so he eats one of them.\n\nNow he has one cookie left, and he eats it.\n\nNow he has no cookies left, but Aoki has three, so Takahashi eats one of them.\n\nThus, in the end, Takahashi will have 0 cookies, and Aoki will have 2.\n\nSample Input 2\n\n500000000000 500000000000 1000000000000\n\nSample Output 2\n\n0 0\n\nWatch out for overflows.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 101, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s473138077", "group_id": "codeNet:p02818", "input_text": "A,B,K = map(int, input().split()) \n\nS=max([0,A-K])\n\nif A= 22:\n print(\"bust\")\nelse:\n print(\"win\")", "language": "Python", "metadata": {"date": 1588663728, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02835.html", "problem_id": "p02835", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02835/input.txt", "sample_output_relpath": "derived/input_output/data/p02835/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02835/Python/s030355148.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s030355148", "user_id": "u508164527"}, "prompt_components": {"gold_output": "win\n", "input_to_evaluate": "A = [int(x) for x in input().split()]\nif sum(A) >= 22:\n print(\"bust\")\nelse:\n print(\"win\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are three integers A_1, A_2, and A_3.\n\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\nConstraints\n\n1 \\leq A_i \\leq 13 \\ \\ (i=1,2,3)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\nSample Input 1\n\n5 7 9\n\nSample Output 1\n\nwin\n\n5+7+9=21, so print win.\n\nSample Input 2\n\n13 7 2\n\nSample Output 2\n\nbust\n\n13+7+2=22, so print bust.", "sample_input": "5 7 9\n"}, "reference_outputs": ["win\n"], "source_document_id": "p02835", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are three integers A_1, A_2, and A_3.\n\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\nConstraints\n\n1 \\leq A_i \\leq 13 \\ \\ (i=1,2,3)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\nSample Input 1\n\n5 7 9\n\nSample Output 1\n\nwin\n\n5+7+9=21, so print win.\n\nSample Input 2\n\n13 7 2\n\nSample Output 2\n\nbust\n\n13+7+2=22, so print bust.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 91, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s114328781", "group_id": "codeNet:p02835", "input_text": "S = list(map(int,input().split()))\n\nif sum(S) >= 22:\n print('bust')\nelse:\n print('win')", "language": "Python", "metadata": {"date": 1578027208, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02835.html", "problem_id": "p02835", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02835/input.txt", "sample_output_relpath": "derived/input_output/data/p02835/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02835/Python/s114328781.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s114328781", "user_id": "u259861571"}, "prompt_components": {"gold_output": "win\n", "input_to_evaluate": "S = list(map(int,input().split()))\n\nif sum(S) >= 22:\n print('bust')\nelse:\n print('win')", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are three integers A_1, A_2, and A_3.\n\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\nConstraints\n\n1 \\leq A_i \\leq 13 \\ \\ (i=1,2,3)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\nSample Input 1\n\n5 7 9\n\nSample Output 1\n\nwin\n\n5+7+9=21, so print win.\n\nSample Input 2\n\n13 7 2\n\nSample Output 2\n\nbust\n\n13+7+2=22, so print bust.", "sample_input": "5 7 9\n"}, "reference_outputs": ["win\n"], "source_document_id": "p02835", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are three integers A_1, A_2, and A_3.\n\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\nConstraints\n\n1 \\leq A_i \\leq 13 \\ \\ (i=1,2,3)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\nSample Input 1\n\n5 7 9\n\nSample Output 1\n\nwin\n\n5+7+9=21, so print win.\n\nSample Input 2\n\n13 7 2\n\nSample Output 2\n\nbust\n\n13+7+2=22, so print bust.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 93, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s107885815", "group_id": "codeNet:p02835", "input_text": "n = sum(list(map(int, input().split())))\nprint('win' if n <= 21 else 'bust')", "language": "Python", "metadata": {"date": 1575858201, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02835.html", "problem_id": "p02835", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02835/input.txt", "sample_output_relpath": "derived/input_output/data/p02835/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02835/Python/s107885815.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s107885815", "user_id": "u148218179"}, "prompt_components": {"gold_output": "win\n", "input_to_evaluate": "n = sum(list(map(int, input().split())))\nprint('win' if n <= 21 else 'bust')", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are three integers A_1, A_2, and A_3.\n\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\nConstraints\n\n1 \\leq A_i \\leq 13 \\ \\ (i=1,2,3)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\nSample Input 1\n\n5 7 9\n\nSample Output 1\n\nwin\n\n5+7+9=21, so print win.\n\nSample Input 2\n\n13 7 2\n\nSample Output 2\n\nbust\n\n13+7+2=22, so print bust.", "sample_input": "5 7 9\n"}, "reference_outputs": ["win\n"], "source_document_id": "p02835", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are three integers A_1, A_2, and A_3.\n\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\nConstraints\n\n1 \\leq A_i \\leq 13 \\ \\ (i=1,2,3)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\nSample Input 1\n\n5 7 9\n\nSample Output 1\n\nwin\n\n5+7+9=21, so print win.\n\nSample Input 2\n\n13 7 2\n\nSample Output 2\n\nbust\n\n13+7+2=22, so print bust.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 76, "cpu_time_ms": 175, "memory_kb": 38384}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s295713758", "group_id": "codeNet:p02835", "input_text": "N = input().split()\nprint(N)\n\nsum = 0\nfor i in range(len(N)):\n sum += int(N[i])\n \nif sum >= 22:\n print('bust')\nelse:\n print('win')", "language": "Python", "metadata": {"date": 1575857106, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02835.html", "problem_id": "p02835", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02835/input.txt", "sample_output_relpath": "derived/input_output/data/p02835/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02835/Python/s295713758.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s295713758", "user_id": "u570832830"}, "prompt_components": {"gold_output": "win\n", "input_to_evaluate": "N = input().split()\nprint(N)\n\nsum = 0\nfor i in range(len(N)):\n sum += int(N[i])\n \nif sum >= 22:\n print('bust')\nelse:\n print('win')", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are three integers A_1, A_2, and A_3.\n\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\nConstraints\n\n1 \\leq A_i \\leq 13 \\ \\ (i=1,2,3)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\nSample Input 1\n\n5 7 9\n\nSample Output 1\n\nwin\n\n5+7+9=21, so print win.\n\nSample Input 2\n\n13 7 2\n\nSample Output 2\n\nbust\n\n13+7+2=22, so print bust.", "sample_input": "5 7 9\n"}, "reference_outputs": ["win\n"], "source_document_id": "p02835", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are three integers A_1, A_2, and A_3.\n\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\nConstraints\n\n1 \\leq A_i \\leq 13 \\ \\ (i=1,2,3)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\nSample Input 1\n\n5 7 9\n\nSample Output 1\n\nwin\n\n5+7+9=21, so print win.\n\nSample Input 2\n\n13 7 2\n\nSample Output 2\n\nbust\n\n13+7+2=22, so print bust.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 134, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s326082885", "group_id": "codeNet:p02836", "input_text": "import sys\ninput = sys.stdin.readline\n\nS = input()\nl = len(S)\ncount = 0\nif len(S)%2 == 1:\n #print(\"here\")\n for i in range(int(len(S)/2)):\n #print(S[i], S[l-i-2])\n if S[i] != S[l-i-2]:\n count += 1\nelse:\n for i in range(int((len(S)-1)/2)):\n #print(S[i], S[l-i-2])\n if S[i] != S[l-i-2]:\n count += 1\n\nprint(count)\n", "language": "Python", "metadata": {"date": 1576972329, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02836.html", "problem_id": "p02836", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02836/input.txt", "sample_output_relpath": "derived/input_output/data/p02836/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02836/Python/s326082885.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s326082885", "user_id": "u077141270"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import sys\ninput = sys.stdin.readline\n\nS = input()\nl = len(S)\ncount = 0\nif len(S)%2 == 1:\n #print(\"here\")\n for i in range(int(len(S)/2)):\n #print(S[i], S[l-i-2])\n if S[i] != S[l-i-2]:\n count += 1\nelse:\n for i in range(int((len(S)-1)/2)):\n #print(S[i], S[l-i-2])\n if S[i] != S[l-i-2]:\n count += 1\n\nprint(count)\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.\n\nGiven is a string S. Find the minimum number of hugs needed to make S palindromic.\n\nConstraints\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of hugs needed to make S palindromic.\n\nSample Input 1\n\nredcoder\n\nSample Output 1\n\n1\n\nFor example, we can change the fourth character to o and get a palindrome redooder.\n\nSample Input 2\n\nvvvvvv\n\nSample Output 2\n\n0\n\nWe might need no hugs at all.\n\nSample Input 3\n\nabcdabc\n\nSample Output 3\n\n2", "sample_input": "redcoder\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02836", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.\n\nGiven is a string S. Find the minimum number of hugs needed to make S palindromic.\n\nConstraints\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of hugs needed to make S palindromic.\n\nSample Input 1\n\nredcoder\n\nSample Output 1\n\n1\n\nFor example, we can change the fourth character to o and get a palindrome redooder.\n\nSample Input 2\n\nvvvvvv\n\nSample Output 2\n\n0\n\nWe might need no hugs at all.\n\nSample Input 3\n\nabcdabc\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 369, "cpu_time_ms": 166, "memory_kb": 38384}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s520570770", "group_id": "codeNet:p02838", "input_text": "import sys\ninput = sys.stdin.readline\nn = int(input())\na = list(map(int, input().split()))\nmod = 7 + 10**9\nA = []\nleng = len(format(max(a), 'b'))\nbit_acc = [0 for i in range(leng)]\nfor i in range(n):\n A.append(list(map(int, format(a[i], 'b').zfill(leng))))\nfor i in range(leng):\n bit_acc[i] = sum([A[j][i] for j in range(n)]) \nans = 0\nfor i in range(n):\n for j in range(leng):\n if A[i][j] == 1:\n ans += (n - bit_acc[j]) * (2 ** (leng - j - 1))\n else:\n ans += bit_acc[j] * (2 ** (leng - j - 1))\nprint((ans * 500000004) % mod)\n\n", "language": "Python", "metadata": {"date": 1581664616, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02838.html", "problem_id": "p02838", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02838/input.txt", "sample_output_relpath": "derived/input_output/data/p02838/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02838/Python/s520570770.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s520570770", "user_id": "u691896522"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "import sys\ninput = sys.stdin.readline\nn = int(input())\na = list(map(int, input().split()))\nmod = 7 + 10**9\nA = []\nleng = len(format(max(a), 'b'))\nbit_acc = [0 for i in range(leng)]\nfor i in range(n):\n A.append(list(map(int, format(a[i], 'b').zfill(leng))))\nfor i in range(leng):\n bit_acc[i] = sum([A[j][i] for j in range(n)]) \nans = 0\nfor i in range(n):\n for j in range(leng):\n if A[i][j] == 1:\n ans += (n - bit_acc[j]) * (2 ** (leng - j - 1))\n else:\n ans += bit_acc[j] * (2 ** (leng - j - 1))\nprint((ans * 500000004) % mod)\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N integers. The i-th integer is A_i.\n\nFind \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nWhat is \\mbox{ XOR }?\n\nThe XOR of integers A and B, A \\mbox{ XOR } B, is defined as follows:\n\nWhen A \\mbox{ XOR } B is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if either A or B, but not both, has 1 in the 2^k's place, and 0 otherwise.\n\nFor example, 3 \\mbox{ XOR } 5 = 6. (In base two: 011 \\mbox{ XOR } 101 = 110.)\n\nConstraints\n\n2 \\leq N \\leq 3 \\times 10^5\n\n0 \\leq A_i < 2^{60}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the value \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n6\n\nWe have (1\\mbox{ XOR } 2)+(1\\mbox{ XOR } 3)+(2\\mbox{ XOR } 3)=3+2+1=6.\n\nSample Input 2\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 2\n\n237\n\nSample Input 3\n\n10\n3 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820\n\nSample Output 3\n\n103715602\n\nPrint the sum modulo (10^9+7).", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["6\n"], "source_document_id": "p02838", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N integers. The i-th integer is A_i.\n\nFind \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nWhat is \\mbox{ XOR }?\n\nThe XOR of integers A and B, A \\mbox{ XOR } B, is defined as follows:\n\nWhen A \\mbox{ XOR } B is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if either A or B, but not both, has 1 in the 2^k's place, and 0 otherwise.\n\nFor example, 3 \\mbox{ XOR } 5 = 6. (In base two: 011 \\mbox{ XOR } 101 = 110.)\n\nConstraints\n\n2 \\leq N \\leq 3 \\times 10^5\n\n0 \\leq A_i < 2^{60}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the value \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n6\n\nWe have (1\\mbox{ XOR } 2)+(1\\mbox{ XOR } 3)+(2\\mbox{ XOR } 3)=3+2+1=6.\n\nSample Input 2\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 2\n\n237\n\nSample Input 3\n\n10\n3 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820\n\nSample Output 3\n\n103715602\n\nPrint the sum modulo (10^9+7).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 571, "cpu_time_ms": 2116, "memory_kb": 196892}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s683726040", "group_id": "codeNet:p02838", "input_text": "n = int(input())\nA = list(map(int,input().split()))\nC = [0 for i in range(60)]\nmod = 1000000007\nfor a in A:\n for i in range(60):\n C[i] += a%2\n a>>=1\n if a==0:\n break\nans = 0\nfor i in range(60):\n u = (2**(i))%mod\n num = C[i]*(n-C[i])\n ans+=u*num\n ans%=mod\nprint(ans)", "language": "Python", "metadata": {"date": 1576275080, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02838.html", "problem_id": "p02838", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02838/input.txt", "sample_output_relpath": "derived/input_output/data/p02838/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02838/Python/s683726040.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s683726040", "user_id": "u382907940"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "n = int(input())\nA = list(map(int,input().split()))\nC = [0 for i in range(60)]\nmod = 1000000007\nfor a in A:\n for i in range(60):\n C[i] += a%2\n a>>=1\n if a==0:\n break\nans = 0\nfor i in range(60):\n u = (2**(i))%mod\n num = C[i]*(n-C[i])\n ans+=u*num\n ans%=mod\nprint(ans)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N integers. The i-th integer is A_i.\n\nFind \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nWhat is \\mbox{ XOR }?\n\nThe XOR of integers A and B, A \\mbox{ XOR } B, is defined as follows:\n\nWhen A \\mbox{ XOR } B is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if either A or B, but not both, has 1 in the 2^k's place, and 0 otherwise.\n\nFor example, 3 \\mbox{ XOR } 5 = 6. (In base two: 011 \\mbox{ XOR } 101 = 110.)\n\nConstraints\n\n2 \\leq N \\leq 3 \\times 10^5\n\n0 \\leq A_i < 2^{60}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the value \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n6\n\nWe have (1\\mbox{ XOR } 2)+(1\\mbox{ XOR } 3)+(2\\mbox{ XOR } 3)=3+2+1=6.\n\nSample Input 2\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 2\n\n237\n\nSample Input 3\n\n10\n3 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820\n\nSample Output 3\n\n103715602\n\nPrint the sum modulo (10^9+7).", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["6\n"], "source_document_id": "p02838", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N integers. The i-th integer is A_i.\n\nFind \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nWhat is \\mbox{ XOR }?\n\nThe XOR of integers A and B, A \\mbox{ XOR } B, is defined as follows:\n\nWhen A \\mbox{ XOR } B is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if either A or B, but not both, has 1 in the 2^k's place, and 0 otherwise.\n\nFor example, 3 \\mbox{ XOR } 5 = 6. (In base two: 011 \\mbox{ XOR } 101 = 110.)\n\nConstraints\n\n2 \\leq N \\leq 3 \\times 10^5\n\n0 \\leq A_i < 2^{60}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the value \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n6\n\nWe have (1\\mbox{ XOR } 2)+(1\\mbox{ XOR } 3)+(2\\mbox{ XOR } 3)=3+2+1=6.\n\nSample Input 2\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 2\n\n237\n\nSample Input 3\n\n10\n3 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820\n\nSample Output 3\n\n103715602\n\nPrint the sum modulo (10^9+7).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 284, "cpu_time_ms": 2105, "memory_kb": 42156}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s858603180", "group_id": "codeNet:p02838", "input_text": "N = int(input())\nA = list(map(int, input().split())) \n\ndef sumXOR( arr, n): \n sum = 0\n for i in range(0, 64): \n \n # Count of zeros and ones \n zc = 0\n oc = 0\n \n # Individual sum at each bit position \n idsum = 0\n for j in range(0, n): \n if (arr[j] % 2 == 0): \n zc = (zc + 1)\n \n else: \n oc = (oc + 1)\n arr[j] = int(arr[j] / 2) \n \n \n # calculating individual bit sum \n idsum = (oc * zc * ((1 << i))) % 1000000007\n \n # final sum \n sum = (sum + idsum)\n \n return sum\n \n \n \n \nprint(sumXOR(A, N) % 1000000007)", "language": "Python", "metadata": {"date": 1575862125, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02838.html", "problem_id": "p02838", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02838/input.txt", "sample_output_relpath": "derived/input_output/data/p02838/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02838/Python/s858603180.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s858603180", "user_id": "u861095163"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "N = int(input())\nA = list(map(int, input().split())) \n\ndef sumXOR( arr, n): \n sum = 0\n for i in range(0, 64): \n \n # Count of zeros and ones \n zc = 0\n oc = 0\n \n # Individual sum at each bit position \n idsum = 0\n for j in range(0, n): \n if (arr[j] % 2 == 0): \n zc = (zc + 1)\n \n else: \n oc = (oc + 1)\n arr[j] = int(arr[j] / 2) \n \n \n # calculating individual bit sum \n idsum = (oc * zc * ((1 << i))) % 1000000007\n \n # final sum \n sum = (sum + idsum)\n \n return sum\n \n \n \n \nprint(sumXOR(A, N) % 1000000007)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N integers. The i-th integer is A_i.\n\nFind \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nWhat is \\mbox{ XOR }?\n\nThe XOR of integers A and B, A \\mbox{ XOR } B, is defined as follows:\n\nWhen A \\mbox{ XOR } B is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if either A or B, but not both, has 1 in the 2^k's place, and 0 otherwise.\n\nFor example, 3 \\mbox{ XOR } 5 = 6. (In base two: 011 \\mbox{ XOR } 101 = 110.)\n\nConstraints\n\n2 \\leq N \\leq 3 \\times 10^5\n\n0 \\leq A_i < 2^{60}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the value \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n6\n\nWe have (1\\mbox{ XOR } 2)+(1\\mbox{ XOR } 3)+(2\\mbox{ XOR } 3)=3+2+1=6.\n\nSample Input 2\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 2\n\n237\n\nSample Input 3\n\n10\n3 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820\n\nSample Output 3\n\n103715602\n\nPrint the sum modulo (10^9+7).", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["6\n"], "source_document_id": "p02838", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N integers. The i-th integer is A_i.\n\nFind \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nWhat is \\mbox{ XOR }?\n\nThe XOR of integers A and B, A \\mbox{ XOR } B, is defined as follows:\n\nWhen A \\mbox{ XOR } B is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if either A or B, but not both, has 1 in the 2^k's place, and 0 otherwise.\n\nFor example, 3 \\mbox{ XOR } 5 = 6. (In base two: 011 \\mbox{ XOR } 101 = 110.)\n\nConstraints\n\n2 \\leq N \\leq 3 \\times 10^5\n\n0 \\leq A_i < 2^{60}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the value \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n6\n\nWe have (1\\mbox{ XOR } 2)+(1\\mbox{ XOR } 3)+(2\\mbox{ XOR } 3)=3+2+1=6.\n\nSample Input 2\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 2\n\n237\n\nSample Input 3\n\n10\n3 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820\n\nSample Output 3\n\n103715602\n\nPrint the sum modulo (10^9+7).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 708, "cpu_time_ms": 1279, "memory_kb": 122808}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s302092560", "group_id": "codeNet:p02839", "input_text": "import numpy as np\nHW = list(map(int, input().split()))\nH = HW[0]\nW = HW[1]\nA = np.empty((H, W), dtype=np.int64)\nB = np.empty((H, W), dtype=np.int64)\nfor i in range(H):\n A[i] = np.fromstring(input(), dtype = np.int64, sep = ' ')\nfor i in range(H):\n B[i] = np.fromstring(input(), dtype = np.int64, sep = ' ')\n\nC = np.abs(A - B)\nK = (H + W) * (C.max())\n\nD = np.full((H, W, K), False)\nD[0][0][C[0][0]] = True\nD[0][1][C[0][0] + C[0][1]] = True\nD[0][1][abs(C[0][0] - C[0][1])] = True\nD[1][0][C[0][0] + C[1][0]] = True\nD[1][0][abs(C[0][0] - C[1][0])] = True\n\nfor i in range(1, H):\n for j in range(1, W):\n for k in range(K):\n if k + C[i][j] < K:\n if D[i-1][j][k + C[i][j]] or D[i][j-1][k + C[i][j]]:\n D[i][j][k] = True\n continue\n if D[i-1][j][abs(k - C[i][j])] or D[i][j-1][abs(k - C[i][j])]:\n D[i][j][k] = True\n\nfor k in range(K):\n if D[H-1][W-1][k]:\n print(k)\n break", "language": "Python", "metadata": {"date": 1576877154, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02839.html", "problem_id": "p02839", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02839/input.txt", "sample_output_relpath": "derived/input_output/data/p02839/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02839/Python/s302092560.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s302092560", "user_id": "u924507375"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "import numpy as np\nHW = list(map(int, input().split()))\nH = HW[0]\nW = HW[1]\nA = np.empty((H, W), dtype=np.int64)\nB = np.empty((H, W), dtype=np.int64)\nfor i in range(H):\n A[i] = np.fromstring(input(), dtype = np.int64, sep = ' ')\nfor i in range(H):\n B[i] = np.fromstring(input(), dtype = np.int64, sep = ' ')\n\nC = np.abs(A - B)\nK = (H + W) * (C.max())\n\nD = np.full((H, W, K), False)\nD[0][0][C[0][0]] = True\nD[0][1][C[0][0] + C[0][1]] = True\nD[0][1][abs(C[0][0] - C[0][1])] = True\nD[1][0][C[0][0] + C[1][0]] = True\nD[1][0][abs(C[0][0] - C[1][0])] = True\n\nfor i in range(1, H):\n for j in range(1, W):\n for k in range(K):\n if k + C[i][j] < K:\n if D[i-1][j][k + C[i][j]] or D[i][j-1][k + C[i][j]]:\n D[i][j][k] = True\n continue\n if D[i-1][j][abs(k - C[i][j])] or D[i][j-1][abs(k - C[i][j])]:\n D[i][j][k] = True\n\nfor k in range(K):\n if D[H-1][W-1][k]:\n print(k)\n break", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a grid with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left.\n\nThe square (i, j) has two numbers A_{ij} and B_{ij} written on it.\n\nFirst, for each square, Takahashi paints one of the written numbers red and the other blue.\n\nThen, he travels from the square (1, 1) to the square (H, W). In one move, he can move from a square (i, j) to the square (i+1, j) or the square (i, j+1). He must not leave the grid.\n\nLet the unbalancedness be the absolute difference of the sum of red numbers and the sum of blue numbers written on the squares along Takahashi's path, including the squares (1, 1) and (H, W).\n\nTakahashi wants to make the unbalancedness as small as possible by appropriately painting the grid and traveling on it.\n\nFind the minimum unbalancedness possible.\n\nConstraints\n\n2 \\leq H \\leq 80\n\n2 \\leq W \\leq 80\n\n0 \\leq A_{ij} \\leq 80\n\n0 \\leq B_{ij} \\leq 80\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nA_{11} A_{12} \\ldots A_{1W}\n:\nA_{H1} A_{H2} \\ldots A_{HW}\nB_{11} B_{12} \\ldots B_{1W}\n:\nB_{H1} B_{H2} \\ldots B_{HW}\n\nOutput\n\nPrint the minimum unbalancedness possible.\n\nSample Input 1\n\n2 2\n1 2\n3 4\n3 4\n2 1\n\nSample Output 1\n\n0\n\nBy painting the grid and traveling on it as shown in the figure below, the sum of red numbers and the sum of blue numbers are 3+3+1=7 and 1+2+4=7, respectively, for the unbalancedness of 0.\n\nSample Input 2\n\n2 3\n1 10 80\n80 10 1\n1 2 3\n4 5 6\n\nSample Output 2\n\n2", "sample_input": "2 2\n1 2\n3 4\n3 4\n2 1\n"}, "reference_outputs": ["0\n"], "source_document_id": "p02839", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a grid with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left.\n\nThe square (i, j) has two numbers A_{ij} and B_{ij} written on it.\n\nFirst, for each square, Takahashi paints one of the written numbers red and the other blue.\n\nThen, he travels from the square (1, 1) to the square (H, W). In one move, he can move from a square (i, j) to the square (i+1, j) or the square (i, j+1). He must not leave the grid.\n\nLet the unbalancedness be the absolute difference of the sum of red numbers and the sum of blue numbers written on the squares along Takahashi's path, including the squares (1, 1) and (H, W).\n\nTakahashi wants to make the unbalancedness as small as possible by appropriately painting the grid and traveling on it.\n\nFind the minimum unbalancedness possible.\n\nConstraints\n\n2 \\leq H \\leq 80\n\n2 \\leq W \\leq 80\n\n0 \\leq A_{ij} \\leq 80\n\n0 \\leq B_{ij} \\leq 80\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nA_{11} A_{12} \\ldots A_{1W}\n:\nA_{H1} A_{H2} \\ldots A_{HW}\nB_{11} B_{12} \\ldots B_{1W}\n:\nB_{H1} B_{H2} \\ldots B_{HW}\n\nOutput\n\nPrint the minimum unbalancedness possible.\n\nSample Input 1\n\n2 2\n1 2\n3 4\n3 4\n2 1\n\nSample Output 1\n\n0\n\nBy painting the grid and traveling on it as shown in the figure below, the sum of red numbers and the sum of blue numbers are 3+3+1=7 and 1+2+4=7, respectively, for the unbalancedness of 0.\n\nSample Input 2\n\n2 3\n1 10 80\n80 10 1\n1 2 3\n4 5 6\n\nSample Output 2\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 916, "cpu_time_ms": 2110, "memory_kb": 654548}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s969916305", "group_id": "codeNet:p02839", "input_text": "h, w = list(map(int, input().split()))\n\naa = [list(map(int, input().split())) for _ in range(h)]\nbb = [list(map(int, input().split())) for _ in range(h)]\n\ndif = []\nfor i in range(h):\n dif.append([int(abs(a - b)) for a, b in zip(aa[i], bb[i])])\n\ndp = [[set() for _ in range(w + 2)] for _ in range(h + 2)]\n\ndp[1][0] = set([0])\n\nlim = [[0 for _ in range(w + 2)] for _ in range(h + 2)]\nfor i in reversed(range(1, h + 1)):\n for j in reversed(range(1, w + 1)):\n lim[i][j] = max(lim[i + 1][j], lim[i][j + 1]) + dif[i - 1][j - 1]\n\n\n\nfor i in range(1, h + 1):\n for j in range(1, w + 1):\n origin = dp[i - 1][j] | dp[i][j - 1]\n cand = {x + dif[i - 1][j - 1] for x in origin} | {x - dif[i - 1][j - 1] for x in origin}\n dp[i][j] = {x for x in cand if x <= lim[i][j]} | {min({10 ** 10}.union({x for x in cand if x > lim[i][j]}))}\n\nprint(min([abs(x) for x in dp[h][w]]))", "language": "Python", "metadata": {"date": 1576626943, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02839.html", "problem_id": "p02839", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02839/input.txt", "sample_output_relpath": "derived/input_output/data/p02839/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02839/Python/s969916305.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s969916305", "user_id": "u653807637"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "h, w = list(map(int, input().split()))\n\naa = [list(map(int, input().split())) for _ in range(h)]\nbb = [list(map(int, input().split())) for _ in range(h)]\n\ndif = []\nfor i in range(h):\n dif.append([int(abs(a - b)) for a, b in zip(aa[i], bb[i])])\n\ndp = [[set() for _ in range(w + 2)] for _ in range(h + 2)]\n\ndp[1][0] = set([0])\n\nlim = [[0 for _ in range(w + 2)] for _ in range(h + 2)]\nfor i in reversed(range(1, h + 1)):\n for j in reversed(range(1, w + 1)):\n lim[i][j] = max(lim[i + 1][j], lim[i][j + 1]) + dif[i - 1][j - 1]\n\n\n\nfor i in range(1, h + 1):\n for j in range(1, w + 1):\n origin = dp[i - 1][j] | dp[i][j - 1]\n cand = {x + dif[i - 1][j - 1] for x in origin} | {x - dif[i - 1][j - 1] for x in origin}\n dp[i][j] = {x for x in cand if x <= lim[i][j]} | {min({10 ** 10}.union({x for x in cand if x > lim[i][j]}))}\n\nprint(min([abs(x) for x in dp[h][w]]))", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a grid with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left.\n\nThe square (i, j) has two numbers A_{ij} and B_{ij} written on it.\n\nFirst, for each square, Takahashi paints one of the written numbers red and the other blue.\n\nThen, he travels from the square (1, 1) to the square (H, W). In one move, he can move from a square (i, j) to the square (i+1, j) or the square (i, j+1). He must not leave the grid.\n\nLet the unbalancedness be the absolute difference of the sum of red numbers and the sum of blue numbers written on the squares along Takahashi's path, including the squares (1, 1) and (H, W).\n\nTakahashi wants to make the unbalancedness as small as possible by appropriately painting the grid and traveling on it.\n\nFind the minimum unbalancedness possible.\n\nConstraints\n\n2 \\leq H \\leq 80\n\n2 \\leq W \\leq 80\n\n0 \\leq A_{ij} \\leq 80\n\n0 \\leq B_{ij} \\leq 80\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nA_{11} A_{12} \\ldots A_{1W}\n:\nA_{H1} A_{H2} \\ldots A_{HW}\nB_{11} B_{12} \\ldots B_{1W}\n:\nB_{H1} B_{H2} \\ldots B_{HW}\n\nOutput\n\nPrint the minimum unbalancedness possible.\n\nSample Input 1\n\n2 2\n1 2\n3 4\n3 4\n2 1\n\nSample Output 1\n\n0\n\nBy painting the grid and traveling on it as shown in the figure below, the sum of red numbers and the sum of blue numbers are 3+3+1=7 and 1+2+4=7, respectively, for the unbalancedness of 0.\n\nSample Input 2\n\n2 3\n1 10 80\n80 10 1\n1 2 3\n4 5 6\n\nSample Output 2\n\n2", "sample_input": "2 2\n1 2\n3 4\n3 4\n2 1\n"}, "reference_outputs": ["0\n"], "source_document_id": "p02839", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a grid with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left.\n\nThe square (i, j) has two numbers A_{ij} and B_{ij} written on it.\n\nFirst, for each square, Takahashi paints one of the written numbers red and the other blue.\n\nThen, he travels from the square (1, 1) to the square (H, W). In one move, he can move from a square (i, j) to the square (i+1, j) or the square (i, j+1). He must not leave the grid.\n\nLet the unbalancedness be the absolute difference of the sum of red numbers and the sum of blue numbers written on the squares along Takahashi's path, including the squares (1, 1) and (H, W).\n\nTakahashi wants to make the unbalancedness as small as possible by appropriately painting the grid and traveling on it.\n\nFind the minimum unbalancedness possible.\n\nConstraints\n\n2 \\leq H \\leq 80\n\n2 \\leq W \\leq 80\n\n0 \\leq A_{ij} \\leq 80\n\n0 \\leq B_{ij} \\leq 80\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nA_{11} A_{12} \\ldots A_{1W}\n:\nA_{H1} A_{H2} \\ldots A_{HW}\nB_{11} B_{12} \\ldots B_{1W}\n:\nB_{H1} B_{H2} \\ldots B_{HW}\n\nOutput\n\nPrint the minimum unbalancedness possible.\n\nSample Input 1\n\n2 2\n1 2\n3 4\n3 4\n2 1\n\nSample Output 1\n\n0\n\nBy painting the grid and traveling on it as shown in the figure below, the sum of red numbers and the sum of blue numbers are 3+3+1=7 and 1+2+4=7, respectively, for the unbalancedness of 0.\n\nSample Input 2\n\n2 3\n1 10 80\n80 10 1\n1 2 3\n4 5 6\n\nSample Output 2\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 892, "cpu_time_ms": 2150, "memory_kb": 726792}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s237590611", "group_id": "codeNet:p02842", "input_text": "import sys\nn=int(input())\nfor i in range(n):\n if (int(i*108/100)==n):\n print (i)\n sys.exit() \nprint(\":(\")", "language": "Python", "metadata": {"date": 1586926917, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02842.html", "problem_id": "p02842", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02842/input.txt", "sample_output_relpath": "derived/input_output/data/p02842/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02842/Python/s237590611.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s237590611", "user_id": "u791146764"}, "prompt_components": {"gold_output": "400\n", "input_to_evaluate": "import sys\nn=int(input())\nfor i in range(n):\n if (int(i*108/100)==n):\n print (i)\n sys.exit() \nprint(\":(\")", "problem_context": "Score: 200 points\n\nProblem Statement\n\nTakahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it.\n\nThe consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \\times 1.08 yen (rounded down to the nearest integer).\n\nTakahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer.\n\nIf there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact.\n\nConstraints\n\n1 \\leq N \\leq 50000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there are values that could be X, the price of the apple pie before tax, print any one of them.\n\nIf there are multiple such values, printing any one of them will be accepted.\n\nIf no value could be X, print :(.\n\nSample Input 1\n\n432\n\nSample Output 1\n\n400\n\nIf the apple pie is priced at 400 yen before tax, you have to pay 400 \\times 1.08 = 432 yen to buy one.\n\nOtherwise, the amount you have to pay will not be 432 yen.\n\nSample Input 2\n\n1079\n\nSample Output 2\n\n:(\n\nThere is no possible price before tax for which you have to pay 1079 yen with tax.\n\nSample Input 3\n\n1001\n\nSample Output 3\n\n927\n\nIf the apple pie is priced 927 yen before tax, by rounding down 927 \\times 1.08 = 1001.16, you have to pay 1001 yen.", "sample_input": "432\n"}, "reference_outputs": ["400\n"], "source_document_id": "p02842", "source_text": "Score: 200 points\n\nProblem Statement\n\nTakahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it.\n\nThe consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \\times 1.08 yen (rounded down to the nearest integer).\n\nTakahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer.\n\nIf there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact.\n\nConstraints\n\n1 \\leq N \\leq 50000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there are values that could be X, the price of the apple pie before tax, print any one of them.\n\nIf there are multiple such values, printing any one of them will be accepted.\n\nIf no value could be X, print :(.\n\nSample Input 1\n\n432\n\nSample Output 1\n\n400\n\nIf the apple pie is priced at 400 yen before tax, you have to pay 400 \\times 1.08 = 432 yen to buy one.\n\nOtherwise, the amount you have to pay will not be 432 yen.\n\nSample Input 2\n\n1079\n\nSample Output 2\n\n:(\n\nThere is no possible price before tax for which you have to pay 1079 yen with tax.\n\nSample Input 3\n\n1001\n\nSample Output 3\n\n927\n\nIf the apple pie is priced 927 yen before tax, by rounding down 927 \\times 1.08 = 1001.16, you have to pay 1001 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 122, "cpu_time_ms": 31, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s706937093", "group_id": "codeNet:p02842", "input_text": "N = int(input())\n\nX = N // 1.08\n\nif int(X*1.08) == N:\n print(X)\nelif int((X-1)*1.08) == N:\n print(X-1)\nelif int((X+1)*1.08) == N:\n print(X+1)", "language": "Python", "metadata": {"date": 1575404624, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02842.html", "problem_id": "p02842", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02842/input.txt", "sample_output_relpath": "derived/input_output/data/p02842/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02842/Python/s706937093.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s706937093", "user_id": "u698902360"}, "prompt_components": {"gold_output": "400\n", "input_to_evaluate": "N = int(input())\n\nX = N // 1.08\n\nif int(X*1.08) == N:\n print(X)\nelif int((X-1)*1.08) == N:\n print(X-1)\nelif int((X+1)*1.08) == N:\n print(X+1)", "problem_context": "Score: 200 points\n\nProblem Statement\n\nTakahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it.\n\nThe consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \\times 1.08 yen (rounded down to the nearest integer).\n\nTakahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer.\n\nIf there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact.\n\nConstraints\n\n1 \\leq N \\leq 50000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there are values that could be X, the price of the apple pie before tax, print any one of them.\n\nIf there are multiple such values, printing any one of them will be accepted.\n\nIf no value could be X, print :(.\n\nSample Input 1\n\n432\n\nSample Output 1\n\n400\n\nIf the apple pie is priced at 400 yen before tax, you have to pay 400 \\times 1.08 = 432 yen to buy one.\n\nOtherwise, the amount you have to pay will not be 432 yen.\n\nSample Input 2\n\n1079\n\nSample Output 2\n\n:(\n\nThere is no possible price before tax for which you have to pay 1079 yen with tax.\n\nSample Input 3\n\n1001\n\nSample Output 3\n\n927\n\nIf the apple pie is priced 927 yen before tax, by rounding down 927 \\times 1.08 = 1001.16, you have to pay 1001 yen.", "sample_input": "432\n"}, "reference_outputs": ["400\n"], "source_document_id": "p02842", "source_text": "Score: 200 points\n\nProblem Statement\n\nTakahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it.\n\nThe consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \\times 1.08 yen (rounded down to the nearest integer).\n\nTakahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer.\n\nIf there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact.\n\nConstraints\n\n1 \\leq N \\leq 50000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there are values that could be X, the price of the apple pie before tax, print any one of them.\n\nIf there are multiple such values, printing any one of them will be accepted.\n\nIf no value could be X, print :(.\n\nSample Input 1\n\n432\n\nSample Output 1\n\n400\n\nIf the apple pie is priced at 400 yen before tax, you have to pay 400 \\times 1.08 = 432 yen to buy one.\n\nOtherwise, the amount you have to pay will not be 432 yen.\n\nSample Input 2\n\n1079\n\nSample Output 2\n\n:(\n\nThere is no possible price before tax for which you have to pay 1079 yen with tax.\n\nSample Input 3\n\n1001\n\nSample Output 3\n\n927\n\nIf the apple pie is priced 927 yen before tax, by rounding down 927 \\times 1.08 = 1001.16, you have to pay 1001 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 150, "cpu_time_ms": 170, "memory_kb": 38256}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s552196905", "group_id": "codeNet:p02842", "input_text": "N = int(input())\n\nfor i in range(1, 50001):\n if int(i * 1.08) == N:\n print(i)\n exit()\n\nprint(\":(\")", "language": "Python", "metadata": {"date": 1575252324, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02842.html", "problem_id": "p02842", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02842/input.txt", "sample_output_relpath": "derived/input_output/data/p02842/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02842/Python/s552196905.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s552196905", "user_id": "u886747123"}, "prompt_components": {"gold_output": "400\n", "input_to_evaluate": "N = int(input())\n\nfor i in range(1, 50001):\n if int(i * 1.08) == N:\n print(i)\n exit()\n\nprint(\":(\")", "problem_context": "Score: 200 points\n\nProblem Statement\n\nTakahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it.\n\nThe consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \\times 1.08 yen (rounded down to the nearest integer).\n\nTakahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer.\n\nIf there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact.\n\nConstraints\n\n1 \\leq N \\leq 50000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there are values that could be X, the price of the apple pie before tax, print any one of them.\n\nIf there are multiple such values, printing any one of them will be accepted.\n\nIf no value could be X, print :(.\n\nSample Input 1\n\n432\n\nSample Output 1\n\n400\n\nIf the apple pie is priced at 400 yen before tax, you have to pay 400 \\times 1.08 = 432 yen to buy one.\n\nOtherwise, the amount you have to pay will not be 432 yen.\n\nSample Input 2\n\n1079\n\nSample Output 2\n\n:(\n\nThere is no possible price before tax for which you have to pay 1079 yen with tax.\n\nSample Input 3\n\n1001\n\nSample Output 3\n\n927\n\nIf the apple pie is priced 927 yen before tax, by rounding down 927 \\times 1.08 = 1001.16, you have to pay 1001 yen.", "sample_input": "432\n"}, "reference_outputs": ["400\n"], "source_document_id": "p02842", "source_text": "Score: 200 points\n\nProblem Statement\n\nTakahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it.\n\nThe consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \\times 1.08 yen (rounded down to the nearest integer).\n\nTakahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer.\n\nIf there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact.\n\nConstraints\n\n1 \\leq N \\leq 50000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there are values that could be X, the price of the apple pie before tax, print any one of them.\n\nIf there are multiple such values, printing any one of them will be accepted.\n\nIf no value could be X, print :(.\n\nSample Input 1\n\n432\n\nSample Output 1\n\n400\n\nIf the apple pie is priced at 400 yen before tax, you have to pay 400 \\times 1.08 = 432 yen to buy one.\n\nOtherwise, the amount you have to pay will not be 432 yen.\n\nSample Input 2\n\n1079\n\nSample Output 2\n\n:(\n\nThere is no possible price before tax for which you have to pay 1079 yen with tax.\n\nSample Input 3\n\n1001\n\nSample Output 3\n\n927\n\nIf the apple pie is priced 927 yen before tax, by rounding down 927 \\times 1.08 = 1001.16, you have to pay 1001 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 115, "cpu_time_ms": 34, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s459237178", "group_id": "codeNet:p02842", "input_text": "n = int(input())\n\nfor i in range(1, 1000000):\n if int(i * 1.08) == n:\n print(i)\n break\nelse:\n print(\":(\")", "language": "Python", "metadata": {"date": 1575252195, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02842.html", "problem_id": "p02842", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02842/input.txt", "sample_output_relpath": "derived/input_output/data/p02842/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02842/Python/s459237178.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s459237178", "user_id": "u794173881"}, "prompt_components": {"gold_output": "400\n", "input_to_evaluate": "n = int(input())\n\nfor i in range(1, 1000000):\n if int(i * 1.08) == n:\n print(i)\n break\nelse:\n print(\":(\")", "problem_context": "Score: 200 points\n\nProblem Statement\n\nTakahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it.\n\nThe consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \\times 1.08 yen (rounded down to the nearest integer).\n\nTakahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer.\n\nIf there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact.\n\nConstraints\n\n1 \\leq N \\leq 50000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there are values that could be X, the price of the apple pie before tax, print any one of them.\n\nIf there are multiple such values, printing any one of them will be accepted.\n\nIf no value could be X, print :(.\n\nSample Input 1\n\n432\n\nSample Output 1\n\n400\n\nIf the apple pie is priced at 400 yen before tax, you have to pay 400 \\times 1.08 = 432 yen to buy one.\n\nOtherwise, the amount you have to pay will not be 432 yen.\n\nSample Input 2\n\n1079\n\nSample Output 2\n\n:(\n\nThere is no possible price before tax for which you have to pay 1079 yen with tax.\n\nSample Input 3\n\n1001\n\nSample Output 3\n\n927\n\nIf the apple pie is priced 927 yen before tax, by rounding down 927 \\times 1.08 = 1001.16, you have to pay 1001 yen.", "sample_input": "432\n"}, "reference_outputs": ["400\n"], "source_document_id": "p02842", "source_text": "Score: 200 points\n\nProblem Statement\n\nTakahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it.\n\nThe consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \\times 1.08 yen (rounded down to the nearest integer).\n\nTakahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer.\n\nIf there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact.\n\nConstraints\n\n1 \\leq N \\leq 50000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there are values that could be X, the price of the apple pie before tax, print any one of them.\n\nIf there are multiple such values, printing any one of them will be accepted.\n\nIf no value could be X, print :(.\n\nSample Input 1\n\n432\n\nSample Output 1\n\n400\n\nIf the apple pie is priced at 400 yen before tax, you have to pay 400 \\times 1.08 = 432 yen to buy one.\n\nOtherwise, the amount you have to pay will not be 432 yen.\n\nSample Input 2\n\n1079\n\nSample Output 2\n\n:(\n\nThere is no possible price before tax for which you have to pay 1079 yen with tax.\n\nSample Input 3\n\n1001\n\nSample Output 3\n\n927\n\nIf the apple pie is priced 927 yen before tax, by rounding down 927 \\times 1.08 = 1001.16, you have to pay 1001 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 125, "cpu_time_ms": 184, "memory_kb": 40940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s395569276", "group_id": "codeNet:p02843", "input_text": "x = int(input())\n\n# 最大n個は買う必要がある\nn = x // 100\n\n# 最低m個買う必要がある\nm = x // 105\n\nans = 0\n# もし割り切れたら、OK\nfor i in range(100,106):\n if x % i == 0:\n ans = 1\n break\n\ny = x % 100\n\nimport itertools\nshinamono = [0,1,2,3,4,5] * (n%100)\nfor i in range(m,n+1):\n if ans == 1:\n break\n a = itertools.combinations(shinamono, i)\n for j in a:\n if sum(j) == y:\n ans = 1\n break\n\nprint(ans)\n", "language": "Python", "metadata": {"date": 1575256031, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02843.html", "problem_id": "p02843", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02843/input.txt", "sample_output_relpath": "derived/input_output/data/p02843/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02843/Python/s395569276.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s395569276", "user_id": "u441254033"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "x = int(input())\n\n# 最大n個は買う必要がある\nn = x // 100\n\n# 最低m個買う必要がある\nm = x // 105\n\nans = 0\n# もし割り切れたら、OK\nfor i in range(100,106):\n if x % i == 0:\n ans = 1\n break\n\ny = x % 100\n\nimport itertools\nshinamono = [0,1,2,3,4,5] * (n%100)\nfor i in range(m,n+1):\n if ans == 1:\n break\n a = itertools.combinations(shinamono, i)\n for j in a:\n if sum(j) == y:\n ans = 1\n break\n\nprint(ans)\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nAtCoder Mart sells 1000000 of each of the six items below:\n\nRiceballs, priced at 100 yen (the currency of Japan) each\n\nSandwiches, priced at 101 yen each\n\nCookies, priced at 102 yen each\n\nCakes, priced at 103 yen each\n\nCandies, priced at 104 yen each\n\nComputers, priced at 105 yen each\n\nTakahashi wants to buy some of them that cost exactly X yen in total.\nDetermine whether this is possible.\n\n(Ignore consumption tax.)\n\nConstraints\n\n1 \\leq X \\leq 100000\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nIf it is possible to buy some set of items that cost exactly X yen in total, print 1; otherwise, print 0.\n\nSample Input 1\n\n615\n\nSample Output 1\n\n1\n\nFor example, we can buy one of each kind of item, which will cost 100+101+102+103+104+105=615 yen in total.\n\nSample Input 2\n\n217\n\nSample Output 2\n\n0\n\nNo set of items costs 217 yen in total.", "sample_input": "615\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02843", "source_text": "Score: 300 points\n\nProblem Statement\n\nAtCoder Mart sells 1000000 of each of the six items below:\n\nRiceballs, priced at 100 yen (the currency of Japan) each\n\nSandwiches, priced at 101 yen each\n\nCookies, priced at 102 yen each\n\nCakes, priced at 103 yen each\n\nCandies, priced at 104 yen each\n\nComputers, priced at 105 yen each\n\nTakahashi wants to buy some of them that cost exactly X yen in total.\nDetermine whether this is possible.\n\n(Ignore consumption tax.)\n\nConstraints\n\n1 \\leq X \\leq 100000\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nIf it is possible to buy some set of items that cost exactly X yen in total, print 1; otherwise, print 0.\n\nSample Input 1\n\n615\n\nSample Output 1\n\n1\n\nFor example, we can buy one of each kind of item, which will cost 100+101+102+103+104+105=615 yen in total.\n\nSample Input 2\n\n217\n\nSample Output 2\n\n0\n\nNo set of items costs 217 yen in total.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 451, "cpu_time_ms": 2104, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s506768003", "group_id": "codeNet:p02845", "input_text": "import collections\n\nmod=10**9+7\nn=int(input())\narr=list(map(int,input().split()))\ndic=collections.defaultdict(int)\ndic[-1]=3\nans=1\nfor i in range(n):\n dic[arr[i]]+=1\n ans*=dic[arr[i]-1]\n ans%=mod\n dic[arr[i]-1]-=1\nprint(ans) ", "language": "Python", "metadata": {"date": 1582407658, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02845.html", "problem_id": "p02845", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02845/input.txt", "sample_output_relpath": "derived/input_output/data/p02845/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02845/Python/s506768003.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s506768003", "user_id": "u163320134"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import collections\n\nmod=10**9+7\nn=int(input())\narr=list(map(int,input().split()))\ndic=collections.defaultdict(int)\ndic[-1]=3\nans=1\nfor i in range(n):\n dic[arr[i]]+=1\n ans*=dic[arr[i]-1]\n ans%=mod\n dic[arr[i]-1]-=1\nprint(ans) ", "problem_context": "Score: 500 points\n\nProblem Statement\n\nN people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green.\n\nThe person numbered i says:\n\n\"In front of me, exactly A_i people are wearing hats with the same color as mine.\"\n\nAssuming that all these statements are correct, find the number of possible combinations of colors of the N people's hats.\n\nSince the count can be enormous, compute it modulo 1000000007.\n\nConstraints\n\n1 \\leq N \\leq 100000\n\n0 \\leq A_i \\leq N-1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 A_3 ... A_N\n\nOutput\n\nPrint the number of possible combinations of colors of the N people's hats, modulo 1000000007.\n\nSample Input 1\n\n6\n0 1 2 3 4 5\n\nSample Output 1\n\n3\n\nWe have three possible combinations, as follows:\n\nRed, Red, Red, Red, Red, Red\n\nBlue, Blue, Blue, Blue, Blue, Blue\n\nGreen, Green, Green, Green, Green, Green\n\nSample Input 2\n\n3\n0 0 0\n\nSample Output 2\n\n6\n\nSample Input 3\n\n54\n0 0 1 0 1 2 1 2 3 2 3 3 4 4 5 4 6 5 7 8 5 6 6 7 7 8 8 9 9 10 10 11 9 12 10 13 14 11 11 12 12 13 13 14 14 15 15 15 16 16 16 17 17 17\n\nSample Output 3\n\n115295190", "sample_input": "6\n0 1 2 3 4 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02845", "source_text": "Score: 500 points\n\nProblem Statement\n\nN people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green.\n\nThe person numbered i says:\n\n\"In front of me, exactly A_i people are wearing hats with the same color as mine.\"\n\nAssuming that all these statements are correct, find the number of possible combinations of colors of the N people's hats.\n\nSince the count can be enormous, compute it modulo 1000000007.\n\nConstraints\n\n1 \\leq N \\leq 100000\n\n0 \\leq A_i \\leq N-1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 A_3 ... A_N\n\nOutput\n\nPrint the number of possible combinations of colors of the N people's hats, modulo 1000000007.\n\nSample Input 1\n\n6\n0 1 2 3 4 5\n\nSample Output 1\n\n3\n\nWe have three possible combinations, as follows:\n\nRed, Red, Red, Red, Red, Red\n\nBlue, Blue, Blue, Blue, Blue, Blue\n\nGreen, Green, Green, Green, Green, Green\n\nSample Input 2\n\n3\n0 0 0\n\nSample Output 2\n\n6\n\nSample Input 3\n\n54\n0 0 1 0 1 2 1 2 3 2 3 3 4 4 5 4 6 5 7 8 5 6 6 7 7 8 8 9 9 10 10 11 9 12 10 13 14 11 11 12 12 13 13 14 14 15 15 15 16 16 16 17 17 17\n\nSample Output 3\n\n115295190", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 130, "memory_kb": 18648}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s709154023", "group_id": "codeNet:p02846", "input_text": "t1, t2 = map(int, input().split())\na1, a2 = map(int, input().split())\nb1, b2 = map(int, input().split())\n\ndelta1 = (a1 - b1) * t1\ndelta2 = (a2 - b2) * t2\n\nif delta1 + delta2 == 0:\n print('infinity')\n exit()\n\nif delta1 * delta2 >= 0:\n print(0)\n exit()\n\nif abs(delta1) > abs(delta2):\n print(0)\n exit()\n\nsteps = delta1 + delta2\n\nans = 2 * (min(abs(delta1), abs(delta2)) // steps) + 1\nprint(ans)", "language": "Python", "metadata": {"date": 1575256476, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02846.html", "problem_id": "p02846", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02846/input.txt", "sample_output_relpath": "derived/input_output/data/p02846/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02846/Python/s709154023.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s709154023", "user_id": "u380524497"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "t1, t2 = map(int, input().split())\na1, a2 = map(int, input().split())\nb1, b2 = map(int, input().split())\n\ndelta1 = (a1 - b1) * t1\ndelta2 = (a2 - b2) * t2\n\nif delta1 + delta2 == 0:\n print('infinity')\n exit()\n\nif delta1 * delta2 >= 0:\n print(0)\n exit()\n\nif abs(delta1) > abs(delta2):\n print(0)\n exit()\n\nsteps = delta1 + delta2\n\nans = 2 * (min(abs(delta1), abs(delta2)) // steps) + 1\nprint(ans)", "problem_context": "Score: 600 points\n\nProblem Statement\n\nTakahashi and Aoki are training for long-distance races in an infinitely long straight course running from west to east.\n\nThey start simultaneously at the same point and moves as follows towards the east:\n\nTakahashi runs A_1 meters per minute for the first T_1 minutes, then runs at A_2 meters per minute for the subsequent T_2 minutes, and alternates between these two modes forever.\n\nAoki runs B_1 meters per minute for the first T_1 minutes, then runs at B_2 meters per minute for the subsequent T_2 minutes, and alternates between these two modes forever.\n\nHow many times will Takahashi and Aoki meet each other, that is, come to the same point? We do not count the start of the run. If they meet infinitely many times, report that fact.\n\nConstraints\n\n1 \\leq T_i \\leq 100000\n\n1 \\leq A_i \\leq 10^{10}\n\n1 \\leq B_i \\leq 10^{10}\n\nA_1 \\neq B_1\n\nA_2 \\neq B_2\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT_1 T_2\nA_1 A_2\nB_1 B_2\n\nOutput\n\nPrint the number of times Takahashi and Aoki will meet each other.\n\nIf they meet infinitely many times, print infinity instead.\n\nSample Input 1\n\n1 2\n10 10\n12 4\n\nSample Output 1\n\n1\n\nThey will meet just once, \\frac{4}{3} minutes after they start, at \\frac{40}{3} meters from where they start.\n\nSample Input 2\n\n100 1\n101 101\n102 1\n\nSample Output 2\n\ninfinity\n\nThey will meet 101, 202, 303, 404, 505, 606, ... minutes after they start, that is, they will meet infinitely many times.\n\nSample Input 3\n\n12000 15700\n3390000000 3810000000\n5550000000 2130000000\n\nSample Output 3\n\n113\n\nThe values in input may not fit into a 32-bit integer type.", "sample_input": "1 2\n10 10\n12 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02846", "source_text": "Score: 600 points\n\nProblem Statement\n\nTakahashi and Aoki are training for long-distance races in an infinitely long straight course running from west to east.\n\nThey start simultaneously at the same point and moves as follows towards the east:\n\nTakahashi runs A_1 meters per minute for the first T_1 minutes, then runs at A_2 meters per minute for the subsequent T_2 minutes, and alternates between these two modes forever.\n\nAoki runs B_1 meters per minute for the first T_1 minutes, then runs at B_2 meters per minute for the subsequent T_2 minutes, and alternates between these two modes forever.\n\nHow many times will Takahashi and Aoki meet each other, that is, come to the same point? We do not count the start of the run. If they meet infinitely many times, report that fact.\n\nConstraints\n\n1 \\leq T_i \\leq 100000\n\n1 \\leq A_i \\leq 10^{10}\n\n1 \\leq B_i \\leq 10^{10}\n\nA_1 \\neq B_1\n\nA_2 \\neq B_2\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT_1 T_2\nA_1 A_2\nB_1 B_2\n\nOutput\n\nPrint the number of times Takahashi and Aoki will meet each other.\n\nIf they meet infinitely many times, print infinity instead.\n\nSample Input 1\n\n1 2\n10 10\n12 4\n\nSample Output 1\n\n1\n\nThey will meet just once, \\frac{4}{3} minutes after they start, at \\frac{40}{3} meters from where they start.\n\nSample Input 2\n\n100 1\n101 101\n102 1\n\nSample Output 2\n\ninfinity\n\nThey will meet 101, 202, 303, 404, 505, 606, ... minutes after they start, that is, they will meet infinitely many times.\n\nSample Input 3\n\n12000 15700\n3390000000 3810000000\n5550000000 2130000000\n\nSample Output 3\n\n113\n\nThe values in input may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 409, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s385435906", "group_id": "codeNet:p02847", "input_text": "s = input()\n\nif s == 'SUN':\n\tprint('7')\nelif s == 'MON':\n\tprint('6')\nelif s == 'TUE':\n\tprint('5')\nelif s == 'WED':\n\tprint('4')\nelif s == 'THU':\n\tprint('3')\nelif s == 'FRI':\n\tprint('2')\nelif s == 'SAT':\n\tprint('1')", "language": "Python", "metadata": {"date": 1588037466, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02847.html", "problem_id": "p02847", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02847/input.txt", "sample_output_relpath": "derived/input_output/data/p02847/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02847/Python/s385435906.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s385435906", "user_id": "u828139046"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "s = input()\n\nif s == 'SUN':\n\tprint('7')\nelif s == 'MON':\n\tprint('6')\nelif s == 'TUE':\n\tprint('5')\nelif s == 'WED':\n\tprint('4')\nelif s == 'THU':\n\tprint('3')\nelif s == 'FRI':\n\tprint('2')\nelif s == 'SAT':\n\tprint('1')", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is a string S representing the day of the week today.\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT, for Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday, respectively.\n\nAfter how many days is the next Sunday (tomorrow or later)?\n\nConstraints\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of days before the next Sunday.\n\nSample Input 1\n\nSAT\n\nSample Output 1\n\n1\n\nIt is Saturday today, and tomorrow will be Sunday.\n\nSample Input 2\n\nSUN\n\nSample Output 2\n\n7\n\nIt is Sunday today, and seven days later, it will be Sunday again.", "sample_input": "SAT\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02847", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is a string S representing the day of the week today.\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT, for Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday, respectively.\n\nAfter how many days is the next Sunday (tomorrow or later)?\n\nConstraints\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of days before the next Sunday.\n\nSample Input 1\n\nSAT\n\nSample Output 1\n\n1\n\nIt is Saturday today, and tomorrow will be Sunday.\n\nSample Input 2\n\nSUN\n\nSample Output 2\n\n7\n\nIt is Sunday today, and seven days later, it will be Sunday again.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 213, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s581645828", "group_id": "codeNet:p02847", "input_text": "dic = {'SUN':7,'SAT':1,'FRI':2,'THU':3,'WED':4,'TUE':5,'MON':6}\ns=input()\nprint(dic[s])\n", "language": "Python", "metadata": {"date": 1574928526, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02847.html", "problem_id": "p02847", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02847/input.txt", "sample_output_relpath": "derived/input_output/data/p02847/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02847/Python/s581645828.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s581645828", "user_id": "u634677999"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "dic = {'SUN':7,'SAT':1,'FRI':2,'THU':3,'WED':4,'TUE':5,'MON':6}\ns=input()\nprint(dic[s])\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is a string S representing the day of the week today.\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT, for Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday, respectively.\n\nAfter how many days is the next Sunday (tomorrow or later)?\n\nConstraints\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of days before the next Sunday.\n\nSample Input 1\n\nSAT\n\nSample Output 1\n\n1\n\nIt is Saturday today, and tomorrow will be Sunday.\n\nSample Input 2\n\nSUN\n\nSample Output 2\n\n7\n\nIt is Sunday today, and seven days later, it will be Sunday again.", "sample_input": "SAT\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02847", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is a string S representing the day of the week today.\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT, for Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday, respectively.\n\nAfter how many days is the next Sunday (tomorrow or later)?\n\nConstraints\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of days before the next Sunday.\n\nSample Input 1\n\nSAT\n\nSample Output 1\n\n1\n\nIt is Saturday today, and tomorrow will be Sunday.\n\nSample Input 2\n\nSUN\n\nSample Output 2\n\n7\n\nIt is Sunday today, and seven days later, it will be Sunday again.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 88, "cpu_time_ms": 19, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s794361687", "group_id": "codeNet:p02847", "input_text": "import math\n\na, b, x = map(int, input().split())\nn = 0\ni = 1\nf = int(1e9)\nans = 0\n\nwhile f-i > 1:\n n = (i+f)//2\n d = math.trunc(math.log10(n)) + 1\n if a*n + b*d <= x:\n i = n\n else:\n f = n\n\nif a*f + b*d <= x:\n ans = f\nelif a*i + b*d <= x:\n ans = i\nelse:\n ans = 0\n\nprint(ans)", "language": "Python", "metadata": {"date": 1574704205, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02847.html", "problem_id": "p02847", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02847/input.txt", "sample_output_relpath": "derived/input_output/data/p02847/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02847/Python/s794361687.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s794361687", "user_id": "u836984617"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import math\n\na, b, x = map(int, input().split())\nn = 0\ni = 1\nf = int(1e9)\nans = 0\n\nwhile f-i > 1:\n n = (i+f)//2\n d = math.trunc(math.log10(n)) + 1\n if a*n + b*d <= x:\n i = n\n else:\n f = n\n\nif a*f + b*d <= x:\n ans = f\nelif a*i + b*d <= x:\n ans = i\nelse:\n ans = 0\n\nprint(ans)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is a string S representing the day of the week today.\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT, for Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday, respectively.\n\nAfter how many days is the next Sunday (tomorrow or later)?\n\nConstraints\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of days before the next Sunday.\n\nSample Input 1\n\nSAT\n\nSample Output 1\n\n1\n\nIt is Saturday today, and tomorrow will be Sunday.\n\nSample Input 2\n\nSUN\n\nSample Output 2\n\n7\n\nIt is Sunday today, and seven days later, it will be Sunday again.", "sample_input": "SAT\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02847", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is a string S representing the day of the week today.\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT, for Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday, respectively.\n\nAfter how many days is the next Sunday (tomorrow or later)?\n\nConstraints\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of days before the next Sunday.\n\nSample Input 1\n\nSAT\n\nSample Output 1\n\n1\n\nIt is Saturday today, and tomorrow will be Sunday.\n\nSample Input 2\n\nSUN\n\nSample Output 2\n\n7\n\nIt is Sunday today, and seven days later, it will be Sunday again.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 286, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s537807704", "group_id": "codeNet:p02848", "input_text": "n = int(input())\ns = list(input())\n\nm = len(s)\n\nfor i in range(m):\n\tif ord(s[i])+n-65<26:\n\t\ts[i]=chr(ord(s[i])+n)\n\telse:\n\t\ts[i]=chr(ord(s[i])+n-26)\n\"\".join(s)\nprint(\"\".join(s))", "language": "Python", "metadata": {"date": 1586575496, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02848.html", "problem_id": "p02848", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02848/input.txt", "sample_output_relpath": "derived/input_output/data/p02848/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02848/Python/s537807704.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s537807704", "user_id": "u886459614"}, "prompt_components": {"gold_output": "CDEZAB\n", "input_to_evaluate": "n = int(input())\ns = list(input())\n\nm = len(s)\n\nfor i in range(m):\n\tif ord(s[i])+n-65<26:\n\t\ts[i]=chr(ord(s[i])+n)\n\telse:\n\t\ts[i]=chr(ord(s[i])+n-26)\n\"\".join(s)\nprint(\"\".join(s))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\n\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\n\nWe assume that A follows Z. For example, shifting A by 2 results in C (A \\to B \\to C), and shifting Y by 3 results in B (Y \\to Z \\to A \\to B).\n\nConstraints\n\n0 \\leq N \\leq 26\n\n1 \\leq |S| \\leq 10^4\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the string resulting from shifting each character of S by N in alphabetical order.\n\nSample Input 1\n\n2\nABCXYZ\n\nSample Output 1\n\nCDEZAB\n\nNote that A follows Z.\n\nSample Input 2\n\n0\nABCXYZ\n\nSample Output 2\n\nABCXYZ\n\nSample Input 3\n\n13\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n\nSample Output 3\n\nNOPQRSTUVWXYZABCDEFGHIJKLM", "sample_input": "2\nABCXYZ\n"}, "reference_outputs": ["CDEZAB\n"], "source_document_id": "p02848", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\n\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\n\nWe assume that A follows Z. For example, shifting A by 2 results in C (A \\to B \\to C), and shifting Y by 3 results in B (Y \\to Z \\to A \\to B).\n\nConstraints\n\n0 \\leq N \\leq 26\n\n1 \\leq |S| \\leq 10^4\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the string resulting from shifting each character of S by N in alphabetical order.\n\nSample Input 1\n\n2\nABCXYZ\n\nSample Output 1\n\nCDEZAB\n\nNote that A follows Z.\n\nSample Input 2\n\n0\nABCXYZ\n\nSample Output 2\n\nABCXYZ\n\nSample Input 3\n\n13\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n\nSample Output 3\n\nNOPQRSTUVWXYZABCDEFGHIJKLM", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 176, "cpu_time_ms": 22, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s908221691", "group_id": "codeNet:p02848", "input_text": "N = input()\nS = input()\n\n# A = list('A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z')\nA = list('ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ')\nprint(A)\nT =\"\"\nfor i in S:\n print(i)\n k=A.index(i)+int(N)\n print(k)\n t=A[k]\n print(t)\n T +=t\n\nprint(T)\n", "language": "Python", "metadata": {"date": 1574650184, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02848.html", "problem_id": "p02848", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02848/input.txt", "sample_output_relpath": "derived/input_output/data/p02848/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02848/Python/s908221691.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s908221691", "user_id": "u994484340"}, "prompt_components": {"gold_output": "CDEZAB\n", "input_to_evaluate": "N = input()\nS = input()\n\n# A = list('A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z')\nA = list('ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ')\nprint(A)\nT =\"\"\nfor i in S:\n print(i)\n k=A.index(i)+int(N)\n print(k)\n t=A[k]\n print(t)\n T +=t\n\nprint(T)\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\n\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\n\nWe assume that A follows Z. For example, shifting A by 2 results in C (A \\to B \\to C), and shifting Y by 3 results in B (Y \\to Z \\to A \\to B).\n\nConstraints\n\n0 \\leq N \\leq 26\n\n1 \\leq |S| \\leq 10^4\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the string resulting from shifting each character of S by N in alphabetical order.\n\nSample Input 1\n\n2\nABCXYZ\n\nSample Output 1\n\nCDEZAB\n\nNote that A follows Z.\n\nSample Input 2\n\n0\nABCXYZ\n\nSample Output 2\n\nABCXYZ\n\nSample Input 3\n\n13\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n\nSample Output 3\n\nNOPQRSTUVWXYZABCDEFGHIJKLM", "sample_input": "2\nABCXYZ\n"}, "reference_outputs": ["CDEZAB\n"], "source_document_id": "p02848", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\n\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\n\nWe assume that A follows Z. For example, shifting A by 2 results in C (A \\to B \\to C), and shifting Y by 3 results in B (Y \\to Z \\to A \\to B).\n\nConstraints\n\n0 \\leq N \\leq 26\n\n1 \\leq |S| \\leq 10^4\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the string resulting from shifting each character of S by N in alphabetical order.\n\nSample Input 1\n\n2\nABCXYZ\n\nSample Output 1\n\nCDEZAB\n\nNote that A follows Z.\n\nSample Input 2\n\n0\nABCXYZ\n\nSample Output 2\n\nABCXYZ\n\nSample Input 3\n\n13\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n\nSample Output 3\n\nNOPQRSTUVWXYZABCDEFGHIJKLM", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 329, "cpu_time_ms": 41, "memory_kb": 3768}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s120041381", "group_id": "codeNet:p02850", "input_text": "class UnionFind():\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n\n if x == y:\n return\n\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n def size(self, x):\n return -self.parents[self.find(x)]\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n def members(self, x):\n root = self.find(x)\n return [i for i in range(self.n) if self.find(i) == root]\n\n def roots(self):\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n def group_count(self):\n return len(self.roots())\n\n def all_group_members(self):\n return {r: self.members(r) for r in self.roots()}\n\n def __str__(self):\n return '\\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())\n\nfrom collections import deque\n \nn = int(input())\nuf = UnionFind(n)\ng = [[] for i in range(n)]\ncnt = [0] * n\nans = [0] * (n - 1)\nans_index = []\n\nfor i in range(n - 1):\n a, b = map(lambda x:int(x) - 1, input().split())\n uf.union(a, b)\n g[a].append(b)\n g[b].append(a)\n cnt[a] += 1\n cnt[b] += 1\n ans_index.append((a, b))\n \n\nfor i in uf.roots():\n visited = [0] * n\n visited[i] = 1\n que = deque()\n que.append([i, 0])\n while que:\n s = que.popleft()\n k = 0\n for j in g[s[0]]:\n if not visited[j]:\n while True:\n k += 1\n if k != s[1]:\n que.append([j, k])\n visited[j] = 1\n #ans[ans_index.index((s[0], j))] = k\n break\n\nprint(max(cnt))\nprint(*ans, sep = \"\\n\")\n\n \n ", "language": "Python", "metadata": {"date": 1593283729, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02850.html", "problem_id": "p02850", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02850/input.txt", "sample_output_relpath": "derived/input_output/data/p02850/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02850/Python/s120041381.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s120041381", "user_id": "u183422236"}, "prompt_components": {"gold_output": "2\n1\n2\n", "input_to_evaluate": "class UnionFind():\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n\n if x == y:\n return\n\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n def size(self, x):\n return -self.parents[self.find(x)]\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n def members(self, x):\n root = self.find(x)\n return [i for i in range(self.n) if self.find(i) == root]\n\n def roots(self):\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n def group_count(self):\n return len(self.roots())\n\n def all_group_members(self):\n return {r: self.members(r) for r in self.roots()}\n\n def __str__(self):\n return '\\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())\n\nfrom collections import deque\n \nn = int(input())\nuf = UnionFind(n)\ng = [[] for i in range(n)]\ncnt = [0] * n\nans = [0] * (n - 1)\nans_index = []\n\nfor i in range(n - 1):\n a, b = map(lambda x:int(x) - 1, input().split())\n uf.union(a, b)\n g[a].append(b)\n g[b].append(a)\n cnt[a] += 1\n cnt[b] += 1\n ans_index.append((a, b))\n \n\nfor i in uf.roots():\n visited = [0] * n\n visited[i] = 1\n que = deque()\n que.append([i, 0])\n while que:\n s = que.popleft()\n k = 0\n for j in g[s[0]]:\n if not visited[j]:\n while True:\n k += 1\n if k != s[1]:\n que.append([j, k])\n visited[j] = 1\n #ans[ans_index.index((s[0], j))] = k\n break\n\nprint(max(cnt))\nprint(*ans, sep = \"\\n\")\n\n \n ", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a tree G with N vertices.\nThe vertices are numbered 1 through N, and the i-th edge connects Vertex a_i and Vertex b_i.\n\nConsider painting the edges in G with some number of colors.\nWe want to paint them so that, for each vertex, the colors of the edges incident to that vertex are all different.\n\nAmong the colorings satisfying the condition above, construct one that uses the minimum number of colors.\n\nConstraints\n\n2 \\le N \\le 10^5\n\n1 \\le a_i \\lt b_i \\le N\n\nAll values in input are integers.\n\nThe given graph is a tree.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1\na_2 b_2\n\\vdots\na_{N-1} b_{N-1}\n\nOutput\n\nPrint N lines.\n\nThe first line should contain K, the number of colors used.\n\nThe (i+1)-th line (1 \\le i \\le N-1) should contain c_i, the integer representing the color of the i-th edge, where 1 \\le c_i \\le K must hold.\n\nIf there are multiple colorings with the minimum number of colors that satisfy the condition, printing any of them will be accepted.\n\nSample Input 1\n\n3\n1 2\n2 3\n\nSample Output 1\n\n2\n1\n2\n\nSample Input 2\n\n8\n1 2\n2 3\n2 4\n2 5\n4 7\n5 6\n6 8\n\nSample Output 2\n\n4\n1\n2\n3\n4\n1\n1\n2\n\nSample Input 3\n\n6\n1 2\n1 3\n1 4\n1 5\n1 6\n\nSample Output 3\n\n5\n1\n2\n3\n4\n5", "sample_input": "3\n1 2\n2 3\n"}, "reference_outputs": ["2\n1\n2\n"], "source_document_id": "p02850", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a tree G with N vertices.\nThe vertices are numbered 1 through N, and the i-th edge connects Vertex a_i and Vertex b_i.\n\nConsider painting the edges in G with some number of colors.\nWe want to paint them so that, for each vertex, the colors of the edges incident to that vertex are all different.\n\nAmong the colorings satisfying the condition above, construct one that uses the minimum number of colors.\n\nConstraints\n\n2 \\le N \\le 10^5\n\n1 \\le a_i \\lt b_i \\le N\n\nAll values in input are integers.\n\nThe given graph is a tree.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1\na_2 b_2\n\\vdots\na_{N-1} b_{N-1}\n\nOutput\n\nPrint N lines.\n\nThe first line should contain K, the number of colors used.\n\nThe (i+1)-th line (1 \\le i \\le N-1) should contain c_i, the integer representing the color of the i-th edge, where 1 \\le c_i \\le K must hold.\n\nIf there are multiple colorings with the minimum number of colors that satisfy the condition, printing any of them will be accepted.\n\nSample Input 1\n\n3\n1 2\n2 3\n\nSample Output 1\n\n2\n1\n2\n\nSample Input 2\n\n8\n1 2\n2 3\n2 4\n2 5\n4 7\n5 6\n6 8\n\nSample Output 2\n\n4\n1\n2\n3\n4\n1\n1\n2\n\nSample Input 3\n\n6\n1 2\n1 3\n1 4\n1 5\n1 6\n\nSample Output 3\n\n5\n1\n2\n3\n4\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2030, "cpu_time_ms": 410, "memory_kb": 105480}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s545905152", "group_id": "codeNet:p02850", "input_text": "from collections import deque\nn = int(input())\nkey = [0]*n\nchild = [[] for i in range(n)]\ninput_order = [0]*(n-1)\n\nfor i in range(n-1):\n a, b = map(int, input().split())\n input_order[i] = [a-1, b-1]\n key[a-1] += 1\n key[b-1] += 1\n child[a-1].append([a-1, b-1])\n\nans = max(key)\nprint(ans)\ncolor = [[0]*n for i in range(n)]\ncolor_min = [1]*n\nyet = [[False]*n for i in range(n)]\nnot_yet = deque(child[0])\n\n#本番 \nwhile len(not_yet) > 0:\n key = not_yet.popleft()\n a, b = key[0], key[1]\n color[a][b] = max([color_min[a], color_min[b]])\n if color[a][b] == color_min[a]:\n color_min[a] += 1\n if color[a][b] == color_min[b]:\n color_min[b] += 1\n \n for value in child[b]:\n if yet[value[0]][value[1]] == True:\n continue\n not_yet.append(value)\n yet[value[0]][value[1]] = True\n\nfor i in range(n-1):\n a, b = input_order[i][0], input_order[i][1]\n print(color[a][b])", "language": "Python", "metadata": {"date": 1583788304, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02850.html", "problem_id": "p02850", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02850/input.txt", "sample_output_relpath": "derived/input_output/data/p02850/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02850/Python/s545905152.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s545905152", "user_id": "u021548497"}, "prompt_components": {"gold_output": "2\n1\n2\n", "input_to_evaluate": "from collections import deque\nn = int(input())\nkey = [0]*n\nchild = [[] for i in range(n)]\ninput_order = [0]*(n-1)\n\nfor i in range(n-1):\n a, b = map(int, input().split())\n input_order[i] = [a-1, b-1]\n key[a-1] += 1\n key[b-1] += 1\n child[a-1].append([a-1, b-1])\n\nans = max(key)\nprint(ans)\ncolor = [[0]*n for i in range(n)]\ncolor_min = [1]*n\nyet = [[False]*n for i in range(n)]\nnot_yet = deque(child[0])\n\n#本番 \nwhile len(not_yet) > 0:\n key = not_yet.popleft()\n a, b = key[0], key[1]\n color[a][b] = max([color_min[a], color_min[b]])\n if color[a][b] == color_min[a]:\n color_min[a] += 1\n if color[a][b] == color_min[b]:\n color_min[b] += 1\n \n for value in child[b]:\n if yet[value[0]][value[1]] == True:\n continue\n not_yet.append(value)\n yet[value[0]][value[1]] = True\n\nfor i in range(n-1):\n a, b = input_order[i][0], input_order[i][1]\n print(color[a][b])", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a tree G with N vertices.\nThe vertices are numbered 1 through N, and the i-th edge connects Vertex a_i and Vertex b_i.\n\nConsider painting the edges in G with some number of colors.\nWe want to paint them so that, for each vertex, the colors of the edges incident to that vertex are all different.\n\nAmong the colorings satisfying the condition above, construct one that uses the minimum number of colors.\n\nConstraints\n\n2 \\le N \\le 10^5\n\n1 \\le a_i \\lt b_i \\le N\n\nAll values in input are integers.\n\nThe given graph is a tree.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1\na_2 b_2\n\\vdots\na_{N-1} b_{N-1}\n\nOutput\n\nPrint N lines.\n\nThe first line should contain K, the number of colors used.\n\nThe (i+1)-th line (1 \\le i \\le N-1) should contain c_i, the integer representing the color of the i-th edge, where 1 \\le c_i \\le K must hold.\n\nIf there are multiple colorings with the minimum number of colors that satisfy the condition, printing any of them will be accepted.\n\nSample Input 1\n\n3\n1 2\n2 3\n\nSample Output 1\n\n2\n1\n2\n\nSample Input 2\n\n8\n1 2\n2 3\n2 4\n2 5\n4 7\n5 6\n6 8\n\nSample Output 2\n\n4\n1\n2\n3\n4\n1\n1\n2\n\nSample Input 3\n\n6\n1 2\n1 3\n1 4\n1 5\n1 6\n\nSample Output 3\n\n5\n1\n2\n3\n4\n5", "sample_input": "3\n1 2\n2 3\n"}, "reference_outputs": ["2\n1\n2\n"], "source_document_id": "p02850", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a tree G with N vertices.\nThe vertices are numbered 1 through N, and the i-th edge connects Vertex a_i and Vertex b_i.\n\nConsider painting the edges in G with some number of colors.\nWe want to paint them so that, for each vertex, the colors of the edges incident to that vertex are all different.\n\nAmong the colorings satisfying the condition above, construct one that uses the minimum number of colors.\n\nConstraints\n\n2 \\le N \\le 10^5\n\n1 \\le a_i \\lt b_i \\le N\n\nAll values in input are integers.\n\nThe given graph is a tree.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1\na_2 b_2\n\\vdots\na_{N-1} b_{N-1}\n\nOutput\n\nPrint N lines.\n\nThe first line should contain K, the number of colors used.\n\nThe (i+1)-th line (1 \\le i \\le N-1) should contain c_i, the integer representing the color of the i-th edge, where 1 \\le c_i \\le K must hold.\n\nIf there are multiple colorings with the minimum number of colors that satisfy the condition, printing any of them will be accepted.\n\nSample Input 1\n\n3\n1 2\n2 3\n\nSample Output 1\n\n2\n1\n2\n\nSample Input 2\n\n8\n1 2\n2 3\n2 4\n2 5\n4 7\n5 6\n6 8\n\nSample Output 2\n\n4\n1\n2\n3\n4\n1\n1\n2\n\nSample Input 3\n\n6\n1 2\n1 3\n1 4\n1 5\n1 6\n\nSample Output 3\n\n5\n1\n2\n3\n4\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 940, "cpu_time_ms": 2215, "memory_kb": 1800736}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s843570507", "group_id": "codeNet:p02850", "input_text": "N = int(input())\nl = [0 for i in range(N)]\n\nfor i in range(N-1):\n a, b = map(int, input().split())\n l[a-1] += 1\n l[b-1] += 1\nprint(max(l))\nfor i in range(N-1):\n print(i % max(l) + 1)", "language": "Python", "metadata": {"date": 1574824727, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02850.html", "problem_id": "p02850", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02850/input.txt", "sample_output_relpath": "derived/input_output/data/p02850/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02850/Python/s843570507.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s843570507", "user_id": "u552357043"}, "prompt_components": {"gold_output": "2\n1\n2\n", "input_to_evaluate": "N = int(input())\nl = [0 for i in range(N)]\n\nfor i in range(N-1):\n a, b = map(int, input().split())\n l[a-1] += 1\n l[b-1] += 1\nprint(max(l))\nfor i in range(N-1):\n print(i % max(l) + 1)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a tree G with N vertices.\nThe vertices are numbered 1 through N, and the i-th edge connects Vertex a_i and Vertex b_i.\n\nConsider painting the edges in G with some number of colors.\nWe want to paint them so that, for each vertex, the colors of the edges incident to that vertex are all different.\n\nAmong the colorings satisfying the condition above, construct one that uses the minimum number of colors.\n\nConstraints\n\n2 \\le N \\le 10^5\n\n1 \\le a_i \\lt b_i \\le N\n\nAll values in input are integers.\n\nThe given graph is a tree.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1\na_2 b_2\n\\vdots\na_{N-1} b_{N-1}\n\nOutput\n\nPrint N lines.\n\nThe first line should contain K, the number of colors used.\n\nThe (i+1)-th line (1 \\le i \\le N-1) should contain c_i, the integer representing the color of the i-th edge, where 1 \\le c_i \\le K must hold.\n\nIf there are multiple colorings with the minimum number of colors that satisfy the condition, printing any of them will be accepted.\n\nSample Input 1\n\n3\n1 2\n2 3\n\nSample Output 1\n\n2\n1\n2\n\nSample Input 2\n\n8\n1 2\n2 3\n2 4\n2 5\n4 7\n5 6\n6 8\n\nSample Output 2\n\n4\n1\n2\n3\n4\n1\n1\n2\n\nSample Input 3\n\n6\n1 2\n1 3\n1 4\n1 5\n1 6\n\nSample Output 3\n\n5\n1\n2\n3\n4\n5", "sample_input": "3\n1 2\n2 3\n"}, "reference_outputs": ["2\n1\n2\n"], "source_document_id": "p02850", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a tree G with N vertices.\nThe vertices are numbered 1 through N, and the i-th edge connects Vertex a_i and Vertex b_i.\n\nConsider painting the edges in G with some number of colors.\nWe want to paint them so that, for each vertex, the colors of the edges incident to that vertex are all different.\n\nAmong the colorings satisfying the condition above, construct one that uses the minimum number of colors.\n\nConstraints\n\n2 \\le N \\le 10^5\n\n1 \\le a_i \\lt b_i \\le N\n\nAll values in input are integers.\n\nThe given graph is a tree.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1\na_2 b_2\n\\vdots\na_{N-1} b_{N-1}\n\nOutput\n\nPrint N lines.\n\nThe first line should contain K, the number of colors used.\n\nThe (i+1)-th line (1 \\le i \\le N-1) should contain c_i, the integer representing the color of the i-th edge, where 1 \\le c_i \\le K must hold.\n\nIf there are multiple colorings with the minimum number of colors that satisfy the condition, printing any of them will be accepted.\n\nSample Input 1\n\n3\n1 2\n2 3\n\nSample Output 1\n\n2\n1\n2\n\nSample Input 2\n\n8\n1 2\n2 3\n2 4\n2 5\n4 7\n5 6\n6 8\n\nSample Output 2\n\n4\n1\n2\n3\n4\n1\n1\n2\n\nSample Input 3\n\n6\n1 2\n1 3\n1 4\n1 5\n1 6\n\nSample Output 3\n\n5\n1\n2\n3\n4\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 194, "cpu_time_ms": 2104, "memory_kb": 3956}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s593451419", "group_id": "codeNet:p02859", "input_text": "r = input()\ns = r**2\nprint(s)", "language": "Python", "metadata": {"date": 1573956359, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02859.html", "problem_id": "p02859", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02859/input.txt", "sample_output_relpath": "derived/input_output/data/p02859/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02859/Python/s593451419.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s593451419", "user_id": "u994034374"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "r = input()\ns = r**2\nprint(s)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer r.\n\nHow many times is the area of a circle of radius r larger than the area of a circle of radius 1?\n\nIt can be proved that the answer is always an integer under the constraints given.\n\nConstraints\n\n1 \\leq r \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nr\n\nOutput\n\nPrint the area of a circle of radius r, divided by the area of a circle of radius 1, as an integer.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n4\n\nThe area of a circle of radius 2 is 4 times larger than the area of a circle of radius 1.\n\nNote that output must be an integer - for example, 4.0 will not be accepted.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n10000", "sample_input": "2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02859", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer r.\n\nHow many times is the area of a circle of radius r larger than the area of a circle of radius 1?\n\nIt can be proved that the answer is always an integer under the constraints given.\n\nConstraints\n\n1 \\leq r \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nr\n\nOutput\n\nPrint the area of a circle of radius r, divided by the area of a circle of radius 1, as an integer.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n4\n\nThe area of a circle of radius 2 is 4 times larger than the area of a circle of radius 1.\n\nNote that output must be an integer - for example, 4.0 will not be accepted.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 29, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s809063983", "group_id": "codeNet:p02860", "input_text": "N = int(input())\nS = str(input())\n\ncnt=0\nif N%2==1:\n print('No')\nelse:\n for i in range(int(N/2)):\n if S[i]==S[int(N/2)+i]:\n cnt+=1\n else:\n print('No')\n break\nif cnt==int(N/2):\n print('Yes')", "language": "Python", "metadata": {"date": 1581725019, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02860.html", "problem_id": "p02860", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02860/input.txt", "sample_output_relpath": "derived/input_output/data/p02860/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02860/Python/s809063983.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s809063983", "user_id": "u001490106"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "N = int(input())\nS = str(input())\n\ncnt=0\nif N%2==1:\n print('No')\nelse:\n for i in range(int(N/2)):\n if S[i]==S[int(N/2)+i]:\n cnt+=1\n else:\n print('No')\n break\nif cnt==int(N/2):\n print('Yes')", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are a positive integer N and a string S of length N consisting of lowercase English letters.\n\nDetermine whether the string is a concatenation of two copies of some string.\nThat is, determine whether there is a string T such that S = T + T.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nS consists of lowercase English letters.\n\n|S| = N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nIf S is a concatenation of two copies of some string, print Yes; otherwise, print No.\n\nSample Input 1\n\n6\nabcabc\n\nSample Output 1\n\nYes\n\nLet T = abc, and S = T + T.\n\nSample Input 2\n\n6\nabcadc\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n1\nz\n\nSample Output 3\n\nNo", "sample_input": "6\nabcabc\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02860", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are a positive integer N and a string S of length N consisting of lowercase English letters.\n\nDetermine whether the string is a concatenation of two copies of some string.\nThat is, determine whether there is a string T such that S = T + T.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nS consists of lowercase English letters.\n\n|S| = N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nIf S is a concatenation of two copies of some string, print Yes; otherwise, print No.\n\nSample Input 1\n\n6\nabcabc\n\nSample Output 1\n\nYes\n\nLet T = abc, and S = T + T.\n\nSample Input 2\n\n6\nabcadc\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n1\nz\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 245, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s333967686", "group_id": "codeNet:p02860", "input_text": "N = int(input())\nS = str(input())\n\nif N % 2 != 0:\n print('No')\n\nif S[:N / 2] == S[N / 2:]:\n print('Yes')", "language": "Python", "metadata": {"date": 1573959391, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02860.html", "problem_id": "p02860", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02860/input.txt", "sample_output_relpath": "derived/input_output/data/p02860/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02860/Python/s333967686.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s333967686", "user_id": "u538844871"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "N = int(input())\nS = str(input())\n\nif N % 2 != 0:\n print('No')\n\nif S[:N / 2] == S[N / 2:]:\n print('Yes')", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are a positive integer N and a string S of length N consisting of lowercase English letters.\n\nDetermine whether the string is a concatenation of two copies of some string.\nThat is, determine whether there is a string T such that S = T + T.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nS consists of lowercase English letters.\n\n|S| = N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nIf S is a concatenation of two copies of some string, print Yes; otherwise, print No.\n\nSample Input 1\n\n6\nabcabc\n\nSample Output 1\n\nYes\n\nLet T = abc, and S = T + T.\n\nSample Input 2\n\n6\nabcadc\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n1\nz\n\nSample Output 3\n\nNo", "sample_input": "6\nabcabc\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02860", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are a positive integer N and a string S of length N consisting of lowercase English letters.\n\nDetermine whether the string is a concatenation of two copies of some string.\nThat is, determine whether there is a string T such that S = T + T.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nS consists of lowercase English letters.\n\n|S| = N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nIf S is a concatenation of two copies of some string, print Yes; otherwise, print No.\n\nSample Input 1\n\n6\nabcabc\n\nSample Output 1\n\nYes\n\nLet T = abc, and S = T + T.\n\nSample Input 2\n\n6\nabcadc\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n1\nz\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 106, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s926603102", "group_id": "codeNet:p02861", "input_text": "def kai(a):\n if a == 1:\n return 1\n else:\n return a*kai(a-1)\n\ndef L(i, j, x, y):\n return ((x[i] - x[j])**2 + (y[i] - y[j])**2)**0.5\n\nN = int(input())\nx = [0]*N\ny = [0]*N\nk = kai(N)\nl = 0\nfor n in range(N):\n x[n], y[n] = map(int, input().split())\n\nfor X in range(N):\n for Y in range(N):\n if X <= Y:\n continue\n else:\n l += L(X, Y, x, y)\n \n\nbi = ((N - 1) * k)/((N * (N - 1))/2)\n\n\n\nprint((l * bi)/k)\n", "language": "Python", "metadata": {"date": 1573958739, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02861.html", "problem_id": "p02861", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02861/input.txt", "sample_output_relpath": "derived/input_output/data/p02861/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02861/Python/s926603102.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s926603102", "user_id": "u185966380"}, "prompt_components": {"gold_output": "2.2761423749\n", "input_to_evaluate": "def kai(a):\n if a == 1:\n return 1\n else:\n return a*kai(a-1)\n\ndef L(i, j, x, y):\n return ((x[i] - x[j])**2 + (y[i] - y[j])**2)**0.5\n\nN = int(input())\nx = [0]*N\ny = [0]*N\nk = kai(N)\nl = 0\nfor n in range(N):\n x[n], y[n] = map(int, input().split())\n\nfor X in range(N):\n for Y in range(N):\n if X <= Y:\n continue\n else:\n l += L(X, Y, x, y)\n \n\nbi = ((N - 1) * k)/((N * (N - 1))/2)\n\n\n\nprint((l * bi)/k)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N towns in a coordinate plane. Town i is located at coordinates (x_i, y_i). The distance between Town i and Town j is \\sqrt{\\left(x_i-x_j\\right)^2+\\left(y_i-y_j\\right)^2}.\n\nThere are N! possible paths to visit all of these towns once. Let the length of a path be the distance covered when we start at the first town in the path, visit the second, third, \\dots, towns, and arrive at the last town (assume that we travel in a straight line from a town to another). Compute the average length of these N! paths.\n\nConstraints\n\n2 \\leq N \\leq 8\n\n-1000 \\leq x_i \\leq 1000\n\n-1000 \\leq y_i \\leq 1000\n\n\\left(x_i, y_i\\right) \\neq \\left(x_j, y_j\\right) (if i \\neq j)\n\n(Added 21:12 JST) All values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\n:\nx_N y_N\n\nOutput\n\nPrint the average length of the paths.\nYour output will be judges as correct when the absolute difference from the judge's output is at most 10^{-6}.\n\nSample Input 1\n\n3\n0 0\n1 0\n0 1\n\nSample Output 1\n\n2.2761423749\n\nThere are six paths to visit the towns: 1 → 2 → 3, 1 → 3 → 2, 2 → 1 → 3, 2 → 3 → 1, 3 → 1 → 2, and 3 → 2 → 1.\n\nThe length of the path 1 → 2 → 3 is \\sqrt{\\left(0-1\\right)^2+\\left(0-0\\right)^2} + \\sqrt{\\left(1-0\\right)^2+\\left(0-1\\right)^2} = 1+\\sqrt{2}.\n\nBy calculating the lengths of the other paths in this way, we see that the average length of all routes is:\n\n\\frac{\\left(1+\\sqrt{2}\\right)+\\left(1+\\sqrt{2}\\right)+\\left(2\\right)+\\left(1+\\sqrt{2}\\right)+\\left(2\\right)+\\left(1+\\sqrt{2}\\right)}{6} = 2.276142...\n\nSample Input 2\n\n2\n-879 981\n-866 890\n\nSample Output 2\n\n91.9238815543\n\nThere are two paths to visit the towns: 1 → 2 and 2 → 1. These paths have the same length.\n\nSample Input 3\n\n8\n-406 10\n512 859\n494 362\n-955 -475\n128 553\n-986 -885\n763 77\n449 310\n\nSample Output 3\n\n7641.9817824387", "sample_input": "3\n0 0\n1 0\n0 1\n"}, "reference_outputs": ["2.2761423749\n"], "source_document_id": "p02861", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N towns in a coordinate plane. Town i is located at coordinates (x_i, y_i). The distance between Town i and Town j is \\sqrt{\\left(x_i-x_j\\right)^2+\\left(y_i-y_j\\right)^2}.\n\nThere are N! possible paths to visit all of these towns once. Let the length of a path be the distance covered when we start at the first town in the path, visit the second, third, \\dots, towns, and arrive at the last town (assume that we travel in a straight line from a town to another). Compute the average length of these N! paths.\n\nConstraints\n\n2 \\leq N \\leq 8\n\n-1000 \\leq x_i \\leq 1000\n\n-1000 \\leq y_i \\leq 1000\n\n\\left(x_i, y_i\\right) \\neq \\left(x_j, y_j\\right) (if i \\neq j)\n\n(Added 21:12 JST) All values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\n:\nx_N y_N\n\nOutput\n\nPrint the average length of the paths.\nYour output will be judges as correct when the absolute difference from the judge's output is at most 10^{-6}.\n\nSample Input 1\n\n3\n0 0\n1 0\n0 1\n\nSample Output 1\n\n2.2761423749\n\nThere are six paths to visit the towns: 1 → 2 → 3, 1 → 3 → 2, 2 → 1 → 3, 2 → 3 → 1, 3 → 1 → 2, and 3 → 2 → 1.\n\nThe length of the path 1 → 2 → 3 is \\sqrt{\\left(0-1\\right)^2+\\left(0-0\\right)^2} + \\sqrt{\\left(1-0\\right)^2+\\left(0-1\\right)^2} = 1+\\sqrt{2}.\n\nBy calculating the lengths of the other paths in this way, we see that the average length of all routes is:\n\n\\frac{\\left(1+\\sqrt{2}\\right)+\\left(1+\\sqrt{2}\\right)+\\left(2\\right)+\\left(1+\\sqrt{2}\\right)+\\left(2\\right)+\\left(1+\\sqrt{2}\\right)}{6} = 2.276142...\n\nSample Input 2\n\n2\n-879 981\n-866 890\n\nSample Output 2\n\n91.9238815543\n\nThere are two paths to visit the towns: 1 → 2 and 2 → 1. These paths have the same length.\n\nSample Input 3\n\n8\n-406 10\n512 859\n494 362\n-955 -475\n128 553\n-986 -885\n763 77\n449 310\n\nSample Output 3\n\n7641.9817824387", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 471, "cpu_time_ms": 18, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s110804621", "group_id": "codeNet:p02862", "input_text": "od = 10**9+7\ndef comb(n, k):\n c = 1\n for i in range(k):\n c *= n - i\n c %= mod\n d = 1\n for i in range(1, k + 1):\n d *= i\n d %= mod\n return (c * pow(d, mod - 2, mod)) % mod\nx,y=map(int,input().split())\n\nans=0\n\nz=x//2+1\n\nfor q in range(z,x+1):\n w=2*q-x\n if w*2+(q-w)==y:\n t=comb(q,w)\n ans+=t\n \n \n \nprint(ans)", "language": "Python", "metadata": {"date": 1594677960, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02862.html", "problem_id": "p02862", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02862/input.txt", "sample_output_relpath": "derived/input_output/data/p02862/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02862/Python/s110804621.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s110804621", "user_id": "u516554284"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "od = 10**9+7\ndef comb(n, k):\n c = 1\n for i in range(k):\n c *= n - i\n c %= mod\n d = 1\n for i in range(1, k + 1):\n d *= i\n d %= mod\n return (c * pow(d, mod - 2, mod)) % mod\nx,y=map(int,input().split())\n\nans=0\n\nz=x//2+1\n\nfor q in range(z,x+1):\n w=2*q-x\n if w*2+(q-w)==y:\n t=comb(q,w)\n ans+=t\n \n \n \nprint(ans)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a knight - the chess piece - at the origin (0, 0) of a two-dimensional grid.\n\nWhen the knight is at the square (i, j), it can be moved to either (i+1,j+2) or (i+2, j+1).\n\nIn how many ways can the knight reach the square (X, Y)?\n\nFind the number of ways modulo 10^9 + 7.\n\nConstraints\n\n1 \\leq X \\leq 10^6\n\n1 \\leq Y \\leq 10^6\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint the number of ways for the knight to reach (X, Y) from (0, 0), modulo 10^9 + 7.\n\nSample Input 1\n\n3 3\n\nSample Output 1\n\n2\n\nThere are two ways: (0,0) \\to (1,2) \\to (3,3) and (0,0) \\to (2,1) \\to (3,3).\n\nSample Input 2\n\n2 2\n\nSample Output 2\n\n0\n\nThe knight cannot reach (2,2).\n\nSample Input 3\n\n999999 999999\n\nSample Output 3\n\n151840682\n\nPrint the number of ways modulo 10^9 + 7.", "sample_input": "3 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02862", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a knight - the chess piece - at the origin (0, 0) of a two-dimensional grid.\n\nWhen the knight is at the square (i, j), it can be moved to either (i+1,j+2) or (i+2, j+1).\n\nIn how many ways can the knight reach the square (X, Y)?\n\nFind the number of ways modulo 10^9 + 7.\n\nConstraints\n\n1 \\leq X \\leq 10^6\n\n1 \\leq Y \\leq 10^6\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint the number of ways for the knight to reach (X, Y) from (0, 0), modulo 10^9 + 7.\n\nSample Input 1\n\n3 3\n\nSample Output 1\n\n2\n\nThere are two ways: (0,0) \\to (1,2) \\to (3,3) and (0,0) \\to (2,1) \\to (3,3).\n\nSample Input 2\n\n2 2\n\nSample Output 2\n\n0\n\nThe knight cannot reach (2,2).\n\nSample Input 3\n\n999999 999999\n\nSample Output 3\n\n151840682\n\nPrint the number of ways modulo 10^9 + 7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 361, "cpu_time_ms": 162, "memory_kb": 74200}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s522203495", "group_id": "codeNet:p02862", "input_text": "import numpy as np\nimport math\n\ndef frac_mod(n, mod, f=1):\n for i in range(1, n + 1):\n f = (f * i) % mod\n return f\n\ndef ifrac_mod(n, mod, f_inv=1):\n for i in range(n, 1, -1):\n f_inv = (f_inv * pow(i, mod-2, mod)) % mod\n return f_inv\n\ndef cmb_mod(n, r, mod):\n n_frac = frac_mod(n, mod)\n n_r_ifrac = ifrac_mod(n-r, mod)\n r_ifrac = ifrac_mod(r, mod)\n \n return int((n_frac * n_r_ifrac * r_ifrac) % mod)\nmod = 10**9+7\nx,y = map(int, input().split())\na = np.array([[1,2], [2,1]])\nb = np.array([x,y])\nres = np.linalg.solve(a,b)\nis_ok = True\nif not (res[0].is_integer() and res[1].is_integer()):\n is_ok = False\n ans = 0\nx_res = int(res[0])\ny_res = int(res[1])\nif is_ok:\n ans = cmb_mod(x_res+y_res, x_res, mod)\nprint(ans)", "language": "Python", "metadata": {"date": 1573964714, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02862.html", "problem_id": "p02862", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02862/input.txt", "sample_output_relpath": "derived/input_output/data/p02862/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02862/Python/s522203495.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s522203495", "user_id": "u894381129"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import numpy as np\nimport math\n\ndef frac_mod(n, mod, f=1):\n for i in range(1, n + 1):\n f = (f * i) % mod\n return f\n\ndef ifrac_mod(n, mod, f_inv=1):\n for i in range(n, 1, -1):\n f_inv = (f_inv * pow(i, mod-2, mod)) % mod\n return f_inv\n\ndef cmb_mod(n, r, mod):\n n_frac = frac_mod(n, mod)\n n_r_ifrac = ifrac_mod(n-r, mod)\n r_ifrac = ifrac_mod(r, mod)\n \n return int((n_frac * n_r_ifrac * r_ifrac) % mod)\nmod = 10**9+7\nx,y = map(int, input().split())\na = np.array([[1,2], [2,1]])\nb = np.array([x,y])\nres = np.linalg.solve(a,b)\nis_ok = True\nif not (res[0].is_integer() and res[1].is_integer()):\n is_ok = False\n ans = 0\nx_res = int(res[0])\ny_res = int(res[1])\nif is_ok:\n ans = cmb_mod(x_res+y_res, x_res, mod)\nprint(ans)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a knight - the chess piece - at the origin (0, 0) of a two-dimensional grid.\n\nWhen the knight is at the square (i, j), it can be moved to either (i+1,j+2) or (i+2, j+1).\n\nIn how many ways can the knight reach the square (X, Y)?\n\nFind the number of ways modulo 10^9 + 7.\n\nConstraints\n\n1 \\leq X \\leq 10^6\n\n1 \\leq Y \\leq 10^6\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint the number of ways for the knight to reach (X, Y) from (0, 0), modulo 10^9 + 7.\n\nSample Input 1\n\n3 3\n\nSample Output 1\n\n2\n\nThere are two ways: (0,0) \\to (1,2) \\to (3,3) and (0,0) \\to (2,1) \\to (3,3).\n\nSample Input 2\n\n2 2\n\nSample Output 2\n\n0\n\nThe knight cannot reach (2,2).\n\nSample Input 3\n\n999999 999999\n\nSample Output 3\n\n151840682\n\nPrint the number of ways modulo 10^9 + 7.", "sample_input": "3 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02862", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a knight - the chess piece - at the origin (0, 0) of a two-dimensional grid.\n\nWhen the knight is at the square (i, j), it can be moved to either (i+1,j+2) or (i+2, j+1).\n\nIn how many ways can the knight reach the square (X, Y)?\n\nFind the number of ways modulo 10^9 + 7.\n\nConstraints\n\n1 \\leq X \\leq 10^6\n\n1 \\leq Y \\leq 10^6\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint the number of ways for the knight to reach (X, Y) from (0, 0), modulo 10^9 + 7.\n\nSample Input 1\n\n3 3\n\nSample Output 1\n\n2\n\nThere are two ways: (0,0) \\to (1,2) \\to (3,3) and (0,0) \\to (2,1) \\to (3,3).\n\nSample Input 2\n\n2 2\n\nSample Output 2\n\n0\n\nThe knight cannot reach (2,2).\n\nSample Input 3\n\n999999 999999\n\nSample Output 3\n\n151840682\n\nPrint the number of ways modulo 10^9 + 7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 762, "cpu_time_ms": 2108, "memory_kb": 25620}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s489632609", "group_id": "codeNet:p02867", "input_text": "import numpy as np\nN=int(input())\nA=np.array(list(map(int,input().split())))\nB=np.array(list(map(int,input().split())))\n\nAB=np.array([(a,b) for a,b in zip(A,B)])\nAB=AB[np.argsort(AB[:,1])]\n\nAI=np.array([[i,AB[i,0]] for i in range(N)])\nAI=AI[np.argsort(AI[:,1])]\n\nsigma=AI[:,0]\nASort=AI[:,1]\nBSort=AB[:,1]\n\ng=0\nf=0\nfor i in range(N):\n if ASort[i]>BSort[i]:\n g=1\n break\n\nused=np.array([])\nif g==0:\n start=0\n now=sigma[start]\n np.append(used,now)\n while start!=now:\n now=sigma[now]\n np.append(used,now)\n \n \n if N==len(used):\n f=1\n for i in range(N-1):\n if BSort[i]>=ASort[i+1]:\n f=0\n break\nif f==1 or g==1:\n print(\"No\")\nelse:\n print(\"Yes\")\n", "language": "Python", "metadata": {"date": 1573376041, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02867.html", "problem_id": "p02867", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02867/input.txt", "sample_output_relpath": "derived/input_output/data/p02867/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02867/Python/s489632609.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s489632609", "user_id": "u978313283"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import numpy as np\nN=int(input())\nA=np.array(list(map(int,input().split())))\nB=np.array(list(map(int,input().split())))\n\nAB=np.array([(a,b) for a,b in zip(A,B)])\nAB=AB[np.argsort(AB[:,1])]\n\nAI=np.array([[i,AB[i,0]] for i in range(N)])\nAI=AI[np.argsort(AI[:,1])]\n\nsigma=AI[:,0]\nASort=AI[:,1]\nBSort=AB[:,1]\n\ng=0\nf=0\nfor i in range(N):\n if ASort[i]>BSort[i]:\n g=1\n break\n\nused=np.array([])\nif g==0:\n start=0\n now=sigma[start]\n np.append(used,now)\n while start!=now:\n now=sigma[now]\n np.append(used,now)\n \n \n if N==len(used):\n f=1\n for i in range(N-1):\n if BSort[i]>=ASort[i+1]:\n f=0\n break\nif f==1 or g==1:\n print(\"No\")\nelse:\n print(\"Yes\")\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nGiven are two integer sequences of N elements each: A_1,...,A_N and B_1,...,B_N.\nDetermine if it is possible to do the following operation at most N-2 times (possibly zero) so that, for every integer i from 1 to N, A_i \\leq B_i holds:\n\nChoose two distinct integers x and y between 1 and N (inclusive), and swap the values of A_x and A_y.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i,B_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\nB_1 B_2 ... B_N\n\nOutput\n\nIf the objective is achievable, print Yes; if it is not, print No.\n\nSample Input 1\n\n3\n1 3 2\n1 2 3\n\nSample Output 1\n\nYes\n\nWe should swap the values of A_2 and A_3.\n\nSample Input 2\n\n3\n1 2 3\n2 2 2\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n6\n3 1 2 6 3 4\n2 2 8 3 4 3\n\nSample Output 3\n\nYes", "sample_input": "3\n1 3 2\n1 2 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02867", "source_text": "Score : 600 points\n\nProblem Statement\n\nGiven are two integer sequences of N elements each: A_1,...,A_N and B_1,...,B_N.\nDetermine if it is possible to do the following operation at most N-2 times (possibly zero) so that, for every integer i from 1 to N, A_i \\leq B_i holds:\n\nChoose two distinct integers x and y between 1 and N (inclusive), and swap the values of A_x and A_y.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i,B_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\nB_1 B_2 ... B_N\n\nOutput\n\nIf the objective is achievable, print Yes; if it is not, print No.\n\nSample Input 1\n\n3\n1 3 2\n1 2 3\n\nSample Output 1\n\nYes\n\nWe should swap the values of A_2 and A_3.\n\nSample Input 2\n\n3\n1 2 3\n2 2 2\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n6\n3 1 2 6 3 4\n2 2 8 3 4 3\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 750, "cpu_time_ms": 1203, "memory_kb": 33232}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s668824431", "group_id": "codeNet:p02875", "input_text": "N = int(input())\nMOD = 998244353\ndef func(x):\n a = [23,26]\n out = 1\n for i in range(30):\n if not i in a:\n out = (out*x)%MOD\n x *= x\n x %= MOD\n return out\n\ndef func2(x):\n x = bin(x)[2:]\n out = 1\n b = 3\n for i in range(len(x)):\n if x[-1-i] == \"1\":\n out *= b\n out %= MOD\n b *= b\n b %= MOD\n return out\n\nans = 0\nd = 1\nb = 1\nfor i in range((N//2)):\n ans += d * b\n b *= 2\n b %= MOD\n ans %= MOD\n d = ((N-i)*d)%MOD\n d = (d*func(i+1))%MOD\n\nprint((func2(N)-ans*2)%MOD)", "language": "Python", "metadata": {"date": 1572852366, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02875.html", "problem_id": "p02875", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02875/input.txt", "sample_output_relpath": "derived/input_output/data/p02875/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02875/Python/s668824431.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s668824431", "user_id": "u211160392"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "N = int(input())\nMOD = 998244353\ndef func(x):\n a = [23,26]\n out = 1\n for i in range(30):\n if not i in a:\n out = (out*x)%MOD\n x *= x\n x %= MOD\n return out\n\ndef func2(x):\n x = bin(x)[2:]\n out = 1\n b = 3\n for i in range(len(x)):\n if x[-1-i] == \"1\":\n out *= b\n out %= MOD\n b *= b\n b %= MOD\n return out\n\nans = 0\nd = 1\nb = 1\nfor i in range((N//2)):\n ans += d * b\n b *= 2\n b %= MOD\n ans %= MOD\n d = ((N-i)*d)%MOD\n d = (d*func(i+1))%MOD\n\nprint((func2(N)-ans*2)%MOD)", "problem_context": "Score : 800 points\n\nProblem Statement\n\nGiven is a positive even number N.\n\nFind the number of strings s of length N consisting of A, B, and C that satisfy the following condition:\n\ns can be converted to the empty string by repeating the following operation:\n\nChoose two consecutive characters in s and erase them. However, choosing AB or BA is not allowed.\n\nFor example, ABBC satisfies the condition for N=4, because we can convert it as follows: ABBC → (erase BB) → AC → (erase AC) → (empty).\n\nThe answer can be enormous, so compute the count modulo 998244353.\n\nConstraints\n\n2 \\leq N \\leq 10^7\n\nN is an even number.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of strings that satisfy the conditions, modulo 998244353.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n7\n\nExcept AB and BA, all possible strings satisfy the conditions.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n50007\n\nSample Input 3\n\n1000000\n\nSample Output 3\n\n210055358", "sample_input": "2\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02875", "source_text": "Score : 800 points\n\nProblem Statement\n\nGiven is a positive even number N.\n\nFind the number of strings s of length N consisting of A, B, and C that satisfy the following condition:\n\ns can be converted to the empty string by repeating the following operation:\n\nChoose two consecutive characters in s and erase them. However, choosing AB or BA is not allowed.\n\nFor example, ABBC satisfies the condition for N=4, because we can convert it as follows: ABBC → (erase BB) → AC → (erase AC) → (empty).\n\nThe answer can be enormous, so compute the count modulo 998244353.\n\nConstraints\n\n2 \\leq N \\leq 10^7\n\nN is an even number.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of strings that satisfy the conditions, modulo 998244353.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n7\n\nExcept AB and BA, all possible strings satisfy the conditions.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n50007\n\nSample Input 3\n\n1000000\n\nSample Output 3\n\n210055358", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 577, "cpu_time_ms": 4206, "memory_kb": 42940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s201324208", "group_id": "codeNet:p02880", "input_text": "N=int(input())\nbandera=False\nfor i in range(10):\n for j in range(10):\n producto=i*j\n if producto==N:\n bandera=True\nif bandera==True:\n print(\"yes\")\nelse:\n print(\"no\")", "language": "Python", "metadata": {"date": 1600520695, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02880.html", "problem_id": "p02880", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02880/input.txt", "sample_output_relpath": "derived/input_output/data/p02880/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02880/Python/s201324208.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s201324208", "user_id": "u816631826"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "N=int(input())\nbandera=False\nfor i in range(10):\n for j in range(10):\n producto=i*j\n if producto==N:\n bandera=True\nif bandera==True:\n print(\"yes\")\nelse:\n print(\"no\")", "problem_context": "Score : 200 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together.\n\nGiven an integer N, determine whether N can be represented as the product of two integers between 1 and 9. If it can, print Yes; if it cannot, print No.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N can be represented as the product of two integers between 1 and 9 (inclusive), print Yes; if it cannot, print No.\n\nSample Input 1\n\n10\n\nSample Output 1\n\nYes\n\n10 can be represented as, for example, 2 \\times 5.\n\nSample Input 2\n\n50\n\nSample Output 2\n\nNo\n\n50 cannot be represented as the product of two integers between 1 and 9.\n\nSample Input 3\n\n81\n\nSample Output 3\n\nYes", "sample_input": "10\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02880", "source_text": "Score : 200 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together.\n\nGiven an integer N, determine whether N can be represented as the product of two integers between 1 and 9. If it can, print Yes; if it cannot, print No.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N can be represented as the product of two integers between 1 and 9 (inclusive), print Yes; if it cannot, print No.\n\nSample Input 1\n\n10\n\nSample Output 1\n\nYes\n\n10 can be represented as, for example, 2 \\times 5.\n\nSample Input 2\n\n50\n\nSample Output 2\n\nNo\n\n50 cannot be represented as the product of two integers between 1 and 9.\n\nSample Input 3\n\n81\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 179, "cpu_time_ms": 29, "memory_kb": 9164}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s809984016", "group_id": "codeNet:p02880", "input_text": "n = int(input())\n\nrevList = [9, 8, 7, 6, 5, 4, 3, 2, 1]\nfor i in revList:\n if n % i == 0:\n if n/i < 10:\n print(\"Yes\")\n break\nelse:\n print(\"No\")\n", "language": "Python", "metadata": {"date": 1574396449, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02880.html", "problem_id": "p02880", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02880/input.txt", "sample_output_relpath": "derived/input_output/data/p02880/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02880/Python/s809984016.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s809984016", "user_id": "u193435200"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "n = int(input())\n\nrevList = [9, 8, 7, 6, 5, 4, 3, 2, 1]\nfor i in revList:\n if n % i == 0:\n if n/i < 10:\n print(\"Yes\")\n break\nelse:\n print(\"No\")\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together.\n\nGiven an integer N, determine whether N can be represented as the product of two integers between 1 and 9. If it can, print Yes; if it cannot, print No.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N can be represented as the product of two integers between 1 and 9 (inclusive), print Yes; if it cannot, print No.\n\nSample Input 1\n\n10\n\nSample Output 1\n\nYes\n\n10 can be represented as, for example, 2 \\times 5.\n\nSample Input 2\n\n50\n\nSample Output 2\n\nNo\n\n50 cannot be represented as the product of two integers between 1 and 9.\n\nSample Input 3\n\n81\n\nSample Output 3\n\nYes", "sample_input": "10\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02880", "source_text": "Score : 200 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together.\n\nGiven an integer N, determine whether N can be represented as the product of two integers between 1 and 9. If it can, print Yes; if it cannot, print No.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N can be represented as the product of two integers between 1 and 9 (inclusive), print Yes; if it cannot, print No.\n\nSample Input 1\n\n10\n\nSample Output 1\n\nYes\n\n10 can be represented as, for example, 2 \\times 5.\n\nSample Input 2\n\n50\n\nSample Output 2\n\nNo\n\n50 cannot be represented as the product of two integers between 1 and 9.\n\nSample Input 3\n\n81\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 159, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s766547829", "group_id": "codeNet:p02880", "input_text": "n = int(input())\n\nfor i in range(9):\n if n%(i+1)==0 and n/(i+1)<10:\n print(\"Yes\")\n break\n elif i==8:\n print(\"No\")", "language": "Python", "metadata": {"date": 1572225006, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02880.html", "problem_id": "p02880", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02880/input.txt", "sample_output_relpath": "derived/input_output/data/p02880/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02880/Python/s766547829.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s766547829", "user_id": "u388450899"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "n = int(input())\n\nfor i in range(9):\n if n%(i+1)==0 and n/(i+1)<10:\n print(\"Yes\")\n break\n elif i==8:\n print(\"No\")", "problem_context": "Score : 200 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together.\n\nGiven an integer N, determine whether N can be represented as the product of two integers between 1 and 9. If it can, print Yes; if it cannot, print No.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N can be represented as the product of two integers between 1 and 9 (inclusive), print Yes; if it cannot, print No.\n\nSample Input 1\n\n10\n\nSample Output 1\n\nYes\n\n10 can be represented as, for example, 2 \\times 5.\n\nSample Input 2\n\n50\n\nSample Output 2\n\nNo\n\n50 cannot be represented as the product of two integers between 1 and 9.\n\nSample Input 3\n\n81\n\nSample Output 3\n\nYes", "sample_input": "10\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02880", "source_text": "Score : 200 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together.\n\nGiven an integer N, determine whether N can be represented as the product of two integers between 1 and 9. If it can, print Yes; if it cannot, print No.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N can be represented as the product of two integers between 1 and 9 (inclusive), print Yes; if it cannot, print No.\n\nSample Input 1\n\n10\n\nSample Output 1\n\nYes\n\n10 can be represented as, for example, 2 \\times 5.\n\nSample Input 2\n\n50\n\nSample Output 2\n\nNo\n\n50 cannot be represented as the product of two integers between 1 and 9.\n\nSample Input 3\n\n81\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 140, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s689591762", "group_id": "codeNet:p02881", "input_text": "import math \n\nN=int(input())\nA=math.sqrt(N)\ntmp=float(\"inf\")\nfor i in range(1,int(A)+1):\n\tif N%i==0:\n\t\ttmp=min(tmp,N//i+i)\nprint(tmp-2)", "language": "Python", "metadata": {"date": 1585876356, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02881.html", "problem_id": "p02881", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02881/input.txt", "sample_output_relpath": "derived/input_output/data/p02881/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02881/Python/s689591762.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s689591762", "user_id": "u527993431"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import math \n\nN=int(input())\nA=math.sqrt(N)\ntmp=float(\"inf\")\nfor i in range(1,int(A)+1):\n\tif N%i==0:\n\t\ttmp=min(tmp,N//i+i)\nprint(tmp-2)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is standing on a multiplication table with infinitely many rows and columns.\n\nThe square (i,j) contains the integer i \\times j. Initially, Takahashi is standing at (1,1).\n\nIn one move, he can move from (i,j) to either (i+1,j) or (i,j+1).\n\nGiven an integer N, find the minimum number of moves needed to reach a square that contains N.\n\nConstraints\n\n2 \\leq N \\leq 10^{12}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum number of moves needed to reach a square that contains the integer N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n5\n\n(2,5) can be reached in five moves. We cannot reach a square that contains 10 in less than five moves.\n\nSample Input 2\n\n50\n\nSample Output 2\n\n13\n\n(5, 10) can be reached in 13 moves.\n\nSample Input 3\n\n10000000019\n\nSample Output 3\n\n10000000018\n\nBoth input and output may be enormous.", "sample_input": "10\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02881", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is standing on a multiplication table with infinitely many rows and columns.\n\nThe square (i,j) contains the integer i \\times j. Initially, Takahashi is standing at (1,1).\n\nIn one move, he can move from (i,j) to either (i+1,j) or (i,j+1).\n\nGiven an integer N, find the minimum number of moves needed to reach a square that contains N.\n\nConstraints\n\n2 \\leq N \\leq 10^{12}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum number of moves needed to reach a square that contains the integer N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n5\n\n(2,5) can be reached in five moves. We cannot reach a square that contains 10 in less than five moves.\n\nSample Input 2\n\n50\n\nSample Output 2\n\n13\n\n(5, 10) can be reached in 13 moves.\n\nSample Input 3\n\n10000000019\n\nSample Output 3\n\n10000000018\n\nBoth input and output may be enormous.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 135, "cpu_time_ms": 151, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s906575146", "group_id": "codeNet:p02881", "input_text": "import math\n\ndef solve():\n N = int(input())\n for i in range(math.floor(math.sqrt(N)), 0, -1):\n if N % i != 0: continue\n return i + (N // i) - 2\n\nprint(solve())", "language": "Python", "metadata": {"date": 1572225116, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02881.html", "problem_id": "p02881", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02881/input.txt", "sample_output_relpath": "derived/input_output/data/p02881/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02881/Python/s906575146.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s906575146", "user_id": "u286955577"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import math\n\ndef solve():\n N = int(input())\n for i in range(math.floor(math.sqrt(N)), 0, -1):\n if N % i != 0: continue\n return i + (N // i) - 2\n\nprint(solve())", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is standing on a multiplication table with infinitely many rows and columns.\n\nThe square (i,j) contains the integer i \\times j. Initially, Takahashi is standing at (1,1).\n\nIn one move, he can move from (i,j) to either (i+1,j) or (i,j+1).\n\nGiven an integer N, find the minimum number of moves needed to reach a square that contains N.\n\nConstraints\n\n2 \\leq N \\leq 10^{12}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum number of moves needed to reach a square that contains the integer N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n5\n\n(2,5) can be reached in five moves. We cannot reach a square that contains 10 in less than five moves.\n\nSample Input 2\n\n50\n\nSample Output 2\n\n13\n\n(5, 10) can be reached in 13 moves.\n\nSample Input 3\n\n10000000019\n\nSample Output 3\n\n10000000018\n\nBoth input and output may be enormous.", "sample_input": "10\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02881", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is standing on a multiplication table with infinitely many rows and columns.\n\nThe square (i,j) contains the integer i \\times j. Initially, Takahashi is standing at (1,1).\n\nIn one move, he can move from (i,j) to either (i+1,j) or (i,j+1).\n\nGiven an integer N, find the minimum number of moves needed to reach a square that contains N.\n\nConstraints\n\n2 \\leq N \\leq 10^{12}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum number of moves needed to reach a square that contains the integer N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n5\n\n(2,5) can be reached in five moves. We cannot reach a square that contains 10 in less than five moves.\n\nSample Input 2\n\n50\n\nSample Output 2\n\n13\n\n(5, 10) can be reached in 13 moves.\n\nSample Input 3\n\n10000000019\n\nSample Output 3\n\n10000000018\n\nBoth input and output may be enormous.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 167, "cpu_time_ms": 111, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s938303406", "group_id": "codeNet:p02882", "input_text": "import numpy as np\nimport math\n\na,b,x = map(int,input().split())\ntaiseki = a*a*b\nmizu_height = x / (a*a)\nparcent = x/taiseki\nprint(parcent)\nif x/taiseki <= 0.5:\n menseki = mizu_height*a\n a = 2 * menseki / b\n #print(a)\n teihen = np.sqrt(a**2+b**2)\n #print(teihen)\n height = 2*menseki/teihen\n #print(height/b)\n print(90-math.degrees(math.asin(height/b)))\n\nelse:\n menseki = mizu_height * a\n daikei_hen = 2*menseki/a - b\n\n sankaku_b = b - daikei_hen\n\n sankaku_menseki = a*sankaku_b/2\n daikei_menseki = menseki - sankaku_menseki\n\n sankaku_teihen = np.sqrt(a**2+sankaku_b**2)\n sankaku_height = 2*sankaku_menseki/sankaku_teihen\n\n daikei_height = daikei_menseki/sankaku_teihen\n\n height = daikei_height + sankaku_height\n\n print(90-math.degrees(math.asin(height/b)))\n", "language": "Python", "metadata": {"date": 1572505793, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02882.html", "problem_id": "p02882", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02882/input.txt", "sample_output_relpath": "derived/input_output/data/p02882/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02882/Python/s938303406.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s938303406", "user_id": "u644360640"}, "prompt_components": {"gold_output": "45.0000000000\n", "input_to_evaluate": "import numpy as np\nimport math\n\na,b,x = map(int,input().split())\ntaiseki = a*a*b\nmizu_height = x / (a*a)\nparcent = x/taiseki\nprint(parcent)\nif x/taiseki <= 0.5:\n menseki = mizu_height*a\n a = 2 * menseki / b\n #print(a)\n teihen = np.sqrt(a**2+b**2)\n #print(teihen)\n height = 2*menseki/teihen\n #print(height/b)\n print(90-math.degrees(math.asin(height/b)))\n\nelse:\n menseki = mizu_height * a\n daikei_hen = 2*menseki/a - b\n\n sankaku_b = b - daikei_hen\n\n sankaku_menseki = a*sankaku_b/2\n daikei_menseki = menseki - sankaku_menseki\n\n sankaku_teihen = np.sqrt(a**2+sankaku_b**2)\n sankaku_height = 2*sankaku_menseki/sankaku_teihen\n\n daikei_height = daikei_menseki/sankaku_teihen\n\n height = daikei_height + sankaku_height\n\n print(90-math.degrees(math.asin(height/b)))\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi has a water bottle with the shape of a rectangular prism whose base is a square of side a~\\mathrm{cm} and whose height is b~\\mathrm{cm}. (The thickness of the bottle can be ignored.)\n\nWe will pour x~\\mathrm{cm}^3 of water into the bottle, and gradually tilt the bottle around one of the sides of the base.\n\nWhen will the water be spilled? More formally, find the maximum angle in which we can tilt the bottle without spilling any water.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq a \\leq 100\n\n1 \\leq b \\leq 100\n\n1 \\leq x \\leq a^2b\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b x\n\nOutput\n\nPrint the maximum angle in which we can tilt the bottle without spilling any water, in degrees.\nYour output will be judged as correct when the absolute or relative error from the judge's output is at most 10^{-6}.\n\nSample Input 1\n\n2 2 4\n\nSample Output 1\n\n45.0000000000\n\nThis bottle has a cubic shape, and it is half-full. The water gets spilled when we tilt the bottle more than 45 degrees.\n\nSample Input 2\n\n12 21 10\n\nSample Output 2\n\n89.7834636934\n\nThis bottle is almost empty. When the water gets spilled, the bottle is nearly horizontal.\n\nSample Input 3\n\n3 1 8\n\nSample Output 3\n\n4.2363947991\n\nThis bottle is almost full. When the water gets spilled, the bottle is still nearly vertical.", "sample_input": "2 2 4\n"}, "reference_outputs": ["45.0000000000\n"], "source_document_id": "p02882", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi has a water bottle with the shape of a rectangular prism whose base is a square of side a~\\mathrm{cm} and whose height is b~\\mathrm{cm}. (The thickness of the bottle can be ignored.)\n\nWe will pour x~\\mathrm{cm}^3 of water into the bottle, and gradually tilt the bottle around one of the sides of the base.\n\nWhen will the water be spilled? More formally, find the maximum angle in which we can tilt the bottle without spilling any water.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq a \\leq 100\n\n1 \\leq b \\leq 100\n\n1 \\leq x \\leq a^2b\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b x\n\nOutput\n\nPrint the maximum angle in which we can tilt the bottle without spilling any water, in degrees.\nYour output will be judged as correct when the absolute or relative error from the judge's output is at most 10^{-6}.\n\nSample Input 1\n\n2 2 4\n\nSample Output 1\n\n45.0000000000\n\nThis bottle has a cubic shape, and it is half-full. The water gets spilled when we tilt the bottle more than 45 degrees.\n\nSample Input 2\n\n12 21 10\n\nSample Output 2\n\n89.7834636934\n\nThis bottle is almost empty. When the water gets spilled, the bottle is nearly horizontal.\n\nSample Input 3\n\n3 1 8\n\nSample Output 3\n\n4.2363947991\n\nThis bottle is almost full. When the water gets spilled, the bottle is still nearly vertical.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 811, "cpu_time_ms": 151, "memory_kb": 12416}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s218258981", "group_id": "codeNet:p02882", "input_text": "a,b,x=map(int,input().split())\nimport math\np=2*(a*a*b-x)/a**3\nq=(a*b*b)/(2*x)\ny=math.atan(p)\nu=math.atan(q)\nif x>=a**2*b/2:\n\tprint(math.degrees(y))\nelse:\n\tprint(math.degrees(u))\n", "language": "Python", "metadata": {"date": 1572289283, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02882.html", "problem_id": "p02882", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02882/input.txt", "sample_output_relpath": "derived/input_output/data/p02882/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02882/Python/s218258981.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s218258981", "user_id": "u296150111"}, "prompt_components": {"gold_output": "45.0000000000\n", "input_to_evaluate": "a,b,x=map(int,input().split())\nimport math\np=2*(a*a*b-x)/a**3\nq=(a*b*b)/(2*x)\ny=math.atan(p)\nu=math.atan(q)\nif x>=a**2*b/2:\n\tprint(math.degrees(y))\nelse:\n\tprint(math.degrees(u))\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi has a water bottle with the shape of a rectangular prism whose base is a square of side a~\\mathrm{cm} and whose height is b~\\mathrm{cm}. (The thickness of the bottle can be ignored.)\n\nWe will pour x~\\mathrm{cm}^3 of water into the bottle, and gradually tilt the bottle around one of the sides of the base.\n\nWhen will the water be spilled? More formally, find the maximum angle in which we can tilt the bottle without spilling any water.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq a \\leq 100\n\n1 \\leq b \\leq 100\n\n1 \\leq x \\leq a^2b\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b x\n\nOutput\n\nPrint the maximum angle in which we can tilt the bottle without spilling any water, in degrees.\nYour output will be judged as correct when the absolute or relative error from the judge's output is at most 10^{-6}.\n\nSample Input 1\n\n2 2 4\n\nSample Output 1\n\n45.0000000000\n\nThis bottle has a cubic shape, and it is half-full. The water gets spilled when we tilt the bottle more than 45 degrees.\n\nSample Input 2\n\n12 21 10\n\nSample Output 2\n\n89.7834636934\n\nThis bottle is almost empty. When the water gets spilled, the bottle is nearly horizontal.\n\nSample Input 3\n\n3 1 8\n\nSample Output 3\n\n4.2363947991\n\nThis bottle is almost full. When the water gets spilled, the bottle is still nearly vertical.", "sample_input": "2 2 4\n"}, "reference_outputs": ["45.0000000000\n"], "source_document_id": "p02882", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi has a water bottle with the shape of a rectangular prism whose base is a square of side a~\\mathrm{cm} and whose height is b~\\mathrm{cm}. (The thickness of the bottle can be ignored.)\n\nWe will pour x~\\mathrm{cm}^3 of water into the bottle, and gradually tilt the bottle around one of the sides of the base.\n\nWhen will the water be spilled? More formally, find the maximum angle in which we can tilt the bottle without spilling any water.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq a \\leq 100\n\n1 \\leq b \\leq 100\n\n1 \\leq x \\leq a^2b\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b x\n\nOutput\n\nPrint the maximum angle in which we can tilt the bottle without spilling any water, in degrees.\nYour output will be judged as correct when the absolute or relative error from the judge's output is at most 10^{-6}.\n\nSample Input 1\n\n2 2 4\n\nSample Output 1\n\n45.0000000000\n\nThis bottle has a cubic shape, and it is half-full. The water gets spilled when we tilt the bottle more than 45 degrees.\n\nSample Input 2\n\n12 21 10\n\nSample Output 2\n\n89.7834636934\n\nThis bottle is almost empty. When the water gets spilled, the bottle is nearly horizontal.\n\nSample Input 3\n\n3 1 8\n\nSample Output 3\n\n4.2363947991\n\nThis bottle is almost full. When the water gets spilled, the bottle is still nearly vertical.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 178, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s821717674", "group_id": "codeNet:p02883", "input_text": "# coding: utf-8\n# Your code here!\n\nimport math\nimport sys\n\nn,k = map(int,input().split())\nal = list(map(int,input().split()))\nfl = list(map(int,input().split()))\n\nal.sort()\nfl.sort(reverse=True)\n\nub = max([a*f for a,f in zip(al, fl)])\nlb = 0\n\nwhile True:\n if ub == lb:\n print(lb)\n sys.exit()\n p = 0\n t = int((ub + lb) / 2)\n for a, f in zip(al, fl):\n p += max(math.ceil(a - t / f), 0)\n if p <= k:\n ub = t\n else:\n lb = t + 1", "language": "Python", "metadata": {"date": 1572290622, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02883.html", "problem_id": "p02883", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02883/input.txt", "sample_output_relpath": "derived/input_output/data/p02883/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02883/Python/s821717674.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s821717674", "user_id": "u683134447"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "# coding: utf-8\n# Your code here!\n\nimport math\nimport sys\n\nn,k = map(int,input().split())\nal = list(map(int,input().split()))\nfl = list(map(int,input().split()))\n\nal.sort()\nfl.sort(reverse=True)\n\nub = max([a*f for a,f in zip(al, fl)])\nlb = 0\n\nwhile True:\n if ub == lb:\n print(lb)\n sys.exit()\n p = 0\n t = int((ub + lb) / 2)\n for a, f in zip(al, fl):\n p += max(math.ceil(a - t / f), 0)\n if p <= k:\n ub = t\n else:\n lb = t + 1", "problem_context": "Score: 500 points\n\nProblem Statement\n\nTakahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The consumption coefficient of Member i is A_i.\n\nIn the contest, N foods numbered 1 through N will be presented, and the difficulty of Food i is F_i. The details of the contest are as follows:\n\nA team should assign one member to each food, and should not assign the same member to multiple foods.\n\nIt will take x \\times y seconds for a member to finish the food, where x is the consumption coefficient of the member and y is the difficulty of the dish.\n\nThe score of a team is the longest time it takes for an individual member to finish the food.\n\nBefore the contest, Takahashi's team decided to do some training. In one set of training, a member can reduce his/her consumption coefficient by 1, as long as it does not go below 0. However, for financial reasons, the N members can do at most K sets of training in total.\n\nWhat is the minimum possible score of the team, achieved by choosing the amounts of members' training and allocating the dishes optimally?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq K \\leq 10^{18}\n\n1 \\leq A_i \\leq 10^6\\ (1 \\leq i \\leq N)\n\n1 \\leq F_i \\leq 10^6\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\nF_1 F_2 ... F_N\n\nOutput\n\nPrint the minimum possible score of the team.\n\nSample Input 1\n\n3 5\n4 2 1\n2 3 1\n\nSample Output 1\n\n2\n\nThey can achieve the score of 2, as follows:\n\nMember 1 does 4 sets of training and eats Food 2 in (4-4) \\times 3 = 0 seconds.\n\nMember 2 does 1 set of training and eats Food 3 in (2-1) \\times 1 = 1 second.\n\nMember 3 does 0 sets of training and eats Food 1 in (1-0) \\times 2 = 2 seconds.\n\nThey cannot achieve a score of less than 2, so the answer is 2.\n\nSample Input 2\n\n3 8\n4 2 1\n2 3 1\n\nSample Output 2\n\n0\n\nThey can choose not to do exactly K sets of training.\n\nSample Input 3\n\n11 14\n3 1 4 1 5 9 2 6 5 3 5\n8 9 7 9 3 2 3 8 4 6 2\n\nSample Output 3\n\n12", "sample_input": "3 5\n4 2 1\n2 3 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02883", "source_text": "Score: 500 points\n\nProblem Statement\n\nTakahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The consumption coefficient of Member i is A_i.\n\nIn the contest, N foods numbered 1 through N will be presented, and the difficulty of Food i is F_i. The details of the contest are as follows:\n\nA team should assign one member to each food, and should not assign the same member to multiple foods.\n\nIt will take x \\times y seconds for a member to finish the food, where x is the consumption coefficient of the member and y is the difficulty of the dish.\n\nThe score of a team is the longest time it takes for an individual member to finish the food.\n\nBefore the contest, Takahashi's team decided to do some training. In one set of training, a member can reduce his/her consumption coefficient by 1, as long as it does not go below 0. However, for financial reasons, the N members can do at most K sets of training in total.\n\nWhat is the minimum possible score of the team, achieved by choosing the amounts of members' training and allocating the dishes optimally?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq K \\leq 10^{18}\n\n1 \\leq A_i \\leq 10^6\\ (1 \\leq i \\leq N)\n\n1 \\leq F_i \\leq 10^6\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\nF_1 F_2 ... F_N\n\nOutput\n\nPrint the minimum possible score of the team.\n\nSample Input 1\n\n3 5\n4 2 1\n2 3 1\n\nSample Output 1\n\n2\n\nThey can achieve the score of 2, as follows:\n\nMember 1 does 4 sets of training and eats Food 2 in (4-4) \\times 3 = 0 seconds.\n\nMember 2 does 1 set of training and eats Food 3 in (2-1) \\times 1 = 1 second.\n\nMember 3 does 0 sets of training and eats Food 1 in (1-0) \\times 2 = 2 seconds.\n\nThey cannot achieve a score of less than 2, so the answer is 2.\n\nSample Input 2\n\n3 8\n4 2 1\n2 3 1\n\nSample Output 2\n\n0\n\nThey can choose not to do exactly K sets of training.\n\nSample Input 3\n\n11 14\n3 1 4 1 5 9 2 6 5 3 5\n8 9 7 9 3 2 3 8 4 6 2\n\nSample Output 3\n\n12", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 475, "cpu_time_ms": 2109, "memory_kb": 34624}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s580714922", "group_id": "codeNet:p02885", "input_text": "a, b= map(int, input().split())\n\nc=a-b*2\n\nif c<=0:\n print(0)\nelse:\n print(c)\n", "language": "Python", "metadata": {"date": 1571537980, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02885.html", "problem_id": "p02885", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02885/input.txt", "sample_output_relpath": "derived/input_output/data/p02885/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02885/Python/s580714922.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s580714922", "user_id": "u261423637"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "a, b= map(int, input().split())\n\nc=a-b*2\n\nif c<=0:\n print(0)\nelse:\n print(c)\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThe window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)\n\nWe will close the window so as to minimize the total horizontal length of the uncovered part of the window.\nFind the total horizontal length of the uncovered parts of the window then.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the total horizontal length of the uncovered parts of the window.\n\nSample Input 1\n\n12 4\n\nSample Output 1\n\n4\n\nWe have a window with a horizontal length of 12, and two curtains, each of length 4, that cover both ends of the window, for example. The uncovered part has a horizontal length of 4.\n\nSample Input 2\n\n20 15\n\nSample Output 2\n\n0\n\nIf the window is completely covered, print 0.\n\nSample Input 3\n\n20 30\n\nSample Output 3\n\n0\n\nEach curtain may be longer than the window.", "sample_input": "12 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02885", "source_text": "Score : 100 points\n\nProblem Statement\n\nThe window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)\n\nWe will close the window so as to minimize the total horizontal length of the uncovered part of the window.\nFind the total horizontal length of the uncovered parts of the window then.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the total horizontal length of the uncovered parts of the window.\n\nSample Input 1\n\n12 4\n\nSample Output 1\n\n4\n\nWe have a window with a horizontal length of 12, and two curtains, each of length 4, that cover both ends of the window, for example. The uncovered part has a horizontal length of 4.\n\nSample Input 2\n\n20 15\n\nSample Output 2\n\n0\n\nIf the window is completely covered, print 0.\n\nSample Input 3\n\n20 30\n\nSample Output 3\n\n0\n\nEach curtain may be longer than the window.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 83, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s515940680", "group_id": "codeNet:p02887", "input_text": "N = int(input())\nS = input()\ncount = 0\nfor x in range(0,N-1):\n if S[x] == S[x+1]:\n count += 1\nans = len(S) - count\nprint(ans)", "language": "Python", "metadata": {"date": 1571535141, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02887.html", "problem_id": "p02887", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02887/input.txt", "sample_output_relpath": "derived/input_output/data/p02887/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02887/Python/s515940680.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s515940680", "user_id": "u428316812"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "N = int(input())\nS = input()\ncount = 0\nfor x in range(0,N-1):\n if S[x] == S[x+1]:\n count += 1\nans = len(S) - count\nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N slimes lining up from left to right. The colors of these slimes will be given as a string S of length N consisting of lowercase English letters. The i-th slime from the left has the color that corresponds to the i-th character of S.\n\nAdjacent slimes with the same color will fuse into one larger slime without changing the color. If there were a slime adjacent to this group of slimes before fusion, that slime is now adjacent to the new larger slime.\n\nUltimately, how many slimes will be there?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n|S| = N\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the final number of slimes.\n\nSample Input 1\n\n10\naabbbbaaca\n\nSample Output 1\n\n5\n\nUltimately, these slimes will fuse into abaca.\n\nSample Input 2\n\n5\naaaaa\n\nSample Output 2\n\n1\n\nAll the slimes will fuse into one.\n\nSample Input 3\n\n20\nxxzaffeeeeddfkkkkllq\n\nSample Output 3\n\n10", "sample_input": "10\naabbbbaaca\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02887", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N slimes lining up from left to right. The colors of these slimes will be given as a string S of length N consisting of lowercase English letters. The i-th slime from the left has the color that corresponds to the i-th character of S.\n\nAdjacent slimes with the same color will fuse into one larger slime without changing the color. If there were a slime adjacent to this group of slimes before fusion, that slime is now adjacent to the new larger slime.\n\nUltimately, how many slimes will be there?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n|S| = N\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the final number of slimes.\n\nSample Input 1\n\n10\naabbbbaaca\n\nSample Output 1\n\n5\n\nUltimately, these slimes will fuse into abaca.\n\nSample Input 2\n\n5\naaaaa\n\nSample Output 2\n\n1\n\nAll the slimes will fuse into one.\n\nSample Input 3\n\n20\nxxzaffeeeeddfkkkkllq\n\nSample Output 3\n\n10", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 135, "cpu_time_ms": 43, "memory_kb": 3444}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s688266408", "group_id": "codeNet:p02888", "input_text": "n=int(input())\nl=list(map(int,input().split()))\nans=0\nfor i in range(n-2):\n a=l[i]\n for j in range(i+1,n-1):\n b=l[j]\n for k in range(j+1,n):\n c=l[k]\n if a=l[_]:\n continue\n elif l[i]+l[k]<=l[_]:\n break\n else:\n ans+=1\nprint(ans)", "language": "Python", "metadata": {"date": 1586720648, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02888.html", "problem_id": "p02888", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02888/input.txt", "sample_output_relpath": "derived/input_output/data/p02888/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02888/Python/s811652119.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s811652119", "user_id": "u024782094"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import sys\ninput = sys.stdin.readline\nn=int(input())\nl = list(map(int, input().split()))\nl=sorted(l)\nans=0\nfor i in range(n):\n for k in range(i+1,n):\n for _ in range(k+1,n):\n if -l[i]+l[k]>=l[_]:\n continue\n elif l[i]+l[k]<=l[_]:\n break\n else:\n ans+=1\nprint(ans)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi has N sticks that are distinguishable from each other. The length of the i-th stick is L_i.\n\nHe is going to form a triangle using three of these sticks. Let a, b, and c be the lengths of the three sticks used. Here, all of the following conditions must be satisfied:\n\na < b + c\n\nb < c + a\n\nc < a + b\n\nHow many different triangles can be formed? Two triangles are considered different when there is a stick used in only one of them.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 2 \\times 10^3\n\n1 \\leq L_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_N\n\nConstraints\n\nPrint the number of different triangles that can be formed.\n\nSample Input 1\n\n4\n3 4 2 1\n\nSample Output 1\n\n1\n\nOnly one triangle can be formed: the triangle formed by the first, second, and third sticks.\n\nSample Input 2\n\n3\n1 1000 1\n\nSample Output 2\n\n0\n\nNo triangles can be formed.\n\nSample Input 3\n\n7\n218 786 704 233 645 728 389\n\nSample Output 3\n\n23", "sample_input": "4\n3 4 2 1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02888", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi has N sticks that are distinguishable from each other. The length of the i-th stick is L_i.\n\nHe is going to form a triangle using three of these sticks. Let a, b, and c be the lengths of the three sticks used. Here, all of the following conditions must be satisfied:\n\na < b + c\n\nb < c + a\n\nc < a + b\n\nHow many different triangles can be formed? Two triangles are considered different when there is a stick used in only one of them.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 2 \\times 10^3\n\n1 \\leq L_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_N\n\nConstraints\n\nPrint the number of different triangles that can be formed.\n\nSample Input 1\n\n4\n3 4 2 1\n\nSample Output 1\n\n1\n\nOnly one triangle can be formed: the triangle formed by the first, second, and third sticks.\n\nSample Input 2\n\n3\n1 1000 1\n\nSample Output 2\n\n0\n\nNo triangles can be formed.\n\nSample Input 3\n\n7\n218 786 704 233 645 728 389\n\nSample Output 3\n\n23", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 301, "cpu_time_ms": 2106, "memory_kb": 45356}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s109542112", "group_id": "codeNet:p02888", "input_text": "\nN = int(input())\nD = input().split(' ')\n\nD.sort(reverse=True)\n\ncount = 0\nfor i in range(N):\n for j in range(i + 1, N):\n for k in range(j + 1, N):\n if int(D[i]) < int(D[j]) + int(D[k]):\n count += 1\n else:\n break\n \n \nprint(count)\n\n ", "language": "Python", "metadata": {"date": 1571537031, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02888.html", "problem_id": "p02888", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02888/input.txt", "sample_output_relpath": "derived/input_output/data/p02888/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02888/Python/s109542112.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s109542112", "user_id": "u326744360"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "\nN = int(input())\nD = input().split(' ')\n\nD.sort(reverse=True)\n\ncount = 0\nfor i in range(N):\n for j in range(i + 1, N):\n for k in range(j + 1, N):\n if int(D[i]) < int(D[j]) + int(D[k]):\n count += 1\n else:\n break\n \n \nprint(count)\n\n ", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi has N sticks that are distinguishable from each other. The length of the i-th stick is L_i.\n\nHe is going to form a triangle using three of these sticks. Let a, b, and c be the lengths of the three sticks used. Here, all of the following conditions must be satisfied:\n\na < b + c\n\nb < c + a\n\nc < a + b\n\nHow many different triangles can be formed? Two triangles are considered different when there is a stick used in only one of them.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 2 \\times 10^3\n\n1 \\leq L_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_N\n\nConstraints\n\nPrint the number of different triangles that can be formed.\n\nSample Input 1\n\n4\n3 4 2 1\n\nSample Output 1\n\n1\n\nOnly one triangle can be formed: the triangle formed by the first, second, and third sticks.\n\nSample Input 2\n\n3\n1 1000 1\n\nSample Output 2\n\n0\n\nNo triangles can be formed.\n\nSample Input 3\n\n7\n218 786 704 233 645 728 389\n\nSample Output 3\n\n23", "sample_input": "4\n3 4 2 1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02888", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi has N sticks that are distinguishable from each other. The length of the i-th stick is L_i.\n\nHe is going to form a triangle using three of these sticks. Let a, b, and c be the lengths of the three sticks used. Here, all of the following conditions must be satisfied:\n\na < b + c\n\nb < c + a\n\nc < a + b\n\nHow many different triangles can be formed? Two triangles are considered different when there is a stick used in only one of them.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 2 \\times 10^3\n\n1 \\leq L_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_N\n\nConstraints\n\nPrint the number of different triangles that can be formed.\n\nSample Input 1\n\n4\n3 4 2 1\n\nSample Output 1\n\n1\n\nOnly one triangle can be formed: the triangle formed by the first, second, and third sticks.\n\nSample Input 2\n\n3\n1 1000 1\n\nSample Output 2\n\n0\n\nNo triangles can be formed.\n\nSample Input 3\n\n7\n218 786 704 233 645 728 389\n\nSample Output 3\n\n23", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 296, "cpu_time_ms": 2104, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s901197571", "group_id": "codeNet:p02888", "input_text": "n=int(input())\nl=list(map(int,input().split()))\nl.sort(reverse=True)\ntotal=0\nfor i in range(n-2):\n if l[i]= k:\n cnt += 1\n\n# 答えの出力\nprint( cnt )", "language": "Python", "metadata": {"date": 1570737029, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02898.html", "problem_id": "p02898", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02898/input.txt", "sample_output_relpath": "derived/input_output/data/p02898/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02898/Python/s642905025.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s642905025", "user_id": "u826027240"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "# 1行目の入力を空白で分割された数値として扱う\nn, k = map(int, input().split())\n# 2行目の入力を数値のリストとして扱う\nh = list(map(int, input().split()))\n\n# 答えのカウンタの準備\ncnt = 0\n\n# k以上のhを数える\nfor i in range(0, n):\n if h[i] >= k:\n cnt += 1\n\n# 答えの出力\nprint( cnt )", "problem_context": "Score : 200 points\n\nProblem Statement\n\nN friends of Takahashi has come to a theme park.\n\nTo ride the most popular roller coaster in the park, you must be at least K centimeters tall.\n\nThe i-th friend is h_i centimeters tall.\n\nHow many of the Takahashi's friends can ride the roller coaster?\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le K \\le 500\n\n1 \\le h_i \\le 500\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the number of people among the Takahashi's friends who can ride the roller coaster.\n\nSample Input 1\n\n4 150\n150 140 100 200\n\nSample Output 1\n\n2\n\nTwo of them can ride the roller coaster: the first and fourth friends.\n\nSample Input 2\n\n1 500\n499\n\nSample Output 2\n\n0\n\nSample Input 3\n\n5 1\n100 200 300 400 500\n\nSample Output 3\n\n5", "sample_input": "4 150\n150 140 100 200\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02898", "source_text": "Score : 200 points\n\nProblem Statement\n\nN friends of Takahashi has come to a theme park.\n\nTo ride the most popular roller coaster in the park, you must be at least K centimeters tall.\n\nThe i-th friend is h_i centimeters tall.\n\nHow many of the Takahashi's friends can ride the roller coaster?\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le K \\le 500\n\n1 \\le h_i \\le 500\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the number of people among the Takahashi's friends who can ride the roller coaster.\n\nSample Input 1\n\n4 150\n150 140 100 200\n\nSample Output 1\n\n2\n\nTwo of them can ride the roller coaster: the first and fourth friends.\n\nSample Input 2\n\n1 500\n499\n\nSample Output 2\n\n0\n\nSample Input 3\n\n5 1\n100 200 300 400 500\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 348, "cpu_time_ms": 52, "memory_kb": 11916}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s531728391", "group_id": "codeNet:p02898", "input_text": "N,K = map(int,input().split())\nH = list(map(int,input().split()))\n\nans = 0\nfor h in H :\n if h >= K :\n ans += 1\nprint(ans)\n\n", "language": "Python", "metadata": {"date": 1569718878, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02898.html", "problem_id": "p02898", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02898/input.txt", "sample_output_relpath": "derived/input_output/data/p02898/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02898/Python/s531728391.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s531728391", "user_id": "u879870653"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "N,K = map(int,input().split())\nH = list(map(int,input().split()))\n\nans = 0\nfor h in H :\n if h >= K :\n ans += 1\nprint(ans)\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nN friends of Takahashi has come to a theme park.\n\nTo ride the most popular roller coaster in the park, you must be at least K centimeters tall.\n\nThe i-th friend is h_i centimeters tall.\n\nHow many of the Takahashi's friends can ride the roller coaster?\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le K \\le 500\n\n1 \\le h_i \\le 500\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the number of people among the Takahashi's friends who can ride the roller coaster.\n\nSample Input 1\n\n4 150\n150 140 100 200\n\nSample Output 1\n\n2\n\nTwo of them can ride the roller coaster: the first and fourth friends.\n\nSample Input 2\n\n1 500\n499\n\nSample Output 2\n\n0\n\nSample Input 3\n\n5 1\n100 200 300 400 500\n\nSample Output 3\n\n5", "sample_input": "4 150\n150 140 100 200\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02898", "source_text": "Score : 200 points\n\nProblem Statement\n\nN friends of Takahashi has come to a theme park.\n\nTo ride the most popular roller coaster in the park, you must be at least K centimeters tall.\n\nThe i-th friend is h_i centimeters tall.\n\nHow many of the Takahashi's friends can ride the roller coaster?\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le K \\le 500\n\n1 \\le h_i \\le 500\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the number of people among the Takahashi's friends who can ride the roller coaster.\n\nSample Input 1\n\n4 150\n150 140 100 200\n\nSample Output 1\n\n2\n\nTwo of them can ride the roller coaster: the first and fourth friends.\n\nSample Input 2\n\n1 500\n499\n\nSample Output 2\n\n0\n\nSample Input 3\n\n5 1\n100 200 300 400 500\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 133, "cpu_time_ms": 48, "memory_kb": 11908}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s878114187", "group_id": "codeNet:p02899", "input_text": "n = int(input())\na = list(map(int, input().split()))\n\ncount = dict()\n\nfor x in range(1, n+1):\n count[str(x)] = a[x-1]\n\n\ncount_sorted = sorted(count.items(), key=lambda x: x[1])\n\nans = ''\n\nfor x in range(n):\n ans += count_sorted[x][0]\n if x != n-1:\n ans += ' '\n\nprint(ans)\n", "language": "Python", "metadata": {"date": 1592107596, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02899.html", "problem_id": "p02899", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02899/input.txt", "sample_output_relpath": "derived/input_output/data/p02899/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02899/Python/s878114187.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s878114187", "user_id": "u806403461"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "n = int(input())\na = list(map(int, input().split()))\n\ncount = dict()\n\nfor x in range(1, n+1):\n count[str(x)] = a[x-1]\n\n\ncount_sorted = sorted(count.items(), key=lambda x: x[1])\n\nans = ''\n\nfor x in range(n):\n ans += count_sorted[x][0]\n if x != n-1:\n ans += ' '\n\nprint(ans)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is a teacher responsible for a class of N students.\n\nThe students are given distinct student numbers from 1 to N.\n\nToday, all the students entered the classroom at different times.\n\nAccording to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).\n\nFrom these records, reconstruct the order in which the students entered the classroom.\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le A_i \\le N\n\nA_i \\neq A_j (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the student numbers of the students in the order the students entered the classroom.\n\nSample Input 1\n\n3\n2 3 1\n\nSample Output 1\n\n3 1 2\n\nFirst, student number 3 entered the classroom.\n\nThen, student number 1 entered the classroom.\n\nFinally, student number 2 entered the classroom.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n1 2 3 4 5\n\nSample Input 3\n\n8\n8 2 7 3 4 5 6 1\n\nSample Output 3\n\n8 2 4 5 6 7 3 1", "sample_input": "3\n2 3 1\n"}, "reference_outputs": ["3 1 2\n"], "source_document_id": "p02899", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is a teacher responsible for a class of N students.\n\nThe students are given distinct student numbers from 1 to N.\n\nToday, all the students entered the classroom at different times.\n\nAccording to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).\n\nFrom these records, reconstruct the order in which the students entered the classroom.\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le A_i \\le N\n\nA_i \\neq A_j (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the student numbers of the students in the order the students entered the classroom.\n\nSample Input 1\n\n3\n2 3 1\n\nSample Output 1\n\n3 1 2\n\nFirst, student number 3 entered the classroom.\n\nThen, student number 1 entered the classroom.\n\nFinally, student number 2 entered the classroom.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n1 2 3 4 5\n\nSample Input 3\n\n8\n8 2 7 3 4 5 6 1\n\nSample Output 3\n\n8 2 4 5 6 7 3 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 288, "cpu_time_ms": 243, "memory_kb": 27892}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s726716767", "group_id": "codeNet:p02899", "input_text": "N=input()\nQsList=list(map(int,input().split()))\n\ntmpList=QsList[:]\ntmpList.sort()\n\ncnt=0\ntmp=0\nAnsList=QsList[:]\nfor i in QsList:\n tmp=int(QsList.index(i))+1\n a=int(tmpList.index(i))\n a=int(a)\n AnsList[a]=tmp\n \nprint(*AnsList)", "language": "Python", "metadata": {"date": 1569723939, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02899.html", "problem_id": "p02899", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02899/input.txt", "sample_output_relpath": "derived/input_output/data/p02899/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02899/Python/s726716767.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s726716767", "user_id": "u461996061"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "N=input()\nQsList=list(map(int,input().split()))\n\ntmpList=QsList[:]\ntmpList.sort()\n\ncnt=0\ntmp=0\nAnsList=QsList[:]\nfor i in QsList:\n tmp=int(QsList.index(i))+1\n a=int(tmpList.index(i))\n a=int(a)\n AnsList[a]=tmp\n \nprint(*AnsList)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is a teacher responsible for a class of N students.\n\nThe students are given distinct student numbers from 1 to N.\n\nToday, all the students entered the classroom at different times.\n\nAccording to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).\n\nFrom these records, reconstruct the order in which the students entered the classroom.\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le A_i \\le N\n\nA_i \\neq A_j (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the student numbers of the students in the order the students entered the classroom.\n\nSample Input 1\n\n3\n2 3 1\n\nSample Output 1\n\n3 1 2\n\nFirst, student number 3 entered the classroom.\n\nThen, student number 1 entered the classroom.\n\nFinally, student number 2 entered the classroom.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n1 2 3 4 5\n\nSample Input 3\n\n8\n8 2 7 3 4 5 6 1\n\nSample Output 3\n\n8 2 4 5 6 7 3 1", "sample_input": "3\n2 3 1\n"}, "reference_outputs": ["3 1 2\n"], "source_document_id": "p02899", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is a teacher responsible for a class of N students.\n\nThe students are given distinct student numbers from 1 to N.\n\nToday, all the students entered the classroom at different times.\n\nAccording to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).\n\nFrom these records, reconstruct the order in which the students entered the classroom.\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le A_i \\le N\n\nA_i \\neq A_j (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the student numbers of the students in the order the students entered the classroom.\n\nSample Input 1\n\n3\n2 3 1\n\nSample Output 1\n\n3 1 2\n\nFirst, student number 3 entered the classroom.\n\nThen, student number 1 entered the classroom.\n\nFinally, student number 2 entered the classroom.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n1 2 3 4 5\n\nSample Input 3\n\n8\n8 2 7 3 4 5 6 1\n\nSample Output 3\n\n8 2 4 5 6 7 3 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 231, "cpu_time_ms": 2104, "memory_kb": 13880}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s175964117", "group_id": "codeNet:p02899", "input_text": "N=input()\na=list(map(int, input()))\nb=a\nc=1\nif c<=N:\n\td=a[c-1]\n\tb[d-1]='c'\n\tc+=1\n''.join(b)", "language": "Python", "metadata": {"date": 1569722903, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02899.html", "problem_id": "p02899", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02899/input.txt", "sample_output_relpath": "derived/input_output/data/p02899/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02899/Python/s175964117.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s175964117", "user_id": "u051928503"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "N=input()\na=list(map(int, input()))\nb=a\nc=1\nif c<=N:\n\td=a[c-1]\n\tb[d-1]='c'\n\tc+=1\n''.join(b)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is a teacher responsible for a class of N students.\n\nThe students are given distinct student numbers from 1 to N.\n\nToday, all the students entered the classroom at different times.\n\nAccording to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).\n\nFrom these records, reconstruct the order in which the students entered the classroom.\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le A_i \\le N\n\nA_i \\neq A_j (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the student numbers of the students in the order the students entered the classroom.\n\nSample Input 1\n\n3\n2 3 1\n\nSample Output 1\n\n3 1 2\n\nFirst, student number 3 entered the classroom.\n\nThen, student number 1 entered the classroom.\n\nFinally, student number 2 entered the classroom.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n1 2 3 4 5\n\nSample Input 3\n\n8\n8 2 7 3 4 5 6 1\n\nSample Output 3\n\n8 2 4 5 6 7 3 1", "sample_input": "3\n2 3 1\n"}, "reference_outputs": ["3 1 2\n"], "source_document_id": "p02899", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is a teacher responsible for a class of N students.\n\nThe students are given distinct student numbers from 1 to N.\n\nToday, all the students entered the classroom at different times.\n\nAccording to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).\n\nFrom these records, reconstruct the order in which the students entered the classroom.\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le A_i \\le N\n\nA_i \\neq A_j (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the student numbers of the students in the order the students entered the classroom.\n\nSample Input 1\n\n3\n2 3 1\n\nSample Output 1\n\n3 1 2\n\nFirst, student number 3 entered the classroom.\n\nThen, student number 1 entered the classroom.\n\nFinally, student number 2 entered the classroom.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n1 2 3 4 5\n\nSample Input 3\n\n8\n8 2 7 3 4 5 6 1\n\nSample Output 3\n\n8 2 4 5 6 7 3 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 91, "cpu_time_ms": 18, "memory_kb": 4280}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s791808633", "group_id": "codeNet:p02900", "input_text": "from math import *\n\ndef next_int():\n return int(input())\n\ndef next_ints():\n return list(map(int, input().split()))\n\na, b = next_ints()\nn = gcd(a, b)\nans = 1\ni = 2\nwhile i*i <= n:\n if n%i == 0:\n ans += 1\n while n%i == 0:\n n //= i\n i += 1\nif n != 1:\n ans += 1\nprint(ans)\n", "language": "Python", "metadata": {"date": 1569901517, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02900.html", "problem_id": "p02900", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02900/input.txt", "sample_output_relpath": "derived/input_output/data/p02900/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02900/Python/s791808633.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s791808633", "user_id": "u464770506"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "from math import *\n\ndef next_int():\n return int(input())\n\ndef next_ints():\n return list(map(int, input().split()))\n\na, b = next_ints()\nn = gcd(a, b)\nans = 1\ni = 2\nwhile i*i <= n:\n if n%i == 0:\n ans += 1\n while n%i == 0:\n n //= i\n i += 1\nif n != 1:\n ans += 1\nprint(ans)\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven are positive integers A and B.\n\nLet us choose some number of positive common divisors of A and B.\n\nHere, any two of the chosen divisors must be coprime.\n\nAt most, how many divisors can we choose?\n\nDefinition of common divisor\n\nAn integer d is said to be a common divisor of integers x and y when d divides both x and y.\n\nDefinition of being coprime\n\nIntegers x and y are said to be coprime when x and y have no positive common divisors other than 1.\n\nDefinition of dividing\n\nAn integer x is said to divide another integer y when there exists an integer \\alpha such that y = \\alpha x.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the maximum number of divisors that can be chosen to satisfy the condition.\n\nSample Input 1\n\n12 18\n\nSample Output 1\n\n3\n\n12 and 18 have the following positive common divisors: 1, 2, 3, and 6.\n\n1 and 2 are coprime, 2 and 3 are coprime, and 3 and 1 are coprime, so we can choose 1, 2, and 3, which achieve the maximum result.\n\nSample Input 2\n\n420 660\n\nSample Output 2\n\n4\n\nSample Input 3\n\n1 2019\n\nSample Output 3\n\n1\n\n1 and 2019 have no positive common divisors other than 1.", "sample_input": "12 18\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02900", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven are positive integers A and B.\n\nLet us choose some number of positive common divisors of A and B.\n\nHere, any two of the chosen divisors must be coprime.\n\nAt most, how many divisors can we choose?\n\nDefinition of common divisor\n\nAn integer d is said to be a common divisor of integers x and y when d divides both x and y.\n\nDefinition of being coprime\n\nIntegers x and y are said to be coprime when x and y have no positive common divisors other than 1.\n\nDefinition of dividing\n\nAn integer x is said to divide another integer y when there exists an integer \\alpha such that y = \\alpha x.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the maximum number of divisors that can be chosen to satisfy the condition.\n\nSample Input 1\n\n12 18\n\nSample Output 1\n\n3\n\n12 and 18 have the following positive common divisors: 1, 2, 3, and 6.\n\n1 and 2 are coprime, 2 and 3 are coprime, and 3 and 1 are coprime, so we can choose 1, 2, and 3, which achieve the maximum result.\n\nSample Input 2\n\n420 660\n\nSample Output 2\n\n4\n\nSample Input 3\n\n1 2019\n\nSample Output 3\n\n1\n\n1 and 2019 have no positive common divisors other than 1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 309, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s188058958", "group_id": "codeNet:p02900", "input_text": "from math import gcd\na, b = map(int, input().split())\nx = gcd(a, b)\nz = []\nfor i in range(2, x):\n flag = True\n if x % i == 0:\n for j in z:\n if i % j == 0:\n flag = False\n break\n if flag == True and x % i == 0:\n z.append(i)\nprint len(z) + 1\n", "language": "Python", "metadata": {"date": 1569788705, "filename_ext": "py", "original_language": "Python (2.7.6)", "problem_description_relpath": "problem_descriptions/p02900.html", "problem_id": "p02900", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02900/input.txt", "sample_output_relpath": "derived/input_output/data/p02900/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02900/Python/s188058958.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s188058958", "user_id": "u697031246"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "from math import gcd\na, b = map(int, input().split())\nx = gcd(a, b)\nz = []\nfor i in range(2, x):\n flag = True\n if x % i == 0:\n for j in z:\n if i % j == 0:\n flag = False\n break\n if flag == True and x % i == 0:\n z.append(i)\nprint len(z) + 1\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven are positive integers A and B.\n\nLet us choose some number of positive common divisors of A and B.\n\nHere, any two of the chosen divisors must be coprime.\n\nAt most, how many divisors can we choose?\n\nDefinition of common divisor\n\nAn integer d is said to be a common divisor of integers x and y when d divides both x and y.\n\nDefinition of being coprime\n\nIntegers x and y are said to be coprime when x and y have no positive common divisors other than 1.\n\nDefinition of dividing\n\nAn integer x is said to divide another integer y when there exists an integer \\alpha such that y = \\alpha x.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the maximum number of divisors that can be chosen to satisfy the condition.\n\nSample Input 1\n\n12 18\n\nSample Output 1\n\n3\n\n12 and 18 have the following positive common divisors: 1, 2, 3, and 6.\n\n1 and 2 are coprime, 2 and 3 are coprime, and 3 and 1 are coprime, so we can choose 1, 2, and 3, which achieve the maximum result.\n\nSample Input 2\n\n420 660\n\nSample Output 2\n\n4\n\nSample Input 3\n\n1 2019\n\nSample Output 3\n\n1\n\n1 and 2019 have no positive common divisors other than 1.", "sample_input": "12 18\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02900", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven are positive integers A and B.\n\nLet us choose some number of positive common divisors of A and B.\n\nHere, any two of the chosen divisors must be coprime.\n\nAt most, how many divisors can we choose?\n\nDefinition of common divisor\n\nAn integer d is said to be a common divisor of integers x and y when d divides both x and y.\n\nDefinition of being coprime\n\nIntegers x and y are said to be coprime when x and y have no positive common divisors other than 1.\n\nDefinition of dividing\n\nAn integer x is said to divide another integer y when there exists an integer \\alpha such that y = \\alpha x.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the maximum number of divisors that can be chosen to satisfy the condition.\n\nSample Input 1\n\n12 18\n\nSample Output 1\n\n3\n\n12 and 18 have the following positive common divisors: 1, 2, 3, and 6.\n\n1 and 2 are coprime, 2 and 3 are coprime, and 3 and 1 are coprime, so we can choose 1, 2, and 3, which achieve the maximum result.\n\nSample Input 2\n\n420 660\n\nSample Output 2\n\n4\n\nSample Input 3\n\n1 2019\n\nSample Output 3\n\n1\n\n1 and 2019 have no positive common divisors other than 1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 303, "cpu_time_ms": 13, "memory_kb": 2568}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s010141987", "group_id": "codeNet:p02900", "input_text": "A, B = map(int,input().split())\nC = abs(A-B)\n\nwhile A != 0 and B != 0:\n if A < B:\n B = C\n else:\n A = C\n C = abs(A-B)\n\ni = 2\nans = 1\nwhile C > 1:\n if C%i == 0:\n ans += 1\n while C%i == 0:\n C //= i\n i += 1\n\nprint(ans)", "language": "Python", "metadata": {"date": 1569721522, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02900.html", "problem_id": "p02900", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02900/input.txt", "sample_output_relpath": "derived/input_output/data/p02900/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02900/Python/s010141987.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s010141987", "user_id": "u760391419"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "A, B = map(int,input().split())\nC = abs(A-B)\n\nwhile A != 0 and B != 0:\n if A < B:\n B = C\n else:\n A = C\n C = abs(A-B)\n\ni = 2\nans = 1\nwhile C > 1:\n if C%i == 0:\n ans += 1\n while C%i == 0:\n C //= i\n i += 1\n\nprint(ans)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven are positive integers A and B.\n\nLet us choose some number of positive common divisors of A and B.\n\nHere, any two of the chosen divisors must be coprime.\n\nAt most, how many divisors can we choose?\n\nDefinition of common divisor\n\nAn integer d is said to be a common divisor of integers x and y when d divides both x and y.\n\nDefinition of being coprime\n\nIntegers x and y are said to be coprime when x and y have no positive common divisors other than 1.\n\nDefinition of dividing\n\nAn integer x is said to divide another integer y when there exists an integer \\alpha such that y = \\alpha x.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the maximum number of divisors that can be chosen to satisfy the condition.\n\nSample Input 1\n\n12 18\n\nSample Output 1\n\n3\n\n12 and 18 have the following positive common divisors: 1, 2, 3, and 6.\n\n1 and 2 are coprime, 2 and 3 are coprime, and 3 and 1 are coprime, so we can choose 1, 2, and 3, which achieve the maximum result.\n\nSample Input 2\n\n420 660\n\nSample Output 2\n\n4\n\nSample Input 3\n\n1 2019\n\nSample Output 3\n\n1\n\n1 and 2019 have no positive common divisors other than 1.", "sample_input": "12 18\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02900", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven are positive integers A and B.\n\nLet us choose some number of positive common divisors of A and B.\n\nHere, any two of the chosen divisors must be coprime.\n\nAt most, how many divisors can we choose?\n\nDefinition of common divisor\n\nAn integer d is said to be a common divisor of integers x and y when d divides both x and y.\n\nDefinition of being coprime\n\nIntegers x and y are said to be coprime when x and y have no positive common divisors other than 1.\n\nDefinition of dividing\n\nAn integer x is said to divide another integer y when there exists an integer \\alpha such that y = \\alpha x.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the maximum number of divisors that can be chosen to satisfy the condition.\n\nSample Input 1\n\n12 18\n\nSample Output 1\n\n3\n\n12 and 18 have the following positive common divisors: 1, 2, 3, and 6.\n\n1 and 2 are coprime, 2 and 3 are coprime, and 3 and 1 are coprime, so we can choose 1, 2, and 3, which achieve the maximum result.\n\nSample Input 2\n\n420 660\n\nSample Output 2\n\n4\n\nSample Input 3\n\n1 2019\n\nSample Output 3\n\n1\n\n1 and 2019 have no positive common divisors other than 1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 236, "cpu_time_ms": 2104, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s339312455", "group_id": "codeNet:p02901", "input_text": "n,m = map(int, input().split())\n\ninf = 10**9\n\ndp = [[inf for _ in range(2**n)]] * m\ndp[0][0] = 0\n\nfor i in range(m):\n a,b = map(int, input().split())\n d = sum((1<<(i-1)) for i in map(int, input().split()))\n \n #initialize\n if i==0:\n dp[0][d] = a\n continue\n \n for j in range(2**n):\n jord = j | d\n print(jord)\n dp[i][jord] = min(dp[i-1][jord], dp[i-1][j] + a)\n print(dp[i][jord])\n \nif dp[m-1][2**n-1] == inf:\n print(-1)\nelse:\n print(dp[m-1][2**n-1])", "language": "Python", "metadata": {"date": 1570752215, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02901.html", "problem_id": "p02901", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02901/input.txt", "sample_output_relpath": "derived/input_output/data/p02901/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02901/Python/s339312455.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s339312455", "user_id": "u693716675"}, "prompt_components": {"gold_output": "25\n", "input_to_evaluate": "n,m = map(int, input().split())\n\ninf = 10**9\n\ndp = [[inf for _ in range(2**n)]] * m\ndp[0][0] = 0\n\nfor i in range(m):\n a,b = map(int, input().split())\n d = sum((1<<(i-1)) for i in map(int, input().split()))\n \n #initialize\n if i==0:\n dp[0][d] = a\n continue\n \n for j in range(2**n):\n jord = j | d\n print(jord)\n dp[i][jord] = min(dp[i-1][jord], dp[i-1][j] + a)\n print(dp[i][jord])\n \nif dp[m-1][2**n-1] == inf:\n print(-1)\nelse:\n print(dp[m-1][2**n-1])", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have N locked treasure boxes, numbered 1 to N.\n\nA shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.\n\nFind the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 12\n\n1 \\leq M \\leq 10^3\n\n1 \\leq a_i \\leq 10^5\n\n1 \\leq b_i \\leq N\n\n1 \\leq c_{i1} < c_{i2} < ... < c_{i{b_i}} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\nc_{11} c_{12} ... c_{1{b_1}}\n:\na_M b_M\nc_{M1} c_{M2} ... c_{M{b_M}}\n\nOutput\n\nPrint the minimum cost required to unlock all the treasure boxes.\nIf it is impossible to unlock all of them, print -1.\n\nSample Input 1\n\n2 3\n10 1\n1\n15 1\n2\n30 2\n1 2\n\nSample Output 1\n\n25\n\nWe can unlock all the boxes by purchasing the first and second keys, at the cost of 25 yen, which is the minimum cost required.\n\nSample Input 2\n\n12 1\n100000 1\n2\n\nSample Output 2\n\n-1\n\nWe cannot unlock all the boxes.\n\nSample Input 3\n\n4 6\n67786 3\n1 3 4\n3497 1\n2\n44908 3\n2 3 4\n2156 3\n2 3 4\n26230 1\n2\n86918 1\n3\n\nSample Output 3\n\n69942", "sample_input": "2 3\n10 1\n1\n15 1\n2\n30 2\n1 2\n"}, "reference_outputs": ["25\n"], "source_document_id": "p02901", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have N locked treasure boxes, numbered 1 to N.\n\nA shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.\n\nFind the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 12\n\n1 \\leq M \\leq 10^3\n\n1 \\leq a_i \\leq 10^5\n\n1 \\leq b_i \\leq N\n\n1 \\leq c_{i1} < c_{i2} < ... < c_{i{b_i}} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\nc_{11} c_{12} ... c_{1{b_1}}\n:\na_M b_M\nc_{M1} c_{M2} ... c_{M{b_M}}\n\nOutput\n\nPrint the minimum cost required to unlock all the treasure boxes.\nIf it is impossible to unlock all of them, print -1.\n\nSample Input 1\n\n2 3\n10 1\n1\n15 1\n2\n30 2\n1 2\n\nSample Output 1\n\n25\n\nWe can unlock all the boxes by purchasing the first and second keys, at the cost of 25 yen, which is the minimum cost required.\n\nSample Input 2\n\n12 1\n100000 1\n2\n\nSample Output 2\n\n-1\n\nWe cannot unlock all the boxes.\n\nSample Input 3\n\n4 6\n67786 3\n1 3 4\n3497 1\n2\n44908 3\n2 3 4\n2156 3\n2 3 4\n26230 1\n2\n86918 1\n3\n\nSample Output 3\n\n69942", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 528, "cpu_time_ms": 2104, "memory_kb": 16956}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s789914821", "group_id": "codeNet:p02901", "input_text": "import numpy as np\n\nN, M = map(int, input().split())\n\ndp = [10e9] * (2 ** N)\ndp[0] = 0\n\nfor i in range(M):\n a, b = map(int, input().split())\n c = map(int, input().split())\n key = np.sum([2**(x-1) for x in c])\n \n ndp = dp.copy()\n for j in range(2**N):\n if dp[j | key] > ndp[j] + a:\n dp[j | key] = ndp[j] + a\n \nif dp[-1] == np.inf:\n print(-1)\nelse:\n print(dp[-1])\n", "language": "Python", "metadata": {"date": 1570402769, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02901.html", "problem_id": "p02901", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02901/input.txt", "sample_output_relpath": "derived/input_output/data/p02901/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02901/Python/s789914821.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s789914821", "user_id": "u584790715"}, "prompt_components": {"gold_output": "25\n", "input_to_evaluate": "import numpy as np\n\nN, M = map(int, input().split())\n\ndp = [10e9] * (2 ** N)\ndp[0] = 0\n\nfor i in range(M):\n a, b = map(int, input().split())\n c = map(int, input().split())\n key = np.sum([2**(x-1) for x in c])\n \n ndp = dp.copy()\n for j in range(2**N):\n if dp[j | key] > ndp[j] + a:\n dp[j | key] = ndp[j] + a\n \nif dp[-1] == np.inf:\n print(-1)\nelse:\n print(dp[-1])\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have N locked treasure boxes, numbered 1 to N.\n\nA shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.\n\nFind the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 12\n\n1 \\leq M \\leq 10^3\n\n1 \\leq a_i \\leq 10^5\n\n1 \\leq b_i \\leq N\n\n1 \\leq c_{i1} < c_{i2} < ... < c_{i{b_i}} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\nc_{11} c_{12} ... c_{1{b_1}}\n:\na_M b_M\nc_{M1} c_{M2} ... c_{M{b_M}}\n\nOutput\n\nPrint the minimum cost required to unlock all the treasure boxes.\nIf it is impossible to unlock all of them, print -1.\n\nSample Input 1\n\n2 3\n10 1\n1\n15 1\n2\n30 2\n1 2\n\nSample Output 1\n\n25\n\nWe can unlock all the boxes by purchasing the first and second keys, at the cost of 25 yen, which is the minimum cost required.\n\nSample Input 2\n\n12 1\n100000 1\n2\n\nSample Output 2\n\n-1\n\nWe cannot unlock all the boxes.\n\nSample Input 3\n\n4 6\n67786 3\n1 3 4\n3497 1\n2\n44908 3\n2 3 4\n2156 3\n2 3 4\n26230 1\n2\n86918 1\n3\n\nSample Output 3\n\n69942", "sample_input": "2 3\n10 1\n1\n15 1\n2\n30 2\n1 2\n"}, "reference_outputs": ["25\n"], "source_document_id": "p02901", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have N locked treasure boxes, numbered 1 to N.\n\nA shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.\n\nFind the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 12\n\n1 \\leq M \\leq 10^3\n\n1 \\leq a_i \\leq 10^5\n\n1 \\leq b_i \\leq N\n\n1 \\leq c_{i1} < c_{i2} < ... < c_{i{b_i}} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\nc_{11} c_{12} ... c_{1{b_1}}\n:\na_M b_M\nc_{M1} c_{M2} ... c_{M{b_M}}\n\nOutput\n\nPrint the minimum cost required to unlock all the treasure boxes.\nIf it is impossible to unlock all of them, print -1.\n\nSample Input 1\n\n2 3\n10 1\n1\n15 1\n2\n30 2\n1 2\n\nSample Output 1\n\n25\n\nWe can unlock all the boxes by purchasing the first and second keys, at the cost of 25 yen, which is the minimum cost required.\n\nSample Input 2\n\n12 1\n100000 1\n2\n\nSample Output 2\n\n-1\n\nWe cannot unlock all the boxes.\n\nSample Input 3\n\n4 6\n67786 3\n1 3 4\n3497 1\n2\n44908 3\n2 3 4\n2156 3\n2 3 4\n26230 1\n2\n86918 1\n3\n\nSample Output 3\n\n69942", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2108, "memory_kb": 12500}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s026432612", "group_id": "codeNet:p02901", "input_text": "#142e\nN,M = map(int, input().split())\n\nopenable_box_and_price = {} #開けられる箱のtaple:値段 なdict\n\n#同じ箱を開けられる鍵は最安値のものを選びつつ、読み込み\nfor i in range(M):\n a,b = map(int, input().split())\n c = tuple(map(int, input().split()))\n \n #print(c,\":\",a)\n \n if c in openable_box_and_price:\n #print(\"重複\")\n if openable_box_and_price[c] > a:\n #print(\"安値更新\")\n openable_box_and_price[c] = a\n else:\n openable_box_and_price[c] = a\n\n#鍵に番号(0~)を付けるためlist化\nkey_price = list(openable_box_and_price.values())\nkey_openable_box = list(openable_box_and_price.keys())\n\n#ある箱を開けられる鍵のリストを作る\nkey_number = 0\nbox_and_openable_key = [[] for _ in range(N)]\n\nfor openable_boxes in key_openable_box:\n for openable_box in openable_boxes:\n box_and_openable_key[openable_box-1].append(key_number)\n\n key_number += 1\n\n#すべての箱を開けられる鍵の組み合わせのうち、最安値を求める。\nno_ans_flag = 0\n\n#そもそも開けられる鍵が無い箱があったら-1を出力\nfor openable_key in box_and_openable_key:\n if not openable_key:\n print(-1)\n no_ans_flag = 1\n break\n \nif no_ans_flag != 1:\n def choice_keys(box_number):\n for key_number in box_and_openable_key[box_number]: #箱を開けられる鍵から1個選ぶ\n choiced_keys.append(key_number)\n if len(choiced_keys) != N: #すべての箱に対して鍵を選んでなかったら\n choice_keys(box_number+1) #さらに選ぶ\n else: #すべての箱に対して鍵を選んでたら\n #値段を計算する\n \n choiced_keys_set = set(choiced_keys) #重複選択している鍵を削除する\n\n if tuple(choiced_keys_set) not in caluclated_key_set_and_price: #setでは辞書のkeyに使えないので、tuple化\n #値段計算\n total_price = 0\n for choiced_key in choiced_keys_set:\n total_price += key_price[choiced_key]\n\n caluclated_key_set_and_price[tuple(choiced_keys_set)] = total_price\n\n #print(choiced_keys,\":\",choiced_keys_set,\":\",total_price)\n\n choiced_keys.pop(-1)\n\n if len(choiced_keys)!=0:\n choiced_keys.pop(-1) \n\n \n caluclated_key_set_and_price = {}\n choiced_keys = []\n choice_keys(0)\n\n #求めたすべての箱を開けられる鍵の選択肢一覧から最安を選ぶ\n #print(caluclated_key_set_and_price)\n caluclated_key_set_and_price = sorted(caluclated_key_set_and_price.items(), key=lambda x:x[1])\n #print(caluclated_key_set_and_price)\n print(caluclated_key_set_and_price[0][1])", "language": "Python", "metadata": {"date": 1570241931, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02901.html", "problem_id": "p02901", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02901/input.txt", "sample_output_relpath": "derived/input_output/data/p02901/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02901/Python/s026432612.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s026432612", "user_id": "u314089899"}, "prompt_components": {"gold_output": "25\n", "input_to_evaluate": "#142e\nN,M = map(int, input().split())\n\nopenable_box_and_price = {} #開けられる箱のtaple:値段 なdict\n\n#同じ箱を開けられる鍵は最安値のものを選びつつ、読み込み\nfor i in range(M):\n a,b = map(int, input().split())\n c = tuple(map(int, input().split()))\n \n #print(c,\":\",a)\n \n if c in openable_box_and_price:\n #print(\"重複\")\n if openable_box_and_price[c] > a:\n #print(\"安値更新\")\n openable_box_and_price[c] = a\n else:\n openable_box_and_price[c] = a\n\n#鍵に番号(0~)を付けるためlist化\nkey_price = list(openable_box_and_price.values())\nkey_openable_box = list(openable_box_and_price.keys())\n\n#ある箱を開けられる鍵のリストを作る\nkey_number = 0\nbox_and_openable_key = [[] for _ in range(N)]\n\nfor openable_boxes in key_openable_box:\n for openable_box in openable_boxes:\n box_and_openable_key[openable_box-1].append(key_number)\n\n key_number += 1\n\n#すべての箱を開けられる鍵の組み合わせのうち、最安値を求める。\nno_ans_flag = 0\n\n#そもそも開けられる鍵が無い箱があったら-1を出力\nfor openable_key in box_and_openable_key:\n if not openable_key:\n print(-1)\n no_ans_flag = 1\n break\n \nif no_ans_flag != 1:\n def choice_keys(box_number):\n for key_number in box_and_openable_key[box_number]: #箱を開けられる鍵から1個選ぶ\n choiced_keys.append(key_number)\n if len(choiced_keys) != N: #すべての箱に対して鍵を選んでなかったら\n choice_keys(box_number+1) #さらに選ぶ\n else: #すべての箱に対して鍵を選んでたら\n #値段を計算する\n \n choiced_keys_set = set(choiced_keys) #重複選択している鍵を削除する\n\n if tuple(choiced_keys_set) not in caluclated_key_set_and_price: #setでは辞書のkeyに使えないので、tuple化\n #値段計算\n total_price = 0\n for choiced_key in choiced_keys_set:\n total_price += key_price[choiced_key]\n\n caluclated_key_set_and_price[tuple(choiced_keys_set)] = total_price\n\n #print(choiced_keys,\":\",choiced_keys_set,\":\",total_price)\n\n choiced_keys.pop(-1)\n\n if len(choiced_keys)!=0:\n choiced_keys.pop(-1) \n\n \n caluclated_key_set_and_price = {}\n choiced_keys = []\n choice_keys(0)\n\n #求めたすべての箱を開けられる鍵の選択肢一覧から最安を選ぶ\n #print(caluclated_key_set_and_price)\n caluclated_key_set_and_price = sorted(caluclated_key_set_and_price.items(), key=lambda x:x[1])\n #print(caluclated_key_set_and_price)\n print(caluclated_key_set_and_price[0][1])", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have N locked treasure boxes, numbered 1 to N.\n\nA shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.\n\nFind the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 12\n\n1 \\leq M \\leq 10^3\n\n1 \\leq a_i \\leq 10^5\n\n1 \\leq b_i \\leq N\n\n1 \\leq c_{i1} < c_{i2} < ... < c_{i{b_i}} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\nc_{11} c_{12} ... c_{1{b_1}}\n:\na_M b_M\nc_{M1} c_{M2} ... c_{M{b_M}}\n\nOutput\n\nPrint the minimum cost required to unlock all the treasure boxes.\nIf it is impossible to unlock all of them, print -1.\n\nSample Input 1\n\n2 3\n10 1\n1\n15 1\n2\n30 2\n1 2\n\nSample Output 1\n\n25\n\nWe can unlock all the boxes by purchasing the first and second keys, at the cost of 25 yen, which is the minimum cost required.\n\nSample Input 2\n\n12 1\n100000 1\n2\n\nSample Output 2\n\n-1\n\nWe cannot unlock all the boxes.\n\nSample Input 3\n\n4 6\n67786 3\n1 3 4\n3497 1\n2\n44908 3\n2 3 4\n2156 3\n2 3 4\n26230 1\n2\n86918 1\n3\n\nSample Output 3\n\n69942", "sample_input": "2 3\n10 1\n1\n15 1\n2\n30 2\n1 2\n"}, "reference_outputs": ["25\n"], "source_document_id": "p02901", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have N locked treasure boxes, numbered 1 to N.\n\nA shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.\n\nFind the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 12\n\n1 \\leq M \\leq 10^3\n\n1 \\leq a_i \\leq 10^5\n\n1 \\leq b_i \\leq N\n\n1 \\leq c_{i1} < c_{i2} < ... < c_{i{b_i}} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\nc_{11} c_{12} ... c_{1{b_1}}\n:\na_M b_M\nc_{M1} c_{M2} ... c_{M{b_M}}\n\nOutput\n\nPrint the minimum cost required to unlock all the treasure boxes.\nIf it is impossible to unlock all of them, print -1.\n\nSample Input 1\n\n2 3\n10 1\n1\n15 1\n2\n30 2\n1 2\n\nSample Output 1\n\n25\n\nWe can unlock all the boxes by purchasing the first and second keys, at the cost of 25 yen, which is the minimum cost required.\n\nSample Input 2\n\n12 1\n100000 1\n2\n\nSample Output 2\n\n-1\n\nWe cannot unlock all the boxes.\n\nSample Input 3\n\n4 6\n67786 3\n1 3 4\n3497 1\n2\n44908 3\n2 3 4\n2156 3\n2 3 4\n26230 1\n2\n86918 1\n3\n\nSample Output 3\n\n69942", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2885, "cpu_time_ms": 2111, "memory_kb": 183596}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s414162168", "group_id": "codeNet:p02903", "input_text": "h,w,a,b = map(int, input().split())\nif a*2>w or b*2>h:\n print('No')\nelse:\n ans = [[0 for i in range(w)]for j in range(h)]\n for i in range(h):\n for j in range(w):\n if j=a and i>=b:\n ans[i][j]=1\n for i in range(h):\n print(''.join(map(str,ans[i])))", "language": "Python", "metadata": {"date": 1569471641, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02903.html", "problem_id": "p02903", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02903/input.txt", "sample_output_relpath": "derived/input_output/data/p02903/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02903/Python/s414162168.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s414162168", "user_id": "u190405389"}, "prompt_components": {"gold_output": "100\n010\n001\n", "input_to_evaluate": "h,w,a,b = map(int, input().split())\nif a*2>w or b*2>h:\n print('No')\nelse:\n ans = [[0 for i in range(w)]for j in range(h)]\n for i in range(h):\n for j in range(w):\n if j=a and i>=b:\n ans[i][j]=1\n for i in range(h):\n print(''.join(map(str,ans[i])))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a square grid with H rows and W columns.\nSnuke wants to write 0 or 1 in each of the squares.\nHere, all of the following conditions have to be satisfied:\n\nFor every row, the smaller of the following is A: the number of 0s contained in the row, and the number of 1s contained in the row. (If these two numbers are equal, “the smaller” should be read as “either”.)\n\nFor every column, the smaller of the following is B: the number of 0s contained in the column, and the number of 1s contained in the column.\n\nDetermine if these conditions can be satisfied by writing 0 or 1 in each of the squares. If the answer is yes, show one way to fill the squares so that the conditions are satisfied.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\n0 \\leq A\n\n2 \\times A \\leq W\n\n0 \\leq B\n\n2 \\times B \\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W A B\n\nOutput\n\nIf the conditions cannot be satisfied by writing 0 or 1 in each of the squares, print -1.\n\nIf the conditions can be satisfied, print one way to fill the squares so that the conditions are satisfied, in the following format:\n\ns_{11}s_{12}\\cdots s_{1W}\ns_{21}s_{22}\\cdots s_{2W}\n\\vdots\ns_{H1}s_{H2}\\cdots s_{HW}\n\nHere s_{ij} is the digit written in the square at the i-th row from the top and the j-th column from the left in the grid.\n\nIf multiple solutions exist, printing any of them will be accepted.\n\nSample Input 1\n\n3 3 1 1\n\nSample Output 1\n\n100\n010\n001\n\nEvery row contains two 0s and one 1, so the first condition is satisfied.\nAlso, every column contains two 0s and one 1, so the second condition is satisfied.\n\nSample Input 2\n\n1 5 2 0\n\nSample Output 2\n\n01010", "sample_input": "3 3 1 1\n"}, "reference_outputs": ["100\n010\n001\n"], "source_document_id": "p02903", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a square grid with H rows and W columns.\nSnuke wants to write 0 or 1 in each of the squares.\nHere, all of the following conditions have to be satisfied:\n\nFor every row, the smaller of the following is A: the number of 0s contained in the row, and the number of 1s contained in the row. (If these two numbers are equal, “the smaller” should be read as “either”.)\n\nFor every column, the smaller of the following is B: the number of 0s contained in the column, and the number of 1s contained in the column.\n\nDetermine if these conditions can be satisfied by writing 0 or 1 in each of the squares. If the answer is yes, show one way to fill the squares so that the conditions are satisfied.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\n0 \\leq A\n\n2 \\times A \\leq W\n\n0 \\leq B\n\n2 \\times B \\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W A B\n\nOutput\n\nIf the conditions cannot be satisfied by writing 0 or 1 in each of the squares, print -1.\n\nIf the conditions can be satisfied, print one way to fill the squares so that the conditions are satisfied, in the following format:\n\ns_{11}s_{12}\\cdots s_{1W}\ns_{21}s_{22}\\cdots s_{2W}\n\\vdots\ns_{H1}s_{H2}\\cdots s_{HW}\n\nHere s_{ij} is the digit written in the square at the i-th row from the top and the j-th column from the left in the grid.\n\nIf multiple solutions exist, printing any of them will be accepted.\n\nSample Input 1\n\n3 3 1 1\n\nSample Output 1\n\n100\n010\n001\n\nEvery row contains two 0s and one 1, so the first condition is satisfied.\nAlso, every column contains two 0s and one 1, so the second condition is satisfied.\n\nSample Input 2\n\n1 5 2 0\n\nSample Output 2\n\n01010", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 356, "cpu_time_ms": 294, "memory_kb": 52700}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s466105609", "group_id": "codeNet:p02906", "input_text": "import sys\n\n\nclass UnionFind:\n def __init__(self, n):\n self.table = [-1] * n\n\n def _root(self, x):\n if self.table[x] < 0:\n return x\n else:\n self.table[x] = self._root(self.table[x])\n return self.table[x]\n\n def find(self, x, y):\n return self._root(x) == self._root(y)\n\n def union(self, x, y):\n r1 = self._root(x)\n r2 = self._root(y)\n if r1 == r2:\n return\n d1 = self.table[r1]\n d2 = self.table[r2]\n if d1 <= d2:\n self.table[r2] = r1\n self.table[r1] += d2\n else:\n self.table[r1] = r2\n self.table[r2] += d1\n\n def connected_count(self):\n return sum(x < 0 for x in self.table)\n\n\nn, m, q = list(map(int, input().split()))\nuft = UnionFind(n)\nhyper_paths = set()\n\nfor line in sys.stdin:\n a, b, c = list(map(int, line.split()))\n if c == 1:\n hyper_paths.add((a, b))\n continue\n uft.union(a, b)\n\nfor a, b in hyper_paths:\n if uft.find(a, b):\n print('No')\n exit()\n\ncc = uft.connected_count()\n\nmin_m = n if len(hyper_paths) > 0 else n - 1\nmax_m = n - cc + cc * (cc - 1) // 2\n\nprint('Yes' if min_m <= m <= max_m else 'No')\n", "language": "Python", "metadata": {"date": 1569125753, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02906.html", "problem_id": "p02906", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02906/input.txt", "sample_output_relpath": "derived/input_output/data/p02906/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02906/Python/s466105609.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s466105609", "user_id": "u340781749"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import sys\n\n\nclass UnionFind:\n def __init__(self, n):\n self.table = [-1] * n\n\n def _root(self, x):\n if self.table[x] < 0:\n return x\n else:\n self.table[x] = self._root(self.table[x])\n return self.table[x]\n\n def find(self, x, y):\n return self._root(x) == self._root(y)\n\n def union(self, x, y):\n r1 = self._root(x)\n r2 = self._root(y)\n if r1 == r2:\n return\n d1 = self.table[r1]\n d2 = self.table[r2]\n if d1 <= d2:\n self.table[r2] = r1\n self.table[r1] += d2\n else:\n self.table[r1] = r2\n self.table[r2] += d1\n\n def connected_count(self):\n return sum(x < 0 for x in self.table)\n\n\nn, m, q = list(map(int, input().split()))\nuft = UnionFind(n)\nhyper_paths = set()\n\nfor line in sys.stdin:\n a, b, c = list(map(int, line.split()))\n if c == 1:\n hyper_paths.add((a, b))\n continue\n uft.union(a, b)\n\nfor a, b in hyper_paths:\n if uft.find(a, b):\n print('No')\n exit()\n\ncc = uft.connected_count()\n\nmin_m = n if len(hyper_paths) > 0 else n - 1\nmax_m = n - cc + cc * (cc - 1) // 2\n\nprint('Yes' if min_m <= m <= max_m else 'No')\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSnuke's mother gave Snuke an undirected graph consisting of N vertices numbered 0 to N-1 and M edges.\nThis graph was connected and contained no parallel edges or self-loops.\n\nOne day, Snuke broke this graph.\nFortunately, he remembered Q clues about the graph.\nThe i-th clue (0 \\leq i \\leq Q-1) is represented as integers A_i,B_i,C_i and means the following:\n\nIf C_i=0: there was exactly one simple path (a path that never visits the same vertex twice) from Vertex A_i to B_i.\n\nIf C_i=1: there were two or more simple paths from Vertex A_i to B_i.\n\nSnuke is not sure if his memory is correct, and worried whether there is a graph that matches these Q clues.\nDetermine if there exists a graph that matches Snuke's memory.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\nN-1 \\leq M \\leq N \\times (N-1)/2\n\n1 \\leq Q \\leq 10^5\n\n0 \\leq A_i,B_i \\leq N-1\n\nA_i \\neq B_i\n\n0 \\leq C_i \\leq 1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nA_0 B_0 C_0\nA_1 B_1 C_1\n\\vdots\nA_{Q-1} B_{Q-1} C_{Q-1}\n\nOutput\n\nIf there exists a graph that matches Snuke's memory, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 5 3\n0 1 0\n1 2 1\n2 3 0\n\nSample Output 1\n\nYes\n\nFor example, consider a graph with edges (0,1),(1,2),(1,4),(2,3),(2,4). This graph matches the clues.\n\nSample Input 2\n\n4 4 3\n0 1 0\n1 2 1\n2 3 0\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n10 9 9\n7 6 0\n4 5 1\n9 7 0\n2 9 0\n2 3 0\n4 1 0\n8 0 0\n9 1 0\n3 0 0\n\nSample Output 3\n\nNo", "sample_input": "5 5 3\n0 1 0\n1 2 1\n2 3 0\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02906", "source_text": "Score : 700 points\n\nProblem Statement\n\nSnuke's mother gave Snuke an undirected graph consisting of N vertices numbered 0 to N-1 and M edges.\nThis graph was connected and contained no parallel edges or self-loops.\n\nOne day, Snuke broke this graph.\nFortunately, he remembered Q clues about the graph.\nThe i-th clue (0 \\leq i \\leq Q-1) is represented as integers A_i,B_i,C_i and means the following:\n\nIf C_i=0: there was exactly one simple path (a path that never visits the same vertex twice) from Vertex A_i to B_i.\n\nIf C_i=1: there were two or more simple paths from Vertex A_i to B_i.\n\nSnuke is not sure if his memory is correct, and worried whether there is a graph that matches these Q clues.\nDetermine if there exists a graph that matches Snuke's memory.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\nN-1 \\leq M \\leq N \\times (N-1)/2\n\n1 \\leq Q \\leq 10^5\n\n0 \\leq A_i,B_i \\leq N-1\n\nA_i \\neq B_i\n\n0 \\leq C_i \\leq 1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nA_0 B_0 C_0\nA_1 B_1 C_1\n\\vdots\nA_{Q-1} B_{Q-1} C_{Q-1}\n\nOutput\n\nIf there exists a graph that matches Snuke's memory, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 5 3\n0 1 0\n1 2 1\n2 3 0\n\nSample Output 1\n\nYes\n\nFor example, consider a graph with edges (0,1),(1,2),(1,4),(2,3),(2,4). This graph matches the clues.\n\nSample Input 2\n\n4 4 3\n0 1 0\n1 2 1\n2 3 0\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n10 9 9\n7 6 0\n4 5 1\n9 7 0\n2 9 0\n2 3 0\n4 1 0\n8 0 0\n9 1 0\n3 0 0\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1233, "cpu_time_ms": 333, "memory_kb": 21116}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s016067977", "group_id": "codeNet:p02906", "input_text": "import sys\ninput = sys.stdin.readline\n\nclass Node:\n def __init__(self, id):\n self.id = id\n self.parent = None\n self.child_num = 0\n self.is_root = True\n self.grand_parent = False\n\n def root(self):\n node = self\n while not node.is_root:\n # print(node.id)\n node = node.parent\n return node\n\ndef main():\n N, M, Q = map(int, input().split())\n abc = sorted([list(map(int, input().split())) for i in range(Q)], key=lambda x: x[2])\n\n nodes = [Node(i) for i in range(N)]\n edge_count = 0\n count_rest = True\n ok = True\n for i in range(Q):\n # print(i)\n a, b, c = abc[i]\n if c == 0:# Union-find\n root_a = nodes[a].root()\n root_b = nodes[b].root()\n if root_a != root_b:\n if root_a.child_num > root_b.child_num:\n root_b, root_a = root_a, root_b\n root_a.child_num += root_b.child_num + 1\n root_b.parent = root_a\n root_b.is_root = False\n edge_count += 1\n if edge_count > M:\n ok = False\n break\n else:\n if count_rest:\n rest_node = 0\n for i in range(N):\n if nodes[i].is_root and nodes[i].child_num == 0:\n rest_node += 1\n count_rest = False\n if rest_node == 0:\n ok = False\n break\n root_a = nodes[a].root()\n root_b = nodes[b].root()\n if root_a == root_b:\n ok = False\n break\n elif root_a.grand_parent and root_b.grand_parent:\n pass\n elif root_a.grand_parent and not root_b.grand_parent:\n root_b.grand_parent = True\n edge_count += 1\n elif (not root_a.grand_parent) and root_b.grand_parent:\n root_a.grand_parent = True\n edge_count += 1\n else:\n root_a.grand_parent = True\n root_b.grand_parent = True\n edge_count += 2\n \n has_grand = 0\n for i in range(N):\n if nodes[i].grand_parent:\n has_grand += 1\n yoyu = (has_grand * (has_grand - 1)) // 2\n \n if edge_count > M:\n ok = False\n elif edge_count < M:\n if edge_count + rest_node - 1 <= M:\n if edge_count + rest_node - 1 + yoyu < M:\n ok = False\n else:\n ok = False\n\n if not ok:\n print(\"No\")\n else:\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n main()", "language": "Python", "metadata": {"date": 1569120777, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02906.html", "problem_id": "p02906", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02906/input.txt", "sample_output_relpath": "derived/input_output/data/p02906/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02906/Python/s016067977.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s016067977", "user_id": "u480138356"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import sys\ninput = sys.stdin.readline\n\nclass Node:\n def __init__(self, id):\n self.id = id\n self.parent = None\n self.child_num = 0\n self.is_root = True\n self.grand_parent = False\n\n def root(self):\n node = self\n while not node.is_root:\n # print(node.id)\n node = node.parent\n return node\n\ndef main():\n N, M, Q = map(int, input().split())\n abc = sorted([list(map(int, input().split())) for i in range(Q)], key=lambda x: x[2])\n\n nodes = [Node(i) for i in range(N)]\n edge_count = 0\n count_rest = True\n ok = True\n for i in range(Q):\n # print(i)\n a, b, c = abc[i]\n if c == 0:# Union-find\n root_a = nodes[a].root()\n root_b = nodes[b].root()\n if root_a != root_b:\n if root_a.child_num > root_b.child_num:\n root_b, root_a = root_a, root_b\n root_a.child_num += root_b.child_num + 1\n root_b.parent = root_a\n root_b.is_root = False\n edge_count += 1\n if edge_count > M:\n ok = False\n break\n else:\n if count_rest:\n rest_node = 0\n for i in range(N):\n if nodes[i].is_root and nodes[i].child_num == 0:\n rest_node += 1\n count_rest = False\n if rest_node == 0:\n ok = False\n break\n root_a = nodes[a].root()\n root_b = nodes[b].root()\n if root_a == root_b:\n ok = False\n break\n elif root_a.grand_parent and root_b.grand_parent:\n pass\n elif root_a.grand_parent and not root_b.grand_parent:\n root_b.grand_parent = True\n edge_count += 1\n elif (not root_a.grand_parent) and root_b.grand_parent:\n root_a.grand_parent = True\n edge_count += 1\n else:\n root_a.grand_parent = True\n root_b.grand_parent = True\n edge_count += 2\n \n has_grand = 0\n for i in range(N):\n if nodes[i].grand_parent:\n has_grand += 1\n yoyu = (has_grand * (has_grand - 1)) // 2\n \n if edge_count > M:\n ok = False\n elif edge_count < M:\n if edge_count + rest_node - 1 <= M:\n if edge_count + rest_node - 1 + yoyu < M:\n ok = False\n else:\n ok = False\n\n if not ok:\n print(\"No\")\n else:\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n main()", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSnuke's mother gave Snuke an undirected graph consisting of N vertices numbered 0 to N-1 and M edges.\nThis graph was connected and contained no parallel edges or self-loops.\n\nOne day, Snuke broke this graph.\nFortunately, he remembered Q clues about the graph.\nThe i-th clue (0 \\leq i \\leq Q-1) is represented as integers A_i,B_i,C_i and means the following:\n\nIf C_i=0: there was exactly one simple path (a path that never visits the same vertex twice) from Vertex A_i to B_i.\n\nIf C_i=1: there were two or more simple paths from Vertex A_i to B_i.\n\nSnuke is not sure if his memory is correct, and worried whether there is a graph that matches these Q clues.\nDetermine if there exists a graph that matches Snuke's memory.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\nN-1 \\leq M \\leq N \\times (N-1)/2\n\n1 \\leq Q \\leq 10^5\n\n0 \\leq A_i,B_i \\leq N-1\n\nA_i \\neq B_i\n\n0 \\leq C_i \\leq 1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nA_0 B_0 C_0\nA_1 B_1 C_1\n\\vdots\nA_{Q-1} B_{Q-1} C_{Q-1}\n\nOutput\n\nIf there exists a graph that matches Snuke's memory, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 5 3\n0 1 0\n1 2 1\n2 3 0\n\nSample Output 1\n\nYes\n\nFor example, consider a graph with edges (0,1),(1,2),(1,4),(2,3),(2,4). This graph matches the clues.\n\nSample Input 2\n\n4 4 3\n0 1 0\n1 2 1\n2 3 0\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n10 9 9\n7 6 0\n4 5 1\n9 7 0\n2 9 0\n2 3 0\n4 1 0\n8 0 0\n9 1 0\n3 0 0\n\nSample Output 3\n\nNo", "sample_input": "5 5 3\n0 1 0\n1 2 1\n2 3 0\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02906", "source_text": "Score : 700 points\n\nProblem Statement\n\nSnuke's mother gave Snuke an undirected graph consisting of N vertices numbered 0 to N-1 and M edges.\nThis graph was connected and contained no parallel edges or self-loops.\n\nOne day, Snuke broke this graph.\nFortunately, he remembered Q clues about the graph.\nThe i-th clue (0 \\leq i \\leq Q-1) is represented as integers A_i,B_i,C_i and means the following:\n\nIf C_i=0: there was exactly one simple path (a path that never visits the same vertex twice) from Vertex A_i to B_i.\n\nIf C_i=1: there were two or more simple paths from Vertex A_i to B_i.\n\nSnuke is not sure if his memory is correct, and worried whether there is a graph that matches these Q clues.\nDetermine if there exists a graph that matches Snuke's memory.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\nN-1 \\leq M \\leq N \\times (N-1)/2\n\n1 \\leq Q \\leq 10^5\n\n0 \\leq A_i,B_i \\leq N-1\n\nA_i \\neq B_i\n\n0 \\leq C_i \\leq 1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nA_0 B_0 C_0\nA_1 B_1 C_1\n\\vdots\nA_{Q-1} B_{Q-1} C_{Q-1}\n\nOutput\n\nIf there exists a graph that matches Snuke's memory, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 5 3\n0 1 0\n1 2 1\n2 3 0\n\nSample Output 1\n\nYes\n\nFor example, consider a graph with edges (0,1),(1,2),(1,4),(2,3),(2,4). This graph matches the clues.\n\nSample Input 2\n\n4 4 3\n0 1 0\n1 2 1\n2 3 0\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n10 9 9\n7 6 0\n4 5 1\n9 7 0\n2 9 0\n2 3 0\n4 1 0\n8 0 0\n9 1 0\n3 0 0\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2661, "cpu_time_ms": 2107, "memory_kb": 57548}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s732913281", "group_id": "codeNet:p02909", "input_text": "W = ['Sunny', 'Cloudy', 'Rainy']\nS = input()\nif S == W[0]:\n print(W[1])\nelif S == W[1]:\n print(W[2])\nelse:\n print(W[0])", "language": "Python", "metadata": {"date": 1574113799, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02909.html", "problem_id": "p02909", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02909/input.txt", "sample_output_relpath": "derived/input_output/data/p02909/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02909/Python/s732913281.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s732913281", "user_id": "u281610856"}, "prompt_components": {"gold_output": "Cloudy\n", "input_to_evaluate": "W = ['Sunny', 'Cloudy', 'Rainy']\nS = input()\nif S == W[0]:\n print(W[1])\nelif S == W[1]:\n print(W[2])\nelse:\n print(W[0])", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...\n\nGiven is a string S representing the weather in the town today. Predict the weather tomorrow.\n\nConstraints\n\nS is Sunny, Cloudy, or Rainy.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint a string representing the expected weather tomorrow, in the same format in which input is given.\n\nSample Input 1\n\nSunny\n\nSample Output 1\n\nCloudy\n\nIn Takahashi's town, a sunny day is followed by a cloudy day.\n\nSample Input 2\n\nRainy\n\nSample Output 2\n\nSunny", "sample_input": "Sunny\n"}, "reference_outputs": ["Cloudy\n"], "source_document_id": "p02909", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...\n\nGiven is a string S representing the weather in the town today. Predict the weather tomorrow.\n\nConstraints\n\nS is Sunny, Cloudy, or Rainy.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint a string representing the expected weather tomorrow, in the same format in which input is given.\n\nSample Input 1\n\nSunny\n\nSample Output 1\n\nCloudy\n\nIn Takahashi's town, a sunny day is followed by a cloudy day.\n\nSample Input 2\n\nRainy\n\nSample Output 2\n\nSunny", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 122, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s956173485", "group_id": "codeNet:p02909", "input_text": "S = input()\nif S == \"Sunny\":\n print(\"Cloudy\")\nelif S ==\"Cloudy\":\n print(\"Rainy\")\nelse:\n print(\"Sunny\")", "language": "Python", "metadata": {"date": 1568778756, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02909.html", "problem_id": "p02909", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02909/input.txt", "sample_output_relpath": "derived/input_output/data/p02909/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02909/Python/s956173485.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s956173485", "user_id": "u503111914"}, "prompt_components": {"gold_output": "Cloudy\n", "input_to_evaluate": "S = input()\nif S == \"Sunny\":\n print(\"Cloudy\")\nelif S ==\"Cloudy\":\n print(\"Rainy\")\nelse:\n print(\"Sunny\")", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...\n\nGiven is a string S representing the weather in the town today. Predict the weather tomorrow.\n\nConstraints\n\nS is Sunny, Cloudy, or Rainy.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint a string representing the expected weather tomorrow, in the same format in which input is given.\n\nSample Input 1\n\nSunny\n\nSample Output 1\n\nCloudy\n\nIn Takahashi's town, a sunny day is followed by a cloudy day.\n\nSample Input 2\n\nRainy\n\nSample Output 2\n\nSunny", "sample_input": "Sunny\n"}, "reference_outputs": ["Cloudy\n"], "source_document_id": "p02909", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...\n\nGiven is a string S representing the weather in the town today. Predict the weather tomorrow.\n\nConstraints\n\nS is Sunny, Cloudy, or Rainy.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint a string representing the expected weather tomorrow, in the same format in which input is given.\n\nSample Input 1\n\nSunny\n\nSample Output 1\n\nCloudy\n\nIn Takahashi's town, a sunny day is followed by a cloudy day.\n\nSample Input 2\n\nRainy\n\nSample Output 2\n\nSunny", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 105, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s458025802", "group_id": "codeNet:p02909", "input_text": "s = input()\nm = {\"Sunny\": \"Cloudy\", \"Cloudy\": \"Rainy\", \"Rainy\": \"Sunny\"}\n\nprint(m[s])\n", "language": "Python", "metadata": {"date": 1568595881, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02909.html", "problem_id": "p02909", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02909/input.txt", "sample_output_relpath": "derived/input_output/data/p02909/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02909/Python/s458025802.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s458025802", "user_id": "u976365284"}, "prompt_components": {"gold_output": "Cloudy\n", "input_to_evaluate": "s = input()\nm = {\"Sunny\": \"Cloudy\", \"Cloudy\": \"Rainy\", \"Rainy\": \"Sunny\"}\n\nprint(m[s])\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...\n\nGiven is a string S representing the weather in the town today. Predict the weather tomorrow.\n\nConstraints\n\nS is Sunny, Cloudy, or Rainy.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint a string representing the expected weather tomorrow, in the same format in which input is given.\n\nSample Input 1\n\nSunny\n\nSample Output 1\n\nCloudy\n\nIn Takahashi's town, a sunny day is followed by a cloudy day.\n\nSample Input 2\n\nRainy\n\nSample Output 2\n\nSunny", "sample_input": "Sunny\n"}, "reference_outputs": ["Cloudy\n"], "source_document_id": "p02909", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...\n\nGiven is a string S representing the weather in the town today. Predict the weather tomorrow.\n\nConstraints\n\nS is Sunny, Cloudy, or Rainy.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint a string representing the expected weather tomorrow, in the same format in which input is given.\n\nSample Input 1\n\nSunny\n\nSample Output 1\n\nCloudy\n\nIn Takahashi's town, a sunny day is followed by a cloudy day.\n\nSample Input 2\n\nRainy\n\nSample Output 2\n\nSunny", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 86, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s454070172", "group_id": "codeNet:p02909", "input_text": "vals = ['Sunny', 'Cloudy', 'Rainy']\n\ns = input().rstrip()\n\nprint(vals[(vals.index(s) + 1) % 3])\n", "language": "Python", "metadata": {"date": 1568595835, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02909.html", "problem_id": "p02909", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02909/input.txt", "sample_output_relpath": "derived/input_output/data/p02909/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02909/Python/s454070172.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s454070172", "user_id": "u982594421"}, "prompt_components": {"gold_output": "Cloudy\n", "input_to_evaluate": "vals = ['Sunny', 'Cloudy', 'Rainy']\n\ns = input().rstrip()\n\nprint(vals[(vals.index(s) + 1) % 3])\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...\n\nGiven is a string S representing the weather in the town today. Predict the weather tomorrow.\n\nConstraints\n\nS is Sunny, Cloudy, or Rainy.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint a string representing the expected weather tomorrow, in the same format in which input is given.\n\nSample Input 1\n\nSunny\n\nSample Output 1\n\nCloudy\n\nIn Takahashi's town, a sunny day is followed by a cloudy day.\n\nSample Input 2\n\nRainy\n\nSample Output 2\n\nSunny", "sample_input": "Sunny\n"}, "reference_outputs": ["Cloudy\n"], "source_document_id": "p02909", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...\n\nGiven is a string S representing the weather in the town today. Predict the weather tomorrow.\n\nConstraints\n\nS is Sunny, Cloudy, or Rainy.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint a string representing the expected weather tomorrow, in the same format in which input is given.\n\nSample Input 1\n\nSunny\n\nSample Output 1\n\nCloudy\n\nIn Takahashi's town, a sunny day is followed by a cloudy day.\n\nSample Input 2\n\nRainy\n\nSample Output 2\n\nSunny", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s975390999", "group_id": "codeNet:p02909", "input_text": "S = input()\n\nif S[0] == \"S\":\n print(\"Cloudy\")\nelif S[0] == \"C\":\n print(\"Rainy\")\nelse:\n print(\"Sunny\")\n", "language": "Python", "metadata": {"date": 1568595708, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02909.html", "problem_id": "p02909", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02909/input.txt", "sample_output_relpath": "derived/input_output/data/p02909/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02909/Python/s975390999.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s975390999", "user_id": "u328099989"}, "prompt_components": {"gold_output": "Cloudy\n", "input_to_evaluate": "S = input()\n\nif S[0] == \"S\":\n print(\"Cloudy\")\nelif S[0] == \"C\":\n print(\"Rainy\")\nelse:\n print(\"Sunny\")\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...\n\nGiven is a string S representing the weather in the town today. Predict the weather tomorrow.\n\nConstraints\n\nS is Sunny, Cloudy, or Rainy.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint a string representing the expected weather tomorrow, in the same format in which input is given.\n\nSample Input 1\n\nSunny\n\nSample Output 1\n\nCloudy\n\nIn Takahashi's town, a sunny day is followed by a cloudy day.\n\nSample Input 2\n\nRainy\n\nSample Output 2\n\nSunny", "sample_input": "Sunny\n"}, "reference_outputs": ["Cloudy\n"], "source_document_id": "p02909", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...\n\nGiven is a string S representing the weather in the town today. Predict the weather tomorrow.\n\nConstraints\n\nS is Sunny, Cloudy, or Rainy.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint a string representing the expected weather tomorrow, in the same format in which input is given.\n\nSample Input 1\n\nSunny\n\nSample Output 1\n\nCloudy\n\nIn Takahashi's town, a sunny day is followed by a cloudy day.\n\nSample Input 2\n\nRainy\n\nSample Output 2\n\nSunny", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 111, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s825651426", "group_id": "codeNet:p02910", "input_text": "S = input()\nans = 'Yes'\nfor i in range((len(S) + 1) // 2):\n if S[2*i] == 'L' or S[2*i + 1] == 'R':\n ans = 'No'\n break\n\nprint(ans)\n", "language": "Python", "metadata": {"date": 1580610553, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02910.html", "problem_id": "p02910", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02910/input.txt", "sample_output_relpath": "derived/input_output/data/p02910/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02910/Python/s825651426.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s825651426", "user_id": "u408375121"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "S = input()\nans = 'Yes'\nfor i in range((len(S) + 1) // 2):\n if S[2*i] == 'L' or S[2*i + 1] == 'R':\n ans = 'No'\n break\n\nprint(ans)\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nTakahashi will do a tap dance. The dance is described by a string S where each character is L, R, U, or D. These characters indicate the positions on which Takahashi should step. He will follow these instructions one by one in order, starting with the first character.\n\nS is said to be easily playable if and only if it satisfies both of the following conditions:\n\nEvery character in an odd position (1-st, 3-rd, 5-th, \\ldots) is R, U, or D.\n\nEvery character in an even position (2-nd, 4-th, 6-th, \\ldots) is L, U, or D.\n\nYour task is to print Yes if S is easily playable, and No otherwise.\n\nConstraints\n\nS is a string of length between 1 and 100 (inclusive).\n\nEach character of S is L, R, U, or D.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint Yes if S is easily playable, and No otherwise.\n\nSample Input 1\n\nRUDLUDR\n\nSample Output 1\n\nYes\n\nEvery character in an odd position (1-st, 3-rd, 5-th, 7-th) is R, U, or D.\n\nEvery character in an even position (2-nd, 4-th, 6-th) is L, U, or D.\n\nThus, S is easily playable.\n\nSample Input 2\n\nDULL\n\nSample Output 2\n\nNo\n\nThe 3-rd character is not R, U, nor D, so S is not easily playable.\n\nSample Input 3\n\nUUUUUUUUUUUUUUU\n\nSample Output 3\n\nYes\n\nSample Input 4\n\nULURU\n\nSample Output 4\n\nNo\n\nSample Input 5\n\nRDULULDURURLRDULRLR\n\nSample Output 5\n\nYes", "sample_input": "RUDLUDR\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02910", "source_text": "Score: 200 points\n\nProblem Statement\n\nTakahashi will do a tap dance. The dance is described by a string S where each character is L, R, U, or D. These characters indicate the positions on which Takahashi should step. He will follow these instructions one by one in order, starting with the first character.\n\nS is said to be easily playable if and only if it satisfies both of the following conditions:\n\nEvery character in an odd position (1-st, 3-rd, 5-th, \\ldots) is R, U, or D.\n\nEvery character in an even position (2-nd, 4-th, 6-th, \\ldots) is L, U, or D.\n\nYour task is to print Yes if S is easily playable, and No otherwise.\n\nConstraints\n\nS is a string of length between 1 and 100 (inclusive).\n\nEach character of S is L, R, U, or D.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint Yes if S is easily playable, and No otherwise.\n\nSample Input 1\n\nRUDLUDR\n\nSample Output 1\n\nYes\n\nEvery character in an odd position (1-st, 3-rd, 5-th, 7-th) is R, U, or D.\n\nEvery character in an even position (2-nd, 4-th, 6-th) is L, U, or D.\n\nThus, S is easily playable.\n\nSample Input 2\n\nDULL\n\nSample Output 2\n\nNo\n\nThe 3-rd character is not R, U, nor D, so S is not easily playable.\n\nSample Input 3\n\nUUUUUUUUUUUUUUU\n\nSample Output 3\n\nYes\n\nSample Input 4\n\nULURU\n\nSample Output 4\n\nNo\n\nSample Input 5\n\nRDULULDURURLRDULRLR\n\nSample Output 5\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 137, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s514001163", "group_id": "codeNet:p02910", "input_text": "s=input()\n\ni=0\n\nfor x in range(len(s)):\n if(i%2==1):\n if(s[i] =='R' or 'U' or 'D'):\n flug=1\n else:\n if(s[i] =='L' or 'U' or 'D'):\n flug=1\n\nif(flug!=1):\n print(\"No\")\nelse:\n print(\"Yes\")", "language": "Python", "metadata": {"date": 1569520315, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02910.html", "problem_id": "p02910", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02910/input.txt", "sample_output_relpath": "derived/input_output/data/p02910/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02910/Python/s514001163.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s514001163", "user_id": "u767121254"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "s=input()\n\ni=0\n\nfor x in range(len(s)):\n if(i%2==1):\n if(s[i] =='R' or 'U' or 'D'):\n flug=1\n else:\n if(s[i] =='L' or 'U' or 'D'):\n flug=1\n\nif(flug!=1):\n print(\"No\")\nelse:\n print(\"Yes\")", "problem_context": "Score: 200 points\n\nProblem Statement\n\nTakahashi will do a tap dance. The dance is described by a string S where each character is L, R, U, or D. These characters indicate the positions on which Takahashi should step. He will follow these instructions one by one in order, starting with the first character.\n\nS is said to be easily playable if and only if it satisfies both of the following conditions:\n\nEvery character in an odd position (1-st, 3-rd, 5-th, \\ldots) is R, U, or D.\n\nEvery character in an even position (2-nd, 4-th, 6-th, \\ldots) is L, U, or D.\n\nYour task is to print Yes if S is easily playable, and No otherwise.\n\nConstraints\n\nS is a string of length between 1 and 100 (inclusive).\n\nEach character of S is L, R, U, or D.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint Yes if S is easily playable, and No otherwise.\n\nSample Input 1\n\nRUDLUDR\n\nSample Output 1\n\nYes\n\nEvery character in an odd position (1-st, 3-rd, 5-th, 7-th) is R, U, or D.\n\nEvery character in an even position (2-nd, 4-th, 6-th) is L, U, or D.\n\nThus, S is easily playable.\n\nSample Input 2\n\nDULL\n\nSample Output 2\n\nNo\n\nThe 3-rd character is not R, U, nor D, so S is not easily playable.\n\nSample Input 3\n\nUUUUUUUUUUUUUUU\n\nSample Output 3\n\nYes\n\nSample Input 4\n\nULURU\n\nSample Output 4\n\nNo\n\nSample Input 5\n\nRDULULDURURLRDULRLR\n\nSample Output 5\n\nYes", "sample_input": "RUDLUDR\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02910", "source_text": "Score: 200 points\n\nProblem Statement\n\nTakahashi will do a tap dance. The dance is described by a string S where each character is L, R, U, or D. These characters indicate the positions on which Takahashi should step. He will follow these instructions one by one in order, starting with the first character.\n\nS is said to be easily playable if and only if it satisfies both of the following conditions:\n\nEvery character in an odd position (1-st, 3-rd, 5-th, \\ldots) is R, U, or D.\n\nEvery character in an even position (2-nd, 4-th, 6-th, \\ldots) is L, U, or D.\n\nYour task is to print Yes if S is easily playable, and No otherwise.\n\nConstraints\n\nS is a string of length between 1 and 100 (inclusive).\n\nEach character of S is L, R, U, or D.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint Yes if S is easily playable, and No otherwise.\n\nSample Input 1\n\nRUDLUDR\n\nSample Output 1\n\nYes\n\nEvery character in an odd position (1-st, 3-rd, 5-th, 7-th) is R, U, or D.\n\nEvery character in an even position (2-nd, 4-th, 6-th) is L, U, or D.\n\nThus, S is easily playable.\n\nSample Input 2\n\nDULL\n\nSample Output 2\n\nNo\n\nThe 3-rd character is not R, U, nor D, so S is not easily playable.\n\nSample Input 3\n\nUUUUUUUUUUUUUUU\n\nSample Output 3\n\nYes\n\nSample Input 4\n\nULURU\n\nSample Output 4\n\nNo\n\nSample Input 5\n\nRDULULDURURLRDULRLR\n\nSample Output 5\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 232, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s479450833", "group_id": "codeNet:p02911", "input_text": "n, k, q = map(int, input().split())\n\np = [k - q] * n\n\na = []\nfor _ in range(q):\n a.append(int(input()))\n\nfor i in range(q):\n p[a[i]-1] += 1\n\nfor i in range(n):\n if p[i] <= 0:\n print(\"No\")\n else:\n print(\"Yes\")\n", "language": "Python", "metadata": {"date": 1573882515, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02911.html", "problem_id": "p02911", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02911/input.txt", "sample_output_relpath": "derived/input_output/data/p02911/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02911/Python/s479450833.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s479450833", "user_id": "u861141787"}, "prompt_components": {"gold_output": "No\nNo\nYes\nNo\nNo\nNo\n", "input_to_evaluate": "n, k, q = map(int, input().split())\n\np = [k - q] * n\n\na = []\nfor _ in range(q):\n a.append(int(input()))\n\nfor i in range(q):\n p[a[i]-1] += 1\n\nfor i in range(n):\n if p[i] <= 0:\n print(\"No\")\n else:\n print(\"Yes\")\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nTakahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.\n\nA game is played by N players, numbered 1 to N. At the beginning of a game, each player has K points.\n\nWhen a player correctly answers a question, each of the other N-1 players receives minus one (-1) point. There is no other factor that affects the players' scores.\n\nAt the end of a game, the players with 0 points or lower are eliminated, and the remaining players survive.\n\nIn the last game, the players gave a total of Q correct answers, the i-th of which was given by Player A_i.\nFor Kizahashi, write a program that determines whether each of the N players survived this game.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^9\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq A_i \\leq N\\ (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K Q\nA_1\nA_2\n.\n.\n.\nA_Q\n\nOutput\n\nPrint N lines. The i-th line should contain Yes if Player i survived the game, and No otherwise.\n\nSample Input 1\n\n6 3 4\n3\n1\n3\n2\n\nSample Output 1\n\nNo\nNo\nYes\nNo\nNo\nNo\n\nIn the beginning, the players' scores are (3, 3, 3, 3, 3, 3).\n\nPlayer 3 correctly answers a question. The players' scores are now (2, 2, 3, 2, 2, 2).\n\nPlayer 1 correctly answers a question. The players' scores are now (2, 1, 2, 1, 1, 1).\n\nPlayer 3 correctly answers a question. The players' scores are now (1, 0, 2, 0, 0, 0).\n\nPlayer 2 correctly answers a question. The players' scores are now (0, 0, 1, -1, -1, -1).\n\nPlayers 1, 2, 4, 5 and 6, who have 0 points or lower, are eliminated, and Player 3 survives this game.\n\nSample Input 2\n\n6 5 4\n3\n1\n3\n2\n\nSample Output 2\n\nYes\nYes\nYes\nYes\nYes\nYes\n\nSample Input 3\n\n10 13 15\n3\n1\n4\n1\n5\n9\n2\n6\n5\n3\n5\n8\n9\n7\n9\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nYes\nNo\nNo\nNo\nYes\nNo", "sample_input": "6 3 4\n3\n1\n3\n2\n"}, "reference_outputs": ["No\nNo\nYes\nNo\nNo\nNo\n"], "source_document_id": "p02911", "source_text": "Score: 300 points\n\nProblem Statement\n\nTakahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.\n\nA game is played by N players, numbered 1 to N. At the beginning of a game, each player has K points.\n\nWhen a player correctly answers a question, each of the other N-1 players receives minus one (-1) point. There is no other factor that affects the players' scores.\n\nAt the end of a game, the players with 0 points or lower are eliminated, and the remaining players survive.\n\nIn the last game, the players gave a total of Q correct answers, the i-th of which was given by Player A_i.\nFor Kizahashi, write a program that determines whether each of the N players survived this game.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^9\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq A_i \\leq N\\ (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K Q\nA_1\nA_2\n.\n.\n.\nA_Q\n\nOutput\n\nPrint N lines. The i-th line should contain Yes if Player i survived the game, and No otherwise.\n\nSample Input 1\n\n6 3 4\n3\n1\n3\n2\n\nSample Output 1\n\nNo\nNo\nYes\nNo\nNo\nNo\n\nIn the beginning, the players' scores are (3, 3, 3, 3, 3, 3).\n\nPlayer 3 correctly answers a question. The players' scores are now (2, 2, 3, 2, 2, 2).\n\nPlayer 1 correctly answers a question. The players' scores are now (2, 1, 2, 1, 1, 1).\n\nPlayer 3 correctly answers a question. The players' scores are now (1, 0, 2, 0, 0, 0).\n\nPlayer 2 correctly answers a question. The players' scores are now (0, 0, 1, -1, -1, -1).\n\nPlayers 1, 2, 4, 5 and 6, who have 0 points or lower, are eliminated, and Player 3 survives this game.\n\nSample Input 2\n\n6 5 4\n3\n1\n3\n2\n\nSample Output 2\n\nYes\nYes\nYes\nYes\nYes\nYes\n\nSample Input 3\n\n10 13 15\n3\n1\n4\n1\n5\n9\n2\n6\n5\n3\n5\n8\n9\n7\n9\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nYes\nNo\nNo\nNo\nYes\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 235, "cpu_time_ms": 569, "memory_kb": 56024}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s802520571", "group_id": "codeNet:p02911", "input_text": "from collections import deque\nN,K,Q=map(int,input().split())\nls=[int(input())-1 for i in range(Q)]\nque=deque(ls)\nco=[0 for i in range(N)]\nfor j in range(Q):\n co[que.popleft()]+=1\nfor i in co:\n if i>Q-K:\n print(\"Yes\")\n else:\n print(\"No\")", "language": "Python", "metadata": {"date": 1571093012, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02911.html", "problem_id": "p02911", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02911/input.txt", "sample_output_relpath": "derived/input_output/data/p02911/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02911/Python/s802520571.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s802520571", "user_id": "u051684204"}, "prompt_components": {"gold_output": "No\nNo\nYes\nNo\nNo\nNo\n", "input_to_evaluate": "from collections import deque\nN,K,Q=map(int,input().split())\nls=[int(input())-1 for i in range(Q)]\nque=deque(ls)\nco=[0 for i in range(N)]\nfor j in range(Q):\n co[que.popleft()]+=1\nfor i in co:\n if i>Q-K:\n print(\"Yes\")\n else:\n print(\"No\")", "problem_context": "Score: 300 points\n\nProblem Statement\n\nTakahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.\n\nA game is played by N players, numbered 1 to N. At the beginning of a game, each player has K points.\n\nWhen a player correctly answers a question, each of the other N-1 players receives minus one (-1) point. There is no other factor that affects the players' scores.\n\nAt the end of a game, the players with 0 points or lower are eliminated, and the remaining players survive.\n\nIn the last game, the players gave a total of Q correct answers, the i-th of which was given by Player A_i.\nFor Kizahashi, write a program that determines whether each of the N players survived this game.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^9\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq A_i \\leq N\\ (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K Q\nA_1\nA_2\n.\n.\n.\nA_Q\n\nOutput\n\nPrint N lines. The i-th line should contain Yes if Player i survived the game, and No otherwise.\n\nSample Input 1\n\n6 3 4\n3\n1\n3\n2\n\nSample Output 1\n\nNo\nNo\nYes\nNo\nNo\nNo\n\nIn the beginning, the players' scores are (3, 3, 3, 3, 3, 3).\n\nPlayer 3 correctly answers a question. The players' scores are now (2, 2, 3, 2, 2, 2).\n\nPlayer 1 correctly answers a question. The players' scores are now (2, 1, 2, 1, 1, 1).\n\nPlayer 3 correctly answers a question. The players' scores are now (1, 0, 2, 0, 0, 0).\n\nPlayer 2 correctly answers a question. The players' scores are now (0, 0, 1, -1, -1, -1).\n\nPlayers 1, 2, 4, 5 and 6, who have 0 points or lower, are eliminated, and Player 3 survives this game.\n\nSample Input 2\n\n6 5 4\n3\n1\n3\n2\n\nSample Output 2\n\nYes\nYes\nYes\nYes\nYes\nYes\n\nSample Input 3\n\n10 13 15\n3\n1\n4\n1\n5\n9\n2\n6\n5\n3\n5\n8\n9\n7\n9\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nYes\nNo\nNo\nNo\nYes\nNo", "sample_input": "6 3 4\n3\n1\n3\n2\n"}, "reference_outputs": ["No\nNo\nYes\nNo\nNo\nNo\n"], "source_document_id": "p02911", "source_text": "Score: 300 points\n\nProblem Statement\n\nTakahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.\n\nA game is played by N players, numbered 1 to N. At the beginning of a game, each player has K points.\n\nWhen a player correctly answers a question, each of the other N-1 players receives minus one (-1) point. There is no other factor that affects the players' scores.\n\nAt the end of a game, the players with 0 points or lower are eliminated, and the remaining players survive.\n\nIn the last game, the players gave a total of Q correct answers, the i-th of which was given by Player A_i.\nFor Kizahashi, write a program that determines whether each of the N players survived this game.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^9\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq A_i \\leq N\\ (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K Q\nA_1\nA_2\n.\n.\n.\nA_Q\n\nOutput\n\nPrint N lines. The i-th line should contain Yes if Player i survived the game, and No otherwise.\n\nSample Input 1\n\n6 3 4\n3\n1\n3\n2\n\nSample Output 1\n\nNo\nNo\nYes\nNo\nNo\nNo\n\nIn the beginning, the players' scores are (3, 3, 3, 3, 3, 3).\n\nPlayer 3 correctly answers a question. The players' scores are now (2, 2, 3, 2, 2, 2).\n\nPlayer 1 correctly answers a question. The players' scores are now (2, 1, 2, 1, 1, 1).\n\nPlayer 3 correctly answers a question. The players' scores are now (1, 0, 2, 0, 0, 0).\n\nPlayer 2 correctly answers a question. The players' scores are now (0, 0, 1, -1, -1, -1).\n\nPlayers 1, 2, 4, 5 and 6, who have 0 points or lower, are eliminated, and Player 3 survives this game.\n\nSample Input 2\n\n6 5 4\n3\n1\n3\n2\n\nSample Output 2\n\nYes\nYes\nYes\nYes\nYes\nYes\n\nSample Input 3\n\n10 13 15\n3\n1\n4\n1\n5\n9\n2\n6\n5\n3\n5\n8\n9\n7\n9\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nYes\nNo\nNo\nNo\nYes\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 245, "cpu_time_ms": 251, "memory_kb": 9376}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s049132683", "group_id": "codeNet:p02911", "input_text": "import numpy as np\n\nninzu, k, seikaisu = map(int, input().split())\n\nsankasya = np.array([k] * ninzu)\n\nfor i in range(seikaisu):\n sankasya = sankasya - 1\n seikaisya = int(input()) - 1 \n sankasya[seikaisya] = sankasya[seikaisya] + 1\n\nfor point in sankasya:\n if point > 0:\n print('Yes')\n else:\n print('No')", "language": "Python", "metadata": {"date": 1568598608, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02911.html", "problem_id": "p02911", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02911/input.txt", "sample_output_relpath": "derived/input_output/data/p02911/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02911/Python/s049132683.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s049132683", "user_id": "u548986948"}, "prompt_components": {"gold_output": "No\nNo\nYes\nNo\nNo\nNo\n", "input_to_evaluate": "import numpy as np\n\nninzu, k, seikaisu = map(int, input().split())\n\nsankasya = np.array([k] * ninzu)\n\nfor i in range(seikaisu):\n sankasya = sankasya - 1\n seikaisya = int(input()) - 1 \n sankasya[seikaisya] = sankasya[seikaisya] + 1\n\nfor point in sankasya:\n if point > 0:\n print('Yes')\n else:\n print('No')", "problem_context": "Score: 300 points\n\nProblem Statement\n\nTakahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.\n\nA game is played by N players, numbered 1 to N. At the beginning of a game, each player has K points.\n\nWhen a player correctly answers a question, each of the other N-1 players receives minus one (-1) point. There is no other factor that affects the players' scores.\n\nAt the end of a game, the players with 0 points or lower are eliminated, and the remaining players survive.\n\nIn the last game, the players gave a total of Q correct answers, the i-th of which was given by Player A_i.\nFor Kizahashi, write a program that determines whether each of the N players survived this game.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^9\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq A_i \\leq N\\ (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K Q\nA_1\nA_2\n.\n.\n.\nA_Q\n\nOutput\n\nPrint N lines. The i-th line should contain Yes if Player i survived the game, and No otherwise.\n\nSample Input 1\n\n6 3 4\n3\n1\n3\n2\n\nSample Output 1\n\nNo\nNo\nYes\nNo\nNo\nNo\n\nIn the beginning, the players' scores are (3, 3, 3, 3, 3, 3).\n\nPlayer 3 correctly answers a question. The players' scores are now (2, 2, 3, 2, 2, 2).\n\nPlayer 1 correctly answers a question. The players' scores are now (2, 1, 2, 1, 1, 1).\n\nPlayer 3 correctly answers a question. The players' scores are now (1, 0, 2, 0, 0, 0).\n\nPlayer 2 correctly answers a question. The players' scores are now (0, 0, 1, -1, -1, -1).\n\nPlayers 1, 2, 4, 5 and 6, who have 0 points or lower, are eliminated, and Player 3 survives this game.\n\nSample Input 2\n\n6 5 4\n3\n1\n3\n2\n\nSample Output 2\n\nYes\nYes\nYes\nYes\nYes\nYes\n\nSample Input 3\n\n10 13 15\n3\n1\n4\n1\n5\n9\n2\n6\n5\n3\n5\n8\n9\n7\n9\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nYes\nNo\nNo\nNo\nYes\nNo", "sample_input": "6 3 4\n3\n1\n3\n2\n"}, "reference_outputs": ["No\nNo\nYes\nNo\nNo\nNo\n"], "source_document_id": "p02911", "source_text": "Score: 300 points\n\nProblem Statement\n\nTakahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.\n\nA game is played by N players, numbered 1 to N. At the beginning of a game, each player has K points.\n\nWhen a player correctly answers a question, each of the other N-1 players receives minus one (-1) point. There is no other factor that affects the players' scores.\n\nAt the end of a game, the players with 0 points or lower are eliminated, and the remaining players survive.\n\nIn the last game, the players gave a total of Q correct answers, the i-th of which was given by Player A_i.\nFor Kizahashi, write a program that determines whether each of the N players survived this game.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^9\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq A_i \\leq N\\ (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K Q\nA_1\nA_2\n.\n.\n.\nA_Q\n\nOutput\n\nPrint N lines. The i-th line should contain Yes if Player i survived the game, and No otherwise.\n\nSample Input 1\n\n6 3 4\n3\n1\n3\n2\n\nSample Output 1\n\nNo\nNo\nYes\nNo\nNo\nNo\n\nIn the beginning, the players' scores are (3, 3, 3, 3, 3, 3).\n\nPlayer 3 correctly answers a question. The players' scores are now (2, 2, 3, 2, 2, 2).\n\nPlayer 1 correctly answers a question. The players' scores are now (2, 1, 2, 1, 1, 1).\n\nPlayer 3 correctly answers a question. The players' scores are now (1, 0, 2, 0, 0, 0).\n\nPlayer 2 correctly answers a question. The players' scores are now (0, 0, 1, -1, -1, -1).\n\nPlayers 1, 2, 4, 5 and 6, who have 0 points or lower, are eliminated, and Player 3 survives this game.\n\nSample Input 2\n\n6 5 4\n3\n1\n3\n2\n\nSample Output 2\n\nYes\nYes\nYes\nYes\nYes\nYes\n\nSample Input 3\n\n10 13 15\n3\n1\n4\n1\n5\n9\n2\n6\n5\n3\n5\n8\n9\n7\n9\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nYes\nNo\nNo\nNo\nYes\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2108, "memory_kb": 16072}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s395833246", "group_id": "codeNet:p02911", "input_text": "# 190915 C\nif __name__ == \"__main__\":\n N = list(map(int,input().split()))\n K = N[1]\n Q = N[2]\n N = N[0]\n A = [0] * N\n maxp = 0\n for i in range(Q):\n tmpi = int(input())\n A[tmpi-1] += 1\n \n for i in range(N):\n if K - (Q - A[i]) <= 0:\n print(\"No\")\n else:\n print(\"Yes\")\n\n ", "language": "Python", "metadata": {"date": 1568597556, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02911.html", "problem_id": "p02911", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02911/input.txt", "sample_output_relpath": "derived/input_output/data/p02911/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02911/Python/s395833246.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s395833246", "user_id": "u520680626"}, "prompt_components": {"gold_output": "No\nNo\nYes\nNo\nNo\nNo\n", "input_to_evaluate": "# 190915 C\nif __name__ == \"__main__\":\n N = list(map(int,input().split()))\n K = N[1]\n Q = N[2]\n N = N[0]\n A = [0] * N\n maxp = 0\n for i in range(Q):\n tmpi = int(input())\n A[tmpi-1] += 1\n \n for i in range(N):\n if K - (Q - A[i]) <= 0:\n print(\"No\")\n else:\n print(\"Yes\")\n\n ", "problem_context": "Score: 300 points\n\nProblem Statement\n\nTakahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.\n\nA game is played by N players, numbered 1 to N. At the beginning of a game, each player has K points.\n\nWhen a player correctly answers a question, each of the other N-1 players receives minus one (-1) point. There is no other factor that affects the players' scores.\n\nAt the end of a game, the players with 0 points or lower are eliminated, and the remaining players survive.\n\nIn the last game, the players gave a total of Q correct answers, the i-th of which was given by Player A_i.\nFor Kizahashi, write a program that determines whether each of the N players survived this game.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^9\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq A_i \\leq N\\ (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K Q\nA_1\nA_2\n.\n.\n.\nA_Q\n\nOutput\n\nPrint N lines. The i-th line should contain Yes if Player i survived the game, and No otherwise.\n\nSample Input 1\n\n6 3 4\n3\n1\n3\n2\n\nSample Output 1\n\nNo\nNo\nYes\nNo\nNo\nNo\n\nIn the beginning, the players' scores are (3, 3, 3, 3, 3, 3).\n\nPlayer 3 correctly answers a question. The players' scores are now (2, 2, 3, 2, 2, 2).\n\nPlayer 1 correctly answers a question. The players' scores are now (2, 1, 2, 1, 1, 1).\n\nPlayer 3 correctly answers a question. The players' scores are now (1, 0, 2, 0, 0, 0).\n\nPlayer 2 correctly answers a question. The players' scores are now (0, 0, 1, -1, -1, -1).\n\nPlayers 1, 2, 4, 5 and 6, who have 0 points or lower, are eliminated, and Player 3 survives this game.\n\nSample Input 2\n\n6 5 4\n3\n1\n3\n2\n\nSample Output 2\n\nYes\nYes\nYes\nYes\nYes\nYes\n\nSample Input 3\n\n10 13 15\n3\n1\n4\n1\n5\n9\n2\n6\n5\n3\n5\n8\n9\n7\n9\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nYes\nNo\nNo\nNo\nYes\nNo", "sample_input": "6 3 4\n3\n1\n3\n2\n"}, "reference_outputs": ["No\nNo\nYes\nNo\nNo\nNo\n"], "source_document_id": "p02911", "source_text": "Score: 300 points\n\nProblem Statement\n\nTakahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.\n\nA game is played by N players, numbered 1 to N. At the beginning of a game, each player has K points.\n\nWhen a player correctly answers a question, each of the other N-1 players receives minus one (-1) point. There is no other factor that affects the players' scores.\n\nAt the end of a game, the players with 0 points or lower are eliminated, and the remaining players survive.\n\nIn the last game, the players gave a total of Q correct answers, the i-th of which was given by Player A_i.\nFor Kizahashi, write a program that determines whether each of the N players survived this game.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^9\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq A_i \\leq N\\ (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K Q\nA_1\nA_2\n.\n.\n.\nA_Q\n\nOutput\n\nPrint N lines. The i-th line should contain Yes if Player i survived the game, and No otherwise.\n\nSample Input 1\n\n6 3 4\n3\n1\n3\n2\n\nSample Output 1\n\nNo\nNo\nYes\nNo\nNo\nNo\n\nIn the beginning, the players' scores are (3, 3, 3, 3, 3, 3).\n\nPlayer 3 correctly answers a question. The players' scores are now (2, 2, 3, 2, 2, 2).\n\nPlayer 1 correctly answers a question. The players' scores are now (2, 1, 2, 1, 1, 1).\n\nPlayer 3 correctly answers a question. The players' scores are now (1, 0, 2, 0, 0, 0).\n\nPlayer 2 correctly answers a question. The players' scores are now (0, 0, 1, -1, -1, -1).\n\nPlayers 1, 2, 4, 5 and 6, who have 0 points or lower, are eliminated, and Player 3 survives this game.\n\nSample Input 2\n\n6 5 4\n3\n1\n3\n2\n\nSample Output 2\n\nYes\nYes\nYes\nYes\nYes\nYes\n\nSample Input 3\n\n10 13 15\n3\n1\n4\n1\n5\n9\n2\n6\n5\n3\n5\n8\n9\n7\n9\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nYes\nNo\nNo\nNo\nYes\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 273, "memory_kb": 4680}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s301680638", "group_id": "codeNet:p02915", "input_text": "N = int(input())\n\nprint(N ** 3)\n", "language": "Python", "metadata": {"date": 1569264983, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02915.html", "problem_id": "p02915", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02915/input.txt", "sample_output_relpath": "derived/input_output/data/p02915/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02915/Python/s301680638.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s301680638", "user_id": "u204415375"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "N = int(input())\n\nprint(N ** 3)\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is going to set a 3-character password.\n\nHow many possible passwords are there if each of its characters must be a digit between 1 and N (inclusive)?\n\nConstraints\n\n1 \\leq N \\leq 9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of possible passwords.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n8\n\nThere are eight possible passwords: 111, 112, 121, 122, 211, 212, 221, and 222.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nThere is only one possible password if you can only use one kind of character.", "sample_input": "2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02915", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is going to set a 3-character password.\n\nHow many possible passwords are there if each of its characters must be a digit between 1 and N (inclusive)?\n\nConstraints\n\n1 \\leq N \\leq 9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of possible passwords.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n8\n\nThere are eight possible passwords: 111, 112, 121, 122, 211, 212, 221, and 222.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nThere is only one possible password if you can only use one kind of character.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 32, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s003562314", "group_id": "codeNet:p02916", "input_text": "N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nvalue = 0\nfor i in range(N):\n value += B[A[i]-1]\n if i > 0 and A[i] == A[i-1]+1:\n value += C[A[i-1]-1]\nprint(value)", "language": "Python", "metadata": {"date": 1567906821, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02916.html", "problem_id": "p02916", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02916/input.txt", "sample_output_relpath": "derived/input_output/data/p02916/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02916/Python/s003562314.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s003562314", "user_id": "u888512581"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nvalue = 0\nfor i in range(N):\n value += B[A[i]-1]\n if i > 0 and A[i] == A[i-1]+1:\n value += C[A[i-1]-1]\nprint(value)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi went to an all-you-can-eat buffet with N kinds of dishes and ate all of them (Dish 1, Dish 2, \\ldots, Dish N) once.\n\nThe i-th dish (1 \\leq i \\leq N) he ate was Dish A_i.\n\nWhen he eats Dish i (1 \\leq i \\leq N), he gains B_i satisfaction points.\n\nAdditionally, when he eats Dish i+1 just after eating Dish i (1 \\leq i \\leq N - 1), he gains C_i more satisfaction points.\n\nFind the sum of the satisfaction points he gained.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 20\n\n1 \\leq A_i \\leq N\n\nA_1, A_2, ..., A_N are all different.\n\n1 \\leq B_i \\leq 50\n\n1 \\leq C_i \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\nB_1 B_2 ... B_N\nC_1 C_2 ... C_{N-1}\n\nOutput\n\nPrint the sum of the satisfaction points Takahashi gained, as an integer.\n\nSample Input 1\n\n3\n3 1 2\n2 5 4\n3 6\n\nSample Output 1\n\n14\n\nTakahashi gained 14 satisfaction points in total, as follows:\n\nFirst, he ate Dish 3 and gained 4 satisfaction points.\n\nNext, he ate Dish 1 and gained 2 satisfaction points.\n\nLastly, he ate Dish 2 and gained 5 + 3 = 8 satisfaction points.\n\nSample Input 2\n\n4\n2 3 4 1\n13 5 8 24\n45 9 15\n\nSample Output 2\n\n74\n\nSample Input 3\n\n2\n1 2\n50 50\n50\n\nSample Output 3\n\n150", "sample_input": "3\n3 1 2\n2 5 4\n3 6\n"}, "reference_outputs": ["14\n"], "source_document_id": "p02916", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi went to an all-you-can-eat buffet with N kinds of dishes and ate all of them (Dish 1, Dish 2, \\ldots, Dish N) once.\n\nThe i-th dish (1 \\leq i \\leq N) he ate was Dish A_i.\n\nWhen he eats Dish i (1 \\leq i \\leq N), he gains B_i satisfaction points.\n\nAdditionally, when he eats Dish i+1 just after eating Dish i (1 \\leq i \\leq N - 1), he gains C_i more satisfaction points.\n\nFind the sum of the satisfaction points he gained.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 20\n\n1 \\leq A_i \\leq N\n\nA_1, A_2, ..., A_N are all different.\n\n1 \\leq B_i \\leq 50\n\n1 \\leq C_i \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\nB_1 B_2 ... B_N\nC_1 C_2 ... C_{N-1}\n\nOutput\n\nPrint the sum of the satisfaction points Takahashi gained, as an integer.\n\nSample Input 1\n\n3\n3 1 2\n2 5 4\n3 6\n\nSample Output 1\n\n14\n\nTakahashi gained 14 satisfaction points in total, as follows:\n\nFirst, he ate Dish 3 and gained 4 satisfaction points.\n\nNext, he ate Dish 1 and gained 2 satisfaction points.\n\nLastly, he ate Dish 2 and gained 5 + 3 = 8 satisfaction points.\n\nSample Input 2\n\n4\n2 3 4 1\n13 5 8 24\n45 9 15\n\nSample Output 2\n\n74\n\nSample Input 3\n\n2\n1 2\n50 50\n50\n\nSample Output 3\n\n150", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 245, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s858502832", "group_id": "codeNet:p02919", "input_text": "import sys\nimport math\nfrom collections import defaultdict\n\nsys.setrecursionlimit(10**7)\ndef input():\n return sys.stdin.readline()[:-1]\n\nmod = 10**9 + 7\n\ndef I(): return int(input())\ndef II(): return map(int, input().split())\ndef III(): return list(map(int, input().split()))\ndef Line(N):\n read_all = [tuple(map(int, input().split())) for _ in range(N)]\n return map(list,zip(*read_all))\n\n#################\n\nclass BIT:\n '''\n a[1]~a[n]の数列を想定\n '''\n\n def __init__(self, n):\n self.size = n\n self.tree = [0] * (n + 1)\n \n def add(self, index, x):\n '''\n a[index]にxを加算\n '''\n while index <= self.size:\n self.tree[index] += x\n index += index & (-index)\n \n def sum(self, index):\n '''\n a[1]~a[index]の和\n '''\n s = 0\n while index:\n s += self.tree[index]\n index -= index & (-index)\n return s\n \n def search(self, value):\n '''\n sum(index)>=value を満たす最小のindex\n sum(n)=1:\n L = bit.sum(index)\n else:\n L = 0\n wi = bit.search(L-1) if L>=2 else 0\n xi = bit.search(L) if L>=1 else 0\n\n R = bit.sum(N)-bit.sum(index+1)\n yi = bit.search(L+1)\n zi = bit.search(L+2)\n\n ci = (xi-wi)*(yi-index-1) + (index+1-xi)*(zi-yi)\n ans += ci*x[i][0]\n bit.add(index+1, 1)\n\nprint(ans)", "language": "Python", "metadata": {"date": 1567951942, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02919.html", "problem_id": "p02919", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02919/input.txt", "sample_output_relpath": "derived/input_output/data/p02919/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02919/Python/s858502832.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s858502832", "user_id": "u508486691"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import sys\nimport math\nfrom collections import defaultdict\n\nsys.setrecursionlimit(10**7)\ndef input():\n return sys.stdin.readline()[:-1]\n\nmod = 10**9 + 7\n\ndef I(): return int(input())\ndef II(): return map(int, input().split())\ndef III(): return list(map(int, input().split()))\ndef Line(N):\n read_all = [tuple(map(int, input().split())) for _ in range(N)]\n return map(list,zip(*read_all))\n\n#################\n\nclass BIT:\n '''\n a[1]~a[n]の数列を想定\n '''\n\n def __init__(self, n):\n self.size = n\n self.tree = [0] * (n + 1)\n \n def add(self, index, x):\n '''\n a[index]にxを加算\n '''\n while index <= self.size:\n self.tree[index] += x\n index += index & (-index)\n \n def sum(self, index):\n '''\n a[1]~a[index]の和\n '''\n s = 0\n while index:\n s += self.tree[index]\n index -= index & (-index)\n return s\n \n def search(self, value):\n '''\n sum(index)>=value を満たす最小のindex\n sum(n)=1:\n L = bit.sum(index)\n else:\n L = 0\n wi = bit.search(L-1) if L>=2 else 0\n xi = bit.search(L) if L>=1 else 0\n\n R = bit.sum(N)-bit.sum(index+1)\n yi = bit.search(L+1)\n zi = bit.search(L+2)\n\n ci = (xi-wi)*(yi-index-1) + (index+1-xi)*(zi-yi)\n ans += ci*x[i][0]\n bit.add(index+1, 1)\n\nprint(ans)", "problem_context": "Score: 500 points\n\nProblem Statement\n\nGiven is a permutation P of \\{1, 2, \\ldots, N\\}.\n\nFor a pair (L, R) (1 \\le L \\lt R \\le N), let X_{L, R} be the second largest value among P_L, P_{L+1}, \\ldots, P_R.\n\nFind \\displaystyle \\sum_{L=1}^{N-1} \\sum_{R=L+1}^{N} X_{L,R}.\n\nConstraints\n\n2 \\le N \\le 10^5\n\n1 \\le P_i \\le N\n\nP_i \\neq P_j (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 P_2 \\ldots P_N\n\nOutput\n\nPrint \\displaystyle \\sum_{L=1}^{N-1} \\sum_{R=L+1}^{N} X_{L,R}.\n\nSample Input 1\n\n3\n2 3 1\n\nSample Output 1\n\n5\n\nX_{1, 2} = 2, X_{1, 3} = 2, and X_{2, 3} = 1, so the sum is 2 + 2 + 1 = 5.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n30\n\nSample Input 3\n\n8\n8 2 7 3 4 5 6 1\n\nSample Output 3\n\n136", "sample_input": "3\n2 3 1\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02919", "source_text": "Score: 500 points\n\nProblem Statement\n\nGiven is a permutation P of \\{1, 2, \\ldots, N\\}.\n\nFor a pair (L, R) (1 \\le L \\lt R \\le N), let X_{L, R} be the second largest value among P_L, P_{L+1}, \\ldots, P_R.\n\nFind \\displaystyle \\sum_{L=1}^{N-1} \\sum_{R=L+1}^{N} X_{L,R}.\n\nConstraints\n\n2 \\le N \\le 10^5\n\n1 \\le P_i \\le N\n\nP_i \\neq P_j (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 P_2 \\ldots P_N\n\nOutput\n\nPrint \\displaystyle \\sum_{L=1}^{N-1} \\sum_{R=L+1}^{N} X_{L,R}.\n\nSample Input 1\n\n3\n2 3 1\n\nSample Output 1\n\n5\n\nX_{1, 2} = 2, X_{1, 3} = 2, and X_{2, 3} = 1, so the sum is 2 + 2 + 1 = 5.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n30\n\nSample Input 3\n\n8\n8 2 7 3 4 5 6 1\n\nSample Output 3\n\n136", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2069, "cpu_time_ms": 786, "memory_kb": 66080}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s485066750", "group_id": "codeNet:p02921", "input_text": "s = list(input())\nt = list(input())\n\ncount = 0\n\nfor i in range(3):\n if s[i] == t[i]:\n count = count + 1\n\nprint(count)", "language": "Python", "metadata": {"date": 1567364542, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02921.html", "problem_id": "p02921", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02921/input.txt", "sample_output_relpath": "derived/input_output/data/p02921/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02921/Python/s485066750.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s485066750", "user_id": "u044635590"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "s = list(input())\nt = list(input())\n\ncount = 0\n\nfor i in range(3):\n if s[i] == t[i]:\n count = count + 1\n\nprint(count)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will be given a string S of length 3 representing the weather forecast for three days in the past.\n\nThe i-th character (1 \\leq i \\leq 3) of S represents the forecast for the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively.\n\nYou will also be given a string T of length 3 representing the actual weather on those three days.\n\nThe i-th character (1 \\leq i \\leq 3) of S represents the actual weather on the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively.\n\nPrint the number of days for which the forecast was correct.\n\nConstraints\n\nS and T are strings of length 3 each.\n\nS and T consist of S, C, and R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the number of days for which the forecast was correct.\n\nSample Input 1\n\nCSS\nCSR\n\nSample Output 1\n\n2\n\nFor the first day, it was forecast to be cloudy, and it was indeed cloudy.\n\nFor the second day, it was forecast to be sunny, and it was indeed sunny.\n\nFor the third day, it was forecast to be sunny, but it was rainy.\n\nThus, the forecast was correct for two days in this case.\n\nSample Input 2\n\nSSR\nSSR\n\nSample Output 2\n\n3\n\nSample Input 3\n\nRRR\nSSS\n\nSample Output 3\n\n0", "sample_input": "CSS\nCSR\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02921", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will be given a string S of length 3 representing the weather forecast for three days in the past.\n\nThe i-th character (1 \\leq i \\leq 3) of S represents the forecast for the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively.\n\nYou will also be given a string T of length 3 representing the actual weather on those three days.\n\nThe i-th character (1 \\leq i \\leq 3) of S represents the actual weather on the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively.\n\nPrint the number of days for which the forecast was correct.\n\nConstraints\n\nS and T are strings of length 3 each.\n\nS and T consist of S, C, and R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the number of days for which the forecast was correct.\n\nSample Input 1\n\nCSS\nCSR\n\nSample Output 1\n\n2\n\nFor the first day, it was forecast to be cloudy, and it was indeed cloudy.\n\nFor the second day, it was forecast to be sunny, and it was indeed sunny.\n\nFor the third day, it was forecast to be sunny, but it was rainy.\n\nThus, the forecast was correct for two days in this case.\n\nSample Input 2\n\nSSR\nSSR\n\nSample Output 2\n\n3\n\nSample Input 3\n\nRRR\nSSS\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 127, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s106443051", "group_id": "codeNet:p02922", "input_text": "a,b = map(int,input().split())\ncount = 0\nif a >= b:\n print(1)\nb = b - a\ncount +=1\nwhile b > 0:\n b = b - (a-1)\n count += 1\nprint(count)", "language": "Python", "metadata": {"date": 1592542497, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02922.html", "problem_id": "p02922", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02922/input.txt", "sample_output_relpath": "derived/input_output/data/p02922/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02922/Python/s106443051.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s106443051", "user_id": "u999750647"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "a,b = map(int,input().split())\ncount = 0\nif a >= b:\n print(1)\nb = b - a\ncount +=1\nwhile b > 0:\n b = b - (a-1)\n count += 1\nprint(count)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi's house has only one socket.\n\nTakahashi wants to extend it with some number of power strips, each with A sockets, into B or more empty sockets.\n\nOne power strip with A sockets can extend one empty socket into A empty sockets.\n\nFind the minimum number of power strips required.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of power strips required.\n\nSample Input 1\n\n4 10\n\nSample Output 1\n\n3\n\n3 power strips, each with 4 sockets, extend the socket into 10 empty sockets.\n\nSample Input 2\n\n8 9\n\nSample Output 2\n\n2\n\n2 power strips, each with 8 sockets, extend the socket into 15 empty sockets.\n\nSample Input 3\n\n8 8\n\nSample Output 3\n\n1", "sample_input": "4 10\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02922", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi's house has only one socket.\n\nTakahashi wants to extend it with some number of power strips, each with A sockets, into B or more empty sockets.\n\nOne power strip with A sockets can extend one empty socket into A empty sockets.\n\nFind the minimum number of power strips required.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of power strips required.\n\nSample Input 1\n\n4 10\n\nSample Output 1\n\n3\n\n3 power strips, each with 4 sockets, extend the socket into 10 empty sockets.\n\nSample Input 2\n\n8 9\n\nSample Output 2\n\n2\n\n2 power strips, each with 8 sockets, extend the socket into 15 empty sockets.\n\nSample Input 3\n\n8 8\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 143, "cpu_time_ms": 26, "memory_kb": 9184}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s201847891", "group_id": "codeNet:p02922", "input_text": "import math\nA, B=map(int, input().split())\n\nif math.ceil(B/A)==1:\n print(1)\n\nelse:\n print(B//A+1)", "language": "Python", "metadata": {"date": 1588431875, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02922.html", "problem_id": "p02922", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02922/input.txt", "sample_output_relpath": "derived/input_output/data/p02922/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02922/Python/s201847891.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s201847891", "user_id": "u409435529"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import math\nA, B=map(int, input().split())\n\nif math.ceil(B/A)==1:\n print(1)\n\nelse:\n print(B//A+1)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi's house has only one socket.\n\nTakahashi wants to extend it with some number of power strips, each with A sockets, into B or more empty sockets.\n\nOne power strip with A sockets can extend one empty socket into A empty sockets.\n\nFind the minimum number of power strips required.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of power strips required.\n\nSample Input 1\n\n4 10\n\nSample Output 1\n\n3\n\n3 power strips, each with 4 sockets, extend the socket into 10 empty sockets.\n\nSample Input 2\n\n8 9\n\nSample Output 2\n\n2\n\n2 power strips, each with 8 sockets, extend the socket into 15 empty sockets.\n\nSample Input 3\n\n8 8\n\nSample Output 3\n\n1", "sample_input": "4 10\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02922", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi's house has only one socket.\n\nTakahashi wants to extend it with some number of power strips, each with A sockets, into B or more empty sockets.\n\nOne power strip with A sockets can extend one empty socket into A empty sockets.\n\nFind the minimum number of power strips required.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of power strips required.\n\nSample Input 1\n\n4 10\n\nSample Output 1\n\n3\n\n3 power strips, each with 4 sockets, extend the socket into 10 empty sockets.\n\nSample Input 2\n\n8 9\n\nSample Output 2\n\n2\n\n2 power strips, each with 8 sockets, extend the socket into 15 empty sockets.\n\nSample Input 3\n\n8 8\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 99, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s727130657", "group_id": "codeNet:p02922", "input_text": "a,b=map(int,input().split())\ntotal=1\ncount=0\n\nfor i in range(100):\n if total=h[i+1]:\n ans += 1\n \nprint(ans-1)\n", "language": "Python", "metadata": {"date": 1600261362, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p02923.html", "problem_id": "p02923", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02923/input.txt", "sample_output_relpath": "derived/input_output/data/p02923/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02923/Python/s258108522.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s258108522", "user_id": "u034855798"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n = int(input())\nh = list(map(int,input().split()))\nA = []\nans = 0\nfor i in range(n-1):\n if h[i]>=h[i+1]:\n ans += 1\n \nprint(ans-1)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "sample_input": "5\n10 4 8 7 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02923", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 148, "cpu_time_ms": 89, "memory_kb": 85220}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s244523135", "group_id": "codeNet:p02923", "input_text": "n = int(input())\nh = list(map(int, input().split()))\nanswer = -1#これなに\nm = 0#カウントするやつやね\nfor i in range(n-1):\n if h[i] >= h[i+1]:\n m += 1\n else:\n answer = max(answer,m)\n m = 0\nanswer = max(answer,m)\nprint(answer)\n", "language": "Python", "metadata": {"date": 1587501469, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02923.html", "problem_id": "p02923", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02923/input.txt", "sample_output_relpath": "derived/input_output/data/p02923/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02923/Python/s244523135.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s244523135", "user_id": "u700929101"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n = int(input())\nh = list(map(int, input().split()))\nanswer = -1#これなに\nm = 0#カウントするやつやね\nfor i in range(n-1):\n if h[i] >= h[i+1]:\n m += 1\n else:\n answer = max(answer,m)\n m = 0\nanswer = max(answer,m)\nprint(answer)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "sample_input": "5\n10 4 8 7 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02923", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 266, "cpu_time_ms": 82, "memory_kb": 14224}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s644599149", "group_id": "codeNet:p02923", "input_text": "import copy\nn = int(input())\nr_L = list(map(int,input().split()))\nl_L = copy.deepcopy(r_L)\nl_L.reverse()\n\n\nr_ans,l_ans = 0,0\nr_ans_L,l_ans_L = [],[]\n\nfor val in range(n-1):\n if r_L[val] >= r_L[val+1]:\n r_ans += 1\n else:\n r_ans_L.append(r_ans)\n r_ans = 0\n \n\n\n\nl_ans_L.append(l_ans)\nr_ans_L.append(r_ans)\n\nprint(max(max(l_ans_L),max(r_ans_L)))\n", "language": "Python", "metadata": {"date": 1573001015, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02923.html", "problem_id": "p02923", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02923/input.txt", "sample_output_relpath": "derived/input_output/data/p02923/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02923/Python/s644599149.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s644599149", "user_id": "u291628833"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import copy\nn = int(input())\nr_L = list(map(int,input().split()))\nl_L = copy.deepcopy(r_L)\nl_L.reverse()\n\n\nr_ans,l_ans = 0,0\nr_ans_L,l_ans_L = [],[]\n\nfor val in range(n-1):\n if r_L[val] >= r_L[val+1]:\n r_ans += 1\n else:\n r_ans_L.append(r_ans)\n r_ans = 0\n \n\n\n\nl_ans_L.append(l_ans)\nr_ans_L.append(r_ans)\n\nprint(max(max(l_ans_L),max(r_ans_L)))\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "sample_input": "5\n10 4 8 7 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02923", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 372, "cpu_time_ms": 306, "memory_kb": 90348}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s962677948", "group_id": "codeNet:p02923", "input_text": "N = int(input())\nmasu = list(map(lambda x: int(x), input().split()))\n\ncount = 0\nmax_count = 0\n\nfor i in range(N - 1):\n if (masu[i] >= masu[i + 1]):\n count += 1\n else:\n if max_count < count:\n max_count = count\n count = 0\n \n \nif count == N - 1:\n print(count)\nelse:\n print(max_count)\n\n", "language": "Python", "metadata": {"date": 1567369924, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02923.html", "problem_id": "p02923", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02923/input.txt", "sample_output_relpath": "derived/input_output/data/p02923/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02923/Python/s962677948.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s962677948", "user_id": "u214215724"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "N = int(input())\nmasu = list(map(lambda x: int(x), input().split()))\n\ncount = 0\nmax_count = 0\n\nfor i in range(N - 1):\n if (masu[i] >= masu[i + 1]):\n count += 1\n else:\n if max_count < count:\n max_count = count\n count = 0\n \n \nif count == N - 1:\n print(count)\nelse:\n print(max_count)\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "sample_input": "5\n10 4 8 7 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02923", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 332, "cpu_time_ms": 76, "memory_kb": 14224}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s851298523", "group_id": "codeNet:p02924", "input_text": "n = int(input())\nprint(n*(n-1)//2)", "language": "Python", "metadata": {"date": 1595108211, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02924.html", "problem_id": "p02924", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02924/input.txt", "sample_output_relpath": "derived/input_output/data/p02924/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02924/Python/s851298523.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s851298523", "user_id": "u368796742"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "n = int(input())\nprint(n*(n-1)//2)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nFor an integer N, we will choose a permutation \\{P_1, P_2, ..., P_N\\} of \\{1, 2, ..., N\\}.\n\nThen, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.\n\nFind the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1\n\nWhen the permutation \\{P_1, P_2\\} = \\{2, 1\\} is chosen, M_1 + M_2 = 1 + 0 = 1.\n\nSample Input 2\n\n13\n\nSample Output 2\n\n78\n\nSample Input 3\n\n1\n\nSample Output 3\n\n0", "sample_input": "2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02924", "source_text": "Score : 400 points\n\nProblem Statement\n\nFor an integer N, we will choose a permutation \\{P_1, P_2, ..., P_N\\} of \\{1, 2, ..., N\\}.\n\nThen, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.\n\nFind the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1\n\nWhen the permutation \\{P_1, P_2\\} = \\{2, 1\\} is chosen, M_1 + M_2 = 1 + 0 = 1.\n\nSample Input 2\n\n13\n\nSample Output 2\n\n78\n\nSample Input 3\n\n1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 34, "cpu_time_ms": 28, "memory_kb": 9148}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s579547933", "group_id": "codeNet:p02924", "input_text": "n = int(input())\nprint(int((n-1)*n/2))", "language": "Python", "metadata": {"date": 1567848601, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02924.html", "problem_id": "p02924", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02924/input.txt", "sample_output_relpath": "derived/input_output/data/p02924/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02924/Python/s579547933.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s579547933", "user_id": "u510097799"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "n = int(input())\nprint(int((n-1)*n/2))", "problem_context": "Score : 400 points\n\nProblem Statement\n\nFor an integer N, we will choose a permutation \\{P_1, P_2, ..., P_N\\} of \\{1, 2, ..., N\\}.\n\nThen, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.\n\nFind the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1\n\nWhen the permutation \\{P_1, P_2\\} = \\{2, 1\\} is chosen, M_1 + M_2 = 1 + 0 = 1.\n\nSample Input 2\n\n13\n\nSample Output 2\n\n78\n\nSample Input 3\n\n1\n\nSample Output 3\n\n0", "sample_input": "2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02924", "source_text": "Score : 400 points\n\nProblem Statement\n\nFor an integer N, we will choose a permutation \\{P_1, P_2, ..., P_N\\} of \\{1, 2, ..., N\\}.\n\nThen, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.\n\nFind the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1\n\nWhen the permutation \\{P_1, P_2\\} = \\{2, 1\\} is chosen, M_1 + M_2 = 1 + 0 = 1.\n\nSample Input 2\n\n13\n\nSample Output 2\n\n78\n\nSample Input 3\n\n1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 38, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s160349593", "group_id": "codeNet:p02924", "input_text": "S=float(input())\n#N=list(map(int,input().split()))\nans=(S-1)*S/2\nprint(int(ans))", "language": "Python", "metadata": {"date": 1567489156, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02924.html", "problem_id": "p02924", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02924/input.txt", "sample_output_relpath": "derived/input_output/data/p02924/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02924/Python/s160349593.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s160349593", "user_id": "u466968658"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "S=float(input())\n#N=list(map(int,input().split()))\nans=(S-1)*S/2\nprint(int(ans))", "problem_context": "Score : 400 points\n\nProblem Statement\n\nFor an integer N, we will choose a permutation \\{P_1, P_2, ..., P_N\\} of \\{1, 2, ..., N\\}.\n\nThen, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.\n\nFind the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1\n\nWhen the permutation \\{P_1, P_2\\} = \\{2, 1\\} is chosen, M_1 + M_2 = 1 + 0 = 1.\n\nSample Input 2\n\n13\n\nSample Output 2\n\n78\n\nSample Input 3\n\n1\n\nSample Output 3\n\n0", "sample_input": "2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02924", "source_text": "Score : 400 points\n\nProblem Statement\n\nFor an integer N, we will choose a permutation \\{P_1, P_2, ..., P_N\\} of \\{1, 2, ..., N\\}.\n\nThen, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.\n\nFind the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1\n\nWhen the permutation \\{P_1, P_2\\} = \\{2, 1\\} is chosen, M_1 + M_2 = 1 + 0 = 1.\n\nSample Input 2\n\n13\n\nSample Output 2\n\n78\n\nSample Input 3\n\n1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 80, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s665072987", "group_id": "codeNet:p02924", "input_text": "n = int(input())\nans = n * (n-1) // 2\nprint(ans)\n", "language": "Python", "metadata": {"date": 1567453220, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02924.html", "problem_id": "p02924", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02924/input.txt", "sample_output_relpath": "derived/input_output/data/p02924/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02924/Python/s665072987.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s665072987", "user_id": "u558242240"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "n = int(input())\nans = n * (n-1) // 2\nprint(ans)\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nFor an integer N, we will choose a permutation \\{P_1, P_2, ..., P_N\\} of \\{1, 2, ..., N\\}.\n\nThen, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.\n\nFind the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1\n\nWhen the permutation \\{P_1, P_2\\} = \\{2, 1\\} is chosen, M_1 + M_2 = 1 + 0 = 1.\n\nSample Input 2\n\n13\n\nSample Output 2\n\n78\n\nSample Input 3\n\n1\n\nSample Output 3\n\n0", "sample_input": "2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02924", "source_text": "Score : 400 points\n\nProblem Statement\n\nFor an integer N, we will choose a permutation \\{P_1, P_2, ..., P_N\\} of \\{1, 2, ..., N\\}.\n\nThen, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.\n\nFind the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1\n\nWhen the permutation \\{P_1, P_2\\} = \\{2, 1\\} is chosen, M_1 + M_2 = 1 + 0 = 1.\n\nSample Input 2\n\n13\n\nSample Output 2\n\n78\n\nSample Input 3\n\n1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 49, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s333285234", "group_id": "codeNet:p02924", "input_text": "n = int(input())\ntmp = 0\nmax = 0\nfor i in range(n):\n max = max + i\nprint(max)\n", "language": "Python", "metadata": {"date": 1567367042, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02924.html", "problem_id": "p02924", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02924/input.txt", "sample_output_relpath": "derived/input_output/data/p02924/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02924/Python/s333285234.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s333285234", "user_id": "u405620865"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "n = int(input())\ntmp = 0\nmax = 0\nfor i in range(n):\n max = max + i\nprint(max)\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nFor an integer N, we will choose a permutation \\{P_1, P_2, ..., P_N\\} of \\{1, 2, ..., N\\}.\n\nThen, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.\n\nFind the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1\n\nWhen the permutation \\{P_1, P_2\\} = \\{2, 1\\} is chosen, M_1 + M_2 = 1 + 0 = 1.\n\nSample Input 2\n\n13\n\nSample Output 2\n\n78\n\nSample Input 3\n\n1\n\nSample Output 3\n\n0", "sample_input": "2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02924", "source_text": "Score : 400 points\n\nProblem Statement\n\nFor an integer N, we will choose a permutation \\{P_1, P_2, ..., P_N\\} of \\{1, 2, ..., N\\}.\n\nThen, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.\n\nFind the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1\n\nWhen the permutation \\{P_1, P_2\\} = \\{2, 1\\} is chosen, M_1 + M_2 = 1 + 0 = 1.\n\nSample Input 2\n\n13\n\nSample Output 2\n\n78\n\nSample Input 3\n\n1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 81, "cpu_time_ms": 2104, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s330721035", "group_id": "codeNet:p02925", "input_text": "# 休憩review\n# League\nfrom collections import deque\nN = int(input())\nG = [[] for i in range(N**2+1)]\nfor i in range(N):\n a = list(map(int, input().split()))\n for j in range(1, N-1):\n _from, _to = a[j-1], a[j]\n G[N*min(i+1, _from)-N+max(i+1, _from)\n ].append(N*min(i+1, _to)-N+max(i+1, _to))\n\n\nIn = [0 for i in range(N**2+1)] # In[node] = node に入る入次数\nfor i in range(1, N**2+1):\n for node in G[i]:\n In[node] += 1\n\n\nstack = deque()\nfor i in range(1, N**2+1):\n if In[i] == 0:\n stack.append(i) # stack := 入次数が0になった点を入れておく\n\n\nRemoved = [False for i in range(N**2+1)] # 考慮されたか\ncnt = [1 for i in range(N**2+1)]\n\n\nwhile stack:\n x = stack.popleft()\n Removed[x] = True\n for node in G[x]:\n In[node] -= 1\n if In[node] == 0:\n cnt[node] += cnt[x]\n stack.append(node)\n\n\nall_checked = all(Removed[node] == True for node in range(1, N**2+1))\nif all_checked:\n answer = max(cnt)\n print(answer)\n exit()\nprint(-1)", "language": "Python", "metadata": {"date": 1594170964, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02925.html", "problem_id": "p02925", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02925/input.txt", "sample_output_relpath": "derived/input_output/data/p02925/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02925/Python/s330721035.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s330721035", "user_id": "u780962115"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "# 休憩review\n# League\nfrom collections import deque\nN = int(input())\nG = [[] for i in range(N**2+1)]\nfor i in range(N):\n a = list(map(int, input().split()))\n for j in range(1, N-1):\n _from, _to = a[j-1], a[j]\n G[N*min(i+1, _from)-N+max(i+1, _from)\n ].append(N*min(i+1, _to)-N+max(i+1, _to))\n\n\nIn = [0 for i in range(N**2+1)] # In[node] = node に入る入次数\nfor i in range(1, N**2+1):\n for node in G[i]:\n In[node] += 1\n\n\nstack = deque()\nfor i in range(1, N**2+1):\n if In[i] == 0:\n stack.append(i) # stack := 入次数が0になった点を入れておく\n\n\nRemoved = [False for i in range(N**2+1)] # 考慮されたか\ncnt = [1 for i in range(N**2+1)]\n\n\nwhile stack:\n x = stack.popleft()\n Removed[x] = True\n for node in G[x]:\n In[node] -= 1\n if In[node] == 0:\n cnt[node] += cnt[x]\n stack.append(node)\n\n\nall_checked = all(Removed[node] == True for node in range(1, N**2+1))\nif all_checked:\n answer = max(cnt)\n print(answer)\n exit()\nprint(-1)", "problem_context": "Score : 500 points\n\nProblem Statement\n\nN players will participate in a tennis tournament. We will call them Player 1, Player 2, \\ldots, Player N.\n\nThe tournament is round-robin format, and there will be N(N-1)/2 matches in total.\nIs it possible to schedule these matches so that all of the following conditions are satisfied? If the answer is yes, also find the minimum number of days required.\n\nEach player plays at most one matches in a day.\n\nEach player i (1 \\leq i \\leq N) plays one match against Player A_{i, 1}, A_{i, 2}, \\ldots, A_{i, N-1} in this order.\n\nConstraints\n\n3 \\leq N \\leq 1000\n\n1 \\leq A_{i, j} \\leq N\n\nA_{i, j} \\neq i\n\nA_{i, 1}, A_{i, 2}, \\ldots, A_{i, N-1} are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1, 1} A_{1, 2} \\ldots A_{1, N-1}\nA_{2, 1} A_{2, 2} \\ldots A_{2, N-1}\n:\nA_{N, 1} A_{N, 2} \\ldots A_{N, N-1}\n\nOutput\n\nIf it is possible to schedule all the matches so that all of the conditions are satisfied, print the minimum number of days required; if it is impossible, print -1.\n\nSample Input 1\n\n3\n2 3\n1 3\n1 2\n\nSample Output 1\n\n3\n\nAll the conditions can be satisfied if the matches are scheduled for three days as follows:\n\nDay 1: Player 1 vs Player 2\n\nDay 2: Player 1 vs Player 3\n\nDay 3: Player 2 vs Player 3\n\nThis is the minimum number of days required.\n\nSample Input 2\n\n4\n2 3 4\n1 3 4\n4 1 2\n3 1 2\n\nSample Output 2\n\n4\n\nAll the conditions can be satisfied if the matches are scheduled for four days as follows:\n\nDay 1: Player 1 vs Player 2, Player 3 vs Player 4\n\nDay 2: Player 1 vs Player 3\n\nDay 3: Player 1 vs Player 4, Player 2 vs Player 3\n\nDay 4: Player 2 vs Player 4\n\nThis is the minimum number of days required.\n\nSample Input 3\n\n3\n2 3\n3 1\n1 2\n\nSample Output 3\n\n-1\n\nAny scheduling of the matches violates some condition.", "sample_input": "3\n2 3\n1 3\n1 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02925", "source_text": "Score : 500 points\n\nProblem Statement\n\nN players will participate in a tennis tournament. We will call them Player 1, Player 2, \\ldots, Player N.\n\nThe tournament is round-robin format, and there will be N(N-1)/2 matches in total.\nIs it possible to schedule these matches so that all of the following conditions are satisfied? If the answer is yes, also find the minimum number of days required.\n\nEach player plays at most one matches in a day.\n\nEach player i (1 \\leq i \\leq N) plays one match against Player A_{i, 1}, A_{i, 2}, \\ldots, A_{i, N-1} in this order.\n\nConstraints\n\n3 \\leq N \\leq 1000\n\n1 \\leq A_{i, j} \\leq N\n\nA_{i, j} \\neq i\n\nA_{i, 1}, A_{i, 2}, \\ldots, A_{i, N-1} are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1, 1} A_{1, 2} \\ldots A_{1, N-1}\nA_{2, 1} A_{2, 2} \\ldots A_{2, N-1}\n:\nA_{N, 1} A_{N, 2} \\ldots A_{N, N-1}\n\nOutput\n\nIf it is possible to schedule all the matches so that all of the conditions are satisfied, print the minimum number of days required; if it is impossible, print -1.\n\nSample Input 1\n\n3\n2 3\n1 3\n1 2\n\nSample Output 1\n\n3\n\nAll the conditions can be satisfied if the matches are scheduled for three days as follows:\n\nDay 1: Player 1 vs Player 2\n\nDay 2: Player 1 vs Player 3\n\nDay 3: Player 2 vs Player 3\n\nThis is the minimum number of days required.\n\nSample Input 2\n\n4\n2 3 4\n1 3 4\n4 1 2\n3 1 2\n\nSample Output 2\n\n4\n\nAll the conditions can be satisfied if the matches are scheduled for four days as follows:\n\nDay 1: Player 1 vs Player 2, Player 3 vs Player 4\n\nDay 2: Player 1 vs Player 3\n\nDay 3: Player 1 vs Player 4, Player 2 vs Player 3\n\nDay 4: Player 2 vs Player 4\n\nThis is the minimum number of days required.\n\nSample Input 3\n\n3\n2 3\n3 1\n1 2\n\nSample Output 3\n\n-1\n\nAny scheduling of the matches violates some condition.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1052, "cpu_time_ms": 2210, "memory_kb": 171672}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s369977719", "group_id": "codeNet:p02928", "input_text": "#######################################\nprime = 10**9+7\n\ndef sowa(num):\n return int((1+num)*num/2)\n#######################################\nn,k = map(int, input().split())\na = list(map(int, input().split()))\n\n\ntento1 = [sum([1 if a[i]>a[j] else 0 for j in range(i,n)]) for i in range(n-1)]\ntento2 = [sum([1 if a[i]>a[j] else 0 for j in range(n)]) for i in range(n)]\n\n\nret = ((sum(tento1)%prime) *(k%prime) %prime) + ((sum(tento2)%prime) *(sowa(k-1) %prime)%prime)\nprint(ret%prime)\n", "language": "Python", "metadata": {"date": 1566698434, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02928.html", "problem_id": "p02928", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02928/input.txt", "sample_output_relpath": "derived/input_output/data/p02928/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02928/Python/s369977719.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s369977719", "user_id": "u124589361"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "#######################################\nprime = 10**9+7\n\ndef sowa(num):\n return int((1+num)*num/2)\n#######################################\nn,k = map(int, input().split())\na = list(map(int, input().split()))\n\n\ntento1 = [sum([1 if a[i]>a[j] else 0 for j in range(i,n)]) for i in range(n-1)]\ntento2 = [sum([1 if a[i]>a[j] else 0 for j in range(n)]) for i in range(n)]\n\n\nret = ((sum(tento1)%prime) *(k%prime) %prime) + ((sum(tento2)%prime) *(sowa(k-1) %prime)%prime)\nprint(ret%prime)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}.\n\nLet B be a sequence of K \\times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2.\n\nFind the inversion number of B, modulo 10^9 + 7.\n\nHere the inversion number of B is defined as the number of ordered pairs of integers (i,~j)~(0 \\leq i < j \\leq K \\times N - 1) such that B_i > B_j.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_0 A_1 ... A_{N - 1}\n\nOutput\n\nPrint the inversion number of B, modulo 10^9 + 7.\n\nSample Input 1\n\n2 2\n2 1\n\nSample Output 1\n\n3\n\nIn this case, B~=~2,~1,~2,~1. We have:\n\nB_0 > B_1\n\nB_0 > B_3\n\nB_2 > B_3\n\nThus, the inversion number of B is 3.\n\nSample Input 2\n\n3 5\n1 1 1\n\nSample Output 2\n\n0\n\nA may contain multiple occurrences of the same number.\n\nSample Input 3\n\n10 998244353\n10 9 8 7 5 6 3 4 2 1\n\nSample Output 3\n\n185297239\n\nBe sure to print the output modulo 10^9 + 7.", "sample_input": "2 2\n2 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02928", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}.\n\nLet B be a sequence of K \\times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2.\n\nFind the inversion number of B, modulo 10^9 + 7.\n\nHere the inversion number of B is defined as the number of ordered pairs of integers (i,~j)~(0 \\leq i < j \\leq K \\times N - 1) such that B_i > B_j.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_0 A_1 ... A_{N - 1}\n\nOutput\n\nPrint the inversion number of B, modulo 10^9 + 7.\n\nSample Input 1\n\n2 2\n2 1\n\nSample Output 1\n\n3\n\nIn this case, B~=~2,~1,~2,~1. We have:\n\nB_0 > B_1\n\nB_0 > B_3\n\nB_2 > B_3\n\nThus, the inversion number of B is 3.\n\nSample Input 2\n\n3 5\n1 1 1\n\nSample Output 2\n\n0\n\nA may contain multiple occurrences of the same number.\n\nSample Input 3\n\n10 998244353\n10 9 8 7 5 6 3 4 2 1\n\nSample Output 3\n\n185297239\n\nBe sure to print the output modulo 10^9 + 7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 481, "cpu_time_ms": 689, "memory_kb": 3188}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s693716021", "group_id": "codeNet:p02934", "input_text": "a = input()\nlist_a = list(map(int, input().split()))\n\nans = 0\nfor i in list_a:\n ans += 1/i\n \nprint(1/ans)", "language": "Python", "metadata": {"date": 1583957195, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02934.html", "problem_id": "p02934", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02934/input.txt", "sample_output_relpath": "derived/input_output/data/p02934/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02934/Python/s693716021.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s693716021", "user_id": "u524489226"}, "prompt_components": {"gold_output": "7.5\n", "input_to_evaluate": "a = input()\nlist_a = list(map(int, input().split()))\n\nans = 0\nfor i in list_a:\n ans += 1/i\n \nprint(1/ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is a sequence of N integers A_1, \\ldots, A_N.\n\nFind the (multiplicative) inverse of the sum of the inverses of these numbers, \\frac{1}{\\frac{1}{A_1} + \\ldots + \\frac{1}{A_N}}.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint a decimal number (or an integer) representing the value of \\frac{1}{\\frac{1}{A_1} + \\ldots + \\frac{1}{A_N}}.\n\nYour output will be judged correct when its absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n10 30\n\nSample Output 1\n\n7.5\n\n\\frac{1}{\\frac{1}{10} + \\frac{1}{30}} = \\frac{1}{\\frac{4}{30}} = \\frac{30}{4} = 7.5.\n\nPrinting 7.50001, 7.49999, and so on will also be accepted.\n\nSample Input 2\n\n3\n200 200 200\n\nSample Output 2\n\n66.66666666666667\n\n\\frac{1}{\\frac{1}{200} + \\frac{1}{200} + \\frac{1}{200}} = \\frac{1}{\\frac{3}{200}} = \\frac{200}{3} = 66.6666....\n\nPrinting 6.66666e+1 and so on will also be accepted.\n\nSample Input 3\n\n1\n1000\n\nSample Output 3\n\n1000\n\n\\frac{1}{\\frac{1}{1000}} = 1000.\n\nPrinting +1000.0 and so on will also be accepted.", "sample_input": "2\n10 30\n"}, "reference_outputs": ["7.5\n"], "source_document_id": "p02934", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is a sequence of N integers A_1, \\ldots, A_N.\n\nFind the (multiplicative) inverse of the sum of the inverses of these numbers, \\frac{1}{\\frac{1}{A_1} + \\ldots + \\frac{1}{A_N}}.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint a decimal number (or an integer) representing the value of \\frac{1}{\\frac{1}{A_1} + \\ldots + \\frac{1}{A_N}}.\n\nYour output will be judged correct when its absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n10 30\n\nSample Output 1\n\n7.5\n\n\\frac{1}{\\frac{1}{10} + \\frac{1}{30}} = \\frac{1}{\\frac{4}{30}} = \\frac{30}{4} = 7.5.\n\nPrinting 7.50001, 7.49999, and so on will also be accepted.\n\nSample Input 2\n\n3\n200 200 200\n\nSample Output 2\n\n66.66666666666667\n\n\\frac{1}{\\frac{1}{200} + \\frac{1}{200} + \\frac{1}{200}} = \\frac{1}{\\frac{3}{200}} = \\frac{200}{3} = 66.6666....\n\nPrinting 6.66666e+1 and so on will also be accepted.\n\nSample Input 3\n\n1\n1000\n\nSample Output 3\n\n1000\n\n\\frac{1}{\\frac{1}{1000}} = 1000.\n\nPrinting +1000.0 and so on will also be accepted.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 107, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s183926019", "group_id": "codeNet:p02934", "input_text": "n=int(input())\nl=list(map(int,input().split()))\nl=list(map(lambda x:1/x,l))\n\na=sum(l)\nans=1/a\n\nprint(ans)", "language": "Python", "metadata": {"date": 1566177134, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02934.html", "problem_id": "p02934", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02934/input.txt", "sample_output_relpath": "derived/input_output/data/p02934/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02934/Python/s183926019.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s183926019", "user_id": "u739959951"}, "prompt_components": {"gold_output": "7.5\n", "input_to_evaluate": "n=int(input())\nl=list(map(int,input().split()))\nl=list(map(lambda x:1/x,l))\n\na=sum(l)\nans=1/a\n\nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is a sequence of N integers A_1, \\ldots, A_N.\n\nFind the (multiplicative) inverse of the sum of the inverses of these numbers, \\frac{1}{\\frac{1}{A_1} + \\ldots + \\frac{1}{A_N}}.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint a decimal number (or an integer) representing the value of \\frac{1}{\\frac{1}{A_1} + \\ldots + \\frac{1}{A_N}}.\n\nYour output will be judged correct when its absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n10 30\n\nSample Output 1\n\n7.5\n\n\\frac{1}{\\frac{1}{10} + \\frac{1}{30}} = \\frac{1}{\\frac{4}{30}} = \\frac{30}{4} = 7.5.\n\nPrinting 7.50001, 7.49999, and so on will also be accepted.\n\nSample Input 2\n\n3\n200 200 200\n\nSample Output 2\n\n66.66666666666667\n\n\\frac{1}{\\frac{1}{200} + \\frac{1}{200} + \\frac{1}{200}} = \\frac{1}{\\frac{3}{200}} = \\frac{200}{3} = 66.6666....\n\nPrinting 6.66666e+1 and so on will also be accepted.\n\nSample Input 3\n\n1\n1000\n\nSample Output 3\n\n1000\n\n\\frac{1}{\\frac{1}{1000}} = 1000.\n\nPrinting +1000.0 and so on will also be accepted.", "sample_input": "2\n10 30\n"}, "reference_outputs": ["7.5\n"], "source_document_id": "p02934", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is a sequence of N integers A_1, \\ldots, A_N.\n\nFind the (multiplicative) inverse of the sum of the inverses of these numbers, \\frac{1}{\\frac{1}{A_1} + \\ldots + \\frac{1}{A_N}}.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint a decimal number (or an integer) representing the value of \\frac{1}{\\frac{1}{A_1} + \\ldots + \\frac{1}{A_N}}.\n\nYour output will be judged correct when its absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n10 30\n\nSample Output 1\n\n7.5\n\n\\frac{1}{\\frac{1}{10} + \\frac{1}{30}} = \\frac{1}{\\frac{4}{30}} = \\frac{30}{4} = 7.5.\n\nPrinting 7.50001, 7.49999, and so on will also be accepted.\n\nSample Input 2\n\n3\n200 200 200\n\nSample Output 2\n\n66.66666666666667\n\n\\frac{1}{\\frac{1}{200} + \\frac{1}{200} + \\frac{1}{200}} = \\frac{1}{\\frac{3}{200}} = \\frac{200}{3} = 66.6666....\n\nPrinting 6.66666e+1 and so on will also be accepted.\n\nSample Input 3\n\n1\n1000\n\nSample Output 3\n\n1000\n\n\\frac{1}{\\frac{1}{1000}} = 1000.\n\nPrinting +1000.0 and so on will also be accepted.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 105, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s688815542", "group_id": "codeNet:p02935", "input_text": "\nimport heapq\n\n\nN = int(input())\nV = [int(x) for x in input().split()]\n\nheapq.heapify(V)\n\nfor i in range(N-1):\n a= heapq.heappop(V)\n b= heapq.heappop(V)\n c=(a+b)/2\n heapq.heappush(V,c)\n\nans = heapq.heappop(V)\nprint(ans)", "language": "Python", "metadata": {"date": 1570411730, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02935.html", "problem_id": "p02935", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02935/input.txt", "sample_output_relpath": "derived/input_output/data/p02935/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02935/Python/s688815542.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s688815542", "user_id": "u396961814"}, "prompt_components": {"gold_output": "3.5\n", "input_to_evaluate": "\nimport heapq\n\n\nN = int(input())\nV = [int(x) for x in input().split()]\n\nheapq.heapify(V)\n\nfor i in range(N-1):\n a= heapq.heappop(V)\n b= heapq.heappop(V)\n c=(a+b)/2\n heapq.heappush(V,c)\n\nans = heapq.heappop(V)\nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou have a pot and N ingredients. Each ingredient has a real number parameter called value, and the value of the i-th ingredient (1 \\leq i \\leq N) is v_i.\n\nWhen you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 where x and y are the values of the ingredients consumed, and you can put this ingredient again in the pot.\n\nAfter you compose ingredients in this way N-1 times, you will end up with one ingredient. Find the maximum possible value of this ingredient.\n\nConstraints\n\n2 \\leq N \\leq 50\n\n1 \\leq v_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nv_1 v_2 \\ldots v_N\n\nOutput\n\nPrint a decimal number (or an integer) representing the maximum possible value of the last ingredient remaining.\n\nYour output will be judged correct when its absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n3 4\n\nSample Output 1\n\n3.5\n\nIf you start with two ingredients, the only choice is to put both of them in the pot. The value of the ingredient resulting from the ingredients of values 3 and 4 is (3 + 4) / 2 = 3.5.\n\nPrinting 3.50001, 3.49999, and so on will also be accepted.\n\nSample Input 2\n\n3\n500 300 200\n\nSample Output 2\n\n375\n\nYou start with three ingredients this time, and you can choose what to use in the first composition. There are three possible choices:\n\nUse the ingredients of values 500 and 300 to produce an ingredient of value (500 + 300) / 2 = 400. The next composition will use this ingredient and the ingredient of value 200, resulting in an ingredient of value (400 + 200) / 2 = 300.\n\nUse the ingredients of values 500 and 200 to produce an ingredient of value (500 + 200) / 2 = 350. The next composition will use this ingredient and the ingredient of value 300, resulting in an ingredient of value (350 + 300) / 2 = 325.\n\nUse the ingredients of values 300 and 200 to produce an ingredient of value (300 + 200) / 2 = 250. The next composition will use this ingredient and the ingredient of value 500, resulting in an ingredient of value (250 + 500) / 2 = 375.\n\nThus, the maximum possible value of the last ingredient remaining is 375.\n\nPrinting 375.0 and so on will also be accepted.\n\nSample Input 3\n\n5\n138 138 138 138 138\n\nSample Output 3\n\n138", "sample_input": "2\n3 4\n"}, "reference_outputs": ["3.5\n"], "source_document_id": "p02935", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou have a pot and N ingredients. Each ingredient has a real number parameter called value, and the value of the i-th ingredient (1 \\leq i \\leq N) is v_i.\n\nWhen you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 where x and y are the values of the ingredients consumed, and you can put this ingredient again in the pot.\n\nAfter you compose ingredients in this way N-1 times, you will end up with one ingredient. Find the maximum possible value of this ingredient.\n\nConstraints\n\n2 \\leq N \\leq 50\n\n1 \\leq v_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nv_1 v_2 \\ldots v_N\n\nOutput\n\nPrint a decimal number (or an integer) representing the maximum possible value of the last ingredient remaining.\n\nYour output will be judged correct when its absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n3 4\n\nSample Output 1\n\n3.5\n\nIf you start with two ingredients, the only choice is to put both of them in the pot. The value of the ingredient resulting from the ingredients of values 3 and 4 is (3 + 4) / 2 = 3.5.\n\nPrinting 3.50001, 3.49999, and so on will also be accepted.\n\nSample Input 2\n\n3\n500 300 200\n\nSample Output 2\n\n375\n\nYou start with three ingredients this time, and you can choose what to use in the first composition. There are three possible choices:\n\nUse the ingredients of values 500 and 300 to produce an ingredient of value (500 + 300) / 2 = 400. The next composition will use this ingredient and the ingredient of value 200, resulting in an ingredient of value (400 + 200) / 2 = 300.\n\nUse the ingredients of values 500 and 200 to produce an ingredient of value (500 + 200) / 2 = 350. The next composition will use this ingredient and the ingredient of value 300, resulting in an ingredient of value (350 + 300) / 2 = 325.\n\nUse the ingredients of values 300 and 200 to produce an ingredient of value (300 + 200) / 2 = 250. The next composition will use this ingredient and the ingredient of value 500, resulting in an ingredient of value (250 + 500) / 2 = 375.\n\nThus, the maximum possible value of the last ingredient remaining is 375.\n\nPrinting 375.0 and so on will also be accepted.\n\nSample Input 3\n\n5\n138 138 138 138 138\n\nSample Output 3\n\n138", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 231, "cpu_time_ms": 18, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s609594257", "group_id": "codeNet:p02937", "input_text": "import sys\nimport bisect\n\nsys.setrecursionlimit(10 ** 7)\nf_inf = float('inf')\nmod = 10 ** 9 + 7\nalphabet = [chr(i) for i in range(97, 97 + 26)]\n\n\ndef resolve():\n S = input()\n T = input()\n\n n = len(S)\n m = len(T)\n\n idx = [[] for _ in range(26)]\n for i in range(n):\n idx[alphabet.index(S[i])].append(i)\n\n for i in range(n):\n idx[alphabet.index(S[i])].append(i + n)\n\n res = 0\n pos = 0\n for i in range(m):\n c = alphabet.index(T[i])\n if len(idx[c]) == 0:\n print(-1)\n break\n pos = idx[c][bisect.bisect_left(idx[c], pos)] + 1\n if pos >= n:\n pos -= n\n res += n\n else:\n res += pos\n print(res)\n\n\nif __name__ == '__main__':\n resolve()\n", "language": "Python", "metadata": {"date": 1590593092, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02937.html", "problem_id": "p02937", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02937/input.txt", "sample_output_relpath": "derived/input_output/data/p02937/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02937/Python/s609594257.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s609594257", "user_id": "u489959379"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "import sys\nimport bisect\n\nsys.setrecursionlimit(10 ** 7)\nf_inf = float('inf')\nmod = 10 ** 9 + 7\nalphabet = [chr(i) for i in range(97, 97 + 26)]\n\n\ndef resolve():\n S = input()\n T = input()\n\n n = len(S)\n m = len(T)\n\n idx = [[] for _ in range(26)]\n for i in range(n):\n idx[alphabet.index(S[i])].append(i)\n\n for i in range(n):\n idx[alphabet.index(S[i])].append(i + n)\n\n res = 0\n pos = 0\n for i in range(m):\n c = alphabet.index(T[i])\n if len(idx[c]) == 0:\n print(-1)\n break\n pos = idx[c][bisect.bisect_left(idx[c], pos)] + 1\n if pos >= n:\n pos -= n\n res += n\n else:\n res += pos\n print(res)\n\n\nif __name__ == '__main__':\n resolve()\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nGiven are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists.\n\nLet s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\\ldots{s'}_i (the first i characters in s').\n\nNotes\n\nA subsequence of a string a is a string obtained by deleting zero or more characters from a and concatenating the remaining characters without changing the relative order. For example, the subsequences of contest include net, c, and contest.\n\nConstraints\n\n1 \\leq |s| \\leq 10^5\n\n1 \\leq |t| \\leq 10^5\n\ns and t consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nIf there exists an integer i satisfying the following condition, print the minimum such i; otherwise, print -1.\n\nSample Input 1\n\ncontest\nson\n\nSample Output 1\n\n10\n\nt = son is a subsequence of the string contestcon (the first 10 characters in s' = contestcontestcontest...), so i = 10 satisfies the condition.\n\nOn the other hand, t is not a subsequence of the string contestco (the first 9 characters in s'), so i = 9 does not satisfy the condition.\n\nSimilarly, any integer less than 9 does not satisfy the condition, either. Thus, the minimum integer i satisfying the condition is 10.\n\nSample Input 2\n\ncontest\nprogramming\n\nSample Output 2\n\n-1\n\nt = programming is not a substring of s' = contestcontestcontest.... Thus, there is no integer i satisfying the condition.\n\nSample Input 3\n\ncontest\nsentence\n\nSample Output 3\n\n33\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "sample_input": "contest\nson\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02937", "source_text": "Score : 500 points\n\nProblem Statement\n\nGiven are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists.\n\nLet s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\\ldots{s'}_i (the first i characters in s').\n\nNotes\n\nA subsequence of a string a is a string obtained by deleting zero or more characters from a and concatenating the remaining characters without changing the relative order. For example, the subsequences of contest include net, c, and contest.\n\nConstraints\n\n1 \\leq |s| \\leq 10^5\n\n1 \\leq |t| \\leq 10^5\n\ns and t consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nIf there exists an integer i satisfying the following condition, print the minimum such i; otherwise, print -1.\n\nSample Input 1\n\ncontest\nson\n\nSample Output 1\n\n10\n\nt = son is a subsequence of the string contestcon (the first 10 characters in s' = contestcontestcontest...), so i = 10 satisfies the condition.\n\nOn the other hand, t is not a subsequence of the string contestco (the first 9 characters in s'), so i = 9 does not satisfy the condition.\n\nSimilarly, any integer less than 9 does not satisfy the condition, either. Thus, the minimum integer i satisfying the condition is 10.\n\nSample Input 2\n\ncontest\nprogramming\n\nSample Output 2\n\n-1\n\nt = programming is not a substring of s' = contestcontestcontest.... Thus, there is no integer i satisfying the condition.\n\nSample Input 3\n\ncontest\nsentence\n\nSample Output 3\n\n33\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 760, "cpu_time_ms": 269, "memory_kb": 11892}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s030194651", "group_id": "codeNet:p02937", "input_text": "#!/usr/bin/env python3\nfrom collections import defaultdict,deque\nfrom heapq import heappush, heappop\nfrom bisect import bisect_left, bisect_right\nimport sys, random, itertools, math\nsys.setrecursionlimit(10**5)\ninput = sys.stdin.readline\nsqrt = math.sqrt\ndef LI(): return list(map(int, input().split()))\ndef LF(): return list(map(float, input().split()))\ndef LI_(): return list(map(lambda x: int(x)-1, input().split()))\ndef II(): return int(input())\ndef IF(): return float(input())\ndef LS(): return list(map(list, input().split()))\ndef S(): return list(input().rstrip())\ndef IR(n): return [II() for _ in range(n)]\ndef LIR(n): return [LI() for _ in range(n)]\ndef FR(n): return [IF() for _ in range(n)]\ndef LFR(n): return [LI() for _ in range(n)]\ndef LIR_(n): return [LI_() for _ in range(n)]\ndef SR(n): return [S() for _ in range(n)]\ndef LSR(n): return [LS() for _ in range(n)]\nmod = 1000000007\ninf = float('INF')\n\n#A\ndef A():\n d = {\"Sunny\":1 , \"Cloudy\":2, \"Rainy\":0}\n a = [\"Sunny\", \"Cloudy\", \"Rainy\"]\n print(a[d[input().rstrip()]])\n return\n\n#B\ndef B():\n s = S()\n for i, si in enumerate(s):\n if i % 2:\n if si == \"R\":\n print(\"No\")\n return\n else:\n if si == \"L\":\n print(\"No\")\n return\n print(\"Yes\")\n return\n\n#C\ndef C():\n n, k, q = LI()\n d = [0] * n\n for _ in range(q):\n a = II() - 1\n d[a] += 1\n for a in d:\n if k - (q - a) > 0:\n print(\"Yes\")\n else:\n print(\"No\")\n return\n\n#D\ndef D():\n n,m = LI()\n a = LI()\n q = []\n for ai in a:\n heappush(q, -ai)\n for _ in range(m):\n heappush(q, heappop(q) / 2)\n ans = 0\n while q:\n ans += int(-heappop(q))\n print(ans)\n return\n\n#E\ndef E():\n s = S()\n t = S()\n d = defaultdict(list)\n for i,si in enumerate(s):\n d[si].append(i)\n if d[t[0]] == []:\n print(-1)\n return\n before = d[t[0]][0]\n ans = 0\n for ti in t[1:]:\n if d[ti] == []:\n print(-1)\n return\n a = d[ti]\n index = bisect_right(a, before)\n if index == len(a):\n ans += 1\n before = a[0]\n else:\n before = a[index]\n print(ans * len(s) + before + 1)\n return\n\n#F\ndef F():\n return\n\n#Solve\nif __name__ == '__main__':\n E()\n", "language": "Python", "metadata": {"date": 1569530726, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02937.html", "problem_id": "p02937", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02937/input.txt", "sample_output_relpath": "derived/input_output/data/p02937/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02937/Python/s030194651.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s030194651", "user_id": "u423585790"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "#!/usr/bin/env python3\nfrom collections import defaultdict,deque\nfrom heapq import heappush, heappop\nfrom bisect import bisect_left, bisect_right\nimport sys, random, itertools, math\nsys.setrecursionlimit(10**5)\ninput = sys.stdin.readline\nsqrt = math.sqrt\ndef LI(): return list(map(int, input().split()))\ndef LF(): return list(map(float, input().split()))\ndef LI_(): return list(map(lambda x: int(x)-1, input().split()))\ndef II(): return int(input())\ndef IF(): return float(input())\ndef LS(): return list(map(list, input().split()))\ndef S(): return list(input().rstrip())\ndef IR(n): return [II() for _ in range(n)]\ndef LIR(n): return [LI() for _ in range(n)]\ndef FR(n): return [IF() for _ in range(n)]\ndef LFR(n): return [LI() for _ in range(n)]\ndef LIR_(n): return [LI_() for _ in range(n)]\ndef SR(n): return [S() for _ in range(n)]\ndef LSR(n): return [LS() for _ in range(n)]\nmod = 1000000007\ninf = float('INF')\n\n#A\ndef A():\n d = {\"Sunny\":1 , \"Cloudy\":2, \"Rainy\":0}\n a = [\"Sunny\", \"Cloudy\", \"Rainy\"]\n print(a[d[input().rstrip()]])\n return\n\n#B\ndef B():\n s = S()\n for i, si in enumerate(s):\n if i % 2:\n if si == \"R\":\n print(\"No\")\n return\n else:\n if si == \"L\":\n print(\"No\")\n return\n print(\"Yes\")\n return\n\n#C\ndef C():\n n, k, q = LI()\n d = [0] * n\n for _ in range(q):\n a = II() - 1\n d[a] += 1\n for a in d:\n if k - (q - a) > 0:\n print(\"Yes\")\n else:\n print(\"No\")\n return\n\n#D\ndef D():\n n,m = LI()\n a = LI()\n q = []\n for ai in a:\n heappush(q, -ai)\n for _ in range(m):\n heappush(q, heappop(q) / 2)\n ans = 0\n while q:\n ans += int(-heappop(q))\n print(ans)\n return\n\n#E\ndef E():\n s = S()\n t = S()\n d = defaultdict(list)\n for i,si in enumerate(s):\n d[si].append(i)\n if d[t[0]] == []:\n print(-1)\n return\n before = d[t[0]][0]\n ans = 0\n for ti in t[1:]:\n if d[ti] == []:\n print(-1)\n return\n a = d[ti]\n index = bisect_right(a, before)\n if index == len(a):\n ans += 1\n before = a[0]\n else:\n before = a[index]\n print(ans * len(s) + before + 1)\n return\n\n#F\ndef F():\n return\n\n#Solve\nif __name__ == '__main__':\n E()\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nGiven are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists.\n\nLet s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\\ldots{s'}_i (the first i characters in s').\n\nNotes\n\nA subsequence of a string a is a string obtained by deleting zero or more characters from a and concatenating the remaining characters without changing the relative order. For example, the subsequences of contest include net, c, and contest.\n\nConstraints\n\n1 \\leq |s| \\leq 10^5\n\n1 \\leq |t| \\leq 10^5\n\ns and t consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nIf there exists an integer i satisfying the following condition, print the minimum such i; otherwise, print -1.\n\nSample Input 1\n\ncontest\nson\n\nSample Output 1\n\n10\n\nt = son is a subsequence of the string contestcon (the first 10 characters in s' = contestcontestcontest...), so i = 10 satisfies the condition.\n\nOn the other hand, t is not a subsequence of the string contestco (the first 9 characters in s'), so i = 9 does not satisfy the condition.\n\nSimilarly, any integer less than 9 does not satisfy the condition, either. Thus, the minimum integer i satisfying the condition is 10.\n\nSample Input 2\n\ncontest\nprogramming\n\nSample Output 2\n\n-1\n\nt = programming is not a substring of s' = contestcontestcontest.... Thus, there is no integer i satisfying the condition.\n\nSample Input 3\n\ncontest\nsentence\n\nSample Output 3\n\n33\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "sample_input": "contest\nson\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02937", "source_text": "Score : 500 points\n\nProblem Statement\n\nGiven are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists.\n\nLet s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\\ldots{s'}_i (the first i characters in s').\n\nNotes\n\nA subsequence of a string a is a string obtained by deleting zero or more characters from a and concatenating the remaining characters without changing the relative order. For example, the subsequences of contest include net, c, and contest.\n\nConstraints\n\n1 \\leq |s| \\leq 10^5\n\n1 \\leq |t| \\leq 10^5\n\ns and t consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nIf there exists an integer i satisfying the following condition, print the minimum such i; otherwise, print -1.\n\nSample Input 1\n\ncontest\nson\n\nSample Output 1\n\n10\n\nt = son is a subsequence of the string contestcon (the first 10 characters in s' = contestcontestcontest...), so i = 10 satisfies the condition.\n\nOn the other hand, t is not a subsequence of the string contestco (the first 9 characters in s'), so i = 9 does not satisfy the condition.\n\nSimilarly, any integer less than 9 does not satisfy the condition, either. Thus, the minimum integer i satisfying the condition is 10.\n\nSample Input 2\n\ncontest\nprogramming\n\nSample Output 2\n\n-1\n\nt = programming is not a substring of s' = contestcontestcontest.... Thus, there is no integer i satisfying the condition.\n\nSample Input 3\n\ncontest\nsentence\n\nSample Output 3\n\n33\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2372, "cpu_time_ms": 275, "memory_kb": 59888}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s415557570", "group_id": "codeNet:p02937", "input_text": "s=input().rstrip()\nx=list(s)\nt=input().rstrip()\ny=list(t)\nfor i in range(0,len(y)):\n if y[i] not in x:\n print(-1)\n break;\nelse:\n C=0;\n D=0;\n for i in range(0,len(y)):\n T=y[i]\n CC=x[C:len(x)]\n if T in CC:\n V=CC.index(T)\n C=V+C;\n else:\n D+=1;\n V=x.index(T)\n C=V;\n print(D*len(x) + C+1)\n", "language": "Python", "metadata": {"date": 1566179866, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02937.html", "problem_id": "p02937", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02937/input.txt", "sample_output_relpath": "derived/input_output/data/p02937/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02937/Python/s415557570.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s415557570", "user_id": "u323120917"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "s=input().rstrip()\nx=list(s)\nt=input().rstrip()\ny=list(t)\nfor i in range(0,len(y)):\n if y[i] not in x:\n print(-1)\n break;\nelse:\n C=0;\n D=0;\n for i in range(0,len(y)):\n T=y[i]\n CC=x[C:len(x)]\n if T in CC:\n V=CC.index(T)\n C=V+C;\n else:\n D+=1;\n V=x.index(T)\n C=V;\n print(D*len(x) + C+1)\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nGiven are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists.\n\nLet s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\\ldots{s'}_i (the first i characters in s').\n\nNotes\n\nA subsequence of a string a is a string obtained by deleting zero or more characters from a and concatenating the remaining characters without changing the relative order. For example, the subsequences of contest include net, c, and contest.\n\nConstraints\n\n1 \\leq |s| \\leq 10^5\n\n1 \\leq |t| \\leq 10^5\n\ns and t consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nIf there exists an integer i satisfying the following condition, print the minimum such i; otherwise, print -1.\n\nSample Input 1\n\ncontest\nson\n\nSample Output 1\n\n10\n\nt = son is a subsequence of the string contestcon (the first 10 characters in s' = contestcontestcontest...), so i = 10 satisfies the condition.\n\nOn the other hand, t is not a subsequence of the string contestco (the first 9 characters in s'), so i = 9 does not satisfy the condition.\n\nSimilarly, any integer less than 9 does not satisfy the condition, either. Thus, the minimum integer i satisfying the condition is 10.\n\nSample Input 2\n\ncontest\nprogramming\n\nSample Output 2\n\n-1\n\nt = programming is not a substring of s' = contestcontestcontest.... Thus, there is no integer i satisfying the condition.\n\nSample Input 3\n\ncontest\nsentence\n\nSample Output 3\n\n33\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "sample_input": "contest\nson\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02937", "source_text": "Score : 500 points\n\nProblem Statement\n\nGiven are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists.\n\nLet s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\\ldots{s'}_i (the first i characters in s').\n\nNotes\n\nA subsequence of a string a is a string obtained by deleting zero or more characters from a and concatenating the remaining characters without changing the relative order. For example, the subsequences of contest include net, c, and contest.\n\nConstraints\n\n1 \\leq |s| \\leq 10^5\n\n1 \\leq |t| \\leq 10^5\n\ns and t consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nIf there exists an integer i satisfying the following condition, print the minimum such i; otherwise, print -1.\n\nSample Input 1\n\ncontest\nson\n\nSample Output 1\n\n10\n\nt = son is a subsequence of the string contestcon (the first 10 characters in s' = contestcontestcontest...), so i = 10 satisfies the condition.\n\nOn the other hand, t is not a subsequence of the string contestco (the first 9 characters in s'), so i = 9 does not satisfy the condition.\n\nSimilarly, any integer less than 9 does not satisfy the condition, either. Thus, the minimum integer i satisfying the condition is 10.\n\nSample Input 2\n\ncontest\nprogramming\n\nSample Output 2\n\n-1\n\nt = programming is not a substring of s' = contestcontestcontest.... Thus, there is no integer i satisfying the condition.\n\nSample Input 3\n\ncontest\nsentence\n\nSample Output 3\n\n33\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 396, "cpu_time_ms": 2104, "memory_kb": 7176}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s932585024", "group_id": "codeNet:p02938", "input_text": "L, R = map(int, input().split())\ndp = [[[[0]*2 for _ in range(2)] for _ in range(2)] for _ in range(65)]\ndp[0][0][0][0] = 1\nMOD = 10**9+7\n\nfor i in range(64):\n Li = (L>>(63-i))&1\n Ri = (R>>(63-i))&1\n \n for j in range(2):\n for k in range(2):\n for l in range(2):\n for x in (range(2) if j else range(Li, 2)):\n for y in range(2 if k else Ri+1):\n if x==1 and y==0:\n continue\n \n if l==0 and x==0 and y==1:\n continue\n \n dp[i+1][j|(x>Li)][k|(yLi)][k|(y>(63-i))&1\n Ri = (R>>(63-i))&1\n \n for j in range(2):\n for k in range(2):\n for l in range(2):\n for x in (range(2) if j else range(Li, 2)):\n for y in range(2 if k else Ri+1):\n if x==1 and y==0:\n continue\n \n if l==0 and x==0 and y==1:\n continue\n \n dp[i+1][j|(x>Li)][k|(yLi)][k|(y 0:\n i = 0\n while True:\n if h + i >= mod :\n h = 0\n i = 0\n if hs[h+i][1] == s:\n hs[h+i][0] += 1\n break\n i += 1\n else:\n hs[h][0] += 1\n hs[h][1] += s\n\nans = 0\nfor j, t in hs:\n if j >= 2:\n ans += j * (j-1) / 2\n\nprint(int(ans))\n\n\n", "language": "Python", "metadata": {"date": 1593967754, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02947.html", "problem_id": "p02947", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02947/input.txt", "sample_output_relpath": "derived/input_output/data/p02947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02947/Python/s652444523.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s652444523", "user_id": "u086438369"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import sys\ninput = sys.stdin.readline\n\nn = int(input())\nsn = [input().strip('\\n') for _ in range(n)]\n\nmod = 10**5 + 7\nhs = [[0, ''] for _ in range(mod)]\n\ndef hypo(s, Mod):\n h_num = 1\n for i in s:\n h_num = h_num * ord(i) % Mod\n return h_num\n\nfor s in sn:\n s = ''.join(sorted(s))\n h = hypo(s, mod)\n if hs[h][0] > 0:\n i = 0\n while True:\n if h + i >= mod :\n h = 0\n i = 0\n if hs[h+i][1] == s:\n hs[h+i][0] += 1\n break\n i += 1\n else:\n hs[h][0] += 1\n hs[h][1] += s\n\nans = 0\nfor j, t in hs:\n if j >= 2:\n ans += j * (j-1) / 2\n\nprint(int(ans))\n\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "sample_input": "3\nacornistnt\npeanutbomb\nconstraint\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02947", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 694, "cpu_time_ms": 2206, "memory_kb": 24892}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s461047136", "group_id": "codeNet:p02947", "input_text": "n = int(input())\ns = [\"\".join(sorted(str(input()))) for i in range(n)]\nd = {}\nans = 0\nfor i in s:\n if i not in d:\n d[i] = 0\n else:\n d[i] += 1\n ans += d[i]\nprint(ans)", "language": "Python", "metadata": {"date": 1584502810, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02947.html", "problem_id": "p02947", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02947/input.txt", "sample_output_relpath": "derived/input_output/data/p02947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02947/Python/s461047136.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s461047136", "user_id": "u738898077"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "n = int(input())\ns = [\"\".join(sorted(str(input()))) for i in range(n)]\nd = {}\nans = 0\nfor i in s:\n if i not in d:\n d[i] = 0\n else:\n d[i] += 1\n ans += d[i]\nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "sample_input": "3\nacornistnt\npeanutbomb\nconstraint\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02947", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 192, "cpu_time_ms": 367, "memory_kb": 19528}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s346962435", "group_id": "codeNet:p02947", "input_text": "n=int(input())\ns=[]\nfor i in range(n):\n x=input()\n y=[]\n for i in x:\n y.append(i)\n y.sort()\n s.append(''.join(y))\n\nd=dict()\n\nfor i in range(n):\n if s[i] not in d.keys():\n d[s[i]]=1\n else:\n d[s[i]]+=1\nans=0\nfor v in d.values():\n ans+=v*(v-1)/2\nprint(int(ans))", "language": "Python", "metadata": {"date": 1582139854, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02947.html", "problem_id": "p02947", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02947/input.txt", "sample_output_relpath": "derived/input_output/data/p02947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02947/Python/s346962435.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s346962435", "user_id": "u210827208"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "n=int(input())\ns=[]\nfor i in range(n):\n x=input()\n y=[]\n for i in x:\n y.append(i)\n y.sort()\n s.append(''.join(y))\n\nd=dict()\n\nfor i in range(n):\n if s[i] not in d.keys():\n d[s[i]]=1\n else:\n d[s[i]]+=1\nans=0\nfor v in d.values():\n ans+=v*(v-1)/2\nprint(int(ans))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "sample_input": "3\nacornistnt\npeanutbomb\nconstraint\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02947", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 303, "cpu_time_ms": 479, "memory_kb": 19484}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s072538842", "group_id": "codeNet:p02947", "input_text": "import math\nn = int(input())\nl = [input() for _ in range(n)]\nl = [sorted([j for j in i]) for i in l]\nl = [\"\".join(i) for i in l]\nal = list(set(l))\nans_dict = {}\nfor i in l:\n if i in ans_dict:\n ans_dict[i]+=1\n else:\n ans_dict[i] = 1\n ans = 0\nfor i in al:\n if ans_dict[i] > 1:\n ans += (math.factorial(ans_dict[i])//math.factorial(2))\n \nprint(ans)", "language": "Python", "metadata": {"date": 1565747686, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02947.html", "problem_id": "p02947", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02947/input.txt", "sample_output_relpath": "derived/input_output/data/p02947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02947/Python/s072538842.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s072538842", "user_id": "u733608212"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import math\nn = int(input())\nl = [input() for _ in range(n)]\nl = [sorted([j for j in i]) for i in l]\nl = [\"\".join(i) for i in l]\nal = list(set(l))\nans_dict = {}\nfor i in l:\n if i in ans_dict:\n ans_dict[i]+=1\n else:\n ans_dict[i] = 1\n ans = 0\nfor i in al:\n if ans_dict[i] > 1:\n ans += (math.factorial(ans_dict[i])//math.factorial(2))\n \nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "sample_input": "3\nacornistnt\npeanutbomb\nconstraint\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02947", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 380, "cpu_time_ms": 2105, "memory_kb": 31256}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s887939747", "group_id": "codeNet:p02947", "input_text": "N = int(input())\n\nlst = []\n\nfor i in range(N):\n lst.append(\"\".join(sorted(list(input()))))\n\n\nd={}\ncount = 0\n\nfor i in lst:\n if not i in d:\n d[i] = 1\n continue\n else:\n d[i] = d[i] + 1\n count = count + d[i]-1\n\n\nprint(count)\n", "language": "Python", "metadata": {"date": 1565501275, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02947.html", "problem_id": "p02947", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02947/input.txt", "sample_output_relpath": "derived/input_output/data/p02947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02947/Python/s887939747.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s887939747", "user_id": "u492447501"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "N = int(input())\n\nlst = []\n\nfor i in range(N):\n lst.append(\"\".join(sorted(list(input()))))\n\n\nd={}\ncount = 0\n\nfor i in lst:\n if not i in d:\n d[i] = 1\n continue\n else:\n d[i] = d[i] + 1\n count = count + d[i]-1\n\n\nprint(count)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "sample_input": "3\nacornistnt\npeanutbomb\nconstraint\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02947", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 239, "cpu_time_ms": 397, "memory_kb": 19504}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s806767926", "group_id": "codeNet:p02947", "input_text": "# -*- coding: utf-8 -*-\nN = int(raw_input())\ncnt = 0\ndic = {}\n\nfor _ in xrange(N):\n\trs = ''.join(sorted(raw_input()))\n\t\n\tif rs in dic:\n\t\tcnt += dic[rs]\n\t\tdic[rs] += 1\n\telse:\n\t\tdic[rs] = 1\nprint cnt", "language": "Python", "metadata": {"date": 1565494114, "filename_ext": "py", "original_language": "Python (2.7.6)", "problem_description_relpath": "problem_descriptions/p02947.html", "problem_id": "p02947", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02947/input.txt", "sample_output_relpath": "derived/input_output/data/p02947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02947/Python/s806767926.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s806767926", "user_id": "u581731684"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "# -*- coding: utf-8 -*-\nN = int(raw_input())\ncnt = 0\ndic = {}\n\nfor _ in xrange(N):\n\trs = ''.join(sorted(raw_input()))\n\t\n\tif rs in dic:\n\t\tcnt += dic[rs]\n\t\tdic[rs] += 1\n\telse:\n\t\tdic[rs] = 1\nprint cnt", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "sample_input": "3\nacornistnt\npeanutbomb\nconstraint\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02947", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 197, "cpu_time_ms": 289, "memory_kb": 16060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s936223228", "group_id": "codeNet:p02948", "input_text": "'''\nrows , days = map(int,input().split())\ntotal = 0\narr2 = [[] for _ in range(days)]\n\nfor i in range(rows):\n day , r = list(map(int,input().split()))\n if day <= days:\n arr2[day].append(r)\n\nprint(arr2)\n'''\n\n#標準入力受け取り\nN, M = list(map(int, input().split()))\njobs = [[] for _ in range(M)]\n\nfor i in range(N):\n d, r = list(map(int, input().split()))\n if d-1 < M:\n jobs[d-1].append(r)\n\nprint(jobs)\n#解法\nrewards = 0\nli = []\nfor i in range(M):\n #候補をリストに追加(給料が間に合うもの仕事が一日ごとに増える)\n li.extend(jobs[i])\n if len(li) >0:\n #最大値を求める(給料が高いバイトをしたい)\n reward = max(li)\n rewards += reward\n #使った値は取り除く(同じバイトはNGのため)\n li.remove(reward)\n\nprint(rewards)", "language": "Python", "metadata": {"date": 1565584833, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02948.html", "problem_id": "p02948", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02948/input.txt", "sample_output_relpath": "derived/input_output/data/p02948/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02948/Python/s936223228.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s936223228", "user_id": "u239756332"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "'''\nrows , days = map(int,input().split())\ntotal = 0\narr2 = [[] for _ in range(days)]\n\nfor i in range(rows):\n day , r = list(map(int,input().split()))\n if day <= days:\n arr2[day].append(r)\n\nprint(arr2)\n'''\n\n#標準入力受け取り\nN, M = list(map(int, input().split()))\njobs = [[] for _ in range(M)]\n\nfor i in range(N):\n d, r = list(map(int, input().split()))\n if d-1 < M:\n jobs[d-1].append(r)\n\nprint(jobs)\n#解法\nrewards = 0\nli = []\nfor i in range(M):\n #候補をリストに追加(給料が間に合うもの仕事が一日ごとに増える)\n li.extend(jobs[i])\n if len(li) >0:\n #最大値を求める(給料が高いバイトをしたい)\n reward = max(li)\n rewards += reward\n #使った値は取り除く(同じバイトはNGのため)\n li.remove(reward)\n\nprint(rewards)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.\n\nYou can take and complete at most one of these jobs in a day.\n\nHowever, you cannot retake a job that you have already done.\n\nFind the maximum total reward that you can earn no later than M days from today.\n\nYou can already start working today.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i \\leq 10^5\n\n1 \\leq B_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the maximum total reward that you can earn no later than M days from today.\n\nSample Input 1\n\n3 4\n4 3\n4 1\n2 2\n\nSample Output 1\n\n5\n\nYou can earn the total reward of 5 by taking the jobs as follows:\n\nTake and complete the first job today. You will earn the reward of 3 after four days from today.\n\nTake and complete the third job tomorrow. You will earn the reward of 2 after two days from tomorrow, that is, after three days from today.\n\nSample Input 2\n\n5 3\n1 2\n1 3\n1 4\n2 1\n2 3\n\nSample Output 2\n\n10\n\nSample Input 3\n\n1 1\n2 1\n\nSample Output 3\n\n0", "sample_input": "3 4\n4 3\n4 1\n2 2\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02948", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.\n\nYou can take and complete at most one of these jobs in a day.\n\nHowever, you cannot retake a job that you have already done.\n\nFind the maximum total reward that you can earn no later than M days from today.\n\nYou can already start working today.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i \\leq 10^5\n\n1 \\leq B_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the maximum total reward that you can earn no later than M days from today.\n\nSample Input 1\n\n3 4\n4 3\n4 1\n2 2\n\nSample Output 1\n\n5\n\nYou can earn the total reward of 5 by taking the jobs as follows:\n\nTake and complete the first job today. You will earn the reward of 3 after four days from today.\n\nTake and complete the third job tomorrow. You will earn the reward of 2 after two days from tomorrow, that is, after three days from today.\n\nSample Input 2\n\n5 3\n1 2\n1 3\n1 4\n2 1\n2 3\n\nSample Output 2\n\n10\n\nSample Input 3\n\n1 1\n2 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 848, "cpu_time_ms": 2105, "memory_kb": 25768}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s973631323", "group_id": "codeNet:p02948", "input_text": "# 2019 8/10\n# ABC137 D Summer Vacation\n\ninfo = []\nreword = 0\nday = 0\n\nN, M = map(int, input().split())\n\nfor i in range(N):\n A, B = map(int, input().split())\n info.append([B, A])\n\ninfo.sort(reverse=True)\nprint(info)\n\nfor i in range(N):\n if day > M:\n break\n\n if info[i][1] + day <= M:\n reword += info[i][0]\n day += 1\n\n\nprint(reword)\n\n\n", "language": "Python", "metadata": {"date": 1565488188, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02948.html", "problem_id": "p02948", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02948/input.txt", "sample_output_relpath": "derived/input_output/data/p02948/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02948/Python/s973631323.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s973631323", "user_id": "u669787859"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "# 2019 8/10\n# ABC137 D Summer Vacation\n\ninfo = []\nreword = 0\nday = 0\n\nN, M = map(int, input().split())\n\nfor i in range(N):\n A, B = map(int, input().split())\n info.append([B, A])\n\ninfo.sort(reverse=True)\nprint(info)\n\nfor i in range(N):\n if day > M:\n break\n\n if info[i][1] + day <= M:\n reword += info[i][0]\n day += 1\n\n\nprint(reword)\n\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.\n\nYou can take and complete at most one of these jobs in a day.\n\nHowever, you cannot retake a job that you have already done.\n\nFind the maximum total reward that you can earn no later than M days from today.\n\nYou can already start working today.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i \\leq 10^5\n\n1 \\leq B_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the maximum total reward that you can earn no later than M days from today.\n\nSample Input 1\n\n3 4\n4 3\n4 1\n2 2\n\nSample Output 1\n\n5\n\nYou can earn the total reward of 5 by taking the jobs as follows:\n\nTake and complete the first job today. You will earn the reward of 3 after four days from today.\n\nTake and complete the third job tomorrow. You will earn the reward of 2 after two days from tomorrow, that is, after three days from today.\n\nSample Input 2\n\n5 3\n1 2\n1 3\n1 4\n2 1\n2 3\n\nSample Output 2\n\n10\n\nSample Input 3\n\n1 1\n2 1\n\nSample Output 3\n\n0", "sample_input": "3 4\n4 3\n4 1\n2 2\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02948", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.\n\nYou can take and complete at most one of these jobs in a day.\n\nHowever, you cannot retake a job that you have already done.\n\nFind the maximum total reward that you can earn no later than M days from today.\n\nYou can already start working today.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i \\leq 10^5\n\n1 \\leq B_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the maximum total reward that you can earn no later than M days from today.\n\nSample Input 1\n\n3 4\n4 3\n4 1\n2 2\n\nSample Output 1\n\n5\n\nYou can earn the total reward of 5 by taking the jobs as follows:\n\nTake and complete the first job today. You will earn the reward of 3 after four days from today.\n\nTake and complete the third job tomorrow. You will earn the reward of 2 after two days from tomorrow, that is, after three days from today.\n\nSample Input 2\n\n5 3\n1 2\n1 3\n1 4\n2 1\n2 3\n\nSample Output 2\n\n10\n\nSample Input 3\n\n1 1\n2 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 366, "cpu_time_ms": 561, "memory_kb": 24268}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s852823722", "group_id": "codeNet:p02951", "input_text": "import math\nimport sys\n\n\n(A,B,C) = list(map(int,input().split()))\n\nprint(max(0,C - (A-B)))\n", "language": "Python", "metadata": {"date": 1584012215, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02951.html", "problem_id": "p02951", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02951/input.txt", "sample_output_relpath": "derived/input_output/data/p02951/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02951/Python/s852823722.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s852823722", "user_id": "u068692021"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import math\nimport sys\n\n\n(A,B,C) = list(map(int,input().split()))\n\nprint(max(0,C - (A-B)))\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have two bottles for holding water.\n\nBottle 1 can hold up to A milliliters of water, and now it contains B milliliters of water.\n\nBottle 2 contains C milliliters of water.\n\nWe will transfer water from Bottle 2 to Bottle 1 as much as possible.\n\nHow much amount of water will remain in Bottle 2?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq B \\leq A \\leq 20\n\n1 \\leq C \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the integer representing the amount of water, in milliliters, that will remain in Bottle 2.\n\nSample Input 1\n\n6 4 3\n\nSample Output 1\n\n1\n\nWe will transfer two milliliters of water from Bottle 2 to Bottle 1, and one milliliter of water will remain in Bottle 2.\n\nSample Input 2\n\n8 3 9\n\nSample Output 2\n\n4\n\nSample Input 3\n\n12 3 7\n\nSample Output 3\n\n0", "sample_input": "6 4 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02951", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have two bottles for holding water.\n\nBottle 1 can hold up to A milliliters of water, and now it contains B milliliters of water.\n\nBottle 2 contains C milliliters of water.\n\nWe will transfer water from Bottle 2 to Bottle 1 as much as possible.\n\nHow much amount of water will remain in Bottle 2?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq B \\leq A \\leq 20\n\n1 \\leq C \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the integer representing the amount of water, in milliliters, that will remain in Bottle 2.\n\nSample Input 1\n\n6 4 3\n\nSample Output 1\n\n1\n\nWe will transfer two milliliters of water from Bottle 2 to Bottle 1, and one milliliter of water will remain in Bottle 2.\n\nSample Input 2\n\n8 3 9\n\nSample Output 2\n\n4\n\nSample Input 3\n\n12 3 7\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 92, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s355553710", "group_id": "codeNet:p02951", "input_text": "A, B, C = map(int, input().split())\n\nX1 = B\nX2 = C\n\nmove = min(A - B, C)\n\nX1 += move\nX2 -= move\n\nprint(X2)", "language": "Python", "metadata": {"date": 1580822206, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02951.html", "problem_id": "p02951", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02951/input.txt", "sample_output_relpath": "derived/input_output/data/p02951/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02951/Python/s355553710.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s355553710", "user_id": "u537859408"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "A, B, C = map(int, input().split())\n\nX1 = B\nX2 = C\n\nmove = min(A - B, C)\n\nX1 += move\nX2 -= move\n\nprint(X2)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have two bottles for holding water.\n\nBottle 1 can hold up to A milliliters of water, and now it contains B milliliters of water.\n\nBottle 2 contains C milliliters of water.\n\nWe will transfer water from Bottle 2 to Bottle 1 as much as possible.\n\nHow much amount of water will remain in Bottle 2?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq B \\leq A \\leq 20\n\n1 \\leq C \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the integer representing the amount of water, in milliliters, that will remain in Bottle 2.\n\nSample Input 1\n\n6 4 3\n\nSample Output 1\n\n1\n\nWe will transfer two milliliters of water from Bottle 2 to Bottle 1, and one milliliter of water will remain in Bottle 2.\n\nSample Input 2\n\n8 3 9\n\nSample Output 2\n\n4\n\nSample Input 3\n\n12 3 7\n\nSample Output 3\n\n0", "sample_input": "6 4 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02951", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have two bottles for holding water.\n\nBottle 1 can hold up to A milliliters of water, and now it contains B milliliters of water.\n\nBottle 2 contains C milliliters of water.\n\nWe will transfer water from Bottle 2 to Bottle 1 as much as possible.\n\nHow much amount of water will remain in Bottle 2?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq B \\leq A \\leq 20\n\n1 \\leq C \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the integer representing the amount of water, in milliliters, that will remain in Bottle 2.\n\nSample Input 1\n\n6 4 3\n\nSample Output 1\n\n1\n\nWe will transfer two milliliters of water from Bottle 2 to Bottle 1, and one milliliter of water will remain in Bottle 2.\n\nSample Input 2\n\n8 3 9\n\nSample Output 2\n\n4\n\nSample Input 3\n\n12 3 7\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 106, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s960268132", "group_id": "codeNet:p02951", "input_text": "a, b, c = (int(x) for x in input().split(' '))\n\nd = c - (a - b)\n\nif d > 0:\n print(d)\nelse:\n print(0)\n\n", "language": "Python", "metadata": {"date": 1567451191, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02951.html", "problem_id": "p02951", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02951/input.txt", "sample_output_relpath": "derived/input_output/data/p02951/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02951/Python/s960268132.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s960268132", "user_id": "u897566476"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "a, b, c = (int(x) for x in input().split(' '))\n\nd = c - (a - b)\n\nif d > 0:\n print(d)\nelse:\n print(0)\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have two bottles for holding water.\n\nBottle 1 can hold up to A milliliters of water, and now it contains B milliliters of water.\n\nBottle 2 contains C milliliters of water.\n\nWe will transfer water from Bottle 2 to Bottle 1 as much as possible.\n\nHow much amount of water will remain in Bottle 2?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq B \\leq A \\leq 20\n\n1 \\leq C \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the integer representing the amount of water, in milliliters, that will remain in Bottle 2.\n\nSample Input 1\n\n6 4 3\n\nSample Output 1\n\n1\n\nWe will transfer two milliliters of water from Bottle 2 to Bottle 1, and one milliliter of water will remain in Bottle 2.\n\nSample Input 2\n\n8 3 9\n\nSample Output 2\n\n4\n\nSample Input 3\n\n12 3 7\n\nSample Output 3\n\n0", "sample_input": "6 4 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02951", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have two bottles for holding water.\n\nBottle 1 can hold up to A milliliters of water, and now it contains B milliliters of water.\n\nBottle 2 contains C milliliters of water.\n\nWe will transfer water from Bottle 2 to Bottle 1 as much as possible.\n\nHow much amount of water will remain in Bottle 2?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq B \\leq A \\leq 20\n\n1 \\leq C \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the integer representing the amount of water, in milliliters, that will remain in Bottle 2.\n\nSample Input 1\n\n6 4 3\n\nSample Output 1\n\n1\n\nWe will transfer two milliliters of water from Bottle 2 to Bottle 1, and one milliliter of water will remain in Bottle 2.\n\nSample Input 2\n\n8 3 9\n\nSample Output 2\n\n4\n\nSample Input 3\n\n12 3 7\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 108, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s217777456", "group_id": "codeNet:p02951", "input_text": "A, B, C = map(lambda x: int(x), input().split(' '))\nif B + C > A:\n print(B + C - A)\nelse:\n print(B + C)\n", "language": "Python", "metadata": {"date": 1564970641, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02951.html", "problem_id": "p02951", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02951/input.txt", "sample_output_relpath": "derived/input_output/data/p02951/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02951/Python/s217777456.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s217777456", "user_id": "u673101577"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "A, B, C = map(lambda x: int(x), input().split(' '))\nif B + C > A:\n print(B + C - A)\nelse:\n print(B + C)\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have two bottles for holding water.\n\nBottle 1 can hold up to A milliliters of water, and now it contains B milliliters of water.\n\nBottle 2 contains C milliliters of water.\n\nWe will transfer water from Bottle 2 to Bottle 1 as much as possible.\n\nHow much amount of water will remain in Bottle 2?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq B \\leq A \\leq 20\n\n1 \\leq C \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the integer representing the amount of water, in milliliters, that will remain in Bottle 2.\n\nSample Input 1\n\n6 4 3\n\nSample Output 1\n\n1\n\nWe will transfer two milliliters of water from Bottle 2 to Bottle 1, and one milliliter of water will remain in Bottle 2.\n\nSample Input 2\n\n8 3 9\n\nSample Output 2\n\n4\n\nSample Input 3\n\n12 3 7\n\nSample Output 3\n\n0", "sample_input": "6 4 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02951", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have two bottles for holding water.\n\nBottle 1 can hold up to A milliliters of water, and now it contains B milliliters of water.\n\nBottle 2 contains C milliliters of water.\n\nWe will transfer water from Bottle 2 to Bottle 1 as much as possible.\n\nHow much amount of water will remain in Bottle 2?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq B \\leq A \\leq 20\n\n1 \\leq C \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the integer representing the amount of water, in milliliters, that will remain in Bottle 2.\n\nSample Input 1\n\n6 4 3\n\nSample Output 1\n\n1\n\nWe will transfer two milliliters of water from Bottle 2 to Bottle 1, and one milliliter of water will remain in Bottle 2.\n\nSample Input 2\n\n8 3 9\n\nSample Output 2\n\n4\n\nSample Input 3\n\n12 3 7\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 110, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s078458092", "group_id": "codeNet:p02952", "input_text": "n = input()\ndigit_n = len(str(n))\nn = int(n)\nans = 0\n\nif digit_n % 2 == 0:\n for i in range(digit_n // 2):\n ans += 9 * 10 ** (i * 2)\n\nelse:\n if digit_n != 1:\n for i in range((digit_n - 1) // 2):\n ans += 9 * 10 ** (i * 2)\n hasuu = int(str(n)[1:])\n ans += hasuu + 1\n \n else:\n ans = n\n\n \nprint(ans)\n", "language": "Python", "metadata": {"date": 1565801872, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02952.html", "problem_id": "p02952", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02952/input.txt", "sample_output_relpath": "derived/input_output/data/p02952/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02952/Python/s078458092.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s078458092", "user_id": "u186206732"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "n = input()\ndigit_n = len(str(n))\nn = int(n)\nans = 0\n\nif digit_n % 2 == 0:\n for i in range(digit_n // 2):\n ans += 9 * 10 ** (i * 2)\n\nelse:\n if digit_n != 1:\n for i in range((digit_n - 1) // 2):\n ans += 9 * 10 ** (i * 2)\n hasuu = int(str(n)[1:])\n ans += hasuu + 1\n \n else:\n ans = n\n\n \nprint(ans)\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of positive integers less than or equal to N that have an odd number of digits.\n\nSample Input 1\n\n11\n\nSample Output 1\n\n9\n\nAmong the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \\ldots, 9.\n\nSample Input 2\n\n136\n\nSample Output 2\n\n46\n\nIn addition to 1, 2, \\ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \\ldots, 136.\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n90909", "sample_input": "11\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02952", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of positive integers less than or equal to N that have an odd number of digits.\n\nSample Input 1\n\n11\n\nSample Output 1\n\n9\n\nAmong the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \\ldots, 9.\n\nSample Input 2\n\n136\n\nSample Output 2\n\n46\n\nIn addition to 1, 2, \\ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \\ldots, 136.\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n90909", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 356, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s728910137", "group_id": "codeNet:p02952", "input_text": "N=int(input())\nif 1<=N and N<10:\n\tprint(N)\nelif 10<=N and N<100:\n\tprint(\"9\")\nelif 100<=N and N<1000:\n\tprint(9+N-99)\nelif 1000<=N and N<10000:\n\tprint(\"909\")\nelif 10000<=N and N<100000:\n\tprint(909+N-9999)\nelse:\n\tprint(\"90909\")", "language": "Python", "metadata": {"date": 1565482031, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02952.html", "problem_id": "p02952", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02952/input.txt", "sample_output_relpath": "derived/input_output/data/p02952/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02952/Python/s728910137.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s728910137", "user_id": "u898058223"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "N=int(input())\nif 1<=N and N<10:\n\tprint(N)\nelif 10<=N and N<100:\n\tprint(\"9\")\nelif 100<=N and N<1000:\n\tprint(9+N-99)\nelif 1000<=N and N<10000:\n\tprint(\"909\")\nelif 10000<=N and N<100000:\n\tprint(909+N-9999)\nelse:\n\tprint(\"90909\")", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of positive integers less than or equal to N that have an odd number of digits.\n\nSample Input 1\n\n11\n\nSample Output 1\n\n9\n\nAmong the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \\ldots, 9.\n\nSample Input 2\n\n136\n\nSample Output 2\n\n46\n\nIn addition to 1, 2, \\ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \\ldots, 136.\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n90909", "sample_input": "11\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02952", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of positive integers less than or equal to N that have an odd number of digits.\n\nSample Input 1\n\n11\n\nSample Output 1\n\n9\n\nAmong the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \\ldots, 9.\n\nSample Input 2\n\n136\n\nSample Output 2\n\n46\n\nIn addition to 1, 2, \\ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \\ldots, 136.\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n90909", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 224, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s517249261", "group_id": "codeNet:p02952", "input_text": "n = int(input())\ncount = 0\n\nwhile n > 0:\n if len(str(n)) % 2 == 0:\n n -= 1\n continue\n\n count += 1\n n -= 1\n\nprint(count)\n", "language": "Python", "metadata": {"date": 1564968366, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02952.html", "problem_id": "p02952", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02952/input.txt", "sample_output_relpath": "derived/input_output/data/p02952/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02952/Python/s517249261.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s517249261", "user_id": "u600195339"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "n = int(input())\ncount = 0\n\nwhile n > 0:\n if len(str(n)) % 2 == 0:\n n -= 1\n continue\n\n count += 1\n n -= 1\n\nprint(count)\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of positive integers less than or equal to N that have an odd number of digits.\n\nSample Input 1\n\n11\n\nSample Output 1\n\n9\n\nAmong the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \\ldots, 9.\n\nSample Input 2\n\n136\n\nSample Output 2\n\n46\n\nIn addition to 1, 2, \\ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \\ldots, 136.\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n90909", "sample_input": "11\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02952", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of positive integers less than or equal to N that have an odd number of digits.\n\nSample Input 1\n\n11\n\nSample Output 1\n\n9\n\nAmong the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \\ldots, 9.\n\nSample Input 2\n\n136\n\nSample Output 2\n\n46\n\nIn addition to 1, 2, \\ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \\ldots, 136.\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n90909", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 143, "cpu_time_ms": 62, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s527801044", "group_id": "codeNet:p02954", "input_text": "S = input()\n#dp_roop[position] = roop\ndp_roop = {}\ndp_mod2 = {}\n\nResult = [0] * len(S)\ncounted = set()\n\n\ndef roop_from(position):\n head = []\n visited = set()\n while position not in visited:\n head.append(position)\n visited.add(position)\n #print(position, head, visited)\n if S[position] == \"R\":\n position += 1\n else:\n position -= 1\n\n roop = head[head.index(position):]\n return head, roop\n\ndef register(head, roop):\n for i, position in enumerate(head):\n if position not in counted:\n mod2 = (len(head) + i) % 2\n Result[roop[mod2]] += 1\n counted.add(position)\n\nfor i in range(0, len(S)):\n if i not in counted:\n #print(i)\n head, roop = roop_from(i)\n register(head, roop)\n\nprint(*Result, sep=\" \")", "language": "Python", "metadata": {"date": 1589304884, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02954.html", "problem_id": "p02954", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02954/input.txt", "sample_output_relpath": "derived/input_output/data/p02954/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02954/Python/s527801044.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s527801044", "user_id": "u332657092"}, "prompt_components": {"gold_output": "0 1 2 1 1\n", "input_to_evaluate": "S = input()\n#dp_roop[position] = roop\ndp_roop = {}\ndp_mod2 = {}\n\nResult = [0] * len(S)\ncounted = set()\n\n\ndef roop_from(position):\n head = []\n visited = set()\n while position not in visited:\n head.append(position)\n visited.add(position)\n #print(position, head, visited)\n if S[position] == \"R\":\n position += 1\n else:\n position -= 1\n\n roop = head[head.index(position):]\n return head, roop\n\ndef register(head, roop):\n for i, position in enumerate(head):\n if position not in counted:\n mod2 = (len(head) + i) % 2\n Result[roop[mod2]] += 1\n counted.add(position)\n\nfor i in range(0, len(S)):\n if i not in counted:\n #print(i)\n head, roop = roop_from(i)\n register(head, roop)\n\nprint(*Result, sep=\" \")", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a string S consisting of L and R.\n\nLet N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square from the left.\n\nThe character written on the leftmost square is always R, and the character written on the rightmost square is always L.\n\nInitially, one child is standing on each square.\n\nEach child will perform the move below 10^{100} times:\n\nMove one square in the direction specified by the character written in the square on which the child is standing. L denotes left, and R denotes right.\n\nFind the number of children standing on each square after the children performed the moves.\n\nConstraints\n\nS is a string of length between 2 and 10^5 (inclusive).\n\nEach character of S is L or R.\n\nThe first and last characters of S are R and L, respectively.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of children standing on each square after the children performed the moves, in order from left to right.\n\nSample Input 1\n\nRRLRL\n\nSample Output 1\n\n0 1 2 1 1\n\nAfter each child performed one move, the number of children standing on each square is 0, 2, 1, 1, 1 from left to right.\n\nAfter each child performed two moves, the number of children standing on each square is 0, 1, 2, 1, 1 from left to right.\n\nAfter each child performed 10^{100} moves, the number of children standing on each square is 0, 1, 2, 1, 1 from left to right.\n\nSample Input 2\n\nRRLLLLRLRRLL\n\nSample Output 2\n\n0 3 3 0 0 0 1 1 0 2 2 0\n\nSample Input 3\n\nRRRLLRLLRRRLLLLL\n\nSample Output 3\n\n0 0 3 2 0 2 1 0 0 0 4 4 0 0 0 0", "sample_input": "RRLRL\n"}, "reference_outputs": ["0 1 2 1 1\n"], "source_document_id": "p02954", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a string S consisting of L and R.\n\nLet N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square from the left.\n\nThe character written on the leftmost square is always R, and the character written on the rightmost square is always L.\n\nInitially, one child is standing on each square.\n\nEach child will perform the move below 10^{100} times:\n\nMove one square in the direction specified by the character written in the square on which the child is standing. L denotes left, and R denotes right.\n\nFind the number of children standing on each square after the children performed the moves.\n\nConstraints\n\nS is a string of length between 2 and 10^5 (inclusive).\n\nEach character of S is L or R.\n\nThe first and last characters of S are R and L, respectively.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of children standing on each square after the children performed the moves, in order from left to right.\n\nSample Input 1\n\nRRLRL\n\nSample Output 1\n\n0 1 2 1 1\n\nAfter each child performed one move, the number of children standing on each square is 0, 2, 1, 1, 1 from left to right.\n\nAfter each child performed two moves, the number of children standing on each square is 0, 1, 2, 1, 1 from left to right.\n\nAfter each child performed 10^{100} moves, the number of children standing on each square is 0, 1, 2, 1, 1 from left to right.\n\nSample Input 2\n\nRRLLLLRLRRLL\n\nSample Output 2\n\n0 3 3 0 0 0 1 1 0 2 2 0\n\nSample Input 3\n\nRRRLLRLLRRRLLLLL\n\nSample Output 3\n\n0 0 3 2 0 2 1 0 0 0 4 4 0 0 0 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 828, "cpu_time_ms": 2112, "memory_kb": 133872}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s810699413", "group_id": "codeNet:p02955", "input_text": "N, K = map(int, input().split())\nA = list(map(int, input().split()))\nsumA = sum(A)\n\n# 約数の全列挙\ndef divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n divisors.sort(reverse = True) # ソート\n return divisors\n\nansList = divisors(sumA)\nans = 1\n\nfor div in ansList :\n count = 0\n for a in A :\n b = a % div\n count += min(b, div - b)\n\n if count <= 2 * K :\n ans = div\n break\n\nprint(ans)", "language": "Python", "metadata": {"date": 1564971965, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02955.html", "problem_id": "p02955", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02955/input.txt", "sample_output_relpath": "derived/input_output/data/p02955/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02955/Python/s810699413.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s810699413", "user_id": "u392319141"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "N, K = map(int, input().split())\nA = list(map(int, input().split()))\nsumA = sum(A)\n\n# 約数の全列挙\ndef divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n divisors.sort(reverse = True) # ソート\n return divisors\n\nansList = divisors(sumA)\nans = 1\n\nfor div in ansList :\n count = 0\n for a in A :\n b = a % div\n count += min(b, div - b)\n\n if count <= 2 * K :\n ans = div\n break\n\nprint(ans)", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a sequence of N integers: A_1, A_2, \\cdots, A_N.\n\nYou can perform the following operation between 0 and K times (inclusive):\n\nChoose two integers i and j such that i \\neq j, each between 1 and N (inclusive). Add 1 to A_i and -1 to A_j, possibly producing a negative element.\n\nCompute the maximum possible positive integer that divides every element of A after the operations. Here a positive integer x divides an integer y if and only if there exists an integer z such that y = xz.\n\nConstraints\n\n2 \\leq N \\leq 500\n\n1 \\leq A_i \\leq 10^6\n\n0 \\leq K \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\cdots A_{N-1} A_{N}\n\nOutput\n\nPrint the maximum possible positive integer that divides every element of A after the operations.\n\nSample Input 1\n\n2 3\n8 20\n\nSample Output 1\n\n7\n\n7 will divide every element of A if, for example, we perform the following operation:\n\nChoose i = 2, j = 1. A becomes (7, 21).\n\nWe cannot reach the situation where 8 or greater integer divides every element of A.\n\nSample Input 2\n\n2 10\n3 5\n\nSample Output 2\n\n8\n\nConsider performing the following five operations:\n\nChoose i = 2, j = 1. A becomes (2, 6).\n\nChoose i = 2, j = 1. A becomes (1, 7).\n\nChoose i = 2, j = 1. A becomes (0, 8).\n\nChoose i = 2, j = 1. A becomes (-1, 9).\n\nChoose i = 1, j = 2. A becomes (0, 8).\n\nThen, 0 = 8 \\times 0 and 8 = 8 \\times 1, so 8 divides every element of A. We cannot reach the situation where 9 or greater integer divides every element of A.\n\nSample Input 3\n\n4 5\n10 1 2 22\n\nSample Output 3\n\n7\n\nSample Input 4\n\n8 7\n1 7 5 6 8 2 6 5\n\nSample Output 4\n\n5", "sample_input": "2 3\n8 20\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02955", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a sequence of N integers: A_1, A_2, \\cdots, A_N.\n\nYou can perform the following operation between 0 and K times (inclusive):\n\nChoose two integers i and j such that i \\neq j, each between 1 and N (inclusive). Add 1 to A_i and -1 to A_j, possibly producing a negative element.\n\nCompute the maximum possible positive integer that divides every element of A after the operations. Here a positive integer x divides an integer y if and only if there exists an integer z such that y = xz.\n\nConstraints\n\n2 \\leq N \\leq 500\n\n1 \\leq A_i \\leq 10^6\n\n0 \\leq K \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\cdots A_{N-1} A_{N}\n\nOutput\n\nPrint the maximum possible positive integer that divides every element of A after the operations.\n\nSample Input 1\n\n2 3\n8 20\n\nSample Output 1\n\n7\n\n7 will divide every element of A if, for example, we perform the following operation:\n\nChoose i = 2, j = 1. A becomes (7, 21).\n\nWe cannot reach the situation where 8 or greater integer divides every element of A.\n\nSample Input 2\n\n2 10\n3 5\n\nSample Output 2\n\n8\n\nConsider performing the following five operations:\n\nChoose i = 2, j = 1. A becomes (2, 6).\n\nChoose i = 2, j = 1. A becomes (1, 7).\n\nChoose i = 2, j = 1. A becomes (0, 8).\n\nChoose i = 2, j = 1. A becomes (-1, 9).\n\nChoose i = 1, j = 2. A becomes (0, 8).\n\nThen, 0 = 8 \\times 0 and 8 = 8 \\times 1, so 8 divides every element of A. We cannot reach the situation where 9 or greater integer divides every element of A.\n\nSample Input 3\n\n4 5\n10 1 2 22\n\nSample Output 3\n\n7\n\nSample Input 4\n\n8 7\n1 7 5 6 8 2 6 5\n\nSample Output 4\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 573, "cpu_time_ms": 274, "memory_kb": 3188}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s393720598", "group_id": "codeNet:p02957", "input_text": "a,b = map(int,input().split())\nprint((a+b)//2 if (a+b)%2 == 0 or a == b else \"IMPOSSIBLE\")", "language": "Python", "metadata": {"date": 1574226644, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02957.html", "problem_id": "p02957", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02957/input.txt", "sample_output_relpath": "derived/input_output/data/p02957/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02957/Python/s393720598.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s393720598", "user_id": "u580093517"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "a,b = map(int,input().split())\nprint((a+b)//2 if (a+b)%2 == 0 or a == b else \"IMPOSSIBLE\")", "problem_context": "Score: 100 points\n\nProblem Statement\n\nWe have two distinct integers A and B.\n\nPrint the integer K such that |A - K| = |B - K|.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A,\\ B \\leq 10^9\n\nA and B are distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the integer K satisfying the condition.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nSample Input 1\n\n2 16\n\nSample Output 1\n\n9\n\n|2 - 9| = 7 and |16 - 9| = 7, so 9 satisfies the condition.\n\nSample Input 2\n\n0 3\n\nSample Output 2\n\nIMPOSSIBLE\n\nNo integer satisfies the condition.\n\nSample Input 3\n\n998244353 99824435\n\nSample Output 3\n\n549034394", "sample_input": "2 16\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02957", "source_text": "Score: 100 points\n\nProblem Statement\n\nWe have two distinct integers A and B.\n\nPrint the integer K such that |A - K| = |B - K|.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A,\\ B \\leq 10^9\n\nA and B are distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the integer K satisfying the condition.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nSample Input 1\n\n2 16\n\nSample Output 1\n\n9\n\n|2 - 9| = 7 and |16 - 9| = 7, so 9 satisfies the condition.\n\nSample Input 2\n\n0 3\n\nSample Output 2\n\nIMPOSSIBLE\n\nNo integer satisfies the condition.\n\nSample Input 3\n\n998244353 99824435\n\nSample Output 3\n\n549034394", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 90, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s945337575", "group_id": "codeNet:p02957", "input_text": "A = int(input())\nB = int(input())\nK = (A+B)//2\nif type(K) is int:\n print(K)\nelse:\n print(\"Impossible\")", "language": "Python", "metadata": {"date": 1564642474, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02957.html", "problem_id": "p02957", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02957/input.txt", "sample_output_relpath": "derived/input_output/data/p02957/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02957/Python/s945337575.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s945337575", "user_id": "u912134329"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "A = int(input())\nB = int(input())\nK = (A+B)//2\nif type(K) is int:\n print(K)\nelse:\n print(\"Impossible\")", "problem_context": "Score: 100 points\n\nProblem Statement\n\nWe have two distinct integers A and B.\n\nPrint the integer K such that |A - K| = |B - K|.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A,\\ B \\leq 10^9\n\nA and B are distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the integer K satisfying the condition.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nSample Input 1\n\n2 16\n\nSample Output 1\n\n9\n\n|2 - 9| = 7 and |16 - 9| = 7, so 9 satisfies the condition.\n\nSample Input 2\n\n0 3\n\nSample Output 2\n\nIMPOSSIBLE\n\nNo integer satisfies the condition.\n\nSample Input 3\n\n998244353 99824435\n\nSample Output 3\n\n549034394", "sample_input": "2 16\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02957", "source_text": "Score: 100 points\n\nProblem Statement\n\nWe have two distinct integers A and B.\n\nPrint the integer K such that |A - K| = |B - K|.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A,\\ B \\leq 10^9\n\nA and B are distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the integer K satisfying the condition.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nSample Input 1\n\n2 16\n\nSample Output 1\n\n9\n\n|2 - 9| = 7 and |16 - 9| = 7, so 9 satisfies the condition.\n\nSample Input 2\n\n0 3\n\nSample Output 2\n\nIMPOSSIBLE\n\nNo integer satisfies the condition.\n\nSample Input 3\n\n998244353 99824435\n\nSample Output 3\n\n549034394", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 104, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s871974896", "group_id": "codeNet:p02957", "input_text": "a = input('A: ')\nb = input('B: ')\nc = int(a + b)\n\ndef judge_int():\n if c % 2 == 0:\n return c/2\n elif c % 2 != 0:\n return \"IMPOSSIBLE\"\n\nprint(judge_int())\n", "language": "Python", "metadata": {"date": 1564279772, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02957.html", "problem_id": "p02957", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02957/input.txt", "sample_output_relpath": "derived/input_output/data/p02957/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02957/Python/s871974896.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s871974896", "user_id": "u229833930"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "a = input('A: ')\nb = input('B: ')\nc = int(a + b)\n\ndef judge_int():\n if c % 2 == 0:\n return c/2\n elif c % 2 != 0:\n return \"IMPOSSIBLE\"\n\nprint(judge_int())\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nWe have two distinct integers A and B.\n\nPrint the integer K such that |A - K| = |B - K|.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A,\\ B \\leq 10^9\n\nA and B are distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the integer K satisfying the condition.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nSample Input 1\n\n2 16\n\nSample Output 1\n\n9\n\n|2 - 9| = 7 and |16 - 9| = 7, so 9 satisfies the condition.\n\nSample Input 2\n\n0 3\n\nSample Output 2\n\nIMPOSSIBLE\n\nNo integer satisfies the condition.\n\nSample Input 3\n\n998244353 99824435\n\nSample Output 3\n\n549034394", "sample_input": "2 16\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02957", "source_text": "Score: 100 points\n\nProblem Statement\n\nWe have two distinct integers A and B.\n\nPrint the integer K such that |A - K| = |B - K|.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A,\\ B \\leq 10^9\n\nA and B are distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the integer K satisfying the condition.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nSample Input 1\n\n2 16\n\nSample Output 1\n\n9\n\n|2 - 9| = 7 and |16 - 9| = 7, so 9 satisfies the condition.\n\nSample Input 2\n\n0 3\n\nSample Output 2\n\nIMPOSSIBLE\n\nNo integer satisfies the condition.\n\nSample Input 3\n\n998244353 99824435\n\nSample Output 3\n\n549034394", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 174, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s044161330", "group_id": "codeNet:p02957", "input_text": "n,m=[int(i) for i in input().split()]\nif (n+m)%2==0:\n print((n+m)//2)\nelse:\n print(\"IMPOSSIBLE\")", "language": "Python", "metadata": {"date": 1564275688, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02957.html", "problem_id": "p02957", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02957/input.txt", "sample_output_relpath": "derived/input_output/data/p02957/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02957/Python/s044161330.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s044161330", "user_id": "u821432765"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "n,m=[int(i) for i in input().split()]\nif (n+m)%2==0:\n print((n+m)//2)\nelse:\n print(\"IMPOSSIBLE\")", "problem_context": "Score: 100 points\n\nProblem Statement\n\nWe have two distinct integers A and B.\n\nPrint the integer K such that |A - K| = |B - K|.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A,\\ B \\leq 10^9\n\nA and B are distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the integer K satisfying the condition.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nSample Input 1\n\n2 16\n\nSample Output 1\n\n9\n\n|2 - 9| = 7 and |16 - 9| = 7, so 9 satisfies the condition.\n\nSample Input 2\n\n0 3\n\nSample Output 2\n\nIMPOSSIBLE\n\nNo integer satisfies the condition.\n\nSample Input 3\n\n998244353 99824435\n\nSample Output 3\n\n549034394", "sample_input": "2 16\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02957", "source_text": "Score: 100 points\n\nProblem Statement\n\nWe have two distinct integers A and B.\n\nPrint the integer K such that |A - K| = |B - K|.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A,\\ B \\leq 10^9\n\nA and B are distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the integer K satisfying the condition.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nSample Input 1\n\n2 16\n\nSample Output 1\n\n9\n\n|2 - 9| = 7 and |16 - 9| = 7, so 9 satisfies the condition.\n\nSample Input 2\n\n0 3\n\nSample Output 2\n\nIMPOSSIBLE\n\nNo integer satisfies the condition.\n\nSample Input 3\n\n998244353 99824435\n\nSample Output 3\n\n549034394", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 98, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s286903142", "group_id": "codeNet:p02958", "input_text": "import copy\n\ndef swap(array, i,j,tar1,tar2):\n tmp = tar1 \n array[i] = tar2\n array[j] = tmp\n# print(array)\n return array\n\ndef orderd(array):\n orderd_array = sorted(array)\n# print(array,orderd_array)\n for i in range(len(array)):\n if not orderd_array[i]==array[i]:\n return False\n return True\n\nN = int(input())\nP = list(map(int,input().split()))\n# print(P)\nans = \"NO\"\nflg = False\nfor i in range(N):\n for j in range(i,N):\n Pi = copy.copy(P)\n Pi = swap(Pi,i,j,Pi[i],Pi[j])\n if orderd(Pi):\n ans = \"YES\"\n flg=True\n break\n if flg:\n break\n#print(P)\nprint(ans)", "language": "Python", "metadata": {"date": 1584388643, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02958.html", "problem_id": "p02958", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02958/input.txt", "sample_output_relpath": "derived/input_output/data/p02958/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02958/Python/s286903142.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s286903142", "user_id": "u371132735"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "import copy\n\ndef swap(array, i,j,tar1,tar2):\n tmp = tar1 \n array[i] = tar2\n array[j] = tmp\n# print(array)\n return array\n\ndef orderd(array):\n orderd_array = sorted(array)\n# print(array,orderd_array)\n for i in range(len(array)):\n if not orderd_array[i]==array[i]:\n return False\n return True\n\nN = int(input())\nP = list(map(int,input().split()))\n# print(P)\nans = \"NO\"\nflg = False\nfor i in range(N):\n for j in range(i,N):\n Pi = copy.copy(P)\n Pi = swap(Pi,i,j,Pi[i],Pi[j])\n if orderd(Pi):\n ans = \"YES\"\n flg=True\n break\n if flg:\n break\n#print(P)\nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a sequence p = {p_1,\\ p_2,\\ ...,\\ p_N} which is a permutation of {1,\\ 2,\\ ...,\\ N}.\n\nYou can perform the following operation at most once: choose integers i and j (1 \\leq i < j \\leq N), and swap p_i and p_j. Note that you can also choose not to perform it.\n\nPrint YES if you can sort p in ascending order in this way, and NO otherwise.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 50\n\np is a permutation of {1,\\ 2,\\ ...,\\ N}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\np_1 p_2 ... p_N\n\nOutput\n\nPrint YES if you can sort p in ascending order in the way stated in the problem statement, and NO otherwise.\n\nSample Input 1\n\n5\n5 2 3 4 1\n\nSample Output 1\n\nYES\n\nYou can sort p in ascending order by swapping p_1 and p_5.\n\nSample Input 2\n\n5\n2 4 3 5 1\n\nSample Output 2\n\nNO\n\nIn this case, swapping any two elements does not sort p in ascending order.\n\nSample Input 3\n\n7\n1 2 3 4 5 6 7\n\nSample Output 3\n\nYES\n\np is already sorted in ascending order, so no operation is needed.", "sample_input": "5\n5 2 3 4 1\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p02958", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a sequence p = {p_1,\\ p_2,\\ ...,\\ p_N} which is a permutation of {1,\\ 2,\\ ...,\\ N}.\n\nYou can perform the following operation at most once: choose integers i and j (1 \\leq i < j \\leq N), and swap p_i and p_j. Note that you can also choose not to perform it.\n\nPrint YES if you can sort p in ascending order in this way, and NO otherwise.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 50\n\np is a permutation of {1,\\ 2,\\ ...,\\ N}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\np_1 p_2 ... p_N\n\nOutput\n\nPrint YES if you can sort p in ascending order in the way stated in the problem statement, and NO otherwise.\n\nSample Input 1\n\n5\n5 2 3 4 1\n\nSample Output 1\n\nYES\n\nYou can sort p in ascending order by swapping p_1 and p_5.\n\nSample Input 2\n\n5\n2 4 3 5 1\n\nSample Output 2\n\nNO\n\nIn this case, swapping any two elements does not sort p in ascending order.\n\nSample Input 3\n\n7\n1 2 3 4 5 6 7\n\nSample Output 3\n\nYES\n\np is already sorted in ascending order, so no operation is needed.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 595, "cpu_time_ms": 29, "memory_kb": 3444}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s135212524", "group_id": "codeNet:p02958", "input_text": "import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import permutations, combinations, product\nfrom operator import itemgetter, mul\nfrom copy import deepcopy,copy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\n\ndef input(): return sys.stdin.readline().strip()\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef LIST(): return list(map(int, input().split()))\nsys.setrecursionlimit(10 ** 9)\nINF = float('inf')\nmod = 10 ** 9 + 7\n\ndef main():\n n=INT()\n p=LIST()\n\n lis=[]\n l=1\n for i in range(1,n):\n if p[i] < p[i-1]:\n if l!=1:\n lis.append(l) \n else:\n l+=1\n\n if l!=1:\n lis.append(l)\n\n #print(lis)\n if len(lis)==1:\n print('YES')\n else:\n print('NO')\n\nif __name__=='__main__':\n main()", "language": "Python", "metadata": {"date": 1564276325, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02958.html", "problem_id": "p02958", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02958/input.txt", "sample_output_relpath": "derived/input_output/data/p02958/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02958/Python/s135212524.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s135212524", "user_id": "u174603263"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import permutations, combinations, product\nfrom operator import itemgetter, mul\nfrom copy import deepcopy,copy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\n\ndef input(): return sys.stdin.readline().strip()\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef LIST(): return list(map(int, input().split()))\nsys.setrecursionlimit(10 ** 9)\nINF = float('inf')\nmod = 10 ** 9 + 7\n\ndef main():\n n=INT()\n p=LIST()\n\n lis=[]\n l=1\n for i in range(1,n):\n if p[i] < p[i-1]:\n if l!=1:\n lis.append(l) \n else:\n l+=1\n\n if l!=1:\n lis.append(l)\n\n #print(lis)\n if len(lis)==1:\n print('YES')\n else:\n print('NO')\n\nif __name__=='__main__':\n main()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a sequence p = {p_1,\\ p_2,\\ ...,\\ p_N} which is a permutation of {1,\\ 2,\\ ...,\\ N}.\n\nYou can perform the following operation at most once: choose integers i and j (1 \\leq i < j \\leq N), and swap p_i and p_j. Note that you can also choose not to perform it.\n\nPrint YES if you can sort p in ascending order in this way, and NO otherwise.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 50\n\np is a permutation of {1,\\ 2,\\ ...,\\ N}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\np_1 p_2 ... p_N\n\nOutput\n\nPrint YES if you can sort p in ascending order in the way stated in the problem statement, and NO otherwise.\n\nSample Input 1\n\n5\n5 2 3 4 1\n\nSample Output 1\n\nYES\n\nYou can sort p in ascending order by swapping p_1 and p_5.\n\nSample Input 2\n\n5\n2 4 3 5 1\n\nSample Output 2\n\nNO\n\nIn this case, swapping any two elements does not sort p in ascending order.\n\nSample Input 3\n\n7\n1 2 3 4 5 6 7\n\nSample Output 3\n\nYES\n\np is already sorted in ascending order, so no operation is needed.", "sample_input": "5\n5 2 3 4 1\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p02958", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a sequence p = {p_1,\\ p_2,\\ ...,\\ p_N} which is a permutation of {1,\\ 2,\\ ...,\\ N}.\n\nYou can perform the following operation at most once: choose integers i and j (1 \\leq i < j \\leq N), and swap p_i and p_j. Note that you can also choose not to perform it.\n\nPrint YES if you can sort p in ascending order in this way, and NO otherwise.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 50\n\np is a permutation of {1,\\ 2,\\ ...,\\ N}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\np_1 p_2 ... p_N\n\nOutput\n\nPrint YES if you can sort p in ascending order in the way stated in the problem statement, and NO otherwise.\n\nSample Input 1\n\n5\n5 2 3 4 1\n\nSample Output 1\n\nYES\n\nYou can sort p in ascending order by swapping p_1 and p_5.\n\nSample Input 2\n\n5\n2 4 3 5 1\n\nSample Output 2\n\nNO\n\nIn this case, swapping any two elements does not sort p in ascending order.\n\nSample Input 3\n\n7\n1 2 3 4 5 6 7\n\nSample Output 3\n\nYES\n\np is already sorted in ascending order, so no operation is needed.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 945, "cpu_time_ms": 38, "memory_kb": 5148}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s030758329", "group_id": "codeNet:p02959", "input_text": "n = int(input())\ncities = list(map(int,input().split()))\nbraves = list(map(int,input().split()))\nbraves.append(0)\ncount = 0\nfor i in range(n+1):\n c = min(braves[i],cities[i])\n count += c\n if i != n:\n braves[i+1] += braves[i] - c\nprint(count)", "language": "Python", "metadata": {"date": 1564277109, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02959.html", "problem_id": "p02959", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02959/input.txt", "sample_output_relpath": "derived/input_output/data/p02959/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02959/Python/s030758329.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s030758329", "user_id": "u103902792"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "n = int(input())\ncities = list(map(int,input().split()))\nbraves = list(map(int,input().split()))\nbraves.append(0)\ncount = 0\nfor i in range(n+1):\n c = min(braves[i],cities[i])\n count += c\n if i != n:\n braves[i+1] += braves[i] - c\nprint(count)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N+1 towns. The i-th town is being attacked by A_i monsters.\n\nWe have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters.\n\nWhat is the maximum total number of monsters the heroes can cooperate to defeat?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_{N+1}\nB_1 B_2 ... B_N\n\nOutput\n\nPrint the maximum total number of monsters the heroes can defeat.\n\nSample Input 1\n\n2\n3 5 2\n4 5\n\nSample Output 1\n\n9\n\nIf the heroes choose the monsters to defeat as follows, they can defeat nine monsters in total, which is the maximum result.\n\nThe first hero defeats two monsters attacking the first town and two monsters attacking the second town.\n\nThe second hero defeats three monsters attacking the second town and two monsters attacking the third town.\n\nSample Input 2\n\n3\n5 6 3 8\n5 100 8\n\nSample Output 2\n\n22\n\nSample Input 3\n\n2\n100 1 1\n1 100\n\nSample Output 3\n\n3", "sample_input": "2\n3 5 2\n4 5\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02959", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N+1 towns. The i-th town is being attacked by A_i monsters.\n\nWe have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters.\n\nWhat is the maximum total number of monsters the heroes can cooperate to defeat?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_{N+1}\nB_1 B_2 ... B_N\n\nOutput\n\nPrint the maximum total number of monsters the heroes can defeat.\n\nSample Input 1\n\n2\n3 5 2\n4 5\n\nSample Output 1\n\n9\n\nIf the heroes choose the monsters to defeat as follows, they can defeat nine monsters in total, which is the maximum result.\n\nThe first hero defeats two monsters attacking the first town and two monsters attacking the second town.\n\nThe second hero defeats three monsters attacking the second town and two monsters attacking the third town.\n\nSample Input 2\n\n3\n5 6 3 8\n5 100 8\n\nSample Output 2\n\n22\n\nSample Input 3\n\n2\n100 1 1\n1 100\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 247, "cpu_time_ms": 143, "memory_kb": 19116}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s223568491", "group_id": "codeNet:p02960", "input_text": "from sys import stdin\n\n\ndef fetch_one_line():\n return stdin.readline().rstrip()\n\n\ndef fetch_int_input():\n return [int(s) for s in fetch_one_line().split()]\n\n\ndef fetch_inputs(times):\n return [fetch_one_line() for _ in range(times)]\n\n\ndef fetch_int_inputs(times):\n return [[int(s) for s in fetch_one_line()] for _ in range(times)]\n\n\ndef fetch_ints_inputs(times):\n return [fetch_int_input() for _ in range(times)]\n\n\nipt = fetch_one_line()\nDIVIDE_NUM = 13\nremainds = [[0 for _ in range(DIVIDE_NUM)]]\nremainds[0][0] = 1\n\ndef transrate(matrix):\n return list(map(list, zip(*matrix)))\n\ndef make_remind(latest_remind, digit):\n tmp_remind = [[latest_remind[(j - (i * (digit % 13))) % 13] for j in range(DIVIDE_NUM)]\n for i in range(10)]\n\n return [sum(t) for t in transrate(tmp_remind)]\n\nfor idx, s in enumerate(ipt[::-1]):\n if s == \"?\":\n digit = pow(10, idx)\n remainds.append(make_remind(remainds[-1], digit))\n else:\n int_s = int(s)\n digit = pow(10, idx)\n move = (int_s % 13) * (digit % 13)\n new_remaind = [remainds[-1][(i - move) % 13] for i in range(DIVIDE_NUM)]\n remainds.append(new_remaind)\n\nprint(remainds[-1][5] % (pow(10, 9) + 7))\n\n", "language": "Python", "metadata": {"date": 1578284396, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02960.html", "problem_id": "p02960", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02960/input.txt", "sample_output_relpath": "derived/input_output/data/p02960/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02960/Python/s223568491.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s223568491", "user_id": "u717387812"}, "prompt_components": {"gold_output": "768\n", "input_to_evaluate": "from sys import stdin\n\n\ndef fetch_one_line():\n return stdin.readline().rstrip()\n\n\ndef fetch_int_input():\n return [int(s) for s in fetch_one_line().split()]\n\n\ndef fetch_inputs(times):\n return [fetch_one_line() for _ in range(times)]\n\n\ndef fetch_int_inputs(times):\n return [[int(s) for s in fetch_one_line()] for _ in range(times)]\n\n\ndef fetch_ints_inputs(times):\n return [fetch_int_input() for _ in range(times)]\n\n\nipt = fetch_one_line()\nDIVIDE_NUM = 13\nremainds = [[0 for _ in range(DIVIDE_NUM)]]\nremainds[0][0] = 1\n\ndef transrate(matrix):\n return list(map(list, zip(*matrix)))\n\ndef make_remind(latest_remind, digit):\n tmp_remind = [[latest_remind[(j - (i * (digit % 13))) % 13] for j in range(DIVIDE_NUM)]\n for i in range(10)]\n\n return [sum(t) for t in transrate(tmp_remind)]\n\nfor idx, s in enumerate(ipt[::-1]):\n if s == \"?\":\n digit = pow(10, idx)\n remainds.append(make_remind(remainds[-1], digit))\n else:\n int_s = int(s)\n digit = pow(10, idx)\n move = (int_s % 13) * (digit % 13)\n new_remaind = [remainds[-1][(i - move) % 13] for i in range(DIVIDE_NUM)]\n remainds.append(new_remaind)\n\nprint(remainds[-1][5] % (pow(10, 9) + 7))\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a string S. Each character in S is either a digit (0, ..., 9) or ?.\n\nAmong the integers obtained by replacing each occurrence of ? with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0.\n\nSince the answer can be enormous, print the count modulo 10^9+7.\n\nConstraints\n\nS is a string consisting of digits (0, ..., 9) and ?.\n\n1 \\leq |S| \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of integers satisfying the condition, modulo 10^9+7.\n\nSample Input 1\n\n??2??5\n\nSample Output 1\n\n768\n\nFor example, 482305, 002865, and 972665 satisfy the condition.\n\nSample Input 2\n\n?44\n\nSample Output 2\n\n1\n\nOnly 044 satisfies the condition.\n\nSample Input 3\n\n7?4\n\nSample Output 3\n\n0\n\nWe may not be able to produce an integer satisfying the condition.\n\nSample Input 4\n\n?6?42???8??2??06243????9??3???7258??5??7???????774????4?1??17???9?5?70???76???\n\nSample Output 4\n\n153716888", "sample_input": "??2??5\n"}, "reference_outputs": ["768\n"], "source_document_id": "p02960", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a string S. Each character in S is either a digit (0, ..., 9) or ?.\n\nAmong the integers obtained by replacing each occurrence of ? with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0.\n\nSince the answer can be enormous, print the count modulo 10^9+7.\n\nConstraints\n\nS is a string consisting of digits (0, ..., 9) and ?.\n\n1 \\leq |S| \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of integers satisfying the condition, modulo 10^9+7.\n\nSample Input 1\n\n??2??5\n\nSample Output 1\n\n768\n\nFor example, 482305, 002865, and 972665 satisfy the condition.\n\nSample Input 2\n\n?44\n\nSample Output 2\n\n1\n\nOnly 044 satisfies the condition.\n\nSample Input 3\n\n7?4\n\nSample Output 3\n\n0\n\nWe may not be able to produce an integer satisfying the condition.\n\nSample Input 4\n\n?6?42???8??2??06243????9??3???7258??5??7???????774????4?1??17???9?5?70???76???\n\nSample Output 4\n\n153716888", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1220, "cpu_time_ms": 2109, "memory_kb": 87132}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s734813952", "group_id": "codeNet:p02963", "input_text": "import sys\ninput=sys.stdin.readline\n\ns = int(input())\nimport math\ny3 = math.ceil(s//(10**9))\nx3 = abs((10**9)*y3-s)\n\nprint(\"0 0 %d %d %d %d\" %(10**9, 1, x3, y3))\n", "language": "Python", "metadata": {"date": 1565848303, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02963.html", "problem_id": "p02963", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02963/input.txt", "sample_output_relpath": "derived/input_output/data/p02963/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02963/Python/s734813952.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s734813952", "user_id": "u076917070"}, "prompt_components": {"gold_output": "1 0 2 2 0 1\n", "input_to_evaluate": "import sys\ninput=sys.stdin.readline\n\ns = int(input())\nimport math\ny3 = math.ceil(s//(10**9))\nx3 = abs((10**9)*y3-s)\n\nprint(\"0 0 %d %d %d %d\" %(10**9, 1, x3, y3))\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is an integer S.\nFind a combination of six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfies all of the following conditions:\n\n0 \\leq X_1,Y_1,X_2,Y_2,X_3,Y_3 \\leq 10^9\n\nThe area of the triangle in a two-dimensional plane whose vertices are (X_1,Y_1),(X_2,Y_2), and (X_3,Y_3) is S/2.\n\nWe can prove that there always exist six integers that satisfy the conditions under the constraints of this problem.\n\nConstraints\n\n1 \\leq S \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfy the conditions, in this order, with spaces in between.\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1 0 2 2 0 1\n\nThe area of the triangle in a two-dimensional plane whose vertices are (1,0),(2,2), and (0,1) is 3/2.\nPrinting 3 0 3 1 0 1 or 1 0 0 1 2 2 will also be accepted.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n0 0 10 0 0 10\n\nSample Input 3\n\n311114770564041497\n\nSample Output 3\n\n314159265 358979323 846264338 327950288 419716939 937510582", "sample_input": "3\n"}, "reference_outputs": ["1 0 2 2 0 1\n"], "source_document_id": "p02963", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is an integer S.\nFind a combination of six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfies all of the following conditions:\n\n0 \\leq X_1,Y_1,X_2,Y_2,X_3,Y_3 \\leq 10^9\n\nThe area of the triangle in a two-dimensional plane whose vertices are (X_1,Y_1),(X_2,Y_2), and (X_3,Y_3) is S/2.\n\nWe can prove that there always exist six integers that satisfy the conditions under the constraints of this problem.\n\nConstraints\n\n1 \\leq S \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfy the conditions, in this order, with spaces in between.\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1 0 2 2 0 1\n\nThe area of the triangle in a two-dimensional plane whose vertices are (1,0),(2,2), and (0,1) is 3/2.\nPrinting 3 0 3 1 0 1 or 1 0 0 1 2 2 will also be accepted.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n0 0 10 0 0 10\n\nSample Input 3\n\n311114770564041497\n\nSample Output 3\n\n314159265 358979323 846264338 327950288 419716939 937510582", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 162, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s658502665", "group_id": "codeNet:p02964", "input_text": "N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\ndic = {}\nfor i in range(N):\n a = A[i]\n v = dic.get(a, None)\n if v is None:\n dic[a] = [i]\n else:\n v.append(i)\n\nresult = []\nresult_dic = {}\nresult_dic_index = {}\ncount = 0\nloop = 0\nwhile count < K:\n index = 0\n if count != 0:\n if result:\n a = result[index]\n v = dic.get(a)\n next_i = v[0]\n index = next_i + 1\n result.clear()\n while index < N:\n a = A[index]\n v = dic.get(a)\n next_i = -1\n for i in v:\n if i > index:\n next_i = i\n break\n if next_i == -1:\n result.append(a)\n index += 1\n else:\n index = next_i + 1\n tu = tuple(result)\n t = result_dic.get(tu, None)\n if t is None:\n result_dic[tu] = count\n result_dic_index[count] = tu\n else:\n loop = count\n break\n count += 1\n\nanswers = None\nif loop == 0:\n answers = tu\nelse:\n index = (K - 1) % loop\n answers = result_dic_index[index]\n\nfor answer in answers:\n print(answer, end=\" \")\nprint()", "language": "Python", "metadata": {"date": 1563763333, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02964.html", "problem_id": "p02964", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02964/input.txt", "sample_output_relpath": "derived/input_output/data/p02964/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02964/Python/s658502665.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s658502665", "user_id": "u381602071"}, "prompt_components": {"gold_output": "2 3\n", "input_to_evaluate": "N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\ndic = {}\nfor i in range(N):\n a = A[i]\n v = dic.get(a, None)\n if v is None:\n dic[a] = [i]\n else:\n v.append(i)\n\nresult = []\nresult_dic = {}\nresult_dic_index = {}\ncount = 0\nloop = 0\nwhile count < K:\n index = 0\n if count != 0:\n if result:\n a = result[index]\n v = dic.get(a)\n next_i = v[0]\n index = next_i + 1\n result.clear()\n while index < N:\n a = A[index]\n v = dic.get(a)\n next_i = -1\n for i in v:\n if i > index:\n next_i = i\n break\n if next_i == -1:\n result.append(a)\n index += 1\n else:\n index = next_i + 1\n tu = tuple(result)\n t = result_dic.get(tu, None)\n if t is None:\n result_dic[tu] = count\n result_dic_index[count] = tu\n else:\n loop = count\n break\n count += 1\n\nanswers = None\nif loop == 0:\n answers = tu\nelse:\n index = (K - 1) % loop\n answers = result_dic_index[index]\n\nfor answer in answers:\n print(answer, end=\" \")\nprint()", "problem_context": "Score : 700 points\n\nProblem Statement\n\nWe have a sequence of N \\times K integers: X=(X_0,X_1,\\cdots,X_{N \\times K-1}).\nIts elements are represented by another sequence of N integers: A=(A_0,A_1,\\cdots,A_{N-1}). For each pair i, j (0 \\leq i \\leq K-1,\\ 0 \\leq j \\leq N-1), X_{i \\times N + j}=A_j holds.\n\nSnuke has an integer sequence s, which is initially empty.\nFor each i=0,1,2,\\cdots,N \\times K-1, in this order, he will perform the following operation:\n\nIf s does not contain X_i: add X_i to the end of s.\n\nIf s does contain X_i: repeatedly delete the element at the end of s until s no longer contains X_i. Note that, in this case, we do not add X_i to the end of s.\n\nFind the elements of s after Snuke finished the operations.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq 10^{12}\n\n1 \\leq A_i \\leq 2 \\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_0 A_1 \\cdots A_{N-1}\n\nOutput\n\nPrint the elements of s after Snuke finished the operations, in order from beginning to end, with spaces in between.\n\nSample Input 1\n\n3 2\n1 2 3\n\nSample Output 1\n\n2 3\n\nIn this case, X=(1,2,3,1,2,3).\nWe will perform the operations as follows:\n\ni=0: s does not contain 1, so we add 1 to the end of s, resulting in s=(1).\n\ni=1: s does not contain 2, so we add 2 to the end of s, resulting in s=(1,2).\n\ni=2: s does not contain 3, so we add 3 to the end of s, resulting in s=(1,2,3).\n\ni=3: s does contain 1, so we repeatedly delete the element at the end of s as long as s contains 1, which causes the following changes to s: (1,2,3)→(1,2)→(1)→().\n\ni=4: s does not contain 2, so we add 2 to the end of s, resulting in s=(2).\n\ni=5: s does not contain 3, so we add 3 to the end of s, resulting in s=(2,3).\n\nSample Input 2\n\n5 10\n1 2 3 2 3\n\nSample Output 2\n\n3\n\nSample Input 3\n\n6 1000000000000\n1 1 2 2 3 3\n\nSample Output 3\n\ns may be empty in the end.\n\nSample Input 4\n\n11 97\n3 1 4 1 5 9 2 6 5 3 5\n\nSample Output 4\n\n9 2 6", "sample_input": "3 2\n1 2 3\n"}, "reference_outputs": ["2 3\n"], "source_document_id": "p02964", "source_text": "Score : 700 points\n\nProblem Statement\n\nWe have a sequence of N \\times K integers: X=(X_0,X_1,\\cdots,X_{N \\times K-1}).\nIts elements are represented by another sequence of N integers: A=(A_0,A_1,\\cdots,A_{N-1}). For each pair i, j (0 \\leq i \\leq K-1,\\ 0 \\leq j \\leq N-1), X_{i \\times N + j}=A_j holds.\n\nSnuke has an integer sequence s, which is initially empty.\nFor each i=0,1,2,\\cdots,N \\times K-1, in this order, he will perform the following operation:\n\nIf s does not contain X_i: add X_i to the end of s.\n\nIf s does contain X_i: repeatedly delete the element at the end of s until s no longer contains X_i. Note that, in this case, we do not add X_i to the end of s.\n\nFind the elements of s after Snuke finished the operations.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq 10^{12}\n\n1 \\leq A_i \\leq 2 \\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_0 A_1 \\cdots A_{N-1}\n\nOutput\n\nPrint the elements of s after Snuke finished the operations, in order from beginning to end, with spaces in between.\n\nSample Input 1\n\n3 2\n1 2 3\n\nSample Output 1\n\n2 3\n\nIn this case, X=(1,2,3,1,2,3).\nWe will perform the operations as follows:\n\ni=0: s does not contain 1, so we add 1 to the end of s, resulting in s=(1).\n\ni=1: s does not contain 2, so we add 2 to the end of s, resulting in s=(1,2).\n\ni=2: s does not contain 3, so we add 3 to the end of s, resulting in s=(1,2,3).\n\ni=3: s does contain 1, so we repeatedly delete the element at the end of s as long as s contains 1, which causes the following changes to s: (1,2,3)→(1,2)→(1)→().\n\ni=4: s does not contain 2, so we add 2 to the end of s, resulting in s=(2).\n\ni=5: s does not contain 3, so we add 3 to the end of s, resulting in s=(2,3).\n\nSample Input 2\n\n5 10\n1 2 3 2 3\n\nSample Output 2\n\n3\n\nSample Input 3\n\n6 1000000000000\n1 1 2 2 3 3\n\nSample Output 3\n\ns may be empty in the end.\n\nSample Input 4\n\n11 97\n3 1 4 1 5 9 2 6 5 3 5\n\nSample Output 4\n\n9 2 6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1171, "cpu_time_ms": 2107, "memory_kb": 71920}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s054856360", "group_id": "codeNet:p02969", "input_text": "r = int(input())\nprint(3*r*r)", "language": "Python", "metadata": {"date": 1563670927, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02969.html", "problem_id": "p02969", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02969/input.txt", "sample_output_relpath": "derived/input_output/data/p02969/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02969/Python/s054856360.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s054856360", "user_id": "u343850880"}, "prompt_components": {"gold_output": "48\n", "input_to_evaluate": "r = int(input())\nprint(3*r*r)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIt is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.\n\nGiven an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.\n\nConstraints\n\n1 \\leq r \\leq 100\n\nr is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nr\n\nOutput\n\nPrint an integer representing the area of the regular dodecagon.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n48\n\nThe area of the regular dodecagon is 3 \\times 4^2 = 48.\n\nSample Input 2\n\n15\n\nSample Output 2\n\n675\n\nSample Input 3\n\n80\n\nSample Output 3\n\n19200", "sample_input": "4\n"}, "reference_outputs": ["48\n"], "source_document_id": "p02969", "source_text": "Score : 100 points\n\nProblem Statement\n\nIt is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.\n\nGiven an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.\n\nConstraints\n\n1 \\leq r \\leq 100\n\nr is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nr\n\nOutput\n\nPrint an integer representing the area of the regular dodecagon.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n48\n\nThe area of the regular dodecagon is 3 \\times 4^2 = 48.\n\nSample Input 2\n\n15\n\nSample Output 2\n\n675\n\nSample Input 3\n\n80\n\nSample Output 3\n\n19200", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 29, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s519257828", "group_id": "codeNet:p02970", "input_text": "import math\nn,d=map(int,input().split())\nans=math.ceil(n/(2*d+1))\nprint(ans)", "language": "Python", "metadata": {"date": 1599484103, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02970.html", "problem_id": "p02970", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02970/input.txt", "sample_output_relpath": "derived/input_output/data/p02970/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02970/Python/s519257828.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s519257828", "user_id": "u888933875"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import math\nn,d=map(int,input().split())\nans=math.ceil(n/(2*d+1))\nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N apple trees in a row. People say that one of them will bear golden apples.\n\nWe want to deploy some number of inspectors so that each of these trees will be inspected.\n\nEach inspector will be deployed under one of the trees. For convenience, we will assign numbers from 1 through N to the trees. An inspector deployed under the i-th tree (1 \\leq i \\leq N) will inspect the trees with numbers between i-D and i+D (inclusive).\n\nFind the minimum number of inspectors that we need to deploy to achieve the objective.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq D \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\n\nOutput\n\nPrint the minimum number of inspectors that we need to deploy to achieve the objective.\n\nSample Input 1\n\n6 2\n\nSample Output 1\n\n2\n\nWe can achieve the objective by, for example, placing an inspector under Tree 3 and Tree 4.\n\nSample Input 2\n\n14 3\n\nSample Output 2\n\n2\n\nSample Input 3\n\n20 4\n\nSample Output 3\n\n3", "sample_input": "6 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02970", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N apple trees in a row. People say that one of them will bear golden apples.\n\nWe want to deploy some number of inspectors so that each of these trees will be inspected.\n\nEach inspector will be deployed under one of the trees. For convenience, we will assign numbers from 1 through N to the trees. An inspector deployed under the i-th tree (1 \\leq i \\leq N) will inspect the trees with numbers between i-D and i+D (inclusive).\n\nFind the minimum number of inspectors that we need to deploy to achieve the objective.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq D \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\n\nOutput\n\nPrint the minimum number of inspectors that we need to deploy to achieve the objective.\n\nSample Input 1\n\n6 2\n\nSample Output 1\n\n2\n\nWe can achieve the objective by, for example, placing an inspector under Tree 3 and Tree 4.\n\nSample Input 2\n\n14 3\n\nSample Output 2\n\n2\n\nSample Input 3\n\n20 4\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 76, "cpu_time_ms": 24, "memory_kb": 9036}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s145340498", "group_id": "codeNet:p02971", "input_text": "n=int(input())\na=[]\nfor i in range(n):\n a.append(int(input()))\nb=max(a)\nc=a.index(b)\na.pop(c)\nd=max(a)\nfor i in range(n):\n if (i==c):\n print('{0}'.format(d))\n else: \n print('{0}'.format(b))", "language": "Python", "metadata": {"date": 1563674935, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02971.html", "problem_id": "p02971", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02971/input.txt", "sample_output_relpath": "derived/input_output/data/p02971/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02971/Python/s145340498.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s145340498", "user_id": "u128646083"}, "prompt_components": {"gold_output": "4\n3\n4\n", "input_to_evaluate": "n=int(input())\na=[]\nfor i in range(n):\n a.append(int(input()))\nb=max(a)\nc=a.index(b)\na.pop(c)\nd=max(a)\nfor i in range(n):\n if (i==c):\n print('{0}'.format(d))\n else: \n print('{0}'.format(b))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of length N: A_1, A_2, ..., A_N.\nFor each integer i between 1 and N (inclusive), answer the following question:\n\nFind the maximum value among the N-1 elements other than A_i in the sequence.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 200000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint N lines. The i-th line (1 \\leq i \\leq N) should contain the maximum value among the N-1 elements other than A_i in the sequence.\n\nSample Input 1\n\n3\n1\n4\n3\n\nSample Output 1\n\n4\n3\n4\n\nThe maximum value among the two elements other than A_1, that is, A_2 = 4 and A_3 = 3, is 4.\n\nThe maximum value among the two elements other than A_2, that is, A_1 = 1 and A_3 = 3, is 3.\n\nThe maximum value among the two elements other than A_3, that is, A_1 = 1 and A_2 = 4, is 4.\n\nSample Input 2\n\n2\n5\n5\n\nSample Output 2\n\n5\n5", "sample_input": "3\n1\n4\n3\n"}, "reference_outputs": ["4\n3\n4\n"], "source_document_id": "p02971", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of length N: A_1, A_2, ..., A_N.\nFor each integer i between 1 and N (inclusive), answer the following question:\n\nFind the maximum value among the N-1 elements other than A_i in the sequence.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 200000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint N lines. The i-th line (1 \\leq i \\leq N) should contain the maximum value among the N-1 elements other than A_i in the sequence.\n\nSample Input 1\n\n3\n1\n4\n3\n\nSample Output 1\n\n4\n3\n4\n\nThe maximum value among the two elements other than A_1, that is, A_2 = 4 and A_3 = 3, is 4.\n\nThe maximum value among the two elements other than A_2, that is, A_1 = 1 and A_3 = 3, is 3.\n\nThe maximum value among the two elements other than A_3, that is, A_1 = 1 and A_2 = 4, is 4.\n\nSample Input 2\n\n2\n5\n5\n\nSample Output 2\n\n5\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 215, "cpu_time_ms": 576, "memory_kb": 12532}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s414037839", "group_id": "codeNet:p02971", "input_text": "n = int(input())\na = []\nfor i in range(0, n):\n a.append((int(input()), i))\na.sort()\na.reverse()\nfor i in range(0, n):\n num = 0\n while a[num][1] == i:\n num += 1\n print(a[num][0])\n", "language": "Python", "metadata": {"date": 1563672081, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02971.html", "problem_id": "p02971", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02971/input.txt", "sample_output_relpath": "derived/input_output/data/p02971/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02971/Python/s414037839.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s414037839", "user_id": "u305366205"}, "prompt_components": {"gold_output": "4\n3\n4\n", "input_to_evaluate": "n = int(input())\na = []\nfor i in range(0, n):\n a.append((int(input()), i))\na.sort()\na.reverse()\nfor i in range(0, n):\n num = 0\n while a[num][1] == i:\n num += 1\n print(a[num][0])\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of length N: A_1, A_2, ..., A_N.\nFor each integer i between 1 and N (inclusive), answer the following question:\n\nFind the maximum value among the N-1 elements other than A_i in the sequence.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 200000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint N lines. The i-th line (1 \\leq i \\leq N) should contain the maximum value among the N-1 elements other than A_i in the sequence.\n\nSample Input 1\n\n3\n1\n4\n3\n\nSample Output 1\n\n4\n3\n4\n\nThe maximum value among the two elements other than A_1, that is, A_2 = 4 and A_3 = 3, is 4.\n\nThe maximum value among the two elements other than A_2, that is, A_1 = 1 and A_3 = 3, is 3.\n\nThe maximum value among the two elements other than A_3, that is, A_1 = 1 and A_2 = 4, is 4.\n\nSample Input 2\n\n2\n5\n5\n\nSample Output 2\n\n5\n5", "sample_input": "3\n1\n4\n3\n"}, "reference_outputs": ["4\n3\n4\n"], "source_document_id": "p02971", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of length N: A_1, A_2, ..., A_N.\nFor each integer i between 1 and N (inclusive), answer the following question:\n\nFind the maximum value among the N-1 elements other than A_i in the sequence.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 200000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint N lines. The i-th line (1 \\leq i \\leq N) should contain the maximum value among the N-1 elements other than A_i in the sequence.\n\nSample Input 1\n\n3\n1\n4\n3\n\nSample Output 1\n\n4\n3\n4\n\nThe maximum value among the two elements other than A_1, that is, A_2 = 4 and A_3 = 3, is 4.\n\nThe maximum value among the two elements other than A_2, that is, A_1 = 1 and A_3 = 3, is 3.\n\nThe maximum value among the two elements other than A_3, that is, A_1 = 1 and A_2 = 4, is 4.\n\nSample Input 2\n\n2\n5\n5\n\nSample Output 2\n\n5\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 197, "cpu_time_ms": 800, "memory_kb": 31584}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s799691446", "group_id": "codeNet:p02971", "input_text": "N=int(input())\nmaxi=0\nsmaxi=0\nflag=0\nls=[]\nx=0\nfor i in range(N):\n x=int(input())\n ls.append(x)\n if (maxi 1:\n m = l + (r - l) // 2\n if d[m] >= a:\n r = m\n else:\n l = m\n if r == 0:\n d = [a] + d\n else:\n d[r - 1] = a\nprint(len(d))", "language": "Python", "metadata": {"date": 1593918764, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02973.html", "problem_id": "p02973", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02973/input.txt", "sample_output_relpath": "derived/input_output/data/p02973/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02973/Python/s719121664.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s719121664", "user_id": "u036104576"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import sys\nimport itertools\n# import numpy as np\nimport time\nimport math\nimport heapq\nfrom collections import defaultdict\nsys.setrecursionlimit(10 ** 7)\n \nINF = 10 ** 9 + 7\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n# map(int, input().split())\n\nMOD = 10 ** 4 + 7\n\nN = int(input())\n\nA = [0] * N\nfor i in range(N):\n A[i] = int(input())\n\nd = []\nfor a in A:\n l = -1\n r = len(d)\n while r - l > 1:\n m = l + (r - l) // 2\n if d[m] >= a:\n r = m\n else:\n l = m\n if r == 0:\n d = [a] + d\n else:\n d[r - 1] = a\nprint(len(d))", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given a sequence with N integers: A = \\{ A_1, A_2, \\cdots, A_N \\}.\nFor each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:\n\nIf A_i and A_j (i < j) are painted with the same color, A_i < A_j.\n\nFind the minimum number of colors required to satisfy the condition.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the minimum number of colors required to satisfy the condition.\n\nSample Input 1\n\n5\n2\n1\n4\n5\n3\n\nSample Output 1\n\n2\n\nWe can satisfy the condition with two colors by, for example, painting 2 and 3 red and painting 1, 4, and 5 blue.\n\nSample Input 2\n\n4\n0\n0\n0\n0\n\nSample Output 2\n\n4\n\nWe have to paint all the integers with distinct colors.", "sample_input": "5\n2\n1\n4\n5\n3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02973", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given a sequence with N integers: A = \\{ A_1, A_2, \\cdots, A_N \\}.\nFor each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:\n\nIf A_i and A_j (i < j) are painted with the same color, A_i < A_j.\n\nFind the minimum number of colors required to satisfy the condition.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the minimum number of colors required to satisfy the condition.\n\nSample Input 1\n\n5\n2\n1\n4\n5\n3\n\nSample Output 1\n\n2\n\nWe can satisfy the condition with two colors by, for example, painting 2 and 3 red and painting 1, 4, and 5 blue.\n\nSample Input 2\n\n4\n0\n0\n0\n0\n\nSample Output 2\n\n4\n\nWe have to paint all the integers with distinct colors.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 647, "cpu_time_ms": 2206, "memory_kb": 13776}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s980164602", "group_id": "codeNet:p02975", "input_text": "from collections import Counter\ndef check():\n N = int(input())\n A = list(map(int, input().split()))\n if N%3 in [1,2]:\n if A!=[0]*N:\n return 'No'\n return 'Yes'\n c = Counter(A)\n if len(c)==1:\n if c[0]==0:\n return 'No'\n return 'Yes'\n if len(c)==2:\n if c[0]!=N//3:\n return 'No'\n return 'Yes'\n if len(c)==3:\n lis = []\n for k,v in c.items():\n if v!=N//3:\n return 'No'\n lis.append(k)\n if lis[0]^lis[1]==lis[2]:\n return 'Yes'\n return 'No'\nprint(check())", "language": "Python", "metadata": {"date": 1596529697, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02975.html", "problem_id": "p02975", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02975/input.txt", "sample_output_relpath": "derived/input_output/data/p02975/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02975/Python/s980164602.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s980164602", "user_id": "u678167152"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "from collections import Counter\ndef check():\n N = int(input())\n A = list(map(int, input().split()))\n if N%3 in [1,2]:\n if A!=[0]*N:\n return 'No'\n return 'Yes'\n c = Counter(A)\n if len(c)==1:\n if c[0]==0:\n return 'No'\n return 'Yes'\n if len(c)==2:\n if c[0]!=N//3:\n return 'No'\n return 'Yes'\n if len(c)==3:\n lis = []\n for k,v in c.items():\n if v!=N//3:\n return 'No'\n lis.append(k)\n if lis[0]^lis[1]==lis[2]:\n return 'Yes'\n return 'No'\nprint(check())", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has N hats. The i-th hat has an integer a_i written on it.\n\nThere are N camels standing in a circle.\nSnuke will put one of his hats on each of these camels.\n\nIf there exists a way to distribute the hats to the camels such that the following condition is satisfied for every camel, print Yes; otherwise, print No.\n\nThe bitwise XOR of the numbers written on the hats on both adjacent camels is equal to the number on the hat on itself.\n\nWhat is XOR?\n\nThe bitwise XOR x_1 \\oplus x_2 \\oplus \\ldots \\oplus x_n of n non-negative integers x_1, x_2, \\ldots, x_n is defined as follows:\n\n- When x_1 \\oplus x_2 \\oplus \\ldots \\oplus x_n is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if the number of integers among x_1, x_2, \\ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even.\n\nFor example, 3 \\oplus 5 = 6.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^{5}\n\n0 \\leq a_i \\leq 10^{9}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 \\ldots a_{N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\nYes\n\nIf we put the hats with 1, 2, and 3 in this order, clockwise, the condition will be satisfied for every camel, so the answer is Yes.\n\nSample Input 2\n\n4\n1 2 4 8\n\nSample Output 2\n\nNo\n\nThere is no such way to distribute the hats; the answer is No.", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02975", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has N hats. The i-th hat has an integer a_i written on it.\n\nThere are N camels standing in a circle.\nSnuke will put one of his hats on each of these camels.\n\nIf there exists a way to distribute the hats to the camels such that the following condition is satisfied for every camel, print Yes; otherwise, print No.\n\nThe bitwise XOR of the numbers written on the hats on both adjacent camels is equal to the number on the hat on itself.\n\nWhat is XOR?\n\nThe bitwise XOR x_1 \\oplus x_2 \\oplus \\ldots \\oplus x_n of n non-negative integers x_1, x_2, \\ldots, x_n is defined as follows:\n\n- When x_1 \\oplus x_2 \\oplus \\ldots \\oplus x_n is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if the number of integers among x_1, x_2, \\ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even.\n\nFor example, 3 \\oplus 5 = 6.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^{5}\n\n0 \\leq a_i \\leq 10^{9}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 \\ldots a_{N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\nYes\n\nIf we put the hats with 1, 2, and 3 in this order, clockwise, the condition will be satisfied for every camel, so the answer is Yes.\n\nSample Input 2\n\n4\n1 2 4 8\n\nSample Output 2\n\nNo\n\nThere is no such way to distribute the hats; the answer is No.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 517, "cpu_time_ms": 54, "memory_kb": 20648}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s136556716", "group_id": "codeNet:p02984", "input_text": "import numpy as np\nN = int(input())\nA = list(map(int, input().split()))\na = np.array(A)\n# l = int(((N*N)+1)/2)\nb = []\nfor i in range(N):\n if i%2==0:\n b.append(1)\n else:\n b.append(-1)\nc = np.dot(np.array(b),a)\nx = [c]\nfor j in range(1,N):\n x_j = 2*a[j-1] - x[j-1]\n x.append(x_j)\nans = list(map(str, list(map(int, list(x)))))\nprint(\" \".join(ans))", "language": "Python", "metadata": {"date": 1563514261, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02984.html", "problem_id": "p02984", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02984/input.txt", "sample_output_relpath": "derived/input_output/data/p02984/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02984/Python/s136556716.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s136556716", "user_id": "u255673886"}, "prompt_components": {"gold_output": "4 0 4\n", "input_to_evaluate": "import numpy as np\nN = int(input())\nA = list(map(int, input().split()))\na = np.array(A)\n# l = int(((N*N)+1)/2)\nb = []\nfor i in range(N):\n if i%2==0:\n b.append(1)\n else:\n b.append(-1)\nc = np.dot(np.array(b),a)\nx = [c]\nfor j in range(1,N):\n x_j = 2*a[j-1] - x[j-1]\n x.append(x_j)\nans = list(map(str, list(map(int, list(x)))))\nprint(\" \".join(ans))", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number.\n\nBetween these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \\leq i \\leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1).\n\nWhen Mountain i (1 \\leq i \\leq N) receives 2x liters of rain, Dam i-1 and Dam i each accumulates x liters of water (Dam 0 is Dam N).\n\nOne day, each of the mountains received a non-negative even number of liters of rain.\n\nAs a result, Dam i (1 \\leq i \\leq N) accumulated a total of A_i liters of water.\n\nFind the amount of rain each of the mountains received. We can prove that the solution is unique under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^5-1\n\nN is an odd number.\n\n0 \\leq A_i \\leq 10^9\n\nThe situation represented by input can occur when each of the mountains receives a non-negative even number of liters of rain.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N integers representing the number of liters of rain Mountain 1, Mountain 2, ..., Mountain N received, in this order.\n\nSample Input 1\n\n3\n2 2 4\n\nSample Output 1\n\n4 0 4\n\nIf we assume Mountain 1, 2, and 3 received 4, 0, and 4 liters of rain, respectively, it is consistent with this input, as follows:\n\nDam 1 should have accumulated \\frac{4}{2} + \\frac{0}{2} = 2 liters of water.\n\nDam 2 should have accumulated \\frac{0}{2} + \\frac{4}{2} = 2 liters of water.\n\nDam 3 should have accumulated \\frac{4}{2} + \\frac{4}{2} = 4 liters of water.\n\nSample Input 2\n\n5\n3 8 7 5 5\n\nSample Output 2\n\n2 4 12 2 8\n\nSample Input 3\n\n3\n1000000000 1000000000 0\n\nSample Output 3\n\n0 2000000000 0", "sample_input": "3\n2 2 4\n"}, "reference_outputs": ["4 0 4\n"], "source_document_id": "p02984", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number.\n\nBetween these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \\leq i \\leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1).\n\nWhen Mountain i (1 \\leq i \\leq N) receives 2x liters of rain, Dam i-1 and Dam i each accumulates x liters of water (Dam 0 is Dam N).\n\nOne day, each of the mountains received a non-negative even number of liters of rain.\n\nAs a result, Dam i (1 \\leq i \\leq N) accumulated a total of A_i liters of water.\n\nFind the amount of rain each of the mountains received. We can prove that the solution is unique under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^5-1\n\nN is an odd number.\n\n0 \\leq A_i \\leq 10^9\n\nThe situation represented by input can occur when each of the mountains receives a non-negative even number of liters of rain.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N integers representing the number of liters of rain Mountain 1, Mountain 2, ..., Mountain N received, in this order.\n\nSample Input 1\n\n3\n2 2 4\n\nSample Output 1\n\n4 0 4\n\nIf we assume Mountain 1, 2, and 3 received 4, 0, and 4 liters of rain, respectively, it is consistent with this input, as follows:\n\nDam 1 should have accumulated \\frac{4}{2} + \\frac{0}{2} = 2 liters of water.\n\nDam 2 should have accumulated \\frac{0}{2} + \\frac{4}{2} = 2 liters of water.\n\nDam 3 should have accumulated \\frac{4}{2} + \\frac{4}{2} = 4 liters of water.\n\nSample Input 2\n\n5\n3 8 7 5 5\n\nSample Output 2\n\n2 4 12 2 8\n\nSample Input 3\n\n3\n1000000000 1000000000 0\n\nSample Output 3\n\n0 2000000000 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 370, "cpu_time_ms": 404, "memory_kb": 32572}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s765183046", "group_id": "codeNet:p02987", "input_text": "s = list(input())\ncount = int(0)\nfor i in s:\n for j in s:\n if(i==j):\n count += 1\nif(count == 8):\n print(\"Yes\")\nelse:\n print(\"No\")", "language": "Python", "metadata": {"date": 1562034803, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02987.html", "problem_id": "p02987", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02987/input.txt", "sample_output_relpath": "derived/input_output/data/p02987/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02987/Python/s765183046.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s765183046", "user_id": "u245788181"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "s = list(input())\ncount = int(0)\nfor i in s:\n for j in s:\n if(i==j):\n count += 1\nif(count == 8):\n print(\"Yes\")\nelse:\n print(\"No\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a 4-character string S consisting of uppercase English letters.\nDetermine if S consists of exactly two kinds of characters which both appear twice in S.\n\nConstraints\n\nThe length of S is 4.\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S consists of exactly two kinds of characters which both appear twice in S, print Yes; otherwise, print No.\n\nSample Input 1\n\nASSA\n\nSample Output 1\n\nYes\n\nS consists of A and S which both appear twice in S.\n\nSample Input 2\n\nSTOP\n\nSample Output 2\n\nNo\n\nSample Input 3\n\nFFEE\n\nSample Output 3\n\nYes\n\nSample Input 4\n\nFREE\n\nSample Output 4\n\nNo", "sample_input": "ASSA\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02987", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a 4-character string S consisting of uppercase English letters.\nDetermine if S consists of exactly two kinds of characters which both appear twice in S.\n\nConstraints\n\nThe length of S is 4.\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S consists of exactly two kinds of characters which both appear twice in S, print Yes; otherwise, print No.\n\nSample Input 1\n\nASSA\n\nSample Output 1\n\nYes\n\nS consists of A and S which both appear twice in S.\n\nSample Input 2\n\nSTOP\n\nSample Output 2\n\nNo\n\nSample Input 3\n\nFFEE\n\nSample Output 3\n\nYes\n\nSample Input 4\n\nFREE\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 156, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s564656734", "group_id": "codeNet:p02987", "input_text": "S = list(input())\nA = S[0]\nwhile A in S :\n S.remove(A)\nif len(S) == 2 :\n if S[0] == S[1] :\n print(\"Yes\")\n else :\n print(\"No\")\nelse :\n print(\"No\")", "language": "Python", "metadata": {"date": 1561859798, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02987.html", "problem_id": "p02987", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02987/input.txt", "sample_output_relpath": "derived/input_output/data/p02987/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02987/Python/s564656734.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s564656734", "user_id": "u233720439"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "S = list(input())\nA = S[0]\nwhile A in S :\n S.remove(A)\nif len(S) == 2 :\n if S[0] == S[1] :\n print(\"Yes\")\n else :\n print(\"No\")\nelse :\n print(\"No\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a 4-character string S consisting of uppercase English letters.\nDetermine if S consists of exactly two kinds of characters which both appear twice in S.\n\nConstraints\n\nThe length of S is 4.\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S consists of exactly two kinds of characters which both appear twice in S, print Yes; otherwise, print No.\n\nSample Input 1\n\nASSA\n\nSample Output 1\n\nYes\n\nS consists of A and S which both appear twice in S.\n\nSample Input 2\n\nSTOP\n\nSample Output 2\n\nNo\n\nSample Input 3\n\nFFEE\n\nSample Output 3\n\nYes\n\nSample Input 4\n\nFREE\n\nSample Output 4\n\nNo", "sample_input": "ASSA\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02987", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a 4-character string S consisting of uppercase English letters.\nDetermine if S consists of exactly two kinds of characters which both appear twice in S.\n\nConstraints\n\nThe length of S is 4.\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S consists of exactly two kinds of characters which both appear twice in S, print Yes; otherwise, print No.\n\nSample Input 1\n\nASSA\n\nSample Output 1\n\nYes\n\nS consists of A and S which both appear twice in S.\n\nSample Input 2\n\nSTOP\n\nSample Output 2\n\nNo\n\nSample Input 3\n\nFFEE\n\nSample Output 3\n\nYes\n\nSample Input 4\n\nFREE\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 171, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s893921675", "group_id": "codeNet:p02988", "input_text": "n = int(input())\np = list(map(int, input().split()))\n\nans = set()\nfor i in range(1, n-1):\n\ta = []\n\ta.append(p[i-1])\n\ta.append(p[i])\n\ta.append(p[i+1])\n\ta.sort()\n\tif a[0] < a[1] and a[1] < a[2]:\n\t ans.add(a[1])\n\t\nprint(len(ans))", "language": "Python", "metadata": {"date": 1579800645, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02988.html", "problem_id": "p02988", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02988/input.txt", "sample_output_relpath": "derived/input_output/data/p02988/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02988/Python/s893921675.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s893921675", "user_id": "u861141787"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n = int(input())\np = list(map(int, input().split()))\n\nans = set()\nfor i in range(1, n-1):\n\ta = []\n\ta.append(p[i-1])\n\ta.append(p[i])\n\ta.append(p[i+1])\n\ta.sort()\n\tif a[0] < a[1] and a[1] < a[2]:\n\t ans.add(a[1])\n\t\nprint(len(ans))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a permutation p = {p_1,\\ p_2,\\ ...,\\ p_n} of {1,\\ 2,\\ ...,\\ n}.\n\nPrint the number of elements p_i (1 < i < n) that satisfy the following condition:\n\np_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq n \\leq 20\n\np is a permutation of {1,\\ 2,\\ ...,\\ n}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\np_1 p_2 ... p_n\n\nOutput\n\nPrint the number of elements p_i (1 < i < n) that satisfy the condition.\n\nSample Input 1\n\n5\n1 3 5 4 2\n\nSample Output 1\n\n2\n\np_2 = 3 is the second smallest number among p_1 = 1, p_2 = 3, and p_3 = 5. Also, p_4 = 4 is the second smallest number among p_3 = 5, p_4 = 4, and p_5 = 2. These two elements satisfy the condition.\n\nSample Input 2\n\n9\n9 6 3 2 5 8 7 4 1\n\nSample Output 2\n\n5", "sample_input": "5\n1 3 5 4 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02988", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a permutation p = {p_1,\\ p_2,\\ ...,\\ p_n} of {1,\\ 2,\\ ...,\\ n}.\n\nPrint the number of elements p_i (1 < i < n) that satisfy the following condition:\n\np_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq n \\leq 20\n\np is a permutation of {1,\\ 2,\\ ...,\\ n}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\np_1 p_2 ... p_n\n\nOutput\n\nPrint the number of elements p_i (1 < i < n) that satisfy the condition.\n\nSample Input 1\n\n5\n1 3 5 4 2\n\nSample Output 1\n\n2\n\np_2 = 3 is the second smallest number among p_1 = 1, p_2 = 3, and p_3 = 5. Also, p_4 = 4 is the second smallest number among p_3 = 5, p_4 = 4, and p_5 = 2. These two elements satisfy the condition.\n\nSample Input 2\n\n9\n9 6 3 2 5 8 7 4 1\n\nSample Output 2\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 227, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s383462000", "group_id": "codeNet:p02989", "input_text": "n = int(input())\na = list(map(int,input().split()))\na.sort()\nprint(a[n//2]-a[n//2-1])", "language": "Python", "metadata": {"date": 1590104124, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02989.html", "problem_id": "p02989", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02989/input.txt", "sample_output_relpath": "derived/input_output/data/p02989/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02989/Python/s383462000.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s383462000", "user_id": "u592248346"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n = int(input())\na = list(map(int,input().split()))\na.sort()\nprint(a[n//2]-a[n//2-1])", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi made N problems for competitive programming.\nThe problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).\n\nHe is dividing the problems into two categories by choosing an integer K, as follows:\n\nA problem with difficulty K or higher will be for ARCs.\n\nA problem with difficulty lower than K will be for ABCs.\n\nHow many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?\n\nProblem Statement\n\n2 \\leq N \\leq 10^5\n\nN is an even number.\n\n1 \\leq d_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1 d_2 ... d_N\n\nOutput\n\nPrint the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 1\n\n6\n9 1 4 4 6 7\n\nSample Output 1\n\n2\n\nIf we choose K=5 or 6, Problem 1, 5, and 6 will be for ARCs, Problem 2, 3, and 4 will be for ABCs, and the objective is achieved.\nThus, the answer is 2.\n\nSample Input 2\n\n8\n9 1 14 5 5 4 4 14\n\nSample Output 2\n\n0\n\nThere may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 3\n\n14\n99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1\n\nSample Output 3\n\n42685", "sample_input": "6\n9 1 4 4 6 7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02989", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi made N problems for competitive programming.\nThe problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).\n\nHe is dividing the problems into two categories by choosing an integer K, as follows:\n\nA problem with difficulty K or higher will be for ARCs.\n\nA problem with difficulty lower than K will be for ABCs.\n\nHow many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?\n\nProblem Statement\n\n2 \\leq N \\leq 10^5\n\nN is an even number.\n\n1 \\leq d_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1 d_2 ... d_N\n\nOutput\n\nPrint the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 1\n\n6\n9 1 4 4 6 7\n\nSample Output 1\n\n2\n\nIf we choose K=5 or 6, Problem 1, 5, and 6 will be for ARCs, Problem 2, 3, and 4 will be for ABCs, and the objective is achieved.\nThus, the answer is 2.\n\nSample Input 2\n\n8\n9 1 14 5 5 4 4 14\n\nSample Output 2\n\n0\n\nThere may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 3\n\n14\n99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1\n\nSample Output 3\n\n42685", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 85, "cpu_time_ms": 76, "memory_kb": 14428}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s282815086", "group_id": "codeNet:p02990", "input_text": "import sys\nsys.setrecursionlimit(1000000)\n\nN,blue = map(int,input().split())\nred = N-blue\n\ndef cmb(n, r):\n nCr = {}\n if r == 0 or r == n: return 1\n if r == 1: return n\n if (n,r) in nCr: return nCr[(n,r)]\n nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)\n return nCr[(n,r)]\n\n# 操作回数\nmax_opr = min(red+1, blue)\n\nfor i in range(1,max_opr+1):\n # 青の差し込み箇所(操作回数)\n ins_ptn = cmb(red+1, i)\n # 青の配置方法\n layout_ptn = cmb(blue-1, i-1)\n print(ins_ptn * layout_ptn % (10**9+7))", "language": "Python", "metadata": {"date": 1561944738, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p02990.html", "problem_id": "p02990", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02990/input.txt", "sample_output_relpath": "derived/input_output/data/p02990/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02990/Python/s282815086.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s282815086", "user_id": "u945418216"}, "prompt_components": {"gold_output": "3\n6\n1\n", "input_to_evaluate": "import sys\nsys.setrecursionlimit(1000000)\n\nN,blue = map(int,input().split())\nred = N-blue\n\ndef cmb(n, r):\n nCr = {}\n if r == 0 or r == n: return 1\n if r == 1: return n\n if (n,r) in nCr: return nCr[(n,r)]\n nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)\n return nCr[(n,r)]\n\n# 操作回数\nmax_opr = min(red+1, blue)\n\nfor i in range(1,max_opr+1):\n # 青の差し込み箇所(操作回数)\n ins_ptn = cmb(red+1, i)\n # 青の配置方法\n layout_ptn = cmb(blue-1, i-1)\n print(ins_ptn * layout_ptn % (10**9+7))", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "sample_input": "5 3\n"}, "reference_outputs": ["3\n6\n1\n"], "source_document_id": "p02990", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 533, "cpu_time_ms": 2111, "memory_kb": 125960}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s586438612", "group_id": "codeNet:p02993", "input_text": "s = input()\nif len(set(s)) == 4:\n print('Good')\nelif len(set(s)) == 1:\n print('Bad')\nelif len(set(s)) == 2:\n if s[0] == s[2] and s.count(s[0]) == 2:\n print('Good')\n else:\n print('Bad')\nelse:\n if s[0] == s[1] or s[1] == s[2] or s[2] ==s[3]:\n print('Bad')\n else:\n print('Good')", "language": "Python", "metadata": {"date": 1565049632, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02993.html", "problem_id": "p02993", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02993/input.txt", "sample_output_relpath": "derived/input_output/data/p02993/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02993/Python/s586438612.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s586438612", "user_id": "u598229387"}, "prompt_components": {"gold_output": "Bad\n", "input_to_evaluate": "s = input()\nif len(set(s)) == 4:\n print('Good')\nelif len(set(s)) == 1:\n print('Bad')\nelif len(set(s)) == 2:\n if s[0] == s[2] and s.count(s[0]) == 2:\n print('Good')\n else:\n print('Bad')\nelse:\n if s[0] == s[1] or s[1] == s[2] or s[2] ==s[3]:\n print('Bad')\n else:\n print('Good')", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThe door of Snuke's laboratory is locked with a security code.\n\nThe security code is a 4-digit number. We say the security code is hard to enter when it contains two consecutive digits that are the same.\n\nYou are given the current security code S. If S is hard to enter, print Bad; otherwise, print Good.\n\nConstraints\n\nS is a 4-character string consisting of digits.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is hard to enter, print Bad; otherwise, print Good.\n\nSample Input 1\n\n3776\n\nSample Output 1\n\nBad\n\nThe second and third digits are the same, so 3776 is hard to enter.\n\nSample Input 2\n\n8080\n\nSample Output 2\n\nGood\n\nThere are no two consecutive digits that are the same, so 8080 is not hard to enter.\n\nSample Input 3\n\n1333\n\nSample Output 3\n\nBad\n\nSample Input 4\n\n0024\n\nSample Output 4\n\nBad", "sample_input": "3776\n"}, "reference_outputs": ["Bad\n"], "source_document_id": "p02993", "source_text": "Score : 100 points\n\nProblem Statement\n\nThe door of Snuke's laboratory is locked with a security code.\n\nThe security code is a 4-digit number. We say the security code is hard to enter when it contains two consecutive digits that are the same.\n\nYou are given the current security code S. If S is hard to enter, print Bad; otherwise, print Good.\n\nConstraints\n\nS is a 4-character string consisting of digits.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is hard to enter, print Bad; otherwise, print Good.\n\nSample Input 1\n\n3776\n\nSample Output 1\n\nBad\n\nThe second and third digits are the same, so 3776 is hard to enter.\n\nSample Input 2\n\n8080\n\nSample Output 2\n\nGood\n\nThere are no two consecutive digits that are the same, so 8080 is not hard to enter.\n\nSample Input 3\n\n1333\n\nSample Output 3\n\nBad\n\nSample Input 4\n\n0024\n\nSample Output 4\n\nBad", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 18, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s055896502", "group_id": "codeNet:p02994", "input_text": "n, l = map(int, input().split())\n\n\na = []\nres = 300\nfor i in range(n):\n a.append(l+i)\n res = min(res, abs(l+i))\ns = sum(a)\nif res in a:\n print(s-res)\nelse:\n print(s+res)", "language": "Python", "metadata": {"date": 1593830856, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p02994.html", "problem_id": "p02994", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02994/input.txt", "sample_output_relpath": "derived/input_output/data/p02994/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02994/Python/s055896502.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s055896502", "user_id": "u583507988"}, "prompt_components": {"gold_output": "18\n", "input_to_evaluate": "n, l = map(int, input().split())\n\n\na = []\nres = 300\nfor i in range(n):\n a.append(l+i)\n res = min(res, abs(l+i))\ns = sum(a)\nif res in a:\n print(s-res)\nelse:\n print(s+res)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The flavor of Apple i is L+i-1, which can be negative.\n\nYou can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.\n\nYou planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.\n\nYou want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.\n\nWe can prove that this value is uniquely determined.\n\nConstraints\n\n2 \\leq N \\leq 200\n\n-100 \\leq L \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN L\n\nOutput\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you optimally choose the apple to eat.\n\nSample Input 1\n\n5 2\n\nSample Output 1\n\n18\n\nThe flavors of Apple 1, 2, 3, 4, and 5 are 2, 3, 4, 5, and 6, respectively. The optimal choice is to eat Apple 1, so the answer is 3+4+5+6=18.\n\nSample Input 2\n\n3 -1\n\nSample Output 2\n\n0\n\nThe flavors of Apple 1, 2, and 3 are -1, 0, and 1, respectively. The optimal choice is to eat Apple 2, so the answer is (-1)+1=0.\n\nSample Input 3\n\n30 -50\n\nSample Output 3\n\n-1044", "sample_input": "5 2\n"}, "reference_outputs": ["18\n"], "source_document_id": "p02994", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The flavor of Apple i is L+i-1, which can be negative.\n\nYou can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.\n\nYou planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.\n\nYou want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.\n\nWe can prove that this value is uniquely determined.\n\nConstraints\n\n2 \\leq N \\leq 200\n\n-100 \\leq L \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN L\n\nOutput\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you optimally choose the apple to eat.\n\nSample Input 1\n\n5 2\n\nSample Output 1\n\n18\n\nThe flavors of Apple 1, 2, 3, 4, and 5 are 2, 3, 4, 5, and 6, respectively. The optimal choice is to eat Apple 1, so the answer is 3+4+5+6=18.\n\nSample Input 2\n\n3 -1\n\nSample Output 2\n\n0\n\nThe flavors of Apple 1, 2, and 3 are -1, 0, and 1, respectively. The optimal choice is to eat Apple 2, so the answer is (-1)+1=0.\n\nSample Input 3\n\n30 -50\n\nSample Output 3\n\n-1044", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 27, "memory_kb": 9124}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s051721776", "group_id": "codeNet:p02994", "input_text": "N, L = map(int, input().split())\n \nif L > -1:\n N_eat = 1\nelif N+L-1 < 1:\n N_eat = N\nelse:\n N_eat = 1-L\n \npie = N*(N+1)/2 +N*(L-1) - (L + N_eat-1) \nprint(pie)", "language": "Python", "metadata": {"date": 1561355012, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02994.html", "problem_id": "p02994", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02994/input.txt", "sample_output_relpath": "derived/input_output/data/p02994/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02994/Python/s051721776.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s051721776", "user_id": "u006251926"}, "prompt_components": {"gold_output": "18\n", "input_to_evaluate": "N, L = map(int, input().split())\n \nif L > -1:\n N_eat = 1\nelif N+L-1 < 1:\n N_eat = N\nelse:\n N_eat = 1-L\n \npie = N*(N+1)/2 +N*(L-1) - (L + N_eat-1) \nprint(pie)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The flavor of Apple i is L+i-1, which can be negative.\n\nYou can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.\n\nYou planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.\n\nYou want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.\n\nWe can prove that this value is uniquely determined.\n\nConstraints\n\n2 \\leq N \\leq 200\n\n-100 \\leq L \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN L\n\nOutput\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you optimally choose the apple to eat.\n\nSample Input 1\n\n5 2\n\nSample Output 1\n\n18\n\nThe flavors of Apple 1, 2, 3, 4, and 5 are 2, 3, 4, 5, and 6, respectively. The optimal choice is to eat Apple 1, so the answer is 3+4+5+6=18.\n\nSample Input 2\n\n3 -1\n\nSample Output 2\n\n0\n\nThe flavors of Apple 1, 2, and 3 are -1, 0, and 1, respectively. The optimal choice is to eat Apple 2, so the answer is (-1)+1=0.\n\nSample Input 3\n\n30 -50\n\nSample Output 3\n\n-1044", "sample_input": "5 2\n"}, "reference_outputs": ["18\n"], "source_document_id": "p02994", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The flavor of Apple i is L+i-1, which can be negative.\n\nYou can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.\n\nYou planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.\n\nYou want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.\n\nWe can prove that this value is uniquely determined.\n\nConstraints\n\n2 \\leq N \\leq 200\n\n-100 \\leq L \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN L\n\nOutput\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you optimally choose the apple to eat.\n\nSample Input 1\n\n5 2\n\nSample Output 1\n\n18\n\nThe flavors of Apple 1, 2, 3, 4, and 5 are 2, 3, 4, 5, and 6, respectively. The optimal choice is to eat Apple 1, so the answer is 3+4+5+6=18.\n\nSample Input 2\n\n3 -1\n\nSample Output 2\n\n0\n\nThe flavors of Apple 1, 2, and 3 are -1, 0, and 1, respectively. The optimal choice is to eat Apple 2, so the answer is (-1)+1=0.\n\nSample Input 3\n\n30 -50\n\nSample Output 3\n\n-1044", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 160, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s064955614", "group_id": "codeNet:p02994", "input_text": "import numpy as np\n\nN,L=map(int, input().split())\ntaste=0\nApple_taste=[]\n\nfor i in range(N):\n taste=L+i\n Apple_taste.append(taste)\n\nAbs=[abs(t) for t in Apple_taste]\n\ni_m=np.argmin(Abs)\ndel Apple_taste[i_m]\n\nprint(sum(Apple_taste))\n\n", "language": "Python", "metadata": {"date": 1561254257, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02994.html", "problem_id": "p02994", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02994/input.txt", "sample_output_relpath": "derived/input_output/data/p02994/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02994/Python/s064955614.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s064955614", "user_id": "u015187377"}, "prompt_components": {"gold_output": "18\n", "input_to_evaluate": "import numpy as np\n\nN,L=map(int, input().split())\ntaste=0\nApple_taste=[]\n\nfor i in range(N):\n taste=L+i\n Apple_taste.append(taste)\n\nAbs=[abs(t) for t in Apple_taste]\n\ni_m=np.argmin(Abs)\ndel Apple_taste[i_m]\n\nprint(sum(Apple_taste))\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The flavor of Apple i is L+i-1, which can be negative.\n\nYou can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.\n\nYou planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.\n\nYou want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.\n\nWe can prove that this value is uniquely determined.\n\nConstraints\n\n2 \\leq N \\leq 200\n\n-100 \\leq L \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN L\n\nOutput\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you optimally choose the apple to eat.\n\nSample Input 1\n\n5 2\n\nSample Output 1\n\n18\n\nThe flavors of Apple 1, 2, 3, 4, and 5 are 2, 3, 4, 5, and 6, respectively. The optimal choice is to eat Apple 1, so the answer is 3+4+5+6=18.\n\nSample Input 2\n\n3 -1\n\nSample Output 2\n\n0\n\nThe flavors of Apple 1, 2, and 3 are -1, 0, and 1, respectively. The optimal choice is to eat Apple 2, so the answer is (-1)+1=0.\n\nSample Input 3\n\n30 -50\n\nSample Output 3\n\n-1044", "sample_input": "5 2\n"}, "reference_outputs": ["18\n"], "source_document_id": "p02994", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The flavor of Apple i is L+i-1, which can be negative.\n\nYou can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.\n\nYou planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.\n\nYou want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.\n\nWe can prove that this value is uniquely determined.\n\nConstraints\n\n2 \\leq N \\leq 200\n\n-100 \\leq L \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN L\n\nOutput\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you optimally choose the apple to eat.\n\nSample Input 1\n\n5 2\n\nSample Output 1\n\n18\n\nThe flavors of Apple 1, 2, 3, 4, and 5 are 2, 3, 4, 5, and 6, respectively. The optimal choice is to eat Apple 1, so the answer is 3+4+5+6=18.\n\nSample Input 2\n\n3 -1\n\nSample Output 2\n\n0\n\nThe flavors of Apple 1, 2, and 3 are -1, 0, and 1, respectively. The optimal choice is to eat Apple 2, so the answer is (-1)+1=0.\n\nSample Input 3\n\n30 -50\n\nSample Output 3\n\n-1044", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 239, "cpu_time_ms": 153, "memory_kb": 12448}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s278976219", "group_id": "codeNet:p02995", "input_text": "import copy\nimport math\n\ninp = str(input())\n# inp = \"314159265358979323 846264338327950288 419716939 937510582\"\ninp = inp.split(\" \")\na = int(inp[0])\nb = int(inp[1])\nc = int(inp[2])\nd = int(inp[3])\n\nh = c * d / math.gcd(c, d)\ne = int(b / c) - int((a-1) / c)\nf = int(b / d) - int((a-1) / d)\ng = int(b / h) - int((a-1) / h)\n\nprint((b-a+1)-(e+f-g))", "language": "Python", "metadata": {"date": 1561370744, "filename_ext": "py", "original_language": "Python (2.7.6)", "problem_description_relpath": "problem_descriptions/p02995.html", "problem_id": "p02995", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02995/input.txt", "sample_output_relpath": "derived/input_output/data/p02995/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02995/Python/s278976219.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s278976219", "user_id": "u669322232"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import copy\nimport math\n\ninp = str(input())\n# inp = \"314159265358979323 846264338327950288 419716939 937510582\"\ninp = inp.split(\" \")\na = int(inp[0])\nb = int(inp[1])\nc = int(inp[2])\nd = int(inp[3])\n\nh = c * d / math.gcd(c, d)\ne = int(b / c) - int((a-1) / c)\nf = int(b / d) - int((a-1) / d)\ng = int(b / h) - int((a-1) / h)\n\nprint((b-a+1)-(e+f-g))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nConstraints\n\n1\\leq A\\leq B\\leq 10^{18}\n\n1\\leq C,D\\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C D\n\nOutput\n\nPrint the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nSample Input 1\n\n4 9 2 3\n\nSample Output 1\n\n2\n\n5 and 7 satisfy the condition.\n\nSample Input 2\n\n10 40 6 8\n\nSample Output 2\n\n23\n\nSample Input 3\n\n314159265358979323 846264338327950288 419716939 937510582\n\nSample Output 3\n\n532105071133627368", "sample_input": "4 9 2 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02995", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nConstraints\n\n1\\leq A\\leq B\\leq 10^{18}\n\n1\\leq C,D\\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C D\n\nOutput\n\nPrint the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nSample Input 1\n\n4 9 2 3\n\nSample Output 1\n\n2\n\n5 and 7 satisfy the condition.\n\nSample Input 2\n\n10 40 6 8\n\nSample Output 2\n\n23\n\nSample Input 3\n\n314159265358979323 846264338327950288 419716939 937510582\n\nSample Output 3\n\n532105071133627368", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 344, "cpu_time_ms": 12, "memory_kb": 2692}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s396238521", "group_id": "codeNet:p02995", "input_text": "a,b,c,d = input().split()\na,b,c,d = int(a),int(b),int(c),int(d)\nad = []\nfor num in range(a,b+1):\n if num%c!=0:\n if num%d!=0:\n ad.append(num)\n\nprint(len(ad))", "language": "Python", "metadata": {"date": 1561316003, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02995.html", "problem_id": "p02995", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02995/input.txt", "sample_output_relpath": "derived/input_output/data/p02995/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02995/Python/s396238521.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s396238521", "user_id": "u921178362"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "a,b,c,d = input().split()\na,b,c,d = int(a),int(b),int(c),int(d)\nad = []\nfor num in range(a,b+1):\n if num%c!=0:\n if num%d!=0:\n ad.append(num)\n\nprint(len(ad))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nConstraints\n\n1\\leq A\\leq B\\leq 10^{18}\n\n1\\leq C,D\\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C D\n\nOutput\n\nPrint the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nSample Input 1\n\n4 9 2 3\n\nSample Output 1\n\n2\n\n5 and 7 satisfy the condition.\n\nSample Input 2\n\n10 40 6 8\n\nSample Output 2\n\n23\n\nSample Input 3\n\n314159265358979323 846264338327950288 419716939 937510582\n\nSample Output 3\n\n532105071133627368", "sample_input": "4 9 2 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02995", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nConstraints\n\n1\\leq A\\leq B\\leq 10^{18}\n\n1\\leq C,D\\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C D\n\nOutput\n\nPrint the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nSample Input 1\n\n4 9 2 3\n\nSample Output 1\n\n2\n\n5 and 7 satisfy the condition.\n\nSample Input 2\n\n10 40 6 8\n\nSample Output 2\n\n23\n\nSample Input 3\n\n314159265358979323 846264338327950288 419716939 937510582\n\nSample Output 3\n\n532105071133627368", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 177, "cpu_time_ms": 2121, "memory_kb": 285872}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s893168221", "group_id": "codeNet:p02995", "input_text": "a,b,c,d = map(int, input().split())\ncount = 0\nfor i in range(a , b+1):\n e = i % c\n if e != 0:\n f = i % d\n if f != 0:\n count += 1\n \nprint(count)\n", "language": "Python", "metadata": {"date": 1561234473, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02995.html", "problem_id": "p02995", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02995/input.txt", "sample_output_relpath": "derived/input_output/data/p02995/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02995/Python/s893168221.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s893168221", "user_id": "u345136423"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "a,b,c,d = map(int, input().split())\ncount = 0\nfor i in range(a , b+1):\n e = i % c\n if e != 0:\n f = i % d\n if f != 0:\n count += 1\n \nprint(count)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nConstraints\n\n1\\leq A\\leq B\\leq 10^{18}\n\n1\\leq C,D\\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C D\n\nOutput\n\nPrint the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nSample Input 1\n\n4 9 2 3\n\nSample Output 1\n\n2\n\n5 and 7 satisfy the condition.\n\nSample Input 2\n\n10 40 6 8\n\nSample Output 2\n\n23\n\nSample Input 3\n\n314159265358979323 846264338327950288 419716939 937510582\n\nSample Output 3\n\n532105071133627368", "sample_input": "4 9 2 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02995", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nConstraints\n\n1\\leq A\\leq B\\leq 10^{18}\n\n1\\leq C,D\\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C D\n\nOutput\n\nPrint the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nSample Input 1\n\n4 9 2 3\n\nSample Output 1\n\n2\n\n5 and 7 satisfy the condition.\n\nSample Input 2\n\n10 40 6 8\n\nSample Output 2\n\n23\n\nSample Input 3\n\n314159265358979323 846264338327950288 419716939 937510582\n\nSample Output 3\n\n532105071133627368", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 182, "cpu_time_ms": 2104, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s703617194", "group_id": "codeNet:p02995", "input_text": "# n = int(sys.stdin.readline())\n# a, b = map(int, sys.stdin.readline().split())\n# c = list(map(int, sys.stdin.readline().split()))\n# s = [list(map(int,list(sys.stdin.readline()))) for i in range(h)] # 二次元配列入力 二次元マップみたいな入力のとき\n\n# a = 100\n# b = 0.987654321\n# print('{0:06d}-{1:6f}'.format(a,b)) # 0埋め, 小数点出力桁指定時のときの出力\n# 000100-0.987654\n\nimport math\nimport sys\nimport itertools\nimport queue\nfrom functools import reduce\nfrom fractions import gcd\n\ndef lcm(a, b):\n return a * b / gcd(a, b)\n\nmod = 1000000007\n\nif __name__ == \"__main__\":\n A, B, C, D = map(int, sys.stdin.readline().split())\n A = A - 1\n c_div = int(B // C)\n d_div = int(B // D)\n cd_div = int(B // lcm(C, D))\n\n not_div1 = B - (c_div + d_div -cd_div)\n\n c_div = int(A // C)\n d_div = int(A // D)\n cd_div = int(A // lcm(C, D))\n\n not_div2 = A - (c_div + d_div -cd_div)\n\n print(not_div1 - not_div2)\n\n", "language": "Python", "metadata": {"date": 1561234194, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02995.html", "problem_id": "p02995", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02995/input.txt", "sample_output_relpath": "derived/input_output/data/p02995/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02995/Python/s703617194.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s703617194", "user_id": "u714225686"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "# n = int(sys.stdin.readline())\n# a, b = map(int, sys.stdin.readline().split())\n# c = list(map(int, sys.stdin.readline().split()))\n# s = [list(map(int,list(sys.stdin.readline()))) for i in range(h)] # 二次元配列入力 二次元マップみたいな入力のとき\n\n# a = 100\n# b = 0.987654321\n# print('{0:06d}-{1:6f}'.format(a,b)) # 0埋め, 小数点出力桁指定時のときの出力\n# 000100-0.987654\n\nimport math\nimport sys\nimport itertools\nimport queue\nfrom functools import reduce\nfrom fractions import gcd\n\ndef lcm(a, b):\n return a * b / gcd(a, b)\n\nmod = 1000000007\n\nif __name__ == \"__main__\":\n A, B, C, D = map(int, sys.stdin.readline().split())\n A = A - 1\n c_div = int(B // C)\n d_div = int(B // D)\n cd_div = int(B // lcm(C, D))\n\n not_div1 = B - (c_div + d_div -cd_div)\n\n c_div = int(A // C)\n d_div = int(A // D)\n cd_div = int(A // lcm(C, D))\n\n not_div2 = A - (c_div + d_div -cd_div)\n\n print(not_div1 - not_div2)\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nConstraints\n\n1\\leq A\\leq B\\leq 10^{18}\n\n1\\leq C,D\\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C D\n\nOutput\n\nPrint the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nSample Input 1\n\n4 9 2 3\n\nSample Output 1\n\n2\n\n5 and 7 satisfy the condition.\n\nSample Input 2\n\n10 40 6 8\n\nSample Output 2\n\n23\n\nSample Input 3\n\n314159265358979323 846264338327950288 419716939 937510582\n\nSample Output 3\n\n532105071133627368", "sample_input": "4 9 2 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02995", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nConstraints\n\n1\\leq A\\leq B\\leq 10^{18}\n\n1\\leq C,D\\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C D\n\nOutput\n\nPrint the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nSample Input 1\n\n4 9 2 3\n\nSample Output 1\n\n2\n\n5 and 7 satisfy the condition.\n\nSample Input 2\n\n10 40 6 8\n\nSample Output 2\n\n23\n\nSample Input 3\n\n314159265358979323 846264338327950288 419716939 937510582\n\nSample Output 3\n\n532105071133627368", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 37, "memory_kb": 5144}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s532095869", "group_id": "codeNet:p02996", "input_text": "N = int(input())\nAs, Bs = list(), list()\nfor i in range(N):\n A, B = map(int, input().split())\n As.append(A)\n Bs.append(B)\n\nBs_with_index = sorted([(Bs[i], i) for i in range(len(Bs))])\nindices = list(map(lambda b: b[1], Bs_with_index))\n\ntime = 0\nfor index in indices:\n time += As[index]\n if time > Bs[index]:\n print('No')\n break\n\nelse:\n print('Yes')", "language": "Python", "metadata": {"date": 1562405453, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02996.html", "problem_id": "p02996", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02996/input.txt", "sample_output_relpath": "derived/input_output/data/p02996/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02996/Python/s532095869.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s532095869", "user_id": "u593761424"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "N = int(input())\nAs, Bs = list(), list()\nfor i in range(N):\n A, B = map(int, input().split())\n As.append(A)\n Bs.append(B)\n\nBs_with_index = sorted([(Bs[i], i) for i in range(len(Bs))])\nindices = list(map(lambda b: b[1], Bs_with_index))\n\ntime = 0\nfor index in indices:\n time += As[index]\n if time > Bs[index]:\n print('No')\n break\n\nelse:\n print('Yes')", "problem_context": "Score: 400 points\n\nProblem Statement\n\nKizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.\n\nLet the current time be time 0. Kizahashi has N jobs numbered 1 to N.\n\nIt takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.\n\nKizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.\n\nCan Kizahashi complete all the jobs in time? If he can, print Yes; if he cannot, print No.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq 10^9 (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n.\n.\n.\nA_N B_N\n\nOutput\n\nIf Kizahashi can complete all the jobs in time, print Yes; if he cannot, print No.\n\nSample Input 1\n\n5\n2 4\n1 9\n1 8\n4 9\n3 12\n\nSample Output 1\n\nYes\n\nHe can complete all the jobs in time by, for example, doing them in the following order:\n\nDo Job 2 from time 0 to 1.\n\nDo Job 1 from time 1 to 3.\n\nDo Job 4 from time 3 to 7.\n\nDo Job 3 from time 7 to 8.\n\nDo Job 5 from time 8 to 11.\n\nNote that it is fine to complete Job 3 exactly at the deadline, time 8.\n\nSample Input 2\n\n3\n334 1000\n334 1000\n334 1000\n\nSample Output 2\n\nNo\n\nHe cannot complete all the jobs in time, no matter what order he does them in.\n\nSample Input 3\n\n30\n384 8895\n1725 9791\n170 1024\n4 11105\n2 6\n578 1815\n702 3352\n143 5141\n1420 6980\n24 1602\n849 999\n76 7586\n85 5570\n444 4991\n719 11090\n470 10708\n1137 4547\n455 9003\n110 9901\n15 8578\n368 3692\n104 1286\n3 4\n366 12143\n7 6649\n610 2374\n152 7324\n4 7042\n292 11386\n334 5720\n\nSample Output 3\n\nYes", "sample_input": "5\n2 4\n1 9\n1 8\n4 9\n3 12\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02996", "source_text": "Score: 400 points\n\nProblem Statement\n\nKizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.\n\nLet the current time be time 0. Kizahashi has N jobs numbered 1 to N.\n\nIt takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.\n\nKizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.\n\nCan Kizahashi complete all the jobs in time? If he can, print Yes; if he cannot, print No.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq 10^9 (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n.\n.\n.\nA_N B_N\n\nOutput\n\nIf Kizahashi can complete all the jobs in time, print Yes; if he cannot, print No.\n\nSample Input 1\n\n5\n2 4\n1 9\n1 8\n4 9\n3 12\n\nSample Output 1\n\nYes\n\nHe can complete all the jobs in time by, for example, doing them in the following order:\n\nDo Job 2 from time 0 to 1.\n\nDo Job 1 from time 1 to 3.\n\nDo Job 4 from time 3 to 7.\n\nDo Job 3 from time 7 to 8.\n\nDo Job 5 from time 8 to 11.\n\nNote that it is fine to complete Job 3 exactly at the deadline, time 8.\n\nSample Input 2\n\n3\n334 1000\n334 1000\n334 1000\n\nSample Output 2\n\nNo\n\nHe cannot complete all the jobs in time, no matter what order he does them in.\n\nSample Input 3\n\n30\n384 8895\n1725 9791\n170 1024\n4 11105\n2 6\n578 1815\n702 3352\n143 5141\n1420 6980\n24 1602\n849 999\n76 7586\n85 5570\n444 4991\n719 11090\n470 10708\n1137 4547\n455 9003\n110 9901\n15 8578\n368 3692\n104 1286\n3 4\n366 12143\n7 6649\n610 2374\n152 7324\n4 7042\n292 11386\n334 5720\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 380, "cpu_time_ms": 985, "memory_kb": 40516}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s842551801", "group_id": "codeNet:p02997", "input_text": "# encoding:utf-8\nimport copy\nimport random\nimport bisect #bisect_left これで二部探索の大小検索が行える\nimport fractions #最小公倍数などはこっち\nimport math\nimport sys\n\nmod = 10**9+7\nsys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\nN,K = LI()\n\nif K > (N-1)*(N-2)//2 :\n print(\"-1\")\n exit()\nnodes = []\nfor i in range(1,N):\n nodes.append([1,i+1])\nadd = (N-1)*(N-2) // 2 - K\nfor i in range(N-2):\n for j in range(i,N-3):\n add -= 1\n\n if add < 0:\n break\n nodes.append([i+2,j+3])\n else:\n continue\n break\n\nfor node in nodes:\n x,y = node\n print(x,y)\n", "language": "Python", "metadata": {"date": 1561307705, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02997.html", "problem_id": "p02997", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02997/input.txt", "sample_output_relpath": "derived/input_output/data/p02997/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02997/Python/s842551801.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s842551801", "user_id": "u059210959"}, "prompt_components": {"gold_output": "5\n4 3\n1 2\n3 1\n4 5\n2 3\n", "input_to_evaluate": "# encoding:utf-8\nimport copy\nimport random\nimport bisect #bisect_left これで二部探索の大小検索が行える\nimport fractions #最小公倍数などはこっち\nimport math\nimport sys\n\nmod = 10**9+7\nsys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\nN,K = LI()\n\nif K > (N-1)*(N-2)//2 :\n print(\"-1\")\n exit()\nnodes = []\nfor i in range(1,N):\n nodes.append([1,i+1])\nadd = (N-1)*(N-2) // 2 - K\nfor i in range(N-2):\n for j in range(i,N-3):\n add -= 1\n\n if add < 0:\n break\n nodes.append([i+2,j+3])\n else:\n continue\n break\n\nfor node in nodes:\n x,y = node\n print(x,y)\n", "problem_context": "Score: 500 points\n\nProblem Statement\n\nDoes there exist an undirected graph with N vertices satisfying the following conditions?\n\nThe graph is simple and connected.\n\nThe vertices are numbered 1, 2, ..., N.\n\nLet M be the number of edges in the graph. The edges are numbered 1, 2, ..., M, the length of each edge is 1, and Edge i connects Vertex u_i and Vertex v_i.\n\nThere are exactly K pairs of vertices (i,\\ j)\\ (i < j) such that the shortest distance between them is 2.\n\nIf there exists such a graph, construct an example.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 100\n\n0 \\leq K \\leq \\frac{N(N - 1)}{2}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nIf there does not exist an undirected graph with N vertices satisfying the conditions, print -1.\n\nIf there exists such a graph, print an example in the following format (refer to Problem Statement for what the symbols stand for):\n\nM\nu_1 v_1\n:\nu_M v_M\n\nIf there exist multiple graphs satisfying the conditions, any of them will be accepted.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n5\n4 3\n1 2\n3 1\n4 5\n2 3\n\nThis graph has three pairs of vertices such that the shortest distance between them is 2: (1,\\ 4), (2,\\ 4), and (3,\\ 5). Thus, the condition is satisfied.\n\nSample Input 2\n\n5 8\n\nSample Output 2\n\n-1\n\nThere is no graph satisfying the conditions.", "sample_input": "5 3\n"}, "reference_outputs": ["5\n4 3\n1 2\n3 1\n4 5\n2 3\n"], "source_document_id": "p02997", "source_text": "Score: 500 points\n\nProblem Statement\n\nDoes there exist an undirected graph with N vertices satisfying the following conditions?\n\nThe graph is simple and connected.\n\nThe vertices are numbered 1, 2, ..., N.\n\nLet M be the number of edges in the graph. The edges are numbered 1, 2, ..., M, the length of each edge is 1, and Edge i connects Vertex u_i and Vertex v_i.\n\nThere are exactly K pairs of vertices (i,\\ j)\\ (i < j) such that the shortest distance between them is 2.\n\nIf there exists such a graph, construct an example.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 100\n\n0 \\leq K \\leq \\frac{N(N - 1)}{2}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nIf there does not exist an undirected graph with N vertices satisfying the conditions, print -1.\n\nIf there exists such a graph, print an example in the following format (refer to Problem Statement for what the symbols stand for):\n\nM\nu_1 v_1\n:\nu_M v_M\n\nIf there exist multiple graphs satisfying the conditions, any of them will be accepted.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n5\n4 3\n1 2\n3 1\n4 5\n2 3\n\nThis graph has three pairs of vertices such that the shortest distance between them is 2: (1,\\ 4), (2,\\ 4), and (3,\\ 5). Thus, the condition is satisfied.\n\nSample Input 2\n\n5 8\n\nSample Output 2\n\n-1\n\nThere is no graph satisfying the conditions.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 711, "cpu_time_ms": 55, "memory_kb": 6516}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s969280187", "group_id": "codeNet:p02998", "input_text": "N = int(input())\n\nV = 100005\nto = [[] for _ in range(V * 2)]\nvisited = [False for _ in range(V * 2)]\ncnt = []\n\ndef dfs(v): \n L = [v]\n while len(L) > 0:\n l = L.pop(0)\n if visited[l]:\n continue\n visited[l] = True\n cnt[l // V] += 1\n for u in to[l]:\n L.append(u)\n\nfor i in range(N):\n x, y = map(int, input().split())\n y += V\n to[x].append(y)\n to[y].append(x)\n\nans = 0\nfor i in range(V * 2):\n if visited[i]:\n continue\n cnt = [0, 0]\n dfs(i)\n ans += cnt[0] * cnt[1]\nans -= N\nprint(ans)", "language": "Python", "metadata": {"date": 1561259554, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p02998.html", "problem_id": "p02998", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p02998/input.txt", "sample_output_relpath": "derived/input_output/data/p02998/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02998/Python/s969280187.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s969280187", "user_id": "u525227429"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "N = int(input())\n\nV = 100005\nto = [[] for _ in range(V * 2)]\nvisited = [False for _ in range(V * 2)]\ncnt = []\n\ndef dfs(v): \n L = [v]\n while len(L) > 0:\n l = L.pop(0)\n if visited[l]:\n continue\n visited[l] = True\n cnt[l // V] += 1\n for u in to[l]:\n L.append(u)\n\nfor i in range(N):\n x, y = map(int, input().split())\n y += V\n to[x].append(y)\n to[y].append(x)\n\nans = 0\nfor i in range(V * 2):\n if visited[i]:\n continue\n cnt = [0, 0]\n dfs(i)\n ans += cnt[0] * cnt[1]\nans -= N\nprint(ans)", "problem_context": "Score : 600 points\n\nProblem Statement\n\nThere are N dots in a two-dimensional plane. The coordinates of the i-th dot are (x_i, y_i).\n\nWe will repeat the following operation as long as possible:\n\nChoose four integers a, b, c, d (a \\neq c, b \\neq d) such that there are dots at exactly three of the positions (a, b), (a, d), (c, b) and (c, d), and add a dot at the remaining position.\n\nWe can prove that we can only do this operation a finite number of times. Find the maximum number of times we can do the operation.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq x_i, y_i \\leq 10^5\n\nIf i \\neq j, x_i \\neq x_j or y_i \\neq y_j.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\n:\nx_N y_N\n\nOutput\n\nPrint the maximum number of times we can do the operation.\n\nSample Input 1\n\n3\n1 1\n5 1\n5 5\n\nSample Output 1\n\n1\n\nBy choosing a = 1, b = 1, c = 5, d = 5, we can add a dot at (1, 5). We cannot do the operation any more, so the maximum number of operations is 1.\n\nSample Input 2\n\n2\n10 10\n20 20\n\nSample Output 2\n\n0\n\nThere are only two dots, so we cannot do the operation at all.\n\nSample Input 3\n\n9\n1 1\n2 1\n3 1\n4 1\n5 1\n1 2\n1 3\n1 4\n1 5\n\nSample Output 3\n\n16\n\nWe can do the operation for all choices of the form a = 1, b = 1, c = i, d = j (2 \\leq i,j \\leq 5), and no more. Thus, the maximum number of operations is 16.", "sample_input": "3\n1 1\n5 1\n5 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02998", "source_text": "Score : 600 points\n\nProblem Statement\n\nThere are N dots in a two-dimensional plane. The coordinates of the i-th dot are (x_i, y_i).\n\nWe will repeat the following operation as long as possible:\n\nChoose four integers a, b, c, d (a \\neq c, b \\neq d) such that there are dots at exactly three of the positions (a, b), (a, d), (c, b) and (c, d), and add a dot at the remaining position.\n\nWe can prove that we can only do this operation a finite number of times. Find the maximum number of times we can do the operation.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq x_i, y_i \\leq 10^5\n\nIf i \\neq j, x_i \\neq x_j or y_i \\neq y_j.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\n:\nx_N y_N\n\nOutput\n\nPrint the maximum number of times we can do the operation.\n\nSample Input 1\n\n3\n1 1\n5 1\n5 5\n\nSample Output 1\n\n1\n\nBy choosing a = 1, b = 1, c = 5, d = 5, we can add a dot at (1, 5). We cannot do the operation any more, so the maximum number of operations is 1.\n\nSample Input 2\n\n2\n10 10\n20 20\n\nSample Output 2\n\n0\n\nThere are only two dots, so we cannot do the operation at all.\n\nSample Input 3\n\n9\n1 1\n2 1\n3 1\n4 1\n5 1\n1 2\n1 3\n1 4\n1 5\n\nSample Output 3\n\n16\n\nWe can do the operation for all choices of the form a = 1, b = 1, c = i, d = j (2 \\leq i,j \\leq 5), and no more. Thus, the maximum number of operations is 16.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 517, "cpu_time_ms": 2105, "memory_kb": 29936}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s018387494", "group_id": "codeNet:p02999", "input_text": "x,a=map(int,input().split())\nif x x:\n break\nprint(s)", "language": "Python", "metadata": {"date": 1582987418, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03000.html", "problem_id": "p03000", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03000/input.txt", "sample_output_relpath": "derived/input_output/data/p03000/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03000/Python/s179160955.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s179160955", "user_id": "u188827677"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n,x = map(int, input().split())\nl = list(map(int, input().split()))\n\ns = 1\nd = 0\nfor i in range(n):\n d += l[i]\n s += 1\n if d > x:\n break\nprint(s)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA ball will bounce along a number line, making N + 1 bounces. It will make the first bounce at coordinate D_1 = 0, and the i-th bounce (2 \\leq i \\leq N+1) at coordinate D_i = D_{i-1} + L_{i-1}.\n\nHow many times will the ball make a bounce where the coordinate is at most X?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq L_i \\leq 100\n\n1 \\leq X \\leq 10000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nL_1 L_2 ... L_{N-1} L_N\n\nOutput\n\nPrint the number of times the ball will make a bounce where the coordinate is at most X.\n\nSample Input 1\n\n3 6\n3 4 5\n\nSample Output 1\n\n2\n\nThe ball will make a bounce at the coordinates 0, 3, 7 and 12, among which two are less than or equal to 6.\n\nSample Input 2\n\n4 9\n3 3 3 3\n\nSample Output 2\n\n4\n\nThe ball will make a bounce at the coordinates 0, 3, 6, 9 and 12, among which four are less than or equal to 9.", "sample_input": "3 6\n3 4 5\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03000", "source_text": "Score : 200 points\n\nProblem Statement\n\nA ball will bounce along a number line, making N + 1 bounces. It will make the first bounce at coordinate D_1 = 0, and the i-th bounce (2 \\leq i \\leq N+1) at coordinate D_i = D_{i-1} + L_{i-1}.\n\nHow many times will the ball make a bounce where the coordinate is at most X?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq L_i \\leq 100\n\n1 \\leq X \\leq 10000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nL_1 L_2 ... L_{N-1} L_N\n\nOutput\n\nPrint the number of times the ball will make a bounce where the coordinate is at most X.\n\nSample Input 1\n\n3 6\n3 4 5\n\nSample Output 1\n\n2\n\nThe ball will make a bounce at the coordinates 0, 3, 7 and 12, among which two are less than or equal to 6.\n\nSample Input 2\n\n4 9\n3 3 3 3\n\nSample Output 2\n\n4\n\nThe ball will make a bounce at the coordinates 0, 3, 6, 9 and 12, among which four are less than or equal to 9.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 151, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s049807372", "group_id": "codeNet:p03000", "input_text": "N, X = map(int, input().split())\nL = list(map(int, input().split()))\ncheck = 0\ncount = 0\nfor l in L:\n if check == X:\n print(count+1)\n break\n elif check > X or count == N:\n print(count)\n break\n check = check + l\n count += 1", "language": "Python", "metadata": {"date": 1577656048, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03000.html", "problem_id": "p03000", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03000/input.txt", "sample_output_relpath": "derived/input_output/data/p03000/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03000/Python/s049807372.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s049807372", "user_id": "u073417656"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "N, X = map(int, input().split())\nL = list(map(int, input().split()))\ncheck = 0\ncount = 0\nfor l in L:\n if check == X:\n print(count+1)\n break\n elif check > X or count == N:\n print(count)\n break\n check = check + l\n count += 1", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA ball will bounce along a number line, making N + 1 bounces. It will make the first bounce at coordinate D_1 = 0, and the i-th bounce (2 \\leq i \\leq N+1) at coordinate D_i = D_{i-1} + L_{i-1}.\n\nHow many times will the ball make a bounce where the coordinate is at most X?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq L_i \\leq 100\n\n1 \\leq X \\leq 10000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nL_1 L_2 ... L_{N-1} L_N\n\nOutput\n\nPrint the number of times the ball will make a bounce where the coordinate is at most X.\n\nSample Input 1\n\n3 6\n3 4 5\n\nSample Output 1\n\n2\n\nThe ball will make a bounce at the coordinates 0, 3, 7 and 12, among which two are less than or equal to 6.\n\nSample Input 2\n\n4 9\n3 3 3 3\n\nSample Output 2\n\n4\n\nThe ball will make a bounce at the coordinates 0, 3, 6, 9 and 12, among which four are less than or equal to 9.", "sample_input": "3 6\n3 4 5\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03000", "source_text": "Score : 200 points\n\nProblem Statement\n\nA ball will bounce along a number line, making N + 1 bounces. It will make the first bounce at coordinate D_1 = 0, and the i-th bounce (2 \\leq i \\leq N+1) at coordinate D_i = D_{i-1} + L_{i-1}.\n\nHow many times will the ball make a bounce where the coordinate is at most X?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq L_i \\leq 100\n\n1 \\leq X \\leq 10000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nL_1 L_2 ... L_{N-1} L_N\n\nOutput\n\nPrint the number of times the ball will make a bounce where the coordinate is at most X.\n\nSample Input 1\n\n3 6\n3 4 5\n\nSample Output 1\n\n2\n\nThe ball will make a bounce at the coordinates 0, 3, 7 and 12, among which two are less than or equal to 6.\n\nSample Input 2\n\n4 9\n3 3 3 3\n\nSample Output 2\n\n4\n\nThe ball will make a bounce at the coordinates 0, 3, 6, 9 and 12, among which four are less than or equal to 9.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 262, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s549079914", "group_id": "codeNet:p03000", "input_text": "# -*- coding: utf-8 -*-\nN, X = map(int, input().split())\nL_list = list(map(int, input().split()))\nbtimes = 1\nlongs = 0\nfor idx, ite in enumerate(L_list):\n longs += ite\n if longs > X:\n break\n btimes += 1\nprint(btimes)", "language": "Python", "metadata": {"date": 1560712039, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03000.html", "problem_id": "p03000", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03000/input.txt", "sample_output_relpath": "derived/input_output/data/p03000/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03000/Python/s549079914.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s549079914", "user_id": "u811817592"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "# -*- coding: utf-8 -*-\nN, X = map(int, input().split())\nL_list = list(map(int, input().split()))\nbtimes = 1\nlongs = 0\nfor idx, ite in enumerate(L_list):\n longs += ite\n if longs > X:\n break\n btimes += 1\nprint(btimes)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA ball will bounce along a number line, making N + 1 bounces. It will make the first bounce at coordinate D_1 = 0, and the i-th bounce (2 \\leq i \\leq N+1) at coordinate D_i = D_{i-1} + L_{i-1}.\n\nHow many times will the ball make a bounce where the coordinate is at most X?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq L_i \\leq 100\n\n1 \\leq X \\leq 10000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nL_1 L_2 ... L_{N-1} L_N\n\nOutput\n\nPrint the number of times the ball will make a bounce where the coordinate is at most X.\n\nSample Input 1\n\n3 6\n3 4 5\n\nSample Output 1\n\n2\n\nThe ball will make a bounce at the coordinates 0, 3, 7 and 12, among which two are less than or equal to 6.\n\nSample Input 2\n\n4 9\n3 3 3 3\n\nSample Output 2\n\n4\n\nThe ball will make a bounce at the coordinates 0, 3, 6, 9 and 12, among which four are less than or equal to 9.", "sample_input": "3 6\n3 4 5\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03000", "source_text": "Score : 200 points\n\nProblem Statement\n\nA ball will bounce along a number line, making N + 1 bounces. It will make the first bounce at coordinate D_1 = 0, and the i-th bounce (2 \\leq i \\leq N+1) at coordinate D_i = D_{i-1} + L_{i-1}.\n\nHow many times will the ball make a bounce where the coordinate is at most X?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq L_i \\leq 100\n\n1 \\leq X \\leq 10000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nL_1 L_2 ... L_{N-1} L_N\n\nOutput\n\nPrint the number of times the ball will make a bounce where the coordinate is at most X.\n\nSample Input 1\n\n3 6\n3 4 5\n\nSample Output 1\n\n2\n\nThe ball will make a bounce at the coordinates 0, 3, 7 and 12, among which two are less than or equal to 6.\n\nSample Input 2\n\n4 9\n3 3 3 3\n\nSample Output 2\n\n4\n\nThe ball will make a bounce at the coordinates 0, 3, 6, 9 and 12, among which four are less than or equal to 9.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s401198085", "group_id": "codeNet:p03001", "input_text": "w,h,x,y = map(int, input().split())\n\nside = (x == 0 or x == w or y == 0 or y == h \\\n or y/x == h/w or y == -h/w * x + h \\\n or x != w/2 or y != h/2) \\\n and not (x == w/2 and y == h/2)\narea = w * h\n\nprint(area/2, int(not side))\n", "language": "Python", "metadata": {"date": 1580421841, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03001.html", "problem_id": "p03001", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03001/input.txt", "sample_output_relpath": "derived/input_output/data/p03001/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03001/Python/s401198085.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s401198085", "user_id": "u295178043"}, "prompt_components": {"gold_output": "3.000000 0\n", "input_to_evaluate": "w,h,x,y = map(int, input().split())\n\nside = (x == 0 or x == w or y == 0 or y == h \\\n or y/x == h/w or y == -h/w * x + h \\\n or x != w/2 or y != h/2) \\\n and not (x == w/2 and y == h/2)\narea = w * h\n\nprint(area/2, int(not side))\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "sample_input": "2 3 1 2\n"}, "reference_outputs": ["3.000000 0\n"], "source_document_id": "p03001", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 235, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s406327486", "group_id": "codeNet:p03001", "input_text": "W, H, x, y = map(int, input().split())\n \nif W-x < x:\n x = W-x\nif H-y < y:\n y = H-y\n \nif x*H > y*W: \n print(y*W, \"0\")\nelif x*H < y*W:\n print(x*H, \"0\")\nelse:\n print(x*H, \"1\")", "language": "Python", "metadata": {"date": 1560713743, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03001.html", "problem_id": "p03001", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03001/input.txt", "sample_output_relpath": "derived/input_output/data/p03001/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03001/Python/s406327486.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s406327486", "user_id": "u121732701"}, "prompt_components": {"gold_output": "3.000000 0\n", "input_to_evaluate": "W, H, x, y = map(int, input().split())\n \nif W-x < x:\n x = W-x\nif H-y < y:\n y = H-y\n \nif x*H > y*W: \n print(y*W, \"0\")\nelif x*H < y*W:\n print(x*H, \"0\")\nelse:\n print(x*H, \"1\")", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "sample_input": "2 3 1 2\n"}, "reference_outputs": ["3.000000 0\n"], "source_document_id": "p03001", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 187, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s187896724", "group_id": "codeNet:p03005", "input_text": "a = 3,2\nprint \"1\"", "language": "Python", "metadata": {"date": 1560651441, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03005.html", "problem_id": "p03005", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03005/input.txt", "sample_output_relpath": "derived/input_output/data/p03005/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03005/Python/s187896724.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s187896724", "user_id": "u635226757"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "a = 3,2\nprint \"1\"", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is distributing N balls to K persons.\n\nIf each person has to receive at least one ball, what is the maximum possible difference in the number of balls received between the person with the most balls and the person with the fewest balls?\n\nConstraints\n\n1 \\leq K \\leq N \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the maximum possible difference in the number of balls received.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n1\n\nThe only way to distribute three balls to two persons so that each of them receives at least one ball is to give one ball to one person and give two balls to the other person.\n\nThus, the maximum possible difference in the number of balls received is 1.\n\nSample Input 2\n\n3 1\n\nSample Output 2\n\n0\n\nWe have no choice but to give three balls to the only person, in which case the difference in the number of balls received is 0.\n\nSample Input 3\n\n8 5\n\nSample Output 3\n\n3\n\nFor example, if we give 1, 4, 1, 1, 1 balls to the five persons, the number of balls received between the person with the most balls and the person with the fewest balls would be 3, which is the maximum result.", "sample_input": "3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03005", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is distributing N balls to K persons.\n\nIf each person has to receive at least one ball, what is the maximum possible difference in the number of balls received between the person with the most balls and the person with the fewest balls?\n\nConstraints\n\n1 \\leq K \\leq N \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the maximum possible difference in the number of balls received.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n1\n\nThe only way to distribute three balls to two persons so that each of them receives at least one ball is to give one ball to one person and give two balls to the other person.\n\nThus, the maximum possible difference in the number of balls received is 1.\n\nSample Input 2\n\n3 1\n\nSample Output 2\n\n0\n\nWe have no choice but to give three balls to the only person, in which case the difference in the number of balls received is 0.\n\nSample Input 3\n\n8 5\n\nSample Output 3\n\n3\n\nFor example, if we give 1, 4, 1, 1, 1 balls to the five persons, the number of balls received between the person with the most balls and the person with the fewest balls would be 3, which is the maximum result.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 17, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s577562504", "group_id": "codeNet:p03007", "input_text": "from collections import deque\nN = int(input())\nA = deque(sorted(list(map(int, input().split()))))\nMAX, MIN = A.pop(), A.popleft()\n\nans = []\nwhile len(A):\n if A[0] < 0:\n x, y = MAX, A.popleft()\n ans.append([MAX, y])\n MAX = MAX - y\n else:\n x, y = MIN, A.popleft()\n ans.append([x, y])\n MIN = MIN - y\n\nans.append([MAX, MIN])\nprint(MAX - MIN)\nfor x, y in ans:\n print(x, y)\n", "language": "Python", "metadata": {"date": 1596677789, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03007.html", "problem_id": "p03007", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03007/input.txt", "sample_output_relpath": "derived/input_output/data/p03007/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03007/Python/s577562504.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s577562504", "user_id": "u075012704"}, "prompt_components": {"gold_output": "4\n-1 1\n2 -2\n", "input_to_evaluate": "from collections import deque\nN = int(input())\nA = deque(sorted(list(map(int, input().split()))))\nMAX, MIN = A.pop(), A.popleft()\n\nans = []\nwhile len(A):\n if A[0] < 0:\n x, y = MAX, A.popleft()\n ans.append([MAX, y])\n MAX = MAX - y\n else:\n x, y = MIN, A.popleft()\n ans.append([x, y])\n MIN = MIN - y\n\nans.append([MAX, MIN])\nprint(MAX - MIN)\nfor x, y in ans:\n print(x, y)\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on a blackboard.\n\nWe will repeat the following operation N-1 times so that we have only one integer on the blackboard.\n\nChoose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y.\n\nFind the maximum possible value of the final integer on the blackboard and a sequence of operations that maximizes the final integer.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-10^4 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible value M of the final integer on the blackboard, and a sequence of operations x_i, y_i that maximizes the final integer, in the format below.\n\nHere x_i and y_i represent the integers x and y chosen in the i-th operation, respectively.\n\nIf there are multiple sequences of operations that maximize the final integer, any of them will be accepted.\n\nM\nx_1 y_1\n:\nx_{N-1} y_{N-1}\n\nSample Input 1\n\n3\n1 -1 2\n\nSample Output 1\n\n4\n-1 1\n2 -2\n\nIf we choose x = -1 and y = 1 in the first operation, the set of integers written on the blackboard becomes (-2, 2).\n\nThen, if we choose x = 2 and y = -2 in the second operation, the set of integers written on the blackboard becomes (4).\n\nIn this case, we have 4 as the final integer. We cannot end with a greater integer, so the answer is 4.\n\nSample Input 2\n\n3\n1 1 1\n\nSample Output 2\n\n1\n1 1\n1 0", "sample_input": "3\n1 -1 2\n"}, "reference_outputs": ["4\n-1 1\n2 -2\n"], "source_document_id": "p03007", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on a blackboard.\n\nWe will repeat the following operation N-1 times so that we have only one integer on the blackboard.\n\nChoose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y.\n\nFind the maximum possible value of the final integer on the blackboard and a sequence of operations that maximizes the final integer.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-10^4 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible value M of the final integer on the blackboard, and a sequence of operations x_i, y_i that maximizes the final integer, in the format below.\n\nHere x_i and y_i represent the integers x and y chosen in the i-th operation, respectively.\n\nIf there are multiple sequences of operations that maximize the final integer, any of them will be accepted.\n\nM\nx_1 y_1\n:\nx_{N-1} y_{N-1}\n\nSample Input 1\n\n3\n1 -1 2\n\nSample Output 1\n\n4\n-1 1\n2 -2\n\nIf we choose x = -1 and y = 1 in the first operation, the set of integers written on the blackboard becomes (-2, 2).\n\nThen, if we choose x = 2 and y = -2 in the second operation, the set of integers written on the blackboard becomes (4).\n\nIn this case, we have 4 as the final integer. We cannot end with a greater integer, so the answer is 4.\n\nSample Input 2\n\n3\n1 1 1\n\nSample Output 2\n\n1\n1 1\n1 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 419, "cpu_time_ms": 199, "memory_kb": 25200}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s812234541", "group_id": "codeNet:p03011", "input_text": "print(sum(sorted(map(int,input().split()))[:2]))", "language": "Python", "metadata": {"date": 1560224957, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03011.html", "problem_id": "p03011", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03011/input.txt", "sample_output_relpath": "derived/input_output/data/p03011/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03011/Python/s812234541.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s812234541", "user_id": "u367130284"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "print(sum(sorted(map(int,input().split()))[:2]))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are three airports A, B and C, and flights between each pair of airports in both directions.\n\nA one-way flight between airports A and B takes P hours, a one-way flight between airports B and C takes Q hours, and a one-way flight between airports C and A takes R hours.\n\nConsider a route where we start at one of the airports, fly to another airport and then fly to the other airport.\n\nWhat is the minimum possible sum of the flight times?\n\nConstraints\n\n1 \\leq P,Q,R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nP Q R\n\nOutput\n\nPrint the minimum possible sum of the flight times.\n\nSample Input 1\n\n1 3 4\n\nSample Output 1\n\n4\n\nThe sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n\nThe sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n\nThe sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n\nThe sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n\nThe sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n\nThe sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\nSample Input 2\n\n3 2 3\n\nSample Output 2\n\n5", "sample_input": "1 3 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03011", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are three airports A, B and C, and flights between each pair of airports in both directions.\n\nA one-way flight between airports A and B takes P hours, a one-way flight between airports B and C takes Q hours, and a one-way flight between airports C and A takes R hours.\n\nConsider a route where we start at one of the airports, fly to another airport and then fly to the other airport.\n\nWhat is the minimum possible sum of the flight times?\n\nConstraints\n\n1 \\leq P,Q,R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nP Q R\n\nOutput\n\nPrint the minimum possible sum of the flight times.\n\nSample Input 1\n\n1 3 4\n\nSample Output 1\n\n4\n\nThe sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n\nThe sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n\nThe sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n\nThe sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n\nThe sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n\nThe sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\nSample Input 2\n\n3 2 3\n\nSample Output 2\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 48, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s912189398", "group_id": "codeNet:p03012", "input_text": "N=int(input())\nw=list(map(int, input().split()))\nS=sum(w)\nA=0\nans=10**7\nfor i in range(N-1):\n A+=w[i]\n if abs(S-A)<=ans:\n ans=abs(S-2*A)\n\nprint(ans)", "language": "Python", "metadata": {"date": 1587045909, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03012.html", "problem_id": "p03012", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03012/input.txt", "sample_output_relpath": "derived/input_output/data/p03012/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03012/Python/s912189398.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s912189398", "user_id": "u337626942"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "N=int(input())\nw=list(map(int, input().split()))\nS=sum(w)\nA=0\nans=10**7\nfor i in range(N-1):\n A+=w[i]\n if abs(S-A)<=ans:\n ans=abs(S-2*A)\n\nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have N weights indexed 1 to N. The \bmass of the weight indexed i is W_i.\n\nWe will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \\leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be the sum of the masses of the weights in the latter group.\n\nConsider all possible such divisions and find the minimum possible absolute difference of S_1 and S_2.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n1 \\leq W_i \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1 W_2 ... W_{N-1} W_N\n\nOutput\n\nPrint the minimum possible absolute difference of S_1 and S_2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n0\n\nIf T = 2, S_1 = 1 + 2 = 3 and S_2 = 3, with the absolute difference of 0.\n\nSample Input 2\n\n4\n1 3 1 1\n\nSample Output 2\n\n2\n\nIf T = 2, S_1 = 1 + 3 = 4 and S_2 = 1 + 1 = 2, with the absolute difference of 2. We cannot have a smaller absolute difference.\n\nSample Input 3\n\n8\n27 23 76 2 3 5 62 52\n\nSample Output 3\n\n2", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03012", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have N weights indexed 1 to N. The \bmass of the weight indexed i is W_i.\n\nWe will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \\leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be the sum of the masses of the weights in the latter group.\n\nConsider all possible such divisions and find the minimum possible absolute difference of S_1 and S_2.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n1 \\leq W_i \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1 W_2 ... W_{N-1} W_N\n\nOutput\n\nPrint the minimum possible absolute difference of S_1 and S_2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n0\n\nIf T = 2, S_1 = 1 + 2 = 3 and S_2 = 3, with the absolute difference of 0.\n\nSample Input 2\n\n4\n1 3 1 1\n\nSample Output 2\n\n2\n\nIf T = 2, S_1 = 1 + 3 = 4 and S_2 = 1 + 1 = 2, with the absolute difference of 2. We cannot have a smaller absolute difference.\n\nSample Input 3\n\n8\n27 23 76 2 3 5 62 52\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 161, "cpu_time_ms": 18, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s507966583", "group_id": "codeNet:p03013", "input_text": "mod = 1000000007\nN,M = list(map(int,input().split()))\n\nb = [0]*(N+2)\nb[0]=1\n\nfor i in range(M):\n b[int(input())] = -1\n\nfor i in range(N):\n if b[i] != -1:\n if b[i+1] != -1:\n b[i+1] += b[i]\n if b[i+2] != -1:\n b[i+2] += b[i]\nprint(b[N]%mod)", "language": "Python", "metadata": {"date": 1564758034, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03013.html", "problem_id": "p03013", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03013/input.txt", "sample_output_relpath": "derived/input_output/data/p03013/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03013/Python/s507966583.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s507966583", "user_id": "u672475305"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "mod = 1000000007\nN,M = list(map(int,input().split()))\n\nb = [0]*(N+2)\nb[0]=1\n\nfor i in range(M):\n b[int(input())] = -1\n\nfor i in range(N):\n if b[i] != -1:\n if b[i+1] != -1:\n b[i+1] += b[i]\n if b[i+2] != -1:\n b[i+2] += b[i]\nprint(b[N]%mod)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step.\nHe can climb up one or two steps at a time.\n\nHowever, the treads of the a_1-th, a_2-th, a_3-th, \\ldots, a_M-th steps are broken, so it is dangerous to set foot on those steps.\n\nHow many are there to climb up to the top step, that is, the N-th step, without setting foot on the broken steps?\nFind the count modulo 1\\ 000\\ 000\\ 007.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq N-1\n\n1 \\leq a_1 < a_2 < ... < a_M \\leq N-1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1\na_2\n.\n.\n.\na_M\n\nOutput\n\nPrint the number of ways to climb up the stairs under the condition, modulo 1\\ 000\\ 000\\ 007.\n\nSample Input 1\n\n6 1\n3\n\nSample Output 1\n\n4\n\nThere are four ways to climb up the stairs, as follows:\n\n0 \\to 1 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 1 \\to 2 \\to 4 \\to 6\n\n0 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 2 \\to 4 \\to 6\n\nSample Input 2\n\n10 2\n4\n5\n\nSample Output 2\n\n0\n\nThere may be no way to climb up the stairs without setting foot on the broken steps.\n\nSample Input 3\n\n100 5\n1\n23\n45\n67\n89\n\nSample Output 3\n\n608200469\n\nBe sure to print the count modulo 1\\ 000\\ 000\\ 007.", "sample_input": "6 1\n3\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03013", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step.\nHe can climb up one or two steps at a time.\n\nHowever, the treads of the a_1-th, a_2-th, a_3-th, \\ldots, a_M-th steps are broken, so it is dangerous to set foot on those steps.\n\nHow many are there to climb up to the top step, that is, the N-th step, without setting foot on the broken steps?\nFind the count modulo 1\\ 000\\ 000\\ 007.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq N-1\n\n1 \\leq a_1 < a_2 < ... < a_M \\leq N-1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1\na_2\n.\n.\n.\na_M\n\nOutput\n\nPrint the number of ways to climb up the stairs under the condition, modulo 1\\ 000\\ 000\\ 007.\n\nSample Input 1\n\n6 1\n3\n\nSample Output 1\n\n4\n\nThere are four ways to climb up the stairs, as follows:\n\n0 \\to 1 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 1 \\to 2 \\to 4 \\to 6\n\n0 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 2 \\to 4 \\to 6\n\nSample Input 2\n\n10 2\n4\n5\n\nSample Output 2\n\n0\n\nThere may be no way to climb up the stairs without setting foot on the broken steps.\n\nSample Input 3\n\n100 5\n1\n23\n45\n67\n89\n\nSample Output 3\n\n608200469\n\nBe sure to print the count modulo 1\\ 000\\ 000\\ 007.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 279, "cpu_time_ms": 611, "memory_kb": 462708}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s483638179", "group_id": "codeNet:p03013", "input_text": "N,M=map(int,input().split())\na=[]\nb=0 in range(N)\nfor i in range(M):\n a.append(int(input()))\nj=M-1\nif j>=0 and a[0]==1:\n f1=0\n f2=1\nelif j>=0 and a[0]==2:\n f1=1\n f2=1\nelse:\n f1=1\n f2=2\ndef f(n,a,j):\n if n>2:\n if j==-1 or ((n-1)!=a[j] and (n-2)!=a[j]):\n return (f(n-1,a,j)+f(n-2,a,j))%100000007\n if j>0 and a[j]==a[j-1]+1:\n return 0\n if j+10 and (n-1)==a[j]:\n return f(n-2,a,j-1)%100000007\n elif (n-1)==a[j]:\n return f(n-2,a,j)\n elif (n-2)==a[j]:\n return f(n-1,a,j)%100000007\n elif n==1:\n return f1\n else:\n return f2\nprint(f(N,a,j)%100000007)", "language": "Python", "metadata": {"date": 1560198019, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03013.html", "problem_id": "p03013", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03013/input.txt", "sample_output_relpath": "derived/input_output/data/p03013/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03013/Python/s483638179.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s483638179", "user_id": "u780420070"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "N,M=map(int,input().split())\na=[]\nb=0 in range(N)\nfor i in range(M):\n a.append(int(input()))\nj=M-1\nif j>=0 and a[0]==1:\n f1=0\n f2=1\nelif j>=0 and a[0]==2:\n f1=1\n f2=1\nelse:\n f1=1\n f2=2\ndef f(n,a,j):\n if n>2:\n if j==-1 or ((n-1)!=a[j] and (n-2)!=a[j]):\n return (f(n-1,a,j)+f(n-2,a,j))%100000007\n if j>0 and a[j]==a[j-1]+1:\n return 0\n if j+10 and (n-1)==a[j]:\n return f(n-2,a,j-1)%100000007\n elif (n-1)==a[j]:\n return f(n-2,a,j)\n elif (n-2)==a[j]:\n return f(n-1,a,j)%100000007\n elif n==1:\n return f1\n else:\n return f2\nprint(f(N,a,j)%100000007)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step.\nHe can climb up one or two steps at a time.\n\nHowever, the treads of the a_1-th, a_2-th, a_3-th, \\ldots, a_M-th steps are broken, so it is dangerous to set foot on those steps.\n\nHow many are there to climb up to the top step, that is, the N-th step, without setting foot on the broken steps?\nFind the count modulo 1\\ 000\\ 000\\ 007.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq N-1\n\n1 \\leq a_1 < a_2 < ... < a_M \\leq N-1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1\na_2\n.\n.\n.\na_M\n\nOutput\n\nPrint the number of ways to climb up the stairs under the condition, modulo 1\\ 000\\ 000\\ 007.\n\nSample Input 1\n\n6 1\n3\n\nSample Output 1\n\n4\n\nThere are four ways to climb up the stairs, as follows:\n\n0 \\to 1 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 1 \\to 2 \\to 4 \\to 6\n\n0 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 2 \\to 4 \\to 6\n\nSample Input 2\n\n10 2\n4\n5\n\nSample Output 2\n\n0\n\nThere may be no way to climb up the stairs without setting foot on the broken steps.\n\nSample Input 3\n\n100 5\n1\n23\n45\n67\n89\n\nSample Output 3\n\n608200469\n\nBe sure to print the count modulo 1\\ 000\\ 000\\ 007.", "sample_input": "6 1\n3\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03013", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step.\nHe can climb up one or two steps at a time.\n\nHowever, the treads of the a_1-th, a_2-th, a_3-th, \\ldots, a_M-th steps are broken, so it is dangerous to set foot on those steps.\n\nHow many are there to climb up to the top step, that is, the N-th step, without setting foot on the broken steps?\nFind the count modulo 1\\ 000\\ 000\\ 007.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq N-1\n\n1 \\leq a_1 < a_2 < ... < a_M \\leq N-1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1\na_2\n.\n.\n.\na_M\n\nOutput\n\nPrint the number of ways to climb up the stairs under the condition, modulo 1\\ 000\\ 000\\ 007.\n\nSample Input 1\n\n6 1\n3\n\nSample Output 1\n\n4\n\nThere are four ways to climb up the stairs, as follows:\n\n0 \\to 1 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 1 \\to 2 \\to 4 \\to 6\n\n0 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 2 \\to 4 \\to 6\n\nSample Input 2\n\n10 2\n4\n5\n\nSample Output 2\n\n0\n\nThere may be no way to climb up the stairs without setting foot on the broken steps.\n\nSample Input 3\n\n100 5\n1\n23\n45\n67\n89\n\nSample Output 3\n\n608200469\n\nBe sure to print the count modulo 1\\ 000\\ 000\\ 007.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 734, "cpu_time_ms": 2103, "memory_kb": 7080}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s891729587", "group_id": "codeNet:p03014", "input_text": "def main():\n H, W = map(int, input().split())\n S = [list(input()) for _ in range(H)]\n\n left = [[-1]*W for _ in range(H)]\n right = [[-1]*W for _ in range(H)]\n up = [[-1]*W for _ in range(H)]\n down = [[-1]*W for _ in range(H)]\n\n for i in range(H):\n for j in range(W):\n if j == 0:\n left[i][j] = 0\n else:\n left[i][j] = left[i][j-1] + 1\n\n for i in range(H):\n for j in range(W):\n if j == 0:\n right[-1-i][-1-j] = 0\n else:\n right[-1-i][-1-j] = right[-1-i][-1-(j-1)] + 1\n\n for i in range(H):\n for j in range(W):\n if i == 0:\n up[i][j] = 0\n else:\n up[i][j] = up[i-1][j] + 1\n\n for i in range(H):\n for j in range(W):\n if i == 0:\n down[-1-i][-1-j] = 0\n else:\n down[-1-i][-1-j] = down[-1-(i-1)][-1-j] + 1\n \n ans = 0\n temp = [0] * W\n for i in range(H):\n for j in range(W):\n temp[j] = left[i][j] + right[i][j] + down[i][j] + up[i][j] + 1\n ans = max(ans, max(temp))\n print(ans)\n\nmain()", "language": "Python", "metadata": {"date": 1589950253, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03014.html", "problem_id": "p03014", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03014/input.txt", "sample_output_relpath": "derived/input_output/data/p03014/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03014/Python/s891729587.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s891729587", "user_id": "u224346910"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "def main():\n H, W = map(int, input().split())\n S = [list(input()) for _ in range(H)]\n\n left = [[-1]*W for _ in range(H)]\n right = [[-1]*W for _ in range(H)]\n up = [[-1]*W for _ in range(H)]\n down = [[-1]*W for _ in range(H)]\n\n for i in range(H):\n for j in range(W):\n if j == 0:\n left[i][j] = 0\n else:\n left[i][j] = left[i][j-1] + 1\n\n for i in range(H):\n for j in range(W):\n if j == 0:\n right[-1-i][-1-j] = 0\n else:\n right[-1-i][-1-j] = right[-1-i][-1-(j-1)] + 1\n\n for i in range(H):\n for j in range(W):\n if i == 0:\n up[i][j] = 0\n else:\n up[i][j] = up[i-1][j] + 1\n\n for i in range(H):\n for j in range(W):\n if i == 0:\n down[-1-i][-1-j] = 0\n else:\n down[-1-i][-1-j] = down[-1-(i-1)][-1-j] + 1\n \n ans = 0\n temp = [0] * W\n for i in range(H):\n for j in range(W):\n temp[j] = left[i][j] + right[i][j] + down[i][j] + up[i][j] + 1\n ans = max(ans, max(temp))\n print(ans)\n\nmain()", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a grid with H horizontal rows and W vertical columns, and there are obstacles on some of the squares.\n\nSnuke is going to choose one of the squares not occupied by an obstacle and place a lamp on it.\nThe lamp placed on the square will emit straight beams of light in four cardinal directions: up, down, left, and right.\nIn each direction, the beam will continue traveling until it hits a square occupied by an obstacle or it hits the border of the grid. It will light all the squares on the way, including the square on which the lamp is placed, but not the square occupied by an obstacle.\n\nSnuke wants to maximize the number of squares lighted by the lamp.\n\nYou are given H strings S_i (1 \\leq i \\leq H), each of length W. If the j-th character (1 \\leq j \\leq W) of S_i is #, there is an obstacle on the square at the i-th row from the top and the j-th column from the left; if that character is ., there is no obstacle on that square.\n\nFind the maximum possible number of squares lighted by the lamp.\n\nConstraints\n\n1 \\leq H \\leq 2,000\n\n1 \\leq W \\leq 2,000\n\nS_i is a string of length W consisting of # and ..\n\n. occurs at least once in one of the strings S_i (1 \\leq i \\leq H).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nS_1\n:\nS_H\n\nOutput\n\nPrint the maximum possible number of squares lighted by the lamp.\n\nSample Input 1\n\n4 6\n#..#..\n.....#\n....#.\n#.#...\n\nSample Output 1\n\n8\n\nIf Snuke places the lamp on the square at the second row from the top and the second column from the left, it will light the following squares: the first through fifth squares from the left in the second row, and the first through fourth squares from the top in the second column, for a total of eight squares.\n\nSample Input 2\n\n8 8\n..#...#.\n....#...\n##......\n..###..#\n...#..#.\n##....#.\n#...#...\n###.#..#\n\nSample Output 2\n\n13", "sample_input": "4 6\n#..#..\n.....#\n....#.\n#.#...\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03014", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a grid with H horizontal rows and W vertical columns, and there are obstacles on some of the squares.\n\nSnuke is going to choose one of the squares not occupied by an obstacle and place a lamp on it.\nThe lamp placed on the square will emit straight beams of light in four cardinal directions: up, down, left, and right.\nIn each direction, the beam will continue traveling until it hits a square occupied by an obstacle or it hits the border of the grid. It will light all the squares on the way, including the square on which the lamp is placed, but not the square occupied by an obstacle.\n\nSnuke wants to maximize the number of squares lighted by the lamp.\n\nYou are given H strings S_i (1 \\leq i \\leq H), each of length W. If the j-th character (1 \\leq j \\leq W) of S_i is #, there is an obstacle on the square at the i-th row from the top and the j-th column from the left; if that character is ., there is no obstacle on that square.\n\nFind the maximum possible number of squares lighted by the lamp.\n\nConstraints\n\n1 \\leq H \\leq 2,000\n\n1 \\leq W \\leq 2,000\n\nS_i is a string of length W consisting of # and ..\n\n. occurs at least once in one of the strings S_i (1 \\leq i \\leq H).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nS_1\n:\nS_H\n\nOutput\n\nPrint the maximum possible number of squares lighted by the lamp.\n\nSample Input 1\n\n4 6\n#..#..\n.....#\n....#.\n#.#...\n\nSample Output 1\n\n8\n\nIf Snuke places the lamp on the square at the second row from the top and the second column from the left, it will light the following squares: the first through fifth squares from the left in the second row, and the first through fourth squares from the top in the second column, for a total of eight squares.\n\nSample Input 2\n\n8 8\n..#...#.\n....#...\n##......\n..###..#\n...#..#.\n##....#.\n#...#...\n###.#..#\n\nSample Output 2\n\n13", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1181, "cpu_time_ms": 1109, "memory_kb": 307464}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s965460325", "group_id": "codeNet:p03014", "input_text": "import numpy as np\nH,W = map(int,input().split())\nS = [list(input()) for _ in range(H)]\nL = np.zeros((H,W),dtype=np.int)\nR = np.zeros((H,W),dtype=np.int)\nU = np.zeros((H,W),dtype=np.int)\nD = np.zeros((H,W),dtype=np.int)\nfor i in range(H):\n for j in range(W):\n if S[i][j] == \"#\":\n L[i][j] = 0\n else:\n L[i][j] = L[i][j-1]+1\n if S[-i-1][-j-1] == \"#\":\n R[-i-1][-j-1] = 0\n else:\n R[-i-1][-j-1] = R[-i-1][-j]+1\n\nfor i in range(H):\n for j in range(W):\n if S[i][j] == \"#\":\n None\n else:\n U[i][j] = U[i-1][j]+1\n if S[-i-1][-j-1] == \"#\":\n None\n else:\n D[-i-1][-j-1] = D[-i][-j-1]+1\nprint(np.max(L+R+U+D)-3)", "language": "Python", "metadata": {"date": 1582142021, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03014.html", "problem_id": "p03014", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03014/input.txt", "sample_output_relpath": "derived/input_output/data/p03014/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03014/Python/s965460325.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s965460325", "user_id": "u503111914"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "import numpy as np\nH,W = map(int,input().split())\nS = [list(input()) for _ in range(H)]\nL = np.zeros((H,W),dtype=np.int)\nR = np.zeros((H,W),dtype=np.int)\nU = np.zeros((H,W),dtype=np.int)\nD = np.zeros((H,W),dtype=np.int)\nfor i in range(H):\n for j in range(W):\n if S[i][j] == \"#\":\n L[i][j] = 0\n else:\n L[i][j] = L[i][j-1]+1\n if S[-i-1][-j-1] == \"#\":\n R[-i-1][-j-1] = 0\n else:\n R[-i-1][-j-1] = R[-i-1][-j]+1\n\nfor i in range(H):\n for j in range(W):\n if S[i][j] == \"#\":\n None\n else:\n U[i][j] = U[i-1][j]+1\n if S[-i-1][-j-1] == \"#\":\n None\n else:\n D[-i-1][-j-1] = D[-i][-j-1]+1\nprint(np.max(L+R+U+D)-3)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a grid with H horizontal rows and W vertical columns, and there are obstacles on some of the squares.\n\nSnuke is going to choose one of the squares not occupied by an obstacle and place a lamp on it.\nThe lamp placed on the square will emit straight beams of light in four cardinal directions: up, down, left, and right.\nIn each direction, the beam will continue traveling until it hits a square occupied by an obstacle or it hits the border of the grid. It will light all the squares on the way, including the square on which the lamp is placed, but not the square occupied by an obstacle.\n\nSnuke wants to maximize the number of squares lighted by the lamp.\n\nYou are given H strings S_i (1 \\leq i \\leq H), each of length W. If the j-th character (1 \\leq j \\leq W) of S_i is #, there is an obstacle on the square at the i-th row from the top and the j-th column from the left; if that character is ., there is no obstacle on that square.\n\nFind the maximum possible number of squares lighted by the lamp.\n\nConstraints\n\n1 \\leq H \\leq 2,000\n\n1 \\leq W \\leq 2,000\n\nS_i is a string of length W consisting of # and ..\n\n. occurs at least once in one of the strings S_i (1 \\leq i \\leq H).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nS_1\n:\nS_H\n\nOutput\n\nPrint the maximum possible number of squares lighted by the lamp.\n\nSample Input 1\n\n4 6\n#..#..\n.....#\n....#.\n#.#...\n\nSample Output 1\n\n8\n\nIf Snuke places the lamp on the square at the second row from the top and the second column from the left, it will light the following squares: the first through fifth squares from the left in the second row, and the first through fourth squares from the top in the second column, for a total of eight squares.\n\nSample Input 2\n\n8 8\n..#...#.\n....#...\n##......\n..###..#\n...#..#.\n##....#.\n#...#...\n###.#..#\n\nSample Output 2\n\n13", "sample_input": "4 6\n#..#..\n.....#\n....#.\n#.#...\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03014", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a grid with H horizontal rows and W vertical columns, and there are obstacles on some of the squares.\n\nSnuke is going to choose one of the squares not occupied by an obstacle and place a lamp on it.\nThe lamp placed on the square will emit straight beams of light in four cardinal directions: up, down, left, and right.\nIn each direction, the beam will continue traveling until it hits a square occupied by an obstacle or it hits the border of the grid. It will light all the squares on the way, including the square on which the lamp is placed, but not the square occupied by an obstacle.\n\nSnuke wants to maximize the number of squares lighted by the lamp.\n\nYou are given H strings S_i (1 \\leq i \\leq H), each of length W. If the j-th character (1 \\leq j \\leq W) of S_i is #, there is an obstacle on the square at the i-th row from the top and the j-th column from the left; if that character is ., there is no obstacle on that square.\n\nFind the maximum possible number of squares lighted by the lamp.\n\nConstraints\n\n1 \\leq H \\leq 2,000\n\n1 \\leq W \\leq 2,000\n\nS_i is a string of length W consisting of # and ..\n\n. occurs at least once in one of the strings S_i (1 \\leq i \\leq H).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nS_1\n:\nS_H\n\nOutput\n\nPrint the maximum possible number of squares lighted by the lamp.\n\nSample Input 1\n\n4 6\n#..#..\n.....#\n....#.\n#.#...\n\nSample Output 1\n\n8\n\nIf Snuke places the lamp on the square at the second row from the top and the second column from the left, it will light the following squares: the first through fifth squares from the left in the second row, and the first through fourth squares from the top in the second column, for a total of eight squares.\n\nSample Input 2\n\n8 8\n..#...#.\n....#...\n##......\n..###..#\n...#..#.\n##....#.\n#...#...\n###.#..#\n\nSample Output 2\n\n13", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 745, "cpu_time_ms": 2114, "memory_kb": 76404}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s876487533", "group_id": "codeNet:p03014", "input_text": "h, w = map(int, raw_input().split())\nS = [raw_input() for i in range(h)]\nL = [[0]*w for i in range(h)]\nR = [[0]*w for i in range(h)]\nU = [[0]*w for i in range(h)]\nD = [[0]*w for i in range(h)]\n\nfor i in range(h):\n ps = 0\n s = S[i]\n for j in range(w):\n if s[j] == \"#\":\n ps = 0\n else:\n ps += 1\n L[i][j] = ps\n\nfor j in range(w):\n ps = 0\n for i in range(h):\n if S[i][j] == \"#\":\n ps = 0\n else:\n ps += 1\n U[i][j] = ps\n\nfor i in range(h-1, -1, -1):\n ps = 0\n for j in range(w-1, -1, -1):\n if S[i][j] == \"#\":\n ps = 0\n else:\n ps += 1\n R[i][j] = ps\nfor j in range(w-1, -1, -1):\n ps = 0\n for i in range(h-1, -1, -1):\n if S[i][j] == \"#\":\n ps = 0\n else:\n ps += 1\n D[i][j] = ps\nmaxLight = 0\nfor i in range(h):\n for j in range(w):\n maxLight = max(maxLight, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3)\nprint maxLight\n", "language": "Python", "metadata": {"date": 1560647827, "filename_ext": "py", "original_language": "Python (2.7.6)", "problem_description_relpath": "problem_descriptions/p03014.html", "problem_id": "p03014", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03014/input.txt", "sample_output_relpath": "derived/input_output/data/p03014/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03014/Python/s876487533.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s876487533", "user_id": "u986254798"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "h, w = map(int, raw_input().split())\nS = [raw_input() for i in range(h)]\nL = [[0]*w for i in range(h)]\nR = [[0]*w for i in range(h)]\nU = [[0]*w for i in range(h)]\nD = [[0]*w for i in range(h)]\n\nfor i in range(h):\n ps = 0\n s = S[i]\n for j in range(w):\n if s[j] == \"#\":\n ps = 0\n else:\n ps += 1\n L[i][j] = ps\n\nfor j in range(w):\n ps = 0\n for i in range(h):\n if S[i][j] == \"#\":\n ps = 0\n else:\n ps += 1\n U[i][j] = ps\n\nfor i in range(h-1, -1, -1):\n ps = 0\n for j in range(w-1, -1, -1):\n if S[i][j] == \"#\":\n ps = 0\n else:\n ps += 1\n R[i][j] = ps\nfor j in range(w-1, -1, -1):\n ps = 0\n for i in range(h-1, -1, -1):\n if S[i][j] == \"#\":\n ps = 0\n else:\n ps += 1\n D[i][j] = ps\nmaxLight = 0\nfor i in range(h):\n for j in range(w):\n maxLight = max(maxLight, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3)\nprint maxLight\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a grid with H horizontal rows and W vertical columns, and there are obstacles on some of the squares.\n\nSnuke is going to choose one of the squares not occupied by an obstacle and place a lamp on it.\nThe lamp placed on the square will emit straight beams of light in four cardinal directions: up, down, left, and right.\nIn each direction, the beam will continue traveling until it hits a square occupied by an obstacle or it hits the border of the grid. It will light all the squares on the way, including the square on which the lamp is placed, but not the square occupied by an obstacle.\n\nSnuke wants to maximize the number of squares lighted by the lamp.\n\nYou are given H strings S_i (1 \\leq i \\leq H), each of length W. If the j-th character (1 \\leq j \\leq W) of S_i is #, there is an obstacle on the square at the i-th row from the top and the j-th column from the left; if that character is ., there is no obstacle on that square.\n\nFind the maximum possible number of squares lighted by the lamp.\n\nConstraints\n\n1 \\leq H \\leq 2,000\n\n1 \\leq W \\leq 2,000\n\nS_i is a string of length W consisting of # and ..\n\n. occurs at least once in one of the strings S_i (1 \\leq i \\leq H).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nS_1\n:\nS_H\n\nOutput\n\nPrint the maximum possible number of squares lighted by the lamp.\n\nSample Input 1\n\n4 6\n#..#..\n.....#\n....#.\n#.#...\n\nSample Output 1\n\n8\n\nIf Snuke places the lamp on the square at the second row from the top and the second column from the left, it will light the following squares: the first through fifth squares from the left in the second row, and the first through fourth squares from the top in the second column, for a total of eight squares.\n\nSample Input 2\n\n8 8\n..#...#.\n....#...\n##......\n..###..#\n...#..#.\n##....#.\n#...#...\n###.#..#\n\nSample Output 2\n\n13", "sample_input": "4 6\n#..#..\n.....#\n....#.\n#.#...\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03014", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a grid with H horizontal rows and W vertical columns, and there are obstacles on some of the squares.\n\nSnuke is going to choose one of the squares not occupied by an obstacle and place a lamp on it.\nThe lamp placed on the square will emit straight beams of light in four cardinal directions: up, down, left, and right.\nIn each direction, the beam will continue traveling until it hits a square occupied by an obstacle or it hits the border of the grid. It will light all the squares on the way, including the square on which the lamp is placed, but not the square occupied by an obstacle.\n\nSnuke wants to maximize the number of squares lighted by the lamp.\n\nYou are given H strings S_i (1 \\leq i \\leq H), each of length W. If the j-th character (1 \\leq j \\leq W) of S_i is #, there is an obstacle on the square at the i-th row from the top and the j-th column from the left; if that character is ., there is no obstacle on that square.\n\nFind the maximum possible number of squares lighted by the lamp.\n\nConstraints\n\n1 \\leq H \\leq 2,000\n\n1 \\leq W \\leq 2,000\n\nS_i is a string of length W consisting of # and ..\n\n. occurs at least once in one of the strings S_i (1 \\leq i \\leq H).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nS_1\n:\nS_H\n\nOutput\n\nPrint the maximum possible number of squares lighted by the lamp.\n\nSample Input 1\n\n4 6\n#..#..\n.....#\n....#.\n#.#...\n\nSample Output 1\n\n8\n\nIf Snuke places the lamp on the square at the second row from the top and the second column from the left, it will light the following squares: the first through fifth squares from the left in the second row, and the first through fourth squares from the top in the second column, for a total of eight squares.\n\nSample Input 2\n\n8 8\n..#...#.\n....#...\n##......\n..###..#\n...#..#.\n##....#.\n#...#...\n###.#..#\n\nSample Output 2\n\n13", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1024, "cpu_time_ms": 2122, "memory_kb": 302980}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s375109319", "group_id": "codeNet:p03017", "input_text": "n, a, b, c, d = map(int, input().split())\nS = input()\nif c < d:\n if \"##\" in S[a:d-3]:\n print(\"No\")\n else:\n print(\"Yes\")\nelse:\n f = S[b-2:].find(\"...\")\n if f != -1 and f < (d-1) and f+1 < (c-1) and (\"##\" not in S[a:d-3]):\n print(\"Yes\")\n else:\n print(\"No\")", "language": "Python", "metadata": {"date": 1589645641, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03017.html", "problem_id": "p03017", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03017/input.txt", "sample_output_relpath": "derived/input_output/data/p03017/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03017/Python/s375109319.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s375109319", "user_id": "u060736237"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "n, a, b, c, d = map(int, input().split())\nS = input()\nif c < d:\n if \"##\" in S[a:d-3]:\n print(\"No\")\n else:\n print(\"Yes\")\nelse:\n f = S[b-2:].find(\"...\")\n if f != -1 and f < (d-1) and f+1 < (c-1) and (\"##\" not in S[a:d-3]):\n print(\"Yes\")\n else:\n print(\"No\")", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "sample_input": "7 1 3 6 7\n.#..#..\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03017", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 297, "cpu_time_ms": 18, "memory_kb": 3572}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s028617098", "group_id": "codeNet:p03017", "input_text": "import sys\ninput = sys.stdin.readline # NOQA\n\n\ndef main():\n N, A, B, C, D = map(int, input().split())\n A -= 1\n B -= 1\n C -= 1\n D -= 1\n S = input().rstrip()\n\n can_jump_R = True # '##'\n can_jump_B = False # '...'\n for i in range(A, N - 1):\n if S[i] == S[i+1] == \"#\":\n if A < i < C or B < i < D:\n can_jump_R = False\n if S[i-1] == S[i] == S[i+1] == \".\":\n if B <= i < C:\n can_jump_B = True\n\n if C < D:\n if can_jump_R:\n ans = \"Yes\"\n else:\n ans = \"No\"\n else:\n if can_jump_R and can_jump_B:\n ans = \"Yes\"\n else:\n ans = \"No\"\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "language": "Python", "metadata": {"date": 1588799624, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03017.html", "problem_id": "p03017", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03017/input.txt", "sample_output_relpath": "derived/input_output/data/p03017/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03017/Python/s028617098.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s028617098", "user_id": "u934442292"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import sys\ninput = sys.stdin.readline # NOQA\n\n\ndef main():\n N, A, B, C, D = map(int, input().split())\n A -= 1\n B -= 1\n C -= 1\n D -= 1\n S = input().rstrip()\n\n can_jump_R = True # '##'\n can_jump_B = False # '...'\n for i in range(A, N - 1):\n if S[i] == S[i+1] == \"#\":\n if A < i < C or B < i < D:\n can_jump_R = False\n if S[i-1] == S[i] == S[i+1] == \".\":\n if B <= i < C:\n can_jump_B = True\n\n if C < D:\n if can_jump_R:\n ans = \"Yes\"\n else:\n ans = \"No\"\n else:\n if can_jump_R and can_jump_B:\n ans = \"Yes\"\n else:\n ans = \"No\"\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "sample_input": "7 1 3 6 7\n.#..#..\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03017", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 744, "cpu_time_ms": 76, "memory_kb": 3572}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s389728677", "group_id": "codeNet:p03017", "input_text": "N, A, B, C, D = map(int, input().split())\nS = input()\np = 0\nt = 0\nsti = 0\nfor i in range(A-1, max(C, D) - 1):\n if S[i:i+2] == '##':\n p = 1\nfor j in range(B-1, min(C, D) - 2): \n if S[j:j+3] == '...':\n if sti == 0:\n sti = j + 1\n t = 1\nif S[B] == '.' and S[B-2] == '.':\n t = 1\nif (C < D and p == 0) or (C > D and p == 0 and t == 1 and sti <= D-1):\n print('Yes')\nelse:\n print('No')\n", "language": "Python", "metadata": {"date": 1584492264, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03017.html", "problem_id": "p03017", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03017/input.txt", "sample_output_relpath": "derived/input_output/data/p03017/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03017/Python/s389728677.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s389728677", "user_id": "u984276646"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "N, A, B, C, D = map(int, input().split())\nS = input()\np = 0\nt = 0\nsti = 0\nfor i in range(A-1, max(C, D) - 1):\n if S[i:i+2] == '##':\n p = 1\nfor j in range(B-1, min(C, D) - 2): \n if S[j:j+3] == '...':\n if sti == 0:\n sti = j + 1\n t = 1\nif S[B] == '.' and S[B-2] == '.':\n t = 1\nif (C < D and p == 0) or (C > D and p == 0 and t == 1 and sti <= D-1):\n print('Yes')\nelse:\n print('No')\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "sample_input": "7 1 3 6 7\n.#..#..\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03017", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 398, "cpu_time_ms": 93, "memory_kb": 3572}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s228963810", "group_id": "codeNet:p03023", "input_text": "N = int(input())\nprint(180*N - 360)", "language": "Python", "metadata": {"date": 1559437990, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03023.html", "problem_id": "p03023", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03023/input.txt", "sample_output_relpath": "derived/input_output/data/p03023/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03023/Python/s228963810.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s228963810", "user_id": "u225642513"}, "prompt_components": {"gold_output": "180\n", "input_to_evaluate": "N = int(input())\nprint(180*N - 360)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides.\n\nPrint the answer in degrees, but do not print units.\n\nConstraints\n\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint an integer representing the sum of the interior angles of a regular polygon with N sides.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n180\n\nThe sum of the interior angles of a regular triangle is 180 degrees.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n17640", "sample_input": "3\n"}, "reference_outputs": ["180\n"], "source_document_id": "p03023", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides.\n\nPrint the answer in degrees, but do not print units.\n\nConstraints\n\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint an integer representing the sum of the interior angles of a regular polygon with N sides.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n180\n\nThe sum of the interior angles of a regular triangle is 180 degrees.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n17640", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 35, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s151422485", "group_id": "codeNet:p03029", "input_text": "a, p = list(map(int,input().split()))\nprint(int(((3 * a) + p)/2))\n", "language": "Python", "metadata": {"date": 1562923681, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03029.html", "problem_id": "p03029", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03029/input.txt", "sample_output_relpath": "derived/input_output/data/p03029/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03029/Python/s151422485.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s151422485", "user_id": "u450904670"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "a, p = list(map(int,input().split()))\nprint(int(((3 * a) + p)/2))\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A apples and P pieces of apple.\n\nWe can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.\n\nFind the maximum number of apple pies we can make with what we have now.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, P \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA P\n\nOutput\n\nPrint the maximum number of apple pies we can make with what we have.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\n3\n\nWe can first make one apple pie by simmering two of the three pieces of apple. Then, we can make two more by simmering the remaining piece and three more pieces obtained by cutting the whole apple.\n\nSample Input 2\n\n0 1\n\nSample Output 2\n\n0\n\nWe cannot make an apple pie in this case, unfortunately.\n\nSample Input 3\n\n32 21\n\nSample Output 3\n\n58", "sample_input": "1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03029", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A apples and P pieces of apple.\n\nWe can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.\n\nFind the maximum number of apple pies we can make with what we have now.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, P \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA P\n\nOutput\n\nPrint the maximum number of apple pies we can make with what we have.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\n3\n\nWe can first make one apple pie by simmering two of the three pieces of apple. Then, we can make two more by simmering the remaining piece and three more pieces obtained by cutting the whole apple.\n\nSample Input 2\n\n0 1\n\nSample Output 2\n\n0\n\nWe cannot make an apple pie in this case, unfortunately.\n\nSample Input 3\n\n32 21\n\nSample Output 3\n\n58", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 66, "cpu_time_ms": 170, "memory_kb": 38256}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s402167713", "group_id": "codeNet:p03029", "input_text": "A, P = map(int, input().split())\nprint((3 * A + P) // 2)", "language": "Python", "metadata": {"date": 1558920021, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03029.html", "problem_id": "p03029", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03029/input.txt", "sample_output_relpath": "derived/input_output/data/p03029/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03029/Python/s402167713.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s402167713", "user_id": "u808373096"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "A, P = map(int, input().split())\nprint((3 * A + P) // 2)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A apples and P pieces of apple.\n\nWe can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.\n\nFind the maximum number of apple pies we can make with what we have now.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, P \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA P\n\nOutput\n\nPrint the maximum number of apple pies we can make with what we have.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\n3\n\nWe can first make one apple pie by simmering two of the three pieces of apple. Then, we can make two more by simmering the remaining piece and three more pieces obtained by cutting the whole apple.\n\nSample Input 2\n\n0 1\n\nSample Output 2\n\n0\n\nWe cannot make an apple pie in this case, unfortunately.\n\nSample Input 3\n\n32 21\n\nSample Output 3\n\n58", "sample_input": "1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03029", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A apples and P pieces of apple.\n\nWe can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.\n\nFind the maximum number of apple pies we can make with what we have now.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, P \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA P\n\nOutput\n\nPrint the maximum number of apple pies we can make with what we have.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\n3\n\nWe can first make one apple pie by simmering two of the three pieces of apple. Then, we can make two more by simmering the remaining piece and three more pieces obtained by cutting the whole apple.\n\nSample Input 2\n\n0 1\n\nSample Output 2\n\n0\n\nWe cannot make an apple pie in this case, unfortunately.\n\nSample Input 3\n\n32 21\n\nSample Output 3\n\n58", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 56, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s487564189", "group_id": "codeNet:p03029", "input_text": "a, p = map(int, input().split())\nprint((a * 3 + p) // 2)", "language": "Python", "metadata": {"date": 1558919100, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03029.html", "problem_id": "p03029", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03029/input.txt", "sample_output_relpath": "derived/input_output/data/p03029/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03029/Python/s487564189.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s487564189", "user_id": "u816872429"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "a, p = map(int, input().split())\nprint((a * 3 + p) // 2)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A apples and P pieces of apple.\n\nWe can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.\n\nFind the maximum number of apple pies we can make with what we have now.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, P \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA P\n\nOutput\n\nPrint the maximum number of apple pies we can make with what we have.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\n3\n\nWe can first make one apple pie by simmering two of the three pieces of apple. Then, we can make two more by simmering the remaining piece and three more pieces obtained by cutting the whole apple.\n\nSample Input 2\n\n0 1\n\nSample Output 2\n\n0\n\nWe cannot make an apple pie in this case, unfortunately.\n\nSample Input 3\n\n32 21\n\nSample Output 3\n\n58", "sample_input": "1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03029", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A apples and P pieces of apple.\n\nWe can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.\n\nFind the maximum number of apple pies we can make with what we have now.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, P \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA P\n\nOutput\n\nPrint the maximum number of apple pies we can make with what we have.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\n3\n\nWe can first make one apple pie by simmering two of the three pieces of apple. Then, we can make two more by simmering the remaining piece and three more pieces obtained by cutting the whole apple.\n\nSample Input 2\n\n0 1\n\nSample Output 2\n\n0\n\nWe cannot make an apple pie in this case, unfortunately.\n\nSample Input 3\n\n32 21\n\nSample Output 3\n\n58", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 56, "cpu_time_ms": 171, "memory_kb": 38384}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s585110030", "group_id": "codeNet:p03029", "input_text": "A, P = map(int, input().split())\nprint(int((3*A + P)/2))", "language": "Python", "metadata": {"date": 1558919056, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03029.html", "problem_id": "p03029", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03029/input.txt", "sample_output_relpath": "derived/input_output/data/p03029/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03029/Python/s585110030.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s585110030", "user_id": "u665038048"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "A, P = map(int, input().split())\nprint(int((3*A + P)/2))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A apples and P pieces of apple.\n\nWe can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.\n\nFind the maximum number of apple pies we can make with what we have now.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, P \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA P\n\nOutput\n\nPrint the maximum number of apple pies we can make with what we have.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\n3\n\nWe can first make one apple pie by simmering two of the three pieces of apple. Then, we can make two more by simmering the remaining piece and three more pieces obtained by cutting the whole apple.\n\nSample Input 2\n\n0 1\n\nSample Output 2\n\n0\n\nWe cannot make an apple pie in this case, unfortunately.\n\nSample Input 3\n\n32 21\n\nSample Output 3\n\n58", "sample_input": "1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03029", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A apples and P pieces of apple.\n\nWe can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.\n\nFind the maximum number of apple pies we can make with what we have now.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, P \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA P\n\nOutput\n\nPrint the maximum number of apple pies we can make with what we have.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\n3\n\nWe can first make one apple pie by simmering two of the three pieces of apple. Then, we can make two more by simmering the remaining piece and three more pieces obtained by cutting the whole apple.\n\nSample Input 2\n\n0 1\n\nSample Output 2\n\n0\n\nWe cannot make an apple pie in this case, unfortunately.\n\nSample Input 3\n\n32 21\n\nSample Output 3\n\n58", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 56, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s139537681", "group_id": "codeNet:p03030", "input_text": "N = int(input())\nr = []\n\nfor i in range(N):\n city, score = input().split()\n r.append((city, int(score), i+1))\n\nr = sorted(r, key = lambda x:(x[0], -x[1]))\nfor city, score, num in r:\n print(num)\n", "language": "Python", "metadata": {"date": 1569203910, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03030.html", "problem_id": "p03030", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03030/input.txt", "sample_output_relpath": "derived/input_output/data/p03030/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03030/Python/s139537681.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s139537681", "user_id": "u707498674"}, "prompt_components": {"gold_output": "3\n4\n6\n1\n5\n2\n", "input_to_evaluate": "N = int(input())\nr = []\n\nfor i in range(N):\n city, score = input().split()\n r.append((city, int(score), i+1))\n\nr = sorted(r, key = lambda x:(x[0], -x[1]))\nfor city, score, num in r:\n print(num)\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have decided to write a book introducing good restaurants.\nThere are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i.\nNo two restaurants have the same score.\n\nYou want to introduce the restaurants in the following order:\n\nThe restaurants are arranged in lexicographical order of the names of their cities.\n\nIf there are multiple restaurants in the same city, they are arranged in descending order of score.\n\nPrint the identification numbers of the restaurants in the order they are introduced in the book.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nS is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\n0 ≤ P_i ≤ 100\n\nP_i is an integer.\n\nP_i ≠ P_j (1 ≤ i < j ≤ N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1 P_1\n:\nS_N P_N\n\nOutput\n\nPrint N lines. The i-th line (1 ≤ i ≤ N) should contain the identification number of the restaurant that is introduced i-th in the book.\n\nSample Input 1\n\n6\nkhabarovsk 20\nmoscow 10\nkazan 50\nkazan 35\nmoscow 60\nkhabarovsk 40\n\nSample Output 1\n\n3\n4\n6\n1\n5\n2\n\nThe lexicographical order of the names of the three cities is kazan < khabarovsk < moscow. For each of these cities, the restaurants in it are introduced in descending order of score. Thus, the restaurants are introduced in the order 3,4,6,1,5,2.\n\nSample Input 2\n\n10\nyakutsk 10\nyakutsk 20\nyakutsk 30\nyakutsk 40\nyakutsk 50\nyakutsk 60\nyakutsk 70\nyakutsk 80\nyakutsk 90\nyakutsk 100\n\nSample Output 2\n\n10\n9\n8\n7\n6\n5\n4\n3\n2\n1", "sample_input": "6\nkhabarovsk 20\nmoscow 10\nkazan 50\nkazan 35\nmoscow 60\nkhabarovsk 40\n"}, "reference_outputs": ["3\n4\n6\n1\n5\n2\n"], "source_document_id": "p03030", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have decided to write a book introducing good restaurants.\nThere are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i.\nNo two restaurants have the same score.\n\nYou want to introduce the restaurants in the following order:\n\nThe restaurants are arranged in lexicographical order of the names of their cities.\n\nIf there are multiple restaurants in the same city, they are arranged in descending order of score.\n\nPrint the identification numbers of the restaurants in the order they are introduced in the book.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nS is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\n0 ≤ P_i ≤ 100\n\nP_i is an integer.\n\nP_i ≠ P_j (1 ≤ i < j ≤ N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1 P_1\n:\nS_N P_N\n\nOutput\n\nPrint N lines. The i-th line (1 ≤ i ≤ N) should contain the identification number of the restaurant that is introduced i-th in the book.\n\nSample Input 1\n\n6\nkhabarovsk 20\nmoscow 10\nkazan 50\nkazan 35\nmoscow 60\nkhabarovsk 40\n\nSample Output 1\n\n3\n4\n6\n1\n5\n2\n\nThe lexicographical order of the names of the three cities is kazan < khabarovsk < moscow. For each of these cities, the restaurants in it are introduced in descending order of score. Thus, the restaurants are introduced in the order 3,4,6,1,5,2.\n\nSample Input 2\n\n10\nyakutsk 10\nyakutsk 20\nyakutsk 30\nyakutsk 40\nyakutsk 50\nyakutsk 60\nyakutsk 70\nyakutsk 80\nyakutsk 90\nyakutsk 100\n\nSample Output 2\n\n10\n9\n8\n7\n6\n5\n4\n3\n2\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 203, "cpu_time_ms": 18, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s718695897", "group_id": "codeNet:p03031", "input_text": "n,m = map(int,input().split())\ns = [list(map(int,input().split())) for i in range(m)]\np = list(map(int,input().split()))\nans = 0\nfor i in range(2**n):\n bit = [i>>j & 1 for j in range(n)]\n for k,x in enumerate(s):\n if p[k] != sum([bit[y-1] for y in x[1:]])%2:\n break\n else:\n ans += 1\nprint(ans)", "language": "Python", "metadata": {"date": 1588809145, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03031.html", "problem_id": "p03031", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03031/input.txt", "sample_output_relpath": "derived/input_output/data/p03031/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03031/Python/s718695897.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s718695897", "user_id": "u652656291"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "n,m = map(int,input().split())\ns = [list(map(int,input().split())) for i in range(m)]\np = list(map(int,input().split()))\nans = 0\nfor i in range(2**n):\n bit = [i>>j & 1 for j in range(n)]\n for k,x in enumerate(s):\n if p[k] != sum([bit[y-1] for y in x[1:]])%2:\n break\n else:\n ans += 1\nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N switches with \"on\" and \"off\" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M.\n\nBulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are \"on\" among these switches is congruent to p_i modulo 2.\n\nHow many combinations of \"on\" and \"off\" states of the switches light all the bulbs?\n\nConstraints\n\n1 \\leq N, M \\leq 10\n\n1 \\leq k_i \\leq N\n\n1 \\leq s_{ij} \\leq N\n\ns_{ia} \\neq s_{ib} (a \\neq b)\n\np_i is 0 or 1.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nk_1 s_{11} s_{12} ... s_{1k_1}\n:\nk_M s_{M1} s_{M2} ... s_{Mk_M}\np_1 p_2 ... p_M\n\nOutput\n\nPrint the number of combinations of \"on\" and \"off\" states of the switches that light all the bulbs.\n\nSample Input 1\n\n2 2\n2 1 2\n1 2\n0 1\n\nSample Output 1\n\n1\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nThere are four possible combinations of states of (Switch 1, Switch 2): (on, on), (on, off), (off, on) and (off, off). Among them, only (on, on) lights all the bulbs, so we should print 1.\n\nSample Input 2\n\n2 3\n2 1 2\n1 1\n1 2\n0 0 1\n\nSample Output 2\n\n0\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1.\n\nBulb 3 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nSwitch 1 has to be \"off\" to light Bulb 2 and Switch 2 has to be \"on\" to light Bulb 3, but then Bulb 1 will not be lighted. Thus, there are no combinations of states of the switches that light all the bulbs, so we should print 0.\n\nSample Input 3\n\n5 2\n3 1 2 5\n2 2 3\n1 0\n\nSample Output 3\n\n8", "sample_input": "2 2\n2 1 2\n1 2\n0 1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03031", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N switches with \"on\" and \"off\" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M.\n\nBulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are \"on\" among these switches is congruent to p_i modulo 2.\n\nHow many combinations of \"on\" and \"off\" states of the switches light all the bulbs?\n\nConstraints\n\n1 \\leq N, M \\leq 10\n\n1 \\leq k_i \\leq N\n\n1 \\leq s_{ij} \\leq N\n\ns_{ia} \\neq s_{ib} (a \\neq b)\n\np_i is 0 or 1.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nk_1 s_{11} s_{12} ... s_{1k_1}\n:\nk_M s_{M1} s_{M2} ... s_{Mk_M}\np_1 p_2 ... p_M\n\nOutput\n\nPrint the number of combinations of \"on\" and \"off\" states of the switches that light all the bulbs.\n\nSample Input 1\n\n2 2\n2 1 2\n1 2\n0 1\n\nSample Output 1\n\n1\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nThere are four possible combinations of states of (Switch 1, Switch 2): (on, on), (on, off), (off, on) and (off, off). Among them, only (on, on) lights all the bulbs, so we should print 1.\n\nSample Input 2\n\n2 3\n2 1 2\n1 1\n1 2\n0 0 1\n\nSample Output 2\n\n0\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1.\n\nBulb 3 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nSwitch 1 has to be \"off\" to light Bulb 2 and Switch 2 has to be \"on\" to light Bulb 3, but then Bulb 1 will not be lighted. Thus, there are no combinations of states of the switches that light all the bulbs, so we should print 0.\n\nSample Input 3\n\n5 2\n3 1 2 5\n2 2 3\n1 0\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 307, "cpu_time_ms": 28, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s147556847", "group_id": "codeNet:p03031", "input_text": "n,m=map(int,input().split())\nl=[list(map(int,input().split())) for i in range(m)]\np=list(map(int,input().split()))\n\nb=[]\nfor k in range(2**n):\n b.append(format(k,'0'+str(n)+'b'))\n\nans=0\nfor i in range(2**n):\n cton=0\n for j in range(m):\n ct=0\n for k in range(1,l[j][0]+1):\n if b[i][l[j][k]-1]=='1':ct+=1\n if ct%2==p[j]:cton+=1\n if cton==m:ans+=1\nprint(ans)", "language": "Python", "metadata": {"date": 1560121315, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03031.html", "problem_id": "p03031", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03031/input.txt", "sample_output_relpath": "derived/input_output/data/p03031/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03031/Python/s147556847.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s147556847", "user_id": "u017810624"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "n,m=map(int,input().split())\nl=[list(map(int,input().split())) for i in range(m)]\np=list(map(int,input().split()))\n\nb=[]\nfor k in range(2**n):\n b.append(format(k,'0'+str(n)+'b'))\n\nans=0\nfor i in range(2**n):\n cton=0\n for j in range(m):\n ct=0\n for k in range(1,l[j][0]+1):\n if b[i][l[j][k]-1]=='1':ct+=1\n if ct%2==p[j]:cton+=1\n if cton==m:ans+=1\nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N switches with \"on\" and \"off\" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M.\n\nBulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are \"on\" among these switches is congruent to p_i modulo 2.\n\nHow many combinations of \"on\" and \"off\" states of the switches light all the bulbs?\n\nConstraints\n\n1 \\leq N, M \\leq 10\n\n1 \\leq k_i \\leq N\n\n1 \\leq s_{ij} \\leq N\n\ns_{ia} \\neq s_{ib} (a \\neq b)\n\np_i is 0 or 1.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nk_1 s_{11} s_{12} ... s_{1k_1}\n:\nk_M s_{M1} s_{M2} ... s_{Mk_M}\np_1 p_2 ... p_M\n\nOutput\n\nPrint the number of combinations of \"on\" and \"off\" states of the switches that light all the bulbs.\n\nSample Input 1\n\n2 2\n2 1 2\n1 2\n0 1\n\nSample Output 1\n\n1\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nThere are four possible combinations of states of (Switch 1, Switch 2): (on, on), (on, off), (off, on) and (off, off). Among them, only (on, on) lights all the bulbs, so we should print 1.\n\nSample Input 2\n\n2 3\n2 1 2\n1 1\n1 2\n0 0 1\n\nSample Output 2\n\n0\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1.\n\nBulb 3 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nSwitch 1 has to be \"off\" to light Bulb 2 and Switch 2 has to be \"on\" to light Bulb 3, but then Bulb 1 will not be lighted. Thus, there are no combinations of states of the switches that light all the bulbs, so we should print 0.\n\nSample Input 3\n\n5 2\n3 1 2 5\n2 2 3\n1 0\n\nSample Output 3\n\n8", "sample_input": "2 2\n2 1 2\n1 2\n0 1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03031", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N switches with \"on\" and \"off\" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M.\n\nBulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are \"on\" among these switches is congruent to p_i modulo 2.\n\nHow many combinations of \"on\" and \"off\" states of the switches light all the bulbs?\n\nConstraints\n\n1 \\leq N, M \\leq 10\n\n1 \\leq k_i \\leq N\n\n1 \\leq s_{ij} \\leq N\n\ns_{ia} \\neq s_{ib} (a \\neq b)\n\np_i is 0 or 1.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nk_1 s_{11} s_{12} ... s_{1k_1}\n:\nk_M s_{M1} s_{M2} ... s_{Mk_M}\np_1 p_2 ... p_M\n\nOutput\n\nPrint the number of combinations of \"on\" and \"off\" states of the switches that light all the bulbs.\n\nSample Input 1\n\n2 2\n2 1 2\n1 2\n0 1\n\nSample Output 1\n\n1\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nThere are four possible combinations of states of (Switch 1, Switch 2): (on, on), (on, off), (off, on) and (off, off). Among them, only (on, on) lights all the bulbs, so we should print 1.\n\nSample Input 2\n\n2 3\n2 1 2\n1 1\n1 2\n0 0 1\n\nSample Output 2\n\n0\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1.\n\nBulb 3 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nSwitch 1 has to be \"off\" to light Bulb 2 and Switch 2 has to be \"on\" to light Bulb 3, but then Bulb 1 will not be lighted. Thus, there are no combinations of states of the switches that light all the bulbs, so we should print 0.\n\nSample Input 3\n\n5 2\n3 1 2 5\n2 2 3\n1 0\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 373, "cpu_time_ms": 49, "memory_kb": 3188}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s580831217", "group_id": "codeNet:p03032", "input_text": "N, K = map(int, input().split())\nV = list(map(int, input().split()))\n\ns = 0\nfor i in range(min(N, K) + 1):\n # res = C + D\n res = K - i\n \n # i = A + B\n for j in range(i + 1):\n # j: B, k: A\n k = i - j\n \n # Jewel in hand\n Q = sorted(V[:j] + V[N - k:])\n \n # Number of negative jewels\n minus = sum([q < 0 for q in Q])\n \n # Drop some of negative, and sum up\n score = sum(Q[min(minus, res):])\n \n # Update score\n s = max(s, score)\n\nprint(s)\n", "language": "Python", "metadata": {"date": 1558926006, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03032.html", "problem_id": "p03032", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03032/input.txt", "sample_output_relpath": "derived/input_output/data/p03032/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03032/Python/s580831217.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s580831217", "user_id": "u057109575"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "N, K = map(int, input().split())\nV = list(map(int, input().split()))\n\ns = 0\nfor i in range(min(N, K) + 1):\n # res = C + D\n res = K - i\n \n # i = A + B\n for j in range(i + 1):\n # j: B, k: A\n k = i - j\n \n # Jewel in hand\n Q = sorted(V[:j] + V[N - k:])\n \n # Number of negative jewels\n minus = sum([q < 0 for q in Q])\n \n # Drop some of negative, and sum up\n score = sum(Q[min(minus, res):])\n \n # Update score\n s = max(s, score)\n\nprint(s)\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYour friend gave you a dequeue D as a birthday present.\n\nD is a horizontal cylinder that contains a row of N jewels.\n\nThe values of the jewels are V_1, V_2, ..., V_N from left to right. There may be jewels with negative values.\n\nIn the beginning, you have no jewel in your hands.\n\nYou can perform at most K operations on D, chosen from the following, at most K times (possibly zero):\n\nOperation A: Take out the leftmost jewel contained in D and have it in your hand. You cannot do this operation when D is empty.\n\nOperation B: Take out the rightmost jewel contained in D and have it in your hand. You cannot do this operation when D is empty.\n\nOperation C: Choose a jewel in your hands and insert it to the left end of D. You cannot do this operation when you have no jewel in your hand.\n\nOperation D: Choose a jewel in your hands and insert it to the right end of D. You cannot do this operation when you have no jewel in your hand.\n\nFind the maximum possible sum of the values of jewels in your hands after the operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 50\n\n1 \\leq K \\leq 100\n\n-10^7 \\leq V_i \\leq 10^7\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nV_1 V_2 ... V_N\n\nOutput\n\nPrint the maximum possible sum of the values of jewels in your hands after the operations.\n\nSample Input 1\n\n6 4\n-10 8 2 1 2 6\n\nSample Output 1\n\n14\n\nAfter the following sequence of operations, you have two jewels of values 8 and 6 in your hands for a total of 14, which is the maximum result.\n\nDo operation A. You take out the jewel of value -10 from the left end of D.\n\nDo operation B. You take out the jewel of value 6 from the right end of D.\n\nDo operation A. You take out the jewel of value 8 from the left end of D.\n\nDo operation D. You insert the jewel of value -10 to the right end of D.\n\nSample Input 2\n\n6 4\n-6 -100 50 -2 -5 -3\n\nSample Output 2\n\n44\n\nSample Input 3\n\n6 3\n-6 -100 50 -2 -5 -3\n\nSample Output 3\n\n0\n\nIt is optimal to do no operation.", "sample_input": "6 4\n-10 8 2 1 2 6\n"}, "reference_outputs": ["14\n"], "source_document_id": "p03032", "source_text": "Score : 400 points\n\nProblem Statement\n\nYour friend gave you a dequeue D as a birthday present.\n\nD is a horizontal cylinder that contains a row of N jewels.\n\nThe values of the jewels are V_1, V_2, ..., V_N from left to right. There may be jewels with negative values.\n\nIn the beginning, you have no jewel in your hands.\n\nYou can perform at most K operations on D, chosen from the following, at most K times (possibly zero):\n\nOperation A: Take out the leftmost jewel contained in D and have it in your hand. You cannot do this operation when D is empty.\n\nOperation B: Take out the rightmost jewel contained in D and have it in your hand. You cannot do this operation when D is empty.\n\nOperation C: Choose a jewel in your hands and insert it to the left end of D. You cannot do this operation when you have no jewel in your hand.\n\nOperation D: Choose a jewel in your hands and insert it to the right end of D. You cannot do this operation when you have no jewel in your hand.\n\nFind the maximum possible sum of the values of jewels in your hands after the operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 50\n\n1 \\leq K \\leq 100\n\n-10^7 \\leq V_i \\leq 10^7\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nV_1 V_2 ... V_N\n\nOutput\n\nPrint the maximum possible sum of the values of jewels in your hands after the operations.\n\nSample Input 1\n\n6 4\n-10 8 2 1 2 6\n\nSample Output 1\n\n14\n\nAfter the following sequence of operations, you have two jewels of values 8 and 6 in your hands for a total of 14, which is the maximum result.\n\nDo operation A. You take out the jewel of value -10 from the left end of D.\n\nDo operation B. You take out the jewel of value 6 from the right end of D.\n\nDo operation A. You take out the jewel of value 8 from the left end of D.\n\nDo operation D. You insert the jewel of value -10 to the right end of D.\n\nSample Input 2\n\n6 4\n-6 -100 50 -2 -5 -3\n\nSample Output 2\n\n44\n\nSample Input 3\n\n6 3\n-6 -100 50 -2 -5 -3\n\nSample Output 3\n\n0\n\nIt is optimal to do no operation.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 480, "cpu_time_ms": 27, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s157479686", "group_id": "codeNet:p03033", "input_text": "import bisect\n\n\nN, Q = map(int, input().split(\" \"))\ncheck_points = [list(map(int, input().split(\" \"))) for _ in range(N)]\nquerys = [int(input()) for _ in range(Q)]\ntime = {}\nfor q in querys:\n time[q] = -1\n\nfor s, f, x in check_points:\n start = s-x\n end = f-x\n left = bisect.bisect_left(querys, start)\n for q in querys[left:]:\n if q >= end:\n break\n if time[q] == -1 or time[q] > x:\n time[q] = x\n\nfor q in querys:\n print(time[q])\n", "language": "Python", "metadata": {"date": 1558924502, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03033.html", "problem_id": "p03033", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03033/input.txt", "sample_output_relpath": "derived/input_output/data/p03033/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03033/Python/s157479686.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s157479686", "user_id": "u237362582"}, "prompt_components": {"gold_output": "2\n2\n10\n-1\n13\n-1\n", "input_to_evaluate": "import bisect\n\n\nN, Q = map(int, input().split(\" \"))\ncheck_points = [list(map(int, input().split(\" \"))) for _ in range(N)]\nquerys = [int(input()) for _ in range(Q)]\ntime = {}\nfor q in querys:\n time[q] = -1\n\nfor s, f, x in check_points:\n start = s-x\n end = f-x\n left = bisect.bisect_left(querys, start)\n for q in querys[left:]:\n if q >= end:\n break\n if time[q] == -1 or time[q] > x:\n time[q] = x\n\nfor q in querys:\n print(time[q])\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is an infinitely long street that runs west to east, which we consider as a number line.\n\nThere are N roadworks scheduled on this street.\nThe i-th roadwork blocks the point at coordinate X_i from time S_i - 0.5 to time T_i - 0.5.\n\nQ people are standing at coordinate 0. The i-th person will start the coordinate 0 at time D_i, continue to walk with speed 1 in the positive direction and stop walking when reaching a blocked point.\n\nFind the distance each of the Q people will walk.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, Q \\leq 2 \\times 10^5\n\n0 \\leq S_i < T_i \\leq 10^9\n\n1 \\leq X_i \\leq 10^9\n\n0 \\leq D_1 < D_2 < ... < D_Q \\leq 10^9\n\nIf i \\neq j and X_i = X_j, the intervals [S_i, T_i) and [S_j, T_j) do not overlap.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS_1 T_1 X_1\n:\nS_N T_N X_N\nD_1\n:\nD_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the distance the i-th person will walk or -1 if that person walks forever.\n\nSample Input 1\n\n4 6\n1 3 2\n7 13 10\n18 20 13\n3 4 2\n0\n1\n2\n3\n5\n8\n\nSample Output 1\n\n2\n2\n10\n-1\n13\n-1\n\nThe first person starts coordinate 0 at time 0 and stops walking at coordinate 2 when reaching a point blocked by the first roadwork at time 2.\n\nThe second person starts coordinate 0 at time 1 and reaches coordinate 2 at time 3. The first roadwork has ended, but the fourth roadwork has begun, so this person also stops walking at coordinate 2.\n\nThe fourth and sixth persons encounter no roadworks while walking, so they walk forever. The output for these cases is -1.", "sample_input": "4 6\n1 3 2\n7 13 10\n18 20 13\n3 4 2\n0\n1\n2\n3\n5\n8\n"}, "reference_outputs": ["2\n2\n10\n-1\n13\n-1\n"], "source_document_id": "p03033", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is an infinitely long street that runs west to east, which we consider as a number line.\n\nThere are N roadworks scheduled on this street.\nThe i-th roadwork blocks the point at coordinate X_i from time S_i - 0.5 to time T_i - 0.5.\n\nQ people are standing at coordinate 0. The i-th person will start the coordinate 0 at time D_i, continue to walk with speed 1 in the positive direction and stop walking when reaching a blocked point.\n\nFind the distance each of the Q people will walk.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, Q \\leq 2 \\times 10^5\n\n0 \\leq S_i < T_i \\leq 10^9\n\n1 \\leq X_i \\leq 10^9\n\n0 \\leq D_1 < D_2 < ... < D_Q \\leq 10^9\n\nIf i \\neq j and X_i = X_j, the intervals [S_i, T_i) and [S_j, T_j) do not overlap.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS_1 T_1 X_1\n:\nS_N T_N X_N\nD_1\n:\nD_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the distance the i-th person will walk or -1 if that person walks forever.\n\nSample Input 1\n\n4 6\n1 3 2\n7 13 10\n18 20 13\n3 4 2\n0\n1\n2\n3\n5\n8\n\nSample Output 1\n\n2\n2\n10\n-1\n13\n-1\n\nThe first person starts coordinate 0 at time 0 and stops walking at coordinate 2 when reaching a point blocked by the first roadwork at time 2.\n\nThe second person starts coordinate 0 at time 1 and reaches coordinate 2 at time 3. The first roadwork has ended, but the fourth roadwork has begun, so this person also stops walking at coordinate 2.\n\nThe fourth and sixth persons encounter no roadworks while walking, so they walk forever. The output for these cases is -1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 482, "cpu_time_ms": 2108, "memory_kb": 84656}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s773488736", "group_id": "codeNet:p03035", "input_text": "n,m = map(int,input().split())\nl = []\nr = []\n\nfor i in range(m):\n a,b = map(int,input().split())\n l.append(a)\n r.append(b)\n\n\nif min(r) < max(l):\n print(min(r) - max(l) + 1)\nelse:\n print(0)", "language": "Python", "metadata": {"date": 1559166523, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03035.html", "problem_id": "p03035", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03035/input.txt", "sample_output_relpath": "derived/input_output/data/p03035/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03035/Python/s773488736.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s773488736", "user_id": "u376380063"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "n,m = map(int,input().split())\nl = []\nr = []\n\nfor i in range(m):\n a,b = map(int,input().split())\n l.append(a)\n r.append(b)\n\n\nif min(r) < max(l):\n print(min(r) - max(l) + 1)\nelse:\n print(0)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi, who is A years old, is riding a Ferris wheel.\n\nIt costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)\n\nFind the cost of the Ferris wheel for Takahashi.\n\nConstraints\n\n0 ≤ A ≤ 100\n\n2 ≤ B ≤ 1000\n\nB is an even number.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the cost of the Ferris wheel for Takahashi.\n\nSample Input 1\n\n30 100\n\nSample Output 1\n\n100\n\nTakahashi is 30 years old now, and the cost of the Ferris wheel is 100 yen.\n\nSample Input 2\n\n12 100\n\nSample Output 2\n\n50\n\nTakahashi is 12 years old, and the cost of the Ferris wheel is the half of 100 yen, that is, 50 yen.\n\nSample Input 3\n\n0 100\n\nSample Output 3\n\n0\n\nTakahashi is 0 years old, and he can ride the Ferris wheel for free.", "sample_input": "30 100\n"}, "reference_outputs": ["100\n"], "source_document_id": "p03035", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi, who is A years old, is riding a Ferris wheel.\n\nIt costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)\n\nFind the cost of the Ferris wheel for Takahashi.\n\nConstraints\n\n0 ≤ A ≤ 100\n\n2 ≤ B ≤ 1000\n\nB is an even number.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the cost of the Ferris wheel for Takahashi.\n\nSample Input 1\n\n30 100\n\nSample Output 1\n\n100\n\nTakahashi is 30 years old now, and the cost of the Ferris wheel is 100 yen.\n\nSample Input 2\n\n12 100\n\nSample Output 2\n\n50\n\nTakahashi is 12 years old, and the cost of the Ferris wheel is the half of 100 yen, that is, 50 yen.\n\nSample Input 3\n\n0 100\n\nSample Output 3\n\n0\n\nTakahashi is 0 years old, and he can ride the Ferris wheel for free.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 203, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s595733248", "group_id": "codeNet:p03035", "input_text": "n, p = map(int, input().split())\nif n<6: print(0)\nelif 5= c:\n break\nelse:\n i += 1\n\nprint(sum(D_[:i]) + sum(A_[i:]))\n", "language": "Python", "metadata": {"date": 1559885721, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03038.html", "problem_id": "p03038", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03038/input.txt", "sample_output_relpath": "derived/input_output/data/p03038/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03038/Python/s355584278.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s355584278", "user_id": "u310431893"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "N, M = [int(i) for i in input().split()]\nA = [int(i) for i in input().split()]\nBC = [tuple(int(i) for i in input().split()) for _ in range(M)]\n\nA_ = sorted(A)\nBC_ = sorted(BC, key=lambda x: x[1], reverse=True)\n\nD_ = sum(([c] * b for b, c in BC_), [])\n\nfor i, (a, c) in enumerate(zip(A_, D_)):\n if a >= c:\n break\nelse:\n i += 1\n\nprint(sum(D_[:i]) + sum(A_[i:]))\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "3 2\n5 1 4\n2 3\n1 5\n"}, "reference_outputs": ["14\n"], "source_document_id": "p03038", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 373, "cpu_time_ms": 2105, "memory_kb": 142128}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s145201957", "group_id": "codeNet:p03038", "input_text": "N, M = map(int, input().split())\nA = list(map(int, input().split()))\ncounter = {}\nfor a in A:\n if a in counter:\n counter[a] += 1\n else:\n counter[a] = 1\nfor _ in range(M):\n B, C = map(int, input().split())\n if C in counter:\n counter[C] += B\n else:\n counter[C] = B\nsortedCounter = sorted(counter.items(), reverse=True)\nsumResult = 0\nfor count in sortedCounter:\n if count[1] >= N:\n sumResult += count[0] * N\n break\n else:\n sumResult += count[0] * count[1]\n N -= count[1]\nprint(sumResult)", "language": "Python", "metadata": {"date": 1559110625, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03038.html", "problem_id": "p03038", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03038/input.txt", "sample_output_relpath": "derived/input_output/data/p03038/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03038/Python/s145201957.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s145201957", "user_id": "u799215419"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "N, M = map(int, input().split())\nA = list(map(int, input().split()))\ncounter = {}\nfor a in A:\n if a in counter:\n counter[a] += 1\n else:\n counter[a] = 1\nfor _ in range(M):\n B, C = map(int, input().split())\n if C in counter:\n counter[C] += B\n else:\n counter[C] = B\nsortedCounter = sorted(counter.items(), reverse=True)\nsumResult = 0\nfor count in sortedCounter:\n if count[1] >= N:\n sumResult += count[0] * N\n break\n else:\n sumResult += count[0] * count[1]\n N -= count[1]\nprint(sumResult)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "3 2\n5 1 4\n2 3\n1 5\n"}, "reference_outputs": ["14\n"], "source_document_id": "p03038", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 561, "cpu_time_ms": 632, "memory_kb": 40736}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s868427940", "group_id": "codeNet:p03039", "input_text": "def cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 #出力の制限\nN = 10**4\ng1 = [1, 1] # 元テーブル\ng2 = [1, 1] #逆元テーブル\ninverse = [0, 1] #逆元テーブル計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nn,m,k = map(int,input().split())\nnm = n*m%(10**9+7)\nk = k%(10**9+7)\na = (cmb(nm-2,k-2,mod)%(10**9+7))*(nm*(m*(n**2-1)+n*(m**2-1)))//6\nprint(a%(10**9+7))", "language": "Python", "metadata": {"date": 1558846704, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03039.html", "problem_id": "p03039", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03039/input.txt", "sample_output_relpath": "derived/input_output/data/p03039/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03039/Python/s868427940.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s868427940", "user_id": "u183284051"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "def cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 #出力の制限\nN = 10**4\ng1 = [1, 1] # 元テーブル\ng2 = [1, 1] #逆元テーブル\ninverse = [0, 1] #逆元テーブル計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nn,m,k = map(int,input().split())\nnm = n*m%(10**9+7)\nk = k%(10**9+7)\na = (cmb(nm-2,k-2,mod)%(10**9+7))*(nm*(m*(n**2-1)+n*(m**2-1)))//6\nprint(a%(10**9+7))", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a grid of squares with N rows and M columns. Let (i, j) denote the square at the i-th row from the top and j-th column from the left. We will choose K of the squares and put a piece on each of them.\n\nIf we place the K pieces on squares (x_1, y_1), (x_2, y_2), ..., and (x_K, y_K), the cost of this arrangement is computed as:\n\n\\sum_{i=1}^{K-1} \\sum_{j=i+1}^K (|x_i - x_j| + |y_i - y_j|)\n\nFind the sum of the costs of all possible arrangements of the pieces. Since this value can be tremendous, print it modulo 10^9+7.\n\nWe consider two arrangements of the pieces different if and only if there is a square that contains a piece in one of the arrangements but not in the other.\n\nConstraints\n\n2 \\leq N \\times M \\leq 2 \\times 10^5\n\n2 \\leq K \\leq N \\times M\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\n\nOutput\n\nPrint the sum of the costs of all possible arrangements of the pieces, modulo 10^9+7.\n\nSample Input 1\n\n2 2 2\n\nSample Output 1\n\n8\n\nThere are six possible arrangements of the pieces, as follows:\n\n((1,1),(1,2)), with the cost |1-1|+|1-2| = 1\n\n((1,1),(2,1)), with the cost |1-2|+|1-1| = 1\n\n((1,1),(2,2)), with the cost |1-2|+|1-2| = 2\n\n((1,2),(2,1)), with the cost |1-2|+|2-1| = 2\n\n((1,2),(2,2)), with the cost |1-2|+|2-2| = 1\n\n((2,1),(2,2)), with the cost |2-2|+|1-2| = 1\n\nThe sum of these costs is 8.\n\nSample Input 2\n\n4 5 4\n\nSample Output 2\n\n87210\n\nSample Input 3\n\n100 100 5000\n\nSample Output 3\n\n817260251\n\nBe sure to print the sum modulo 10^9+7.", "sample_input": "2 2 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03039", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a grid of squares with N rows and M columns. Let (i, j) denote the square at the i-th row from the top and j-th column from the left. We will choose K of the squares and put a piece on each of them.\n\nIf we place the K pieces on squares (x_1, y_1), (x_2, y_2), ..., and (x_K, y_K), the cost of this arrangement is computed as:\n\n\\sum_{i=1}^{K-1} \\sum_{j=i+1}^K (|x_i - x_j| + |y_i - y_j|)\n\nFind the sum of the costs of all possible arrangements of the pieces. Since this value can be tremendous, print it modulo 10^9+7.\n\nWe consider two arrangements of the pieces different if and only if there is a square that contains a piece in one of the arrangements but not in the other.\n\nConstraints\n\n2 \\leq N \\times M \\leq 2 \\times 10^5\n\n2 \\leq K \\leq N \\times M\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\n\nOutput\n\nPrint the sum of the costs of all possible arrangements of the pieces, modulo 10^9+7.\n\nSample Input 1\n\n2 2 2\n\nSample Output 1\n\n8\n\nThere are six possible arrangements of the pieces, as follows:\n\n((1,1),(1,2)), with the cost |1-1|+|1-2| = 1\n\n((1,1),(2,1)), with the cost |1-2|+|1-1| = 1\n\n((1,1),(2,2)), with the cost |1-2|+|1-2| = 2\n\n((1,2),(2,1)), with the cost |1-2|+|2-1| = 2\n\n((1,2),(2,2)), with the cost |1-2|+|2-2| = 1\n\n((2,1),(2,2)), with the cost |2-2|+|1-2| = 1\n\nThe sum of these costs is 8.\n\nSample Input 2\n\n4 5 4\n\nSample Output 2\n\n87210\n\nSample Input 3\n\n100 100 5000\n\nSample Output 3\n\n817260251\n\nBe sure to print the sum modulo 10^9+7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 610, "cpu_time_ms": 29, "memory_kb": 4328}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s593352034", "group_id": "codeNet:p03040", "input_text": "BLACK = True\nRED = False\n\nclass RBNode:\n def __init__(self, value):\n self.value = value\n self.color = RED\n self.duplication = 1\n self.left = None\n self.right = None\n\ndef upper_update(upper, child):\n if upper is not None:\n if child.value < upper.value:\n upper.left = child\n else:\n upper.right = child\n\ndef ll_rotate(upper, top, middle, bottom):\n # top.left == middle\n # middle.left == bottom\n\n top.left = middle.right\n\n upper_update(upper, middle)\n\n middle.right = top\n\n bottom.color = BLACK\n\n return middle\n\ndef lr_rotate(upper, top, middle, bottom):\n # top.left == middle\n # middle.right == bottom\n\n top.left = bottom.right\n\n middle.right = bottom.left\n\n bottom.right = top\n\n bottom.left = middle\n\n upper_update(upper, bottom)\n\n middle.color = BLACK\n\n return bottom\n\ndef rl_rotate(upper, top, middle, bottom):\n # top.right == middle\n # middle.left == bottom\n\n top.right = bottom.left\n\n middle.left = bottom.right\n\n bottom.left = top\n\n bottom.right = middle\n\n upper_update(upper, bottom)\n\n middle.color = BLACK\n\n return bottom\n\ndef rr_rotate(upper, top, middle, bottom):\n # top.right == middle\n # middle.right == bottom\n\n top.right = middle.left\n\n upper_update(upper, middle)\n\n middle.left = top\n\n bottom.color = BLACK\n\n return middle\n\nclass RBTree:\n def __init__(self, value):\n self.root = RBNode(value)\n self.root.color = BLACK\n self.size = 1\n\n def ordered(self, parent=None):\n if parent is None:\n parent = self.root\n if parent.left is not None:\n yield from self.ordered(parent.left)\n yield parent\n if parent.right is not None:\n yield from self.ordered(parent.right)\n\n def insert(self, value):\n self.size += 1\n\n # find\n node = self.root\n stack = [None]\n while True:\n stack.append(node)\n node_value = node.value\n if value == node_value:\n node.duplication += 1\n need_rotation = False\n break\n elif value < node_value:\n if node.left is None:\n bottom = RBNode(value)\n node.left = bottom\n need_rotation = node.color == RED\n stack.append(bottom)\n break\n else:\n node = node.left\n continue\n else:\n if node.right is None:\n bottom = RBNode(value)\n node.right = bottom\n need_rotation = node.color == RED\n stack.append(bottom)\n break\n else:\n node = node.right\n continue\n\n while need_rotation:\n bottom = stack.pop()\n middle = stack.pop()\n top = stack.pop()\n upper = stack[-1]\n if bottom.value < middle.value:\n # Xl\n if middle.value < top.value:\n bottom = ll_rotate(upper, top, middle, bottom)\n else:\n bottom = rl_rotate(upper, top, middle, bottom)\n else:\n # XR\n if middle.value < top.value:\n bottom = lr_rotate(upper, top, middle, bottom)\n else:\n bottom = rr_rotate(upper, top, middle, bottom)\n\n if upper is None:\n # root\n bottom.color = BLACK\n need_rotation = False\n self.root = bottom\n break\n else:\n if upper.color == BLACK:\n need_rotation = False\n break\n else:\n stack.append(bottom)\n continue\n\n return\n\n def find(self, value):\n node = self.root\n level = 0\n num_black = 1\n while node.value != value:\n level += 1\n if value < node.value:\n node = node.left\n else:\n node = node.right\n if node is None:\n return False, level, num_black\n if node.color == BLACK:\n num_black += 1\n return node, level, num_black\n\n def is_leaf(self, value):\n node, level, num_black = self.find(value)\n assert node is not None\n return node.left is None and node.right is None, level, num_black\n\nQ = int(input())\nqueries = []\nfor _ in range(Q):\n query = list(map(int, input().split(\" \")))\n if len(query) == 1:\n continue\n queries.append(query[1])\n\ntree = RBTree(queries[0])\nfor q in queries[1:]:\n tree.insert(q)\n\nprint(\"4 2\")\nprint(\"1 -3\")\n", "language": "Python", "metadata": {"date": 1559091258, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03040.html", "problem_id": "p03040", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03040/input.txt", "sample_output_relpath": "derived/input_output/data/p03040/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03040/Python/s593352034.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s593352034", "user_id": "u579475320"}, "prompt_components": {"gold_output": "4 2\n1 -3\n", "input_to_evaluate": "BLACK = True\nRED = False\n\nclass RBNode:\n def __init__(self, value):\n self.value = value\n self.color = RED\n self.duplication = 1\n self.left = None\n self.right = None\n\ndef upper_update(upper, child):\n if upper is not None:\n if child.value < upper.value:\n upper.left = child\n else:\n upper.right = child\n\ndef ll_rotate(upper, top, middle, bottom):\n # top.left == middle\n # middle.left == bottom\n\n top.left = middle.right\n\n upper_update(upper, middle)\n\n middle.right = top\n\n bottom.color = BLACK\n\n return middle\n\ndef lr_rotate(upper, top, middle, bottom):\n # top.left == middle\n # middle.right == bottom\n\n top.left = bottom.right\n\n middle.right = bottom.left\n\n bottom.right = top\n\n bottom.left = middle\n\n upper_update(upper, bottom)\n\n middle.color = BLACK\n\n return bottom\n\ndef rl_rotate(upper, top, middle, bottom):\n # top.right == middle\n # middle.left == bottom\n\n top.right = bottom.left\n\n middle.left = bottom.right\n\n bottom.left = top\n\n bottom.right = middle\n\n upper_update(upper, bottom)\n\n middle.color = BLACK\n\n return bottom\n\ndef rr_rotate(upper, top, middle, bottom):\n # top.right == middle\n # middle.right == bottom\n\n top.right = middle.left\n\n upper_update(upper, middle)\n\n middle.left = top\n\n bottom.color = BLACK\n\n return middle\n\nclass RBTree:\n def __init__(self, value):\n self.root = RBNode(value)\n self.root.color = BLACK\n self.size = 1\n\n def ordered(self, parent=None):\n if parent is None:\n parent = self.root\n if parent.left is not None:\n yield from self.ordered(parent.left)\n yield parent\n if parent.right is not None:\n yield from self.ordered(parent.right)\n\n def insert(self, value):\n self.size += 1\n\n # find\n node = self.root\n stack = [None]\n while True:\n stack.append(node)\n node_value = node.value\n if value == node_value:\n node.duplication += 1\n need_rotation = False\n break\n elif value < node_value:\n if node.left is None:\n bottom = RBNode(value)\n node.left = bottom\n need_rotation = node.color == RED\n stack.append(bottom)\n break\n else:\n node = node.left\n continue\n else:\n if node.right is None:\n bottom = RBNode(value)\n node.right = bottom\n need_rotation = node.color == RED\n stack.append(bottom)\n break\n else:\n node = node.right\n continue\n\n while need_rotation:\n bottom = stack.pop()\n middle = stack.pop()\n top = stack.pop()\n upper = stack[-1]\n if bottom.value < middle.value:\n # Xl\n if middle.value < top.value:\n bottom = ll_rotate(upper, top, middle, bottom)\n else:\n bottom = rl_rotate(upper, top, middle, bottom)\n else:\n # XR\n if middle.value < top.value:\n bottom = lr_rotate(upper, top, middle, bottom)\n else:\n bottom = rr_rotate(upper, top, middle, bottom)\n\n if upper is None:\n # root\n bottom.color = BLACK\n need_rotation = False\n self.root = bottom\n break\n else:\n if upper.color == BLACK:\n need_rotation = False\n break\n else:\n stack.append(bottom)\n continue\n\n return\n\n def find(self, value):\n node = self.root\n level = 0\n num_black = 1\n while node.value != value:\n level += 1\n if value < node.value:\n node = node.left\n else:\n node = node.right\n if node is None:\n return False, level, num_black\n if node.color == BLACK:\n num_black += 1\n return node, level, num_black\n\n def is_leaf(self, value):\n node, level, num_black = self.find(value)\n assert node is not None\n return node.left is None and node.right is None, level, num_black\n\nQ = int(input())\nqueries = []\nfor _ in range(Q):\n query = list(map(int, input().split(\" \")))\n if len(query) == 1:\n continue\n queries.append(query[1])\n\ntree = RBTree(queries[0])\nfor q in queries[1:]:\n tree.insert(q)\n\nprint(\"4 2\")\nprint(\"1 -3\")\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nThere is a function f(x), which is initially a constant function f(x) = 0.\n\nWe will ask you to process Q queries in order. There are two kinds of queries, update queries and evaluation queries, as follows:\n\nAn update query 1 a b: Given two integers a and b, let g(x) = f(x) + |x - a| + b and replace f(x) with g(x).\n\nAn evaluation query 2: Print x that minimizes f(x), and the minimum value of f(x). If there are multiple such values of x, choose the minimum such value.\n\nWe can show that the values to be output in an evaluation query are always integers, so we ask you to print those values as integers without decimal points.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n-10^9 \\leq a, b \\leq 10^9\n\nThe first query is an update query.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ\nQuery_1\n:\nQuery_Q\n\nSee Sample Input 1 for an example.\n\nOutput\n\nFor each evaluation query, print a line containing the response, in the order in which the queries are given.\n\nThe response to each evaluation query should be the minimum value of x that minimizes f(x), and the minimum value of f(x), in this order, with space in between.\n\nSample Input 1\n\n4\n1 4 2\n2\n1 1 -8\n2\n\nSample Output 1\n\n4 2\n1 -3\n\nIn the first evaluation query, f(x) = |x - 4| + 2, which attains the minimum value of 2 at x = 4.\n\nIn the second evaluation query, f(x) = |x - 1| + |x - 4| - 6, which attains the minimum value of -3 when 1 \\leq x \\leq 4. Among the multiple values of x that minimize f(x), we ask you to print the minimum, that is, 1.\n\nSample Input 2\n\n4\n1 -1000000000 1000000000\n1 -1000000000 1000000000\n1 -1000000000 1000000000\n2\n\nSample Output 2\n\n-1000000000 3000000000", "sample_input": "4\n1 4 2\n2\n1 1 -8\n2\n"}, "reference_outputs": ["4 2\n1 -3\n"], "source_document_id": "p03040", "source_text": "Score : 600 points\n\nProblem Statement\n\nThere is a function f(x), which is initially a constant function f(x) = 0.\n\nWe will ask you to process Q queries in order. There are two kinds of queries, update queries and evaluation queries, as follows:\n\nAn update query 1 a b: Given two integers a and b, let g(x) = f(x) + |x - a| + b and replace f(x) with g(x).\n\nAn evaluation query 2: Print x that minimizes f(x), and the minimum value of f(x). If there are multiple such values of x, choose the minimum such value.\n\nWe can show that the values to be output in an evaluation query are always integers, so we ask you to print those values as integers without decimal points.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq Q \\leq 2 \\times 10^5\n\n-10^9 \\leq a, b \\leq 10^9\n\nThe first query is an update query.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ\nQuery_1\n:\nQuery_Q\n\nSee Sample Input 1 for an example.\n\nOutput\n\nFor each evaluation query, print a line containing the response, in the order in which the queries are given.\n\nThe response to each evaluation query should be the minimum value of x that minimizes f(x), and the minimum value of f(x), in this order, with space in between.\n\nSample Input 1\n\n4\n1 4 2\n2\n1 1 -8\n2\n\nSample Output 1\n\n4 2\n1 -3\n\nIn the first evaluation query, f(x) = |x - 4| + 2, which attains the minimum value of 2 at x = 4.\n\nIn the second evaluation query, f(x) = |x - 1| + |x - 4| - 6, which attains the minimum value of -3 when 1 \\leq x \\leq 4. Among the multiple values of x that minimize f(x), we ask you to print the minimum, that is, 1.\n\nSample Input 2\n\n4\n1 -1000000000 1000000000\n1 -1000000000 1000000000\n1 -1000000000 1000000000\n2\n\nSample Output 2\n\n-1000000000 3000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4867, "cpu_time_ms": 1775, "memory_kb": 33880}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s645445892", "group_id": "codeNet:p03041", "input_text": "N, K = map(int, input().split())\nS = list(input())\nS[K - 1] = S[K - 1].lower()\nprint(\"\".join(S))\n", "language": "Python", "metadata": {"date": 1568848697, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03041.html", "problem_id": "p03041", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03041/input.txt", "sample_output_relpath": "derived/input_output/data/p03041/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03041/Python/s645445892.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s645445892", "user_id": "u626684023"}, "prompt_components": {"gold_output": "aBC\n", "input_to_evaluate": "N, K = map(int, input().split())\nS = list(input())\nS[K - 1] = S[K - 1].lower()\nprint(\"\".join(S))\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, B and C, and an integer K which is between 1 and N (inclusive).\nPrint the string S after lowercasing the K-th character in it.\n\nConstraints\n\n1 ≤ N ≤ 50\n\n1 ≤ K ≤ N\n\nS is a string of length N consisting of A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the string S after lowercasing the K-th character in it.\n\nSample Input 1\n\n3 1\nABC\n\nSample Output 1\n\naBC\n\nSample Input 2\n\n4 3\nCABA\n\nSample Output 2\n\nCAbA", "sample_input": "3 1\nABC\n"}, "reference_outputs": ["aBC\n"], "source_document_id": "p03041", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, B and C, and an integer K which is between 1 and N (inclusive).\nPrint the string S after lowercasing the K-th character in it.\n\nConstraints\n\n1 ≤ N ≤ 50\n\n1 ≤ K ≤ N\n\nS is a string of length N consisting of A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the string S after lowercasing the K-th character in it.\n\nSample Input 1\n\n3 1\nABC\n\nSample Output 1\n\naBC\n\nSample Input 2\n\n4 3\nCABA\n\nSample Output 2\n\nCAbA", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 97, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s346277078", "group_id": "codeNet:p03041", "input_text": "N,K=map(int,input().split())\nS=input()\nS[K-1].lower()\nprint (S)", "language": "Python", "metadata": {"date": 1558458552, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03041.html", "problem_id": "p03041", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03041/input.txt", "sample_output_relpath": "derived/input_output/data/p03041/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03041/Python/s346277078.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s346277078", "user_id": "u258808501"}, "prompt_components": {"gold_output": "aBC\n", "input_to_evaluate": "N,K=map(int,input().split())\nS=input()\nS[K-1].lower()\nprint (S)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, B and C, and an integer K which is between 1 and N (inclusive).\nPrint the string S after lowercasing the K-th character in it.\n\nConstraints\n\n1 ≤ N ≤ 50\n\n1 ≤ K ≤ N\n\nS is a string of length N consisting of A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the string S after lowercasing the K-th character in it.\n\nSample Input 1\n\n3 1\nABC\n\nSample Output 1\n\naBC\n\nSample Input 2\n\n4 3\nCABA\n\nSample Output 2\n\nCAbA", "sample_input": "3 1\nABC\n"}, "reference_outputs": ["aBC\n"], "source_document_id": "p03041", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, B and C, and an integer K which is between 1 and N (inclusive).\nPrint the string S after lowercasing the K-th character in it.\n\nConstraints\n\n1 ≤ N ≤ 50\n\n1 ≤ K ≤ N\n\nS is a string of length N consisting of A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the string S after lowercasing the K-th character in it.\n\nSample Input 1\n\n3 1\nABC\n\nSample Output 1\n\naBC\n\nSample Input 2\n\n4 3\nCABA\n\nSample Output 2\n\nCAbA", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 63, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s900675383", "group_id": "codeNet:p03041", "input_text": "N, K = [ int(i) for i in input().split() ]\nS = input()\n\nprint(S[:K-1] + S[K-1].lower() + S[K:])\n", "language": "Python", "metadata": {"date": 1558315226, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03041.html", "problem_id": "p03041", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03041/input.txt", "sample_output_relpath": "derived/input_output/data/p03041/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03041/Python/s900675383.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s900675383", "user_id": "u476224750"}, "prompt_components": {"gold_output": "aBC\n", "input_to_evaluate": "N, K = [ int(i) for i in input().split() ]\nS = input()\n\nprint(S[:K-1] + S[K-1].lower() + S[K:])\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, B and C, and an integer K which is between 1 and N (inclusive).\nPrint the string S after lowercasing the K-th character in it.\n\nConstraints\n\n1 ≤ N ≤ 50\n\n1 ≤ K ≤ N\n\nS is a string of length N consisting of A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the string S after lowercasing the K-th character in it.\n\nSample Input 1\n\n3 1\nABC\n\nSample Output 1\n\naBC\n\nSample Input 2\n\n4 3\nCABA\n\nSample Output 2\n\nCAbA", "sample_input": "3 1\nABC\n"}, "reference_outputs": ["aBC\n"], "source_document_id": "p03041", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, B and C, and an integer K which is between 1 and N (inclusive).\nPrint the string S after lowercasing the K-th character in it.\n\nConstraints\n\n1 ≤ N ≤ 50\n\n1 ≤ K ≤ N\n\nS is a string of length N consisting of A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the string S after lowercasing the K-th character in it.\n\nSample Input 1\n\n3 1\nABC\n\nSample Output 1\n\naBC\n\nSample Input 2\n\n4 3\nCABA\n\nSample Output 2\n\nCAbA", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s822232971", "group_id": "codeNet:p03043", "input_text": "N,K = map( int, input().split())\n#a = [0 for in range(K)]\nl = [0]\nwin = 0\nif N>=K:\n win = N-K+1\n l[0] = N-K+1\nnow = K-1\ncnt = 2\nnN = N\nwhile now>=1:\n nx = now // 2\n if N > now:\n a = now-nx\n elif now >= nN > nx:\n a = N - nx\n else:\n a = 0\n l.append(a)\n now = nx\n cnt *= 2\nll = len(l)\npp = 1\nfor i in range(ll):\n l[ll-i-1] *= pp\n pp *= 2\nsuml = sum(l)\nprint( suml/(pp/2))\n", "language": "Python", "metadata": {"date": 1558319980, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03043.html", "problem_id": "p03043", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03043/input.txt", "sample_output_relpath": "derived/input_output/data/p03043/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03043/Python/s822232971.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s822232971", "user_id": "u107091170"}, "prompt_components": {"gold_output": "0.145833333333\n", "input_to_evaluate": "N,K = map( int, input().split())\n#a = [0 for in range(K)]\nl = [0]\nwin = 0\nif N>=K:\n win = N-K+1\n l[0] = N-K+1\nnow = K-1\ncnt = 2\nnN = N\nwhile now>=1:\n nx = now // 2\n if N > now:\n a = now-nx\n elif now >= nN > nx:\n a = N - nx\n else:\n a = 0\n l.append(a)\n now = nx\n cnt *= 2\nll = len(l)\npp = 1\nfor i in range(ll):\n l[ll-i-1] *= pp\n pp *= 2\nsuml = sum(l)\nprint( suml/(pp/2))\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:\n\nThrow the die. The current score is the result of the die.\n\nAs long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.\n\nThe game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.\n\nYou are given N and K. Find the probability that Snuke wins the game.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the probability that Snuke wins the game. The output is considered correct when the absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n3 10\n\nSample Output 1\n\n0.145833333333\n\nIf the die shows 1, Snuke needs to get four consecutive heads from four coin flips to obtain a score of 10 or above. The probability of this happening is \\frac{1}{3} \\times (\\frac{1}{2})^4 = \\frac{1}{48}.\n\nIf the die shows 2, Snuke needs to get three consecutive heads from three coin flips to obtain a score of 10 or above. The probability of this happening is \\frac{1}{3} \\times (\\frac{1}{2})^3 = \\frac{1}{24}.\n\nIf the die shows 3, Snuke needs to get two consecutive heads from two coin flips to obtain a score of 10 or above. The probability of this happening is \\frac{1}{3} \\times (\\frac{1}{2})^2 = \\frac{1}{12}.\n\nThus, the probability that Snuke wins is \\frac{1}{48} + \\frac{1}{24} + \\frac{1}{12} = \\frac{7}{48} \\simeq 0.1458333333.\n\nSample Input 2\n\n100000 5\n\nSample Output 2\n\n0.999973749998", "sample_input": "3 10\n"}, "reference_outputs": ["0.145833333333\n"], "source_document_id": "p03043", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:\n\nThrow the die. The current score is the result of the die.\n\nAs long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.\n\nThe game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.\n\nYou are given N and K. Find the probability that Snuke wins the game.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the probability that Snuke wins the game. The output is considered correct when the absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n3 10\n\nSample Output 1\n\n0.145833333333\n\nIf the die shows 1, Snuke needs to get four consecutive heads from four coin flips to obtain a score of 10 or above. The probability of this happening is \\frac{1}{3} \\times (\\frac{1}{2})^4 = \\frac{1}{48}.\n\nIf the die shows 2, Snuke needs to get three consecutive heads from three coin flips to obtain a score of 10 or above. The probability of this happening is \\frac{1}{3} \\times (\\frac{1}{2})^3 = \\frac{1}{24}.\n\nIf the die shows 3, Snuke needs to get two consecutive heads from two coin flips to obtain a score of 10 or above. The probability of this happening is \\frac{1}{3} \\times (\\frac{1}{2})^2 = \\frac{1}{12}.\n\nThus, the probability that Snuke wins is \\frac{1}{48} + \\frac{1}{24} + \\frac{1}{12} = \\frac{7}{48} \\simeq 0.1458333333.\n\nSample Input 2\n\n100000 5\n\nSample Output 2\n\n0.999973749998", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 389, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s855807660", "group_id": "codeNet:p03044", "input_text": "N = int(input())\ntree = [list() for _ in range(N)]\nfor _ in range(N-1):\n u, v, w = map(int, input().split())\n tree[u-1].append((v-1, w))\n tree[v-1].append((u-1, w))\nstack = [0]\nans = [0] * N\nsearched = [False] * N\nwhile stack:\n node = stack.pop()\n searched[node] = True\n for v, w in tree[node]:\n if searched[v]:\n continue\n if w % 2 != 0:\n ans[v] = ans[node] ^ 1\n else:\n ans[v] = ans[node]\n stack.append(v)\nprint(*ans, sep='\\n')\n", "language": "Python", "metadata": {"date": 1576815659, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03044.html", "problem_id": "p03044", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03044/input.txt", "sample_output_relpath": "derived/input_output/data/p03044/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03044/Python/s855807660.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s855807660", "user_id": "u921518222"}, "prompt_components": {"gold_output": "0\n0\n1\n", "input_to_evaluate": "N = int(input())\ntree = [list() for _ in range(N)]\nfor _ in range(N-1):\n u, v, w = map(int, input().split())\n tree[u-1].append((v-1, w))\n tree[v-1].append((u-1, w))\nstack = [0]\nans = [0] * N\nsearched = [False] * N\nwhile stack:\n node = stack.pop()\n searched[node] = True\n for v, w in tree[node]:\n if searched[v]:\n continue\n if w % 2 != 0:\n ans[v] = ans[node] ^ 1\n else:\n ans[v] = ans[node]\n stack.append(v)\nprint(*ans, sep='\\n')\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a tree with N vertices numbered 1 to N.\nThe i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i.\nYour objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied:\n\nFor any two vertices painted in the same color, the distance between them is an even number.\n\nFind a coloring of the vertices that satisfies the condition and print it. It can be proved that at least one such coloring exists under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq u_i < v_i \\leq N\n\n1 \\leq w_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nu_1 v_1 w_1\nu_2 v_2 w_2\n.\n.\n.\nu_{N - 1} v_{N - 1} w_{N - 1}\n\nOutput\n\nPrint a coloring of the vertices that satisfies the condition, in N lines.\nThe i-th line should contain 0 if Vertex i is painted white and 1 if it is painted black.\n\nIf there are multiple colorings that satisfy the condition, any of them will be accepted.\n\nSample Input 1\n\n3\n1 2 2\n2 3 1\n\nSample Output 1\n\n0\n0\n1\n\nSample Input 2\n\n5\n2 5 2\n2 3 10\n1 3 8\n3 4 2\n\nSample Output 2\n\n1\n0\n1\n0\n1", "sample_input": "3\n1 2 2\n2 3 1\n"}, "reference_outputs": ["0\n0\n1\n"], "source_document_id": "p03044", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a tree with N vertices numbered 1 to N.\nThe i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i.\nYour objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied:\n\nFor any two vertices painted in the same color, the distance between them is an even number.\n\nFind a coloring of the vertices that satisfies the condition and print it. It can be proved that at least one such coloring exists under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq u_i < v_i \\leq N\n\n1 \\leq w_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nu_1 v_1 w_1\nu_2 v_2 w_2\n.\n.\n.\nu_{N - 1} v_{N - 1} w_{N - 1}\n\nOutput\n\nPrint a coloring of the vertices that satisfies the condition, in N lines.\nThe i-th line should contain 0 if Vertex i is painted white and 1 if it is painted black.\n\nIf there are multiple colorings that satisfy the condition, any of them will be accepted.\n\nSample Input 1\n\n3\n1 2 2\n2 3 1\n\nSample Output 1\n\n0\n0\n1\n\nSample Input 2\n\n5\n2 5 2\n2 3 10\n1 3 8\n3 4 2\n\nSample Output 2\n\n1\n0\n1\n0\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 507, "cpu_time_ms": 785, "memory_kb": 70688}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s627277913", "group_id": "codeNet:p03045", "input_text": "def main():\n import sys\n input=sys.stdin.readline\n n,m=map(int,input().split())\n G=[[] for _ in range(n)]\n for _ in range(m):\n x,y,z=map(int,input().split())\n x-=1\n y-=1\n G[x].append(y)\n G[y].append(x)\n \n visited=[True]*n\n def dfs(i):\n for e in G[i]:\n if visited[e]:\n visited[e]=False\n dfs(e)\n \n cnt=0\n for i in range(n):\n if visited[i]:\n cnt+=1\n dfs(i)\n \n print(cnt) \n\nif __name__=='__main__':\n main()", "language": "Python", "metadata": {"date": 1583338744, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03045.html", "problem_id": "p03045", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03045/input.txt", "sample_output_relpath": "derived/input_output/data/p03045/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03045/Python/s627277913.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s627277913", "user_id": "u561231954"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "def main():\n import sys\n input=sys.stdin.readline\n n,m=map(int,input().split())\n G=[[] for _ in range(n)]\n for _ in range(m):\n x,y,z=map(int,input().split())\n x-=1\n y-=1\n G[x].append(y)\n G[y].append(x)\n \n visited=[True]*n\n def dfs(i):\n for e in G[i]:\n if visited[e]:\n visited[e]=False\n dfs(e)\n \n cnt=0\n for i in range(n):\n if visited[i]:\n cnt+=1\n dfs(i)\n \n print(cnt) \n\nif __name__=='__main__':\n main()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N cards placed face down in a row. On each card, an integer 1 or 2 is written.\n\nLet A_i be the integer written on the i-th card.\n\nYour objective is to guess A_1, A_2, ..., A_N correctly.\n\nYou know the following facts:\n\nFor each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number.\n\nYou are a magician and can use the following magic any number of times:\n\nMagic: Choose one card and know the integer A_i written on it. The cost of using this magic is 1.\n\nWhat is the minimum cost required to determine all of A_1, A_2, ..., A_N?\n\nIt is guaranteed that there is no contradiction in given input.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq X_i < Y_i \\leq N\n\n1 \\leq Z_i \\leq 100\n\nThe pairs (X_i, Y_i) are distinct.\n\nThere is no contradiction in input. (That is, there exist integers A_1, A_2, ..., A_N that satisfy the conditions.)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nX_1 Y_1 Z_1\nX_2 Y_2 Z_2\n\\vdots\nX_M Y_M Z_M\n\nOutput\n\nPrint the minimum total cost required to determine all of A_1, A_2, ..., A_N.\n\nSample Input 1\n\n3 1\n1 2 1\n\nSample Output 1\n\n2\n\nYou can determine all of A_1, A_2, A_3 by using the magic for the first and third cards.\n\nSample Input 2\n\n6 5\n1 2 1\n2 3 2\n1 3 3\n4 5 4\n5 6 5\n\nSample Output 2\n\n2\n\nSample Input 3\n\n100000 1\n1 100000 100\n\nSample Output 3\n\n99999", "sample_input": "3 1\n1 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03045", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N cards placed face down in a row. On each card, an integer 1 or 2 is written.\n\nLet A_i be the integer written on the i-th card.\n\nYour objective is to guess A_1, A_2, ..., A_N correctly.\n\nYou know the following facts:\n\nFor each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number.\n\nYou are a magician and can use the following magic any number of times:\n\nMagic: Choose one card and know the integer A_i written on it. The cost of using this magic is 1.\n\nWhat is the minimum cost required to determine all of A_1, A_2, ..., A_N?\n\nIt is guaranteed that there is no contradiction in given input.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq X_i < Y_i \\leq N\n\n1 \\leq Z_i \\leq 100\n\nThe pairs (X_i, Y_i) are distinct.\n\nThere is no contradiction in input. (That is, there exist integers A_1, A_2, ..., A_N that satisfy the conditions.)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nX_1 Y_1 Z_1\nX_2 Y_2 Z_2\n\\vdots\nX_M Y_M Z_M\n\nOutput\n\nPrint the minimum total cost required to determine all of A_1, A_2, ..., A_N.\n\nSample Input 1\n\n3 1\n1 2 1\n\nSample Output 1\n\n2\n\nYou can determine all of A_1, A_2, A_3 by using the magic for the first and third cards.\n\nSample Input 2\n\n6 5\n1 2 1\n2 3 2\n1 3 3\n4 5 4\n5 6 5\n\nSample Output 2\n\n2\n\nSample Input 3\n\n100000 1\n1 100000 100\n\nSample Output 3\n\n99999", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 557, "cpu_time_ms": 306, "memory_kb": 23068}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s206552872", "group_id": "codeNet:p03049", "input_text": "n = int(input())\nS = [input() for i in range(n)]\ncnt = 0\na = 0\nb = 0\nba = 0\nfor i in range(n):\n cnt += S[i].count(\"AB\")\n if S[i].startswith(\"B\") and S[i].endswith(\"A\"):\n ba += 1\n elif S[i].startswith(\"B\"):\n b += 1\n elif S[i].endswith(\"A\"):\n a += 1\nif ba >= 1:\n cnt += ba - 1\n if a >= 1:\n cnt += 1\n a -= 1\n if b >= 1:\n cnt += 1\n b -= 1\n cnt += min(a, b)\nelif a >= 1 and b >= 1:\n cnt += min(a, b)\nprint(cnt)\n", "language": "Python", "metadata": {"date": 1557630882, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03049.html", "problem_id": "p03049", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03049/input.txt", "sample_output_relpath": "derived/input_output/data/p03049/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03049/Python/s206552872.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s206552872", "user_id": "u194894739"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n = int(input())\nS = [input() for i in range(n)]\ncnt = 0\na = 0\nb = 0\nba = 0\nfor i in range(n):\n cnt += S[i].count(\"AB\")\n if S[i].startswith(\"B\") and S[i].endswith(\"A\"):\n ba += 1\n elif S[i].startswith(\"B\"):\n b += 1\n elif S[i].endswith(\"A\"):\n a += 1\nif ba >= 1:\n cnt += ba - 1\n if a >= 1:\n cnt += 1\n a -= 1\n if b >= 1:\n cnt += 1\n b -= 1\n cnt += min(a, b)\nelif a >= 1 and b >= 1:\n cnt += min(a, b)\nprint(cnt)\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke has N strings. The i-th string is s_i.\n\nLet us concatenate these strings into one string after arranging them in some order.\nFind the maximum possible number of occurrences of AB in the resulting string.\n\nConstraints\n\n1 \\leq N \\leq 10^{4}\n\n2 \\leq |s_i| \\leq 10\n\ns_i consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\n\\vdots\ns_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\nABCA\nXBAZ\nBAD\n\nSample Output 1\n\n2\n\nFor example, if we concatenate ABCA, BAD and XBAZ in this order, the resulting string ABCABADXBAZ has two occurrences of AB.\n\nSample Input 2\n\n9\nBEWPVCRWH\nZZNQYIJX\nBAVREA\nPA\nHJMYITEOX\nBCJHMRMNK\nBP\nQVFABZ\nPRGKSPUNA\n\nSample Output 2\n\n4\n\nSample Input 3\n\n7\nRABYBBE\nJOZ\nBMHQUVA\nBPA\nISU\nMCMABAOBHZ\nSZMEHMA\n\nSample Output 3\n\n4", "sample_input": "3\nABCA\nXBAZ\nBAD\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03049", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke has N strings. The i-th string is s_i.\n\nLet us concatenate these strings into one string after arranging them in some order.\nFind the maximum possible number of occurrences of AB in the resulting string.\n\nConstraints\n\n1 \\leq N \\leq 10^{4}\n\n2 \\leq |s_i| \\leq 10\n\ns_i consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\n\\vdots\ns_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\nABCA\nXBAZ\nBAD\n\nSample Output 1\n\n2\n\nFor example, if we concatenate ABCA, BAD and XBAZ in this order, the resulting string ABCABADXBAZ has two occurrences of AB.\n\nSample Input 2\n\n9\nBEWPVCRWH\nZZNQYIJX\nBAVREA\nPA\nHJMYITEOX\nBCJHMRMNK\nBP\nQVFABZ\nPRGKSPUNA\n\nSample Output 2\n\n4\n\nSample Input 3\n\n7\nRABYBBE\nJOZ\nBMHQUVA\nBPA\nISU\nMCMABAOBHZ\nSZMEHMA\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 482, "cpu_time_ms": 41, "memory_kb": 3828}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s201237778", "group_id": "codeNet:p03049", "input_text": "# -*- coding: utf-8 -*-\n\n\ndef main():\n n = int(input())\n s = [input() for _ in range(n)]\n ans = 0\n back_a_count = 0\n front_b_count = 0\n front_b_back_a_count = 0\n\n for si in s:\n if si[0] == 'B' and si[-1] == 'A':\n front_b_back_a_count += 1\n elif si[0] == 'B':\n front_b_count += 1\n elif si[-1] == 'A':\n back_a_count += 1\n\n if len(si) >= 3:\n for j in range(len(si) - 1):\n if (si[j] == 'A' and si[j + 1] == 'B'):\n ans += 1\n\n if back_a_count >= front_b_count:\n ans += front_b_count\n back_a_count -= front_b_count\n front_b_count = 0\n else:\n ans += back_a_count\n front_b_count -= back_a_count\n back_a_count = 0\n\n ans += front_b_back_a_count // 2\n front_b_back_a_count %= 2\n\n if front_b_back_a_count == 1:\n if back_a_count >= 1:\n ans += 1\n back_a_count -= 1\n elif front_b_count >= 1:\n ans += 1\n front_b_count -= 1\n\n if back_a_count >= 1:\n ans += 1\n elif front_b_count >= 1:\n ans += 1\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n", "language": "Python", "metadata": {"date": 1557627591, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03049.html", "problem_id": "p03049", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03049/input.txt", "sample_output_relpath": "derived/input_output/data/p03049/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03049/Python/s201237778.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s201237778", "user_id": "u226108478"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "# -*- coding: utf-8 -*-\n\n\ndef main():\n n = int(input())\n s = [input() for _ in range(n)]\n ans = 0\n back_a_count = 0\n front_b_count = 0\n front_b_back_a_count = 0\n\n for si in s:\n if si[0] == 'B' and si[-1] == 'A':\n front_b_back_a_count += 1\n elif si[0] == 'B':\n front_b_count += 1\n elif si[-1] == 'A':\n back_a_count += 1\n\n if len(si) >= 3:\n for j in range(len(si) - 1):\n if (si[j] == 'A' and si[j + 1] == 'B'):\n ans += 1\n\n if back_a_count >= front_b_count:\n ans += front_b_count\n back_a_count -= front_b_count\n front_b_count = 0\n else:\n ans += back_a_count\n front_b_count -= back_a_count\n back_a_count = 0\n\n ans += front_b_back_a_count // 2\n front_b_back_a_count %= 2\n\n if front_b_back_a_count == 1:\n if back_a_count >= 1:\n ans += 1\n back_a_count -= 1\n elif front_b_count >= 1:\n ans += 1\n front_b_count -= 1\n\n if back_a_count >= 1:\n ans += 1\n elif front_b_count >= 1:\n ans += 1\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke has N strings. The i-th string is s_i.\n\nLet us concatenate these strings into one string after arranging them in some order.\nFind the maximum possible number of occurrences of AB in the resulting string.\n\nConstraints\n\n1 \\leq N \\leq 10^{4}\n\n2 \\leq |s_i| \\leq 10\n\ns_i consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\n\\vdots\ns_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\nABCA\nXBAZ\nBAD\n\nSample Output 1\n\n2\n\nFor example, if we concatenate ABCA, BAD and XBAZ in this order, the resulting string ABCABADXBAZ has two occurrences of AB.\n\nSample Input 2\n\n9\nBEWPVCRWH\nZZNQYIJX\nBAVREA\nPA\nHJMYITEOX\nBCJHMRMNK\nBP\nQVFABZ\nPRGKSPUNA\n\nSample Output 2\n\n4\n\nSample Input 3\n\n7\nRABYBBE\nJOZ\nBMHQUVA\nBPA\nISU\nMCMABAOBHZ\nSZMEHMA\n\nSample Output 3\n\n4", "sample_input": "3\nABCA\nXBAZ\nBAD\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03049", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke has N strings. The i-th string is s_i.\n\nLet us concatenate these strings into one string after arranging them in some order.\nFind the maximum possible number of occurrences of AB in the resulting string.\n\nConstraints\n\n1 \\leq N \\leq 10^{4}\n\n2 \\leq |s_i| \\leq 10\n\ns_i consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\n\\vdots\ns_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\nABCA\nXBAZ\nBAD\n\nSample Output 1\n\n2\n\nFor example, if we concatenate ABCA, BAD and XBAZ in this order, the resulting string ABCABADXBAZ has two occurrences of AB.\n\nSample Input 2\n\n9\nBEWPVCRWH\nZZNQYIJX\nBAVREA\nPA\nHJMYITEOX\nBCJHMRMNK\nBP\nQVFABZ\nPRGKSPUNA\n\nSample Output 2\n\n4\n\nSample Input 3\n\n7\nRABYBBE\nJOZ\nBMHQUVA\nBPA\nISU\nMCMABAOBHZ\nSZMEHMA\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1194, "cpu_time_ms": 38, "memory_kb": 3700}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s950749399", "group_id": "codeNet:p03059", "input_text": "a,b,t=map(int,input().split())\nprint(int(b*((t+.5)//a)))", "language": "Python", "metadata": {"date": 1579513485, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03059.html", "problem_id": "p03059", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03059/input.txt", "sample_output_relpath": "derived/input_output/data/p03059/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03059/Python/s950749399.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s950749399", "user_id": "u698437687"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "a,b,t=map(int,input().split())\nprint(int(b*((t+.5)//a)))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nA biscuit making machine produces B biscuits at the following moments: A seconds, 2A seconds, 3A seconds and each subsequent multiple of A seconds after activation.\n\nFind the total number of biscuits produced within T + 0.5 seconds after activation.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, T \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B T\n\nOutput\n\nPrint the total number of biscuits produced within T + 0.5 seconds after activation.\n\nSample Input 1\n\n3 5 7\n\nSample Output 1\n\n10\n\nFive biscuits will be produced three seconds after activation.\n\nAnother five biscuits will be produced six seconds after activation.\n\nThus, a total of ten biscuits will be produced within 7.5 seconds after activation.\n\nSample Input 2\n\n3 2 9\n\nSample Output 2\n\n6\n\nSample Input 3\n\n20 20 19\n\nSample Output 3\n\n0", "sample_input": "3 5 7\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03059", "source_text": "Score : 100 points\n\nProblem Statement\n\nA biscuit making machine produces B biscuits at the following moments: A seconds, 2A seconds, 3A seconds and each subsequent multiple of A seconds after activation.\n\nFind the total number of biscuits produced within T + 0.5 seconds after activation.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, T \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B T\n\nOutput\n\nPrint the total number of biscuits produced within T + 0.5 seconds after activation.\n\nSample Input 1\n\n3 5 7\n\nSample Output 1\n\n10\n\nFive biscuits will be produced three seconds after activation.\n\nAnother five biscuits will be produced six seconds after activation.\n\nThus, a total of ten biscuits will be produced within 7.5 seconds after activation.\n\nSample Input 2\n\n3 2 9\n\nSample Output 2\n\n6\n\nSample Input 3\n\n20 20 19\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 56, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s180492786", "group_id": "codeNet:p03059", "input_text": "a, b, t = map(int,input().split())\n\nprint((t//a)*b)", "language": "Python", "metadata": {"date": 1556483010, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03059.html", "problem_id": "p03059", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03059/input.txt", "sample_output_relpath": "derived/input_output/data/p03059/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03059/Python/s180492786.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s180492786", "user_id": "u026102659"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "a, b, t = map(int,input().split())\n\nprint((t//a)*b)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nA biscuit making machine produces B biscuits at the following moments: A seconds, 2A seconds, 3A seconds and each subsequent multiple of A seconds after activation.\n\nFind the total number of biscuits produced within T + 0.5 seconds after activation.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, T \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B T\n\nOutput\n\nPrint the total number of biscuits produced within T + 0.5 seconds after activation.\n\nSample Input 1\n\n3 5 7\n\nSample Output 1\n\n10\n\nFive biscuits will be produced three seconds after activation.\n\nAnother five biscuits will be produced six seconds after activation.\n\nThus, a total of ten biscuits will be produced within 7.5 seconds after activation.\n\nSample Input 2\n\n3 2 9\n\nSample Output 2\n\n6\n\nSample Input 3\n\n20 20 19\n\nSample Output 3\n\n0", "sample_input": "3 5 7\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03059", "source_text": "Score : 100 points\n\nProblem Statement\n\nA biscuit making machine produces B biscuits at the following moments: A seconds, 2A seconds, 3A seconds and each subsequent multiple of A seconds after activation.\n\nFind the total number of biscuits produced within T + 0.5 seconds after activation.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, T \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B T\n\nOutput\n\nPrint the total number of biscuits produced within T + 0.5 seconds after activation.\n\nSample Input 1\n\n3 5 7\n\nSample Output 1\n\n10\n\nFive biscuits will be produced three seconds after activation.\n\nAnother five biscuits will be produced six seconds after activation.\n\nThus, a total of ten biscuits will be produced within 7.5 seconds after activation.\n\nSample Input 2\n\n3 2 9\n\nSample Output 2\n\n6\n\nSample Input 3\n\n20 20 19\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 51, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s730319825", "group_id": "codeNet:p03059", "input_text": "A, B, T = map(int,input().split())\nT += 0.5\nprint(int(T//A*B))", "language": "Python", "metadata": {"date": 1556413324, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03059.html", "problem_id": "p03059", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03059/input.txt", "sample_output_relpath": "derived/input_output/data/p03059/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03059/Python/s730319825.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s730319825", "user_id": "u887207211"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "A, B, T = map(int,input().split())\nT += 0.5\nprint(int(T//A*B))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nA biscuit making machine produces B biscuits at the following moments: A seconds, 2A seconds, 3A seconds and each subsequent multiple of A seconds after activation.\n\nFind the total number of biscuits produced within T + 0.5 seconds after activation.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, T \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B T\n\nOutput\n\nPrint the total number of biscuits produced within T + 0.5 seconds after activation.\n\nSample Input 1\n\n3 5 7\n\nSample Output 1\n\n10\n\nFive biscuits will be produced three seconds after activation.\n\nAnother five biscuits will be produced six seconds after activation.\n\nThus, a total of ten biscuits will be produced within 7.5 seconds after activation.\n\nSample Input 2\n\n3 2 9\n\nSample Output 2\n\n6\n\nSample Input 3\n\n20 20 19\n\nSample Output 3\n\n0", "sample_input": "3 5 7\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03059", "source_text": "Score : 100 points\n\nProblem Statement\n\nA biscuit making machine produces B biscuits at the following moments: A seconds, 2A seconds, 3A seconds and each subsequent multiple of A seconds after activation.\n\nFind the total number of biscuits produced within T + 0.5 seconds after activation.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, T \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B T\n\nOutput\n\nPrint the total number of biscuits produced within T + 0.5 seconds after activation.\n\nSample Input 1\n\n3 5 7\n\nSample Output 1\n\n10\n\nFive biscuits will be produced three seconds after activation.\n\nAnother five biscuits will be produced six seconds after activation.\n\nThus, a total of ten biscuits will be produced within 7.5 seconds after activation.\n\nSample Input 2\n\n3 2 9\n\nSample Output 2\n\n6\n\nSample Input 3\n\n20 20 19\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 62, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s271373523", "group_id": "codeNet:p03060", "input_text": "import sys\nsys.setrecursionlimit(10**7)\ninput = sys.stdin.readline\n\nn = int(input())\nv = list(map(int, input().split()))\nc = list(map(int, input().split()))\n\nans = 0\nfor bit in range(2**n):\n vsum = 0\n csum = 0\n for i in range(n):\n if (bit & (1 << i)):\n vsum += v[i]\n csum += c[i]\n ans = max(vsum - csum, ans)\n\nprint(ans)\n", "language": "Python", "metadata": {"date": 1594254007, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p03060.html", "problem_id": "p03060", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03060/input.txt", "sample_output_relpath": "derived/input_output/data/p03060/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03060/Python/s271373523.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s271373523", "user_id": "u651235280"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "import sys\nsys.setrecursionlimit(10**7)\ninput = sys.stdin.readline\n\nn = int(input())\nv = list(map(int, input().split()))\nc = list(map(int, input().split()))\n\nans = 0\nfor bit in range(2**n):\n vsum = 0\n csum = 0\n for i in range(n):\n if (bit & (1 << i)):\n vsum += v[i]\n csum += c[i]\n ans = max(vsum - csum, ans)\n\nprint(ans)\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N gems. The value of the i-th gem is V_i.\n\nYou will choose some of these gems, possibly all or none, and get them.\n\nHowever, you need to pay a cost of C_i to get the i-th gem.\n\nLet X be the sum of the values of the gems obtained, and Y be the sum of the costs paid.\n\nFind the maximum possible value of X-Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq C_i, V_i \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nV_1 V_2 ... V_N\nC_1 C_2 ... C_N\n\nOutput\n\nPrint the maximum possible value of X-Y.\n\nSample Input 1\n\n3\n10 2 5\n6 3 4\n\nSample Output 1\n\n5\n\nIf we choose the first and third gems, X = 10 + 5 = 15 and Y = 6 + 4 = 10.\nWe have X-Y = 5 here, which is the maximum possible value.\n\nSample Input 2\n\n4\n13 21 6 19\n11 30 6 15\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1\n1\n50\n\nSample Output 3\n\n0", "sample_input": "3\n10 2 5\n6 3 4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03060", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N gems. The value of the i-th gem is V_i.\n\nYou will choose some of these gems, possibly all or none, and get them.\n\nHowever, you need to pay a cost of C_i to get the i-th gem.\n\nLet X be the sum of the values of the gems obtained, and Y be the sum of the costs paid.\n\nFind the maximum possible value of X-Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq C_i, V_i \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nV_1 V_2 ... V_N\nC_1 C_2 ... C_N\n\nOutput\n\nPrint the maximum possible value of X-Y.\n\nSample Input 1\n\n3\n10 2 5\n6 3 4\n\nSample Output 1\n\n5\n\nIf we choose the first and third gems, X = 10 + 5 = 15 and Y = 6 + 4 = 10.\nWe have X-Y = 5 here, which is the maximum possible value.\n\nSample Input 2\n\n4\n13 21 6 19\n11 30 6 15\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1\n1\n50\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 362, "cpu_time_ms": 340, "memory_kb": 73696}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s653977260", "group_id": "codeNet:p03060", "input_text": "n = int(input())\nv = input().split()\nc = input().split()\n\nvc = []\nfor i in range(n):\n vc.append(int(v[i]) - int(c[i]))\n\nanswer = 0\nfor i in vc:\n if i > 0:\n answer += i\n\nprint(answer)\n", "language": "Python", "metadata": {"date": 1556414886, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03060.html", "problem_id": "p03060", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03060/input.txt", "sample_output_relpath": "derived/input_output/data/p03060/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03060/Python/s653977260.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s653977260", "user_id": "u772614554"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "n = int(input())\nv = input().split()\nc = input().split()\n\nvc = []\nfor i in range(n):\n vc.append(int(v[i]) - int(c[i]))\n\nanswer = 0\nfor i in vc:\n if i > 0:\n answer += i\n\nprint(answer)\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N gems. The value of the i-th gem is V_i.\n\nYou will choose some of these gems, possibly all or none, and get them.\n\nHowever, you need to pay a cost of C_i to get the i-th gem.\n\nLet X be the sum of the values of the gems obtained, and Y be the sum of the costs paid.\n\nFind the maximum possible value of X-Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq C_i, V_i \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nV_1 V_2 ... V_N\nC_1 C_2 ... C_N\n\nOutput\n\nPrint the maximum possible value of X-Y.\n\nSample Input 1\n\n3\n10 2 5\n6 3 4\n\nSample Output 1\n\n5\n\nIf we choose the first and third gems, X = 10 + 5 = 15 and Y = 6 + 4 = 10.\nWe have X-Y = 5 here, which is the maximum possible value.\n\nSample Input 2\n\n4\n13 21 6 19\n11 30 6 15\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1\n1\n50\n\nSample Output 3\n\n0", "sample_input": "3\n10 2 5\n6 3 4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03060", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N gems. The value of the i-th gem is V_i.\n\nYou will choose some of these gems, possibly all or none, and get them.\n\nHowever, you need to pay a cost of C_i to get the i-th gem.\n\nLet X be the sum of the values of the gems obtained, and Y be the sum of the costs paid.\n\nFind the maximum possible value of X-Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq C_i, V_i \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nV_1 V_2 ... V_N\nC_1 C_2 ... C_N\n\nOutput\n\nPrint the maximum possible value of X-Y.\n\nSample Input 1\n\n3\n10 2 5\n6 3 4\n\nSample Output 1\n\n5\n\nIf we choose the first and third gems, X = 10 + 5 = 15 and Y = 6 + 4 = 10.\nWe have X-Y = 5 here, which is the maximum possible value.\n\nSample Input 2\n\n4\n13 21 6 19\n11 30 6 15\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1\n1\n50\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 188, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s809797036", "group_id": "codeNet:p03062", "input_text": "N = int(input())\nA = list(map(int,input().split()))\nneg_num = 0\nmax_neg = -float('inf')\nsum_abs_A = 0\nfor a in A:\n sum_abs_A += abs(a)\n if a < 0 :\n neg_num += 0\n max_neg = max(a,max_neg)\nprint(sum_abs_A if neg_num%2==0 else sum_abs_A + 2*max_neg)", "language": "Python", "metadata": {"date": 1569846613, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03062.html", "problem_id": "p03062", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03062/input.txt", "sample_output_relpath": "derived/input_output/data/p03062/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03062/Python/s809797036.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s809797036", "user_id": "u673361376"}, "prompt_components": {"gold_output": "19\n", "input_to_evaluate": "N = int(input())\nA = list(map(int,input().split()))\nneg_num = 0\nmax_neg = -float('inf')\nsum_abs_A = 0\nfor a in A:\n sum_abs_A += abs(a)\n if a < 0 :\n neg_num += 0\n max_neg = max(a,max_neg)\nprint(sum_abs_A if neg_num%2==0 else sum_abs_A + 2*max_neg)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, arranged in a row in this order.\n\nYou can perform the following operation on this integer sequence any number of times:\n\nOperation: Choose an integer i satisfying 1 \\leq i \\leq N-1. Multiply both A_i and A_{i+1} by -1.\n\nLet B_1, B_2, ..., B_N be the integer sequence after your operations.\n\nFind the maximum possible value of B_1 + B_2 + ... + B_N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n-10^9 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible value of B_1 + B_2 + ... + B_N.\n\nSample Input 1\n\n3\n-10 5 -4\n\nSample Output 1\n\n19\n\nIf we perform the operation as follows:\n\nChoose 1 as i, which changes the sequence to 10, -5, -4.\n\nChoose 2 as i, which changes the sequence to 10, 5, 4.\n\nwe have B_1 = 10, B_2 = 5, B_3 = 4. The sum here, B_1 + B_2 + B_3 = 10 + 5 + 4 = 19, is the maximum possible result.\n\nSample Input 2\n\n5\n10 -4 -8 -11 3\n\nSample Output 2\n\n30\n\nSample Input 3\n\n11\n-1000000000 1000000000 -1000000000 1000000000 -1000000000 0 1000000000 -1000000000 1000000000 -1000000000 1000000000\n\nSample Output 3\n\n10000000000\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "3\n-10 5 -4\n"}, "reference_outputs": ["19\n"], "source_document_id": "p03062", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, arranged in a row in this order.\n\nYou can perform the following operation on this integer sequence any number of times:\n\nOperation: Choose an integer i satisfying 1 \\leq i \\leq N-1. Multiply both A_i and A_{i+1} by -1.\n\nLet B_1, B_2, ..., B_N be the integer sequence after your operations.\n\nFind the maximum possible value of B_1 + B_2 + ... + B_N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n-10^9 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible value of B_1 + B_2 + ... + B_N.\n\nSample Input 1\n\n3\n-10 5 -4\n\nSample Output 1\n\n19\n\nIf we perform the operation as follows:\n\nChoose 1 as i, which changes the sequence to 10, -5, -4.\n\nChoose 2 as i, which changes the sequence to 10, 5, 4.\n\nwe have B_1 = 10, B_2 = 5, B_3 = 4. The sum here, B_1 + B_2 + B_3 = 10 + 5 + 4 = 19, is the maximum possible result.\n\nSample Input 2\n\n5\n10 -4 -8 -11 3\n\nSample Output 2\n\n30\n\nSample Input 3\n\n11\n-1000000000 1000000000 -1000000000 1000000000 -1000000000 0 1000000000 -1000000000 1000000000 -1000000000 1000000000\n\nSample Output 3\n\n10000000000\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 254, "cpu_time_ms": 89, "memory_kb": 14332}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s478699252", "group_id": "codeNet:p03062", "input_text": "import numpy as np\nN = int(input())\na = np.array(list(map(int, input().split())))\n\ntmp = sum(np.abs(a))\nif np.count_nonzero(a < 0)%2 == 0:\n print(tmp)\nelse:\n ind = np.argmin(np.abs(a))\n print(tmp-abs(a[ind])*2)\n", "language": "Python", "metadata": {"date": 1562444683, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03062.html", "problem_id": "p03062", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03062/input.txt", "sample_output_relpath": "derived/input_output/data/p03062/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03062/Python/s478699252.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s478699252", "user_id": "u480138356"}, "prompt_components": {"gold_output": "19\n", "input_to_evaluate": "import numpy as np\nN = int(input())\na = np.array(list(map(int, input().split())))\n\ntmp = sum(np.abs(a))\nif np.count_nonzero(a < 0)%2 == 0:\n print(tmp)\nelse:\n ind = np.argmin(np.abs(a))\n print(tmp-abs(a[ind])*2)\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, arranged in a row in this order.\n\nYou can perform the following operation on this integer sequence any number of times:\n\nOperation: Choose an integer i satisfying 1 \\leq i \\leq N-1. Multiply both A_i and A_{i+1} by -1.\n\nLet B_1, B_2, ..., B_N be the integer sequence after your operations.\n\nFind the maximum possible value of B_1 + B_2 + ... + B_N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n-10^9 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible value of B_1 + B_2 + ... + B_N.\n\nSample Input 1\n\n3\n-10 5 -4\n\nSample Output 1\n\n19\n\nIf we perform the operation as follows:\n\nChoose 1 as i, which changes the sequence to 10, -5, -4.\n\nChoose 2 as i, which changes the sequence to 10, 5, 4.\n\nwe have B_1 = 10, B_2 = 5, B_3 = 4. The sum here, B_1 + B_2 + B_3 = 10 + 5 + 4 = 19, is the maximum possible result.\n\nSample Input 2\n\n5\n10 -4 -8 -11 3\n\nSample Output 2\n\n30\n\nSample Input 3\n\n11\n-1000000000 1000000000 -1000000000 1000000000 -1000000000 0 1000000000 -1000000000 1000000000 -1000000000 1000000000\n\nSample Output 3\n\n10000000000\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "3\n-10 5 -4\n"}, "reference_outputs": ["19\n"], "source_document_id": "p03062", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, arranged in a row in this order.\n\nYou can perform the following operation on this integer sequence any number of times:\n\nOperation: Choose an integer i satisfying 1 \\leq i \\leq N-1. Multiply both A_i and A_{i+1} by -1.\n\nLet B_1, B_2, ..., B_N be the integer sequence after your operations.\n\nFind the maximum possible value of B_1 + B_2 + ... + B_N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n-10^9 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible value of B_1 + B_2 + ... + B_N.\n\nSample Input 1\n\n3\n-10 5 -4\n\nSample Output 1\n\n19\n\nIf we perform the operation as follows:\n\nChoose 1 as i, which changes the sequence to 10, -5, -4.\n\nChoose 2 as i, which changes the sequence to 10, 5, 4.\n\nwe have B_1 = 10, B_2 = 5, B_3 = 4. The sum here, B_1 + B_2 + B_3 = 10 + 5 + 4 = 19, is the maximum possible result.\n\nSample Input 2\n\n5\n10 -4 -8 -11 3\n\nSample Output 2\n\n30\n\nSample Input 3\n\n11\n-1000000000 1000000000 -1000000000 1000000000 -1000000000 0 1000000000 -1000000000 1000000000 -1000000000 1000000000\n\nSample Output 3\n\n10000000000\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 220, "cpu_time_ms": 212, "memory_kb": 23308}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s108201988", "group_id": "codeNet:p03062", "input_text": "N = int(input().strip())\nA= [int(x) for x in input().strip().split(\" \")]\n\nminus_list = filter(lambda x: x<0,A)\nminus_cnt = len(list(minus_list))\n\nabs_list = list(map(abs,A))\n\nif minus_cnt % 2 == 0:\n print(sum(abs_list))\nelse:\n print(sum(abs_list) - 2* min(abs_list))\n", "language": "Python", "metadata": {"date": 1556575588, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03062.html", "problem_id": "p03062", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03062/input.txt", "sample_output_relpath": "derived/input_output/data/p03062/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03062/Python/s108201988.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s108201988", "user_id": "u048867491"}, "prompt_components": {"gold_output": "19\n", "input_to_evaluate": "N = int(input().strip())\nA= [int(x) for x in input().strip().split(\" \")]\n\nminus_list = filter(lambda x: x<0,A)\nminus_cnt = len(list(minus_list))\n\nabs_list = list(map(abs,A))\n\nif minus_cnt % 2 == 0:\n print(sum(abs_list))\nelse:\n print(sum(abs_list) - 2* min(abs_list))\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, arranged in a row in this order.\n\nYou can perform the following operation on this integer sequence any number of times:\n\nOperation: Choose an integer i satisfying 1 \\leq i \\leq N-1. Multiply both A_i and A_{i+1} by -1.\n\nLet B_1, B_2, ..., B_N be the integer sequence after your operations.\n\nFind the maximum possible value of B_1 + B_2 + ... + B_N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n-10^9 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible value of B_1 + B_2 + ... + B_N.\n\nSample Input 1\n\n3\n-10 5 -4\n\nSample Output 1\n\n19\n\nIf we perform the operation as follows:\n\nChoose 1 as i, which changes the sequence to 10, -5, -4.\n\nChoose 2 as i, which changes the sequence to 10, 5, 4.\n\nwe have B_1 = 10, B_2 = 5, B_3 = 4. The sum here, B_1 + B_2 + B_3 = 10 + 5 + 4 = 19, is the maximum possible result.\n\nSample Input 2\n\n5\n10 -4 -8 -11 3\n\nSample Output 2\n\n30\n\nSample Input 3\n\n11\n-1000000000 1000000000 -1000000000 1000000000 -1000000000 0 1000000000 -1000000000 1000000000 -1000000000 1000000000\n\nSample Output 3\n\n10000000000\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "3\n-10 5 -4\n"}, "reference_outputs": ["19\n"], "source_document_id": "p03062", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, arranged in a row in this order.\n\nYou can perform the following operation on this integer sequence any number of times:\n\nOperation: Choose an integer i satisfying 1 \\leq i \\leq N-1. Multiply both A_i and A_{i+1} by -1.\n\nLet B_1, B_2, ..., B_N be the integer sequence after your operations.\n\nFind the maximum possible value of B_1 + B_2 + ... + B_N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n-10^9 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible value of B_1 + B_2 + ... + B_N.\n\nSample Input 1\n\n3\n-10 5 -4\n\nSample Output 1\n\n19\n\nIf we perform the operation as follows:\n\nChoose 1 as i, which changes the sequence to 10, -5, -4.\n\nChoose 2 as i, which changes the sequence to 10, 5, 4.\n\nwe have B_1 = 10, B_2 = 5, B_3 = 4. The sum here, B_1 + B_2 + B_3 = 10 + 5 + 4 = 19, is the maximum possible result.\n\nSample Input 2\n\n5\n10 -4 -8 -11 3\n\nSample Output 2\n\n30\n\nSample Input 3\n\n11\n-1000000000 1000000000 -1000000000 1000000000 -1000000000 0 1000000000 -1000000000 1000000000 -1000000000 1000000000\n\nSample Output 3\n\n10000000000\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 273, "cpu_time_ms": 64, "memory_kb": 14412}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s350580706", "group_id": "codeNet:p03062", "input_text": "N = int(input())\nA = list(map(int, input().split(\" \")))\nabs_list = list(map(abs, A))\nabs_list.sort()\npos = list(filter(lambda x: x > 0, A))\nneg = list(filter(lambda x: x < 0, A))\npos.sort()\nneg.sort()\n\n# A has 0\nif abs_list[0] == 0:\n\tprint(sum(abs_list))\nelif len(neg) % 2 == 0:\n\tprint(sum(abs_list))\nelif len(pos) > 0 and abs(pos[0]) < abs(neg[-1]):\n\tprint(sum(abs_list) - 2*pos[0])\nelse:\n\tprint(sum(abs_list[1:])-abs_list[0])\n\n", "language": "Python", "metadata": {"date": 1556417460, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03062.html", "problem_id": "p03062", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03062/input.txt", "sample_output_relpath": "derived/input_output/data/p03062/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03062/Python/s350580706.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s350580706", "user_id": "u061984624"}, "prompt_components": {"gold_output": "19\n", "input_to_evaluate": "N = int(input())\nA = list(map(int, input().split(\" \")))\nabs_list = list(map(abs, A))\nabs_list.sort()\npos = list(filter(lambda x: x > 0, A))\nneg = list(filter(lambda x: x < 0, A))\npos.sort()\nneg.sort()\n\n# A has 0\nif abs_list[0] == 0:\n\tprint(sum(abs_list))\nelif len(neg) % 2 == 0:\n\tprint(sum(abs_list))\nelif len(pos) > 0 and abs(pos[0]) < abs(neg[-1]):\n\tprint(sum(abs_list) - 2*pos[0])\nelse:\n\tprint(sum(abs_list[1:])-abs_list[0])\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, arranged in a row in this order.\n\nYou can perform the following operation on this integer sequence any number of times:\n\nOperation: Choose an integer i satisfying 1 \\leq i \\leq N-1. Multiply both A_i and A_{i+1} by -1.\n\nLet B_1, B_2, ..., B_N be the integer sequence after your operations.\n\nFind the maximum possible value of B_1 + B_2 + ... + B_N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n-10^9 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible value of B_1 + B_2 + ... + B_N.\n\nSample Input 1\n\n3\n-10 5 -4\n\nSample Output 1\n\n19\n\nIf we perform the operation as follows:\n\nChoose 1 as i, which changes the sequence to 10, -5, -4.\n\nChoose 2 as i, which changes the sequence to 10, 5, 4.\n\nwe have B_1 = 10, B_2 = 5, B_3 = 4. The sum here, B_1 + B_2 + B_3 = 10 + 5 + 4 = 19, is the maximum possible result.\n\nSample Input 2\n\n5\n10 -4 -8 -11 3\n\nSample Output 2\n\n30\n\nSample Input 3\n\n11\n-1000000000 1000000000 -1000000000 1000000000 -1000000000 0 1000000000 -1000000000 1000000000 -1000000000 1000000000\n\nSample Output 3\n\n10000000000\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "3\n-10 5 -4\n"}, "reference_outputs": ["19\n"], "source_document_id": "p03062", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, arranged in a row in this order.\n\nYou can perform the following operation on this integer sequence any number of times:\n\nOperation: Choose an integer i satisfying 1 \\leq i \\leq N-1. Multiply both A_i and A_{i+1} by -1.\n\nLet B_1, B_2, ..., B_N be the integer sequence after your operations.\n\nFind the maximum possible value of B_1 + B_2 + ... + B_N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n-10^9 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible value of B_1 + B_2 + ... + B_N.\n\nSample Input 1\n\n3\n-10 5 -4\n\nSample Output 1\n\n19\n\nIf we perform the operation as follows:\n\nChoose 1 as i, which changes the sequence to 10, -5, -4.\n\nChoose 2 as i, which changes the sequence to 10, 5, 4.\n\nwe have B_1 = 10, B_2 = 5, B_3 = 4. The sum here, B_1 + B_2 + B_3 = 10 + 5 + 4 = 19, is the maximum possible result.\n\nSample Input 2\n\n5\n10 -4 -8 -11 3\n\nSample Output 2\n\n30\n\nSample Input 3\n\n11\n-1000000000 1000000000 -1000000000 1000000000 -1000000000 0 1000000000 -1000000000 1000000000 -1000000000 1000000000\n\nSample Output 3\n\n10000000000\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 429, "cpu_time_ms": 139, "memory_kb": 14412}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s766979808", "group_id": "codeNet:p03063", "input_text": "n = int(input())\n#n = 10 ** 5\nstones = [0 if x == \".\" else 1 for x in list(input())]\n#stones = [0] + [0 for _ in range(n)] + [1]\n\nbf = 0\naf = n - sum(stones)\nmin_num = bf + af\n\nfor i in range(n):\n\tbf += stones[i]\n\taf -= 1 - stones[i]\n\tmin_num = min(min_num, bf + af)\n\nprint(min_num)", "language": "Python", "metadata": {"date": 1555809640, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03063.html", "problem_id": "p03063", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03063/input.txt", "sample_output_relpath": "derived/input_output/data/p03063/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03063/Python/s766979808.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s766979808", "user_id": "u653807637"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "n = int(input())\n#n = 10 ** 5\nstones = [0 if x == \".\" else 1 for x in list(input())]\n#stones = [0] + [0 for _ in range(n)] + [1]\n\nbf = 0\naf = n - sum(stones)\nmin_num = bf + af\n\nfor i in range(n):\n\tbf += stones[i]\n\taf -= 1 - stones[i]\n\tmin_num = min(min_num, bf + af)\n\nprint(min_num)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "sample_input": "3\n#.#\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03063", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 282, "cpu_time_ms": 155, "memory_kb": 6436}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s755929488", "group_id": "codeNet:p03067", "input_text": "a, b, c = map(int, input().split())\n\nif a < c < b:\n print('Yes')\nelse:\n print('No')\n", "language": "Python", "metadata": {"date": 1572624591, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03067.html", "problem_id": "p03067", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03067/input.txt", "sample_output_relpath": "derived/input_output/data/p03067/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03067/Python/s755929488.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s755929488", "user_id": "u328364772"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "a, b, c = map(int, input().split())\n\nif a < c < b:\n print('Yes')\nelse:\n print('No')\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively.\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nConstraints\n\n0\\leq A,B,C\\leq 100\n\nA, B and C are distinct integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nSample Input 1\n\n3 8 5\n\nSample Output 1\n\nYes\n\nWe pass the coordinate 5 on the straight way from the house at coordinate 3 to the house at coordinate 8.\n\nSample Input 2\n\n7 3 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n10 2 4\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n31 41 59\n\nSample Output 4\n\nNo", "sample_input": "3 8 5\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03067", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively.\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nConstraints\n\n0\\leq A,B,C\\leq 100\n\nA, B and C are distinct integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nSample Input 1\n\n3 8 5\n\nSample Output 1\n\nYes\n\nWe pass the coordinate 5 on the straight way from the house at coordinate 3 to the house at coordinate 8.\n\nSample Input 2\n\n7 3 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n10 2 4\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n31 41 59\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 90, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s666162299", "group_id": "codeNet:p03067", "input_text": "import sys\nimport math\nN = list(map(int, input().split()))\n\nt = False\nif (N[0] < N[1]) == (N[0] < N[2]):\n if abs(N[1] - N[0]) > abs(N[2] - N[0]):\n t = True\n\nprint(\"Yes\" if t else \"No\")\n", "language": "Python", "metadata": {"date": 1555809208, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03067.html", "problem_id": "p03067", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03067/input.txt", "sample_output_relpath": "derived/input_output/data/p03067/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03067/Python/s666162299.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s666162299", "user_id": "u463655976"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import sys\nimport math\nN = list(map(int, input().split()))\n\nt = False\nif (N[0] < N[1]) == (N[0] < N[2]):\n if abs(N[1] - N[0]) > abs(N[2] - N[0]):\n t = True\n\nprint(\"Yes\" if t else \"No\")\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively.\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nConstraints\n\n0\\leq A,B,C\\leq 100\n\nA, B and C are distinct integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nSample Input 1\n\n3 8 5\n\nSample Output 1\n\nYes\n\nWe pass the coordinate 5 on the straight way from the house at coordinate 3 to the house at coordinate 8.\n\nSample Input 2\n\n7 3 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n10 2 4\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n31 41 59\n\nSample Output 4\n\nNo", "sample_input": "3 8 5\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03067", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively.\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nConstraints\n\n0\\leq A,B,C\\leq 100\n\nA, B and C are distinct integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nSample Input 1\n\n3 8 5\n\nSample Output 1\n\nYes\n\nWe pass the coordinate 5 on the straight way from the house at coordinate 3 to the house at coordinate 8.\n\nSample Input 2\n\n7 3 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n10 2 4\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n31 41 59\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 195, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s798711235", "group_id": "codeNet:p03068", "input_text": "n=int(input())\ns=input()\nk=int(input())\nd=s[k-1]\nfor a in s:\n if a!=d:\n a='*'\nprint(s)", "language": "Python", "metadata": {"date": 1555809116, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03068.html", "problem_id": "p03068", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03068/input.txt", "sample_output_relpath": "derived/input_output/data/p03068/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03068/Python/s798711235.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s798711235", "user_id": "u410118019"}, "prompt_components": {"gold_output": "*rr*r\n", "input_to_evaluate": "n=int(input())\ns=input()\nk=int(input())\nd=s[k-1]\nfor a in s:\n if a!=d:\n a='*'\nprint(s)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of lowercase English letters, and an integer K.\nPrint the string obtained by replacing every character in S that differs from the K-th character of S, with *.\n\nConstraints\n\n1 \\leq K \\leq N\\leq 10\n\nS is a string of length N consisting of lowercase English letters.\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\nK\n\nOutput\n\nPrint the string obtained by replacing every character in S that differs from the K-th character of S, with *.\n\nSample Input 1\n\n5\nerror\n2\n\nSample Output 1\n\n*rr*r\n\nThe second character of S is r. When we replace every character in error that differs from r with *, we get the string *rr*r.\n\nSample Input 2\n\n6\neleven\n5\n\nSample Output 2\n\ne*e*e*\n\nSample Input 3\n\n9\neducation\n7\n\nSample Output 3\n\n******i**", "sample_input": "5\nerror\n2\n"}, "reference_outputs": ["*rr*r\n"], "source_document_id": "p03068", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of lowercase English letters, and an integer K.\nPrint the string obtained by replacing every character in S that differs from the K-th character of S, with *.\n\nConstraints\n\n1 \\leq K \\leq N\\leq 10\n\nS is a string of length N consisting of lowercase English letters.\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\nK\n\nOutput\n\nPrint the string obtained by replacing every character in S that differs from the K-th character of S, with *.\n\nSample Input 1\n\n5\nerror\n2\n\nSample Output 1\n\n*rr*r\n\nThe second character of S is r. When we replace every character in error that differs from r with *, we get the string *rr*r.\n\nSample Input 2\n\n6\neleven\n5\n\nSample Output 2\n\ne*e*e*\n\nSample Input 3\n\n9\neducation\n7\n\nSample Output 3\n\n******i**", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 90, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s568891306", "group_id": "codeNet:p03069", "input_text": "N = int(input())\nS = list(input())\n\ncount_list =[]\nwc = 0\n\nA=[0]*(N+1)\n\nfor i in list(range(N))[::-1]:\n if(S[i] == '#'):\n A[i] = A[i+1] + 1\n\nprint(A)\nfor n in range(N-1):\n if(S[n] == '.'):\n num = n\n count_list.append(A[n+1] + wc)\n wc += 1\n\nif(S[N-1] == '.'):\n count_list.append(wc+1)\n\ncount = min(count_list)\nprint(count)", "language": "Python", "metadata": {"date": 1555816578, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03069.html", "problem_id": "p03069", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03069/input.txt", "sample_output_relpath": "derived/input_output/data/p03069/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03069/Python/s568891306.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s568891306", "user_id": "u141511678"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "N = int(input())\nS = list(input())\n\ncount_list =[]\nwc = 0\n\nA=[0]*(N+1)\n\nfor i in list(range(N))[::-1]:\n if(S[i] == '#'):\n A[i] = A[i+1] + 1\n\nprint(A)\nfor n in range(N-1):\n if(S[n] == '.'):\n num = n\n count_list.append(A[n+1] + wc)\n wc += 1\n\nif(S[N-1] == '.'):\n count_list.append(wc+1)\n\ncount = min(count_list)\nprint(count)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "sample_input": "3\n#.#\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03069", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 358, "cpu_time_ms": 143, "memory_kb": 20516}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s495668328", "group_id": "codeNet:p03069", "input_text": "N=int(input())\nS=str(input())\n\ndef count_renzoku(S,s):\n renzoku=1\n for i in range(1,len(S)):\n if S[i]==s:\n renzoku+=1\n else:\n break\n return renzoku\n\nif S.count('#')==N or S.count('.')==N:\n print(0)\nelse:\n a=min(S.count('#'),S.count('.'))\n T=S[::-1]\n if T[0]=='#':\n T=T[count_renzoku(T,'#'):]\n U=T[::-1]\n if U[0]=='.':\n U=U[count_renzoku(U,'.'):]\n b=min(U.count('#'),U.count('.'))\n print(min(a,b))\n elif S[0]=='.':\n S=S[count_renzoku(S,'.'):]\n b=min(S.count('#'),S.count('.'))\n print(min(a,b))\n else:\n print(a)", "language": "Python", "metadata": {"date": 1555813379, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03069.html", "problem_id": "p03069", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03069/input.txt", "sample_output_relpath": "derived/input_output/data/p03069/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03069/Python/s495668328.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s495668328", "user_id": "u414699019"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "N=int(input())\nS=str(input())\n\ndef count_renzoku(S,s):\n renzoku=1\n for i in range(1,len(S)):\n if S[i]==s:\n renzoku+=1\n else:\n break\n return renzoku\n\nif S.count('#')==N or S.count('.')==N:\n print(0)\nelse:\n a=min(S.count('#'),S.count('.'))\n T=S[::-1]\n if T[0]=='#':\n T=T[count_renzoku(T,'#'):]\n U=T[::-1]\n if U[0]=='.':\n U=U[count_renzoku(U,'.'):]\n b=min(U.count('#'),U.count('.'))\n print(min(a,b))\n elif S[0]=='.':\n S=S[count_renzoku(S,'.'):]\n b=min(S.count('#'),S.count('.'))\n print(min(a,b))\n else:\n print(a)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "sample_input": "3\n#.#\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03069", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 646, "cpu_time_ms": 38, "memory_kb": 3816}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s578956381", "group_id": "codeNet:p03069", "input_text": "#!/usr/bin/python\n# coding: UTF-8\n\n\ndef exe(n,s,count):\n #print(s)\n for i in range(1,n):\n if s[i-1] == \"#\" and s[i] == \".\":\n return exe(n-2,s[0:i-1]+s[i+1:],count+1)\n return count\nN = int(input())\nS = input()\n\nprint(exe(N,S,0))", "language": "Python", "metadata": {"date": 1555812739, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03069.html", "problem_id": "p03069", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03069/input.txt", "sample_output_relpath": "derived/input_output/data/p03069/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03069/Python/s578956381.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s578956381", "user_id": "u243963816"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "#!/usr/bin/python\n# coding: UTF-8\n\n\ndef exe(n,s,count):\n #print(s)\n for i in range(1,n):\n if s[i-1] == \"#\" and s[i] == \".\":\n return exe(n-2,s[0:i-1]+s[i+1:],count+1)\n return count\nN = int(input())\nS = input()\n\nprint(exe(N,S,0))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "sample_input": "3\n#.#\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03069", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 254, "cpu_time_ms": 2106, "memory_kb": 198140}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s476296329", "group_id": "codeNet:p03069", "input_text": "N = int(input())\nS = input()\nblackcnt = 0\nwhitecnt = 0\nwhiteflag = False\n\nfor i in range(N):\n if S[i] == '#':\n whiteflag = True\n blackcnt += 1\n elif whiteflag and S[i] == '.':\n whitecnt += 1\n\nprint(min(blackcnt, whitecnt) if whiteflag else 0)", "language": "Python", "metadata": {"date": 1555809164, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03069.html", "problem_id": "p03069", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03069/input.txt", "sample_output_relpath": "derived/input_output/data/p03069/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03069/Python/s476296329.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s476296329", "user_id": "u379692329"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "N = int(input())\nS = input()\nblackcnt = 0\nwhitecnt = 0\nwhiteflag = False\n\nfor i in range(N):\n if S[i] == '#':\n whiteflag = True\n blackcnt += 1\n elif whiteflag and S[i] == '.':\n whitecnt += 1\n\nprint(min(blackcnt, whitecnt) if whiteflag else 0)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "sample_input": "3\n#.#\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03069", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 269, "cpu_time_ms": 64, "memory_kb": 3500}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s534830873", "group_id": "codeNet:p03071", "input_text": "a = sorted(list(map(int, input().split())))", "language": "Python", "metadata": {"date": 1569251951, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03071.html", "problem_id": "p03071", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03071/input.txt", "sample_output_relpath": "derived/input_output/data/p03071/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03071/Python/s534830873.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s534830873", "user_id": "u287431190"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "a = sorted(list(map(int, input().split())))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are two buttons, one of size A and one of size B.\n\nWhen you press a button of size X, you get X coins and the size of that button decreases by 1.\n\nYou will press a button twice. Here, you can press the same button twice, or press both buttons once.\n\nAt most how many coins can you get?\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq A, B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the maximum number of coins you can get.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n9\n\nYou can get 5 + 4 = 9 coins by pressing the button of size 5 twice, and this is the maximum result.\n\nSample Input 2\n\n3 4\n\nSample Output 2\n\n7\n\nSample Input 3\n\n6 6\n\nSample Output 3\n\n12", "sample_input": "5 3\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03071", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are two buttons, one of size A and one of size B.\n\nWhen you press a button of size X, you get X coins and the size of that button decreases by 1.\n\nYou will press a button twice. Here, you can press the same button twice, or press both buttons once.\n\nAt most how many coins can you get?\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq A, B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the maximum number of coins you can get.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n9\n\nYou can get 5 + 4 = 9 coins by pressing the button of size 5 twice, and this is the maximum result.\n\nSample Input 2\n\n3 4\n\nSample Output 2\n\n7\n\nSample Input 3\n\n6 6\n\nSample Output 3\n\n12", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 43, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s820531552", "group_id": "codeNet:p03071", "input_text": "numbers = [int(i) for i in input().split()]\n\nnum1 = numbers[0]\nnum2 = numbers[1]\n\nsum = 0\nfor i in range (2):\n \n if num1 >=num2:\n sum += num1\n num1 = num1 -1\n else:\n sum += num2\n num2 = num2-1\n\nprint (sum)\n\n", "language": "Python", "metadata": {"date": 1566262829, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03071.html", "problem_id": "p03071", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03071/input.txt", "sample_output_relpath": "derived/input_output/data/p03071/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03071/Python/s820531552.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s820531552", "user_id": "u700138719"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "numbers = [int(i) for i in input().split()]\n\nnum1 = numbers[0]\nnum2 = numbers[1]\n\nsum = 0\nfor i in range (2):\n \n if num1 >=num2:\n sum += num1\n num1 = num1 -1\n else:\n sum += num2\n num2 = num2-1\n\nprint (sum)\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are two buttons, one of size A and one of size B.\n\nWhen you press a button of size X, you get X coins and the size of that button decreases by 1.\n\nYou will press a button twice. Here, you can press the same button twice, or press both buttons once.\n\nAt most how many coins can you get?\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq A, B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the maximum number of coins you can get.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n9\n\nYou can get 5 + 4 = 9 coins by pressing the button of size 5 twice, and this is the maximum result.\n\nSample Input 2\n\n3 4\n\nSample Output 2\n\n7\n\nSample Input 3\n\n6 6\n\nSample Output 3\n\n12", "sample_input": "5 3\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03071", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are two buttons, one of size A and one of size B.\n\nWhen you press a button of size X, you get X coins and the size of that button decreases by 1.\n\nYou will press a button twice. Here, you can press the same button twice, or press both buttons once.\n\nAt most how many coins can you get?\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq A, B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the maximum number of coins you can get.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n9\n\nYou can get 5 + 4 = 9 coins by pressing the button of size 5 twice, and this is the maximum result.\n\nSample Input 2\n\n3 4\n\nSample Output 2\n\n7\n\nSample Input 3\n\n6 6\n\nSample Output 3\n\n12", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 248, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s484957767", "group_id": "codeNet:p03071", "input_text": "a,b = map(int, input().split())\n\nif a == b:\n out = 2*a\nelse:\n out = max(a, b) * 2 - 1\n \nprint(out)\n", "language": "Python", "metadata": {"date": 1563480137, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03071.html", "problem_id": "p03071", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03071/input.txt", "sample_output_relpath": "derived/input_output/data/p03071/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03071/Python/s484957767.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s484957767", "user_id": "u956194864"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "a,b = map(int, input().split())\n\nif a == b:\n out = 2*a\nelse:\n out = max(a, b) * 2 - 1\n \nprint(out)\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are two buttons, one of size A and one of size B.\n\nWhen you press a button of size X, you get X coins and the size of that button decreases by 1.\n\nYou will press a button twice. Here, you can press the same button twice, or press both buttons once.\n\nAt most how many coins can you get?\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq A, B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the maximum number of coins you can get.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n9\n\nYou can get 5 + 4 = 9 coins by pressing the button of size 5 twice, and this is the maximum result.\n\nSample Input 2\n\n3 4\n\nSample Output 2\n\n7\n\nSample Input 3\n\n6 6\n\nSample Output 3\n\n12", "sample_input": "5 3\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03071", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are two buttons, one of size A and one of size B.\n\nWhen you press a button of size X, you get X coins and the size of that button decreases by 1.\n\nYou will press a button twice. Here, you can press the same button twice, or press both buttons once.\n\nAt most how many coins can you get?\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq A, B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the maximum number of coins you can get.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n9\n\nYou can get 5 + 4 = 9 coins by pressing the button of size 5 twice, and this is the maximum result.\n\nSample Input 2\n\n3 4\n\nSample Output 2\n\n7\n\nSample Input 3\n\n6 6\n\nSample Output 3\n\n12", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 108, "cpu_time_ms": 163, "memory_kb": 38512}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s868346480", "group_id": "codeNet:p03072", "input_text": "N=int(input())\nH=[int(i) for i in input().split()]\nresult=0\nhmax=H[0]\nfor i in range(N):\n hmax=max(hmax,H[i])\n if H[i]>=hmax:\n result+=1\nprint(result)", "language": "Python", "metadata": {"date": 1555182429, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03072.html", "problem_id": "p03072", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03072/input.txt", "sample_output_relpath": "derived/input_output/data/p03072/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03072/Python/s868346480.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s868346480", "user_id": "u747873993"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "N=int(input())\nH=[int(i) for i in input().split()]\nresult=0\nhmax=H[0]\nfor i in range(N):\n hmax=max(hmax,H[i])\n if H[i]>=hmax:\n result+=1\nprint(result)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N mountains ranging from east to west, and an ocean to the west.\n\nAt the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.\n\nThe height of the i-th mountain from the west is H_i.\n\nYou can certainly see the ocean from the inn at the top of the westmost mountain.\n\nFor the inn at the top of the i-th mountain from the west (i = 2, 3, ..., N), you can see the ocean if and only if H_1 \\leq H_i, H_2 \\leq H_i, ..., and H_{i-1} \\leq H_i.\n\nFrom how many of these N inns can you see the ocean?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq H_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the number of inns from which you can see the ocean.\n\nSample Input 1\n\n4\n6 5 6 8\n\nSample Output 1\n\n3\n\nYou can see the ocean from the first, third and fourth inns from the west.\n\nSample Input 2\n\n5\n4 5 3 5 4\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5\n9 5 6 8 4\n\nSample Output 3\n\n1", "sample_input": "4\n6 5 6 8\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03072", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N mountains ranging from east to west, and an ocean to the west.\n\nAt the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.\n\nThe height of the i-th mountain from the west is H_i.\n\nYou can certainly see the ocean from the inn at the top of the westmost mountain.\n\nFor the inn at the top of the i-th mountain from the west (i = 2, 3, ..., N), you can see the ocean if and only if H_1 \\leq H_i, H_2 \\leq H_i, ..., and H_{i-1} \\leq H_i.\n\nFrom how many of these N inns can you see the ocean?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq H_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the number of inns from which you can see the ocean.\n\nSample Input 1\n\n4\n6 5 6 8\n\nSample Output 1\n\n3\n\nYou can see the ocean from the first, third and fourth inns from the west.\n\nSample Input 2\n\n5\n4 5 3 5 4\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5\n9 5 6 8 4\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 163, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s046931938", "group_id": "codeNet:p03074", "input_text": "N, K = map(int, input().split())\ns = \"1\"+input().strip()+\"1\"\ni = 0\ndp = []\nwhile i < len(s):\n l = i\n while i < len(s) and s[i] == '1':\n i += 1\n if l < i:\n dp.append([l, i-1])\n while i < len(s) and s[i] == '0':\n i += 1\n\n\nif len(dp) <= K:\n print(N)\nelse:\n ans = 0\n for i in range(0, len(dp)-K):\n t = dp[i+K][1]-dp[i][0]\n if t > ans:\n ans = t\n print(ans)\n", "language": "Python", "metadata": {"date": 1555187433, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03074.html", "problem_id": "p03074", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03074/input.txt", "sample_output_relpath": "derived/input_output/data/p03074/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03074/Python/s046931938.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s046931938", "user_id": "u342869120"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "N, K = map(int, input().split())\ns = \"1\"+input().strip()+\"1\"\ni = 0\ndp = []\nwhile i < len(s):\n l = i\n while i < len(s) and s[i] == '1':\n i += 1\n if l < i:\n dp.append([l, i-1])\n while i < len(s) and s[i] == '0':\n i += 1\n\n\nif len(dp) <= K:\n print(N)\nelse:\n ans = 0\n for i in range(0, len(dp)-K):\n t = dp[i+K][1]-dp[i][0]\n if t > ans:\n ans = t\n print(ans)\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nN people are arranged in a row from left to right.\n\nYou are given a string S of length N consisting of 0 and 1, and a positive integer K.\n\nThe i-th person from the left is standing on feet if the i-th character of S is 0, and standing on hands if that character is 1.\n\nYou will give the following direction at most K times (possibly zero):\n\nDirection: Choose integers l and r satisfying 1 \\leq l \\leq r \\leq N, and flip the l-th, (l+1)-th, ..., and r-th persons. That is, for each i = l, l+1, ..., r, the i-th person from the left now stands on hands if he/she was standing on feet, and stands on feet if he/she was standing on hands.\n\nFind the maximum possible number of consecutive people standing on hands after at most K directions.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^5.\n\nK is an integer satisfying 1 \\leq K \\leq 10^5.\n\nThe length of the string S is N.\n\nEach character of the string S is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the maximum possible number of consecutive people standing on hands after at most K directions.\n\nSample Input 1\n\n5 1\n00010\n\nSample Output 1\n\n4\n\nWe can have four consecutive people standing on hands, which is the maximum result, by giving the following direction:\n\nGive the direction with l = 1, r = 3, which flips the first, second and third persons from the left.\n\nSample Input 2\n\n14 2\n11101010110011\n\nSample Output 2\n\n8\n\nSample Input 3\n\n1 1\n1\n\nSample Output 3\n\n1\n\nNo directions are necessary.", "sample_input": "5 1\n00010\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03074", "source_text": "Score : 400 points\n\nProblem Statement\n\nN people are arranged in a row from left to right.\n\nYou are given a string S of length N consisting of 0 and 1, and a positive integer K.\n\nThe i-th person from the left is standing on feet if the i-th character of S is 0, and standing on hands if that character is 1.\n\nYou will give the following direction at most K times (possibly zero):\n\nDirection: Choose integers l and r satisfying 1 \\leq l \\leq r \\leq N, and flip the l-th, (l+1)-th, ..., and r-th persons. That is, for each i = l, l+1, ..., r, the i-th person from the left now stands on hands if he/she was standing on feet, and stands on feet if he/she was standing on hands.\n\nFind the maximum possible number of consecutive people standing on hands after at most K directions.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^5.\n\nK is an integer satisfying 1 \\leq K \\leq 10^5.\n\nThe length of the string S is N.\n\nEach character of the string S is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the maximum possible number of consecutive people standing on hands after at most K directions.\n\nSample Input 1\n\n5 1\n00010\n\nSample Output 1\n\n4\n\nWe can have four consecutive people standing on hands, which is the maximum result, by giving the following direction:\n\nGive the direction with l = 1, r = 3, which flips the first, second and third persons from the left.\n\nSample Input 2\n\n14 2\n11101010110011\n\nSample Output 2\n\n8\n\nSample Input 3\n\n1 1\n1\n\nSample Output 3\n\n1\n\nNo directions are necessary.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 422, "cpu_time_ms": 99, "memory_kb": 11412}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s347879695", "group_id": "codeNet:p03075", "input_text": "a = [int(input()) for _ in range(5)]\nk = int(input())\nif(a[4]-a[0]>k):\n print(':(')\nelse:\n print('Yay!')", "language": "Python", "metadata": {"date": 1555073767, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03075.html", "problem_id": "p03075", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03075/input.txt", "sample_output_relpath": "derived/input_output/data/p03075/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03075/Python/s347879695.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s347879695", "user_id": "u129978636"}, "prompt_components": {"gold_output": "Yay!\n", "input_to_evaluate": "a = [int(input()) for _ in range(5)]\nk = int(input())\nif(a[4]-a[0]>k):\n print(':(')\nelse:\n print('Yay!')", "problem_context": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "sample_input": "1\n2\n4\n8\n9\n15\n"}, "reference_outputs": ["Yay!\n"], "source_document_id": "p03075", "source_text": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 110, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s836800961", "group_id": "codeNet:p03075", "input_text": "t = [int(input()) for i in range(6)]\nprint (\"Yay!\" if t[4]-t[0] <= t[5] else \":(\")", "language": "Python", "metadata": {"date": 1554577444, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03075.html", "problem_id": "p03075", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03075/input.txt", "sample_output_relpath": "derived/input_output/data/p03075/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03075/Python/s836800961.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s836800961", "user_id": "u562033060"}, "prompt_components": {"gold_output": "Yay!\n", "input_to_evaluate": "t = [int(input()) for i in range(6)]\nprint (\"Yay!\" if t[4]-t[0] <= t[5] else \":(\")", "problem_context": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "sample_input": "1\n2\n4\n8\n9\n15\n"}, "reference_outputs": ["Yay!\n"], "source_document_id": "p03075", "source_text": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 82, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s602144630", "group_id": "codeNet:p03076", "input_text": "dishes = [int(input()) for i in range(5)] \n\nd = [abs(d % 10 -10) for d in dishes if d % 10 != 0] # select nums which can be divided by 10\nd.remove(max(d)) \nprint(sum(dishes) + sum(d))", "language": "Python", "metadata": {"date": 1600270678, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03076.html", "problem_id": "p03076", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03076/input.txt", "sample_output_relpath": "derived/input_output/data/p03076/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03076/Python/s602144630.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s602144630", "user_id": "u724428568"}, "prompt_components": {"gold_output": "215\n", "input_to_evaluate": "dishes = [int(input()) for i in range(5)] \n\nd = [abs(d % 10 -10) for d in dishes if d % 10 != 0] # select nums which can be divided by 10\nd.remove(max(d)) \nprint(sum(dishes) + sum(d))", "problem_context": "Score: 200 points\n\nProblem Statement\n\nThe restaurant AtCoder serves the following five dishes:\n\nABC Don (rice bowl): takes A minutes to serve.\n\nARC Curry: takes B minutes to serve.\n\nAGC Pasta: takes C minutes to serve.\n\nAPC Ramen: takes D minutes to serve.\n\nATC Hanbagu (hamburger patty): takes E minutes to serve.\n\nHere, the time to serve a dish is the time between when an order is placed and when the dish is delivered.\n\nThis restaurant has the following rules on orders:\n\nAn order can only be placed at a time that is a multiple of 10 (time 0, 10, 20, ...).\n\nOnly one dish can be ordered at a time.\n\nNo new order can be placed when an order is already placed and the dish is still not delivered, but a new order can be placed at the exact time when the dish is delivered.\n\nE869120 arrives at this restaurant at time 0. He will order all five dishes. Find the earliest possible time for the last dish to be delivered.\n\nHere, he can order the dishes in any order he likes, and he can place an order already at time 0.\n\nConstraints\n\nA, B, C, D and E are integers between 1 and 123 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nD\nE\n\nOutput\n\nPrint the earliest possible time for the last dish to be delivered, as an integer.\n\nSample Input 1\n\n29\n20\n7\n35\n120\n\nSample Output 1\n\n215\n\nIf we decide to order the dishes in the order ABC Don, ARC Curry, AGC Pasta, ATC Hanbagu, APC Ramen, the earliest possible time for each order is as follows:\n\nOrder ABC Don at time 0, which will be delivered at time 29.\n\nOrder ARC Curry at time 30, which will be delivered at time 50.\n\nOrder AGC Pasta at time 50, which will be delivered at time 57.\n\nOrder ATC Hanbagu at time 60, which will be delivered at time 180.\n\nOrder APC Ramen at time 180, which will be delivered at time 215.\n\nThere is no way to order the dishes in which the last dish will be delivered earlier than this.\n\nSample Input 2\n\n101\n86\n119\n108\n57\n\nSample Output 2\n\n481\n\nIf we decide to order the dishes in the order AGC Pasta, ARC Curry, ATC Hanbagu, APC Ramen, ABC Don, the earliest possible time for each order is as follows:\n\nOrder AGC Pasta at time 0, which will be delivered at time 119.\n\nOrder ARC Curry at time 120, which will be delivered at time 206.\n\nOrder ATC Hanbagu at time 210, which will be delivered at time 267.\n\nOrder APC Ramen at time 270, which will be delivered at time 378.\n\nOrder ABC Don at time 380, which will be delivered at time 481.\n\nThere is no way to order the dishes in which the last dish will be delivered earlier than this.\n\nSample Input 3\n\n123\n123\n123\n123\n123\n\nSample Output 3\n\n643\n\nThis is the largest valid case.", "sample_input": "29\n20\n7\n35\n120\n"}, "reference_outputs": ["215\n"], "source_document_id": "p03076", "source_text": "Score: 200 points\n\nProblem Statement\n\nThe restaurant AtCoder serves the following five dishes:\n\nABC Don (rice bowl): takes A minutes to serve.\n\nARC Curry: takes B minutes to serve.\n\nAGC Pasta: takes C minutes to serve.\n\nAPC Ramen: takes D minutes to serve.\n\nATC Hanbagu (hamburger patty): takes E minutes to serve.\n\nHere, the time to serve a dish is the time between when an order is placed and when the dish is delivered.\n\nThis restaurant has the following rules on orders:\n\nAn order can only be placed at a time that is a multiple of 10 (time 0, 10, 20, ...).\n\nOnly one dish can be ordered at a time.\n\nNo new order can be placed when an order is already placed and the dish is still not delivered, but a new order can be placed at the exact time when the dish is delivered.\n\nE869120 arrives at this restaurant at time 0. He will order all five dishes. Find the earliest possible time for the last dish to be delivered.\n\nHere, he can order the dishes in any order he likes, and he can place an order already at time 0.\n\nConstraints\n\nA, B, C, D and E are integers between 1 and 123 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nD\nE\n\nOutput\n\nPrint the earliest possible time for the last dish to be delivered, as an integer.\n\nSample Input 1\n\n29\n20\n7\n35\n120\n\nSample Output 1\n\n215\n\nIf we decide to order the dishes in the order ABC Don, ARC Curry, AGC Pasta, ATC Hanbagu, APC Ramen, the earliest possible time for each order is as follows:\n\nOrder ABC Don at time 0, which will be delivered at time 29.\n\nOrder ARC Curry at time 30, which will be delivered at time 50.\n\nOrder AGC Pasta at time 50, which will be delivered at time 57.\n\nOrder ATC Hanbagu at time 60, which will be delivered at time 180.\n\nOrder APC Ramen at time 180, which will be delivered at time 215.\n\nThere is no way to order the dishes in which the last dish will be delivered earlier than this.\n\nSample Input 2\n\n101\n86\n119\n108\n57\n\nSample Output 2\n\n481\n\nIf we decide to order the dishes in the order AGC Pasta, ARC Curry, ATC Hanbagu, APC Ramen, ABC Don, the earliest possible time for each order is as follows:\n\nOrder AGC Pasta at time 0, which will be delivered at time 119.\n\nOrder ARC Curry at time 120, which will be delivered at time 206.\n\nOrder ATC Hanbagu at time 210, which will be delivered at time 267.\n\nOrder APC Ramen at time 270, which will be delivered at time 378.\n\nOrder ABC Don at time 380, which will be delivered at time 481.\n\nThere is no way to order the dishes in which the last dish will be delivered earlier than this.\n\nSample Input 3\n\n123\n123\n123\n123\n123\n\nSample Output 3\n\n643\n\nThis is the largest valid case.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 183, "cpu_time_ms": 24, "memory_kb": 9072}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s477006782", "group_id": "codeNet:p03077", "input_text": "print(~-int(input())//min(eval('int(input()),'*5))+5)", "language": "Python", "metadata": {"date": 1554585121, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03077.html", "problem_id": "p03077", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03077/input.txt", "sample_output_relpath": "derived/input_output/data/p03077/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03077/Python/s477006782.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s477006782", "user_id": "u170765582"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "print(~-int(input())//min(eval('int(input()),'*5))+5)", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn 2028 and after a continuous growth, AtCoder Inc. finally built an empire with six cities (City 1, 2, 3, 4, 5, 6)!\n\nThere are five means of transport in this empire:\n\nTrain: travels from City 1 to 2 in one minute. A train can occupy at most A people.\n\nBus: travels from City 2 to 3 in one minute. A bus can occupy at most B people.\n\nTaxi: travels from City 3 to 4 in one minute. A taxi can occupy at most C people.\n\nAirplane: travels from City 4 to 5 in one minute. An airplane can occupy at most D people.\n\nShip: travels from City 5 to 6 in one minute. A ship can occupy at most E people.\n\nFor each of them, one vehicle leaves the city at each integer time (time 0, 1, 2, ...).\n\nThere is a group of N people at City 1, and they all want to go to City 6.\n\nAt least how long does it take for all of them to reach there?\nYou can ignore the time needed to transfer.\n\nConstraints\n\n1 \\leq N, A, B, C, D, E \\leq 10^{15}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA\nB\nC\nD\nE\n\nOutput\n\nPrint the minimum time required for all of the people to reach City 6, in minutes.\n\nSample Input 1\n\n5\n3\n2\n4\n3\n5\n\nSample Output 1\n\n7\n\nOne possible way to travel is as follows.\nFirst, there are N = 5 people at City 1, as shown in the following image:\n\nIn the first minute, three people travels from City 1 to City 2 by train. Note that a train can only occupy at most three people.\n\nIn the second minute, the remaining two people travels from City 1 to City 2 by train, and two of the three people who were already at City 2 travels to City 3 by bus. Note that a bus can only occupy at most two people.\n\nIn the third minute, two people travels from City 2 to City 3 by train, and another two people travels from City 3 to City 4 by taxi.\n\nFrom then on, if they continue traveling without stopping until they reach City 6, all of them can reach there in seven minutes.\n\nThere is no way for them to reach City 6 in 6 minutes or less.\n\nSample Input 2\n\n10\n123\n123\n123\n123\n123\n\nSample Output 2\n\n5\n\nAll kinds of vehicles can occupy N = 10 people at a time.\nThus, if they continue traveling without stopping until they reach City 6, all of them can reach there in five minutes.\n\nSample Input 3\n\n10000000007\n2\n3\n5\n7\n11\n\nSample Output 3\n\n5000000008\n\nNote that the input or output may not fit into a 32-bit integer type.", "sample_input": "5\n3\n2\n4\n3\n5\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03077", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn 2028 and after a continuous growth, AtCoder Inc. finally built an empire with six cities (City 1, 2, 3, 4, 5, 6)!\n\nThere are five means of transport in this empire:\n\nTrain: travels from City 1 to 2 in one minute. A train can occupy at most A people.\n\nBus: travels from City 2 to 3 in one minute. A bus can occupy at most B people.\n\nTaxi: travels from City 3 to 4 in one minute. A taxi can occupy at most C people.\n\nAirplane: travels from City 4 to 5 in one minute. An airplane can occupy at most D people.\n\nShip: travels from City 5 to 6 in one minute. A ship can occupy at most E people.\n\nFor each of them, one vehicle leaves the city at each integer time (time 0, 1, 2, ...).\n\nThere is a group of N people at City 1, and they all want to go to City 6.\n\nAt least how long does it take for all of them to reach there?\nYou can ignore the time needed to transfer.\n\nConstraints\n\n1 \\leq N, A, B, C, D, E \\leq 10^{15}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA\nB\nC\nD\nE\n\nOutput\n\nPrint the minimum time required for all of the people to reach City 6, in minutes.\n\nSample Input 1\n\n5\n3\n2\n4\n3\n5\n\nSample Output 1\n\n7\n\nOne possible way to travel is as follows.\nFirst, there are N = 5 people at City 1, as shown in the following image:\n\nIn the first minute, three people travels from City 1 to City 2 by train. Note that a train can only occupy at most three people.\n\nIn the second minute, the remaining two people travels from City 1 to City 2 by train, and two of the three people who were already at City 2 travels to City 3 by bus. Note that a bus can only occupy at most two people.\n\nIn the third minute, two people travels from City 2 to City 3 by train, and another two people travels from City 3 to City 4 by taxi.\n\nFrom then on, if they continue traveling without stopping until they reach City 6, all of them can reach there in seven minutes.\n\nThere is no way for them to reach City 6 in 6 minutes or less.\n\nSample Input 2\n\n10\n123\n123\n123\n123\n123\n\nSample Output 2\n\n5\n\nAll kinds of vehicles can occupy N = 10 people at a time.\nThus, if they continue traveling without stopping until they reach City 6, all of them can reach there in five minutes.\n\nSample Input 3\n\n10000000007\n2\n3\n5\n7\n11\n\nSample Output 3\n\n5000000008\n\nNote that the input or output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 53, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s983365190", "group_id": "codeNet:p03077", "input_text": "n = int(input())\na = int(input())\nb = int(input())\nc = int(input())\nd = int(input())\ne = int(input())\ninput_list = [a,b,c,d,e]\ninput_list.sort()\nprint(n // input_list[0] +5)", "language": "Python", "metadata": {"date": 1554581267, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03077.html", "problem_id": "p03077", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03077/input.txt", "sample_output_relpath": "derived/input_output/data/p03077/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03077/Python/s983365190.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s983365190", "user_id": "u384476576"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "n = int(input())\na = int(input())\nb = int(input())\nc = int(input())\nd = int(input())\ne = int(input())\ninput_list = [a,b,c,d,e]\ninput_list.sort()\nprint(n // input_list[0] +5)", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn 2028 and after a continuous growth, AtCoder Inc. finally built an empire with six cities (City 1, 2, 3, 4, 5, 6)!\n\nThere are five means of transport in this empire:\n\nTrain: travels from City 1 to 2 in one minute. A train can occupy at most A people.\n\nBus: travels from City 2 to 3 in one minute. A bus can occupy at most B people.\n\nTaxi: travels from City 3 to 4 in one minute. A taxi can occupy at most C people.\n\nAirplane: travels from City 4 to 5 in one minute. An airplane can occupy at most D people.\n\nShip: travels from City 5 to 6 in one minute. A ship can occupy at most E people.\n\nFor each of them, one vehicle leaves the city at each integer time (time 0, 1, 2, ...).\n\nThere is a group of N people at City 1, and they all want to go to City 6.\n\nAt least how long does it take for all of them to reach there?\nYou can ignore the time needed to transfer.\n\nConstraints\n\n1 \\leq N, A, B, C, D, E \\leq 10^{15}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA\nB\nC\nD\nE\n\nOutput\n\nPrint the minimum time required for all of the people to reach City 6, in minutes.\n\nSample Input 1\n\n5\n3\n2\n4\n3\n5\n\nSample Output 1\n\n7\n\nOne possible way to travel is as follows.\nFirst, there are N = 5 people at City 1, as shown in the following image:\n\nIn the first minute, three people travels from City 1 to City 2 by train. Note that a train can only occupy at most three people.\n\nIn the second minute, the remaining two people travels from City 1 to City 2 by train, and two of the three people who were already at City 2 travels to City 3 by bus. Note that a bus can only occupy at most two people.\n\nIn the third minute, two people travels from City 2 to City 3 by train, and another two people travels from City 3 to City 4 by taxi.\n\nFrom then on, if they continue traveling without stopping until they reach City 6, all of them can reach there in seven minutes.\n\nThere is no way for them to reach City 6 in 6 minutes or less.\n\nSample Input 2\n\n10\n123\n123\n123\n123\n123\n\nSample Output 2\n\n5\n\nAll kinds of vehicles can occupy N = 10 people at a time.\nThus, if they continue traveling without stopping until they reach City 6, all of them can reach there in five minutes.\n\nSample Input 3\n\n10000000007\n2\n3\n5\n7\n11\n\nSample Output 3\n\n5000000008\n\nNote that the input or output may not fit into a 32-bit integer type.", "sample_input": "5\n3\n2\n4\n3\n5\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03077", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn 2028 and after a continuous growth, AtCoder Inc. finally built an empire with six cities (City 1, 2, 3, 4, 5, 6)!\n\nThere are five means of transport in this empire:\n\nTrain: travels from City 1 to 2 in one minute. A train can occupy at most A people.\n\nBus: travels from City 2 to 3 in one minute. A bus can occupy at most B people.\n\nTaxi: travels from City 3 to 4 in one minute. A taxi can occupy at most C people.\n\nAirplane: travels from City 4 to 5 in one minute. An airplane can occupy at most D people.\n\nShip: travels from City 5 to 6 in one minute. A ship can occupy at most E people.\n\nFor each of them, one vehicle leaves the city at each integer time (time 0, 1, 2, ...).\n\nThere is a group of N people at City 1, and they all want to go to City 6.\n\nAt least how long does it take for all of them to reach there?\nYou can ignore the time needed to transfer.\n\nConstraints\n\n1 \\leq N, A, B, C, D, E \\leq 10^{15}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA\nB\nC\nD\nE\n\nOutput\n\nPrint the minimum time required for all of the people to reach City 6, in minutes.\n\nSample Input 1\n\n5\n3\n2\n4\n3\n5\n\nSample Output 1\n\n7\n\nOne possible way to travel is as follows.\nFirst, there are N = 5 people at City 1, as shown in the following image:\n\nIn the first minute, three people travels from City 1 to City 2 by train. Note that a train can only occupy at most three people.\n\nIn the second minute, the remaining two people travels from City 1 to City 2 by train, and two of the three people who were already at City 2 travels to City 3 by bus. Note that a bus can only occupy at most two people.\n\nIn the third minute, two people travels from City 2 to City 3 by train, and another two people travels from City 3 to City 4 by taxi.\n\nFrom then on, if they continue traveling without stopping until they reach City 6, all of them can reach there in seven minutes.\n\nThere is no way for them to reach City 6 in 6 minutes or less.\n\nSample Input 2\n\n10\n123\n123\n123\n123\n123\n\nSample Output 2\n\n5\n\nAll kinds of vehicles can occupy N = 10 people at a time.\nThus, if they continue traveling without stopping until they reach City 6, all of them can reach there in five minutes.\n\nSample Input 3\n\n10000000007\n2\n3\n5\n7\n11\n\nSample Output 3\n\n5000000008\n\nNote that the input or output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 173, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s403120586", "group_id": "codeNet:p03078", "input_text": "x, y, z, k = map(int, input().split())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = sorted(list(map(int, input().split())))[z-k:]\nab, abc = [], []\n\nfor i in a:\n for j in b:\n ab.append(i+j)\n\nab.sort()\ns = ab[x*y-k:]\nfor i in s:\n for j in c:\n abc.append(i+j)\n\nabc.sort(reverse=True)\nfor i in range(k):\n print(abc[i])", "language": "Python", "metadata": {"date": 1558107743, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03078.html", "problem_id": "p03078", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03078/input.txt", "sample_output_relpath": "derived/input_output/data/p03078/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03078/Python/s403120586.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s403120586", "user_id": "u652081898"}, "prompt_components": {"gold_output": "19\n17\n15\n14\n13\n12\n10\n8\n", "input_to_evaluate": "x, y, z, k = map(int, input().split())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = sorted(list(map(int, input().split())))[z-k:]\nab, abc = [], []\n\nfor i in a:\n for j in b:\n ab.append(i+j)\n\nab.sort()\ns = ab[x*y-k:]\nfor i in s:\n for j in c:\n abc.append(i+j)\n\nabc.sort(reverse=True)\nfor i in range(k):\n print(abc[i])", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Patisserie AtCoder sells cakes with number-shaped candles.\nThere are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively.\nEach cake has an integer value called deliciousness, as follows:\n\nThe deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.\n\nThe deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.\n\nThe deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.\n\nTakahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.\n\nThere are X \\times Y \\times Z such ways to choose three cakes.\n\nWe will arrange these X \\times Y \\times Z ways in descending order of the sum of the deliciousness of the cakes.\n\nPrint the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.\n\nConstraints\n\n1 \\leq X \\leq 1 \\ 000\n\n1 \\leq Y \\leq 1 \\ 000\n\n1 \\leq Z \\leq 1 \\ 000\n\n1 \\leq K \\leq \\min(3 \\ 000, X \\times Y \\times Z)\n\n1 \\leq A_i \\leq 10 \\ 000 \\ 000 \\ 000\n\n1 \\leq B_i \\leq 10 \\ 000 \\ 000 \\ 000\n\n1 \\leq C_i \\leq 10 \\ 000 \\ 000 \\ 000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z K\nA_1 \\ A_2 \\ A_3 \\ ... \\ A_X\nB_1 \\ B_2 \\ B_3 \\ ... \\ B_Y\nC_1 \\ C_2 \\ C_3 \\ ... \\ C_Z\n\nOutput\n\nPrint K lines. The i-th line should contain the i-th value stated in the problem statement.\n\nSample Input 1\n\n2 2 2 8\n4 6\n1 5\n3 8\n\nSample Output 1\n\n19\n17\n15\n14\n13\n12\n10\n8\n\nThere are 2 \\times 2 \\times 2 = 8 ways to choose three cakes, as shown below in descending order of the sum of the deliciousness of the cakes:\n\n(A_2, B_2, C_2): 6 + 5 + 8 = 19\n\n(A_1, B_2, C_2): 4 + 5 + 8 = 17\n\n(A_2, B_1, C_2): 6 + 1 + 8 = 15\n\n(A_2, B_2, C_1): 6 + 5 + 3 = 14\n\n(A_1, B_1, C_2): 4 + 1 + 8 = 13\n\n(A_1, B_2, C_1): 4 + 5 + 3 = 12\n\n(A_2, B_1, C_1): 6 + 1 + 3 = 10\n\n(A_1, B_1, C_1): 4 + 1 + 3 = 8\n\nSample Input 2\n\n3 3 3 5\n1 10 100\n2 20 200\n1 10 100\n\nSample Output 2\n\n400\n310\n310\n301\n301\n\nThere may be multiple combinations of cakes with the same sum of the deliciousness. For example, in this test case, the sum of A_1, B_3, C_3 and the sum of A_3, B_3, C_1 are both 301.\nHowever, they are different ways of choosing cakes, so 301 occurs twice in the output.\n\nSample Input 3\n\n10 10 10 20\n7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488\n1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338\n4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736\n\nSample Output 3\n\n23379871545\n22444657051\n22302177772\n22095691512\n21667941469\n21366963278\n21287912315\n21279176669\n21160477018\n21085311041\n21059876163\n21017997739\n20703329561\n20702387965\n20590247696\n20383761436\n20343962175\n20254073196\n20210218542\n20150096547\n\nNote that the input or output may not fit into a 32-bit integer type.", "sample_input": "2 2 2 8\n4 6\n1 5\n3 8\n"}, "reference_outputs": ["19\n17\n15\n14\n13\n12\n10\n8\n"], "source_document_id": "p03078", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Patisserie AtCoder sells cakes with number-shaped candles.\nThere are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively.\nEach cake has an integer value called deliciousness, as follows:\n\nThe deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.\n\nThe deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.\n\nThe deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.\n\nTakahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.\n\nThere are X \\times Y \\times Z such ways to choose three cakes.\n\nWe will arrange these X \\times Y \\times Z ways in descending order of the sum of the deliciousness of the cakes.\n\nPrint the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.\n\nConstraints\n\n1 \\leq X \\leq 1 \\ 000\n\n1 \\leq Y \\leq 1 \\ 000\n\n1 \\leq Z \\leq 1 \\ 000\n\n1 \\leq K \\leq \\min(3 \\ 000, X \\times Y \\times Z)\n\n1 \\leq A_i \\leq 10 \\ 000 \\ 000 \\ 000\n\n1 \\leq B_i \\leq 10 \\ 000 \\ 000 \\ 000\n\n1 \\leq C_i \\leq 10 \\ 000 \\ 000 \\ 000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z K\nA_1 \\ A_2 \\ A_3 \\ ... \\ A_X\nB_1 \\ B_2 \\ B_3 \\ ... \\ B_Y\nC_1 \\ C_2 \\ C_3 \\ ... \\ C_Z\n\nOutput\n\nPrint K lines. The i-th line should contain the i-th value stated in the problem statement.\n\nSample Input 1\n\n2 2 2 8\n4 6\n1 5\n3 8\n\nSample Output 1\n\n19\n17\n15\n14\n13\n12\n10\n8\n\nThere are 2 \\times 2 \\times 2 = 8 ways to choose three cakes, as shown below in descending order of the sum of the deliciousness of the cakes:\n\n(A_2, B_2, C_2): 6 + 5 + 8 = 19\n\n(A_1, B_2, C_2): 4 + 5 + 8 = 17\n\n(A_2, B_1, C_2): 6 + 1 + 8 = 15\n\n(A_2, B_2, C_1): 6 + 5 + 3 = 14\n\n(A_1, B_1, C_2): 4 + 1 + 8 = 13\n\n(A_1, B_2, C_1): 4 + 5 + 3 = 12\n\n(A_2, B_1, C_1): 6 + 1 + 3 = 10\n\n(A_1, B_1, C_1): 4 + 1 + 3 = 8\n\nSample Input 2\n\n3 3 3 5\n1 10 100\n2 20 200\n1 10 100\n\nSample Output 2\n\n400\n310\n310\n301\n301\n\nThere may be multiple combinations of cakes with the same sum of the deliciousness. For example, in this test case, the sum of A_1, B_3, C_3 and the sum of A_3, B_3, C_1 are both 301.\nHowever, they are different ways of choosing cakes, so 301 occurs twice in the output.\n\nSample Input 3\n\n10 10 10 20\n7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488\n1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338\n4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736\n\nSample Output 3\n\n23379871545\n22444657051\n22302177772\n22095691512\n21667941469\n21366963278\n21287912315\n21279176669\n21160477018\n21085311041\n21059876163\n21017997739\n20703329561\n20702387965\n20590247696\n20383761436\n20343962175\n20254073196\n20210218542\n20150096547\n\nNote that the input or output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 368, "cpu_time_ms": 2116, "memory_kb": 208536}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s722792357", "group_id": "codeNet:p03081", "input_text": "n,q = map(int,input().split())\ns = list(input())\npoint = []\nmark = []\nfor i in range(n):\n if s[i] in mark:\n point[mark.index(s[i])].append(i)\n else:\n mark.append(s[i])\n point.append([i])\n\ng = [0] + [1]*n +[0]\n\ndef f(j,o,g):\n if o == \"L\":\n g[j-1] += g[j]\n else:\n g[j+1] += g[j]\n g[j] = 0\n return g\n\nfor i in range(q):\n al,o = map(str,input().split())\n if al in mark:\n for j in point[mark.index(al)]:\n if g[j+1] > 0:\n g = f(j+1,o,g)\n \ng[0],g[-1] = 0,0\nprint(sum(g))", "language": "Python", "metadata": {"date": 1553982312, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03081.html", "problem_id": "p03081", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03081/input.txt", "sample_output_relpath": "derived/input_output/data/p03081/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03081/Python/s722792357.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s722792357", "user_id": "u697713131"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n,q = map(int,input().split())\ns = list(input())\npoint = []\nmark = []\nfor i in range(n):\n if s[i] in mark:\n point[mark.index(s[i])].append(i)\n else:\n mark.append(s[i])\n point.append([i])\n\ng = [0] + [1]*n +[0]\n\ndef f(j,o,g):\n if o == \"L\":\n g[j-1] += g[j]\n else:\n g[j+1] += g[j]\n g[j] = 0\n return g\n\nfor i in range(q):\n al,o = map(str,input().split())\n if al in mark:\n for j in point[mark.index(al)]:\n if g[j+1] > 0:\n g = f(j+1,o,g)\n \ng[0],g[-1] = 0,0\nprint(sum(g))", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N squares numbered 1 to N from left to right.\nEach square has a character written on it, and Square i has a letter s_i. Besides, there is initially one golem on each square.\n\nSnuke cast Q spells to move the golems.\n\nThe i-th spell consisted of two characters t_i and d_i, where d_i is L or R.\nWhen Snuke cast this spell, for each square with the character t_i, all golems on that square moved to the square adjacent to the left if d_i is L, and moved to the square adjacent to the right if d_i is R.\n\nHowever, when a golem tried to move left from Square 1 or move right from Square N, it disappeared.\n\nFind the number of golems remaining after Snuke cast the Q spells.\n\nConstraints\n\n1 \\leq N,Q \\leq 2 \\times 10^{5}\n\n|s| = N\n\ns_i and t_i are uppercase English letters.\n\nd_i is L or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\ns\nt_1 d_1\n\\vdots\nt_{Q} d_Q\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 4\nABC\nA L\nB L\nB R\nA R\n\nSample Output 1\n\n2\n\nInitially, there is one golem on each square.\n\nIn the first spell, the golem on Square 1 tries to move left and disappears.\n\nIn the second spell, the golem on Square 2 moves left.\n\nIn the third spell, no golem moves.\n\nIn the fourth spell, the golem on Square 1 moves right.\n\nAfter the four spells are cast, there is one golem on Square 2 and one golem on Square 3, for a total of two golems remaining.\n\nSample Input 2\n\n8 3\nAABCBDBA\nA L\nB R\nA R\n\nSample Output 2\n\n5\n\nAfter the three spells are cast, there is one golem on Square 2, two golems on Square 4 and two golems on Square 6, for a total of five golems remaining.\n\nNote that a single spell may move multiple golems.\n\nSample Input 3\n\n10 15\nSNCZWRCEWB\nB R\nR R\nE R\nW R\nZ L\nS R\nQ L\nW L\nB R\nC L\nA L\nN L\nE R\nZ L\nS L\n\nSample Output 3\n\n3", "sample_input": "3 4\nABC\nA L\nB L\nB R\nA R\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03081", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N squares numbered 1 to N from left to right.\nEach square has a character written on it, and Square i has a letter s_i. Besides, there is initially one golem on each square.\n\nSnuke cast Q spells to move the golems.\n\nThe i-th spell consisted of two characters t_i and d_i, where d_i is L or R.\nWhen Snuke cast this spell, for each square with the character t_i, all golems on that square moved to the square adjacent to the left if d_i is L, and moved to the square adjacent to the right if d_i is R.\n\nHowever, when a golem tried to move left from Square 1 or move right from Square N, it disappeared.\n\nFind the number of golems remaining after Snuke cast the Q spells.\n\nConstraints\n\n1 \\leq N,Q \\leq 2 \\times 10^{5}\n\n|s| = N\n\ns_i and t_i are uppercase English letters.\n\nd_i is L or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\ns\nt_1 d_1\n\\vdots\nt_{Q} d_Q\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 4\nABC\nA L\nB L\nB R\nA R\n\nSample Output 1\n\n2\n\nInitially, there is one golem on each square.\n\nIn the first spell, the golem on Square 1 tries to move left and disappears.\n\nIn the second spell, the golem on Square 2 moves left.\n\nIn the third spell, no golem moves.\n\nIn the fourth spell, the golem on Square 1 moves right.\n\nAfter the four spells are cast, there is one golem on Square 2 and one golem on Square 3, for a total of two golems remaining.\n\nSample Input 2\n\n8 3\nAABCBDBA\nA L\nB R\nA R\n\nSample Output 2\n\n5\n\nAfter the three spells are cast, there is one golem on Square 2, two golems on Square 4 and two golems on Square 6, for a total of five golems remaining.\n\nNote that a single spell may move multiple golems.\n\nSample Input 3\n\n10 15\nSNCZWRCEWB\nB R\nR R\nE R\nW R\nZ L\nS R\nQ L\nW L\nB R\nC L\nA L\nN L\nE R\nZ L\nS L\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 591, "cpu_time_ms": 2107, "memory_kb": 67660}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s011290693", "group_id": "codeNet:p03085", "input_text": "b = input()\nif b == \"A\":\n print(\"T\")\nelif b == \"C\":\n print(\"G\")\nelif b == \"G\":\n print(\"C\")\nelif b == \"T\":\n print(\"A\")", "language": "Python", "metadata": {"date": 1572685484, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03085.html", "problem_id": "p03085", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03085/input.txt", "sample_output_relpath": "derived/input_output/data/p03085/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03085/Python/s011290693.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s011290693", "user_id": "u219197917"}, "prompt_components": {"gold_output": "T\n", "input_to_evaluate": "b = input()\nif b == \"A\":\n print(\"T\")\nelif b == \"C\":\n print(\"G\")\nelif b == \"G\":\n print(\"C\")\nelif b == \"T\":\n print(\"A\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nOn the Planet AtCoder, there are four types of bases: A, C, G and T. A bonds with T, and C bonds with G.\n\nYou are given a letter b as input, which is A, C, G or T. Write a program that prints the letter representing the base that bonds with the base b.\n\nConstraints\n\nb is one of the letters A, C, G and T.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nb\n\nOutput\n\nPrint the letter representing the base that bonds with the base b.\n\nSample Input 1\n\nA\n\nSample Output 1\n\nT\n\nSample Input 2\n\nG\n\nSample Output 2\n\nC", "sample_input": "A\n"}, "reference_outputs": ["T\n"], "source_document_id": "p03085", "source_text": "Score : 100 points\n\nProblem Statement\n\nOn the Planet AtCoder, there are four types of bases: A, C, G and T. A bonds with T, and C bonds with G.\n\nYou are given a letter b as input, which is A, C, G or T. Write a program that prints the letter representing the base that bonds with the base b.\n\nConstraints\n\nb is one of the letters A, C, G and T.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nb\n\nOutput\n\nPrint the letter representing the base that bonds with the base b.\n\nSample Input 1\n\nA\n\nSample Output 1\n\nT\n\nSample Input 2\n\nG\n\nSample Output 2\n\nC", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 121, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s400230096", "group_id": "codeNet:p03086", "input_text": "lngs = input()\n\nACGT = [\"A\", \"C\", \"G\", \"T\"]\nout_list = []\n\nfor lng in lngs:\n if lng in ACGT:\n out_list += lng\nout = ''.join(out_list)\nprint(out)", "language": "Python", "metadata": {"date": 1596122690, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03086.html", "problem_id": "p03086", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03086/input.txt", "sample_output_relpath": "derived/input_output/data/p03086/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03086/Python/s400230096.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s400230096", "user_id": "u515128734"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "lngs = input()\n\nACGT = [\"A\", \"C\", \"G\", \"T\"]\nout_list = []\n\nfor lng in lngs:\n if lng in ACGT:\n out_list += lng\nout = ''.join(out_list)\nprint(out)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.\n\nHere, a ACGT string is a string that contains no characters other than A, C, G and T.\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\nS is a string of length between 1 and 10 (inclusive).\n\nEach character in S is an uppercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the length of the longest ACGT string that is a substring of S.\n\nSample Input 1\n\nATCODER\n\nSample Output 1\n\n3\n\nAmong the ACGT strings that are substrings of ATCODER, the longest one is ATC.\n\nSample Input 2\n\nHATAGAYA\n\nSample Output 2\n\n5\n\nAmong the ACGT strings that are substrings of HATAGAYA, the longest one is ATAGA.\n\nSample Input 3\n\nSHINJUKU\n\nSample Output 3\n\n0\n\nAmong the ACGT strings that are substrings of SHINJUKU, the longest one is (the empty string).", "sample_input": "ATCODER\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03086", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.\n\nHere, a ACGT string is a string that contains no characters other than A, C, G and T.\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\nS is a string of length between 1 and 10 (inclusive).\n\nEach character in S is an uppercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the length of the longest ACGT string that is a substring of S.\n\nSample Input 1\n\nATCODER\n\nSample Output 1\n\n3\n\nAmong the ACGT strings that are substrings of ATCODER, the longest one is ATC.\n\nSample Input 2\n\nHATAGAYA\n\nSample Output 2\n\n5\n\nAmong the ACGT strings that are substrings of HATAGAYA, the longest one is ATAGA.\n\nSample Input 3\n\nSHINJUKU\n\nSample Output 3\n\n0\n\nAmong the ACGT strings that are substrings of SHINJUKU, the longest one is (the empty string).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 154, "cpu_time_ms": 27, "memory_kb": 9004}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s799567253", "group_id": "codeNet:p03086", "input_text": "S = list(input())\nn = []\na = 0\nfor s in S :\n\tif s in [\"A\",\"T\",\"G\",\"C\"] :\n\t\ta += 1\n\telse :\n\t\tn.append(a if a > 0 else 0)\n\t\ta = 0\nprint(max(n))", "language": "Python", "metadata": {"date": 1558510327, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03086.html", "problem_id": "p03086", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03086/input.txt", "sample_output_relpath": "derived/input_output/data/p03086/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03086/Python/s799567253.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s799567253", "user_id": "u816919571"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "S = list(input())\nn = []\na = 0\nfor s in S :\n\tif s in [\"A\",\"T\",\"G\",\"C\"] :\n\t\ta += 1\n\telse :\n\t\tn.append(a if a > 0 else 0)\n\t\ta = 0\nprint(max(n))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.\n\nHere, a ACGT string is a string that contains no characters other than A, C, G and T.\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\nS is a string of length between 1 and 10 (inclusive).\n\nEach character in S is an uppercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the length of the longest ACGT string that is a substring of S.\n\nSample Input 1\n\nATCODER\n\nSample Output 1\n\n3\n\nAmong the ACGT strings that are substrings of ATCODER, the longest one is ATC.\n\nSample Input 2\n\nHATAGAYA\n\nSample Output 2\n\n5\n\nAmong the ACGT strings that are substrings of HATAGAYA, the longest one is ATAGA.\n\nSample Input 3\n\nSHINJUKU\n\nSample Output 3\n\n0\n\nAmong the ACGT strings that are substrings of SHINJUKU, the longest one is (the empty string).", "sample_input": "ATCODER\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03086", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.\n\nHere, a ACGT string is a string that contains no characters other than A, C, G and T.\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\nS is a string of length between 1 and 10 (inclusive).\n\nEach character in S is an uppercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the length of the longest ACGT string that is a substring of S.\n\nSample Input 1\n\nATCODER\n\nSample Output 1\n\n3\n\nAmong the ACGT strings that are substrings of ATCODER, the longest one is ATC.\n\nSample Input 2\n\nHATAGAYA\n\nSample Output 2\n\n5\n\nAmong the ACGT strings that are substrings of HATAGAYA, the longest one is ATAGA.\n\nSample Input 3\n\nSHINJUKU\n\nSample Output 3\n\n0\n\nAmong the ACGT strings that are substrings of SHINJUKU, the longest one is (the empty string).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 141, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s689643746", "group_id": "codeNet:p03086", "input_text": "S = list(input())\nm = 0\ncount = 0\n\nfor i in range(len(S)):\n for j in range(i, len(S)):\n count = 0\n for s in list(S[i:j+1]):\n if s in ['A', 'G', 'T', 'C']:\n count += 1\n else:\n if m <= count:\n m = count\n count = 0\nprint(m)", "language": "Python", "metadata": {"date": 1553460099, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03086.html", "problem_id": "p03086", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03086/input.txt", "sample_output_relpath": "derived/input_output/data/p03086/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03086/Python/s689643746.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s689643746", "user_id": "u844646164"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "S = list(input())\nm = 0\ncount = 0\n\nfor i in range(len(S)):\n for j in range(i, len(S)):\n count = 0\n for s in list(S[i:j+1]):\n if s in ['A', 'G', 'T', 'C']:\n count += 1\n else:\n if m <= count:\n m = count\n count = 0\nprint(m)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.\n\nHere, a ACGT string is a string that contains no characters other than A, C, G and T.\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\nS is a string of length between 1 and 10 (inclusive).\n\nEach character in S is an uppercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the length of the longest ACGT string that is a substring of S.\n\nSample Input 1\n\nATCODER\n\nSample Output 1\n\n3\n\nAmong the ACGT strings that are substrings of ATCODER, the longest one is ATC.\n\nSample Input 2\n\nHATAGAYA\n\nSample Output 2\n\n5\n\nAmong the ACGT strings that are substrings of HATAGAYA, the longest one is ATAGA.\n\nSample Input 3\n\nSHINJUKU\n\nSample Output 3\n\n0\n\nAmong the ACGT strings that are substrings of SHINJUKU, the longest one is (the empty string).", "sample_input": "ATCODER\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03086", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.\n\nHere, a ACGT string is a string that contains no characters other than A, C, G and T.\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\nS is a string of length between 1 and 10 (inclusive).\n\nEach character in S is an uppercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the length of the longest ACGT string that is a substring of S.\n\nSample Input 1\n\nATCODER\n\nSample Output 1\n\n3\n\nAmong the ACGT strings that are substrings of ATCODER, the longest one is ATC.\n\nSample Input 2\n\nHATAGAYA\n\nSample Output 2\n\n5\n\nAmong the ACGT strings that are substrings of HATAGAYA, the longest one is ATAGA.\n\nSample Input 3\n\nSHINJUKU\n\nSample Output 3\n\n0\n\nAmong the ACGT strings that are substrings of SHINJUKU, the longest one is (the empty string).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 323, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s427180874", "group_id": "codeNet:p03087", "input_text": "n,q=map(int,input().split())\ns=input()\nlr=[list(map(int,input().split())) for _ in range(q)]\nL=[0,0]\nc=0\nfor i in range(1,n):\n\tif s[i-1]=='A' and s[i]=='C':\n\t\tc += 1\n\tL.append(c)\nprint(L)\nfor l,r in lr:\n\tprint(L[r]-L[l])", "language": "Python", "metadata": {"date": 1581369703, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03087.html", "problem_id": "p03087", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03087/input.txt", "sample_output_relpath": "derived/input_output/data/p03087/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03087/Python/s427180874.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s427180874", "user_id": "u857070771"}, "prompt_components": {"gold_output": "2\n0\n3\n", "input_to_evaluate": "n,q=map(int,input().split())\ns=input()\nlr=[list(map(int,input().split())) for _ in range(q)]\nL=[0,0]\nc=0\nfor i in range(1,n):\n\tif s[i-1]=='A' and s[i]=='C':\n\t\tc += 1\n\tL.append(c)\nprint(L)\nfor l,r in lr:\n\tprint(L[r]-L[l])", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "sample_input": "8 3\nACACTACG\n3 7\n2 3\n1 8\n"}, "reference_outputs": ["2\n0\n3\n"], "source_document_id": "p03087", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 220, "cpu_time_ms": 457, "memory_kb": 31964}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s399034052", "group_id": "codeNet:p03087", "input_text": "N, Q = map(int, input().split())\nS = input()\nns = [-1]*N\nn = 0\nns[0] = n\nfor i in range(N-1):\n if S[i:i+2] == \"AC\":\n n += 1\n ns[i+1] = n\n#print(ns)\nfor i in range(Q):\n l, r = map(int, input().split())\n l, r = l-1, r-1\n c = ns[r]-ns[l]\n print(c)\n", "language": "Python", "metadata": {"date": 1568219043, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03087.html", "problem_id": "p03087", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03087/input.txt", "sample_output_relpath": "derived/input_output/data/p03087/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03087/Python/s399034052.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s399034052", "user_id": "u792670114"}, "prompt_components": {"gold_output": "2\n0\n3\n", "input_to_evaluate": "N, Q = map(int, input().split())\nS = input()\nns = [-1]*N\nn = 0\nns[0] = n\nfor i in range(N-1):\n if S[i:i+2] == \"AC\":\n n += 1\n ns[i+1] = n\n#print(ns)\nfor i in range(Q):\n l, r = map(int, input().split())\n l, r = l-1, r-1\n c = ns[r]-ns[l]\n print(c)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "sample_input": "8 3\nACACTACG\n3 7\n2 3\n1 8\n"}, "reference_outputs": ["2\n0\n3\n"], "source_document_id": "p03087", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 254, "cpu_time_ms": 891, "memory_kb": 6060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s845382009", "group_id": "codeNet:p03087", "input_text": "n, q = map(int,input().split())\ns = input()\nruiseki = [0]*(n+1)\nfor i in range(n):\n if s[i:i+2] == 'AC':\n ac = 1\n else:\n ac = 0\n ruiseki[i+1] = ruiseki[i] + ac\nans_list = []\nfor i in range(q):\n l,r = map(int,input().split())\n ans_list.append(ruiseki[r-1]-ruiseki[l-1])\nfor i in range(q):\n print(ans_list[i])", "language": "Python", "metadata": {"date": 1556022330, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03087.html", "problem_id": "p03087", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03087/input.txt", "sample_output_relpath": "derived/input_output/data/p03087/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03087/Python/s845382009.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s845382009", "user_id": "u185354171"}, "prompt_components": {"gold_output": "2\n0\n3\n", "input_to_evaluate": "n, q = map(int,input().split())\ns = input()\nruiseki = [0]*(n+1)\nfor i in range(n):\n if s[i:i+2] == 'AC':\n ac = 1\n else:\n ac = 0\n ruiseki[i+1] = ruiseki[i] + ac\nans_list = []\nfor i in range(q):\n l,r = map(int,input().split())\n ans_list.append(ruiseki[r-1]-ruiseki[l-1])\nfor i in range(q):\n print(ans_list[i])", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "sample_input": "8 3\nACACTACG\n3 7\n2 3\n1 8\n"}, "reference_outputs": ["2\n0\n3\n"], "source_document_id": "p03087", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 339, "cpu_time_ms": 424, "memory_kb": 11876}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s687466090", "group_id": "codeNet:p03087", "input_text": "N,Q=map(int,input().split()) \nS=input()\nt = [0] * (N + 1)\nfor i in range(N):\n t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)\nfor i in range(Q):\n l, r = map(int, input().split())\n print(t[r-1] - t[l-1])", "language": "Python", "metadata": {"date": 1555841614, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03087.html", "problem_id": "p03087", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03087/input.txt", "sample_output_relpath": "derived/input_output/data/p03087/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03087/Python/s687466090.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s687466090", "user_id": "u556225812"}, "prompt_components": {"gold_output": "2\n0\n3\n", "input_to_evaluate": "N,Q=map(int,input().split()) \nS=input()\nt = [0] * (N + 1)\nfor i in range(N):\n t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)\nfor i in range(Q):\n l, r = map(int, input().split())\n print(t[r-1] - t[l-1])", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "sample_input": "8 3\nACACTACG\n3 7\n2 3\n1 8\n"}, "reference_outputs": ["2\n0\n3\n"], "source_document_id": "p03087", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 216, "cpu_time_ms": 887, "memory_kb": 7748}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s140827708", "group_id": "codeNet:p03087", "input_text": "[n,q] = [int(i) for i in input().split()]\ns = input()\nfor i in range(q):\n [l,r] = [int(i) for i in input().split()]\n print(s[l-1:r].count(\"AC\"))\n", "language": "Python", "metadata": {"date": 1553459147, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03087.html", "problem_id": "p03087", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03087/input.txt", "sample_output_relpath": "derived/input_output/data/p03087/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03087/Python/s140827708.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s140827708", "user_id": "u333139319"}, "prompt_components": {"gold_output": "2\n0\n3\n", "input_to_evaluate": "[n,q] = [int(i) for i in input().split()]\ns = input()\nfor i in range(q):\n [l,r] = [int(i) for i in input().split()]\n print(s[l-1:r].count(\"AC\"))\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "sample_input": "8 3\nACACTACG\n3 7\n2 3\n1 8\n"}, "reference_outputs": ["2\n0\n3\n"], "source_document_id": "p03087", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 151, "cpu_time_ms": 2104, "memory_kb": 3444}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s080734503", "group_id": "codeNet:p03088", "input_text": "# 直前数文字しか影響しないと思えばDPと見当つく\nMOD = 10**9 + 7\nN = int(input())\ndp = [[[[0]*5 for i in range(5)] for i in range(5)] for i in range(N+1)]\n\ndp[0][0][0][0] = 1\nfor n in range(N):\n for i in range(5):\n for j in range(5):\n for k in range(5):\n for l in range(1,5):\n if j == 1 and k == 2 and l == 3: continue # AGC\n if j == 2 and k == 1 and l == 3: continue # GAC\n if j == 1 and k == 3 and l == 2: continue # ACG\n if i == 1 and k == 2 and l == 3: continue # A?GC\n if i == 1 and j == 2 and l == 3: continue # AG?C\n dp[n+1][j][k][l] += dp[n][i][j][k]\n\nans = 0\nfor i in range(1,5):\n for j in range(1,5):\n for k in range(1,5):\n ans += dp[N][i][j][k]\n ans %= MOD\nprint(ans)\n\n", "language": "Python", "metadata": {"date": 1586465207, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03088.html", "problem_id": "p03088", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03088/input.txt", "sample_output_relpath": "derived/input_output/data/p03088/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03088/Python/s080734503.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s080734503", "user_id": "u503228842"}, "prompt_components": {"gold_output": "61\n", "input_to_evaluate": "# 直前数文字しか影響しないと思えばDPと見当つく\nMOD = 10**9 + 7\nN = int(input())\ndp = [[[[0]*5 for i in range(5)] for i in range(5)] for i in range(N+1)]\n\ndp[0][0][0][0] = 1\nfor n in range(N):\n for i in range(5):\n for j in range(5):\n for k in range(5):\n for l in range(1,5):\n if j == 1 and k == 2 and l == 3: continue # AGC\n if j == 2 and k == 1 and l == 3: continue # GAC\n if j == 1 and k == 3 and l == 2: continue # ACG\n if i == 1 and k == 2 and l == 3: continue # A?GC\n if i == 1 and j == 2 and l == 3: continue # AG?C\n dp[n+1][j][k][l] += dp[n][i][j][k]\n\nans = 0\nfor i in range(1,5):\n for j in range(1,5):\n for k in range(1,5):\n ans += dp[N][i][j][k]\n ans %= MOD\nprint(ans)\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7:\n\nThe string does not contain characters other than A, C, G and T.\n\nThe string does not contain AGC as a substring.\n\nThe condition above cannot be violated by swapping two adjacent characters once.\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of strings of length N that satisfy the following conditions, modulo 10^9+7.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n61\n\nThere are 4^3 = 64 strings of length 3 that do not contain characters other than A, C, G and T. Among them, only AGC, ACG and GAC violate the condition, so the answer is 64 - 3 = 61.\n\nSample Input 2\n\n4\n\nSample Output 2\n\n230\n\nSample Input 3\n\n100\n\nSample Output 3\n\n388130742\n\nBe sure to print the number of strings modulo 10^9+7.", "sample_input": "3\n"}, "reference_outputs": ["61\n"], "source_document_id": "p03088", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7:\n\nThe string does not contain characters other than A, C, G and T.\n\nThe string does not contain AGC as a substring.\n\nThe condition above cannot be violated by swapping two adjacent characters once.\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of strings of length N that satisfy the following conditions, modulo 10^9+7.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n61\n\nThere are 4^3 = 64 strings of length 3 that do not contain characters other than A, C, G and T. Among them, only AGC, ACG and GAC violate the condition, so the answer is 64 - 3 = 61.\n\nSample Input 2\n\n4\n\nSample Output 2\n\n230\n\nSample Input 3\n\n100\n\nSample Output 3\n\n388130742\n\nBe sure to print the number of strings modulo 10^9+7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 886, "cpu_time_ms": 51, "memory_kb": 3572}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s429174260", "group_id": "codeNet:p03090", "input_text": "N = int(input())\n\nif N % 2 == 0:\n #偶数の場合 i , N+1-i ペア以外を出力\n print(N*(N-2)//2)\n for i in range(1,N+1):\n for j in range(i+1,N+1):\n if i + j == N+1:\n continue\n print(i,j)\nelse:\n #奇数の場合 i, N-i ペア以外を出力\n print(((N-1)**2)//2)\n for i in range(1,N+1):\n for j in range(i+1,N+1):\n if i + j == N:\n continue\n print(i,j)", "language": "Python", "metadata": {"date": 1553377548, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03090.html", "problem_id": "p03090", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03090/input.txt", "sample_output_relpath": "derived/input_output/data/p03090/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03090/Python/s429174260.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s429174260", "user_id": "u391731808"}, "prompt_components": {"gold_output": "2\n1 3\n2 3\n", "input_to_evaluate": "N = int(input())\n\nif N % 2 == 0:\n #偶数の場合 i , N+1-i ペア以外を出力\n print(N*(N-2)//2)\n for i in range(1,N+1):\n for j in range(i+1,N+1):\n if i + j == N+1:\n continue\n print(i,j)\nelse:\n #奇数の場合 i, N-i ペア以外を出力\n print(((N-1)**2)//2)\n for i in range(1,N+1):\n for j in range(i+1,N+1):\n if i + j == N:\n continue\n print(i,j)", "problem_context": "Score : 700 points\n\nProblem Statement\n\nYou are given an integer N.\nBuild an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions:\n\nThe graph is simple and connected.\n\nThere exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S.\n\nIt can be proved that at least one such graph exists under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIn the first line, print the number of edges, M, in the graph you made. In the i-th of the following M lines, print two integers a_i and b_i, representing the endpoints of the i-th edge.\n\nThe output will be judged correct if the graph satisfies the conditions.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n2\n1 3\n2 3\n\nFor every vertex, the sum of the indices of the vertices adjacent to that vertex is 3.", "sample_input": "3\n"}, "reference_outputs": ["2\n1 3\n2 3\n"], "source_document_id": "p03090", "source_text": "Score : 700 points\n\nProblem Statement\n\nYou are given an integer N.\nBuild an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions:\n\nThe graph is simple and connected.\n\nThere exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S.\n\nIt can be proved that at least one such graph exists under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIn the first line, print the number of edges, M, in the graph you made. In the i-th of the following M lines, print two integers a_i and b_i, representing the endpoints of the i-th edge.\n\nThe output will be judged correct if the graph satisfies the conditions.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n2\n1 3\n2 3\n\nFor every vertex, the sum of the indices of the vertices adjacent to that vertex is 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 460, "cpu_time_ms": 24, "memory_kb": 3612}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s284075389", "group_id": "codeNet:p03095", "input_text": "import sys\nsys.setrecursionlimit(10 ** 9)\n# input = sys.stdin.readline ####\ndef int1(x): return int(x) - 1\ndef II(): return int(input())\ndef MI(): return map(int, input().split())\ndef MI1(): return map(int1, input().split())\ndef LI(): return list(map(int, input().split()))\ndef LI1(): return list(map(int1, input().split()))\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\ndef MS(): return input().split()\ndef LS(): return list(input())\ndef LLS(rows_number): return [LS() for _ in range(rows_number)]\ndef printlist(lst, k=' '): print(k.join(list(map(str, lst))))\nINF = float('inf')\n# from math import ceil, floor, log2\nfrom collections import deque, defaultdict\n# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations\n# from heapq import heapify, heappop, heappush\n# import numpy as np # cumsum\n# from bisect import bisect_left, bisect_right\n\ndef comb(n, r):\n # if n - r < 0: return 0\n if n - r < r: r = n - r\n if r == 0: return 1\n if r == 1: return n\n\n numerator = [n - r + k + 1 for k in range(r)]\n denominator = [k + 1 for k in range(r)]\n\n for p in range(2, r + 1):\n pivot = denominator[p - 1]\n if pivot > 1:\n offset = (n - r) % p\n for k in range(p - 1, r, p):\n numerator[k - offset] /= pivot\n denominator[k] /= pivot\n\n result = 1\n for k in range(r):\n if numerator[k] > 1:\n result *= int(numerator[k])\n\n return result\n\ndef solve():\n N = II()\n S = input()\n\n d = defaultdict(lambda: 0)\n for s in S:\n d[s] += 1\n\n ans = 1\n for n in d.values():\n ans *= (n+1)\n print(ans-1)\n\nif __name__ == '__main__':\n solve()\n\n", "language": "Python", "metadata": {"date": 1598209880, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03095.html", "problem_id": "p03095", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03095/input.txt", "sample_output_relpath": "derived/input_output/data/p03095/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03095/Python/s284075389.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s284075389", "user_id": "u564589929"}, "prompt_components": {"gold_output": "15\n", "input_to_evaluate": "import sys\nsys.setrecursionlimit(10 ** 9)\n# input = sys.stdin.readline ####\ndef int1(x): return int(x) - 1\ndef II(): return int(input())\ndef MI(): return map(int, input().split())\ndef MI1(): return map(int1, input().split())\ndef LI(): return list(map(int, input().split()))\ndef LI1(): return list(map(int1, input().split()))\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\ndef MS(): return input().split()\ndef LS(): return list(input())\ndef LLS(rows_number): return [LS() for _ in range(rows_number)]\ndef printlist(lst, k=' '): print(k.join(list(map(str, lst))))\nINF = float('inf')\n# from math import ceil, floor, log2\nfrom collections import deque, defaultdict\n# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations\n# from heapq import heapify, heappop, heappush\n# import numpy as np # cumsum\n# from bisect import bisect_left, bisect_right\n\ndef comb(n, r):\n # if n - r < 0: return 0\n if n - r < r: r = n - r\n if r == 0: return 1\n if r == 1: return n\n\n numerator = [n - r + k + 1 for k in range(r)]\n denominator = [k + 1 for k in range(r)]\n\n for p in range(2, r + 1):\n pivot = denominator[p - 1]\n if pivot > 1:\n offset = (n - r) % p\n for k in range(p - 1, r, p):\n numerator[k - offset] /= pivot\n denominator[k] /= pivot\n\n result = 1\n for k in range(r):\n if numerator[k] > 1:\n result *= int(numerator[k])\n\n return result\n\ndef solve():\n N = II()\n S = input()\n\n d = defaultdict(lambda: 0)\n for s in S:\n d[s] += 1\n\n ans = 1\n for n in d.values():\n ans *= (n+1)\n print(ans-1)\n\nif __name__ == '__main__':\n solve()\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S of length N.\nAmong its subsequences, count the ones such that all characters are different, modulo 10^9+7. Two subsequences are considered different if their characters come from different positions in the string, even if they are the same as strings.\n\nHere, a subsequence of a string is a concatenation of one or more characters from the string without changing the order.\n\nConstraints\n\n1 \\leq N \\leq 100000\n\nS consists of lowercase English letters.\n\n|S|=N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of the subsequences such that all characters are different, modulo 10^9+7.\n\nSample Input 1\n\n4\nabcd\n\nSample Output 1\n\n15\n\nSince all characters in S itself are different, all its subsequences satisfy the condition.\n\nSample Input 2\n\n3\nbaa\n\nSample Output 2\n\n5\n\nThe answer is five: b, two occurrences of a, two occurrences of ba. Note that we do not count baa, since it contains two as.\n\nSample Input 3\n\n5\nabcab\n\nSample Output 3\n\n17", "sample_input": "4\nabcd\n"}, "reference_outputs": ["15\n"], "source_document_id": "p03095", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S of length N.\nAmong its subsequences, count the ones such that all characters are different, modulo 10^9+7. Two subsequences are considered different if their characters come from different positions in the string, even if they are the same as strings.\n\nHere, a subsequence of a string is a concatenation of one or more characters from the string without changing the order.\n\nConstraints\n\n1 \\leq N \\leq 100000\n\nS consists of lowercase English letters.\n\n|S|=N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of the subsequences such that all characters are different, modulo 10^9+7.\n\nSample Input 1\n\n4\nabcd\n\nSample Output 1\n\n15\n\nSince all characters in S itself are different, all its subsequences satisfy the condition.\n\nSample Input 2\n\n3\nbaa\n\nSample Output 2\n\n5\n\nThe answer is five: b, two occurrences of a, two occurrences of ba. Note that we do not count baa, since it contains two as.\n\nSample Input 3\n\n5\nabcab\n\nSample Output 3\n\n17", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1748, "cpu_time_ms": 38, "memory_kb": 9440}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s391760074", "group_id": "codeNet:p03101", "input_text": "H,W = map(int,input().split())\nh,w = map(int,input().split())\nprint((H-h)*(W-w))", "language": "Python", "metadata": {"date": 1576066019, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03101.html", "problem_id": "p03101", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03101/input.txt", "sample_output_relpath": "derived/input_output/data/p03101/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03101/Python/s391760074.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s391760074", "user_id": "u278670845"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "H,W = map(int,input().split())\nh,w = map(int,input().split())\nprint((H-h)*(W-w))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are H rows and W columns of white square cells.\n\nYou will choose h of the rows and w of the columns, and paint all of the cells contained in those rows or columns.\n\nHow many white cells will remain?\n\nIt can be proved that this count does not depend on what rows and columns are chosen.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 20\n\n1 \\leq h \\leq H\n\n1 \\leq w \\leq W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nh w\n\nOutput\n\nPrint the number of white cells that will remain.\n\nSample Input 1\n\n3 2\n2 1\n\nSample Output 1\n\n1\n\nThere are 3 rows and 2 columns of cells. When two rows and one column are chosen and painted in black, there is always one white cell that remains.\n\nSample Input 2\n\n5 5\n2 3\n\nSample Output 2\n\n6\n\nSample Input 3\n\n2 4\n2 4\n\nSample Output 3\n\n0", "sample_input": "3 2\n2 1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03101", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are H rows and W columns of white square cells.\n\nYou will choose h of the rows and w of the columns, and paint all of the cells contained in those rows or columns.\n\nHow many white cells will remain?\n\nIt can be proved that this count does not depend on what rows and columns are chosen.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 20\n\n1 \\leq h \\leq H\n\n1 \\leq w \\leq W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nh w\n\nOutput\n\nPrint the number of white cells that will remain.\n\nSample Input 1\n\n3 2\n2 1\n\nSample Output 1\n\n1\n\nThere are 3 rows and 2 columns of cells. When two rows and one column are chosen and painted in black, there is always one white cell that remains.\n\nSample Input 2\n\n5 5\n2 3\n\nSample Output 2\n\n6\n\nSample Input 3\n\n2 4\n2 4\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 80, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s100295538", "group_id": "codeNet:p03102", "input_text": "n,m,c=map(int,input().split())\nb=list(map(int,input().split()))\ncount=0\nfor i in range(n):\n ans=0\n a=list(map(int,input().split()))\n for i in range(m):\n ans+=a[i]*b[i]\n if ans+c>0:\n count+=1\nprint(count)", "language": "Python", "metadata": {"date": 1598437078, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03102.html", "problem_id": "p03102", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03102/input.txt", "sample_output_relpath": "derived/input_output/data/p03102/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03102/Python/s100295538.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s100295538", "user_id": "u910632349"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "n,m,c=map(int,input().split())\nb=list(map(int,input().split()))\ncount=0\nfor i in range(n):\n ans=0\n a=list(map(int,input().split()))\n for i in range(m):\n ans+=a[i]*b[i]\n if ans+c>0:\n count+=1\nprint(count)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N pieces of source code. The characteristics of the i-th code is represented by M integers A_{i1}, A_{i2}, ..., A_{iM}.\n\nAdditionally, you are given integers B_1, B_2, ..., B_M and C.\n\nThe i-th code correctly solves this problem if and only if A_{i1} B_1 + A_{i2} B_2 + ... + A_{iM} B_M + C > 0.\n\nAmong the N codes, find the number of codes that correctly solve this problem.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 20\n\n-100 \\leq A_{ij} \\leq 100\n\n-100 \\leq B_i \\leq 100\n\n-100 \\leq C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M C\nB_1 B_2 ... B_M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n\\vdots\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the number of codes among the given N codes that correctly solve this problem.\n\nSample Input 1\n\n2 3 -10\n1 2 3\n3 2 1\n1 2 2\n\nSample Output 1\n\n1\n\nOnly the second code correctly solves this problem, as follows:\n\nSince 3 \\times 1 + 2 \\times 2 + 1 \\times 3 + (-10) = 0 \\leq 0, the first code does not solve this problem.\n\n1 \\times 1 + 2 \\times 2 + 2 \\times 3 + (-10) = 1 > 0, the second code solves this problem.\n\nSample Input 2\n\n5 2 -4\n-2 5\n100 41\n100 40\n-3 0\n-6 -2\n18 -13\n\nSample Output 2\n\n2\n\nSample Input 3\n\n3 3 0\n100 -100 0\n0 100 100\n100 100 100\n-100 100 100\n\nSample Output 3\n\n0\n\nAll of them are Wrong Answer. Except yours.", "sample_input": "2 3 -10\n1 2 3\n3 2 1\n1 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03102", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N pieces of source code. The characteristics of the i-th code is represented by M integers A_{i1}, A_{i2}, ..., A_{iM}.\n\nAdditionally, you are given integers B_1, B_2, ..., B_M and C.\n\nThe i-th code correctly solves this problem if and only if A_{i1} B_1 + A_{i2} B_2 + ... + A_{iM} B_M + C > 0.\n\nAmong the N codes, find the number of codes that correctly solve this problem.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 20\n\n-100 \\leq A_{ij} \\leq 100\n\n-100 \\leq B_i \\leq 100\n\n-100 \\leq C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M C\nB_1 B_2 ... B_M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n\\vdots\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the number of codes among the given N codes that correctly solve this problem.\n\nSample Input 1\n\n2 3 -10\n1 2 3\n3 2 1\n1 2 2\n\nSample Output 1\n\n1\n\nOnly the second code correctly solves this problem, as follows:\n\nSince 3 \\times 1 + 2 \\times 2 + 1 \\times 3 + (-10) = 0 \\leq 0, the first code does not solve this problem.\n\n1 \\times 1 + 2 \\times 2 + 2 \\times 3 + (-10) = 1 > 0, the second code solves this problem.\n\nSample Input 2\n\n5 2 -4\n-2 5\n100 41\n100 40\n-3 0\n-6 -2\n18 -13\n\nSample Output 2\n\n2\n\nSample Input 3\n\n3 3 0\n100 -100 0\n0 100 100\n100 100 100\n-100 100 100\n\nSample Output 3\n\n0\n\nAll of them are Wrong Answer. Except yours.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 229, "cpu_time_ms": 29, "memory_kb": 9096}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s203320165", "group_id": "codeNet:p03103", "input_text": "n,m = map( int, input().split() )\nab = []\nfor _ in range(n):\n ab.append( list( map( int, input().split() ) ) )\n\nab.sort()\nsum_money = 0\nfor i in range(n):\n if m > ab[i][1]:\n sum_money += ab[i][0]*ab[i][1]\n m -= ab[i][1]\n else:\n sum_money += ab[i][0]*m\n break\n\nprint(sum_money)", "language": "Python", "metadata": {"date": 1565874798, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03103.html", "problem_id": "p03103", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03103/input.txt", "sample_output_relpath": "derived/input_output/data/p03103/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03103/Python/s203320165.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s203320165", "user_id": "u917101497"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "n,m = map( int, input().split() )\nab = []\nfor _ in range(n):\n ab.append( list( map( int, input().split() ) ) )\n\nab.sort()\nsum_money = 0\nfor i in range(n):\n if m > ab[i][1]:\n sum_money += ab[i][0]*ab[i][1]\n m -= ab[i][1]\n else:\n sum_money += ab[i][0]*m\n break\n\nprint(sum_money)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nHearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.\n\nThere are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.\n\nWhat is the minimum amount of money with which he can buy M cans of energy drinks?\n\nIt is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^5\n\nB_1 + ... + B_N \\geq M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the minimum amount of money with which Takahashi can buy M cans of energy drinks.\n\nSample Input 1\n\n2 5\n4 9\n2 4\n\nSample Output 1\n\n12\n\nWith 12 yen, we can buy one drink at the first store and four drinks at the second store, for the total of five drinks. However, we cannot buy 5 drinks with 11 yen or less.\n\nSample Input 2\n\n4 30\n6 18\n2 5\n3 10\n7 9\n\nSample Output 2\n\n130\n\nSample Input 3\n\n1 100000\n1000000000 100000\n\nSample Output 3\n\n100000000000000\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "2 5\n4 9\n2 4\n"}, "reference_outputs": ["12\n"], "source_document_id": "p03103", "source_text": "Score : 300 points\n\nProblem Statement\n\nHearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.\n\nThere are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.\n\nWhat is the minimum amount of money with which he can buy M cans of energy drinks?\n\nIt is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^5\n\nB_1 + ... + B_N \\geq M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the minimum amount of money with which Takahashi can buy M cans of energy drinks.\n\nSample Input 1\n\n2 5\n4 9\n2 4\n\nSample Output 1\n\n12\n\nWith 12 yen, we can buy one drink at the first store and four drinks at the second store, for the total of five drinks. However, we cannot buy 5 drinks with 11 yen or less.\n\nSample Input 2\n\n4 30\n6 18\n2 5\n3 10\n7 9\n\nSample Output 2\n\n130\n\nSample Input 3\n\n1 100000\n1000000000 100000\n\nSample Output 3\n\n100000000000000\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 313, "cpu_time_ms": 850, "memory_kb": 60792}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s165581278", "group_id": "codeNet:p03106", "input_text": "A,B,K = [int(x) for x in input().split()]\ncnt =0\nfor i in range(1,max(A,B)):\n if A%i==0 and B%i==0:\n cnt+=1\n if cnt==K:\n print(i)", "language": "Python", "metadata": {"date": 1568021875, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03106.html", "problem_id": "p03106", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03106/input.txt", "sample_output_relpath": "derived/input_output/data/p03106/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03106/Python/s165581278.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s165581278", "user_id": "u466331465"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "A,B,K = [int(x) for x in input().split()]\ncnt =0\nfor i in range(1,max(A,B)):\n if A%i==0 and B%i==0:\n cnt+=1\n if cnt==K:\n print(i)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given positive integers A and B.\n\nFind the K-th largest positive integer that divides both A and B.\n\nThe input guarantees that there exists such a number.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 100\n\nThe K-th largest positive integer that divides both A and B exists.\n\nK \\geq 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the K-th largest positive integer that divides both A and B.\n\nSample Input 1\n\n8 12 2\n\nSample Output 1\n\n2\n\nThree positive integers divides both 8 and 12: 1, 2 and 4.\nAmong them, the second largest is 2.\n\nSample Input 2\n\n100 50 4\n\nSample Output 2\n\n5\n\nSample Input 3\n\n1 1 1\n\nSample Output 3\n\n1", "sample_input": "8 12 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03106", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given positive integers A and B.\n\nFind the K-th largest positive integer that divides both A and B.\n\nThe input guarantees that there exists such a number.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 100\n\nThe K-th largest positive integer that divides both A and B exists.\n\nK \\geq 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the K-th largest positive integer that divides both A and B.\n\nSample Input 1\n\n8 12 2\n\nSample Output 1\n\n2\n\nThree positive integers divides both 8 and 12: 1, 2 and 4.\nAmong them, the second largest is 2.\n\nSample Input 2\n\n100 50 4\n\nSample Output 2\n\n5\n\nSample Input 3\n\n1 1 1\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 141, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s736740012", "group_id": "codeNet:p03106", "input_text": "A, B, K = map(int, input().split())\nl = []\nfor i in range(1, 101):\n if A % i == 0 and B % i == 0:\n l.append(i)\nl.sort(reverse=True)\nprint(l[K - 1])", "language": "Python", "metadata": {"date": 1555022008, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03106.html", "problem_id": "p03106", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03106/input.txt", "sample_output_relpath": "derived/input_output/data/p03106/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03106/Python/s736740012.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s736740012", "user_id": "u363610900"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "A, B, K = map(int, input().split())\nl = []\nfor i in range(1, 101):\n if A % i == 0 and B % i == 0:\n l.append(i)\nl.sort(reverse=True)\nprint(l[K - 1])", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given positive integers A and B.\n\nFind the K-th largest positive integer that divides both A and B.\n\nThe input guarantees that there exists such a number.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 100\n\nThe K-th largest positive integer that divides both A and B exists.\n\nK \\geq 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the K-th largest positive integer that divides both A and B.\n\nSample Input 1\n\n8 12 2\n\nSample Output 1\n\n2\n\nThree positive integers divides both 8 and 12: 1, 2 and 4.\nAmong them, the second largest is 2.\n\nSample Input 2\n\n100 50 4\n\nSample Output 2\n\n5\n\nSample Input 3\n\n1 1 1\n\nSample Output 3\n\n1", "sample_input": "8 12 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03106", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given positive integers A and B.\n\nFind the K-th largest positive integer that divides both A and B.\n\nThe input guarantees that there exists such a number.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 100\n\nThe K-th largest positive integer that divides both A and B exists.\n\nK \\geq 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the K-th largest positive integer that divides both A and B.\n\nSample Input 1\n\n8 12 2\n\nSample Output 1\n\n2\n\nThree positive integers divides both 8 and 12: 1, 2 and 4.\nAmong them, the second largest is 2.\n\nSample Input 2\n\n100 50 4\n\nSample Output 2\n\n5\n\nSample Input 3\n\n1 1 1\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 157, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s139291145", "group_id": "codeNet:p03107", "input_text": "s = input()\ncnt0 = s.count('0')\ncnt1 = s.count('1')\nprint(min(cnt0, cnt1) * 2)", "language": "Python", "metadata": {"date": 1588846915, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03107.html", "problem_id": "p03107", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03107/input.txt", "sample_output_relpath": "derived/input_output/data/p03107/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03107/Python/s139291145.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s139291145", "user_id": "u131264627"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "s = input()\ncnt0 = s.count('0')\ncnt1 = s.count('1')\nprint(min(cnt0, cnt1) * 2)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N cubes stacked vertically on a desk.\n\nYou are given a string S of length N. The color of the i-th cube from the bottom is red if the i-th character in S is 0, and blue if that character is 1.\n\nYou can perform the following operation any number of times: choose a red cube and a blue cube that are adjacent, and remove them. Here, the cubes that were stacked on the removed cubes will fall down onto the object below them.\n\nAt most how many cubes can be removed?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n|S| = N\n\nEach character in S is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of cubes that can be removed.\n\nSample Input 1\n\n0011\n\nSample Output 1\n\n4\n\nAll four cubes can be removed, by performing the operation as follows:\n\nRemove the second and third cubes from the bottom. Then, the fourth cube drops onto the first cube.\n\nRemove the first and second cubes from the bottom.\n\nSample Input 2\n\n11011010001011\n\nSample Output 2\n\n12\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "sample_input": "0011\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03107", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N cubes stacked vertically on a desk.\n\nYou are given a string S of length N. The color of the i-th cube from the bottom is red if the i-th character in S is 0, and blue if that character is 1.\n\nYou can perform the following operation any number of times: choose a red cube and a blue cube that are adjacent, and remove them. Here, the cubes that were stacked on the removed cubes will fall down onto the object below them.\n\nAt most how many cubes can be removed?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n|S| = N\n\nEach character in S is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of cubes that can be removed.\n\nSample Input 1\n\n0011\n\nSample Output 1\n\n4\n\nAll four cubes can be removed, by performing the operation as follows:\n\nRemove the second and third cubes from the bottom. Then, the fourth cube drops onto the first cube.\n\nRemove the first and second cubes from the bottom.\n\nSample Input 2\n\n11011010001011\n\nSample Output 2\n\n12\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 78, "cpu_time_ms": 18, "memory_kb": 3188}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s192414052", "group_id": "codeNet:p03107", "input_text": "s = input()\ncnt = 0\nwhile True:\n idx = s.find(\"01\")\n if idx != -1:\n cnt += 2\n s = s[:idx] + s[idx+2:]\n idxx = s.find(\"10\")\n if idxx != -1:\n cnt += 2\n s = s[:idxx] + s[idxx+2:]\n if idx == -1 and idxx == -1:\n break\nprint(cnt)", "language": "Python", "metadata": {"date": 1577756779, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03107.html", "problem_id": "p03107", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03107/input.txt", "sample_output_relpath": "derived/input_output/data/p03107/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03107/Python/s192414052.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s192414052", "user_id": "u633355062"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "s = input()\ncnt = 0\nwhile True:\n idx = s.find(\"01\")\n if idx != -1:\n cnt += 2\n s = s[:idx] + s[idx+2:]\n idxx = s.find(\"10\")\n if idxx != -1:\n cnt += 2\n s = s[:idxx] + s[idxx+2:]\n if idx == -1 and idxx == -1:\n break\nprint(cnt)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N cubes stacked vertically on a desk.\n\nYou are given a string S of length N. The color of the i-th cube from the bottom is red if the i-th character in S is 0, and blue if that character is 1.\n\nYou can perform the following operation any number of times: choose a red cube and a blue cube that are adjacent, and remove them. Here, the cubes that were stacked on the removed cubes will fall down onto the object below them.\n\nAt most how many cubes can be removed?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n|S| = N\n\nEach character in S is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of cubes that can be removed.\n\nSample Input 1\n\n0011\n\nSample Output 1\n\n4\n\nAll four cubes can be removed, by performing the operation as follows:\n\nRemove the second and third cubes from the bottom. Then, the fourth cube drops onto the first cube.\n\nRemove the first and second cubes from the bottom.\n\nSample Input 2\n\n11011010001011\n\nSample Output 2\n\n12\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "sample_input": "0011\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03107", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N cubes stacked vertically on a desk.\n\nYou are given a string S of length N. The color of the i-th cube from the bottom is red if the i-th character in S is 0, and blue if that character is 1.\n\nYou can perform the following operation any number of times: choose a red cube and a blue cube that are adjacent, and remove them. Here, the cubes that were stacked on the removed cubes will fall down onto the object below them.\n\nAt most how many cubes can be removed?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n|S| = N\n\nEach character in S is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of cubes that can be removed.\n\nSample Input 1\n\n0011\n\nSample Output 1\n\n4\n\nAll four cubes can be removed, by performing the operation as follows:\n\nRemove the second and third cubes from the bottom. Then, the fourth cube drops onto the first cube.\n\nRemove the first and second cubes from the bottom.\n\nSample Input 2\n\n11011010001011\n\nSample Output 2\n\n12\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 273, "cpu_time_ms": 2104, "memory_kb": 3412}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s884041736", "group_id": "codeNet:p03107", "input_text": "S = list(input())\nrm = 0\nwhile True:\n length = len(S)\n for i in range(length - 1):\n # print(S)\n # print(f\"1){length} {i} {len(S)}\")\n if (int(S[i]) + int(S[i+1])) == 1:\n rm += 2\n del(S[i:i+2])\n # print(f\"2){length} {i} {len(S)} {S}\")\n break\n else:\n i += 1\n # print(f\"3){length} {i} {len(S)}\")\n if length == len(S):\n break\n i = 0\nprint(rm)", "language": "Python", "metadata": {"date": 1551645857, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03107.html", "problem_id": "p03107", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03107/input.txt", "sample_output_relpath": "derived/input_output/data/p03107/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03107/Python/s884041736.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s884041736", "user_id": "u827141374"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "S = list(input())\nrm = 0\nwhile True:\n length = len(S)\n for i in range(length - 1):\n # print(S)\n # print(f\"1){length} {i} {len(S)}\")\n if (int(S[i]) + int(S[i+1])) == 1:\n rm += 2\n del(S[i:i+2])\n # print(f\"2){length} {i} {len(S)} {S}\")\n break\n else:\n i += 1\n # print(f\"3){length} {i} {len(S)}\")\n if length == len(S):\n break\n i = 0\nprint(rm)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N cubes stacked vertically on a desk.\n\nYou are given a string S of length N. The color of the i-th cube from the bottom is red if the i-th character in S is 0, and blue if that character is 1.\n\nYou can perform the following operation any number of times: choose a red cube and a blue cube that are adjacent, and remove them. Here, the cubes that were stacked on the removed cubes will fall down onto the object below them.\n\nAt most how many cubes can be removed?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n|S| = N\n\nEach character in S is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of cubes that can be removed.\n\nSample Input 1\n\n0011\n\nSample Output 1\n\n4\n\nAll four cubes can be removed, by performing the operation as follows:\n\nRemove the second and third cubes from the bottom. Then, the fourth cube drops onto the first cube.\n\nRemove the first and second cubes from the bottom.\n\nSample Input 2\n\n11011010001011\n\nSample Output 2\n\n12\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "sample_input": "0011\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03107", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N cubes stacked vertically on a desk.\n\nYou are given a string S of length N. The color of the i-th cube from the bottom is red if the i-th character in S is 0, and blue if that character is 1.\n\nYou can perform the following operation any number of times: choose a red cube and a blue cube that are adjacent, and remove them. Here, the cubes that were stacked on the removed cubes will fall down onto the object below them.\n\nAt most how many cubes can be removed?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n|S| = N\n\nEach character in S is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of cubes that can be removed.\n\nSample Input 1\n\n0011\n\nSample Output 1\n\n4\n\nAll four cubes can be removed, by performing the operation as follows:\n\nRemove the second and third cubes from the bottom. Then, the fourth cube drops onto the first cube.\n\nRemove the first and second cubes from the bottom.\n\nSample Input 2\n\n11011010001011\n\nSample Output 2\n\n12\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 442, "cpu_time_ms": 2104, "memory_kb": 3956}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s964945713", "group_id": "codeNet:p03108", "input_text": "import sys\nimport heapq\nimport math\nimport fractions\nimport bisect\nimport itertools\nfrom collections import Counter\nfrom collections import deque\nfrom operator import itemgetter\ndef input(): return sys.stdin.readline().strip()\ndef mp(): return map(int,input().split())\ndef lmp(): return list(map(int,input().split()))\n\n\nclass UnionFind():\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n\n if x == y:\n return\n\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n def size(self, x):\n return -self.parents[self.find(x)]\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n def members(self, x):\n root = self.find(x)\n return [i for i in range(self.n) if self.find(i) == root]\n\n def roots(self):\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n def group_count(self):\n return len(self.roots())\n\n def all_group_members(self):\n return {r: self.members(r) for r in self.roots()}\n\n def __str__(self):\n return '\\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())\n\nn,m=mp()\nl=[]\nfor i in range(m):\n l.append(lmp())\nans=[0]*m \nans[m-1]=n*(n-1)//2\nuf=UnionFind(n+1)\nfor i in range(m-1):\n if not uf.same(l[m-1-i][0],l[m-1-i][1]):\n ans[m-2-i]=ans[m-i-1]-uf.size(l[m-1-i][0])*uf.size(l[m-1-i][1])\n uf.union(l[m-1-i][0],l[m-1-i][1])\nfor a in ans:\n print(a) \n", "language": "Python", "metadata": {"date": 1598037962, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p03108.html", "problem_id": "p03108", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03108/input.txt", "sample_output_relpath": "derived/input_output/data/p03108/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03108/Python/s964945713.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s964945713", "user_id": "u024782094"}, "prompt_components": {"gold_output": "0\n0\n4\n5\n6\n", "input_to_evaluate": "import sys\nimport heapq\nimport math\nimport fractions\nimport bisect\nimport itertools\nfrom collections import Counter\nfrom collections import deque\nfrom operator import itemgetter\ndef input(): return sys.stdin.readline().strip()\ndef mp(): return map(int,input().split())\ndef lmp(): return list(map(int,input().split()))\n\n\nclass UnionFind():\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n\n if x == y:\n return\n\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n\n self.parents[x] += self.parents[y]\n self.parents[y] = x\n\n def size(self, x):\n return -self.parents[self.find(x)]\n\n def same(self, x, y):\n return self.find(x) == self.find(y)\n\n def members(self, x):\n root = self.find(x)\n return [i for i in range(self.n) if self.find(i) == root]\n\n def roots(self):\n return [i for i, x in enumerate(self.parents) if x < 0]\n\n def group_count(self):\n return len(self.roots())\n\n def all_group_members(self):\n return {r: self.members(r) for r in self.roots()}\n\n def __str__(self):\n return '\\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())\n\nn,m=mp()\nl=[]\nfor i in range(m):\n l.append(lmp())\nans=[0]*m \nans[m-1]=n*(n-1)//2\nuf=UnionFind(n+1)\nfor i in range(m-1):\n if not uf.same(l[m-1-i][0],l[m-1-i][1]):\n ans[m-2-i]=ans[m-i-1]-uf.size(l[m-1-i][0])*uf.size(l[m-1-i][1])\n uf.union(l[m-1-i][0],l[m-1-i][1])\nfor a in ans:\n print(a) \n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N islands and M bridges.\n\nThe i-th bridge connects the A_i-th and B_i-th islands bidirectionally.\n\nInitially, we can travel between any two islands using some of these bridges.\n\nHowever, the results of a survey show that these bridges will all collapse because of aging, in the order from the first bridge to the M-th bridge.\n\nLet the inconvenience be the number of pairs of islands (a, b) (a < b) such that we are no longer able to travel between the a-th and b-th islands using some of the bridges remaining.\n\nFor each i (1 \\leq i \\leq M), find the inconvenience just after the i-th bridge collapses.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i < B_i \\leq N\n\nAll pairs (A_i, B_i) are distinct.\n\nThe inconvenience is initially 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_M B_M\n\nOutput\n\nIn the order i = 1, 2, ..., M, print the inconvenience just after the i-th bridge collapses.\nNote that the answer may not fit into a 32-bit integer type.\n\nSample Input 1\n\n4 5\n1 2\n3 4\n1 3\n2 3\n1 4\n\nSample Output 1\n\n0\n0\n4\n5\n6\n\nFor example, when the first to third bridges have collapsed, the inconvenience is 4 since we can no longer travel between the pairs (1, 2), (1, 3), (2, 4) and (3, 4).\n\nSample Input 2\n\n6 5\n2 3\n1 2\n5 6\n3 4\n4 5\n\nSample Output 2\n\n8\n9\n12\n14\n15\n\nSample Input 3\n\n2 1\n1 2\n\nSample Output 3\n\n1", "sample_input": "4 5\n1 2\n3 4\n1 3\n2 3\n1 4\n"}, "reference_outputs": ["0\n0\n4\n5\n6\n"], "source_document_id": "p03108", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N islands and M bridges.\n\nThe i-th bridge connects the A_i-th and B_i-th islands bidirectionally.\n\nInitially, we can travel between any two islands using some of these bridges.\n\nHowever, the results of a survey show that these bridges will all collapse because of aging, in the order from the first bridge to the M-th bridge.\n\nLet the inconvenience be the number of pairs of islands (a, b) (a < b) such that we are no longer able to travel between the a-th and b-th islands using some of the bridges remaining.\n\nFor each i (1 \\leq i \\leq M), find the inconvenience just after the i-th bridge collapses.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i < B_i \\leq N\n\nAll pairs (A_i, B_i) are distinct.\n\nThe inconvenience is initially 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_M B_M\n\nOutput\n\nIn the order i = 1, 2, ..., M, print the inconvenience just after the i-th bridge collapses.\nNote that the answer may not fit into a 32-bit integer type.\n\nSample Input 1\n\n4 5\n1 2\n3 4\n1 3\n2 3\n1 4\n\nSample Output 1\n\n0\n0\n4\n5\n6\n\nFor example, when the first to third bridges have collapsed, the inconvenience is 4 since we can no longer travel between the pairs (1, 2), (1, 3), (2, 4) and (3, 4).\n\nSample Input 2\n\n6 5\n2 3\n1 2\n5 6\n3 4\n4 5\n\nSample Output 2\n\n8\n9\n12\n14\n15\n\nSample Input 3\n\n2 1\n1 2\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1783, "cpu_time_ms": 398, "memory_kb": 97856}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s552758651", "group_id": "codeNet:p03109", "input_text": "# coding: utf-8\n# Your code here!\ns=input()\nt=\"2019/04/30\"\nif s<=t:\n print(\"Heisei\")\nelse :\n print(\"TBD\")", "language": "Python", "metadata": {"date": 1553692716, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03109.html", "problem_id": "p03109", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03109/input.txt", "sample_output_relpath": "derived/input_output/data/p03109/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03109/Python/s552758651.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s552758651", "user_id": "u185896732"}, "prompt_components": {"gold_output": "Heisei\n", "input_to_evaluate": "# coding: utf-8\n# Your code here!\ns=input()\nt=\"2019/04/30\"\nif s<=t:\n print(\"Heisei\")\nelse :\n print(\"TBD\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S as input. This represents a valid date in the year 2019 in the yyyy/mm/dd format. (For example, April 30, 2019 is represented as 2019/04/30.)\n\nWrite a program that prints Heisei if the date represented by S is not later than April 30, 2019, and prints TBD otherwise.\n\nConstraints\n\nS is a string that represents a valid date in the year 2019 in the yyyy/mm/dd format.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint Heisei if the date represented by S is not later than April 30, 2019, and print TBD otherwise.\n\nSample Input 1\n\n2019/04/30\n\nSample Output 1\n\nHeisei\n\nSample Input 2\n\n2019/11/01\n\nSample Output 2\n\nTBD", "sample_input": "2019/04/30\n"}, "reference_outputs": ["Heisei\n"], "source_document_id": "p03109", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S as input. This represents a valid date in the year 2019 in the yyyy/mm/dd format. (For example, April 30, 2019 is represented as 2019/04/30.)\n\nWrite a program that prints Heisei if the date represented by S is not later than April 30, 2019, and prints TBD otherwise.\n\nConstraints\n\nS is a string that represents a valid date in the year 2019 in the yyyy/mm/dd format.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint Heisei if the date represented by S is not later than April 30, 2019, and print TBD otherwise.\n\nSample Input 1\n\n2019/04/30\n\nSample Output 1\n\nHeisei\n\nSample Input 2\n\n2019/11/01\n\nSample Output 2\n\nTBD", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 111, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s196210417", "group_id": "codeNet:p03109", "input_text": "s = str(input())\n\nnexts = s.replace(\"/\",\"\")\n\nsint = int(nexts)\n\nprint(sint)\n\n\nif sint <= 20190430:\n print(\"Heisei\")\nelse:\n print(\"TBD\")\n", "language": "Python", "metadata": {"date": 1552833419, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03109.html", "problem_id": "p03109", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03109/input.txt", "sample_output_relpath": "derived/input_output/data/p03109/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03109/Python/s196210417.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s196210417", "user_id": "u815666840"}, "prompt_components": {"gold_output": "Heisei\n", "input_to_evaluate": "s = str(input())\n\nnexts = s.replace(\"/\",\"\")\n\nsint = int(nexts)\n\nprint(sint)\n\n\nif sint <= 20190430:\n print(\"Heisei\")\nelse:\n print(\"TBD\")\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S as input. This represents a valid date in the year 2019 in the yyyy/mm/dd format. (For example, April 30, 2019 is represented as 2019/04/30.)\n\nWrite a program that prints Heisei if the date represented by S is not later than April 30, 2019, and prints TBD otherwise.\n\nConstraints\n\nS is a string that represents a valid date in the year 2019 in the yyyy/mm/dd format.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint Heisei if the date represented by S is not later than April 30, 2019, and print TBD otherwise.\n\nSample Input 1\n\n2019/04/30\n\nSample Output 1\n\nHeisei\n\nSample Input 2\n\n2019/11/01\n\nSample Output 2\n\nTBD", "sample_input": "2019/04/30\n"}, "reference_outputs": ["Heisei\n"], "source_document_id": "p03109", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S as input. This represents a valid date in the year 2019 in the yyyy/mm/dd format. (For example, April 30, 2019 is represented as 2019/04/30.)\n\nWrite a program that prints Heisei if the date represented by S is not later than April 30, 2019, and prints TBD otherwise.\n\nConstraints\n\nS is a string that represents a valid date in the year 2019 in the yyyy/mm/dd format.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint Heisei if the date represented by S is not later than April 30, 2019, and print TBD otherwise.\n\nSample Input 1\n\n2019/04/30\n\nSample Output 1\n\nHeisei\n\nSample Input 2\n\n2019/11/01\n\nSample Output 2\n\nTBD", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 142, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s806152680", "group_id": "codeNet:p03109", "input_text": "SEIREKI = '2019/04/30'\n\ninputData = input()\nans = \"\"\nif inputData <= SEIREKI:\n ans = 'Heisei'\nelse:\n ans = 'TBD'\nprint(ans)", "language": "Python", "metadata": {"date": 1551041627, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03109.html", "problem_id": "p03109", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03109/input.txt", "sample_output_relpath": "derived/input_output/data/p03109/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03109/Python/s806152680.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s806152680", "user_id": "u311379832"}, "prompt_components": {"gold_output": "Heisei\n", "input_to_evaluate": "SEIREKI = '2019/04/30'\n\ninputData = input()\nans = \"\"\nif inputData <= SEIREKI:\n ans = 'Heisei'\nelse:\n ans = 'TBD'\nprint(ans)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S as input. This represents a valid date in the year 2019 in the yyyy/mm/dd format. (For example, April 30, 2019 is represented as 2019/04/30.)\n\nWrite a program that prints Heisei if the date represented by S is not later than April 30, 2019, and prints TBD otherwise.\n\nConstraints\n\nS is a string that represents a valid date in the year 2019 in the yyyy/mm/dd format.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint Heisei if the date represented by S is not later than April 30, 2019, and print TBD otherwise.\n\nSample Input 1\n\n2019/04/30\n\nSample Output 1\n\nHeisei\n\nSample Input 2\n\n2019/11/01\n\nSample Output 2\n\nTBD", "sample_input": "2019/04/30\n"}, "reference_outputs": ["Heisei\n"], "source_document_id": "p03109", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S as input. This represents a valid date in the year 2019 in the yyyy/mm/dd format. (For example, April 30, 2019 is represented as 2019/04/30.)\n\nWrite a program that prints Heisei if the date represented by S is not later than April 30, 2019, and prints TBD otherwise.\n\nConstraints\n\nS is a string that represents a valid date in the year 2019 in the yyyy/mm/dd format.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint Heisei if the date represented by S is not later than April 30, 2019, and print TBD otherwise.\n\nSample Input 1\n\n2019/04/30\n\nSample Output 1\n\nHeisei\n\nSample Input 2\n\n2019/11/01\n\nSample Output 2\n\nTBD", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 129, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s354066407", "group_id": "codeNet:p03110", "input_text": "n = int(input())\nre = [list(input().split(' ')) for i in range(n)]\ndef b2y(btc):\n return float(btc) * 380000\nans = 0\nfor x, u in re:\n if u == 'JPY':\n ans += float(x)\n else:\n ans += b2y(x)\nprint(ans)", "language": "Python", "metadata": {"date": 1562522372, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03110.html", "problem_id": "p03110", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03110/input.txt", "sample_output_relpath": "derived/input_output/data/p03110/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03110/Python/s354066407.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s354066407", "user_id": "u747884126"}, "prompt_components": {"gold_output": "48000.0\n", "input_to_evaluate": "n = int(input())\nre = [list(input().split(' ')) for i in range(n)]\ndef b2y(btc):\n return float(btc) * 380000\nans = 0\nfor x, u in re:\n if u == 'JPY':\n ans += float(x)\n else:\n ans += b2y(x)\nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi received otoshidama (New Year's money gifts) from N of his relatives.\n\nYou are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either JPY or BTC, and x_i and u_i represent the content of the otoshidama from the i-th relative.\n\nFor example, if x_1 = 10000 and u_1 = JPY, the otoshidama from the first relative is 10000 Japanese yen; if x_2 = 0.10000000 and u_2 = BTC, the otoshidama from the second relative is 0.1 bitcoins.\n\nIf we convert the bitcoins into yen at the rate of 380000.0 JPY per 1.0 BTC, how much are the gifts worth in total?\n\nConstraints\n\n2 \\leq N \\leq 10\n\nu_i = JPY or BTC.\n\nIf u_i = JPY, x_i is an integer such that 1 \\leq x_i \\leq 10^8.\n\nIf u_i = BTC, x_i is a decimal with 8 decimal digits, such that 0.00000001 \\leq x_i \\leq 100.00000000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 u_1\nx_2 u_2\n:\nx_N u_N\n\nOutput\n\nIf the gifts are worth Y yen in total, print the value Y (not necessarily an integer).\n\nOutput will be judged correct when the absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n10000 JPY\n0.10000000 BTC\n\nSample Output 1\n\n48000.0\n\nThe otoshidama from the first relative is 10000 yen. The otoshidama from the second relative is 0.1 bitcoins, which is worth 38000.0 yen if converted at the rate of 380000.0 JPY per 1.0 BTC. The sum of these is 48000.0 yen.\n\nOutputs such as 48000 and 48000.1 will also be judged correct.\n\nSample Input 2\n\n3\n100000000 JPY\n100.00000000 BTC\n0.00000001 BTC\n\nSample Output 2\n\n138000000.0038\n\nIn this case, outputs such as 138001000 and 1.38e8 will also be judged correct.", "sample_input": "2\n10000 JPY\n0.10000000 BTC\n"}, "reference_outputs": ["48000.0\n"], "source_document_id": "p03110", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi received otoshidama (New Year's money gifts) from N of his relatives.\n\nYou are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either JPY or BTC, and x_i and u_i represent the content of the otoshidama from the i-th relative.\n\nFor example, if x_1 = 10000 and u_1 = JPY, the otoshidama from the first relative is 10000 Japanese yen; if x_2 = 0.10000000 and u_2 = BTC, the otoshidama from the second relative is 0.1 bitcoins.\n\nIf we convert the bitcoins into yen at the rate of 380000.0 JPY per 1.0 BTC, how much are the gifts worth in total?\n\nConstraints\n\n2 \\leq N \\leq 10\n\nu_i = JPY or BTC.\n\nIf u_i = JPY, x_i is an integer such that 1 \\leq x_i \\leq 10^8.\n\nIf u_i = BTC, x_i is a decimal with 8 decimal digits, such that 0.00000001 \\leq x_i \\leq 100.00000000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 u_1\nx_2 u_2\n:\nx_N u_N\n\nOutput\n\nIf the gifts are worth Y yen in total, print the value Y (not necessarily an integer).\n\nOutput will be judged correct when the absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n10000 JPY\n0.10000000 BTC\n\nSample Output 1\n\n48000.0\n\nThe otoshidama from the first relative is 10000 yen. The otoshidama from the second relative is 0.1 bitcoins, which is worth 38000.0 yen if converted at the rate of 380000.0 JPY per 1.0 BTC. The sum of these is 48000.0 yen.\n\nOutputs such as 48000 and 48000.1 will also be judged correct.\n\nSample Input 2\n\n3\n100000000 JPY\n100.00000000 BTC\n0.00000001 BTC\n\nSample Output 2\n\n138000000.0038\n\nIn this case, outputs such as 138001000 and 1.38e8 will also be judged correct.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 207, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s683290169", "group_id": "codeNet:p03110", "input_text": "N = int(input())\nans = 0.0\nfor i in range(N):\n mon, kind = input().split()\n mon = float(mon)\n if kind == 'BTC':\n mon = 380000.0 * mon\n ans += mon\nprint(ans)\n", "language": "Python", "metadata": {"date": 1554588229, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03110.html", "problem_id": "p03110", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03110/input.txt", "sample_output_relpath": "derived/input_output/data/p03110/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03110/Python/s683290169.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s683290169", "user_id": "u972946695"}, "prompt_components": {"gold_output": "48000.0\n", "input_to_evaluate": "N = int(input())\nans = 0.0\nfor i in range(N):\n mon, kind = input().split()\n mon = float(mon)\n if kind == 'BTC':\n mon = 380000.0 * mon\n ans += mon\nprint(ans)\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi received otoshidama (New Year's money gifts) from N of his relatives.\n\nYou are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either JPY or BTC, and x_i and u_i represent the content of the otoshidama from the i-th relative.\n\nFor example, if x_1 = 10000 and u_1 = JPY, the otoshidama from the first relative is 10000 Japanese yen; if x_2 = 0.10000000 and u_2 = BTC, the otoshidama from the second relative is 0.1 bitcoins.\n\nIf we convert the bitcoins into yen at the rate of 380000.0 JPY per 1.0 BTC, how much are the gifts worth in total?\n\nConstraints\n\n2 \\leq N \\leq 10\n\nu_i = JPY or BTC.\n\nIf u_i = JPY, x_i is an integer such that 1 \\leq x_i \\leq 10^8.\n\nIf u_i = BTC, x_i is a decimal with 8 decimal digits, such that 0.00000001 \\leq x_i \\leq 100.00000000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 u_1\nx_2 u_2\n:\nx_N u_N\n\nOutput\n\nIf the gifts are worth Y yen in total, print the value Y (not necessarily an integer).\n\nOutput will be judged correct when the absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n10000 JPY\n0.10000000 BTC\n\nSample Output 1\n\n48000.0\n\nThe otoshidama from the first relative is 10000 yen. The otoshidama from the second relative is 0.1 bitcoins, which is worth 38000.0 yen if converted at the rate of 380000.0 JPY per 1.0 BTC. The sum of these is 48000.0 yen.\n\nOutputs such as 48000 and 48000.1 will also be judged correct.\n\nSample Input 2\n\n3\n100000000 JPY\n100.00000000 BTC\n0.00000001 BTC\n\nSample Output 2\n\n138000000.0038\n\nIn this case, outputs such as 138001000 and 1.38e8 will also be judged correct.", "sample_input": "2\n10000 JPY\n0.10000000 BTC\n"}, "reference_outputs": ["48000.0\n"], "source_document_id": "p03110", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi received otoshidama (New Year's money gifts) from N of his relatives.\n\nYou are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either JPY or BTC, and x_i and u_i represent the content of the otoshidama from the i-th relative.\n\nFor example, if x_1 = 10000 and u_1 = JPY, the otoshidama from the first relative is 10000 Japanese yen; if x_2 = 0.10000000 and u_2 = BTC, the otoshidama from the second relative is 0.1 bitcoins.\n\nIf we convert the bitcoins into yen at the rate of 380000.0 JPY per 1.0 BTC, how much are the gifts worth in total?\n\nConstraints\n\n2 \\leq N \\leq 10\n\nu_i = JPY or BTC.\n\nIf u_i = JPY, x_i is an integer such that 1 \\leq x_i \\leq 10^8.\n\nIf u_i = BTC, x_i is a decimal with 8 decimal digits, such that 0.00000001 \\leq x_i \\leq 100.00000000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 u_1\nx_2 u_2\n:\nx_N u_N\n\nOutput\n\nIf the gifts are worth Y yen in total, print the value Y (not necessarily an integer).\n\nOutput will be judged correct when the absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n10000 JPY\n0.10000000 BTC\n\nSample Output 1\n\n48000.0\n\nThe otoshidama from the first relative is 10000 yen. The otoshidama from the second relative is 0.1 bitcoins, which is worth 38000.0 yen if converted at the rate of 380000.0 JPY per 1.0 BTC. The sum of these is 48000.0 yen.\n\nOutputs such as 48000 and 48000.1 will also be judged correct.\n\nSample Input 2\n\n3\n100000000 JPY\n100.00000000 BTC\n0.00000001 BTC\n\nSample Output 2\n\n138000000.0038\n\nIn this case, outputs such as 138001000 and 1.38e8 will also be judged correct.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 176, "cpu_time_ms": 20, "memory_kb": 3316}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s488515991", "group_id": "codeNet:p03110", "input_text": "N = int(input())\nz = [0, 0]\nfor i in range(N):\n u = input().split()\n z[u[1] == 'BTC'] += float(u[0])\n\nprint(z[0] + z[1] * 380000)", "language": "Python", "metadata": {"date": 1551041786, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03110.html", "problem_id": "p03110", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03110/input.txt", "sample_output_relpath": "derived/input_output/data/p03110/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03110/Python/s488515991.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s488515991", "user_id": "u178888901"}, "prompt_components": {"gold_output": "48000.0\n", "input_to_evaluate": "N = int(input())\nz = [0, 0]\nfor i in range(N):\n u = input().split()\n z[u[1] == 'BTC'] += float(u[0])\n\nprint(z[0] + z[1] * 380000)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi received otoshidama (New Year's money gifts) from N of his relatives.\n\nYou are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either JPY or BTC, and x_i and u_i represent the content of the otoshidama from the i-th relative.\n\nFor example, if x_1 = 10000 and u_1 = JPY, the otoshidama from the first relative is 10000 Japanese yen; if x_2 = 0.10000000 and u_2 = BTC, the otoshidama from the second relative is 0.1 bitcoins.\n\nIf we convert the bitcoins into yen at the rate of 380000.0 JPY per 1.0 BTC, how much are the gifts worth in total?\n\nConstraints\n\n2 \\leq N \\leq 10\n\nu_i = JPY or BTC.\n\nIf u_i = JPY, x_i is an integer such that 1 \\leq x_i \\leq 10^8.\n\nIf u_i = BTC, x_i is a decimal with 8 decimal digits, such that 0.00000001 \\leq x_i \\leq 100.00000000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 u_1\nx_2 u_2\n:\nx_N u_N\n\nOutput\n\nIf the gifts are worth Y yen in total, print the value Y (not necessarily an integer).\n\nOutput will be judged correct when the absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n10000 JPY\n0.10000000 BTC\n\nSample Output 1\n\n48000.0\n\nThe otoshidama from the first relative is 10000 yen. The otoshidama from the second relative is 0.1 bitcoins, which is worth 38000.0 yen if converted at the rate of 380000.0 JPY per 1.0 BTC. The sum of these is 48000.0 yen.\n\nOutputs such as 48000 and 48000.1 will also be judged correct.\n\nSample Input 2\n\n3\n100000000 JPY\n100.00000000 BTC\n0.00000001 BTC\n\nSample Output 2\n\n138000000.0038\n\nIn this case, outputs such as 138001000 and 1.38e8 will also be judged correct.", "sample_input": "2\n10000 JPY\n0.10000000 BTC\n"}, "reference_outputs": ["48000.0\n"], "source_document_id": "p03110", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi received otoshidama (New Year's money gifts) from N of his relatives.\n\nYou are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either JPY or BTC, and x_i and u_i represent the content of the otoshidama from the i-th relative.\n\nFor example, if x_1 = 10000 and u_1 = JPY, the otoshidama from the first relative is 10000 Japanese yen; if x_2 = 0.10000000 and u_2 = BTC, the otoshidama from the second relative is 0.1 bitcoins.\n\nIf we convert the bitcoins into yen at the rate of 380000.0 JPY per 1.0 BTC, how much are the gifts worth in total?\n\nConstraints\n\n2 \\leq N \\leq 10\n\nu_i = JPY or BTC.\n\nIf u_i = JPY, x_i is an integer such that 1 \\leq x_i \\leq 10^8.\n\nIf u_i = BTC, x_i is a decimal with 8 decimal digits, such that 0.00000001 \\leq x_i \\leq 100.00000000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 u_1\nx_2 u_2\n:\nx_N u_N\n\nOutput\n\nIf the gifts are worth Y yen in total, print the value Y (not necessarily an integer).\n\nOutput will be judged correct when the absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n10000 JPY\n0.10000000 BTC\n\nSample Output 1\n\n48000.0\n\nThe otoshidama from the first relative is 10000 yen. The otoshidama from the second relative is 0.1 bitcoins, which is worth 38000.0 yen if converted at the rate of 380000.0 JPY per 1.0 BTC. The sum of these is 48000.0 yen.\n\nOutputs such as 48000 and 48000.1 will also be judged correct.\n\nSample Input 2\n\n3\n100000000 JPY\n100.00000000 BTC\n0.00000001 BTC\n\nSample Output 2\n\n138000000.0038\n\nIn this case, outputs such as 138001000 and 1.38e8 will also be judged correct.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 131, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s701770890", "group_id": "codeNet:p03111", "input_text": "from itertools import product\n\ndef solve(NUM, LIST):\n lst = [i for i, li in enumerate(LIST) if li == NUM]\n if len(lst) == 0:\n return 10 ** 5\n ANS = (len(lst) - 1) * 10\n ANS += abs(sum(l[i] for i in lst) - target[NUM])\n return ANS\n\ntarget = list(map(int, input().split()))\nl = [int(input()) for _ in range(target[0])]\n\nans = 10 ** 5\nfor pat in product([0, 1, 2, 3], repeat=target[0]):\n tmp = sum(solve(i + 1, pat) for i in range(3))\n ans = min(ans, tmp)\nprint(ans)\n", "language": "Python", "metadata": {"date": 1599686172, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p03111.html", "problem_id": "p03111", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03111/input.txt", "sample_output_relpath": "derived/input_output/data/p03111/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03111/Python/s701770890.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s701770890", "user_id": "u222668979"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "from itertools import product\n\ndef solve(NUM, LIST):\n lst = [i for i, li in enumerate(LIST) if li == NUM]\n if len(lst) == 0:\n return 10 ** 5\n ANS = (len(lst) - 1) * 10\n ANS += abs(sum(l[i] for i in lst) - target[NUM])\n return ANS\n\ntarget = list(map(int, input().split()))\nl = [int(input()) for _ in range(target[0])]\n\nans = 10 ** 5\nfor pat in product([0, 1, 2, 3], repeat=target[0]):\n tmp = sum(solve(i + 1, pat) for i in range(3))\n ans = min(ans, tmp)\nprint(ans)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively.\n\nYour objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number:\n\nExtension Magic: Consumes 1 MP (magic point). Choose one bamboo and increase its length by 1.\n\nShortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1.\n\nComposition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.)\n\nAt least how much MP is needed to achieve the objective?\n\nConstraints\n\n3 \\leq N \\leq 8\n\n1 \\leq C < B < A \\leq 1000\n\n1 \\leq l_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C\nl_1\nl_2\n:\nl_N\n\nOutput\n\nPrint the minimum amount of MP needed to achieve the objective.\n\nSample Input 1\n\n5 100 90 80\n98\n40\n30\n21\n80\n\nSample Output 1\n\n23\n\nWe are obtaining three bamboos of lengths 100, 90, 80 from five bamboos 98, 40, 30, 21, 80. We already have a bamboo of length 80, and we can obtain bamboos of lengths 100, 90 by using the magics as follows at the total cost of 23 MP, which is optimal.\n\nUse Extension Magic twice on the bamboo of length 98 to obtain a bamboo of length 100. (MP consumed: 2)\n\nUse Composition Magic on the bamboos of lengths 40, 30 to obtain a bamboo of length 70. (MP consumed: 10)\n\nUse Shortening Magic once on the bamboo of length 21 to obtain a bamboo of length 20. (MP consumed: 1)\n\nUse Composition Magic on the bamboo of length 70 obtained in step 2 and the bamboo of length 20 obtained in step 3 to obtain a bamboo of length 90. (MP consumed: 10)\n\nSample Input 2\n\n8 100 90 80\n100\n100\n90\n90\n90\n80\n80\n80\n\nSample Output 2\n\n0\n\nIf we already have all bamboos of the desired lengths, the amount of MP needed is 0. As seen here, we do not necessarily need to use all the bamboos.\n\nSample Input 3\n\n8 1000 800 100\n300\n333\n400\n444\n500\n555\n600\n666\n\nSample Output 3\n\n243", "sample_input": "5 100 90 80\n98\n40\n30\n21\n80\n"}, "reference_outputs": ["23\n"], "source_document_id": "p03111", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively.\n\nYour objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number:\n\nExtension Magic: Consumes 1 MP (magic point). Choose one bamboo and increase its length by 1.\n\nShortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1.\n\nComposition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.)\n\nAt least how much MP is needed to achieve the objective?\n\nConstraints\n\n3 \\leq N \\leq 8\n\n1 \\leq C < B < A \\leq 1000\n\n1 \\leq l_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C\nl_1\nl_2\n:\nl_N\n\nOutput\n\nPrint the minimum amount of MP needed to achieve the objective.\n\nSample Input 1\n\n5 100 90 80\n98\n40\n30\n21\n80\n\nSample Output 1\n\n23\n\nWe are obtaining three bamboos of lengths 100, 90, 80 from five bamboos 98, 40, 30, 21, 80. We already have a bamboo of length 80, and we can obtain bamboos of lengths 100, 90 by using the magics as follows at the total cost of 23 MP, which is optimal.\n\nUse Extension Magic twice on the bamboo of length 98 to obtain a bamboo of length 100. (MP consumed: 2)\n\nUse Composition Magic on the bamboos of lengths 40, 30 to obtain a bamboo of length 70. (MP consumed: 10)\n\nUse Shortening Magic once on the bamboo of length 21 to obtain a bamboo of length 20. (MP consumed: 1)\n\nUse Composition Magic on the bamboo of length 70 obtained in step 2 and the bamboo of length 20 obtained in step 3 to obtain a bamboo of length 90. (MP consumed: 10)\n\nSample Input 2\n\n8 100 90 80\n100\n100\n90\n90\n90\n80\n80\n80\n\nSample Output 2\n\n0\n\nIf we already have all bamboos of the desired lengths, the amount of MP needed is 0. As seen here, we do not necessarily need to use all the bamboos.\n\nSample Input 3\n\n8 1000 800 100\n300\n333\n400\n444\n500\n555\n600\n666\n\nSample Output 3\n\n243", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 492, "cpu_time_ms": 212, "memory_kb": 77956}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s556405287", "group_id": "codeNet:p03112", "input_text": "# -*- coding: utf-8 -*-\nimport sys\nfrom bisect import bisect_left, bisect_right\nfrom operator import itemgetter\nfrom fractions import gcd\nfrom math import ceil, floor, sqrt\nfrom copy import deepcopy\nfrom collections import Counter, deque\nimport heapq\nfrom functools import reduce\nfrom random import shuffle\nimport cProfile\nsys.setrecursionlimit(200000)\n# local only\n# if not __debug__:\n# fin = open('text.txt', 'r')\n# sys.stdin = fin\n# local only\ninput = sys.stdin.readline\ndef ii(): return int(input())\ndef mi(): return map(int, input().rstrip().split())\ndef lmi(): return list(map(int, input().rstrip().split()))\ndef li(): return list(input().rstrip())\ndef debug(*args, sep=\" \", end=\"\\n\"): print(\"debug:\", *args, file=sys.stderr, sep=sep, end=end) if not __debug__ else None\ndef exit(*arg): print(*arg); sys.exit()\n# template\n\n# BEGIN CUT HERE\nclass Avltree:\n \"\"\"\n AVL木\n\n Methods\n -------\n search(x: int) -> Union(int)\n ◯.data == x のものが存在するある場合それを出力、ない場合 None を返す\n insert(x: int) -> None\n ◯.data == x がない場合 ◯.data == x なる頂点を作る。ある場合はなにもしない(上書きしない)\n y.to_s() -> int\n 頂点yのdataを返す\n y.left_s() -> Union(int, key=None)\n 頂点yのleftを返す(ない場合は key)\n search_lower(x: int, key_lower) -> int\n ○.data が x より小さいものの中で最も大きいものを出力、ない場合 key_lower を返す\n search_higher(x:int , key_higher) -> int\n ○.data が x より大きいものの中で最も小さいものを出力、ない場合 key_higher を返す\n \"\"\"\n\n def __init__(self, key=None):\n self.key = key\n self.left = None\n self.right = None\n self.balance = \"Even\"\n\n def search(self, key):\n node = self\n while node is not None:\n if node.key == key:\n return node # node.key == keyの場合\n if node.key > key:\n node = node.left\n elif node.key < key:\n node = node.right\n return None\n\n def search_lower(self, key, key_lower):\n node = self\n if node.key is None:\n return key_lower\n ans = key_lower\n while node is not None:\n if node.key < key:\n if ans < node.key:\n ans = node.key\n node = node.right\n elif node.key >= key:\n node = node.left\n return ans\n\n def search_higher(self, key, key_higher):\n node = self\n if node.key is None:\n return key_higher\n ans = key_higher\n while node is not None:\n if node.key > key:\n if ans > node.key:\n ans = node.key\n node = node.left\n elif node.key <= key:\n node = node.right\n return ans\n\n\n def end_lower(self, end_lower_key):\n node = self\n while node.left is not None:\n node = node.left\n return node.key\n\n def end_higher(self, end_higher_key):\n node = self\n while node.right is not None:\n node = node.right\n return node.key\n\n\n def DoubleRightRotation(self):\n tl = self.left\n self.left = tl.right.right\n tl.right.right = self # selfはそのノード\n tlr = tl.right\n tl.right = tlr.left\n tlr.left = tl\n if tlr.balance == \"Left\":\n tlr.right.balance = \"Right\"\n tlr.left.balance = \"Even\"\n elif tlr.balance == \"Right\":\n tlr.right.balance = \"Even\"\n tlr.left.balance = \"Left\"\n elif tlr.balance == \"Even\":\n tlr.right.balance = \"Even\"\n tlr.left.balance = \"Even\"\n tlr.balance = \"Even\"\n return tlr\n def DoubleLeftRotation(self):\n tr = self.right\n self.right = tr.left.left\n tr.left.left = self\n trl = tr.left\n tr.left = trl.right\n trl.right = tr\n if trl.balance == \"Right\":\n trl.left.balance = \"Left\"\n trl.right.balance = \"Even\"\n elif trl.balance == \"Left\":\n trl.left.balance = \"Even\"\n trl.right.balance = \"Right\"\n elif trl.balance == \"Even\":\n trl.left.balance = \"Even\"\n trl.right.balance = \"Even\"\n trl.balance = \"Even\"\n return trl\n def SingleLeftRotation(self):\n tr = self.right\n tr.balance = \"Even\"\n self.balance = \"Even\"\n self.right = tr.left\n tr.left = self\n return tr\n def SingleRightRotation(self):\n tl = self.left\n tl.balance = \"Even\"\n self.balance = \"Even\"\n self.left = tl.right\n tl.right = self\n return tl\n def replace(self, p, v): # 親ノードpの下にある自分(self)をvに置き換える。\n if p.left == self:\n p.left = v\n else:\n p.right = v\n def insert(self, key): # rootでのみ呼ばれる挿入\n if self.key is None: # rootを含むrotationはしないことにする。\n self.key = key\n return self\n if key < self.key:\n if self.left is None:\n self.left = Avltree(key)\n else:\n self.left.insertx(self, key)\n elif key > self.key:\n if self.right is None:\n self.right = Avltree(key)\n else:\n self.right.insertx(self, key)\n else: # key == self.key:\n pass # do not overwrite\n def insertx(self, p, key): # replaceを呼ぶために一つ上の親を持っているinsert\n node = self\n s = []\n while True:\n if node.key > key:\n s.append((node, -1))\n if node.left is None:\n node.left = Avltree(key)\n node = node.left\n break\n else:\n node = node.left\n elif node.key < key:\n s.append((node, 1))\n if node.right is None:\n node.right = Avltree(key)\n node = node.right\n break\n else:\n node = node.right\n while len(s) != 0:\n node, direct = s.pop()\n if len(s) != 0:\n par = s[-1][0]\n else:\n par = p\n if direct == -1:\n if node.balance == \"Right\":\n node.balance = \"Even\"\n break\n elif node.balance == \"Even\":\n node.balance = \"Left\"\n elif node.balance == \"Left\":\n if node.left.balance == \"Right\":\n node.replace(par, node.DoubleRightRotation())\n elif node.left.balance == \"Left\":\n node.replace(par, node.SingleRightRotation())\n break\n elif direct == 1:\n if node.balance == \"Left\":\n node.balance = \"Even\"\n break\n elif node.balance == \"Even\":\n node.balance = \"Right\"\n elif node.balance == \"Right\":\n if node.right.balance == \"Left\":\n node.replace(par, node.DoubleLeftRotation())\n elif node.right.balance == \"Right\":\n node.replace(par, node.SingleLeftRotation())\n break\n\n def to_s(self):\n return self.key\n def left_s(self):\n if self.left is None:\n return None\n return (self.left).key\n def right_s(self):\n if self.right is None:\n return None\n return (self.right).key\n# END CUT HERE\n\n\n\ndef main():\n rb1 = Avltree()\n a, b, q = map(int, input().split())\n\n rb2 = Avltree()\n for i in range(a):\n s = ii()\n rb1.insert(s)\n for i in range(b):\n t = ii()\n rb2.insert(t)\n # rb1.output()\n # rb2.output()\n for i in range(q):\n x = ii()\n s1 = rb1.search_lower(x, -10**18)\n s2 = rb1.search_higher(x, 10**18)\n t1 = rb2.search_lower(x, -10**18)\n t2 = rb2.search_higher(x, 10**18)\n # print(s1, s2, t1, t2)\n res = 10**18\n for S in [s1, s2]:\n for T in [t1, t2]:\n d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)\n res = min(res, d1, d2)\n print(res)\n\n\n\n\nif __name__ == '__main__':\n # cProfile.run('main()')\n main()\n", "language": "Python", "metadata": {"date": 1568135595, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03112.html", "problem_id": "p03112", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03112/input.txt", "sample_output_relpath": "derived/input_output/data/p03112/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03112/Python/s556405287.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s556405287", "user_id": "u379629675"}, "prompt_components": {"gold_output": "350\n1400\n301\n399\n", "input_to_evaluate": "# -*- coding: utf-8 -*-\nimport sys\nfrom bisect import bisect_left, bisect_right\nfrom operator import itemgetter\nfrom fractions import gcd\nfrom math import ceil, floor, sqrt\nfrom copy import deepcopy\nfrom collections import Counter, deque\nimport heapq\nfrom functools import reduce\nfrom random import shuffle\nimport cProfile\nsys.setrecursionlimit(200000)\n# local only\n# if not __debug__:\n# fin = open('text.txt', 'r')\n# sys.stdin = fin\n# local only\ninput = sys.stdin.readline\ndef ii(): return int(input())\ndef mi(): return map(int, input().rstrip().split())\ndef lmi(): return list(map(int, input().rstrip().split()))\ndef li(): return list(input().rstrip())\ndef debug(*args, sep=\" \", end=\"\\n\"): print(\"debug:\", *args, file=sys.stderr, sep=sep, end=end) if not __debug__ else None\ndef exit(*arg): print(*arg); sys.exit()\n# template\n\n# BEGIN CUT HERE\nclass Avltree:\n \"\"\"\n AVL木\n\n Methods\n -------\n search(x: int) -> Union(int)\n ◯.data == x のものが存在するある場合それを出力、ない場合 None を返す\n insert(x: int) -> None\n ◯.data == x がない場合 ◯.data == x なる頂点を作る。ある場合はなにもしない(上書きしない)\n y.to_s() -> int\n 頂点yのdataを返す\n y.left_s() -> Union(int, key=None)\n 頂点yのleftを返す(ない場合は key)\n search_lower(x: int, key_lower) -> int\n ○.data が x より小さいものの中で最も大きいものを出力、ない場合 key_lower を返す\n search_higher(x:int , key_higher) -> int\n ○.data が x より大きいものの中で最も小さいものを出力、ない場合 key_higher を返す\n \"\"\"\n\n def __init__(self, key=None):\n self.key = key\n self.left = None\n self.right = None\n self.balance = \"Even\"\n\n def search(self, key):\n node = self\n while node is not None:\n if node.key == key:\n return node # node.key == keyの場合\n if node.key > key:\n node = node.left\n elif node.key < key:\n node = node.right\n return None\n\n def search_lower(self, key, key_lower):\n node = self\n if node.key is None:\n return key_lower\n ans = key_lower\n while node is not None:\n if node.key < key:\n if ans < node.key:\n ans = node.key\n node = node.right\n elif node.key >= key:\n node = node.left\n return ans\n\n def search_higher(self, key, key_higher):\n node = self\n if node.key is None:\n return key_higher\n ans = key_higher\n while node is not None:\n if node.key > key:\n if ans > node.key:\n ans = node.key\n node = node.left\n elif node.key <= key:\n node = node.right\n return ans\n\n\n def end_lower(self, end_lower_key):\n node = self\n while node.left is not None:\n node = node.left\n return node.key\n\n def end_higher(self, end_higher_key):\n node = self\n while node.right is not None:\n node = node.right\n return node.key\n\n\n def DoubleRightRotation(self):\n tl = self.left\n self.left = tl.right.right\n tl.right.right = self # selfはそのノード\n tlr = tl.right\n tl.right = tlr.left\n tlr.left = tl\n if tlr.balance == \"Left\":\n tlr.right.balance = \"Right\"\n tlr.left.balance = \"Even\"\n elif tlr.balance == \"Right\":\n tlr.right.balance = \"Even\"\n tlr.left.balance = \"Left\"\n elif tlr.balance == \"Even\":\n tlr.right.balance = \"Even\"\n tlr.left.balance = \"Even\"\n tlr.balance = \"Even\"\n return tlr\n def DoubleLeftRotation(self):\n tr = self.right\n self.right = tr.left.left\n tr.left.left = self\n trl = tr.left\n tr.left = trl.right\n trl.right = tr\n if trl.balance == \"Right\":\n trl.left.balance = \"Left\"\n trl.right.balance = \"Even\"\n elif trl.balance == \"Left\":\n trl.left.balance = \"Even\"\n trl.right.balance = \"Right\"\n elif trl.balance == \"Even\":\n trl.left.balance = \"Even\"\n trl.right.balance = \"Even\"\n trl.balance = \"Even\"\n return trl\n def SingleLeftRotation(self):\n tr = self.right\n tr.balance = \"Even\"\n self.balance = \"Even\"\n self.right = tr.left\n tr.left = self\n return tr\n def SingleRightRotation(self):\n tl = self.left\n tl.balance = \"Even\"\n self.balance = \"Even\"\n self.left = tl.right\n tl.right = self\n return tl\n def replace(self, p, v): # 親ノードpの下にある自分(self)をvに置き換える。\n if p.left == self:\n p.left = v\n else:\n p.right = v\n def insert(self, key): # rootでのみ呼ばれる挿入\n if self.key is None: # rootを含むrotationはしないことにする。\n self.key = key\n return self\n if key < self.key:\n if self.left is None:\n self.left = Avltree(key)\n else:\n self.left.insertx(self, key)\n elif key > self.key:\n if self.right is None:\n self.right = Avltree(key)\n else:\n self.right.insertx(self, key)\n else: # key == self.key:\n pass # do not overwrite\n def insertx(self, p, key): # replaceを呼ぶために一つ上の親を持っているinsert\n node = self\n s = []\n while True:\n if node.key > key:\n s.append((node, -1))\n if node.left is None:\n node.left = Avltree(key)\n node = node.left\n break\n else:\n node = node.left\n elif node.key < key:\n s.append((node, 1))\n if node.right is None:\n node.right = Avltree(key)\n node = node.right\n break\n else:\n node = node.right\n while len(s) != 0:\n node, direct = s.pop()\n if len(s) != 0:\n par = s[-1][0]\n else:\n par = p\n if direct == -1:\n if node.balance == \"Right\":\n node.balance = \"Even\"\n break\n elif node.balance == \"Even\":\n node.balance = \"Left\"\n elif node.balance == \"Left\":\n if node.left.balance == \"Right\":\n node.replace(par, node.DoubleRightRotation())\n elif node.left.balance == \"Left\":\n node.replace(par, node.SingleRightRotation())\n break\n elif direct == 1:\n if node.balance == \"Left\":\n node.balance = \"Even\"\n break\n elif node.balance == \"Even\":\n node.balance = \"Right\"\n elif node.balance == \"Right\":\n if node.right.balance == \"Left\":\n node.replace(par, node.DoubleLeftRotation())\n elif node.right.balance == \"Right\":\n node.replace(par, node.SingleLeftRotation())\n break\n\n def to_s(self):\n return self.key\n def left_s(self):\n if self.left is None:\n return None\n return (self.left).key\n def right_s(self):\n if self.right is None:\n return None\n return (self.right).key\n# END CUT HERE\n\n\n\ndef main():\n rb1 = Avltree()\n a, b, q = map(int, input().split())\n\n rb2 = Avltree()\n for i in range(a):\n s = ii()\n rb1.insert(s)\n for i in range(b):\n t = ii()\n rb2.insert(t)\n # rb1.output()\n # rb2.output()\n for i in range(q):\n x = ii()\n s1 = rb1.search_lower(x, -10**18)\n s2 = rb1.search_higher(x, 10**18)\n t1 = rb2.search_lower(x, -10**18)\n t2 = rb2.search_higher(x, 10**18)\n # print(s1, s2, t1, t2)\n res = 10**18\n for S in [s1, s2]:\n for T in [t1, t2]:\n d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)\n res = min(res, d1, d2)\n print(res)\n\n\n\n\nif __name__ == '__main__':\n # cProfile.run('main()')\n main()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nAlong a road running in an east-west direction, there are A shrines and B temples.\nThe i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road.\n\nAnswer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.)\n\nConstraints\n\n1 \\leq A, B \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq s_1 < s_2 < ... < s_A \\leq 10^{10}\n\n1 \\leq t_1 < t_2 < ... < t_B \\leq 10^{10}\n\n1 \\leq x_i \\leq 10^{10}\n\ns_1, ..., s_A, t_1, ..., t_B, x_1, ..., x_Q are all different.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B Q\ns_1\n:\ns_A\nt_1\n:\nt_B\nx_1\n:\nx_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n2 3 4\n100\n600\n400\n900\n1000\n150\n2000\n899\n799\n\nSample Output 1\n\n350\n1400\n301\n399\n\nThere are two shrines and three temples. The shrines are located at distances of 100, 600 meters from the west end of the road, and the temples are located at distances of 400, 900, 1000 meters from the west end of the road.\n\nQuery 1: If we start from a point at a distance of 150 meters from the west end of the road, the optimal move is first to walk 50 meters west to visit a shrine, then to walk 300 meters east to visit a temple.\n\nQuery 2: If we start from a point at a distance of 2000 meters from the west end of the road, the optimal move is first to walk 1000 meters west to visit a temple, then to walk 400 meters west to visit a shrine. We will pass by another temple on the way, but it is fine.\n\nQuery 3: If we start from a point at a distance of 899 meters from the west end of the road, the optimal move is first to walk 1 meter east to visit a temple, then to walk 300 meters west to visit a shrine.\n\nQuery 4: If we start from a point at a distance of 799 meters from the west end of the road, the optimal move is first to walk 199 meters west to visit a shrine, then to walk 200 meters west to visit a temple.\n\nSample Input 2\n\n1 1 3\n1\n10000000000\n2\n9999999999\n5000000000\n\nSample Output 2\n\n10000000000\n10000000000\n14999999998\n\nThe road is quite long, and we may need to travel a distance that does not fit into a 32-bit integer.", "sample_input": "2 3 4\n100\n600\n400\n900\n1000\n150\n2000\n899\n799\n"}, "reference_outputs": ["350\n1400\n301\n399\n"], "source_document_id": "p03112", "source_text": "Score : 400 points\n\nProblem Statement\n\nAlong a road running in an east-west direction, there are A shrines and B temples.\nThe i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road.\n\nAnswer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.)\n\nConstraints\n\n1 \\leq A, B \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq s_1 < s_2 < ... < s_A \\leq 10^{10}\n\n1 \\leq t_1 < t_2 < ... < t_B \\leq 10^{10}\n\n1 \\leq x_i \\leq 10^{10}\n\ns_1, ..., s_A, t_1, ..., t_B, x_1, ..., x_Q are all different.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B Q\ns_1\n:\ns_A\nt_1\n:\nt_B\nx_1\n:\nx_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n2 3 4\n100\n600\n400\n900\n1000\n150\n2000\n899\n799\n\nSample Output 1\n\n350\n1400\n301\n399\n\nThere are two shrines and three temples. The shrines are located at distances of 100, 600 meters from the west end of the road, and the temples are located at distances of 400, 900, 1000 meters from the west end of the road.\n\nQuery 1: If we start from a point at a distance of 150 meters from the west end of the road, the optimal move is first to walk 50 meters west to visit a shrine, then to walk 300 meters east to visit a temple.\n\nQuery 2: If we start from a point at a distance of 2000 meters from the west end of the road, the optimal move is first to walk 1000 meters west to visit a temple, then to walk 400 meters west to visit a shrine. We will pass by another temple on the way, but it is fine.\n\nQuery 3: If we start from a point at a distance of 899 meters from the west end of the road, the optimal move is first to walk 1 meter east to visit a temple, then to walk 300 meters west to visit a shrine.\n\nQuery 4: If we start from a point at a distance of 799 meters from the west end of the road, the optimal move is first to walk 199 meters west to visit a shrine, then to walk 200 meters west to visit a temple.\n\nSample Input 2\n\n1 1 3\n1\n10000000000\n2\n9999999999\n5000000000\n\nSample Output 2\n\n10000000000\n10000000000\n14999999998\n\nThe road is quite long, and we may need to travel a distance that does not fit into a 32-bit integer.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 8679, "cpu_time_ms": 1029, "memory_kb": 102532}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s456869759", "group_id": "codeNet:p03125", "input_text": "a,b = map(int,input().split())\nif b % a == 0:\n print(a + b)\nelse:\n print(b - a)", "language": "Python", "metadata": {"date": 1558487994, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03125.html", "problem_id": "p03125", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03125/input.txt", "sample_output_relpath": "derived/input_output/data/p03125/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03125/Python/s456869759.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s456869759", "user_id": "u502028059"}, "prompt_components": {"gold_output": "16\n", "input_to_evaluate": "a,b = map(int,input().split())\nif b % a == 0:\n print(a + b)\nelse:\n print(b - a)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given positive integers A and B.\n\nIf A is a divisor of B, print A + B; otherwise, print B - A.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf A is a divisor of B, print A + B; otherwise, print B - A.\n\nSample Input 1\n\n4 12\n\nSample Output 1\n\n16\n\nAs 4 is a divisor of 12, 4 + 12 = 16 should be printed.\n\nSample Input 2\n\n8 20\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n2\n\n1 is a divisor of 1.", "sample_input": "4 12\n"}, "reference_outputs": ["16\n"], "source_document_id": "p03125", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given positive integers A and B.\n\nIf A is a divisor of B, print A + B; otherwise, print B - A.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf A is a divisor of B, print A + B; otherwise, print B - A.\n\nSample Input 1\n\n4 12\n\nSample Output 1\n\n16\n\nAs 4 is a divisor of 12, 4 + 12 = 16 should be printed.\n\nSample Input 2\n\n8 20\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n2\n\n1 is a divisor of 1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 85, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s635639433", "group_id": "codeNet:p03126", "input_text": "n, m = map(int, input().split())\n\nlist_score = [ list(map(int,input().split(\" \"))) for i in range(n)]\nans = set(list_score[0][1:])\n\nfor c in list_score:\n ans = ans & set(c[1:])\n\nprint(len(ans))", "language": "Python", "metadata": {"date": 1584717778, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03126.html", "problem_id": "p03126", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03126/input.txt", "sample_output_relpath": "derived/input_output/data/p03126/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03126/Python/s635639433.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s635639433", "user_id": "u011062360"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "n, m = map(int, input().split())\n\nlist_score = [ list(map(int,input().split(\" \"))) for i in range(n)]\nans = set(list_score[0][1:])\n\nfor c in list_score:\n ans = ans & set(c[1:])\n\nprint(len(ans))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nKatsusando loves omelette rice.\n\nBesides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.\n\nTo prove that hypothesis, he conducted a survey on M kinds of foods and asked N people whether they like these foods or not.\n\nThe i-th person answered that he/she only likes the A_{i1}-th, A_{i2}-th, ..., A_{iK_i}-th food.\n\nFind the number of the foods liked by all the N people.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 30\n\n1 \\leq K_i \\leq M\n\n1 \\leq A_{ij} \\leq M\n\nFor each i (1 \\leq i \\leq N), A_{i1}, A_{i2}, ..., A_{iK_i} are distinct.\n\nConstraints\n\nInput is given from Standard Input in the following format:\n\nN M\nK_1 A_{11} A_{12} ... A_{1K_1}\nK_2 A_{21} A_{22} ... A_{2K_2}\n:\nK_N A_{N1} A_{N2} ... A_{NK_N}\n\nOutput\n\nPrint the number of the foods liked by all the N people.\n\nSample Input 1\n\n3 4\n2 1 3\n3 1 2 3\n2 3 2\n\nSample Output 1\n\n1\n\nAs only the third food is liked by all the three people, 1 should be printed.\n\nSample Input 2\n\n5 5\n4 2 3 4 5\n4 1 3 4 5\n4 1 2 4 5\n4 1 2 3 5\n4 1 2 3 4\n\nSample Output 2\n\n0\n\nKatsusando's hypothesis turned out to be wrong.\n\nSample Input 3\n\n1 30\n3 5 10 30\n\nSample Output 3\n\n3", "sample_input": "3 4\n2 1 3\n3 1 2 3\n2 3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03126", "source_text": "Score : 200 points\n\nProblem Statement\n\nKatsusando loves omelette rice.\n\nBesides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.\n\nTo prove that hypothesis, he conducted a survey on M kinds of foods and asked N people whether they like these foods or not.\n\nThe i-th person answered that he/she only likes the A_{i1}-th, A_{i2}-th, ..., A_{iK_i}-th food.\n\nFind the number of the foods liked by all the N people.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 30\n\n1 \\leq K_i \\leq M\n\n1 \\leq A_{ij} \\leq M\n\nFor each i (1 \\leq i \\leq N), A_{i1}, A_{i2}, ..., A_{iK_i} are distinct.\n\nConstraints\n\nInput is given from Standard Input in the following format:\n\nN M\nK_1 A_{11} A_{12} ... A_{1K_1}\nK_2 A_{21} A_{22} ... A_{2K_2}\n:\nK_N A_{N1} A_{N2} ... A_{NK_N}\n\nOutput\n\nPrint the number of the foods liked by all the N people.\n\nSample Input 1\n\n3 4\n2 1 3\n3 1 2 3\n2 3 2\n\nSample Output 1\n\n1\n\nAs only the third food is liked by all the three people, 1 should be printed.\n\nSample Input 2\n\n5 5\n4 2 3 4 5\n4 1 3 4 5\n4 1 2 4 5\n4 1 2 3 5\n4 1 2 3 4\n\nSample Output 2\n\n0\n\nKatsusando's hypothesis turned out to be wrong.\n\nSample Input 3\n\n1 30\n3 5 10 30\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 196, "cpu_time_ms": 18, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s718640959", "group_id": "codeNet:p03126", "input_text": "n,m = map(int, input().split())\nl = [0]*m\n\nfor i in range(n):\n\tk,*p = map(int, open(0).read().split())\n\tfor j in range(k):\n\t\tl[p[j]-1] += 1\nans = 0\nfor i in range(m):\n\tif l[i] == 0:\n\t\tans += 1\nprint ans", "language": "Python", "metadata": {"date": 1558275358, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03126.html", "problem_id": "p03126", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03126/input.txt", "sample_output_relpath": "derived/input_output/data/p03126/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03126/Python/s718640959.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s718640959", "user_id": "u076996519"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "n,m = map(int, input().split())\nl = [0]*m\n\nfor i in range(n):\n\tk,*p = map(int, open(0).read().split())\n\tfor j in range(k):\n\t\tl[p[j]-1] += 1\nans = 0\nfor i in range(m):\n\tif l[i] == 0:\n\t\tans += 1\nprint ans", "problem_context": "Score : 200 points\n\nProblem Statement\n\nKatsusando loves omelette rice.\n\nBesides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.\n\nTo prove that hypothesis, he conducted a survey on M kinds of foods and asked N people whether they like these foods or not.\n\nThe i-th person answered that he/she only likes the A_{i1}-th, A_{i2}-th, ..., A_{iK_i}-th food.\n\nFind the number of the foods liked by all the N people.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 30\n\n1 \\leq K_i \\leq M\n\n1 \\leq A_{ij} \\leq M\n\nFor each i (1 \\leq i \\leq N), A_{i1}, A_{i2}, ..., A_{iK_i} are distinct.\n\nConstraints\n\nInput is given from Standard Input in the following format:\n\nN M\nK_1 A_{11} A_{12} ... A_{1K_1}\nK_2 A_{21} A_{22} ... A_{2K_2}\n:\nK_N A_{N1} A_{N2} ... A_{NK_N}\n\nOutput\n\nPrint the number of the foods liked by all the N people.\n\nSample Input 1\n\n3 4\n2 1 3\n3 1 2 3\n2 3 2\n\nSample Output 1\n\n1\n\nAs only the third food is liked by all the three people, 1 should be printed.\n\nSample Input 2\n\n5 5\n4 2 3 4 5\n4 1 3 4 5\n4 1 2 4 5\n4 1 2 3 5\n4 1 2 3 4\n\nSample Output 2\n\n0\n\nKatsusando's hypothesis turned out to be wrong.\n\nSample Input 3\n\n1 30\n3 5 10 30\n\nSample Output 3\n\n3", "sample_input": "3 4\n2 1 3\n3 1 2 3\n2 3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03126", "source_text": "Score : 200 points\n\nProblem Statement\n\nKatsusando loves omelette rice.\n\nBesides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.\n\nTo prove that hypothesis, he conducted a survey on M kinds of foods and asked N people whether they like these foods or not.\n\nThe i-th person answered that he/she only likes the A_{i1}-th, A_{i2}-th, ..., A_{iK_i}-th food.\n\nFind the number of the foods liked by all the N people.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 30\n\n1 \\leq K_i \\leq M\n\n1 \\leq A_{ij} \\leq M\n\nFor each i (1 \\leq i \\leq N), A_{i1}, A_{i2}, ..., A_{iK_i} are distinct.\n\nConstraints\n\nInput is given from Standard Input in the following format:\n\nN M\nK_1 A_{11} A_{12} ... A_{1K_1}\nK_2 A_{21} A_{22} ... A_{2K_2}\n:\nK_N A_{N1} A_{N2} ... A_{NK_N}\n\nOutput\n\nPrint the number of the foods liked by all the N people.\n\nSample Input 1\n\n3 4\n2 1 3\n3 1 2 3\n2 3 2\n\nSample Output 1\n\n1\n\nAs only the third food is liked by all the three people, 1 should be printed.\n\nSample Input 2\n\n5 5\n4 2 3 4 5\n4 1 3 4 5\n4 1 2 4 5\n4 1 2 3 5\n4 1 2 3 4\n\nSample Output 2\n\n0\n\nKatsusando's hypothesis turned out to be wrong.\n\nSample Input 3\n\n1 30\n3 5 10 30\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 202, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s779443877", "group_id": "codeNet:p03127", "input_text": "from fractions import gcd\n\nN = int(input())\n\nAs = list(map(int, input().split()))\n\nd = As[0]\nfor a in As[1:]:\n d = gcd(d, a)\n\nprint(d)", "language": "Python", "metadata": {"date": 1554574267, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03127.html", "problem_id": "p03127", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03127/input.txt", "sample_output_relpath": "derived/input_output/data/p03127/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03127/Python/s779443877.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s779443877", "user_id": "u450339194"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "from fractions import gcd\n\nN = int(input())\n\nAs = list(map(int, input().split()))\n\nd = As[0]\nfor a in As[1:]:\n d = gcd(d, a)\n\nprint(d)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N monsters, numbered 1, 2, ..., N.\n\nInitially, the health of Monster i is A_i.\n\nBelow, a monster with at least 1 health is called alive.\n\nUntil there is only one alive monster, the following is repeated:\n\nA random alive monster attacks another random alive monster.\n\nAs a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.\n\nFind the minimum possible final health of the last monster alive.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible final health of the last monster alive.\n\nSample Input 1\n\n4\n2 10 8 40\n\nSample Output 1\n\n2\n\nWhen only the first monster keeps on attacking, the final health of the last monster will be 2, which is minimum.\n\nSample Input 2\n\n4\n5 13 8 1000000000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n3\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n1000000000", "sample_input": "4\n2 10 8 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03127", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N monsters, numbered 1, 2, ..., N.\n\nInitially, the health of Monster i is A_i.\n\nBelow, a monster with at least 1 health is called alive.\n\nUntil there is only one alive monster, the following is repeated:\n\nA random alive monster attacks another random alive monster.\n\nAs a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.\n\nFind the minimum possible final health of the last monster alive.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible final health of the last monster alive.\n\nSample Input 1\n\n4\n2 10 8 40\n\nSample Output 1\n\n2\n\nWhen only the first monster keeps on attacking, the final health of the last monster will be 2, which is minimum.\n\nSample Input 2\n\n4\n5 13 8 1000000000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n3\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n1000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 137, "cpu_time_ms": 92, "memory_kb": 16280}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s827049312", "group_id": "codeNet:p03127", "input_text": "N = int(raw_input())\nhealth = map(int, raw_input().split())\n\ndef gcd(a, b):\n\twhile b:\n\t\ta, b = b, a % b\n\treturn a\n\ndef gcd_driver(lst):\n\tif len(lst) <= 1:\n\t\treturn lst[0]\n\tif len(lst) > 2:\n\t\tlst[1] = gcd(lst[0], lst[1])\n\t\treturn gcd_driver(lst[1:])\n\telse:\n\t\treturn gcd(lst[0], lst[1])\n\nprint gcd_driver(health)\n", "language": "Python", "metadata": {"date": 1551615240, "filename_ext": "py", "original_language": "Python (2.7.6)", "problem_description_relpath": "problem_descriptions/p03127.html", "problem_id": "p03127", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03127/input.txt", "sample_output_relpath": "derived/input_output/data/p03127/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03127/Python/s827049312.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s827049312", "user_id": "u929937885"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "N = int(raw_input())\nhealth = map(int, raw_input().split())\n\ndef gcd(a, b):\n\twhile b:\n\t\ta, b = b, a % b\n\treturn a\n\ndef gcd_driver(lst):\n\tif len(lst) <= 1:\n\t\treturn lst[0]\n\tif len(lst) > 2:\n\t\tlst[1] = gcd(lst[0], lst[1])\n\t\treturn gcd_driver(lst[1:])\n\telse:\n\t\treturn gcd(lst[0], lst[1])\n\nprint gcd_driver(health)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N monsters, numbered 1, 2, ..., N.\n\nInitially, the health of Monster i is A_i.\n\nBelow, a monster with at least 1 health is called alive.\n\nUntil there is only one alive monster, the following is repeated:\n\nA random alive monster attacks another random alive monster.\n\nAs a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.\n\nFind the minimum possible final health of the last monster alive.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible final health of the last monster alive.\n\nSample Input 1\n\n4\n2 10 8 40\n\nSample Output 1\n\n2\n\nWhen only the first monster keeps on attacking, the final health of the last monster will be 2, which is minimum.\n\nSample Input 2\n\n4\n5 13 8 1000000000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n3\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n1000000000", "sample_input": "4\n2 10 8 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03127", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N monsters, numbered 1, 2, ..., N.\n\nInitially, the health of Monster i is A_i.\n\nBelow, a monster with at least 1 health is called alive.\n\nUntil there is only one alive monster, the following is repeated:\n\nA random alive monster attacks another random alive monster.\n\nAs a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.\n\nFind the minimum possible final health of the last monster alive.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible final health of the last monster alive.\n\nSample Input 1\n\n4\n2 10 8 40\n\nSample Output 1\n\n2\n\nWhen only the first monster keeps on attacking, the final health of the last monster will be 2, which is minimum.\n\nSample Input 2\n\n4\n5 13 8 1000000000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n3\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n1000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 311, "cpu_time_ms": 2152, "memory_kb": 782568}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s476141501", "group_id": "codeNet:p03129", "input_text": "N,K = map(int,input().split())\n\nif (N+1)/2 >= K:\n print('YES')\nelse:\n print('NO')\n ", "language": "Python", "metadata": {"date": 1553962816, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03129.html", "problem_id": "p03129", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03129/input.txt", "sample_output_relpath": "derived/input_output/data/p03129/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03129/Python/s476141501.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s476141501", "user_id": "u698176039"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "N,K = map(int,input().split())\n\nif (N+1)/2 >= K:\n print('YES')\nelse:\n print('NO')\n ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nDetermine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1.\n\nConstraints\n\n1\\leq N,K\\leq 100\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nIf we can choose K integers as above, print YES; otherwise, print NO.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\nYES\n\nWe can choose 1 and 3.\n\nSample Input 2\n\n5 5\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n31 10\n\nSample Output 3\n\nYES\n\nSample Input 4\n\n10 90\n\nSample Output 4\n\nNO", "sample_input": "3 2\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03129", "source_text": "Score : 100 points\n\nProblem Statement\n\nDetermine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1.\n\nConstraints\n\n1\\leq N,K\\leq 100\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nIf we can choose K integers as above, print YES; otherwise, print NO.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\nYES\n\nWe can choose 1 and 3.\n\nSample Input 2\n\n5 5\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n31 10\n\nSample Output 3\n\nYES\n\nSample Input 4\n\n10 90\n\nSample Output 4\n\nNO", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 92, "cpu_time_ms": 19, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s489228098", "group_id": "codeNet:p03131", "input_text": "k,a,b=map(int,input().split())\nif b-a <= 2:\n print(k+1)\n exit()\nif k-a<1:\n print(k+1)\n exit()\nprint(1 + (a-1) + (b-a)*((k-(a-1))//2) + (k-(a-1))%2)", "language": "Python", "metadata": {"date": 1587083195, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03131.html", "problem_id": "p03131", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03131/input.txt", "sample_output_relpath": "derived/input_output/data/p03131/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03131/Python/s489228098.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s489228098", "user_id": "u707124227"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "k,a,b=map(int,input().split())\nif b-a <= 2:\n print(k+1)\n exit()\nif k-a<1:\n print(k+1)\n exit()\nprint(1 + (a-1) + (b-a)*((k-(a-1))//2) + (k-(a-1))%2)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke has one biscuit and zero Japanese yen (the currency) in his pocket.\nHe will perform the following operations exactly K times in total, in the order he likes:\n\nHit his pocket, which magically increases the number of biscuits by one.\n\nExchange A biscuits to 1 yen.\n\nExchange 1 yen to B biscuits.\n\nFind the maximum possible number of biscuits in Snuke's pocket after K operations.\n\nConstraints\n\n1 \\leq K,A,B \\leq 10^9\n\nK,A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK A B\n\nOutput\n\nPrint the maximum possible number of biscuits in Snuke's pocket after K operations.\n\nSample Input 1\n\n4 2 6\n\nSample Output 1\n\n7\n\nThe number of biscuits in Snuke's pocket after K operations is maximized as follows:\n\nHit his pocket. Now he has 2 biscuits and 0 yen.\n\nExchange 2 biscuits to 1 yen. his pocket. Now he has 0 biscuits and 1 yen.\n\nHit his pocket. Now he has 1 biscuits and 1 yen.\n\nExchange 1 yen to 6 biscuits. his pocket. Now he has 7 biscuits and 0 yen.\n\nSample Input 2\n\n7 3 4\n\nSample Output 2\n\n8\n\nSample Input 3\n\n314159265 35897932 384626433\n\nSample Output 3\n\n48518828981938099", "sample_input": "4 2 6\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03131", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke has one biscuit and zero Japanese yen (the currency) in his pocket.\nHe will perform the following operations exactly K times in total, in the order he likes:\n\nHit his pocket, which magically increases the number of biscuits by one.\n\nExchange A biscuits to 1 yen.\n\nExchange 1 yen to B biscuits.\n\nFind the maximum possible number of biscuits in Snuke's pocket after K operations.\n\nConstraints\n\n1 \\leq K,A,B \\leq 10^9\n\nK,A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK A B\n\nOutput\n\nPrint the maximum possible number of biscuits in Snuke's pocket after K operations.\n\nSample Input 1\n\n4 2 6\n\nSample Output 1\n\n7\n\nThe number of biscuits in Snuke's pocket after K operations is maximized as follows:\n\nHit his pocket. Now he has 2 biscuits and 0 yen.\n\nExchange 2 biscuits to 1 yen. his pocket. Now he has 0 biscuits and 1 yen.\n\nHit his pocket. Now he has 1 biscuits and 1 yen.\n\nExchange 1 yen to 6 biscuits. his pocket. Now he has 7 biscuits and 0 yen.\n\nSample Input 2\n\n7 3 4\n\nSample Output 2\n\n8\n\nSample Input 3\n\n314159265 35897932 384626433\n\nSample Output 3\n\n48518828981938099", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 151, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s490691196", "group_id": "codeNet:p03131", "input_text": "K, A, B = map(int, input().split())\n\nbs = 1\nyen = 0\nif B - A < 2:\n bs = K + 1\nelse:\n if K < A + 1:\n bs = K + 1\n else:\n #print(A)\n #print((B - A) * ((K - A + 1) // 2) )\n #print((K - A + 1) % 2)\n bs = A + (B - A) * ((K - A + 1) // 2) + ((K - A + 1) % 2)\n\nprint(bs)", "language": "Python", "metadata": {"date": 1549769890, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03131.html", "problem_id": "p03131", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03131/input.txt", "sample_output_relpath": "derived/input_output/data/p03131/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03131/Python/s490691196.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s490691196", "user_id": "u463950771"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "K, A, B = map(int, input().split())\n\nbs = 1\nyen = 0\nif B - A < 2:\n bs = K + 1\nelse:\n if K < A + 1:\n bs = K + 1\n else:\n #print(A)\n #print((B - A) * ((K - A + 1) // 2) )\n #print((K - A + 1) % 2)\n bs = A + (B - A) * ((K - A + 1) // 2) + ((K - A + 1) % 2)\n\nprint(bs)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke has one biscuit and zero Japanese yen (the currency) in his pocket.\nHe will perform the following operations exactly K times in total, in the order he likes:\n\nHit his pocket, which magically increases the number of biscuits by one.\n\nExchange A biscuits to 1 yen.\n\nExchange 1 yen to B biscuits.\n\nFind the maximum possible number of biscuits in Snuke's pocket after K operations.\n\nConstraints\n\n1 \\leq K,A,B \\leq 10^9\n\nK,A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK A B\n\nOutput\n\nPrint the maximum possible number of biscuits in Snuke's pocket after K operations.\n\nSample Input 1\n\n4 2 6\n\nSample Output 1\n\n7\n\nThe number of biscuits in Snuke's pocket after K operations is maximized as follows:\n\nHit his pocket. Now he has 2 biscuits and 0 yen.\n\nExchange 2 biscuits to 1 yen. his pocket. Now he has 0 biscuits and 1 yen.\n\nHit his pocket. Now he has 1 biscuits and 1 yen.\n\nExchange 1 yen to 6 biscuits. his pocket. Now he has 7 biscuits and 0 yen.\n\nSample Input 2\n\n7 3 4\n\nSample Output 2\n\n8\n\nSample Input 3\n\n314159265 35897932 384626433\n\nSample Output 3\n\n48518828981938099", "sample_input": "4 2 6\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03131", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke has one biscuit and zero Japanese yen (the currency) in his pocket.\nHe will perform the following operations exactly K times in total, in the order he likes:\n\nHit his pocket, which magically increases the number of biscuits by one.\n\nExchange A biscuits to 1 yen.\n\nExchange 1 yen to B biscuits.\n\nFind the maximum possible number of biscuits in Snuke's pocket after K operations.\n\nConstraints\n\n1 \\leq K,A,B \\leq 10^9\n\nK,A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK A B\n\nOutput\n\nPrint the maximum possible number of biscuits in Snuke's pocket after K operations.\n\nSample Input 1\n\n4 2 6\n\nSample Output 1\n\n7\n\nThe number of biscuits in Snuke's pocket after K operations is maximized as follows:\n\nHit his pocket. Now he has 2 biscuits and 0 yen.\n\nExchange 2 biscuits to 1 yen. his pocket. Now he has 0 biscuits and 1 yen.\n\nHit his pocket. Now he has 1 biscuits and 1 yen.\n\nExchange 1 yen to 6 biscuits. his pocket. Now he has 7 biscuits and 0 yen.\n\nSample Input 2\n\n7 3 4\n\nSample Output 2\n\n8\n\nSample Input 3\n\n314159265 35897932 384626433\n\nSample Output 3\n\n48518828981938099", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 306, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s923306258", "group_id": "codeNet:p03135", "input_text": "hours, multi_time = map(int, input().split())\n\nresult = hours / multi_time\nprint(result)", "language": "Python", "metadata": {"date": 1599545818, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03135.html", "problem_id": "p03135", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03135/input.txt", "sample_output_relpath": "derived/input_output/data/p03135/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03135/Python/s923306258.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s923306258", "user_id": "u905895868"}, "prompt_components": {"gold_output": "2.6666666667\n", "input_to_evaluate": "hours, multi_time = map(int, input().split())\n\nresult = hours / multi_time\nprint(result)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn order to pass the entrance examination tomorrow, Taro has to study for T more hours.\n\nFortunately, he can leap to World B where time passes X times as fast as it does in our world (World A).\n\nWhile (X \\times t) hours pass in World B, t hours pass in World A.\n\nHow many hours will pass in World A while Taro studies for T hours in World B?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq T \\leq 100\n\n1 \\leq X \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT X\n\nOutput\n\nPrint the number of hours that will pass in World A.\n\nThe output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}.\n\nSample Input 1\n\n8 3\n\nSample Output 1\n\n2.6666666667\n\nWhile Taro studies for eight hours in World B where time passes three times as fast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\nSample Input 2\n\n99 1\n\nSample Output 2\n\n99.0000000000\n\nSample Input 3\n\n1 100\n\nSample Output 3\n\n0.0100000000", "sample_input": "8 3\n"}, "reference_outputs": ["2.6666666667\n"], "source_document_id": "p03135", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn order to pass the entrance examination tomorrow, Taro has to study for T more hours.\n\nFortunately, he can leap to World B where time passes X times as fast as it does in our world (World A).\n\nWhile (X \\times t) hours pass in World B, t hours pass in World A.\n\nHow many hours will pass in World A while Taro studies for T hours in World B?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq T \\leq 100\n\n1 \\leq X \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT X\n\nOutput\n\nPrint the number of hours that will pass in World A.\n\nThe output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}.\n\nSample Input 1\n\n8 3\n\nSample Output 1\n\n2.6666666667\n\nWhile Taro studies for eight hours in World B where time passes three times as fast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\nSample Input 2\n\n99 1\n\nSample Output 2\n\n99.0000000000\n\nSample Input 3\n\n1 100\n\nSample Output 3\n\n0.0100000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 88, "cpu_time_ms": 28, "memory_kb": 9080}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s378203451", "group_id": "codeNet:p03135", "input_text": "T,X = map(int,input().split())\nprint(T/X)", "language": "Python", "metadata": {"date": 1582226761, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03135.html", "problem_id": "p03135", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03135/input.txt", "sample_output_relpath": "derived/input_output/data/p03135/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03135/Python/s378203451.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s378203451", "user_id": "u759412327"}, "prompt_components": {"gold_output": "2.6666666667\n", "input_to_evaluate": "T,X = map(int,input().split())\nprint(T/X)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn order to pass the entrance examination tomorrow, Taro has to study for T more hours.\n\nFortunately, he can leap to World B where time passes X times as fast as it does in our world (World A).\n\nWhile (X \\times t) hours pass in World B, t hours pass in World A.\n\nHow many hours will pass in World A while Taro studies for T hours in World B?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq T \\leq 100\n\n1 \\leq X \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT X\n\nOutput\n\nPrint the number of hours that will pass in World A.\n\nThe output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}.\n\nSample Input 1\n\n8 3\n\nSample Output 1\n\n2.6666666667\n\nWhile Taro studies for eight hours in World B where time passes three times as fast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\nSample Input 2\n\n99 1\n\nSample Output 2\n\n99.0000000000\n\nSample Input 3\n\n1 100\n\nSample Output 3\n\n0.0100000000", "sample_input": "8 3\n"}, "reference_outputs": ["2.6666666667\n"], "source_document_id": "p03135", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn order to pass the entrance examination tomorrow, Taro has to study for T more hours.\n\nFortunately, he can leap to World B where time passes X times as fast as it does in our world (World A).\n\nWhile (X \\times t) hours pass in World B, t hours pass in World A.\n\nHow many hours will pass in World A while Taro studies for T hours in World B?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq T \\leq 100\n\n1 \\leq X \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT X\n\nOutput\n\nPrint the number of hours that will pass in World A.\n\nThe output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}.\n\nSample Input 1\n\n8 3\n\nSample Output 1\n\n2.6666666667\n\nWhile Taro studies for eight hours in World B where time passes three times as fast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\nSample Input 2\n\n99 1\n\nSample Output 2\n\n99.0000000000\n\nSample Input 3\n\n1 100\n\nSample Output 3\n\n0.0100000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 41, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s773361996", "group_id": "codeNet:p03135", "input_text": "t,x = map(int,input().split())\nprint(t/x)\n", "language": "Python", "metadata": {"date": 1579121869, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03135.html", "problem_id": "p03135", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03135/input.txt", "sample_output_relpath": "derived/input_output/data/p03135/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03135/Python/s773361996.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s773361996", "user_id": "u287880059"}, "prompt_components": {"gold_output": "2.6666666667\n", "input_to_evaluate": "t,x = map(int,input().split())\nprint(t/x)\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn order to pass the entrance examination tomorrow, Taro has to study for T more hours.\n\nFortunately, he can leap to World B where time passes X times as fast as it does in our world (World A).\n\nWhile (X \\times t) hours pass in World B, t hours pass in World A.\n\nHow many hours will pass in World A while Taro studies for T hours in World B?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq T \\leq 100\n\n1 \\leq X \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT X\n\nOutput\n\nPrint the number of hours that will pass in World A.\n\nThe output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}.\n\nSample Input 1\n\n8 3\n\nSample Output 1\n\n2.6666666667\n\nWhile Taro studies for eight hours in World B where time passes three times as fast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\nSample Input 2\n\n99 1\n\nSample Output 2\n\n99.0000000000\n\nSample Input 3\n\n1 100\n\nSample Output 3\n\n0.0100000000", "sample_input": "8 3\n"}, "reference_outputs": ["2.6666666667\n"], "source_document_id": "p03135", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn order to pass the entrance examination tomorrow, Taro has to study for T more hours.\n\nFortunately, he can leap to World B where time passes X times as fast as it does in our world (World A).\n\nWhile (X \\times t) hours pass in World B, t hours pass in World A.\n\nHow many hours will pass in World A while Taro studies for T hours in World B?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq T \\leq 100\n\n1 \\leq X \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT X\n\nOutput\n\nPrint the number of hours that will pass in World A.\n\nThe output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}.\n\nSample Input 1\n\n8 3\n\nSample Output 1\n\n2.6666666667\n\nWhile Taro studies for eight hours in World B where time passes three times as fast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\nSample Input 2\n\n99 1\n\nSample Output 2\n\n99.0000000000\n\nSample Input 3\n\n1 100\n\nSample Output 3\n\n0.0100000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 42, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s308735098", "group_id": "codeNet:p03135", "input_text": "# ABC 117: A – Entrance Examination\nt, x = [int(s) for s in input().split()]\nprint('{:.4f}'.format(t / x))", "language": "Python", "metadata": {"date": 1573068283, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03135.html", "problem_id": "p03135", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03135/input.txt", "sample_output_relpath": "derived/input_output/data/p03135/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03135/Python/s308735098.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s308735098", "user_id": "u276115223"}, "prompt_components": {"gold_output": "2.6666666667\n", "input_to_evaluate": "# ABC 117: A – Entrance Examination\nt, x = [int(s) for s in input().split()]\nprint('{:.4f}'.format(t / x))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn order to pass the entrance examination tomorrow, Taro has to study for T more hours.\n\nFortunately, he can leap to World B where time passes X times as fast as it does in our world (World A).\n\nWhile (X \\times t) hours pass in World B, t hours pass in World A.\n\nHow many hours will pass in World A while Taro studies for T hours in World B?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq T \\leq 100\n\n1 \\leq X \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT X\n\nOutput\n\nPrint the number of hours that will pass in World A.\n\nThe output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}.\n\nSample Input 1\n\n8 3\n\nSample Output 1\n\n2.6666666667\n\nWhile Taro studies for eight hours in World B where time passes three times as fast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\nSample Input 2\n\n99 1\n\nSample Output 2\n\n99.0000000000\n\nSample Input 3\n\n1 100\n\nSample Output 3\n\n0.0100000000", "sample_input": "8 3\n"}, "reference_outputs": ["2.6666666667\n"], "source_document_id": "p03135", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn order to pass the entrance examination tomorrow, Taro has to study for T more hours.\n\nFortunately, he can leap to World B where time passes X times as fast as it does in our world (World A).\n\nWhile (X \\times t) hours pass in World B, t hours pass in World A.\n\nHow many hours will pass in World A while Taro studies for T hours in World B?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq T \\leq 100\n\n1 \\leq X \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT X\n\nOutput\n\nPrint the number of hours that will pass in World A.\n\nThe output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}.\n\nSample Input 1\n\n8 3\n\nSample Output 1\n\n2.6666666667\n\nWhile Taro studies for eight hours in World B where time passes three times as fast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\nSample Input 2\n\n99 1\n\nSample Output 2\n\n99.0000000000\n\nSample Input 3\n\n1 100\n\nSample Output 3\n\n0.0100000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 108, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s692910023", "group_id": "codeNet:p03136", "input_text": "n = int(input())\nl = list(map(int, input().split()))\n\nl_s = list(sorted(l))\nprint( 'Yes' if (l_s[-1] < sum(l_s[:-1])) else 'No')", "language": "Python", "metadata": {"date": 1592870733, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03136.html", "problem_id": "p03136", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03136/input.txt", "sample_output_relpath": "derived/input_output/data/p03136/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03136/Python/s692910023.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s692910023", "user_id": "u460615319"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "n = int(input())\nl = list(map(int, input().split()))\n\nl_s = list(sorted(l))\nprint( 'Yes' if (l_s[-1] < sum(l_s[:-1])) else 'No')", "problem_context": "Score : 200 points\n\nProblem Statement\n\nDetermine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane.\n\nYou can use the following theorem:\n\nTheorem: an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10\n\n1 \\leq L_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_N\n\nOutput\n\nIf an N-sided polygon satisfying the condition can be drawn, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\n3 8 5 1\n\nSample Output 1\n\nYes\n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can be drawn on a plane.\n\nSample Input 2\n\n4\n3 8 4 1\n\nSample Output 2\n\nNo\n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon cannot be drawn on a plane.\n\nSample Input 3\n\n10\n1 8 10 5 8 12 34 100 11 3\n\nSample Output 3\n\nNo", "sample_input": "4\n3 8 5 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03136", "source_text": "Score : 200 points\n\nProblem Statement\n\nDetermine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane.\n\nYou can use the following theorem:\n\nTheorem: an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10\n\n1 \\leq L_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_N\n\nOutput\n\nIf an N-sided polygon satisfying the condition can be drawn, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\n3 8 5 1\n\nSample Output 1\n\nYes\n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can be drawn on a plane.\n\nSample Input 2\n\n4\n3 8 4 1\n\nSample Output 2\n\nNo\n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon cannot be drawn on a plane.\n\nSample Input 3\n\n10\n1 8 10 5 8 12 34 100 11 3\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 128, "cpu_time_ms": 32, "memory_kb": 9144}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s503878511", "group_id": "codeNet:p03136", "input_text": "input()\nL = sorted([int(x) for x in input().split()])\n\nl = L[-1]\nif l < sum(L[:-1]):\n print(\"Yes\")\nelse:\n print(\"No\")", "language": "Python", "metadata": {"date": 1559142442, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03136.html", "problem_id": "p03136", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03136/input.txt", "sample_output_relpath": "derived/input_output/data/p03136/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03136/Python/s503878511.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s503878511", "user_id": "u736729525"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "input()\nL = sorted([int(x) for x in input().split()])\n\nl = L[-1]\nif l < sum(L[:-1]):\n print(\"Yes\")\nelse:\n print(\"No\")", "problem_context": "Score : 200 points\n\nProblem Statement\n\nDetermine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane.\n\nYou can use the following theorem:\n\nTheorem: an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10\n\n1 \\leq L_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_N\n\nOutput\n\nIf an N-sided polygon satisfying the condition can be drawn, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\n3 8 5 1\n\nSample Output 1\n\nYes\n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can be drawn on a plane.\n\nSample Input 2\n\n4\n3 8 4 1\n\nSample Output 2\n\nNo\n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon cannot be drawn on a plane.\n\nSample Input 3\n\n10\n1 8 10 5 8 12 34 100 11 3\n\nSample Output 3\n\nNo", "sample_input": "4\n3 8 5 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03136", "source_text": "Score : 200 points\n\nProblem Statement\n\nDetermine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane.\n\nYou can use the following theorem:\n\nTheorem: an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10\n\n1 \\leq L_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_N\n\nOutput\n\nIf an N-sided polygon satisfying the condition can be drawn, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\n3 8 5 1\n\nSample Output 1\n\nYes\n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can be drawn on a plane.\n\nSample Input 2\n\n4\n3 8 4 1\n\nSample Output 2\n\nNo\n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon cannot be drawn on a plane.\n\nSample Input 3\n\n10\n1 8 10 5 8 12 34 100 11 3\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 123, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s141284846", "group_id": "codeNet:p03136", "input_text": "n = int(input())\nnums = list(map(int, input().split()))\nnums.sort()\nif nums[n-1] < sum(nums[:n]):\n print(\"Yes\")\nelse:\n print(\"No\")", "language": "Python", "metadata": {"date": 1549248460, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03136.html", "problem_id": "p03136", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03136/input.txt", "sample_output_relpath": "derived/input_output/data/p03136/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03136/Python/s141284846.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s141284846", "user_id": "u937529125"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "n = int(input())\nnums = list(map(int, input().split()))\nnums.sort()\nif nums[n-1] < sum(nums[:n]):\n print(\"Yes\")\nelse:\n print(\"No\")", "problem_context": "Score : 200 points\n\nProblem Statement\n\nDetermine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane.\n\nYou can use the following theorem:\n\nTheorem: an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10\n\n1 \\leq L_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_N\n\nOutput\n\nIf an N-sided polygon satisfying the condition can be drawn, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\n3 8 5 1\n\nSample Output 1\n\nYes\n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can be drawn on a plane.\n\nSample Input 2\n\n4\n3 8 4 1\n\nSample Output 2\n\nNo\n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon cannot be drawn on a plane.\n\nSample Input 3\n\n10\n1 8 10 5 8 12 34 100 11 3\n\nSample Output 3\n\nNo", "sample_input": "4\n3 8 5 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03136", "source_text": "Score : 200 points\n\nProblem Statement\n\nDetermine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane.\n\nYou can use the following theorem:\n\nTheorem: an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10\n\n1 \\leq L_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_N\n\nOutput\n\nIf an N-sided polygon satisfying the condition can be drawn, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\n3 8 5 1\n\nSample Output 1\n\nYes\n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can be drawn on a plane.\n\nSample Input 2\n\n4\n3 8 4 1\n\nSample Output 2\n\nNo\n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon cannot be drawn on a plane.\n\nSample Input 3\n\n10\n1 8 10 5 8 12 34 100 11 3\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 136, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s807531377", "group_id": "codeNet:p03137", "input_text": "n,m,*x = map(int,open(0).read().split())\nx.sort()\nif n >= m:\n print(0)\n exit()\na = sorted([x[i+1]-x[i] for i in range(m-1)],reverse=True)\nans = x[-1]-x[0]\nfor i in range(n-1):\n ans -= a[i]\nprint(ans)", "language": "Python", "metadata": {"date": 1590290842, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03137.html", "problem_id": "p03137", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03137/input.txt", "sample_output_relpath": "derived/input_output/data/p03137/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03137/Python/s807531377.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s807531377", "user_id": "u857759499"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "n,m,*x = map(int,open(0).read().split())\nx.sort()\nif n >= m:\n print(0)\n exit()\na = sorted([x[i+1]-x[i] for i in range(m-1)],reverse=True)\nans = x[-1]-x[0]\nfor i in range(n-1):\n ans -= a[i]\nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe will play a one-player game using a number line and N pieces.\n\nFirst, we place each of these pieces at some integer coordinate.\n\nHere, multiple pieces can be placed at the same coordinate.\n\nOur objective is to visit all of the M coordinates X_1, X_2, ..., X_M with these pieces, by repeating the following move:\n\nMove: Choose a piece and let x be its coordinate. Put that piece at coordinate x+1 or x-1.\n\nNote that the coordinates where we initially place the pieces are already regarded as visited.\n\nFind the minimum number of moves required to achieve the objective.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n-10^5 \\leq X_i \\leq 10^5\n\nX_1, X_2, ..., X_M are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nX_1 X_2 ... X_M\n\nOutput\n\nFind the minimum number of moves required to achieve the objective.\n\nSample Input 1\n\n2 5\n10 12 1 2 14\n\nSample Output 1\n\n5\n\nThe objective can be achieved in five moves as follows, and this is the minimum number of moves required.\n\nInitially, put the two pieces at coordinates 1 and 10.\n\nMove the piece at coordinate 1 to 2.\n\nMove the piece at coordinate 10 to 11.\n\nMove the piece at coordinate 11 to 12.\n\nMove the piece at coordinate 12 to 13.\n\nMove the piece at coordinate 13 to 14.\n\nSample Input 2\n\n3 7\n-10 -3 0 9 -100 2 17\n\nSample Output 2\n\n19\n\nSample Input 3\n\n100 1\n-100000\n\nSample Output 3\n\n0", "sample_input": "2 5\n10 12 1 2 14\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03137", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe will play a one-player game using a number line and N pieces.\n\nFirst, we place each of these pieces at some integer coordinate.\n\nHere, multiple pieces can be placed at the same coordinate.\n\nOur objective is to visit all of the M coordinates X_1, X_2, ..., X_M with these pieces, by repeating the following move:\n\nMove: Choose a piece and let x be its coordinate. Put that piece at coordinate x+1 or x-1.\n\nNote that the coordinates where we initially place the pieces are already regarded as visited.\n\nFind the minimum number of moves required to achieve the objective.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n-10^5 \\leq X_i \\leq 10^5\n\nX_1, X_2, ..., X_M are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nX_1 X_2 ... X_M\n\nOutput\n\nFind the minimum number of moves required to achieve the objective.\n\nSample Input 1\n\n2 5\n10 12 1 2 14\n\nSample Output 1\n\n5\n\nThe objective can be achieved in five moves as follows, and this is the minimum number of moves required.\n\nInitially, put the two pieces at coordinates 1 and 10.\n\nMove the piece at coordinate 1 to 2.\n\nMove the piece at coordinate 10 to 11.\n\nMove the piece at coordinate 11 to 12.\n\nMove the piece at coordinate 12 to 13.\n\nMove the piece at coordinate 13 to 14.\n\nSample Input 2\n\n3 7\n-10 -3 0 9 -100 2 17\n\nSample Output 2\n\n19\n\nSample Input 3\n\n100 1\n-100000\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 202, "cpu_time_ms": 115, "memory_kb": 13964}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s128469484", "group_id": "codeNet:p03137", "input_text": "N,M= map(int,input().split())\n\nX=list(map(int,input().split()))\nX.sort()\n\nL=[0]*(M-1)\nfor i in range(M-1):\n L[i] = X[i+1]-X[i]\n\n\nL.sort()\n\nprint(sum(L[:-N+1]))", "language": "Python", "metadata": {"date": 1588380846, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03137.html", "problem_id": "p03137", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03137/input.txt", "sample_output_relpath": "derived/input_output/data/p03137/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03137/Python/s128469484.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s128469484", "user_id": "u481101428"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "N,M= map(int,input().split())\n\nX=list(map(int,input().split()))\nX.sort()\n\nL=[0]*(M-1)\nfor i in range(M-1):\n L[i] = X[i+1]-X[i]\n\n\nL.sort()\n\nprint(sum(L[:-N+1]))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe will play a one-player game using a number line and N pieces.\n\nFirst, we place each of these pieces at some integer coordinate.\n\nHere, multiple pieces can be placed at the same coordinate.\n\nOur objective is to visit all of the M coordinates X_1, X_2, ..., X_M with these pieces, by repeating the following move:\n\nMove: Choose a piece and let x be its coordinate. Put that piece at coordinate x+1 or x-1.\n\nNote that the coordinates where we initially place the pieces are already regarded as visited.\n\nFind the minimum number of moves required to achieve the objective.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n-10^5 \\leq X_i \\leq 10^5\n\nX_1, X_2, ..., X_M are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nX_1 X_2 ... X_M\n\nOutput\n\nFind the minimum number of moves required to achieve the objective.\n\nSample Input 1\n\n2 5\n10 12 1 2 14\n\nSample Output 1\n\n5\n\nThe objective can be achieved in five moves as follows, and this is the minimum number of moves required.\n\nInitially, put the two pieces at coordinates 1 and 10.\n\nMove the piece at coordinate 1 to 2.\n\nMove the piece at coordinate 10 to 11.\n\nMove the piece at coordinate 11 to 12.\n\nMove the piece at coordinate 12 to 13.\n\nMove the piece at coordinate 13 to 14.\n\nSample Input 2\n\n3 7\n-10 -3 0 9 -100 2 17\n\nSample Output 2\n\n19\n\nSample Input 3\n\n100 1\n-100000\n\nSample Output 3\n\n0", "sample_input": "2 5\n10 12 1 2 14\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03137", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe will play a one-player game using a number line and N pieces.\n\nFirst, we place each of these pieces at some integer coordinate.\n\nHere, multiple pieces can be placed at the same coordinate.\n\nOur objective is to visit all of the M coordinates X_1, X_2, ..., X_M with these pieces, by repeating the following move:\n\nMove: Choose a piece and let x be its coordinate. Put that piece at coordinate x+1 or x-1.\n\nNote that the coordinates where we initially place the pieces are already regarded as visited.\n\nFind the minimum number of moves required to achieve the objective.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n-10^5 \\leq X_i \\leq 10^5\n\nX_1, X_2, ..., X_M are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nX_1 X_2 ... X_M\n\nOutput\n\nFind the minimum number of moves required to achieve the objective.\n\nSample Input 1\n\n2 5\n10 12 1 2 14\n\nSample Output 1\n\n5\n\nThe objective can be achieved in five moves as follows, and this is the minimum number of moves required.\n\nInitially, put the two pieces at coordinates 1 and 10.\n\nMove the piece at coordinate 1 to 2.\n\nMove the piece at coordinate 10 to 11.\n\nMove the piece at coordinate 11 to 12.\n\nMove the piece at coordinate 12 to 13.\n\nMove the piece at coordinate 13 to 14.\n\nSample Input 2\n\n3 7\n-10 -3 0 9 -100 2 17\n\nSample Output 2\n\n19\n\nSample Input 3\n\n100 1\n-100000\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 159, "cpu_time_ms": 109, "memory_kb": 13960}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s311217827", "group_id": "codeNet:p03140", "input_text": "n=int(input())\na=input()\nb=input()\nc=input()\n\nret = 0\nfor i in range(n):\n if a[i] == b[i] == c[i]:\n continue\n if a[i] == b[i] or b[i] == c[i] or a[i] == c[i] :\n ret += 1\n else:\n ret += 2\n\nprint(ret)", "language": "Python", "metadata": {"date": 1548728788, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03140.html", "problem_id": "p03140", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03140/input.txt", "sample_output_relpath": "derived/input_output/data/p03140/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03140/Python/s311217827.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s311217827", "user_id": "u702582248"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "n=int(input())\na=input()\nb=input()\nc=input()\n\nret = 0\nfor i in range(n):\n if a[i] == b[i] == c[i]:\n continue\n if a[i] == b[i] or b[i] == c[i] or a[i] == c[i] :\n ret += 1\n else:\n ret += 2\n\nprint(ret)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.\n\nOur objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:\n\nOperation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.\n\nWhat is the minimum number of operations required to achieve the objective?\n\nConstraints\n\n1 \\leq N \\leq 100\n\nEach of the strings A, B and C is a string of length N.\n\nEach character in each of the strings A, B and C is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA\nB\nC\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4\nwest\neast\nwait\n\nSample Output 1\n\n3\n\nIn this sample, initially A = west、B = east、C = wait. We can achieve the objective in the minimum number of operations by performing three operations as follows:\n\nChange the second character in A to a. A is now wast.\n\nChange the first character in B to w. B is now wast.\n\nChange the third character in C to s. C is now wast.\n\nSample Input 2\n\n9\ndifferent\ndifferent\ndifferent\n\nSample Output 2\n\n0\n\nIf A, B and C are already equal in the beginning, the number of operations required is 0.\n\nSample Input 3\n\n7\nzenkoku\ntouitsu\nprogram\n\nSample Output 3\n\n13", "sample_input": "4\nwest\neast\nwait\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03140", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.\n\nOur objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:\n\nOperation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.\n\nWhat is the minimum number of operations required to achieve the objective?\n\nConstraints\n\n1 \\leq N \\leq 100\n\nEach of the strings A, B and C is a string of length N.\n\nEach character in each of the strings A, B and C is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA\nB\nC\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4\nwest\neast\nwait\n\nSample Output 1\n\n3\n\nIn this sample, initially A = west、B = east、C = wait. We can achieve the objective in the minimum number of operations by performing three operations as follows:\n\nChange the second character in A to a. A is now wast.\n\nChange the first character in B to w. B is now wast.\n\nChange the third character in C to s. C is now wast.\n\nSample Input 2\n\n9\ndifferent\ndifferent\ndifferent\n\nSample Output 2\n\n0\n\nIf A, B and C are already equal in the beginning, the number of operations required is 0.\n\nSample Input 3\n\n7\nzenkoku\ntouitsu\nprogram\n\nSample Output 3\n\n13", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 228, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s173489546", "group_id": "codeNet:p03141", "input_text": "s=[list(map(int,input().split()))for i in range(int(input()))];print(sum(sorted([x[1]+x[0] for x in s])[::-2])-sum([x[1]for x in s]))", "language": "Python", "metadata": {"date": 1553809136, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03141.html", "problem_id": "p03141", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03141/input.txt", "sample_output_relpath": "derived/input_output/data/p03141/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03141/Python/s173489546.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s173489546", "user_id": "u619819312"}, "prompt_components": {"gold_output": "20\n", "input_to_evaluate": "s=[list(map(int,input().split()))for i in range(int(input()))];print(sum(sorted([x[1]+x[0] for x in s])[::-2])-sum([x[1]for x in s]))", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N dishes of cuisine placed in front of Takahashi and Aoki.\nFor convenience, we call these dishes Dish 1, Dish 2, ..., Dish N.\n\nWhen Takahashi eats Dish i, he earns A_i points of happiness; when Aoki eats Dish i, she earns B_i points of happiness.\n\nStarting from Takahashi, they alternately choose one dish and eat it, until there is no more dish to eat.\nHere, both of them choose dishes so that the following value is maximized: \"the sum of the happiness he/she will earn in the end\" minus \"the sum of the happiness the other person will earn in the end\".\n\nFind the value: \"the sum of the happiness Takahashi earns in the end\" minus \"the sum of the happiness Aoki earns in the end\".\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq 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\nA_1 B_1\n:\nA_N B_N\n\nOutput\n\nPrint the value: \"the sum of the happiness Takahashi earns in the end\" minus \"the sum of the happiness Aoki earns in the end\".\n\nSample Input 1\n\n3\n10 10\n20 20\n30 30\n\nSample Output 1\n\n20\n\nIn this sample, both of them earns 10 points of happiness by eating Dish 1, 20 points by eating Dish 2, and 30 points by eating Dish 3.\n\nIn this case, since Takahashi and Aoki have the same \"taste\", each time they will choose the dish with which they can earn the greatest happiness. Thus, first Takahashi will choose Dish 3, then Aoki will choose Dish 2, and finally Takahashi will choose Dish 1, so the answer is (30 + 10) - 20 = 20.\n\nSample Input 2\n\n3\n20 10\n20 20\n20 30\n\nSample Output 2\n\n20\n\nIn this sample, Takahashi earns 20 points of happiness by eating any one of the dishes 1, 2 and 3, but Aoki earns 10 points of happiness by eating Dish 1, 20 points by eating Dish 2, and 30 points by eating Dish 3.\n\nIn this case, since only Aoki has likes and dislikes, each time they will choose the dish with which Aoki can earn the greatest happiness. Thus, first Takahashi will choose Dish 3, then Aoki will choose Dish 2, and finally Takahashi will choose Dish 1, so the answer is (20 + 20) - 20 = 20.\n\nSample Input 3\n\n6\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 3\n\n-2999999997\n\nNote that the answer may not fit into a 32-bit integer.", "sample_input": "3\n10 10\n20 20\n30 30\n"}, "reference_outputs": ["20\n"], "source_document_id": "p03141", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N dishes of cuisine placed in front of Takahashi and Aoki.\nFor convenience, we call these dishes Dish 1, Dish 2, ..., Dish N.\n\nWhen Takahashi eats Dish i, he earns A_i points of happiness; when Aoki eats Dish i, she earns B_i points of happiness.\n\nStarting from Takahashi, they alternately choose one dish and eat it, until there is no more dish to eat.\nHere, both of them choose dishes so that the following value is maximized: \"the sum of the happiness he/she will earn in the end\" minus \"the sum of the happiness the other person will earn in the end\".\n\nFind the value: \"the sum of the happiness Takahashi earns in the end\" minus \"the sum of the happiness Aoki earns in the end\".\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq 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\nA_1 B_1\n:\nA_N B_N\n\nOutput\n\nPrint the value: \"the sum of the happiness Takahashi earns in the end\" minus \"the sum of the happiness Aoki earns in the end\".\n\nSample Input 1\n\n3\n10 10\n20 20\n30 30\n\nSample Output 1\n\n20\n\nIn this sample, both of them earns 10 points of happiness by eating Dish 1, 20 points by eating Dish 2, and 30 points by eating Dish 3.\n\nIn this case, since Takahashi and Aoki have the same \"taste\", each time they will choose the dish with which they can earn the greatest happiness. Thus, first Takahashi will choose Dish 3, then Aoki will choose Dish 2, and finally Takahashi will choose Dish 1, so the answer is (30 + 10) - 20 = 20.\n\nSample Input 2\n\n3\n20 10\n20 20\n20 30\n\nSample Output 2\n\n20\n\nIn this sample, Takahashi earns 20 points of happiness by eating any one of the dishes 1, 2 and 3, but Aoki earns 10 points of happiness by eating Dish 1, 20 points by eating Dish 2, and 30 points by eating Dish 3.\n\nIn this case, since only Aoki has likes and dislikes, each time they will choose the dish with which Aoki can earn the greatest happiness. Thus, first Takahashi will choose Dish 3, then Aoki will choose Dish 2, and finally Takahashi will choose Dish 1, so the answer is (20 + 20) - 20 = 20.\n\nSample Input 3\n\n6\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 3\n\n-2999999997\n\nNote that the answer may not fit into a 32-bit integer.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 133, "cpu_time_ms": 380, "memory_kb": 32660}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s322147339", "group_id": "codeNet:p03142", "input_text": "# 有効グラフ上で、近道に当たる点はすべて余計な辺\n# ある点に入ってくる最も距離が長い辺のみが有効となる\n# 一番距離が長い人版ダイクストラやってみる\n# 入力のあった頂点を記録することで、入力の無かった頂点を根とみなせる\n\nimport sys\nreadline = sys.stdin.readline\n\nN,M = map(int,readline().split())\nG = [[] for i in range(N)]\ngrandparent = set(range(N))\nfor i in range(N - 1 + M):\n a,b = map(int,readline().split())\n G[a-1].append(b-1)\n grandparent -= {b - 1}\n\nstart = list(grandparent)[0]\nimport heapq\n\n# 距離, 頂点, 親\nq = [(0, start, -1)]\nheapq.heapify(q)\n\n# ans[頂点] = (到達コスト,親)\nans = [(-1, -1) for i in range(N)]\nwhile q:\n dist, v, parent = heapq.heappop(q)\n dist = -dist\n if ans[v][0] >= dist:\n continue\n ans[v] = (dist, parent)\n for child in G[v]:\n heapq.heappush(q,(-(dist + 1), child, v))\n \nfor a in ans:\n print(a[1] + 1)", "language": "Python", "metadata": {"date": 1590550545, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03142.html", "problem_id": "p03142", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03142/input.txt", "sample_output_relpath": "derived/input_output/data/p03142/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03142/Python/s322147339.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s322147339", "user_id": "u936985471"}, "prompt_components": {"gold_output": "0\n1\n2\n", "input_to_evaluate": "# 有効グラフ上で、近道に当たる点はすべて余計な辺\n# ある点に入ってくる最も距離が長い辺のみが有効となる\n# 一番距離が長い人版ダイクストラやってみる\n# 入力のあった頂点を記録することで、入力の無かった頂点を根とみなせる\n\nimport sys\nreadline = sys.stdin.readline\n\nN,M = map(int,readline().split())\nG = [[] for i in range(N)]\ngrandparent = set(range(N))\nfor i in range(N - 1 + M):\n a,b = map(int,readline().split())\n G[a-1].append(b-1)\n grandparent -= {b - 1}\n\nstart = list(grandparent)[0]\nimport heapq\n\n# 距離, 頂点, 親\nq = [(0, start, -1)]\nheapq.heapify(q)\n\n# ans[頂点] = (到達コスト,親)\nans = [(-1, -1) for i in range(N)]\nwhile q:\n dist, v, parent = heapq.heappop(q)\n dist = -dist\n if ans[v][0] >= dist:\n continue\n ans[v] = (dist, parent)\n for child in G[v]:\n heapq.heappush(q,(-(dist + 1), child, v))\n \nfor a in ans:\n print(a[1] + 1)", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is a rooted tree (see Notes) with N vertices numbered 1 to N.\nEach of the vertices, except the root, has a directed edge coming from its parent.\nNote that the root may not be Vertex 1.\n\nTakahashi has added M new directed edges to this graph.\nEach of these M edges, u \\rightarrow v, extends from some vertex u to its descendant v.\n\nYou are given the directed graph with N vertices and N-1+M edges after Takahashi added edges.\nMore specifically, you are given N-1+M pairs of integers, (A_1, B_1), ..., (A_{N-1+M}, B_{N-1+M}), which represent that the i-th edge extends from Vertex A_i to Vertex B_i.\n\nRestore the original rooted tree.\n\nNotes\n\nFor \"tree\" and other related terms in graph theory, see the article in Wikipedia, for example.\n\nConstraints\n\n3 \\leq N\n\n1 \\leq M\n\nN + M \\leq 10^5\n\n1 \\leq A_i, B_i \\leq N\n\nA_i \\neq B_i\n\nIf i \\neq j, (A_i, B_i) \\neq (A_j, B_j).\n\nThe graph in input can be obtained by adding M edges satisfying the condition in the problem statement to a rooted tree with N vertices.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_{N-1+M} B_{N-1+M}\n\nOutput\n\nPrint N lines.\nIn the i-th line, print 0 if Vertex i is the root of the original tree, and otherwise print the integer representing the parent of Vertex i in the original tree.\n\nNote that it can be shown that the original tree is uniquely determined.\n\nSample Input 1\n\n3 1\n1 2\n1 3\n2 3\n\nSample Output 1\n\n0\n1\n2\n\nThe graph in this input is shown below:\n\nIt can be seen that this graph is obtained by adding the edge 1 \\rightarrow 3 to the rooted tree 1 \\rightarrow 2 \\rightarrow 3.\n\nSample Input 2\n\n6 3\n2 1\n2 3\n4 1\n4 2\n6 1\n2 6\n4 6\n6 5\n\nSample Output 2\n\n6\n4\n2\n0\n6\n2", "sample_input": "3 1\n1 2\n1 3\n2 3\n"}, "reference_outputs": ["0\n1\n2\n"], "source_document_id": "p03142", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is a rooted tree (see Notes) with N vertices numbered 1 to N.\nEach of the vertices, except the root, has a directed edge coming from its parent.\nNote that the root may not be Vertex 1.\n\nTakahashi has added M new directed edges to this graph.\nEach of these M edges, u \\rightarrow v, extends from some vertex u to its descendant v.\n\nYou are given the directed graph with N vertices and N-1+M edges after Takahashi added edges.\nMore specifically, you are given N-1+M pairs of integers, (A_1, B_1), ..., (A_{N-1+M}, B_{N-1+M}), which represent that the i-th edge extends from Vertex A_i to Vertex B_i.\n\nRestore the original rooted tree.\n\nNotes\n\nFor \"tree\" and other related terms in graph theory, see the article in Wikipedia, for example.\n\nConstraints\n\n3 \\leq N\n\n1 \\leq M\n\nN + M \\leq 10^5\n\n1 \\leq A_i, B_i \\leq N\n\nA_i \\neq B_i\n\nIf i \\neq j, (A_i, B_i) \\neq (A_j, B_j).\n\nThe graph in input can be obtained by adding M edges satisfying the condition in the problem statement to a rooted tree with N vertices.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_{N-1+M} B_{N-1+M}\n\nOutput\n\nPrint N lines.\nIn the i-th line, print 0 if Vertex i is the root of the original tree, and otherwise print the integer representing the parent of Vertex i in the original tree.\n\nNote that it can be shown that the original tree is uniquely determined.\n\nSample Input 1\n\n3 1\n1 2\n1 3\n2 3\n\nSample Output 1\n\n0\n1\n2\n\nThe graph in this input is shown below:\n\nIt can be seen that this graph is obtained by adding the edge 1 \\rightarrow 3 to the rooted tree 1 \\rightarrow 2 \\rightarrow 3.\n\nSample Input 2\n\n6 3\n2 1\n2 3\n4 1\n4 2\n6 1\n2 6\n4 6\n6 5\n\nSample Output 2\n\n6\n4\n2\n0\n6\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 961, "cpu_time_ms": 2108, "memory_kb": 83180}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s592941777", "group_id": "codeNet:p03142", "input_text": "N, M = [int(_) for _ in input().split()]\nAB = [[int(_) for _ in input().split()] for i in range(N - 1 + M)]\n\nfrom collections import defaultdict\n\nnodes = list(range(1, N + 1))\nedges = defaultdict(set)\nrev_edges = defaultdict(set)\n\nfor a, b in AB:\n edges[a].add(b)\n rev_edges[b].add(a)\n\n#print(vs)\n#print(ws)\n\ndef TopologicalSort(nodes, edges, rev_edges):\n '''\n nodes ... Node[]\n edges ... Dict[From Node](To Node)\n rev_edges ... Dict[To Node](From Node)\n '''\n rev_edges_num = dict((n, len(rev_edges[n])) for n in nodes)\n L = []\n S = [n for n in nodes if not rev_edges_num[n]]\n while S:\n n = S.pop()\n L.append(n)\n for m in edges[n]:\n rev_edges_num[m] -= 1\n if not rev_edges_num[m]:\n S.append(m)\n \n # プロコン用なのでエラーチェックはしない\n\n return L\n\nL = TopologicalSort(nodes, edges, rev_edges)\n\nnrank = dict((n, r) for r, n in enumerate(L))\n\nfor n in range(1, N + 1):\n r = 0\n if rev_edges[n]:\n r = sorted(rev_edges[n], key=lambda x:nrank[x], reverse=True)[0]\n print(r)\n", "language": "Python", "metadata": {"date": 1548997754, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03142.html", "problem_id": "p03142", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03142/input.txt", "sample_output_relpath": "derived/input_output/data/p03142/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03142/Python/s592941777.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s592941777", "user_id": "u808427016"}, "prompt_components": {"gold_output": "0\n1\n2\n", "input_to_evaluate": "N, M = [int(_) for _ in input().split()]\nAB = [[int(_) for _ in input().split()] for i in range(N - 1 + M)]\n\nfrom collections import defaultdict\n\nnodes = list(range(1, N + 1))\nedges = defaultdict(set)\nrev_edges = defaultdict(set)\n\nfor a, b in AB:\n edges[a].add(b)\n rev_edges[b].add(a)\n\n#print(vs)\n#print(ws)\n\ndef TopologicalSort(nodes, edges, rev_edges):\n '''\n nodes ... Node[]\n edges ... Dict[From Node](To Node)\n rev_edges ... Dict[To Node](From Node)\n '''\n rev_edges_num = dict((n, len(rev_edges[n])) for n in nodes)\n L = []\n S = [n for n in nodes if not rev_edges_num[n]]\n while S:\n n = S.pop()\n L.append(n)\n for m in edges[n]:\n rev_edges_num[m] -= 1\n if not rev_edges_num[m]:\n S.append(m)\n \n # プロコン用なのでエラーチェックはしない\n\n return L\n\nL = TopologicalSort(nodes, edges, rev_edges)\n\nnrank = dict((n, r) for r, n in enumerate(L))\n\nfor n in range(1, N + 1):\n r = 0\n if rev_edges[n]:\n r = sorted(rev_edges[n], key=lambda x:nrank[x], reverse=True)[0]\n print(r)\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is a rooted tree (see Notes) with N vertices numbered 1 to N.\nEach of the vertices, except the root, has a directed edge coming from its parent.\nNote that the root may not be Vertex 1.\n\nTakahashi has added M new directed edges to this graph.\nEach of these M edges, u \\rightarrow v, extends from some vertex u to its descendant v.\n\nYou are given the directed graph with N vertices and N-1+M edges after Takahashi added edges.\nMore specifically, you are given N-1+M pairs of integers, (A_1, B_1), ..., (A_{N-1+M}, B_{N-1+M}), which represent that the i-th edge extends from Vertex A_i to Vertex B_i.\n\nRestore the original rooted tree.\n\nNotes\n\nFor \"tree\" and other related terms in graph theory, see the article in Wikipedia, for example.\n\nConstraints\n\n3 \\leq N\n\n1 \\leq M\n\nN + M \\leq 10^5\n\n1 \\leq A_i, B_i \\leq N\n\nA_i \\neq B_i\n\nIf i \\neq j, (A_i, B_i) \\neq (A_j, B_j).\n\nThe graph in input can be obtained by adding M edges satisfying the condition in the problem statement to a rooted tree with N vertices.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_{N-1+M} B_{N-1+M}\n\nOutput\n\nPrint N lines.\nIn the i-th line, print 0 if Vertex i is the root of the original tree, and otherwise print the integer representing the parent of Vertex i in the original tree.\n\nNote that it can be shown that the original tree is uniquely determined.\n\nSample Input 1\n\n3 1\n1 2\n1 3\n2 3\n\nSample Output 1\n\n0\n1\n2\n\nThe graph in this input is shown below:\n\nIt can be seen that this graph is obtained by adding the edge 1 \\rightarrow 3 to the rooted tree 1 \\rightarrow 2 \\rightarrow 3.\n\nSample Input 2\n\n6 3\n2 1\n2 3\n4 1\n4 2\n6 1\n2 6\n4 6\n6 5\n\nSample Output 2\n\n6\n4\n2\n0\n6\n2", "sample_input": "3 1\n1 2\n1 3\n2 3\n"}, "reference_outputs": ["0\n1\n2\n"], "source_document_id": "p03142", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is a rooted tree (see Notes) with N vertices numbered 1 to N.\nEach of the vertices, except the root, has a directed edge coming from its parent.\nNote that the root may not be Vertex 1.\n\nTakahashi has added M new directed edges to this graph.\nEach of these M edges, u \\rightarrow v, extends from some vertex u to its descendant v.\n\nYou are given the directed graph with N vertices and N-1+M edges after Takahashi added edges.\nMore specifically, you are given N-1+M pairs of integers, (A_1, B_1), ..., (A_{N-1+M}, B_{N-1+M}), which represent that the i-th edge extends from Vertex A_i to Vertex B_i.\n\nRestore the original rooted tree.\n\nNotes\n\nFor \"tree\" and other related terms in graph theory, see the article in Wikipedia, for example.\n\nConstraints\n\n3 \\leq N\n\n1 \\leq M\n\nN + M \\leq 10^5\n\n1 \\leq A_i, B_i \\leq N\n\nA_i \\neq B_i\n\nIf i \\neq j, (A_i, B_i) \\neq (A_j, B_j).\n\nThe graph in input can be obtained by adding M edges satisfying the condition in the problem statement to a rooted tree with N vertices.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_{N-1+M} B_{N-1+M}\n\nOutput\n\nPrint N lines.\nIn the i-th line, print 0 if Vertex i is the root of the original tree, and otherwise print the integer representing the parent of Vertex i in the original tree.\n\nNote that it can be shown that the original tree is uniquely determined.\n\nSample Input 1\n\n3 1\n1 2\n1 3\n2 3\n\nSample Output 1\n\n0\n1\n2\n\nThe graph in this input is shown below:\n\nIt can be seen that this graph is obtained by adding the edge 1 \\rightarrow 3 to the rooted tree 1 \\rightarrow 2 \\rightarrow 3.\n\nSample Input 2\n\n6 3\n2 1\n2 3\n4 1\n4 2\n6 1\n2 6\n4 6\n6 5\n\nSample Output 2\n\n6\n4\n2\n0\n6\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1113, "cpu_time_ms": 1360, "memory_kb": 103188}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s112544575", "group_id": "codeNet:p03146", "input_text": "def f(n):\n if n % 2 == 0:\n return n // 2\n return 3 * n + 1\n\n\ndef main():\n s = int(input())\n aa = {s}\n a = f(s)\n for i in range(2, 1000001):\n if a in aa:\n print(i)\n break\n aa.add(a)\n a = f(a)\n\n\nif __name__ == \"__main__\":\n main()\n", "language": "Python", "metadata": {"date": 1549019352, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03146.html", "problem_id": "p03146", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03146/input.txt", "sample_output_relpath": "derived/input_output/data/p03146/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03146/Python/s112544575.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s112544575", "user_id": "u880373275"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "def f(n):\n if n % 2 == 0:\n return n // 2\n return 3 * n + 1\n\n\ndef main():\n s = int(input())\n aa = {s}\n a = f(s)\n for i in range(2, 1000001):\n if a in aa:\n print(i)\n break\n aa.add(a)\n a = f(a)\n\n\nif __name__ == \"__main__\":\n main()\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows:\n\nThe first term s is given as input.\n\nLet f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd.\n\na_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1.\n\nFind the minimum integer m that satisfies the following condition:\n\nThere exists an integer n such that a_m = a_n (m > n).\n\nConstraints\n\n1 \\leq s \\leq 100\n\nAll values in input are integers.\n\nIt is guaranteed that all elements in a and the minimum m that satisfies the condition are at most 1000000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the minimum integer m that satisfies the condition.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n5\n\na=\\{8,4,2,1,4,2,1,4,2,1,......\\}. As a_5=a_2, the answer is 5.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n18\n\na=\\{7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1,4,2,1,......\\}.\n\nSample Input 3\n\n54\n\nSample Output 3\n\n114", "sample_input": "8\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03146", "source_text": "Score : 200 points\n\nProblem Statement\n\nA sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows:\n\nThe first term s is given as input.\n\nLet f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd.\n\na_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1.\n\nFind the minimum integer m that satisfies the following condition:\n\nThere exists an integer n such that a_m = a_n (m > n).\n\nConstraints\n\n1 \\leq s \\leq 100\n\nAll values in input are integers.\n\nIt is guaranteed that all elements in a and the minimum m that satisfies the condition are at most 1000000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the minimum integer m that satisfies the condition.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n5\n\na=\\{8,4,2,1,4,2,1,4,2,1,......\\}. As a_5=a_2, the answer is 5.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n18\n\na=\\{7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1,4,2,1,......\\}.\n\nSample Input 3\n\n54\n\nSample Output 3\n\n114", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 299, "cpu_time_ms": 20, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s947080551", "group_id": "codeNet:p03146", "input_text": "s = int(input())\ndef func(n):\n if n % 2 == 0:\n return n // 2\n else:\n return 3*n + 1\na = [0,s]\nfor i in range(2,10**6+1):\n a_i = func(a[i-1])\n if a_i in a:\n print(i)\n break\n a.append(a_i)", "language": "Python", "metadata": {"date": 1548036800, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03146.html", "problem_id": "p03146", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03146/input.txt", "sample_output_relpath": "derived/input_output/data/p03146/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03146/Python/s947080551.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s947080551", "user_id": "u983918956"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "s = int(input())\ndef func(n):\n if n % 2 == 0:\n return n // 2\n else:\n return 3*n + 1\na = [0,s]\nfor i in range(2,10**6+1):\n a_i = func(a[i-1])\n if a_i in a:\n print(i)\n break\n a.append(a_i)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows:\n\nThe first term s is given as input.\n\nLet f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd.\n\na_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1.\n\nFind the minimum integer m that satisfies the following condition:\n\nThere exists an integer n such that a_m = a_n (m > n).\n\nConstraints\n\n1 \\leq s \\leq 100\n\nAll values in input are integers.\n\nIt is guaranteed that all elements in a and the minimum m that satisfies the condition are at most 1000000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the minimum integer m that satisfies the condition.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n5\n\na=\\{8,4,2,1,4,2,1,4,2,1,......\\}. As a_5=a_2, the answer is 5.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n18\n\na=\\{7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1,4,2,1,......\\}.\n\nSample Input 3\n\n54\n\nSample Output 3\n\n114", "sample_input": "8\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03146", "source_text": "Score : 200 points\n\nProblem Statement\n\nA sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows:\n\nThe first term s is given as input.\n\nLet f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd.\n\na_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1.\n\nFind the minimum integer m that satisfies the following condition:\n\nThere exists an integer n such that a_m = a_n (m > n).\n\nConstraints\n\n1 \\leq s \\leq 100\n\nAll values in input are integers.\n\nIt is guaranteed that all elements in a and the minimum m that satisfies the condition are at most 1000000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the minimum integer m that satisfies the condition.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n5\n\na=\\{8,4,2,1,4,2,1,4,2,1,......\\}. As a_5=a_2, the answer is 5.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n18\n\na=\\{7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1,4,2,1,......\\}.\n\nSample Input 3\n\n54\n\nSample Output 3\n\n114", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 229, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s125175007", "group_id": "codeNet:p03147", "input_text": "import sys\n\nsys.setrecursionlimit(10 ** 6)\nINF = float(\"inf\")\nMOD = 10 ** 9 + 7\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef check(H):\n N = len(H)\n for i in range(N):\n if H[i] != 0:\n return False\n\n return True\n\n\ndef main():\n N = int(input())\n H = list(map(int, input().split()))\n\n ans = 0\n while True:\n if check(H):\n break\n\n # 区間分割\n i = 0\n while i < N:\n if H[i] == 0:\n i += 1\n else:\n # 区間が始まる\n ans += 1\n while i < N and H[i] > 0:\n H[i] -= 1\n i += 1\n\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "language": "Python", "metadata": {"date": 1589460265, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03147.html", "problem_id": "p03147", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03147/input.txt", "sample_output_relpath": "derived/input_output/data/p03147/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03147/Python/s125175007.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s125175007", "user_id": "u346812984"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import sys\n\nsys.setrecursionlimit(10 ** 6)\nINF = float(\"inf\")\nMOD = 10 ** 9 + 7\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef check(H):\n N = len(H)\n for i in range(N):\n if H[i] != 0:\n return False\n\n return True\n\n\ndef main():\n N = int(input())\n H = list(map(int, input().split()))\n\n ans = 0\n while True:\n if check(H):\n break\n\n # 区間分割\n i = 0\n while i < N:\n if H[i] == 0:\n i += 1\n else:\n # 区間が始まる\n ans += 1\n while i < N and H[i] > 0:\n H[i] -= 1\n i += 1\n\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0.\nYou are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \\leq k \\leq N), by repeating the following \"watering\" operation:\n\nSpecify integers l and r. Increase the height of Flower x by 1 for all x such that l \\leq x \\leq r.\n\nFind the minimum number of watering operations required to satisfy the condition.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq h_i \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 h_3 ...... h_N\n\nOutput\n\nPrint the minimum number of watering operations required to satisfy the condition.\n\nSample Input 1\n\n4\n1 2 2 1\n\nSample Output 1\n\n2\n\nThe minimum number of watering operations required is 2.\nOne way to achieve it is:\n\nPerform the operation with (l,r)=(1,3).\n\nPerform the operation with (l,r)=(2,4).\n\nSample Input 2\n\n5\n3 1 2 3 1\n\nSample Output 2\n\n5\n\nSample Input 3\n\n8\n4 23 75 0 23 96 50 100\n\nSample Output 3\n\n221", "sample_input": "4\n1 2 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03147", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0.\nYou are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \\leq k \\leq N), by repeating the following \"watering\" operation:\n\nSpecify integers l and r. Increase the height of Flower x by 1 for all x such that l \\leq x \\leq r.\n\nFind the minimum number of watering operations required to satisfy the condition.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq h_i \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 h_3 ...... h_N\n\nOutput\n\nPrint the minimum number of watering operations required to satisfy the condition.\n\nSample Input 1\n\n4\n1 2 2 1\n\nSample Output 1\n\n2\n\nThe minimum number of watering operations required is 2.\nOne way to achieve it is:\n\nPerform the operation with (l,r)=(1,3).\n\nPerform the operation with (l,r)=(2,4).\n\nSample Input 2\n\n5\n3 1 2 3 1\n\nSample Output 2\n\n5\n\nSample Input 3\n\n8\n4 23 75 0 23 96 50 100\n\nSample Output 3\n\n221", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 739, "cpu_time_ms": 19, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s922435872", "group_id": "codeNet:p03147", "input_text": "n=int(input())\nii=input().split(\" \")\nflower=[]\ncount=0\nend=n\n\nfor i in ii:\n flower.append(int(i))\n\n#print (flower)\n\nwhile True:\n end=n\n if flower[0]==0:\n del flower[0]\n n=n-1\n if n==0:\n print(str(count))\n exit()\n else:\n continue\n for j in range(0,n):\n if flower[j]==0:\n end=j\n break\n \n for m in range (0,end):\n flower[m]=flower[m]-1\n #print(end)\n count=count+1\n #print(flower)\n continue", "language": "Python", "metadata": {"date": 1548019739, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03147.html", "problem_id": "p03147", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03147/input.txt", "sample_output_relpath": "derived/input_output/data/p03147/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03147/Python/s922435872.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s922435872", "user_id": "u866169813"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n=int(input())\nii=input().split(\" \")\nflower=[]\ncount=0\nend=n\n\nfor i in ii:\n flower.append(int(i))\n\n#print (flower)\n\nwhile True:\n end=n\n if flower[0]==0:\n del flower[0]\n n=n-1\n if n==0:\n print(str(count))\n exit()\n else:\n continue\n for j in range(0,n):\n if flower[j]==0:\n end=j\n break\n \n for m in range (0,end):\n flower[m]=flower[m]-1\n #print(end)\n count=count+1\n #print(flower)\n continue", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0.\nYou are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \\leq k \\leq N), by repeating the following \"watering\" operation:\n\nSpecify integers l and r. Increase the height of Flower x by 1 for all x such that l \\leq x \\leq r.\n\nFind the minimum number of watering operations required to satisfy the condition.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq h_i \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 h_3 ...... h_N\n\nOutput\n\nPrint the minimum number of watering operations required to satisfy the condition.\n\nSample Input 1\n\n4\n1 2 2 1\n\nSample Output 1\n\n2\n\nThe minimum number of watering operations required is 2.\nOne way to achieve it is:\n\nPerform the operation with (l,r)=(1,3).\n\nPerform the operation with (l,r)=(2,4).\n\nSample Input 2\n\n5\n3 1 2 3 1\n\nSample Output 2\n\n5\n\nSample Input 3\n\n8\n4 23 75 0 23 96 50 100\n\nSample Output 3\n\n221", "sample_input": "4\n1 2 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03147", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0.\nYou are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \\leq k \\leq N), by repeating the following \"watering\" operation:\n\nSpecify integers l and r. Increase the height of Flower x by 1 for all x such that l \\leq x \\leq r.\n\nFind the minimum number of watering operations required to satisfy the condition.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq h_i \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 h_3 ...... h_N\n\nOutput\n\nPrint the minimum number of watering operations required to satisfy the condition.\n\nSample Input 1\n\n4\n1 2 2 1\n\nSample Output 1\n\n2\n\nThe minimum number of watering operations required is 2.\nOne way to achieve it is:\n\nPerform the operation with (l,r)=(1,3).\n\nPerform the operation with (l,r)=(2,4).\n\nSample Input 2\n\n5\n3 1 2 3 1\n\nSample Output 2\n\n5\n\nSample Input 3\n\n8\n4 23 75 0 23 96 50 100\n\nSample Output 3\n\n221", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 441, "cpu_time_ms": 22, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s772529608", "group_id": "codeNet:p03148", "input_text": "n, k = map(int, input().split())\ntd = sorted([list(map(int, input().split())) for i in range(n)], reverse=True, key=lambda x: x[1])\n\ntype = set()\nL = []\nSum = 0\nfor x in td[:k]:\n Sum += x[1]\n if x[0] not in type:\n type.add(x[0])\n else:\n L.append(x[1])\n\nL = L[::-1]\ntype_cnt = len(type)\nans = Sum + type_cnt ** 2\nfor x in td[k:]:\n if len(L)==0:break\n if x[0] not in type:\n type.add(x[0])\n type_cnt += 1\n Sum = Sum - L.pop(0) + x[1]\n ans = max(ans, Sum + type_cnt ** 2)\nprint(ans)\n", "language": "Python", "metadata": {"date": 1557330288, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03148.html", "problem_id": "p03148", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03148/input.txt", "sample_output_relpath": "derived/input_output/data/p03148/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03148/Python/s772529608.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s772529608", "user_id": "u722535636"}, "prompt_components": {"gold_output": "26\n", "input_to_evaluate": "n, k = map(int, input().split())\ntd = sorted([list(map(int, input().split())) for i in range(n)], reverse=True, key=lambda x: x[1])\n\ntype = set()\nL = []\nSum = 0\nfor x in td[:k]:\n Sum += x[1]\n if x[0] not in type:\n type.add(x[0])\n else:\n L.append(x[1])\n\nL = L[::-1]\ntype_cnt = len(type)\nans = Sum + type_cnt ** 2\nfor x in td[k:]:\n if len(L)==0:break\n if x[0] not in type:\n type.add(x[0])\n type_cnt += 1\n Sum = Sum - L.pop(0) + x[1]\n ans = max(ans, Sum + type_cnt ** 2)\nprint(ans)\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N pieces of sushi. Each piece has two parameters: \"kind of topping\" t_i and \"deliciousness\" d_i.\nYou are choosing K among these N pieces to eat.\nYour \"satisfaction\" here will be calculated as follows:\n\nThe satisfaction is the sum of the \"base total deliciousness\" and the \"variety bonus\".\n\nThe base total deliciousness is the sum of the deliciousness of the pieces you eat.\n\nThe variety bonus is x*x, where x is the number of different kinds of toppings of the pieces you eat.\n\nYou want to have as much satisfaction as possible.\nFind this maximum satisfaction.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 10^5\n\n1 \\leq t_i \\leq N\n\n1 \\leq d_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nt_1 d_1\nt_2 d_2\n.\n.\n.\nt_N d_N\n\nOutput\n\nPrint the maximum satisfaction that you can obtain.\n\nSample Input 1\n\n5 3\n1 9\n1 7\n2 6\n2 5\n3 1\n\nSample Output 1\n\n26\n\nIf you eat Sushi 1,2 and 3:\n\nThe base total deliciousness is 9+7+6=22.\n\nThe variety bonus is 2*2=4.\n\nThus, your satisfaction will be 26, which is optimal.\n\nSample Input 2\n\n7 4\n1 1\n2 1\n3 1\n4 6\n4 5\n4 5\n4 5\n\nSample Output 2\n\n25\n\nIt is optimal to eat Sushi 1,2,3 and 4.\n\nSample Input 3\n\n6 5\n5 1000000000\n2 990000000\n3 980000000\n6 970000000\n6 960000000\n4 950000000\n\nSample Output 3\n\n4900000016\n\nNote that the output may not fit into a 32-bit integer type.", "sample_input": "5 3\n1 9\n1 7\n2 6\n2 5\n3 1\n"}, "reference_outputs": ["26\n"], "source_document_id": "p03148", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N pieces of sushi. Each piece has two parameters: \"kind of topping\" t_i and \"deliciousness\" d_i.\nYou are choosing K among these N pieces to eat.\nYour \"satisfaction\" here will be calculated as follows:\n\nThe satisfaction is the sum of the \"base total deliciousness\" and the \"variety bonus\".\n\nThe base total deliciousness is the sum of the deliciousness of the pieces you eat.\n\nThe variety bonus is x*x, where x is the number of different kinds of toppings of the pieces you eat.\n\nYou want to have as much satisfaction as possible.\nFind this maximum satisfaction.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 10^5\n\n1 \\leq t_i \\leq N\n\n1 \\leq d_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nt_1 d_1\nt_2 d_2\n.\n.\n.\nt_N d_N\n\nOutput\n\nPrint the maximum satisfaction that you can obtain.\n\nSample Input 1\n\n5 3\n1 9\n1 7\n2 6\n2 5\n3 1\n\nSample Output 1\n\n26\n\nIf you eat Sushi 1,2 and 3:\n\nThe base total deliciousness is 9+7+6=22.\n\nThe variety bonus is 2*2=4.\n\nThus, your satisfaction will be 26, which is optimal.\n\nSample Input 2\n\n7 4\n1 1\n2 1\n3 1\n4 6\n4 5\n4 5\n4 5\n\nSample Output 2\n\n25\n\nIt is optimal to eat Sushi 1,2,3 and 4.\n\nSample Input 3\n\n6 5\n5 1000000000\n2 990000000\n3 980000000\n6 970000000\n6 960000000\n4 950000000\n\nSample Output 3\n\n4900000016\n\nNote that the output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 536, "cpu_time_ms": 513, "memory_kb": 30776}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s000544732", "group_id": "codeNet:p03150", "input_text": "S = input()\n\nimport re\ns = \"keyence\"\nans = s in S\nfor i in range(1, len(s)):\n s1 = s[:i]\n s2 = s[i:]\n ans = ans or re.match(\".*{}.*{}\".format(s1, s2), S)\n\nprint(\"YES\" if ans else \"NO\")\n", "language": "Python", "metadata": {"date": 1556717930, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03150.html", "problem_id": "p03150", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03150/input.txt", "sample_output_relpath": "derived/input_output/data/p03150/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03150/Python/s000544732.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s000544732", "user_id": "u071730284"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "S = input()\n\nimport re\ns = \"keyence\"\nans = s in S\nfor i in range(1, len(s)):\n s1 = s[:i]\n s2 = s[i:]\n ans = ans or re.match(\".*{}.*{}\".format(s1, s2), S)\n\nprint(\"YES\" if ans else \"NO\")\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA string is called a KEYENCE string when it can be changed to keyence by removing its contiguous substring (possibly empty) only once.\n\nGiven a string S consisting of lowercase English letters, determine if S is a KEYENCE string.\n\nConstraints\n\nThe length of S is between 7 and 100 (inclusive).\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a KEYENCE string, print YES; otherwise, print NO.\n\nSample Input 1\n\nkeyofscience\n\nSample Output 1\n\nYES\n\nkeyence is an abbreviation of key of science.\n\nSample Input 2\n\nmpyszsbznf\n\nSample Output 2\n\nNO\n\nSample Input 3\n\nashlfyha\n\nSample Output 3\n\nNO\n\nSample Input 4\n\nkeyence\n\nSample Output 4\n\nYES", "sample_input": "keyofscience\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03150", "source_text": "Score : 200 points\n\nProblem Statement\n\nA string is called a KEYENCE string when it can be changed to keyence by removing its contiguous substring (possibly empty) only once.\n\nGiven a string S consisting of lowercase English letters, determine if S is a KEYENCE string.\n\nConstraints\n\nThe length of S is between 7 and 100 (inclusive).\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a KEYENCE string, print YES; otherwise, print NO.\n\nSample Input 1\n\nkeyofscience\n\nSample Output 1\n\nYES\n\nkeyence is an abbreviation of key of science.\n\nSample Input 2\n\nmpyszsbznf\n\nSample Output 2\n\nNO\n\nSample Input 3\n\nashlfyha\n\nSample Output 3\n\nNO\n\nSample Input 4\n\nkeyence\n\nSample Output 4\n\nYES", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 194, "cpu_time_ms": 20, "memory_kb": 3188}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s873455225", "group_id": "codeNet:p03153", "input_text": "N, D = map(int, input().split())\n*A, = map(int, input().split())\n\nN0 = 2**(N-1).bit_length()\nINF = (10**18, -1)\nldata = [INF]*(2*N0)\nrdata = [INF]*(2*N0)\n\nfor i in range(N0-2, -1, -1):\n ldata[i] = min(ldata[2*i+1], ldata[2*i+2])\n rdata[i] = min(rdata[2*i+1], rdata[2*i+2])\ndef update(data, k, x):\n k += N0-1\n data[k] = x\n while k >= 0:\n k = (k - 1) // 2\n data[k] = min(data[2*k+1], data[2*k+2])\ndef query(data, l, r):\n if l >= r:\n return INF\n L = l + N0; R = r + N0\n s = INF\n while L < R:\n if R & 1:\n R -= 1\n s = min(s, data[R-1])\n\n if L & 1:\n s = min(s, data[L-1])\n L += 1\n L >>= 1; R >>= 1\n return s\n\n*I, = range(N)\nI.sort(key=A.__getitem__)\n\nE = []\nfor i in I:\n c, k = query(ldata, 0, i)\n if k != -1:\n c -= (N-1-i)*D\n E.append((c + A[i], k, i))\n c, k = query(rdata, i+1, N)\n if k != -1:\n c -= i*D\n E.append((c + A[i], i, k))\n update(ldata, i, ((N-1-i)*D + A[i], i))\n update(rdata, i, (i*D + A[i], i))\n\n*p, = range(N)\ndef root(x):\n if x == p[x]:\n return x\n p[x] = y = root(p[x])\n return y\ndef unite(x, y):\n px = root(x); py = root(y)\n if px == py:\n return 0\n if px < py:\n p[py] = px\n else:\n p[px] = py\n return 1\n\n\nE.sort()\nans = 0\nfor c, i, j in E:\n if unite(i, j):\n ans += c\nprint(ans)", "language": "Python", "metadata": {"date": 1547490302, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03153.html", "problem_id": "p03153", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03153/input.txt", "sample_output_relpath": "derived/input_output/data/p03153/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03153/Python/s873455225.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s873455225", "user_id": "u226155577"}, "prompt_components": {"gold_output": "106\n", "input_to_evaluate": "N, D = map(int, input().split())\n*A, = map(int, input().split())\n\nN0 = 2**(N-1).bit_length()\nINF = (10**18, -1)\nldata = [INF]*(2*N0)\nrdata = [INF]*(2*N0)\n\nfor i in range(N0-2, -1, -1):\n ldata[i] = min(ldata[2*i+1], ldata[2*i+2])\n rdata[i] = min(rdata[2*i+1], rdata[2*i+2])\ndef update(data, k, x):\n k += N0-1\n data[k] = x\n while k >= 0:\n k = (k - 1) // 2\n data[k] = min(data[2*k+1], data[2*k+2])\ndef query(data, l, r):\n if l >= r:\n return INF\n L = l + N0; R = r + N0\n s = INF\n while L < R:\n if R & 1:\n R -= 1\n s = min(s, data[R-1])\n\n if L & 1:\n s = min(s, data[L-1])\n L += 1\n L >>= 1; R >>= 1\n return s\n\n*I, = range(N)\nI.sort(key=A.__getitem__)\n\nE = []\nfor i in I:\n c, k = query(ldata, 0, i)\n if k != -1:\n c -= (N-1-i)*D\n E.append((c + A[i], k, i))\n c, k = query(rdata, i+1, N)\n if k != -1:\n c -= i*D\n E.append((c + A[i], i, k))\n update(ldata, i, ((N-1-i)*D + A[i], i))\n update(rdata, i, (i*D + A[i], i))\n\n*p, = range(N)\ndef root(x):\n if x == p[x]:\n return x\n p[x] = y = root(p[x])\n return y\ndef unite(x, y):\n px = root(x); py = root(y)\n if px == py:\n return 0\n if px < py:\n p[py] = px\n else:\n p[px] = py\n return 1\n\n\nE.sort()\nans = 0\nfor c, i, j in E:\n if unite(i, j):\n ans += c\nprint(ans)", "problem_context": "Score : 600 points\n\nProblem Statement\n\nThere are N cities in Republic of AtCoder. The size of the i-th city is A_{i}.\nTakahashi would like to build N-1 bidirectional roads connecting two cities so that any city can be reached from any other city by using these roads.\n\nAssume that the cost of building a road connecting the i-th city and the j-th city is |i-j| \\times D + A_{i} + A_{j}.\nFor Takahashi, find the minimum possible total cost to achieve the objective.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq D \\leq 10^9\n\n1 \\leq A_{i} \\leq 10^9\n\nA_{i} and D are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible total cost.\n\nSample Input 1\n\n3 1\n1 100 1\n\nSample Output 1\n\n106\n\nThis cost can be achieved by, for example, building roads connecting City 1, 2 and City 1, 3.\n\nSample Input 2\n\n3 1000\n1 100 1\n\nSample Output 2\n\n2202\n\nSample Input 3\n\n6 14\n25 171 7 1 17 162\n\nSample Output 3\n\n497\n\nSample Input 4\n\n12 5\n43 94 27 3 69 99 56 25 8 15 46 8\n\nSample Output 4\n\n658", "sample_input": "3 1\n1 100 1\n"}, "reference_outputs": ["106\n"], "source_document_id": "p03153", "source_text": "Score : 600 points\n\nProblem Statement\n\nThere are N cities in Republic of AtCoder. The size of the i-th city is A_{i}.\nTakahashi would like to build N-1 bidirectional roads connecting two cities so that any city can be reached from any other city by using these roads.\n\nAssume that the cost of building a road connecting the i-th city and the j-th city is |i-j| \\times D + A_{i} + A_{j}.\nFor Takahashi, find the minimum possible total cost to achieve the objective.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq D \\leq 10^9\n\n1 \\leq A_{i} \\leq 10^9\n\nA_{i} and D are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible total cost.\n\nSample Input 1\n\n3 1\n1 100 1\n\nSample Output 1\n\n106\n\nThis cost can be achieved by, for example, building roads connecting City 1, 2 and City 1, 3.\n\nSample Input 2\n\n3 1000\n1 100 1\n\nSample Output 2\n\n2202\n\nSample Input 3\n\n6 14\n25 171 7 1 17 162\n\nSample Output 3\n\n497\n\nSample Input 4\n\n12 5\n43 94 27 3 69 99 56 25 8 15 46 8\n\nSample Output 4\n\n658", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1412, "cpu_time_ms": 2121, "memory_kb": 287044}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s320833731", "group_id": "codeNet:p03164", "input_text": "# D knap sack 2\nfrom math import isinf\n\nN,W = map(int, input().split())\nw,v = [0]*N, [0]*N\nfor i in range(N):\n w[i],v[i] = map(int, input().split())\n \ninf = float('inf')\n# dp tabel -> dp list\ndp = [inf]*(1000+1) \ndp[0] = 0\nfor i in range(N):\n for j in reversed(range(1000+1)):\n if j-v[i]<0 or dp[j-v[i]] + w[i] > W:\n dp[j] = dp[j]\n else:\n dp[j] = min(dp[j],\n dp[j-v[i]] + w[i])\n # print(dp[:100])\n\nans = 0\nfor value,dpi in enumerate(dp):\n if dpi<=W:\n ans = max(ans, value)\nprint(ans)", "language": "Python", "metadata": {"date": 1546809196, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03164.html", "problem_id": "p03164", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03164/input.txt", "sample_output_relpath": "derived/input_output/data/p03164/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03164/Python/s320833731.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s320833731", "user_id": "u001024152"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "# D knap sack 2\nfrom math import isinf\n\nN,W = map(int, input().split())\nw,v = [0]*N, [0]*N\nfor i in range(N):\n w[i],v[i] = map(int, input().split())\n \ninf = float('inf')\n# dp tabel -> dp list\ndp = [inf]*(1000+1) \ndp[0] = 0\nfor i in range(N):\n for j in reversed(range(1000+1)):\n if j-v[i]<0 or dp[j-v[i]] + w[i] > W:\n dp[j] = dp[j]\n else:\n dp[j] = min(dp[j],\n dp[j-v[i]] + w[i])\n # print(dp[:100])\n\nans = 0\nfor value,dpi in enumerate(dp):\n if dpi<=W:\n ans = max(ans, value)\nprint(ans)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "sample_input": "3 8\n3 30\n4 50\n5 60\n"}, "reference_outputs": ["90\n"], "source_document_id": "p03164", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 565, "cpu_time_ms": 187, "memory_kb": 40688}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s326720701", "group_id": "codeNet:p03166", "input_text": "import sys\ndef ii(): return int(sys.stdin.readline())\ndef mi(): return map(int, sys.stdin.readline().split())\ndef li(): return list(map(int, sys.stdin.readline().split()))\ndef li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]\ndef dp2(ini, i, j): return [[ini]*i for i2 in range(j)]\ndef dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]\n#import bisect #bisect.bisect_left(B, a)\n#from collections import defaultdict #d = defaultdict(int) d[key] += value\n\nfrom collections import deque\nN, M = mi()\nx = li2(M)\n\nadj = [[] for i in range(N)]\nfor i in range(M):\n x[i][0] -= 1\n x[i][1] -= 1\n adj[x[i][0]].append(x[i][1])\n\nflag = [0]*N\nans = deque([])\n\ndef dfs(x):\n if flag[x]:\n return False\n else:\n flag[x] = 1\n for a in adj[x]:\n dfs(a)\n global ans\n ans.appendleft(x)\n\nfor i in range(N):\n dfs(i)\n\n#print(ans)\n\ndp = [0]*N\nfor a in ans:\n for b in adj[a]:\n dp[b] = max(dp[b], dp[a] + 1)\n\nprint(max(dp))", "language": "Python", "metadata": {"date": 1586362438, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03166.html", "problem_id": "p03166", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03166/input.txt", "sample_output_relpath": "derived/input_output/data/p03166/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03166/Python/s326720701.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s326720701", "user_id": "u744920373"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import sys\ndef ii(): return int(sys.stdin.readline())\ndef mi(): return map(int, sys.stdin.readline().split())\ndef li(): return list(map(int, sys.stdin.readline().split()))\ndef li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]\ndef dp2(ini, i, j): return [[ini]*i for i2 in range(j)]\ndef dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]\n#import bisect #bisect.bisect_left(B, a)\n#from collections import defaultdict #d = defaultdict(int) d[key] += value\n\nfrom collections import deque\nN, M = mi()\nx = li2(M)\n\nadj = [[] for i in range(N)]\nfor i in range(M):\n x[i][0] -= 1\n x[i][1] -= 1\n adj[x[i][0]].append(x[i][1])\n\nflag = [0]*N\nans = deque([])\n\ndef dfs(x):\n if flag[x]:\n return False\n else:\n flag[x] = 1\n for a in adj[x]:\n dfs(a)\n global ans\n ans.appendleft(x)\n\nfor i in range(N):\n dfs(i)\n\n#print(ans)\n\ndp = [0]*N\nfor a in ans:\n for b in adj[a]:\n dp[b] = max(dp[b], dp[a] + 1)\n\nprint(max(dp))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is a directed graph G with N vertices and M edges.\nThe vertices are numbered 1, 2, \\ldots, N, and for each i (1 \\leq i \\leq M), the i-th directed edge goes from Vertex x_i to y_i.\nG does not contain directed cycles.\n\nFind the length of the longest directed path in G.\nHere, the length of a directed path is the number of edges in it.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq x_i, y_i \\leq N\n\nAll pairs (x_i, y_i) are distinct.\n\nG does not contain directed cycles.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nx_1 y_1\nx_2 y_2\n:\nx_M y_M\n\nOutput\n\nPrint the length of the longest directed path in G.\n\nSample Input 1\n\n4 5\n1 2\n1 3\n3 2\n2 4\n3 4\n\nSample Output 1\n\n3\n\nThe red directed path in the following figure is the longest:\n\nSample Input 2\n\n6 3\n2 3\n4 5\n5 6\n\nSample Output 2\n\n2\n\nThe red directed path in the following figure is the longest:\n\nSample Input 3\n\n5 8\n5 3\n2 3\n2 4\n5 2\n5 1\n1 4\n4 3\n1 3\n\nSample Output 3\n\n3\n\nThe red directed path in the following figure is one of the longest:", "sample_input": "4 5\n1 2\n1 3\n3 2\n2 4\n3 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03166", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is a directed graph G with N vertices and M edges.\nThe vertices are numbered 1, 2, \\ldots, N, and for each i (1 \\leq i \\leq M), the i-th directed edge goes from Vertex x_i to y_i.\nG does not contain directed cycles.\n\nFind the length of the longest directed path in G.\nHere, the length of a directed path is the number of edges in it.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq x_i, y_i \\leq N\n\nAll pairs (x_i, y_i) are distinct.\n\nG does not contain directed cycles.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nx_1 y_1\nx_2 y_2\n:\nx_M y_M\n\nOutput\n\nPrint the length of the longest directed path in G.\n\nSample Input 1\n\n4 5\n1 2\n1 3\n3 2\n2 4\n3 4\n\nSample Output 1\n\n3\n\nThe red directed path in the following figure is the longest:\n\nSample Input 2\n\n6 3\n2 3\n4 5\n5 6\n\nSample Output 2\n\n2\n\nThe red directed path in the following figure is the longest:\n\nSample Input 3\n\n5 8\n5 3\n2 3\n2 4\n5 2\n5 1\n1 4\n4 3\n1 3\n\nSample Output 3\n\n3\n\nThe red directed path in the following figure is one of the longest:", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1021, "cpu_time_ms": 979, "memory_kb": 140844}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s545531954", "group_id": "codeNet:p03192", "input_text": "n = list(input())\nc = 0\nfor i in n:\n if i == \"2\":\n c += 1\nprint(c)\n", "language": "Python", "metadata": {"date": 1545530509, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03192.html", "problem_id": "p03192", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03192/input.txt", "sample_output_relpath": "derived/input_output/data/p03192/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03192/Python/s545531954.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s545531954", "user_id": "u514383727"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "n = list(input())\nc = 0\nfor i in n:\n if i == \"2\":\n c += 1\nprint(c)\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given an integer N that has exactly four digits in base ten.\nHow many times does 2 occur in the base-ten representation of N?\n\nConstraints\n\n1000 \\leq N \\leq 9999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1222\n\nSample Output 1\n\n3\n\n2 occurs three times in 1222. By the way, this contest is held on December 22 (JST).\n\nSample Input 2\n\n3456\n\nSample Output 2\n\n0\n\nSample Input 3\n\n9592\n\nSample Output 3\n\n1", "sample_input": "1222\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03192", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given an integer N that has exactly four digits in base ten.\nHow many times does 2 occur in the base-ten representation of N?\n\nConstraints\n\n1000 \\leq N \\leq 9999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1222\n\nSample Output 1\n\n3\n\n2 occurs three times in 1222. By the way, this contest is held on December 22 (JST).\n\nSample Input 2\n\n3456\n\nSample Output 2\n\n0\n\nSample Input 3\n\n9592\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 77, "cpu_time_ms": 199, "memory_kb": 38384}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s089946624", "group_id": "codeNet:p03196", "input_text": "from math import sqrt\n\ndef fact(n):\n insu = []\n for i in range(2,int(sqrt(n))+1):\n if n % i == 0:\n while n % i == 0:\n n //= i\n insu.append(i)\n if n == 1:\n break\n if n > 1:\n insu.append(n)\n return insu\n\ndef main():\n N,P = map(int,input().split())\n insu = fact(P)\n insu_set,insu_list,pt = set(),[],0\n for i in range(len(insu)):\n if insu[i] not in insu_set:\n insu_set.add(insu[i])\n insu_list.append([insu[i],1])\n pt += 1\n else:\n insu_list[pt-1][1] += 1\n for i in range(len(insu_list)):\n insu_list[i][1] //= N\n\n ans = 1\n for a,b in insu_list:\n ans *= a**b\n print(ans)\n\nif __name__ ==\"__main__\":\n main()\n", "language": "Python", "metadata": {"date": 1589211826, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03196.html", "problem_id": "p03196", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03196/input.txt", "sample_output_relpath": "derived/input_output/data/p03196/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03196/Python/s089946624.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s089946624", "user_id": "u571867512"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "from math import sqrt\n\ndef fact(n):\n insu = []\n for i in range(2,int(sqrt(n))+1):\n if n % i == 0:\n while n % i == 0:\n n //= i\n insu.append(i)\n if n == 1:\n break\n if n > 1:\n insu.append(n)\n return insu\n\ndef main():\n N,P = map(int,input().split())\n insu = fact(P)\n insu_set,insu_list,pt = set(),[],0\n for i in range(len(insu)):\n if insu[i] not in insu_set:\n insu_set.add(insu[i])\n insu_list.append([insu[i],1])\n pt += 1\n else:\n insu_list[pt-1][1] += 1\n for i in range(len(insu_list)):\n insu_list[i][1] //= N\n\n ans = 1\n for a,b in insu_list:\n ans *= a**b\n print(ans)\n\nif __name__ ==\"__main__\":\n main()\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N integers a_1, a_2, ..., a_N not less than 1.\nThe values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \\times a_2 \\times ... \\times a_N = P.\n\nFind the maximum possible greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\n1 \\leq N \\leq 10^{12}\n\n1 \\leq P \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN P\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 24\n\nSample Output 1\n\n2\n\nThe greatest common divisor would be 2 when, for example, a_1=2, a_2=6 and a_3=2.\n\nSample Input 2\n\n5 1\n\nSample Output 2\n\n1\n\nAs a_i are positive integers, the only possible case is a_1 = a_2 = a_3 = a_4 = a_5 = 1.\n\nSample Input 3\n\n1 111\n\nSample Output 3\n\n111\n\nSample Input 4\n\n4 972439611840\n\nSample Output 4\n\n206", "sample_input": "3 24\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03196", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N integers a_1, a_2, ..., a_N not less than 1.\nThe values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \\times a_2 \\times ... \\times a_N = P.\n\nFind the maximum possible greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\n1 \\leq N \\leq 10^{12}\n\n1 \\leq P \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN P\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 24\n\nSample Output 1\n\n2\n\nThe greatest common divisor would be 2 when, for example, a_1=2, a_2=6 and a_3=2.\n\nSample Input 2\n\n5 1\n\nSample Output 2\n\n1\n\nAs a_i are positive integers, the only possible case is a_1 = a_2 = a_3 = a_4 = a_5 = 1.\n\nSample Input 3\n\n1 111\n\nSample Output 3\n\n111\n\nSample Input 4\n\n4 972439611840\n\nSample Output 4\n\n206", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 783, "cpu_time_ms": 107, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s017512222", "group_id": "codeNet:p03196", "input_text": "import math\nN,P=map(int,input().split())\nL=[]\nfor i in range(1,int(math.sqrt(P))+1):\n\tif P%i==0:\n\t\tL.append(i)\nL=set(L)\nL=sorted(L)\nS=[]\nfor i in L:\n\tif P%(i**N)==0:\n\t\tS.append(i)\nprint(max(S))", "language": "Python", "metadata": {"date": 1587319266, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03196.html", "problem_id": "p03196", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03196/input.txt", "sample_output_relpath": "derived/input_output/data/p03196/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03196/Python/s017512222.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s017512222", "user_id": "u527993431"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import math\nN,P=map(int,input().split())\nL=[]\nfor i in range(1,int(math.sqrt(P))+1):\n\tif P%i==0:\n\t\tL.append(i)\nL=set(L)\nL=sorted(L)\nS=[]\nfor i in L:\n\tif P%(i**N)==0:\n\t\tS.append(i)\nprint(max(S))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N integers a_1, a_2, ..., a_N not less than 1.\nThe values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \\times a_2 \\times ... \\times a_N = P.\n\nFind the maximum possible greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\n1 \\leq N \\leq 10^{12}\n\n1 \\leq P \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN P\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 24\n\nSample Output 1\n\n2\n\nThe greatest common divisor would be 2 when, for example, a_1=2, a_2=6 and a_3=2.\n\nSample Input 2\n\n5 1\n\nSample Output 2\n\n1\n\nAs a_i are positive integers, the only possible case is a_1 = a_2 = a_3 = a_4 = a_5 = 1.\n\nSample Input 3\n\n1 111\n\nSample Output 3\n\n111\n\nSample Input 4\n\n4 972439611840\n\nSample Output 4\n\n206", "sample_input": "3 24\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03196", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N integers a_1, a_2, ..., a_N not less than 1.\nThe values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \\times a_2 \\times ... \\times a_N = P.\n\nFind the maximum possible greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\n1 \\leq N \\leq 10^{12}\n\n1 \\leq P \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN P\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 24\n\nSample Output 1\n\n2\n\nThe greatest common divisor would be 2 when, for example, a_1=2, a_2=6 and a_3=2.\n\nSample Input 2\n\n5 1\n\nSample Output 2\n\n1\n\nAs a_i are positive integers, the only possible case is a_1 = a_2 = a_3 = a_4 = a_5 = 1.\n\nSample Input 3\n\n1 111\n\nSample Output 3\n\n111\n\nSample Input 4\n\n4 972439611840\n\nSample Output 4\n\n206", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 193, "cpu_time_ms": 2109, "memory_kb": 1594396}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s129732243", "group_id": "codeNet:p03200", "input_text": "src = input()\ncount = 0\n\nwhile src.find('BW') > -1 :\n src = src.replace('BW', 'WB', 1)\n count = count + 1\n\nprint( count )", "language": "Python", "metadata": {"date": 1544929462, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03200.html", "problem_id": "p03200", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03200/input.txt", "sample_output_relpath": "derived/input_output/data/p03200/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03200/Python/s129732243.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s129732243", "user_id": "u131443777"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "src = input()\ncount = 0\n\nwhile src.find('BW') > -1 :\n src = src.replace('BW', 'WB', 1)\n count = count + 1\n\nprint( count )", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N Reversi pieces arranged in a row. (A Reversi piece is a disc with a black side and a white side.)\nThe state of each piece is represented by a string S of length N.\nIf S_i=B, the i-th piece from the left is showing black;\nIf S_i=W, the i-th piece from the left is showing white.\n\nConsider performing the following operation:\n\nChoose i (1 \\leq i < N) such that the i-th piece from the left is showing black and the (i+1)-th piece from the left is showing white, then flip both of those pieces. That is, the i-th piece from the left is now showing white and the (i+1)-th piece from the left is now showing black.\n\nFind the maximum possible number of times this operation can be performed.\n\nConstraints\n\n1 \\leq |S| \\leq 2\\times 10^5\n\nS_i=B or W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum possible number of times the operation can be performed.\n\nSample Input 1\n\nBBW\n\nSample Output 1\n\n2\n\nThe operation can be performed twice, as follows:\n\nFlip the second and third pieces from the left.\n\nFlip the first and second pieces from the left.\n\nSample Input 2\n\nBWBWBW\n\nSample Output 2\n\n6", "sample_input": "BBW\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03200", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N Reversi pieces arranged in a row. (A Reversi piece is a disc with a black side and a white side.)\nThe state of each piece is represented by a string S of length N.\nIf S_i=B, the i-th piece from the left is showing black;\nIf S_i=W, the i-th piece from the left is showing white.\n\nConsider performing the following operation:\n\nChoose i (1 \\leq i < N) such that the i-th piece from the left is showing black and the (i+1)-th piece from the left is showing white, then flip both of those pieces. That is, the i-th piece from the left is now showing white and the (i+1)-th piece from the left is now showing black.\n\nFind the maximum possible number of times this operation can be performed.\n\nConstraints\n\n1 \\leq |S| \\leq 2\\times 10^5\n\nS_i=B or W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum possible number of times the operation can be performed.\n\nSample Input 1\n\nBBW\n\nSample Output 1\n\n2\n\nThe operation can be performed twice, as follows:\n\nFlip the second and third pieces from the left.\n\nFlip the first and second pieces from the left.\n\nSample Input 2\n\nBWBWBW\n\nSample Output 2\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 127, "cpu_time_ms": 2104, "memory_kb": 3500}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s356997715", "group_id": "codeNet:p03201", "input_text": "def main():\n n = int(input())\n nums = list(map(int, input().split()))\n nums.sort()\n used = [False] * n\n\n num_bin_digits = [1 << len(\"{:b}\".format(x)) for x in nums]\n cnt = 0\n\n for cur in reversed(range(n)):\n if used[cur]:\n continue\n\n num = nums[cur]\n power_of_2 = num_bin_digits[cur]\n pair = power_of_2 - num\n idx = -1\n if pair in nums[:cur]:\n idx = nums.index(pair)\n\n if idx != -1 and not used[idx]:\n used[idx] = True\n cnt += 1\n\n #print(idx, num, power_of_2, pair)\n #print(used)\n\n print(cnt)\n\n return\n\nmain()", "language": "Python", "metadata": {"date": 1544957235, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03201.html", "problem_id": "p03201", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03201/input.txt", "sample_output_relpath": "derived/input_output/data/p03201/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03201/Python/s356997715.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s356997715", "user_id": "u026075806"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "def main():\n n = int(input())\n nums = list(map(int, input().split()))\n nums.sort()\n used = [False] * n\n\n num_bin_digits = [1 << len(\"{:b}\".format(x)) for x in nums]\n cnt = 0\n\n for cur in reversed(range(n)):\n if used[cur]:\n continue\n\n num = nums[cur]\n power_of_2 = num_bin_digits[cur]\n pair = power_of_2 - num\n idx = -1\n if pair in nums[:cur]:\n idx = nums.index(pair)\n\n if idx != -1 and not used[idx]:\n used[idx] = True\n cnt += 1\n\n #print(idx, num, power_of_2, pair)\n #print(used)\n\n print(cnt)\n\n return\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nTakahashi has N balls with positive integers written on them. The integer written on the i-th ball is A_i.\nHe would like to form some number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\nNote that a ball cannot belong to multiple pairs.\nFind the maximum possible number of pairs that can be formed.\n\nHere, a positive integer is said to be a power of 2 when it can be written as 2^t using some non-negative integer t.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n1\n\nWe can form one pair whose sum of the written numbers is 4 by pairing the first and third balls.\nNote that we cannot pair the second ball with itself.\n\nSample Input 2\n\n5\n3 11 14 5 13\n\nSample Output 2\n\n2", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03201", "source_text": "Score : 600 points\n\nProblem Statement\n\nTakahashi has N balls with positive integers written on them. The integer written on the i-th ball is A_i.\nHe would like to form some number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\nNote that a ball cannot belong to multiple pairs.\nFind the maximum possible number of pairs that can be formed.\n\nHere, a positive integer is said to be a power of 2 when it can be written as 2^t using some non-negative integer t.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n1\n\nWe can form one pair whose sum of the written numbers is 4 by pairing the first and third balls.\nNote that we cannot pair the second ball with itself.\n\nSample Input 2\n\n5\n3 11 14 5 13\n\nSample Output 2\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 643, "cpu_time_ms": 2105, "memory_kb": 26932}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s775367688", "group_id": "codeNet:p03207", "input_text": "def main():\n N = int(input())\n prices = [int(input()) for _ in range(N)]\n r = sum(prices) - max(prices) / 2\n print(int(r))\n\nif __name__ == '__main__':\n main()\n", "language": "Python", "metadata": {"date": 1593872711, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p03207.html", "problem_id": "p03207", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03207/input.txt", "sample_output_relpath": "derived/input_output/data/p03207/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03207/Python/s775367688.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s775367688", "user_id": "u243535639"}, "prompt_components": {"gold_output": "15950\n", "input_to_evaluate": "def main():\n N = int(input())\n prices = [int(input()) for _ in range(N)]\n r = sum(prices) - max(prices) / 2\n print(int(r))\n\nif __name__ == '__main__':\n main()\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIn some other world, today is the day before Christmas Eve.\n\nMr. Takaha is buying N items at a department store. The regular price of the i-th item (1 \\leq i \\leq N) is p_i yen (the currency of Japan).\n\nHe has a discount coupon, and can buy one item with the highest price for half the regular price. The remaining N-1 items cost their regular prices. What is the total amount he will pay?\n\nConstraints\n\n2 \\leq N \\leq 10\n\n100 \\leq p_i \\leq 10000\n\np_i is an even number.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\np_1\np_2\n:\np_N\n\nOutput\n\nPrint the total amount Mr. Takaha will pay.\n\nSample Input 1\n\n3\n4980\n7980\n6980\n\nSample Output 1\n\n15950\n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 = 15950 yen.\n\nNote that outputs such as 15950.0 will be judged as Wrong Answer.\n\nSample Input 2\n\n4\n4320\n4320\n4320\n4320\n\nSample Output 2\n\n15120\n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320 + 4320 + 4320 = 15120 yen.", "sample_input": "3\n4980\n7980\n6980\n"}, "reference_outputs": ["15950\n"], "source_document_id": "p03207", "source_text": "Score : 200 points\n\nProblem Statement\n\nIn some other world, today is the day before Christmas Eve.\n\nMr. Takaha is buying N items at a department store. The regular price of the i-th item (1 \\leq i \\leq N) is p_i yen (the currency of Japan).\n\nHe has a discount coupon, and can buy one item with the highest price for half the regular price. The remaining N-1 items cost their regular prices. What is the total amount he will pay?\n\nConstraints\n\n2 \\leq N \\leq 10\n\n100 \\leq p_i \\leq 10000\n\np_i is an even number.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\np_1\np_2\n:\np_N\n\nOutput\n\nPrint the total amount Mr. Takaha will pay.\n\nSample Input 1\n\n3\n4980\n7980\n6980\n\nSample Output 1\n\n15950\n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 = 15950 yen.\n\nNote that outputs such as 15950.0 will be judged as Wrong Answer.\n\nSample Input 2\n\n4\n4320\n4320\n4320\n4320\n\nSample Output 2\n\n15120\n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320 + 4320 + 4320 = 15120 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 174, "cpu_time_ms": 72, "memory_kb": 61952}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s895763280", "group_id": "codeNet:p03207", "input_text": "N = int(input())\n\nkakaku = [int(input()) for _ in range(N)]\ntotal = int(sum(kakaku) - (max(kakaku) / 2))\nprint(total)", "language": "Python", "metadata": {"date": 1546064758, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03207.html", "problem_id": "p03207", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03207/input.txt", "sample_output_relpath": "derived/input_output/data/p03207/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03207/Python/s895763280.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s895763280", "user_id": "u345389118"}, "prompt_components": {"gold_output": "15950\n", "input_to_evaluate": "N = int(input())\n\nkakaku = [int(input()) for _ in range(N)]\ntotal = int(sum(kakaku) - (max(kakaku) / 2))\nprint(total)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIn some other world, today is the day before Christmas Eve.\n\nMr. Takaha is buying N items at a department store. The regular price of the i-th item (1 \\leq i \\leq N) is p_i yen (the currency of Japan).\n\nHe has a discount coupon, and can buy one item with the highest price for half the regular price. The remaining N-1 items cost their regular prices. What is the total amount he will pay?\n\nConstraints\n\n2 \\leq N \\leq 10\n\n100 \\leq p_i \\leq 10000\n\np_i is an even number.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\np_1\np_2\n:\np_N\n\nOutput\n\nPrint the total amount Mr. Takaha will pay.\n\nSample Input 1\n\n3\n4980\n7980\n6980\n\nSample Output 1\n\n15950\n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 = 15950 yen.\n\nNote that outputs such as 15950.0 will be judged as Wrong Answer.\n\nSample Input 2\n\n4\n4320\n4320\n4320\n4320\n\nSample Output 2\n\n15120\n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320 + 4320 + 4320 = 15120 yen.", "sample_input": "3\n4980\n7980\n6980\n"}, "reference_outputs": ["15950\n"], "source_document_id": "p03207", "source_text": "Score : 200 points\n\nProblem Statement\n\nIn some other world, today is the day before Christmas Eve.\n\nMr. Takaha is buying N items at a department store. The regular price of the i-th item (1 \\leq i \\leq N) is p_i yen (the currency of Japan).\n\nHe has a discount coupon, and can buy one item with the highest price for half the regular price. The remaining N-1 items cost their regular prices. What is the total amount he will pay?\n\nConstraints\n\n2 \\leq N \\leq 10\n\n100 \\leq p_i \\leq 10000\n\np_i is an even number.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\np_1\np_2\n:\np_N\n\nOutput\n\nPrint the total amount Mr. Takaha will pay.\n\nSample Input 1\n\n3\n4980\n7980\n6980\n\nSample Output 1\n\n15950\n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 = 15950 yen.\n\nNote that outputs such as 15950.0 will be judged as Wrong Answer.\n\nSample Input 2\n\n4\n4320\n4320\n4320\n4320\n\nSample Output 2\n\n15120\n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320 + 4320 + 4320 = 15120 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 117, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s179609937", "group_id": "codeNet:p03208", "input_text": "n, k = map(int, input().split())\nh = [int(input()) for i in range(n)]\n\nh.sort()\n\nans = 100000000\n\nfor i in range(n-k+1):\n if ans > h[i+k-1]-h[i]:\n ans = h[i+k-1]-h[i]\n\nprint(ans)", "language": "Python", "metadata": {"date": 1588571014, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03208.html", "problem_id": "p03208", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03208/input.txt", "sample_output_relpath": "derived/input_output/data/p03208/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03208/Python/s179609937.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s179609937", "user_id": "u460009487"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n, k = map(int, input().split())\nh = [int(input()) for i in range(n)]\n\nh.sort()\n\nans = 100000000\n\nfor i in range(n-k+1):\n if ans > h[i+k-1]-h[i]:\n ans = h[i+k-1]-h[i]\n\nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn some other world, today is Christmas Eve.\n\nThere are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \\leq i \\leq N) is h_i meters.\n\nHe decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible.\n\nMore specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?\n\nConstraints\n\n2 \\leq K < N \\leq 10^5\n\n1 \\leq h_i \\leq 10^9\n\nh_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum possible value of h_{max} - h_{min}.\n\nSample Input 1\n\n5 3\n10\n15\n11\n14\n12\n\nSample Output 1\n\n2\n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so h_{max} - h_{min} = 2. This is optimal.\n\nSample Input 2\n\n5 3\n5\n7\n5\n7\n7\n\nSample Output 2\n\n0\n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so h_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can be at most one hundred thousand trees (we just can't put a sample with a hundred thousand lines here).", "sample_input": "5 3\n10\n15\n11\n14\n12\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03208", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn some other world, today is Christmas Eve.\n\nThere are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \\leq i \\leq N) is h_i meters.\n\nHe decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible.\n\nMore specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?\n\nConstraints\n\n2 \\leq K < N \\leq 10^5\n\n1 \\leq h_i \\leq 10^9\n\nh_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum possible value of h_{max} - h_{min}.\n\nSample Input 1\n\n5 3\n10\n15\n11\n14\n12\n\nSample Output 1\n\n2\n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so h_{max} - h_{min} = 2. This is optimal.\n\nSample Input 2\n\n5 3\n5\n7\n5\n7\n7\n\nSample Output 2\n\n0\n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so h_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can be at most one hundred thousand trees (we just can't put a sample with a hundred thousand lines here).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 182, "cpu_time_ms": 548, "memory_kb": 50332}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s475239901", "group_id": "codeNet:p03208", "input_text": "N,K = map(int,input().split())\nH = sorted(int(input()) for _ in range(N))\nans = float(\"INF\")\nfor i in range(N-K+1):\n ans = min(H[i+K-1]-H[i],ans)\nprint(ans)", "language": "Python", "metadata": {"date": 1576387419, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03208.html", "problem_id": "p03208", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03208/input.txt", "sample_output_relpath": "derived/input_output/data/p03208/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03208/Python/s475239901.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s475239901", "user_id": "u580093517"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "N,K = map(int,input().split())\nH = sorted(int(input()) for _ in range(N))\nans = float(\"INF\")\nfor i in range(N-K+1):\n ans = min(H[i+K-1]-H[i],ans)\nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn some other world, today is Christmas Eve.\n\nThere are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \\leq i \\leq N) is h_i meters.\n\nHe decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible.\n\nMore specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?\n\nConstraints\n\n2 \\leq K < N \\leq 10^5\n\n1 \\leq h_i \\leq 10^9\n\nh_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum possible value of h_{max} - h_{min}.\n\nSample Input 1\n\n5 3\n10\n15\n11\n14\n12\n\nSample Output 1\n\n2\n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so h_{max} - h_{min} = 2. This is optimal.\n\nSample Input 2\n\n5 3\n5\n7\n5\n7\n7\n\nSample Output 2\n\n0\n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so h_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can be at most one hundred thousand trees (we just can't put a sample with a hundred thousand lines here).", "sample_input": "5 3\n10\n15\n11\n14\n12\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03208", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn some other world, today is Christmas Eve.\n\nThere are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \\leq i \\leq N) is h_i meters.\n\nHe decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible.\n\nMore specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?\n\nConstraints\n\n2 \\leq K < N \\leq 10^5\n\n1 \\leq h_i \\leq 10^9\n\nh_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum possible value of h_{max} - h_{min}.\n\nSample Input 1\n\n5 3\n10\n15\n11\n14\n12\n\nSample Output 1\n\n2\n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so h_{max} - h_{min} = 2. This is optimal.\n\nSample Input 2\n\n5 3\n5\n7\n5\n7\n7\n\nSample Output 2\n\n0\n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so h_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can be at most one hundred thousand trees (we just can't put a sample with a hundred thousand lines here).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 159, "cpu_time_ms": 258, "memory_kb": 7396}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s129043473", "group_id": "codeNet:p03208", "input_text": "N,K=map(int,input().split())\nH=[int(input()) for i in range(N)]\n\nH.sort()\nANS=10**10\nfor i in range(K-1,N):\n if ANS>H[i]-H[i-K+1]:\n ANS=H[i]-H[i-K+1]\nprint(ANS)", "language": "Python", "metadata": {"date": 1544321829, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03208.html", "problem_id": "p03208", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03208/input.txt", "sample_output_relpath": "derived/input_output/data/p03208/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03208/Python/s129043473.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s129043473", "user_id": "u695811449"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "N,K=map(int,input().split())\nH=[int(input()) for i in range(N)]\n\nH.sort()\nANS=10**10\nfor i in range(K-1,N):\n if ANS>H[i]-H[i-K+1]:\n ANS=H[i]-H[i-K+1]\nprint(ANS)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn some other world, today is Christmas Eve.\n\nThere are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \\leq i \\leq N) is h_i meters.\n\nHe decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible.\n\nMore specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?\n\nConstraints\n\n2 \\leq K < N \\leq 10^5\n\n1 \\leq h_i \\leq 10^9\n\nh_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum possible value of h_{max} - h_{min}.\n\nSample Input 1\n\n5 3\n10\n15\n11\n14\n12\n\nSample Output 1\n\n2\n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so h_{max} - h_{min} = 2. This is optimal.\n\nSample Input 2\n\n5 3\n5\n7\n5\n7\n7\n\nSample Output 2\n\n0\n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so h_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can be at most one hundred thousand trees (we just can't put a sample with a hundred thousand lines here).", "sample_input": "5 3\n10\n15\n11\n14\n12\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03208", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn some other world, today is Christmas Eve.\n\nThere are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \\leq i \\leq N) is h_i meters.\n\nHe decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible.\n\nMore specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?\n\nConstraints\n\n2 \\leq K < N \\leq 10^5\n\n1 \\leq h_i \\leq 10^9\n\nh_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum possible value of h_{max} - h_{min}.\n\nSample Input 1\n\n5 3\n10\n15\n11\n14\n12\n\nSample Output 1\n\n2\n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so h_{max} - h_{min} = 2. This is optimal.\n\nSample Input 2\n\n5 3\n5\n7\n5\n7\n7\n\nSample Output 2\n\n0\n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so h_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can be at most one hundred thousand trees (we just can't put a sample with a hundred thousand lines here).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 170, "cpu_time_ms": 224, "memory_kb": 7384}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s211412612", "group_id": "codeNet:p03209", "input_text": "N, X = map(int, input().split())\na = [1]\np = [1]\nfor i in range(N):\n\ta.append(a[i]*2+3)\n\tp.append(p[i]*2+1)\n\ndef f(N, X):\n\tif N == 0:\n\t\treturn 0 if X <= 0 else 1\n\telif 1 <= X <= a[N-1]+1:\n\t\treturn f(N-1, X-1)\n\telif X == a[N-1]+2:\n\t\treturn p[N-1] + 1\n\telif a[N-1]+3 <= X <= 2*a[N-1]+2:\n\t\treturn f(N-1, X-2-a[N-1]) + p[N-1] + 1\n\telse:\n\t\treturn 2*p[N-1] + 1\n\nprint(f(N, X))\n", "language": "Python", "metadata": {"date": 1552683119, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03209.html", "problem_id": "p03209", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03209/input.txt", "sample_output_relpath": "derived/input_output/data/p03209/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03209/Python/s211412612.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s211412612", "user_id": "u050698451"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "N, X = map(int, input().split())\na = [1]\np = [1]\nfor i in range(N):\n\ta.append(a[i]*2+3)\n\tp.append(p[i]*2+1)\n\ndef f(N, X):\n\tif N == 0:\n\t\treturn 0 if X <= 0 else 1\n\telif 1 <= X <= a[N-1]+1:\n\t\treturn f(N-1, X-1)\n\telif X == a[N-1]+2:\n\t\treturn p[N-1] + 1\n\telif a[N-1]+3 <= X <= 2*a[N-1]+2:\n\t\treturn f(N-1, X-2-a[N-1]) + p[N-1] + 1\n\telse:\n\t\treturn 2*p[N-1] + 1\n\nprint(f(N, X))\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nIn some other world, today is Christmas.\n\nMr. Takaha decides to make a multi-dimensional burger in his party. A level-L burger (L is an integer greater than or equal to 0) is the following thing:\n\nA level-0 burger is a patty.\n\nA level-L burger (L \\geq 1) is a bun, a level-(L-1) burger, a patty, another level-(L-1) burger and another bun, stacked vertically in this order from the bottom.\n\nFor example, a level-1 burger and a level-2 burger look like BPPPB and BBPPPBPBPPPBB (rotated 90 degrees), where B and P stands for a bun and a patty.\n\nThe burger Mr. Takaha will make is a level-N burger. Lunlun the Dachshund will eat X layers from the bottom of this burger (a layer is a patty or a bun). How many patties will she eat?\n\nConstraints\n\n1 \\leq N \\leq 50\n\n1 \\leq X \\leq ( the total number of layers in a level-N burger )\n\nN and X are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\n\nOutput\n\nPrint the number of patties in the bottom-most X layers from the bottom of a level-N burger.\n\nSample Input 1\n\n2 7\n\nSample Output 1\n\n4\n\nThere are 4 patties in the bottom-most 7 layers of a level-2 burger (BBPPPBPBPPPBB).\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\n0\n\nThe bottom-most layer of a level-1 burger is a bun.\n\nSample Input 3\n\n50 4321098765432109\n\nSample Output 3\n\n2160549382716056\n\nA level-50 burger is rather thick, to the extent that the number of its layers does not fit into a 32-bit integer.", "sample_input": "2 7\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03209", "source_text": "Score : 400 points\n\nProblem Statement\n\nIn some other world, today is Christmas.\n\nMr. Takaha decides to make a multi-dimensional burger in his party. A level-L burger (L is an integer greater than or equal to 0) is the following thing:\n\nA level-0 burger is a patty.\n\nA level-L burger (L \\geq 1) is a bun, a level-(L-1) burger, a patty, another level-(L-1) burger and another bun, stacked vertically in this order from the bottom.\n\nFor example, a level-1 burger and a level-2 burger look like BPPPB and BBPPPBPBPPPBB (rotated 90 degrees), where B and P stands for a bun and a patty.\n\nThe burger Mr. Takaha will make is a level-N burger. Lunlun the Dachshund will eat X layers from the bottom of this burger (a layer is a patty or a bun). How many patties will she eat?\n\nConstraints\n\n1 \\leq N \\leq 50\n\n1 \\leq X \\leq ( the total number of layers in a level-N burger )\n\nN and X are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\n\nOutput\n\nPrint the number of patties in the bottom-most X layers from the bottom of a level-N burger.\n\nSample Input 1\n\n2 7\n\nSample Output 1\n\n4\n\nThere are 4 patties in the bottom-most 7 layers of a level-2 burger (BBPPPBPBPPPBB).\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\n0\n\nThe bottom-most layer of a level-1 burger is a bun.\n\nSample Input 3\n\n50 4321098765432109\n\nSample Output 3\n\n2160549382716056\n\nA level-50 burger is rather thick, to the extent that the number of its layers does not fit into a 32-bit integer.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 371, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s341194032", "group_id": "codeNet:p03210", "input_text": "if input() in ['7', '5', '3']:\n print('YES')\nelse:\n print('NO')", "language": "Python", "metadata": {"date": 1583980856, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03210.html", "problem_id": "p03210", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03210/input.txt", "sample_output_relpath": "derived/input_output/data/p03210/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03210/Python/s341194032.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s341194032", "user_id": "u922449550"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "if input() in ['7', '5', '3']:\n print('YES')\nelse:\n print('NO')", "problem_context": "Score : 100 points\n\nProblem Statement\n\nShichi-Go-San (literally \"Seven-Five-Three\") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children.\n\nTakahashi is now X years old. Will his growth be celebrated in Shichi-Go-San this time?\n\nConstraints\n\n1 ≤ X ≤ 9\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nIf Takahashi's growth will be celebrated, print YES; if it will not, print NO.\n\nSample Input 1\n\n5\n\nSample Output 1\n\nYES\n\nThe growth of a five-year-old child will be celebrated.\n\nSample Input 2\n\n6\n\nSample Output 2\n\nNO\n\nSee you next year.", "sample_input": "5\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03210", "source_text": "Score : 100 points\n\nProblem Statement\n\nShichi-Go-San (literally \"Seven-Five-Three\") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children.\n\nTakahashi is now X years old. Will his growth be celebrated in Shichi-Go-San this time?\n\nConstraints\n\n1 ≤ X ≤ 9\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nIf Takahashi's growth will be celebrated, print YES; if it will not, print NO.\n\nSample Input 1\n\n5\n\nSample Output 1\n\nYES\n\nThe growth of a five-year-old child will be celebrated.\n\nSample Input 2\n\n6\n\nSample Output 2\n\nNO\n\nSee you next year.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 65, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s158672532", "group_id": "codeNet:p03210", "input_text": "X = int(input())\nl = [7,5,3]\n\nif X in l:\n print('Yes')\nelse:\n print('No')", "language": "Python", "metadata": {"date": 1575122369, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03210.html", "problem_id": "p03210", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03210/input.txt", "sample_output_relpath": "derived/input_output/data/p03210/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03210/Python/s158672532.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s158672532", "user_id": "u379535139"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "X = int(input())\nl = [7,5,3]\n\nif X in l:\n print('Yes')\nelse:\n print('No')", "problem_context": "Score : 100 points\n\nProblem Statement\n\nShichi-Go-San (literally \"Seven-Five-Three\") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children.\n\nTakahashi is now X years old. Will his growth be celebrated in Shichi-Go-San this time?\n\nConstraints\n\n1 ≤ X ≤ 9\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nIf Takahashi's growth will be celebrated, print YES; if it will not, print NO.\n\nSample Input 1\n\n5\n\nSample Output 1\n\nYES\n\nThe growth of a five-year-old child will be celebrated.\n\nSample Input 2\n\n6\n\nSample Output 2\n\nNO\n\nSee you next year.", "sample_input": "5\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03210", "source_text": "Score : 100 points\n\nProblem Statement\n\nShichi-Go-San (literally \"Seven-Five-Three\") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children.\n\nTakahashi is now X years old. Will his growth be celebrated in Shichi-Go-San this time?\n\nConstraints\n\n1 ≤ X ≤ 9\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nIf Takahashi's growth will be celebrated, print YES; if it will not, print NO.\n\nSample Input 1\n\n5\n\nSample Output 1\n\nYES\n\nThe growth of a five-year-old child will be celebrated.\n\nSample Input 2\n\n6\n\nSample Output 2\n\nNO\n\nSee you next year.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 75, "cpu_time_ms": 19, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s778671664", "group_id": "codeNet:p03211", "input_text": "S = input()\nans = 753\nfor i in range(len(S)-2):\n ans = min(ans, abs(753-int(S[i:i+3])))\nprint(ans)", "language": "Python", "metadata": {"date": 1589728687, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03211.html", "problem_id": "p03211", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03211/input.txt", "sample_output_relpath": "derived/input_output/data/p03211/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03211/Python/s778671664.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s778671664", "user_id": "u771167374"}, "prompt_components": {"gold_output": "34\n", "input_to_evaluate": "S = input()\nans = 753\nfor i in range(len(S)-2):\n ans = min(ans, abs(753-int(S[i:i+3])))\nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a string S consisting of digits 1, 2, ..., 9.\nLunlun, the Dachshund, will take out three consecutive digits from S, treat them as a single integer X and bring it to her master. (She cannot rearrange the digits.)\n\nThe master's favorite number is 753. The closer to this number, the better.\nWhat is the minimum possible (absolute) difference between X and 753?\n\nConstraints\n\nS is a string of length between 4 and 10 (inclusive).\n\nEach character in S is 1, 2, ..., or 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum possible difference between X and 753.\n\nSample Input 1\n\n1234567876\n\nSample Output 1\n\n34\n\nTaking out the seventh to ninth characters results in X = 787, and the difference between this and 753 is 787 - 753 = 34. The difference cannot be made smaller, no matter where X is taken from.\n\nNote that the digits cannot be rearranged. For example, taking out 567 and rearranging it to 765 is not allowed.\n\nWe cannot take out three digits that are not consecutive from S, either. For example, taking out the seventh digit 7, the ninth digit 7 and the tenth digit 6 to obtain 776 is not allowed.\n\nSample Input 2\n\n35753\n\nSample Output 2\n\n0\n\nIf 753 itself can be taken out, the answer is 0.\n\nSample Input 3\n\n1111111111\n\nSample Output 3\n\n642\n\nNo matter where X is taken from, X = 111, with the difference 753 - 111 = 642.", "sample_input": "1234567876\n"}, "reference_outputs": ["34\n"], "source_document_id": "p03211", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a string S consisting of digits 1, 2, ..., 9.\nLunlun, the Dachshund, will take out three consecutive digits from S, treat them as a single integer X and bring it to her master. (She cannot rearrange the digits.)\n\nThe master's favorite number is 753. The closer to this number, the better.\nWhat is the minimum possible (absolute) difference between X and 753?\n\nConstraints\n\nS is a string of length between 4 and 10 (inclusive).\n\nEach character in S is 1, 2, ..., or 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum possible difference between X and 753.\n\nSample Input 1\n\n1234567876\n\nSample Output 1\n\n34\n\nTaking out the seventh to ninth characters results in X = 787, and the difference between this and 753 is 787 - 753 = 34. The difference cannot be made smaller, no matter where X is taken from.\n\nNote that the digits cannot be rearranged. For example, taking out 567 and rearranging it to 765 is not allowed.\n\nWe cannot take out three digits that are not consecutive from S, either. For example, taking out the seventh digit 7, the ninth digit 7 and the tenth digit 6 to obtain 776 is not allowed.\n\nSample Input 2\n\n35753\n\nSample Output 2\n\n0\n\nIf 753 itself can be taken out, the answer is 0.\n\nSample Input 3\n\n1111111111\n\nSample Output 3\n\n642\n\nNo matter where X is taken from, X = 111, with the difference 753 - 111 = 642.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 101, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s930505798", "group_id": "codeNet:p03211", "input_text": "S=input()\nS_len = len(S)\nS_num = [0]*(S_len-2)\nfor i in range(S_len - 2):\n S_num[i] = int(S[i]+S[i+1]+S[i+2])\n S_num[i] = abs(753-S_num[i])\nprint(min(S_num))", "language": "Python", "metadata": {"date": 1554688860, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03211.html", "problem_id": "p03211", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03211/input.txt", "sample_output_relpath": "derived/input_output/data/p03211/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03211/Python/s930505798.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s930505798", "user_id": "u783420291"}, "prompt_components": {"gold_output": "34\n", "input_to_evaluate": "S=input()\nS_len = len(S)\nS_num = [0]*(S_len-2)\nfor i in range(S_len - 2):\n S_num[i] = int(S[i]+S[i+1]+S[i+2])\n S_num[i] = abs(753-S_num[i])\nprint(min(S_num))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a string S consisting of digits 1, 2, ..., 9.\nLunlun, the Dachshund, will take out three consecutive digits from S, treat them as a single integer X and bring it to her master. (She cannot rearrange the digits.)\n\nThe master's favorite number is 753. The closer to this number, the better.\nWhat is the minimum possible (absolute) difference between X and 753?\n\nConstraints\n\nS is a string of length between 4 and 10 (inclusive).\n\nEach character in S is 1, 2, ..., or 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum possible difference between X and 753.\n\nSample Input 1\n\n1234567876\n\nSample Output 1\n\n34\n\nTaking out the seventh to ninth characters results in X = 787, and the difference between this and 753 is 787 - 753 = 34. The difference cannot be made smaller, no matter where X is taken from.\n\nNote that the digits cannot be rearranged. For example, taking out 567 and rearranging it to 765 is not allowed.\n\nWe cannot take out three digits that are not consecutive from S, either. For example, taking out the seventh digit 7, the ninth digit 7 and the tenth digit 6 to obtain 776 is not allowed.\n\nSample Input 2\n\n35753\n\nSample Output 2\n\n0\n\nIf 753 itself can be taken out, the answer is 0.\n\nSample Input 3\n\n1111111111\n\nSample Output 3\n\n642\n\nNo matter where X is taken from, X = 111, with the difference 753 - 111 = 642.", "sample_input": "1234567876\n"}, "reference_outputs": ["34\n"], "source_document_id": "p03211", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a string S consisting of digits 1, 2, ..., 9.\nLunlun, the Dachshund, will take out three consecutive digits from S, treat them as a single integer X and bring it to her master. (She cannot rearrange the digits.)\n\nThe master's favorite number is 753. The closer to this number, the better.\nWhat is the minimum possible (absolute) difference between X and 753?\n\nConstraints\n\nS is a string of length between 4 and 10 (inclusive).\n\nEach character in S is 1, 2, ..., or 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum possible difference between X and 753.\n\nSample Input 1\n\n1234567876\n\nSample Output 1\n\n34\n\nTaking out the seventh to ninth characters results in X = 787, and the difference between this and 753 is 787 - 753 = 34. The difference cannot be made smaller, no matter where X is taken from.\n\nNote that the digits cannot be rearranged. For example, taking out 567 and rearranging it to 765 is not allowed.\n\nWe cannot take out three digits that are not consecutive from S, either. For example, taking out the seventh digit 7, the ninth digit 7 and the tenth digit 6 to obtain 776 is not allowed.\n\nSample Input 2\n\n35753\n\nSample Output 2\n\n0\n\nIf 753 itself can be taken out, the answer is 0.\n\nSample Input 3\n\n1111111111\n\nSample Output 3\n\n642\n\nNo matter where X is taken from, X = 111, with the difference 753 - 111 = 642.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 163, "cpu_time_ms": 18, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s225081326", "group_id": "codeNet:p03212", "input_text": "def function(n):\n digit=len(str(n))\n N=str(n)\n k=int(N[0])\n if digit<3:\n return 0\n else:\n if k<3:\n return function(10**(digit-1)-1)\n elif k==3:\n return function(10**(digit-1)-1)+function(n%(10**(digit-1)))-function(10**(digit-2))+subfunction(5,7,n%(10**(digit-1)))\n elif k==4:\n return function(4*(10**(digit-1))-1)\n elif k==5:\n return function(4*(10**(digit-1))-1)+function(n%(10**(digit-1)))-function(10**(digit-2))+subfunction(3,7,n%(10**(digit-1)))\n elif k==6:\n return function(6*(10**(digit-1))-1)\n elif k==7:\n return function(6*(10**(digit-1))-1)+function(n%(10**(digit-1)))-function(10**(digit-2))+subfunction(3,5,n%(10**(digit-1)))\n else:\n return function(8*(10**(digit-1))-1)\n\ndef subfunction(a,b,n):\n digit=len(str(n))\n N=str(n)\n k=int(N[0])\n if digit<2:\n return 0\n else:\n if k=12 else sum([N>=9, N>=6]) # 4\nft = sum([N>=91, N>=60, N>=30, N>=16]) # 14\ntf = sum([N>=100, N>=54, N>=28]) # 24\nsf = N>=78 # 74\n\ntff = four * (four-1) * (two-2) // 2 # 2,4,4\nttf = tf * (two-1) # 2,24\nfft = ft * (four-1) # 4,14\nsfo = sf # 74\n\nprint(tff+ttf+fft+sfo)", "language": "Python", "metadata": {"date": 1546979728, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03213.html", "problem_id": "p03213", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03213/input.txt", "sample_output_relpath": "derived/input_output/data/p03213/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03213/Python/s726263362.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s726263362", "user_id": "u130391855"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "N = int(input())\nprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]\n\ntwo = sum(p<=N//2 for p in primes) # 2\nfour = sum(p<=N//4 for p in primes) if N>=12 else sum([N>=9, N>=6]) # 4\nft = sum([N>=91, N>=60, N>=30, N>=16]) # 14\ntf = sum([N>=100, N>=54, N>=28]) # 24\nsf = N>=78 # 74\n\ntff = four * (four-1) * (two-2) // 2 # 2,4,4\nttf = tf * (two-1) # 2,24\nfft = ft * (four-1) # 4,14\nsfo = sf # 74\n\nprint(tff+ttf+fft+sfo)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given an integer N. Among the divisors of N! (= 1 \\times 2 \\times ... \\times N), how many Shichi-Go numbers (literally \"Seven-Five numbers\") are there?\n\nHere, a Shichi-Go number is a positive integer that has exactly 75 divisors.\n\nNote\n\nWhen a positive integer A divides a positive integer B, A is said to a divisor of B.\nFor example, 6 has four divisors: 1, 2, 3 and 6.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of the Shichi-Go numbers that are divisors of N!.\n\nSample Input 1\n\n9\n\nSample Output 1\n\n0\n\nThere are no Shichi-Go numbers among the divisors of 9! = 1 \\times 2 \\times ... \\times 9 = 362880.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n1\n\nThere is one Shichi-Go number among the divisors of 10! = 3628800: 32400.\n\nSample Input 3\n\n100\n\nSample Output 3\n\n543", "sample_input": "9\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03213", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given an integer N. Among the divisors of N! (= 1 \\times 2 \\times ... \\times N), how many Shichi-Go numbers (literally \"Seven-Five numbers\") are there?\n\nHere, a Shichi-Go number is a positive integer that has exactly 75 divisors.\n\nNote\n\nWhen a positive integer A divides a positive integer B, A is said to a divisor of B.\nFor example, 6 has four divisors: 1, 2, 3 and 6.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of the Shichi-Go numbers that are divisors of N!.\n\nSample Input 1\n\n9\n\nSample Output 1\n\n0\n\nThere are no Shichi-Go numbers among the divisors of 9! = 1 \\times 2 \\times ... \\times 9 = 362880.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n1\n\nThere is one Shichi-Go number among the divisors of 10! = 3628800: 32400.\n\nSample Input 3\n\n100\n\nSample Output 3\n\n543", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 415, "cpu_time_ms": 18, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s193656072", "group_id": "codeNet:p03219", "input_text": "#include\n#include\nusing namespace std;\nint main()\n{\n\tint a,b,c;\n\tcin>>a>>b;\n\tc=a+b/2;\n\tcout<\n#include\nusing namespace std;\nint main()\n{\n\tint a,b,c;\n\tcin>>a>>b;\n\tc=a+b/2;\n\tcout< abs(A-tmp):\n p = A-tmp\n ans = i+1\nprint(ans)\n", "language": "Python", "metadata": {"date": 1558553751, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03220.html", "problem_id": "p03220", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03220/input.txt", "sample_output_relpath": "derived/input_output/data/p03220/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03220/Python/s673066299.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s673066299", "user_id": "u614734359"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "N = int(input())\nT,A = (int(i) for i in input().split())\np = float('inf')\nfor i,h in enumerate([int(i) for i in input().split()]):\n tmp = T-h*0.006\n if p > abs(A-tmp):\n p = A-tmp\n ans = i+1\nprint(ans)\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nA country decides to build a palace.\n\nIn this country, the average temperature of a point at an elevation of x meters is T-x \\times 0.006 degrees Celsius.\n\nThere are N places proposed for the place. The elevation of Place i is H_i meters.\n\nAmong them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.\n\nPrint the index of the place where the palace should be built.\n\nIt is guaranteed that the solution is unique.\n\nConstraints\n\n1 \\leq N \\leq 1000\n\n0 \\leq T \\leq 50\n\n-60 \\leq A \\leq T\n\n0 \\leq H_i \\leq 10^5\n\nAll values in input are integers.\n\nThe solution is unique.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nT A\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the index of the place where the palace should be built.\n\nSample Input 1\n\n2\n12 5\n1000 2000\n\nSample Output 1\n\n1\n\nThe average temperature of Place 1 is 12-1000 \\times 0.006=6 degrees Celsius.\n\nThe average temperature of Place 2 is 12-2000 \\times 0.006=0 degrees Celsius.\n\nThus, the palace should be built at Place 1.\n\nSample Input 2\n\n3\n21 -11\n81234 94124 52141\n\nSample Output 2\n\n3", "sample_input": "2\n12 5\n1000 2000\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03220", "source_text": "Score: 200 points\n\nProblem Statement\n\nA country decides to build a palace.\n\nIn this country, the average temperature of a point at an elevation of x meters is T-x \\times 0.006 degrees Celsius.\n\nThere are N places proposed for the place. The elevation of Place i is H_i meters.\n\nAmong them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.\n\nPrint the index of the place where the palace should be built.\n\nIt is guaranteed that the solution is unique.\n\nConstraints\n\n1 \\leq N \\leq 1000\n\n0 \\leq T \\leq 50\n\n-60 \\leq A \\leq T\n\n0 \\leq H_i \\leq 10^5\n\nAll values in input are integers.\n\nThe solution is unique.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nT A\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the index of the place where the palace should be built.\n\nSample Input 1\n\n2\n12 5\n1000 2000\n\nSample Output 1\n\n1\n\nThe average temperature of Place 1 is 12-1000 \\times 0.006=6 degrees Celsius.\n\nThe average temperature of Place 2 is 12-2000 \\times 0.006=0 degrees Celsius.\n\nThus, the palace should be built at Place 1.\n\nSample Input 2\n\n3\n21 -11\n81234 94124 52141\n\nSample Output 2\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 221, "cpu_time_ms": 19, "memory_kb": 3188}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s969663306", "group_id": "codeNet:p03220", "input_text": "from sys import stdin\n\ndef main():\n N = int(input())\n T, A = map(int, input().split())\n H = map(int, input().split())\n\n temp = [T - x * 0.006 for x in H]\n diff = float('inf')\n ans = 0\n for i, a in enumerate(temp, start=1):\n b = abs(A - a)\n if not b:\n print(i)\n return\n elif diff > b:\n ans, diff = i, b\n print(ans)\n\ninput = lambda: stdin.readline()\nmain()\n", "language": "Python", "metadata": {"date": 1541384434, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03220.html", "problem_id": "p03220", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03220/input.txt", "sample_output_relpath": "derived/input_output/data/p03220/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03220/Python/s969663306.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s969663306", "user_id": "u125205981"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "from sys import stdin\n\ndef main():\n N = int(input())\n T, A = map(int, input().split())\n H = map(int, input().split())\n\n temp = [T - x * 0.006 for x in H]\n diff = float('inf')\n ans = 0\n for i, a in enumerate(temp, start=1):\n b = abs(A - a)\n if not b:\n print(i)\n return\n elif diff > b:\n ans, diff = i, b\n print(ans)\n\ninput = lambda: stdin.readline()\nmain()\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nA country decides to build a palace.\n\nIn this country, the average temperature of a point at an elevation of x meters is T-x \\times 0.006 degrees Celsius.\n\nThere are N places proposed for the place. The elevation of Place i is H_i meters.\n\nAmong them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.\n\nPrint the index of the place where the palace should be built.\n\nIt is guaranteed that the solution is unique.\n\nConstraints\n\n1 \\leq N \\leq 1000\n\n0 \\leq T \\leq 50\n\n-60 \\leq A \\leq T\n\n0 \\leq H_i \\leq 10^5\n\nAll values in input are integers.\n\nThe solution is unique.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nT A\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the index of the place where the palace should be built.\n\nSample Input 1\n\n2\n12 5\n1000 2000\n\nSample Output 1\n\n1\n\nThe average temperature of Place 1 is 12-1000 \\times 0.006=6 degrees Celsius.\n\nThe average temperature of Place 2 is 12-2000 \\times 0.006=0 degrees Celsius.\n\nThus, the palace should be built at Place 1.\n\nSample Input 2\n\n3\n21 -11\n81234 94124 52141\n\nSample Output 2\n\n3", "sample_input": "2\n12 5\n1000 2000\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03220", "source_text": "Score: 200 points\n\nProblem Statement\n\nA country decides to build a palace.\n\nIn this country, the average temperature of a point at an elevation of x meters is T-x \\times 0.006 degrees Celsius.\n\nThere are N places proposed for the place. The elevation of Place i is H_i meters.\n\nAmong them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.\n\nPrint the index of the place where the palace should be built.\n\nIt is guaranteed that the solution is unique.\n\nConstraints\n\n1 \\leq N \\leq 1000\n\n0 \\leq T \\leq 50\n\n-60 \\leq A \\leq T\n\n0 \\leq H_i \\leq 10^5\n\nAll values in input are integers.\n\nThe solution is unique.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nT A\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the index of the place where the palace should be built.\n\nSample Input 1\n\n2\n12 5\n1000 2000\n\nSample Output 1\n\n1\n\nThe average temperature of Place 1 is 12-1000 \\times 0.006=6 degrees Celsius.\n\nThe average temperature of Place 2 is 12-2000 \\times 0.006=0 degrees Celsius.\n\nThus, the palace should be built at Place 1.\n\nSample Input 2\n\n3\n21 -11\n81234 94124 52141\n\nSample Output 2\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 433, "cpu_time_ms": 46, "memory_kb": 3188}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s757064740", "group_id": "codeNet:p03221", "input_text": "def main():\n n, m = map(int, input().split())\n query = []\n result = [[] for i in range(n)]\n for i in range(m):\n qList = list(map(int, input().split()))\n query.append(qList)\n result[qList[0]-1].append(qList[1])\n \n for i in result:\n i.sort()\n \n for city in query:\n rank = bisect.bisect_left(result[city[0]-1], city[1])\n ans = \"%06d%06d\"%(city[0],rank+1)\n print(ans)\n \nif __name__ == \"__main__\":\n main()", "language": "Python", "metadata": {"date": 1567112820, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03221.html", "problem_id": "p03221", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03221/input.txt", "sample_output_relpath": "derived/input_output/data/p03221/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03221/Python/s757064740.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s757064740", "user_id": "u359933779"}, "prompt_components": {"gold_output": "000001000002\n000002000001\n000001000001\n", "input_to_evaluate": "def main():\n n, m = map(int, input().split())\n query = []\n result = [[] for i in range(n)]\n for i in range(m):\n qList = list(map(int, input().split()))\n query.append(qList)\n result[qList[0]-1].append(qList[1])\n \n for i in result:\n i.sort()\n \n for city in query:\n rank = bisect.bisect_left(result[city[0]-1], city[1])\n ans = \"%06d%06d\"%(city[0],rank+1)\n print(ans)\n \nif __name__ == \"__main__\":\n main()", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.\n\nCity i is established in year Y_i and belongs to Prefecture P_i.\n\nYou can assume that there are no multiple cities that are established in the same year.\n\nIt is decided to allocate a 12-digit ID number to each city.\n\nIf City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x.\n\nHere, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits.\n\nFind the ID numbers for all the cities.\n\nNote that there can be a prefecture with no cities.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq P_i \\leq N\n\n1 \\leq Y_i \\leq 10^9\n\nY_i are all different.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nP_1 Y_1\n:\nP_M Y_M\n\nOutput\n\nPrint the ID numbers for all the cities, in ascending order of indices (City 1, City 2, ...).\n\nSample Input 1\n\n2 3\n1 32\n2 63\n1 12\n\nSample Output 1\n\n000001000002\n000002000001\n000001000001\n\nAs City 1 is the second established city among the cities that belong to Prefecture 1, its ID number is 000001000002.\n\nAs City 2 is the first established city among the cities that belong to Prefecture 2, its ID number is 000002000001.\n\nAs City 3 is the first established city among the cities that belong to Prefecture 1, its ID number is 000001000001.\n\nSample Input 2\n\n2 3\n2 55\n2 77\n2 99\n\nSample Output 2\n\n000002000001\n000002000002\n000002000003", "sample_input": "2 3\n1 32\n2 63\n1 12\n"}, "reference_outputs": ["000001000002\n000002000001\n000001000001\n"], "source_document_id": "p03221", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.\n\nCity i is established in year Y_i and belongs to Prefecture P_i.\n\nYou can assume that there are no multiple cities that are established in the same year.\n\nIt is decided to allocate a 12-digit ID number to each city.\n\nIf City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x.\n\nHere, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits.\n\nFind the ID numbers for all the cities.\n\nNote that there can be a prefecture with no cities.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq P_i \\leq N\n\n1 \\leq Y_i \\leq 10^9\n\nY_i are all different.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nP_1 Y_1\n:\nP_M Y_M\n\nOutput\n\nPrint the ID numbers for all the cities, in ascending order of indices (City 1, City 2, ...).\n\nSample Input 1\n\n2 3\n1 32\n2 63\n1 12\n\nSample Output 1\n\n000001000002\n000002000001\n000001000001\n\nAs City 1 is the second established city among the cities that belong to Prefecture 1, its ID number is 000001000002.\n\nAs City 2 is the first established city among the cities that belong to Prefecture 2, its ID number is 000002000001.\n\nAs City 3 is the first established city among the cities that belong to Prefecture 1, its ID number is 000001000001.\n\nSample Input 2\n\n2 3\n2 55\n2 77\n2 99\n\nSample Output 2\n\n000002000001\n000002000002\n000002000003", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 471, "cpu_time_ms": 715, "memory_kb": 72224}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s272780346", "group_id": "codeNet:p03221", "input_text": "N, M = map(int, input().split())\np = list()\ny = list()\nd = dict()\nfor i in range(M):\n inp_p, inp_y = map(int, input().split())\n p.append(inp_p)\n y.append(inp_y)\n if inp_p in d:\n d[inp_p].append(inp_y)\n else:\n d[inp_p] = [inp_y]\nfor i in d:\n d[i] = sorted(d[i])\nfor i, j in zip(p, y):\n print(\"{:06d}{:06d}\".format(i, d[i].index(j)+1))", "language": "Python", "metadata": {"date": 1541971117, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03221.html", "problem_id": "p03221", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03221/input.txt", "sample_output_relpath": "derived/input_output/data/p03221/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03221/Python/s272780346.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s272780346", "user_id": "u647213752"}, "prompt_components": {"gold_output": "000001000002\n000002000001\n000001000001\n", "input_to_evaluate": "N, M = map(int, input().split())\np = list()\ny = list()\nd = dict()\nfor i in range(M):\n inp_p, inp_y = map(int, input().split())\n p.append(inp_p)\n y.append(inp_y)\n if inp_p in d:\n d[inp_p].append(inp_y)\n else:\n d[inp_p] = [inp_y]\nfor i in d:\n d[i] = sorted(d[i])\nfor i, j in zip(p, y):\n print(\"{:06d}{:06d}\".format(i, d[i].index(j)+1))", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.\n\nCity i is established in year Y_i and belongs to Prefecture P_i.\n\nYou can assume that there are no multiple cities that are established in the same year.\n\nIt is decided to allocate a 12-digit ID number to each city.\n\nIf City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x.\n\nHere, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits.\n\nFind the ID numbers for all the cities.\n\nNote that there can be a prefecture with no cities.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq P_i \\leq N\n\n1 \\leq Y_i \\leq 10^9\n\nY_i are all different.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nP_1 Y_1\n:\nP_M Y_M\n\nOutput\n\nPrint the ID numbers for all the cities, in ascending order of indices (City 1, City 2, ...).\n\nSample Input 1\n\n2 3\n1 32\n2 63\n1 12\n\nSample Output 1\n\n000001000002\n000002000001\n000001000001\n\nAs City 1 is the second established city among the cities that belong to Prefecture 1, its ID number is 000001000002.\n\nAs City 2 is the first established city among the cities that belong to Prefecture 2, its ID number is 000002000001.\n\nAs City 3 is the first established city among the cities that belong to Prefecture 1, its ID number is 000001000001.\n\nSample Input 2\n\n2 3\n2 55\n2 77\n2 99\n\nSample Output 2\n\n000002000001\n000002000002\n000002000003", "sample_input": "2 3\n1 32\n2 63\n1 12\n"}, "reference_outputs": ["000001000002\n000002000001\n000001000001\n"], "source_document_id": "p03221", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.\n\nCity i is established in year Y_i and belongs to Prefecture P_i.\n\nYou can assume that there are no multiple cities that are established in the same year.\n\nIt is decided to allocate a 12-digit ID number to each city.\n\nIf City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x.\n\nHere, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits.\n\nFind the ID numbers for all the cities.\n\nNote that there can be a prefecture with no cities.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq P_i \\leq N\n\n1 \\leq Y_i \\leq 10^9\n\nY_i are all different.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nP_1 Y_1\n:\nP_M Y_M\n\nOutput\n\nPrint the ID numbers for all the cities, in ascending order of indices (City 1, City 2, ...).\n\nSample Input 1\n\n2 3\n1 32\n2 63\n1 12\n\nSample Output 1\n\n000001000002\n000002000001\n000001000001\n\nAs City 1 is the second established city among the cities that belong to Prefecture 1, its ID number is 000001000002.\n\nAs City 2 is the first established city among the cities that belong to Prefecture 2, its ID number is 000002000001.\n\nAs City 3 is the first established city among the cities that belong to Prefecture 1, its ID number is 000001000001.\n\nSample Input 2\n\n2 3\n2 55\n2 77\n2 99\n\nSample Output 2\n\n000002000001\n000002000002\n000002000003", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 368, "cpu_time_ms": 2104, "memory_kb": 30284}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s564078848", "group_id": "codeNet:p03223", "input_text": "n,*a=map(int,open(0).readlines())\na.sort()\nif n%2:\n b=a[:n//2]\n c=a[n//2:]\n for i in range(n//2):\n b[i]*=2\n for i in range(2,n//2+1):\n c[i]*=2\n m=sum(c)-sum(b)\n b=a[:n//2+1]\n c=a[n//2+1:]\n for i in range(n//2-1):\n b[i]*=2\n for i in range(n//2):\n c[i]*=2\n m=max(m,sum(c)-sum(b))\nelse:\n b=a[:n//2]\n c=a[n//2:]\n for i in range(n//2-1):\n b[i]*=2\n for i in range(1,n//2):\n c[i]*=2\n m=sum(c)-sum(b)\nprint(m)", "language": "Python", "metadata": {"date": 1551946225, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03223.html", "problem_id": "p03223", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03223/input.txt", "sample_output_relpath": "derived/input_output/data/p03223/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03223/Python/s564078848.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s564078848", "user_id": "u729133443"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "n,*a=map(int,open(0).readlines())\na.sort()\nif n%2:\n b=a[:n//2]\n c=a[n//2:]\n for i in range(n//2):\n b[i]*=2\n for i in range(2,n//2+1):\n c[i]*=2\n m=sum(c)-sum(b)\n b=a[:n//2+1]\n c=a[n//2+1:]\n for i in range(n//2-1):\n b[i]*=2\n for i in range(n//2):\n c[i]*=2\n m=max(m,sum(c)-sum(b))\nelse:\n b=a[:n//2]\n c=a[n//2:]\n for i in range(n//2-1):\n b[i]*=2\n for i in range(1,n//2):\n c[i]*=2\n m=sum(c)-sum(b)\nprint(m)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "sample_input": "5\n6\n8\n1\n2\n3\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03223", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 434, "cpu_time_ms": 290, "memory_kb": 60508}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s861323633", "group_id": "codeNet:p03228", "input_text": "def exchange(hand,receive):\n if(hand[0]%2==1):\n hand[0]-=1\n hand[0]/=2\n receive[0]+=hand[0]\n\nA=[0]\nB=[0]\nA[0],B[0],K=map(int,input().split())\n\n\nfor i in range(K):\n if(i%2==0):\n exchange(A,B)\n else:\n exchange(B,A)\n\nprint(\"{} {}\".format(int(A[0]),int(B[0])))", "language": "Python", "metadata": {"date": 1540927872, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03228.html", "problem_id": "p03228", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03228/input.txt", "sample_output_relpath": "derived/input_output/data/p03228/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03228/Python/s861323633.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s861323633", "user_id": "u920299620"}, "prompt_components": {"gold_output": "5 3\n", "input_to_evaluate": "def exchange(hand,receive):\n if(hand[0]%2==1):\n hand[0]-=1\n hand[0]/=2\n receive[0]+=hand[0]\n\nA=[0]\nB=[0]\nA[0],B[0],K=map(int,input().split())\n\n\nfor i in range(K):\n if(i%2==0):\n exchange(A,B)\n else:\n exchange(B,A)\n\nprint(\"{} {}\".format(int(A[0]),int(B[0])))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIn the beginning, Takahashi has A cookies, and Aoki has B cookies.\nThey will perform the following operation alternately, starting from Takahashi:\n\nIf the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other person.\n\nFind the numbers of cookies Takahashi and Aoki respectively have after performing K operations in total.\n\nConstraints\n\n1 \\leq A,B \\leq 10^9\n\n1 \\leq K \\leq 100\n\nA,B and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the number of cookies Takahashi has, and the number of cookies Aoki has, in this order, after performing K operations in total.\n\nSample Input 1\n\n5 4 2\n\nSample Output 1\n\n5 3\n\nThe process will go as follows:\n\nIn the beginning, Takahashi and Aoki have 5 and 4 cookies, respectively.\n\nTakahashi eats one cookie and gives two cookies to Aoki. They now have 2 and 6 cookies, respectively.\n\nAoki gives three cookies to Takahashi. They now have 5 and 3 cookies, respectively.\n\nSample Input 2\n\n3 3 3\n\nSample Output 2\n\n1 3\n\nSample Input 3\n\n314159265 358979323 84\n\nSample Output 3\n\n448759046 224379523", "sample_input": "5 4 2\n"}, "reference_outputs": ["5 3\n"], "source_document_id": "p03228", "source_text": "Score : 200 points\n\nProblem Statement\n\nIn the beginning, Takahashi has A cookies, and Aoki has B cookies.\nThey will perform the following operation alternately, starting from Takahashi:\n\nIf the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other person.\n\nFind the numbers of cookies Takahashi and Aoki respectively have after performing K operations in total.\n\nConstraints\n\n1 \\leq A,B \\leq 10^9\n\n1 \\leq K \\leq 100\n\nA,B and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the number of cookies Takahashi has, and the number of cookies Aoki has, in this order, after performing K operations in total.\n\nSample Input 1\n\n5 4 2\n\nSample Output 1\n\n5 3\n\nThe process will go as follows:\n\nIn the beginning, Takahashi and Aoki have 5 and 4 cookies, respectively.\n\nTakahashi eats one cookie and gives two cookies to Aoki. They now have 2 and 6 cookies, respectively.\n\nAoki gives three cookies to Takahashi. They now have 5 and 3 cookies, respectively.\n\nSample Input 2\n\n3 3 3\n\nSample Output 2\n\n1 3\n\nSample Input 3\n\n314159265 358979323 84\n\nSample Output 3\n\n448759046 224379523", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 292, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s153547362", "group_id": "codeNet:p03230", "input_text": "N = int(input())\nif N == 1:\n print('Yes')\n print(2)\n print(1, 1)\n print(1, 1)\n quit()\n\nS = [{1, 2}, {1, 3}, {2, 3}]\nn = 3\nwhile n < N:\n l = len(S)\n s = set()\n for i in range(l):\n n += 1\n S[i].add(n)\n s.add(n)\n S.append(s)\n\nif n == N:\n print('Yes')\n print(len(S))\n for s in S:\n print(len(s), *s)\nelse:\n print('No')", "language": "Python", "metadata": {"date": 1592178083, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03230.html", "problem_id": "p03230", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03230/input.txt", "sample_output_relpath": "derived/input_output/data/p03230/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03230/Python/s153547362.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s153547362", "user_id": "u922449550"}, "prompt_components": {"gold_output": "Yes\n3\n2 1 2\n2 3 1\n2 2 3\n", "input_to_evaluate": "N = int(input())\nif N == 1:\n print('Yes')\n print(2)\n print(1, 1)\n print(1, 1)\n quit()\n\nS = [{1, 2}, {1, 3}, {2, 3}]\nn = 3\nwhile n < N:\n l = len(S)\n s = set()\n for i in range(l):\n n += 1\n S[i].add(n)\n s.add(n)\n S.append(s)\n\nif n == N:\n print('Yes')\n print(len(S))\n for s in S:\n print(len(s), *s)\nelse:\n print('No')", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given an integer N. Determine if there exists a tuple of subsets of \\{1,2,...N\\}, (S_1,S_2,...,S_k), that satisfies the following conditions:\n\nEach of the integers 1,2,...,N is contained in exactly two of the sets S_1,S_2,...,S_k.\n\nAny two of the sets S_1,S_2,...,S_k have exactly one element in common.\n\nIf such a tuple exists, construct one such tuple.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf a tuple of subsets of \\{1,2,...N\\} that satisfies the conditions does not exist, print No.\nIf such a tuple exists, print Yes first, then print such subsets in the following format:\n\nk\n|S_1| S_{1,1} S_{1,2} ... S_{1,|S_1|}\n:\n|S_k| S_{k,1} S_{k,2} ... S_{k,|S_k|}\n\nwhere S_i={S_{i,1},S_{i,2},...,S_{i,|S_i|}}.\n\nIf there are multiple such tuples, any of them will be accepted.\n\nSample Input 1\n\n3\n\nSample Output 1\n\nYes\n3\n2 1 2\n2 3 1\n2 2 3\n\nIt can be seen that (S_1,S_2,S_3)=(\\{1,2\\},\\{3,1\\},\\{2,3\\}) satisfies the conditions.\n\nSample Input 2\n\n4\n\nSample Output 2\n\nNo", "sample_input": "3\n"}, "reference_outputs": ["Yes\n3\n2 1 2\n2 3 1\n2 2 3\n"], "source_document_id": "p03230", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given an integer N. Determine if there exists a tuple of subsets of \\{1,2,...N\\}, (S_1,S_2,...,S_k), that satisfies the following conditions:\n\nEach of the integers 1,2,...,N is contained in exactly two of the sets S_1,S_2,...,S_k.\n\nAny two of the sets S_1,S_2,...,S_k have exactly one element in common.\n\nIf such a tuple exists, construct one such tuple.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf a tuple of subsets of \\{1,2,...N\\} that satisfies the conditions does not exist, print No.\nIf such a tuple exists, print Yes first, then print such subsets in the following format:\n\nk\n|S_1| S_{1,1} S_{1,2} ... S_{1,|S_1|}\n:\n|S_k| S_{k,1} S_{k,2} ... S_{k,|S_k|}\n\nwhere S_i={S_{i,1},S_{i,2},...,S_{i,|S_i|}}.\n\nIf there are multiple such tuples, any of them will be accepted.\n\nSample Input 1\n\n3\n\nSample Output 1\n\nYes\n3\n2 1 2\n2 3 1\n2 2 3\n\nIt can be seen that (S_1,S_2,S_3)=(\\{1,2\\},\\{3,1\\},\\{2,3\\}) satisfies the conditions.\n\nSample Input 2\n\n4\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 338, "cpu_time_ms": 144, "memory_kb": 22024}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s270420585", "group_id": "codeNet:p03238", "input_text": "n = int(input())\n\nif n == 1:\n print(\"Hello Wrold\")\n exit()\nelse:\n a = int(input())\n b = int(input())\n print(a+b)", "language": "Python", "metadata": {"date": 1566408660, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03238.html", "problem_id": "p03238", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03238/input.txt", "sample_output_relpath": "derived/input_output/data/p03238/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03238/Python/s270420585.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s270420585", "user_id": "u353895424"}, "prompt_components": {"gold_output": "Hello World\n", "input_to_evaluate": "n = int(input())\n\nif n == 1:\n print(\"Hello Wrold\")\n exit()\nelse:\n a = int(input())\n b = int(input())\n print(a+b)", "problem_context": "Score: 100 points\n\nProblem Statement\n\nIn 2020, AtCoder Inc. with an annual sales of more than one billion yen (the currency of Japan) has started a business in programming education.\n\nOne day, there was an exam where a one-year-old child must write a program that prints Hello World, and a two-year-old child must write a program that receives integers A, B and prints A+B.\n\nTakahashi, who is taking this exam, suddenly forgets his age.\n\nHe decides to write a program that first receives his age N (1 or 2) as input, then prints Hello World if N=1, and additionally receives integers A, B and prints A+B if N=2.\n\nWrite this program for him.\n\nConstraints\n\nN is 1 or 2.\n\nA is an integer between 1 and 9 (inclusive).\n\nB is an integer between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in one of the following formats:\n\n1\n\n2\nA\nB\n\nOutput\n\nIf N=1, print Hello World; if N=2, print A+B.\n\nSample Input 1\n\n1\n\nSample Output 1\n\nHello World\n\nAs N=1, Takahashi is one year old. Thus, we should print Hello World.\n\nSample Input 2\n\n2\n3\n5\n\nSample Output 2\n\n8\n\nAs N=2, Takahashi is two years old. Thus, we should print A+B, which is 8 since A=3 and B=5.", "sample_input": "1\n"}, "reference_outputs": ["Hello World\n"], "source_document_id": "p03238", "source_text": "Score: 100 points\n\nProblem Statement\n\nIn 2020, AtCoder Inc. with an annual sales of more than one billion yen (the currency of Japan) has started a business in programming education.\n\nOne day, there was an exam where a one-year-old child must write a program that prints Hello World, and a two-year-old child must write a program that receives integers A, B and prints A+B.\n\nTakahashi, who is taking this exam, suddenly forgets his age.\n\nHe decides to write a program that first receives his age N (1 or 2) as input, then prints Hello World if N=1, and additionally receives integers A, B and prints A+B if N=2.\n\nWrite this program for him.\n\nConstraints\n\nN is 1 or 2.\n\nA is an integer between 1 and 9 (inclusive).\n\nB is an integer between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in one of the following formats:\n\n1\n\n2\nA\nB\n\nOutput\n\nIf N=1, print Hello World; if N=2, print A+B.\n\nSample Input 1\n\n1\n\nSample Output 1\n\nHello World\n\nAs N=1, Takahashi is one year old. Thus, we should print Hello World.\n\nSample Input 2\n\n2\n3\n5\n\nSample Output 2\n\n8\n\nAs N=2, Takahashi is two years old. Thus, we should print A+B, which is 8 since A=3 and B=5.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 127, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s459216265", "group_id": "codeNet:p03241", "input_text": "n, m = map(int, input().split())\nvalues = []\n\ndef pfac(n):\n values = [1, n]\n for i in range(2, int(n ** 0.5) + 1):\n if n % i == 0:\n values.append(i)\n values.append(n // i)\n return values\n\n\nfor i in pfac(m):\n if m % i == 0 and m / i >= n:\n values.append(i)\nprint(max(values))\n", "language": "Python", "metadata": {"date": 1538880295, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03241.html", "problem_id": "p03241", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03241/input.txt", "sample_output_relpath": "derived/input_output/data/p03241/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03241/Python/s459216265.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s459216265", "user_id": "u820351940"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n, m = map(int, input().split())\nvalues = []\n\ndef pfac(n):\n values = [1, n]\n for i in range(2, int(n ** 0.5) + 1):\n if n % i == 0:\n values.append(i)\n values.append(n // i)\n return values\n\n\nfor i in pfac(m):\n if m % i == 0 and m / i >= n:\n values.append(i)\nprint(max(values))\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "sample_input": "3 14\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03241", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 323, "cpu_time_ms": 20, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s247332132", "group_id": "codeNet:p03242", "input_text": "input_line = str(input())\ns = []\n\nfor i in range(len(input_line)):\n if input_line[i] == '9':\n s.append('1')\n elif input_line[i] == '1':\n s.append('9')\n else:\n s.append(input_line[i])\n\nprint(s)\n\nmojiretu = ''\n\nfor x in s:\n mojiretu += x\n\nprint(mojiretu)\n", "language": "Python", "metadata": {"date": 1565236348, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03242.html", "problem_id": "p03242", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03242/input.txt", "sample_output_relpath": "derived/input_output/data/p03242/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03242/Python/s247332132.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s247332132", "user_id": "u395761272"}, "prompt_components": {"gold_output": "991\n", "input_to_evaluate": "input_line = str(input())\ns = []\n\nfor i in range(len(input_line)):\n if input_line[i] == '9':\n s.append('1')\n elif input_line[i] == '1':\n s.append('9')\n else:\n s.append(input_line[i])\n\nprint(s)\n\nmojiretu = ''\n\nfor x in s:\n mojiretu += x\n\nprint(mojiretu)\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCat Snuke is learning to write characters.\nToday, he practiced writing digits 1 and 9, but he did it the other way around.\n\nYou are given a three-digit integer n written by Snuke.\nPrint the integer obtained by replacing each digit 1 with 9 and each digit 9 with 1 in n.\n\nConstraints\n\n111 \\leq n \\leq 999\n\nn is an integer consisting of digits 1 and 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\n\nOutput\n\nPrint the integer obtained by replacing each occurrence of 1 with 9 and each occurrence of 9 with 1 in n.\n\nSample Input 1\n\n119\n\nSample Output 1\n\n991\n\nReplace the 9 in the ones place with 1, the 1 in the tens place with 9 and the 1 in the hundreds place with 9. The answer is 991.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n111", "sample_input": "119\n"}, "reference_outputs": ["991\n"], "source_document_id": "p03242", "source_text": "Score : 100 points\n\nProblem Statement\n\nCat Snuke is learning to write characters.\nToday, he practiced writing digits 1 and 9, but he did it the other way around.\n\nYou are given a three-digit integer n written by Snuke.\nPrint the integer obtained by replacing each digit 1 with 9 and each digit 9 with 1 in n.\n\nConstraints\n\n111 \\leq n \\leq 999\n\nn is an integer consisting of digits 1 and 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\n\nOutput\n\nPrint the integer obtained by replacing each occurrence of 1 with 9 and each occurrence of 9 with 1 in n.\n\nSample Input 1\n\n119\n\nSample Output 1\n\n991\n\nReplace the 9 in the ones place with 1, the 1 in the tens place with 9 and the 1 in the hundreds place with 9. The answer is 991.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n111", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 286, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s363421320", "group_id": "codeNet:p03242", "input_text": "for c in list(input()):\n\tif c == \"9\":\n\t\tc = \"1\"\n\telif c == \"1\":\n\t\tc = \"9\"\n\tprint(c, end=\"\")\nprint(\"\")\n", "language": "Python", "metadata": {"date": 1555090202, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03242.html", "problem_id": "p03242", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03242/input.txt", "sample_output_relpath": "derived/input_output/data/p03242/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03242/Python/s363421320.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s363421320", "user_id": "u938812966"}, "prompt_components": {"gold_output": "991\n", "input_to_evaluate": "for c in list(input()):\n\tif c == \"9\":\n\t\tc = \"1\"\n\telif c == \"1\":\n\t\tc = \"9\"\n\tprint(c, end=\"\")\nprint(\"\")\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCat Snuke is learning to write characters.\nToday, he practiced writing digits 1 and 9, but he did it the other way around.\n\nYou are given a three-digit integer n written by Snuke.\nPrint the integer obtained by replacing each digit 1 with 9 and each digit 9 with 1 in n.\n\nConstraints\n\n111 \\leq n \\leq 999\n\nn is an integer consisting of digits 1 and 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\n\nOutput\n\nPrint the integer obtained by replacing each occurrence of 1 with 9 and each occurrence of 9 with 1 in n.\n\nSample Input 1\n\n119\n\nSample Output 1\n\n991\n\nReplace the 9 in the ones place with 1, the 1 in the tens place with 9 and the 1 in the hundreds place with 9. The answer is 991.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n111", "sample_input": "119\n"}, "reference_outputs": ["991\n"], "source_document_id": "p03242", "source_text": "Score : 100 points\n\nProblem Statement\n\nCat Snuke is learning to write characters.\nToday, he practiced writing digits 1 and 9, but he did it the other way around.\n\nYou are given a three-digit integer n written by Snuke.\nPrint the integer obtained by replacing each digit 1 with 9 and each digit 9 with 1 in n.\n\nConstraints\n\n111 \\leq n \\leq 999\n\nn is an integer consisting of digits 1 and 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\n\nOutput\n\nPrint the integer obtained by replacing each occurrence of 1 with 9 and each occurrence of 9 with 1 in n.\n\nSample Input 1\n\n119\n\nSample Output 1\n\n991\n\nReplace the 9 in the ones place with 1, the 1 in the tens place with 9 and the 1 in the hundreds place with 9. The answer is 991.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n111", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 102, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s660926108", "group_id": "codeNet:p03242", "input_text": "n = list(input())\nfor i in range(3):\n if n[i] == '1':\n n[i] = '9'\n else:\n n[i] = '1'\nprint(int(n[0]+n[1]+n[2]))", "language": "Python", "metadata": {"date": 1538837123, "filename_ext": "py", "original_language": "Python (2.7.6)", "problem_description_relpath": "problem_descriptions/p03242.html", "problem_id": "p03242", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03242/input.txt", "sample_output_relpath": "derived/input_output/data/p03242/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03242/Python/s660926108.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s660926108", "user_id": "u986014912"}, "prompt_components": {"gold_output": "991\n", "input_to_evaluate": "n = list(input())\nfor i in range(3):\n if n[i] == '1':\n n[i] = '9'\n else:\n n[i] = '1'\nprint(int(n[0]+n[1]+n[2]))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCat Snuke is learning to write characters.\nToday, he practiced writing digits 1 and 9, but he did it the other way around.\n\nYou are given a three-digit integer n written by Snuke.\nPrint the integer obtained by replacing each digit 1 with 9 and each digit 9 with 1 in n.\n\nConstraints\n\n111 \\leq n \\leq 999\n\nn is an integer consisting of digits 1 and 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\n\nOutput\n\nPrint the integer obtained by replacing each occurrence of 1 with 9 and each occurrence of 9 with 1 in n.\n\nSample Input 1\n\n119\n\nSample Output 1\n\n991\n\nReplace the 9 in the ones place with 1, the 1 in the tens place with 9 and the 1 in the hundreds place with 9. The answer is 991.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n111", "sample_input": "119\n"}, "reference_outputs": ["991\n"], "source_document_id": "p03242", "source_text": "Score : 100 points\n\nProblem Statement\n\nCat Snuke is learning to write characters.\nToday, he practiced writing digits 1 and 9, but he did it the other way around.\n\nYou are given a three-digit integer n written by Snuke.\nPrint the integer obtained by replacing each digit 1 with 9 and each digit 9 with 1 in n.\n\nConstraints\n\n111 \\leq n \\leq 999\n\nn is an integer consisting of digits 1 and 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\n\nOutput\n\nPrint the integer obtained by replacing each occurrence of 1 with 9 and each occurrence of 9 with 1 in n.\n\nSample Input 1\n\n119\n\nSample Output 1\n\n991\n\nReplace the 9 in the ones place with 1, the 1 in the tens place with 9 and the 1 in the hundreds place with 9. The answer is 991.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n111", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 131, "cpu_time_ms": 10, "memory_kb": 2568}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s604497608", "group_id": "codeNet:p03243", "input_text": "a,b,c = list(map(int, list(str(input()))))\nif not (a == b and b == c):\n if (b >= a and c >= a) or (b == a and c >= a):\n a += 1\n b = a; c = a\n\nans = list(map(str, [a,b,c]))\nprint(\"\".join(ans))", "language": "Python", "metadata": {"date": 1569496614, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03243.html", "problem_id": "p03243", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03243/input.txt", "sample_output_relpath": "derived/input_output/data/p03243/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03243/Python/s604497608.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s604497608", "user_id": "u584083761"}, "prompt_components": {"gold_output": "111\n", "input_to_evaluate": "a,b,c = list(map(int, list(str(input()))))\nif not (a == b and b == c):\n if (b >= a and c >= a) or (b == a and c >= a):\n a += 1\n b = a; c = a\n\nans = list(map(str, [a,b,c]))\nprint(\"\".join(ans))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nKurohashi has never participated in AtCoder Beginner Contest (ABC).\n\nThe next ABC to be held is ABC N (the N-th ABC ever held).\nKurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same.\n\nWhat is the earliest ABC where Kurohashi can make his debut?\n\nConstraints\n\n100 \\leq N \\leq 999\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf the earliest ABC where Kurohashi can make his debut is ABC n, print n.\n\nSample Input 1\n\n111\n\nSample Output 1\n\n111\n\nThe next ABC to be held is ABC 111, where Kurohashi can make his debut.\n\nSample Input 2\n\n112\n\nSample Output 2\n\n222\n\nThe next ABC to be held is ABC 112, which means Kurohashi can no longer participate in ABC 111.\nAmong the ABCs where Kurohashi can make his debut, the earliest one is ABC 222.\n\nSample Input 3\n\n750\n\nSample Output 3\n\n777", "sample_input": "111\n"}, "reference_outputs": ["111\n"], "source_document_id": "p03243", "source_text": "Score : 200 points\n\nProblem Statement\n\nKurohashi has never participated in AtCoder Beginner Contest (ABC).\n\nThe next ABC to be held is ABC N (the N-th ABC ever held).\nKurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same.\n\nWhat is the earliest ABC where Kurohashi can make his debut?\n\nConstraints\n\n100 \\leq N \\leq 999\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf the earliest ABC where Kurohashi can make his debut is ABC n, print n.\n\nSample Input 1\n\n111\n\nSample Output 1\n\n111\n\nThe next ABC to be held is ABC 111, where Kurohashi can make his debut.\n\nSample Input 2\n\n112\n\nSample Output 2\n\n222\n\nThe next ABC to be held is ABC 112, which means Kurohashi can no longer participate in ABC 111.\nAmong the ABCs where Kurohashi can make his debut, the earliest one is ABC 222.\n\nSample Input 3\n\n750\n\nSample Output 3\n\n777", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 204, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s658430783", "group_id": "codeNet:p03244", "input_text": "N = int(input())\nl = list(map(int, input().split()))\n\nodd = {}\neven = {}\nfor i in range(N):\n tmp = l[i]\n if i % 2:\n if not odd.get(tmp):\n odd[tmp] = 0\n odd[tmp] += 1\n else:\n if not even.get(tmp):\n even[tmp] = 0\n even[tmp] += 1\n\nodd_max = sorted(odd.items(), key=lambda x: -x[1])[0][0]\neven_max = sorted(even.items(), key=lambda x: -x[1])[0][0]\n\nodd_switch = sum([v for k, v in odd.items() if k != odd_max])\neven_switch = sum([v for k, v in even.items() if k != even_max])\n\nif odd_switch + even_switch == 0:\n print(N // 2)\nelse:\n print(odd_switch + even_switch)\n", "language": "Python", "metadata": {"date": 1565468152, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03244.html", "problem_id": "p03244", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03244/input.txt", "sample_output_relpath": "derived/input_output/data/p03244/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03244/Python/s658430783.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s658430783", "user_id": "u970308980"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "N = int(input())\nl = list(map(int, input().split()))\n\nodd = {}\neven = {}\nfor i in range(N):\n tmp = l[i]\n if i % 2:\n if not odd.get(tmp):\n odd[tmp] = 0\n odd[tmp] += 1\n else:\n if not even.get(tmp):\n even[tmp] = 0\n even[tmp] += 1\n\nodd_max = sorted(odd.items(), key=lambda x: -x[1])[0][0]\neven_max = sorted(even.items(), key=lambda x: -x[1])[0][0]\n\nodd_switch = sum([v for k, v in odd.items() if k != odd_max])\neven_switch = sum([v for k, v in even.items() if k != even_max])\n\nif odd_switch + even_switch == 0:\n print(N // 2)\nelse:\n print(odd_switch + even_switch)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "sample_input": "4\n3 1 3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03244", "source_text": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 136, "memory_kb": 17656}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s615619513", "group_id": "codeNet:p03244", "input_text": "def GetMaxes(d):\n m = []\n for k, v in d.items():\n m.append([k,v])\n m.sort(key=lambda x:-x[1])\n\n if len(m) == 1:\n m.append([0, 0])\n return m[:2]\n\ndef main():\n n = int(input())\n v = list(map(int, input().split()))\n\n dic0 = dict()\n dic1 = dict()\n d = [dic0, dic1]\n for i in range(n):\n dic = d[i%2]\n if v[i] not in dic:\n dic[v[i]] = 1\n else:\n dic[v[i]] += 1\n\n m0 = GetMaxes(d[0])\n m1 = GetMaxes(d[1])\n\n if m0[0][0] == m1[0][0]:\n take0 = m0[0][1] + m1[1][1]\n take1 = m1[0][1] + m0[1][1]\n if take0 > take1:\n print(n-take0)\n else:\n print(n-take1)\n else:\n print(n - m0[0][1] - m1[0][1])\n\nif __name__ == \"__main__\":\n main()", "language": "Python", "metadata": {"date": 1542820336, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03244.html", "problem_id": "p03244", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03244/input.txt", "sample_output_relpath": "derived/input_output/data/p03244/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03244/Python/s615619513.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s615619513", "user_id": "u996749146"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "def GetMaxes(d):\n m = []\n for k, v in d.items():\n m.append([k,v])\n m.sort(key=lambda x:-x[1])\n\n if len(m) == 1:\n m.append([0, 0])\n return m[:2]\n\ndef main():\n n = int(input())\n v = list(map(int, input().split()))\n\n dic0 = dict()\n dic1 = dict()\n d = [dic0, dic1]\n for i in range(n):\n dic = d[i%2]\n if v[i] not in dic:\n dic[v[i]] = 1\n else:\n dic[v[i]] += 1\n\n m0 = GetMaxes(d[0])\n m1 = GetMaxes(d[1])\n\n if m0[0][0] == m1[0][0]:\n take0 = m0[0][1] + m1[1][1]\n take1 = m1[0][1] + m0[1][1]\n if take0 > take1:\n print(n-take0)\n else:\n print(n-take1)\n else:\n print(n - m0[0][1] - m1[0][1])\n\nif __name__ == \"__main__\":\n main()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "sample_input": "4\n3 1 3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03244", "source_text": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 776, "cpu_time_ms": 114, "memory_kb": 18684}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s858573311", "group_id": "codeNet:p03246", "input_text": "N = int(input())\nV = [int(i) for i in input().split()]\nV1 = [V[2*j-2] for j in range(1, N//2+1)]\nV2 = [V[2*j-1] for j in range(1, N//2+1)]\n#print(V1, V2)\n\ndef dict(x):\n D = {}\n for i in x:\n if i in D:\n D[i] += 1\n else:\n D.setdefault(i, 1)\n return D\n\ndictV1 = dict(V1)\ndictV2 = dict(V2)\n#print(dictV1, dictV2)\n\nsortdictV1 = sorted(dictV1.items(), key=lambda x:x[1], reverse=True)\nsortdictV2 = sorted(dictV2.items(), key=lambda x:x[1], reverse=True)\na = 0\nif sortdictV1[0][0] != sortdictV2[0][0]:\n a = N - sortdictV1[0][1] - sortdictV2[0][1]\nelse:\n if len(dictV1) == len(dictV2) == 1:\n a = N // 2\n else:\n if len(dictV1) == 1:\n a = N - sortdictV1[0][1] - sortdictV2[1][1]\n elif len(dictV2) == 1:\n a = N - sortdictV1[1][1] - sortdictV2[0][1]\n else:\n a = min(N - sortdictV1[0][1] - sortdictV2[1][1], N - sortdictV1[1][1] - sortdictV2[0][1])\nprint(a)\n", "language": "Python", "metadata": {"date": 1591332360, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03246.html", "problem_id": "p03246", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03246/input.txt", "sample_output_relpath": "derived/input_output/data/p03246/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03246/Python/s858573311.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s858573311", "user_id": "u476038506"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "N = int(input())\nV = [int(i) for i in input().split()]\nV1 = [V[2*j-2] for j in range(1, N//2+1)]\nV2 = [V[2*j-1] for j in range(1, N//2+1)]\n#print(V1, V2)\n\ndef dict(x):\n D = {}\n for i in x:\n if i in D:\n D[i] += 1\n else:\n D.setdefault(i, 1)\n return D\n\ndictV1 = dict(V1)\ndictV2 = dict(V2)\n#print(dictV1, dictV2)\n\nsortdictV1 = sorted(dictV1.items(), key=lambda x:x[1], reverse=True)\nsortdictV2 = sorted(dictV2.items(), key=lambda x:x[1], reverse=True)\na = 0\nif sortdictV1[0][0] != sortdictV2[0][0]:\n a = N - sortdictV1[0][1] - sortdictV2[0][1]\nelse:\n if len(dictV1) == len(dictV2) == 1:\n a = N // 2\n else:\n if len(dictV1) == 1:\n a = N - sortdictV1[0][1] - sortdictV2[1][1]\n elif len(dictV2) == 1:\n a = N - sortdictV1[1][1] - sortdictV2[0][1]\n else:\n a = min(N - sortdictV1[0][1] - sortdictV2[1][1], N - sortdictV1[1][1] - sortdictV2[0][1])\nprint(a)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "sample_input": "4\n3 1 3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03246", "source_text": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 897, "cpu_time_ms": 105, "memory_kb": 23332}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s916833342", "group_id": "codeNet:p03248", "input_text": "import sys\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\n\nS = '-' + sr()\nN = len(S) - 1\ndef solve(S):\n if S[1] == '0':\n print(-1)\n exit()\n if S[N] == '1':\n print(-1)\n exit()\n prev = 1\n for n in range(1,N//2 + 1):\n if S[n] != S[N-n]:\n print(-1)\n exit()\n if S[n] == '0':\n continue\n for i in range(prev,n):\n print(i, n)\n prev = n\n for x in range(prev, N):\n print(x, N)\n\nsolve(S)\n", "language": "Python", "metadata": {"date": 1582711265, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03248.html", "problem_id": "p03248", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03248/input.txt", "sample_output_relpath": "derived/input_output/data/p03248/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03248/Python/s916833342.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s916833342", "user_id": "u600402037"}, "prompt_components": {"gold_output": "-1\n", "input_to_evaluate": "import sys\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\n\nS = '-' + sr()\nN = len(S) - 1\ndef solve(S):\n if S[1] == '0':\n print(-1)\n exit()\n if S[N] == '1':\n print(-1)\n exit()\n prev = 1\n for n in range(1,N//2 + 1):\n if S[n] != S[N-n]:\n print(-1)\n exit()\n if S[n] == '0':\n continue\n for i in range(prev,n):\n print(i, n)\n prev = n\n for x in range(prev, N):\n print(x, N)\n\nsolve(S)\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nYou are given a string s of length n.\nDoes a tree with n vertices that satisfies the following conditions exist?\n\nThe vertices are numbered 1,2,..., n.\n\nThe edges are numbered 1,2,..., n-1, and Edge i connects Vertex u_i and v_i.\n\nIf the i-th character in s is 1, we can have a connected component of size i by removing one edge from the tree.\n\nIf the i-th character in s is 0, we cannot have a connected component of size i by removing any one edge from the tree.\n\nIf such a tree exists, construct one such tree.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\ns is a string of length n consisting of 0 and 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf a tree with n vertices that satisfies the conditions does not exist, print -1.\n\nIf a tree with n vertices that satisfies the conditions exist, print n-1 lines.\nThe i-th line should contain u_i and v_i with a space in between.\nIf there are multiple trees that satisfy the conditions, any such tree will be accepted.\n\nSample Input 1\n\n1111\n\nSample Output 1\n\n-1\n\nIt is impossible to have a connected component of size n after removing one edge from a tree with n vertices.\n\nSample Input 2\n\n1110\n\nSample Output 2\n\n1 2\n2 3\n3 4\n\nIf Edge 1 or Edge 3 is removed, we will have a connected component of size 1 and another of size 3. If Edge 2 is removed, we will have two connected components, each of size 2.\n\nSample Input 3\n\n1010\n\nSample Output 3\n\n1 2\n1 3\n1 4\n\nRemoving any edge will result in a connected component of size 1 and another of size 3.", "sample_input": "1111\n"}, "reference_outputs": ["-1\n"], "source_document_id": "p03248", "source_text": "Score : 700 points\n\nProblem Statement\n\nYou are given a string s of length n.\nDoes a tree with n vertices that satisfies the following conditions exist?\n\nThe vertices are numbered 1,2,..., n.\n\nThe edges are numbered 1,2,..., n-1, and Edge i connects Vertex u_i and v_i.\n\nIf the i-th character in s is 1, we can have a connected component of size i by removing one edge from the tree.\n\nIf the i-th character in s is 0, we cannot have a connected component of size i by removing any one edge from the tree.\n\nIf such a tree exists, construct one such tree.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\ns is a string of length n consisting of 0 and 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf a tree with n vertices that satisfies the conditions does not exist, print -1.\n\nIf a tree with n vertices that satisfies the conditions exist, print n-1 lines.\nThe i-th line should contain u_i and v_i with a space in between.\nIf there are multiple trees that satisfy the conditions, any such tree will be accepted.\n\nSample Input 1\n\n1111\n\nSample Output 1\n\n-1\n\nIt is impossible to have a connected component of size n after removing one edge from a tree with n vertices.\n\nSample Input 2\n\n1110\n\nSample Output 2\n\n1 2\n2 3\n3 4\n\nIf Edge 1 or Edge 3 is removed, we will have a connected component of size 1 and another of size 3. If Edge 2 is removed, we will have two connected components, each of size 2.\n\nSample Input 3\n\n1010\n\nSample Output 3\n\n1 2\n1 3\n1 4\n\nRemoving any edge will result in a connected component of size 1 and another of size 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 561, "cpu_time_ms": 168, "memory_kb": 4744}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s875752101", "group_id": "codeNet:p03252", "input_text": "from collections import Counter\n\nS=input()\nT=input()\nN=len(S)\nd=dict()\n\nfor i in range(N):\n if S[i]!=T[i]:\n if T[i] not in d:\n d[T[i]] = set(S[i])\n else:\n d[T[i]].add(S[i])\n \nans=\"Yes\"\nfor pair in d:\n if len(d[pair])>1:\n ans=\"No\"\nprint(ans)", "language": "Python", "metadata": {"date": 1589155294, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03252.html", "problem_id": "p03252", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03252/input.txt", "sample_output_relpath": "derived/input_output/data/p03252/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03252/Python/s875752101.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s875752101", "user_id": "u089142196"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "from collections import Counter\n\nS=input()\nT=input()\nN=len(S)\nd=dict()\n\nfor i in range(N):\n if S[i]!=T[i]:\n if T[i] not in d:\n d[T[i]] = set(S[i])\n else:\n d[T[i]].add(S[i])\n \nans=\"Yes\"\nfor pair in d:\n if len(d[pair])>1:\n ans=\"No\"\nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given strings S and T consisting of lowercase English letters.\n\nYou can perform the following operation on S any number of times:\n\nOperation: Choose two distinct lowercase English letters c_1 and c_2, then replace every occurrence of c_1 with c_2, and every occurrence of c_2 with c_1.\n\nDetermine if S and T can be made equal by performing the operation zero or more times.\n\nConstraints\n\n1 \\leq |S| \\leq 2 \\times 10^5\n\n|S| = |T|\n\nS and T consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf S and T can be made equal, print Yes; otherwise, print No.\n\nSample Input 1\n\nazzel\napple\n\nSample Output 1\n\nYes\n\nazzel can be changed to apple, as follows:\n\nChoose e as c_1 and l as c_2. azzel becomes azzle.\n\nChoose z as c_1 and p as c_2. azzle becomes apple.\n\nSample Input 2\n\nchokudai\nredcoder\n\nSample Output 2\n\nNo\n\nNo sequences of operation can change chokudai to redcoder.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\nibyhqfrekavclxjstdwgpzmonu\n\nSample Output 3\n\nYes", "sample_input": "azzel\napple\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03252", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given strings S and T consisting of lowercase English letters.\n\nYou can perform the following operation on S any number of times:\n\nOperation: Choose two distinct lowercase English letters c_1 and c_2, then replace every occurrence of c_1 with c_2, and every occurrence of c_2 with c_1.\n\nDetermine if S and T can be made equal by performing the operation zero or more times.\n\nConstraints\n\n1 \\leq |S| \\leq 2 \\times 10^5\n\n|S| = |T|\n\nS and T consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf S and T can be made equal, print Yes; otherwise, print No.\n\nSample Input 1\n\nazzel\napple\n\nSample Output 1\n\nYes\n\nazzel can be changed to apple, as follows:\n\nChoose e as c_1 and l as c_2. azzel becomes azzle.\n\nChoose z as c_1 and p as c_2. azzle becomes apple.\n\nSample Input 2\n\nchokudai\nredcoder\n\nSample Output 2\n\nNo\n\nNo sequences of operation can change chokudai to redcoder.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\nibyhqfrekavclxjstdwgpzmonu\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 266, "cpu_time_ms": 111, "memory_kb": 4136}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s582810754", "group_id": "codeNet:p03253", "input_text": "from math import factorial\n\nnm = input().split()\nn = int(nm[0])\nm = int(nm[1])\n\nf = []\n\ni = 2\nj = 0\nwhile (m > 1) and i<=m:\n while m%i == 0:\n m /= i\n j += 1\n if j >= 1:\n f.append(j)\n i += 1\n j = 0\n\n \nans = 1\n\nfor k in f:\n if k > 0:\n ans *= factorial(n+k-1) // (factorial(k) * factorial(n-1))\n \nprint(int(ans) % (10**9+7))\n", "language": "Python", "metadata": {"date": 1537755053, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03253.html", "problem_id": "p03253", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03253/input.txt", "sample_output_relpath": "derived/input_output/data/p03253/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03253/Python/s582810754.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s582810754", "user_id": "u023540496"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "from math import factorial\n\nnm = input().split()\nn = int(nm[0])\nm = int(nm[1])\n\nf = []\n\ni = 2\nj = 0\nwhile (m > 1) and i<=m:\n while m%i == 0:\n m /= i\n j += 1\n if j >= 1:\n f.append(j)\n i += 1\n j = 0\n\n \nans = 1\n\nfor k in f:\n if k > 0:\n ans *= factorial(n+k-1) // (factorial(k) * factorial(n-1))\n \nprint(int(ans) % (10**9+7))\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given positive integers N and M.\n\nHow many sequences a of length N consisting of positive integers satisfy a_1 \\times a_2 \\times ... \\times a_N = M? Find the count modulo 10^9+7.\n\nHere, two sequences a' and a'' are considered different when there exists some i such that a_i' \\neq a_i''.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n2 6\n\nSample Output 1\n\n4\n\nFour sequences satisfy the condition: \\{a_1, a_2\\} = \\{1, 6\\}, \\{2, 3\\}, \\{3, 2\\} and \\{6, 1\\}.\n\nSample Input 2\n\n3 12\n\nSample Output 2\n\n18\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n957870001", "sample_input": "2 6\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03253", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given positive integers N and M.\n\nHow many sequences a of length N consisting of positive integers satisfy a_1 \\times a_2 \\times ... \\times a_N = M? Find the count modulo 10^9+7.\n\nHere, two sequences a' and a'' are considered different when there exists some i such that a_i' \\neq a_i''.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n2 6\n\nSample Output 1\n\n4\n\nFour sequences satisfy the condition: \\{a_1, a_2\\} = \\{1, 6\\}, \\{2, 3\\}, \\{3, 2\\} and \\{6, 1\\}.\n\nSample Input 2\n\n3 12\n\nSample Output 2\n\n18\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n957870001", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 375, "cpu_time_ms": 2104, "memory_kb": 4504}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s209573534", "group_id": "codeNet:p03254", "input_text": "import sys\ninput = sys.stdin.readline\n\nN, X = map(int, input().split())\nL = [int(v) for v in input().split()]\nL.sort()\n\nans = 0\nfor i in range(N):\n a = L[i]\n \n if X >= a:\n X -= a\n ans += 1\n\nif ans == N and X > 0:\n ans -= 1\n \nprint(ans)", "language": "Python", "metadata": {"date": 1559707381, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03254.html", "problem_id": "p03254", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03254/input.txt", "sample_output_relpath": "derived/input_output/data/p03254/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03254/Python/s209573534.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s209573534", "user_id": "u133886644"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import sys\ninput = sys.stdin.readline\n\nN, X = map(int, input().split())\nL = [int(v) for v in input().split()]\nL.sort()\n\nans = 0\nfor i in range(N):\n a = L[i]\n \n if X >= a:\n X -= a\n ans += 1\n\nif ans == N and X > 0:\n ans -= 1\n \nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N children, numbered 1, 2, ..., N.\n\nSnuke has decided to distribute x sweets among them.\nHe needs to give out all the x sweets, but some of the children may get zero sweets.\n\nFor each i (1 \\leq i \\leq N), Child i will be happy if he/she gets exactly a_i sweets.\nSnuke is trying to maximize the number of happy children by optimally distributing the sweets.\nFind the maximum possible number of happy children.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 100\n\n1 \\leq x \\leq 10^9\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum possible number of happy children.\n\nSample Input 1\n\n3 70\n20 30 10\n\nSample Output 1\n\n2\n\nOne optimal way to distribute sweets is (20, 30, 20).\n\nSample Input 2\n\n3 10\n20 30 10\n\nSample Output 2\n\n1\n\nThe optimal way to distribute sweets is (0, 0, 10).\n\nSample Input 3\n\n4 1111\n1 10 100 1000\n\nSample Output 3\n\n4\n\nThe optimal way to distribute sweets is (1, 10, 100, 1000).\n\nSample Input 4\n\n2 10\n20 20\n\nSample Output 4\n\n0\n\nNo children will be happy, no matter how the sweets are distributed.", "sample_input": "3 70\n20 30 10\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03254", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N children, numbered 1, 2, ..., N.\n\nSnuke has decided to distribute x sweets among them.\nHe needs to give out all the x sweets, but some of the children may get zero sweets.\n\nFor each i (1 \\leq i \\leq N), Child i will be happy if he/she gets exactly a_i sweets.\nSnuke is trying to maximize the number of happy children by optimally distributing the sweets.\nFind the maximum possible number of happy children.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 100\n\n1 \\leq x \\leq 10^9\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum possible number of happy children.\n\nSample Input 1\n\n3 70\n20 30 10\n\nSample Output 1\n\n2\n\nOne optimal way to distribute sweets is (20, 30, 20).\n\nSample Input 2\n\n3 10\n20 30 10\n\nSample Output 2\n\n1\n\nThe optimal way to distribute sweets is (0, 0, 10).\n\nSample Input 3\n\n4 1111\n1 10 100 1000\n\nSample Output 3\n\n4\n\nThe optimal way to distribute sweets is (1, 10, 100, 1000).\n\nSample Input 4\n\n2 10\n20 20\n\nSample Output 4\n\n0\n\nNo children will be happy, no matter how the sweets are distributed.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s820347666", "group_id": "codeNet:p03254", "input_text": "n, x = map(int, input( ).split())\na = list(map(int, input().split()))\ncounter = 0\nfor i in sorted(a):\n x -= i\n counter += 1\n if x<0:\n print(counter-1)\n elif x==0:\n print(counter)\n else:\n if counter==n:\n print(counter-1)", "language": "Python", "metadata": {"date": 1537064173, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03254.html", "problem_id": "p03254", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03254/input.txt", "sample_output_relpath": "derived/input_output/data/p03254/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03254/Python/s820347666.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s820347666", "user_id": "u735211927"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n, x = map(int, input( ).split())\na = list(map(int, input().split()))\ncounter = 0\nfor i in sorted(a):\n x -= i\n counter += 1\n if x<0:\n print(counter-1)\n elif x==0:\n print(counter)\n else:\n if counter==n:\n print(counter-1)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N children, numbered 1, 2, ..., N.\n\nSnuke has decided to distribute x sweets among them.\nHe needs to give out all the x sweets, but some of the children may get zero sweets.\n\nFor each i (1 \\leq i \\leq N), Child i will be happy if he/she gets exactly a_i sweets.\nSnuke is trying to maximize the number of happy children by optimally distributing the sweets.\nFind the maximum possible number of happy children.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 100\n\n1 \\leq x \\leq 10^9\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum possible number of happy children.\n\nSample Input 1\n\n3 70\n20 30 10\n\nSample Output 1\n\n2\n\nOne optimal way to distribute sweets is (20, 30, 20).\n\nSample Input 2\n\n3 10\n20 30 10\n\nSample Output 2\n\n1\n\nThe optimal way to distribute sweets is (0, 0, 10).\n\nSample Input 3\n\n4 1111\n1 10 100 1000\n\nSample Output 3\n\n4\n\nThe optimal way to distribute sweets is (1, 10, 100, 1000).\n\nSample Input 4\n\n2 10\n20 20\n\nSample Output 4\n\n0\n\nNo children will be happy, no matter how the sweets are distributed.", "sample_input": "3 70\n20 30 10\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03254", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N children, numbered 1, 2, ..., N.\n\nSnuke has decided to distribute x sweets among them.\nHe needs to give out all the x sweets, but some of the children may get zero sweets.\n\nFor each i (1 \\leq i \\leq N), Child i will be happy if he/she gets exactly a_i sweets.\nSnuke is trying to maximize the number of happy children by optimally distributing the sweets.\nFind the maximum possible number of happy children.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 100\n\n1 \\leq x \\leq 10^9\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum possible number of happy children.\n\nSample Input 1\n\n3 70\n20 30 10\n\nSample Output 1\n\n2\n\nOne optimal way to distribute sweets is (20, 30, 20).\n\nSample Input 2\n\n3 10\n20 30 10\n\nSample Output 2\n\n1\n\nThe optimal way to distribute sweets is (0, 0, 10).\n\nSample Input 3\n\n4 1111\n1 10 100 1000\n\nSample Output 3\n\n4\n\nThe optimal way to distribute sweets is (1, 10, 100, 1000).\n\nSample Input 4\n\n2 10\n20 20\n\nSample Output 4\n\n0\n\nNo children will be happy, no matter how the sweets are distributed.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 238, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s532479004", "group_id": "codeNet:p03255", "input_text": "import math\nN, X=map(int, input().split())\nx=[]\nx=list(map(int, input().split()))\nA=0\nB=0\nC=(N+1)*X\nd=math.ceil(N/2)\nfor i in range(N-2):\n A+=(N-2-i)*2*x[i]\nfor j in range(N):\n C+=x[j]*5\nif X*(d-1)<=A:\n B=C+X*(d-1)\nelse:\n B=C+A\nprint(B)\n", "language": "Python", "metadata": {"date": 1537237187, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03255.html", "problem_id": "p03255", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03255/input.txt", "sample_output_relpath": "derived/input_output/data/p03255/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03255/Python/s532479004.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s532479004", "user_id": "u519604525"}, "prompt_components": {"gold_output": "355\n", "input_to_evaluate": "import math\nN, X=map(int, input().split())\nx=[]\nx=list(map(int, input().split()))\nA=0\nB=0\nC=(N+1)*X\nd=math.ceil(N/2)\nfor i in range(N-2):\n A+=(N-2-i)*2*x[i]\nfor j in range(N):\n C+=x[j]*5\nif X*(d-1)<=A:\n B=C+X*(d-1)\nelse:\n B=C+A\nprint(B)\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSnuke has decided to use a robot to clean his room.\n\nThere are N pieces of trash on a number line.\nThe i-th piece from the left is at position x_i.\nWe would like to put all of them in a trash bin at position 0.\n\nFor the positions of the pieces of trash, 0 < x_1 < x_2 < ... < x_{N} \\leq 10^{9} holds.\n\nThe robot is initially at position 0.\nIt can freely move left and right along the number line, pick up a piece of trash when it comes to the position of that piece, carry any number of pieces of trash and put them in the trash bin when it comes to position 0. It is not allowed to put pieces of trash anywhere except in the trash bin.\n\nThe robot consumes X points of energy when the robot picks up a piece of trash, or put pieces of trash in the trash bin. (Putting any number of pieces of trash in the trash bin consumes X points of energy.)\nAlso, the robot consumes (k+1)^{2} points of energy to travel by a distance of 1 when the robot is carrying k pieces of trash.\n\nFind the minimum amount of energy required to put all the N pieces of trash in the trash bin.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^{5}\n\n0 < x_1 < ... < x_N \\leq 10^9\n\n1 \\leq X \\leq 10^9\n\nAll values in input are integers.\n\nPartial Scores\n\n400 points will be awarded for passing the test set satisfying N \\leq 2000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nx_1 x_2 ... x_{N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 100\n1 10\n\nSample Output 1\n\n355\n\nTravel to position 10 by consuming 10 points of energy.\n\nPick up the piece of trash by consuming 100 points of energy.\n\nTravel to position 1 by consuming 36 points of energy.\n\nPick up the piece of trash by consuming 100 points of energy.\n\nTravel to position 0 by consuming 9 points of energy.\n\nPut the two pieces of trash in the trash bin by consuming 100 points of energy.\n\nThis strategy consumes a total of 10+100+36+100+9+100=355 points of energy.\n\nSample Input 2\n\n5 1\n1 999999997 999999998 999999999 1000000000\n\nSample Output 2\n\n19999999983\n\nSample Input 3\n\n10 8851025\n38 87 668 3175 22601 65499 90236 790604 4290609 4894746\n\nSample Output 3\n\n150710136\n\nSample Input 4\n\n16 10\n1 7 12 27 52 75 731 13856 395504 534840 1276551 2356789 9384806 19108104 82684732 535447408\n\nSample Output 4\n\n3256017715", "sample_input": "2 100\n1 10\n"}, "reference_outputs": ["355\n"], "source_document_id": "p03255", "source_text": "Score : 700 points\n\nProblem Statement\n\nSnuke has decided to use a robot to clean his room.\n\nThere are N pieces of trash on a number line.\nThe i-th piece from the left is at position x_i.\nWe would like to put all of them in a trash bin at position 0.\n\nFor the positions of the pieces of trash, 0 < x_1 < x_2 < ... < x_{N} \\leq 10^{9} holds.\n\nThe robot is initially at position 0.\nIt can freely move left and right along the number line, pick up a piece of trash when it comes to the position of that piece, carry any number of pieces of trash and put them in the trash bin when it comes to position 0. It is not allowed to put pieces of trash anywhere except in the trash bin.\n\nThe robot consumes X points of energy when the robot picks up a piece of trash, or put pieces of trash in the trash bin. (Putting any number of pieces of trash in the trash bin consumes X points of energy.)\nAlso, the robot consumes (k+1)^{2} points of energy to travel by a distance of 1 when the robot is carrying k pieces of trash.\n\nFind the minimum amount of energy required to put all the N pieces of trash in the trash bin.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^{5}\n\n0 < x_1 < ... < x_N \\leq 10^9\n\n1 \\leq X \\leq 10^9\n\nAll values in input are integers.\n\nPartial Scores\n\n400 points will be awarded for passing the test set satisfying N \\leq 2000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nx_1 x_2 ... x_{N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 100\n1 10\n\nSample Output 1\n\n355\n\nTravel to position 10 by consuming 10 points of energy.\n\nPick up the piece of trash by consuming 100 points of energy.\n\nTravel to position 1 by consuming 36 points of energy.\n\nPick up the piece of trash by consuming 100 points of energy.\n\nTravel to position 0 by consuming 9 points of energy.\n\nPut the two pieces of trash in the trash bin by consuming 100 points of energy.\n\nThis strategy consumes a total of 10+100+36+100+9+100=355 points of energy.\n\nSample Input 2\n\n5 1\n1 999999997 999999998 999999999 1000000000\n\nSample Output 2\n\n19999999983\n\nSample Input 3\n\n10 8851025\n38 87 668 3175 22601 65499 90236 790604 4290609 4894746\n\nSample Output 3\n\n150710136\n\nSample Input 4\n\n16 10\n1 7 12 27 52 75 731 13856 395504 534840 1276551 2356789 9384806 19108104 82684732 535447408\n\nSample Output 4\n\n3256017715", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 249, "cpu_time_ms": 172, "memory_kb": 26612}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s025736590", "group_id": "codeNet:p03263", "input_text": "def is_even(num):\n if num == 0:\n return True\n return num % 2 == 0\n\n\nheight, width = list(map(int, input().split()))\ncoin_table = [list(map(is_even, map(int, input().split()))) for i in range(height)]\n\nmove_list = list()\n\nfor h in range(height):\n for w in range(width):\n if not(coin_table[h][w]):\n coin_table[h][w] = True\n if w == width-1:\n if h == height-1:\n break\n coin_table[h + 1][w] = not coin_table[h + 1][w]\n move_list.append([h + 1, w + 1, h + 2, w + 1])\n else:\n coin_table[h][w+1] = not coin_table[h][w+1]\n move_list.append([h + 1, w + 1, h + 1, w + 2])\n\nprint(len(move_list))\nfor i in range(len(move_list)):\n print(\"{0} {1} {2} {3}\".format(move_list[i][0], move_list[i][1], move_list[i][2], move_list[i][3]))\n", "language": "Python", "metadata": {"date": 1536461253, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03263.html", "problem_id": "p03263", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03263/input.txt", "sample_output_relpath": "derived/input_output/data/p03263/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03263/Python/s025736590.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s025736590", "user_id": "u871374729"}, "prompt_components": {"gold_output": "3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n", "input_to_evaluate": "def is_even(num):\n if num == 0:\n return True\n return num % 2 == 0\n\n\nheight, width = list(map(int, input().split()))\ncoin_table = [list(map(is_even, map(int, input().split()))) for i in range(height)]\n\nmove_list = list()\n\nfor h in range(height):\n for w in range(width):\n if not(coin_table[h][w]):\n coin_table[h][w] = True\n if w == width-1:\n if h == height-1:\n break\n coin_table[h + 1][w] = not coin_table[h + 1][w]\n move_list.append([h + 1, w + 1, h + 2, w + 1])\n else:\n coin_table[h][w+1] = not coin_table[h][w+1]\n move_list.append([h + 1, w + 1, h + 1, w + 2])\n\nprint(len(move_list))\nfor i in range(len(move_list)):\n print(\"{0} {1} {2} {3}\".format(move_list[i][0], move_list[i][1], move_list[i][2], move_list[i][3]))\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "sample_input": "2 3\n1 2 3\n0 1 1\n"}, "reference_outputs": ["3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n"], "source_document_id": "p03263", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 871, "cpu_time_ms": 463, "memory_kb": 29880}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s766863484", "group_id": "codeNet:p03264", "input_text": "k=int(input())\nif k%2==0:\n print((k//2)**2)\nelse:\n a=k//2\n print(a*(k-a))", "language": "Python", "metadata": {"date": 1552962870, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03264.html", "problem_id": "p03264", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03264/input.txt", "sample_output_relpath": "derived/input_output/data/p03264/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03264/Python/s766863484.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s766863484", "user_id": "u636162168"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "k=int(input())\nif k%2==0:\n print((k//2)**2)\nelse:\n a=k//2\n print(a*(k-a))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nFind the number of ways to choose a pair of an even number and an odd number from the positive integers between 1 and K (inclusive). The order does not matter.\n\nConstraints\n\n2\\leq K\\leq 100\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the number of ways to choose a pair of an even number and an odd number from the positive integers between 1 and K (inclusive).\n\nSample Input 1\n\n3\n\nSample Output 1\n\n2\n\nTwo pairs can be chosen: (2,1) and (2,3).\n\nSample Input 2\n\n6\n\nSample Output 2\n\n9\n\nSample Input 3\n\n11\n\nSample Output 3\n\n30\n\nSample Input 4\n\n50\n\nSample Output 4\n\n625", "sample_input": "3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03264", "source_text": "Score : 100 points\n\nProblem Statement\n\nFind the number of ways to choose a pair of an even number and an odd number from the positive integers between 1 and K (inclusive). The order does not matter.\n\nConstraints\n\n2\\leq K\\leq 100\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the number of ways to choose a pair of an even number and an odd number from the positive integers between 1 and K (inclusive).\n\nSample Input 1\n\n3\n\nSample Output 1\n\n2\n\nTwo pairs can be chosen: (2,1) and (2,3).\n\nSample Input 2\n\n6\n\nSample Output 2\n\n9\n\nSample Input 3\n\n11\n\nSample Output 3\n\n30\n\nSample Input 4\n\n50\n\nSample Output 4\n\n625", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 82, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s594036259", "group_id": "codeNet:p03266", "input_text": "n,k = map(int,input().split())\nif k%2!=0:\n count = 0\n i = 1\n check = True\n while check:\n if n <= k * i:\n check = False\n else:\n count += 1\n i += 1\n print(count**2*count)\nimport math\nif k%2==0:\n count = 0\n i = 1\n check = True\n while check:\n if n < (k/2) * i:\n check = False\n else:\n count += 1\n i += 1\n ans_1 = math.ceil(count/2)\n ans_2 = math.ceil(count/2)-1\n print(ans_1**2*ans_1+ans_2**2*ans_2)", "language": "Python", "metadata": {"date": 1535855164, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03266.html", "problem_id": "p03266", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03266/input.txt", "sample_output_relpath": "derived/input_output/data/p03266/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03266/Python/s594036259.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s594036259", "user_id": "u677440371"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "n,k = map(int,input().split())\nif k%2!=0:\n count = 0\n i = 1\n check = True\n while check:\n if n <= k * i:\n check = False\n else:\n count += 1\n i += 1\n print(count**2*count)\nimport math\nif k%2==0:\n count = 0\n i = 1\n check = True\n while check:\n if n < (k/2) * i:\n check = False\n else:\n count += 1\n i += 1\n ans_1 = math.ceil(count/2)\n ans_2 = math.ceil(count/2)-1\n print(ans_1**2*ans_1+ans_2**2*ans_2)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the same.\n\nConstraints\n\n1 \\leq N,K \\leq 2\\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.\n\nSample Input 2\n\n5 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n27\n\nSample Input 4\n\n35897 932\n\nSample Output 4\n\n114191", "sample_input": "3 2\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03266", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the same.\n\nConstraints\n\n1 \\leq N,K \\leq 2\\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.\n\nSample Input 2\n\n5 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n27\n\nSample Input 4\n\n35897 932\n\nSample Output 4\n\n114191", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 524, "cpu_time_ms": 89, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s821988815", "group_id": "codeNet:p03272", "input_text": "n,i = list(map(int,(input().split())))\n\nprint(n-(i-1))\n", "language": "Python", "metadata": {"date": 1561933037, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03272.html", "problem_id": "p03272", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03272/input.txt", "sample_output_relpath": "derived/input_output/data/p03272/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03272/Python/s821988815.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s821988815", "user_id": "u619785253"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "n,i = list(map(int,(input().split())))\n\nprint(n-(i-1))\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is an N-car train.\n\nYou are given an integer i. Find the value of j such that the following statement is true: \"the i-th car from the front of the train is the j-th car from the back.\"\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN i\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n4 2\n\nSample Output 1\n\n3\n\nThe second car from the front of a 4-car train is the third car from the back.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n15 11\n\nSample Output 3\n\n5", "sample_input": "4 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03272", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is an N-car train.\n\nYou are given an integer i. Find the value of j such that the following statement is true: \"the i-th car from the front of the train is the j-th car from the back.\"\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN i\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n4 2\n\nSample Output 1\n\n3\n\nThe second car from the front of a 4-car train is the third car from the back.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n15 11\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 56, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s404705588", "group_id": "codeNet:p03272", "input_text": "N,i=map(int,input().split())\nprint(N+1-i)", "language": "Python", "metadata": {"date": 1536175460, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03272.html", "problem_id": "p03272", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03272/input.txt", "sample_output_relpath": "derived/input_output/data/p03272/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03272/Python/s404705588.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s404705588", "user_id": "u834415466"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "N,i=map(int,input().split())\nprint(N+1-i)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is an N-car train.\n\nYou are given an integer i. Find the value of j such that the following statement is true: \"the i-th car from the front of the train is the j-th car from the back.\"\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN i\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n4 2\n\nSample Output 1\n\n3\n\nThe second car from the front of a 4-car train is the third car from the back.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n15 11\n\nSample Output 3\n\n5", "sample_input": "4 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03272", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is an N-car train.\n\nYou are given an integer i. Find the value of j such that the following statement is true: \"the i-th car from the front of the train is the j-th car from the back.\"\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN i\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n4 2\n\nSample Output 1\n\n3\n\nThe second car from the front of a 4-car train is the third car from the back.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n15 11\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 41, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s865475636", "group_id": "codeNet:p03274", "input_text": "# coding: utf-8\n# Your code here!\nimport bisect\n\nN,K=map(int,input().split())\nX=list(map(int,input().split()))\n\nzero=bisect.bisect_left(X,0)\n\nans=10**18\nstart=max(0,zero-K)\nfor i in range(start,start+N-K+1):\n temp=X[i:i+K]\n m=min(0,min(temp))\n M=max(0,max(temp))\n ans=min((abs(m)+abs(M)*2),(abs(m)*2+abs(M)),ans)\n \nprint(ans)\n\n", "language": "Python", "metadata": {"date": 1572043766, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Python/s865475636.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s865475636", "user_id": "u798818115"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "# coding: utf-8\n# Your code here!\nimport bisect\n\nN,K=map(int,input().split())\nX=list(map(int,input().split()))\n\nzero=bisect.bisect_left(X,0)\n\nans=10**18\nstart=max(0,zero-K)\nfor i in range(start,start+N-K+1):\n temp=X[i:i+K]\n m=min(0,min(temp))\n M=max(0,max(temp))\n ans=min((abs(m)+abs(M)*2),(abs(m)*2+abs(M)),ans)\n \nprint(ans)\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 342, "cpu_time_ms": 2104, "memory_kb": 14480}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s445779759", "group_id": "codeNet:p03280", "input_text": "a,b = map(int, input().split())\nprint((a-1)*(b-1))", "language": "Python", "metadata": {"date": 1581478665, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03280.html", "problem_id": "p03280", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03280/input.txt", "sample_output_relpath": "derived/input_output/data/p03280/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03280/Python/s445779759.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s445779759", "user_id": "u625729943"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "a,b = map(int, input().split())\nprint((a-1)*(b-1))", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThere is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a horizontal road inside the farm from one border to another, as shown below: (The gray part represents the roads.)\n\nWhat is the area of this yard excluding the roads? Find it.\n\nNote\n\nIt can be proved that the positions of the roads do not affect the area.\n\nConstraints\n\nA is an integer between 2 and 100 (inclusive).\n\nB is an integer between 2 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the area of this yard excluding the roads (in square yards).\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n1\n\nIn this case, the area is 1 square yard.\n\nSample Input 2\n\n5 7\n\nSample Output 2\n\n24\n\nIn this case, the area is 24 square yards.", "sample_input": "2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03280", "source_text": "Score: 100 points\n\nProblem Statement\n\nThere is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a horizontal road inside the farm from one border to another, as shown below: (The gray part represents the roads.)\n\nWhat is the area of this yard excluding the roads? Find it.\n\nNote\n\nIt can be proved that the positions of the roads do not affect the area.\n\nConstraints\n\nA is an integer between 2 and 100 (inclusive).\n\nB is an integer between 2 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the area of this yard excluding the roads (in square yards).\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n1\n\nIn this case, the area is 1 square yard.\n\nSample Input 2\n\n5 7\n\nSample Output 2\n\n24\n\nIn this case, the area is 24 square yards.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 50, "cpu_time_ms": 167, "memory_kb": 38256}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s995649546", "group_id": "codeNet:p03280", "input_text": "A, B = map(int, input().split())\n\nprint((A - 1) * (B - 1))\n", "language": "Python", "metadata": {"date": 1556232193, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03280.html", "problem_id": "p03280", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03280/input.txt", "sample_output_relpath": "derived/input_output/data/p03280/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03280/Python/s995649546.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s995649546", "user_id": "u995102075"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "A, B = map(int, input().split())\n\nprint((A - 1) * (B - 1))\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThere is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a horizontal road inside the farm from one border to another, as shown below: (The gray part represents the roads.)\n\nWhat is the area of this yard excluding the roads? Find it.\n\nNote\n\nIt can be proved that the positions of the roads do not affect the area.\n\nConstraints\n\nA is an integer between 2 and 100 (inclusive).\n\nB is an integer between 2 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the area of this yard excluding the roads (in square yards).\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n1\n\nIn this case, the area is 1 square yard.\n\nSample Input 2\n\n5 7\n\nSample Output 2\n\n24\n\nIn this case, the area is 24 square yards.", "sample_input": "2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03280", "source_text": "Score: 100 points\n\nProblem Statement\n\nThere is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a horizontal road inside the farm from one border to another, as shown below: (The gray part represents the roads.)\n\nWhat is the area of this yard excluding the roads? Find it.\n\nNote\n\nIt can be proved that the positions of the roads do not affect the area.\n\nConstraints\n\nA is an integer between 2 and 100 (inclusive).\n\nB is an integer between 2 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the area of this yard excluding the roads (in square yards).\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n1\n\nIn this case, the area is 1 square yard.\n\nSample Input 2\n\n5 7\n\nSample Output 2\n\n24\n\nIn this case, the area is 24 square yards.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 59, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s490987146", "group_id": "codeNet:p03280", "input_text": "a,b=map(int,input().split());print((a-1)*(b-1))", "language": "Python", "metadata": {"date": 1553208078, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03280.html", "problem_id": "p03280", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03280/input.txt", "sample_output_relpath": "derived/input_output/data/p03280/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03280/Python/s490987146.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s490987146", "user_id": "u227082700"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "a,b=map(int,input().split());print((a-1)*(b-1))", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThere is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a horizontal road inside the farm from one border to another, as shown below: (The gray part represents the roads.)\n\nWhat is the area of this yard excluding the roads? Find it.\n\nNote\n\nIt can be proved that the positions of the roads do not affect the area.\n\nConstraints\n\nA is an integer between 2 and 100 (inclusive).\n\nB is an integer between 2 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the area of this yard excluding the roads (in square yards).\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n1\n\nIn this case, the area is 1 square yard.\n\nSample Input 2\n\n5 7\n\nSample Output 2\n\n24\n\nIn this case, the area is 24 square yards.", "sample_input": "2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03280", "source_text": "Score: 100 points\n\nProblem Statement\n\nThere is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a horizontal road inside the farm from one border to another, as shown below: (The gray part represents the roads.)\n\nWhat is the area of this yard excluding the roads? Find it.\n\nNote\n\nIt can be proved that the positions of the roads do not affect the area.\n\nConstraints\n\nA is an integer between 2 and 100 (inclusive).\n\nB is an integer between 2 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the area of this yard excluding the roads (in square yards).\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n1\n\nIn this case, the area is 1 square yard.\n\nSample Input 2\n\n5 7\n\nSample Output 2\n\n24\n\nIn this case, the area is 24 square yards.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 47, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s158698151", "group_id": "codeNet:p03281", "input_text": "N = int(input())\n\nif N >= 105:\n print(1)\nelse:\n print(0)", "language": "Python", "metadata": {"date": 1594531444, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03281.html", "problem_id": "p03281", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03281/input.txt", "sample_output_relpath": "derived/input_output/data/p03281/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03281/Python/s158698151.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s158698151", "user_id": "u874333466"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "N = int(input())\n\nif N >= 105:\n print(1)\nelse:\n print(0)", "problem_context": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "sample_input": "105\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03281", "source_text": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 58, "cpu_time_ms": 29, "memory_kb": 9144}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s837055813", "group_id": "codeNet:p03281", "input_text": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Tue Mar 31 02:12:27 2020\n\n@author: liang\n\"\"\"\n\nn = int(input())\nans = 0\nfor num in range(1, n+1,2):\n cnt = 0\n for i in range(1,num+1):\n if num % i == 0:\n cnt += 1\n if cnt == 8:\n ans += 1\nprint(ans)", "language": "Python", "metadata": {"date": 1585636164, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03281.html", "problem_id": "p03281", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03281/input.txt", "sample_output_relpath": "derived/input_output/data/p03281/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03281/Python/s837055813.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s837055813", "user_id": "u628285938"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Tue Mar 31 02:12:27 2020\n\n@author: liang\n\"\"\"\n\nn = int(input())\nans = 0\nfor num in range(1, n+1,2):\n cnt = 0\n for i in range(1,num+1):\n if num % i == 0:\n cnt += 1\n if cnt == 8:\n ans += 1\nprint(ans)", "problem_context": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "sample_input": "105\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03281", "source_text": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 269, "cpu_time_ms": 18, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s978945113", "group_id": "codeNet:p03281", "input_text": "n = int(input())\nans = 0\nfor i in range(1,n+1,2):\n count = 0\n for j in range(1,i+1):\n if i%j==0:\n count += 1\n if count == 8:\n ans += 1\nprint(ans)\n", "language": "Python", "metadata": {"date": 1585503266, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03281.html", "problem_id": "p03281", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03281/input.txt", "sample_output_relpath": "derived/input_output/data/p03281/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03281/Python/s978945113.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s978945113", "user_id": "u368796742"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "n = int(input())\nans = 0\nfor i in range(1,n+1,2):\n count = 0\n for j in range(1,i+1):\n if i%j==0:\n count += 1\n if count == 8:\n ans += 1\nprint(ans)\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "sample_input": "105\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03281", "source_text": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 180, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s139347102", "group_id": "codeNet:p03281", "input_text": "def main():\n n = int(input())\n s = 0\n\n for i in range(1, n + 1, 2):\n if num_factor(i) == 8:\n s += 1\n print(s)\n\n\ndef num_factor(n):\n if n == 1:\n return 1\n\n s = 2\n i = 2\n\n while i * i <= n:\n if n % i == 0:\n if i * i != n:\n s += 2\n else:\n s += 1\n i += 1\n return s\n\nmain()\n", "language": "Python", "metadata": {"date": 1541281839, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03281.html", "problem_id": "p03281", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03281/input.txt", "sample_output_relpath": "derived/input_output/data/p03281/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03281/Python/s139347102.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s139347102", "user_id": "u090225501"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "def main():\n n = int(input())\n s = 0\n\n for i in range(1, n + 1, 2):\n if num_factor(i) == 8:\n s += 1\n print(s)\n\n\ndef num_factor(n):\n if n == 1:\n return 1\n\n s = 2\n i = 2\n\n while i * i <= n:\n if n % i == 0:\n if i * i != n:\n s += 2\n else:\n s += 1\n i += 1\n return s\n\nmain()\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "sample_input": "105\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03281", "source_text": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 387, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s625023801", "group_id": "codeNet:p03282", "input_text": "s = list(map(int,input()))\nj = 1\nfor i in s:\n\tif i != 1:\n\t\tj = i\n\t\tbreak\nprint(j)", "language": "Python", "metadata": {"date": 1560558975, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03282.html", "problem_id": "p03282", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03282/input.txt", "sample_output_relpath": "derived/input_output/data/p03282/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03282/Python/s625023801.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s625023801", "user_id": "u829406396"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "s = list(map(int,input()))\nj = 1\nfor i in s:\n\tif i != 1:\n\t\tj = i\n\t\tbreak\nprint(j)", "problem_context": "Score: 300 points\n\nProblem Statement\n\nMr. Infinity has a string S consisting of digits from 1 to 9. Each time the date changes, this string changes as follows:\n\nEach occurrence of 2 in S is replaced with 22. Similarly, each 3 becomes 333, 4 becomes 4444, 5 becomes 55555, 6 becomes 666666, 7 becomes 7777777, 8 becomes 88888888 and 9 becomes 999999999. 1 remains as 1.\n\nFor example, if S is 1324, it becomes 1333224444 the next day, and it becomes 133333333322224444444444444444 the day after next.\nYou are interested in what the string looks like after 5 \\times 10^{15} days. What is the K-th character from the left in the string after 5 \\times 10^{15} days?\n\nConstraints\n\nS is a string of length between 1 and 100 (inclusive).\n\nK is an integer between 1 and 10^{18} (inclusive).\n\nThe length of the string after 5 \\times 10^{15} days is at least K.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the K-th character from the left in Mr. Infinity's string after 5 \\times 10^{15} days.\n\nSample Input 1\n\n1214\n4\n\nSample Output 1\n\n2\n\nThe string S changes as follows:\n\nNow: 1214\n\nAfter one day: 12214444\n\nAfter two days: 1222214444444444444444\n\nAfter three days: 12222222214444444444444444444444444444444444444444444444444444444444444444\n\nThe first five characters in the string after 5 \\times 10^{15} days is 12222. As K=4, we should print the fourth character, 2.\n\nSample Input 2\n\n3\n157\n\nSample Output 2\n\n3\n\nThe initial string is 3. The string after 5 \\times 10^{15} days consists only of 3.\n\nSample Input 3\n\n299792458\n9460730472580800\n\nSample Output 3\n\n2", "sample_input": "1214\n4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03282", "source_text": "Score: 300 points\n\nProblem Statement\n\nMr. Infinity has a string S consisting of digits from 1 to 9. Each time the date changes, this string changes as follows:\n\nEach occurrence of 2 in S is replaced with 22. Similarly, each 3 becomes 333, 4 becomes 4444, 5 becomes 55555, 6 becomes 666666, 7 becomes 7777777, 8 becomes 88888888 and 9 becomes 999999999. 1 remains as 1.\n\nFor example, if S is 1324, it becomes 1333224444 the next day, and it becomes 133333333322224444444444444444 the day after next.\nYou are interested in what the string looks like after 5 \\times 10^{15} days. What is the K-th character from the left in the string after 5 \\times 10^{15} days?\n\nConstraints\n\nS is a string of length between 1 and 100 (inclusive).\n\nK is an integer between 1 and 10^{18} (inclusive).\n\nThe length of the string after 5 \\times 10^{15} days is at least K.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the K-th character from the left in Mr. Infinity's string after 5 \\times 10^{15} days.\n\nSample Input 1\n\n1214\n4\n\nSample Output 1\n\n2\n\nThe string S changes as follows:\n\nNow: 1214\n\nAfter one day: 12214444\n\nAfter two days: 1222214444444444444444\n\nAfter three days: 12222222214444444444444444444444444444444444444444444444444444444444444444\n\nThe first five characters in the string after 5 \\times 10^{15} days is 12222. As K=4, we should print the fourth character, 2.\n\nSample Input 2\n\n3\n157\n\nSample Output 2\n\n3\n\nThe initial string is 3. The string after 5 \\times 10^{15} days consists only of 3.\n\nSample Input 3\n\n299792458\n9460730472580800\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 81, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s434714130", "group_id": "codeNet:p03282", "input_text": "S = input()\nK = int(input())\n\nk = 1\nwhile k <= K:\n if S[k-1] != \"1\":\n print(S[k-1])\n break\n k += 1\nelse:\n print(1)\n", "language": "Python", "metadata": {"date": 1534646284, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03282.html", "problem_id": "p03282", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03282/input.txt", "sample_output_relpath": "derived/input_output/data/p03282/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03282/Python/s434714130.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s434714130", "user_id": "u860657719"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "S = input()\nK = int(input())\n\nk = 1\nwhile k <= K:\n if S[k-1] != \"1\":\n print(S[k-1])\n break\n k += 1\nelse:\n print(1)\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nMr. Infinity has a string S consisting of digits from 1 to 9. Each time the date changes, this string changes as follows:\n\nEach occurrence of 2 in S is replaced with 22. Similarly, each 3 becomes 333, 4 becomes 4444, 5 becomes 55555, 6 becomes 666666, 7 becomes 7777777, 8 becomes 88888888 and 9 becomes 999999999. 1 remains as 1.\n\nFor example, if S is 1324, it becomes 1333224444 the next day, and it becomes 133333333322224444444444444444 the day after next.\nYou are interested in what the string looks like after 5 \\times 10^{15} days. What is the K-th character from the left in the string after 5 \\times 10^{15} days?\n\nConstraints\n\nS is a string of length between 1 and 100 (inclusive).\n\nK is an integer between 1 and 10^{18} (inclusive).\n\nThe length of the string after 5 \\times 10^{15} days is at least K.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the K-th character from the left in Mr. Infinity's string after 5 \\times 10^{15} days.\n\nSample Input 1\n\n1214\n4\n\nSample Output 1\n\n2\n\nThe string S changes as follows:\n\nNow: 1214\n\nAfter one day: 12214444\n\nAfter two days: 1222214444444444444444\n\nAfter three days: 12222222214444444444444444444444444444444444444444444444444444444444444444\n\nThe first five characters in the string after 5 \\times 10^{15} days is 12222. As K=4, we should print the fourth character, 2.\n\nSample Input 2\n\n3\n157\n\nSample Output 2\n\n3\n\nThe initial string is 3. The string after 5 \\times 10^{15} days consists only of 3.\n\nSample Input 3\n\n299792458\n9460730472580800\n\nSample Output 3\n\n2", "sample_input": "1214\n4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03282", "source_text": "Score: 300 points\n\nProblem Statement\n\nMr. Infinity has a string S consisting of digits from 1 to 9. Each time the date changes, this string changes as follows:\n\nEach occurrence of 2 in S is replaced with 22. Similarly, each 3 becomes 333, 4 becomes 4444, 5 becomes 55555, 6 becomes 666666, 7 becomes 7777777, 8 becomes 88888888 and 9 becomes 999999999. 1 remains as 1.\n\nFor example, if S is 1324, it becomes 1333224444 the next day, and it becomes 133333333322224444444444444444 the day after next.\nYou are interested in what the string looks like after 5 \\times 10^{15} days. What is the K-th character from the left in the string after 5 \\times 10^{15} days?\n\nConstraints\n\nS is a string of length between 1 and 100 (inclusive).\n\nK is an integer between 1 and 10^{18} (inclusive).\n\nThe length of the string after 5 \\times 10^{15} days is at least K.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the K-th character from the left in Mr. Infinity's string after 5 \\times 10^{15} days.\n\nSample Input 1\n\n1214\n4\n\nSample Output 1\n\n2\n\nThe string S changes as follows:\n\nNow: 1214\n\nAfter one day: 12214444\n\nAfter two days: 1222214444444444444444\n\nAfter three days: 12222222214444444444444444444444444444444444444444444444444444444444444444\n\nThe first five characters in the string after 5 \\times 10^{15} days is 12222. As K=4, we should print the fourth character, 2.\n\nSample Input 2\n\n3\n157\n\nSample Output 2\n\n3\n\nThe initial string is 3. The string after 5 \\times 10^{15} days consists only of 3.\n\nSample Input 3\n\n299792458\n9460730472580800\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 138, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s762539951", "group_id": "codeNet:p03283", "input_text": "N,M,Q = map(int,input().split())\ntrains = []\nquestion = []\nfor i in range(M):\n trains.append(list(map(int,input().split())))\nfor j in range(Q):\n question.append(list(map(int,input().split())))\nfor que in question:\n ans = 0\n for train in trains:\n if train[0]>=que[0] and train[1]<=que[1]:\n ans+=1\n print(ans)", "language": "Python", "metadata": {"date": 1550465903, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03283.html", "problem_id": "p03283", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03283/input.txt", "sample_output_relpath": "derived/input_output/data/p03283/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03283/Python/s762539951.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s762539951", "user_id": "u077019541"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "N,M,Q = map(int,input().split())\ntrains = []\nquestion = []\nfor i in range(M):\n trains.append(list(map(int,input().split())))\nfor j in range(Q):\n question.append(list(map(int,input().split())))\nfor que in question:\n ans = 0\n for train in trains:\n if train[0]>=que[0] and train[1]<=que[1]:\n ans+=1\n print(ans)", "problem_context": "Score: 400 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east.\nA company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i).\nTakahashi the king is interested in the following Q matters:\n\nThe number of the trains that runs strictly within the section from City p_i to City q_i, that is, the number of trains j such that p_i \\leq L_j and R_j \\leq q_i.\n\nAlthough he is genius, this is too much data to process by himself. Find the answer for each of these Q queries to help him.\n\nConstraints\n\nN is an integer between 1 and 500 (inclusive).\n\nM is an integer between 1 and 200 \\ 000 (inclusive).\n\nQ is an integer between 1 and 100 \\ 000 (inclusive).\n\n1 \\leq L_i \\leq R_i \\leq N (1 \\leq i \\leq M)\n\n1 \\leq p_i \\leq q_i \\leq N (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nL_1 R_1\nL_2 R_2\n:\nL_M R_M\np_1 q_1\np_2 q_2\n:\np_Q q_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the number of the trains that runs strictly within the section from City p_i to City q_i.\n\nSample Input 1\n\n2 3 1\n1 1\n1 2\n2 2\n1 2\n\nSample Output 1\n\n3\n\nAs all the trains runs within the section from City 1 to City 2, the answer to the only query is 3.\n\nSample Input 2\n\n10 3 2\n1 5\n2 8\n7 10\n1 7\n3 10\n\nSample Output 2\n\n1\n1\n\nThe first query is on the section from City 1 to 7. There is only one train that runs strictly within that section: Train 1.\nThe second query is on the section from City 3 to 10. There is only one train that runs strictly within that section: Train 3.\n\nSample Input 3\n\n10 10 10\n1 6\n2 9\n4 5\n4 7\n4 7\n5 8\n6 6\n6 7\n7 9\n10 10\n1 8\n1 9\n1 10\n2 8\n2 9\n2 10\n3 8\n3 9\n3 10\n1 10\n\nSample Output 3\n\n7\n9\n10\n6\n8\n9\n6\n7\n8\n10", "sample_input": "2 3 1\n1 1\n1 2\n2 2\n1 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03283", "source_text": "Score: 400 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east.\nA company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i).\nTakahashi the king is interested in the following Q matters:\n\nThe number of the trains that runs strictly within the section from City p_i to City q_i, that is, the number of trains j such that p_i \\leq L_j and R_j \\leq q_i.\n\nAlthough he is genius, this is too much data to process by himself. Find the answer for each of these Q queries to help him.\n\nConstraints\n\nN is an integer between 1 and 500 (inclusive).\n\nM is an integer between 1 and 200 \\ 000 (inclusive).\n\nQ is an integer between 1 and 100 \\ 000 (inclusive).\n\n1 \\leq L_i \\leq R_i \\leq N (1 \\leq i \\leq M)\n\n1 \\leq p_i \\leq q_i \\leq N (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nL_1 R_1\nL_2 R_2\n:\nL_M R_M\np_1 q_1\np_2 q_2\n:\np_Q q_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the number of the trains that runs strictly within the section from City p_i to City q_i.\n\nSample Input 1\n\n2 3 1\n1 1\n1 2\n2 2\n1 2\n\nSample Output 1\n\n3\n\nAs all the trains runs within the section from City 1 to City 2, the answer to the only query is 3.\n\nSample Input 2\n\n10 3 2\n1 5\n2 8\n7 10\n1 7\n3 10\n\nSample Output 2\n\n1\n1\n\nThe first query is on the section from City 1 to 7. There is only one train that runs strictly within that section: Train 1.\nThe second query is on the section from City 3 to 10. There is only one train that runs strictly within that section: Train 3.\n\nSample Input 3\n\n10 10 10\n1 6\n2 9\n4 5\n4 7\n4 7\n5 8\n6 6\n6 7\n7 9\n10 10\n1 8\n1 9\n1 10\n2 8\n2 9\n2 10\n3 8\n3 9\n3 10\n1 10\n\nSample Output 3\n\n7\n9\n10\n6\n8\n9\n6\n7\n8\n10", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 340, "cpu_time_ms": 3160, "memory_kb": 68496}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s007738716", "group_id": "codeNet:p03284", "input_text": "N,K = map(int,input().split())\nif N % K == 0:\n print(0)\nelse:\n print(1)", "language": "Python", "metadata": {"date": 1556235268, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03284.html", "problem_id": "p03284", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03284/input.txt", "sample_output_relpath": "derived/input_output/data/p03284/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03284/Python/s007738716.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s007738716", "user_id": "u928784113"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "N,K = map(int,input().split())\nif N % K == 0:\n print(0)\nelse:\n print(1)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nConstraints\n\n1 \\leq N,K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nSample Input 1\n\n7 3\n\nSample Output 1\n\n1\n\nWhen the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.\n\nSample Input 2\n\n100 10\n\nSample Output 2\n\n0\n\nThe crackers can be distributed evenly.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "sample_input": "7 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03284", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nConstraints\n\n1 \\leq N,K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nSample Input 1\n\n7 3\n\nSample Output 1\n\n1\n\nWhen the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.\n\nSample Input 2\n\n100 10\n\nSample Output 2\n\n0\n\nThe crackers can be distributed evenly.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 77, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s897255909", "group_id": "codeNet:p03284", "input_text": "n, k = list(map(int, input().split()))\nif n%k == 0:\n print(0)\nelse:\n print(1)", "language": "Python", "metadata": {"date": 1536113748, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03284.html", "problem_id": "p03284", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03284/input.txt", "sample_output_relpath": "derived/input_output/data/p03284/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03284/Python/s897255909.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s897255909", "user_id": "u186950791"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "n, k = list(map(int, input().split()))\nif n%k == 0:\n print(0)\nelse:\n print(1)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nConstraints\n\n1 \\leq N,K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nSample Input 1\n\n7 3\n\nSample Output 1\n\n1\n\nWhen the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.\n\nSample Input 2\n\n100 10\n\nSample Output 2\n\n0\n\nThe crackers can be distributed evenly.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "sample_input": "7 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03284", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nConstraints\n\n1 \\leq N,K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nSample Input 1\n\n7 3\n\nSample Output 1\n\n1\n\nWhen the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.\n\nSample Input 2\n\n100 10\n\nSample Output 2\n\n0\n\nThe crackers can be distributed evenly.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 83, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s877344392", "group_id": "codeNet:p03284", "input_text": "N, K = [int(i) for i in input().split()]\n\nif N % K == 0:\n print(0)\nelse:\n print(1)", "language": "Python", "metadata": {"date": 1534036507, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03284.html", "problem_id": "p03284", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03284/input.txt", "sample_output_relpath": "derived/input_output/data/p03284/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03284/Python/s877344392.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s877344392", "user_id": "u455233471"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "N, K = [int(i) for i in input().split()]\n\nif N % K == 0:\n print(0)\nelse:\n print(1)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nConstraints\n\n1 \\leq N,K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nSample Input 1\n\n7 3\n\nSample Output 1\n\n1\n\nWhen the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.\n\nSample Input 2\n\n100 10\n\nSample Output 2\n\n0\n\nThe crackers can be distributed evenly.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "sample_input": "7 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03284", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nConstraints\n\n1 \\leq N,K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nSample Input 1\n\n7 3\n\nSample Output 1\n\n1\n\nWhen the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.\n\nSample Input 2\n\n100 10\n\nSample Output 2\n\n0\n\nThe crackers can be distributed evenly.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 88, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s304515262", "group_id": "codeNet:p03284", "input_text": "N,K=map(int,input().split())\nA=[0 for i in range(K)]\nfor i in range(N):\n A[i%K]+=1\nprint(max(A)-min(A))\n", "language": "Python", "metadata": {"date": 1534035738, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03284.html", "problem_id": "p03284", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03284/input.txt", "sample_output_relpath": "derived/input_output/data/p03284/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03284/Python/s304515262.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s304515262", "user_id": "u562016607"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "N,K=map(int,input().split())\nA=[0 for i in range(K)]\nfor i in range(N):\n A[i%K]+=1\nprint(max(A)-min(A))\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nConstraints\n\n1 \\leq N,K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nSample Input 1\n\n7 3\n\nSample Output 1\n\n1\n\nWhen the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.\n\nSample Input 2\n\n100 10\n\nSample Output 2\n\n0\n\nThe crackers can be distributed evenly.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "sample_input": "7 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03284", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nConstraints\n\n1 \\leq N,K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nSample Input 1\n\n7 3\n\nSample Output 1\n\n1\n\nWhen the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.\n\nSample Input 2\n\n100 10\n\nSample Output 2\n\n0\n\nThe crackers can be distributed evenly.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 107, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s319832062", "group_id": "codeNet:p03287", "input_text": "N,M = list(map(int,input().split()))\nA = input().split()\n\ncount = 0\nA = np.array(A,dtype='int64')\nB = np.cumsum(A)\nC = np.append([0],B)\n\nL = (1 for i in range(N+1) for t in range(N+1) if i1 and i < len(s)-1 :\n if s[i]=='C':\n if count == 0:\n count += 1\n else:\n break\n elif s[i].islower():\n pass\n else:\n break\n elif i == len(s) :\n if s[i].islower():\n print(\"AC\")\n exit()\n else:\n break\nprint(\"WA\")", "language": "Python", "metadata": {"date": 1533519046, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03289.html", "problem_id": "p03289", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03289/input.txt", "sample_output_relpath": "derived/input_output/data/p03289/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03289/Python/s566697958.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s566697958", "user_id": "u843932857"}, "prompt_components": {"gold_output": "AC\n", "input_to_evaluate": "s = input()\ncount = 0\nfor i in range(len(s)):\n if i == 0:\n if s[i] != 'A':\n break\n elif i == 1:\n if s[i].islower():\n pass\n else:\n break\n elif i>1 and i < len(s)-1 :\n if s[i]=='C':\n if count == 0:\n count += 1\n else:\n break\n elif s[i].islower():\n pass\n else:\n break\n elif i == len(s) :\n if s[i].islower():\n print(\"AC\")\n exit()\n else:\n break\nprint(\"WA\")", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S. Each character of S is uppercase or lowercase English letter.\nDetermine if S satisfies all of the following conditions:\n\nThe initial character of S is an uppercase A.\n\nThere is exactly one occurrence of C between the third character from the beginning and the second to last character (inclusive).\n\nAll letters except the A and C mentioned above are lowercase.\n\nConstraints\n\n4 ≤ |S| ≤ 10 (|S| is the length of the string S.)\n\nEach character of S is uppercase or lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S satisfies all of the conditions in the problem statement, print AC; otherwise, print WA.\n\nSample Input 1\n\nAtCoder\n\nSample Output 1\n\nAC\n\nThe first letter is A, the third letter is C and the remaining letters are all lowercase, so all the conditions are satisfied.\n\nSample Input 2\n\nACoder\n\nSample Output 2\n\nWA\n\nThe second letter should not be C.\n\nSample Input 3\n\nAcycliC\n\nSample Output 3\n\nWA\n\nThe last letter should not be C, either.\n\nSample Input 4\n\nAtCoCo\n\nSample Output 4\n\nWA\n\nThere should not be two or more occurrences of C.\n\nSample Input 5\n\nAtcoder\n\nSample Output 5\n\nWA\n\nThe number of C should not be zero, either.", "sample_input": "AtCoder\n"}, "reference_outputs": ["AC\n"], "source_document_id": "p03289", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S. Each character of S is uppercase or lowercase English letter.\nDetermine if S satisfies all of the following conditions:\n\nThe initial character of S is an uppercase A.\n\nThere is exactly one occurrence of C between the third character from the beginning and the second to last character (inclusive).\n\nAll letters except the A and C mentioned above are lowercase.\n\nConstraints\n\n4 ≤ |S| ≤ 10 (|S| is the length of the string S.)\n\nEach character of S is uppercase or lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S satisfies all of the conditions in the problem statement, print AC; otherwise, print WA.\n\nSample Input 1\n\nAtCoder\n\nSample Output 1\n\nAC\n\nThe first letter is A, the third letter is C and the remaining letters are all lowercase, so all the conditions are satisfied.\n\nSample Input 2\n\nACoder\n\nSample Output 2\n\nWA\n\nThe second letter should not be C.\n\nSample Input 3\n\nAcycliC\n\nSample Output 3\n\nWA\n\nThe last letter should not be C, either.\n\nSample Input 4\n\nAtCoCo\n\nSample Output 4\n\nWA\n\nThere should not be two or more occurrences of C.\n\nSample Input 5\n\nAtcoder\n\nSample Output 5\n\nWA\n\nThe number of C should not be zero, either.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 550, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s058330520", "group_id": "codeNet:p03292", "input_text": "list1 = list(map(int, input().split()))\nlist1.sort()\ncost= list1[2]-list1[0]\nprint(cost)", "language": "Python", "metadata": {"date": 1536506788, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03292.html", "problem_id": "p03292", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03292/input.txt", "sample_output_relpath": "derived/input_output/data/p03292/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03292/Python/s058330520.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s058330520", "user_id": "u711295009"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "list1 = list(map(int, input().split()))\nlist1.sort()\ncost= list1[2]-list1[0]\nprint(cost)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou have three tasks, all of which need to be completed.\n\nFirst, you can complete any one task at cost 0.\n\nThen, just after completing the i-th task, you can complete the j-th task at cost |A_j - A_i|.\n\nHere, |x| denotes the absolute value of x.\n\nFind the minimum total cost required to complete all the task.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_1, A_2, A_3 \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nPrint the minimum total cost required to complete all the task.\n\nSample Input 1\n\n1 6 3\n\nSample Output 1\n\n5\n\nWhen the tasks are completed in the following order, the total cost will be 5, which is the minimum:\n\nComplete the first task at cost 0.\n\nComplete the third task at cost 2.\n\nComplete the second task at cost 3.\n\nSample Input 2\n\n11 5 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n100 100 100\n\nSample Output 3\n\n0", "sample_input": "1 6 3\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03292", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou have three tasks, all of which need to be completed.\n\nFirst, you can complete any one task at cost 0.\n\nThen, just after completing the i-th task, you can complete the j-th task at cost |A_j - A_i|.\n\nHere, |x| denotes the absolute value of x.\n\nFind the minimum total cost required to complete all the task.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_1, A_2, A_3 \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nPrint the minimum total cost required to complete all the task.\n\nSample Input 1\n\n1 6 3\n\nSample Output 1\n\n5\n\nWhen the tasks are completed in the following order, the total cost will be 5, which is the minimum:\n\nComplete the first task at cost 0.\n\nComplete the third task at cost 2.\n\nComplete the second task at cost 3.\n\nSample Input 2\n\n11 5 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n100 100 100\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 88, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s338989943", "group_id": "codeNet:p03292", "input_text": "a = list(map(int, input().split()))\na.sort()\nnum1 = a[1]-a[0]\nnum2 = a[2]-a[1]\nprint(int(num1)+int(num2))", "language": "Python", "metadata": {"date": 1532225182, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03292.html", "problem_id": "p03292", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03292/input.txt", "sample_output_relpath": "derived/input_output/data/p03292/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03292/Python/s338989943.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s338989943", "user_id": "u006721330"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "a = list(map(int, input().split()))\na.sort()\nnum1 = a[1]-a[0]\nnum2 = a[2]-a[1]\nprint(int(num1)+int(num2))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou have three tasks, all of which need to be completed.\n\nFirst, you can complete any one task at cost 0.\n\nThen, just after completing the i-th task, you can complete the j-th task at cost |A_j - A_i|.\n\nHere, |x| denotes the absolute value of x.\n\nFind the minimum total cost required to complete all the task.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_1, A_2, A_3 \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nPrint the minimum total cost required to complete all the task.\n\nSample Input 1\n\n1 6 3\n\nSample Output 1\n\n5\n\nWhen the tasks are completed in the following order, the total cost will be 5, which is the minimum:\n\nComplete the first task at cost 0.\n\nComplete the third task at cost 2.\n\nComplete the second task at cost 3.\n\nSample Input 2\n\n11 5 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n100 100 100\n\nSample Output 3\n\n0", "sample_input": "1 6 3\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03292", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou have three tasks, all of which need to be completed.\n\nFirst, you can complete any one task at cost 0.\n\nThen, just after completing the i-th task, you can complete the j-th task at cost |A_j - A_i|.\n\nHere, |x| denotes the absolute value of x.\n\nFind the minimum total cost required to complete all the task.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_1, A_2, A_3 \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nPrint the minimum total cost required to complete all the task.\n\nSample Input 1\n\n1 6 3\n\nSample Output 1\n\n5\n\nWhen the tasks are completed in the following order, the total cost will be 5, which is the minimum:\n\nComplete the first task at cost 0.\n\nComplete the third task at cost 2.\n\nComplete the second task at cost 3.\n\nSample Input 2\n\n11 5 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n100 100 100\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 105, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s771716961", "group_id": "codeNet:p03293", "input_text": "S = input()\nT = input()\n\nt2 = T + T\n\nif set(S) == set(T):\n if t2.count(S) > 0:\n r = 'Yes'\nelse:\n r = 'No'\n \nprint(r)", "language": "Python", "metadata": {"date": 1600609662, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03293.html", "problem_id": "p03293", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03293/input.txt", "sample_output_relpath": "derived/input_output/data/p03293/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03293/Python/s771716961.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s771716961", "user_id": "u353548710"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "S = input()\nT = input()\n\nt2 = T + T\n\nif set(S) == set(T):\n if t2.count(S) > 0:\n r = 'Yes'\nelse:\n r = 'No'\n \nprint(r)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given string S and T consisting of lowercase English letters.\n\nDetermine if S equals T after rotation.\n\nThat is, determine if S equals T after the following operation is performed some number of times:\n\nOperation: Let S = S_1 S_2 ... S_{|S|}. Change S to S_{|S|} S_1 S_2 ... S_{|S|-1}.\n\nHere, |X| denotes the length of the string X.\n\nConstraints\n\n2 \\leq |S| \\leq 100\n\n|S| = |T|\n\nS and T consist of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf S equals T after rotation, print Yes; if it does not, print No.\n\nSample Input 1\n\nkyoto\ntokyo\n\nSample Output 1\n\nYes\n\nIn the first operation, kyoto becomes okyot.\n\nIn the second operation, okyot becomes tokyo.\n\nSample Input 2\n\nabc\narc\n\nSample Output 2\n\nNo\n\nabc does not equal arc after any number of operations.\n\nSample Input 3\n\naaaaaaaaaaaaaaab\naaaaaaaaaaaaaaab\n\nSample Output 3\n\nYes", "sample_input": "kyoto\ntokyo\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03293", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given string S and T consisting of lowercase English letters.\n\nDetermine if S equals T after rotation.\n\nThat is, determine if S equals T after the following operation is performed some number of times:\n\nOperation: Let S = S_1 S_2 ... S_{|S|}. Change S to S_{|S|} S_1 S_2 ... S_{|S|-1}.\n\nHere, |X| denotes the length of the string X.\n\nConstraints\n\n2 \\leq |S| \\leq 100\n\n|S| = |T|\n\nS and T consist of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf S equals T after rotation, print Yes; if it does not, print No.\n\nSample Input 1\n\nkyoto\ntokyo\n\nSample Output 1\n\nYes\n\nIn the first operation, kyoto becomes okyot.\n\nIn the second operation, okyot becomes tokyo.\n\nSample Input 2\n\nabc\narc\n\nSample Output 2\n\nNo\n\nabc does not equal arc after any number of operations.\n\nSample Input 3\n\naaaaaaaaaaaaaaab\naaaaaaaaaaaaaaab\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 122, "cpu_time_ms": 26, "memory_kb": 9020}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s724946741", "group_id": "codeNet:p03294", "input_text": "n = int(input())\nA = list(map(int, input().split()))\nprint(sum([a - 1 for a in A])) ", "language": "Python", "metadata": {"date": 1590178071, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03294.html", "problem_id": "p03294", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03294/input.txt", "sample_output_relpath": "derived/input_output/data/p03294/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03294/Python/s724946741.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s724946741", "user_id": "u941047297"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "n = int(input())\nA = list(map(int, input().split()))\nprint(sum([a - 1 for a in A])) ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given N positive integers a_1, a_2, ..., a_N.\n\nFor a non-negative integer m, let f(m) = (m\\ mod\\ a_1) + (m\\ mod\\ a_2) + ... + (m\\ mod\\ a_N).\n\nHere, X\\ mod\\ Y denotes the remainder of the division of X by Y.\n\nFind the maximum value of f.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 3000\n\n2 \\leq a_i \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum value of f.\n\nSample Input 1\n\n3\n3 4 6\n\nSample Output 1\n\n10\n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value of f.\n\nSample Input 2\n\n5\n7 46 11 20 11\n\nSample Output 2\n\n90\n\nSample Input 3\n\n7\n994 518 941 851 647 2 581\n\nSample Output 3\n\n4527", "sample_input": "3\n3 4 6\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03294", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given N positive integers a_1, a_2, ..., a_N.\n\nFor a non-negative integer m, let f(m) = (m\\ mod\\ a_1) + (m\\ mod\\ a_2) + ... + (m\\ mod\\ a_N).\n\nHere, X\\ mod\\ Y denotes the remainder of the division of X by Y.\n\nFind the maximum value of f.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 3000\n\n2 \\leq a_i \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum value of f.\n\nSample Input 1\n\n3\n3 4 6\n\nSample Output 1\n\n10\n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value of f.\n\nSample Input 2\n\n5\n7 46 11 20 11\n\nSample Output 2\n\n90\n\nSample Input 3\n\n7\n994 518 941 851 647 2 581\n\nSample Output 3\n\n4527", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 85, "cpu_time_ms": 21, "memory_kb": 3316}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s649479394", "group_id": "codeNet:p03294", "input_text": "N = int(input())\nA = list(map(int, input().split()))\n\nA1 = [a - 1 for a in A]\n\nprint(sum(A1))", "language": "Python", "metadata": {"date": 1532237158, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03294.html", "problem_id": "p03294", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03294/input.txt", "sample_output_relpath": "derived/input_output/data/p03294/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03294/Python/s649479394.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s649479394", "user_id": "u632369368"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "N = int(input())\nA = list(map(int, input().split()))\n\nA1 = [a - 1 for a in A]\n\nprint(sum(A1))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given N positive integers a_1, a_2, ..., a_N.\n\nFor a non-negative integer m, let f(m) = (m\\ mod\\ a_1) + (m\\ mod\\ a_2) + ... + (m\\ mod\\ a_N).\n\nHere, X\\ mod\\ Y denotes the remainder of the division of X by Y.\n\nFind the maximum value of f.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 3000\n\n2 \\leq a_i \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum value of f.\n\nSample Input 1\n\n3\n3 4 6\n\nSample Output 1\n\n10\n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value of f.\n\nSample Input 2\n\n5\n7 46 11 20 11\n\nSample Output 2\n\n90\n\nSample Input 3\n\n7\n994 518 941 851 647 2 581\n\nSample Output 3\n\n4527", "sample_input": "3\n3 4 6\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03294", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given N positive integers a_1, a_2, ..., a_N.\n\nFor a non-negative integer m, let f(m) = (m\\ mod\\ a_1) + (m\\ mod\\ a_2) + ... + (m\\ mod\\ a_N).\n\nHere, X\\ mod\\ Y denotes the remainder of the division of X by Y.\n\nFind the maximum value of f.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 3000\n\n2 \\leq a_i \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum value of f.\n\nSample Input 1\n\n3\n3 4 6\n\nSample Output 1\n\n10\n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value of f.\n\nSample Input 2\n\n5\n7 46 11 20 11\n\nSample Output 2\n\n90\n\nSample Input 3\n\n7\n994 518 941 851 647 2 581\n\nSample Output 3\n\n4527", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 93, "cpu_time_ms": 18, "memory_kb": 3316}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s699284560", "group_id": "codeNet:p03296", "input_text": "import math\n\nn = int(input())\na = list(map(int, input().split()))\na.append(\"#\")\nstart = 0\nend = 0\n\nans = 0\n\nwhile a[start] != \"#\" :\n if a[start] != a[end]:\n x = end - start\n if x % 2 == 0:\n ans += x // 2\n else:\n ans += math.floor(x / 2)\n \n start = end\n\n else:\n end += 1\n\n\nprint(ans)", "language": "Python", "metadata": {"date": 1565888608, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03296.html", "problem_id": "p03296", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03296/input.txt", "sample_output_relpath": "derived/input_output/data/p03296/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03296/Python/s699284560.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s699284560", "user_id": "u777283665"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import math\n\nn = int(input())\na = list(map(int, input().split()))\na.append(\"#\")\nstart = 0\nend = 0\n\nans = 0\n\nwhile a[start] != \"#\" :\n if a[start] != a[end]:\n x = end - start\n if x % 2 == 0:\n ans += x // 2\n else:\n ans += math.floor(x / 2)\n \n start = end\n\n else:\n end += 1\n\n\nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.\n\nTakahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i.\nIf two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.\n\nTakahashi can change the color of one slime to any of the 10000 colors by one spell.\nHow many spells are required so that no slimes will start to combine themselves?\n\nConstraints\n\n2 \\leq N \\leq 100\n\n1 \\leq a_i \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of spells required.\n\nSample Input 1\n\n5\n1 1 2 2 2\n\nSample Output 1\n\n2\n\nFor example, if we change the color of the second slime from the left to 4, and the color of the fourth slime to 5, the colors of the slimes will be 1, 4, 2, 5, 2, which satisfy the condition.\n\nSample Input 2\n\n3\n1 2 1\n\nSample Output 2\n\n0\n\nAlthough the colors of the first and third slimes are the same, they are not adjacent, so no spell is required.\n\nSample Input 3\n\n5\n1 1 1 1 1\n\nSample Output 3\n\n2\n\nFor example, if we change the colors of the second and fourth slimes from the left to 2, the colors of the slimes will be 1, 2, 1, 2, 1, which satisfy the condition.\n\nSample Input 4\n\n14\n1 2 2 3 3 3 4 4 4 4 1 2 3 4\n\nSample Output 4\n\n4", "sample_input": "5\n1 1 2 2 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03296", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi lives in another world. There are slimes (creatures) of 10000 colors in this world. Let us call these colors Color 1, 2, ..., 10000.\n\nTakahashi has N slimes, and they are standing in a row from left to right. The color of the i-th slime from the left is a_i.\nIf two slimes of the same color are adjacent, they will start to combine themselves. Because Takahashi likes smaller slimes, he has decided to change the colors of some of the slimes with his magic.\n\nTakahashi can change the color of one slime to any of the 10000 colors by one spell.\nHow many spells are required so that no slimes will start to combine themselves?\n\nConstraints\n\n2 \\leq N \\leq 100\n\n1 \\leq a_i \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of spells required.\n\nSample Input 1\n\n5\n1 1 2 2 2\n\nSample Output 1\n\n2\n\nFor example, if we change the color of the second slime from the left to 4, and the color of the fourth slime to 5, the colors of the slimes will be 1, 4, 2, 5, 2, which satisfy the condition.\n\nSample Input 2\n\n3\n1 2 1\n\nSample Output 2\n\n0\n\nAlthough the colors of the first and third slimes are the same, they are not adjacent, so no spell is required.\n\nSample Input 3\n\n5\n1 1 1 1 1\n\nSample Output 3\n\n2\n\nFor example, if we change the colors of the second and fourth slimes from the left to 2, the colors of the slimes will be 1, 2, 1, 2, 1, which satisfy the condition.\n\nSample Input 4\n\n14\n1 2 2 3 3 3 4 4 4 4 1 2 3 4\n\nSample Output 4\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 310, "cpu_time_ms": 182, "memory_kb": 38256}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s100074529", "group_id": "codeNet:p03302", "input_text": "a,b=map(int,input().split())\nprint('+' if a+b==15 else '*' if a*b==15 else 'x')\n", "language": "Python", "metadata": {"date": 1550173403, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03302.html", "problem_id": "p03302", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03302/input.txt", "sample_output_relpath": "derived/input_output/data/p03302/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03302/Python/s100074529.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s100074529", "user_id": "u223133214"}, "prompt_components": {"gold_output": "+\n", "input_to_evaluate": "a,b=map(int,input().split())\nprint('+' if a+b==15 else '*' if a*b==15 else 'x')\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given two integers a and b.\nDetermine if a+b=15 or a\\times b=15 or neither holds.\n\nNote that a+b=15 and a\\times b=15 do not hold at the same time.\n\nConstraints\n\n1 \\leq a,b \\leq 15\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf a+b=15, print +;\nif a\\times b=15, print *;\nif neither holds, print x.\n\nSample Input 1\n\n4 11\n\nSample Output 1\n\n+\n\n4+11=15.\n\nSample Input 2\n\n3 5\n\nSample Output 2\n\n*\n\n3\\times 5=15.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\nx\n\n1+1=2 and 1\\times 1=1, neither of which is 15.", "sample_input": "4 11\n"}, "reference_outputs": ["+\n"], "source_document_id": "p03302", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given two integers a and b.\nDetermine if a+b=15 or a\\times b=15 or neither holds.\n\nNote that a+b=15 and a\\times b=15 do not hold at the same time.\n\nConstraints\n\n1 \\leq a,b \\leq 15\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf a+b=15, print +;\nif a\\times b=15, print *;\nif neither holds, print x.\n\nSample Input 1\n\n4 11\n\nSample Output 1\n\n+\n\n4+11=15.\n\nSample Input 2\n\n3 5\n\nSample Output 2\n\n*\n\n3\\times 5=15.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\nx\n\n1+1=2 and 1\\times 1=1, neither of which is 15.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 80, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s731118674", "group_id": "codeNet:p03304", "input_text": "n,m,d = map(int,input().split())\nprint(2*(m-1)*(n-d)/n/n if d > 0 else (m-1)/n)", "language": "Python", "metadata": {"date": 1589338539, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03304.html", "problem_id": "p03304", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03304/input.txt", "sample_output_relpath": "derived/input_output/data/p03304/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03304/Python/s731118674.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s731118674", "user_id": "u818349438"}, "prompt_components": {"gold_output": "1.0000000000\n", "input_to_evaluate": "n,m,d = map(int,input().split())\nprint(2*(m-1)*(n-d)/n/n if d > 0 else (m-1)/n)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nLet us define the beauty of a sequence (a_1,... ,a_n) as the number of pairs of two adjacent elements in it whose absolute differences are d.\nFor example, when d=1, the beauty of the sequence (3, 2, 3, 10, 9) is 3.\n\nThere are a total of n^m sequences of length m where each element is an integer between 1 and n (inclusive).\nFind the beauty of each of these n^m sequences, and print the average of those values.\n\nConstraints\n\n0 \\leq d < n \\leq 10^9\n\n2 \\leq m \\leq 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 d\n\nOutput\n\nPrint the average of the beauties of the sequences of length m where each element is an integer between 1 and n.\nThe output will be judged correct if the absolute or relative error is at most 10^{-6}.\n\nSample Input 1\n\n2 3 1\n\nSample Output 1\n\n1.0000000000\n\nThe beauty of (1,1,1) is 0.\n\nThe beauty of (1,1,2) is 1.\n\nThe beauty of (1,2,1) is 2.\n\nThe beauty of (1,2,2) is 1.\n\nThe beauty of (2,1,1) is 1.\n\nThe beauty of (2,1,2) is 2.\n\nThe beauty of (2,2,1) is 1.\n\nThe beauty of (2,2,2) is 0.\n\nThe answer is the average of these values: (0+1+2+1+1+2+1+0)/8=1.\n\nSample Input 2\n\n1000000000 180707 0\n\nSample Output 2\n\n0.0001807060", "sample_input": "2 3 1\n"}, "reference_outputs": ["1.0000000000\n"], "source_document_id": "p03304", "source_text": "Score : 300 points\n\nProblem Statement\n\nLet us define the beauty of a sequence (a_1,... ,a_n) as the number of pairs of two adjacent elements in it whose absolute differences are d.\nFor example, when d=1, the beauty of the sequence (3, 2, 3, 10, 9) is 3.\n\nThere are a total of n^m sequences of length m where each element is an integer between 1 and n (inclusive).\nFind the beauty of each of these n^m sequences, and print the average of those values.\n\nConstraints\n\n0 \\leq d < n \\leq 10^9\n\n2 \\leq m \\leq 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 d\n\nOutput\n\nPrint the average of the beauties of the sequences of length m where each element is an integer between 1 and n.\nThe output will be judged correct if the absolute or relative error is at most 10^{-6}.\n\nSample Input 1\n\n2 3 1\n\nSample Output 1\n\n1.0000000000\n\nThe beauty of (1,1,1) is 0.\n\nThe beauty of (1,1,2) is 1.\n\nThe beauty of (1,2,1) is 2.\n\nThe beauty of (1,2,2) is 1.\n\nThe beauty of (2,1,1) is 1.\n\nThe beauty of (2,1,2) is 2.\n\nThe beauty of (2,2,1) is 1.\n\nThe beauty of (2,2,2) is 0.\n\nThe answer is the average of these values: (0+1+2+1+1+2+1+0)/8=1.\n\nSample Input 2\n\n1000000000 180707 0\n\nSample Output 2\n\n0.0001807060", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 79, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s286862099", "group_id": "codeNet:p03304", "input_text": "N,M,D = list(map(int,input().split()))\n\nprint((2 * (N-D) * (M-1))/(N**2))", "language": "Python", "metadata": {"date": 1584567225, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03304.html", "problem_id": "p03304", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03304/input.txt", "sample_output_relpath": "derived/input_output/data/p03304/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03304/Python/s286862099.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s286862099", "user_id": "u785989355"}, "prompt_components": {"gold_output": "1.0000000000\n", "input_to_evaluate": "N,M,D = list(map(int,input().split()))\n\nprint((2 * (N-D) * (M-1))/(N**2))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nLet us define the beauty of a sequence (a_1,... ,a_n) as the number of pairs of two adjacent elements in it whose absolute differences are d.\nFor example, when d=1, the beauty of the sequence (3, 2, 3, 10, 9) is 3.\n\nThere are a total of n^m sequences of length m where each element is an integer between 1 and n (inclusive).\nFind the beauty of each of these n^m sequences, and print the average of those values.\n\nConstraints\n\n0 \\leq d < n \\leq 10^9\n\n2 \\leq m \\leq 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 d\n\nOutput\n\nPrint the average of the beauties of the sequences of length m where each element is an integer between 1 and n.\nThe output will be judged correct if the absolute or relative error is at most 10^{-6}.\n\nSample Input 1\n\n2 3 1\n\nSample Output 1\n\n1.0000000000\n\nThe beauty of (1,1,1) is 0.\n\nThe beauty of (1,1,2) is 1.\n\nThe beauty of (1,2,1) is 2.\n\nThe beauty of (1,2,2) is 1.\n\nThe beauty of (2,1,1) is 1.\n\nThe beauty of (2,1,2) is 2.\n\nThe beauty of (2,2,1) is 1.\n\nThe beauty of (2,2,2) is 0.\n\nThe answer is the average of these values: (0+1+2+1+1+2+1+0)/8=1.\n\nSample Input 2\n\n1000000000 180707 0\n\nSample Output 2\n\n0.0001807060", "sample_input": "2 3 1\n"}, "reference_outputs": ["1.0000000000\n"], "source_document_id": "p03304", "source_text": "Score : 300 points\n\nProblem Statement\n\nLet us define the beauty of a sequence (a_1,... ,a_n) as the number of pairs of two adjacent elements in it whose absolute differences are d.\nFor example, when d=1, the beauty of the sequence (3, 2, 3, 10, 9) is 3.\n\nThere are a total of n^m sequences of length m where each element is an integer between 1 and n (inclusive).\nFind the beauty of each of these n^m sequences, and print the average of those values.\n\nConstraints\n\n0 \\leq d < n \\leq 10^9\n\n2 \\leq m \\leq 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 d\n\nOutput\n\nPrint the average of the beauties of the sequences of length m where each element is an integer between 1 and n.\nThe output will be judged correct if the absolute or relative error is at most 10^{-6}.\n\nSample Input 1\n\n2 3 1\n\nSample Output 1\n\n1.0000000000\n\nThe beauty of (1,1,1) is 0.\n\nThe beauty of (1,1,2) is 1.\n\nThe beauty of (1,2,1) is 2.\n\nThe beauty of (1,2,2) is 1.\n\nThe beauty of (2,1,1) is 1.\n\nThe beauty of (2,1,2) is 2.\n\nThe beauty of (2,2,1) is 1.\n\nThe beauty of (2,2,2) is 0.\n\nThe answer is the average of these values: (0+1+2+1+1+2+1+0)/8=1.\n\nSample Input 2\n\n1000000000 180707 0\n\nSample Output 2\n\n0.0001807060", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 73, "cpu_time_ms": 165, "memory_kb": 38256}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s949853574", "group_id": "codeNet:p03308", "input_text": "N = int(input())\nA = list(map(int, input().split()))\nans = 0\nfor i in range(N):\n for k in range(i+1, N):\n ans = max(ans,abs(A[i] - A[k]))\nprint(ans)", "language": "Python", "metadata": {"date": 1578284971, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03308.html", "problem_id": "p03308", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03308/input.txt", "sample_output_relpath": "derived/input_output/data/p03308/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03308/Python/s949853574.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s949853574", "user_id": "u230621983"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "N = int(input())\nA = list(map(int, input().split()))\nans = 0\nfor i in range(N):\n for k in range(i+1, N):\n ans = max(ans,abs(A[i] - A[k]))\nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given an integer sequence A of length N.\nFind the maximum absolute difference of two elements (with different indices) in A.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum absolute difference of two elements (with different indices) in A.\n\nSample Input 1\n\n4\n1 4 6 3\n\nSample Output 1\n\n5\n\nThe maximum absolute difference of two elements is A_3-A_1=6-1=5.\n\nSample Input 2\n\n2\n1000000000 1\n\nSample Output 2\n\n999999999\n\nSample Input 3\n\n5\n1 1 1 1 1\n\nSample Output 3\n\n0", "sample_input": "4\n1 4 6 3\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03308", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given an integer sequence A of length N.\nFind the maximum absolute difference of two elements (with different indices) in A.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum absolute difference of two elements (with different indices) in A.\n\nSample Input 1\n\n4\n1 4 6 3\n\nSample Output 1\n\n5\n\nThe maximum absolute difference of two elements is A_3-A_1=6-1=5.\n\nSample Input 2\n\n2\n1000000000 1\n\nSample Output 2\n\n999999999\n\nSample Input 3\n\n5\n1 1 1 1 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 152, "cpu_time_ms": 19, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s435773681", "group_id": "codeNet:p03311", "input_text": "N = int(input())\nA = list(map(int, input().split()))\nfor i in range(N):\n A[i] -= i\n \nmode = sorted(A)[N//2]\n\nans = 0\nfor i in range(N):\n ans += abs(A[i]-mode)\nprint(ans)", "language": "Python", "metadata": {"date": 1558237232, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03311.html", "problem_id": "p03311", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03311/input.txt", "sample_output_relpath": "derived/input_output/data/p03311/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03311/Python/s435773681.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s435773681", "user_id": "u667084803"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "N = int(input())\nA = list(map(int, input().split()))\nfor i in range(N):\n A[i] -= i\n \nmode = sorted(A)[N//2]\n\nans = 0\nfor i in range(N):\n ans += abs(A[i]-mode)\nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has an integer sequence A of length N.\n\nHe will freely choose an integer b.\nHere, he will get sad if A_i and b+i are far from each other.\nMore specifically, the sadness of Snuke is calculated as follows:\n\nabs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N))\n\nHere, abs(x) is a function that returns the absolute value of x.\n\nFind the minimum possible sadness of Snuke.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible sadness of Snuke.\n\nSample Input 1\n\n5\n2 2 3 5 5\n\nSample Output 1\n\n2\n\nIf we choose b=0, the sadness of Snuke would be abs(2-(0+1))+abs(2-(0+2))+abs(3-(0+3))+abs(5-(0+4))+abs(5-(0+5))=2.\nAny choice of b does not make the sadness of Snuke less than 2, so the answer is 2.\n\nSample Input 2\n\n9\n1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n6\n6 5 4 3 2 1\n\nSample Output 3\n\n18\n\nSample Input 4\n\n7\n1 1 1 1 2 3 4\n\nSample Output 4\n\n6", "sample_input": "5\n2 2 3 5 5\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03311", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has an integer sequence A of length N.\n\nHe will freely choose an integer b.\nHere, he will get sad if A_i and b+i are far from each other.\nMore specifically, the sadness of Snuke is calculated as follows:\n\nabs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N))\n\nHere, abs(x) is a function that returns the absolute value of x.\n\nFind the minimum possible sadness of Snuke.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible sadness of Snuke.\n\nSample Input 1\n\n5\n2 2 3 5 5\n\nSample Output 1\n\n2\n\nIf we choose b=0, the sadness of Snuke would be abs(2-(0+1))+abs(2-(0+2))+abs(3-(0+3))+abs(5-(0+4))+abs(5-(0+5))=2.\nAny choice of b does not make the sadness of Snuke less than 2, so the answer is 2.\n\nSample Input 2\n\n9\n1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n6\n6 5 4 3 2 1\n\nSample Output 3\n\n18\n\nSample Input 4\n\n7\n1 1 1 1 2 3 4\n\nSample Output 4\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 172, "cpu_time_ms": 219, "memory_kb": 26708}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s973960381", "group_id": "codeNet:p03315", "input_text": "S_original=input('S: ')\nS_list=list(S_original)\nlength_S=len(S_list)\n\na=0\ni=0\n\nwhile i < length_S:\n if S_list[i]=='+':\n a += 1\n i += 1\n else:\n a = a-1\n i=i+1\n \n\nprint(a)\n ", "language": "Python", "metadata": {"date": 1529979799, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03315.html", "problem_id": "p03315", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03315/input.txt", "sample_output_relpath": "derived/input_output/data/p03315/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03315/Python/s973960381.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s973960381", "user_id": "u106297876"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "S_original=input('S: ')\nS_list=list(S_original)\nlength_S=len(S_list)\n\na=0\ni=0\n\nwhile i < length_S:\n if S_list[i]=='+':\n a += 1\n i += 1\n else:\n a = a-1\n i=i+1\n \n\nprint(a)\n ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is always an integer in Takahashi's mind.\n\nInitially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is + or -. When he eats +, the integer in his mind increases by 1; when he eats -, the integer in his mind decreases by 1.\n\nThe symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat.\n\nFind the integer in Takahashi's mind after he eats all the symbols.\n\nConstraints\n\nThe length of S is 4.\n\nEach character in S is + or -.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the integer in Takahashi's mind after he eats all the symbols.\n\nSample Input 1\n\n+-++\n\nSample Output 1\n\n2\n\nInitially, the integer in Takahashi's mind is 0.\n\nThe first integer for him to eat is +. After eating it, the integer in his mind becomes 1.\n\nThe second integer to eat is -. After eating it, the integer in his mind becomes 0.\n\nThe third integer to eat is +. After eating it, the integer in his mind becomes 1.\n\nThe fourth integer to eat is +. After eating it, the integer in his mind becomes 2.\n\nThus, the integer in Takahashi's mind after he eats all the symbols is 2.\n\nSample Input 2\n\n-+--\n\nSample Output 2\n\n-2\n\nSample Input 3\n\n----\n\nSample Output 3\n\n-4", "sample_input": "+-++\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03315", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is always an integer in Takahashi's mind.\n\nInitially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is + or -. When he eats +, the integer in his mind increases by 1; when he eats -, the integer in his mind decreases by 1.\n\nThe symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat.\n\nFind the integer in Takahashi's mind after he eats all the symbols.\n\nConstraints\n\nThe length of S is 4.\n\nEach character in S is + or -.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the integer in Takahashi's mind after he eats all the symbols.\n\nSample Input 1\n\n+-++\n\nSample Output 1\n\n2\n\nInitially, the integer in Takahashi's mind is 0.\n\nThe first integer for him to eat is +. After eating it, the integer in his mind becomes 1.\n\nThe second integer to eat is -. After eating it, the integer in his mind becomes 0.\n\nThe third integer to eat is +. After eating it, the integer in his mind becomes 1.\n\nThe fourth integer to eat is +. After eating it, the integer in his mind becomes 2.\n\nThus, the integer in Takahashi's mind after he eats all the symbols is 2.\n\nSample Input 2\n\n-+--\n\nSample Output 2\n\n-2\n\nSample Input 3\n\n----\n\nSample Output 3\n\n-4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 189, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s297411355", "group_id": "codeNet:p03315", "input_text": "num = 0\ns = input()\nfor op in s:\n if op == '+':\n num += 1\n else:\n num -= 1\nprint(num)", "language": "Python", "metadata": {"date": 1529811951, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03315.html", "problem_id": "p03315", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03315/input.txt", "sample_output_relpath": "derived/input_output/data/p03315/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03315/Python/s297411355.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s297411355", "user_id": "u492532572"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "num = 0\ns = input()\nfor op in s:\n if op == '+':\n num += 1\n else:\n num -= 1\nprint(num)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is always an integer in Takahashi's mind.\n\nInitially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is + or -. When he eats +, the integer in his mind increases by 1; when he eats -, the integer in his mind decreases by 1.\n\nThe symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat.\n\nFind the integer in Takahashi's mind after he eats all the symbols.\n\nConstraints\n\nThe length of S is 4.\n\nEach character in S is + or -.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the integer in Takahashi's mind after he eats all the symbols.\n\nSample Input 1\n\n+-++\n\nSample Output 1\n\n2\n\nInitially, the integer in Takahashi's mind is 0.\n\nThe first integer for him to eat is +. After eating it, the integer in his mind becomes 1.\n\nThe second integer to eat is -. After eating it, the integer in his mind becomes 0.\n\nThe third integer to eat is +. After eating it, the integer in his mind becomes 1.\n\nThe fourth integer to eat is +. After eating it, the integer in his mind becomes 2.\n\nThus, the integer in Takahashi's mind after he eats all the symbols is 2.\n\nSample Input 2\n\n-+--\n\nSample Output 2\n\n-2\n\nSample Input 3\n\n----\n\nSample Output 3\n\n-4", "sample_input": "+-++\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03315", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is always an integer in Takahashi's mind.\n\nInitially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is + or -. When he eats +, the integer in his mind increases by 1; when he eats -, the integer in his mind decreases by 1.\n\nThe symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat.\n\nFind the integer in Takahashi's mind after he eats all the symbols.\n\nConstraints\n\nThe length of S is 4.\n\nEach character in S is + or -.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the integer in Takahashi's mind after he eats all the symbols.\n\nSample Input 1\n\n+-++\n\nSample Output 1\n\n2\n\nInitially, the integer in Takahashi's mind is 0.\n\nThe first integer for him to eat is +. After eating it, the integer in his mind becomes 1.\n\nThe second integer to eat is -. After eating it, the integer in his mind becomes 0.\n\nThe third integer to eat is +. After eating it, the integer in his mind becomes 1.\n\nThe fourth integer to eat is +. After eating it, the integer in his mind becomes 2.\n\nThus, the integer in Takahashi's mind after he eats all the symbols is 2.\n\nSample Input 2\n\n-+--\n\nSample Output 2\n\n-2\n\nSample Input 3\n\n----\n\nSample Output 3\n\n-4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 93, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s414802859", "group_id": "codeNet:p03317", "input_text": "n, k = map(int, input().split())\na = list(map(int, input().split()))\n\none = 0\nfor i in range(n):\n if a[i] == 1:\n one = i + 1\n break\n \nfront = -(-(one - 1) // (k - 1))\nback = -(-(n - one) // (k - 1))\n#print(front, back)\nprint(front + back)", "language": "Python", "metadata": {"date": 1585803066, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03317.html", "problem_id": "p03317", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03317/input.txt", "sample_output_relpath": "derived/input_output/data/p03317/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03317/Python/s414802859.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s414802859", "user_id": "u502731482"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n, k = map(int, input().split())\na = list(map(int, input().split()))\n\none = 0\nfor i in range(n):\n if a[i] == 1:\n one = i + 1\n break\n \nfront = -(-(one - 1) // (k - 1))\nback = -(-(n - one) // (k - 1))\n#print(front, back)\nprint(front + back)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.\n\nOn this sequence, Snuke can perform the following operation:\n\nChoose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.\n\nSnuke would like to make all the elements in this sequence equal by repeating the operation above some number of times.\nFind the minimum number of operations required.\nIt can be proved that, Under the constraints of this problem, this objective is always achievable.\n\nConstraints\n\n2 \\leq K \\leq N \\leq 100000\n\nA_1, A_2, ..., A_N is a permutation of 1, 2, ..., N.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4 3\n2 3 1 4\n\nSample Output 1\n\n2\n\nOne optimal strategy is as follows:\n\nIn the first operation, choose the first, second and third elements. The sequence A becomes 1, 1, 1, 4.\n\nIn the second operation, choose the second, third and fourth elements. The sequence A becomes 1, 1, 1, 1.\n\nSample Input 2\n\n3 3\n1 2 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n8 3\n7 3 1 8 4 6 2 5\n\nSample Output 3\n\n4", "sample_input": "4 3\n2 3 1 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03317", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.\n\nOn this sequence, Snuke can perform the following operation:\n\nChoose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.\n\nSnuke would like to make all the elements in this sequence equal by repeating the operation above some number of times.\nFind the minimum number of operations required.\nIt can be proved that, Under the constraints of this problem, this objective is always achievable.\n\nConstraints\n\n2 \\leq K \\leq N \\leq 100000\n\nA_1, A_2, ..., A_N is a permutation of 1, 2, ..., N.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4 3\n2 3 1 4\n\nSample Output 1\n\n2\n\nOne optimal strategy is as follows:\n\nIn the first operation, choose the first, second and third elements. The sequence A becomes 1, 1, 1, 4.\n\nIn the second operation, choose the second, third and fourth elements. The sequence A becomes 1, 1, 1, 1.\n\nSample Input 2\n\n3 3\n1 2 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n8 3\n7 3 1 8 4 6 2 5\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 258, "cpu_time_ms": 47, "memory_kb": 14008}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s282918519", "group_id": "codeNet:p03319", "input_text": "N,K = map(int,input().split())\nA = list(map(int,input().split()))\nind = A.index(1)\nn = ind//(K-1)\nif ind%(K-1):\n n += 1\nm = (N-1-ind)//(K-1)\nif (N-1-ind)%(K-1):\n m += 1\ncmin = n+m\nfor i in range(max(1,ind+K-N),min(ind,K-1)+1):\n n = (ind-i)//(K-1)\n if (ind-i)%(K-1):\n n += 1\n m = (N-ind-K+i)//(K-1)\n if (N-ind-K+i)%(K-1):\n m += 1\n cnt = n+m+1\n cmin = min(cmin,cnt)\nprint(cmin)", "language": "Python", "metadata": {"date": 1601343904, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p03319.html", "problem_id": "p03319", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03319/input.txt", "sample_output_relpath": "derived/input_output/data/p03319/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03319/Python/s282918519.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s282918519", "user_id": "u644907318"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "N,K = map(int,input().split())\nA = list(map(int,input().split()))\nind = A.index(1)\nn = ind//(K-1)\nif ind%(K-1):\n n += 1\nm = (N-1-ind)//(K-1)\nif (N-1-ind)%(K-1):\n m += 1\ncmin = n+m\nfor i in range(max(1,ind+K-N),min(ind,K-1)+1):\n n = (ind-i)//(K-1)\n if (ind-i)%(K-1):\n n += 1\n m = (N-ind-K+i)//(K-1)\n if (N-ind-K+i)%(K-1):\n m += 1\n cnt = n+m+1\n cmin = min(cmin,cnt)\nprint(cmin)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.\n\nOn this sequence, Snuke can perform the following operation:\n\nChoose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.\n\nSnuke would like to make all the elements in this sequence equal by repeating the operation above some number of times.\nFind the minimum number of operations required.\nIt can be proved that, Under the constraints of this problem, this objective is always achievable.\n\nConstraints\n\n2 \\leq K \\leq N \\leq 100000\n\nA_1, A_2, ..., A_N is a permutation of 1, 2, ..., N.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4 3\n2 3 1 4\n\nSample Output 1\n\n2\n\nOne optimal strategy is as follows:\n\nIn the first operation, choose the first, second and third elements. The sequence A becomes 1, 1, 1, 4.\n\nIn the second operation, choose the second, third and fourth elements. The sequence A becomes 1, 1, 1, 1.\n\nSample Input 2\n\n3 3\n1 2 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n8 3\n7 3 1 8 4 6 2 5\n\nSample Output 3\n\n4", "sample_input": "4 3\n2 3 1 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03319", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.\n\nOn this sequence, Snuke can perform the following operation:\n\nChoose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.\n\nSnuke would like to make all the elements in this sequence equal by repeating the operation above some number of times.\nFind the minimum number of operations required.\nIt can be proved that, Under the constraints of this problem, this objective is always achievable.\n\nConstraints\n\n2 \\leq K \\leq N \\leq 100000\n\nA_1, A_2, ..., A_N is a permutation of 1, 2, ..., N.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4 3\n2 3 1 4\n\nSample Output 1\n\n2\n\nOne optimal strategy is as follows:\n\nIn the first operation, choose the first, second and third elements. The sequence A becomes 1, 1, 1, 4.\n\nIn the second operation, choose the second, third and fourth elements. The sequence A becomes 1, 1, 1, 1.\n\nSample Input 2\n\n3 3\n1 2 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n8 3\n7 3 1 8 4 6 2 5\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 413, "cpu_time_ms": 84, "memory_kb": 83280}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s948729379", "group_id": "codeNet:p03320", "input_text": "k = int(input())\nr = 0 # 桁数\nsnuke_list = []\n\ndef snuke(num):\n s = 0\n for i in str(num):\n s += int(i)\n return num/s\n\ndef snuke_check(num):\n n = str(num)\n keta = len(n) # numの桁数\n min_snuke = int(n[0] + '9'*(keta-1))\n if snuke(num) <= snuke(min_snuke):\n return True\n else:\n return False\n\ncount = 0\nwhile count < 2*k:\n for t in range(1, 150):\n num = int(str(t) + '9' * r)\n if snuke_check(num) is True:\n if num not in snuke_list:\n snuke_list.append(num)\n count += 1\n if count >= 2*k:\n break\n r += 1\nsnuke_list.sort()\ncheck = []\nfor n in snuke_list:\n check.append(snuke(n))\nfor i in range(len(check)):\n if check[i] <= min(check[i:]):\n pass\n else:\n snuke_list[i] = -1\n\nfor i in range(k):\n if snuke_list[i] > 0:\n print(snuke_list[i])", "language": "Python", "metadata": {"date": 1557327297, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03320.html", "problem_id": "p03320", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03320/input.txt", "sample_output_relpath": "derived/input_output/data/p03320/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03320/Python/s948729379.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s948729379", "user_id": "u656995812"}, "prompt_components": {"gold_output": "1\n2\n3\n4\n5\n6\n7\n8\n9\n19\n", "input_to_evaluate": "k = int(input())\nr = 0 # 桁数\nsnuke_list = []\n\ndef snuke(num):\n s = 0\n for i in str(num):\n s += int(i)\n return num/s\n\ndef snuke_check(num):\n n = str(num)\n keta = len(n) # numの桁数\n min_snuke = int(n[0] + '9'*(keta-1))\n if snuke(num) <= snuke(min_snuke):\n return True\n else:\n return False\n\ncount = 0\nwhile count < 2*k:\n for t in range(1, 150):\n num = int(str(t) + '9' * r)\n if snuke_check(num) is True:\n if num not in snuke_list:\n snuke_list.append(num)\n count += 1\n if count >= 2*k:\n break\n r += 1\nsnuke_list.sort()\ncheck = []\nfor n in snuke_list:\n check.append(snuke(n))\nfor i in range(len(check)):\n if check[i] <= min(check[i:]):\n pass\n else:\n snuke_list[i] = -1\n\nfor i in range(k):\n if snuke_list[i] > 0:\n print(snuke_list[i])", "problem_context": "Score : 500 points\n\nProblem Statement\n\nLet S(n) denote the sum of the digits in the decimal notation of n.\nFor example, S(123) = 1 + 2 + 3 = 6.\n\nWe will call an integer n a Snuke number when, for all positive integers m such that m > n, \\frac{n}{S(n)} \\leq \\frac{m}{S(m)} holds.\n\nGiven an integer K, list the K smallest Snuke numbers.\n\nConstraints\n\n1 \\leq K\n\nThe K-th smallest Snuke number is not greater than 10^{15}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint K lines. The i-th line should contain the i-th smallest Snuke number.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n1\n2\n3\n4\n5\n6\n7\n8\n9\n19", "sample_input": "10\n"}, "reference_outputs": ["1\n2\n3\n4\n5\n6\n7\n8\n9\n19\n"], "source_document_id": "p03320", "source_text": "Score : 500 points\n\nProblem Statement\n\nLet S(n) denote the sum of the digits in the decimal notation of n.\nFor example, S(123) = 1 + 2 + 3 = 6.\n\nWe will call an integer n a Snuke number when, for all positive integers m such that m > n, \\frac{n}{S(n)} \\leq \\frac{m}{S(m)} holds.\n\nGiven an integer K, list the K smallest Snuke numbers.\n\nConstraints\n\n1 \\leq K\n\nThe K-th smallest Snuke number is not greater than 10^{15}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint K lines. The i-th line should contain the i-th smallest Snuke number.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n1\n2\n3\n4\n5\n6\n7\n8\n9\n19", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 896, "cpu_time_ms": 84, "memory_kb": 3188}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s115821852", "group_id": "codeNet:p03323", "input_text": "# ABC 100: A – Happy Birthday!\na, b = [int(s) for s in input().split()]\nprint('Yay!' if a <= 8 and b <= 8 else ':(')", "language": "Python", "metadata": {"date": 1573064219, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03323.html", "problem_id": "p03323", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03323/input.txt", "sample_output_relpath": "derived/input_output/data/p03323/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03323/Python/s115821852.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s115821852", "user_id": "u276115223"}, "prompt_components": {"gold_output": "Yay!\n", "input_to_evaluate": "# ABC 100: A – Happy Birthday!\na, b = [int(s) for s in input().split()]\nprint('Yay!' if a <= 8 and b <= 8 else ':(')", "problem_context": "Score: 100 points\n\nProblem Statement\n\nE869120's and square1001's 16-th birthday is coming soon.\n\nTakahashi from AtCoder Kingdom gave them a round cake cut into 16 equal fan-shaped pieces.\n\nE869120 and square1001 were just about to eat A and B of those pieces, respectively,\n\nwhen they found a note attached to the cake saying that \"the same person should not take two adjacent pieces of cake\".\n\nCan both of them obey the instruction in the note and take desired numbers of pieces of cake?\n\nConstraints\n\nA and B are integers between 1 and 16 (inclusive).\n\nA+B is at most 16.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf both E869120 and square1001 can obey the instruction in the note and take desired numbers of pieces of cake, print Yay!; otherwise, print :(.\n\nSample Input 1\n\n5 4\n\nSample Output 1\n\nYay!\n\nBoth of them can take desired number of pieces as follows:\n\nSample Input 2\n\n8 8\n\nSample Output 2\n\nYay!\n\nBoth of them can take desired number of pieces as follows:\n\nSample Input 3\n\n11 4\n\nSample Output 3\n\n:(\n\nIn this case, there is no way for them to take desired number of pieces, unfortunately.", "sample_input": "5 4\n"}, "reference_outputs": ["Yay!\n"], "source_document_id": "p03323", "source_text": "Score: 100 points\n\nProblem Statement\n\nE869120's and square1001's 16-th birthday is coming soon.\n\nTakahashi from AtCoder Kingdom gave them a round cake cut into 16 equal fan-shaped pieces.\n\nE869120 and square1001 were just about to eat A and B of those pieces, respectively,\n\nwhen they found a note attached to the cake saying that \"the same person should not take two adjacent pieces of cake\".\n\nCan both of them obey the instruction in the note and take desired numbers of pieces of cake?\n\nConstraints\n\nA and B are integers between 1 and 16 (inclusive).\n\nA+B is at most 16.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf both E869120 and square1001 can obey the instruction in the note and take desired numbers of pieces of cake, print Yay!; otherwise, print :(.\n\nSample Input 1\n\n5 4\n\nSample Output 1\n\nYay!\n\nBoth of them can take desired number of pieces as follows:\n\nSample Input 2\n\n8 8\n\nSample Output 2\n\nYay!\n\nBoth of them can take desired number of pieces as follows:\n\nSample Input 3\n\n11 4\n\nSample Output 3\n\n:(\n\nIn this case, there is no way for them to take desired number of pieces, unfortunately.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 118, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s729677608", "group_id": "codeNet:p03326", "input_text": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport itertools\nimport numpy as np\n\n# 入力受け取り\nN, M = map(lambda x: int(x), input().split())\ncake_scores = [[] for _ in range(N)]\nfor i in range(N):\n cake_scores[i] = [int(j) for j in input().split()] # print(score)\n\ncake_id = np.arange(N) # cakeのID\nchosen_cakes_scores = [] # スコアのまとめ\nfor cake_choice in itertools.combinations(cake_id, M):\n cakes = np.array([cake_scores[i] for i in cake_choice]) # cakes [[スコア], [スコア]...]\n box = np.zeros(len(cakes[0])) # shape (1, 3)\n for i in cakes:\n box += i\n chosen_cakes_scores.append(np.sum(abs(box)))\n\nprint(int(max(chosen_cakes_scores)))\n", "language": "Python", "metadata": {"date": 1529215986, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03326.html", "problem_id": "p03326", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03326/input.txt", "sample_output_relpath": "derived/input_output/data/p03326/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03326/Python/s729677608.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s729677608", "user_id": "u870998297"}, "prompt_components": {"gold_output": "56\n", "input_to_evaluate": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport itertools\nimport numpy as np\n\n# 入力受け取り\nN, M = map(lambda x: int(x), input().split())\ncake_scores = [[] for _ in range(N)]\nfor i in range(N):\n cake_scores[i] = [int(j) for j in input().split()] # print(score)\n\ncake_id = np.arange(N) # cakeのID\nchosen_cakes_scores = [] # スコアのまとめ\nfor cake_choice in itertools.combinations(cake_id, M):\n cakes = np.array([cake_scores[i] for i in cake_choice]) # cakes [[スコア], [スコア]...]\n box = np.zeros(len(cakes[0])) # shape (1, 3)\n for i in cakes:\n box += i\n chosen_cakes_scores.append(np.sum(abs(box)))\n\nprint(int(max(chosen_cakes_scores)))\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nTakahashi became a pastry chef and opened a shop La Confiserie d'ABC to celebrate AtCoder Beginner Contest 100.\n\nThe shop sells N kinds of cakes.\n\nEach kind of cake has three parameters \"beauty\", \"tastiness\" and \"popularity\". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i.\n\nThese values may be zero or negative.\n\nRingo has decided to have M pieces of cakes here. He will choose the set of cakes as follows:\n\nDo not have two or more pieces of the same kind of cake.\n\nUnder the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity).\n\nFind the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.\n\nConstraints\n\nN is an integer between 1 and 1 \\ 000 (inclusive).\n\nM is an integer between 0 and N (inclusive).\n\nx_i, y_i, z_i \\ (1 \\leq i \\leq N) are integers between -10 \\ 000 \\ 000 \\ 000 and 10 \\ 000 \\ 000 \\ 000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nx_1 y_1 z_1\nx_2 y_2 z_2\n: :\nx_N y_N z_N\n\nOutput\n\nPrint the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.\n\nSample Input 1\n\n5 3\n3 1 4\n1 5 9\n2 6 5\n3 5 8\n9 7 9\n\nSample Output 1\n\n56\n\nConsider having the 2-nd, 4-th and 5-th kinds of cakes. The total beauty, tastiness and popularity will be as follows:\n\nBeauty: 1 + 3 + 9 = 13\n\nTastiness: 5 + 5 + 7 = 17\n\nPopularity: 9 + 8 + 9 = 26\n\nThe value (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) here is 13 + 17 + 26 = 56. This is the maximum value.\n\nSample Input 2\n\n5 3\n1 -2 3\n-4 5 -6\n7 -8 -9\n-10 11 -12\n13 -14 15\n\nSample Output 2\n\n54\n\nConsider having the 1-st, 3-rd and 5-th kinds of cakes. The total beauty, tastiness and popularity will be as follows:\n\nBeauty: 1 + 7 + 13 = 21\n\nTastiness: (-2) + (-8) + (-14) = -24\n\nPopularity: 3 + (-9) + 15 = 9\n\nThe value (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) here is 21 + 24 + 9 = 54. This is the maximum value.\n\nSample Input 3\n\n10 5\n10 -80 21\n23 8 38\n-94 28 11\n-26 -2 18\n-69 72 79\n-26 -86 -54\n-72 -50 59\n21 65 -32\n40 -94 87\n-62 18 82\n\nSample Output 3\n\n638\n\nIf we have the 3-rd, 4-th, 5-th, 7-th and 10-th kinds of cakes, the total beauty, tastiness and popularity will be -323, 66 and 249, respectively.\n\nThe value (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) here is 323 + 66 + 249 = 638. This is the maximum value.\n\nSample Input 4\n\n3 2\n2000000000 -9000000000 4000000000\n7000000000 -5000000000 3000000000\n6000000000 -1000000000 8000000000\n\nSample Output 4\n\n30000000000\n\nThe values of the beauty, tastiness and popularity of the cakes and the value to be printed may not fit into 32-bit integers.", "sample_input": "5 3\n3 1 4\n1 5 9\n2 6 5\n3 5 8\n9 7 9\n"}, "reference_outputs": ["56\n"], "source_document_id": "p03326", "source_text": "Score: 400 points\n\nProblem Statement\n\nTakahashi became a pastry chef and opened a shop La Confiserie d'ABC to celebrate AtCoder Beginner Contest 100.\n\nThe shop sells N kinds of cakes.\n\nEach kind of cake has three parameters \"beauty\", \"tastiness\" and \"popularity\". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i.\n\nThese values may be zero or negative.\n\nRingo has decided to have M pieces of cakes here. He will choose the set of cakes as follows:\n\nDo not have two or more pieces of the same kind of cake.\n\nUnder the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity).\n\nFind the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.\n\nConstraints\n\nN is an integer between 1 and 1 \\ 000 (inclusive).\n\nM is an integer between 0 and N (inclusive).\n\nx_i, y_i, z_i \\ (1 \\leq i \\leq N) are integers between -10 \\ 000 \\ 000 \\ 000 and 10 \\ 000 \\ 000 \\ 000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nx_1 y_1 z_1\nx_2 y_2 z_2\n: :\nx_N y_N z_N\n\nOutput\n\nPrint the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.\n\nSample Input 1\n\n5 3\n3 1 4\n1 5 9\n2 6 5\n3 5 8\n9 7 9\n\nSample Output 1\n\n56\n\nConsider having the 2-nd, 4-th and 5-th kinds of cakes. The total beauty, tastiness and popularity will be as follows:\n\nBeauty: 1 + 3 + 9 = 13\n\nTastiness: 5 + 5 + 7 = 17\n\nPopularity: 9 + 8 + 9 = 26\n\nThe value (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) here is 13 + 17 + 26 = 56. This is the maximum value.\n\nSample Input 2\n\n5 3\n1 -2 3\n-4 5 -6\n7 -8 -9\n-10 11 -12\n13 -14 15\n\nSample Output 2\n\n54\n\nConsider having the 1-st, 3-rd and 5-th kinds of cakes. The total beauty, tastiness and popularity will be as follows:\n\nBeauty: 1 + 7 + 13 = 21\n\nTastiness: (-2) + (-8) + (-14) = -24\n\nPopularity: 3 + (-9) + 15 = 9\n\nThe value (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) here is 21 + 24 + 9 = 54. This is the maximum value.\n\nSample Input 3\n\n10 5\n10 -80 21\n23 8 38\n-94 28 11\n-26 -2 18\n-69 72 79\n-26 -86 -54\n-72 -50 59\n21 65 -32\n40 -94 87\n-62 18 82\n\nSample Output 3\n\n638\n\nIf we have the 3-rd, 4-th, 5-th, 7-th and 10-th kinds of cakes, the total beauty, tastiness and popularity will be -323, 66 and 249, respectively.\n\nThe value (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) here is 323 + 66 + 249 = 638. This is the maximum value.\n\nSample Input 4\n\n3 2\n2000000000 -9000000000 4000000000\n7000000000 -5000000000 3000000000\n6000000000 -1000000000 8000000000\n\nSample Output 4\n\n30000000000\n\nThe values of the beauty, tastiness and popularity of the cakes and the value to be printed may not fit into 32-bit integers.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 693, "cpu_time_ms": 2108, "memory_kb": 21596}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s840572401", "group_id": "codeNet:p03327", "input_text": "N = int(input())\nif N <= 999:\n print(\"ABC\")\nelse:\n print(\"ABD\")", "language": "Python", "metadata": {"date": 1566492362, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03327.html", "problem_id": "p03327", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03327/input.txt", "sample_output_relpath": "derived/input_output/data/p03327/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03327/Python/s840572401.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s840572401", "user_id": "u122195031"}, "prompt_components": {"gold_output": "ABC\n", "input_to_evaluate": "N = int(input())\nif N <= 999:\n print(\"ABC\")\nelse:\n print(\"ABD\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nDecades have passed since the beginning of AtCoder Beginner Contest.\n\nThe contests are labeled as ABC001, ABC002, ... from the first round, but after the 999-th round ABC999, a problem occurred: how the future rounds should be labeled?\n\nIn the end, the labels for the rounds from the 1000-th to the 1998-th are decided: ABD001, ABD002, ..., ABD999.\n\nYou are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.\n\nConstraints\n\n1 \\leq N \\leq 1998\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 first three characters of the label of the N-th round of AtCoder Beginner Contest.\n\nSample Input 1\n\n999\n\nSample Output 1\n\nABC\n\nThe 999-th round of AtCoder Beginner Contest is labeled as ABC999.\n\nSample Input 2\n\n1000\n\nSample Output 2\n\nABD\n\nThe 1000-th round of AtCoder Beginner Contest is labeled as ABD001.\n\nSample Input 3\n\n1481\n\nSample Output 3\n\nABD\n\nThe 1481-th round of AtCoder Beginner Contest is labeled as ABD482.", "sample_input": "999\n"}, "reference_outputs": ["ABC\n"], "source_document_id": "p03327", "source_text": "Score : 100 points\n\nProblem Statement\n\nDecades have passed since the beginning of AtCoder Beginner Contest.\n\nThe contests are labeled as ABC001, ABC002, ... from the first round, but after the 999-th round ABC999, a problem occurred: how the future rounds should be labeled?\n\nIn the end, the labels for the rounds from the 1000-th to the 1998-th are decided: ABD001, ABD002, ..., ABD999.\n\nYou are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.\n\nConstraints\n\n1 \\leq N \\leq 1998\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 first three characters of the label of the N-th round of AtCoder Beginner Contest.\n\nSample Input 1\n\n999\n\nSample Output 1\n\nABC\n\nThe 999-th round of AtCoder Beginner Contest is labeled as ABC999.\n\nSample Input 2\n\n1000\n\nSample Output 2\n\nABD\n\nThe 1000-th round of AtCoder Beginner Contest is labeled as ABD001.\n\nSample Input 3\n\n1481\n\nSample Output 3\n\nABD\n\nThe 1481-th round of AtCoder Beginner Contest is labeled as ABD482.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 69, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s024981556", "group_id": "codeNet:p03327", "input_text": "N = input()\n\nif len(N) < 4:\n print(\"ABC\")\nelse:\n print(\"ABD\")", "language": "Python", "metadata": {"date": 1528684378, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03327.html", "problem_id": "p03327", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03327/input.txt", "sample_output_relpath": "derived/input_output/data/p03327/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03327/Python/s024981556.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s024981556", "user_id": "u923794601"}, "prompt_components": {"gold_output": "ABC\n", "input_to_evaluate": "N = input()\n\nif len(N) < 4:\n print(\"ABC\")\nelse:\n print(\"ABD\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nDecades have passed since the beginning of AtCoder Beginner Contest.\n\nThe contests are labeled as ABC001, ABC002, ... from the first round, but after the 999-th round ABC999, a problem occurred: how the future rounds should be labeled?\n\nIn the end, the labels for the rounds from the 1000-th to the 1998-th are decided: ABD001, ABD002, ..., ABD999.\n\nYou are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.\n\nConstraints\n\n1 \\leq N \\leq 1998\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 first three characters of the label of the N-th round of AtCoder Beginner Contest.\n\nSample Input 1\n\n999\n\nSample Output 1\n\nABC\n\nThe 999-th round of AtCoder Beginner Contest is labeled as ABC999.\n\nSample Input 2\n\n1000\n\nSample Output 2\n\nABD\n\nThe 1000-th round of AtCoder Beginner Contest is labeled as ABD001.\n\nSample Input 3\n\n1481\n\nSample Output 3\n\nABD\n\nThe 1481-th round of AtCoder Beginner Contest is labeled as ABD482.", "sample_input": "999\n"}, "reference_outputs": ["ABC\n"], "source_document_id": "p03327", "source_text": "Score : 100 points\n\nProblem Statement\n\nDecades have passed since the beginning of AtCoder Beginner Contest.\n\nThe contests are labeled as ABC001, ABC002, ... from the first round, but after the 999-th round ABC999, a problem occurred: how the future rounds should be labeled?\n\nIn the end, the labels for the rounds from the 1000-th to the 1998-th are decided: ABD001, ABD002, ..., ABD999.\n\nYou are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.\n\nConstraints\n\n1 \\leq N \\leq 1998\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 first three characters of the label of the N-th round of AtCoder Beginner Contest.\n\nSample Input 1\n\n999\n\nSample Output 1\n\nABC\n\nThe 999-th round of AtCoder Beginner Contest is labeled as ABC999.\n\nSample Input 2\n\n1000\n\nSample Output 2\n\nABD\n\nThe 1000-th round of AtCoder Beginner Contest is labeled as ABD001.\n\nSample Input 3\n\n1481\n\nSample Output 3\n\nABD\n\nThe 1481-th round of AtCoder Beginner Contest is labeled as ABD482.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 67, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s935541399", "group_id": "codeNet:p03328", "input_text": "a,b=map(int,input().split())\nprint(sum(i for i in range(b-a))-a)", "language": "Python", "metadata": {"date": 1580451897, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03328.html", "problem_id": "p03328", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03328/input.txt", "sample_output_relpath": "derived/input_output/data/p03328/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03328/Python/s935541399.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s935541399", "user_id": "u133936772"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "a,b=map(int,input().split())\nprint(sum(i for i in range(b-a))-a)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIn some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter.\n\nIt had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower.\n\nAssuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover.\n\nAssume also that the depth of the snow cover is always at least 1 meter.\n\nConstraints\n\n1 \\leq a < b < 499500(=1+2+3+...+999)\n\nAll values in input are integers.\n\nThere is no input that contradicts the assumption.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the depth of the snow cover is x meters, print x as an integer.\n\nSample Input 1\n\n8 13\n\nSample Output 1\n\n2\n\nThe heights of the two towers are 10 meters and 15 meters, respectively.\nThus, we can see that the depth of the snow cover is 2 meters.\n\nSample Input 2\n\n54 65\n\nSample Output 2\n\n1", "sample_input": "8 13\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03328", "source_text": "Score : 200 points\n\nProblem Statement\n\nIn some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter.\n\nIt had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower.\n\nAssuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover.\n\nAssume also that the depth of the snow cover is always at least 1 meter.\n\nConstraints\n\n1 \\leq a < b < 499500(=1+2+3+...+999)\n\nAll values in input are integers.\n\nThere is no input that contradicts the assumption.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the depth of the snow cover is x meters, print x as an integer.\n\nSample Input 1\n\n8 13\n\nSample Output 1\n\n2\n\nThe heights of the two towers are 10 meters and 15 meters, respectively.\nThus, we can see that the depth of the snow cover is 2 meters.\n\nSample Input 2\n\n54 65\n\nSample Output 2\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 64, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s146400634", "group_id": "codeNet:p03328", "input_text": "a, b = map(int, input().split())\nl = []\nfor i in range(1, 1000):\n\tl.append(i*(i+1)//2)\nfor i in range(1, 1000):\n\tif a+i in l and b+i in l:\n\t\tprint(i)\n\t\tbreak", "language": "Python", "metadata": {"date": 1566871468, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03328.html", "problem_id": "p03328", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03328/input.txt", "sample_output_relpath": "derived/input_output/data/p03328/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03328/Python/s146400634.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s146400634", "user_id": "u054559808"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "a, b = map(int, input().split())\nl = []\nfor i in range(1, 1000):\n\tl.append(i*(i+1)//2)\nfor i in range(1, 1000):\n\tif a+i in l and b+i in l:\n\t\tprint(i)\n\t\tbreak", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIn some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter.\n\nIt had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower.\n\nAssuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover.\n\nAssume also that the depth of the snow cover is always at least 1 meter.\n\nConstraints\n\n1 \\leq a < b < 499500(=1+2+3+...+999)\n\nAll values in input are integers.\n\nThere is no input that contradicts the assumption.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the depth of the snow cover is x meters, print x as an integer.\n\nSample Input 1\n\n8 13\n\nSample Output 1\n\n2\n\nThe heights of the two towers are 10 meters and 15 meters, respectively.\nThus, we can see that the depth of the snow cover is 2 meters.\n\nSample Input 2\n\n54 65\n\nSample Output 2\n\n1", "sample_input": "8 13\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03328", "source_text": "Score : 200 points\n\nProblem Statement\n\nIn some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter.\n\nIt had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower.\n\nAssuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover.\n\nAssume also that the depth of the snow cover is always at least 1 meter.\n\nConstraints\n\n1 \\leq a < b < 499500(=1+2+3+...+999)\n\nAll values in input are integers.\n\nThere is no input that contradicts the assumption.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the depth of the snow cover is x meters, print x as an integer.\n\nSample Input 1\n\n8 13\n\nSample Output 1\n\n2\n\nThe heights of the two towers are 10 meters and 15 meters, respectively.\nThus, we can see that the depth of the snow cover is 2 meters.\n\nSample Input 2\n\n54 65\n\nSample Output 2\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 157, "cpu_time_ms": 178, "memory_kb": 38384}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s238653187", "group_id": "codeNet:p03329", "input_text": "from math import log\nn = int(input())\n\n\ndef make_list(n, x):\n return [x ** i for i in range(1, int(log(n, x))+1)]\n\n\nsixes = make_list(n, 6)\nnines = make_list(n, 9)\nnums = [1] + sixes + nines\n\ndp = [float('inf')] * (n+1)\nfor num in nums:\n for i in range(1, n+1):\n if i == num:\n dp[i] = 1\n elif i > num:\n dp[i] = min(dp[i], dp[i-num]+1)\nprint(dp[n])\n", "language": "Python", "metadata": {"date": 1580158047, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03329.html", "problem_id": "p03329", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03329/input.txt", "sample_output_relpath": "derived/input_output/data/p03329/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03329/Python/s238653187.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s238653187", "user_id": "u708255304"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "from math import log\nn = int(input())\n\n\ndef make_list(n, x):\n return [x ** i for i in range(1, int(log(n, x))+1)]\n\n\nsixes = make_list(n, 6)\nnines = make_list(n, 9)\nnums = [1] + sixes + nines\n\ndp = [float('inf')] * (n+1)\nfor num in nums:\n for i in range(1, n+1):\n if i == num:\n dp[i] = 1\n elif i > num:\n dp[i] = min(dp[i], dp[i-num]+1)\nprint(dp[n])\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTo make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation:\n\n1 yen (the currency of Japan)\n\n6 yen, 6^2(=36) yen, 6^3(=216) yen, ...\n\n9 yen, 9^2(=81) yen, 9^3(=729) yen, ...\n\nAt least how many operations are required to withdraw exactly N yen in total?\n\nIt is not allowed to re-deposit the money you withdrew.\n\nConstraints\n\n1 \\leq N \\leq 100000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf at least x operations are required to withdraw exactly N yen in total, print x.\n\nSample Input 1\n\n127\n\nSample Output 1\n\n4\n\nBy withdrawing 1 yen, 9 yen, 36(=6^2) yen and 81(=9^2) yen, we can withdraw 127 yen in four operations.\n\nSample Input 2\n\n3\n\nSample Output 2\n\n3\n\nBy withdrawing 1 yen three times, we can withdraw 3 yen in three operations.\n\nSample Input 3\n\n44852\n\nSample Output 3\n\n16", "sample_input": "127\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03329", "source_text": "Score : 300 points\n\nProblem Statement\n\nTo make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation:\n\n1 yen (the currency of Japan)\n\n6 yen, 6^2(=36) yen, 6^3(=216) yen, ...\n\n9 yen, 9^2(=81) yen, 9^3(=729) yen, ...\n\nAt least how many operations are required to withdraw exactly N yen in total?\n\nIt is not allowed to re-deposit the money you withdrew.\n\nConstraints\n\n1 \\leq N \\leq 100000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf at least x operations are required to withdraw exactly N yen in total, print x.\n\nSample Input 1\n\n127\n\nSample Output 1\n\n4\n\nBy withdrawing 1 yen, 9 yen, 36(=6^2) yen and 81(=9^2) yen, we can withdraw 127 yen in four operations.\n\nSample Input 2\n\n3\n\nSample Output 2\n\n3\n\nBy withdrawing 1 yen three times, we can withdraw 3 yen in three operations.\n\nSample Input 3\n\n44852\n\nSample Output 3\n\n16", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 390, "cpu_time_ms": 597, "memory_kb": 6900}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s329741955", "group_id": "codeNet:p03331", "input_text": "n = int(input())\ndef f(x):\n x%10+f(x//10) if x else 0\nprint(min([f(i)+f(n-i) for i in range(0,n+1)]))", "language": "Python", "metadata": {"date": 1588217678, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03331.html", "problem_id": "p03331", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03331/input.txt", "sample_output_relpath": "derived/input_output/data/p03331/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03331/Python/s329741955.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s329741955", "user_id": "u548624367"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "n = int(input())\ndef f(x):\n x%10+f(x//10) if x else 0\nprint(min([f(i)+f(n-i) for i in range(0,n+1)]))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has two positive integers A and B.\n\nIt is known that A plus B equals N.\nFind the minimum possible value of \"the sum of the digits of A\" plus \"the sum of the digits of B\" (in base 10).\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum possible value of \"the sum of the digits of A\" plus \"the sum of the digits of B\".\n\nSample Input 1\n\n15\n\nSample Output 1\n\n6\n\nWhen A=2 and B=13, the sums of their digits are 2 and 4, which minimizes the value in question.\n\nSample Input 2\n\n100000\n\nSample Output 2\n\n10", "sample_input": "15\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03331", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has two positive integers A and B.\n\nIt is known that A plus B equals N.\nFind the minimum possible value of \"the sum of the digits of A\" plus \"the sum of the digits of B\" (in base 10).\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum possible value of \"the sum of the digits of A\" plus \"the sum of the digits of B\".\n\nSample Input 1\n\n15\n\nSample Output 1\n\n6\n\nWhen A=2 and B=13, the sums of their digits are 2 and 4, which minimizes the value in question.\n\nSample Input 2\n\n100000\n\nSample Output 2\n\n10", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 104, "cpu_time_ms": 18, "memory_kb": 3164}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s263502480", "group_id": "codeNet:p03337", "input_text": "import math, sys\nfrom bisect import bisect_left, bisect_right\nfrom collections import Counter, defaultdict, deque\nfrom copy import deepcopy\nfrom functools import lru_cache\nfrom heapq import heapify, heappop, heappush\nfrom itertools import accumulate, combinations, permutations\ninput = sys.stdin.readline\nmod = 10**9 + 7\nns = lambda: input().strip()\nni = lambda: int(input().strip())\nnm = lambda: map(int, input().split())\nnl = lambda: list(map(int, input().split()))\n\na, b = nm()\n\nprint(max([a + b, a - b, a * b]))", "language": "Python", "metadata": {"date": 1587171362, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03337.html", "problem_id": "p03337", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03337/input.txt", "sample_output_relpath": "derived/input_output/data/p03337/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03337/Python/s263502480.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s263502480", "user_id": "u047023156"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "import math, sys\nfrom bisect import bisect_left, bisect_right\nfrom collections import Counter, defaultdict, deque\nfrom copy import deepcopy\nfrom functools import lru_cache\nfrom heapq import heapify, heappop, heappush\nfrom itertools import accumulate, combinations, permutations\ninput = sys.stdin.readline\nmod = 10**9 + 7\nns = lambda: input().strip()\nni = lambda: int(input().strip())\nnm = lambda: map(int, input().split())\nnl = lambda: list(map(int, input().split()))\n\na, b = nm()\n\nprint(max([a + b, a - b, a * b]))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given two integers A and B.\nFind the largest value among A+B, A-B and A \\times B.\n\nConstraints\n\n-1000 \\leq A,B \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the largest value among A+B, A-B and A \\times B.\n\nSample Input 1\n\n3 1\n\nSample Output 1\n\n4\n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\nSample Input 2\n\n4 -2\n\nSample Output 2\n\n6\n\nThe largest is 4 - (-2) = 6.\n\nSample Input 3\n\n0 0\n\nSample Output 3\n\n0", "sample_input": "3 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03337", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given two integers A and B.\nFind the largest value among A+B, A-B and A \\times B.\n\nConstraints\n\n-1000 \\leq A,B \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the largest value among A+B, A-B and A \\times B.\n\nSample Input 1\n\n3 1\n\nSample Output 1\n\n4\n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\nSample Input 2\n\n4 -2\n\nSample Output 2\n\n6\n\nThe largest is 4 - (-2) = 6.\n\nSample Input 3\n\n0 0\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 515, "cpu_time_ms": 24, "memory_kb": 3700}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s163525945", "group_id": "codeNet:p03337", "input_text": "a,b = map(int,input().split())\n\nprint(max(a+b, a-b, a*b))", "language": "Python", "metadata": {"date": 1538772477, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03337.html", "problem_id": "p03337", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03337/input.txt", "sample_output_relpath": "derived/input_output/data/p03337/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03337/Python/s163525945.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s163525945", "user_id": "u790877102"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "a,b = map(int,input().split())\n\nprint(max(a+b, a-b, a*b))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given two integers A and B.\nFind the largest value among A+B, A-B and A \\times B.\n\nConstraints\n\n-1000 \\leq A,B \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the largest value among A+B, A-B and A \\times B.\n\nSample Input 1\n\n3 1\n\nSample Output 1\n\n4\n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\nSample Input 2\n\n4 -2\n\nSample Output 2\n\n6\n\nThe largest is 4 - (-2) = 6.\n\nSample Input 3\n\n0 0\n\nSample Output 3\n\n0", "sample_input": "3 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03337", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given two integers A and B.\nFind the largest value among A+B, A-B and A \\times B.\n\nConstraints\n\n-1000 \\leq A,B \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the largest value among A+B, A-B and A \\times B.\n\nSample Input 1\n\n3 1\n\nSample Output 1\n\n4\n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\nSample Input 2\n\n4 -2\n\nSample Output 2\n\n6\n\nThe largest is 4 - (-2) = 6.\n\nSample Input 3\n\n0 0\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 57, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s603492169", "group_id": "codeNet:p03338", "input_text": "n=int(input())\ns=list(input().strip())\nans=0\nfor i in range(n):\n s1=set(s[:i])\n s2=set(s[i:])\n ans=max(ans,len(s1 & s2))\nprint(ans)", "language": "Python", "metadata": {"date": 1527507902, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03338.html", "problem_id": "p03338", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03338/input.txt", "sample_output_relpath": "derived/input_output/data/p03338/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03338/Python/s603492169.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s603492169", "user_id": "u846150137"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n=int(input())\ns=list(input().strip())\nans=0\nfor i in range(n):\n s1=set(s[:i])\n s2=set(s[i:])\n ans=max(ans,len(s1 & s2))\nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of lowercase English letters.\nWe will cut this string at one position into two strings X and Y.\nHere, we would like to maximize the number of different letters contained in both X and Y.\nFind the largest possible number of different letters contained in both X and Y when we cut the string at the optimal position.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n|S| = N\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the largest possible number of different letters contained in both X and Y.\n\nSample Input 1\n\n6\naabbca\n\nSample Output 1\n\n2\n\nIf we cut the string between the third and fourth letters into X = aab and Y = bca, the letters contained in both X and Y are a and b.\nThere will never be three or more different letters contained in both X and Y, so the answer is 2.\n\nSample Input 2\n\n10\naaaaaaaaaa\n\nSample Output 2\n\n1\n\nHowever we divide S, only a will be contained in both X and Y.\n\nSample Input 3\n\n45\ntgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir\n\nSample Output 3\n\n9", "sample_input": "6\naabbca\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03338", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of lowercase English letters.\nWe will cut this string at one position into two strings X and Y.\nHere, we would like to maximize the number of different letters contained in both X and Y.\nFind the largest possible number of different letters contained in both X and Y when we cut the string at the optimal position.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n|S| = N\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the largest possible number of different letters contained in both X and Y.\n\nSample Input 1\n\n6\naabbca\n\nSample Output 1\n\n2\n\nIf we cut the string between the third and fourth letters into X = aab and Y = bca, the letters contained in both X and Y are a and b.\nThere will never be three or more different letters contained in both X and Y, so the answer is 2.\n\nSample Input 2\n\n10\naaaaaaaaaa\n\nSample Output 2\n\n1\n\nHowever we divide S, only a will be contained in both X and Y.\n\nSample Input 3\n\n45\ntgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir\n\nSample Output 3\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 134, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s928254558", "group_id": "codeNet:p03341", "input_text": "n = int(input())\nS = [s for s in input()]\nans = float('inf')\nfor i in range(n):\n #print(S[:i],S[i+1:])\n ans = min(ans,S[:i].count('W')+S[i+1:].count('E'))\nprint(ans)\n", "language": "Python", "metadata": {"date": 1560542628, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03341.html", "problem_id": "p03341", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03341/input.txt", "sample_output_relpath": "derived/input_output/data/p03341/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03341/Python/s928254558.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s928254558", "user_id": "u614734359"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "n = int(input())\nS = [s for s in input()]\nans = float('inf')\nfor i in range(n):\n #print(S[:i],S[i+1:])\n ans = min(ans,S[:i].count('W')+S[i+1:].count('E'))\nprint(ans)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people standing in a row from west to east.\nEach person is facing east or west.\nThe directions of the people is given as a string S of length N.\nThe i-th person from the west is facing east if S_i = E, and west if S_i = W.\n\nYou will appoint one of the N people as the leader, then command the rest of them to face in the direction of the leader.\nHere, we do not care which direction the leader is facing.\n\nThe people in the row hate to change their directions, so you would like to select the leader so that the number of people who have to change their directions is minimized.\nFind the minimum number of people who have to change their directions.\n\nConstraints\n\n2 \\leq N \\leq 3 \\times 10^5\n\n|S| = N\n\nS_i is E or W.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of people who have to change their directions.\n\nSample Input 1\n\n5\nWEEWW\n\nSample Output 1\n\n1\n\nAssume that we appoint the third person from the west as the leader.\nThen, the first person from the west needs to face east and has to turn around.\nThe other people do not need to change their directions, so the number of people who have to change their directions is 1 in this case.\nIt is not possible to have 0 people who have to change their directions, so the answer is 1.\n\nSample Input 2\n\n12\nWEWEWEEEWWWE\n\nSample Output 2\n\n4\n\nSample Input 3\n\n8\nWWWWWEEE\n\nSample Output 3\n\n3", "sample_input": "5\nWEEWW\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03341", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people standing in a row from west to east.\nEach person is facing east or west.\nThe directions of the people is given as a string S of length N.\nThe i-th person from the west is facing east if S_i = E, and west if S_i = W.\n\nYou will appoint one of the N people as the leader, then command the rest of them to face in the direction of the leader.\nHere, we do not care which direction the leader is facing.\n\nThe people in the row hate to change their directions, so you would like to select the leader so that the number of people who have to change their directions is minimized.\nFind the minimum number of people who have to change their directions.\n\nConstraints\n\n2 \\leq N \\leq 3 \\times 10^5\n\n|S| = N\n\nS_i is E or W.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of people who have to change their directions.\n\nSample Input 1\n\n5\nWEEWW\n\nSample Output 1\n\n1\n\nAssume that we appoint the third person from the west as the leader.\nThen, the first person from the west needs to face east and has to turn around.\nThe other people do not need to change their directions, so the number of people who have to change their directions is 1 in this case.\nIt is not possible to have 0 people who have to change their directions, so the answer is 1.\n\nSample Input 2\n\n12\nWEWEWEEEWWWE\n\nSample Output 2\n\n4\n\nSample Input 3\n\n8\nWWWWWEEE\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 172, "cpu_time_ms": 2104, "memory_kb": 8144}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s644138295", "group_id": "codeNet:p03351", "input_text": "a,b,c,d = map(int,input().split())\nif abs(a-c) <= d or (abs(a-b) <= d and abs(b-c)<=d):\n print('Yes')\nelse:\n print('No')", "language": "Python", "metadata": {"date": 1550598435, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03351.html", "problem_id": "p03351", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03351/input.txt", "sample_output_relpath": "derived/input_output/data/p03351/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03351/Python/s644138295.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s644138295", "user_id": "u282228874"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "a,b,c,d = map(int,input().split())\nif abs(a-c) <= d or (abs(a-b) <= d and abs(b-c)<=d):\n print('Yes')\nelse:\n print('No')", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThree people, A, B and C, are trying to communicate using transceivers.\nThey are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively.\nTwo people can directly communicate when the distance between them is at most d meters.\nDetermine if A and C can communicate, either directly or indirectly.\nHere, A and C can indirectly communicate when A and B can directly communicate and also B and C can directly communicate.\n\nConstraints\n\n1 ≤ a,b,c ≤ 100\n\n1 ≤ d ≤ 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nIf A and C can communicate, print Yes; if they cannot, print No.\n\nSample Input 1\n\n4 7 9 3\n\nSample Output 1\n\nYes\n\nA and B can directly communicate, and also B and C can directly communicate, so we should print Yes.\n\nSample Input 2\n\n100 10 1 2\n\nSample Output 2\n\nNo\n\nThey cannot communicate in this case.\n\nSample Input 3\n\n10 10 10 1\n\nSample Output 3\n\nYes\n\nThere can be multiple people at the same position.\n\nSample Input 4\n\n1 100 2 10\n\nSample Output 4\n\nYes", "sample_input": "4 7 9 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03351", "source_text": "Score : 100 points\n\nProblem Statement\n\nThree people, A, B and C, are trying to communicate using transceivers.\nThey are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively.\nTwo people can directly communicate when the distance between them is at most d meters.\nDetermine if A and C can communicate, either directly or indirectly.\nHere, A and C can indirectly communicate when A and B can directly communicate and also B and C can directly communicate.\n\nConstraints\n\n1 ≤ a,b,c ≤ 100\n\n1 ≤ d ≤ 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nIf A and C can communicate, print Yes; if they cannot, print No.\n\nSample Input 1\n\n4 7 9 3\n\nSample Output 1\n\nYes\n\nA and B can directly communicate, and also B and C can directly communicate, so we should print Yes.\n\nSample Input 2\n\n100 10 1 2\n\nSample Output 2\n\nNo\n\nThey cannot communicate in this case.\n\nSample Input 3\n\n10 10 10 1\n\nSample Output 3\n\nYes\n\nThere can be multiple people at the same position.\n\nSample Input 4\n\n1 100 2 10\n\nSample Output 4\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 126, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s771547751", "group_id": "codeNet:p03352", "input_text": "import sys\nX = int(input())\nL = []\nfor i in range(1,32):\n for j in range(2,10):\n if X <= i**j:\n L.append(i**(j-1))\n break\nprint(max(L))\n\t\t", "language": "Python", "metadata": {"date": 1579698502, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03352.html", "problem_id": "p03352", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03352/input.txt", "sample_output_relpath": "derived/input_output/data/p03352/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03352/Python/s771547751.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s771547751", "user_id": "u617037231"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "import sys\nX = int(input())\nL = []\nfor i in range(1,32):\n for j in range(2,10):\n if X <= i**j:\n L.append(i**(j-1))\n break\nprint(max(L))\n\t\t", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a positive integer X.\nFind the largest perfect power that is at most X.\nHere, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.\n\nConstraints\n\n1 ≤ X ≤ 1000\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the largest perfect power that is at most X.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\nThere are four perfect powers that are at most 10: 1, 4, 8 and 9.\nWe should print the largest among them, 9.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n999\n\nSample Output 3\n\n961", "sample_input": "10\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03352", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a positive integer X.\nFind the largest perfect power that is at most X.\nHere, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.\n\nConstraints\n\n1 ≤ X ≤ 1000\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the largest perfect power that is at most X.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\nThere are four perfect powers that are at most 10: 1, 4, 8 and 9.\nWe should print the largest among them, 9.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n999\n\nSample Output 3\n\n961", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 152, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s937372124", "group_id": "codeNet:p03353", "input_text": "from collections import Counter\ndef main():\n s=input()\n k=int(input())\n p=sorted(Counter(s).items(), key=lambda x: x[1], reverse=True)\n count = 1\n for i in range(len(p)):\n for t in g(p[i][0], s):\n if count == k:\n print(t)\n return\n count += 1\n \ndef g(s, ss):\n sumi = set()\n lens = len(ss)\n for l in range(lens):\n for i in range(lens):\n if i+l >= lens:\n break\n res = ss[i:i+l+1]\n if (ss[i] == s) and (res not in sumi):\n sumi.add(res)\n return sorted(sumi)\n\nif __name__ == \"__main__\":\n main()", "language": "Python", "metadata": {"date": 1595866543, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03353.html", "problem_id": "p03353", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03353/input.txt", "sample_output_relpath": "derived/input_output/data/p03353/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03353/Python/s937372124.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s937372124", "user_id": "u157232135"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "from collections import Counter\ndef main():\n s=input()\n k=int(input())\n p=sorted(Counter(s).items(), key=lambda x: x[1], reverse=True)\n count = 1\n for i in range(len(p)):\n for t in g(p[i][0], s):\n if count == k:\n print(t)\n return\n count += 1\n \ndef g(s, ss):\n sumi = set()\n lens = len(ss)\n for l in range(lens):\n for i in range(lens):\n if i+l >= lens:\n break\n res = ss[i:i+l+1]\n if (ss[i] == s) and (res not in sumi):\n sumi.add(res)\n return sorted(sumi)\n\nif __name__ == \"__main__\":\n main()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string s.\nAmong the different substrings of s, print the K-th lexicographically smallest one.\n\nA substring of s is a string obtained by taking out a non-empty contiguous part in s.\nFor example, if s = ababc, a, bab and ababc are substrings of s, while ac, z and an empty string are not.\nAlso, we say that substrings are different when they are different as strings.\n\nLet X = x_{1}x_{2}...x_{n} and Y = y_{1}y_{2}...y_{m} be two distinct strings. X is lexicographically larger than Y if and only if Y is a prefix of X or x_{j} > y_{j} where j is the smallest integer such that x_{j} \\neq y_{j}.\n\nConstraints\n\n1 ≤ |s| ≤ 5000\n\ns consists of lowercase English letters.\n\n1 ≤ K ≤ 5\n\ns has at least K different substrings.\n\nPartial Score\n\n200 points will be awarded as a partial score for passing the test set satisfying |s| ≤ 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nK\n\nOutput\n\nPrint the K-th lexicographically smallest substring of K.\n\nSample Input 1\n\naba\n4\n\nSample Output 1\n\nb\n\ns has five substrings: a, b, ab, ba and aba.\nAmong them, we should print the fourth smallest one, b.\nNote that we do not count a twice.\n\nSample Input 2\n\natcoderandatcodeer\n5\n\nSample Output 2\n\nandat\n\nSample Input 3\n\nz\n1\n\nSample Output 3\n\nz", "sample_input": "aba\n4\n"}, "reference_outputs": ["b\n"], "source_document_id": "p03353", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string s.\nAmong the different substrings of s, print the K-th lexicographically smallest one.\n\nA substring of s is a string obtained by taking out a non-empty contiguous part in s.\nFor example, if s = ababc, a, bab and ababc are substrings of s, while ac, z and an empty string are not.\nAlso, we say that substrings are different when they are different as strings.\n\nLet X = x_{1}x_{2}...x_{n} and Y = y_{1}y_{2}...y_{m} be two distinct strings. X is lexicographically larger than Y if and only if Y is a prefix of X or x_{j} > y_{j} where j is the smallest integer such that x_{j} \\neq y_{j}.\n\nConstraints\n\n1 ≤ |s| ≤ 5000\n\ns consists of lowercase English letters.\n\n1 ≤ K ≤ 5\n\ns has at least K different substrings.\n\nPartial Score\n\n200 points will be awarded as a partial score for passing the test set satisfying |s| ≤ 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nK\n\nOutput\n\nPrint the K-th lexicographically smallest substring of K.\n\nSample Input 1\n\naba\n4\n\nSample Output 1\n\nb\n\ns has five substrings: a, b, ab, ba and aba.\nAmong them, we should print the fourth smallest one, b.\nNote that we do not count a twice.\n\nSample Input 2\n\natcoderandatcodeer\n5\n\nSample Output 2\n\nandat\n\nSample Input 3\n\nz\n1\n\nSample Output 3\n\nz", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 654, "cpu_time_ms": 2215, "memory_kb": 399560}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s087232127", "group_id": "codeNet:p03353", "input_text": "#encoding utf-8\n\nimport copy\nimport numpy as np\nimport random\n\n\ns = list(str(input()))\nk = int(input())\n\nsubstrings = []\nfor length in range(1,len(s)+1):\n if length >= 5:\n break\n for i in range(len(s)-length+1):\n word = \"\".join(s[i:i+length])\n # print(word)\n if word in substrings:\n pass\n else:\n substrings.append(str(word))\n\nsubstrings.sort()\n# print(substrings)\nprint(substrings[k-1])", "language": "Python", "metadata": {"date": 1551042987, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03353.html", "problem_id": "p03353", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03353/input.txt", "sample_output_relpath": "derived/input_output/data/p03353/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03353/Python/s087232127.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s087232127", "user_id": "u059210959"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "#encoding utf-8\n\nimport copy\nimport numpy as np\nimport random\n\n\ns = list(str(input()))\nk = int(input())\n\nsubstrings = []\nfor length in range(1,len(s)+1):\n if length >= 5:\n break\n for i in range(len(s)-length+1):\n word = \"\".join(s[i:i+length])\n # print(word)\n if word in substrings:\n pass\n else:\n substrings.append(str(word))\n\nsubstrings.sort()\n# print(substrings)\nprint(substrings[k-1])", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string s.\nAmong the different substrings of s, print the K-th lexicographically smallest one.\n\nA substring of s is a string obtained by taking out a non-empty contiguous part in s.\nFor example, if s = ababc, a, bab and ababc are substrings of s, while ac, z and an empty string are not.\nAlso, we say that substrings are different when they are different as strings.\n\nLet X = x_{1}x_{2}...x_{n} and Y = y_{1}y_{2}...y_{m} be two distinct strings. X is lexicographically larger than Y if and only if Y is a prefix of X or x_{j} > y_{j} where j is the smallest integer such that x_{j} \\neq y_{j}.\n\nConstraints\n\n1 ≤ |s| ≤ 5000\n\ns consists of lowercase English letters.\n\n1 ≤ K ≤ 5\n\ns has at least K different substrings.\n\nPartial Score\n\n200 points will be awarded as a partial score for passing the test set satisfying |s| ≤ 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nK\n\nOutput\n\nPrint the K-th lexicographically smallest substring of K.\n\nSample Input 1\n\naba\n4\n\nSample Output 1\n\nb\n\ns has five substrings: a, b, ab, ba and aba.\nAmong them, we should print the fourth smallest one, b.\nNote that we do not count a twice.\n\nSample Input 2\n\natcoderandatcodeer\n5\n\nSample Output 2\n\nandat\n\nSample Input 3\n\nz\n1\n\nSample Output 3\n\nz", "sample_input": "aba\n4\n"}, "reference_outputs": ["b\n"], "source_document_id": "p03353", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string s.\nAmong the different substrings of s, print the K-th lexicographically smallest one.\n\nA substring of s is a string obtained by taking out a non-empty contiguous part in s.\nFor example, if s = ababc, a, bab and ababc are substrings of s, while ac, z and an empty string are not.\nAlso, we say that substrings are different when they are different as strings.\n\nLet X = x_{1}x_{2}...x_{n} and Y = y_{1}y_{2}...y_{m} be two distinct strings. X is lexicographically larger than Y if and only if Y is a prefix of X or x_{j} > y_{j} where j is the smallest integer such that x_{j} \\neq y_{j}.\n\nConstraints\n\n1 ≤ |s| ≤ 5000\n\ns consists of lowercase English letters.\n\n1 ≤ K ≤ 5\n\ns has at least K different substrings.\n\nPartial Score\n\n200 points will be awarded as a partial score for passing the test set satisfying |s| ≤ 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nK\n\nOutput\n\nPrint the K-th lexicographically smallest substring of K.\n\nSample Input 1\n\naba\n4\n\nSample Output 1\n\nb\n\ns has five substrings: a, b, ab, ba and aba.\nAmong them, we should print the fourth smallest one, b.\nNote that we do not count a twice.\n\nSample Input 2\n\natcoderandatcodeer\n5\n\nSample Output 2\n\nandat\n\nSample Input 3\n\nz\n1\n\nSample Output 3\n\nz", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 449, "cpu_time_ms": 914, "memory_kb": 13388}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s256475604", "group_id": "codeNet:p03354", "input_text": "def find(x):\n while union[x] != x:\n x = union[x]\n return x\n\nN, M = map(int, input().split())\np = list(map(int, input().split()))\n\nunion = [i for i in range(N+1)]\n\nfor i in range(M):\n x, y = map(int, input().split())\n a, b = find(x), find(y)\n if a != b:\n union[a] = b\n\nans = 0\nfor idx, n in enumerate(p):\n x, y = find(idx+1), find(n)\n if x == y:\n ans += 1\n \nprint(ans)", "language": "Python", "metadata": {"date": 1565661602, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03354.html", "problem_id": "p03354", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03354/input.txt", "sample_output_relpath": "derived/input_output/data/p03354/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03354/Python/s256475604.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s256475604", "user_id": "u721316601"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "def find(x):\n while union[x] != x:\n x = union[x]\n return x\n\nN, M = map(int, input().split())\np = list(map(int, input().split()))\n\nunion = [i for i in range(N+1)]\n\nfor i in range(M):\n x, y = map(int, input().split())\n a, b = find(x), find(y)\n if a != b:\n union[a] = b\n\nans = 0\nfor idx, n in enumerate(p):\n x, y = find(idx+1), find(n)\n if x == y:\n ans += 1\n \nprint(ans)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a permutation of the integers from 1 through N, p_1, p_2, .., p_N.\nWe also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M).\nAtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N) such that p_i = i is maximized:\n\nChoose j such that 1 ≤ j ≤ M, and swap p_{x_j} and p_{y_j}.\n\nFind the maximum possible number of i such that p_i = i after operations.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ M ≤ 10^5\n\np is a permutation of integers from 1 through N.\n\n1 ≤ x_j,y_j ≤ N\n\nx_j ≠ y_j\n\nIf i ≠ j, \\{x_i,y_i\\} ≠ \\{x_j,y_j\\}.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 p_2 .. p_N\nx_1 y_1\nx_2 y_2\n:\nx_M y_M\n\nOutput\n\nPrint the maximum possible number of i such that p_i = i after operations.\n\nSample Input 1\n\n5 2\n5 3 1 4 2\n1 3\n5 4\n\nSample Output 1\n\n2\n\nIf we perform the operation by choosing j=1, p becomes 1 3 5 4 2, which is optimal, so the answer is 2.\n\nSample Input 2\n\n3 2\n3 2 1\n1 2\n2 3\n\nSample Output 2\n\n3\n\nIf we perform the operation by, for example, choosing j=1, j=2, j=1 in this order, p becomes 1 2 3, which is obviously optimal.\nNote that we may choose the same j any number of times.\n\nSample Input 3\n\n10 8\n5 3 6 8 7 10 9 1 2 4\n3 1\n4 1\n5 9\n2 5\n6 5\n3 5\n8 9\n7 9\n\nSample Output 3\n\n8\n\nSample Input 4\n\n5 1\n1 2 3 4 5\n1 5\n\nSample Output 4\n\n5\n\nWe do not have to perform the operation.", "sample_input": "5 2\n5 3 1 4 2\n1 3\n5 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03354", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a permutation of the integers from 1 through N, p_1, p_2, .., p_N.\nWe also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M).\nAtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N) such that p_i = i is maximized:\n\nChoose j such that 1 ≤ j ≤ M, and swap p_{x_j} and p_{y_j}.\n\nFind the maximum possible number of i such that p_i = i after operations.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ M ≤ 10^5\n\np is a permutation of integers from 1 through N.\n\n1 ≤ x_j,y_j ≤ N\n\nx_j ≠ y_j\n\nIf i ≠ j, \\{x_i,y_i\\} ≠ \\{x_j,y_j\\}.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 p_2 .. p_N\nx_1 y_1\nx_2 y_2\n:\nx_M y_M\n\nOutput\n\nPrint the maximum possible number of i such that p_i = i after operations.\n\nSample Input 1\n\n5 2\n5 3 1 4 2\n1 3\n5 4\n\nSample Output 1\n\n2\n\nIf we perform the operation by choosing j=1, p becomes 1 3 5 4 2, which is optimal, so the answer is 2.\n\nSample Input 2\n\n3 2\n3 2 1\n1 2\n2 3\n\nSample Output 2\n\n3\n\nIf we perform the operation by, for example, choosing j=1, j=2, j=1 in this order, p becomes 1 2 3, which is obviously optimal.\nNote that we may choose the same j any number of times.\n\nSample Input 3\n\n10 8\n5 3 6 8 7 10 9 1 2 4\n3 1\n4 1\n5 9\n2 5\n6 5\n3 5\n8 9\n7 9\n\nSample Output 3\n\n8\n\nSample Input 4\n\n5 1\n1 2 3 4 5\n1 5\n\nSample Output 4\n\n5\n\nWe do not have to perform the operation.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 412, "cpu_time_ms": 2104, "memory_kb": 13880}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s559661563", "group_id": "codeNet:p03361", "input_text": "H,W = map(int,raw_input().split())\n \ns = []\nfor i in range(H):\n\ts.append(raw_input())\n \nflag=True\nfor i in range(H):\n\tfor j in range(W):\n\t\tif s[i][j]=='#':\n\t\t\tlocal_flag=False\n\t\t\tif i+1=0:\n\t\t\t\tif s[i-1][j]=='#':\n\t\t\t\t\tlocal_flag=True\n\t\t\tif j-1>=0:\n\t\t\t\tif s[i][j-1]=='#':\n\t\t\t\t\tlocal_flag=True\n\t\t\tif local_flag==False:\n\t\t\t\tflag=False\nif flag:\n\tprint 'Yes'\nelse:\n\tprint 'No'", "language": "Python", "metadata": {"date": 1539096524, "filename_ext": "py", "original_language": "Python (2.7.6)", "problem_description_relpath": "problem_descriptions/p03361.html", "problem_id": "p03361", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03361/input.txt", "sample_output_relpath": "derived/input_output/data/p03361/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03361/Python/s559661563.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s559661563", "user_id": "u785989355"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "H,W = map(int,raw_input().split())\n \ns = []\nfor i in range(H):\n\ts.append(raw_input())\n \nflag=True\nfor i in range(H):\n\tfor j in range(W):\n\t\tif s[i][j]=='#':\n\t\t\tlocal_flag=False\n\t\t\tif i+1=0:\n\t\t\t\tif s[i-1][j]=='#':\n\t\t\t\t\tlocal_flag=True\n\t\t\tif j-1>=0:\n\t\t\t\tif s[i][j-1]=='#':\n\t\t\t\t\tlocal_flag=True\n\t\t\tif local_flag==False:\n\t\t\t\tflag=False\nif flag:\n\tprint 'Yes'\nelse:\n\tprint 'No'", "problem_context": "Score: 300 points\n\nProblem Statement\n\nWe have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j).\n\nInitially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, j}= #, and to make Square (i, j) white when s_{i, j}= ..\n\nHowever, since he is not a good painter, he can only choose two squares that are horizontally or vertically adjacent and paint those squares black, for some number of times (possibly zero). He may choose squares that are already painted black, in which case the color of those squares remain black.\n\nDetermine if square1001 can achieve his objective.\n\nConstraints\n\nH is an integer between 1 and 50 (inclusive).\n\nW is an integer between 1 and 50 (inclusive).\n\nFor every (i, j) (1 \\leq i \\leq H, 1 \\leq j \\leq W), s_{i, j} is # or ..\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{1, 1} s_{1, 2} s_{1, 3} ... s_{1, W}\ns_{2, 1} s_{2, 2} s_{2, 3} ... s_{2, W}\n: :\ns_{H, 1} s_{H, 2} s_{H, 3} ... s_{H, W}\n\nOutput\n\nIf square1001 can achieve his objective, print Yes; if he cannot, print No.\n\nSample Input 1\n\n3 3\n.#.\n###\n.#.\n\nSample Output 1\n\nYes\n\nOne possible way to achieve the objective is shown in the figure below. Here, the squares being painted are marked by stars.\n\nSample Input 2\n\n5 5\n#.#.#\n.#.#.\n#.#.#\n.#.#.\n#.#.#\n\nSample Output 2\n\nNo\n\nsquare1001 cannot achieve his objective here.\n\nSample Input 3\n\n11 11\n...#####...\n.##.....##.\n#..##.##..#\n#..##.##..#\n#.........#\n#...###...#\n.#########.\n.#.#.#.#.#.\n##.#.#.#.##\n..##.#.##..\n.##..#..##.\n\nSample Output 3\n\nYes", "sample_input": "3 3\n.#.\n###\n.#.\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03361", "source_text": "Score: 300 points\n\nProblem Statement\n\nWe have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j).\n\nInitially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, j}= #, and to make Square (i, j) white when s_{i, j}= ..\n\nHowever, since he is not a good painter, he can only choose two squares that are horizontally or vertically adjacent and paint those squares black, for some number of times (possibly zero). He may choose squares that are already painted black, in which case the color of those squares remain black.\n\nDetermine if square1001 can achieve his objective.\n\nConstraints\n\nH is an integer between 1 and 50 (inclusive).\n\nW is an integer between 1 and 50 (inclusive).\n\nFor every (i, j) (1 \\leq i \\leq H, 1 \\leq j \\leq W), s_{i, j} is # or ..\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{1, 1} s_{1, 2} s_{1, 3} ... s_{1, W}\ns_{2, 1} s_{2, 2} s_{2, 3} ... s_{2, W}\n: :\ns_{H, 1} s_{H, 2} s_{H, 3} ... s_{H, W}\n\nOutput\n\nIf square1001 can achieve his objective, print Yes; if he cannot, print No.\n\nSample Input 1\n\n3 3\n.#.\n###\n.#.\n\nSample Output 1\n\nYes\n\nOne possible way to achieve the objective is shown in the figure below. Here, the squares being painted are marked by stars.\n\nSample Input 2\n\n5 5\n#.#.#\n.#.#.\n#.#.#\n.#.#.\n#.#.#\n\nSample Output 2\n\nNo\n\nsquare1001 cannot achieve his objective here.\n\nSample Input 3\n\n11 11\n...#####...\n.##.....##.\n#..##.##..#\n#..##.##..#\n#.........#\n#...###...#\n.#########.\n.#.#.#.#.#.\n##.#.#.#.##\n..##.#.##..\n.##..#..##.\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 485, "cpu_time_ms": 12, "memory_kb": 2692}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s916938038", "group_id": "codeNet:p03361", "input_text": "h,w = map(int, input().split())\ns = [input() for _ in range(h)]\n\ndef check():\n for i in range(h):\n for j in range(w):\n if s[i][j] == '.':\n continue\n ok = False\n for x,y in [(i-1,j), (i+1,j), (i,j+1), (i,j-1)]:\n if x<0 or x>=h or y<0 or y>=w :\n continue\n if s[x][y] == '#':\n ok = True\n if not ok:\n return False\n return True\n\n\nprint(\"Yes\" if check() else \"No\")\n", "language": "Python", "metadata": {"date": 1525575164, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03361.html", "problem_id": "p03361", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03361/input.txt", "sample_output_relpath": "derived/input_output/data/p03361/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03361/Python/s916938038.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s916938038", "user_id": "u910288980"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "h,w = map(int, input().split())\ns = [input() for _ in range(h)]\n\ndef check():\n for i in range(h):\n for j in range(w):\n if s[i][j] == '.':\n continue\n ok = False\n for x,y in [(i-1,j), (i+1,j), (i,j+1), (i,j-1)]:\n if x<0 or x>=h or y<0 or y>=w :\n continue\n if s[x][y] == '#':\n ok = True\n if not ok:\n return False\n return True\n\n\nprint(\"Yes\" if check() else \"No\")\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nWe have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j).\n\nInitially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, j}= #, and to make Square (i, j) white when s_{i, j}= ..\n\nHowever, since he is not a good painter, he can only choose two squares that are horizontally or vertically adjacent and paint those squares black, for some number of times (possibly zero). He may choose squares that are already painted black, in which case the color of those squares remain black.\n\nDetermine if square1001 can achieve his objective.\n\nConstraints\n\nH is an integer between 1 and 50 (inclusive).\n\nW is an integer between 1 and 50 (inclusive).\n\nFor every (i, j) (1 \\leq i \\leq H, 1 \\leq j \\leq W), s_{i, j} is # or ..\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{1, 1} s_{1, 2} s_{1, 3} ... s_{1, W}\ns_{2, 1} s_{2, 2} s_{2, 3} ... s_{2, W}\n: :\ns_{H, 1} s_{H, 2} s_{H, 3} ... s_{H, W}\n\nOutput\n\nIf square1001 can achieve his objective, print Yes; if he cannot, print No.\n\nSample Input 1\n\n3 3\n.#.\n###\n.#.\n\nSample Output 1\n\nYes\n\nOne possible way to achieve the objective is shown in the figure below. Here, the squares being painted are marked by stars.\n\nSample Input 2\n\n5 5\n#.#.#\n.#.#.\n#.#.#\n.#.#.\n#.#.#\n\nSample Output 2\n\nNo\n\nsquare1001 cannot achieve his objective here.\n\nSample Input 3\n\n11 11\n...#####...\n.##.....##.\n#..##.##..#\n#..##.##..#\n#.........#\n#...###...#\n.#########.\n.#.#.#.#.#.\n##.#.#.#.##\n..##.#.##..\n.##..#..##.\n\nSample Output 3\n\nYes", "sample_input": "3 3\n.#.\n###\n.#.\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03361", "source_text": "Score: 300 points\n\nProblem Statement\n\nWe have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j).\n\nInitially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, j}= #, and to make Square (i, j) white when s_{i, j}= ..\n\nHowever, since he is not a good painter, he can only choose two squares that are horizontally or vertically adjacent and paint those squares black, for some number of times (possibly zero). He may choose squares that are already painted black, in which case the color of those squares remain black.\n\nDetermine if square1001 can achieve his objective.\n\nConstraints\n\nH is an integer between 1 and 50 (inclusive).\n\nW is an integer between 1 and 50 (inclusive).\n\nFor every (i, j) (1 \\leq i \\leq H, 1 \\leq j \\leq W), s_{i, j} is # or ..\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{1, 1} s_{1, 2} s_{1, 3} ... s_{1, W}\ns_{2, 1} s_{2, 2} s_{2, 3} ... s_{2, W}\n: :\ns_{H, 1} s_{H, 2} s_{H, 3} ... s_{H, W}\n\nOutput\n\nIf square1001 can achieve his objective, print Yes; if he cannot, print No.\n\nSample Input 1\n\n3 3\n.#.\n###\n.#.\n\nSample Output 1\n\nYes\n\nOne possible way to achieve the objective is shown in the figure below. Here, the squares being painted are marked by stars.\n\nSample Input 2\n\n5 5\n#.#.#\n.#.#.\n#.#.#\n.#.#.\n#.#.#\n\nSample Output 2\n\nNo\n\nsquare1001 cannot achieve his objective here.\n\nSample Input 3\n\n11 11\n...#####...\n.##.....##.\n#..##.##..#\n#..##.##..#\n#.........#\n#...###...#\n.#########.\n.#.#.#.#.#.\n##.#.#.#.##\n..##.#.##..\n.##..#..##.\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 514, "cpu_time_ms": 20, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s812670864", "group_id": "codeNet:p03362", "input_text": "# Nまでの素数を列挙\ndef get_sieve_of_eratosthenes(n):\n if not isinstance(n, int):\n raise TypeError(\"n is int type.\")\n if n < 2:\n raise ValueError(\"n is more than 2\")\n prime = [2]\n limit = int(n ** 0.5)\n data = [i + 1 for i in range(2, n, 2)]\n while True:\n p = data[0]\n if limit <= p:\n return prime + data\n prime.append(p)\n data = [e for e in data if e % p != 0]\n\n\n# if __name__ == '__main__':\n# data = get_sieve_of_eratosthenes(100)\n# print(' '.join(map(str, data)))\n# print(\"2~{0}までで以上が素数です\\n\".format(100))\n\n\nN = int(input())\nP = get_sieve_of_eratosthenes(55555)\ncnt = 0\nfor p in P:\n if p % 5 == 1:\n print(p)\n cnt += 1\n if cnt == N:\n break\n", "language": "Python", "metadata": {"date": 1595926812, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03362.html", "problem_id": "p03362", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03362/input.txt", "sample_output_relpath": "derived/input_output/data/p03362/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03362/Python/s812670864.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s812670864", "user_id": "u815878613"}, "prompt_components": {"gold_output": "3 5 7 11 31\n", "input_to_evaluate": "# Nまでの素数を列挙\ndef get_sieve_of_eratosthenes(n):\n if not isinstance(n, int):\n raise TypeError(\"n is int type.\")\n if n < 2:\n raise ValueError(\"n is more than 2\")\n prime = [2]\n limit = int(n ** 0.5)\n data = [i + 1 for i in range(2, n, 2)]\n while True:\n p = data[0]\n if limit <= p:\n return prime + data\n prime.append(p)\n data = [e for e in data if e % p != 0]\n\n\n# if __name__ == '__main__':\n# data = get_sieve_of_eratosthenes(100)\n# print(' '.join(map(str, data)))\n# print(\"2~{0}までで以上が素数です\\n\".format(100))\n\n\nN = int(input())\nP = get_sieve_of_eratosthenes(55555)\ncnt = 0\nfor p in P:\n if p % 5 == 1:\n print(p)\n cnt += 1\n if cnt == N:\n break\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nPrint a sequence a_1, a_2, ..., a_N whose length is N that satisfies the following conditions:\n\na_i (1 \\leq i \\leq N) is a prime number at most 55 555.\n\nThe values of a_1, a_2, ..., a_N are all different.\n\nIn every choice of five different integers from a_1, a_2, ..., a_N, the sum of those integers is a composite number.\n\nIf there are multiple such sequences, printing any of them is accepted.\n\nNotes\n\nAn integer N not less than 2 is called a prime number if it cannot be divided evenly by any integers except 1 and N, and called a composite number otherwise.\n\nConstraints\n\nN is an integer between 5 and 55 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint N numbers a_1, a_2, a_3, ..., a_N in a line, with spaces in between.\n\nSample Input 1\n\n5\n\nSample Output 1\n\n3 5 7 11 31\n\nLet us see if this output actually satisfies the conditions.\n\nFirst, 3, 5, 7, 11 and 31 are all different, and all of them are prime numbers.\n\nThe only way to choose five among them is to choose all of them, whose sum is a_1+a_2+a_3+a_4+a_5=57, which is a composite number.\n\nThere are also other possible outputs, such as 2 3 5 7 13, 11 13 17 19 31 and 7 11 5 31 3.\n\nSample Input 2\n\n6\n\nSample Output 2\n\n2 3 5 7 11 13\n\n2, 3, 5, 7, 11, 13 are all different prime numbers.\n\n2+3+5+7+11=28 is a composite number.\n\n2+3+5+7+13=30 is a composite number.\n\n2+3+5+11+13=34 is a composite number.\n\n2+3+7+11+13=36 is a composite number.\n\n2+5+7+11+13=38 is a composite number.\n\n3+5+7+11+13=39 is a composite number.\n\nThus, the sequence 2 3 5 7 11 13 satisfies the conditions.\n\nSample Input 3\n\n8\n\nSample Output 3\n\n2 5 7 13 19 37 67 79", "sample_input": "5\n"}, "reference_outputs": ["3 5 7 11 31\n"], "source_document_id": "p03362", "source_text": "Score: 400 points\n\nProblem Statement\n\nPrint a sequence a_1, a_2, ..., a_N whose length is N that satisfies the following conditions:\n\na_i (1 \\leq i \\leq N) is a prime number at most 55 555.\n\nThe values of a_1, a_2, ..., a_N are all different.\n\nIn every choice of five different integers from a_1, a_2, ..., a_N, the sum of those integers is a composite number.\n\nIf there are multiple such sequences, printing any of them is accepted.\n\nNotes\n\nAn integer N not less than 2 is called a prime number if it cannot be divided evenly by any integers except 1 and N, and called a composite number otherwise.\n\nConstraints\n\nN is an integer between 5 and 55 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint N numbers a_1, a_2, a_3, ..., a_N in a line, with spaces in between.\n\nSample Input 1\n\n5\n\nSample Output 1\n\n3 5 7 11 31\n\nLet us see if this output actually satisfies the conditions.\n\nFirst, 3, 5, 7, 11 and 31 are all different, and all of them are prime numbers.\n\nThe only way to choose five among them is to choose all of them, whose sum is a_1+a_2+a_3+a_4+a_5=57, which is a composite number.\n\nThere are also other possible outputs, such as 2 3 5 7 13, 11 13 17 19 31 and 7 11 5 31 3.\n\nSample Input 2\n\n6\n\nSample Output 2\n\n2 3 5 7 11 13\n\n2, 3, 5, 7, 11, 13 are all different prime numbers.\n\n2+3+5+7+11=28 is a composite number.\n\n2+3+5+7+13=30 is a composite number.\n\n2+3+5+11+13=34 is a composite number.\n\n2+3+7+11+13=36 is a composite number.\n\n2+5+7+11+13=38 is a composite number.\n\n3+5+7+11+13=39 is a composite number.\n\nThus, the sequence 2 3 5 7 11 13 satisfies the conditions.\n\nSample Input 3\n\n8\n\nSample Output 3\n\n2 5 7 13 19 37 67 79", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 769, "cpu_time_ms": 52, "memory_kb": 10652}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s027729342", "group_id": "codeNet:p03365", "input_text": "from sys import exit, setrecursionlimit, stderr\nfrom functools import reduce\nfrom itertools import *\nfrom collections import defaultdict\nfrom bisect import bisect\n\ndef read():\n return int(input())\n\ndef reads():\n return [int(x) for x in input().split()]\n\nMOD = 10**9 + 7\n\nN = read()\n\nNN = N + 1\nfact = [1] * NN\nfor i in range(1, NN):\n fact[i] = (fact[i-1] * i) % MOD\n\ndef inv(n):\n return pow(n, MOD-2, MOD)\n\ndef comb(n, k):\n return fact[n] * inv(fact[n-k]) % MOD * inv(fact[k]) % MOD\n\nS = [0] * N\nfor k in range((N+1) // 2, N):\n c = comb(k-1, N-1-k)\n S[k] = c * fact[k] % MOD\n\n# print(S, file=stderr)\n\nans = 0\nfor k in range((N+1) // 2, N):\n ans = (ans + k * (S[k] - S[k-1] * (N - k)) % MOD) % MOD\nprint(ans)\n", "language": "Python", "metadata": {"date": 1524971845, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03365.html", "problem_id": "p03365", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03365/input.txt", "sample_output_relpath": "derived/input_output/data/p03365/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03365/Python/s027729342.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s027729342", "user_id": "u478870821"}, "prompt_components": {"gold_output": "16\n", "input_to_evaluate": "from sys import exit, setrecursionlimit, stderr\nfrom functools import reduce\nfrom itertools import *\nfrom collections import defaultdict\nfrom bisect import bisect\n\ndef read():\n return int(input())\n\ndef reads():\n return [int(x) for x in input().split()]\n\nMOD = 10**9 + 7\n\nN = read()\n\nNN = N + 1\nfact = [1] * NN\nfor i in range(1, NN):\n fact[i] = (fact[i-1] * i) % MOD\n\ndef inv(n):\n return pow(n, MOD-2, MOD)\n\ndef comb(n, k):\n return fact[n] * inv(fact[n-k]) % MOD * inv(fact[k]) % MOD\n\nS = [0] * N\nfor k in range((N+1) // 2, N):\n c = comb(k-1, N-1-k)\n S[k] = c * fact[k] % MOD\n\n# print(S, file=stderr)\n\nans = 0\nfor k in range((N+1) // 2, N):\n ans = (ans + k * (S[k] - S[k-1] * (N - k)) % MOD) % MOD\nprint(ans)\n", "problem_context": "Score : 800 points\n\nProblem Statement\n\nThere are N squares lining up in a row, numbered 1 through N from left to right.\nInitially, all squares are white.\nWe also have N-1 painting machines, numbered 1 through N-1.\nWhen operated, Machine i paints Square i and i+1 black.\n\nSnuke will operate these machines one by one.\nThe order in which he operates them is represented by a permutation of (1, 2, ..., N-1), P, which means that the i-th operated machine is Machine P_i.\n\nHere, the score of a permutation P is defined as the number of machines that are operated before all the squares are painted black for the first time, when the machines are operated in the order specified by P.\nSnuke has not decided what permutation P to use, but he is interested in the scores of possible permutations.\nFind the sum of the scores over all possible permutations for him.\nSince this can be extremely large, compute the sum modulo 10^9+7.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of the scores over all possible permutations, modulo 10^9+7.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n16\n\nThere are six possible permutations as P.\nAmong them, P = (1, 3, 2) and P = (3, 1, 2) have a score of 2, and the others have a score of 3.\nThus, the answer is 2 \\times 2 + 3 \\times 4 = 16.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n1\n\nThere is only one possible permutation: P = (1), which has a score of 1.\n\nSample Input 3\n\n5\n\nSample Output 3\n\n84\n\nSample Input 4\n\n100000\n\nSample Output 4\n\n341429644", "sample_input": "4\n"}, "reference_outputs": ["16\n"], "source_document_id": "p03365", "source_text": "Score : 800 points\n\nProblem Statement\n\nThere are N squares lining up in a row, numbered 1 through N from left to right.\nInitially, all squares are white.\nWe also have N-1 painting machines, numbered 1 through N-1.\nWhen operated, Machine i paints Square i and i+1 black.\n\nSnuke will operate these machines one by one.\nThe order in which he operates them is represented by a permutation of (1, 2, ..., N-1), P, which means that the i-th operated machine is Machine P_i.\n\nHere, the score of a permutation P is defined as the number of machines that are operated before all the squares are painted black for the first time, when the machines are operated in the order specified by P.\nSnuke has not decided what permutation P to use, but he is interested in the scores of possible permutations.\nFind the sum of the scores over all possible permutations for him.\nSince this can be extremely large, compute the sum modulo 10^9+7.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of the scores over all possible permutations, modulo 10^9+7.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n16\n\nThere are six possible permutations as P.\nAmong them, P = (1, 3, 2) and P = (3, 1, 2) have a score of 2, and the others have a score of 3.\nThus, the answer is 2 \\times 2 + 3 \\times 4 = 16.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n1\n\nThere is only one possible permutation: P = (1), which has a score of 1.\n\nSample Input 3\n\n5\n\nSample Output 3\n\n84\n\nSample Input 4\n\n100000\n\nSample Output 4\n\n341429644", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 716, "cpu_time_ms": 2106, "memory_kb": 58028}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s093328718", "group_id": "codeNet:p03369", "input_text": "s = input()\ns = list(s)\ncount = 0\nfor i in s:\n if i == \"o\":\n count += 1\n\nprint(700 + 100 * count)", "language": "Python", "metadata": {"date": 1541272962, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03369.html", "problem_id": "p03369", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03369/input.txt", "sample_output_relpath": "derived/input_output/data/p03369/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03369/Python/s093328718.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s093328718", "user_id": "u272557899"}, "prompt_components": {"gold_output": "900\n", "input_to_evaluate": "s = input()\ns = list(s)\ncount = 0\nfor i in s:\n if i == \"o\":\n count += 1\n\nprint(700 + 100 * count)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn \"Takahashi-ya\", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions).\n\nA customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is three characters long, and if the first character in S is o, it means the ramen should be topped with boiled egg; if that character is x, it means the ramen should not be topped with boiled egg. Similarly, the second and third characters in S mean the presence or absence of sliced pork and green onions on top of the ramen.\n\nWrite a program that, when S is given, prints the price of the corresponding bowl of ramen.\n\nConstraints\n\nS is a string of length 3.\n\nEach character in S is o or x.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the price of the bowl of ramen corresponding to S.\n\nSample Input 1\n\noxo\n\nSample Output 1\n\n900\n\nThe price of a ramen topped with two kinds of toppings, boiled egg and green onions, is 700 + 100 \\times 2 = 900 yen.\n\nSample Input 2\n\nooo\n\nSample Output 2\n\n1000\n\nThe price of a ramen topped with all three kinds of toppings is 700 + 100 \\times 3 = 1000 yen.\n\nSample Input 3\n\nxxx\n\nSample Output 3\n\n700\n\nThe price of a ramen without any toppings is 700 yen.", "sample_input": "oxo\n"}, "reference_outputs": ["900\n"], "source_document_id": "p03369", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn \"Takahashi-ya\", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions).\n\nA customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is three characters long, and if the first character in S is o, it means the ramen should be topped with boiled egg; if that character is x, it means the ramen should not be topped with boiled egg. Similarly, the second and third characters in S mean the presence or absence of sliced pork and green onions on top of the ramen.\n\nWrite a program that, when S is given, prints the price of the corresponding bowl of ramen.\n\nConstraints\n\nS is a string of length 3.\n\nEach character in S is o or x.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the price of the bowl of ramen corresponding to S.\n\nSample Input 1\n\noxo\n\nSample Output 1\n\n900\n\nThe price of a ramen topped with two kinds of toppings, boiled egg and green onions, is 700 + 100 \\times 2 = 900 yen.\n\nSample Input 2\n\nooo\n\nSample Output 2\n\n1000\n\nThe price of a ramen topped with all three kinds of toppings is 700 + 100 \\times 3 = 1000 yen.\n\nSample Input 3\n\nxxx\n\nSample Output 3\n\n700\n\nThe price of a ramen without any toppings is 700 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 107, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s063431997", "group_id": "codeNet:p03371", "input_text": "price_A, price_B, price_AB, num_A, num_B = map(int,input().split())\nAandB = price_A * num_A + price_B * num_B\nif num_A >= num_B:\n minAB = price_AB*num_B*2 + price_A*(num_A-num_B)\nelse:\n minAB = price_AB*num_A*2 + price_B*(num_B-num_A)\nmaxAB = price_AB * max(num_A, num_B) * 2\nprint(min(AandB, minAB, maxAB))", "language": "Python", "metadata": {"date": 1596042778, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03371.html", "problem_id": "p03371", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03371/input.txt", "sample_output_relpath": "derived/input_output/data/p03371/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03371/Python/s063431997.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s063431997", "user_id": "u192154323"}, "prompt_components": {"gold_output": "7900\n", "input_to_evaluate": "price_A, price_B, price_AB, num_A, num_B = map(int,input().split())\nAandB = price_A * num_A + price_B * num_B\nif num_A >= num_B:\n minAB = price_AB*num_B*2 + price_A*(num_A-num_B)\nelse:\n minAB = price_AB*num_A*2 + price_B*(num_B-num_A)\nmaxAB = price_AB * max(num_A, num_B) * 2\nprint(min(AandB, minAB, maxAB))", "problem_context": "Score : 300 points\n\nProblem Statement\n\n\"Pizza At\", a fast food chain, offers three kinds of pizza: \"A-pizza\", \"B-pizza\" and \"AB-pizza\". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.\n\nNakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.\n\nConstraints\n\n1 ≤ A, B, C ≤ 5000\n\n1 ≤ X, Y ≤ 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C X Y\n\nOutput\n\nPrint the minimum amount of money required to prepare X A-pizzas and Y B-pizzas.\n\nSample Input 1\n\n1500 2000 1600 3 2\n\nSample Output 1\n\n7900\n\nIt is optimal to buy four AB-pizzas and rearrange them into two A-pizzas and two B-pizzas, then buy additional one A-pizza.\n\nSample Input 2\n\n1500 2000 1900 3 2\n\nSample Output 2\n\n8500\n\nIt is optimal to directly buy three A-pizzas and two B-pizzas.\n\nSample Input 3\n\n1500 2000 500 90000 100000\n\nSample Output 3\n\n100000000\n\nIt is optimal to buy 200000 AB-pizzas and rearrange them into 100000 A-pizzas and 100000 B-pizzas. We will have 10000 more A-pizzas than necessary, but that is fine.", "sample_input": "1500 2000 1600 3 2\n"}, "reference_outputs": ["7900\n"], "source_document_id": "p03371", "source_text": "Score : 300 points\n\nProblem Statement\n\n\"Pizza At\", a fast food chain, offers three kinds of pizza: \"A-pizza\", \"B-pizza\" and \"AB-pizza\". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.\n\nNakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.\n\nConstraints\n\n1 ≤ A, B, C ≤ 5000\n\n1 ≤ X, Y ≤ 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C X Y\n\nOutput\n\nPrint the minimum amount of money required to prepare X A-pizzas and Y B-pizzas.\n\nSample Input 1\n\n1500 2000 1600 3 2\n\nSample Output 1\n\n7900\n\nIt is optimal to buy four AB-pizzas and rearrange them into two A-pizzas and two B-pizzas, then buy additional one A-pizza.\n\nSample Input 2\n\n1500 2000 1900 3 2\n\nSample Output 2\n\n8500\n\nIt is optimal to directly buy three A-pizzas and two B-pizzas.\n\nSample Input 3\n\n1500 2000 500 90000 100000\n\nSample Output 3\n\n100000000\n\nIt is optimal to buy 200000 AB-pizzas and rearrange them into 100000 A-pizzas and 100000 B-pizzas. We will have 10000 more A-pizzas than necessary, but that is fine.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 313, "cpu_time_ms": 30, "memory_kb": 9060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s307610937", "group_id": "codeNet:p03371", "input_text": "def solve(a,b,c,x,y):\n l = []\n for i in range(5*(10**4)+1):\n s = a*max(x-i,0)+b*max(y-i,0)+c*i*2\n l.append(s)\n return min(l)\n\n \n\nA,B,C,X,Y = map(int,input().split())\nprint(solve(A,B,C,X,Y))", "language": "Python", "metadata": {"date": 1592161329, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03371.html", "problem_id": "p03371", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03371/input.txt", "sample_output_relpath": "derived/input_output/data/p03371/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03371/Python/s307610937.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s307610937", "user_id": "u425762225"}, "prompt_components": {"gold_output": "7900\n", "input_to_evaluate": "def solve(a,b,c,x,y):\n l = []\n for i in range(5*(10**4)+1):\n s = a*max(x-i,0)+b*max(y-i,0)+c*i*2\n l.append(s)\n return min(l)\n\n \n\nA,B,C,X,Y = map(int,input().split())\nprint(solve(A,B,C,X,Y))", "problem_context": "Score : 300 points\n\nProblem Statement\n\n\"Pizza At\", a fast food chain, offers three kinds of pizza: \"A-pizza\", \"B-pizza\" and \"AB-pizza\". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.\n\nNakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.\n\nConstraints\n\n1 ≤ A, B, C ≤ 5000\n\n1 ≤ X, Y ≤ 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C X Y\n\nOutput\n\nPrint the minimum amount of money required to prepare X A-pizzas and Y B-pizzas.\n\nSample Input 1\n\n1500 2000 1600 3 2\n\nSample Output 1\n\n7900\n\nIt is optimal to buy four AB-pizzas and rearrange them into two A-pizzas and two B-pizzas, then buy additional one A-pizza.\n\nSample Input 2\n\n1500 2000 1900 3 2\n\nSample Output 2\n\n8500\n\nIt is optimal to directly buy three A-pizzas and two B-pizzas.\n\nSample Input 3\n\n1500 2000 500 90000 100000\n\nSample Output 3\n\n100000000\n\nIt is optimal to buy 200000 AB-pizzas and rearrange them into 100000 A-pizzas and 100000 B-pizzas. We will have 10000 more A-pizzas than necessary, but that is fine.", "sample_input": "1500 2000 1600 3 2\n"}, "reference_outputs": ["7900\n"], "source_document_id": "p03371", "source_text": "Score : 300 points\n\nProblem Statement\n\n\"Pizza At\", a fast food chain, offers three kinds of pizza: \"A-pizza\", \"B-pizza\" and \"AB-pizza\". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.\n\nNakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.\n\nConstraints\n\n1 ≤ A, B, C ≤ 5000\n\n1 ≤ X, Y ≤ 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C X Y\n\nOutput\n\nPrint the minimum amount of money required to prepare X A-pizzas and Y B-pizzas.\n\nSample Input 1\n\n1500 2000 1600 3 2\n\nSample Output 1\n\n7900\n\nIt is optimal to buy four AB-pizzas and rearrange them into two A-pizzas and two B-pizzas, then buy additional one A-pizza.\n\nSample Input 2\n\n1500 2000 1900 3 2\n\nSample Output 2\n\n8500\n\nIt is optimal to directly buy three A-pizzas and two B-pizzas.\n\nSample Input 3\n\n1500 2000 500 90000 100000\n\nSample Output 3\n\n100000000\n\nIt is optimal to buy 200000 AB-pizzas and rearrange them into 100000 A-pizzas and 100000 B-pizzas. We will have 10000 more A-pizzas than necessary, but that is fine.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 205, "cpu_time_ms": 54, "memory_kb": 5096}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s820191812", "group_id": "codeNet:p03371", "input_text": "import sys\ninput = sys.stdin.readline\n\nA, B, C, X, Y = map(int, input().split(' '))\nset_price = min(A+B, C*2)\nset_num = min(X, Y)\n\nans = set_price * set_num\nif X > Y:\n ans += min(A, C*2) * (X-Y)\nelif X < Y:\n ans += min(B, C*2) * (Y-X)\nprint(ans)", "language": "Python", "metadata": {"date": 1584214769, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03371.html", "problem_id": "p03371", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03371/input.txt", "sample_output_relpath": "derived/input_output/data/p03371/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03371/Python/s820191812.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s820191812", "user_id": "u004423772"}, "prompt_components": {"gold_output": "7900\n", "input_to_evaluate": "import sys\ninput = sys.stdin.readline\n\nA, B, C, X, Y = map(int, input().split(' '))\nset_price = min(A+B, C*2)\nset_num = min(X, Y)\n\nans = set_price * set_num\nif X > Y:\n ans += min(A, C*2) * (X-Y)\nelif X < Y:\n ans += min(B, C*2) * (Y-X)\nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\n\"Pizza At\", a fast food chain, offers three kinds of pizza: \"A-pizza\", \"B-pizza\" and \"AB-pizza\". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.\n\nNakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.\n\nConstraints\n\n1 ≤ A, B, C ≤ 5000\n\n1 ≤ X, Y ≤ 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C X Y\n\nOutput\n\nPrint the minimum amount of money required to prepare X A-pizzas and Y B-pizzas.\n\nSample Input 1\n\n1500 2000 1600 3 2\n\nSample Output 1\n\n7900\n\nIt is optimal to buy four AB-pizzas and rearrange them into two A-pizzas and two B-pizzas, then buy additional one A-pizza.\n\nSample Input 2\n\n1500 2000 1900 3 2\n\nSample Output 2\n\n8500\n\nIt is optimal to directly buy three A-pizzas and two B-pizzas.\n\nSample Input 3\n\n1500 2000 500 90000 100000\n\nSample Output 3\n\n100000000\n\nIt is optimal to buy 200000 AB-pizzas and rearrange them into 100000 A-pizzas and 100000 B-pizzas. We will have 10000 more A-pizzas than necessary, but that is fine.", "sample_input": "1500 2000 1600 3 2\n"}, "reference_outputs": ["7900\n"], "source_document_id": "p03371", "source_text": "Score : 300 points\n\nProblem Statement\n\n\"Pizza At\", a fast food chain, offers three kinds of pizza: \"A-pizza\", \"B-pizza\" and \"AB-pizza\". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.\n\nNakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.\n\nConstraints\n\n1 ≤ A, B, C ≤ 5000\n\n1 ≤ X, Y ≤ 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C X Y\n\nOutput\n\nPrint the minimum amount of money required to prepare X A-pizzas and Y B-pizzas.\n\nSample Input 1\n\n1500 2000 1600 3 2\n\nSample Output 1\n\n7900\n\nIt is optimal to buy four AB-pizzas and rearrange them into two A-pizzas and two B-pizzas, then buy additional one A-pizza.\n\nSample Input 2\n\n1500 2000 1900 3 2\n\nSample Output 2\n\n8500\n\nIt is optimal to directly buy three A-pizzas and two B-pizzas.\n\nSample Input 3\n\n1500 2000 500 90000 100000\n\nSample Output 3\n\n100000000\n\nIt is optimal to buy 200000 AB-pizzas and rearrange them into 100000 A-pizzas and 100000 B-pizzas. We will have 10000 more A-pizzas than necessary, but that is fine.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 251, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s383639548", "group_id": "codeNet:p03377", "input_text": "a,b,x=map(int,raw_input().split())\nif a+(x-a) ==x or a==x:\n print \"YES\"\nelse:\n print \"NO\"", "language": "Python", "metadata": {"date": 1582391566, "filename_ext": "py", "original_language": "Python (2.7.6)", "problem_description_relpath": "problem_descriptions/p03377.html", "problem_id": "p03377", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03377/input.txt", "sample_output_relpath": "derived/input_output/data/p03377/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03377/Python/s383639548.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s383639548", "user_id": "u346677493"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "a,b,x=map(int,raw_input().split())\nif a+(x-a) ==x or a==x:\n print \"YES\"\nelse:\n print \"NO\"", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are a total of A + B cats and dogs.\nAmong them, A are known to be cats, but the remaining B are not known to be either cats or dogs.\n\nDetermine if it is possible that there are exactly X cats among these A + B animals.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\n1 \\leq X \\leq 200\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B X\n\nOutput\n\nIf it is possible that there are exactly X cats, print YES; if it is impossible, print NO.\n\nSample Input 1\n\n3 5 4\n\nSample Output 1\n\nYES\n\nIf there are one cat and four dogs among the B = 5 animals, there are X = 4 cats in total.\n\nSample Input 2\n\n2 2 6\n\nSample Output 2\n\nNO\n\nEven if all of the B = 2 animals are cats, there are less than X = 6 cats in total.\n\nSample Input 3\n\n5 3 2\n\nSample Output 3\n\nNO\n\nEven if all of the B = 3 animals are dogs, there are more than X = 2 cats in total.", "sample_input": "3 5 4\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03377", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are a total of A + B cats and dogs.\nAmong them, A are known to be cats, but the remaining B are not known to be either cats or dogs.\n\nDetermine if it is possible that there are exactly X cats among these A + B animals.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\n1 \\leq X \\leq 200\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B X\n\nOutput\n\nIf it is possible that there are exactly X cats, print YES; if it is impossible, print NO.\n\nSample Input 1\n\n3 5 4\n\nSample Output 1\n\nYES\n\nIf there are one cat and four dogs among the B = 5 animals, there are X = 4 cats in total.\n\nSample Input 2\n\n2 2 6\n\nSample Output 2\n\nNO\n\nEven if all of the B = 2 animals are cats, there are less than X = 6 cats in total.\n\nSample Input 3\n\n5 3 2\n\nSample Output 3\n\nNO\n\nEven if all of the B = 3 animals are dogs, there are more than X = 2 cats in total.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 91, "cpu_time_ms": 10, "memory_kb": 2568}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s599206397", "group_id": "codeNet:p03377", "input_text": "A,B,X=map(int,input().split())\nif A<=X and X<=A+B:\n print(\"YES\")\nelse:\n print(\"NO\")\n", "language": "Python", "metadata": {"date": 1541293310, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03377.html", "problem_id": "p03377", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03377/input.txt", "sample_output_relpath": "derived/input_output/data/p03377/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03377/Python/s599206397.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s599206397", "user_id": "u390694622"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "A,B,X=map(int,input().split())\nif A<=X and X<=A+B:\n print(\"YES\")\nelse:\n print(\"NO\")\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are a total of A + B cats and dogs.\nAmong them, A are known to be cats, but the remaining B are not known to be either cats or dogs.\n\nDetermine if it is possible that there are exactly X cats among these A + B animals.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\n1 \\leq X \\leq 200\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B X\n\nOutput\n\nIf it is possible that there are exactly X cats, print YES; if it is impossible, print NO.\n\nSample Input 1\n\n3 5 4\n\nSample Output 1\n\nYES\n\nIf there are one cat and four dogs among the B = 5 animals, there are X = 4 cats in total.\n\nSample Input 2\n\n2 2 6\n\nSample Output 2\n\nNO\n\nEven if all of the B = 2 animals are cats, there are less than X = 6 cats in total.\n\nSample Input 3\n\n5 3 2\n\nSample Output 3\n\nNO\n\nEven if all of the B = 3 animals are dogs, there are more than X = 2 cats in total.", "sample_input": "3 5 4\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03377", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are a total of A + B cats and dogs.\nAmong them, A are known to be cats, but the remaining B are not known to be either cats or dogs.\n\nDetermine if it is possible that there are exactly X cats among these A + B animals.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\n1 \\leq X \\leq 200\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B X\n\nOutput\n\nIf it is possible that there are exactly X cats, print YES; if it is impossible, print NO.\n\nSample Input 1\n\n3 5 4\n\nSample Output 1\n\nYES\n\nIf there are one cat and four dogs among the B = 5 animals, there are X = 4 cats in total.\n\nSample Input 2\n\n2 2 6\n\nSample Output 2\n\nNO\n\nEven if all of the B = 2 animals are cats, there are less than X = 6 cats in total.\n\nSample Input 3\n\n5 3 2\n\nSample Output 3\n\nNO\n\nEven if all of the B = 3 animals are dogs, there are more than X = 2 cats in total.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 86, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s324902352", "group_id": "codeNet:p03378", "input_text": "import numpy as np\n\nn, m, x = map(int, input().split())\na_list = np.array(list(map(int, input().split())))\n\nupper = np.sum((a_list > x))\nlower = len(a_list) - upper\n\nprint(min(lower, upper))", "language": "Python", "metadata": {"date": 1568528628, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03378.html", "problem_id": "p03378", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03378/input.txt", "sample_output_relpath": "derived/input_output/data/p03378/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03378/Python/s324902352.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s324902352", "user_id": "u089376182"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import numpy as np\n\nn, m, x = map(int, input().split())\na_list = np.array(list(map(int, input().split())))\n\nupper = np.sum((a_list > x))\nlower = len(a_list) - upper\n\nprint(min(lower, upper))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to right.\n\nInitially, you are in Square X.\nYou can freely travel between adjacent squares. Your goal is to reach Square 0 or Square N.\nHowever, for each i = 1, 2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i incurs a cost of 1.\nIt is guaranteed that there is no toll gate in Square 0, Square X and Square N.\n\nFind the minimum cost incurred before reaching the goal.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq 100\n\n1 \\leq X \\leq N - 1\n\n1 \\leq A_1 < A_2 < ... < A_M \\leq N\n\nA_i \\neq X\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X\nA_1 A_2 ... A_M\n\nOutput\n\nPrint the minimum cost incurred before reaching the goal.\n\nSample Input 1\n\n5 3 3\n1 2 4\n\nSample Output 1\n\n1\n\nThe optimal solution is as follows:\n\nFirst, travel from Square 3 to Square 4. Here, there is a toll gate in Square 4, so the cost of 1 is incurred.\n\nThen, travel from Square 4 to Square 5. This time, no cost is incurred.\n\nNow, we are in Square 5 and we have reached the goal.\n\nIn this case, the total cost incurred is 1.\n\nSample Input 2\n\n7 3 2\n4 5 6\n\nSample Output 2\n\n0\n\nWe may be able to reach the goal at no cost.\n\nSample Input 3\n\n10 7 5\n1 2 3 4 6 8 9\n\nSample Output 3\n\n3", "sample_input": "5 3 3\n1 2 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03378", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to right.\n\nInitially, you are in Square X.\nYou can freely travel between adjacent squares. Your goal is to reach Square 0 or Square N.\nHowever, for each i = 1, 2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i incurs a cost of 1.\nIt is guaranteed that there is no toll gate in Square 0, Square X and Square N.\n\nFind the minimum cost incurred before reaching the goal.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq 100\n\n1 \\leq X \\leq N - 1\n\n1 \\leq A_1 < A_2 < ... < A_M \\leq N\n\nA_i \\neq X\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X\nA_1 A_2 ... A_M\n\nOutput\n\nPrint the minimum cost incurred before reaching the goal.\n\nSample Input 1\n\n5 3 3\n1 2 4\n\nSample Output 1\n\n1\n\nThe optimal solution is as follows:\n\nFirst, travel from Square 3 to Square 4. Here, there is a toll gate in Square 4, so the cost of 1 is incurred.\n\nThen, travel from Square 4 to Square 5. This time, no cost is incurred.\n\nNow, we are in Square 5 and we have reached the goal.\n\nIn this case, the total cost incurred is 1.\n\nSample Input 2\n\n7 3 2\n4 5 6\n\nSample Output 2\n\n0\n\nWe may be able to reach the goal at no cost.\n\nSample Input 3\n\n10 7 5\n1 2 3 4 6 8 9\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 190, "cpu_time_ms": 156, "memory_kb": 12488}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s387768055", "group_id": "codeNet:p03378", "input_text": "_,M,X = list(map(int,input().split()))\na = list(map(int,input().split()))\nfor i,c in enumerate(a):\n if X < c:\n print(min(i,M-i))\n break", "language": "Python", "metadata": {"date": 1558703406, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03378.html", "problem_id": "p03378", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03378/input.txt", "sample_output_relpath": "derived/input_output/data/p03378/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03378/Python/s387768055.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s387768055", "user_id": "u007550226"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "_,M,X = list(map(int,input().split()))\na = list(map(int,input().split()))\nfor i,c in enumerate(a):\n if X < c:\n print(min(i,M-i))\n break", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to right.\n\nInitially, you are in Square X.\nYou can freely travel between adjacent squares. Your goal is to reach Square 0 or Square N.\nHowever, for each i = 1, 2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i incurs a cost of 1.\nIt is guaranteed that there is no toll gate in Square 0, Square X and Square N.\n\nFind the minimum cost incurred before reaching the goal.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq 100\n\n1 \\leq X \\leq N - 1\n\n1 \\leq A_1 < A_2 < ... < A_M \\leq N\n\nA_i \\neq X\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X\nA_1 A_2 ... A_M\n\nOutput\n\nPrint the minimum cost incurred before reaching the goal.\n\nSample Input 1\n\n5 3 3\n1 2 4\n\nSample Output 1\n\n1\n\nThe optimal solution is as follows:\n\nFirst, travel from Square 3 to Square 4. Here, there is a toll gate in Square 4, so the cost of 1 is incurred.\n\nThen, travel from Square 4 to Square 5. This time, no cost is incurred.\n\nNow, we are in Square 5 and we have reached the goal.\n\nIn this case, the total cost incurred is 1.\n\nSample Input 2\n\n7 3 2\n4 5 6\n\nSample Output 2\n\n0\n\nWe may be able to reach the goal at no cost.\n\nSample Input 3\n\n10 7 5\n1 2 3 4 6 8 9\n\nSample Output 3\n\n3", "sample_input": "5 3 3\n1 2 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03378", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to right.\n\nInitially, you are in Square X.\nYou can freely travel between adjacent squares. Your goal is to reach Square 0 or Square N.\nHowever, for each i = 1, 2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i incurs a cost of 1.\nIt is guaranteed that there is no toll gate in Square 0, Square X and Square N.\n\nFind the minimum cost incurred before reaching the goal.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq 100\n\n1 \\leq X \\leq N - 1\n\n1 \\leq A_1 < A_2 < ... < A_M \\leq N\n\nA_i \\neq X\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X\nA_1 A_2 ... A_M\n\nOutput\n\nPrint the minimum cost incurred before reaching the goal.\n\nSample Input 1\n\n5 3 3\n1 2 4\n\nSample Output 1\n\n1\n\nThe optimal solution is as follows:\n\nFirst, travel from Square 3 to Square 4. Here, there is a toll gate in Square 4, so the cost of 1 is incurred.\n\nThen, travel from Square 4 to Square 5. This time, no cost is incurred.\n\nNow, we are in Square 5 and we have reached the goal.\n\nIn this case, the total cost incurred is 1.\n\nSample Input 2\n\n7 3 2\n4 5 6\n\nSample Output 2\n\n0\n\nWe may be able to reach the goal at no cost.\n\nSample Input 3\n\n10 7 5\n1 2 3 4 6 8 9\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 152, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s843630199", "group_id": "codeNet:p03379", "input_text": "import sys\nif __name__ == \"__main__\":\n N = int(input())\n X = list(map(int, (input().split(' '))))\n buf = sorted(X)\n for i in range(N):\n# buf = list(X)\n# buf.pop(i)\n# buf = sorted(buf)\n# print(X[i])\n# print(buf[int(N/2)])\n if X[i] < buf[int(N/2)]:\n print(buf[int(N/2)])\n else:\n print(buf[int(N/2)-1])", "language": "Python", "metadata": {"date": 1523756777, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03379.html", "problem_id": "p03379", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03379/input.txt", "sample_output_relpath": "derived/input_output/data/p03379/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03379/Python/s843630199.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s843630199", "user_id": "u315838013"}, "prompt_components": {"gold_output": "4\n3\n3\n4\n", "input_to_evaluate": "import sys\nif __name__ == \"__main__\":\n N = int(input())\n X = list(map(int, (input().split(' '))))\n buf = sorted(X)\n for i in range(N):\n# buf = list(X)\n# buf.pop(i)\n# buf = sorted(buf)\n# print(X[i])\n# print(buf[int(N/2)])\n if X[i] < buf[int(N/2)]:\n print(buf[int(N/2)])\n else:\n print(buf[int(N/2)-1])", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWhen l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l.\n\nYou are given N numbers X_1, X_2, ..., X_N, where N is an even number.\nFor each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..., X_{i-1}, X_{i+1}, ..., X_N be B_i.\n\nFind B_i for each i = 1, 2, ..., N.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\nN is even.\n\n1 \\leq X_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 X_2 ... X_N\n\nOutput\n\nPrint N lines.\nThe i-th line should contain B_i.\n\nSample Input 1\n\n4\n2 4 4 3\n\nSample Output 1\n\n4\n3\n3\n4\n\nSince the median of X_2, X_3, X_4 is 4, B_1 = 4.\n\nSince the median of X_1, X_3, X_4 is 3, B_2 = 3.\n\nSince the median of X_1, X_2, X_4 is 3, B_3 = 3.\n\nSince the median of X_1, X_2, X_3 is 4, B_4 = 4.\n\nSample Input 2\n\n2\n1 2\n\nSample Output 2\n\n2\n1\n\nSample Input 3\n\n6\n5 5 4 4 3 3\n\nSample Output 3\n\n4\n4\n4\n4\n4\n4", "sample_input": "4\n2 4 4 3\n"}, "reference_outputs": ["4\n3\n3\n4\n"], "source_document_id": "p03379", "source_text": "Score : 300 points\n\nProblem Statement\n\nWhen l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l.\n\nYou are given N numbers X_1, X_2, ..., X_N, where N is an even number.\nFor each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..., X_{i-1}, X_{i+1}, ..., X_N be B_i.\n\nFind B_i for each i = 1, 2, ..., N.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\nN is even.\n\n1 \\leq X_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 X_2 ... X_N\n\nOutput\n\nPrint N lines.\nThe i-th line should contain B_i.\n\nSample Input 1\n\n4\n2 4 4 3\n\nSample Output 1\n\n4\n3\n3\n4\n\nSince the median of X_2, X_3, X_4 is 4, B_1 = 4.\n\nSince the median of X_1, X_3, X_4 is 3, B_2 = 3.\n\nSince the median of X_1, X_2, X_4 is 3, B_3 = 3.\n\nSince the median of X_1, X_2, X_3 is 4, B_4 = 4.\n\nSample Input 2\n\n2\n1 2\n\nSample Output 2\n\n2\n1\n\nSample Input 3\n\n6\n5 5 4 4 3 3\n\nSample Output 3\n\n4\n4\n4\n4\n4\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 382, "cpu_time_ms": 391, "memory_kb": 26772}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s642522043", "group_id": "codeNet:p03380", "input_text": "n=int(input())\na=sorted(list(map(int,input().split())))\nb=a.pop(-1)\nd=0\ne=0\nfor i in [n//2-1,n//2]:\n c=1\n A=a[i]\n for j in range(i+1)[A:i+1]:\n c*=j\n for k in range(1,A+1):\n c/=k\n if d < c:\n d=c\n e=A\nprint(b,e)\n", "language": "Python", "metadata": {"date": 1541310625, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03380.html", "problem_id": "p03380", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03380/input.txt", "sample_output_relpath": "derived/input_output/data/p03380/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03380/Python/s642522043.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s642522043", "user_id": "u853900545"}, "prompt_components": {"gold_output": "11 6\n", "input_to_evaluate": "n=int(input())\na=sorted(list(map(int,input().split())))\nb=a.pop(-1)\nd=0\ne=0\nfor i in [n//2-1,n//2]:\n c=1\n A=a[i]\n for j in range(i+1)[A:i+1]:\n c*=j\n for k in range(1,A+1):\n c/=k\n if d < c:\n d=c\n e=A\nprint(b,e)\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nLet {\\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order.\nFrom n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\\rm comb}(a_i,a_j) is maximized.\nIf there are multiple pairs that maximize the value, any of them is accepted.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\n0 \\leq a_i \\leq 10^9\n\na_1,a_2,...,a_n are pairwise distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint a_i and a_j that you selected, with a space in between.\n\nSample Input 1\n\n5\n6 9 4 2 11\n\nSample Output 1\n\n11 6\n\n\\rm{comb}(a_i,a_j) for each possible selection is as follows:\n\n\\rm{comb}(4,2)=6\n\n\\rm{comb}(6,2)=15\n\n\\rm{comb}(6,4)=15\n\n\\rm{comb}(9,2)=36\n\n\\rm{comb}(9,4)=126\n\n\\rm{comb}(9,6)=84\n\n\\rm{comb}(11,2)=55\n\n\\rm{comb}(11,4)=330\n\n\\rm{comb}(11,6)=462\n\n\\rm{comb}(11,9)=55\n\nThus, we should print 11 and 6.\n\nSample Input 2\n\n2\n100 0\n\nSample Output 2\n\n100 0", "sample_input": "5\n6 9 4 2 11\n"}, "reference_outputs": ["11 6\n"], "source_document_id": "p03380", "source_text": "Score : 400 points\n\nProblem Statement\n\nLet {\\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order.\nFrom n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\\rm comb}(a_i,a_j) is maximized.\nIf there are multiple pairs that maximize the value, any of them is accepted.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\n0 \\leq a_i \\leq 10^9\n\na_1,a_2,...,a_n are pairwise distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint a_i and a_j that you selected, with a space in between.\n\nSample Input 1\n\n5\n6 9 4 2 11\n\nSample Output 1\n\n11 6\n\n\\rm{comb}(a_i,a_j) for each possible selection is as follows:\n\n\\rm{comb}(4,2)=6\n\n\\rm{comb}(6,2)=15\n\n\\rm{comb}(6,4)=15\n\n\\rm{comb}(9,2)=36\n\n\\rm{comb}(9,4)=126\n\n\\rm{comb}(9,6)=84\n\n\\rm{comb}(11,2)=55\n\n\\rm{comb}(11,4)=330\n\n\\rm{comb}(11,6)=462\n\n\\rm{comb}(11,9)=55\n\nThus, we should print 11 and 6.\n\nSample Input 2\n\n2\n100 0\n\nSample Output 2\n\n100 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 253, "cpu_time_ms": 2104, "memory_kb": 14428}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s275272970", "group_id": "codeNet:p03380", "input_text": "import sys\n\nstdin = sys.stdin\n\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nns = lambda: stdin.readline().strip()\n\nn = ni()\na = na()\n\nif n == 2:\n if a[0] > a[1]:\n print(a[0],a[1])\n else:\n print(a[1],a[0])\nelse:\n x = max(a)\n mid = x / 2\n a.remove(x)\n\n diff = mid - a[0]\n ans = 0\n for i in range(len(a)):\n if diff > abs(mid - a[i]):\n diff = abs(mid - a[i])\n ans = i\n print(x,a[ans])\n", "language": "Python", "metadata": {"date": 1523758514, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03380.html", "problem_id": "p03380", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03380/input.txt", "sample_output_relpath": "derived/input_output/data/p03380/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03380/Python/s275272970.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s275272970", "user_id": "u597436499"}, "prompt_components": {"gold_output": "11 6\n", "input_to_evaluate": "import sys\n\nstdin = sys.stdin\n\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nns = lambda: stdin.readline().strip()\n\nn = ni()\na = na()\n\nif n == 2:\n if a[0] > a[1]:\n print(a[0],a[1])\n else:\n print(a[1],a[0])\nelse:\n x = max(a)\n mid = x / 2\n a.remove(x)\n\n diff = mid - a[0]\n ans = 0\n for i in range(len(a)):\n if diff > abs(mid - a[i]):\n diff = abs(mid - a[i])\n ans = i\n print(x,a[ans])\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nLet {\\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order.\nFrom n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\\rm comb}(a_i,a_j) is maximized.\nIf there are multiple pairs that maximize the value, any of them is accepted.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\n0 \\leq a_i \\leq 10^9\n\na_1,a_2,...,a_n are pairwise distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint a_i and a_j that you selected, with a space in between.\n\nSample Input 1\n\n5\n6 9 4 2 11\n\nSample Output 1\n\n11 6\n\n\\rm{comb}(a_i,a_j) for each possible selection is as follows:\n\n\\rm{comb}(4,2)=6\n\n\\rm{comb}(6,2)=15\n\n\\rm{comb}(6,4)=15\n\n\\rm{comb}(9,2)=36\n\n\\rm{comb}(9,4)=126\n\n\\rm{comb}(9,6)=84\n\n\\rm{comb}(11,2)=55\n\n\\rm{comb}(11,4)=330\n\n\\rm{comb}(11,6)=462\n\n\\rm{comb}(11,9)=55\n\nThus, we should print 11 and 6.\n\nSample Input 2\n\n2\n100 0\n\nSample Output 2\n\n100 0", "sample_input": "5\n6 9 4 2 11\n"}, "reference_outputs": ["11 6\n"], "source_document_id": "p03380", "source_text": "Score : 400 points\n\nProblem Statement\n\nLet {\\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order.\nFrom n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\\rm comb}(a_i,a_j) is maximized.\nIf there are multiple pairs that maximize the value, any of them is accepted.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\n0 \\leq a_i \\leq 10^9\n\na_1,a_2,...,a_n are pairwise distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint a_i and a_j that you selected, with a space in between.\n\nSample Input 1\n\n5\n6 9 4 2 11\n\nSample Output 1\n\n11 6\n\n\\rm{comb}(a_i,a_j) for each possible selection is as follows:\n\n\\rm{comb}(4,2)=6\n\n\\rm{comb}(6,2)=15\n\n\\rm{comb}(6,4)=15\n\n\\rm{comb}(9,2)=36\n\n\\rm{comb}(9,4)=126\n\n\\rm{comb}(9,6)=84\n\n\\rm{comb}(11,2)=55\n\n\\rm{comb}(11,4)=330\n\n\\rm{comb}(11,6)=462\n\n\\rm{comb}(11,9)=55\n\nThus, we should print 11 and 6.\n\nSample Input 2\n\n2\n100 0\n\nSample Output 2\n\n100 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 483, "cpu_time_ms": 72, "memory_kb": 14432}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s371964992", "group_id": "codeNet:p03385", "input_text": "#coding:utf-8\nn=[int(i) for i in input().split()]\nif(n[1]-n[0]+1<=2*n[2]):\n for i in range(n[0],n[1]+1):\n print(i)\nelse:\n for j in range(n[0],n[0]+n[2]):\n print(j)\n for k in range(n[1]-n[2]+1,n[1]+1):\n print(k)\n", "language": "Python", "metadata": {"date": 1531850129, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03385.html", "problem_id": "p03385", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03385/input.txt", "sample_output_relpath": "derived/input_output/data/p03385/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03385/Python/s371964992.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s371964992", "user_id": "u636775911"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "#coding:utf-8\nn=[int(i) for i in input().split()]\nif(n[1]-n[0]+1<=2*n[2]):\n for i in range(n[0],n[1]+1):\n print(i)\nelse:\n for j in range(n[0],n[0]+n[2]):\n print(j)\n for k in range(n[1]-n[2]+1,n[1]+1):\n print(k)\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S of length 3 consisting of a, b and c. Determine if S can be obtained by permuting abc.\n\nConstraints\n\n|S|=3\n\nS consists of a, b and c.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S can be obtained by permuting abc, print Yes; otherwise, print No.\n\nSample Input 1\n\nbac\n\nSample Output 1\n\nYes\n\nSwapping the first and second characters in bac results in abc.\n\nSample Input 2\n\nbab\n\nSample Output 2\n\nNo\n\nSample Input 3\n\nabc\n\nSample Output 3\n\nYes\n\nSample Input 4\n\naaa\n\nSample Output 4\n\nNo", "sample_input": "bac\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03385", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S of length 3 consisting of a, b and c. Determine if S can be obtained by permuting abc.\n\nConstraints\n\n|S|=3\n\nS consists of a, b and c.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S can be obtained by permuting abc, print Yes; otherwise, print No.\n\nSample Input 1\n\nbac\n\nSample Output 1\n\nYes\n\nSwapping the first and second characters in bac results in abc.\n\nSample Input 2\n\nbab\n\nSample Output 2\n\nNo\n\nSample Input 3\n\nabc\n\nSample Output 3\n\nYes\n\nSample Input 4\n\naaa\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 223, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s035228725", "group_id": "codeNet:p03386", "input_text": "import sys\nimport math\nimport collections\nimport itertools\nimport array\nimport inspect\n\n# Set max recursion limit\nsys.setrecursionlimit(10000)\n\n# Debug output\n\n\ndef chkprint(*args):\n names = {id(v): k for k, v in inspect.currentframe().f_back.f_locals.items()}\n print(', '.join(names.get(id(arg), '???')+' = '+repr(arg) for arg in args))\n\n# Binary converter\n\n\ndef to_bin(x):\n return bin(x)[2:]\n\n\ndef li_input():\n return [int(_) for _ in input().split()]\n\n# --------------------------------------------\n\n\ndp = None\n\n\ndef main():\n A, B, K = li_input()\n\n C = []\n\n for i in range(A, A + K):\n C.append(i)\n\n for i in range(B - K + 1, B + 1):\n if i not in C:\n C.append(i)\n\n for c in C:\n print(c)\n\n\nmain()\n", "language": "Python", "metadata": {"date": 1533496273, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03386.html", "problem_id": "p03386", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03386/input.txt", "sample_output_relpath": "derived/input_output/data/p03386/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03386/Python/s035228725.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s035228725", "user_id": "u255280439"}, "prompt_components": {"gold_output": "3\n4\n7\n8\n", "input_to_evaluate": "import sys\nimport math\nimport collections\nimport itertools\nimport array\nimport inspect\n\n# Set max recursion limit\nsys.setrecursionlimit(10000)\n\n# Debug output\n\n\ndef chkprint(*args):\n names = {id(v): k for k, v in inspect.currentframe().f_back.f_locals.items()}\n print(', '.join(names.get(id(arg), '???')+' = '+repr(arg) for arg in args))\n\n# Binary converter\n\n\ndef to_bin(x):\n return bin(x)[2:]\n\n\ndef li_input():\n return [int(_) for _ in input().split()]\n\n# --------------------------------------------\n\n\ndp = None\n\n\ndef main():\n A, B, K = li_input()\n\n C = []\n\n for i in range(A, A + K):\n C.append(i)\n\n for i in range(B - K + 1, B + 1):\n if i not in C:\n C.append(i)\n\n for c in C:\n print(c)\n\n\nmain()\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nPrint all the integers that satisfies the following in ascending order:\n\nAmong the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers.\n\nConstraints\n\n1 \\leq A \\leq B \\leq 10^9\n\n1 \\leq K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint all the integers that satisfies the condition above in ascending order.\n\nSample Input 1\n\n3 8 2\n\nSample Output 1\n\n3\n4\n7\n8\n\n3 is the first smallest integer among the integers between 3 and 8.\n\n4 is the second smallest integer among the integers between 3 and 8.\n\n7 is the second largest integer among the integers between 3 and 8.\n\n8 is the first largest integer among the integers between 3 and 8.\n\nSample Input 2\n\n4 8 3\n\nSample Output 2\n\n4\n5\n6\n7\n8\n\nSample Input 3\n\n2 9 100\n\nSample Output 3\n\n2\n3\n4\n5\n6\n7\n8\n9", "sample_input": "3 8 2\n"}, "reference_outputs": ["3\n4\n7\n8\n"], "source_document_id": "p03386", "source_text": "Score : 200 points\n\nProblem Statement\n\nPrint all the integers that satisfies the following in ascending order:\n\nAmong the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers.\n\nConstraints\n\n1 \\leq A \\leq B \\leq 10^9\n\n1 \\leq K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint all the integers that satisfies the condition above in ascending order.\n\nSample Input 1\n\n3 8 2\n\nSample Output 1\n\n3\n4\n7\n8\n\n3 is the first smallest integer among the integers between 3 and 8.\n\n4 is the second smallest integer among the integers between 3 and 8.\n\n7 is the second largest integer among the integers between 3 and 8.\n\n8 is the first largest integer among the integers between 3 and 8.\n\nSample Input 2\n\n4 8 3\n\nSample Output 2\n\n4\n5\n6\n7\n8\n\nSample Input 3\n\n2 9 100\n\nSample Output 3\n\n2\n3\n4\n5\n6\n7\n8\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 757, "cpu_time_ms": 37, "memory_kb": 4628}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s584344877", "group_id": "codeNet:p03387", "input_text": "import sys\ninput=sys.stdin.readline\n\nl=list(map(int,input().split()))\na,b,c=sorted(l)\n#print(a,b,c)\nif a%2==b%2 and a%2==c%2:\n print((2*c-a-b)//2)\nelif a%2==b%2:\n print((2*c-2-a-b)//2+1)\nelse:\n print((2*c+1-a-b)//2+1)", "language": "Python", "metadata": {"date": 1541581473, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03387.html", "problem_id": "p03387", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03387/input.txt", "sample_output_relpath": "derived/input_output/data/p03387/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03387/Python/s584344877.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s584344877", "user_id": "u652150585"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import sys\ninput=sys.stdin.readline\n\nl=list(map(int,input().split()))\na,b,c=sorted(l)\n#print(a,b,c)\nif a%2==b%2 and a%2==c%2:\n print((2*c-a-b)//2)\nelif a%2==b%2:\n print((2*c-2-a-b)//2+1)\nelse:\n print((2*c+1-a-b)//2+1)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order:\n\nChoose two among A, B and C, then increase both by 1.\n\nChoose one among A, B and C, then increase it by 2.\n\nIt can be proved that we can always make A, B and C all equal by repeatedly performing these operations.\n\nConstraints\n\n0 \\leq A,B,C \\leq 50\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the minimum number of operations required to make A, B and C all equal.\n\nSample Input 1\n\n2 5 4\n\nSample Output 1\n\n2\n\nWe can make A, B and C all equal by the following operations:\n\nIncrease A and C by 1. Now, A, B, C are 3, 5, 5, respectively.\n\nIncrease A by 2. Now, A, B, C are 5, 5, 5, respectively.\n\nSample Input 2\n\n2 6 3\n\nSample Output 2\n\n5\n\nSample Input 3\n\n31 41 5\n\nSample Output 3\n\n23", "sample_input": "2 5 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03387", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given three integers A, B and C. Find the minimum number of operations required to make A, B and C all equal by repeatedly performing the following two kinds of operations in any order:\n\nChoose two among A, B and C, then increase both by 1.\n\nChoose one among A, B and C, then increase it by 2.\n\nIt can be proved that we can always make A, B and C all equal by repeatedly performing these operations.\n\nConstraints\n\n0 \\leq A,B,C \\leq 50\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the minimum number of operations required to make A, B and C all equal.\n\nSample Input 1\n\n2 5 4\n\nSample Output 1\n\n2\n\nWe can make A, B and C all equal by the following operations:\n\nIncrease A and C by 1. Now, A, B, C are 3, 5, 5, respectively.\n\nIncrease A by 2. Now, A, B, C are 5, 5, 5, respectively.\n\nSample Input 2\n\n2 6 3\n\nSample Output 2\n\n5\n\nSample Input 3\n\n31 41 5\n\nSample Output 3\n\n23", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 226, "cpu_time_ms": 21, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s910708691", "group_id": "codeNet:p03400", "input_text": "N = int(input())\nD, X = map(int, input().split())\nans = X\nfor i in range(N):\n a = int(input())\n ans += ((D - 1) // a + 1)\nprint(ans)", "language": "Python", "metadata": {"date": 1599754556, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p03400.html", "problem_id": "p03400", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03400/input.txt", "sample_output_relpath": "derived/input_output/data/p03400/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03400/Python/s910708691.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s910708691", "user_id": "u666550725"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "N = int(input())\nD, X = map(int, input().split())\nans = X\nfor i in range(N):\n a = int(input())\n ans += ((D - 1) // a + 1)\nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSome number of chocolate pieces were prepared for a training camp.\nThe camp had N participants and lasted for D days.\nThe i-th participant (1 \\leq i \\leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on.\nAs a result, there were X chocolate pieces remaining at the end of the camp. During the camp, nobody except the participants ate chocolate pieces.\n\nFind the number of chocolate pieces prepared at the beginning of the camp.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq D \\leq 100\n\n1 \\leq X \\leq 100\n\n1 \\leq A_i \\leq 100 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nD X\nA_1\nA_2\n:\nA_N\n\nOutput\n\nFind the number of chocolate pieces prepared at the beginning of the camp.\n\nSample Input 1\n\n3\n7 1\n2\n5\n10\n\nSample Output 1\n\n8\n\nThe camp has 3 participants and lasts for 7 days.\nEach participant eats chocolate pieces as follows:\n\nThe first participant eats one chocolate piece on Day 1, 3, 5 and 7, for a total of four.\n\nThe second participant eats one chocolate piece on Day 1 and 6, for a total of two.\n\nThe third participant eats one chocolate piece only on Day 1, for a total of one.\n\nSince the number of pieces remaining at the end of the camp is one, the number of pieces prepared at the beginning of the camp is 1 + 4 + 2 + 1 = 8.\n\nSample Input 2\n\n2\n8 20\n1\n10\n\nSample Output 2\n\n29\n\nSample Input 3\n\n5\n30 44\n26\n18\n81\n18\n6\n\nSample Output 3\n\n56", "sample_input": "3\n7 1\n2\n5\n10\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03400", "source_text": "Score : 200 points\n\nProblem Statement\n\nSome number of chocolate pieces were prepared for a training camp.\nThe camp had N participants and lasted for D days.\nThe i-th participant (1 \\leq i \\leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on.\nAs a result, there were X chocolate pieces remaining at the end of the camp. During the camp, nobody except the participants ate chocolate pieces.\n\nFind the number of chocolate pieces prepared at the beginning of the camp.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq D \\leq 100\n\n1 \\leq X \\leq 100\n\n1 \\leq A_i \\leq 100 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nD X\nA_1\nA_2\n:\nA_N\n\nOutput\n\nFind the number of chocolate pieces prepared at the beginning of the camp.\n\nSample Input 1\n\n3\n7 1\n2\n5\n10\n\nSample Output 1\n\n8\n\nThe camp has 3 participants and lasts for 7 days.\nEach participant eats chocolate pieces as follows:\n\nThe first participant eats one chocolate piece on Day 1, 3, 5 and 7, for a total of four.\n\nThe second participant eats one chocolate piece on Day 1 and 6, for a total of two.\n\nThe third participant eats one chocolate piece only on Day 1, for a total of one.\n\nSince the number of pieces remaining at the end of the camp is one, the number of pieces prepared at the beginning of the camp is 1 + 4 + 2 + 1 = 8.\n\nSample Input 2\n\n2\n8 20\n1\n10\n\nSample Output 2\n\n29\n\nSample Input 3\n\n5\n30 44\n26\n18\n81\n18\n6\n\nSample Output 3\n\n56", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 134, "cpu_time_ms": 64, "memory_kb": 62428}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s651140063", "group_id": "codeNet:p03400", "input_text": "\"\"\" AtCoder \"\"\"\n\nN = int(input())\nD, X = map(int, input().split())\nA = [int(input()) for _ in range(N)]\n\nans = 0\n\nfor i in range(N):\n if D % A[i] > 0:\n ans += D // A[i] + 1\n else:\n ans += D // A[i]\n\nprint(ans + X)\n", "language": "Python", "metadata": {"date": 1549940636, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03400.html", "problem_id": "p03400", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03400/input.txt", "sample_output_relpath": "derived/input_output/data/p03400/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03400/Python/s651140063.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s651140063", "user_id": "u500297289"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "\"\"\" AtCoder \"\"\"\n\nN = int(input())\nD, X = map(int, input().split())\nA = [int(input()) for _ in range(N)]\n\nans = 0\n\nfor i in range(N):\n if D % A[i] > 0:\n ans += D // A[i] + 1\n else:\n ans += D // A[i]\n\nprint(ans + X)\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSome number of chocolate pieces were prepared for a training camp.\nThe camp had N participants and lasted for D days.\nThe i-th participant (1 \\leq i \\leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on.\nAs a result, there were X chocolate pieces remaining at the end of the camp. During the camp, nobody except the participants ate chocolate pieces.\n\nFind the number of chocolate pieces prepared at the beginning of the camp.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq D \\leq 100\n\n1 \\leq X \\leq 100\n\n1 \\leq A_i \\leq 100 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nD X\nA_1\nA_2\n:\nA_N\n\nOutput\n\nFind the number of chocolate pieces prepared at the beginning of the camp.\n\nSample Input 1\n\n3\n7 1\n2\n5\n10\n\nSample Output 1\n\n8\n\nThe camp has 3 participants and lasts for 7 days.\nEach participant eats chocolate pieces as follows:\n\nThe first participant eats one chocolate piece on Day 1, 3, 5 and 7, for a total of four.\n\nThe second participant eats one chocolate piece on Day 1 and 6, for a total of two.\n\nThe third participant eats one chocolate piece only on Day 1, for a total of one.\n\nSince the number of pieces remaining at the end of the camp is one, the number of pieces prepared at the beginning of the camp is 1 + 4 + 2 + 1 = 8.\n\nSample Input 2\n\n2\n8 20\n1\n10\n\nSample Output 2\n\n29\n\nSample Input 3\n\n5\n30 44\n26\n18\n81\n18\n6\n\nSample Output 3\n\n56", "sample_input": "3\n7 1\n2\n5\n10\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03400", "source_text": "Score : 200 points\n\nProblem Statement\n\nSome number of chocolate pieces were prepared for a training camp.\nThe camp had N participants and lasted for D days.\nThe i-th participant (1 \\leq i \\leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on.\nAs a result, there were X chocolate pieces remaining at the end of the camp. During the camp, nobody except the participants ate chocolate pieces.\n\nFind the number of chocolate pieces prepared at the beginning of the camp.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq D \\leq 100\n\n1 \\leq X \\leq 100\n\n1 \\leq A_i \\leq 100 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nD X\nA_1\nA_2\n:\nA_N\n\nOutput\n\nFind the number of chocolate pieces prepared at the beginning of the camp.\n\nSample Input 1\n\n3\n7 1\n2\n5\n10\n\nSample Output 1\n\n8\n\nThe camp has 3 participants and lasts for 7 days.\nEach participant eats chocolate pieces as follows:\n\nThe first participant eats one chocolate piece on Day 1, 3, 5 and 7, for a total of four.\n\nThe second participant eats one chocolate piece on Day 1 and 6, for a total of two.\n\nThe third participant eats one chocolate piece only on Day 1, for a total of one.\n\nSince the number of pieces remaining at the end of the camp is one, the number of pieces prepared at the beginning of the camp is 1 + 4 + 2 + 1 = 8.\n\nSample Input 2\n\n2\n8 20\n1\n10\n\nSample Output 2\n\n29\n\nSample Input 3\n\n5\n30 44\n26\n18\n81\n18\n6\n\nSample Output 3\n\n56", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 234, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s470342317", "group_id": "codeNet:p03400", "input_text": "N = int(input())\nD,X = map(int,input().split())\nA = [0]*N\nfor i in range(N):\n A[i] = int(input())\ncnt = 0\nfor i in range(N):\n cnt += (D-1)//A[i]+1\nprint(X+cnt)", "language": "Python", "metadata": {"date": 1522027335, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03400.html", "problem_id": "p03400", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03400/input.txt", "sample_output_relpath": "derived/input_output/data/p03400/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03400/Python/s470342317.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s470342317", "user_id": "u614459338"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "N = int(input())\nD,X = map(int,input().split())\nA = [0]*N\nfor i in range(N):\n A[i] = int(input())\ncnt = 0\nfor i in range(N):\n cnt += (D-1)//A[i]+1\nprint(X+cnt)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSome number of chocolate pieces were prepared for a training camp.\nThe camp had N participants and lasted for D days.\nThe i-th participant (1 \\leq i \\leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on.\nAs a result, there were X chocolate pieces remaining at the end of the camp. During the camp, nobody except the participants ate chocolate pieces.\n\nFind the number of chocolate pieces prepared at the beginning of the camp.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq D \\leq 100\n\n1 \\leq X \\leq 100\n\n1 \\leq A_i \\leq 100 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nD X\nA_1\nA_2\n:\nA_N\n\nOutput\n\nFind the number of chocolate pieces prepared at the beginning of the camp.\n\nSample Input 1\n\n3\n7 1\n2\n5\n10\n\nSample Output 1\n\n8\n\nThe camp has 3 participants and lasts for 7 days.\nEach participant eats chocolate pieces as follows:\n\nThe first participant eats one chocolate piece on Day 1, 3, 5 and 7, for a total of four.\n\nThe second participant eats one chocolate piece on Day 1 and 6, for a total of two.\n\nThe third participant eats one chocolate piece only on Day 1, for a total of one.\n\nSince the number of pieces remaining at the end of the camp is one, the number of pieces prepared at the beginning of the camp is 1 + 4 + 2 + 1 = 8.\n\nSample Input 2\n\n2\n8 20\n1\n10\n\nSample Output 2\n\n29\n\nSample Input 3\n\n5\n30 44\n26\n18\n81\n18\n6\n\nSample Output 3\n\n56", "sample_input": "3\n7 1\n2\n5\n10\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03400", "source_text": "Score : 200 points\n\nProblem Statement\n\nSome number of chocolate pieces were prepared for a training camp.\nThe camp had N participants and lasted for D days.\nThe i-th participant (1 \\leq i \\leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on.\nAs a result, there were X chocolate pieces remaining at the end of the camp. During the camp, nobody except the participants ate chocolate pieces.\n\nFind the number of chocolate pieces prepared at the beginning of the camp.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq D \\leq 100\n\n1 \\leq X \\leq 100\n\n1 \\leq A_i \\leq 100 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nD X\nA_1\nA_2\n:\nA_N\n\nOutput\n\nFind the number of chocolate pieces prepared at the beginning of the camp.\n\nSample Input 1\n\n3\n7 1\n2\n5\n10\n\nSample Output 1\n\n8\n\nThe camp has 3 participants and lasts for 7 days.\nEach participant eats chocolate pieces as follows:\n\nThe first participant eats one chocolate piece on Day 1, 3, 5 and 7, for a total of four.\n\nThe second participant eats one chocolate piece on Day 1 and 6, for a total of two.\n\nThe third participant eats one chocolate piece only on Day 1, for a total of one.\n\nSince the number of pieces remaining at the end of the camp is one, the number of pieces prepared at the beginning of the camp is 1 + 4 + 2 + 1 = 8.\n\nSample Input 2\n\n2\n8 20\n1\n10\n\nSample Output 2\n\n29\n\nSample Input 3\n\n5\n30 44\n26\n18\n81\n18\n6\n\nSample Output 3\n\n56", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 165, "cpu_time_ms": 18, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s872993486", "group_id": "codeNet:p03401", "input_text": "N = int(input())\nA = list(map(int, input().split()))\n\ntotal = abs(A[0])\ncancel = [0 for _ in range(N)]\ncancel[0] = abs(A[1]) - (abs(A[1] - A[0]) + abs(A[0]))\n\nfor i in range(1, N-1):\n total += abs(A[i]-A[i-1])\n cancel[i] = abs(A[i+1] - A[i-1]) - (abs(A[i+1] - A[i]) + abs(A[i] - A[i-1]))\n\ntotal += abs(A[N-1]-A[N-2]) + abs(A[N-1])\ncancel[N-1] = abs(A[N-2]) - (abs(A[N-1]) + abs(A[N-1] - A[N-2]))\n\nfor c in cancel:\n print(total+c)\n", "language": "Python", "metadata": {"date": 1558619066, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03401.html", "problem_id": "p03401", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03401/input.txt", "sample_output_relpath": "derived/input_output/data/p03401/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03401/Python/s872993486.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s872993486", "user_id": "u599170882"}, "prompt_components": {"gold_output": "12\n8\n10\n", "input_to_evaluate": "N = int(input())\nA = list(map(int, input().split()))\n\ntotal = abs(A[0])\ncancel = [0 for _ in range(N)]\ncancel[0] = abs(A[1]) - (abs(A[1] - A[0]) + abs(A[0]))\n\nfor i in range(1, N-1):\n total += abs(A[i]-A[i-1])\n cancel[i] = abs(A[i+1] - A[i-1]) - (abs(A[i+1] - A[i]) + abs(A[i] - A[i-1]))\n\ntotal += abs(A[N-1]-A[N-2]) + abs(A[N-1])\ncancel[N-1] = abs(A[N-2]) - (abs(A[N-1]) + abs(A[N-1] - A[N-2]))\n\nfor c in cancel:\n print(total+c)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N sightseeing spots on the x-axis, numbered 1, 2, ..., N.\nSpot i is at the point with coordinate A_i.\nIt costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.\n\nYou planned a trip along the axis.\nIn this plan, you first depart from the point with coordinate 0, then visit the N spots in the order they are numbered, and finally return to the point with coordinate 0.\n\nHowever, something came up just before the trip, and you no longer have enough time to visit all the N spots, so you decided to choose some i and cancel the visit to Spot i.\nYou will visit the remaining spots as planned in the order they are numbered.\nYou will also depart from and return to the point with coordinate 0 at the beginning and the end, as planned.\n\nFor each i = 1, 2, ..., N, find the total cost of travel during the trip when the visit to Spot i is canceled.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-5000 \\leq A_i \\leq 5000 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N lines.\nIn the i-th line, print the total cost of travel during the trip when the visit to Spot i is canceled.\n\nSample Input 1\n\n3\n3 5 -1\n\nSample Output 1\n\n12\n8\n10\n\nSpot 1, 2 and 3 are at the points with coordinates 3, 5 and -1, respectively.\nFor each i, the course of the trip and the total cost of travel when the visit to Spot i is canceled, are as follows:\n\nFor i = 1, the course of the trip is 0 \\rightarrow 5 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 5 + 6 + 1 = 12 yen.\n\nFor i = 2, the course of the trip is 0 \\rightarrow 3 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 3 + 4 + 1 = 8 yen.\n\nFor i = 3, the course of the trip is 0 \\rightarrow 3 \\rightarrow 5 \\rightarrow 0 and the total cost of travel is 3 + 2 + 5 = 10 yen.\n\nSample Input 2\n\n5\n1 1 1 2 0\n\nSample Output 2\n\n4\n4\n4\n2\n4\n\nSample Input 3\n\n6\n-679 -2409 -3258 3095 -3291 -4462\n\nSample Output 3\n\n21630\n21630\n19932\n8924\n21630\n19288", "sample_input": "3\n3 5 -1\n"}, "reference_outputs": ["12\n8\n10\n"], "source_document_id": "p03401", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N sightseeing spots on the x-axis, numbered 1, 2, ..., N.\nSpot i is at the point with coordinate A_i.\nIt costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.\n\nYou planned a trip along the axis.\nIn this plan, you first depart from the point with coordinate 0, then visit the N spots in the order they are numbered, and finally return to the point with coordinate 0.\n\nHowever, something came up just before the trip, and you no longer have enough time to visit all the N spots, so you decided to choose some i and cancel the visit to Spot i.\nYou will visit the remaining spots as planned in the order they are numbered.\nYou will also depart from and return to the point with coordinate 0 at the beginning and the end, as planned.\n\nFor each i = 1, 2, ..., N, find the total cost of travel during the trip when the visit to Spot i is canceled.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-5000 \\leq A_i \\leq 5000 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N lines.\nIn the i-th line, print the total cost of travel during the trip when the visit to Spot i is canceled.\n\nSample Input 1\n\n3\n3 5 -1\n\nSample Output 1\n\n12\n8\n10\n\nSpot 1, 2 and 3 are at the points with coordinates 3, 5 and -1, respectively.\nFor each i, the course of the trip and the total cost of travel when the visit to Spot i is canceled, are as follows:\n\nFor i = 1, the course of the trip is 0 \\rightarrow 5 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 5 + 6 + 1 = 12 yen.\n\nFor i = 2, the course of the trip is 0 \\rightarrow 3 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 3 + 4 + 1 = 8 yen.\n\nFor i = 3, the course of the trip is 0 \\rightarrow 3 \\rightarrow 5 \\rightarrow 0 and the total cost of travel is 3 + 2 + 5 = 10 yen.\n\nSample Input 2\n\n5\n1 1 1 2 0\n\nSample Output 2\n\n4\n4\n4\n2\n4\n\nSample Input 3\n\n6\n-679 -2409 -3258 3095 -3291 -4462\n\nSample Output 3\n\n21630\n21630\n19932\n8924\n21630\n19288", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 439, "cpu_time_ms": 247, "memory_kb": 14048}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s724795480", "group_id": "codeNet:p03402", "input_text": "a,b = map(int,input().split())\nif a > b:\n big = a\n dif = a - b\n iros = '#'\nelse:\n big = b\n dif = b - a\n iros = '.'\nprint('2 {}'.format(big * 2))\nif b > a:\n iro = ['#.' for Big in range(big)]\n print(''.join(iro))\n iro = ['#.' for Big in range(big - dif - 1)]\n for i in range(dif * 2 + 2):\n iro.append(iros)\n print(''.join(iro))\nelse:\n iro = ['.#' for Big in range(big)]\n print(''.join(iro))\n iro = ['.#' for Big in range(big - dif - 1)]\n for i in range(dif * 2 + 2):\n iro.append(iros)\n print(''.join(iro))", "language": "Python", "metadata": {"date": 1556072967, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03402.html", "problem_id": "p03402", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03402/input.txt", "sample_output_relpath": "derived/input_output/data/p03402/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03402/Python/s724795480.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s724795480", "user_id": "u023958502"}, "prompt_components": {"gold_output": "3 3\n##.\n..#\n#.#\n", "input_to_evaluate": "a,b = map(int,input().split())\nif a > b:\n big = a\n dif = a - b\n iros = '#'\nelse:\n big = b\n dif = b - a\n iros = '.'\nprint('2 {}'.format(big * 2))\nif b > a:\n iro = ['#.' for Big in range(big)]\n print(''.join(iro))\n iro = ['#.' for Big in range(big - dif - 1)]\n for i in range(dif * 2 + 2):\n iro.append(iros)\n print(''.join(iro))\nelse:\n iro = ['.#' for Big in range(big)]\n print(''.join(iro))\n iro = ['.#' for Big in range(big - dif - 1)]\n for i in range(dif * 2 + 2):\n iro.append(iros)\n print(''.join(iro))", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given two integers A and B.\n\nPrint a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:\n\nLet the size of the grid be h \\times w (h vertical, w horizontal). Both h and w are at most 100.\n\nThe set of the squares painted white is divided into exactly A connected components.\n\nThe set of the squares painted black is divided into exactly B connected components.\n\nIt can be proved that there always exist one or more solutions under the conditions specified in Constraints section.\nIf there are multiple solutions, any of them may be printed.\n\nNotes\n\nTwo squares painted white, c_1 and c_2, are called connected when the square c_2 can be reached from the square c_1 passing only white squares by repeatedly moving up, down, left or right to an adjacent square.\n\nA set of squares painted white, S, forms a connected component when the following conditions are met:\n\nAny two squares in S are connected.\n\nNo pair of a square painted white that is not included in S and a square included in S is connected.\n\nA connected component of squares painted black is defined similarly.\n\nConstraints\n\n1 \\leq A \\leq 500\n\n1 \\leq B \\leq 500\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nOutput should be in the following format:\n\nIn the first line, print integers h and w representing the size of the grid you constructed, with a space in between.\n\nThen, print h more lines. The i-th (1 \\leq i \\leq h) of these lines should contain a string s_i as follows:\n\nIf the square at the i-th row and j-th column (1 \\leq j \\leq w) in the grid is painted white, the j-th character in s_i should be ..\n\nIf the square at the i-th row and j-th column (1 \\leq j \\leq w) in the grid is painted black, the j-th character in s_i should be #.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n3 3\n##.\n..#\n#.#\n\nThis output corresponds to the grid below:\n\nSample Input 2\n\n7 8\n\nSample Output 2\n\n3 5\n#.#.#\n.#.#.\n#.#.#\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n4 2\n..\n#.\n##\n##\n\nSample Input 4\n\n3 14\n\nSample Output 4\n\n8 18\n..................\n..................\n....##.......####.\n....#.#.....#.....\n...#...#....#.....\n..#.###.#...#.....\n.#.......#..#.....\n#.........#..####.", "sample_input": "2 3\n"}, "reference_outputs": ["3 3\n##.\n..#\n#.#\n"], "source_document_id": "p03402", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given two integers A and B.\n\nPrint a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:\n\nLet the size of the grid be h \\times w (h vertical, w horizontal). Both h and w are at most 100.\n\nThe set of the squares painted white is divided into exactly A connected components.\n\nThe set of the squares painted black is divided into exactly B connected components.\n\nIt can be proved that there always exist one or more solutions under the conditions specified in Constraints section.\nIf there are multiple solutions, any of them may be printed.\n\nNotes\n\nTwo squares painted white, c_1 and c_2, are called connected when the square c_2 can be reached from the square c_1 passing only white squares by repeatedly moving up, down, left or right to an adjacent square.\n\nA set of squares painted white, S, forms a connected component when the following conditions are met:\n\nAny two squares in S are connected.\n\nNo pair of a square painted white that is not included in S and a square included in S is connected.\n\nA connected component of squares painted black is defined similarly.\n\nConstraints\n\n1 \\leq A \\leq 500\n\n1 \\leq B \\leq 500\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nOutput should be in the following format:\n\nIn the first line, print integers h and w representing the size of the grid you constructed, with a space in between.\n\nThen, print h more lines. The i-th (1 \\leq i \\leq h) of these lines should contain a string s_i as follows:\n\nIf the square at the i-th row and j-th column (1 \\leq j \\leq w) in the grid is painted white, the j-th character in s_i should be ..\n\nIf the square at the i-th row and j-th column (1 \\leq j \\leq w) in the grid is painted black, the j-th character in s_i should be #.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n3 3\n##.\n..#\n#.#\n\nThis output corresponds to the grid below:\n\nSample Input 2\n\n7 8\n\nSample Output 2\n\n3 5\n#.#.#\n.#.#.\n#.#.#\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n4 2\n..\n#.\n##\n##\n\nSample Input 4\n\n3 14\n\nSample Output 4\n\n8 18\n..................\n..................\n....##.......####.\n....#.#.....#.....\n...#...#....#.....\n..#.###.#...#.....\n.#.......#..#.....\n#.........#..####.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 566, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s904690882", "group_id": "codeNet:p03405", "input_text": "import sys\ninput = sys.stdin.readline\n\nMOD = 10 ** 9 + 7\n\nN,M = map(int,input().split())\nX = int(input())\nUVW = [[int(x) for x in input().split()] for _ in range(M)]\nUVW.sort(key = lambda x: x[2])\n\nroot = list(range(N+1))\ndef find_root(x):\n y = root[x]\n if x == y:\n return x\n z = find_root(y)\n root[x] = z\n return z\n\n# min spanning tree\ntree = [set() for _ in range(N+1)]\nmin_tree_size = 0\nfor u,v,w in UVW:\n ru = find_root(u)\n rv = find_root(v)\n if ru == rv:\n continue\n root[ru] = rv\n min_tree_size += w\n tree[u].add((v,w))\n tree[v].add((u,w))\n\n# treeにおける2頂点の間の辺の最大値を求めたい\n# LCA。2^n個手前およびそこまでの最大値を覚える\n\nparent = [[0] * 12 for _ in range(N+1)]\nmax_wt = [[0] * 12 for _ in range(N+1)]\ndepth = [0] * (N+1)\n\ndef dfs(v=1,p=0,dep=0,w=0):\n parent[v][0] = p\n depth[v] = dep\n max_wt[v][0] = w\n for n in range(1,11):\n parent[v][n] = parent[parent[v][n-1]][n-1]\n max_wt[v][n] = max(max_wt[v][n-1], max_wt[parent[v][n-1]][n-1])\n for u,w in tree[v]:\n if u == p:\n continue\n dfs(u,v,dep+1,w)\n\ndfs()\n\ndef max_wt_between(x,y):\n # LCA しながら重みの最大値を得る\n wt = 0\n dx,dy = depth[x], depth[y]\n if dx > dy:\n x,y = y,x\n dx,dy = dy,dx\n while dy > dx:\n diff = dy - dx\n step = diff & (-diff)\n n = step.bit_length() - 1\n wt = max(wt, max_wt[y][n])\n y = parent[y][n]\n dy -= step\n if x == y:\n return wt\n step = 1 << 11\n while step:\n n = step.bit_length() - 1\n rx,ry = parent[x][n], parent[y][n]\n if rx != ry:\n x,y = rx,ry\n wt = max(wt, max_wt[x][n], max_wt[y][n])\n step >>= 1\n return max(wt, max_wt[x][0], max_wt[y][0])\n\n# 各edgeに対して、その辺を含む最小の全域木の大きさを求める\nmin_size = []\nfor u,v,w in UVW:\n if (v,w) in tree[u]:\n min_size.append(min_tree_size)\n else:\n x = max_wt_between(u,v)\n min_size.append(min_tree_size + w - x)\n\nsm = sum(1 if s < X else 0 for s in min_size)\neq = sum(1 if s == X else 0 for s in min_size)\ngr = sum(1 if s > X else 0 for s in min_size)\n\nif eq == 0:\n answer = 0\nelif sm == 0:\n # eq 内の辺が完全同色でなければよい\n answer = (pow(2,eq,MOD) - 2) * pow(2,gr,MOD) % MOD\nelse:\n # sm 内が完全同色でなければならない。\n # eq 内は、smの色と異なる色を持っていれば何でもよい\n answer = 2 * (pow(2,eq,MOD) - 1) * pow(2,gr,MOD) % MOD\n\nprint(answer)", "language": "Python", "metadata": {"date": 1563150613, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03405.html", "problem_id": "p03405", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03405/input.txt", "sample_output_relpath": "derived/input_output/data/p03405/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03405/Python/s904690882.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s904690882", "user_id": "u102461423"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "import sys\ninput = sys.stdin.readline\n\nMOD = 10 ** 9 + 7\n\nN,M = map(int,input().split())\nX = int(input())\nUVW = [[int(x) for x in input().split()] for _ in range(M)]\nUVW.sort(key = lambda x: x[2])\n\nroot = list(range(N+1))\ndef find_root(x):\n y = root[x]\n if x == y:\n return x\n z = find_root(y)\n root[x] = z\n return z\n\n# min spanning tree\ntree = [set() for _ in range(N+1)]\nmin_tree_size = 0\nfor u,v,w in UVW:\n ru = find_root(u)\n rv = find_root(v)\n if ru == rv:\n continue\n root[ru] = rv\n min_tree_size += w\n tree[u].add((v,w))\n tree[v].add((u,w))\n\n# treeにおける2頂点の間の辺の最大値を求めたい\n# LCA。2^n個手前およびそこまでの最大値を覚える\n\nparent = [[0] * 12 for _ in range(N+1)]\nmax_wt = [[0] * 12 for _ in range(N+1)]\ndepth = [0] * (N+1)\n\ndef dfs(v=1,p=0,dep=0,w=0):\n parent[v][0] = p\n depth[v] = dep\n max_wt[v][0] = w\n for n in range(1,11):\n parent[v][n] = parent[parent[v][n-1]][n-1]\n max_wt[v][n] = max(max_wt[v][n-1], max_wt[parent[v][n-1]][n-1])\n for u,w in tree[v]:\n if u == p:\n continue\n dfs(u,v,dep+1,w)\n\ndfs()\n\ndef max_wt_between(x,y):\n # LCA しながら重みの最大値を得る\n wt = 0\n dx,dy = depth[x], depth[y]\n if dx > dy:\n x,y = y,x\n dx,dy = dy,dx\n while dy > dx:\n diff = dy - dx\n step = diff & (-diff)\n n = step.bit_length() - 1\n wt = max(wt, max_wt[y][n])\n y = parent[y][n]\n dy -= step\n if x == y:\n return wt\n step = 1 << 11\n while step:\n n = step.bit_length() - 1\n rx,ry = parent[x][n], parent[y][n]\n if rx != ry:\n x,y = rx,ry\n wt = max(wt, max_wt[x][n], max_wt[y][n])\n step >>= 1\n return max(wt, max_wt[x][0], max_wt[y][0])\n\n# 各edgeに対して、その辺を含む最小の全域木の大きさを求める\nmin_size = []\nfor u,v,w in UVW:\n if (v,w) in tree[u]:\n min_size.append(min_tree_size)\n else:\n x = max_wt_between(u,v)\n min_size.append(min_tree_size + w - x)\n\nsm = sum(1 if s < X else 0 for s in min_size)\neq = sum(1 if s == X else 0 for s in min_size)\ngr = sum(1 if s > X else 0 for s in min_size)\n\nif eq == 0:\n answer = 0\nelif sm == 0:\n # eq 内の辺が完全同色でなければよい\n answer = (pow(2,eq,MOD) - 2) * pow(2,gr,MOD) % MOD\nelse:\n # sm 内が完全同色でなければならない。\n # eq 内は、smの色と異なる色を持っていれば何でもよい\n answer = 2 * (pow(2,eq,MOD) - 1) * pow(2,gr,MOD) % MOD\n\nprint(answer)", "problem_context": "Score : 900 points\n\nProblem Statement\n\nWe have an undirected weighted graph with N vertices and M edges.\nThe i-th edge in the graph connects Vertex U_i and Vertex V_i, and has a weight of W_i.\nAdditionally, you are given an integer X.\n\nFind the number of ways to paint each edge in this graph either white or black such that the following condition is met, modulo 10^9 + 7:\n\nThe graph has a spanning tree that contains both an edge painted white and an edge painted black. Furthermore, among such spanning trees, the one with the smallest weight has a weight of X.\n\nHere, the weight of a spanning tree is the sum of the weights of the edges contained in the spanning tree.\n\nConstraints\n\n1 \\leq N \\leq 1 000\n\n1 \\leq M \\leq 2 000\n\n1 \\leq U_i, V_i \\leq N (1 \\leq i \\leq M)\n\n1 \\leq W_i \\leq 10^9 (1 \\leq i \\leq M)\n\nIf i \\neq j, then (U_i, V_i) \\neq (U_j, V_j) and (U_i, V_i) \\neq (V_j, U_j).\n\nU_i \\neq V_i (1 \\leq i \\leq M)\n\nThe given graph is connected.\n\n1 \\leq X \\leq 10^{12}\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nX\nU_1 V_1 W_1\nU_2 V_2 W_2\n:\nU_M V_M W_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n2\n1 2 1\n2 3 1\n3 1 1\n\nSample Output 1\n\n6\n\nSample Input 2\n\n3 3\n3\n1 2 1\n2 3 1\n3 1 2\n\nSample Output 2\n\n2\n\nSample Input 3\n\n5 4\n1\n1 2 3\n1 3 3\n2 4 6\n2 5 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n8 10\n49\n4 6 10\n8 4 11\n5 8 9\n1 8 10\n3 8 128773450\n7 8 10\n4 2 4\n3 4 1\n3 1 13\n5 2 2\n\nSample Output 4\n\n4", "sample_input": "3 3\n2\n1 2 1\n2 3 1\n3 1 1\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03405", "source_text": "Score : 900 points\n\nProblem Statement\n\nWe have an undirected weighted graph with N vertices and M edges.\nThe i-th edge in the graph connects Vertex U_i and Vertex V_i, and has a weight of W_i.\nAdditionally, you are given an integer X.\n\nFind the number of ways to paint each edge in this graph either white or black such that the following condition is met, modulo 10^9 + 7:\n\nThe graph has a spanning tree that contains both an edge painted white and an edge painted black. Furthermore, among such spanning trees, the one with the smallest weight has a weight of X.\n\nHere, the weight of a spanning tree is the sum of the weights of the edges contained in the spanning tree.\n\nConstraints\n\n1 \\leq N \\leq 1 000\n\n1 \\leq M \\leq 2 000\n\n1 \\leq U_i, V_i \\leq N (1 \\leq i \\leq M)\n\n1 \\leq W_i \\leq 10^9 (1 \\leq i \\leq M)\n\nIf i \\neq j, then (U_i, V_i) \\neq (U_j, V_j) and (U_i, V_i) \\neq (V_j, U_j).\n\nU_i \\neq V_i (1 \\leq i \\leq M)\n\nThe given graph is connected.\n\n1 \\leq X \\leq 10^{12}\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nX\nU_1 V_1 W_1\nU_2 V_2 W_2\n:\nU_M V_M W_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n2\n1 2 1\n2 3 1\n3 1 1\n\nSample Output 1\n\n6\n\nSample Input 2\n\n3 3\n3\n1 2 1\n2 3 1\n3 1 2\n\nSample Output 2\n\n2\n\nSample Input 3\n\n5 4\n1\n1 2 3\n1 3 3\n2 4 6\n2 5 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n8 10\n49\n4 6 10\n8 4 11\n5 8 9\n1 8 10\n3 8 128773450\n7 8 10\n4 2 4\n3 4 1\n3 1 13\n5 2 2\n\nSample Output 4\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2609, "cpu_time_ms": 42, "memory_kb": 5108}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s814349837", "group_id": "codeNet:p03408", "input_text": "n=int(input())\ns=[input() for i in range(n)]\nm=int(input())\nt=[input() for j in range(m)]\nc=0\nfor k in s:\n a=s.count(k)-t.count(k)\n if a>c:c=a\nprint(c)", "language": "Python", "metadata": {"date": 1537204847, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03408.html", "problem_id": "p03408", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03408/input.txt", "sample_output_relpath": "derived/input_output/data/p03408/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03408/Python/s814349837.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s814349837", "user_id": "u017810624"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n=int(input())\ns=[input() for i in range(n)]\nm=int(input())\nt=[input() for j in range(m)]\nc=0\nfor k in s:\n a=s.count(k)-t.count(k)\n if a>c:c=a\nprint(c)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N blue cards and M red cards.\nA string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i.\n\nTakahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will earn 1 yen (the currency of Japan); each time he finds a red card with that string, he will lose 1 yen.\n\nHere, we only consider the case where the string announced by Takahashi and the string on the card are exactly the same. For example, if he announces atcoder, he will not earn money even if there are blue cards with atcoderr, atcode, btcoder, and so on. (On the other hand, he will not lose money even if there are red cards with such strings, either.)\n\nAt most how much can he earn on balance?\n\nNote that the same string may be written on multiple cards.\n\nConstraints\n\nN and M are integers.\n\n1 \\leq N, M \\leq 100\n\ns_1, s_2, ..., s_N, t_1, t_2, ..., t_M are all strings of lengths between 1 and 10 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\nM\nt_1\nt_2\n:\nt_M\n\nOutput\n\nIf Takahashi can earn at most X yen on balance, print X.\n\nSample Input 1\n\n3\napple\norange\napple\n1\ngrape\n\nSample Output 1\n\n2\n\nHe can earn 2 yen by announcing apple.\n\nSample Input 2\n\n3\napple\norange\napple\n5\napple\napple\napple\napple\napple\n\nSample Output 2\n\n1\n\nIf he announces apple, he will lose 3 yen. If he announces orange, he can earn 1 yen.\n\nSample Input 3\n\n1\nvoldemort\n10\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\n\nSample Output 3\n\n0\n\nIf he announces voldemort, he will lose 9 yen. If he announces orange, for example, he can avoid losing a yen.\n\nSample Input 4\n\n6\nred\nred\nblue\nyellow\nyellow\nred\n5\nred\nred\nyellow\ngreen\nblue\n\nSample Output 4\n\n1", "sample_input": "3\napple\norange\napple\n1\ngrape\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03408", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N blue cards and M red cards.\nA string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i.\n\nTakahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will earn 1 yen (the currency of Japan); each time he finds a red card with that string, he will lose 1 yen.\n\nHere, we only consider the case where the string announced by Takahashi and the string on the card are exactly the same. For example, if he announces atcoder, he will not earn money even if there are blue cards with atcoderr, atcode, btcoder, and so on. (On the other hand, he will not lose money even if there are red cards with such strings, either.)\n\nAt most how much can he earn on balance?\n\nNote that the same string may be written on multiple cards.\n\nConstraints\n\nN and M are integers.\n\n1 \\leq N, M \\leq 100\n\ns_1, s_2, ..., s_N, t_1, t_2, ..., t_M are all strings of lengths between 1 and 10 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\nM\nt_1\nt_2\n:\nt_M\n\nOutput\n\nIf Takahashi can earn at most X yen on balance, print X.\n\nSample Input 1\n\n3\napple\norange\napple\n1\ngrape\n\nSample Output 1\n\n2\n\nHe can earn 2 yen by announcing apple.\n\nSample Input 2\n\n3\napple\norange\napple\n5\napple\napple\napple\napple\napple\n\nSample Output 2\n\n1\n\nIf he announces apple, he will lose 3 yen. If he announces orange, he can earn 1 yen.\n\nSample Input 3\n\n1\nvoldemort\n10\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\n\nSample Output 3\n\n0\n\nIf he announces voldemort, he will lose 9 yen. If he announces orange, for example, he can avoid losing a yen.\n\nSample Input 4\n\n6\nred\nred\nblue\nyellow\nyellow\nred\n5\nred\nred\nyellow\ngreen\nblue\n\nSample Output 4\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 153, "cpu_time_ms": 18, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s519886044", "group_id": "codeNet:p03409", "input_text": "n = int(input())\nab = [list(map(int, input().split())) for _ in range(n)]\ncd = [list(map(int, input().split())) for _ in range(n)]\n\ncd.sort()\nremain = set(range(n))\n\nans = 0\nfor c,d in cd:\n cand = [-1, -1]\n for i in remain:\n a,b = ab[i]\n if((a 0:\n d = dfs(e.to, t, min(f, e.cap))\n if d > 0:\n G[v][i] = Edge(e.to, e.cap - d, e.rev)\n G[e.to][e.rev] = Edge(v, G[e.to][e.rev].cap + d, i)\n return d\n return 0\n\nfor i in range(1, N + 1):\n add_edge(0, i, 1)\n add_edge(N + i, N * 2 + 1, 1)\n\nfor i in range(1, N + 1):\n a, b = ab[i - 1]\n for j in range(1, N + 1):\n c, d = cd[j - 1]\n if a < c and b < d:\n add_edge(i, N + j, 1) \n\nflow = 0\nwhile 1:\n used = [False for i in range(N * 2 + 2)]\n f = dfs(0, N * 2 + 1, 114514)\n if f == 0:\n break\n flow += f\n\nprint(flow)", "language": "Python", "metadata": {"date": 1537684863, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03409.html", "problem_id": "p03409", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03409/input.txt", "sample_output_relpath": "derived/input_output/data/p03409/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03409/Python/s083037224.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s083037224", "user_id": "u833070958"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "from collections import namedtuple\n\nN = int(input())\nab = [tuple(map(int, input().split())) for i in range(N)]\ncd = [tuple(map(int, input().split())) for i in range(N)]\n\nG = [[] for i in range(N * 2 + 2)]\n\nEdge = namedtuple(\"Edge\", (\"to\", \"cap\", \"rev\"))\n\ndef add_edge(frm, to, cap):\n G[frm].append(Edge(to, cap, len(G[to])))\n G[to].append(Edge(frm, 0, len(G[frm]) - 1))\n\n# 現在の頂点, 終点, 増加フロー\ndef dfs(v, t, f):\n if v == t:\n return f\n used[v] = True\n for i, e in enumerate(G[v]):\n if not used[e.to] and e.cap > 0:\n d = dfs(e.to, t, min(f, e.cap))\n if d > 0:\n G[v][i] = Edge(e.to, e.cap - d, e.rev)\n G[e.to][e.rev] = Edge(v, G[e.to][e.rev].cap + d, i)\n return d\n return 0\n\nfor i in range(1, N + 1):\n add_edge(0, i, 1)\n add_edge(N + i, N * 2 + 1, 1)\n\nfor i in range(1, N + 1):\n a, b = ab[i - 1]\n for j in range(1, N + 1):\n c, d = cd[j - 1]\n if a < c and b < d:\n add_edge(i, N + j, 1) \n\nflow = 0\nwhile 1:\n used = [False for i in range(N * 2 + 2)]\n f = dfs(0, N * 2 + 1, 114514)\n if f == 0:\n break\n flow += f\n\nprint(flow)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nOn a two-dimensional plane, there are N red points and N blue points.\nThe coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i).\n\nA red point and a blue point can form a friendly pair when, the x-coordinate of the red point is smaller than that of the blue point, and the y-coordinate of the red point is also smaller than that of the blue point.\n\nAt most how many friendly pairs can you form? Note that a point cannot belong to multiple pairs.\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n0 \\leq a_i, b_i, c_i, d_i < 2N\n\na_1, a_2, ..., a_N, c_1, c_2, ..., c_N are all different.\n\nb_1, b_2, ..., b_N, d_1, d_2, ..., d_N are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1\na_2 b_2\n:\na_N b_N\nc_1 d_1\nc_2 d_2\n:\nc_N d_N\n\nOutput\n\nPrint the maximum number of friendly pairs.\n\nSample Input 1\n\n3\n2 0\n3 1\n1 3\n4 2\n0 4\n5 5\n\nSample Output 1\n\n2\n\nFor example, you can pair (2, 0) and (4, 2), then (3, 1) and (5, 5).\n\nSample Input 2\n\n3\n0 0\n1 1\n5 2\n2 3\n3 4\n4 5\n\nSample Output 2\n\n2\n\nFor example, you can pair (0, 0) and (2, 3), then (1, 1) and (3, 4).\n\nSample Input 3\n\n2\n2 2\n3 3\n0 0\n1 1\n\nSample Output 3\n\n0\n\nIt is possible that no pair can be formed.\n\nSample Input 4\n\n5\n0 0\n7 3\n2 2\n4 8\n1 6\n8 5\n6 9\n5 4\n9 1\n3 7\n\nSample Output 4\n\n5\n\nSample Input 5\n\n5\n0 0\n1 1\n5 5\n6 6\n7 7\n2 2\n3 3\n4 4\n8 8\n9 9\n\nSample Output 5\n\n4", "sample_input": "3\n2 0\n3 1\n1 3\n4 2\n0 4\n5 5\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03409", "source_text": "Score : 400 points\n\nProblem Statement\n\nOn a two-dimensional plane, there are N red points and N blue points.\nThe coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i).\n\nA red point and a blue point can form a friendly pair when, the x-coordinate of the red point is smaller than that of the blue point, and the y-coordinate of the red point is also smaller than that of the blue point.\n\nAt most how many friendly pairs can you form? Note that a point cannot belong to multiple pairs.\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n0 \\leq a_i, b_i, c_i, d_i < 2N\n\na_1, a_2, ..., a_N, c_1, c_2, ..., c_N are all different.\n\nb_1, b_2, ..., b_N, d_1, d_2, ..., d_N are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1\na_2 b_2\n:\na_N b_N\nc_1 d_1\nc_2 d_2\n:\nc_N d_N\n\nOutput\n\nPrint the maximum number of friendly pairs.\n\nSample Input 1\n\n3\n2 0\n3 1\n1 3\n4 2\n0 4\n5 5\n\nSample Output 1\n\n2\n\nFor example, you can pair (2, 0) and (4, 2), then (3, 1) and (5, 5).\n\nSample Input 2\n\n3\n0 0\n1 1\n5 2\n2 3\n3 4\n4 5\n\nSample Output 2\n\n2\n\nFor example, you can pair (0, 0) and (2, 3), then (1, 1) and (3, 4).\n\nSample Input 3\n\n2\n2 2\n3 3\n0 0\n1 1\n\nSample Output 3\n\n0\n\nIt is possible that no pair can be formed.\n\nSample Input 4\n\n5\n0 0\n7 3\n2 2\n4 8\n1 6\n8 5\n6 9\n5 4\n9 1\n3 7\n\nSample Output 4\n\n5\n\nSample Input 5\n\n5\n0 0\n1 1\n5 5\n6 6\n7 7\n2 2\n3 3\n4 4\n8 8\n9 9\n\nSample Output 5\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1203, "cpu_time_ms": 62, "memory_kb": 3956}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s330680176", "group_id": "codeNet:p03415", "input_text": "l = [input() for i in range(3)]\n\nprint(''.join([l[0][:1], l[1][1:2], l[2][2:3]]))\n", "language": "Python", "metadata": {"date": 1521267110, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03415.html", "problem_id": "p03415", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03415/input.txt", "sample_output_relpath": "derived/input_output/data/p03415/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03415/Python/s330680176.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s330680176", "user_id": "u174523836"}, "prompt_components": {"gold_output": "abc\n", "input_to_evaluate": "l = [input() for i in range(3)]\n\nprint(''.join([l[0][:1], l[1][1:2], l[2][2:3]]))\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have a 3×3 square grid, where each square contains a lowercase English letters.\nThe letter in the square at the i-th row from the top and j-th column from the left is c_{ij}.\n\nPrint the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bottom-right corner of the grid, from the top-left to bottom-right.\n\nConstraints\n\nInput consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nc_{11}c_{12}c_{13}\nc_{21}c_{22}c_{23}\nc_{31}c_{32}c_{33}\n\nOutput\n\nPrint the string of length 3 that can be obtained by concatenating the letters on the diagonal connecting the top-left and bottom-right corner of the grid, from the top-left to bottom-right.\n\nSample Input 1\n\nant\nobe\nrec\n\nSample Output 1\n\nabc\n\nThe letters in the squares on the diagonal connecting the top-left and bottom-right corner of the grid are a, b and c from top-right to bottom-left. Concatenate these letters and print abc.\n\nSample Input 2\n\nedu\ncat\nion\n\nSample Output 2\n\nean", "sample_input": "ant\nobe\nrec\n"}, "reference_outputs": ["abc\n"], "source_document_id": "p03415", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have a 3×3 square grid, where each square contains a lowercase English letters.\nThe letter in the square at the i-th row from the top and j-th column from the left is c_{ij}.\n\nPrint the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bottom-right corner of the grid, from the top-left to bottom-right.\n\nConstraints\n\nInput consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nc_{11}c_{12}c_{13}\nc_{21}c_{22}c_{23}\nc_{31}c_{32}c_{33}\n\nOutput\n\nPrint the string of length 3 that can be obtained by concatenating the letters on the diagonal connecting the top-left and bottom-right corner of the grid, from the top-left to bottom-right.\n\nSample Input 1\n\nant\nobe\nrec\n\nSample Output 1\n\nabc\n\nThe letters in the squares on the diagonal connecting the top-left and bottom-right corner of the grid are a, b and c from top-right to bottom-left. Concatenate these letters and print abc.\n\nSample Input 2\n\nedu\ncat\nion\n\nSample Output 2\n\nean", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 82, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s766511492", "group_id": "codeNet:p03416", "input_text": "a,b = map(int,input().split())\nres = 0\nfor i in range(a,b+1):\n i = str(i)\n if i == i[::-1]:\n res += 1\nprint(res) \n", "language": "Python", "metadata": {"date": 1592923386, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03416.html", "problem_id": "p03416", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03416/input.txt", "sample_output_relpath": "derived/input_output/data/p03416/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03416/Python/s766511492.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s766511492", "user_id": "u021770165"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "a,b = map(int,input().split())\nres = 0\nfor i in range(a,b+1):\n i = str(i)\n if i == i[::-1]:\n res += 1\nprint(res) \n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nFind the number of palindromic numbers among the integers between A and B (inclusive).\nHere, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward.\n\nConstraints\n\n10000 \\leq A \\leq B \\leq 99999\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the number of palindromic numbers among the integers between A and B (inclusive).\n\nSample Input 1\n\n11009 11332\n\nSample Output 1\n\n4\n\nThere are four integers that satisfy the conditions: 11011, 11111, 11211 and 11311.\n\nSample Input 2\n\n31415 92653\n\nSample Output 2\n\n612", "sample_input": "11009 11332\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03416", "source_text": "Score : 200 points\n\nProblem Statement\n\nFind the number of palindromic numbers among the integers between A and B (inclusive).\nHere, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward.\n\nConstraints\n\n10000 \\leq A \\leq B \\leq 99999\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the number of palindromic numbers among the integers between A and B (inclusive).\n\nSample Input 1\n\n11009 11332\n\nSample Output 1\n\n4\n\nThere are four integers that satisfy the conditions: 11011, 11111, 11211 and 11311.\n\nSample Input 2\n\n31415 92653\n\nSample Output 2\n\n612", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 121, "cpu_time_ms": 56, "memory_kb": 8980}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s073850454", "group_id": "codeNet:p03416", "input_text": "x, y = map(int,input().split())\nans = 0\n\nfor i in range(x,y+1):\n if str(i) == str(i)[::-1]:\n ans += 1\n\nprint(ans)", "language": "Python", "metadata": {"date": 1587185026, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03416.html", "problem_id": "p03416", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03416/input.txt", "sample_output_relpath": "derived/input_output/data/p03416/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03416/Python/s073850454.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s073850454", "user_id": "u106181248"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "x, y = map(int,input().split())\nans = 0\n\nfor i in range(x,y+1):\n if str(i) == str(i)[::-1]:\n ans += 1\n\nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nFind the number of palindromic numbers among the integers between A and B (inclusive).\nHere, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward.\n\nConstraints\n\n10000 \\leq A \\leq B \\leq 99999\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the number of palindromic numbers among the integers between A and B (inclusive).\n\nSample Input 1\n\n11009 11332\n\nSample Output 1\n\n4\n\nThere are four integers that satisfy the conditions: 11011, 11111, 11211 and 11311.\n\nSample Input 2\n\n31415 92653\n\nSample Output 2\n\n612", "sample_input": "11009 11332\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03416", "source_text": "Score : 200 points\n\nProblem Statement\n\nFind the number of palindromic numbers among the integers between A and B (inclusive).\nHere, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward.\n\nConstraints\n\n10000 \\leq A \\leq B \\leq 99999\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the number of palindromic numbers among the integers between A and B (inclusive).\n\nSample Input 1\n\n11009 11332\n\nSample Output 1\n\n4\n\nThere are four integers that satisfy the conditions: 11011, 11111, 11211 and 11311.\n\nSample Input 2\n\n31415 92653\n\nSample Output 2\n\n612", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 123, "cpu_time_ms": 64, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s554770523", "group_id": "codeNet:p03416", "input_text": "a = input().split(\" \")\nstart = a[0]\nstart = list(map(int, start))\nend = a[1]\nend = list(map(int, end))\n\nif (end[0] - start[0]) != 0:\n ans = (end[0] - start[0] - 1) * 100 + end[1] * 10 + end[2] + 1 + (9 - start[1]) * 10 + (10 - start[2])\n if start[1] < start[3] :\n ans -= 1\n else:\n if start[0] < start[4]:\n ans -= 1\nelse:\n if (end[1] - start[1]) != 0:\n ans = (end[1] - start[1] - 1) * 10 + end[2] + (10 - start[2])\n if start[1] < start[3] :\n ans -= 1\n else:\n if start[0] < start[4]: \n ans -= 1\n \n else:\n ans = end[2] - start[2] + 1\n\nprint(ans)", "language": "Python", "metadata": {"date": 1583897321, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03416.html", "problem_id": "p03416", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03416/input.txt", "sample_output_relpath": "derived/input_output/data/p03416/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03416/Python/s554770523.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s554770523", "user_id": "u569117803"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "a = input().split(\" \")\nstart = a[0]\nstart = list(map(int, start))\nend = a[1]\nend = list(map(int, end))\n\nif (end[0] - start[0]) != 0:\n ans = (end[0] - start[0] - 1) * 100 + end[1] * 10 + end[2] + 1 + (9 - start[1]) * 10 + (10 - start[2])\n if start[1] < start[3] :\n ans -= 1\n else:\n if start[0] < start[4]:\n ans -= 1\nelse:\n if (end[1] - start[1]) != 0:\n ans = (end[1] - start[1] - 1) * 10 + end[2] + (10 - start[2])\n if start[1] < start[3] :\n ans -= 1\n else:\n if start[0] < start[4]: \n ans -= 1\n \n else:\n ans = end[2] - start[2] + 1\n\nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nFind the number of palindromic numbers among the integers between A and B (inclusive).\nHere, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward.\n\nConstraints\n\n10000 \\leq A \\leq B \\leq 99999\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the number of palindromic numbers among the integers between A and B (inclusive).\n\nSample Input 1\n\n11009 11332\n\nSample Output 1\n\n4\n\nThere are four integers that satisfy the conditions: 11011, 11111, 11211 and 11311.\n\nSample Input 2\n\n31415 92653\n\nSample Output 2\n\n612", "sample_input": "11009 11332\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03416", "source_text": "Score : 200 points\n\nProblem Statement\n\nFind the number of palindromic numbers among the integers between A and B (inclusive).\nHere, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward.\n\nConstraints\n\n10000 \\leq A \\leq B \\leq 99999\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the number of palindromic numbers among the integers between A and B (inclusive).\n\nSample Input 1\n\n11009 11332\n\nSample Output 1\n\n4\n\nThere are four integers that satisfy the conditions: 11011, 11111, 11211 and 11311.\n\nSample Input 2\n\n31415 92653\n\nSample Output 2\n\n612", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 663, "cpu_time_ms": 18, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s750253248", "group_id": "codeNet:p03419", "input_text": "N,M = map(int, input().split())\nif N<3 and M<3:\n print(0)\nelif N==2:\n print(M-2)\nelif M==2:\n print(N-2)\nelse:\n print((N-2)*(M-2))", "language": "Python", "metadata": {"date": 1520817086, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03419.html", "problem_id": "p03419", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03419/input.txt", "sample_output_relpath": "derived/input_output/data/p03419/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03419/Python/s750253248.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s750253248", "user_id": "u842230338"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "N,M = map(int, input().split())\nif N<3 and M<3:\n print(0)\nelif N==2:\n print(M-2)\nelif M==2:\n print(N-2)\nelse:\n print((N-2)*(M-2))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive N rows and M columns, and a card is placed in each square in this region.\nThe front and back sides of these cards can be distinguished, and initially every card faces up.\n\nWe will perform the following operation once for each square contains a card:\n\nFor each of the following nine squares, flip the card in it if it exists: the target square itself and the eight squares that shares a corner or a side with the target square.\n\nIt can be proved that, whether each card faces up or down after all the operations does not depend on the order the operations are performed.\nFind the number of cards that face down after all the operations.\n\nConstraints\n\n1 \\leq N,M \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of cards that face down after all the operations.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n0\n\nWe will flip every card in any of the four operations. Thus, after all the operations, all cards face up.\n\nSample Input 2\n\n1 7\n\nSample Output 2\n\n5\n\nAfter all the operations, all cards except at both ends face down.\n\nSample Input 3\n\n314 1592\n\nSample Output 3\n\n496080", "sample_input": "2 2\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03419", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive N rows and M columns, and a card is placed in each square in this region.\nThe front and back sides of these cards can be distinguished, and initially every card faces up.\n\nWe will perform the following operation once for each square contains a card:\n\nFor each of the following nine squares, flip the card in it if it exists: the target square itself and the eight squares that shares a corner or a side with the target square.\n\nIt can be proved that, whether each card faces up or down after all the operations does not depend on the order the operations are performed.\nFind the number of cards that face down after all the operations.\n\nConstraints\n\n1 \\leq N,M \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of cards that face down after all the operations.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n0\n\nWe will flip every card in any of the four operations. Thus, after all the operations, all cards face up.\n\nSample Input 2\n\n1 7\n\nSample Output 2\n\n5\n\nAfter all the operations, all cards except at both ends face down.\n\nSample Input 3\n\n314 1592\n\nSample Output 3\n\n496080", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 141, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s024960866", "group_id": "codeNet:p03420", "input_text": "from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb\nfrom itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement\nfrom collections import deque,defaultdict,Counter\nfrom bisect import bisect_left,bisect_right\nfrom operator import itemgetter\nfrom heapq import heapify,heappop,heappush\nfrom queue import Queue,LifoQueue,PriorityQueue\nfrom copy import deepcopy\nfrom time import time\nfrom functools import reduce\nimport string\nimport sys\nsys.setrecursionlimit(10 ** 7)\ndef input() : return sys.stdin.readline().strip()\ndef INT() : return int(input())\ndef MAP() : return map(int,input().split())\ndef LIST() : return list(MAP())\n\nn, k = MAP()\nans = 0\nif k == 0:\n ans = n**2\nelse:\n for b in range(k+1, n+1):\n x = n//b\n y = n % b\n ans += (b-k)*x + (y-k+1 if y >= k else 0)\nprint(ans)", "language": "Python", "metadata": {"date": 1596594451, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03420.html", "problem_id": "p03420", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03420/input.txt", "sample_output_relpath": "derived/input_output/data/p03420/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03420/Python/s024960866.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s024960866", "user_id": "u603958124"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb\nfrom itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement\nfrom collections import deque,defaultdict,Counter\nfrom bisect import bisect_left,bisect_right\nfrom operator import itemgetter\nfrom heapq import heapify,heappop,heappush\nfrom queue import Queue,LifoQueue,PriorityQueue\nfrom copy import deepcopy\nfrom time import time\nfrom functools import reduce\nimport string\nimport sys\nsys.setrecursionlimit(10 ** 7)\ndef input() : return sys.stdin.readline().strip()\ndef INT() : return int(input())\ndef MAP() : return map(int,input().split())\ndef LIST() : return list(MAP())\n\nn, k = MAP()\nans = 0\nif k == 0:\n ans = n**2\nelse:\n for b in range(k+1, n+1):\n x = n//b\n y = n % b\n ans += (b-k)*x + (y-k+1 if y >= k else 0)\nprint(ans)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi had a pair of two positive integers not exceeding N, (a,b), which he has forgotten.\nHe remembers that the remainder of a divided by b was greater than or equal to K.\nFind the number of possible pairs that he may have had.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq K \\leq N-1\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible pairs that he may have had.\n\nSample Input 1\n\n5 2\n\nSample Output 1\n\n7\n\nThere are seven possible pairs: (2,3),(5,3),(2,4),(3,4),(2,5),(3,5) and (4,5).\n\nSample Input 2\n\n10 0\n\nSample Output 2\n\n100\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n287927211", "sample_input": "5 2\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03420", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi had a pair of two positive integers not exceeding N, (a,b), which he has forgotten.\nHe remembers that the remainder of a divided by b was greater than or equal to K.\nFind the number of possible pairs that he may have had.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq K \\leq N-1\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible pairs that he may have had.\n\nSample Input 1\n\n5 2\n\nSample Output 1\n\n7\n\nThere are seven possible pairs: (2,3),(5,3),(2,4),(3,4),(2,5),(3,5) and (4,5).\n\nSample Input 2\n\n10 0\n\nSample Output 2\n\n100\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n287927211", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 904, "cpu_time_ms": 74, "memory_kb": 10296}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s728419045", "group_id": "codeNet:p03423", "input_text": "N = int(input())\nprint(N//3)", "language": "Python", "metadata": {"date": 1588455611, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03423.html", "problem_id": "p03423", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03423/input.txt", "sample_output_relpath": "derived/input_output/data/p03423/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03423/Python/s728419045.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s728419045", "user_id": "u600261652"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "N = int(input())\nprint(N//3)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N students in a school.\n\nWe will divide these students into some groups, and in each group they will discuss some themes.\n\nYou think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible.\n\nDivide the students so that the number of groups consisting of three or more students is maximized.\n\nConstraints\n\n1 \\leq N \\leq 1000\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf you can form at most x groups consisting of three or more students, print x.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n2\n\nFor example, you can form a group of three students and another of five students.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n0\n\nSometimes you cannot form any group consisting of three or more students, regardless of how you divide the students.\n\nSample Input 3\n\n9\n\nSample Output 3\n\n3", "sample_input": "8\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03423", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N students in a school.\n\nWe will divide these students into some groups, and in each group they will discuss some themes.\n\nYou think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible.\n\nDivide the students so that the number of groups consisting of three or more students is maximized.\n\nConstraints\n\n1 \\leq N \\leq 1000\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf you can form at most x groups consisting of three or more students, print x.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n2\n\nFor example, you can form a group of three students and another of five students.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n0\n\nSometimes you cannot form any group consisting of three or more students, regardless of how you divide the students.\n\nSample Input 3\n\n9\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 28, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s292527934", "group_id": "codeNet:p03423", "input_text": "n=int(input())\nprint(n//3)", "language": "Python", "metadata": {"date": 1578629484, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03423.html", "problem_id": "p03423", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03423/input.txt", "sample_output_relpath": "derived/input_output/data/p03423/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03423/Python/s292527934.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s292527934", "user_id": "u222801992"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n=int(input())\nprint(n//3)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N students in a school.\n\nWe will divide these students into some groups, and in each group they will discuss some themes.\n\nYou think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible.\n\nDivide the students so that the number of groups consisting of three or more students is maximized.\n\nConstraints\n\n1 \\leq N \\leq 1000\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf you can form at most x groups consisting of three or more students, print x.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n2\n\nFor example, you can form a group of three students and another of five students.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n0\n\nSometimes you cannot form any group consisting of three or more students, regardless of how you divide the students.\n\nSample Input 3\n\n9\n\nSample Output 3\n\n3", "sample_input": "8\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03423", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N students in a school.\n\nWe will divide these students into some groups, and in each group they will discuss some themes.\n\nYou think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible.\n\nDivide the students so that the number of groups consisting of three or more students is maximized.\n\nConstraints\n\n1 \\leq N \\leq 1000\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf you can form at most x groups consisting of three or more students, print x.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n2\n\nFor example, you can form a group of three students and another of five students.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n0\n\nSometimes you cannot form any group consisting of three or more students, regardless of how you divide the students.\n\nSample Input 3\n\n9\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 26, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s311550918", "group_id": "codeNet:p03426", "input_text": "h,w,d = map(int, input().split())\n\nfrom collections import defaultdict\nG = defaultdict(list)\nfor i in range(h):\n l = list(map(int, input().split()))\n for n, item in enumerate(l):\n G[item] = [n,i]\n\n\n\n\n# magic is just distance by 1\n\n# if d is 4,\n# 1,5,9 or 2,6,10.. make surplus to categorize\n# query comes 10^5, so O(1) or O(logN) is limit -> cumulativesum\n\ndp = [0 for i in range(h*w+1)]\nfor i in range((h*w)%d+1): # 1,2,...d\n current_place = i+1\n while current_place + d <= h*w:\n x,y = G[current_place]\n next_place = current_place + d\n x1,y1 = G[next_place]\n magic = abs(x-x1) + abs(y-y1)\n dp[next_place] = magic + dp[current_place]\n current_place = next_place\n\nq = int(input())\nfor i in range(q):\n l, r = map(int, input().split())\n print( dp[r]-dp[l], flush=True)\n\n", "language": "Python", "metadata": {"date": 1601255569, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03426.html", "problem_id": "p03426", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03426/input.txt", "sample_output_relpath": "derived/input_output/data/p03426/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03426/Python/s311550918.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s311550918", "user_id": "u454760747"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "h,w,d = map(int, input().split())\n\nfrom collections import defaultdict\nG = defaultdict(list)\nfor i in range(h):\n l = list(map(int, input().split()))\n for n, item in enumerate(l):\n G[item] = [n,i]\n\n\n\n\n# magic is just distance by 1\n\n# if d is 4,\n# 1,5,9 or 2,6,10.. make surplus to categorize\n# query comes 10^5, so O(1) or O(logN) is limit -> cumulativesum\n\ndp = [0 for i in range(h*w+1)]\nfor i in range((h*w)%d+1): # 1,2,...d\n current_place = i+1\n while current_place + d <= h*w:\n x,y = G[current_place]\n next_place = current_place + d\n x1,y1 = G[next_place]\n magic = abs(x-x1) + abs(y-y1)\n dp[next_place] = magic + dp[current_place]\n current_place = next_place\n\nq = int(input())\nfor i in range(q):\n l, r = map(int, input().split())\n print( dp[r]-dp[l], flush=True)\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j).\n\nThe integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}.\n\nYou, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by consuming |x-i|+|y-j| magic points.\n\nYou now have to take Q practical tests of your ability as a magical girl.\n\nThe i-th test will be conducted as follows:\n\nInitially, a piece is placed on the square where the integer L_i is written.\n\nLet x be the integer written in the square occupied by the piece. Repeatedly move the piece to the square where the integer x+D is written, as long as x is not R_i. The test ends when x=R_i.\n\nHere, it is guaranteed that R_i-L_i is a multiple of D.\n\nFor each test, find the sum of magic points consumed during that test.\n\nConstraints\n\n1 \\leq H,W \\leq 300\n\n1 \\leq D \\leq H×W\n\n1 \\leq A_{i,j} \\leq H×W\n\nA_{i,j} \\neq A_{x,y} ((i,j) \\neq (x,y))\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq L_i \\leq R_i \\leq H×W\n\n(R_i-L_i) is a multiple of D.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W D\nA_{1,1} A_{1,2} ... A_{1,W}\n:\nA_{H,1} A_{H,2} ... A_{H,W}\nQ\nL_1 R_1\n:\nL_Q R_Q\n\nOutput\n\nFor each test, print the sum of magic points consumed during that test.\n\nOutput should be in the order the tests are conducted.\n\nSample Input 1\n\n3 3 2\n1 4 3\n2 5 7\n8 9 6\n1\n4 8\n\nSample Output 1\n\n5\n\n4 is written in Square (1,2).\n\n6 is written in Square (3,3).\n\n8 is written in Square (3,1).\n\nThus, the sum of magic points consumed during the first test is (|3-1|+|3-2|)+(|3-3|+|1-3|)=5.\n\nSample Input 2\n\n4 2 3\n3 7\n1 4\n5 2\n6 8\n2\n2 2\n2 2\n\nSample Output 2\n\n0\n0\n\nNote that there may be a test where the piece is not moved at all, and there may be multiple identical tests.\n\nSample Input 3\n\n5 5 4\n13 25 7 15 17\n16 22 20 2 9\n14 11 12 1 19\n10 6 23 8 18\n3 21 5 24 4\n3\n13 13\n2 10\n13 13\n\nSample Output 3\n\n0\n5\n0", "sample_input": "3 3 2\n1 4 3\n2 5 7\n8 9 6\n1\n4 8\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03426", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j).\n\nThe integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}.\n\nYou, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by consuming |x-i|+|y-j| magic points.\n\nYou now have to take Q practical tests of your ability as a magical girl.\n\nThe i-th test will be conducted as follows:\n\nInitially, a piece is placed on the square where the integer L_i is written.\n\nLet x be the integer written in the square occupied by the piece. Repeatedly move the piece to the square where the integer x+D is written, as long as x is not R_i. The test ends when x=R_i.\n\nHere, it is guaranteed that R_i-L_i is a multiple of D.\n\nFor each test, find the sum of magic points consumed during that test.\n\nConstraints\n\n1 \\leq H,W \\leq 300\n\n1 \\leq D \\leq H×W\n\n1 \\leq A_{i,j} \\leq H×W\n\nA_{i,j} \\neq A_{x,y} ((i,j) \\neq (x,y))\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq L_i \\leq R_i \\leq H×W\n\n(R_i-L_i) is a multiple of D.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W D\nA_{1,1} A_{1,2} ... A_{1,W}\n:\nA_{H,1} A_{H,2} ... A_{H,W}\nQ\nL_1 R_1\n:\nL_Q R_Q\n\nOutput\n\nFor each test, print the sum of magic points consumed during that test.\n\nOutput should be in the order the tests are conducted.\n\nSample Input 1\n\n3 3 2\n1 4 3\n2 5 7\n8 9 6\n1\n4 8\n\nSample Output 1\n\n5\n\n4 is written in Square (1,2).\n\n6 is written in Square (3,3).\n\n8 is written in Square (3,1).\n\nThus, the sum of magic points consumed during the first test is (|3-1|+|3-2|)+(|3-3|+|1-3|)=5.\n\nSample Input 2\n\n4 2 3\n3 7\n1 4\n5 2\n6 8\n2\n2 2\n2 2\n\nSample Output 2\n\n0\n0\n\nNote that there may be a test where the piece is not moved at all, and there may be multiple identical tests.\n\nSample Input 3\n\n5 5 4\n13 25 7 15 17\n16 22 20 2 9\n14 11 12 1 19\n10 6 23 8 18\n3 21 5 24 4\n3\n13 13\n2 10\n13 13\n\nSample Output 3\n\n0\n5\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 834, "cpu_time_ms": 561, "memory_kb": 28356}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s658776535", "group_id": "codeNet:p03433", "input_text": "\nn = int(input())\ncards = sorted(list(map(int, input().split())), reverse=True)\n\nalice = 0\nbob = 0\nfor i in range(n):\n if i % 2 == 0:\n alice += cards[i]\n else:\n bob += cards[i]\n\nprint(alice - bob)", "language": "Python", "metadata": {"date": 1578602684, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03433.html", "problem_id": "p03433", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03433/input.txt", "sample_output_relpath": "derived/input_output/data/p03433/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03433/Python/s658776535.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s658776535", "user_id": "u634439390"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "\nn = int(input())\ncards = sorted(list(map(int, input().split())), reverse=True)\n\nalice = 0\nbob = 0\nfor i in range(n):\n if i % 2 == 0:\n alice += cards[i]\n else:\n bob += cards[i]\n\nprint(alice - bob)", "problem_context": "Score: 100 points\n\nProblem Statement\n\nE869120 has A 1-yen coins and infinitely many 500-yen coins.\n\nDetermine if he can pay exactly N yen using only these coins.\n\nConstraints\n\nN is an integer between 1 and 10000 (inclusive).\n\nA is an integer between 0 and 1000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA\n\nOutput\n\nIf E869120 can pay exactly N yen using only his 1-yen and 500-yen coins, print Yes; otherwise, print No.\n\nSample Input 1\n\n2018\n218\n\nSample Output 1\n\nYes\n\nWe can pay 2018 yen with four 500-yen coins and 18 1-yen coins, so the answer is Yes.\n\nSample Input 2\n\n2763\n0\n\nSample Output 2\n\nNo\n\nWhen we have no 1-yen coins, we can only pay a multiple of 500 yen using only 500-yen coins. Since 2763 is not a multiple of 500, we cannot pay this amount.\n\nSample Input 3\n\n37\n514\n\nSample Output 3\n\nYes", "sample_input": "2018\n218\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03433", "source_text": "Score: 100 points\n\nProblem Statement\n\nE869120 has A 1-yen coins and infinitely many 500-yen coins.\n\nDetermine if he can pay exactly N yen using only these coins.\n\nConstraints\n\nN is an integer between 1 and 10000 (inclusive).\n\nA is an integer between 0 and 1000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA\n\nOutput\n\nIf E869120 can pay exactly N yen using only his 1-yen and 500-yen coins, print Yes; otherwise, print No.\n\nSample Input 1\n\n2018\n218\n\nSample Output 1\n\nYes\n\nWe can pay 2018 yen with four 500-yen coins and 18 1-yen coins, so the answer is Yes.\n\nSample Input 2\n\n2763\n0\n\nSample Output 2\n\nNo\n\nWhen we have no 1-yen coins, we can only pay a multiple of 500 yen using only 500-yen coins. Since 2763 is not a multiple of 500, we cannot pay this amount.\n\nSample Input 3\n\n37\n514\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 216, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s725927473", "group_id": "codeNet:p03434", "input_text": "N = int(input())\nscore = list(map(int, input().split()))\ntotal = 0\n \nscore.sort(reverse=True)\nfor i in range(0, N, 2):\n if score[i+1] == None:\n total += score[i]\n else:\n total += score[i]-score[i+1]\n\nprint(total)", "language": "Python", "metadata": {"date": 1584713992, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03434.html", "problem_id": "p03434", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03434/input.txt", "sample_output_relpath": "derived/input_output/data/p03434/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03434/Python/s725927473.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s725927473", "user_id": "u379720557"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "N = int(input())\nscore = list(map(int, input().split()))\ntotal = 0\n \nscore.sort(reverse=True)\nfor i in range(0, N, 2):\n if score[i+1] == None:\n total += score[i]\n else:\n total += score[i]-score[i+1]\n\nprint(total)", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have N cards. A number a_i is written on the i-th card.\n\nAlice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.\n\nThe game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\na_i \\ (1 \\leq i \\leq N) is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint Alice's score minus Bob's score when both players take the optimal strategy to maximize their scores.\n\nSample Input 1\n\n2\n3 1\n\nSample Output 1\n\n2\n\nFirst, Alice will take the card with 3. Then, Bob will take the card with 1.\nThe difference of their scores will be 3 - 1 = 2.\n\nSample Input 2\n\n3\n2 7 4\n\nSample Output 2\n\n5\n\nFirst, Alice will take the card with 7. Then, Bob will take the card with 4. Lastly, Alice will take the card with 2. The difference of their scores will be 7 - 4 + 2 = 5. The difference of their scores will be 3 - 1 = 2.\n\nSample Input 3\n\n4\n20 18 2 18\n\nSample Output 3\n\n18", "sample_input": "2\n3 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03434", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have N cards. A number a_i is written on the i-th card.\n\nAlice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.\n\nThe game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\na_i \\ (1 \\leq i \\leq N) is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint Alice's score minus Bob's score when both players take the optimal strategy to maximize their scores.\n\nSample Input 1\n\n2\n3 1\n\nSample Output 1\n\n2\n\nFirst, Alice will take the card with 3. Then, Bob will take the card with 1.\nThe difference of their scores will be 3 - 1 = 2.\n\nSample Input 2\n\n3\n2 7 4\n\nSample Output 2\n\n5\n\nFirst, Alice will take the card with 7. Then, Bob will take the card with 4. Lastly, Alice will take the card with 2. The difference of their scores will be 7 - 4 + 2 = 5. The difference of their scores will be 3 - 1 = 2.\n\nSample Input 3\n\n4\n20 18 2 18\n\nSample Output 3\n\n18", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 220, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s263346065", "group_id": "codeNet:p03434", "input_text": "n = int(input())\nA = list(map(int, input().split()))\nA.sort(reverse=True)\nans = sum(A[::2]) - sum(A[1::2])\nprint(ans)", "language": "Python", "metadata": {"date": 1580046877, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03434.html", "problem_id": "p03434", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03434/input.txt", "sample_output_relpath": "derived/input_output/data/p03434/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03434/Python/s263346065.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s263346065", "user_id": "u802963389"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n = int(input())\nA = list(map(int, input().split()))\nA.sort(reverse=True)\nans = sum(A[::2]) - sum(A[1::2])\nprint(ans)", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have N cards. A number a_i is written on the i-th card.\n\nAlice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.\n\nThe game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\na_i \\ (1 \\leq i \\leq N) is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint Alice's score minus Bob's score when both players take the optimal strategy to maximize their scores.\n\nSample Input 1\n\n2\n3 1\n\nSample Output 1\n\n2\n\nFirst, Alice will take the card with 3. Then, Bob will take the card with 1.\nThe difference of their scores will be 3 - 1 = 2.\n\nSample Input 2\n\n3\n2 7 4\n\nSample Output 2\n\n5\n\nFirst, Alice will take the card with 7. Then, Bob will take the card with 4. Lastly, Alice will take the card with 2. The difference of their scores will be 7 - 4 + 2 = 5. The difference of their scores will be 3 - 1 = 2.\n\nSample Input 3\n\n4\n20 18 2 18\n\nSample Output 3\n\n18", "sample_input": "2\n3 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03434", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have N cards. A number a_i is written on the i-th card.\n\nAlice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.\n\nThe game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\na_i \\ (1 \\leq i \\leq N) is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint Alice's score minus Bob's score when both players take the optimal strategy to maximize their scores.\n\nSample Input 1\n\n2\n3 1\n\nSample Output 1\n\n2\n\nFirst, Alice will take the card with 3. Then, Bob will take the card with 1.\nThe difference of their scores will be 3 - 1 = 2.\n\nSample Input 2\n\n3\n2 7 4\n\nSample Output 2\n\n5\n\nFirst, Alice will take the card with 7. Then, Bob will take the card with 4. Lastly, Alice will take the card with 2. The difference of their scores will be 7 - 4 + 2 = 5. The difference of their scores will be 3 - 1 = 2.\n\nSample Input 3\n\n4\n20 18 2 18\n\nSample Output 3\n\n18", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 117, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s927983920", "group_id": "codeNet:p03435", "input_text": "def main():\n c11, c12, c13 = map(int, input().split())\n c21, c22, c23 = map(int, input().split())\n c31, c32, c33 = map(int, input().split())\n\n for a1 in range(0, 101):\n for a2 in range(0, 101):\n for a3 in range(0, 101):\n for b1 in range(0, 101):\n C11 = a1 + b1\n C21 = a2 + b1\n C31 = a3 + b1\n if C11 > 100 or C21 > 100 or C31 > 100:\n break\n if C11 == c11 and C21 == c21 and C31 == c31:\n for b2 in range(0, 101):\n C12 = a1 + b2\n C22 = a2 + b2\n C32 = a3 + b2\n if C12 > 100 or C22 > 100 or C32 > 100:\n break\n if C12 == c12 and C22 == c22 and C32 == c32:\n for b3 in range(0, 101):\n C13 = a1 + b3\n C23 = a2 + b3\n C33 = a3 + b3\n if C13 > 100 or C23 > 100 or C33 > 100:\n break\n if C13 == c13 and C23 == c23 and C33 == c33:\n print('Yes')\n return\n\n print('No')\n return\n\n\nif __name__ == '__main__':\n main()", "language": "Python", "metadata": {"date": 1565062962, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03435.html", "problem_id": "p03435", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03435/input.txt", "sample_output_relpath": "derived/input_output/data/p03435/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03435/Python/s927983920.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s927983920", "user_id": "u987143553"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "def main():\n c11, c12, c13 = map(int, input().split())\n c21, c22, c23 = map(int, input().split())\n c31, c32, c33 = map(int, input().split())\n\n for a1 in range(0, 101):\n for a2 in range(0, 101):\n for a3 in range(0, 101):\n for b1 in range(0, 101):\n C11 = a1 + b1\n C21 = a2 + b1\n C31 = a3 + b1\n if C11 > 100 or C21 > 100 or C31 > 100:\n break\n if C11 == c11 and C21 == c21 and C31 == c31:\n for b2 in range(0, 101):\n C12 = a1 + b2\n C22 = a2 + b2\n C32 = a3 + b2\n if C12 > 100 or C22 > 100 or C32 > 100:\n break\n if C12 == c12 and C22 == c22 and C32 == c32:\n for b3 in range(0, 101):\n C13 = a1 + b3\n C23 = a2 + b3\n C33 = a3 + b3\n if C13 > 100 or C23 > 100 or C33 > 100:\n break\n if C13 == c13 and C23 == c23 and C33 == c33:\n print('Yes')\n return\n\n print('No')\n return\n\n\nif __name__ == '__main__':\n main()", "problem_context": "Score: 300 points\n\nProblem Statement\n\nWe have a 3 \\times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left.\n\nAccording to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) is equal to a_i + b_j.\n\nDetermine if he is correct.\n\nConstraints\n\nc_{i, j} \\ (1 \\leq i \\leq 3, 1 \\leq j \\leq 3) is an integer between 0 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nc_{1,1} c_{1,2} c_{1,3}\nc_{2,1} c_{2,2} c_{2,3}\nc_{3,1} c_{3,2} c_{3,3}\n\nOutput\n\nIf Takahashi's statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 0 1\n2 1 2\n1 0 1\n\nSample Output 1\n\nYes\n\nTakahashi is correct, since there are possible sets of integers such as: a_1=0,a_2=1,a_3=0,b_1=1,b_2=0,b_3=1.\n\nSample Input 2\n\n2 2 2\n2 1 2\n2 2 2\n\nSample Output 2\n\nNo\n\nTakahashi is incorrect in this case.\n\nSample Input 3\n\n0 8 8\n0 8 8\n0 8 8\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1 8 6\n2 9 7\n0 7 7\n\nSample Output 4\n\nNo", "sample_input": "1 0 1\n2 1 2\n1 0 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03435", "source_text": "Score: 300 points\n\nProblem Statement\n\nWe have a 3 \\times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left.\n\nAccording to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) is equal to a_i + b_j.\n\nDetermine if he is correct.\n\nConstraints\n\nc_{i, j} \\ (1 \\leq i \\leq 3, 1 \\leq j \\leq 3) is an integer between 0 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nc_{1,1} c_{1,2} c_{1,3}\nc_{2,1} c_{2,2} c_{2,3}\nc_{3,1} c_{3,2} c_{3,3}\n\nOutput\n\nIf Takahashi's statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 0 1\n2 1 2\n1 0 1\n\nSample Output 1\n\nYes\n\nTakahashi is correct, since there are possible sets of integers such as: a_1=0,a_2=1,a_3=0,b_1=1,b_2=0,b_3=1.\n\nSample Input 2\n\n2 2 2\n2 1 2\n2 2 2\n\nSample Output 2\n\nNo\n\nTakahashi is incorrect in this case.\n\nSample Input 3\n\n0 8 8\n0 8 8\n0 8 8\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1 8 6\n2 9 7\n0 7 7\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1479, "cpu_time_ms": 2104, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s183860232", "group_id": "codeNet:p03435", "input_text": "C = [0]*3\nC1 = [[0]*2]*3\nC2 = [[0]*3]*2\nfor i in range(3):\n C[i] = list(map(int, input().split()))\nfor i in range(3):\n for j in range(2):\n C1[i][j] = C[i][j] - C[i][j+1]\nfor i in range(2):\n for j in range(3):\n C2[i][j] = C[i][j] - C[i+1][j]\n \nif(C1[0][0] == C1[1][0] == C1[2][0]):\n if(C1[0][1] == C1[1][1] == C1[2][1]):\n if(C2[0][0] == C2[0][1] == C2[0][2]):\n if(C2[1][0] == C2[1][1] == C2[1][2]):\n print(\"No\")\n exit()\nprint(\"No\")", "language": "Python", "metadata": {"date": 1554778554, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03435.html", "problem_id": "p03435", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03435/input.txt", "sample_output_relpath": "derived/input_output/data/p03435/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03435/Python/s183860232.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s183860232", "user_id": "u501643136"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "C = [0]*3\nC1 = [[0]*2]*3\nC2 = [[0]*3]*2\nfor i in range(3):\n C[i] = list(map(int, input().split()))\nfor i in range(3):\n for j in range(2):\n C1[i][j] = C[i][j] - C[i][j+1]\nfor i in range(2):\n for j in range(3):\n C2[i][j] = C[i][j] - C[i+1][j]\n \nif(C1[0][0] == C1[1][0] == C1[2][0]):\n if(C1[0][1] == C1[1][1] == C1[2][1]):\n if(C2[0][0] == C2[0][1] == C2[0][2]):\n if(C2[1][0] == C2[1][1] == C2[1][2]):\n print(\"No\")\n exit()\nprint(\"No\")", "problem_context": "Score: 300 points\n\nProblem Statement\n\nWe have a 3 \\times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left.\n\nAccording to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) is equal to a_i + b_j.\n\nDetermine if he is correct.\n\nConstraints\n\nc_{i, j} \\ (1 \\leq i \\leq 3, 1 \\leq j \\leq 3) is an integer between 0 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nc_{1,1} c_{1,2} c_{1,3}\nc_{2,1} c_{2,2} c_{2,3}\nc_{3,1} c_{3,2} c_{3,3}\n\nOutput\n\nIf Takahashi's statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 0 1\n2 1 2\n1 0 1\n\nSample Output 1\n\nYes\n\nTakahashi is correct, since there are possible sets of integers such as: a_1=0,a_2=1,a_3=0,b_1=1,b_2=0,b_3=1.\n\nSample Input 2\n\n2 2 2\n2 1 2\n2 2 2\n\nSample Output 2\n\nNo\n\nTakahashi is incorrect in this case.\n\nSample Input 3\n\n0 8 8\n0 8 8\n0 8 8\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1 8 6\n2 9 7\n0 7 7\n\nSample Output 4\n\nNo", "sample_input": "1 0 1\n2 1 2\n1 0 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03435", "source_text": "Score: 300 points\n\nProblem Statement\n\nWe have a 3 \\times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left.\n\nAccording to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) is equal to a_i + b_j.\n\nDetermine if he is correct.\n\nConstraints\n\nc_{i, j} \\ (1 \\leq i \\leq 3, 1 \\leq j \\leq 3) is an integer between 0 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nc_{1,1} c_{1,2} c_{1,3}\nc_{2,1} c_{2,2} c_{2,3}\nc_{3,1} c_{3,2} c_{3,3}\n\nOutput\n\nIf Takahashi's statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 0 1\n2 1 2\n1 0 1\n\nSample Output 1\n\nYes\n\nTakahashi is correct, since there are possible sets of integers such as: a_1=0,a_2=1,a_3=0,b_1=1,b_2=0,b_3=1.\n\nSample Input 2\n\n2 2 2\n2 1 2\n2 2 2\n\nSample Output 2\n\nNo\n\nTakahashi is incorrect in this case.\n\nSample Input 3\n\n0 8 8\n0 8 8\n0 8 8\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1 8 6\n2 9 7\n0 7 7\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 465, "cpu_time_ms": 18, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s649049497", "group_id": "codeNet:p03435", "input_text": "import numpy as np\nc = np.array([[int(i) for i in input().split()] for _ in range(3)])\nprint(np.sum(c) % 3 == 0)", "language": "Python", "metadata": {"date": 1519870761, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03435.html", "problem_id": "p03435", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03435/input.txt", "sample_output_relpath": "derived/input_output/data/p03435/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03435/Python/s649049497.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s649049497", "user_id": "u729214975"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import numpy as np\nc = np.array([[int(i) for i in input().split()] for _ in range(3)])\nprint(np.sum(c) % 3 == 0)", "problem_context": "Score: 300 points\n\nProblem Statement\n\nWe have a 3 \\times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left.\n\nAccording to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) is equal to a_i + b_j.\n\nDetermine if he is correct.\n\nConstraints\n\nc_{i, j} \\ (1 \\leq i \\leq 3, 1 \\leq j \\leq 3) is an integer between 0 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nc_{1,1} c_{1,2} c_{1,3}\nc_{2,1} c_{2,2} c_{2,3}\nc_{3,1} c_{3,2} c_{3,3}\n\nOutput\n\nIf Takahashi's statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 0 1\n2 1 2\n1 0 1\n\nSample Output 1\n\nYes\n\nTakahashi is correct, since there are possible sets of integers such as: a_1=0,a_2=1,a_3=0,b_1=1,b_2=0,b_3=1.\n\nSample Input 2\n\n2 2 2\n2 1 2\n2 2 2\n\nSample Output 2\n\nNo\n\nTakahashi is incorrect in this case.\n\nSample Input 3\n\n0 8 8\n0 8 8\n0 8 8\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1 8 6\n2 9 7\n0 7 7\n\nSample Output 4\n\nNo", "sample_input": "1 0 1\n2 1 2\n1 0 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03435", "source_text": "Score: 300 points\n\nProblem Statement\n\nWe have a 3 \\times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left.\n\nAccording to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) is equal to a_i + b_j.\n\nDetermine if he is correct.\n\nConstraints\n\nc_{i, j} \\ (1 \\leq i \\leq 3, 1 \\leq j \\leq 3) is an integer between 0 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nc_{1,1} c_{1,2} c_{1,3}\nc_{2,1} c_{2,2} c_{2,3}\nc_{3,1} c_{3,2} c_{3,3}\n\nOutput\n\nIf Takahashi's statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 0 1\n2 1 2\n1 0 1\n\nSample Output 1\n\nYes\n\nTakahashi is correct, since there are possible sets of integers such as: a_1=0,a_2=1,a_3=0,b_1=1,b_2=0,b_3=1.\n\nSample Input 2\n\n2 2 2\n2 1 2\n2 2 2\n\nSample Output 2\n\nNo\n\nTakahashi is incorrect in this case.\n\nSample Input 3\n\n0 8 8\n0 8 8\n0 8 8\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1 8 6\n2 9 7\n0 7 7\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 112, "cpu_time_ms": 325, "memory_kb": 21804}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s144547977", "group_id": "codeNet:p03436", "input_text": "from collections import deque\nimport sys\nh,w = map(int,input().split())\nmp = [list(input()) for _ in range(h)]\n\nvisited = [[0]*w for _ in range(h)]\n\ndxdy = [[1,0],[0,1],[-1,0],[0,-1]]\n\nqueue = deque()\nqueue.append([0,0,1])\nvisited[0][0]=1\n\nwhile queue:\n x,y,d = queue.popleft()\n for dx,dy in dxdy:\n nx,ny = x+dx,y+dy\n if -1 sum(B):\n print(\"No\")\n return\n\n bamari = 0\n for i in range(N):\n if A[i] == B[i]:\n continue\n elif A[i] > B[i]:\n bamari -= A[i] - B[i]\n else:\n bamari += -(-(B[i] - A[i])) // 2\n bamari -= (B[i] - A[i]) % 2\n\n if bamari >= 0:\n print(\"Yes\")\n else:\n print(\"No\")\n\n\nif __name__ == '__main__':\n main()\n", "language": "Python", "metadata": {"date": 1597382427, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03438.html", "problem_id": "p03438", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03438/input.txt", "sample_output_relpath": "derived/input_output/data/p03438/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03438/Python/s302006284.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s302006284", "user_id": "u098012509"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import sys\n\nsys.setrecursionlimit(10 ** 8)\n\ninput = sys.stdin.readline\n\n\ndef main():\n N = int(input())\n A = [int(x) for x in input().split()]\n B = [int(x) for x in input().split()]\n\n if sum(A) > sum(B):\n print(\"No\")\n return\n\n bamari = 0\n for i in range(N):\n if A[i] == B[i]:\n continue\n elif A[i] > B[i]:\n bamari -= A[i] - B[i]\n else:\n bamari += -(-(B[i] - A[i])) // 2\n bamari -= (B[i] - A[i]) % 2\n\n if bamari >= 0:\n print(\"Yes\")\n else:\n print(\"No\")\n\n\nif __name__ == '__main__':\n main()\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two integer sequences of length N: a_1,a_2,..,a_N and b_1,b_2,..,b_N.\nDetermine if we can repeat the following operation zero or more times so that the sequences a and b become equal.\n\nOperation: Choose two integers i and j (possibly the same) between 1 and N (inclusive), then perform the following two actions simultaneously:\n\nAdd 2 to a_i.\n\nAdd 1 to b_j.\n\nConstraints\n\n1 ≤ N ≤ 10 000\n\n0 ≤ a_i,b_i ≤ 10^9 (1 ≤ i ≤ N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\nb_1 b_2 .. b_N\n\nOutput\n\nIf we can repeat the operation zero or more times so that the sequences a and b become equal, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 2 3\n5 2 2\n\nSample Output 1\n\nYes\n\nFor example, we can perform three operations as follows to do our job:\n\nFirst operation: i=1 and j=2. Now we have a = \\{3,2,3\\}, b = \\{5,3,2\\}.\n\nSecond operation: i=1 and j=2. Now we have a = \\{5,2,3\\}, b = \\{5,4,2\\}.\n\nThird operation: i=2 and j=3. Now we have a = \\{5,4,3\\}, b = \\{5,4,3\\}.\n\nSample Input 2\n\n5\n3 1 4 1 5\n2 7 1 8 2\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n2 7 1 8 2\n3 1 4 1 5\n\nSample Output 3\n\nNo", "sample_input": "3\n1 2 3\n5 2 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03438", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two integer sequences of length N: a_1,a_2,..,a_N and b_1,b_2,..,b_N.\nDetermine if we can repeat the following operation zero or more times so that the sequences a and b become equal.\n\nOperation: Choose two integers i and j (possibly the same) between 1 and N (inclusive), then perform the following two actions simultaneously:\n\nAdd 2 to a_i.\n\nAdd 1 to b_j.\n\nConstraints\n\n1 ≤ N ≤ 10 000\n\n0 ≤ a_i,b_i ≤ 10^9 (1 ≤ i ≤ N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\nb_1 b_2 .. b_N\n\nOutput\n\nIf we can repeat the operation zero or more times so that the sequences a and b become equal, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 2 3\n5 2 2\n\nSample Output 1\n\nYes\n\nFor example, we can perform three operations as follows to do our job:\n\nFirst operation: i=1 and j=2. Now we have a = \\{3,2,3\\}, b = \\{5,3,2\\}.\n\nSecond operation: i=1 and j=2. Now we have a = \\{5,2,3\\}, b = \\{5,4,2\\}.\n\nThird operation: i=2 and j=3. Now we have a = \\{5,4,3\\}, b = \\{5,4,3\\}.\n\nSample Input 2\n\n5\n3 1 4 1 5\n2 7 1 8 2\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n2 7 1 8 2\n3 1 4 1 5\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 606, "cpu_time_ms": 39, "memory_kb": 10548}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s856043719", "group_id": "codeNet:p03438", "input_text": "(n,),aa,bb = [list(map(int, s.split())) for s in open(0)]\n\nup = down = 0\n\nfor i in range(n):\n a = aa[i]\n b = bb[i]\n if a > b:\n down += a-b\n if b > a:\n d,m = divmod(b-a,2)\n up += d+m\n down += m\n\ndiff = sum(bb) - sum(aa)\n\nif up <= diff and down <= diff:\n print('Yes')\nelse:\n print('No')", "language": "Python", "metadata": {"date": 1597379502, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p03438.html", "problem_id": "p03438", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03438/input.txt", "sample_output_relpath": "derived/input_output/data/p03438/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03438/Python/s856043719.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s856043719", "user_id": "u062691227"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "(n,),aa,bb = [list(map(int, s.split())) for s in open(0)]\n\nup = down = 0\n\nfor i in range(n):\n a = aa[i]\n b = bb[i]\n if a > b:\n down += a-b\n if b > a:\n d,m = divmod(b-a,2)\n up += d+m\n down += m\n\ndiff = sum(bb) - sum(aa)\n\nif up <= diff and down <= diff:\n print('Yes')\nelse:\n print('No')", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two integer sequences of length N: a_1,a_2,..,a_N and b_1,b_2,..,b_N.\nDetermine if we can repeat the following operation zero or more times so that the sequences a and b become equal.\n\nOperation: Choose two integers i and j (possibly the same) between 1 and N (inclusive), then perform the following two actions simultaneously:\n\nAdd 2 to a_i.\n\nAdd 1 to b_j.\n\nConstraints\n\n1 ≤ N ≤ 10 000\n\n0 ≤ a_i,b_i ≤ 10^9 (1 ≤ i ≤ N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\nb_1 b_2 .. b_N\n\nOutput\n\nIf we can repeat the operation zero or more times so that the sequences a and b become equal, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 2 3\n5 2 2\n\nSample Output 1\n\nYes\n\nFor example, we can perform three operations as follows to do our job:\n\nFirst operation: i=1 and j=2. Now we have a = \\{3,2,3\\}, b = \\{5,3,2\\}.\n\nSecond operation: i=1 and j=2. Now we have a = \\{5,2,3\\}, b = \\{5,4,2\\}.\n\nThird operation: i=2 and j=3. Now we have a = \\{5,4,3\\}, b = \\{5,4,3\\}.\n\nSample Input 2\n\n5\n3 1 4 1 5\n2 7 1 8 2\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n2 7 1 8 2\n3 1 4 1 5\n\nSample Output 3\n\nNo", "sample_input": "3\n1 2 3\n5 2 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03438", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two integer sequences of length N: a_1,a_2,..,a_N and b_1,b_2,..,b_N.\nDetermine if we can repeat the following operation zero or more times so that the sequences a and b become equal.\n\nOperation: Choose two integers i and j (possibly the same) between 1 and N (inclusive), then perform the following two actions simultaneously:\n\nAdd 2 to a_i.\n\nAdd 1 to b_j.\n\nConstraints\n\n1 ≤ N ≤ 10 000\n\n0 ≤ a_i,b_i ≤ 10^9 (1 ≤ i ≤ N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\nb_1 b_2 .. b_N\n\nOutput\n\nIf we can repeat the operation zero or more times so that the sequences a and b become equal, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 2 3\n5 2 2\n\nSample Output 1\n\nYes\n\nFor example, we can perform three operations as follows to do our job:\n\nFirst operation: i=1 and j=2. Now we have a = \\{3,2,3\\}, b = \\{5,3,2\\}.\n\nSecond operation: i=1 and j=2. Now we have a = \\{5,2,3\\}, b = \\{5,4,2\\}.\n\nThird operation: i=2 and j=3. Now we have a = \\{5,4,3\\}, b = \\{5,4,3\\}.\n\nSample Input 2\n\n5\n3 1 4 1 5\n2 7 1 8 2\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n2 7 1 8 2\n3 1 4 1 5\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 330, "cpu_time_ms": 74, "memory_kb": 74192}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s193008007", "group_id": "codeNet:p03447", "input_text": "X = int(input())\nA = int(input())\nB = int(input())\n\nprint((X-A)%B)\n", "language": "Python", "metadata": {"date": 1520613623, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03447.html", "problem_id": "p03447", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03447/input.txt", "sample_output_relpath": "derived/input_output/data/p03447/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03447/Python/s193008007.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s193008007", "user_id": "u297103202"}, "prompt_components": {"gold_output": "84\n", "input_to_evaluate": "X = int(input())\nA = int(input())\nB = int(input())\n\nprint((X-A)%B)\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou went shopping to buy cakes and donuts with X yen (the currency of Japan).\n\nFirst, you bought one cake for A yen at a cake shop.\nThen, you bought as many donuts as possible for B yen each, at a donut shop.\n\nHow much do you have left after shopping?\n\nConstraints\n\n1 \\leq A, B \\leq 1 000\n\nA + B \\leq X \\leq 10 000\n\nX, A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\nA\nB\n\nOutput\n\nPrint the amount you have left after shopping.\n\nSample Input 1\n\n1234\n150\n100\n\nSample Output 1\n\n84\n\nYou have 1234 - 150 = 1084 yen left after buying a cake.\nWith this amount, you can buy 10 donuts, after which you have 84 yen left.\n\nSample Input 2\n\n1000\n108\n108\n\nSample Output 2\n\n28\n\nSample Input 3\n\n579\n123\n456\n\nSample Output 3\n\n0\n\nSample Input 4\n\n7477\n549\n593\n\nSample Output 4\n\n405", "sample_input": "1234\n150\n100\n"}, "reference_outputs": ["84\n"], "source_document_id": "p03447", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou went shopping to buy cakes and donuts with X yen (the currency of Japan).\n\nFirst, you bought one cake for A yen at a cake shop.\nThen, you bought as many donuts as possible for B yen each, at a donut shop.\n\nHow much do you have left after shopping?\n\nConstraints\n\n1 \\leq A, B \\leq 1 000\n\nA + B \\leq X \\leq 10 000\n\nX, A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\nA\nB\n\nOutput\n\nPrint the amount you have left after shopping.\n\nSample Input 1\n\n1234\n150\n100\n\nSample Output 1\n\n84\n\nYou have 1234 - 150 = 1084 yen left after buying a cake.\nWith this amount, you can buy 10 donuts, after which you have 84 yen left.\n\nSample Input 2\n\n1000\n108\n108\n\nSample Output 2\n\n28\n\nSample Input 3\n\n579\n123\n456\n\nSample Output 3\n\n0\n\nSample Input 4\n\n7477\n549\n593\n\nSample Output 4\n\n405", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 67, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s896806817", "group_id": "codeNet:p03451", "input_text": "n = int(input())\ngrid = [list(map(int, input().split())), list(map(int, input().split()))]\ndist = [[0 for _ in range(n)] for _ in range(2)]\ndist[0][0] = grid[0][0]\nfor i in range(2):\n for j in range(n):\n if j < n - 1:\n dist[i][j + 1] = max(dist[i][j + 1], dist[i][j] + grid[i][j + 1])\n if i == 0:\n dist[1][j] = max(dist[1][j], dist[0][j] + grid[1][j])\nprint(dist[-1][-1])", "language": "Python", "metadata": {"date": 1591463485, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03451.html", "problem_id": "p03451", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03451/input.txt", "sample_output_relpath": "derived/input_output/data/p03451/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03451/Python/s896806817.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s896806817", "user_id": "u780475861"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "n = int(input())\ngrid = [list(map(int, input().split())), list(map(int, input().split()))]\ndist = [[0 for _ in range(n)] for _ in range(2)]\ndist[0][0] = grid[0][0]\nfor i in range(2):\n for j in range(n):\n if j < n - 1:\n dist[i][j + 1] = max(dist[i][j + 1], dist[i][j] + grid[i][j + 1])\n if i == 0:\n dist[1][j] = max(dist[1][j], dist[0][j] + grid[1][j])\nprint(dist[-1][-1])", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a 2 \\times N grid. We will denote the square at the i-th row and j-th column (1 \\leq i \\leq 2, 1 \\leq j \\leq N) as (i, j).\n\nYou are initially in the top-left square, (1, 1).\nYou will travel to the bottom-right square, (2, N), by repeatedly moving right or down.\n\nThe square (i, j) contains A_{i, j} candies.\nYou will collect all the candies you visit during the travel.\nThe top-left and bottom-right squares also contain candies, and you will also collect them.\n\nAt most how many candies can you collect when you choose the best way to travel?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq A_{i, j} \\leq 100 (1 \\leq i \\leq 2, 1 \\leq j \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1, 1} A_{1, 2} ... A_{1, N}\nA_{2, 1} A_{2, 2} ... A_{2, N}\n\nOutput\n\nPrint the maximum number of candies that can be collected.\n\nSample Input 1\n\n5\n3 2 2 4 1\n1 2 2 2 1\n\nSample Output 1\n\n14\n\nThe number of collected candies will be maximized when you:\n\nmove right three times, then move down once, then move right once.\n\nSample Input 2\n\n4\n1 1 1 1\n1 1 1 1\n\nSample Output 2\n\n5\n\nYou will always collect the same number of candies, regardless of how you travel.\n\nSample Input 3\n\n7\n3 3 4 5 4 5 3\n5 3 4 4 2 3 2\n\nSample Output 3\n\n29\n\nSample Input 4\n\n1\n2\n3\n\nSample Output 4\n\n5", "sample_input": "5\n3 2 2 4 1\n1 2 2 2 1\n"}, "reference_outputs": ["14\n"], "source_document_id": "p03451", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a 2 \\times N grid. We will denote the square at the i-th row and j-th column (1 \\leq i \\leq 2, 1 \\leq j \\leq N) as (i, j).\n\nYou are initially in the top-left square, (1, 1).\nYou will travel to the bottom-right square, (2, N), by repeatedly moving right or down.\n\nThe square (i, j) contains A_{i, j} candies.\nYou will collect all the candies you visit during the travel.\nThe top-left and bottom-right squares also contain candies, and you will also collect them.\n\nAt most how many candies can you collect when you choose the best way to travel?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq A_{i, j} \\leq 100 (1 \\leq i \\leq 2, 1 \\leq j \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1, 1} A_{1, 2} ... A_{1, N}\nA_{2, 1} A_{2, 2} ... A_{2, N}\n\nOutput\n\nPrint the maximum number of candies that can be collected.\n\nSample Input 1\n\n5\n3 2 2 4 1\n1 2 2 2 1\n\nSample Output 1\n\n14\n\nThe number of collected candies will be maximized when you:\n\nmove right three times, then move down once, then move right once.\n\nSample Input 2\n\n4\n1 1 1 1\n1 1 1 1\n\nSample Output 2\n\n5\n\nYou will always collect the same number of candies, regardless of how you travel.\n\nSample Input 3\n\n7\n3 3 4 5 4 5 3\n5 3 4 4 2 3 2\n\nSample Output 3\n\n29\n\nSample Input 4\n\n1\n2\n3\n\nSample Output 4\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 388, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s175527928", "group_id": "codeNet:p03456", "input_text": "n = int(''.join(input().split()))\nif isinstance(n ** 0.5, int):\n print('Yes')\nelse:\n print('No')\n", "language": "Python", "metadata": {"date": 1597686317, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03456.html", "problem_id": "p03456", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03456/input.txt", "sample_output_relpath": "derived/input_output/data/p03456/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03456/Python/s175527928.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s175527928", "user_id": "u975997984"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "n = int(''.join(input().split()))\nif isinstance(n ** 0.5, int):\n print('Yes')\nelse:\n print('No')\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nAtCoDeer the deer has found two positive integers, a and b.\nDetermine whether the concatenation of a and b in this order is a square number.\n\nConstraints\n\n1 ≤ a,b ≤ 100\n\na and b are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the concatenation of a and b in this order is a square number, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 21\n\nSample Output 1\n\nYes\n\nAs 121 = 11 × 11, it is a square number.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\nNo\n\n100100 is not a square number.\n\nSample Input 3\n\n12 10\n\nSample Output 3\n\nNo", "sample_input": "1 21\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03456", "source_text": "Score : 200 points\n\nProblem Statement\n\nAtCoDeer the deer has found two positive integers, a and b.\nDetermine whether the concatenation of a and b in this order is a square number.\n\nConstraints\n\n1 ≤ a,b ≤ 100\n\na and b are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the concatenation of a and b in this order is a square number, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 21\n\nSample Output 1\n\nYes\n\nAs 121 = 11 × 11, it is a square number.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\nNo\n\n100100 is not a square number.\n\nSample Input 3\n\n12 10\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 103, "cpu_time_ms": 31, "memory_kb": 9400}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s906200255", "group_id": "codeNet:p03456", "input_text": "import math\n\na,b = input().split()\n\nr = math.sqrt(int(a+b))\nif r - int(r) > 0:\n print('No')\nelse:\n print('Yes')", "language": "Python", "metadata": {"date": 1587852768, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03456.html", "problem_id": "p03456", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03456/input.txt", "sample_output_relpath": "derived/input_output/data/p03456/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03456/Python/s906200255.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s906200255", "user_id": "u763968347"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "import math\n\na,b = input().split()\n\nr = math.sqrt(int(a+b))\nif r - int(r) > 0:\n print('No')\nelse:\n print('Yes')", "problem_context": "Score : 200 points\n\nProblem Statement\n\nAtCoDeer the deer has found two positive integers, a and b.\nDetermine whether the concatenation of a and b in this order is a square number.\n\nConstraints\n\n1 ≤ a,b ≤ 100\n\na and b are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the concatenation of a and b in this order is a square number, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 21\n\nSample Output 1\n\nYes\n\nAs 121 = 11 × 11, it is a square number.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\nNo\n\n100100 is not a square number.\n\nSample Input 3\n\n12 10\n\nSample Output 3\n\nNo", "sample_input": "1 21\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03456", "source_text": "Score : 200 points\n\nProblem Statement\n\nAtCoDeer the deer has found two positive integers, a and b.\nDetermine whether the concatenation of a and b in this order is a square number.\n\nConstraints\n\n1 ≤ a,b ≤ 100\n\na and b are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the concatenation of a and b in this order is a square number, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 21\n\nSample Output 1\n\nYes\n\nAs 121 = 11 × 11, it is a square number.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\nNo\n\n100100 is not a square number.\n\nSample Input 3\n\n12 10\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 117, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s501083778", "group_id": "codeNet:p03456", "input_text": "a,b=map(int, input().split())\nfor i in range(1,101):\n if i*i==a*100+b:\n print(\"Yes\")\n exit()\nprint(\"No\")\n", "language": "Python", "metadata": {"date": 1572805425, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03456.html", "problem_id": "p03456", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03456/input.txt", "sample_output_relpath": "derived/input_output/data/p03456/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03456/Python/s501083778.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s501083778", "user_id": "u117193815"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "a,b=map(int, input().split())\nfor i in range(1,101):\n if i*i==a*100+b:\n print(\"Yes\")\n exit()\nprint(\"No\")\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nAtCoDeer the deer has found two positive integers, a and b.\nDetermine whether the concatenation of a and b in this order is a square number.\n\nConstraints\n\n1 ≤ a,b ≤ 100\n\na and b are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the concatenation of a and b in this order is a square number, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 21\n\nSample Output 1\n\nYes\n\nAs 121 = 11 × 11, it is a square number.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\nNo\n\n100100 is not a square number.\n\nSample Input 3\n\n12 10\n\nSample Output 3\n\nNo", "sample_input": "1 21\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03456", "source_text": "Score : 200 points\n\nProblem Statement\n\nAtCoDeer the deer has found two positive integers, a and b.\nDetermine whether the concatenation of a and b in this order is a square number.\n\nConstraints\n\n1 ≤ a,b ≤ 100\n\na and b are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the concatenation of a and b in this order is a square number, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 21\n\nSample Output 1\n\nYes\n\nAs 121 = 11 × 11, it is a square number.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\nNo\n\n100100 is not a square number.\n\nSample Input 3\n\n12 10\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 112, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s436728517", "group_id": "codeNet:p03457", "input_text": "n = int(input())\nfor i in range(n):\n t,x,y=map(int,input().split())\n if (x + y) > t or (x + y + t) % 2:\n print(\"No\")\n exit()\nprint(\"Yes\")", "language": "Python", "metadata": {"date": 1580855159, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03457.html", "problem_id": "p03457", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03457/input.txt", "sample_output_relpath": "derived/input_output/data/p03457/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03457/Python/s436728517.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s436728517", "user_id": "u736848749"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "n = int(input())\nfor i in range(n):\n t,x,y=map(int,input().split())\n if (x + y) > t or (x + y + t) % 2:\n print(\"No\")\n exit()\nprint(\"Yes\")", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "sample_input": "2\n3 1 2\n6 1 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03457", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 157, "cpu_time_ms": 330, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s952917191", "group_id": "codeNet:p03457", "input_text": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Thu Aug 9 01:39:56 2018\n\n@author: Yuki\n\"\"\"\n\nN = int(input())\nplans = [[0, 0, 0]]\nfor i in range(N):\n plans.append([int(ii) for ii in input().split()])\n\nYes_flag = True\n# 移動距離が遠すぎないかのチェック\nfor i in range(N):\n if (abs(plans[i+1][1] - plans[i][1]) + abs(plans[i+1][2] - plans[i][2])) > (plans[i+1][0] - plans[i][0]):\n Yes_flag = False\n break\nfor i in range(1, N+1):\n if plans[i][0] % 2 == 0:\n if (plans[i][1] + plans[i][2]) % 2 != 0:\n Yes_flag = False\n break\n else:\n if (plans[i][1] + plans[i][2]) % 2 == 0:\n Yes_flag = False\n break\nif Yes_flag:\n print('Yes')\nelse:\n print('No')\n", "language": "Python", "metadata": {"date": 1533794133, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03457.html", "problem_id": "p03457", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03457/input.txt", "sample_output_relpath": "derived/input_output/data/p03457/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03457/Python/s952917191.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s952917191", "user_id": "u102902647"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Thu Aug 9 01:39:56 2018\n\n@author: Yuki\n\"\"\"\n\nN = int(input())\nplans = [[0, 0, 0]]\nfor i in range(N):\n plans.append([int(ii) for ii in input().split()])\n\nYes_flag = True\n# 移動距離が遠すぎないかのチェック\nfor i in range(N):\n if (abs(plans[i+1][1] - plans[i][1]) + abs(plans[i+1][2] - plans[i][2])) > (plans[i+1][0] - plans[i][0]):\n Yes_flag = False\n break\nfor i in range(1, N+1):\n if plans[i][0] % 2 == 0:\n if (plans[i][1] + plans[i][2]) % 2 != 0:\n Yes_flag = False\n break\n else:\n if (plans[i][1] + plans[i][2]) % 2 == 0:\n Yes_flag = False\n break\nif Yes_flag:\n print('Yes')\nelse:\n print('No')\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "sample_input": "2\n3 1 2\n6 1 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03457", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 737, "cpu_time_ms": 428, "memory_kb": 21156}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s525784857", "group_id": "codeNet:p03469", "input_text": "s= input()\nprint(s[:3] + '8' + s[4:])\n\n", "language": "Python", "metadata": {"date": 1592687202, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03469.html", "problem_id": "p03469", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03469/input.txt", "sample_output_relpath": "derived/input_output/data/p03469/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03469/Python/s525784857.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s525784857", "user_id": "u103902792"}, "prompt_components": {"gold_output": "2018/01/07\n", "input_to_evaluate": "s= input()\nprint(s[:3] + '8' + s[4:])\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nOn some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in yyyy/mm/dd format. For example, January 23, 2018 should be written as 2018/01/23.\n\nAfter finishing the document, she noticed that she had mistakenly wrote 2017 at the beginning of the date column. Write a program that, when the string that Takaki wrote in the date column, S, is given as input, modifies the first four characters in S to 2018 and prints it.\n\nConstraints\n\nS is a string of length 10.\n\nThe first eight characters in S are 2017/01/.\n\nThe last two characters in S are digits and represent an integer between 1 and 31 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nReplace the first four characters in S with 2018 and print it.\n\nSample Input 1\n\n2017/01/07\n\nSample Output 1\n\n2018/01/07\n\nSample Input 2\n\n2017/01/31\n\nSample Output 2\n\n2018/01/31", "sample_input": "2017/01/07\n"}, "reference_outputs": ["2018/01/07\n"], "source_document_id": "p03469", "source_text": "Score : 100 points\n\nProblem Statement\n\nOn some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in yyyy/mm/dd format. For example, January 23, 2018 should be written as 2018/01/23.\n\nAfter finishing the document, she noticed that she had mistakenly wrote 2017 at the beginning of the date column. Write a program that, when the string that Takaki wrote in the date column, S, is given as input, modifies the first four characters in S to 2018 and prints it.\n\nConstraints\n\nS is a string of length 10.\n\nThe first eight characters in S are 2017/01/.\n\nThe last two characters in S are digits and represent an integer between 1 and 31 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nReplace the first four characters in S with 2018 and print it.\n\nSample Input 1\n\n2017/01/07\n\nSample Output 1\n\n2018/01/07\n\nSample Input 2\n\n2017/01/31\n\nSample Output 2\n\n2018/01/31", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 40, "cpu_time_ms": 27, "memory_kb": 8980}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s491780484", "group_id": "codeNet:p03470", "input_text": "a = set()\nfor i in range(int(input())):\n a.add(int(input()))\nprint(len(a))", "language": "Python", "metadata": {"date": 1586468287, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03470.html", "problem_id": "p03470", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03470/input.txt", "sample_output_relpath": "derived/input_output/data/p03470/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03470/Python/s491780484.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s491780484", "user_id": "u060793972"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "a = set()\nfor i in range(int(input())):\n a.add(int(input()))\nprint(len(a))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nAn X-layered kagami mochi (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you have a 3-layered kagami mochi; if you put just one mochi, you have a 1-layered kagami mochi.\n\nLunlun the dachshund has N round mochi, and the diameter of the i-th mochi is d_i centimeters. When we make a kagami mochi using some or all of them, at most how many layers can our kagami mochi have?\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ d_i ≤ 100\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1\n:\nd_N\n\nOutput\n\nPrint the maximum number of layers in a kagami mochi that can be made.\n\nSample Input 1\n\n4\n10\n8\n8\n6\n\nSample Output 1\n\n3\n\nIf we stack the mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, we have a 3-layered kagami mochi, which is the maximum number of layers.\n\nSample Input 2\n\n3\n15\n15\n15\n\nSample Output 2\n\n1\n\nWhen all the mochi have the same diameter, we can only have a 1-layered kagami mochi.\n\nSample Input 3\n\n7\n50\n30\n50\n100\n50\n80\n30\n\nSample Output 3\n\n4", "sample_input": "4\n10\n8\n8\n6\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03470", "source_text": "Score : 200 points\n\nProblem Statement\n\nAn X-layered kagami mochi (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you have a 3-layered kagami mochi; if you put just one mochi, you have a 1-layered kagami mochi.\n\nLunlun the dachshund has N round mochi, and the diameter of the i-th mochi is d_i centimeters. When we make a kagami mochi using some or all of them, at most how many layers can our kagami mochi have?\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ d_i ≤ 100\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1\n:\nd_N\n\nOutput\n\nPrint the maximum number of layers in a kagami mochi that can be made.\n\nSample Input 1\n\n4\n10\n8\n8\n6\n\nSample Output 1\n\n3\n\nIf we stack the mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, we have a 3-layered kagami mochi, which is the maximum number of layers.\n\nSample Input 2\n\n3\n15\n15\n15\n\nSample Output 2\n\n1\n\nWhen all the mochi have the same diameter, we can only have a 1-layered kagami mochi.\n\nSample Input 3\n\n7\n50\n30\n50\n100\n50\n80\n30\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 77, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s451036318", "group_id": "codeNet:p03473", "input_text": "i=(48-i)\nprint(input())", "language": "Python", "metadata": {"date": 1597335960, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03473.html", "problem_id": "p03473", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03473/input.txt", "sample_output_relpath": "derived/input_output/data/p03473/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03473/Python/s451036318.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s451036318", "user_id": "u710282484"}, "prompt_components": {"gold_output": "27\n", "input_to_evaluate": "i=(48-i)\nprint(input())", "problem_context": "Score : 100 points\n\nProblem Statement\n\nHow many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December?\n\nConstraints\n\n1≤M≤23\n\nM is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nM\n\nOutput\n\nIf we have x hours until New Year at M o'clock on 30th, December, print x.\n\nSample Input 1\n\n21\n\nSample Output 1\n\n27\n\nWe have 27 hours until New Year at 21 o'clock on 30th, December.\n\nSample Input 2\n\n12\n\nSample Output 2\n\n36", "sample_input": "21\n"}, "reference_outputs": ["27\n"], "source_document_id": "p03473", "source_text": "Score : 100 points\n\nProblem Statement\n\nHow many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December?\n\nConstraints\n\n1≤M≤23\n\nM is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nM\n\nOutput\n\nIf we have x hours until New Year at M o'clock on 30th, December, print x.\n\nSample Input 1\n\n21\n\nSample Output 1\n\n27\n\nWe have 27 hours until New Year at 21 o'clock on 30th, December.\n\nSample Input 2\n\n12\n\nSample Output 2\n\n36", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 23, "cpu_time_ms": 21, "memory_kb": 9016}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s590660231", "group_id": "codeNet:p03474", "input_text": "a,b=map(int,input().split())\ns=input()\nflag=True\nfor i in range(0,a+b+1):\n if i c+d else \"Right\" if a+b < c+d else \"Balanced\")", "language": "Python", "metadata": {"date": 1584473424, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03477.html", "problem_id": "p03477", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03477/input.txt", "sample_output_relpath": "derived/input_output/data/p03477/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03477/Python/s838727795.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s838727795", "user_id": "u037901699"}, "prompt_components": {"gold_output": "Left\n", "input_to_evaluate": "a, b, c, d=map(int, input().split())\nprint(\"Left\" if a+b > c+d else \"Right\" if a+b < c+d else \"Balanced\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nA balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L8, we should print Left.\n\nSample Input 2\n\n3 4 5 2\n\nSample Output 2\n\nBalanced\n\nThe total weight of the masses on the left pan is 7, and the total weight of the masses on the right pan is 7. Since 7=7, we should print Balanced.\n\nSample Input 3\n\n1 7 6 4\n\nSample Output 3\n\nRight\n\nThe total weight of the masses on the left pan is 8, and the total weight of the masses on the right pan is 10. Since 8<10, we should print Right.", "sample_input": "3 8 7 1\n"}, "reference_outputs": ["Left\n"], "source_document_id": "p03477", "source_text": "Score : 100 points\n\nProblem Statement\n\nA balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L8, we should print Left.\n\nSample Input 2\n\n3 4 5 2\n\nSample Output 2\n\nBalanced\n\nThe total weight of the masses on the left pan is 7, and the total weight of the masses on the right pan is 7. Since 7=7, we should print Balanced.\n\nSample Input 3\n\n1 7 6 4\n\nSample Output 3\n\nRight\n\nThe total weight of the masses on the left pan is 8, and the total weight of the masses on the right pan is 10. Since 8<10, we should print Right.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 105, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s957986033", "group_id": "codeNet:p03479", "input_text": "x,y = map(int,input().split())\ncnt = 0\nwhile True:\n if x > y:\n break\n else:\n cnt+=1\n x *= 2\nprint(cnt)\n", "language": "Python", "metadata": {"date": 1584675803, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03479.html", "problem_id": "p03479", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03479/input.txt", "sample_output_relpath": "derived/input_output/data/p03479/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03479/Python/s957986033.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s957986033", "user_id": "u401487574"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "x,y = map(int,input().split())\ncnt = 0\nwhile True:\n if x > y:\n break\n else:\n cnt+=1\n x *= 2\nprint(cnt)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAs a token of his gratitude, Takahashi has decided to give his mother an integer sequence.\nThe sequence A needs to satisfy the conditions below:\n\nA consists of integers between X and Y (inclusive).\n\nFor each 1\\leq i \\leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.\n\nFind the maximum possible length of the sequence.\n\nConstraints\n\n1 \\leq X \\leq Y \\leq 10^{18}\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint the maximum possible length of the sequence.\n\nSample Input 1\n\n3 20\n\nSample Output 1\n\n3\n\nThe sequence 3,6,18 satisfies the conditions.\n\nSample Input 2\n\n25 100\n\nSample Output 2\n\n3\n\nSample Input 3\n\n314159265 358979323846264338\n\nSample Output 3\n\n31", "sample_input": "3 20\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03479", "source_text": "Score : 300 points\n\nProblem Statement\n\nAs a token of his gratitude, Takahashi has decided to give his mother an integer sequence.\nThe sequence A needs to satisfy the conditions below:\n\nA consists of integers between X and Y (inclusive).\n\nFor each 1\\leq i \\leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.\n\nFind the maximum possible length of the sequence.\n\nConstraints\n\n1 \\leq X \\leq Y \\leq 10^{18}\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint the maximum possible length of the sequence.\n\nSample Input 1\n\n3 20\n\nSample Output 1\n\n3\n\nThe sequence 3,6,18 satisfies the conditions.\n\nSample Input 2\n\n25 100\n\nSample Output 2\n\n3\n\nSample Input 3\n\n314159265 358979323846264338\n\nSample Output 3\n\n31", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 130, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s503210778", "group_id": "codeNet:p03485", "input_text": "import math\na,b=map(int,input().split())\nprint(math.ceil((a+b)/2))", "language": "Python", "metadata": {"date": 1587828580, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03485.html", "problem_id": "p03485", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03485/input.txt", "sample_output_relpath": "derived/input_output/data/p03485/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03485/Python/s503210778.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s503210778", "user_id": "u383450070"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import math\na,b=map(int,input().split())\nprint(math.ceil((a+b)/2))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given two positive integers a and b.\nLet x be the average of a and b.\nPrint x rounded up to the nearest integer.\n\nConstraints\n\na and b are integers.\n\n1 \\leq a, b \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nPrint x rounded up to the nearest integer.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\n2\n\nThe average of 1 and 3 is 2.0, and it will be rounded up to the nearest integer, 2.\n\nSample Input 2\n\n7 4\n\nSample Output 2\n\n6\n\nThe average of 7 and 4 is 5.5, and it will be rounded up to the nearest integer, 6.\n\nSample Input 3\n\n5 5\n\nSample Output 3\n\n5", "sample_input": "1 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03485", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given two positive integers a and b.\nLet x be the average of a and b.\nPrint x rounded up to the nearest integer.\n\nConstraints\n\na and b are integers.\n\n1 \\leq a, b \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nPrint x rounded up to the nearest integer.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\n2\n\nThe average of 1 and 3 is 2.0, and it will be rounded up to the nearest integer, 2.\n\nSample Input 2\n\n7 4\n\nSample Output 2\n\n6\n\nThe average of 7 and 4 is 5.5, and it will be rounded up to the nearest integer, 6.\n\nSample Input 3\n\n5 5\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 66, "cpu_time_ms": 18, "memory_kb": 3188}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s923986350", "group_id": "codeNet:p03485", "input_text": "a,b = map(int,input().split())\nif (a+b) % 2 == 0:\n print((a+b)//2)\nelse:\n print((a+b)//2+1)\n", "language": "Python", "metadata": {"date": 1570523533, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03485.html", "problem_id": "p03485", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03485/input.txt", "sample_output_relpath": "derived/input_output/data/p03485/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03485/Python/s923986350.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s923986350", "user_id": "u390883247"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "a,b = map(int,input().split())\nif (a+b) % 2 == 0:\n print((a+b)//2)\nelse:\n print((a+b)//2+1)\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given two positive integers a and b.\nLet x be the average of a and b.\nPrint x rounded up to the nearest integer.\n\nConstraints\n\na and b are integers.\n\n1 \\leq a, b \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nPrint x rounded up to the nearest integer.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\n2\n\nThe average of 1 and 3 is 2.0, and it will be rounded up to the nearest integer, 2.\n\nSample Input 2\n\n7 4\n\nSample Output 2\n\n6\n\nThe average of 7 and 4 is 5.5, and it will be rounded up to the nearest integer, 6.\n\nSample Input 3\n\n5 5\n\nSample Output 3\n\n5", "sample_input": "1 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03485", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given two positive integers a and b.\nLet x be the average of a and b.\nPrint x rounded up to the nearest integer.\n\nConstraints\n\na and b are integers.\n\n1 \\leq a, b \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nPrint x rounded up to the nearest integer.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\n2\n\nThe average of 1 and 3 is 2.0, and it will be rounded up to the nearest integer, 2.\n\nSample Input 2\n\n7 4\n\nSample Output 2\n\n6\n\nThe average of 7 and 4 is 5.5, and it will be rounded up to the nearest integer, 6.\n\nSample Input 3\n\n5 5\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 98, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s753522117", "group_id": "codeNet:p03486", "input_text": "s = raw_input()\nt = raw_input()\n\nsd = \"\".join(sorted(list(s)))\ntd = \"\".join(sorted(list(t), reverse=True))\nif sd < td:\n\tprint \"Yes\"\nelse:\n\tprint \"No\"\n\n", "language": "Python", "metadata": {"date": 1542772810, "filename_ext": "py", "original_language": "Python (2.7.6)", "problem_description_relpath": "problem_descriptions/p03486.html", "problem_id": "p03486", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03486/input.txt", "sample_output_relpath": "derived/input_output/data/p03486/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03486/Python/s753522117.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s753522117", "user_id": "u330039499"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "s = raw_input()\nt = raw_input()\n\nsd = \"\".join(sorted(list(s)))\ntd = \"\".join(sorted(list(t), reverse=True))\nif sd < td:\n\tprint \"Yes\"\nelse:\n\tprint \"No\"\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given strings s and t, consisting of lowercase English letters.\nYou will create a string s' by freely rearranging the characters in s.\nYou will also create a string t' by freely rearranging the characters in t.\nDetermine whether it is possible to satisfy s' < t' for the lexicographic order.\n\nNotes\n\nFor a string a = a_1 a_2 ... a_N of length N and a string b = b_1 b_2 ... b_M of length M, we say a < b for the lexicographic order if either one of the following two conditions holds true:\n\nN < M and a_1 = b_1, a_2 = b_2, ..., a_N = b_N.\n\nThere exists i (1 \\leq i \\leq N, M) such that a_1 = b_1, a_2 = b_2, ..., a_{i - 1} = b_{i - 1} and a_i < b_i. Here, letters are compared using alphabetical order.\n\nFor example, xy < xya and atcoder < atlas.\n\nConstraints\n\nThe lengths of s and t are between 1 and 100 (inclusive).\n\ns and t consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nIf it is possible to satisfy s' < t', print Yes; if it is not, print No.\n\nSample Input 1\n\nyx\naxy\n\nSample Output 1\n\nYes\n\nWe can, for example, rearrange yx into xy and axy into yxa. Then, xy < yxa.\n\nSample Input 2\n\nratcode\natlas\n\nSample Output 2\n\nYes\n\nWe can, for example, rearrange ratcode into acdeort and atlas into tslaa. Then, acdeort < tslaa.\n\nSample Input 3\n\ncd\nabc\n\nSample Output 3\n\nNo\n\nNo matter how we rearrange cd and abc, we cannot achieve our objective.\n\nSample Input 4\n\nw\nww\n\nSample Output 4\n\nYes\n\nSample Input 5\n\nzzz\nzzz\n\nSample Output 5\n\nNo", "sample_input": "yx\naxy\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03486", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given strings s and t, consisting of lowercase English letters.\nYou will create a string s' by freely rearranging the characters in s.\nYou will also create a string t' by freely rearranging the characters in t.\nDetermine whether it is possible to satisfy s' < t' for the lexicographic order.\n\nNotes\n\nFor a string a = a_1 a_2 ... a_N of length N and a string b = b_1 b_2 ... b_M of length M, we say a < b for the lexicographic order if either one of the following two conditions holds true:\n\nN < M and a_1 = b_1, a_2 = b_2, ..., a_N = b_N.\n\nThere exists i (1 \\leq i \\leq N, M) such that a_1 = b_1, a_2 = b_2, ..., a_{i - 1} = b_{i - 1} and a_i < b_i. Here, letters are compared using alphabetical order.\n\nFor example, xy < xya and atcoder < atlas.\n\nConstraints\n\nThe lengths of s and t are between 1 and 100 (inclusive).\n\ns and t consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nIf it is possible to satisfy s' < t', print Yes; if it is not, print No.\n\nSample Input 1\n\nyx\naxy\n\nSample Output 1\n\nYes\n\nWe can, for example, rearrange yx into xy and axy into yxa. Then, xy < yxa.\n\nSample Input 2\n\nratcode\natlas\n\nSample Output 2\n\nYes\n\nWe can, for example, rearrange ratcode into acdeort and atlas into tslaa. Then, acdeort < tslaa.\n\nSample Input 3\n\ncd\nabc\n\nSample Output 3\n\nNo\n\nNo matter how we rearrange cd and abc, we cannot achieve our objective.\n\nSample Input 4\n\nw\nww\n\nSample Output 4\n\nYes\n\nSample Input 5\n\nzzz\nzzz\n\nSample Output 5\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 151, "cpu_time_ms": 10, "memory_kb": 2568}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s936320231", "group_id": "codeNet:p03487", "input_text": "N = int(input())\nA = list(map(int,input().split()))\n\nd = {}\nfor a in A:\n if(a in d):\n d[a] += 1\n else:\n d[a] = 1\ncnt = 0\nfor k, v in d.items():\n if(k > v):\n cnt += v\n elif(k < v):\n cnt += v - k\nprint(cnt)", "language": "Python", "metadata": {"date": 1550572831, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03487.html", "problem_id": "p03487", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03487/input.txt", "sample_output_relpath": "derived/input_output/data/p03487/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03487/Python/s936320231.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s936320231", "user_id": "u887207211"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "N = int(input())\nA = list(map(int,input().split()))\n\nd = {}\nfor a in A:\n if(a in d):\n d[a] += 1\n else:\n d[a] = 1\ncnt = 0\nfor k, v in d.items():\n if(k > v):\n cnt += v\n elif(k < v):\n cnt += v - k\nprint(cnt)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "sample_input": "4\n3 3 3 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03487", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 220, "cpu_time_ms": 83, "memory_kb": 17784}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s850371243", "group_id": "codeNet:p03487", "input_text": "require 'prime'\nrequire 'set'\nrequire 'tsort'\ninclude Math\nALP = ('a'..'z').to_a\nINF = 0xffffffffffffffff\ndef max(a,b); a > b ? a : b end\ndef min(a,b); a < b ? a : b end\ndef swap(a,b); a, b = b, a end\ndef gif; gets.to_i end\ndef gff; gets.to_f end\ndef gsf; gets.chomp end\ndef gi; gets.split.map(&:to_i) end\ndef gf; gets.split.map(&:to_f) end\ndef gs; gets.chomp.split.map(&:to_s) end\ndef gc; gets.chomp.split('') end\ndef pr(num); num.prime_division end\ndef pr?(num); Prime.prime?(num) end\ndef digit(num); num.to_s.length end\ndef array(s,ini=nil); Array.new(s){ini} end\ndef darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}} end\ndef rep(num); num.times{|i|yield(i)} end\ndef repl(st,en,n=1); st.step(en,n){|i|yield(i)} end\n\nn = gif\n\na = gi\n\nb = Hash.new\na.each do |aa|\nb[aa] ||= 0\nb[aa] += 1\nend\nans = 0\nb.each do |key,value|\n if value >= key\n ans += value - key\nelse\n ans += value\nend\nend\n\nputs ans\n\n", "language": "Python", "metadata": {"date": 1542572513, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03487.html", "problem_id": "p03487", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03487/input.txt", "sample_output_relpath": "derived/input_output/data/p03487/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03487/Python/s850371243.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s850371243", "user_id": "u247366051"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "require 'prime'\nrequire 'set'\nrequire 'tsort'\ninclude Math\nALP = ('a'..'z').to_a\nINF = 0xffffffffffffffff\ndef max(a,b); a > b ? a : b end\ndef min(a,b); a < b ? a : b end\ndef swap(a,b); a, b = b, a end\ndef gif; gets.to_i end\ndef gff; gets.to_f end\ndef gsf; gets.chomp end\ndef gi; gets.split.map(&:to_i) end\ndef gf; gets.split.map(&:to_f) end\ndef gs; gets.chomp.split.map(&:to_s) end\ndef gc; gets.chomp.split('') end\ndef pr(num); num.prime_division end\ndef pr?(num); Prime.prime?(num) end\ndef digit(num); num.to_s.length end\ndef array(s,ini=nil); Array.new(s){ini} end\ndef darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}} end\ndef rep(num); num.times{|i|yield(i)} end\ndef repl(st,en,n=1); st.step(en,n){|i|yield(i)} end\n\nn = gif\n\na = gi\n\nb = Hash.new\na.each do |aa|\nb[aa] ||= 0\nb[aa] += 1\nend\nans = 0\nb.each do |key,value|\n if value >= key\n ans += value - key\nelse\n ans += value\nend\nend\n\nputs ans\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "sample_input": "4\n3 3 3 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03487", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1545, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s912903913", "group_id": "codeNet:p03494", "input_text": "n = int(input())\na = list(map(int, input().split()))\ncnt = 0\nwhile True:\n\tis_odd = False\n\tfor i in range(len(a)):\n\t\tif a[i] % 2 == 1:\n\t\t\tis_odd = True\n\t\t\tbreak\n\t\telse:\n\t\t\ta[i] /= 2\n\tif is_odd:\n\t\tbreak\n\tcnt += 1\n\nprint(cnt)", "language": "Python", "metadata": {"date": 1594352738, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03494.html", "problem_id": "p03494", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03494/input.txt", "sample_output_relpath": "derived/input_output/data/p03494/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03494/Python/s912903913.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s912903913", "user_id": "u018846452"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n = int(input())\na = list(map(int, input().split()))\ncnt = 0\nwhile True:\n\tis_odd = False\n\tfor i in range(len(a)):\n\t\tif a[i] % 2 == 1:\n\t\t\tis_odd = True\n\t\t\tbreak\n\t\telse:\n\t\t\ta[i] /= 2\n\tif is_odd:\n\t\tbreak\n\tcnt += 1\n\nprint(cnt)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "sample_input": "3\n8 12 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03494", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 222, "cpu_time_ms": 29, "memory_kb": 9184}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s084782218", "group_id": "codeNet:p03494", "input_text": "num = input()\nl = input().split()\ncount = 0\nfor k in l:\n x = int(k) % 2\n if x == 0:\n for i in l:\n y = int(i) % 2 \n if y == 0:\n count += 1\nprint(int((count - 3 )/ 3))", "language": "Python", "metadata": {"date": 1583183472, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03494.html", "problem_id": "p03494", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03494/input.txt", "sample_output_relpath": "derived/input_output/data/p03494/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03494/Python/s084782218.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s084782218", "user_id": "u163874353"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "num = input()\nl = input().split()\ncount = 0\nfor k in l:\n x = int(k) % 2\n if x == 0:\n for i in l:\n y = int(i) % 2 \n if y == 0:\n count += 1\nprint(int((count - 3 )/ 3))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "sample_input": "3\n8 12 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03494", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 215, "cpu_time_ms": 32, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s354199440", "group_id": "codeNet:p03494", "input_text": "n = input()\nnList = list(map(int,input().split()))\ncount = 0\nwhile True:\n for i in range(len(nList)):\n nList[i] = nList[i]/2\n if not(nList[i].is_integer()):\n print(count)\n exit()\n count += 1", "language": "Python", "metadata": {"date": 1579378713, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03494.html", "problem_id": "p03494", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03494/input.txt", "sample_output_relpath": "derived/input_output/data/p03494/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03494/Python/s354199440.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s354199440", "user_id": "u905974390"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n = input()\nnList = list(map(int,input().split()))\ncount = 0\nwhile True:\n for i in range(len(nList)):\n nList[i] = nList[i]/2\n if not(nList[i].is_integer()):\n print(count)\n exit()\n count += 1", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "sample_input": "3\n8 12 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03494", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 208, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s315921859", "group_id": "codeNet:p03494", "input_text": "A=list(map(int,input().split()))\nflag=0\ncount=0\nans=[]\nfor a in A:\n if a%2==0:\n count=a/2\n else:\n count=(a-1)/2\n flag=1\n ans.append(count)\n if flag==1:\n print(int(min(ans)))\n else:\n print(0) ", "language": "Python", "metadata": {"date": 1569159326, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03494.html", "problem_id": "p03494", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03494/input.txt", "sample_output_relpath": "derived/input_output/data/p03494/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03494/Python/s315921859.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s315921859", "user_id": "u982471399"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "A=list(map(int,input().split()))\nflag=0\ncount=0\nans=[]\nfor a in A:\n if a%2==0:\n count=a/2\n else:\n count=(a-1)/2\n flag=1\n ans.append(count)\n if flag==1:\n print(int(min(ans)))\n else:\n print(0) ", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "sample_input": "3\n8 12 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03494", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 253, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s631540179", "group_id": "codeNet:p03494", "input_text": "_,t=open(0);n=eval(t.replace(' ','|'));print(len(bin(n&-n))-3)", "language": "Python", "metadata": {"date": 1554854989, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03494.html", "problem_id": "p03494", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03494/input.txt", "sample_output_relpath": "derived/input_output/data/p03494/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03494/Python/s631540179.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s631540179", "user_id": "u729133443"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "_,t=open(0);n=eval(t.replace(' ','|'));print(len(bin(n&-n))-3)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "sample_input": "3\n8 12 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03494", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 62, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s642270586", "group_id": "codeNet:p03494", "input_text": "N = int(input())\nnumber = input().split()\nnumber = [int(s) for s in number]\nfor i in range(1, 27):\n frag = 0\n for j in range(N):\n if number[j] % (2**i) != 0:\n frag = 1\n break\n if frag == 1:\n print(i - 1)\n break", "language": "Python", "metadata": {"date": 1549876937, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03494.html", "problem_id": "p03494", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03494/input.txt", "sample_output_relpath": "derived/input_output/data/p03494/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03494/Python/s642270586.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s642270586", "user_id": "u962819039"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "N = int(input())\nnumber = input().split()\nnumber = [int(s) for s in number]\nfor i in range(1, 27):\n frag = 0\n for j in range(N):\n if number[j] % (2**i) != 0:\n frag = 1\n break\n if frag == 1:\n print(i - 1)\n break", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "sample_input": "3\n8 12 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03494", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 247, "cpu_time_ms": 20, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s918062412", "group_id": "codeNet:p03494", "input_text": "n=int(input())\ndat=list(map(int, input().split()))\n\nfor e in dat:\n e = bin(e)[2:]\n e = list(e).reverse()\n\nre = []\n\nfor e in dat:\n try:\n w=e.index('1')\n re.append(w)\n except Exception:\n re.append(0)\n\nprint(min(re))", "language": "Python", "metadata": {"date": 1543037169, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03494.html", "problem_id": "p03494", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03494/input.txt", "sample_output_relpath": "derived/input_output/data/p03494/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03494/Python/s918062412.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s918062412", "user_id": "u464995425"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n=int(input())\ndat=list(map(int, input().split()))\n\nfor e in dat:\n e = bin(e)[2:]\n e = list(e).reverse()\n\nre = []\n\nfor e in dat:\n try:\n w=e.index('1')\n re.append(w)\n except Exception:\n re.append(0)\n\nprint(min(re))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "sample_input": "3\n8 12 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03494", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 262, "cpu_time_ms": 18, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s051594714", "group_id": "codeNet:p03494", "input_text": "n = input()\na = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in a:\n ans = min(ans, len(bin(i)) - (bin(i).rfind(\"1\") + 1))\nprint(ans)", "language": "Python", "metadata": {"date": 1534863125, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03494.html", "problem_id": "p03494", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03494/input.txt", "sample_output_relpath": "derived/input_output/data/p03494/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03494/Python/s051594714.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s051594714", "user_id": "u138486156"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n = input()\na = list(map(int, input().split()))\nans = float(\"inf\")\nfor i in a:\n ans = min(ans, len(bin(i)) - (bin(i).rfind(\"1\") + 1))\nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "sample_input": "3\n8 12 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03494", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 147, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s318073341", "group_id": "codeNet:p03501", "input_text": "import bisect,collections,copy,heapq,itertools,math,string\nimport sys\ndef S(): return sys.stdin.readline().rstrip()\ndef M(): return map(int,sys.stdin.readline().rstrip().split())\ndef I(): return int(sys.stdin.readline().rstrip())\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split()))\ndef LS(): return list(sys.stdin.readline().rstrip().split())\nn, a, b = M()\nprint(min(n*a, b))", "language": "Python", "metadata": {"date": 1594507625, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p03501.html", "problem_id": "p03501", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03501/input.txt", "sample_output_relpath": "derived/input_output/data/p03501/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03501/Python/s318073341.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s318073341", "user_id": "u225084815"}, "prompt_components": {"gold_output": "119\n", "input_to_evaluate": "import bisect,collections,copy,heapq,itertools,math,string\nimport sys\ndef S(): return sys.stdin.readline().rstrip()\ndef M(): return map(int,sys.stdin.readline().rstrip().split())\ndef I(): return int(sys.stdin.readline().rstrip())\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split()))\ndef LS(): return list(sys.stdin.readline().rstrip().split())\nn, a, b = M()\nprint(min(n*a, b))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are parking at a parking lot. You can choose from the following two fee plans:\n\nPlan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours.\n\nPlan 2: The fee will be B yen, regardless of the duration.\n\nFind the minimum fee when you park for N hours.\n\nConstraints\n\n1≤N≤20\n\n1≤A≤100\n\n1≤B≤2000\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nWhen the minimum fee is x yen, print the value of x.\n\nSample Input 1\n\n7 17 120\n\nSample Output 1\n\n119\n\nIf you choose Plan 1, the fee will be 7×17=119 yen.\n\nIf you choose Plan 2, the fee will be 120 yen.\n\nThus, the minimum fee is 119 yen.\n\nSample Input 2\n\n5 20 100\n\nSample Output 2\n\n100\n\nThe fee might be the same in the two plans.\n\nSample Input 3\n\n6 18 100\n\nSample Output 3\n\n100", "sample_input": "7 17 120\n"}, "reference_outputs": ["119\n"], "source_document_id": "p03501", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are parking at a parking lot. You can choose from the following two fee plans:\n\nPlan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours.\n\nPlan 2: The fee will be B yen, regardless of the duration.\n\nFind the minimum fee when you park for N hours.\n\nConstraints\n\n1≤N≤20\n\n1≤A≤100\n\n1≤B≤2000\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nWhen the minimum fee is x yen, print the value of x.\n\nSample Input 1\n\n7 17 120\n\nSample Output 1\n\n119\n\nIf you choose Plan 1, the fee will be 7×17=119 yen.\n\nIf you choose Plan 2, the fee will be 120 yen.\n\nThus, the minimum fee is 119 yen.\n\nSample Input 2\n\n5 20 100\n\nSample Output 2\n\n100\n\nThe fee might be the same in the two plans.\n\nSample Input 3\n\n6 18 100\n\nSample Output 3\n\n100", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 88, "memory_kb": 74576}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s759878810", "group_id": "codeNet:p03502", "input_text": "def main():\n N = input()\n print('YNeos'[not int(N) % sum(int(n) for n in N) == 0::2])\n\n\nmain()\n", "language": "Python", "metadata": {"date": 1558575932, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03502.html", "problem_id": "p03502", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03502/input.txt", "sample_output_relpath": "derived/input_output/data/p03502/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03502/Python/s759878810.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s759878810", "user_id": "u360116509"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "def main():\n N = input()\n print('YNeos'[not int(N) % sum(int(n) for n in N) == 0::2])\n\n\nmain()\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nAn integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10.\n\nGiven an integer N, determine whether it is a Harshad number.\n\nConstraints\n\n1?N?10^8\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint Yes if N is a Harshad number; print No otherwise.\n\nSample Input 1\n\n12\n\nSample Output 1\n\nYes\n\nf(12)=1+2=3. Since 12 is divisible by 3, 12 is a Harshad number.\n\nSample Input 2\n\n57\n\nSample Output 2\n\nNo\n\nf(57)=5+7=12. Since 57 is not divisible by 12, 12 is not a Harshad number.\n\nSample Input 3\n\n148\n\nSample Output 3\n\nNo", "sample_input": "12\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03502", "source_text": "Score : 200 points\n\nProblem Statement\n\nAn integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10.\n\nGiven an integer N, determine whether it is a Harshad number.\n\nConstraints\n\n1?N?10^8\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint Yes if N is a Harshad number; print No otherwise.\n\nSample Input 1\n\n12\n\nSample Output 1\n\nYes\n\nf(12)=1+2=3. Since 12 is divisible by 3, 12 is a Harshad number.\n\nSample Input 2\n\n57\n\nSample Output 2\n\nNo\n\nf(57)=5+7=12. Since 57 is not divisible by 12, 12 is not a Harshad number.\n\nSample Input 3\n\n148\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 101, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s442104155", "group_id": "codeNet:p03503", "input_text": "import itertools\nN = int(input())\nF = []\nfor i in range(N):\n F_next = input().split()\n F_next = [int(i) for i in F_next]\n F.append(F_next)\nP = []\nfor i in range(N):\n P_next = input().split()\n P_next = [int(i) for i in P_next]\n P.append(P_next)\n\n#営業する時間を入力してそれぞれのお店との被る日数を出力\ndef count_number(shop):\n count = [0]*N\n for i in range(N):\n for j in range(10):\n if(shop[j]==1 and F[i][j]==1):\n count[i] = count[i]+1\n return (count)\n#お店と被る日数を入力して利益を出力\ndef benefit(count):\n #一日も店を開かない日があってはダメなので利益を最小にしておく\n if(sum(count)==0):\n return(-100000000)\n bene_sum = 0\n for i in range(N):\n bene_sum = bene_sum + P[i][count[i]]\n return(bene_sum)\n\nbene = []\nfor shop in itertools.product(range(2),repeat = 10):\n bene_next = benefit(count_number(shop))\n bene.append(bene_next)\nprint(max(bene))", "language": "Python", "metadata": {"date": 1551054192, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03503.html", "problem_id": "p03503", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03503/input.txt", "sample_output_relpath": "derived/input_output/data/p03503/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03503/Python/s442104155.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s442104155", "user_id": "u070449185"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "import itertools\nN = int(input())\nF = []\nfor i in range(N):\n F_next = input().split()\n F_next = [int(i) for i in F_next]\n F.append(F_next)\nP = []\nfor i in range(N):\n P_next = input().split()\n P_next = [int(i) for i in P_next]\n P.append(P_next)\n\n#営業する時間を入力してそれぞれのお店との被る日数を出力\ndef count_number(shop):\n count = [0]*N\n for i in range(N):\n for j in range(10):\n if(shop[j]==1 and F[i][j]==1):\n count[i] = count[i]+1\n return (count)\n#お店と被る日数を入力して利益を出力\ndef benefit(count):\n #一日も店を開かない日があってはダメなので利益を最小にしておく\n if(sum(count)==0):\n return(-100000000)\n bene_sum = 0\n for i in range(N):\n bene_sum = bene_sum + P[i][count[i]]\n return(bene_sum)\n\nbene = []\nfor shop in itertools.product(range(2),repeat = 10):\n bene_next = benefit(count_number(shop))\n bene.append(bene_next)\nprint(max(bene))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nJoisino is planning to open a shop in a shopping street.\n\nEach of the five weekdays is divided into two periods, the morning and the evening. For each of those ten periods, a shop must be either open during the whole period, or closed during the whole period. Naturally, a shop must be open during at least one of those periods.\n\nThere are already N stores in the street, numbered 1 through N.\n\nYou are given information of the business hours of those shops, F_{i,j,k}. If F_{i,j,k}=1, Shop i is open during Period k on Day j (this notation is explained below); if F_{i,j,k}=0, Shop i is closed during that period. Here, the days of the week are denoted as follows. Monday: Day 1, Tuesday: Day 2, Wednesday: Day 3, Thursday: Day 4, Friday: Day 5. Also, the morning is denoted as Period 1, and the afternoon is denoted as Period 2.\n\nLet c_i be the number of periods during which both Shop i and Joisino's shop are open. Then, the profit of Joisino's shop will be P_{1,c_1}+P_{2,c_2}+...+P_{N,c_N}.\n\nFind the maximum possible profit of Joisino's shop when she decides whether her shop is open during each period, making sure that it is open during at least one period.\n\nConstraints\n\n1≤N≤100\n\n0≤F_{i,j,k}≤1\n\nFor every integer i such that 1≤i≤N, there exists at least one pair (j,k) such that F_{i,j,k}=1.\n\n-10^7≤P_{i,j}≤10^7\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nF_{1,1,1} F_{1,1,2} ... F_{1,5,1} F_{1,5,2}\n:\nF_{N,1,1} F_{N,1,2} ... F_{N,5,1} F_{N,5,2}\nP_{1,0} ... P_{1,10}\n:\nP_{N,0} ... P_{N,10}\n\nOutput\n\nPrint the maximum possible profit of Joisino's shop.\n\nSample Input 1\n\n1\n1 1 0 1 0 0 0 1 0 1\n3 4 5 6 7 8 9 -2 -3 4 -2\n\nSample Output 1\n\n8\n\nIf her shop is open only during the periods when Shop 1 is opened, the profit will be 8, which is the maximum possible profit.\n\nSample Input 2\n\n2\n1 1 1 1 1 0 0 0 0 0\n0 0 0 0 0 1 1 1 1 1\n0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1\n0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1\n\nSample Output 2\n\n-2\n\nNote that a shop must be open during at least one period, and the profit may be negative.\n\nSample Input 3\n\n3\n1 1 1 1 1 1 0 0 1 1\n0 1 0 1 1 1 1 0 1 0\n1 0 1 1 0 1 0 1 0 1\n-8 6 -2 -8 -8 4 8 7 -6 2 2\n-9 2 0 1 7 -5 0 -2 -6 5 5\n6 -6 7 -9 6 -5 8 0 -9 -7 -7\n\nSample Output 3\n\n23", "sample_input": "1\n1 1 0 1 0 0 0 1 0 1\n3 4 5 6 7 8 9 -2 -3 4 -2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03503", "source_text": "Score : 300 points\n\nProblem Statement\n\nJoisino is planning to open a shop in a shopping street.\n\nEach of the five weekdays is divided into two periods, the morning and the evening. For each of those ten periods, a shop must be either open during the whole period, or closed during the whole period. Naturally, a shop must be open during at least one of those periods.\n\nThere are already N stores in the street, numbered 1 through N.\n\nYou are given information of the business hours of those shops, F_{i,j,k}. If F_{i,j,k}=1, Shop i is open during Period k on Day j (this notation is explained below); if F_{i,j,k}=0, Shop i is closed during that period. Here, the days of the week are denoted as follows. Monday: Day 1, Tuesday: Day 2, Wednesday: Day 3, Thursday: Day 4, Friday: Day 5. Also, the morning is denoted as Period 1, and the afternoon is denoted as Period 2.\n\nLet c_i be the number of periods during which both Shop i and Joisino's shop are open. Then, the profit of Joisino's shop will be P_{1,c_1}+P_{2,c_2}+...+P_{N,c_N}.\n\nFind the maximum possible profit of Joisino's shop when she decides whether her shop is open during each period, making sure that it is open during at least one period.\n\nConstraints\n\n1≤N≤100\n\n0≤F_{i,j,k}≤1\n\nFor every integer i such that 1≤i≤N, there exists at least one pair (j,k) such that F_{i,j,k}=1.\n\n-10^7≤P_{i,j}≤10^7\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nF_{1,1,1} F_{1,1,2} ... F_{1,5,1} F_{1,5,2}\n:\nF_{N,1,1} F_{N,1,2} ... F_{N,5,1} F_{N,5,2}\nP_{1,0} ... P_{1,10}\n:\nP_{N,0} ... P_{N,10}\n\nOutput\n\nPrint the maximum possible profit of Joisino's shop.\n\nSample Input 1\n\n1\n1 1 0 1 0 0 0 1 0 1\n3 4 5 6 7 8 9 -2 -3 4 -2\n\nSample Output 1\n\n8\n\nIf her shop is open only during the periods when Shop 1 is opened, the profit will be 8, which is the maximum possible profit.\n\nSample Input 2\n\n2\n1 1 1 1 1 0 0 0 0 0\n0 0 0 0 0 1 1 1 1 1\n0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1\n0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1\n\nSample Output 2\n\n-2\n\nNote that a shop must be open during at least one period, and the profit may be negative.\n\nSample Input 3\n\n3\n1 1 1 1 1 1 0 0 1 1\n0 1 0 1 1 1 1 0 1 0\n1 0 1 1 0 1 0 1 0 1\n-8 6 -2 -8 -8 4 8 7 -6 2 2\n-9 2 0 1 7 -5 0 -2 -6 5 5\n6 -6 7 -9 6 -5 8 0 -9 -7 -7\n\nSample Output 3\n\n23", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1015, "cpu_time_ms": 173, "memory_kb": 3188}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s894252570", "group_id": "codeNet:p03504", "input_text": "n,c=list(map(int,input().split()))\ns=[0 for i in range(n)]\nt=[0 for i in range(n)]\nc=[0 for i in range(n)]\n\nfor i in range(n):\n s[i],t[i],c[i]=list(map(int,input().split()))\n s[i]=s[i]-0.5\n\nu=s+t\nu.sort()\n\ncnt=[0 for i in range(len(u)+1)]\n\nfor i in range(1,len(u)+1):\n cnt[i]=cnt[i-1]\n if isinstance(u[i-1],float):\n cnt[i]+=1\n else:\n cnt[i]-=1\n\nprint(max(cnt))\n", "language": "Python", "metadata": {"date": 1522521970, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03504.html", "problem_id": "p03504", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03504/input.txt", "sample_output_relpath": "derived/input_output/data/p03504/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03504/Python/s894252570.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s894252570", "user_id": "u299801457"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n,c=list(map(int,input().split()))\ns=[0 for i in range(n)]\nt=[0 for i in range(n)]\nc=[0 for i in range(n)]\n\nfor i in range(n):\n s[i],t[i],c[i]=list(map(int,input().split()))\n s[i]=s[i]-0.5\n\nu=s+t\nu.sort()\n\ncnt=[0 for i in range(len(u)+1)]\n\nfor i in range(1,len(u)+1):\n cnt[i]=cnt[i-1]\n if isinstance(u[i-1],float):\n cnt[i]+=1\n else:\n cnt[i]-=1\n\nprint(max(cnt))\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nJoisino is planning to record N TV programs with recorders.\n\nThe TV can receive C channels numbered 1 through C.\n\nThe i-th program that she wants to record will be broadcast from time s_i to time t_i (including time s_i but not t_i) on Channel c_i.\n\nHere, there will never be more than one program that are broadcast on the same channel at the same time.\n\nWhen the recorder is recording a channel from time S to time T (including time S but not T), it cannot record other channels from time S-0.5 to time T (including time S-0.5 but not T).\n\nFind the minimum number of recorders required to record the channels so that all the N programs are completely recorded.\n\nConstraints\n\n1≤N≤10^5\n\n1≤C≤30\n\n1≤s_i b: a,b = b,a\n p1,p2 = pos(a),pos(b)\n while p2[0] > p1[0]:\n p2 = parent(p2)\n while p1 != p2:\n p1,p2 = parent(p1),parent(p2)\n rank,idx = p1\n print(rank**N + idx + 1)", "language": "Python", "metadata": {"date": 1511884468, "filename_ext": "py", "original_language": "Python (2.7.6)", "problem_description_relpath": "problem_descriptions/p03506.html", "problem_id": "p03506", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03506/input.txt", "sample_output_relpath": "derived/input_output/data/p03506/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03506/Python/s386822639.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s386822639", "user_id": "u761320129"}, "prompt_components": {"gold_output": "2\n1\n3\n", "input_to_evaluate": "import bisect\nN,Q = map(int,raw_input().split())\nMAXN = 10**9\nborders = [1]\nwhile borders[-1] < MAXN:\n borders.append(borders[-1] + N**(len(borders) - 1))\n\ndef pos(a):\n rank = bisect.bisect_right(borders, a) - 1\n idx = a - borders[rank]\n return (rank,idx)\n\ndef parent(p):\n rank,idx = p\n return (rank-1, idx//N)\n\nfor i in range(Q):\n a,b = map(int,raw_input().split())\n if a > b: a,b = b,a\n p1,p2 = pos(a),pos(b)\n while p2[0] > p1[0]:\n p2 = parent(p2)\n while p1 != p2:\n p1,p2 = parent(p1),parent(p2)\n rank,idx = p1\n print(rank**N + idx + 1)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given an integer N. Consider an infinite N-ary tree as shown below:\n\nFigure: an infinite N-ary tree for the case N = 3\n\nAs shown in the figure, each vertex is indexed with a unique positive integer, and for every positive integer there is a vertex indexed with it. The root of the tree has the index 1. For the remaining vertices, vertices in the upper row have smaller indices than those in the lower row. Among the vertices in the same row, a vertex that is more to the left has a smaller index.\n\nRegarding this tree, process Q queries. The i-th query is as follows:\n\nFind the index of the lowest common ancestor (see Notes) of Vertex v_i and w_i.\n\nNotes\n\nIn a rooted tree, the lowest common ancestor (LCA) of Vertex v and w is the farthest vertex from the root that is an ancestor of both Vertex v and w. Here, a vertex is considered to be an ancestor of itself. For example, in the tree shown in Problem Statement, the LCA of Vertex 5 and 7 is Vertex 2, the LCA of Vertex 8 and 11 is Vertex 1, and the LCA of Vertex 3 and 9 is Vertex 3.\n\nConstraints\n\n1 ≤ N ≤ 10^9\n\n1 ≤ Q ≤ 10^5\n\n1 ≤ v_i < w_i ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nv_1 w_1\n:\nv_Q w_Q\n\nOutput\n\nPrint Q lines. The i-th line (1 ≤ i ≤ Q) must contain the index of the lowest common ancestor of Vertex v_i and w_i.\n\nSample Input 1\n\n3 3\n5 7\n8 11\n3 9\n\nSample Output 1\n\n2\n1\n3\n\nThe queries in this case correspond to the examples shown in Notes.\n\nSample Input 2\n\n100000 2\n1 2\n3 4\n\nSample Output 2\n\n1\n1", "sample_input": "3 3\n5 7\n8 11\n3 9\n"}, "reference_outputs": ["2\n1\n3\n"], "source_document_id": "p03506", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given an integer N. Consider an infinite N-ary tree as shown below:\n\nFigure: an infinite N-ary tree for the case N = 3\n\nAs shown in the figure, each vertex is indexed with a unique positive integer, and for every positive integer there is a vertex indexed with it. The root of the tree has the index 1. For the remaining vertices, vertices in the upper row have smaller indices than those in the lower row. Among the vertices in the same row, a vertex that is more to the left has a smaller index.\n\nRegarding this tree, process Q queries. The i-th query is as follows:\n\nFind the index of the lowest common ancestor (see Notes) of Vertex v_i and w_i.\n\nNotes\n\nIn a rooted tree, the lowest common ancestor (LCA) of Vertex v and w is the farthest vertex from the root that is an ancestor of both Vertex v and w. Here, a vertex is considered to be an ancestor of itself. For example, in the tree shown in Problem Statement, the LCA of Vertex 5 and 7 is Vertex 2, the LCA of Vertex 8 and 11 is Vertex 1, and the LCA of Vertex 3 and 9 is Vertex 3.\n\nConstraints\n\n1 ≤ N ≤ 10^9\n\n1 ≤ Q ≤ 10^5\n\n1 ≤ v_i < w_i ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nv_1 w_1\n:\nv_Q w_Q\n\nOutput\n\nPrint Q lines. The i-th line (1 ≤ i ≤ Q) must contain the index of the lowest common ancestor of Vertex v_i and w_i.\n\nSample Input 1\n\n3 3\n5 7\n8 11\n3 9\n\nSample Output 1\n\n2\n1\n3\n\nThe queries in this case correspond to the examples shown in Notes.\n\nSample Input 2\n\n100000 2\n1 2\n3 4\n\nSample Output 2\n\n1\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 557, "cpu_time_ms": 2110, "memory_kb": 115072}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s739603745", "group_id": "codeNet:p03524", "input_text": "from collections import Counter\nS = input()\ncounter = Counter(S)\nfor c in [\"a\", \"b\", \"c\"]:\n if c not in counter:\n counter[c] = 0\nif (max(counter.values()) - min(counter.values())) <= 1:\n print(\"YES\")\nelse:\n print(\"NO\")", "language": "Python", "metadata": {"date": 1569284212, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03524.html", "problem_id": "p03524", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03524/input.txt", "sample_output_relpath": "derived/input_output/data/p03524/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03524/Python/s739603745.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s739603745", "user_id": "u291766461"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "from collections import Counter\nS = input()\ncounter = Counter(S)\nfor c in [\"a\", \"b\", \"c\"]:\n if c not in counter:\n counter[c] = 0\nif (max(counter.values()) - min(counter.values())) <= 1:\n print(\"YES\")\nelse:\n print(\"NO\")", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke has a string S consisting of three kinds of letters: a, b and c.\n\nHe has a phobia for palindromes, and wants to permute the characters in S so that S will not contain a palindrome of length 2 or more as a substring. Determine whether this is possible.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of a, b and c.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf the objective is achievable, print YES; if it is unachievable, print NO.\n\nSample Input 1\n\nabac\n\nSample Output 1\n\nYES\n\nAs it stands now, S contains a palindrome aba, but we can permute the characters to get acba, for example, that does not contain a palindrome of length 2 or more.\n\nSample Input 2\n\naba\n\nSample Output 2\n\nNO\n\nSample Input 3\n\nbabacccabab\n\nSample Output 3\n\nYES", "sample_input": "abac\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03524", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke has a string S consisting of three kinds of letters: a, b and c.\n\nHe has a phobia for palindromes, and wants to permute the characters in S so that S will not contain a palindrome of length 2 or more as a substring. Determine whether this is possible.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of a, b and c.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf the objective is achievable, print YES; if it is unachievable, print NO.\n\nSample Input 1\n\nabac\n\nSample Output 1\n\nYES\n\nAs it stands now, S contains a palindrome aba, but we can permute the characters to get acba, for example, that does not contain a palindrome of length 2 or more.\n\nSample Input 2\n\naba\n\nSample Output 2\n\nNO\n\nSample Input 3\n\nbabacccabab\n\nSample Output 3\n\nYES", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 234, "cpu_time_ms": 26, "memory_kb": 3444}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s617787235", "group_id": "codeNet:p03543", "input_text": "N = input()\nif N[0] ==N[1] and N[1]==N[2]:\n print(\"Yes\")\nelif N[1] ==N[2] and N[2]==N[3]:\n print(\"Yes\")\nelse:\n print(\"No\")", "language": "Python", "metadata": {"date": 1597895605, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p03543.html", "problem_id": "p03543", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03543/input.txt", "sample_output_relpath": "derived/input_output/data/p03543/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03543/Python/s617787235.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s617787235", "user_id": "u408071652"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "N = input()\nif N[0] ==N[1] and N[1]==N[2]:\n print(\"Yes\")\nelif N[1] ==N[2] and N[2]==N[3]:\n print(\"Yes\")\nelse:\n print(\"No\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe call a 4-digit integer with three or more consecutive same digits, such as 1118, good.\n\nYou are given a 4-digit integer N. Answer the question: Is N good?\n\nConstraints\n\n1000 ≤ N ≤ 9999\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N is good, print Yes; otherwise, print No.\n\nSample Input 1\n\n1118\n\nSample Output 1\n\nYes\n\nN is good, since it contains three consecutive 1.\n\nSample Input 2\n\n7777\n\nSample Output 2\n\nYes\n\nAn integer is also good when all the digits are the same.\n\nSample Input 3\n\n1234\n\nSample Output 3\n\nNo", "sample_input": "1118\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03543", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe call a 4-digit integer with three or more consecutive same digits, such as 1118, good.\n\nYou are given a 4-digit integer N. Answer the question: Is N good?\n\nConstraints\n\n1000 ≤ N ≤ 9999\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N is good, print Yes; otherwise, print No.\n\nSample Input 1\n\n1118\n\nSample Output 1\n\nYes\n\nN is good, since it contains three consecutive 1.\n\nSample Input 2\n\n7777\n\nSample Output 2\n\nYes\n\nAn integer is also good when all the digits are the same.\n\nSample Input 3\n\n1234\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 125, "cpu_time_ms": 62, "memory_kb": 61816}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s772140565", "group_id": "codeNet:p03543", "input_text": "def main():\n a, b, c, d = input()\n print('YNeos'[not (a == b == c or b == c == d)::2])\n\n\nmain()\n", "language": "Python", "metadata": {"date": 1559267724, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03543.html", "problem_id": "p03543", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03543/input.txt", "sample_output_relpath": "derived/input_output/data/p03543/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03543/Python/s772140565.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s772140565", "user_id": "u360116509"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "def main():\n a, b, c, d = input()\n print('YNeos'[not (a == b == c or b == c == d)::2])\n\n\nmain()\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe call a 4-digit integer with three or more consecutive same digits, such as 1118, good.\n\nYou are given a 4-digit integer N. Answer the question: Is N good?\n\nConstraints\n\n1000 ≤ N ≤ 9999\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N is good, print Yes; otherwise, print No.\n\nSample Input 1\n\n1118\n\nSample Output 1\n\nYes\n\nN is good, since it contains three consecutive 1.\n\nSample Input 2\n\n7777\n\nSample Output 2\n\nYes\n\nAn integer is also good when all the digits are the same.\n\nSample Input 3\n\n1234\n\nSample Output 3\n\nNo", "sample_input": "1118\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03543", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe call a 4-digit integer with three or more consecutive same digits, such as 1118, good.\n\nYou are given a 4-digit integer N. Answer the question: Is N good?\n\nConstraints\n\n1000 ≤ N ≤ 9999\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N is good, print Yes; otherwise, print No.\n\nSample Input 1\n\n1118\n\nSample Output 1\n\nYes\n\nN is good, since it contains three consecutive 1.\n\nSample Input 2\n\n7777\n\nSample Output 2\n\nYes\n\nAn integer is also good when all the digits are the same.\n\nSample Input 3\n\n1234\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 102, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s063068246", "group_id": "codeNet:p03543", "input_text": "n=int(input())\nflag=0\nfor i in range(1,10):\n for j in range(1,10):\n if n == i*1000+i*100+i*10+j or n == j*1000+j*100+j*10+i:\n flag = 1\nif flag or n%1000==0:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "language": "Python", "metadata": {"date": 1552595053, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03543.html", "problem_id": "p03543", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03543/input.txt", "sample_output_relpath": "derived/input_output/data/p03543/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03543/Python/s063068246.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s063068246", "user_id": "u393512980"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "n=int(input())\nflag=0\nfor i in range(1,10):\n for j in range(1,10):\n if n == i*1000+i*100+i*10+j or n == j*1000+j*100+j*10+i:\n flag = 1\nif flag or n%1000==0:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe call a 4-digit integer with three or more consecutive same digits, such as 1118, good.\n\nYou are given a 4-digit integer N. Answer the question: Is N good?\n\nConstraints\n\n1000 ≤ N ≤ 9999\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N is good, print Yes; otherwise, print No.\n\nSample Input 1\n\n1118\n\nSample Output 1\n\nYes\n\nN is good, since it contains three consecutive 1.\n\nSample Input 2\n\n7777\n\nSample Output 2\n\nYes\n\nAn integer is also good when all the digits are the same.\n\nSample Input 3\n\n1234\n\nSample Output 3\n\nNo", "sample_input": "1118\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03543", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe call a 4-digit integer with three or more consecutive same digits, such as 1118, good.\n\nYou are given a 4-digit integer N. Answer the question: Is N good?\n\nConstraints\n\n1000 ≤ N ≤ 9999\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N is good, print Yes; otherwise, print No.\n\nSample Input 1\n\n1118\n\nSample Output 1\n\nYes\n\nN is good, since it contains three consecutive 1.\n\nSample Input 2\n\n7777\n\nSample Output 2\n\nYes\n\nAn integer is also good when all the digits are the same.\n\nSample Input 3\n\n1234\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 201, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s033130808", "group_id": "codeNet:p03544", "input_text": "if __name__ == '__main__':\n\n n = int(input())\n\n A = [2,1]\n if n == 1:\n print(A[1])\n else:\n for i in range(2,n+1):\n A.append(A[i-2] + A[i-1])\n print(A[n])", "language": "Python", "metadata": {"date": 1598935252, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03544.html", "problem_id": "p03544", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03544/input.txt", "sample_output_relpath": "derived/input_output/data/p03544/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03544/Python/s033130808.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s033130808", "user_id": "u517797706"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "if __name__ == '__main__':\n\n n = int(input())\n\n A = [2,1]\n if n == 1:\n print(A[1])\n else:\n for i in range(2,n+1):\n A.append(A[i-2] + A[i-1])\n print(A[n])", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIt is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers.\n\nYou are given an integer N. Find the N-th Lucas number.\n\nHere, the i-th Lucas number L_i is defined as follows:\n\nL_0=2\n\nL_1=1\n\nL_i=L_{i-1}+L_{i-2} (i≥2)\n\nConstraints\n\n1≤N≤86\n\nIt is guaranteed that the answer is less than 10^{18}.\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the N-th Lucas number.\n\nSample Input 1\n\n5\n\nSample Output 1\n\n11\n\nL_0=2\n\nL_1=1\n\nL_2=L_0+L_1=3\n\nL_3=L_1+L_2=4\n\nL_4=L_2+L_3=7\n\nL_5=L_3+L_4=11\n\nThus, the 5-th Lucas number is 11.\n\nSample Input 2\n\n86\n\nSample Output 2\n\n939587134549734843", "sample_input": "5\n"}, "reference_outputs": ["11\n"], "source_document_id": "p03544", "source_text": "Score : 200 points\n\nProblem Statement\n\nIt is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers.\n\nYou are given an integer N. Find the N-th Lucas number.\n\nHere, the i-th Lucas number L_i is defined as follows:\n\nL_0=2\n\nL_1=1\n\nL_i=L_{i-1}+L_{i-2} (i≥2)\n\nConstraints\n\n1≤N≤86\n\nIt is guaranteed that the answer is less than 10^{18}.\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the N-th Lucas number.\n\nSample Input 1\n\n5\n\nSample Output 1\n\n11\n\nL_0=2\n\nL_1=1\n\nL_2=L_0+L_1=3\n\nL_3=L_1+L_2=4\n\nL_4=L_2+L_3=7\n\nL_5=L_3+L_4=11\n\nThus, the 5-th Lucas number is 11.\n\nSample Input 2\n\n86\n\nSample Output 2\n\n939587134549734843", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 193, "cpu_time_ms": 29, "memory_kb": 9180}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s226222992", "group_id": "codeNet:p03545", "input_text": "def inputs(num_of_input):\n ins = [input() for i in range(num_of_input)]\n return ins\n\n\ndef solve(inputs):\n nums = list(map(lambda x: int(x), inputs[0]))\n OPS = [\"+\", \"-\"]\n for temp_op1 in OPS:\n for temp_op2 in OPS:\n for temp_op3 in OPS:\n sum = nums[0]\n if temp_op1 == \"+\":\n sum += nums[1]\n else:\n sum -= nums[1]\n\n if temp_op2 == \"+\":\n sum += nums[2]\n else:\n sum -= nums[2]\n\n if temp_op3 == \"+\":\n sum += nums[3]\n else:\n sum -= nums[3]\n\n if sum == 7:\n return \"%d%s%d%s%d%s%d=7\" % (\n nums[0],\n temp_op1,\n nums[1],\n temp_op2,\n nums[2],\n temp_op3,\n nums[3],\n )\n return \"\"\n\n\nif __name__ == \"__main__\":\n ret = solve(inputs(1))\n print(ret)\n", "language": "Python", "metadata": {"date": 1560015701, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03545.html", "problem_id": "p03545", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03545/input.txt", "sample_output_relpath": "derived/input_output/data/p03545/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03545/Python/s226222992.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s226222992", "user_id": "u672494157"}, "prompt_components": {"gold_output": "1+2+2+2=7\n", "input_to_evaluate": "def inputs(num_of_input):\n ins = [input() for i in range(num_of_input)]\n return ins\n\n\ndef solve(inputs):\n nums = list(map(lambda x: int(x), inputs[0]))\n OPS = [\"+\", \"-\"]\n for temp_op1 in OPS:\n for temp_op2 in OPS:\n for temp_op3 in OPS:\n sum = nums[0]\n if temp_op1 == \"+\":\n sum += nums[1]\n else:\n sum -= nums[1]\n\n if temp_op2 == \"+\":\n sum += nums[2]\n else:\n sum -= nums[2]\n\n if temp_op3 == \"+\":\n sum += nums[3]\n else:\n sum -= nums[3]\n\n if sum == 7:\n return \"%d%s%d%s%d%s%d=7\" % (\n nums[0],\n temp_op1,\n nums[1],\n temp_op2,\n nums[2],\n temp_op3,\n nums[3],\n )\n return \"\"\n\n\nif __name__ == \"__main__\":\n ret = solve(inputs(1))\n print(ret)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSitting in a station waiting room, Joisino is gazing at her train ticket.\n\nThe ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).\n\nIn the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with + or - so that the formula holds.\n\nThe given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.\n\nConstraints\n\n0≤A,B,C,D≤9\n\nAll input values are integers.\n\nIt is guaranteed that there is a solution.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nABCD\n\nOutput\n\nPrint the formula you made, including the part =7.\n\nUse the signs + and -.\n\nDo not print a space between a digit and a sign.\n\nSample Input 1\n\n1222\n\nSample Output 1\n\n1+2+2+2=7\n\nThis is the only valid solution.\n\nSample Input 2\n\n0290\n\nSample Output 2\n\n0-2+9+0=7\n\n0 - 2 + 9 - 0 = 7 is also a valid solution.\n\nSample Input 3\n\n3242\n\nSample Output 3\n\n3+2+4-2=7", "sample_input": "1222\n"}, "reference_outputs": ["1+2+2+2=7\n"], "source_document_id": "p03545", "source_text": "Score : 300 points\n\nProblem Statement\n\nSitting in a station waiting room, Joisino is gazing at her train ticket.\n\nThe ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).\n\nIn the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with + or - so that the formula holds.\n\nThe given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.\n\nConstraints\n\n0≤A,B,C,D≤9\n\nAll input values are integers.\n\nIt is guaranteed that there is a solution.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nABCD\n\nOutput\n\nPrint the formula you made, including the part =7.\n\nUse the signs + and -.\n\nDo not print a space between a digit and a sign.\n\nSample Input 1\n\n1222\n\nSample Output 1\n\n1+2+2+2=7\n\nThis is the only valid solution.\n\nSample Input 2\n\n0290\n\nSample Output 2\n\n0-2+9+0=7\n\n0 - 2 + 9 - 0 = 7 is also a valid solution.\n\nSample Input 3\n\n3242\n\nSample Output 3\n\n3+2+4-2=7", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1106, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s321821054", "group_id": "codeNet:p03546", "input_text": "def warshall_floyd():\n '''\n すべての頂点間の最短距離を求める\n '''\n for k in range(10):\n for i in range(10):\n for j in range(10):\n c[i][j] = min(c[i][j], c[i][k] + c[k][j])\n\n\nh, w = map(int, input().split())\nc = [list(map(int, input().split())) for _ in range(10)]\na = [list(map(int, input().split())) for _ in range(h)]\n\nwarshall_floyd()\n\nres = 0\nfor i in range(h):\n for j in range(w):\n if a[i][j] >= 0:\n res += c[a[i][j]][1]\n\nprint(res)", "language": "Python", "metadata": {"date": 1594261428, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p03546.html", "problem_id": "p03546", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03546/input.txt", "sample_output_relpath": "derived/input_output/data/p03546/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03546/Python/s321821054.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s321821054", "user_id": "u653837719"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "def warshall_floyd():\n '''\n すべての頂点間の最短距離を求める\n '''\n for k in range(10):\n for i in range(10):\n for j in range(10):\n c[i][j] = min(c[i][j], c[i][k] + c[k][j])\n\n\nh, w = map(int, input().split())\nc = [list(map(int, input().split())) for _ in range(10)]\na = [list(map(int, input().split())) for _ in range(h)]\n\nwarshall_floyd()\n\nres = 0\nfor i in range(h):\n for j in range(w):\n if a[i][j] >= 0:\n res += c[a[i][j]][1]\n\nprint(res)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nJoisino the magical girl has decided to turn every single digit that exists on this world into 1.\n\nRewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points).\n\nShe is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and 9 (inclusive).\n\nYou are given A_{i,j} that describes the square at the i-th row from the top and j-th column from the left, as follows:\n\nIf A_{i,j}≠-1, the square contains a digit A_{i,j}.\n\nIf A_{i,j}=-1, the square does not contain a digit.\n\nFind the minimum total amount of MP required to turn every digit on this wall into 1 in the end.\n\nConstraints\n\n1≤H,W≤200\n\n1≤c_{i,j}≤10^3 (i≠j)\n\nc_{i,j}=0 (i=j)\n\n-1≤A_{i,j}≤9\n\nAll input values are integers.\n\nThere is at least one digit on the wall.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nc_{0,0} ... c_{0,9}\n:\nc_{9,0} ... c_{9,9}\nA_{1,1} ... A_{1,W}\n:\nA_{H,1} ... A_{H,W}\n\nOutput\n\nPrint the minimum total amount of MP required to turn every digit on the wall into 1 in the end.\n\nSample Input 1\n\n2 4\n0 9 9 9 9 9 9 9 9 9\n9 0 9 9 9 9 9 9 9 9\n9 9 0 9 9 9 9 9 9 9\n9 9 9 0 9 9 9 9 9 9\n9 9 9 9 0 9 9 9 9 2\n9 9 9 9 9 0 9 9 9 9\n9 9 9 9 9 9 0 9 9 9\n9 9 9 9 9 9 9 0 9 9\n9 9 9 9 2 9 9 9 0 9\n9 2 9 9 9 9 9 9 9 0\n-1 -1 -1 -1\n8 1 1 8\n\nSample Output 1\n\n12\n\nTo turn a single 8 into 1, it is optimal to first turn 8 into 4, then turn 4 into 9, and finally turn 9 into 1, costing 6 MP.\n\nThe wall contains two 8s, so the minimum total MP required is 6×2=12.\n\nSample Input 2\n\n5 5\n0 999 999 999 999 999 999 999 999 999\n999 0 999 999 999 999 999 999 999 999\n999 999 0 999 999 999 999 999 999 999\n999 999 999 0 999 999 999 999 999 999\n999 999 999 999 0 999 999 999 999 999\n999 999 999 999 999 0 999 999 999 999\n999 999 999 999 999 999 0 999 999 999\n999 999 999 999 999 999 999 0 999 999\n999 999 999 999 999 999 999 999 0 999\n999 999 999 999 999 999 999 999 999 0\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n\nSample Output 2\n\n0\n\nNote that she may not need to change any digit.\n\nSample Input 3\n\n3 5\n0 4 3 6 2 7 2 5 3 3\n4 0 5 3 7 5 3 7 2 7\n5 7 0 7 2 9 3 2 9 1\n3 6 2 0 2 4 6 4 2 3\n3 5 7 4 0 6 9 7 6 7\n9 8 5 2 2 0 4 7 6 5\n5 4 6 3 2 3 0 5 4 3\n3 6 2 3 4 2 4 0 8 9\n4 6 5 4 3 5 3 2 0 8\n2 1 3 4 5 7 8 6 4 0\n3 5 2 6 1\n2 5 3 2 1\n6 9 2 5 6\n\nSample Output 3\n\n47", "sample_input": "2 4\n0 9 9 9 9 9 9 9 9 9\n9 0 9 9 9 9 9 9 9 9\n9 9 0 9 9 9 9 9 9 9\n9 9 9 0 9 9 9 9 9 9\n9 9 9 9 0 9 9 9 9 2\n9 9 9 9 9 0 9 9 9 9\n9 9 9 9 9 9 0 9 9 9\n9 9 9 9 9 9 9 0 9 9\n9 9 9 9 2 9 9 9 0 9\n9 2 9 9 9 9 9 9 9 0\n-1 -1 -1 -1\n8 1 1 8\n"}, "reference_outputs": ["12\n"], "source_document_id": "p03546", "source_text": "Score : 400 points\n\nProblem Statement\n\nJoisino the magical girl has decided to turn every single digit that exists on this world into 1.\n\nRewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points).\n\nShe is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and 9 (inclusive).\n\nYou are given A_{i,j} that describes the square at the i-th row from the top and j-th column from the left, as follows:\n\nIf A_{i,j}≠-1, the square contains a digit A_{i,j}.\n\nIf A_{i,j}=-1, the square does not contain a digit.\n\nFind the minimum total amount of MP required to turn every digit on this wall into 1 in the end.\n\nConstraints\n\n1≤H,W≤200\n\n1≤c_{i,j}≤10^3 (i≠j)\n\nc_{i,j}=0 (i=j)\n\n-1≤A_{i,j}≤9\n\nAll input values are integers.\n\nThere is at least one digit on the wall.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nc_{0,0} ... c_{0,9}\n:\nc_{9,0} ... c_{9,9}\nA_{1,1} ... A_{1,W}\n:\nA_{H,1} ... A_{H,W}\n\nOutput\n\nPrint the minimum total amount of MP required to turn every digit on the wall into 1 in the end.\n\nSample Input 1\n\n2 4\n0 9 9 9 9 9 9 9 9 9\n9 0 9 9 9 9 9 9 9 9\n9 9 0 9 9 9 9 9 9 9\n9 9 9 0 9 9 9 9 9 9\n9 9 9 9 0 9 9 9 9 2\n9 9 9 9 9 0 9 9 9 9\n9 9 9 9 9 9 0 9 9 9\n9 9 9 9 9 9 9 0 9 9\n9 9 9 9 2 9 9 9 0 9\n9 2 9 9 9 9 9 9 9 0\n-1 -1 -1 -1\n8 1 1 8\n\nSample Output 1\n\n12\n\nTo turn a single 8 into 1, it is optimal to first turn 8 into 4, then turn 4 into 9, and finally turn 9 into 1, costing 6 MP.\n\nThe wall contains two 8s, so the minimum total MP required is 6×2=12.\n\nSample Input 2\n\n5 5\n0 999 999 999 999 999 999 999 999 999\n999 0 999 999 999 999 999 999 999 999\n999 999 0 999 999 999 999 999 999 999\n999 999 999 0 999 999 999 999 999 999\n999 999 999 999 0 999 999 999 999 999\n999 999 999 999 999 0 999 999 999 999\n999 999 999 999 999 999 0 999 999 999\n999 999 999 999 999 999 999 0 999 999\n999 999 999 999 999 999 999 999 0 999\n999 999 999 999 999 999 999 999 999 0\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n\nSample Output 2\n\n0\n\nNote that she may not need to change any digit.\n\nSample Input 3\n\n3 5\n0 4 3 6 2 7 2 5 3 3\n4 0 5 3 7 5 3 7 2 7\n5 7 0 7 2 9 3 2 9 1\n3 6 2 0 2 4 6 4 2 3\n3 5 7 4 0 6 9 7 6 7\n9 8 5 2 2 0 4 7 6 5\n5 4 6 3 2 3 0 5 4 3\n3 6 2 3 4 2 4 0 8 9\n4 6 5 4 3 5 3 2 0 8\n2 1 3 4 5 7 8 6 4 0\n3 5 2 6 1\n2 5 3 2 1\n6 9 2 5 6\n\nSample Output 3\n\n47", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 519, "cpu_time_ms": 80, "memory_kb": 73916}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s536874149", "group_id": "codeNet:p03546", "input_text": "import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\ndef input(): return sys.stdin.readline().strip()\ndef STR(): return input()\ndef INT(): return int(input())\ndef FLOAT(): return float(input())\ndef MAP(): return map(int, input().split())\ndef S_MAP(): return map(str, input().split())\ndef LIST(): return list(map(int, input().split()))\ndef S_LIST(): return list(map(str, input().split()))\ndef lcm(a, b): return a * b // gcd(a, b)\nsys.setrecursionlimit(10 ** 9)\ninf = sys.maxsize\nmod = 10 ** 9 + 7\ndx = [0, 0, 1, -1, 1, -1, -1, 1]\ndy = [1, -1, 0, 0, 1, -1, 1, -1]\n\ndef func(num, goto, ignore):\n if num == goto:\n return 0\n mn = inf\n retnum = 0\n for j in range(10):\n if j == num or j in ignore:\n continue\n if c[num][j] < mn:\n mn = c[num][j]\n retnum = j\n ignore.append(num)\n res = func(retnum, goto, ignore) + mn\n return res\n\nh, w = MAP()\nc = [LIST() for _ in range(10)]\na = [LIST() for _ in range(h)]\nfor i in range(10):\n for j in range(10):\n c[i][j] = min(c[i][j], func(i, j, []))\nans = 0\nfor i in range(h):\n for j in range(w):\n if a[i][j] == -1 or a[i][j] == 1:\n continue\n ans += c[a[i][j]][1]\nprint(ans)", "language": "Python", "metadata": {"date": 1585916204, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03546.html", "problem_id": "p03546", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03546/input.txt", "sample_output_relpath": "derived/input_output/data/p03546/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03546/Python/s536874149.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s536874149", "user_id": "u287500079"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\ndef input(): return sys.stdin.readline().strip()\ndef STR(): return input()\ndef INT(): return int(input())\ndef FLOAT(): return float(input())\ndef MAP(): return map(int, input().split())\ndef S_MAP(): return map(str, input().split())\ndef LIST(): return list(map(int, input().split()))\ndef S_LIST(): return list(map(str, input().split()))\ndef lcm(a, b): return a * b // gcd(a, b)\nsys.setrecursionlimit(10 ** 9)\ninf = sys.maxsize\nmod = 10 ** 9 + 7\ndx = [0, 0, 1, -1, 1, -1, -1, 1]\ndy = [1, -1, 0, 0, 1, -1, 1, -1]\n\ndef func(num, goto, ignore):\n if num == goto:\n return 0\n mn = inf\n retnum = 0\n for j in range(10):\n if j == num or j in ignore:\n continue\n if c[num][j] < mn:\n mn = c[num][j]\n retnum = j\n ignore.append(num)\n res = func(retnum, goto, ignore) + mn\n return res\n\nh, w = MAP()\nc = [LIST() for _ in range(10)]\na = [LIST() for _ in range(h)]\nfor i in range(10):\n for j in range(10):\n c[i][j] = min(c[i][j], func(i, j, []))\nans = 0\nfor i in range(h):\n for j in range(w):\n if a[i][j] == -1 or a[i][j] == 1:\n continue\n ans += c[a[i][j]][1]\nprint(ans)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nJoisino the magical girl has decided to turn every single digit that exists on this world into 1.\n\nRewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points).\n\nShe is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and 9 (inclusive).\n\nYou are given A_{i,j} that describes the square at the i-th row from the top and j-th column from the left, as follows:\n\nIf A_{i,j}≠-1, the square contains a digit A_{i,j}.\n\nIf A_{i,j}=-1, the square does not contain a digit.\n\nFind the minimum total amount of MP required to turn every digit on this wall into 1 in the end.\n\nConstraints\n\n1≤H,W≤200\n\n1≤c_{i,j}≤10^3 (i≠j)\n\nc_{i,j}=0 (i=j)\n\n-1≤A_{i,j}≤9\n\nAll input values are integers.\n\nThere is at least one digit on the wall.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nc_{0,0} ... c_{0,9}\n:\nc_{9,0} ... c_{9,9}\nA_{1,1} ... A_{1,W}\n:\nA_{H,1} ... A_{H,W}\n\nOutput\n\nPrint the minimum total amount of MP required to turn every digit on the wall into 1 in the end.\n\nSample Input 1\n\n2 4\n0 9 9 9 9 9 9 9 9 9\n9 0 9 9 9 9 9 9 9 9\n9 9 0 9 9 9 9 9 9 9\n9 9 9 0 9 9 9 9 9 9\n9 9 9 9 0 9 9 9 9 2\n9 9 9 9 9 0 9 9 9 9\n9 9 9 9 9 9 0 9 9 9\n9 9 9 9 9 9 9 0 9 9\n9 9 9 9 2 9 9 9 0 9\n9 2 9 9 9 9 9 9 9 0\n-1 -1 -1 -1\n8 1 1 8\n\nSample Output 1\n\n12\n\nTo turn a single 8 into 1, it is optimal to first turn 8 into 4, then turn 4 into 9, and finally turn 9 into 1, costing 6 MP.\n\nThe wall contains two 8s, so the minimum total MP required is 6×2=12.\n\nSample Input 2\n\n5 5\n0 999 999 999 999 999 999 999 999 999\n999 0 999 999 999 999 999 999 999 999\n999 999 0 999 999 999 999 999 999 999\n999 999 999 0 999 999 999 999 999 999\n999 999 999 999 0 999 999 999 999 999\n999 999 999 999 999 0 999 999 999 999\n999 999 999 999 999 999 0 999 999 999\n999 999 999 999 999 999 999 0 999 999\n999 999 999 999 999 999 999 999 0 999\n999 999 999 999 999 999 999 999 999 0\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n\nSample Output 2\n\n0\n\nNote that she may not need to change any digit.\n\nSample Input 3\n\n3 5\n0 4 3 6 2 7 2 5 3 3\n4 0 5 3 7 5 3 7 2 7\n5 7 0 7 2 9 3 2 9 1\n3 6 2 0 2 4 6 4 2 3\n3 5 7 4 0 6 9 7 6 7\n9 8 5 2 2 0 4 7 6 5\n5 4 6 3 2 3 0 5 4 3\n3 6 2 3 4 2 4 0 8 9\n4 6 5 4 3 5 3 2 0 8\n2 1 3 4 5 7 8 6 4 0\n3 5 2 6 1\n2 5 3 2 1\n6 9 2 5 6\n\nSample Output 3\n\n47", "sample_input": "2 4\n0 9 9 9 9 9 9 9 9 9\n9 0 9 9 9 9 9 9 9 9\n9 9 0 9 9 9 9 9 9 9\n9 9 9 0 9 9 9 9 9 9\n9 9 9 9 0 9 9 9 9 2\n9 9 9 9 9 0 9 9 9 9\n9 9 9 9 9 9 0 9 9 9\n9 9 9 9 9 9 9 0 9 9\n9 9 9 9 2 9 9 9 0 9\n9 2 9 9 9 9 9 9 9 0\n-1 -1 -1 -1\n8 1 1 8\n"}, "reference_outputs": ["12\n"], "source_document_id": "p03546", "source_text": "Score : 400 points\n\nProblem Statement\n\nJoisino the magical girl has decided to turn every single digit that exists on this world into 1.\n\nRewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points).\n\nShe is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and 9 (inclusive).\n\nYou are given A_{i,j} that describes the square at the i-th row from the top and j-th column from the left, as follows:\n\nIf A_{i,j}≠-1, the square contains a digit A_{i,j}.\n\nIf A_{i,j}=-1, the square does not contain a digit.\n\nFind the minimum total amount of MP required to turn every digit on this wall into 1 in the end.\n\nConstraints\n\n1≤H,W≤200\n\n1≤c_{i,j}≤10^3 (i≠j)\n\nc_{i,j}=0 (i=j)\n\n-1≤A_{i,j}≤9\n\nAll input values are integers.\n\nThere is at least one digit on the wall.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nc_{0,0} ... c_{0,9}\n:\nc_{9,0} ... c_{9,9}\nA_{1,1} ... A_{1,W}\n:\nA_{H,1} ... A_{H,W}\n\nOutput\n\nPrint the minimum total amount of MP required to turn every digit on the wall into 1 in the end.\n\nSample Input 1\n\n2 4\n0 9 9 9 9 9 9 9 9 9\n9 0 9 9 9 9 9 9 9 9\n9 9 0 9 9 9 9 9 9 9\n9 9 9 0 9 9 9 9 9 9\n9 9 9 9 0 9 9 9 9 2\n9 9 9 9 9 0 9 9 9 9\n9 9 9 9 9 9 0 9 9 9\n9 9 9 9 9 9 9 0 9 9\n9 9 9 9 2 9 9 9 0 9\n9 2 9 9 9 9 9 9 9 0\n-1 -1 -1 -1\n8 1 1 8\n\nSample Output 1\n\n12\n\nTo turn a single 8 into 1, it is optimal to first turn 8 into 4, then turn 4 into 9, and finally turn 9 into 1, costing 6 MP.\n\nThe wall contains two 8s, so the minimum total MP required is 6×2=12.\n\nSample Input 2\n\n5 5\n0 999 999 999 999 999 999 999 999 999\n999 0 999 999 999 999 999 999 999 999\n999 999 0 999 999 999 999 999 999 999\n999 999 999 0 999 999 999 999 999 999\n999 999 999 999 0 999 999 999 999 999\n999 999 999 999 999 0 999 999 999 999\n999 999 999 999 999 999 0 999 999 999\n999 999 999 999 999 999 999 0 999 999\n999 999 999 999 999 999 999 999 0 999\n999 999 999 999 999 999 999 999 999 0\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n\nSample Output 2\n\n0\n\nNote that she may not need to change any digit.\n\nSample Input 3\n\n3 5\n0 4 3 6 2 7 2 5 3 3\n4 0 5 3 7 5 3 7 2 7\n5 7 0 7 2 9 3 2 9 1\n3 6 2 0 2 4 6 4 2 3\n3 5 7 4 0 6 9 7 6 7\n9 8 5 2 2 0 4 7 6 5\n5 4 6 3 2 3 0 5 4 3\n3 6 2 3 4 2 4 0 8 9\n4 6 5 4 3 5 3 2 0 8\n2 1 3 4 5 7 8 6 4 0\n3 5 2 6 1\n2 5 3 2 1\n6 9 2 5 6\n\nSample Output 3\n\n47", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1551, "cpu_time_ms": 353, "memory_kb": 65496}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s613332046", "group_id": "codeNet:p03546", "input_text": "h,w = map(int, input().split())\nc = [list(map(int, input().split())) for i in range(10)]\na = [list(map(int, input().split())) for x in range(h)]\n\nfor k in range(10):\n for i in range(10):\n for j in range(10):\n c[i][j] = min(c[i][j], c[i][k]+c[k][j])\n\nans = 0\n\nfor i in range(h):\n for j in range(w):\n if a[i][j] != 0 and a[i][j] != -1:\n ans += c[a[i][j]][1]\n\nprint(ans)", "language": "Python", "metadata": {"date": 1531680242, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03546.html", "problem_id": "p03546", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03546/input.txt", "sample_output_relpath": "derived/input_output/data/p03546/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03546/Python/s613332046.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s613332046", "user_id": "u190405389"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "h,w = map(int, input().split())\nc = [list(map(int, input().split())) for i in range(10)]\na = [list(map(int, input().split())) for x in range(h)]\n\nfor k in range(10):\n for i in range(10):\n for j in range(10):\n c[i][j] = min(c[i][j], c[i][k]+c[k][j])\n\nans = 0\n\nfor i in range(h):\n for j in range(w):\n if a[i][j] != 0 and a[i][j] != -1:\n ans += c[a[i][j]][1]\n\nprint(ans)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nJoisino the magical girl has decided to turn every single digit that exists on this world into 1.\n\nRewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points).\n\nShe is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and 9 (inclusive).\n\nYou are given A_{i,j} that describes the square at the i-th row from the top and j-th column from the left, as follows:\n\nIf A_{i,j}≠-1, the square contains a digit A_{i,j}.\n\nIf A_{i,j}=-1, the square does not contain a digit.\n\nFind the minimum total amount of MP required to turn every digit on this wall into 1 in the end.\n\nConstraints\n\n1≤H,W≤200\n\n1≤c_{i,j}≤10^3 (i≠j)\n\nc_{i,j}=0 (i=j)\n\n-1≤A_{i,j}≤9\n\nAll input values are integers.\n\nThere is at least one digit on the wall.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nc_{0,0} ... c_{0,9}\n:\nc_{9,0} ... c_{9,9}\nA_{1,1} ... A_{1,W}\n:\nA_{H,1} ... A_{H,W}\n\nOutput\n\nPrint the minimum total amount of MP required to turn every digit on the wall into 1 in the end.\n\nSample Input 1\n\n2 4\n0 9 9 9 9 9 9 9 9 9\n9 0 9 9 9 9 9 9 9 9\n9 9 0 9 9 9 9 9 9 9\n9 9 9 0 9 9 9 9 9 9\n9 9 9 9 0 9 9 9 9 2\n9 9 9 9 9 0 9 9 9 9\n9 9 9 9 9 9 0 9 9 9\n9 9 9 9 9 9 9 0 9 9\n9 9 9 9 2 9 9 9 0 9\n9 2 9 9 9 9 9 9 9 0\n-1 -1 -1 -1\n8 1 1 8\n\nSample Output 1\n\n12\n\nTo turn a single 8 into 1, it is optimal to first turn 8 into 4, then turn 4 into 9, and finally turn 9 into 1, costing 6 MP.\n\nThe wall contains two 8s, so the minimum total MP required is 6×2=12.\n\nSample Input 2\n\n5 5\n0 999 999 999 999 999 999 999 999 999\n999 0 999 999 999 999 999 999 999 999\n999 999 0 999 999 999 999 999 999 999\n999 999 999 0 999 999 999 999 999 999\n999 999 999 999 0 999 999 999 999 999\n999 999 999 999 999 0 999 999 999 999\n999 999 999 999 999 999 0 999 999 999\n999 999 999 999 999 999 999 0 999 999\n999 999 999 999 999 999 999 999 0 999\n999 999 999 999 999 999 999 999 999 0\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n\nSample Output 2\n\n0\n\nNote that she may not need to change any digit.\n\nSample Input 3\n\n3 5\n0 4 3 6 2 7 2 5 3 3\n4 0 5 3 7 5 3 7 2 7\n5 7 0 7 2 9 3 2 9 1\n3 6 2 0 2 4 6 4 2 3\n3 5 7 4 0 6 9 7 6 7\n9 8 5 2 2 0 4 7 6 5\n5 4 6 3 2 3 0 5 4 3\n3 6 2 3 4 2 4 0 8 9\n4 6 5 4 3 5 3 2 0 8\n2 1 3 4 5 7 8 6 4 0\n3 5 2 6 1\n2 5 3 2 1\n6 9 2 5 6\n\nSample Output 3\n\n47", "sample_input": "2 4\n0 9 9 9 9 9 9 9 9 9\n9 0 9 9 9 9 9 9 9 9\n9 9 0 9 9 9 9 9 9 9\n9 9 9 0 9 9 9 9 9 9\n9 9 9 9 0 9 9 9 9 2\n9 9 9 9 9 0 9 9 9 9\n9 9 9 9 9 9 0 9 9 9\n9 9 9 9 9 9 9 0 9 9\n9 9 9 9 2 9 9 9 0 9\n9 2 9 9 9 9 9 9 9 0\n-1 -1 -1 -1\n8 1 1 8\n"}, "reference_outputs": ["12\n"], "source_document_id": "p03546", "source_text": "Score : 400 points\n\nProblem Statement\n\nJoisino the magical girl has decided to turn every single digit that exists on this world into 1.\n\nRewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points).\n\nShe is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and 9 (inclusive).\n\nYou are given A_{i,j} that describes the square at the i-th row from the top and j-th column from the left, as follows:\n\nIf A_{i,j}≠-1, the square contains a digit A_{i,j}.\n\nIf A_{i,j}=-1, the square does not contain a digit.\n\nFind the minimum total amount of MP required to turn every digit on this wall into 1 in the end.\n\nConstraints\n\n1≤H,W≤200\n\n1≤c_{i,j}≤10^3 (i≠j)\n\nc_{i,j}=0 (i=j)\n\n-1≤A_{i,j}≤9\n\nAll input values are integers.\n\nThere is at least one digit on the wall.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nc_{0,0} ... c_{0,9}\n:\nc_{9,0} ... c_{9,9}\nA_{1,1} ... A_{1,W}\n:\nA_{H,1} ... A_{H,W}\n\nOutput\n\nPrint the minimum total amount of MP required to turn every digit on the wall into 1 in the end.\n\nSample Input 1\n\n2 4\n0 9 9 9 9 9 9 9 9 9\n9 0 9 9 9 9 9 9 9 9\n9 9 0 9 9 9 9 9 9 9\n9 9 9 0 9 9 9 9 9 9\n9 9 9 9 0 9 9 9 9 2\n9 9 9 9 9 0 9 9 9 9\n9 9 9 9 9 9 0 9 9 9\n9 9 9 9 9 9 9 0 9 9\n9 9 9 9 2 9 9 9 0 9\n9 2 9 9 9 9 9 9 9 0\n-1 -1 -1 -1\n8 1 1 8\n\nSample Output 1\n\n12\n\nTo turn a single 8 into 1, it is optimal to first turn 8 into 4, then turn 4 into 9, and finally turn 9 into 1, costing 6 MP.\n\nThe wall contains two 8s, so the minimum total MP required is 6×2=12.\n\nSample Input 2\n\n5 5\n0 999 999 999 999 999 999 999 999 999\n999 0 999 999 999 999 999 999 999 999\n999 999 0 999 999 999 999 999 999 999\n999 999 999 0 999 999 999 999 999 999\n999 999 999 999 0 999 999 999 999 999\n999 999 999 999 999 0 999 999 999 999\n999 999 999 999 999 999 0 999 999 999\n999 999 999 999 999 999 999 0 999 999\n999 999 999 999 999 999 999 999 0 999\n999 999 999 999 999 999 999 999 999 0\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n\nSample Output 2\n\n0\n\nNote that she may not need to change any digit.\n\nSample Input 3\n\n3 5\n0 4 3 6 2 7 2 5 3 3\n4 0 5 3 7 5 3 7 2 7\n5 7 0 7 2 9 3 2 9 1\n3 6 2 0 2 4 6 4 2 3\n3 5 7 4 0 6 9 7 6 7\n9 8 5 2 2 0 4 7 6 5\n5 4 6 3 2 3 0 5 4 3\n3 6 2 3 4 2 4 0 8 9\n4 6 5 4 3 5 3 2 0 8\n2 1 3 4 5 7 8 6 4 0\n3 5 2 6 1\n2 5 3 2 1\n6 9 2 5 6\n\nSample Output 3\n\n47", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 409, "cpu_time_ms": 41, "memory_kb": 3444}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s389245038", "group_id": "codeNet:p03548", "input_text": "X,Y,Z=map(int,input().split())\nprint(X//(Y+Z))", "language": "Python", "metadata": {"date": 1595305579, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03548.html", "problem_id": "p03548", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03548/input.txt", "sample_output_relpath": "derived/input_output/data/p03548/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03548/Python/s389245038.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s389245038", "user_id": "u716660050"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "X,Y,Z=map(int,input().split())\nprint(X//(Y+Z))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a long seat of width X centimeters.\nThere are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters.\n\nWe would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two people, and between the end of the seat and a person.\n\nAt most how many people can sit on the seat?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq X, Y, Z \\leq 10^5\n\nY+2Z \\leq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n13 3 1\n\nSample Output 1\n\n3\n\nThere is just enough room for three, as shown below:\n\nFigure\n\nSample Input 2\n\n12 3 1\n\nSample Output 2\n\n2\n\nSample Input 3\n\n100000 1 1\n\nSample Output 3\n\n49999\n\nSample Input 4\n\n64146 123 456\n\nSample Output 4\n\n110\n\nSample Input 5\n\n64145 123 456\n\nSample Output 5\n\n109", "sample_input": "13 3 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03548", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a long seat of width X centimeters.\nThere are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters.\n\nWe would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two people, and between the end of the seat and a person.\n\nAt most how many people can sit on the seat?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq X, Y, Z \\leq 10^5\n\nY+2Z \\leq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n13 3 1\n\nSample Output 1\n\n3\n\nThere is just enough room for three, as shown below:\n\nFigure\n\nSample Input 2\n\n12 3 1\n\nSample Output 2\n\n2\n\nSample Input 3\n\n100000 1 1\n\nSample Output 3\n\n49999\n\nSample Input 4\n\n64146 123 456\n\nSample Output 4\n\n110\n\nSample Input 5\n\n64145 123 456\n\nSample Output 5\n\n109", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 46, "cpu_time_ms": 32, "memory_kb": 9148}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s488510011", "group_id": "codeNet:p03548", "input_text": "x, y, z = map(int, input().split())\nprint(int((x - z) / (y + z)))", "language": "Python", "metadata": {"date": 1578436519, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03548.html", "problem_id": "p03548", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03548/input.txt", "sample_output_relpath": "derived/input_output/data/p03548/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03548/Python/s488510011.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s488510011", "user_id": "u729535891"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "x, y, z = map(int, input().split())\nprint(int((x - z) / (y + z)))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a long seat of width X centimeters.\nThere are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters.\n\nWe would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two people, and between the end of the seat and a person.\n\nAt most how many people can sit on the seat?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq X, Y, Z \\leq 10^5\n\nY+2Z \\leq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n13 3 1\n\nSample Output 1\n\n3\n\nThere is just enough room for three, as shown below:\n\nFigure\n\nSample Input 2\n\n12 3 1\n\nSample Output 2\n\n2\n\nSample Input 3\n\n100000 1 1\n\nSample Output 3\n\n49999\n\nSample Input 4\n\n64146 123 456\n\nSample Output 4\n\n110\n\nSample Input 5\n\n64145 123 456\n\nSample Output 5\n\n109", "sample_input": "13 3 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03548", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a long seat of width X centimeters.\nThere are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters.\n\nWe would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two people, and between the end of the seat and a person.\n\nAt most how many people can sit on the seat?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq X, Y, Z \\leq 10^5\n\nY+2Z \\leq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n13 3 1\n\nSample Output 1\n\n3\n\nThere is just enough room for three, as shown below:\n\nFigure\n\nSample Input 2\n\n12 3 1\n\nSample Output 2\n\n2\n\nSample Input 3\n\n100000 1 1\n\nSample Output 3\n\n49999\n\nSample Input 4\n\n64146 123 456\n\nSample Output 4\n\n110\n\nSample Input 5\n\n64145 123 456\n\nSample Output 5\n\n109", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 65, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s030286438", "group_id": "codeNet:p03549", "input_text": "def MI(): return map(int, input().split())\ndef II(): return int(input())\ndef IS(): return input()\ndef LI(): return list(map(int, input().split()))\n\n\nn, m = MI()\np = (0.5) ** m\nt = 1900*m + 100*(n-m)\nprint(int(t//p))\n", "language": "Python", "metadata": {"date": 1556024059, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03549.html", "problem_id": "p03549", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03549/input.txt", "sample_output_relpath": "derived/input_output/data/p03549/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03549/Python/s030286438.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s030286438", "user_id": "u496744988"}, "prompt_components": {"gold_output": "3800\n", "input_to_evaluate": "def MI(): return map(int, input().split())\ndef II(): return int(input())\ndef IS(): return input()\ndef LI(): return list(map(int, input().split()))\n\n\nn, m = MI()\np = (0.5) ** m\nt = 1900*m + 100*(n-m)\nprint(int(t//p))\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is now competing in a programming contest, but he received TLE in a problem where the answer is YES or NO.\n\nWhen he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases.\n\nThen, he rewrote the code to correctly solve each of those M cases with 1/2 probability in 1900 milliseconds, and correctly solve each of the other N-M cases without fail in 100 milliseconds.\n\nNow, he goes through the following process:\n\nSubmit the code.\n\nWait until the code finishes execution on all the cases.\n\nIf the code fails to correctly solve some of the M cases, submit it again.\n\nRepeat until the code correctly solve all the cases in one submission.\n\nLet the expected value of the total execution time of the code be X milliseconds. Print X (as an integer).\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq {\\rm min}(N, 5)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint X, the expected value of the total execution time of the code, as an integer. It can be proved that, under the constraints in this problem, X is an integer not exceeding 10^9.\n\nSample Input 1\n\n1 1\n\nSample Output 1\n\n3800\n\nIn this input, there is only one case. Takahashi will repeatedly submit the code that correctly solves this case with 1/2 probability in 1900 milliseconds.\n\nThe code will succeed in one attempt with 1/2 probability, in two attempts with 1/4 probability, and in three attempts with 1/8 probability, and so on.\n\nThus, the answer is 1900 \\times 1/2 + (2 \\times 1900) \\times 1/4 + (3 \\times 1900) \\times 1/8 + ... = 3800.\n\nSample Input 2\n\n10 2\n\nSample Output 2\n\n18400\n\nThe code will take 1900 milliseconds in each of the 2 cases, and 100 milliseconds in each of the 10-2=8 cases. The probability of the code correctly solving all the cases is 1/2 \\times 1/2 = 1/4.\n\nSample Input 3\n\n100 5\n\nSample Output 3\n\n608000", "sample_input": "1 1\n"}, "reference_outputs": ["3800\n"], "source_document_id": "p03549", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is now competing in a programming contest, but he received TLE in a problem where the answer is YES or NO.\n\nWhen he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases.\n\nThen, he rewrote the code to correctly solve each of those M cases with 1/2 probability in 1900 milliseconds, and correctly solve each of the other N-M cases without fail in 100 milliseconds.\n\nNow, he goes through the following process:\n\nSubmit the code.\n\nWait until the code finishes execution on all the cases.\n\nIf the code fails to correctly solve some of the M cases, submit it again.\n\nRepeat until the code correctly solve all the cases in one submission.\n\nLet the expected value of the total execution time of the code be X milliseconds. Print X (as an integer).\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq {\\rm min}(N, 5)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint X, the expected value of the total execution time of the code, as an integer. It can be proved that, under the constraints in this problem, X is an integer not exceeding 10^9.\n\nSample Input 1\n\n1 1\n\nSample Output 1\n\n3800\n\nIn this input, there is only one case. Takahashi will repeatedly submit the code that correctly solves this case with 1/2 probability in 1900 milliseconds.\n\nThe code will succeed in one attempt with 1/2 probability, in two attempts with 1/4 probability, and in three attempts with 1/8 probability, and so on.\n\nThus, the answer is 1900 \\times 1/2 + (2 \\times 1900) \\times 1/4 + (3 \\times 1900) \\times 1/8 + ... = 3800.\n\nSample Input 2\n\n10 2\n\nSample Output 2\n\n18400\n\nThe code will take 1900 milliseconds in each of the 2 cases, and 100 milliseconds in each of the 10-2=8 cases. The probability of the code correctly solving all the cases is 1/2 \\times 1/2 = 1/4.\n\nSample Input 3\n\n100 5\n\nSample Output 3\n\n608000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 216, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s527657588", "group_id": "codeNet:p03549", "input_text": "n,m = map(int,input().split())\nprint((1900*m+100*(n-m))*2**m)", "language": "Python", "metadata": {"date": 1521049256, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03549.html", "problem_id": "p03549", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03549/input.txt", "sample_output_relpath": "derived/input_output/data/p03549/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03549/Python/s527657588.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s527657588", "user_id": "u779201862"}, "prompt_components": {"gold_output": "3800\n", "input_to_evaluate": "n,m = map(int,input().split())\nprint((1900*m+100*(n-m))*2**m)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is now competing in a programming contest, but he received TLE in a problem where the answer is YES or NO.\n\nWhen he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases.\n\nThen, he rewrote the code to correctly solve each of those M cases with 1/2 probability in 1900 milliseconds, and correctly solve each of the other N-M cases without fail in 100 milliseconds.\n\nNow, he goes through the following process:\n\nSubmit the code.\n\nWait until the code finishes execution on all the cases.\n\nIf the code fails to correctly solve some of the M cases, submit it again.\n\nRepeat until the code correctly solve all the cases in one submission.\n\nLet the expected value of the total execution time of the code be X milliseconds. Print X (as an integer).\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq {\\rm min}(N, 5)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint X, the expected value of the total execution time of the code, as an integer. It can be proved that, under the constraints in this problem, X is an integer not exceeding 10^9.\n\nSample Input 1\n\n1 1\n\nSample Output 1\n\n3800\n\nIn this input, there is only one case. Takahashi will repeatedly submit the code that correctly solves this case with 1/2 probability in 1900 milliseconds.\n\nThe code will succeed in one attempt with 1/2 probability, in two attempts with 1/4 probability, and in three attempts with 1/8 probability, and so on.\n\nThus, the answer is 1900 \\times 1/2 + (2 \\times 1900) \\times 1/4 + (3 \\times 1900) \\times 1/8 + ... = 3800.\n\nSample Input 2\n\n10 2\n\nSample Output 2\n\n18400\n\nThe code will take 1900 milliseconds in each of the 2 cases, and 100 milliseconds in each of the 10-2=8 cases. The probability of the code correctly solving all the cases is 1/2 \\times 1/2 = 1/4.\n\nSample Input 3\n\n100 5\n\nSample Output 3\n\n608000", "sample_input": "1 1\n"}, "reference_outputs": ["3800\n"], "source_document_id": "p03549", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is now competing in a programming contest, but he received TLE in a problem where the answer is YES or NO.\n\nWhen he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases.\n\nThen, he rewrote the code to correctly solve each of those M cases with 1/2 probability in 1900 milliseconds, and correctly solve each of the other N-M cases without fail in 100 milliseconds.\n\nNow, he goes through the following process:\n\nSubmit the code.\n\nWait until the code finishes execution on all the cases.\n\nIf the code fails to correctly solve some of the M cases, submit it again.\n\nRepeat until the code correctly solve all the cases in one submission.\n\nLet the expected value of the total execution time of the code be X milliseconds. Print X (as an integer).\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq {\\rm min}(N, 5)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint X, the expected value of the total execution time of the code, as an integer. It can be proved that, under the constraints in this problem, X is an integer not exceeding 10^9.\n\nSample Input 1\n\n1 1\n\nSample Output 1\n\n3800\n\nIn this input, there is only one case. Takahashi will repeatedly submit the code that correctly solves this case with 1/2 probability in 1900 milliseconds.\n\nThe code will succeed in one attempt with 1/2 probability, in two attempts with 1/4 probability, and in three attempts with 1/8 probability, and so on.\n\nThus, the answer is 1900 \\times 1/2 + (2 \\times 1900) \\times 1/4 + (3 \\times 1900) \\times 1/8 + ... = 3800.\n\nSample Input 2\n\n10 2\n\nSample Output 2\n\n18400\n\nThe code will take 1900 milliseconds in each of the 2 cases, and 100 milliseconds in each of the 10-2=8 cases. The probability of the code correctly solving all the cases is 1/2 \\times 1/2 = 1/4.\n\nSample Input 3\n\n100 5\n\nSample Output 3\n\n608000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 61, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s870701589", "group_id": "codeNet:p03551", "input_text": "#!python3\n\n# input\nN, M = list(map(int, input().split()))\n\n\ndef main():\n t = 1900 * M + 100 * (N - M)\n e = 2 ** M\n ans = t * e\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "language": "Python", "metadata": {"date": 1588299213, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03551.html", "problem_id": "p03551", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03551/input.txt", "sample_output_relpath": "derived/input_output/data/p03551/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03551/Python/s870701589.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s870701589", "user_id": "u671861352"}, "prompt_components": {"gold_output": "3800\n", "input_to_evaluate": "#!python3\n\n# input\nN, M = list(map(int, input().split()))\n\n\ndef main():\n t = 1900 * M + 100 * (N - M)\n e = 2 ** M\n ans = t * e\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is now competing in a programming contest, but he received TLE in a problem where the answer is YES or NO.\n\nWhen he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases.\n\nThen, he rewrote the code to correctly solve each of those M cases with 1/2 probability in 1900 milliseconds, and correctly solve each of the other N-M cases without fail in 100 milliseconds.\n\nNow, he goes through the following process:\n\nSubmit the code.\n\nWait until the code finishes execution on all the cases.\n\nIf the code fails to correctly solve some of the M cases, submit it again.\n\nRepeat until the code correctly solve all the cases in one submission.\n\nLet the expected value of the total execution time of the code be X milliseconds. Print X (as an integer).\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq {\\rm min}(N, 5)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint X, the expected value of the total execution time of the code, as an integer. It can be proved that, under the constraints in this problem, X is an integer not exceeding 10^9.\n\nSample Input 1\n\n1 1\n\nSample Output 1\n\n3800\n\nIn this input, there is only one case. Takahashi will repeatedly submit the code that correctly solves this case with 1/2 probability in 1900 milliseconds.\n\nThe code will succeed in one attempt with 1/2 probability, in two attempts with 1/4 probability, and in three attempts with 1/8 probability, and so on.\n\nThus, the answer is 1900 \\times 1/2 + (2 \\times 1900) \\times 1/4 + (3 \\times 1900) \\times 1/8 + ... = 3800.\n\nSample Input 2\n\n10 2\n\nSample Output 2\n\n18400\n\nThe code will take 1900 milliseconds in each of the 2 cases, and 100 milliseconds in each of the 10-2=8 cases. The probability of the code correctly solving all the cases is 1/2 \\times 1/2 = 1/4.\n\nSample Input 3\n\n100 5\n\nSample Output 3\n\n608000", "sample_input": "1 1\n"}, "reference_outputs": ["3800\n"], "source_document_id": "p03551", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is now competing in a programming contest, but he received TLE in a problem where the answer is YES or NO.\n\nWhen he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases.\n\nThen, he rewrote the code to correctly solve each of those M cases with 1/2 probability in 1900 milliseconds, and correctly solve each of the other N-M cases without fail in 100 milliseconds.\n\nNow, he goes through the following process:\n\nSubmit the code.\n\nWait until the code finishes execution on all the cases.\n\nIf the code fails to correctly solve some of the M cases, submit it again.\n\nRepeat until the code correctly solve all the cases in one submission.\n\nLet the expected value of the total execution time of the code be X milliseconds. Print X (as an integer).\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq {\\rm min}(N, 5)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint X, the expected value of the total execution time of the code, as an integer. It can be proved that, under the constraints in this problem, X is an integer not exceeding 10^9.\n\nSample Input 1\n\n1 1\n\nSample Output 1\n\n3800\n\nIn this input, there is only one case. Takahashi will repeatedly submit the code that correctly solves this case with 1/2 probability in 1900 milliseconds.\n\nThe code will succeed in one attempt with 1/2 probability, in two attempts with 1/4 probability, and in three attempts with 1/8 probability, and so on.\n\nThus, the answer is 1900 \\times 1/2 + (2 \\times 1900) \\times 1/4 + (3 \\times 1900) \\times 1/8 + ... = 3800.\n\nSample Input 2\n\n10 2\n\nSample Output 2\n\n18400\n\nThe code will take 1900 milliseconds in each of the 2 cases, and 100 milliseconds in each of the 10-2=8 cases. The probability of the code correctly solving all the cases is 1/2 \\times 1/2 = 1/4.\n\nSample Input 3\n\n100 5\n\nSample Output 3\n\n608000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 191, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s463109589", "group_id": "codeNet:p03556", "input_text": "import math\nprint(str(int(math.pow(int(math.sqrt(int(input()))),2))))", "language": "Python", "metadata": {"date": 1510243862, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03556.html", "problem_id": "p03556", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03556/input.txt", "sample_output_relpath": "derived/input_output/data/p03556/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03556/Python/s463109589.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s463109589", "user_id": "u837852400"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "import math\nprint(str(int(math.pow(int(math.sqrt(int(input()))),2))))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nFind the largest square number not exceeding N. Here, a square number is an integer that can be represented as the square of an integer.\n\nConstraints\n\n1 \\leq N \\leq 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the largest square number not exceeding N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\n10 is not square, but 9 = 3 × 3 is. Thus, we print 9.\n\nSample Input 2\n\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\n271828182\n\nSample Output 3\n\n271821169", "sample_input": "10\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03556", "source_text": "Score : 200 points\n\nProblem Statement\n\nFind the largest square number not exceeding N. Here, a square number is an integer that can be represented as the square of an integer.\n\nConstraints\n\n1 \\leq N \\leq 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the largest square number not exceeding N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\n10 is not square, but 9 = 3 × 3 is. Thus, we print 9.\n\nSample Input 2\n\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\n271828182\n\nSample Output 3\n\n271821169", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 69, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s534304862", "group_id": "codeNet:p03556", "input_text": "def solve():\n N = int(input())\n ans1 = 0\n n = 0\n while ans1 <= N:\n ans1 = n ** 2\n n += 1\n\n print((n - 2) ** 2)\n \n \nsolve()", "language": "Python", "metadata": {"date": 1509844431, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03556.html", "problem_id": "p03556", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03556/input.txt", "sample_output_relpath": "derived/input_output/data/p03556/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03556/Python/s534304862.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s534304862", "user_id": "u943004959"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "def solve():\n N = int(input())\n ans1 = 0\n n = 0\n while ans1 <= N:\n ans1 = n ** 2\n n += 1\n\n print((n - 2) ** 2)\n \n \nsolve()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nFind the largest square number not exceeding N. Here, a square number is an integer that can be represented as the square of an integer.\n\nConstraints\n\n1 \\leq N \\leq 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the largest square number not exceeding N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\n10 is not square, but 9 = 3 × 3 is. Thus, we print 9.\n\nSample Input 2\n\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\n271828182\n\nSample Output 3\n\n271821169", "sample_input": "10\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03556", "source_text": "Score : 200 points\n\nProblem Statement\n\nFind the largest square number not exceeding N. Here, a square number is an integer that can be represented as the square of an integer.\n\nConstraints\n\n1 \\leq N \\leq 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the largest square number not exceeding N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\n10 is not square, but 9 = 3 × 3 is. Thus, we print 9.\n\nSample Input 2\n\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\n271828182\n\nSample Output 3\n\n271821169", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 158, "cpu_time_ms": 26, "memory_kb": 3316}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s359224458", "group_id": "codeNet:p03557", "input_text": "import bisect\n\nN=int(input())\nA=[int(i) for i in input().split()]\nB=[int(i) for i in input().split()]\nC=[int(i) for i in input().split()]\nA.sort()\nB.sort()\nC.sort()\n# print(A)\n# print(B)\n# print(C)\n\n# ans=0\n# for i in range(N):\n# part1=A[i]\n# part2_pos=bisect.bisect_right(B,part1)\n# for j in range(part2_pos,N):\n# part2=B[j]\n# part3_pos=bisect.bisect_right(C,part2)\n# # print(i,j,part3_spos,\": \",A[i],B[j],C[part3_pos])\n# ans+=(N-part3_pos)\n# print(ans)\n\nAtoB_Pos=[]\nBtoC_Pos=[]\nans=0\nfor i in range(N):\n B_Pos=bisect.bisect_right(B,A[i])\n AtoB_Pos.append(B_Pos)\n\nfor i in range(N):\n C_Pos=bisect.bisect_right(C,B[i])\n BtoC_Pos.append(C_Pos)\n# print(AtoB_Pos)\n# print(BtoC_Pos)\nfor i in range(N):\n for j in range(AtoB_Pos[i],N):\n # print(i,j,\": \",A[i],B[j])\n # print(N-AtoB_Pos[i],N-BtoC_Pos[j])\n ans+=(N-BtoC_Pos[j])\nprint(ans)\n", "language": "Python", "metadata": {"date": 1584840434, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03557.html", "problem_id": "p03557", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03557/input.txt", "sample_output_relpath": "derived/input_output/data/p03557/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03557/Python/s359224458.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s359224458", "user_id": "u456806668"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import bisect\n\nN=int(input())\nA=[int(i) for i in input().split()]\nB=[int(i) for i in input().split()]\nC=[int(i) for i in input().split()]\nA.sort()\nB.sort()\nC.sort()\n# print(A)\n# print(B)\n# print(C)\n\n# ans=0\n# for i in range(N):\n# part1=A[i]\n# part2_pos=bisect.bisect_right(B,part1)\n# for j in range(part2_pos,N):\n# part2=B[j]\n# part3_pos=bisect.bisect_right(C,part2)\n# # print(i,j,part3_spos,\": \",A[i],B[j],C[part3_pos])\n# ans+=(N-part3_pos)\n# print(ans)\n\nAtoB_Pos=[]\nBtoC_Pos=[]\nans=0\nfor i in range(N):\n B_Pos=bisect.bisect_right(B,A[i])\n AtoB_Pos.append(B_Pos)\n\nfor i in range(N):\n C_Pos=bisect.bisect_right(C,B[i])\n BtoC_Pos.append(C_Pos)\n# print(AtoB_Pos)\n# print(BtoC_Pos)\nfor i in range(N):\n for j in range(AtoB_Pos[i],N):\n # print(i,j,\": \",A[i],B[j])\n # print(N-AtoB_Pos[i],N-BtoC_Pos[j])\n ans+=(N-BtoC_Pos[j])\nprint(ans)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower.\n\nHe has N parts for each of the three categories. The size of the i-th upper part is A_i, the size of the i-th middle part is B_i, and the size of the i-th lower part is C_i.\n\nTo build an altar, the size of the middle part must be strictly greater than that of the upper part, and the size of the lower part must be strictly greater than that of the middle part. On the other hand, any three parts that satisfy these conditions can be combined to form an altar.\n\nHow many different altars can Ringo build? Here, two altars are considered different when at least one of the three parts used is different.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq B_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq C_i \\leq 10^9(1\\leq i\\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\nB_1 ... B_N\nC_1 ... C_N\n\nOutput\n\nPrint the number of different altars that Ringo can build.\n\nSample Input 1\n\n2\n1 5\n2 4\n3 6\n\nSample Output 1\n\n3\n\nThe following three altars can be built:\n\nUpper: 1-st part, Middle: 1-st part, Lower: 1-st part\n\nUpper: 1-st part, Middle: 1-st part, Lower: 2-nd part\n\nUpper: 1-st part, Middle: 2-nd part, Lower: 2-nd part\n\nSample Input 2\n\n3\n1 1 1\n2 2 2\n3 3 3\n\nSample Output 2\n\n27\n\nSample Input 3\n\n6\n3 14 159 2 6 53\n58 9 79 323 84 6\n2643 383 2 79 50 288\n\nSample Output 3\n\n87", "sample_input": "2\n1 5\n2 4\n3 6\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03557", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower.\n\nHe has N parts for each of the three categories. The size of the i-th upper part is A_i, the size of the i-th middle part is B_i, and the size of the i-th lower part is C_i.\n\nTo build an altar, the size of the middle part must be strictly greater than that of the upper part, and the size of the lower part must be strictly greater than that of the middle part. On the other hand, any three parts that satisfy these conditions can be combined to form an altar.\n\nHow many different altars can Ringo build? Here, two altars are considered different when at least one of the three parts used is different.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq B_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq C_i \\leq 10^9(1\\leq i\\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\nB_1 ... B_N\nC_1 ... C_N\n\nOutput\n\nPrint the number of different altars that Ringo can build.\n\nSample Input 1\n\n2\n1 5\n2 4\n3 6\n\nSample Output 1\n\n3\n\nThe following three altars can be built:\n\nUpper: 1-st part, Middle: 1-st part, Lower: 1-st part\n\nUpper: 1-st part, Middle: 1-st part, Lower: 2-nd part\n\nUpper: 1-st part, Middle: 2-nd part, Lower: 2-nd part\n\nSample Input 2\n\n3\n1 1 1\n2 2 2\n3 3 3\n\nSample Output 2\n\n27\n\nSample Input 3\n\n6\n3 14 159 2 6 53\n58 9 79 323 84 6\n2643 383 2 79 50 288\n\nSample Output 3\n\n87", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 910, "cpu_time_ms": 2105, "memory_kb": 25020}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s883046812", "group_id": "codeNet:p03557", "input_text": "import bisect\nn=int(input())\na=sorted(list(map(int,input().split())))\nb=sorted(list(map(int,input().split())))\nc=sorted(list(map(int,input().split())))\n# print(a)\n# print(b)\n# print(c)\n\nans=0\nacount=[0]*n\nbcount=[0]*n\nruiseki=[0]*(n+1)\nfor i in range(n):\n acount[i]=n-bisect.bisect(b,a[i])\n bcount[i]=n-bisect.bisect(c,b[i])\n ruiseki[i+1]=ruiseki[i]+bcount[i]\n# print(acount)\n# print(bcount)\n# print(ruiseki)\n\nfor i in range(n):\n # print(ruiseki[n]-ruiseki[n-acount[i]])\n ans+=ruiseki[n]-ruiseki[n-acount[i]]\nprint(ans)", "language": "Python", "metadata": {"date": 1561951778, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03557.html", "problem_id": "p03557", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03557/input.txt", "sample_output_relpath": "derived/input_output/data/p03557/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03557/Python/s883046812.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s883046812", "user_id": "u654470292"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import bisect\nn=int(input())\na=sorted(list(map(int,input().split())))\nb=sorted(list(map(int,input().split())))\nc=sorted(list(map(int,input().split())))\n# print(a)\n# print(b)\n# print(c)\n\nans=0\nacount=[0]*n\nbcount=[0]*n\nruiseki=[0]*(n+1)\nfor i in range(n):\n acount[i]=n-bisect.bisect(b,a[i])\n bcount[i]=n-bisect.bisect(c,b[i])\n ruiseki[i+1]=ruiseki[i]+bcount[i]\n# print(acount)\n# print(bcount)\n# print(ruiseki)\n\nfor i in range(n):\n # print(ruiseki[n]-ruiseki[n-acount[i]])\n ans+=ruiseki[n]-ruiseki[n-acount[i]]\nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower.\n\nHe has N parts for each of the three categories. The size of the i-th upper part is A_i, the size of the i-th middle part is B_i, and the size of the i-th lower part is C_i.\n\nTo build an altar, the size of the middle part must be strictly greater than that of the upper part, and the size of the lower part must be strictly greater than that of the middle part. On the other hand, any three parts that satisfy these conditions can be combined to form an altar.\n\nHow many different altars can Ringo build? Here, two altars are considered different when at least one of the three parts used is different.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq B_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq C_i \\leq 10^9(1\\leq i\\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\nB_1 ... B_N\nC_1 ... C_N\n\nOutput\n\nPrint the number of different altars that Ringo can build.\n\nSample Input 1\n\n2\n1 5\n2 4\n3 6\n\nSample Output 1\n\n3\n\nThe following three altars can be built:\n\nUpper: 1-st part, Middle: 1-st part, Lower: 1-st part\n\nUpper: 1-st part, Middle: 1-st part, Lower: 2-nd part\n\nUpper: 1-st part, Middle: 2-nd part, Lower: 2-nd part\n\nSample Input 2\n\n3\n1 1 1\n2 2 2\n3 3 3\n\nSample Output 2\n\n27\n\nSample Input 3\n\n6\n3 14 159 2 6 53\n58 9 79 323 84 6\n2643 383 2 79 50 288\n\nSample Output 3\n\n87", "sample_input": "2\n1 5\n2 4\n3 6\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03557", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower.\n\nHe has N parts for each of the three categories. The size of the i-th upper part is A_i, the size of the i-th middle part is B_i, and the size of the i-th lower part is C_i.\n\nTo build an altar, the size of the middle part must be strictly greater than that of the upper part, and the size of the lower part must be strictly greater than that of the middle part. On the other hand, any three parts that satisfy these conditions can be combined to form an altar.\n\nHow many different altars can Ringo build? Here, two altars are considered different when at least one of the three parts used is different.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq B_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq C_i \\leq 10^9(1\\leq i\\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\nB_1 ... B_N\nC_1 ... C_N\n\nOutput\n\nPrint the number of different altars that Ringo can build.\n\nSample Input 1\n\n2\n1 5\n2 4\n3 6\n\nSample Output 1\n\n3\n\nThe following three altars can be built:\n\nUpper: 1-st part, Middle: 1-st part, Lower: 1-st part\n\nUpper: 1-st part, Middle: 1-st part, Lower: 2-nd part\n\nUpper: 1-st part, Middle: 2-nd part, Lower: 2-nd part\n\nSample Input 2\n\n3\n1 1 1\n2 2 2\n3 3 3\n\nSample Output 2\n\n27\n\nSample Input 3\n\n6\n3 14 159 2 6 53\n58 9 79 323 84 6\n2643 383 2 79 50 288\n\nSample Output 3\n\n87", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 534, "cpu_time_ms": 481, "memory_kb": 109412}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s354028141", "group_id": "codeNet:p03559", "input_text": "n=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\nc=list(map(int,input().split()))\na.sort()\na.reverse()\nb.sort()\nb.reverse()\nc.sort()\nc.reverse()\nc.append(0)\n\ni=0\nl=[]\nfor j in b:\n while c[i]>j:\n i+=1\n l.append(i)\nb.append(0)\ns=0\ncnt=0\ni=0\nfor j in a:\n while b[i]>j:\n s+=l[i]\n i+=1\n cnt+=s\nprint(cnt)", "language": "Python", "metadata": {"date": 1600359328, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p03559.html", "problem_id": "p03559", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03559/input.txt", "sample_output_relpath": "derived/input_output/data/p03559/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03559/Python/s354028141.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s354028141", "user_id": "u651663683"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "n=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\nc=list(map(int,input().split()))\na.sort()\na.reverse()\nb.sort()\nb.reverse()\nc.sort()\nc.reverse()\nc.append(0)\n\ni=0\nl=[]\nfor j in b:\n while c[i]>j:\n i+=1\n l.append(i)\nb.append(0)\ns=0\ncnt=0\ni=0\nfor j in a:\n while b[i]>j:\n s+=l[i]\n i+=1\n cnt+=s\nprint(cnt)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower.\n\nHe has N parts for each of the three categories. The size of the i-th upper part is A_i, the size of the i-th middle part is B_i, and the size of the i-th lower part is C_i.\n\nTo build an altar, the size of the middle part must be strictly greater than that of the upper part, and the size of the lower part must be strictly greater than that of the middle part. On the other hand, any three parts that satisfy these conditions can be combined to form an altar.\n\nHow many different altars can Ringo build? Here, two altars are considered different when at least one of the three parts used is different.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq B_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq C_i \\leq 10^9(1\\leq i\\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\nB_1 ... B_N\nC_1 ... C_N\n\nOutput\n\nPrint the number of different altars that Ringo can build.\n\nSample Input 1\n\n2\n1 5\n2 4\n3 6\n\nSample Output 1\n\n3\n\nThe following three altars can be built:\n\nUpper: 1-st part, Middle: 1-st part, Lower: 1-st part\n\nUpper: 1-st part, Middle: 1-st part, Lower: 2-nd part\n\nUpper: 1-st part, Middle: 2-nd part, Lower: 2-nd part\n\nSample Input 2\n\n3\n1 1 1\n2 2 2\n3 3 3\n\nSample Output 2\n\n27\n\nSample Input 3\n\n6\n3 14 159 2 6 53\n58 9 79 323 84 6\n2643 383 2 79 50 288\n\nSample Output 3\n\n87", "sample_input": "2\n1 5\n2 4\n3 6\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03559", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower.\n\nHe has N parts for each of the three categories. The size of the i-th upper part is A_i, the size of the i-th middle part is B_i, and the size of the i-th lower part is C_i.\n\nTo build an altar, the size of the middle part must be strictly greater than that of the upper part, and the size of the lower part must be strictly greater than that of the middle part. On the other hand, any three parts that satisfy these conditions can be combined to form an altar.\n\nHow many different altars can Ringo build? Here, two altars are considered different when at least one of the three parts used is different.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq B_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq C_i \\leq 10^9(1\\leq i\\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\nB_1 ... B_N\nC_1 ... C_N\n\nOutput\n\nPrint the number of different altars that Ringo can build.\n\nSample Input 1\n\n2\n1 5\n2 4\n3 6\n\nSample Output 1\n\n3\n\nThe following three altars can be built:\n\nUpper: 1-st part, Middle: 1-st part, Lower: 1-st part\n\nUpper: 1-st part, Middle: 1-st part, Lower: 2-nd part\n\nUpper: 1-st part, Middle: 2-nd part, Lower: 2-nd part\n\nSample Input 2\n\n3\n1 1 1\n2 2 2\n3 3 3\n\nSample Output 2\n\n27\n\nSample Input 3\n\n6\n3 14 159 2 6 53\n58 9 79 323 84 6\n2643 383 2 79 50 288\n\nSample Output 3\n\n87", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 344, "cpu_time_ms": 397, "memory_kb": 103764}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s909320755", "group_id": "codeNet:p03563", "input_text": "r = int(input())\ng = int(input())\n\nprint(g*2 - r)\n", "language": "Python", "metadata": {"date": 1516419975, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03563.html", "problem_id": "p03563", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03563/input.txt", "sample_output_relpath": "derived/input_output/data/p03563/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03563/Python/s909320755.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s909320755", "user_id": "u590048048"}, "prompt_components": {"gold_output": "2032\n", "input_to_evaluate": "r = int(input())\ng = int(input())\n\nprint(g*2 - r)\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is a user of a site that hosts programming contests.\n\nWhen a user competes in a contest, the rating of the user (not necessarily an integer) changes according to the performance of the user, as follows:\n\nLet the current rating of the user be a.\n\nSuppose that the performance of the user in the contest is b.\n\nThen, the new rating of the user will be the avarage of a and b.\n\nFor example, if a user with rating 1 competes in a contest and gives performance 1000, his/her new rating will be 500.5, the average of 1 and 1000.\n\nTakahashi's current rating is R, and he wants his rating to be exactly G after the next contest.\n\nFind the performance required to achieve it.\n\nConstraints\n\n0 \\leq R, G \\leq 4500\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\nG\n\nOutput\n\nPrint the performance required to achieve the objective.\n\nSample Input 1\n\n2002\n2017\n\nSample Output 1\n\n2032\n\nTakahashi's current rating is 2002.\n\nIf his performance in the contest is 2032, his rating will be the average of 2002 and 2032, which is equal to the desired rating, 2017.\n\nSample Input 2\n\n4500\n0\n\nSample Output 2\n\n-4500\n\nAlthough the current and desired ratings are between 0 and 4500, the performance of a user can be below 0.", "sample_input": "2002\n2017\n"}, "reference_outputs": ["2032\n"], "source_document_id": "p03563", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is a user of a site that hosts programming contests.\n\nWhen a user competes in a contest, the rating of the user (not necessarily an integer) changes according to the performance of the user, as follows:\n\nLet the current rating of the user be a.\n\nSuppose that the performance of the user in the contest is b.\n\nThen, the new rating of the user will be the avarage of a and b.\n\nFor example, if a user with rating 1 competes in a contest and gives performance 1000, his/her new rating will be 500.5, the average of 1 and 1000.\n\nTakahashi's current rating is R, and he wants his rating to be exactly G after the next contest.\n\nFind the performance required to achieve it.\n\nConstraints\n\n0 \\leq R, G \\leq 4500\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\nG\n\nOutput\n\nPrint the performance required to achieve the objective.\n\nSample Input 1\n\n2002\n2017\n\nSample Output 1\n\n2032\n\nTakahashi's current rating is 2002.\n\nIf his performance in the contest is 2032, his rating will be the average of 2002 and 2032, which is equal to the desired rating, 2017.\n\nSample Input 2\n\n4500\n0\n\nSample Output 2\n\n-4500\n\nAlthough the current and desired ratings are between 0 and 4500, the performance of a user can be below 0.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 50, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s852519381", "group_id": "codeNet:p03564", "input_text": "N = int(input())\nK = int(input())\n\na = 1\n\nfor i in range(N):\n if K >= a: \n a *= 2\n else:\n a += K\n\nprint(a)", "language": "Python", "metadata": {"date": 1509759098, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03564.html", "problem_id": "p03564", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03564/input.txt", "sample_output_relpath": "derived/input_output/data/p03564/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03564/Python/s852519381.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s852519381", "user_id": "u163892325"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "N = int(input())\nK = int(input())\n\na = 1\n\nfor i in range(N):\n if K >= a: \n a *= 2\n else:\n a += K\n\nprint(a)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSquare1001 has seen an electric bulletin board displaying the integer 1.\nHe can perform the following operations A and B to change this value:\n\nOperation A: The displayed value is doubled.\n\nOperation B: The displayed value increases by K.\n\nSquare1001 needs to perform these operations N times in total.\nFind the minimum possible value displayed in the board after N operations.\n\nConstraints\n\n1 \\leq N, K \\leq 10\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nK\n\nOutput\n\nPrint the minimum possible value displayed in the board after N operations.\n\nSample Input 1\n\n4\n3\n\nSample Output 1\n\n10\n\nThe value will be minimized when the operations are performed in the following order: A, A, B, B.\n\nIn this case, the value will change as follows: 1 → 2 → 4 → 7 → 10.\n\nSample Input 2\n\n10\n10\n\nSample Output 2\n\n76\n\nThe value will be minimized when the operations are performed in the following order: A, A, A, A, B, B, B, B, B, B.\n\nIn this case, the value will change as follows: 1 → 2 → 4 → 8 → 16 → 26 → 36 → 46 → 56 → 66 → 76.\n\nBy the way, this contest is AtCoder Beginner Contest 076.", "sample_input": "4\n3\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03564", "source_text": "Score : 200 points\n\nProblem Statement\n\nSquare1001 has seen an electric bulletin board displaying the integer 1.\nHe can perform the following operations A and B to change this value:\n\nOperation A: The displayed value is doubled.\n\nOperation B: The displayed value increases by K.\n\nSquare1001 needs to perform these operations N times in total.\nFind the minimum possible value displayed in the board after N operations.\n\nConstraints\n\n1 \\leq N, K \\leq 10\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nK\n\nOutput\n\nPrint the minimum possible value displayed in the board after N operations.\n\nSample Input 1\n\n4\n3\n\nSample Output 1\n\n10\n\nThe value will be minimized when the operations are performed in the following order: A, A, B, B.\n\nIn this case, the value will change as follows: 1 → 2 → 4 → 7 → 10.\n\nSample Input 2\n\n10\n10\n\nSample Output 2\n\n76\n\nThe value will be minimized when the operations are performed in the following order: A, A, A, A, B, B, B, B, B, B.\n\nIn this case, the value will change as follows: 1 → 2 → 4 → 8 → 16 → 26 → 36 → 46 → 56 → 66 → 76.\n\nBy the way, this contest is AtCoder Beginner Contest 076.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 114, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s210554371", "group_id": "codeNet:p03573", "input_text": "nums = input()\nset_nums = list(set(nums))\nother = sum(nums) - sum(set_nums)\nset_nums.remove(other)\nprint(set_nums[0])", "language": "Python", "metadata": {"date": 1508031067, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03573.html", "problem_id": "p03573", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03573/input.txt", "sample_output_relpath": "derived/input_output/data/p03573/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03573/Python/s210554371.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s210554371", "user_id": "u104922648"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "nums = input()\nset_nums = list(set(nums))\nother = sum(nums) - sum(set_nums)\nset_nums.remove(other)\nprint(set_nums[0])", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given three integers, A, B and C.\n\nAmong them, two are the same, but the remaining one is different from the rest.\n\nFor example, when A=5,B=7,C=5, A and C are the same, but B is different.\n\nFind the one that is different from the rest among the given three integers.\n\nConstraints\n\n-100 \\leq A,B,C \\leq 100\n\nA, B and C are integers.\n\nThe input satisfies the condition in the statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nAmong A, B and C, print the integer that is different from the rest.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\n7\n\nThis is the same case as the one in the statement.\n\nSample Input 2\n\n1 1 7\n\nSample Output 2\n\n7\n\nIn this case, C is the one we seek.\n\nSample Input 3\n\n-100 100 100\n\nSample Output 3\n\n-100", "sample_input": "5 7 5\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03573", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given three integers, A, B and C.\n\nAmong them, two are the same, but the remaining one is different from the rest.\n\nFor example, when A=5,B=7,C=5, A and C are the same, but B is different.\n\nFind the one that is different from the rest among the given three integers.\n\nConstraints\n\n-100 \\leq A,B,C \\leq 100\n\nA, B and C are integers.\n\nThe input satisfies the condition in the statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nAmong A, B and C, print the integer that is different from the rest.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\n7\n\nThis is the same case as the one in the statement.\n\nSample Input 2\n\n1 1 7\n\nSample Output 2\n\n7\n\nIn this case, C is the one we seek.\n\nSample Input 3\n\n-100 100 100\n\nSample Output 3\n\n-100", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 117, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s820701679", "group_id": "codeNet:p03592", "input_text": "n,m,k = map(int, input().split())\n\nfor i in range(n+1):\n for j in range(m+1):\n if i*(m-j)+j*(n-1):\n print(\"Yes\")\n exit()\nprint(\"No\")", "language": "Python", "metadata": {"date": 1589682205, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03592.html", "problem_id": "p03592", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03592/input.txt", "sample_output_relpath": "derived/input_output/data/p03592/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03592/Python/s820701679.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s820701679", "user_id": "u241159583"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "n,m,k = map(int, input().split())\n\nfor i in range(n+1):\n for j in range(m+1):\n if i*(m-j)+j*(n-1):\n print(\"Yes\")\n exit()\nprint(\"No\")", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a grid with N rows and M columns of squares. Initially, all the squares are white.\n\nThere is a button attached to each row and each column.\nWhen a button attached to a row is pressed, the colors of all the squares in that row are inverted; that is, white squares become black and vice versa.\nWhen a button attached to a column is pressed, the colors of all the squares in that column are inverted.\n\nTakahashi can freely press the buttons any number of times. Determine whether he can have exactly K black squares in the grid.\n\nConstraints\n\n1 \\leq N,M \\leq 1000\n\n0 \\leq K \\leq NM\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\n\nOutput\n\nIf Takahashi can have exactly K black squares in the grid, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 2 2\n\nSample Output 1\n\nYes\n\nPress the buttons in the order of the first row, the first column.\n\nSample Input 2\n\n2 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n3 5 8\n\nSample Output 3\n\nYes\n\nPress the buttons in the order of the first column, third column, second row, fifth column.\n\nSample Input 4\n\n7 9 20\n\nSample Output 4\n\nNo", "sample_input": "2 2 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03592", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a grid with N rows and M columns of squares. Initially, all the squares are white.\n\nThere is a button attached to each row and each column.\nWhen a button attached to a row is pressed, the colors of all the squares in that row are inverted; that is, white squares become black and vice versa.\nWhen a button attached to a column is pressed, the colors of all the squares in that column are inverted.\n\nTakahashi can freely press the buttons any number of times. Determine whether he can have exactly K black squares in the grid.\n\nConstraints\n\n1 \\leq N,M \\leq 1000\n\n0 \\leq K \\leq NM\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\n\nOutput\n\nIf Takahashi can have exactly K black squares in the grid, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 2 2\n\nSample Output 1\n\nYes\n\nPress the buttons in the order of the first row, the first column.\n\nSample Input 2\n\n2 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n3 5 8\n\nSample Output 3\n\nYes\n\nPress the buttons in the order of the first column, third column, second row, fifth column.\n\nSample Input 4\n\n7 9 20\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 146, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s387194558", "group_id": "codeNet:p03592", "input_text": "a = list(map(int,input().split()))\ns = []\nif a[0] <= a[1]:\n\tsmall = a[0]\n\tbig = a[1]\nelse:\n\tsmall = a[1]\n\tbig = a[0]\ns.append(a[0] * a[1] - 1)\n\nfor i in range(1,small + 1):\n\ts.append(s[i-1] + s[0] - (2 * i) * 2)\nif a[2] in s:\n\tprint('Yes')\nelse:\n\tprint('No')", "language": "Python", "metadata": {"date": 1506216436, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03592.html", "problem_id": "p03592", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03592/input.txt", "sample_output_relpath": "derived/input_output/data/p03592/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03592/Python/s387194558.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s387194558", "user_id": "u858136677"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "a = list(map(int,input().split()))\ns = []\nif a[0] <= a[1]:\n\tsmall = a[0]\n\tbig = a[1]\nelse:\n\tsmall = a[1]\n\tbig = a[0]\ns.append(a[0] * a[1] - 1)\n\nfor i in range(1,small + 1):\n\ts.append(s[i-1] + s[0] - (2 * i) * 2)\nif a[2] in s:\n\tprint('Yes')\nelse:\n\tprint('No')", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a grid with N rows and M columns of squares. Initially, all the squares are white.\n\nThere is a button attached to each row and each column.\nWhen a button attached to a row is pressed, the colors of all the squares in that row are inverted; that is, white squares become black and vice versa.\nWhen a button attached to a column is pressed, the colors of all the squares in that column are inverted.\n\nTakahashi can freely press the buttons any number of times. Determine whether he can have exactly K black squares in the grid.\n\nConstraints\n\n1 \\leq N,M \\leq 1000\n\n0 \\leq K \\leq NM\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\n\nOutput\n\nIf Takahashi can have exactly K black squares in the grid, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 2 2\n\nSample Output 1\n\nYes\n\nPress the buttons in the order of the first row, the first column.\n\nSample Input 2\n\n2 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n3 5 8\n\nSample Output 3\n\nYes\n\nPress the buttons in the order of the first column, third column, second row, fifth column.\n\nSample Input 4\n\n7 9 20\n\nSample Output 4\n\nNo", "sample_input": "2 2 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03592", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a grid with N rows and M columns of squares. Initially, all the squares are white.\n\nThere is a button attached to each row and each column.\nWhen a button attached to a row is pressed, the colors of all the squares in that row are inverted; that is, white squares become black and vice versa.\nWhen a button attached to a column is pressed, the colors of all the squares in that column are inverted.\n\nTakahashi can freely press the buttons any number of times. Determine whether he can have exactly K black squares in the grid.\n\nConstraints\n\n1 \\leq N,M \\leq 1000\n\n0 \\leq K \\leq NM\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\n\nOutput\n\nIf Takahashi can have exactly K black squares in the grid, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 2 2\n\nSample Output 1\n\nYes\n\nPress the buttons in the order of the first row, the first column.\n\nSample Input 2\n\n2 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n3 5 8\n\nSample Output 3\n\nYes\n\nPress the buttons in the order of the first column, third column, second row, fifth column.\n\nSample Input 4\n\n7 9 20\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 258, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s515792365", "group_id": "codeNet:p03593", "input_text": "from collections import Counter\n\n\ndef main():\n H, W = map(int, input().split())\n A = [input() for _ in range(H)]\n space = {}\n space[1] = (H % 2) * (W % 2)\n space[2] = (H % 2) * (W//2*2) + (W % 2) * (H//2*2)\n space[4] = (H//2*2) * (W//2*2)\n cnt = Counter(\"\".join(A))\n for alpha in cnt:\n c = cnt[alpha]\n for k in (4, 2, 1):\n while c//k >= 1 and space[k]:\n y = min(c//k*k, space[k])\n space[k] -= y\n c -= y\n if c:\n print(\"No\")\n return\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n main()\n", "language": "Python", "metadata": {"date": 1562429138, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03593.html", "problem_id": "p03593", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03593/input.txt", "sample_output_relpath": "derived/input_output/data/p03593/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03593/Python/s515792365.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s515792365", "user_id": "u155024797"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "from collections import Counter\n\n\ndef main():\n H, W = map(int, input().split())\n A = [input() for _ in range(H)]\n space = {}\n space[1] = (H % 2) * (W % 2)\n space[2] = (H % 2) * (W//2*2) + (W % 2) * (H//2*2)\n space[4] = (H//2*2) * (W//2*2)\n cnt = Counter(\"\".join(A))\n for alpha in cnt:\n c = cnt[alpha]\n for k in (4, 2, 1):\n while c//k >= 1 and space[k]:\n y = min(c//k*k, space[k])\n space[k] -= y\n c -= y\n if c:\n print(\"No\")\n return\n print(\"Yes\")\n\n\nif __name__ == \"__main__\":\n main()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have an H-by-W matrix.\nLet a_{ij} be the element at the i-th row from the top and j-th column from the left.\nIn this matrix, each a_{ij} is a lowercase English letter.\n\nSnuke is creating another H-by-W matrix, A', by freely rearranging the elements in A.\nHere, he wants to satisfy the following condition:\n\nEvery row and column in A' can be read as a palindrome.\n\nDetermine whether he can create a matrix satisfying the condition.\n\nNote\n\nA palindrome is a string that reads the same forward and backward.\nFor example, a, aa, abba and abcba are all palindromes, while ab, abab and abcda are not.\n\nConstraints\n\n1 ≤ H, W ≤ 100\n\na_{ij} is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11}a_{12}...a_{1W}\n:\na_{H1}a_{H2}...a_{HW}\n\nOutput\n\nIf Snuke can create a matrix satisfying the condition, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 4\naabb\naabb\naacc\n\nSample Output 1\n\nYes\n\nFor example, the following matrix satisfies the condition.\n\nabba\nacca\nabba\n\nSample Input 2\n\n2 2\naa\nbb\n\nSample Output 2\n\nNo\n\nIt is not possible to create a matrix satisfying the condition, no matter how we rearrange the elements in A.\n\nSample Input 3\n\n5 1\nt\nw\ne\ne\nt\n\nSample Output 3\n\nYes\n\nFor example, the following matrix satisfies the condition.\n\nt\ne\nw\ne\nt\n\nSample Input 4\n\n2 5\nabxba\nabyba\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n1 1\nz\n\nSample Output 5\n\nYes", "sample_input": "3 4\naabb\naabb\naacc\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03593", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have an H-by-W matrix.\nLet a_{ij} be the element at the i-th row from the top and j-th column from the left.\nIn this matrix, each a_{ij} is a lowercase English letter.\n\nSnuke is creating another H-by-W matrix, A', by freely rearranging the elements in A.\nHere, he wants to satisfy the following condition:\n\nEvery row and column in A' can be read as a palindrome.\n\nDetermine whether he can create a matrix satisfying the condition.\n\nNote\n\nA palindrome is a string that reads the same forward and backward.\nFor example, a, aa, abba and abcba are all palindromes, while ab, abab and abcda are not.\n\nConstraints\n\n1 ≤ H, W ≤ 100\n\na_{ij} is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11}a_{12}...a_{1W}\n:\na_{H1}a_{H2}...a_{HW}\n\nOutput\n\nIf Snuke can create a matrix satisfying the condition, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 4\naabb\naabb\naacc\n\nSample Output 1\n\nYes\n\nFor example, the following matrix satisfies the condition.\n\nabba\nacca\nabba\n\nSample Input 2\n\n2 2\naa\nbb\n\nSample Output 2\n\nNo\n\nIt is not possible to create a matrix satisfying the condition, no matter how we rearrange the elements in A.\n\nSample Input 3\n\n5 1\nt\nw\ne\ne\nt\n\nSample Output 3\n\nYes\n\nFor example, the following matrix satisfies the condition.\n\nt\ne\nw\ne\nt\n\nSample Input 4\n\n2 5\nabxba\nabyba\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n1 1\nz\n\nSample Output 5\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 611, "cpu_time_ms": 173, "memory_kb": 38896}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s819542324", "group_id": "codeNet:p03597", "input_text": "n = int(input())\na = int(input())\nprint(n**2-a)", "language": "Python", "metadata": {"date": 1582591602, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03597.html", "problem_id": "p03597", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03597/input.txt", "sample_output_relpath": "derived/input_output/data/p03597/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03597/Python/s819542324.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s819542324", "user_id": "u413165887"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "n = int(input())\na = int(input())\nprint(n**2-a)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have an N \\times N square grid.\n\nWe will paint each square in the grid either black or white.\n\nIf we paint exactly A squares white, how many squares will be painted black?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq A \\leq N^2\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\nA\n\nOutputs\n\nPrint the number of squares that will be painted black.\n\nSample Input 1\n\n3\n4\n\nSample Output 1\n\n5\n\nThere are nine squares in a 3 \\times 3 square grid.\nFour of them will be painted white, so the remaining five squares will be painted black.\n\nSample Input 2\n\n19\n100\n\nSample Output 2\n\n261\n\nSample Input 3\n\n10\n0\n\nSample Output 3\n\n100\n\nAs zero squares will be painted white, all the squares will be painted black.", "sample_input": "3\n4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03597", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have an N \\times N square grid.\n\nWe will paint each square in the grid either black or white.\n\nIf we paint exactly A squares white, how many squares will be painted black?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq A \\leq N^2\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\nA\n\nOutputs\n\nPrint the number of squares that will be painted black.\n\nSample Input 1\n\n3\n4\n\nSample Output 1\n\n5\n\nThere are nine squares in a 3 \\times 3 square grid.\nFour of them will be painted white, so the remaining five squares will be painted black.\n\nSample Input 2\n\n19\n100\n\nSample Output 2\n\n261\n\nSample Input 3\n\n10\n0\n\nSample Output 3\n\n100\n\nAs zero squares will be painted white, all the squares will be painted black.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 47, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s452576041", "group_id": "codeNet:p03598", "input_text": "n = int(input())\nk = int(input())\nx = list(map(int,input().split()))\nans = 0\nfor i in x:\n ans += 2 * min(i,k-i)\nprint(ans)", "language": "Python", "metadata": {"date": 1593305469, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03598.html", "problem_id": "p03598", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03598/input.txt", "sample_output_relpath": "derived/input_output/data/p03598/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03598/Python/s452576041.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s452576041", "user_id": "u738898077"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "n = int(input())\nk = int(input())\nx = list(map(int,input().split()))\nans = 0\nfor i in x:\n ans += 2 * min(i,k-i)\nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i).\nThus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N.\n\nIn order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B.\nThen, he placed the i-th type-A robot at coordinates (0, i), and the i-th type-B robot at coordinates (K, i).\nThus, now we have one type-A robot and one type-B robot on each of the N lines y = 1, y = 2, ..., y = N.\n\nWhen activated, each type of robot will operate as follows.\n\nWhen a type-A robot is activated at coordinates (0, a), it will move to the position of the ball on the line y = a, collect the ball, move back to its original position (0, a) and deactivate itself. If there is no such ball, it will just deactivate itself without doing anything.\n\nWhen a type-B robot is activated at coordinates (K, b), it will move to the position of the ball on the line y = b, collect the ball, move back to its original position (K, b) and deactivate itself. If there is no such ball, it will just deactivate itself without doing anything.\n\nSnuke will activate some of the 2N robots to collect all of the balls. Find the minimum possible total distance covered by robots.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n0 < x_i < K\n\nAll input values are integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\nK\nx_1 x_2 ... x_N\n\nOutputs\n\nPrint the minimum possible total distance covered by robots.\n\nSample Input 1\n\n1\n10\n2\n\nSample Output 1\n\n4\n\nThere are just one ball, one type-A robot and one type-B robot.\n\nIf the type-A robot is used to collect the ball, the distance from the robot to the ball is 2, and the distance from the ball to the original position of the robot is also 2, for a total distance of 4.\n\nSimilarly, if the type-B robot is used, the total distance covered will be 16.\n\nThus, the total distance covered will be minimized when the type-A robot is used. The output should be 4.\n\nSample Input 2\n\n2\n9\n3 6\n\nSample Output 2\n\n12\n\nThe total distance covered will be minimized when the first ball is collected by the type-A robot, and the second ball by the type-B robot.\n\nSample Input 3\n\n5\n20\n11 12 9 17 12\n\nSample Output 3\n\n74", "sample_input": "1\n10\n2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03598", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i).\nThus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N.\n\nIn order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B.\nThen, he placed the i-th type-A robot at coordinates (0, i), and the i-th type-B robot at coordinates (K, i).\nThus, now we have one type-A robot and one type-B robot on each of the N lines y = 1, y = 2, ..., y = N.\n\nWhen activated, each type of robot will operate as follows.\n\nWhen a type-A robot is activated at coordinates (0, a), it will move to the position of the ball on the line y = a, collect the ball, move back to its original position (0, a) and deactivate itself. If there is no such ball, it will just deactivate itself without doing anything.\n\nWhen a type-B robot is activated at coordinates (K, b), it will move to the position of the ball on the line y = b, collect the ball, move back to its original position (K, b) and deactivate itself. If there is no such ball, it will just deactivate itself without doing anything.\n\nSnuke will activate some of the 2N robots to collect all of the balls. Find the minimum possible total distance covered by robots.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n0 < x_i < K\n\nAll input values are integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\nK\nx_1 x_2 ... x_N\n\nOutputs\n\nPrint the minimum possible total distance covered by robots.\n\nSample Input 1\n\n1\n10\n2\n\nSample Output 1\n\n4\n\nThere are just one ball, one type-A robot and one type-B robot.\n\nIf the type-A robot is used to collect the ball, the distance from the robot to the ball is 2, and the distance from the ball to the original position of the robot is also 2, for a total distance of 4.\n\nSimilarly, if the type-B robot is used, the total distance covered will be 16.\n\nThus, the total distance covered will be minimized when the type-A robot is used. The output should be 4.\n\nSample Input 2\n\n2\n9\n3 6\n\nSample Output 2\n\n12\n\nThe total distance covered will be minimized when the first ball is collected by the type-A robot, and the second ball by the type-B robot.\n\nSample Input 3\n\n5\n20\n11 12 9 17 12\n\nSample Output 3\n\n74", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 125, "cpu_time_ms": 25, "memory_kb": 9028}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s531382530", "group_id": "codeNet:p03599", "input_text": "from collections import Counter,defaultdict,deque\nfrom heapq import heappop,heappush,heapify\nimport sys,bisect,math,itertools,fractions\nsys.setrecursionlimit(10**8)\nmod = 10**9+7\nINF = float('inf')\ndef inp(): return int(sys.stdin.readline())\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\na,b,c,d,e,f = inpl()\nmx = 0\nres = 0\nans = 0\nfor i in range(40):\n for j in range(40):\n water = 100*a*i + 100*b*j\n if water == 0:\n continue\n for k in range(300):\n for l in range(300):\n sugar = c*k + d*l\n if water+sugar > f or sugar > (i+j)*e:\n continue\n if sugar/(water+sugar) >= mx:\n mx = sugar/(water+sugar)\n res = water+sugar\n ans = sugar\nprint(res,ans)", "language": "Python", "metadata": {"date": 1588681763, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03599.html", "problem_id": "p03599", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03599/input.txt", "sample_output_relpath": "derived/input_output/data/p03599/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03599/Python/s531382530.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s531382530", "user_id": "u645250356"}, "prompt_components": {"gold_output": "110 10\n", "input_to_evaluate": "from collections import Counter,defaultdict,deque\nfrom heapq import heappop,heappush,heapify\nimport sys,bisect,math,itertools,fractions\nsys.setrecursionlimit(10**8)\nmod = 10**9+7\nINF = float('inf')\ndef inp(): return int(sys.stdin.readline())\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\na,b,c,d,e,f = inpl()\nmx = 0\nres = 0\nans = 0\nfor i in range(40):\n for j in range(40):\n water = 100*a*i + 100*b*j\n if water == 0:\n continue\n for k in range(300):\n for l in range(300):\n sugar = c*k + d*l\n if water+sugar > f or sugar > (i+j)*e:\n continue\n if sugar/(water+sugar) >= mx:\n mx = sugar/(water+sugar)\n res = water+sugar\n ans = sugar\nprint(res,ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "sample_input": "1 2 10 20 15 200\n"}, "reference_outputs": ["110 10\n"], "source_document_id": "p03599", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 828, "cpu_time_ms": 1891, "memory_kb": 69848}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s380235626", "group_id": "codeNet:p03599", "input_text": "A,B,C,D,E,F = map(int,input().split(\" \"))\nA *= 100\nB *= 100\n\nwater = []\nfor a in range(F//A+1):\n for b in range(F//B+1):\n if a + b == 0 or a * A + b * B > F:\n continue\n if not((a * A + b * B) in water):\n water.append(a * A + b * B)\n\nsuger = []\nfor c in range(F//C+1):\n for d in range(F//D+1):\n if c * C + d * D > F:\n continue\n if not((c * C + d * D) in suger):\n suger.append(c * C + d * D)\n\nmax_dense = 0\nlog = [water[0],0]\nfor w in water:\n for s in suger:\n if w + s > F:\n continue\n dense = 100 * s / (w + s)\n if dense > E:\n continue\n if dense > max_dense:\n max_dense = dense\n log = [w+s,s]\n\nprint(\" \".join(map(str,log)))", "language": "Python", "metadata": {"date": 1556756329, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03599.html", "problem_id": "p03599", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03599/input.txt", "sample_output_relpath": "derived/input_output/data/p03599/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03599/Python/s380235626.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s380235626", "user_id": "u278886389"}, "prompt_components": {"gold_output": "110 10\n", "input_to_evaluate": "A,B,C,D,E,F = map(int,input().split(\" \"))\nA *= 100\nB *= 100\n\nwater = []\nfor a in range(F//A+1):\n for b in range(F//B+1):\n if a + b == 0 or a * A + b * B > F:\n continue\n if not((a * A + b * B) in water):\n water.append(a * A + b * B)\n\nsuger = []\nfor c in range(F//C+1):\n for d in range(F//D+1):\n if c * C + d * D > F:\n continue\n if not((c * C + d * D) in suger):\n suger.append(c * C + d * D)\n\nmax_dense = 0\nlog = [water[0],0]\nfor w in water:\n for s in suger:\n if w + s > F:\n continue\n dense = 100 * s / (w + s)\n if dense > E:\n continue\n if dense > max_dense:\n max_dense = dense\n log = [w+s,s]\n\nprint(\" \".join(map(str,log)))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "sample_input": "1 2 10 20 15 200\n"}, "reference_outputs": ["110 10\n"], "source_document_id": "p03599", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 774, "cpu_time_ms": 1994, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s190854409", "group_id": "codeNet:p03607", "input_text": "N = int(input())\nA = []\nfor i in range(N):\n x=[int(i) for i in input().split()]\n if A.count(x) == 0:\n A.append(x)\n else:\n A.remove(x)\nprint(len(A))\n \n", "language": "Python", "metadata": {"date": 1589432516, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p03607.html", "problem_id": "p03607", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03607/input.txt", "sample_output_relpath": "derived/input_output/data/p03607/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03607/Python/s190854409.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s190854409", "user_id": "u159975271"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "N = int(input())\nA = []\nfor i in range(N):\n x=[int(i) for i in input().split()]\n if A.count(x) == 0:\n A.append(x)\n else:\n A.remove(x)\nprint(len(A))\n \n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "sample_input": "3\n6\n2\n6\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03607", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 176, "cpu_time_ms": 2208, "memory_kb": 71856}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s180616066", "group_id": "codeNet:p03610", "input_text": "c = input()\nprint(c[::2])", "language": "Python", "metadata": {"date": 1585624394, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Python/s180616066.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s180616066", "user_id": "u453815934"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "c = input()\nprint(c[::2])", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 25, "cpu_time_ms": 18, "memory_kb": 3188}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s317347542", "group_id": "codeNet:p03610", "input_text": "s = input()\nfor i in range(len(s)-1):\n if i%2 == 0:\n print(s[i], end = \"\")", "language": "Python", "metadata": {"date": 1565918709, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Python/s317347542.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s317347542", "user_id": "u260036763"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "s = input()\nfor i in range(len(s)-1):\n if i%2 == 0:\n print(s[i], end = \"\")", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 78, "cpu_time_ms": 85, "memory_kb": 4596}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s711438359", "group_id": "codeNet:p03610", "input_text": "s = input()\nfor i in range(len(s)):\n if i % 2 == 0:\n print(s[i], end=\"\")\nprint(\"\")", "language": "Python", "metadata": {"date": 1504400584, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Python/s711438359.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s711438359", "user_id": "u839537730"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "s = input()\nfor i in range(len(s)):\n if i % 2 == 0:\n print(s[i], end=\"\")\nprint(\"\")", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 92, "cpu_time_ms": 85, "memory_kb": 4596}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s885444903", "group_id": "codeNet:p03611", "input_text": "\nimport sys\nimport collections\n#import numpy as np\n\nreadline = sys.stdin.readline\n\ndef main():\n N = int(input())\n #A1 = np.array(list(map(int, readline().split())))\n A = list(map(int, readline().split()))\n\n count = [0] * (max(A) + 3)\n for a in A:\n count[a+1] += 1\n count[a] += 1\n count[a+2] += 1\n\n print(max(count))\n\n\nif __name__ == \"__main__\":\n main()\n", "language": "Python", "metadata": {"date": 1587610741, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03611.html", "problem_id": "p03611", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03611/input.txt", "sample_output_relpath": "derived/input_output/data/p03611/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03611/Python/s885444903.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s885444903", "user_id": "u125545880"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "\nimport sys\nimport collections\n#import numpy as np\n\nreadline = sys.stdin.readline\n\ndef main():\n N = int(input())\n #A1 = np.array(list(map(int, readline().split())))\n A = list(map(int, readline().split()))\n\n count = [0] * (max(A) + 3)\n for a in A:\n count[a+1] += 1\n count[a] += 1\n count[a+2] += 1\n\n print(max(count))\n\n\nif __name__ == \"__main__\":\n main()\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N, a_1,a_2,...,a_N.\n\nFor each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing.\n\nAfter these operations, you select an integer X and count the number of i such that a_i=X.\n\nMaximize this count by making optimal choices.\n\nConstraints\n\n1≤N≤10^5\n\n0≤a_i<10^5 (1≤i≤N)\n\na_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\n\nOutput\n\nPrint the maximum possible number of i such that a_i=X.\n\nSample Input 1\n\n7\n3 1 4 1 5 9 2\n\nSample Output 1\n\n4\n\nFor example, turn the sequence into 2,2,3,2,6,9,2 and select X=2 to obtain 4, the maximum possible count.\n\nSample Input 2\n\n10\n0 1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n3\n\nSample Input 3\n\n1\n99999\n\nSample Output 3\n\n1", "sample_input": "7\n3 1 4 1 5 9 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03611", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N, a_1,a_2,...,a_N.\n\nFor each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing.\n\nAfter these operations, you select an integer X and count the number of i such that a_i=X.\n\nMaximize this count by making optimal choices.\n\nConstraints\n\n1≤N≤10^5\n\n0≤a_i<10^5 (1≤i≤N)\n\na_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\n\nOutput\n\nPrint the maximum possible number of i such that a_i=X.\n\nSample Input 1\n\n7\n3 1 4 1 5 9 2\n\nSample Output 1\n\n4\n\nFor example, turn the sequence into 2,2,3,2,6,9,2 and select X=2 to obtain 4, the maximum possible count.\n\nSample Input 2\n\n10\n0 1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n3\n\nSample Input 3\n\n1\n99999\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 395, "cpu_time_ms": 75, "memory_kb": 14292}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s518593452", "group_id": "codeNet:p03612", "input_text": "# coding: utf-8\nimport re\nimport math\nfrom collections import defaultdict\nfrom collections import deque\nimport collections\nfrom fractions import Fraction\nimport itertools\nfrom copy import deepcopy\nimport random\nimport time\nimport os\nimport queue\nimport sys\nimport datetime\nfrom functools import lru_cache\n#@lru_cache(maxsize=None)\nreadline=sys.stdin.readline\nsys.setrecursionlimit(2000000)\n#import numpy as np\nalphabet=\"abcdefghijklmnopqrstuvwxyz\"\nmod=int(10**9+7)\ninf=int(10**20)\ndef yn(b):\n if b:\n print(\"yes\")\n else:\n print(\"no\")\ndef Yn(b):\n if b:\n print(\"Yes\")\n else:\n print(\"No\")\ndef YN(b):\n if b:\n print(\"YES\")\n else:\n print(\"NO\")\nclass union_find():\n def __init__(self,n):\n self.n=n\n self.P=[a for a in range(n)]\n self.rank=[0]*n\n \n def find(self,x):\n if(x!=self.P[x]):self.P[x]=self.find(self.P[x])\n return self.P[x]\n \n def same(self,x,y):\n return self.find(x)==self.find(y)\n \n def link(self,x,y):\n if self.rank[x]>(size-a-1))&1==1:\n A[a]=1\n else:\n A[a]=0\n return A\ndef getfacs(n,mod_=0):\n A=[1]*(n+1)\n for a in range(2,len(A)):\n A[a]=A[a-1]*a\n if(mod_>0):A[a]%=mod_\n return A\ndef comb(n,r,mod,fac):\n if(n-r<0):return 0\n return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod\ndef nextcomb(num,size):\n x=num&(-num)\n y=num+x\n z=num&(~y)\n z//=x\n z=z>>1\n num=(y|z)\n if(num>=(1< 1:list_.append(n)\n if type_==\"dict\":\n dic={}\n for a in list_:\n if a in dic:\n dic[a]+=1\n else:\n dic[a]=1\n return dic\n elif type_==\"list\":\n return list_\n else:\n return None\ndef pm(x):\n return x//abs(x)\ndef inputintlist():\n return list(map(int,input().split()))\n######################################################################################################\n\nn=int(input())\nP=inputintlist()\nP=list(map(lambda x:x-1,P))\nB=[]\nfor a in range(n):\n B.append(not P[a]==a)\nans=0\nfor a in range(n-1):\n if B[a]==False:\n if B[a+1]==False:\n B[a]=True\n B[a+1]=True\n else:\n B[a]=True\n ans+=1\n\nprint(ans)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "language": "Python", "metadata": {"date": 1589897573, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03612.html", "problem_id": "p03612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03612/input.txt", "sample_output_relpath": "derived/input_output/data/p03612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03612/Python/s518593452.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s518593452", "user_id": "u902151549"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "# coding: utf-8\nimport re\nimport math\nfrom collections import defaultdict\nfrom collections import deque\nimport collections\nfrom fractions import Fraction\nimport itertools\nfrom copy import deepcopy\nimport random\nimport time\nimport os\nimport queue\nimport sys\nimport datetime\nfrom functools import lru_cache\n#@lru_cache(maxsize=None)\nreadline=sys.stdin.readline\nsys.setrecursionlimit(2000000)\n#import numpy as np\nalphabet=\"abcdefghijklmnopqrstuvwxyz\"\nmod=int(10**9+7)\ninf=int(10**20)\ndef yn(b):\n if b:\n print(\"yes\")\n else:\n print(\"no\")\ndef Yn(b):\n if b:\n print(\"Yes\")\n else:\n print(\"No\")\ndef YN(b):\n if b:\n print(\"YES\")\n else:\n print(\"NO\")\nclass union_find():\n def __init__(self,n):\n self.n=n\n self.P=[a for a in range(n)]\n self.rank=[0]*n\n \n def find(self,x):\n if(x!=self.P[x]):self.P[x]=self.find(self.P[x])\n return self.P[x]\n \n def same(self,x,y):\n return self.find(x)==self.find(y)\n \n def link(self,x,y):\n if self.rank[x]>(size-a-1))&1==1:\n A[a]=1\n else:\n A[a]=0\n return A\ndef getfacs(n,mod_=0):\n A=[1]*(n+1)\n for a in range(2,len(A)):\n A[a]=A[a-1]*a\n if(mod_>0):A[a]%=mod_\n return A\ndef comb(n,r,mod,fac):\n if(n-r<0):return 0\n return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod\ndef nextcomb(num,size):\n x=num&(-num)\n y=num+x\n z=num&(~y)\n z//=x\n z=z>>1\n num=(y|z)\n if(num>=(1< 1:list_.append(n)\n if type_==\"dict\":\n dic={}\n for a in list_:\n if a in dic:\n dic[a]+=1\n else:\n dic[a]=1\n return dic\n elif type_==\"list\":\n return list_\n else:\n return None\ndef pm(x):\n return x//abs(x)\ndef inputintlist():\n return list(map(int,input().split()))\n######################################################################################################\n\nn=int(input())\nP=inputintlist()\nP=list(map(lambda x:x-1,P))\nB=[]\nfor a in range(n):\n B.append(not P[a]==a)\nans=0\nfor a in range(n-1):\n if B[a]==False:\n if B[a+1]==False:\n B[a]=True\n B[a+1]=True\n else:\n B[a]=True\n ans+=1\n\nprint(ans)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N.\nYou can perform the following operation any number of times (possibly zero):\n\nOperation: Swap two adjacent elements in the permutation.\n\nYou want to have p_i ≠ i for all 1≤i≤N.\nFind the minimum required number of operations to achieve this.\n\nConstraints\n\n2≤N≤10^5\n\np_1,p_2,..,p_N is a permutation of 1,2,..,N.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\np_1 p_2 .. p_N\n\nOutput\n\nPrint the minimum required number of operations\n\nSample Input 1\n\n5\n1 4 3 5 2\n\nSample Output 1\n\n2\n\nSwap 1 and 4, then swap 1 and 3. p is now 4,3,1,5,2 and satisfies the condition.\nThis is the minimum possible number, so the answer is 2.\n\nSample Input 2\n\n2\n1 2\n\nSample Output 2\n\n1\n\nSwapping 1 and 2 satisfies the condition.\n\nSample Input 3\n\n2\n2 1\n\nSample Output 3\n\n0\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n9\n1 2 4 9 5 8 7 3 6\n\nSample Output 4\n\n3", "sample_input": "5\n1 4 3 5 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03612", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N.\nYou can perform the following operation any number of times (possibly zero):\n\nOperation: Swap two adjacent elements in the permutation.\n\nYou want to have p_i ≠ i for all 1≤i≤N.\nFind the minimum required number of operations to achieve this.\n\nConstraints\n\n2≤N≤10^5\n\np_1,p_2,..,p_N is a permutation of 1,2,..,N.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\np_1 p_2 .. p_N\n\nOutput\n\nPrint the minimum required number of operations\n\nSample Input 1\n\n5\n1 4 3 5 2\n\nSample Output 1\n\n2\n\nSwap 1 and 4, then swap 1 and 3. p is now 4,3,1,5,2 and satisfies the condition.\nThis is the minimum possible number, so the answer is 2.\n\nSample Input 2\n\n2\n1 2\n\nSample Output 2\n\n1\n\nSwapping 1 and 2 satisfies the condition.\n\nSample Input 3\n\n2\n2 1\n\nSample Output 3\n\n0\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n9\n1 2 4 9 5 8 7 3 6\n\nSample Output 4\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3752, "cpu_time_ms": 120, "memory_kb": 17116}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s044534483", "group_id": "codeNet:p03612", "input_text": "N = int(input())\np = list(map(int, input().split()))\n\nans = 0\nfor i in range(N):\n if p[i] != i+1:\n continue\n tmp = p[i]\n p[i] = p[i+1]\n p[i+1] = tmp\n ans += 1\nprint(ans)\n", "language": "Python", "metadata": {"date": 1582842700, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03612.html", "problem_id": "p03612", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03612/input.txt", "sample_output_relpath": "derived/input_output/data/p03612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03612/Python/s044534483.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s044534483", "user_id": "u391667116"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "N = int(input())\np = list(map(int, input().split()))\n\nans = 0\nfor i in range(N):\n if p[i] != i+1:\n continue\n tmp = p[i]\n p[i] = p[i+1]\n p[i+1] = tmp\n ans += 1\nprint(ans)\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N.\nYou can perform the following operation any number of times (possibly zero):\n\nOperation: Swap two adjacent elements in the permutation.\n\nYou want to have p_i ≠ i for all 1≤i≤N.\nFind the minimum required number of operations to achieve this.\n\nConstraints\n\n2≤N≤10^5\n\np_1,p_2,..,p_N is a permutation of 1,2,..,N.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\np_1 p_2 .. p_N\n\nOutput\n\nPrint the minimum required number of operations\n\nSample Input 1\n\n5\n1 4 3 5 2\n\nSample Output 1\n\n2\n\nSwap 1 and 4, then swap 1 and 3. p is now 4,3,1,5,2 and satisfies the condition.\nThis is the minimum possible number, so the answer is 2.\n\nSample Input 2\n\n2\n1 2\n\nSample Output 2\n\n1\n\nSwapping 1 and 2 satisfies the condition.\n\nSample Input 3\n\n2\n2 1\n\nSample Output 3\n\n0\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n9\n1 2 4 9 5 8 7 3 6\n\nSample Output 4\n\n3", "sample_input": "5\n1 4 3 5 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03612", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N.\nYou can perform the following operation any number of times (possibly zero):\n\nOperation: Swap two adjacent elements in the permutation.\n\nYou want to have p_i ≠ i for all 1≤i≤N.\nFind the minimum required number of operations to achieve this.\n\nConstraints\n\n2≤N≤10^5\n\np_1,p_2,..,p_N is a permutation of 1,2,..,N.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\np_1 p_2 .. p_N\n\nOutput\n\nPrint the minimum required number of operations\n\nSample Input 1\n\n5\n1 4 3 5 2\n\nSample Output 1\n\n2\n\nSwap 1 and 4, then swap 1 and 3. p is now 4,3,1,5,2 and satisfies the condition.\nThis is the minimum possible number, so the answer is 2.\n\nSample Input 2\n\n2\n1 2\n\nSample Output 2\n\n1\n\nSwapping 1 and 2 satisfies the condition.\n\nSample Input 3\n\n2\n2 1\n\nSample Output 3\n\n0\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n9\n1 2 4 9 5 8 7 3 6\n\nSample Output 4\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 192, "cpu_time_ms": 74, "memory_kb": 13880}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s136838256", "group_id": "codeNet:p03623", "input_text": "X, A, B = [int(_) for _ in input().split()]\n\nif abs(X - A) > abs(X - B):\n print(\"B\")\nelse:\n print(\"A\")", "language": "Python", "metadata": {"date": 1544238147, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03623.html", "problem_id": "p03623", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03623/input.txt", "sample_output_relpath": "derived/input_output/data/p03623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03623/Python/s136838256.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s136838256", "user_id": "u808427016"}, "prompt_components": {"gold_output": "B\n", "input_to_evaluate": "X, A, B = [int(_) for _ in input().split()]\n\nif abs(X - A) > abs(X - B):\n print(\"B\")\nelse:\n print(\"A\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke lives at position x on a number line.\nOn this line, there are two stores A and B, respectively at position a and b, that offer food for delivery.\n\nSnuke decided to get food delivery from the closer of stores A and B.\nFind out which store is closer to Snuke's residence.\n\nHere, the distance between two points s and t on a number line is represented by |s-t|.\n\nConstraints\n\n1 \\leq x \\leq 1000\n\n1 \\leq a \\leq 1000\n\n1 \\leq b \\leq 1000\n\nx, a and b are pairwise distinct.\n\nThe distances between Snuke's residence and stores A and B are different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx a b\n\nOutput\n\nIf store A is closer, print A; if store B is closer, print B.\n\nSample Input 1\n\n5 2 7\n\nSample Output 1\n\nB\n\nThe distances between Snuke's residence and stores A and B are 3 and 2, respectively.\nSince store B is closer, print B.\n\nSample Input 2\n\n1 999 1000\n\nSample Output 2\n\nA", "sample_input": "5 2 7\n"}, "reference_outputs": ["B\n"], "source_document_id": "p03623", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke lives at position x on a number line.\nOn this line, there are two stores A and B, respectively at position a and b, that offer food for delivery.\n\nSnuke decided to get food delivery from the closer of stores A and B.\nFind out which store is closer to Snuke's residence.\n\nHere, the distance between two points s and t on a number line is represented by |s-t|.\n\nConstraints\n\n1 \\leq x \\leq 1000\n\n1 \\leq a \\leq 1000\n\n1 \\leq b \\leq 1000\n\nx, a and b are pairwise distinct.\n\nThe distances between Snuke's residence and stores A and B are different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx a b\n\nOutput\n\nIf store A is closer, print A; if store B is closer, print B.\n\nSample Input 1\n\n5 2 7\n\nSample Output 1\n\nB\n\nThe distances between Snuke's residence and stores A and B are 3 and 2, respectively.\nSince store B is closer, print B.\n\nSample Input 2\n\n1 999 1000\n\nSample Output 2\n\nA", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 108, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s879010680", "group_id": "codeNet:p03628", "input_text": "import sys\nimport numpy as np\n\nstdin = sys.stdin\n \nri = lambda: int(rs())\nrl = lambda: list(map(int, stdin.readline().split()))\nrs = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\nN = ri()\nMOD = 10 ** 9 + 7\nS1 = rs()\nS2 = rs()\ncolor = [None] * N\n\nanswer = 1\npattern = 0 #1つ前の列の色の種類\n\nfor i in range(N):\n if color[i] != None:\n continue\n if S1[i] == S2[i]:\n answer *= 3 - pattern\n pattern = 1\n else:\n answer *= [6, 2, 3][pattern]\n color[i+1] = 1\n pattern = 2\n\nprint(answer%MOD)\n#08", "language": "Python", "metadata": {"date": 1576078654, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03628.html", "problem_id": "p03628", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03628/input.txt", "sample_output_relpath": "derived/input_output/data/p03628/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03628/Python/s879010680.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s879010680", "user_id": "u600402037"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "import sys\nimport numpy as np\n\nstdin = sys.stdin\n \nri = lambda: int(rs())\nrl = lambda: list(map(int, stdin.readline().split()))\nrs = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\nN = ri()\nMOD = 10 ** 9 + 7\nS1 = rs()\nS2 = rs()\ncolor = [None] * N\n\nanswer = 1\npattern = 0 #1つ前の列の色の種類\n\nfor i in range(N):\n if color[i] != None:\n continue\n if S1[i] == S2[i]:\n answer *= 3 - pattern\n pattern = 1\n else:\n answer *= [6, 2, 3][pattern]\n color[i+1] = 1\n pattern = 2\n\nprint(answer%MOD)\n#08", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a board with a 2 \\times N grid.\nSnuke covered the board with N dominoes without overlaps.\nHere, a domino can cover a 1 \\times 2 or 2 \\times 1 square.\n\nThen, Snuke decided to paint these dominoes using three colors: red, cyan and green.\nTwo dominoes that are adjacent by side should be painted by different colors.\nHere, it is not always necessary to use all three colors.\n\nFind the number of such ways to paint the dominoes, modulo 1000000007.\n\nThe arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner:\n\nEach domino is represented by a different English letter (lowercase or uppercase).\n\nThe j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left.\n\nConstraints\n\n1 \\leq N \\leq 52\n\n|S_1| = |S_2| = N\n\nS_1 and S_2 consist of lowercase and uppercase English letters.\n\nS_1 and S_2 represent a valid arrangement of dominoes.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\nS_2\n\nOutput\n\nPrint the number of such ways to paint the dominoes, modulo 1000000007.\n\nSample Input 1\n\n3\naab\nccb\n\nSample Output 1\n\n6\n\nThere are six ways as shown below:\n\nSample Input 2\n\n1\nZ\nZ\n\nSample Output 2\n\n3\n\nNote that it is not always necessary to use all the colors.\n\nSample Input 3\n\n52\nRvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn\nRLLwwdWIxxNNQUUXXVVMMooBBaggDKqcimmeYrhAljOOTTJuuzzn\n\nSample Output 3\n\n958681902", "sample_input": "3\naab\nccb\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03628", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a board with a 2 \\times N grid.\nSnuke covered the board with N dominoes without overlaps.\nHere, a domino can cover a 1 \\times 2 or 2 \\times 1 square.\n\nThen, Snuke decided to paint these dominoes using three colors: red, cyan and green.\nTwo dominoes that are adjacent by side should be painted by different colors.\nHere, it is not always necessary to use all three colors.\n\nFind the number of such ways to paint the dominoes, modulo 1000000007.\n\nThe arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner:\n\nEach domino is represented by a different English letter (lowercase or uppercase).\n\nThe j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left.\n\nConstraints\n\n1 \\leq N \\leq 52\n\n|S_1| = |S_2| = N\n\nS_1 and S_2 consist of lowercase and uppercase English letters.\n\nS_1 and S_2 represent a valid arrangement of dominoes.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\nS_2\n\nOutput\n\nPrint the number of such ways to paint the dominoes, modulo 1000000007.\n\nSample Input 1\n\n3\naab\nccb\n\nSample Output 1\n\n6\n\nThere are six ways as shown below:\n\nSample Input 2\n\n1\nZ\nZ\n\nSample Output 2\n\n3\n\nNote that it is not always necessary to use all the colors.\n\nSample Input 3\n\n52\nRvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn\nRLLwwdWIxxNNQUUXXVVMMooBBaggDKqcimmeYrhAljOOTTJuuzzn\n\nSample Output 3\n\n958681902", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 563, "cpu_time_ms": 147, "memory_kb": 12508}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s683485144", "group_id": "codeNet:p03632", "input_text": "import sys\nimport math\nimport collections\nimport itertools\nimport array\nimport inspect\n\n# Set max recursion limit\nsys.setrecursionlimit(10000)\n\n\n# Debug output\ndef chkprint(*args):\n names = {\n id(v): k\n for k, v in inspect.currentframe().f_back.f_locals.items()\n }\n print(', '.join(\n names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))\n\n\n# Binary converter\ndef to_bin(x):\n return bin(x)[2:]\n\n\ndef li_input():\n return [int(_) for _ in input().split()]\n\n\n# --------------------------------------------\n\ndp = None\n\n\ndef main():\n A, B, C, D = li_input()\n L = [0] * 101\n\n for i in range(101):\n if A <= i < B:\n L[i] += 1\n\n if C <= i < D:\n L[i] += 1\n\n ans = 0\n\n for l in L:\n if l == 2:\n ans += 1\n\n print(ans)\n\n\nmain()\n", "language": "Python", "metadata": {"date": 1534864398, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03632.html", "problem_id": "p03632", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03632/input.txt", "sample_output_relpath": "derived/input_output/data/p03632/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03632/Python/s683485144.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s683485144", "user_id": "u255280439"}, "prompt_components": {"gold_output": "50\n", "input_to_evaluate": "import sys\nimport math\nimport collections\nimport itertools\nimport array\nimport inspect\n\n# Set max recursion limit\nsys.setrecursionlimit(10000)\n\n\n# Debug output\ndef chkprint(*args):\n names = {\n id(v): k\n for k, v in inspect.currentframe().f_back.f_locals.items()\n }\n print(', '.join(\n names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))\n\n\n# Binary converter\ndef to_bin(x):\n return bin(x)[2:]\n\n\ndef li_input():\n return [int(_) for _ in input().split()]\n\n\n# --------------------------------------------\n\ndp = None\n\n\ndef main():\n A, B, C, D = li_input()\n L = [0] * 101\n\n for i in range(101):\n if A <= i < B:\n L[i] += 1\n\n if C <= i < D:\n L[i] += 1\n\n ans = 0\n\n for l in L:\n if l == 2:\n ans += 1\n\n print(ans)\n\n\nmain()\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nAlice and Bob are controlling a robot. They each have one switch that controls the robot.\n\nAlice started holding down her button A second after the start-up of the robot, and released her button B second after the start-up.\n\nBob started holding down his button C second after the start-up, and released his button D second after the start-up.\n\nFor how many seconds both Alice and Bob were holding down their buttons?\n\nConstraints\n\n0≤A 0):\n if(inc):\n if(r <= h - 1):\n ans[r].append(i + 1)\n r += 1\n else:\n r = h - 1\n ans[r].append(i + 1)\n r -= 1\n inc = False\n else:\n if(r >= 0):\n ans[r].append(i + 1)\n r -= 1\n else:\n r = 0\n ans[r].append(i + 1)\n r += 1\n inc = True\n a[i] -= 1\nfor x in ans:\n for i in x:\n print(i, end = \" \")\n print()", "language": "Python", "metadata": {"date": 1586861271, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03638.html", "problem_id": "p03638", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03638/input.txt", "sample_output_relpath": "derived/input_output/data/p03638/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03638/Python/s214720789.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s214720789", "user_id": "u626595726"}, "prompt_components": {"gold_output": "1 1\n2 3\n", "input_to_evaluate": "h, w = map(int, input().split())\nn = int(input())\na = list(map(int, input().split()))\nans = [[] for i in range(h)]\ninc = True\nr = 0\nfor i in range(n):\n while(a[i] > 0):\n if(inc):\n if(r <= h - 1):\n ans[r].append(i + 1)\n r += 1\n else:\n r = h - 1\n ans[r].append(i + 1)\n r -= 1\n inc = False\n else:\n if(r >= 0):\n ans[r].append(i + 1)\n r -= 1\n else:\n r = 0\n ans[r].append(i + 1)\n r += 1\n inc = True\n a[i] -= 1\nfor x in ans:\n for i in x:\n print(i, end = \" \")\n print()", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns of squares.\nSnuke is painting these squares in colors 1, 2, ..., N.\nHere, the following conditions should be satisfied:\n\nFor each i (1 ≤ i ≤ N), there are exactly a_i squares painted in Color i. Here, a_1 + a_2 + ... + a_N = H W.\n\nFor each i (1 ≤ i ≤ N), the squares painted in Color i are 4-connected. That is, every square painted in Color i can be reached from every square painted in Color i by repeatedly traveling to a horizontally or vertically adjacent square painted in Color i.\n\nFind a way to paint the squares so that the conditions are satisfied.\nIt can be shown that a solution always exists.\n\nConstraints\n\n1 ≤ H, W ≤ 100\n\n1 ≤ N ≤ H W\n\na_i ≥ 1\n\na_1 + a_2 + ... + a_N = H W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint one way to paint the squares that satisfies the conditions.\nOutput in the following format:\n\nc_{1 1} ... c_{1 W}\n:\nc_{H 1} ... c_{H W}\n\nHere, c_{i j} is the color of the square at the i-th row from the top and j-th column from the left.\n\nSample Input 1\n\n2 2\n3\n2 1 1\n\nSample Output 1\n\n1 1\n2 3\n\nBelow is an example of an invalid solution:\n\n1 2\n3 1\n\nThis is because the squares painted in Color 1 are not 4-connected.\n\nSample Input 2\n\n3 5\n5\n1 2 3 4 5\n\nSample Output 2\n\n1 4 4 4 3\n2 5 4 5 3\n2 5 5 5 3\n\nSample Input 3\n\n1 1\n1\n1\n\nSample Output 3\n\n1", "sample_input": "2 2\n3\n2 1 1\n"}, "reference_outputs": ["1 1\n2 3\n"], "source_document_id": "p03638", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns of squares.\nSnuke is painting these squares in colors 1, 2, ..., N.\nHere, the following conditions should be satisfied:\n\nFor each i (1 ≤ i ≤ N), there are exactly a_i squares painted in Color i. Here, a_1 + a_2 + ... + a_N = H W.\n\nFor each i (1 ≤ i ≤ N), the squares painted in Color i are 4-connected. That is, every square painted in Color i can be reached from every square painted in Color i by repeatedly traveling to a horizontally or vertically adjacent square painted in Color i.\n\nFind a way to paint the squares so that the conditions are satisfied.\nIt can be shown that a solution always exists.\n\nConstraints\n\n1 ≤ H, W ≤ 100\n\n1 ≤ N ≤ H W\n\na_i ≥ 1\n\na_1 + a_2 + ... + a_N = H W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint one way to paint the squares that satisfies the conditions.\nOutput in the following format:\n\nc_{1 1} ... c_{1 W}\n:\nc_{H 1} ... c_{H W}\n\nHere, c_{i j} is the color of the square at the i-th row from the top and j-th column from the left.\n\nSample Input 1\n\n2 2\n3\n2 1 1\n\nSample Output 1\n\n1 1\n2 3\n\nBelow is an example of an invalid solution:\n\n1 2\n3 1\n\nThis is because the squares painted in Color 1 are not 4-connected.\n\nSample Input 2\n\n3 5\n5\n1 2 3 4 5\n\nSample Output 2\n\n1 4 4 4 3\n2 5 4 5 3\n2 5 5 5 3\n\nSample Input 3\n\n1 1\n1\n1\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 721, "cpu_time_ms": 35, "memory_kb": 3828}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s905322495", "group_id": "codeNet:p03641", "input_text": "from collections import defaultdict, deque, Counter\nfrom heapq import heappush, heappop, heapify\nimport math\nimport bisect\nimport random\nfrom itertools import permutations, accumulate, combinations, product\nimport sys\nfrom pprint import pprint\nfrom copy import deepcopy\nimport string\nfrom bisect import bisect_left, bisect_right\nfrom math import factorial, ceil, floor\nfrom operator import mul\nfrom functools import reduce\nfrom pprint import pprint\n\n\nsys.setrecursionlimit(2147483647)\nINF = 10 ** 20\ndef LI(): return list(map(int, sys.stdin.buffer.readline().split()))\ndef I(): return int(sys.stdin.buffer.readline())\ndef LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()\ndef S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')\ndef IR(n): return [I() for i in range(n)]\ndef LIR(n): return [LI() for i in range(n)]\ndef SR(n): return [S() for i in range(n)]\ndef LSR(n): return [LS() for i in range(n)]\ndef SRL(n): return [list(S()) for i in range(n)]\ndef MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]\nmod = 1000000007\n\n\nclass Segtree:\n def __init__(self, A, ide_ele, segfunc, initialize=True):\n self.n = len(A)\n self.size = 2 ** (self.n - 1).bit_length()\n self.ide_ele = ide_ele\n self.segfunc = segfunc\n if initialize:\n self.data = [ide_ele] * self.size + A + [ide_ele] * (self.size - self.n)\n for i in range(self.size - 1, 0, -1):\n self.data[i] = self.segfunc(self.data[2 * i], self.data[2 * i + 1])\n else:\n self.data = [ide_ele] * (2 * self.size)\n\n def update(self, k, x):\n k += self.size\n self.data[k] = x\n while k > 0:\n k = k >> 1\n self.data[k] = self.segfunc(self.data[2 * k], self.data[2 * k + 1])\n\n def query(self, l, r):\n L, R = l + self.size, r + self.size\n s = self.ide_ele\n while L < R:\n if R & 1:\n R -= 1\n s = self.segfunc(s, self.data[R])\n if L & 1:\n s = self.segfunc(s, self.data[L])\n L += 1\n L >>= 1\n R >>= 1\n return s\n\nn = I()\nP = LI()\nD = {P[i]: i for i in range(n)}\np_even = [P[i] if not i & 1 else INF for i in range(n)]\np_odd = [P[i] if i & 1 else INF for i in range(n)]\nst_even = Segtree(p_even, INF, min)\nst_odd = Segtree(p_odd, INF, min)\nhq = [(st_even.query(0, n), 0, n)]\nans = []\nfor i in range(n // 2):\n v1, l, r = heappop(hq)\n p1 = D[v1]\n if not l & 1:\n st1, st2 = st_odd, st_even\n else:\n st1, st2 = st_even, st_odd\n v2 = st1.query(p1, r)\n p2 = D[v2]\n st2.update(p1, INF)\n st1.update(p2, INF)\n if l != p1:\n heappush(hq, (st2.query(l, p1), l, p1))\n if p1 + 1 != p2:\n heappush(hq, (st1.query(p1 + 1, p2), p1 + 1, p2))\n if p2 + 1 != r:\n heappush(hq, (st2.query(p2 + 1, r), p2 + 1, r))\n ans += [v1, v2]\n\n\nprint(*ans)\n\n\n", "language": "Python", "metadata": {"date": 1577041792, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03641.html", "problem_id": "p03641", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03641/input.txt", "sample_output_relpath": "derived/input_output/data/p03641/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03641/Python/s905322495.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s905322495", "user_id": "u499381410"}, "prompt_components": {"gold_output": "3 1 2 4\n", "input_to_evaluate": "from collections import defaultdict, deque, Counter\nfrom heapq import heappush, heappop, heapify\nimport math\nimport bisect\nimport random\nfrom itertools import permutations, accumulate, combinations, product\nimport sys\nfrom pprint import pprint\nfrom copy import deepcopy\nimport string\nfrom bisect import bisect_left, bisect_right\nfrom math import factorial, ceil, floor\nfrom operator import mul\nfrom functools import reduce\nfrom pprint import pprint\n\n\nsys.setrecursionlimit(2147483647)\nINF = 10 ** 20\ndef LI(): return list(map(int, sys.stdin.buffer.readline().split()))\ndef I(): return int(sys.stdin.buffer.readline())\ndef LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()\ndef S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')\ndef IR(n): return [I() for i in range(n)]\ndef LIR(n): return [LI() for i in range(n)]\ndef SR(n): return [S() for i in range(n)]\ndef LSR(n): return [LS() for i in range(n)]\ndef SRL(n): return [list(S()) for i in range(n)]\ndef MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]\nmod = 1000000007\n\n\nclass Segtree:\n def __init__(self, A, ide_ele, segfunc, initialize=True):\n self.n = len(A)\n self.size = 2 ** (self.n - 1).bit_length()\n self.ide_ele = ide_ele\n self.segfunc = segfunc\n if initialize:\n self.data = [ide_ele] * self.size + A + [ide_ele] * (self.size - self.n)\n for i in range(self.size - 1, 0, -1):\n self.data[i] = self.segfunc(self.data[2 * i], self.data[2 * i + 1])\n else:\n self.data = [ide_ele] * (2 * self.size)\n\n def update(self, k, x):\n k += self.size\n self.data[k] = x\n while k > 0:\n k = k >> 1\n self.data[k] = self.segfunc(self.data[2 * k], self.data[2 * k + 1])\n\n def query(self, l, r):\n L, R = l + self.size, r + self.size\n s = self.ide_ele\n while L < R:\n if R & 1:\n R -= 1\n s = self.segfunc(s, self.data[R])\n if L & 1:\n s = self.segfunc(s, self.data[L])\n L += 1\n L >>= 1\n R >>= 1\n return s\n\nn = I()\nP = LI()\nD = {P[i]: i for i in range(n)}\np_even = [P[i] if not i & 1 else INF for i in range(n)]\np_odd = [P[i] if i & 1 else INF for i in range(n)]\nst_even = Segtree(p_even, INF, min)\nst_odd = Segtree(p_odd, INF, min)\nhq = [(st_even.query(0, n), 0, n)]\nans = []\nfor i in range(n // 2):\n v1, l, r = heappop(hq)\n p1 = D[v1]\n if not l & 1:\n st1, st2 = st_odd, st_even\n else:\n st1, st2 = st_even, st_odd\n v2 = st1.query(p1, r)\n p2 = D[v2]\n st2.update(p1, INF)\n st1.update(p2, INF)\n if l != p1:\n heappush(hq, (st2.query(l, p1), l, p1))\n if p1 + 1 != p2:\n heappush(hq, (st1.query(p1 + 1, p2), p1 + 1, p2))\n if p2 + 1 != r:\n heappush(hq, (st2.query(p2 + 1, r), p2 + 1, r))\n ans += [v1, v2]\n\n\nprint(*ans)\n\n\n", "problem_context": "Score : 800 points\n\nProblem Statement\n\nLet N be a positive even number.\n\nWe have a permutation of (1, 2, ..., N), p = (p_1, p_2, ..., p_N).\nSnuke is constructing another permutation of (1, 2, ..., N), q, following the procedure below.\n\nFirst, let q be an empty sequence.\nThen, perform the following operation until p becomes empty:\n\nSelect two adjacent elements in p, and call them x and y in order. Remove x and y from p (reducing the length of p by 2), and insert x and y, preserving the original order, at the beginning of q.\n\nWhen p becomes empty, q will be a permutation of (1, 2, ..., N).\n\nFind the lexicographically smallest permutation that can be obtained as q.\n\nConstraints\n\nN is an even number.\n\n2 ≤ N ≤ 2 × 10^5\n\np is a permutation of (1, 2, ..., N).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\np_1 p_2 ... p_N\n\nOutput\n\nPrint the lexicographically smallest permutation, with spaces in between.\n\nSample Input 1\n\n4\n3 2 4 1\n\nSample Output 1\n\n3 1 2 4\n\nThe solution above is obtained as follows:\n\np\n\nq\n\n(3, 2, 4, 1)\n\n()\n\n↓\n\n↓\n\n(3, 1)\n\n(2, 4)\n\n↓\n\n↓\n\n()\n\n(3, 1, 2, 4)\n\nSample Input 2\n\n2\n1 2\n\nSample Output 2\n\n1 2\n\nSample Input 3\n\n8\n4 6 3 2 8 5 7 1\n\nSample Output 3\n\n3 1 2 7 4 6 8 5\n\nThe solution above is obtained as follows:\n\np\n\nq\n\n(4, 6, 3, 2, 8, 5, 7, 1)\n\n()\n\n↓\n\n↓\n\n(4, 6, 3, 2, 7, 1)\n\n(8, 5)\n\n↓\n\n↓\n\n(3, 2, 7, 1)\n\n(4, 6, 8, 5)\n\n↓\n\n↓\n\n(3, 1)\n\n(2, 7, 4, 6, 8, 5)\n\n↓\n\n↓\n\n()\n\n(3, 1, 2, 7, 4, 6, 8, 5)", "sample_input": "4\n3 2 4 1\n"}, "reference_outputs": ["3 1 2 4\n"], "source_document_id": "p03641", "source_text": "Score : 800 points\n\nProblem Statement\n\nLet N be a positive even number.\n\nWe have a permutation of (1, 2, ..., N), p = (p_1, p_2, ..., p_N).\nSnuke is constructing another permutation of (1, 2, ..., N), q, following the procedure below.\n\nFirst, let q be an empty sequence.\nThen, perform the following operation until p becomes empty:\n\nSelect two adjacent elements in p, and call them x and y in order. Remove x and y from p (reducing the length of p by 2), and insert x and y, preserving the original order, at the beginning of q.\n\nWhen p becomes empty, q will be a permutation of (1, 2, ..., N).\n\nFind the lexicographically smallest permutation that can be obtained as q.\n\nConstraints\n\nN is an even number.\n\n2 ≤ N ≤ 2 × 10^5\n\np is a permutation of (1, 2, ..., N).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\np_1 p_2 ... p_N\n\nOutput\n\nPrint the lexicographically smallest permutation, with spaces in between.\n\nSample Input 1\n\n4\n3 2 4 1\n\nSample Output 1\n\n3 1 2 4\n\nThe solution above is obtained as follows:\n\np\n\nq\n\n(3, 2, 4, 1)\n\n()\n\n↓\n\n↓\n\n(3, 1)\n\n(2, 4)\n\n↓\n\n↓\n\n()\n\n(3, 1, 2, 4)\n\nSample Input 2\n\n2\n1 2\n\nSample Output 2\n\n1 2\n\nSample Input 3\n\n8\n4 6 3 2 8 5 7 1\n\nSample Output 3\n\n3 1 2 7 4 6 8 5\n\nThe solution above is obtained as follows:\n\np\n\nq\n\n(4, 6, 3, 2, 8, 5, 7, 1)\n\n()\n\n↓\n\n↓\n\n(4, 6, 3, 2, 7, 1)\n\n(8, 5)\n\n↓\n\n↓\n\n(3, 2, 7, 1)\n\n(4, 6, 8, 5)\n\n↓\n\n↓\n\n(3, 1)\n\n(2, 7, 4, 6, 8, 5)\n\n↓\n\n↓\n\n()\n\n(3, 1, 2, 7, 4, 6, 8, 5)", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2940, "cpu_time_ms": 2111, "memory_kb": 129692}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s464836793", "group_id": "codeNet:p03643", "input_text": "\ndef resolve():\n n = input()\n print(\"ABC\"+n)\n\n\nif '__main__' == __name__:\n resolve()", "language": "Python", "metadata": {"date": 1587829928, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03643.html", "problem_id": "p03643", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03643/input.txt", "sample_output_relpath": "derived/input_output/data/p03643/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03643/Python/s464836793.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s464836793", "user_id": "u106797249"}, "prompt_components": {"gold_output": "ABC100\n", "input_to_evaluate": "\ndef resolve():\n n = input()\n print(\"ABC\"+n)\n\n\nif '__main__' == __name__:\n resolve()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThis contest, AtCoder Beginner Contest, is abbreviated as ABC.\n\nWhen we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC.\n\nWhat is the abbreviation for the N-th round of ABC? Write a program to output the answer.\n\nConstraints\n\n100 ≤ N ≤ 999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the abbreviation for the N-th round of ABC.\n\nSample Input 1\n\n100\n\nSample Output 1\n\nABC100\n\nThe 100th round of ABC is ABC100.\n\nSample Input 2\n\n425\n\nSample Output 2\n\nABC425\n\nSample Input 3\n\n999\n\nSample Output 3\n\nABC999", "sample_input": "100\n"}, "reference_outputs": ["ABC100\n"], "source_document_id": "p03643", "source_text": "Score : 100 points\n\nProblem Statement\n\nThis contest, AtCoder Beginner Contest, is abbreviated as ABC.\n\nWhen we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC.\n\nWhat is the abbreviation for the N-th round of ABC? Write a program to output the answer.\n\nConstraints\n\n100 ≤ N ≤ 999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the abbreviation for the N-th round of ABC.\n\nSample Input 1\n\n100\n\nSample Output 1\n\nABC100\n\nThe 100th round of ABC is ABC100.\n\nSample Input 2\n\n425\n\nSample Output 2\n\nABC425\n\nSample Input 3\n\n999\n\nSample Output 3\n\nABC999", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 93, "cpu_time_ms": 181, "memory_kb": 38256}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s140171153", "group_id": "codeNet:p03644", "input_text": "# 入力\nN = int(input())\ncount_list = []\n# 計算\nfor i in range(N):\n r = i + 1\n count = 0\n while r % 2 == 0:\n r = r / 2\n count += 1\n else:\n count += 0\n count_list.append(count)\n\nM = max(count_list)\nl = count_list.index(M)\nprint(l + 1)\n\n\n\n", "language": "Python", "metadata": {"date": 1568372917, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03644.html", "problem_id": "p03644", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03644/input.txt", "sample_output_relpath": "derived/input_output/data/p03644/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03644/Python/s140171153.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s140171153", "user_id": "u852367841"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "# 入力\nN = int(input())\ncount_list = []\n# 計算\nfor i in range(N):\n r = i + 1\n count = 0\n while r % 2 == 0:\n r = r / 2\n count += 1\n else:\n count += 0\n count_list.append(count)\n\nM = max(count_list)\nl = count_list.index(M)\nprint(l + 1)\n\n\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi loves numbers divisible by 2.\n\nYou are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique.\n\nHere, the number of times an integer can be divisible by 2, is how many times the integer can be divided by 2 without remainder.\n\nFor example,\n\n6 can be divided by 2 once: 6 -> 3.\n\n8 can be divided by 2 three times: 8 -> 4 -> 2 -> 1.\n\n3 can be divided by 2 zero times.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n4\n\n4 can be divided by 2 twice, which is the most number of times among 1, 2, ..., 7.\n\nSample Input 2\n\n32\n\nSample Output 2\n\n32\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1\n\nSample Input 4\n\n100\n\nSample Output 4\n\n64", "sample_input": "7\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03644", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi loves numbers divisible by 2.\n\nYou are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique.\n\nHere, the number of times an integer can be divisible by 2, is how many times the integer can be divided by 2 without remainder.\n\nFor example,\n\n6 can be divided by 2 once: 6 -> 3.\n\n8 can be divided by 2 three times: 8 -> 4 -> 2 -> 1.\n\n3 can be divided by 2 zero times.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n4\n\n4 can be divided by 2 twice, which is the most number of times among 1, 2, ..., 7.\n\nSample Input 2\n\n32\n\nSample Output 2\n\n32\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1\n\nSample Input 4\n\n100\n\nSample Output 4\n\n64", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 276, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s351960368", "group_id": "codeNet:p03645", "input_text": "N,M=map(int,input().split())\nA=[list(map(int,input().split())) for i in range(M)]\nD=[[]for i in range(N)]\nfor i in range(M):\n D[A[i][0]-1].append(A[i][1]-1)\n D[A[i][1]-1].append(A[i][0]-1)\na=len(D[-1])\nb=len(D[0])\nc=len(set(D[-1]+D[0]))\nif a+b==c:\n print('IMPOSSIBLE')\nelse:\n print('POSSIBLE')", "language": "Python", "metadata": {"date": 1580508033, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03645.html", "problem_id": "p03645", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03645/input.txt", "sample_output_relpath": "derived/input_output/data/p03645/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03645/Python/s351960368.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s351960368", "user_id": "u572142121"}, "prompt_components": {"gold_output": "POSSIBLE\n", "input_to_evaluate": "N,M=map(int,input().split())\nA=[list(map(int,input().split())) for i in range(M)]\nD=[[]for i in range(N)]\nfor i in range(M):\n D[A[i][0]-1].append(A[i][1]-1)\n D[A[i][1]-1].append(A[i][0]-1)\na=len(D[-1])\nb=len(D[0])\nc=len(set(D[-1]+D[0]))\nif a+b==c:\n print('IMPOSSIBLE')\nelse:\n print('POSSIBLE')", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "sample_input": "3 2\n1 2\n2 3\n"}, "reference_outputs": ["POSSIBLE\n"], "source_document_id": "p03645", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 297, "cpu_time_ms": 993, "memory_kb": 87952}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s599975202", "group_id": "codeNet:p03645", "input_text": "N , M = map(int, input().split())\n\nL=[[0]*2 for i in range(M)]\n\nfor i in range(M):\n L[i][0] , L[i][1] = map(int, input().split())\n\nA=[10**10]*M\nB=[10**10]*M\n\nL=sorted(L ,key=lambda x: x[0])\n\nfor i in range(M):\n if L[i][0] == 1:\n A[i]=L[i][1]\n else:\n break\n\nL=sorted(L ,key=lambda x: -x[1])\n\nfor i in range(M):\n if L[i][1] == N:\n B[i]=L[i][0]\n else:\n break\n\nfor i in A:\n for j in B:\n if i == j:\n print(\"POSSIBLE\")\n exit()\n if j == 10**10 : break\n if i == 10**10 : \n print(\"IMPOSSIBLE\")\n exit()\n", "language": "Python", "metadata": {"date": 1573086082, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03645.html", "problem_id": "p03645", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03645/input.txt", "sample_output_relpath": "derived/input_output/data/p03645/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03645/Python/s599975202.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s599975202", "user_id": "u311636831"}, "prompt_components": {"gold_output": "POSSIBLE\n", "input_to_evaluate": "N , M = map(int, input().split())\n\nL=[[0]*2 for i in range(M)]\n\nfor i in range(M):\n L[i][0] , L[i][1] = map(int, input().split())\n\nA=[10**10]*M\nB=[10**10]*M\n\nL=sorted(L ,key=lambda x: x[0])\n\nfor i in range(M):\n if L[i][0] == 1:\n A[i]=L[i][1]\n else:\n break\n\nL=sorted(L ,key=lambda x: -x[1])\n\nfor i in range(M):\n if L[i][1] == N:\n B[i]=L[i][0]\n else:\n break\n\nfor i in A:\n for j in B:\n if i == j:\n print(\"POSSIBLE\")\n exit()\n if j == 10**10 : break\n if i == 10**10 : \n print(\"IMPOSSIBLE\")\n exit()\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "sample_input": "3 2\n1 2\n2 3\n"}, "reference_outputs": ["POSSIBLE\n"], "source_document_id": "p03645", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 592, "cpu_time_ms": 2106, "memory_kb": 50368}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s330940279", "group_id": "codeNet:p03645", "input_text": "# -*- coding: utf-8 -*-\n\nN, M = map(int, raw_input().split())\nline = [] # 定期便\nfor i in range(M):\n a, b = map(int, raw_input().split())\n line.append([a, b])\nline.sort()\n\nfor l in line:\n if l[0] > 1:\n break\n else:\n for k in line:\n if k[0] == l[1] and k[1] == N:\n print 'POSSIBLE'\n exit()\n\nprint 'IMPOSSIBLE'\n", "language": "Python", "metadata": {"date": 1502187184, "filename_ext": "py", "original_language": "Python (2.7.6)", "problem_description_relpath": "problem_descriptions/p03645.html", "problem_id": "p03645", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03645/input.txt", "sample_output_relpath": "derived/input_output/data/p03645/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03645/Python/s330940279.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s330940279", "user_id": "u417735024"}, "prompt_components": {"gold_output": "POSSIBLE\n", "input_to_evaluate": "# -*- coding: utf-8 -*-\n\nN, M = map(int, raw_input().split())\nline = [] # 定期便\nfor i in range(M):\n a, b = map(int, raw_input().split())\n line.append([a, b])\nline.sort()\n\nfor l in line:\n if l[0] > 1:\n break\n else:\n for k in line:\n if k[0] == l[1] and k[1] == N:\n print 'POSSIBLE'\n exit()\n\nprint 'IMPOSSIBLE'\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "sample_input": "3 2\n1 2\n2 3\n"}, "reference_outputs": ["POSSIBLE\n"], "source_document_id": "p03645", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 381, "cpu_time_ms": 2106, "memory_kb": 40580}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s476222897", "group_id": "codeNet:p03651", "input_text": "# 2019/08/15\n\nfrom fractions import gcd\n\nn,k=map(int,input().split())\na=list(map(int,input().split()))\nans='POSSIBLE'\nmax_a=max(a)\nif max_a==k:\n print(ans)\n exit()\nelif max_a=i-1:\n t-=c(p,i-1)\n print(t%pr)\nprint(1)", "language": "Python", "metadata": {"date": 1584668060, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03674.html", "problem_id": "p03674", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03674/input.txt", "sample_output_relpath": "derived/input_output/data/p03674/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03674/Python/s236942279.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s236942279", "user_id": "u187516587"}, "prompt_components": {"gold_output": "3\n5\n4\n1\n", "input_to_evaluate": "n=int(input())\na=list(map(int,input().split()))\nl=[None]*(n+1)\nfor i in range(n+1):\n if l[a[i]]==None:\n l[a[i]]=i\n else:\n p=l[a[i]]+n-i\n break\npr=10**9+7\nprint(n)\nMAX_NUM = 10**5 + 2\nfac = [0 for _ in range(MAX_NUM)]\nfinv = [0 for _ in range(MAX_NUM)]\ninv = [0 for _ in range(MAX_NUM)]\nfac[0] = fac[1] = 1\nfinv[0] = finv[1] = 1\ninv[1] = 1\nfor i in range(2,MAX_NUM):\n fac[i] = fac[i-1] * i % pr\n inv[i] = pr - inv[pr%i] * (pr // i) % pr\n finv[i] = finv[i-1] * inv[i] % pr\ndef c(n,k):\n if n < k:\n return 0\n if n < 0 or k < 0:\n return 0\n return fac[n] * (finv[k] * finv[n-k] % pr) % pr\nfor i in range(2,n+1):\n t=c(n+1,i)\n if p>=i-1:\n t-=c(p,i-1)\n print(t%pr)\nprint(1)", "problem_context": "Score : 600 points\n\nProblem Statement\n\nYou are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n.\nIt is known that each of the n integers 1,...,n appears at least once in this sequence.\n\nFor each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given sequence with length k, modulo 10^9+7.\n\nNotes\n\nIf the contents of two subsequences are the same, they are not separately counted even if they originate from different positions in the original sequence.\n\nA subsequence of a sequence a with length k is a sequence obtained by selecting k of the elements of a and arranging them without changing their relative order. For example, the sequences 1,3,5 and 1,2,3 are subsequences of 1,2,3,4,5, while 3,1,2 and 1,10,100 are not.\n\nConstraints\n\n1 \\leq n \\leq 10^5\n\n1 \\leq a_i \\leq n\n\nEach of the integers 1,...,n appears in the sequence.\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_{n+1}\n\nOutput\n\nPrint n+1 lines.\nThe k-th line should contain the number of the different subsequences of the given sequence with length k, modulo 10^9+7.\n\nSample Input 1\n\n3\n1 2 1 3\n\nSample Output 1\n\n3\n5\n4\n1\n\nThere are three subsequences with length 1: 1 and 2 and 3.\n\nThere are five subsequences with length 2: 1,1 and 1,2 and 1,3 and 2,1 and 2,3.\n\nThere are four subsequences with length 3: 1,1,3 and 1,2,1 and 1,2,3 and 2,1,3.\n\nThere is one subsequence with length 4: 1,2,1,3.\n\nSample Input 2\n\n1\n1 1\n\nSample Output 2\n\n1\n1\n\nThere is one subsequence with length 1: 1.\n\nThere is one subsequence with length 2: 1,1.\n\nSample Input 3\n\n32\n29 19 7 10 26 32 27 4 11 20 2 8 16 23 5 14 6 12 17 22 18 30 28 24 15 1 25 3 13 21 19 31 9\n\nSample Output 3\n\n32\n525\n5453\n40919\n237336\n1107568\n4272048\n13884156\n38567100\n92561040\n193536720\n354817320\n573166440\n818809200\n37158313\n166803103\n166803103\n37158313\n818809200\n573166440\n354817320\n193536720\n92561040\n38567100\n13884156\n4272048\n1107568\n237336\n40920\n5456\n528\n33\n1\n\nBe sure to print the numbers modulo 10^9+7.", "sample_input": "3\n1 2 1 3\n"}, "reference_outputs": ["3\n5\n4\n1\n"], "source_document_id": "p03674", "source_text": "Score : 600 points\n\nProblem Statement\n\nYou are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n.\nIt is known that each of the n integers 1,...,n appears at least once in this sequence.\n\nFor each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given sequence with length k, modulo 10^9+7.\n\nNotes\n\nIf the contents of two subsequences are the same, they are not separately counted even if they originate from different positions in the original sequence.\n\nA subsequence of a sequence a with length k is a sequence obtained by selecting k of the elements of a and arranging them without changing their relative order. For example, the sequences 1,3,5 and 1,2,3 are subsequences of 1,2,3,4,5, while 3,1,2 and 1,10,100 are not.\n\nConstraints\n\n1 \\leq n \\leq 10^5\n\n1 \\leq a_i \\leq n\n\nEach of the integers 1,...,n appears in the sequence.\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_{n+1}\n\nOutput\n\nPrint n+1 lines.\nThe k-th line should contain the number of the different subsequences of the given sequence with length k, modulo 10^9+7.\n\nSample Input 1\n\n3\n1 2 1 3\n\nSample Output 1\n\n3\n5\n4\n1\n\nThere are three subsequences with length 1: 1 and 2 and 3.\n\nThere are five subsequences with length 2: 1,1 and 1,2 and 1,3 and 2,1 and 2,3.\n\nThere are four subsequences with length 3: 1,1,3 and 1,2,1 and 1,2,3 and 2,1,3.\n\nThere is one subsequence with length 4: 1,2,1,3.\n\nSample Input 2\n\n1\n1 1\n\nSample Output 2\n\n1\n1\n\nThere is one subsequence with length 1: 1.\n\nThere is one subsequence with length 2: 1,1.\n\nSample Input 3\n\n32\n29 19 7 10 26 32 27 4 11 20 2 8 16 23 5 14 6 12 17 22 18 30 28 24 15 1 25 3 13 21 19 31 9\n\nSample Output 3\n\n32\n525\n5453\n40919\n237336\n1107568\n4272048\n13884156\n38567100\n92561040\n193536720\n354817320\n573166440\n818809200\n37158313\n166803103\n166803103\n37158313\n818809200\n573166440\n354817320\n193536720\n92561040\n38567100\n13884156\n4272048\n1107568\n237336\n40920\n5456\n528\n33\n1\n\nBe sure to print the numbers modulo 10^9+7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 742, "cpu_time_ms": 393, "memory_kb": 24400}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s211634978", "group_id": "codeNet:p03674", "input_text": "#066-D\nfrom collections import Counter\nn=int(input())\na=list(map(int,input().split()))\nd=Counter(a).most_common(1)[0][0]\nf,s=-1,-1\nfc=[1 for i in range(n+2)]\nfor i in range(n+1):\n if a[i]==d:\n if f==-1:\n f=i\n else:\n s=i\n fc[i+1]=(i+1)*fc[i]\nfc[n+1]=(n+1)*fc[n]\nfor k in range(1,n+2):\n if k==1:\n print(n)\n elif k>f+1+n+1-s-1:\n print(int(fc[n+1]/(fc[k]*fc[n+1-k])))\n else:\n print(int(fc[n+1]/(fc[k]*fc[n+1-k])-fc[f+n-s]/(fc[k-1]*fc[f+n-s-(k-1)])))", "language": "Python", "metadata": {"date": 1545841235, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03674.html", "problem_id": "p03674", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03674/input.txt", "sample_output_relpath": "derived/input_output/data/p03674/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03674/Python/s211634978.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s211634978", "user_id": "u099566485"}, "prompt_components": {"gold_output": "3\n5\n4\n1\n", "input_to_evaluate": "#066-D\nfrom collections import Counter\nn=int(input())\na=list(map(int,input().split()))\nd=Counter(a).most_common(1)[0][0]\nf,s=-1,-1\nfc=[1 for i in range(n+2)]\nfor i in range(n+1):\n if a[i]==d:\n if f==-1:\n f=i\n else:\n s=i\n fc[i+1]=(i+1)*fc[i]\nfc[n+1]=(n+1)*fc[n]\nfor k in range(1,n+2):\n if k==1:\n print(n)\n elif k>f+1+n+1-s-1:\n print(int(fc[n+1]/(fc[k]*fc[n+1-k])))\n else:\n print(int(fc[n+1]/(fc[k]*fc[n+1-k])-fc[f+n-s]/(fc[k-1]*fc[f+n-s-(k-1)])))", "problem_context": "Score : 600 points\n\nProblem Statement\n\nYou are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n.\nIt is known that each of the n integers 1,...,n appears at least once in this sequence.\n\nFor each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given sequence with length k, modulo 10^9+7.\n\nNotes\n\nIf the contents of two subsequences are the same, they are not separately counted even if they originate from different positions in the original sequence.\n\nA subsequence of a sequence a with length k is a sequence obtained by selecting k of the elements of a and arranging them without changing their relative order. For example, the sequences 1,3,5 and 1,2,3 are subsequences of 1,2,3,4,5, while 3,1,2 and 1,10,100 are not.\n\nConstraints\n\n1 \\leq n \\leq 10^5\n\n1 \\leq a_i \\leq n\n\nEach of the integers 1,...,n appears in the sequence.\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_{n+1}\n\nOutput\n\nPrint n+1 lines.\nThe k-th line should contain the number of the different subsequences of the given sequence with length k, modulo 10^9+7.\n\nSample Input 1\n\n3\n1 2 1 3\n\nSample Output 1\n\n3\n5\n4\n1\n\nThere are three subsequences with length 1: 1 and 2 and 3.\n\nThere are five subsequences with length 2: 1,1 and 1,2 and 1,3 and 2,1 and 2,3.\n\nThere are four subsequences with length 3: 1,1,3 and 1,2,1 and 1,2,3 and 2,1,3.\n\nThere is one subsequence with length 4: 1,2,1,3.\n\nSample Input 2\n\n1\n1 1\n\nSample Output 2\n\n1\n1\n\nThere is one subsequence with length 1: 1.\n\nThere is one subsequence with length 2: 1,1.\n\nSample Input 3\n\n32\n29 19 7 10 26 32 27 4 11 20 2 8 16 23 5 14 6 12 17 22 18 30 28 24 15 1 25 3 13 21 19 31 9\n\nSample Output 3\n\n32\n525\n5453\n40919\n237336\n1107568\n4272048\n13884156\n38567100\n92561040\n193536720\n354817320\n573166440\n818809200\n37158313\n166803103\n166803103\n37158313\n818809200\n573166440\n354817320\n193536720\n92561040\n38567100\n13884156\n4272048\n1107568\n237336\n40920\n5456\n528\n33\n1\n\nBe sure to print the numbers modulo 10^9+7.", "sample_input": "3\n1 2 1 3\n"}, "reference_outputs": ["3\n5\n4\n1\n"], "source_document_id": "p03674", "source_text": "Score : 600 points\n\nProblem Statement\n\nYou are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n.\nIt is known that each of the n integers 1,...,n appears at least once in this sequence.\n\nFor each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given sequence with length k, modulo 10^9+7.\n\nNotes\n\nIf the contents of two subsequences are the same, they are not separately counted even if they originate from different positions in the original sequence.\n\nA subsequence of a sequence a with length k is a sequence obtained by selecting k of the elements of a and arranging them without changing their relative order. For example, the sequences 1,3,5 and 1,2,3 are subsequences of 1,2,3,4,5, while 3,1,2 and 1,10,100 are not.\n\nConstraints\n\n1 \\leq n \\leq 10^5\n\n1 \\leq a_i \\leq n\n\nEach of the integers 1,...,n appears in the sequence.\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_{n+1}\n\nOutput\n\nPrint n+1 lines.\nThe k-th line should contain the number of the different subsequences of the given sequence with length k, modulo 10^9+7.\n\nSample Input 1\n\n3\n1 2 1 3\n\nSample Output 1\n\n3\n5\n4\n1\n\nThere are three subsequences with length 1: 1 and 2 and 3.\n\nThere are five subsequences with length 2: 1,1 and 1,2 and 1,3 and 2,1 and 2,3.\n\nThere are four subsequences with length 3: 1,1,3 and 1,2,1 and 1,2,3 and 2,1,3.\n\nThere is one subsequence with length 4: 1,2,1,3.\n\nSample Input 2\n\n1\n1 1\n\nSample Output 2\n\n1\n1\n\nThere is one subsequence with length 1: 1.\n\nThere is one subsequence with length 2: 1,1.\n\nSample Input 3\n\n32\n29 19 7 10 26 32 27 4 11 20 2 8 16 23 5 14 6 12 17 22 18 30 28 24 15 1 25 3 13 21 19 31 9\n\nSample Output 3\n\n32\n525\n5453\n40919\n237336\n1107568\n4272048\n13884156\n38567100\n92561040\n193536720\n354817320\n573166440\n818809200\n37158313\n166803103\n166803103\n37158313\n818809200\n573166440\n354817320\n193536720\n92561040\n38567100\n13884156\n4272048\n1107568\n237336\n40920\n5456\n528\n33\n1\n\nBe sure to print the numbers modulo 10^9+7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 517, "cpu_time_ms": 2277, "memory_kb": 744976}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s137427808", "group_id": "codeNet:p03679", "input_text": "x,a,b=map(int,input().split())\nprint('delicious' if 0<(b-a) else 'dangerous' if x>(b-a) else 'safe')", "language": "Python", "metadata": {"date": 1546410237, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03679.html", "problem_id": "p03679", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03679/input.txt", "sample_output_relpath": "derived/input_output/data/p03679/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03679/Python/s137427808.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s137427808", "user_id": "u239342230"}, "prompt_components": {"gold_output": "safe\n", "input_to_evaluate": "x,a,b=map(int,input().split())\nprint('delicious' if 0<(b-a) else 'dangerous' if x>(b-a) else 'safe')", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "sample_input": "4 3 6\n"}, "reference_outputs": ["safe\n"], "source_document_id": "p03679", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 100, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s784365211", "group_id": "codeNet:p03679", "input_text": "stdin = input()\n\nd = int(stdin.split(\" \")[0])\na = int(stdin.split(\" \")[1])\nb = int(stdin.split(\" \")[2])\n\nif b <= a:\n print (\"delicious\")\nelif b <= a + d:\n print (\"safe\")\nelif b > a + d:\n print (\"dangerous\")", "language": "Python", "metadata": {"date": 1502241521, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03679.html", "problem_id": "p03679", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03679/input.txt", "sample_output_relpath": "derived/input_output/data/p03679/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03679/Python/s784365211.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s784365211", "user_id": "u410363913"}, "prompt_components": {"gold_output": "safe\n", "input_to_evaluate": "stdin = input()\n\nd = int(stdin.split(\" \")[0])\na = int(stdin.split(\" \")[1])\nb = int(stdin.split(\" \")[2])\n\nif b <= a:\n print (\"delicious\")\nelif b <= a + d:\n print (\"safe\")\nelif b > a + d:\n print (\"dangerous\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "sample_input": "4 3 6\n"}, "reference_outputs": ["safe\n"], "source_document_id": "p03679", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 215, "cpu_time_ms": 18, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s232532916", "group_id": "codeNet:p03680", "input_text": "n = int(input())\nq = [int(input()) for i in range(n)]\ncnt = 0\nind = 0\nfor i in range(n):\n ind = q[ind]-1\n cnt += 1\n if ind == 1:\n print(cnt)\n exit()\n \nprint(-1)", "language": "Python", "metadata": {"date": 1601451070, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03680.html", "problem_id": "p03680", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03680/input.txt", "sample_output_relpath": "derived/input_output/data/p03680/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03680/Python/s232532916.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s232532916", "user_id": "u773440446"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n = int(input())\nq = [int(input()) for i in range(n)]\ncnt = 0\nind = 0\nfor i in range(n):\n ind = q[ind]-1\n cnt += 1\n if ind == 1:\n print(cnt)\n exit()\n \nprint(-1)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "sample_input": "3\n3\n1\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03680", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 187, "cpu_time_ms": 163, "memory_kb": 12800}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s934241109", "group_id": "codeNet:p03680", "input_text": "def solve():\n N = int(input())\n a = [int(input()) for i in range(1, N + 1)]\n # ループしたら終わる\n l = []\n s = a[0]\n l = [0] * N\n c = 1\n l[0]=True\n while(True):\n l[s - 1] = True\n if s == 2:\n print(c)\n return True\n s = a[s - 1]\n if l[s - 1] == True:\n print(-1)\n return False\n c += 1\nsolve()\n\n\n", "language": "Python", "metadata": {"date": 1586316581, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03680.html", "problem_id": "p03680", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03680/input.txt", "sample_output_relpath": "derived/input_output/data/p03680/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03680/Python/s934241109.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s934241109", "user_id": "u458725980"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "def solve():\n N = int(input())\n a = [int(input()) for i in range(1, N + 1)]\n # ループしたら終わる\n l = []\n s = a[0]\n l = [0] * N\n c = 1\n l[0]=True\n while(True):\n l[s - 1] = True\n if s == 2:\n print(c)\n return True\n s = a[s - 1]\n if l[s - 1] == True:\n print(-1)\n return False\n c += 1\nsolve()\n\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "sample_input": "3\n3\n1\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03680", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 407, "cpu_time_ms": 200, "memory_kb": 7884}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s846182907", "group_id": "codeNet:p03683", "input_text": "buf=input().split()\nN=int(buf[0])\nM=int(buf[1])\n\nthres=10**9+7\n\nif abs(N-M)==1:\n N=min(N,M)\n retVal=1\n for i in range(1,N+1):\n retVal*=(i**2)\n if retVal>=thres:\n retVal=retVal%thres\n retVal*=(N+1)\n if retVal>=thres:\n retVal=retVal%thres\n print(retVal) \nelif N==M:\n retVal=2\n for i in range(1,N+1):\n retVal*=(i**2)\n if retVal>=thres:\n retVal=retVal%thres\n print(retVal)\nelse:\n print(0)", "language": "Python", "metadata": {"date": 1498498524, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03683.html", "problem_id": "p03683", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03683/input.txt", "sample_output_relpath": "derived/input_output/data/p03683/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03683/Python/s846182907.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s846182907", "user_id": "u177481830"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "buf=input().split()\nN=int(buf[0])\nM=int(buf[1])\n\nthres=10**9+7\n\nif abs(N-M)==1:\n N=min(N,M)\n retVal=1\n for i in range(1,N+1):\n retVal*=(i**2)\n if retVal>=thres:\n retVal=retVal%thres\n retVal*=(N+1)\n if retVal>=thres:\n retVal=retVal%thres\n print(retVal) \nelif N==M:\n retVal=2\n for i in range(1,N+1):\n retVal*=(i**2)\n if retVal>=thres:\n retVal=retVal%thres\n print(retVal)\nelse:\n print(0)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "sample_input": "2 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03683", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 471, "cpu_time_ms": 72, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s852950761", "group_id": "codeNet:p03693", "input_text": "r,g,b = map(int,input().split())\nnum = r*100 + g*20 + b\nif num%4 ==0:\n\tprint(\"YES\")\nelse:\n \tprint(\"NO\")", "language": "Python", "metadata": {"date": 1557273831, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03693.html", "problem_id": "p03693", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03693/input.txt", "sample_output_relpath": "derived/input_output/data/p03693/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03693/Python/s852950761.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s852950761", "user_id": "u853274951"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "r,g,b = map(int,input().split())\nnum = r*100 + g*20 + b\nif num%4 ==0:\n\tprint(\"YES\")\nelse:\n \tprint(\"NO\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer has three cards, one red, one green and one blue.\n\nAn integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card.\n\nWe will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer.\n\nIs this integer a multiple of 4?\n\nConstraints\n\n1 ≤ r, g, b ≤ 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nr g b\n\nOutput\n\nIf the three-digit integer is a multiple of 4, print YES (case-sensitive); otherwise, print NO.\n\nSample Input 1\n\n4 3 2\n\nSample Output 1\n\nYES\n\n432 is a multiple of 4, and thus YES should be printed.\n\nSample Input 2\n\n2 3 4\n\nSample Output 2\n\nNO\n\n234 is not a multiple of 4, and thus NO should be printed.", "sample_input": "4 3 2\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03693", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer has three cards, one red, one green and one blue.\n\nAn integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card.\n\nWe will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer.\n\nIs this integer a multiple of 4?\n\nConstraints\n\n1 ≤ r, g, b ≤ 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nr g b\n\nOutput\n\nIf the three-digit integer is a multiple of 4, print YES (case-sensitive); otherwise, print NO.\n\nSample Input 1\n\n4 3 2\n\nSample Output 1\n\nYES\n\n432 is a multiple of 4, and thus YES should be printed.\n\nSample Input 2\n\n2 3 4\n\nSample Output 2\n\nNO\n\n234 is not a multiple of 4, and thus NO should be printed.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 104, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s727897441", "group_id": "codeNet:p03694", "input_text": "N = int(input())\n\na = [int(n) for n in input().split()]\na = sorted(a)\nprint(a[N-1] - a[0])\n", "language": "Python", "metadata": {"date": 1497223920, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03694.html", "problem_id": "p03694", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03694/input.txt", "sample_output_relpath": "derived/input_output/data/p03694/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03694/Python/s727897441.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s727897441", "user_id": "u840684628"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "N = int(input())\n\na = [int(n) for n in input().split()]\na = sorted(a)\nprint(a[N-1] - a[0])\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIt is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts.\n\nThere are N houses along TopCoDeer street. The i-th house is located at coordinate a_i. He has decided to deliver gifts to all these houses.\n\nFind the minimum distance to be traveled when AtCoDeer can start and end his travel at any positions.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n0 ≤ a_i ≤ 1000\n\na_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum distance to be traveled.\n\nSample Input 1\n\n4\n2 3 7 9\n\nSample Output 1\n\n7\n\nThe travel distance of 7 can be achieved by starting at coordinate 9 and traveling straight to coordinate 2.\n\nIt is not possible to do with a travel distance of less than 7, and thus 7 is the minimum distance to be traveled.\n\nSample Input 2\n\n8\n3 1 4 1 5 9 2 6\n\nSample Output 2\n\n8\n\nThere may be more than one house at a position.", "sample_input": "4\n2 3 7 9\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03694", "source_text": "Score : 200 points\n\nProblem Statement\n\nIt is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts.\n\nThere are N houses along TopCoDeer street. The i-th house is located at coordinate a_i. He has decided to deliver gifts to all these houses.\n\nFind the minimum distance to be traveled when AtCoDeer can start and end his travel at any positions.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n0 ≤ a_i ≤ 1000\n\na_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum distance to be traveled.\n\nSample Input 1\n\n4\n2 3 7 9\n\nSample Output 1\n\n7\n\nThe travel distance of 7 can be achieved by starting at coordinate 9 and traveling straight to coordinate 2.\n\nIt is not possible to do with a travel distance of less than 7, and thus 7 is the minimum distance to be traveled.\n\nSample Input 2\n\n8\n3 1 4 1 5 9 2 6\n\nSample Output 2\n\n8\n\nThere may be more than one house at a position.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 91, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s007045241", "group_id": "codeNet:p03695", "input_text": "n = int(input())\na = list(map(int, input().split()))\ncolor = [0]*8\nfor i in a:\n color[min(8,i//400)] += 1\nkind = 0\nfor i in color[:7]:\n if i:\n kind += 1\nif kind == 0 and color[7]:\n color[7] -= 1\n kind += 1\nprint(kind,kind+color[7])", "language": "Python", "metadata": {"date": 1553287266, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03695.html", "problem_id": "p03695", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03695/input.txt", "sample_output_relpath": "derived/input_output/data/p03695/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03695/Python/s007045241.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s007045241", "user_id": "u543954314"}, "prompt_components": {"gold_output": "2 2\n", "input_to_evaluate": "n = int(input())\na = list(map(int, input().split()))\ncolor = [0]*8\nfor i in a:\n color[min(8,i//400)] += 1\nkind = 0\nfor i in color[:7]:\n if i:\n kind += 1\nif kind == 0 and color[7]:\n color[7] -= 1\n kind += 1\nprint(kind,kind+color[7])", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn AtCoder, a person who has participated in a contest receives a color, which corresponds to the person's rating as follows:\n\nRating 1-399 : gray\n\nRating 400-799 : brown\n\nRating 800-1199 : green\n\nRating 1200-1599 : cyan\n\nRating 1600-1999 : blue\n\nRating 2000-2399 : yellow\n\nRating 2400-2799 : orange\n\nRating 2800-3199 : red\n\nOther than the above, a person whose rating is 3200 or higher can freely pick his/her color, which can be one of the eight colors above or not.\n\nCurrently, there are N users who have participated in a contest in AtCoder, and the i-th user has a rating of a_i.\n\nFind the minimum and maximum possible numbers of different colors of the users.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ a_i ≤ 4800\n\na_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum possible number of different colors of the users, and the maximum possible number of different colors, with a space in between.\n\nSample Input 1\n\n4\n2100 2500 2700 2700\n\nSample Output 1\n\n2 2\n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are two different colors.\n\nSample Input 2\n\n5\n1100 1900 2800 3200 3200\n\nSample Output 2\n\n3 5\n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and the user with rating 2800 is \"red\".\n\nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are three different colors. This is one possible scenario for the minimum number of colors.\n\nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are five different colors. This is one possible scenario for the maximum number of colors.\n\nSample Input 3\n\n20\n800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990\n\nSample Output 3\n\n1 1\n\nAll the users are \"green\", and thus there is one color.", "sample_input": "4\n2100 2500 2700 2700\n"}, "reference_outputs": ["2 2\n"], "source_document_id": "p03695", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn AtCoder, a person who has participated in a contest receives a color, which corresponds to the person's rating as follows:\n\nRating 1-399 : gray\n\nRating 400-799 : brown\n\nRating 800-1199 : green\n\nRating 1200-1599 : cyan\n\nRating 1600-1999 : blue\n\nRating 2000-2399 : yellow\n\nRating 2400-2799 : orange\n\nRating 2800-3199 : red\n\nOther than the above, a person whose rating is 3200 or higher can freely pick his/her color, which can be one of the eight colors above or not.\n\nCurrently, there are N users who have participated in a contest in AtCoder, and the i-th user has a rating of a_i.\n\nFind the minimum and maximum possible numbers of different colors of the users.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ a_i ≤ 4800\n\na_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum possible number of different colors of the users, and the maximum possible number of different colors, with a space in between.\n\nSample Input 1\n\n4\n2100 2500 2700 2700\n\nSample Output 1\n\n2 2\n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are two different colors.\n\nSample Input 2\n\n5\n1100 1900 2800 3200 3200\n\nSample Output 2\n\n3 5\n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and the user with rating 2800 is \"red\".\n\nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are three different colors. This is one possible scenario for the minimum number of colors.\n\nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are five different colors. This is one possible scenario for the maximum number of colors.\n\nSample Input 3\n\n20\n800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990\n\nSample Output 3\n\n1 1\n\nAll the users are \"green\", and thus there is one color.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 238, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s121266702", "group_id": "codeNet:p03697", "input_text": "A, B = map(int, input().split())\nif A + B >= 10:\n print('error')\nelse:\n print(A+B)", "language": "Python", "metadata": {"date": 1566273034, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03697.html", "problem_id": "p03697", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03697/input.txt", "sample_output_relpath": "derived/input_output/data/p03697/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03697/Python/s121266702.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s121266702", "user_id": "u407016024"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "A, B = map(int, input().split())\nif A + B >= 10:\n print('error')\nelse:\n print(A+B)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given two integers A and B as the input. Output the value of A + B.\n\nHowever, if A + B is 10 or greater, output error instead.\n\nConstraints\n\nA and B are integers.\n\n1 ≤ A, B ≤ 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf A + B is 10 or greater, print the string error (case-sensitive); otherwise, print the value of A + B.\n\nSample Input 1\n\n6 3\n\nSample Output 1\n\n9\n\nSample Input 2\n\n6 4\n\nSample Output 2\n\nerror", "sample_input": "6 3\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03697", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given two integers A and B as the input. Output the value of A + B.\n\nHowever, if A + B is 10 or greater, output error instead.\n\nConstraints\n\nA and B are integers.\n\n1 ≤ A, B ≤ 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf A + B is 10 or greater, print the string error (case-sensitive); otherwise, print the value of A + B.\n\nSample Input 1\n\n6 3\n\nSample Output 1\n\n9\n\nSample Input 2\n\n6 4\n\nSample Output 2\n\nerror", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 88, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s168168226", "group_id": "codeNet:p03698", "input_text": "def resolve():\n s = input()\n\n ans = str()\n for char in s:\n if s.count(char) >1:\n ans = \"no\"\n break\n else:\n ans = \"yes\"\n print(ans)\nresolve()", "language": "Python", "metadata": {"date": 1591761150, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03698.html", "problem_id": "p03698", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03698/input.txt", "sample_output_relpath": "derived/input_output/data/p03698/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03698/Python/s168168226.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s168168226", "user_id": "u359007262"}, "prompt_components": {"gold_output": "yes\n", "input_to_evaluate": "def resolve():\n s = input()\n\n ans = str()\n for char in s:\n if s.count(char) >1:\n ans = \"no\"\n break\n else:\n ans = \"yes\"\n print(ans)\nresolve()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different.\n\nConstraints\n\n2 ≤ |S| ≤ 26, where |S| denotes the length of S.\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf all the characters in S are different, print yes (case-sensitive); otherwise, print no.\n\nSample Input 1\n\nuncopyrightable\n\nSample Output 1\n\nyes\n\nSample Input 2\n\ndifferent\n\nSample Output 2\n\nno\n\nSample Input 3\n\nno\n\nSample Output 3\n\nyes", "sample_input": "uncopyrightable\n"}, "reference_outputs": ["yes\n"], "source_document_id": "p03698", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different.\n\nConstraints\n\n2 ≤ |S| ≤ 26, where |S| denotes the length of S.\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf all the characters in S are different, print yes (case-sensitive); otherwise, print no.\n\nSample Input 1\n\nuncopyrightable\n\nSample Output 1\n\nyes\n\nSample Input 2\n\ndifferent\n\nSample Output 2\n\nno\n\nSample Input 3\n\nno\n\nSample Output 3\n\nyes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 199, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s334089156", "group_id": "codeNet:p03698", "input_text": "s = input()\nss = \"\".join(set(s))\nprint(\"Yes\") if len(s) == len(ss) else print(\"No\")", "language": "Python", "metadata": {"date": 1562015184, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03698.html", "problem_id": "p03698", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03698/input.txt", "sample_output_relpath": "derived/input_output/data/p03698/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03698/Python/s334089156.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s334089156", "user_id": "u314050667"}, "prompt_components": {"gold_output": "yes\n", "input_to_evaluate": "s = input()\nss = \"\".join(set(s))\nprint(\"Yes\") if len(s) == len(ss) else print(\"No\")", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different.\n\nConstraints\n\n2 ≤ |S| ≤ 26, where |S| denotes the length of S.\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf all the characters in S are different, print yes (case-sensitive); otherwise, print no.\n\nSample Input 1\n\nuncopyrightable\n\nSample Output 1\n\nyes\n\nSample Input 2\n\ndifferent\n\nSample Output 2\n\nno\n\nSample Input 3\n\nno\n\nSample Output 3\n\nyes", "sample_input": "uncopyrightable\n"}, "reference_outputs": ["yes\n"], "source_document_id": "p03698", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different.\n\nConstraints\n\n2 ≤ |S| ≤ 26, where |S| denotes the length of S.\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf all the characters in S are different, print yes (case-sensitive); otherwise, print no.\n\nSample Input 1\n\nuncopyrightable\n\nSample Output 1\n\nyes\n\nSample Input 2\n\ndifferent\n\nSample Output 2\n\nno\n\nSample Input 3\n\nno\n\nSample Output 3\n\nyes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 83, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s257747011", "group_id": "codeNet:p03699", "input_text": "n = int(input())\nS = sorted([int(input()) for _ in range(n)])\nans = 0\ncaution = 0\nflag = 1\nfor s in S:\n ans += s\n if flag:\n if s % 10:\n caution = s\n flag = 0\nif ans % 10 == 0:\n if caution:\n ans -= caution\n else:\n ans = 0\nprint(ans) ", "language": "Python", "metadata": {"date": 1584166424, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03699.html", "problem_id": "p03699", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03699/input.txt", "sample_output_relpath": "derived/input_output/data/p03699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03699/Python/s257747011.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s257747011", "user_id": "u393253137"}, "prompt_components": {"gold_output": "25\n", "input_to_evaluate": "n = int(input())\nS = sorted([int(input()) for _ in range(n)])\nans = 0\ncaution = 0\nflag = 1\nfor s in S:\n ans += s\n if flag:\n if s % 10:\n caution = s\n flag = 0\nif ans % 10 == 0:\n if caution:\n ans -= caution\n else:\n ans = 0\nprint(ans) ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either \"correct\" or \"incorrect\", and your grade will be the sum of the points allocated to questions that are answered correctly. When you finish answering the questions, your answers will be immediately judged and your grade will be displayed... if everything goes well.\n\nHowever, the examination system is actually flawed, and if your grade is a multiple of 10, the system displays 0 as your grade. Otherwise, your grade is displayed correctly. In this situation, what is the maximum value that can be displayed as your grade?\n\nConstraints\n\nAll input values are integers.\n\n1 ≤ N ≤ 100\n\n1 ≤ s_i ≤ 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the maximum value that can be displayed as your grade.\n\nSample Input 1\n\n3\n5\n10\n15\n\nSample Output 1\n\n25\n\nYour grade will be 25 if the 10-point and 15-point questions are answered correctly and the 5-point question is not, and this grade will be displayed correctly. Your grade will become 30 if the 5-point question is also answered correctly, but this grade will be incorrectly displayed as 0.\n\nSample Input 2\n\n3\n10\n10\n15\n\nSample Output 2\n\n35\n\nYour grade will be 35 if all the questions are answered correctly, and this grade will be displayed correctly.\n\nSample Input 3\n\n3\n10\n20\n30\n\nSample Output 3\n\n0\n\nRegardless of whether each question is answered correctly or not, your grade will be a multiple of 10 and displayed as 0.", "sample_input": "3\n5\n10\n15\n"}, "reference_outputs": ["25\n"], "source_document_id": "p03699", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either \"correct\" or \"incorrect\", and your grade will be the sum of the points allocated to questions that are answered correctly. When you finish answering the questions, your answers will be immediately judged and your grade will be displayed... if everything goes well.\n\nHowever, the examination system is actually flawed, and if your grade is a multiple of 10, the system displays 0 as your grade. Otherwise, your grade is displayed correctly. In this situation, what is the maximum value that can be displayed as your grade?\n\nConstraints\n\nAll input values are integers.\n\n1 ≤ N ≤ 100\n\n1 ≤ s_i ≤ 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the maximum value that can be displayed as your grade.\n\nSample Input 1\n\n3\n5\n10\n15\n\nSample Output 1\n\n25\n\nYour grade will be 25 if the 10-point and 15-point questions are answered correctly and the 5-point question is not, and this grade will be displayed correctly. Your grade will become 30 if the 5-point question is also answered correctly, but this grade will be incorrectly displayed as 0.\n\nSample Input 2\n\n3\n10\n10\n15\n\nSample Output 2\n\n35\n\nYour grade will be 35 if all the questions are answered correctly, and this grade will be displayed correctly.\n\nSample Input 3\n\n3\n10\n20\n30\n\nSample Output 3\n\n0\n\nRegardless of whether each question is answered correctly or not, your grade will be a multiple of 10 and displayed as 0.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 294, "cpu_time_ms": 18, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s239302777", "group_id": "codeNet:p03700", "input_text": "import math\nN, A, B = map(int, input().split())\nH = [int(input()) for i in range(N)]\n \ndef f(x):\n s = sum([math.ceil(max(0, h - x * B) / (A - B)) for h in H])\n if s <= x:\n return True\n else:\n return False\n \nl = 0\nr = 10 ** 9 + 7\nwhile l < r:\n m = (l + r) // 2\n if f(m):\n r = m\n else:\n l = m + 1\n print(r, l, m)\n \nprint(m)", "language": "Python", "metadata": {"date": 1555119424, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03700.html", "problem_id": "p03700", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03700/input.txt", "sample_output_relpath": "derived/input_output/data/p03700/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03700/Python/s239302777.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s239302777", "user_id": "u977389981"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import math\nN, A, B = map(int, input().split())\nH = [int(input()) for i in range(N)]\n \ndef f(x):\n s = sum([math.ceil(max(0, h - x * B) / (A - B)) for h in H])\n if s <= x:\n return True\n else:\n return False\n \nl = 0\nr = 10 ** 9 + 7\nwhile l < r:\n m = (l + r) // 2\n if f(m):\n r = m\n else:\n l = m + 1\n print(r, l, m)\n \nprint(m)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called health, and the health of the i-th monster is h_i at the moment of encounter. A monster will vanish immediately when its health drops to 0 or below.\n\nFortunately, you are a skilled magician, capable of causing explosions that damage monsters. In one explosion, you can damage monsters as follows:\n\nSelect an alive monster, and cause an explosion centered at that monster. The health of the monster at the center of the explosion will decrease by A, and the health of each of the other monsters will decrease by B. Here, A and B are predetermined parameters, and A > B holds.\n\nAt least how many explosions do you need to cause in order to vanish all the monsters?\n\nConstraints\n\nAll input values are integers.\n\n1 ≤ N ≤ 10^5\n\n1 ≤ B < A ≤ 10^9\n\n1 ≤ h_i ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum number of explosions that needs to be caused in order to vanish all the monsters.\n\nSample Input 1\n\n4 5 3\n8\n7\n4\n2\n\nSample Output 1\n\n2\n\nYou can vanish all the monsters in two explosion, as follows:\n\nFirst, cause an explosion centered at the monster with 8 health. The healths of the four monsters become 3, 4, 1 and -1, respectively, and the last monster vanishes.\n\nSecond, cause an explosion centered at the monster with 4 health remaining. The healths of the three remaining monsters become 0, -1 and -2, respectively, and all the monsters are now vanished.\n\nSample Input 2\n\n2 10 4\n20\n20\n\nSample Output 2\n\n4\n\nYou need to cause two explosions centered at each monster, for a total of four.\n\nSample Input 3\n\n5 2 1\n900000000\n900000000\n1000000000\n1000000000\n1000000000\n\nSample Output 3\n\n800000000", "sample_input": "4 5 3\n8\n7\n4\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03700", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called health, and the health of the i-th monster is h_i at the moment of encounter. A monster will vanish immediately when its health drops to 0 or below.\n\nFortunately, you are a skilled magician, capable of causing explosions that damage monsters. In one explosion, you can damage monsters as follows:\n\nSelect an alive monster, and cause an explosion centered at that monster. The health of the monster at the center of the explosion will decrease by A, and the health of each of the other monsters will decrease by B. Here, A and B are predetermined parameters, and A > B holds.\n\nAt least how many explosions do you need to cause in order to vanish all the monsters?\n\nConstraints\n\nAll input values are integers.\n\n1 ≤ N ≤ 10^5\n\n1 ≤ B < A ≤ 10^9\n\n1 ≤ h_i ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum number of explosions that needs to be caused in order to vanish all the monsters.\n\nSample Input 1\n\n4 5 3\n8\n7\n4\n2\n\nSample Output 1\n\n2\n\nYou can vanish all the monsters in two explosion, as follows:\n\nFirst, cause an explosion centered at the monster with 8 health. The healths of the four monsters become 3, 4, 1 and -1, respectively, and the last monster vanishes.\n\nSecond, cause an explosion centered at the monster with 4 health remaining. The healths of the three remaining monsters become 0, -1 and -2, respectively, and all the monsters are now vanished.\n\nSample Input 2\n\n2 10 4\n20\n20\n\nSample Output 2\n\n4\n\nYou need to cause two explosions centered at each monster, for a total of four.\n\nSample Input 3\n\n5 2 1\n900000000\n900000000\n1000000000\n1000000000\n1000000000\n\nSample Output 3\n\n800000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 383, "cpu_time_ms": 1514, "memory_kb": 11028}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s301099069", "group_id": "codeNet:p03711", "input_text": "x,y=map(int,input().split())\ns1={1,3,5,7,8,10,12}\ns2={4,6,9,11}\nprint([\"No\",\"Yes\"][(x in s1 and y in s1) or (x in s2 and y in s2)]) ", "language": "Python", "metadata": {"date": 1596861483, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03711.html", "problem_id": "p03711", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03711/input.txt", "sample_output_relpath": "derived/input_output/data/p03711/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03711/Python/s301099069.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s301099069", "user_id": "u442948527"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "x,y=map(int,input().split())\ns1={1,3,5,7,8,10,12}\ns2={4,6,9,11}\nprint([\"No\",\"Yes\"][(x in s1 and y in s1) or (x in s2 and y in s2)]) ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nBased on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below.\nGiven two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group.\n\nConstraints\n\nx and y are integers.\n\n1 ≤ x < y ≤ 12\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx y\n\nOutput\n\nIf x and y belong to the same group, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\nYes\n\nSample Input 2\n\n2 4\n\nSample Output 2\n\nNo", "sample_input": "1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03711", "source_text": "Score : 100 points\n\nProblem Statement\n\nBased on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below.\nGiven two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group.\n\nConstraints\n\nx and y are integers.\n\n1 ≤ x < y ≤ 12\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx y\n\nOutput\n\nIf x and y belong to the same group, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\nYes\n\nSample Input 2\n\n2 4\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 132, "cpu_time_ms": 26, "memory_kb": 9164}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s218765562", "group_id": "codeNet:p03711", "input_text": "a = [1,3,5,7,8,10,12]\nb = [4,6,9,11]\nc = [2]\nx,y = map(int,input().split())\nif x in a and y in a:\n print(\"Yes\")\nelif x in b and y in b:\n print(\"Yes\")\nelif x in c and y in c:\n print(\"Yes\")\nelse:\n print(\"No\")", "language": "Python", "metadata": {"date": 1587008071, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03711.html", "problem_id": "p03711", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03711/input.txt", "sample_output_relpath": "derived/input_output/data/p03711/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03711/Python/s218765562.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s218765562", "user_id": "u239772565"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "a = [1,3,5,7,8,10,12]\nb = [4,6,9,11]\nc = [2]\nx,y = map(int,input().split())\nif x in a and y in a:\n print(\"Yes\")\nelif x in b and y in b:\n print(\"Yes\")\nelif x in c and y in c:\n print(\"Yes\")\nelse:\n print(\"No\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nBased on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below.\nGiven two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group.\n\nConstraints\n\nx and y are integers.\n\n1 ≤ x < y ≤ 12\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx y\n\nOutput\n\nIf x and y belong to the same group, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\nYes\n\nSample Input 2\n\n2 4\n\nSample Output 2\n\nNo", "sample_input": "1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03711", "source_text": "Score : 100 points\n\nProblem Statement\n\nBased on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below.\nGiven two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group.\n\nConstraints\n\nx and y are integers.\n\n1 ≤ x < y ≤ 12\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx y\n\nOutput\n\nIf x and y belong to the same group, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\nYes\n\nSample Input 2\n\n2 4\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 218, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s785602719", "group_id": "codeNet:p03711", "input_text": "# -*- coding: utf-8 -*-\nx, y = map(int, input().split())\n\n#def list\nlist1 = [1,3,5,7,8,10,12]\nlist2 = [4,6,9,11]\nlist3 = [2]\n\n#group check\nif x in list1 and y in list1:\n print \"YES\"\nelif x in list2 and y in list2:\n print \"YES\"\nelif x in list3 and y in list3:\n print \"YES\"\nelse:\n print \"NO\"\n", "language": "Python", "metadata": {"date": 1495333409, "filename_ext": "py", "original_language": "Python (2.7.6)", "problem_description_relpath": "problem_descriptions/p03711.html", "problem_id": "p03711", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03711/input.txt", "sample_output_relpath": "derived/input_output/data/p03711/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03711/Python/s785602719.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s785602719", "user_id": "u529186305"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "# -*- coding: utf-8 -*-\nx, y = map(int, input().split())\n\n#def list\nlist1 = [1,3,5,7,8,10,12]\nlist2 = [4,6,9,11]\nlist3 = [2]\n\n#group check\nif x in list1 and y in list1:\n print \"YES\"\nelif x in list2 and y in list2:\n print \"YES\"\nelif x in list3 and y in list3:\n print \"YES\"\nelse:\n print \"NO\"\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nBased on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below.\nGiven two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group.\n\nConstraints\n\nx and y are integers.\n\n1 ≤ x < y ≤ 12\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx y\n\nOutput\n\nIf x and y belong to the same group, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\nYes\n\nSample Input 2\n\n2 4\n\nSample Output 2\n\nNo", "sample_input": "1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03711", "source_text": "Score : 100 points\n\nProblem Statement\n\nBased on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below.\nGiven two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group.\n\nConstraints\n\nx and y are integers.\n\n1 ≤ x < y ≤ 12\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx y\n\nOutput\n\nIf x and y belong to the same group, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\nYes\n\nSample Input 2\n\n2 4\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 302, "cpu_time_ms": 10, "memory_kb": 2568}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s423183599", "group_id": "codeNet:p03712", "input_text": "H,W=map(int,input().split())\n\nmat=[[\"#\"]*(W+2)]\nfor i in range(H):\n array=[\"#\"]+list(input())+[\"#\"]\n mat.append(array)\nmat.append([\"#\"]*(W+2))\n\nfor i in range(H+2):\n print(\"\".join(mat[i]))", "language": "Python", "metadata": {"date": 1588726190, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03712.html", "problem_id": "p03712", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03712/input.txt", "sample_output_relpath": "derived/input_output/data/p03712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03712/Python/s423183599.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s423183599", "user_id": "u203843959"}, "prompt_components": {"gold_output": "#####\n#abc#\n#arc#\n#####\n", "input_to_evaluate": "H,W=map(int,input().split())\n\nmat=[[\"#\"]*(W+2)]\nfor i in range(H):\n array=[\"#\"]+list(input())+[\"#\"]\n mat.append(array)\nmat.append([\"#\"]*(W+2))\n\nfor i in range(H+2):\n print(\"\".join(mat[i]))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a image with a height of H pixels and a width of W pixels.\nEach pixel is represented by a lowercase English letter.\nThe pixel at the i-th row from the top and j-th column from the left is a_{ij}.\n\nPut a box around this image and output the result. The box should consist of # and have a thickness of 1.\n\nConstraints\n\n1 ≤ H, W ≤ 100\n\na_{ij} is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} ... a_{1W}\n:\na_{H1} ... a_{HW}\n\nOutput\n\nPrint the image surrounded by a box that consists of # and has a thickness of 1.\n\nSample Input 1\n\n2 3\nabc\narc\n\nSample Output 1\n\n#####\n#abc#\n#arc#\n#####\n\nSample Input 2\n\n1 1\nz\n\nSample Output 2\n\n###\n#z#\n###", "sample_input": "2 3\nabc\narc\n"}, "reference_outputs": ["#####\n#abc#\n#arc#\n#####\n"], "source_document_id": "p03712", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a image with a height of H pixels and a width of W pixels.\nEach pixel is represented by a lowercase English letter.\nThe pixel at the i-th row from the top and j-th column from the left is a_{ij}.\n\nPut a box around this image and output the result. The box should consist of # and have a thickness of 1.\n\nConstraints\n\n1 ≤ H, W ≤ 100\n\na_{ij} is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} ... a_{1W}\n:\na_{H1} ... a_{HW}\n\nOutput\n\nPrint the image surrounded by a box that consists of # and has a thickness of 1.\n\nSample Input 1\n\n2 3\nabc\narc\n\nSample Output 1\n\n#####\n#abc#\n#arc#\n#####\n\nSample Input 2\n\n1 1\nz\n\nSample Output 2\n\n###\n#z#\n###", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 191, "cpu_time_ms": 18, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s823239992", "group_id": "codeNet:p03713", "input_text": "\nH, W=map(int, input().split())\ndeference=H*W\na=0\nb=0\nfor i in range(W-1):\n a=H*(i+1)\n b=H//2*(W-i-1)\n if deference>max(a, b, H*W-a-b)-min(a, b, H*W-a-b):\n deference=max(a, b, H*W-a-b)-min(a, b, H*W-a-b)\nfor i in range(H-1):\n a=W*(i+1)\n b=W//2*(H-i-1)\n if deference>max(a, b, H*W-a-b)-min(a, b, H*W-a-b):\n deference=max(a, b, H*W-a-b)-min(a, b, H*W-a-b)\nfor i in range(W-2):\n a=H*(i+1)\n b=H*((W-i-1)//2)\n if deference>max(a, b, H*W-a-b)-min(a, b, H*W-a-b):\n deference=max(a, b, H*W-a-b)-min(a, b, H*W-a-b)\nfor i in range(H-2):\n a=W*(i+1)\n b=W*((H-i-1)//2)\n if deference>max(a, b, H*W-a-b)-min(a, b, H*W-a-b):\n deference=max(a, b, H*W-a-b)-min(a, b, H*W-a-b)\nprint(deference)", "language": "Python", "metadata": {"date": 1536101610, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03713.html", "problem_id": "p03713", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03713/input.txt", "sample_output_relpath": "derived/input_output/data/p03713/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03713/Python/s823239992.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s823239992", "user_id": "u073775598"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "\nH, W=map(int, input().split())\ndeference=H*W\na=0\nb=0\nfor i in range(W-1):\n a=H*(i+1)\n b=H//2*(W-i-1)\n if deference>max(a, b, H*W-a-b)-min(a, b, H*W-a-b):\n deference=max(a, b, H*W-a-b)-min(a, b, H*W-a-b)\nfor i in range(H-1):\n a=W*(i+1)\n b=W//2*(H-i-1)\n if deference>max(a, b, H*W-a-b)-min(a, b, H*W-a-b):\n deference=max(a, b, H*W-a-b)-min(a, b, H*W-a-b)\nfor i in range(W-2):\n a=H*(i+1)\n b=H*((W-i-1)//2)\n if deference>max(a, b, H*W-a-b)-min(a, b, H*W-a-b):\n deference=max(a, b, H*W-a-b)-min(a, b, H*W-a-b)\nfor i in range(H-2):\n a=W*(i+1)\n b=W*((H-i-1)//2)\n if deference>max(a, b, H*W-a-b)-min(a, b, H*W-a-b):\n deference=max(a, b, H*W-a-b)-min(a, b, H*W-a-b)\nprint(deference)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a bar of chocolate with a height of H blocks and a width of W blocks.\nSnuke is dividing this bar into exactly three pieces.\nHe can only cut the bar along borders of blocks, and the shape of each piece must be a rectangle.\n\nSnuke is trying to divide the bar as evenly as possible.\nMore specifically, he is trying to minimize S_{max} - S_{min}, where S_{max} is the area (the number of blocks contained) of the largest piece, and S_{min} is the area of the smallest piece.\nFind the minimum possible value of S_{max} - S_{min}.\n\nConstraints\n\n2 ≤ H, W ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\n\nOutput\n\nPrint the minimum possible value of S_{max} - S_{min}.\n\nSample Input 1\n\n3 5\n\nSample Output 1\n\n0\n\nIn the division below, S_{max} - S_{min} = 5 - 5 = 0.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n2\n\nIn the division below, S_{max} - S_{min} = 8 - 6 = 2.\n\nSample Input 3\n\n5 5\n\nSample Output 3\n\n4\n\nIn the division below, S_{max} - S_{min} = 10 - 6 = 4.\n\nSample Input 4\n\n100000 2\n\nSample Output 4\n\n1\n\nSample Input 5\n\n100000 100000\n\nSample Output 5\n\n50000", "sample_input": "3 5\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03713", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a bar of chocolate with a height of H blocks and a width of W blocks.\nSnuke is dividing this bar into exactly three pieces.\nHe can only cut the bar along borders of blocks, and the shape of each piece must be a rectangle.\n\nSnuke is trying to divide the bar as evenly as possible.\nMore specifically, he is trying to minimize S_{max} - S_{min}, where S_{max} is the area (the number of blocks contained) of the largest piece, and S_{min} is the area of the smallest piece.\nFind the minimum possible value of S_{max} - S_{min}.\n\nConstraints\n\n2 ≤ H, W ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\n\nOutput\n\nPrint the minimum possible value of S_{max} - S_{min}.\n\nSample Input 1\n\n3 5\n\nSample Output 1\n\n0\n\nIn the division below, S_{max} - S_{min} = 5 - 5 = 0.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n2\n\nIn the division below, S_{max} - S_{min} = 8 - 6 = 2.\n\nSample Input 3\n\n5 5\n\nSample Output 3\n\n4\n\nIn the division below, S_{max} - S_{min} = 10 - 6 = 4.\n\nSample Input 4\n\n100000 2\n\nSample Output 4\n\n1\n\nSample Input 5\n\n100000 100000\n\nSample Output 5\n\n50000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 738, "cpu_time_ms": 509, "memory_kb": 3188}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s669787954", "group_id": "codeNet:p03713", "input_text": "H, W = list(map(int, input().split()))\nres = min(H,W)\nhr,vr = H%3*W,W%3*H\ndef min_s_diff(x, y):\n if x % 3 == 0:\n return 0\n if x % 3 == 1:\n a = x // 3\n b = y // 2\n s1 = a * y\n s2 = (x - a) * b\n s3 = x * y - s1 - s2\n return max(s1, s2, s3) - min(s1, s2, s3)\n if x % 3 == 2:\n a = x // 3 + 1\n b = y // 2\n s1 = a * y\n s2 = (x - a) * b\n s3 = x * y - s1 -s2\n return max(s1, s2, s3) - min(s1, s2, s3)\n\nprint(min(min_s_diff(H, W), min_s_diff(W, H), res, hr, vr))\n \n", "language": "Python", "metadata": {"date": 1504538555, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03713.html", "problem_id": "p03713", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03713/input.txt", "sample_output_relpath": "derived/input_output/data/p03713/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03713/Python/s669787954.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s669787954", "user_id": "u602860891"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "H, W = list(map(int, input().split()))\nres = min(H,W)\nhr,vr = H%3*W,W%3*H\ndef min_s_diff(x, y):\n if x % 3 == 0:\n return 0\n if x % 3 == 1:\n a = x // 3\n b = y // 2\n s1 = a * y\n s2 = (x - a) * b\n s3 = x * y - s1 - s2\n return max(s1, s2, s3) - min(s1, s2, s3)\n if x % 3 == 2:\n a = x // 3 + 1\n b = y // 2\n s1 = a * y\n s2 = (x - a) * b\n s3 = x * y - s1 -s2\n return max(s1, s2, s3) - min(s1, s2, s3)\n\nprint(min(min_s_diff(H, W), min_s_diff(W, H), res, hr, vr))\n \n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a bar of chocolate with a height of H blocks and a width of W blocks.\nSnuke is dividing this bar into exactly three pieces.\nHe can only cut the bar along borders of blocks, and the shape of each piece must be a rectangle.\n\nSnuke is trying to divide the bar as evenly as possible.\nMore specifically, he is trying to minimize S_{max} - S_{min}, where S_{max} is the area (the number of blocks contained) of the largest piece, and S_{min} is the area of the smallest piece.\nFind the minimum possible value of S_{max} - S_{min}.\n\nConstraints\n\n2 ≤ H, W ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\n\nOutput\n\nPrint the minimum possible value of S_{max} - S_{min}.\n\nSample Input 1\n\n3 5\n\nSample Output 1\n\n0\n\nIn the division below, S_{max} - S_{min} = 5 - 5 = 0.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n2\n\nIn the division below, S_{max} - S_{min} = 8 - 6 = 2.\n\nSample Input 3\n\n5 5\n\nSample Output 3\n\n4\n\nIn the division below, S_{max} - S_{min} = 10 - 6 = 4.\n\nSample Input 4\n\n100000 2\n\nSample Output 4\n\n1\n\nSample Input 5\n\n100000 100000\n\nSample Output 5\n\n50000", "sample_input": "3 5\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03713", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a bar of chocolate with a height of H blocks and a width of W blocks.\nSnuke is dividing this bar into exactly three pieces.\nHe can only cut the bar along borders of blocks, and the shape of each piece must be a rectangle.\n\nSnuke is trying to divide the bar as evenly as possible.\nMore specifically, he is trying to minimize S_{max} - S_{min}, where S_{max} is the area (the number of blocks contained) of the largest piece, and S_{min} is the area of the smallest piece.\nFind the minimum possible value of S_{max} - S_{min}.\n\nConstraints\n\n2 ≤ H, W ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\n\nOutput\n\nPrint the minimum possible value of S_{max} - S_{min}.\n\nSample Input 1\n\n3 5\n\nSample Output 1\n\n0\n\nIn the division below, S_{max} - S_{min} = 5 - 5 = 0.\n\nSample Input 2\n\n4 5\n\nSample Output 2\n\n2\n\nIn the division below, S_{max} - S_{min} = 8 - 6 = 2.\n\nSample Input 3\n\n5 5\n\nSample Output 3\n\n4\n\nIn the division below, S_{max} - S_{min} = 10 - 6 = 4.\n\nSample Input 4\n\n100000 2\n\nSample Output 4\n\n1\n\nSample Input 5\n\n100000 100000\n\nSample Output 5\n\n50000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 563, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s366329962", "group_id": "codeNet:p03719", "input_text": "a, b, c = (int(i) for i in input().split())\n\nif a <= c and b >= c:\n print('Yes')\nelse:\n print('No')\n", "language": "Python", "metadata": {"date": 1540759091, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03719.html", "problem_id": "p03719", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03719/input.txt", "sample_output_relpath": "derived/input_output/data/p03719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03719/Python/s366329962.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s366329962", "user_id": "u016393440"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "a, b, c = (int(i) for i in input().split())\n\nif a <= c and b >= c:\n print('Yes')\nelse:\n print('No')\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given three integers A, B and C.\nDetermine whether C is not less than A and not greater than B.\n\nConstraints\n\n-100≤A,B,C≤100\n\nA, B and C are all integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the condition is satisfied, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 3 2\n\nSample Output 1\n\nYes\n\nC=2 is not less than A=1 and not greater than B=3, and thus the output should be Yes.\n\nSample Input 2\n\n6 5 4\n\nSample Output 2\n\nNo\n\nC=4 is less than A=6, and thus the output should be No.\n\nSample Input 3\n\n2 2 2\n\nSample Output 3\n\nYes", "sample_input": "1 3 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03719", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given three integers A, B and C.\nDetermine whether C is not less than A and not greater than B.\n\nConstraints\n\n-100≤A,B,C≤100\n\nA, B and C are all integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the condition is satisfied, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 3 2\n\nSample Output 1\n\nYes\n\nC=2 is not less than A=1 and not greater than B=3, and thus the output should be Yes.\n\nSample Input 2\n\n6 5 4\n\nSample Output 2\n\nNo\n\nC=4 is less than A=6, and thus the output should be No.\n\nSample Input 3\n\n2 2 2\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 106, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s739870553", "group_id": "codeNet:p03719", "input_text": "a, b, c = map(int, raw_input().split())\n\nprint \"YES\" if c >= a and c <= b else \"NO\"\n", "language": "Python", "metadata": {"date": 1494723711, "filename_ext": "py", "original_language": "Python (2.7.6)", "problem_description_relpath": "problem_descriptions/p03719.html", "problem_id": "p03719", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03719/input.txt", "sample_output_relpath": "derived/input_output/data/p03719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03719/Python/s739870553.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s739870553", "user_id": "u638552534"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "a, b, c = map(int, raw_input().split())\n\nprint \"YES\" if c >= a and c <= b else \"NO\"\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given three integers A, B and C.\nDetermine whether C is not less than A and not greater than B.\n\nConstraints\n\n-100≤A,B,C≤100\n\nA, B and C are all integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the condition is satisfied, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 3 2\n\nSample Output 1\n\nYes\n\nC=2 is not less than A=1 and not greater than B=3, and thus the output should be Yes.\n\nSample Input 2\n\n6 5 4\n\nSample Output 2\n\nNo\n\nC=4 is less than A=6, and thus the output should be No.\n\nSample Input 3\n\n2 2 2\n\nSample Output 3\n\nYes", "sample_input": "1 3 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03719", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given three integers A, B and C.\nDetermine whether C is not less than A and not greater than B.\n\nConstraints\n\n-100≤A,B,C≤100\n\nA, B and C are all integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the condition is satisfied, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 3 2\n\nSample Output 1\n\nYes\n\nC=2 is not less than A=1 and not greater than B=3, and thus the output should be Yes.\n\nSample Input 2\n\n6 5 4\n\nSample Output 2\n\nNo\n\nC=4 is less than A=6, and thus the output should be No.\n\nSample Input 3\n\n2 2 2\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 84, "cpu_time_ms": 11, "memory_kb": 2568}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s737564327", "group_id": "codeNet:p03721", "input_text": "n,k = map(int,input().split())\nl = [0]*10**5\nfor i in range(n):\n a,b = map(int,input().split())\n l[a-1] += b\nsum = 0\ni = 0\nwhile sum < k:\n sum += l[i] \n i += 1\nprint(i)", "language": "Python", "metadata": {"date": 1588103258, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03721.html", "problem_id": "p03721", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03721/input.txt", "sample_output_relpath": "derived/input_output/data/p03721/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03721/Python/s737564327.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s737564327", "user_id": "u636683284"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "n,k = map(int,input().split())\nl = [0]*10**5\nfor i in range(n):\n a,b = map(int,input().split())\n l[a-1] += b\nsum = 0\ni = 0\nwhile sum < k:\n sum += l[i] \n i += 1\nprint(i)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is an empty array.\nThe following N operations will be performed to insert integers into the array.\nIn the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array.\nFind the K-th smallest integer in the array after the N operations.\nFor example, the 4-th smallest integer in the array \\{1,2,2,3,3,3\\} is 3.\n\nConstraints\n\n1≤N≤10^5\n\n1≤a_i,b_i≤10^5\n\n1≤K≤b_1…+…b_n\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the K-th smallest integer in the array after the N operations.\n\nSample Input 1\n\n3 4\n1 1\n2 2\n3 3\n\nSample Output 1\n\n3\n\nThe resulting array is the same as the one in the problem statement.\n\nSample Input 2\n\n10 500000\n1 100000\n1 100000\n1 100000\n1 100000\n1 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n\nSample Output 2\n\n1", "sample_input": "3 4\n1 1\n2 2\n3 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03721", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is an empty array.\nThe following N operations will be performed to insert integers into the array.\nIn the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array.\nFind the K-th smallest integer in the array after the N operations.\nFor example, the 4-th smallest integer in the array \\{1,2,2,3,3,3\\} is 3.\n\nConstraints\n\n1≤N≤10^5\n\n1≤a_i,b_i≤10^5\n\n1≤K≤b_1…+…b_n\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the K-th smallest integer in the array after the N operations.\n\nSample Input 1\n\n3 4\n1 1\n2 2\n3 3\n\nSample Output 1\n\n3\n\nThe resulting array is the same as the one in the problem statement.\n\nSample Input 2\n\n10 500000\n1 100000\n1 100000\n1 100000\n1 100000\n1 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n\nSample Output 2\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 172, "cpu_time_ms": 611, "memory_kb": 45016}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s219623030", "group_id": "codeNet:p03722", "input_text": "def BellmanFord(edges,num_v,source):\n #グラフの初期化\n inf=float(\"inf\")\n dist=[inf for i in range(num_v)]\n dist[source-1]=0\n \n #辺の緩和\n for i in range(num_v):\n for edge in edges:\n if edge[0] != inf and dist[edge[1]-1] > dist[edge[0]-1] + edge[2]:\n dist[edge[1]-1] = dist[edge[0]-1] + edge[2]\n if i==num_v-1: return -1\n \n return dist\n\n\nN,M = [int(x) for x in input().split()]\nedges = []\nfor _ in range(N):\n l = [int(x) for x in input().split()]\n l[2]*=-1\n edges.append(l)\n\nroute = BellmanFord(edges,N,1)\nif(route == -1):\n print('inf')\nelse:\n print(-route[-1])\n", "language": "Python", "metadata": {"date": 1559876536, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03722.html", "problem_id": "p03722", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03722/input.txt", "sample_output_relpath": "derived/input_output/data/p03722/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03722/Python/s219623030.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s219623030", "user_id": "u923712635"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "def BellmanFord(edges,num_v,source):\n #グラフの初期化\n inf=float(\"inf\")\n dist=[inf for i in range(num_v)]\n dist[source-1]=0\n \n #辺の緩和\n for i in range(num_v):\n for edge in edges:\n if edge[0] != inf and dist[edge[1]-1] > dist[edge[0]-1] + edge[2]:\n dist[edge[1]-1] = dist[edge[0]-1] + edge[2]\n if i==num_v-1: return -1\n \n return dist\n\n\nN,M = [int(x) for x in input().split()]\nedges = []\nfor _ in range(N):\n l = [int(x) for x in input().split()]\n l[2]*=-1\n edges.append(l)\n\nroute = BellmanFord(edges,N,1)\nif(route == -1):\n print('inf')\nelse:\n print(-route[-1])\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a directed graph with N vertices and M edges.\nThe i-th edge (1≤i≤M) points from vertex a_i to vertex b_i, and has a weight c_i.\nWe will play the following single-player game using this graph and a piece.\n\nInitially, the piece is placed at vertex 1, and the score of the player is set to 0.\nThe player can move the piece as follows:\n\nWhen the piece is placed at vertex a_i, move the piece along the i-th edge to vertex b_i. After this move, the score of the player is increased by c_i.\n\nThe player can end the game only when the piece is placed at vertex N.\nThe given graph guarantees that it is possible to traverse from vertex 1 to vertex N.\n\nWhen the player acts optimally to maximize the score at the end of the game, what will the score be?\nIf it is possible to increase the score indefinitely, print inf.\n\nConstraints\n\n2≤N≤1000\n\n1≤M≤min(N(N-1),2000)\n\n1≤a_i,b_i≤N (1≤i≤M)\n\na_i≠b_i (1≤i≤M)\n\na_i≠a_j or b_i≠b_j (1≤i d[node] + graph[node][neighbour]:\n # Record this lower distance\n d[neighbour] = d[node] + graph[node][neighbour]\n p[neighbour] = node\n\ndef bellman_ford(graph, source):\n d, p = initialize(graph, source)\n for i in range(len(graph)-1): #Run this until is converges\n for u in graph:\n for v in graph[u]: #For each neighbour of u\n relax(u, v, graph, d, p) #Lets relax it\n\n # Step 3: check for negative-weight cycles\n for u in graph:\n for v in graph[u]:\n assert d[v] <= d[u] + graph[u][v]\n\n return d, p\n\nif __name__ == \"__main__\":\n\tn, m = map(int, input().split())\n\tgr = {k: dict() for k in range(1, n+1)}\n\tfor _ in range(m):\n\t\ta, b, c = map(int, input().split())\n\t\tgr[a][b] = -c\n\n\ttry:\n\t\td, p = bellman_ford(gr, 1)\n\t\tprint(-d[n])\n\texcept:\n\t\tprint('inf')\n", "language": "Python", "metadata": {"date": 1494728000, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03722.html", "problem_id": "p03722", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03722/input.txt", "sample_output_relpath": "derived/input_output/data/p03722/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03722/Python/s658095064.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s658095064", "user_id": "u631914718"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "# coding: utf-8\n\nimport pdb\n\n\n# Step 1: For each node prepare the destination and predecessor\ndef initialize(graph, source):\n d = {} # Stands for destination\n p = {} # Stands for predecessor\n for node in graph:\n d[node] = float('Inf') # We start admiting that the rest of nodes are very very far\n p[node] = None\n d[source] = 0 # For the source we know how to reach\n return d, p\n\ndef relax(node, neighbour, graph, d, p):\n # If the distance between the node and the neighbour is lower than the one I have now\n if d[neighbour] > d[node] + graph[node][neighbour]:\n # Record this lower distance\n d[neighbour] = d[node] + graph[node][neighbour]\n p[neighbour] = node\n\ndef bellman_ford(graph, source):\n d, p = initialize(graph, source)\n for i in range(len(graph)-1): #Run this until is converges\n for u in graph:\n for v in graph[u]: #For each neighbour of u\n relax(u, v, graph, d, p) #Lets relax it\n\n # Step 3: check for negative-weight cycles\n for u in graph:\n for v in graph[u]:\n assert d[v] <= d[u] + graph[u][v]\n\n return d, p\n\nif __name__ == \"__main__\":\n\tn, m = map(int, input().split())\n\tgr = {k: dict() for k in range(1, n+1)}\n\tfor _ in range(m):\n\t\ta, b, c = map(int, input().split())\n\t\tgr[a][b] = -c\n\n\ttry:\n\t\td, p = bellman_ford(gr, 1)\n\t\tprint(-d[n])\n\texcept:\n\t\tprint('inf')\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a directed graph with N vertices and M edges.\nThe i-th edge (1≤i≤M) points from vertex a_i to vertex b_i, and has a weight c_i.\nWe will play the following single-player game using this graph and a piece.\n\nInitially, the piece is placed at vertex 1, and the score of the player is set to 0.\nThe player can move the piece as follows:\n\nWhen the piece is placed at vertex a_i, move the piece along the i-th edge to vertex b_i. After this move, the score of the player is increased by c_i.\n\nThe player can end the game only when the piece is placed at vertex N.\nThe given graph guarantees that it is possible to traverse from vertex 1 to vertex N.\n\nWhen the player acts optimally to maximize the score at the end of the game, what will the score be?\nIf it is possible to increase the score indefinitely, print inf.\n\nConstraints\n\n2≤N≤1000\n\n1≤M≤min(N(N-1),2000)\n\n1≤a_i,b_i≤N (1≤i≤M)\n\na_i≠b_i (1≤i≤M)\n\na_i≠a_j or b_i≠b_j (1≤i 300:\n umtp = 300\n can.append(now[j][utmp])\nprint(max(can))", "language": "Python", "metadata": {"date": 1582742909, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03734.html", "problem_id": "p03734", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03734/input.txt", "sample_output_relpath": "derived/input_output/data/p03734/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03734/Python/s624907793.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s624907793", "user_id": "u111365362"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "#13:32\nn,u = map(int,input().split())\nnow = [[0 for _ in range(301)] for _ in range(101)]\nfor i in range(n):\n w,v = map(int,input().split())\n if i == 0:\n w0 = int(w)\n last = now\n now = [[0 for _ in range(301)] for _ in range(101)]\n for j in range(100):\n for k in range(298):\n now[j][k] = max(now[j][k],last[j][k])\n now[j+1][k+w-w0] = max(now[j+1][k+w-w0],last[j][k]+v)\ncan = []\nfor j in range(101):\n utmp = u - w0 * j\n if utmp < 0:\n break\n if utmp > 300:\n umtp = 300\n can.append(now[j][utmp])\nprint(max(can))", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou have N items and a bag of strength W.\nThe i-th item has a weight of w_i and a value of v_i.\n\nYou will select some of the items and put them in the bag.\nHere, the total weight of the selected items needs to be at most W.\n\nYour objective is to maximize the total value of the selected items.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ W ≤ 10^9\n\n1 ≤ w_i ≤ 10^9\n\nFor each i = 2,3,...,N, w_1 ≤ w_i ≤ w_1 + 3.\n\n1 ≤ v_i ≤ 10^7\n\nW, each w_i and v_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible total value of the selected items.\n\nSample Input 1\n\n4 6\n2 1\n3 4\n4 10\n3 4\n\nSample Output 1\n\n11\n\nThe first and third items should be selected.\n\nSample Input 2\n\n4 6\n2 1\n3 7\n4 10\n3 6\n\nSample Output 2\n\n13\n\nThe second and fourth items should be selected.\n\nSample Input 3\n\n4 10\n1 100\n1 100\n1 100\n1 100\n\nSample Output 3\n\n400\n\nYou can take everything.\n\nSample Input 4\n\n4 1\n10 100\n10 100\n10 100\n10 100\n\nSample Output 4\n\n0\n\nYou can take nothing.", "sample_input": "4 6\n2 1\n3 4\n4 10\n3 4\n"}, "reference_outputs": ["11\n"], "source_document_id": "p03734", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou have N items and a bag of strength W.\nThe i-th item has a weight of w_i and a value of v_i.\n\nYou will select some of the items and put them in the bag.\nHere, the total weight of the selected items needs to be at most W.\n\nYour objective is to maximize the total value of the selected items.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ W ≤ 10^9\n\n1 ≤ w_i ≤ 10^9\n\nFor each i = 2,3,...,N, w_1 ≤ w_i ≤ w_1 + 3.\n\n1 ≤ v_i ≤ 10^7\n\nW, each w_i and v_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible total value of the selected items.\n\nSample Input 1\n\n4 6\n2 1\n3 4\n4 10\n3 4\n\nSample Output 1\n\n11\n\nThe first and third items should be selected.\n\nSample Input 2\n\n4 6\n2 1\n3 7\n4 10\n3 6\n\nSample Output 2\n\n13\n\nThe second and fourth items should be selected.\n\nSample Input 3\n\n4 10\n1 100\n1 100\n1 100\n1 100\n\nSample Output 3\n\n400\n\nYou can take everything.\n\nSample Input 4\n\n4 1\n10 100\n10 100\n10 100\n10 100\n\nSample Output 4\n\n0\n\nYou can take nothing.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 539, "cpu_time_ms": 341, "memory_kb": 54748}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s860326559", "group_id": "codeNet:p03737", "input_text": "import sys\ninput = lambda: sys.stdin.readline().rstrip()\n\ndef main():\n words = list(input().split())\n print((words[0][0]+words[1][0]+words[2][0]).upper())\n\nif __name__ == '__main__':\n main()", "language": "Python", "metadata": {"date": 1600232189, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03737.html", "problem_id": "p03737", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03737/input.txt", "sample_output_relpath": "derived/input_output/data/p03737/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03737/Python/s860326559.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s860326559", "user_id": "u340040203"}, "prompt_components": {"gold_output": "ABC\n", "input_to_evaluate": "import sys\ninput = lambda: sys.stdin.readline().rstrip()\n\ndef main():\n words = list(input().split())\n print((words[0][0]+words[1][0]+words[2][0]).upper())\n\nif __name__ == '__main__':\n main()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between.\nPrint the acronym formed from the uppercased initial letters of the words.\n\nConstraints\n\ns_1, s_2 and s_3 are composed of lowercase English letters.\n\n1 ≤ |s_i| ≤ 10 (1≤i≤3)\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_1 s_2 s_3\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\natcoder beginner contest\n\nSample Output 1\n\nABC\n\nThe initial letters of atcoder, beginner and contest are a, b and c. Uppercase and concatenate them to obtain ABC.\n\nSample Input 2\n\nresident register number\n\nSample Output 2\n\nRRN\n\nSample Input 3\n\nk nearest neighbor\n\nSample Output 3\n\nKNN\n\nSample Input 4\n\nasync layered coding\n\nSample Output 4\n\nALC", "sample_input": "atcoder beginner contest\n"}, "reference_outputs": ["ABC\n"], "source_document_id": "p03737", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between.\nPrint the acronym formed from the uppercased initial letters of the words.\n\nConstraints\n\ns_1, s_2 and s_3 are composed of lowercase English letters.\n\n1 ≤ |s_i| ≤ 10 (1≤i≤3)\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_1 s_2 s_3\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\natcoder beginner contest\n\nSample Output 1\n\nABC\n\nThe initial letters of atcoder, beginner and contest are a, b and c. Uppercase and concatenate them to obtain ABC.\n\nSample Input 2\n\nresident register number\n\nSample Output 2\n\nRRN\n\nSample Input 3\n\nk nearest neighbor\n\nSample Output 3\n\nKNN\n\nSample Input 4\n\nasync layered coding\n\nSample Output 4\n\nALC", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 199, "cpu_time_ms": 30, "memory_kb": 9008}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s959803209", "group_id": "codeNet:p03738", "input_text": "def main():\n\n a = int(input())\n b = int(input())\n\n if a > b:\n print(\"GREATER\")\n elif a = b:\n print(\"EQUAL\")\n else:\n print(\"LESS\")\n\nmain()", "language": "Python", "metadata": {"date": 1591547118, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03738.html", "problem_id": "p03738", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03738/input.txt", "sample_output_relpath": "derived/input_output/data/p03738/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03738/Python/s959803209.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s959803209", "user_id": "u152614052"}, "prompt_components": {"gold_output": "GREATER\n", "input_to_evaluate": "def main():\n\n a = int(input())\n b = int(input())\n\n if a > b:\n print(\"GREATER\")\n elif a = b:\n print(\"EQUAL\")\n else:\n print(\"LESS\")\n\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given two positive integers A and B. Compare the magnitudes of these numbers.\n\nConstraints\n\n1 ≤ A, B ≤ 10^{100}\n\nNeither A nor B begins with a 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\n\nOutput\n\nPrint GREATER if A>B, LESS if A24, print GREATER.\n\nSample Input 2\n\n850\n3777\n\nSample Output 2\n\nLESS\n\nSample Input 3\n\n9720246\n22516266\n\nSample Output 3\n\nLESS\n\nSample Input 4\n\n123456789012345678901234567890\n234567890123456789012345678901\n\nSample Output 4\n\nLESS", "sample_input": "36\n24\n"}, "reference_outputs": ["GREATER\n"], "source_document_id": "p03738", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given two positive integers A and B. Compare the magnitudes of these numbers.\n\nConstraints\n\n1 ≤ A, B ≤ 10^{100}\n\nNeither A nor B begins with a 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\n\nOutput\n\nPrint GREATER if A>B, LESS if A24, print GREATER.\n\nSample Input 2\n\n850\n3777\n\nSample Output 2\n\nLESS\n\nSample Input 3\n\n9720246\n22516266\n\nSample Output 3\n\nLESS\n\nSample Input 4\n\n123456789012345678901234567890\n234567890123456789012345678901\n\nSample Output 4\n\nLESS", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 173, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s404043445", "group_id": "codeNet:p03738", "input_text": "a = int(raw_input())\nb = int(raw_input())\nif a>b:\n print 'GREATER'\nelif ab:\n print 'GREATER'\nelif aB, LESS if A24, print GREATER.\n\nSample Input 2\n\n850\n3777\n\nSample Output 2\n\nLESS\n\nSample Input 3\n\n9720246\n22516266\n\nSample Output 3\n\nLESS\n\nSample Input 4\n\n123456789012345678901234567890\n234567890123456789012345678901\n\nSample Output 4\n\nLESS", "sample_input": "36\n24\n"}, "reference_outputs": ["GREATER\n"], "source_document_id": "p03738", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given two positive integers A and B. Compare the magnitudes of these numbers.\n\nConstraints\n\n1 ≤ A, B ≤ 10^{100}\n\nNeither A nor B begins with a 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\n\nOutput\n\nPrint GREATER if A>B, LESS if A24, print GREATER.\n\nSample Input 2\n\n850\n3777\n\nSample Output 2\n\nLESS\n\nSample Input 3\n\n9720246\n22516266\n\nSample Output 3\n\nLESS\n\nSample Input 4\n\n123456789012345678901234567890\n234567890123456789012345678901\n\nSample Output 4\n\nLESS", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 120, "cpu_time_ms": 10, "memory_kb": 2568}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s626739344", "group_id": "codeNet:p03761", "input_text": "#!/usr/bin/env python3\nimport sys\nfrom collections import Counter\n\ndef solve(n: int, S: \"List[str]\"):\n counter_list = [Counter(S[i]) for i in range(n)]\n\n a = dict(counter_list[0].items())\n a_keys = list(counter_list[0].keys())\n for cl in counter_list[1:]:\n for key,value in list(cl.items()):\n if key in a_keys and a[key]>value:\n a[key] = value\n\n for cl in counter_list[1:]:\n for key in list(a.keys()):\n if key not in list(cl.keys()):\n a.pop(key)\n \n answer = \"\"\n for key,value in a.items():\n answer += key*value\n answer = list(answer)\n answer.sort()\n print(\"\".join(answer))\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n n = int(next(tokens)) # type: int\n S = [next(tokens) for _ in range(n)] # type: \"List[str]\"\n solve(n, S)\n\nif __name__ == '__main__':\n main()\n", "language": "Python", "metadata": {"date": 1572223265, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03761.html", "problem_id": "p03761", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03761/input.txt", "sample_output_relpath": "derived/input_output/data/p03761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03761/Python/s626739344.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s626739344", "user_id": "u020390084"}, "prompt_components": {"gold_output": "aac\n", "input_to_evaluate": "#!/usr/bin/env python3\nimport sys\nfrom collections import Counter\n\ndef solve(n: int, S: \"List[str]\"):\n counter_list = [Counter(S[i]) for i in range(n)]\n\n a = dict(counter_list[0].items())\n a_keys = list(counter_list[0].keys())\n for cl in counter_list[1:]:\n for key,value in list(cl.items()):\n if key in a_keys and a[key]>value:\n a[key] = value\n\n for cl in counter_list[1:]:\n for key in list(a.keys()):\n if key not in list(cl.keys()):\n a.pop(key)\n \n answer = \"\"\n for key,value in a.items():\n answer += key*value\n answer = list(answer)\n answer.sort()\n print(\"\".join(answer))\n return\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n n = int(next(tokens)) # type: int\n S = [next(tokens) for _ in range(n)] # type: \"List[str]\"\n solve(n, S)\n\nif __name__ == '__main__':\n main()\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke loves \"paper cutting\": he cuts out characters from a newspaper headline and rearranges them to form another string.\n\nHe will receive a headline which contains one of the strings S_1,...,S_n tomorrow.\nHe is excited and already thinking of what string he will create.\nSince he does not know the string on the headline yet, he is interested in strings that can be created regardless of which string the headline contains.\n\nFind the longest string that can be created regardless of which string among S_1,...,S_n the headline contains.\nIf there are multiple such strings, find the lexicographically smallest one among them.\n\nConstraints\n\n1 \\leq n \\leq 50\n\n1 \\leq |S_i| \\leq 50 for every i = 1, ..., n.\n\nS_i consists of lowercase English letters (a - z) for every i = 1, ..., n.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nS_1\n...\nS_n\n\nOutput\n\nPrint the lexicographically smallest string among the longest strings that satisfy the condition.\nIf the answer is an empty string, print an empty line.\n\nSample Input 1\n\n3\ncbaa\ndaacc\nacacac\n\nSample Output 1\n\naac\n\nThe strings that can be created from each of cbaa, daacc and acacac, are aa, aac, aca, caa and so forth.\nAmong them, aac, aca and caa are the longest, and the lexicographically smallest of these three is aac.\n\nSample Input 2\n\n3\na\naa\nb\n\nSample Output 2\n\nThe answer is an empty string.", "sample_input": "3\ncbaa\ndaacc\nacacac\n"}, "reference_outputs": ["aac\n"], "source_document_id": "p03761", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke loves \"paper cutting\": he cuts out characters from a newspaper headline and rearranges them to form another string.\n\nHe will receive a headline which contains one of the strings S_1,...,S_n tomorrow.\nHe is excited and already thinking of what string he will create.\nSince he does not know the string on the headline yet, he is interested in strings that can be created regardless of which string the headline contains.\n\nFind the longest string that can be created regardless of which string among S_1,...,S_n the headline contains.\nIf there are multiple such strings, find the lexicographically smallest one among them.\n\nConstraints\n\n1 \\leq n \\leq 50\n\n1 \\leq |S_i| \\leq 50 for every i = 1, ..., n.\n\nS_i consists of lowercase English letters (a - z) for every i = 1, ..., n.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nS_1\n...\nS_n\n\nOutput\n\nPrint the lexicographically smallest string among the longest strings that satisfy the condition.\nIf the answer is an empty string, print an empty line.\n\nSample Input 1\n\n3\ncbaa\ndaacc\nacacac\n\nSample Output 1\n\naac\n\nThe strings that can be created from each of cbaa, daacc and acacac, are aa, aac, aca, caa and so forth.\nAmong them, aac, aca and caa are the longest, and the lexicographically smallest of these three is aac.\n\nSample Input 2\n\n3\na\naa\nb\n\nSample Output 2\n\nThe answer is an empty string.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1012, "cpu_time_ms": 129, "memory_kb": 3828}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s681547674", "group_id": "codeNet:p03767", "input_text": "n = int(input())\na = list(map(int,input().split()))\na.sort()\nans = 0\nfor i in range(n):\n ans += a[-2-2*i]\nprint(ans)", "language": "Python", "metadata": {"date": 1601264712, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p03767.html", "problem_id": "p03767", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03767/input.txt", "sample_output_relpath": "derived/input_output/data/p03767/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03767/Python/s681547674.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s681547674", "user_id": "u397953026"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "n = int(input())\na = list(map(int,input().split()))\na.sort()\nans = 0\nfor i in range(n):\n ans += a[-2-2*i]\nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are 3N participants in AtCoder Group Contest.\nThe strength of the i-th participant is represented by an integer a_i.\nThey will form N teams, each consisting of three participants.\nNo participant may belong to multiple teams.\n\nThe strength of a team is defined as the second largest strength among its members.\nFor example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3.\n\nFind the maximum possible sum of the strengths of N teams.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ 10^{9}\n\na_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_{3N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2\n5 2 8 5 1 5\n\nSample Output 1\n\n10\n\nThe following is one formation of teams that maximizes the sum of the strengths of teams:\n\nTeam 1: consists of the first, fourth and fifth participants.\n\nTeam 2: consists of the second, third and sixth participants.\n\nSample Input 2\n\n10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 2\n\n10000000000\n\nThe sum of the strengths can be quite large.", "sample_input": "2\n5 2 8 5 1 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03767", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are 3N participants in AtCoder Group Contest.\nThe strength of the i-th participant is represented by an integer a_i.\nThey will form N teams, each consisting of three participants.\nNo participant may belong to multiple teams.\n\nThe strength of a team is defined as the second largest strength among its members.\nFor example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3.\n\nFind the maximum possible sum of the strengths of N teams.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ 10^{9}\n\na_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_{3N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2\n5 2 8 5 1 5\n\nSample Output 1\n\n10\n\nThe following is one formation of teams that maximizes the sum of the strengths of teams:\n\nTeam 1: consists of the first, fourth and fifth participants.\n\nTeam 2: consists of the second, third and sixth participants.\n\nSample Input 2\n\n10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 2\n\n10000000000\n\nThe sum of the strengths can be quite large.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 119, "cpu_time_ms": 167, "memory_kb": 104812}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s065343200", "group_id": "codeNet:p03767", "input_text": "n = int(input())\nl = list(map(int, input().split()))\nl.sort()\nprint(sum(l[n::2]))", "language": "Python", "metadata": {"date": 1584981271, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03767.html", "problem_id": "p03767", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03767/input.txt", "sample_output_relpath": "derived/input_output/data/p03767/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03767/Python/s065343200.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s065343200", "user_id": "u394731058"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "n = int(input())\nl = list(map(int, input().split()))\nl.sort()\nprint(sum(l[n::2]))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are 3N participants in AtCoder Group Contest.\nThe strength of the i-th participant is represented by an integer a_i.\nThey will form N teams, each consisting of three participants.\nNo participant may belong to multiple teams.\n\nThe strength of a team is defined as the second largest strength among its members.\nFor example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3.\n\nFind the maximum possible sum of the strengths of N teams.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ 10^{9}\n\na_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_{3N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2\n5 2 8 5 1 5\n\nSample Output 1\n\n10\n\nThe following is one formation of teams that maximizes the sum of the strengths of teams:\n\nTeam 1: consists of the first, fourth and fifth participants.\n\nTeam 2: consists of the second, third and sixth participants.\n\nSample Input 2\n\n10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 2\n\n10000000000\n\nThe sum of the strengths can be quite large.", "sample_input": "2\n5 2 8 5 1 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03767", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are 3N participants in AtCoder Group Contest.\nThe strength of the i-th participant is represented by an integer a_i.\nThey will form N teams, each consisting of three participants.\nNo participant may belong to multiple teams.\n\nThe strength of a team is defined as the second largest strength among its members.\nFor example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3.\n\nFind the maximum possible sum of the strengths of N teams.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ 10^{9}\n\na_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_{3N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2\n5 2 8 5 1 5\n\nSample Output 1\n\n10\n\nThe following is one formation of teams that maximizes the sum of the strengths of teams:\n\nTeam 1: consists of the first, fourth and fifth participants.\n\nTeam 2: consists of the second, third and sixth participants.\n\nSample Input 2\n\n10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 2\n\n10000000000\n\nThe sum of the strengths can be quite large.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 81, "cpu_time_ms": 210, "memory_kb": 37084}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s060920826", "group_id": "codeNet:p03773", "input_text": "a, b = map(int,input().split())\nif a+b >= 24:\n print(a + b -24)\nelse:\n print(a+b)", "language": "Python", "metadata": {"date": 1590696754, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03773.html", "problem_id": "p03773", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03773/input.txt", "sample_output_relpath": "derived/input_output/data/p03773/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03773/Python/s060920826.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s060920826", "user_id": "u518958552"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "a, b = map(int,input().split())\nif a+b >= 24:\n print(a + b -24)\nelse:\n print(a+b)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nDolphin loves programming contests. Today, he will take part in a contest in AtCoder.\n\nIn this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as \"21 o'clock\".\n\nThe current time is A o'clock, and a contest will begin in exactly B hours.\nWhen will the contest begin? Answer in 24-hour time.\n\nConstraints\n\n0 \\leq A,B \\leq 23\n\nA and B are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the hour of the starting time of the contest in 24-hour time.\n\nSample Input 1\n\n9 12\n\nSample Output 1\n\n21\n\nIn this input, the current time is 9 o'clock, and 12 hours later it will be 21 o'clock in 24-hour time.\n\nSample Input 2\n\n19 0\n\nSample Output 2\n\n19\n\nThe contest has just started.\n\nSample Input 3\n\n23 2\n\nSample Output 3\n\n1\n\nThe contest will begin at 1 o'clock the next day.", "sample_input": "9 12\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03773", "source_text": "Score : 100 points\n\nProblem Statement\n\nDolphin loves programming contests. Today, he will take part in a contest in AtCoder.\n\nIn this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as \"21 o'clock\".\n\nThe current time is A o'clock, and a contest will begin in exactly B hours.\nWhen will the contest begin? Answer in 24-hour time.\n\nConstraints\n\n0 \\leq A,B \\leq 23\n\nA and B are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the hour of the starting time of the contest in 24-hour time.\n\nSample Input 1\n\n9 12\n\nSample Output 1\n\n21\n\nIn this input, the current time is 9 o'clock, and 12 hours later it will be 21 o'clock in 24-hour time.\n\nSample Input 2\n\n19 0\n\nSample Output 2\n\n19\n\nThe contest has just started.\n\nSample Input 3\n\n23 2\n\nSample Output 3\n\n1\n\nThe contest will begin at 1 o'clock the next day.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 87, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s708321914", "group_id": "codeNet:p03773", "input_text": "print(sum(list(int(i) for i in input().split()))%24)", "language": "Python", "metadata": {"date": 1553521779, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03773.html", "problem_id": "p03773", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03773/input.txt", "sample_output_relpath": "derived/input_output/data/p03773/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03773/Python/s708321914.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s708321914", "user_id": "u268516119"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "print(sum(list(int(i) for i in input().split()))%24)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nDolphin loves programming contests. Today, he will take part in a contest in AtCoder.\n\nIn this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as \"21 o'clock\".\n\nThe current time is A o'clock, and a contest will begin in exactly B hours.\nWhen will the contest begin? Answer in 24-hour time.\n\nConstraints\n\n0 \\leq A,B \\leq 23\n\nA and B are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the hour of the starting time of the contest in 24-hour time.\n\nSample Input 1\n\n9 12\n\nSample Output 1\n\n21\n\nIn this input, the current time is 9 o'clock, and 12 hours later it will be 21 o'clock in 24-hour time.\n\nSample Input 2\n\n19 0\n\nSample Output 2\n\n19\n\nThe contest has just started.\n\nSample Input 3\n\n23 2\n\nSample Output 3\n\n1\n\nThe contest will begin at 1 o'clock the next day.", "sample_input": "9 12\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03773", "source_text": "Score : 100 points\n\nProblem Statement\n\nDolphin loves programming contests. Today, he will take part in a contest in AtCoder.\n\nIn this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as \"21 o'clock\".\n\nThe current time is A o'clock, and a contest will begin in exactly B hours.\nWhen will the contest begin? Answer in 24-hour time.\n\nConstraints\n\n0 \\leq A,B \\leq 23\n\nA and B are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the hour of the starting time of the contest in 24-hour time.\n\nSample Input 1\n\n9 12\n\nSample Output 1\n\n21\n\nIn this input, the current time is 9 o'clock, and 12 hours later it will be 21 o'clock in 24-hour time.\n\nSample Input 2\n\n19 0\n\nSample Output 2\n\n19\n\nThe contest has just started.\n\nSample Input 3\n\n23 2\n\nSample Output 3\n\n1\n\nThe contest will begin at 1 o'clock the next day.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 52, "cpu_time_ms": 17, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s400408546", "group_id": "codeNet:p03774", "input_text": "# -*- coding: utf-8 -*-\n\n# input\nN, M = map(int, input().split())\nab = [list(map(int, input().split())) for i in range(N)]\ncd = [list(map(int, input().split())) for i in range(M)]\n\n# solve & output\nfor i in range(N):\n min_diff = 10 ** 8\n for j in range(M):\n diff = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])\n if min_diff > diff:\n min_diff = diff\n ans = j + 1\n print(ans)\n", "language": "Python", "metadata": {"date": 1566348059, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03774.html", "problem_id": "p03774", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03774/input.txt", "sample_output_relpath": "derived/input_output/data/p03774/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03774/Python/s400408546.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s400408546", "user_id": "u263226212"}, "prompt_components": {"gold_output": "2\n1\n", "input_to_evaluate": "# -*- coding: utf-8 -*-\n\n# input\nN, M = map(int, input().split())\nab = [list(map(int, input().split())) for i in range(N)]\ncd = [list(map(int, input().split())) for i in range(M)]\n\n# solve & output\nfor i in range(N):\n min_diff = 10 ** 8\n for j in range(M):\n diff = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])\n if min_diff > diff:\n min_diff = diff\n ans = j + 1\n print(ans)\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N students and M checkpoints on the xy-plane.\n\nThe coordinates of the i-th student (1 \\leq i \\leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \\leq j \\leq M) is (c_j,d_j).\n\nWhen the teacher gives a signal, each student has to go to the nearest checkpoint measured in Manhattan distance.\n\nThe Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.\n\nHere, |x| denotes the absolute value of x.\n\nIf there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.\n\nWhich checkpoint will each student go to?\n\nConstraints\n\n1 \\leq N,M \\leq 50\n\n-10^8 \\leq a_i,b_i,c_j,d_j \\leq 10^8\n\nAll input values are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_N b_N\nc_1 d_1\n:\nc_M d_M\n\nOutput\n\nPrint N lines.\n\nThe i-th line (1 \\leq i \\leq N) should contain the index of the checkpoint for the i-th student to go.\n\nSample Input 1\n\n2 2\n2 0\n0 0\n-1 0\n1 0\n\nSample Output 1\n\n2\n1\n\nThe Manhattan distance between the first student and each checkpoint is:\n\nFor checkpoint 1: |2-(-1)|+|0-0|=3\n\nFor checkpoint 2: |2-1|+|0-0|=1\n\nThe nearest checkpoint is checkpoint 2. Thus, the first line in the output should contain 2.\n\nThe Manhattan distance between the second student and each checkpoint is:\n\nFor checkpoint 1: |0-(-1)|+|0-0|=1\n\nFor checkpoint 2: |0-1|+|0-0|=1\n\nWhen there are multiple nearest checkpoints, the student will go to the checkpoint with the smallest index. Thus, the second line in the output should contain 1.\n\nSample Input 2\n\n3 4\n10 10\n-10 -10\n3 3\n1 2\n2 3\n3 5\n3 5\n\nSample Output 2\n\n3\n1\n2\n\nThere can be multiple checkpoints at the same coordinates.\n\nSample Input 3\n\n5 5\n-100000000 -100000000\n-100000000 100000000\n100000000 -100000000\n100000000 100000000\n0 0\n0 0\n100000000 100000000\n100000000 -100000000\n-100000000 100000000\n-100000000 -100000000\n\nSample Output 3\n\n5\n4\n3\n2\n1", "sample_input": "2 2\n2 0\n0 0\n-1 0\n1 0\n"}, "reference_outputs": ["2\n1\n"], "source_document_id": "p03774", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N students and M checkpoints on the xy-plane.\n\nThe coordinates of the i-th student (1 \\leq i \\leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \\leq j \\leq M) is (c_j,d_j).\n\nWhen the teacher gives a signal, each student has to go to the nearest checkpoint measured in Manhattan distance.\n\nThe Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.\n\nHere, |x| denotes the absolute value of x.\n\nIf there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.\n\nWhich checkpoint will each student go to?\n\nConstraints\n\n1 \\leq N,M \\leq 50\n\n-10^8 \\leq a_i,b_i,c_j,d_j \\leq 10^8\n\nAll input values are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_N b_N\nc_1 d_1\n:\nc_M d_M\n\nOutput\n\nPrint N lines.\n\nThe i-th line (1 \\leq i \\leq N) should contain the index of the checkpoint for the i-th student to go.\n\nSample Input 1\n\n2 2\n2 0\n0 0\n-1 0\n1 0\n\nSample Output 1\n\n2\n1\n\nThe Manhattan distance between the first student and each checkpoint is:\n\nFor checkpoint 1: |2-(-1)|+|0-0|=3\n\nFor checkpoint 2: |2-1|+|0-0|=1\n\nThe nearest checkpoint is checkpoint 2. Thus, the first line in the output should contain 2.\n\nThe Manhattan distance between the second student and each checkpoint is:\n\nFor checkpoint 1: |0-(-1)|+|0-0|=1\n\nFor checkpoint 2: |0-1|+|0-0|=1\n\nWhen there are multiple nearest checkpoints, the student will go to the checkpoint with the smallest index. Thus, the second line in the output should contain 1.\n\nSample Input 2\n\n3 4\n10 10\n-10 -10\n3 3\n1 2\n2 3\n3 5\n3 5\n\nSample Output 2\n\n3\n1\n2\n\nThere can be multiple checkpoints at the same coordinates.\n\nSample Input 3\n\n5 5\n-100000000 -100000000\n-100000000 100000000\n100000000 -100000000\n100000000 100000000\n0 0\n0 0\n100000000 100000000\n100000000 -100000000\n-100000000 100000000\n-100000000 -100000000\n\nSample Output 3\n\n5\n4\n3\n2\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 425, "cpu_time_ms": 19, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s746873742", "group_id": "codeNet:p03774", "input_text": "def solve():\n ar = raw_input().split(' ')\n N = int(ar[0])\n M = int(ar[1])\n sts = []\n for n in range(N) :\n ar = raw_input().split(' ')\n a = int(ar[0])\n b = int(ar[1])\n sts.append((a, b))\n cks = []\n for m in range(M) :\n ar = raw_input().split(' ')\n c = int(ar[0])\n d = int(ar[1])\n cks.append((c, d))\n\n for st in sts :\n #print st\n mind = float('inf')\n mini = -1\n for i in range(M):\n ckx = cks[i][0]\n cky = cks[i][1]\n d = abs(st[0] - ckx) + abs(st[1] - cky)\n #print 'd=',d\n if d < mind :\n mind = d\n mini = i\n #print 'mind=',mind, ',mini=',mini \n print mini + 1\n\nif __name__ == '__main__':\n solve()", "language": "Python", "metadata": {"date": 1495673874, "filename_ext": "py", "original_language": "Python (2.7.6)", "problem_description_relpath": "problem_descriptions/p03774.html", "problem_id": "p03774", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03774/input.txt", "sample_output_relpath": "derived/input_output/data/p03774/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03774/Python/s746873742.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s746873742", "user_id": "u761320129"}, "prompt_components": {"gold_output": "2\n1\n", "input_to_evaluate": "def solve():\n ar = raw_input().split(' ')\n N = int(ar[0])\n M = int(ar[1])\n sts = []\n for n in range(N) :\n ar = raw_input().split(' ')\n a = int(ar[0])\n b = int(ar[1])\n sts.append((a, b))\n cks = []\n for m in range(M) :\n ar = raw_input().split(' ')\n c = int(ar[0])\n d = int(ar[1])\n cks.append((c, d))\n\n for st in sts :\n #print st\n mind = float('inf')\n mini = -1\n for i in range(M):\n ckx = cks[i][0]\n cky = cks[i][1]\n d = abs(st[0] - ckx) + abs(st[1] - cky)\n #print 'd=',d\n if d < mind :\n mind = d\n mini = i\n #print 'mind=',mind, ',mini=',mini \n print mini + 1\n\nif __name__ == '__main__':\n solve()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N students and M checkpoints on the xy-plane.\n\nThe coordinates of the i-th student (1 \\leq i \\leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \\leq j \\leq M) is (c_j,d_j).\n\nWhen the teacher gives a signal, each student has to go to the nearest checkpoint measured in Manhattan distance.\n\nThe Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.\n\nHere, |x| denotes the absolute value of x.\n\nIf there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.\n\nWhich checkpoint will each student go to?\n\nConstraints\n\n1 \\leq N,M \\leq 50\n\n-10^8 \\leq a_i,b_i,c_j,d_j \\leq 10^8\n\nAll input values are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_N b_N\nc_1 d_1\n:\nc_M d_M\n\nOutput\n\nPrint N lines.\n\nThe i-th line (1 \\leq i \\leq N) should contain the index of the checkpoint for the i-th student to go.\n\nSample Input 1\n\n2 2\n2 0\n0 0\n-1 0\n1 0\n\nSample Output 1\n\n2\n1\n\nThe Manhattan distance between the first student and each checkpoint is:\n\nFor checkpoint 1: |2-(-1)|+|0-0|=3\n\nFor checkpoint 2: |2-1|+|0-0|=1\n\nThe nearest checkpoint is checkpoint 2. Thus, the first line in the output should contain 2.\n\nThe Manhattan distance between the second student and each checkpoint is:\n\nFor checkpoint 1: |0-(-1)|+|0-0|=1\n\nFor checkpoint 2: |0-1|+|0-0|=1\n\nWhen there are multiple nearest checkpoints, the student will go to the checkpoint with the smallest index. Thus, the second line in the output should contain 1.\n\nSample Input 2\n\n3 4\n10 10\n-10 -10\n3 3\n1 2\n2 3\n3 5\n3 5\n\nSample Output 2\n\n3\n1\n2\n\nThere can be multiple checkpoints at the same coordinates.\n\nSample Input 3\n\n5 5\n-100000000 -100000000\n-100000000 100000000\n100000000 -100000000\n100000000 100000000\n0 0\n0 0\n100000000 100000000\n100000000 -100000000\n-100000000 100000000\n-100000000 -100000000\n\nSample Output 3\n\n5\n4\n3\n2\n1", "sample_input": "2 2\n2 0\n0 0\n-1 0\n1 0\n"}, "reference_outputs": ["2\n1\n"], "source_document_id": "p03774", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N students and M checkpoints on the xy-plane.\n\nThe coordinates of the i-th student (1 \\leq i \\leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \\leq j \\leq M) is (c_j,d_j).\n\nWhen the teacher gives a signal, each student has to go to the nearest checkpoint measured in Manhattan distance.\n\nThe Manhattan distance between two points (x_1,y_1) and (x_2,y_2) is |x_1-x_2|+|y_1-y_2|.\n\nHere, |x| denotes the absolute value of x.\n\nIf there are multiple nearest checkpoints for a student, he/she will select the checkpoint with the smallest index.\n\nWhich checkpoint will each student go to?\n\nConstraints\n\n1 \\leq N,M \\leq 50\n\n-10^8 \\leq a_i,b_i,c_j,d_j \\leq 10^8\n\nAll input values are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_N b_N\nc_1 d_1\n:\nc_M d_M\n\nOutput\n\nPrint N lines.\n\nThe i-th line (1 \\leq i \\leq N) should contain the index of the checkpoint for the i-th student to go.\n\nSample Input 1\n\n2 2\n2 0\n0 0\n-1 0\n1 0\n\nSample Output 1\n\n2\n1\n\nThe Manhattan distance between the first student and each checkpoint is:\n\nFor checkpoint 1: |2-(-1)|+|0-0|=3\n\nFor checkpoint 2: |2-1|+|0-0|=1\n\nThe nearest checkpoint is checkpoint 2. Thus, the first line in the output should contain 2.\n\nThe Manhattan distance between the second student and each checkpoint is:\n\nFor checkpoint 1: |0-(-1)|+|0-0|=1\n\nFor checkpoint 2: |0-1|+|0-0|=1\n\nWhen there are multiple nearest checkpoints, the student will go to the checkpoint with the smallest index. Thus, the second line in the output should contain 1.\n\nSample Input 2\n\n3 4\n10 10\n-10 -10\n3 3\n1 2\n2 3\n3 5\n3 5\n\nSample Output 2\n\n3\n1\n2\n\nThere can be multiple checkpoints at the same coordinates.\n\nSample Input 3\n\n5 5\n-100000000 -100000000\n-100000000 100000000\n100000000 -100000000\n100000000 100000000\n0 0\n0 0\n100000000 100000000\n100000000 -100000000\n-100000000 100000000\n-100000000 -100000000\n\nSample Output 3\n\n5\n4\n3\n2\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 683, "cpu_time_ms": 12, "memory_kb": 2696}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s941138744", "group_id": "codeNet:p03775", "input_text": "n = int(input())\n\n\ndef make_divisors(n):\n lower_divisors, upper_divisors = [], []\n i = 1\n while i*i <= n:\n if n % i == 0:\n lower_divisors.append(i)\n if i != n // i:\n upper_divisors.append(n//i)\n i += 1\n return lower_divisors + upper_divisors[::-1]\n\n\nli = make_divisors(n)\n\nans = float(\"inf\")\n\nfor i in li:\n x = n // i\n ans = min(ans, max(len(str(i)), len(str(x))))\n\nprint(ans)", "language": "Python", "metadata": {"date": 1590851308, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03775.html", "problem_id": "p03775", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03775/input.txt", "sample_output_relpath": "derived/input_output/data/p03775/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03775/Python/s941138744.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s941138744", "user_id": "u860002137"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "n = int(input())\n\n\ndef make_divisors(n):\n lower_divisors, upper_divisors = [], []\n i = 1\n while i*i <= n:\n if n % i == 0:\n lower_divisors.append(i)\n if i != n // i:\n upper_divisors.append(n//i)\n i += 1\n return lower_divisors + upper_divisors[::-1]\n\n\nli = make_divisors(n)\n\nans = float(\"inf\")\n\nfor i in li:\n x = n // i\n ans = min(ans, max(len(str(i)), len(str(x))))\n\nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "sample_input": "10000\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03775", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 445, "cpu_time_ms": 35, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s797720163", "group_id": "codeNet:p03775", "input_text": "import math\nn = int(input())\nnn = int(math.sqrt(n))\nwhile n%nn != 0: nn-=1\nans = len(str(n/nn))\nprint(ans)", "language": "Python", "metadata": {"date": 1490816715, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03775.html", "problem_id": "p03775", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03775/input.txt", "sample_output_relpath": "derived/input_output/data/p03775/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03775/Python/s797720163.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s797720163", "user_id": "u054556734"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import math\nn = int(input())\nnn = int(math.sqrt(n))\nwhile n%nn != 0: nn-=1\nans = len(str(n/nn))\nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "sample_input": "10000\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03775", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 106, "cpu_time_ms": 36, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s052358638", "group_id": "codeNet:p03779", "input_text": "x=int(input())\nfor i in range(10**5):\n if 2*x<=(i+1)*i:\n print(i)\n break", "language": "Python", "metadata": {"date": 1592108893, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03779.html", "problem_id": "p03779", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03779/input.txt", "sample_output_relpath": "derived/input_output/data/p03779/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03779/Python/s052358638.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s052358638", "user_id": "u193927973"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "x=int(input())\nfor i in range(10**5):\n if 2*x<=(i+1)*i:\n print(i)\n break", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0.\nDuring the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right.\nThat is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i.\nThe kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible.\nFind the earliest possible time to reach coordinate X.\n\nConstraints\n\nX is an integer.\n\n1≤X≤10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the earliest possible time for the kangaroo to reach coordinate X.\n\nSample Input 1\n\n6\n\nSample Output 1\n\n3\n\nThe kangaroo can reach his nest at time 3 by jumping to the right three times, which is the earliest possible time.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n2\n\nHe can reach his nest at time 2 by staying at his position during the first second, and jumping to the right at the next second.\n\nSample Input 3\n\n11\n\nSample Output 3\n\n5", "sample_input": "6\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03779", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0.\nDuring the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right.\nThat is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i.\nThe kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible.\nFind the earliest possible time to reach coordinate X.\n\nConstraints\n\nX is an integer.\n\n1≤X≤10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the earliest possible time for the kangaroo to reach coordinate X.\n\nSample Input 1\n\n6\n\nSample Output 1\n\n3\n\nThe kangaroo can reach his nest at time 3 by jumping to the right three times, which is the earliest possible time.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n2\n\nHe can reach his nest at time 2 by staying at his position during the first second, and jumping to the right at the next second.\n\nSample Input 3\n\n11\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 79, "cpu_time_ms": 26, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s991757789", "group_id": "codeNet:p03795", "input_text": "a=int(input())\nprint(a*800-a//15*200)", "language": "Python", "metadata": {"date": 1594097016, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03795.html", "problem_id": "p03795", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03795/input.txt", "sample_output_relpath": "derived/input_output/data/p03795/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03795/Python/s991757789.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s991757789", "user_id": "u823885866"}, "prompt_components": {"gold_output": "15800\n", "input_to_evaluate": "a=int(input())\nprint(a*800-a//15*200)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has a favorite restaurant.\n\nThe price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer.\n\nSo far, Snuke has ordered N meals at the restaurant.\nLet the amount of money Snuke has paid to the restaurant be x yen, and let the amount of money the restaurant has paid back to Snuke be y yen.\nFind x-y.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n20\n\nSample Output 1\n\n15800\n\nSo far, Snuke has paid 16000 yen, and the restaurant has paid back 200 yen. Thus, the answer is 15800.\n\nSample Input 2\n\n60\n\nSample Output 2\n\n47200\n\nSnuke has paid 48000 yen for 60 meals, and the restaurant has paid back 800 yen.", "sample_input": "20\n"}, "reference_outputs": ["15800\n"], "source_document_id": "p03795", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has a favorite restaurant.\n\nThe price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer.\n\nSo far, Snuke has ordered N meals at the restaurant.\nLet the amount of money Snuke has paid to the restaurant be x yen, and let the amount of money the restaurant has paid back to Snuke be y yen.\nFind x-y.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n20\n\nSample Output 1\n\n15800\n\nSo far, Snuke has paid 16000 yen, and the restaurant has paid back 200 yen. Thus, the answer is 15800.\n\nSample Input 2\n\n60\n\nSample Output 2\n\n47200\n\nSnuke has paid 48000 yen for 60 meals, and the restaurant has paid back 800 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 37, "cpu_time_ms": 26, "memory_kb": 8928}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s122545670", "group_id": "codeNet:p03796", "input_text": "MOD = 10 ** 9\nN = int(input())\nret = 1\nfor i in range(1, N+1):\n ret *= i\n ret % MOD\nprint(ret)", "language": "Python", "metadata": {"date": 1565577137, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03796.html", "problem_id": "p03796", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03796/input.txt", "sample_output_relpath": "derived/input_output/data/p03796/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03796/Python/s122545670.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s122545670", "user_id": "u814781830"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "MOD = 10 ** 9\nN = int(input())\nret = 1\nfor i in range(1, N+1):\n ret *= i\n ret % MOD\nprint(ret)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke loves working out. He is now exercising N times.\n\nBefore he starts exercising, his power is 1. After he exercises for the i-th time, his power gets multiplied by i.\n\nFind Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7.\n\nConstraints\n\n1 ≤ N ≤ 10^{5}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer modulo 10^{9}+7.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n6\n\nAfter Snuke exercises for the first time, his power gets multiplied by 1 and becomes 1.\n\nAfter Snuke exercises for the second time, his power gets multiplied by 2 and becomes 2.\n\nAfter Snuke exercises for the third time, his power gets multiplied by 3 and becomes 6.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n3628800\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n457992974\n\nPrint the answer modulo 10^{9}+7.", "sample_input": "3\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03796", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke loves working out. He is now exercising N times.\n\nBefore he starts exercising, his power is 1. After he exercises for the i-th time, his power gets multiplied by i.\n\nFind Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7.\n\nConstraints\n\n1 ≤ N ≤ 10^{5}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer modulo 10^{9}+7.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n6\n\nAfter Snuke exercises for the first time, his power gets multiplied by 1 and becomes 1.\n\nAfter Snuke exercises for the second time, his power gets multiplied by 2 and becomes 2.\n\nAfter Snuke exercises for the third time, his power gets multiplied by 3 and becomes 6.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n3628800\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n457992974\n\nPrint the answer modulo 10^{9}+7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 100, "cpu_time_ms": 2104, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s890033123", "group_id": "codeNet:p03796", "input_text": "N = int(input())\na = 1\nfor i in range(1, N+1):\n a *= i\n a %= 1000000007\nprint(a)", "language": "Python", "metadata": {"date": 1564228947, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03796.html", "problem_id": "p03796", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03796/input.txt", "sample_output_relpath": "derived/input_output/data/p03796/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03796/Python/s890033123.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s890033123", "user_id": "u921773161"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "N = int(input())\na = 1\nfor i in range(1, N+1):\n a *= i\n a %= 1000000007\nprint(a)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke loves working out. He is now exercising N times.\n\nBefore he starts exercising, his power is 1. After he exercises for the i-th time, his power gets multiplied by i.\n\nFind Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7.\n\nConstraints\n\n1 ≤ N ≤ 10^{5}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer modulo 10^{9}+7.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n6\n\nAfter Snuke exercises for the first time, his power gets multiplied by 1 and becomes 1.\n\nAfter Snuke exercises for the second time, his power gets multiplied by 2 and becomes 2.\n\nAfter Snuke exercises for the third time, his power gets multiplied by 3 and becomes 6.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n3628800\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n457992974\n\nPrint the answer modulo 10^{9}+7.", "sample_input": "3\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03796", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke loves working out. He is now exercising N times.\n\nBefore he starts exercising, his power is 1. After he exercises for the i-th time, his power gets multiplied by i.\n\nFind Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7.\n\nConstraints\n\n1 ≤ N ≤ 10^{5}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer modulo 10^{9}+7.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n6\n\nAfter Snuke exercises for the first time, his power gets multiplied by 1 and becomes 1.\n\nAfter Snuke exercises for the second time, his power gets multiplied by 2 and becomes 2.\n\nAfter Snuke exercises for the third time, his power gets multiplied by 3 and becomes 6.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n3628800\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n457992974\n\nPrint the answer modulo 10^{9}+7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 86, "cpu_time_ms": 40, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s122151438", "group_id": "codeNet:p03803", "input_text": "a,b=map(int,input().split())\nif a==b:\n print(\"Draw\")\nelif a==1 or (a>b and b!=1):\n print(\"Alice\")\nelse:\n print(\"Bob\")", "language": "Python", "metadata": {"date": 1587932251, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03803.html", "problem_id": "p03803", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03803/input.txt", "sample_output_relpath": "derived/input_output/data/p03803/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03803/Python/s122151438.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s122151438", "user_id": "u032484849"}, "prompt_components": {"gold_output": "Alice\n", "input_to_evaluate": "a,b=map(int,input().split())\nif a==b:\n print(\"Draw\")\nelif a==1 or (a>b and b!=1):\n print(\"Alice\")\nelse:\n print(\"Bob\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAlice and Bob are playing One Card Poker.\n\nOne Card Poker is a two-player game using playing cards.\n\nEach card in this game shows an integer between 1 and 13, inclusive.\n\nThe strength of a card is determined by the number written on it, as follows:\n\nWeak 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < 1 Strong\n\nOne Card Poker is played as follows:\n\nEach player picks one card from the deck. The chosen card becomes the player's hand.\n\nThe players reveal their hands to each other. The player with the stronger card wins the game.\n\nIf their cards are equally strong, the game is drawn.\n\nYou are watching Alice and Bob playing the game, and can see their hands.\n\nThe number written on Alice's card is A, and the number written on Bob's card is B.\n\nWrite a program to determine the outcome of the game.\n\nConstraints\n\n1≦A≦13\n\n1≦B≦13\n\nA and B are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint Alice if Alice will win. Print Bob if Bob will win. Print Draw if the game will be drawn.\n\nSample Input 1\n\n8 6\n\nSample Output 1\n\nAlice\n\n8 is written on Alice's card, and 6 is written on Bob's card.\nAlice has the stronger card, and thus the output should be Alice.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\nDraw\n\nSince their cards have the same number, the game will be drawn.\n\nSample Input 3\n\n13 1\n\nSample Output 3\n\nBob", "sample_input": "8 6\n"}, "reference_outputs": ["Alice\n"], "source_document_id": "p03803", "source_text": "Score : 100 points\n\nProblem Statement\n\nAlice and Bob are playing One Card Poker.\n\nOne Card Poker is a two-player game using playing cards.\n\nEach card in this game shows an integer between 1 and 13, inclusive.\n\nThe strength of a card is determined by the number written on it, as follows:\n\nWeak 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < 1 Strong\n\nOne Card Poker is played as follows:\n\nEach player picks one card from the deck. The chosen card becomes the player's hand.\n\nThe players reveal their hands to each other. The player with the stronger card wins the game.\n\nIf their cards are equally strong, the game is drawn.\n\nYou are watching Alice and Bob playing the game, and can see their hands.\n\nThe number written on Alice's card is A, and the number written on Bob's card is B.\n\nWrite a program to determine the outcome of the game.\n\nConstraints\n\n1≦A≦13\n\n1≦B≦13\n\nA and B are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint Alice if Alice will win. Print Bob if Bob will win. Print Draw if the game will be drawn.\n\nSample Input 1\n\n8 6\n\nSample Output 1\n\nAlice\n\n8 is written on Alice's card, and 6 is written on Bob's card.\nAlice has the stronger card, and thus the output should be Alice.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\nDraw\n\nSince their cards have the same number, the game will be drawn.\n\nSample Input 3\n\n13 1\n\nSample Output 3\n\nBob", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 126, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s596676142", "group_id": "codeNet:p03804", "input_text": "n, m = [int(i) for i in input().split()]\n\ndef init_img(n):\n return [[0 if j == \"#\" else 1 for j in input()] for i in range(n)]\n\nimg = init_img(n)\n\ntmp_img = init_img(m)\n\nflg = False\n\nfor i in range(n):\n if flg:\n break\n\n for j in range(n):\n count = 0\n for k in range(m):\n if img[i+k][j:j+m] == tmp_img[k]:\n count += 1\n\n if count == 3:\n flg = True\n\nif flg:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "language": "Python", "metadata": {"date": 1585196107, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03804.html", "problem_id": "p03804", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03804/input.txt", "sample_output_relpath": "derived/input_output/data/p03804/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03804/Python/s596676142.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s596676142", "user_id": "u230717961"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "n, m = [int(i) for i in input().split()]\n\ndef init_img(n):\n return [[0 if j == \"#\" else 1 for j in input()] for i in range(n)]\n\nimg = init_img(n)\n\ntmp_img = init_img(m)\n\nflg = False\n\nfor i in range(n):\n if flg:\n break\n\n for j in range(n):\n count = 0\n for k in range(m):\n if img[i+k][j:j+m] == tmp_img[k]:\n count += 1\n\n if count == 3:\n flg = True\n\nif flg:\n print(\"Yes\")\nelse:\n print(\"No\")\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels.\n\nA pixel is the smallest element of an image, and in this problem it is a square of size 1×1.\n\nAlso, the given images are binary images, and the color of each pixel is either white or black.\n\nIn the input, every pixel is represented by a character: . corresponds to a white pixel, and # corresponds to a black pixel.\n\nThe image A is given as N strings A_1,...,A_N.\n\nThe j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N).\n\nSimilarly, the template image B is given as M strings B_1,...,B_M.\n\nThe j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M).\n\nDetermine whether the template image B is contained in the image A when only parallel shifts can be applied to the images.\n\nConstraints\n\n1≦M≦N≦50\n\nA_i is a string of length N consisting of # and ..\n\nB_i is a string of length M consisting of # and ..\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\nA_1\nA_2\n:\nA_N\nB_1\nB_2\n:\nB_M\n\nOutput\n\nPrint Yes if the template image B is contained in the image A. Print No otherwise.\n\nSample Input 1\n\n3 2\n#.#\n.#.\n#.#\n#.\n.#\n\nSample Output 1\n\nYes\n\nThe template image B is identical to the upper-left 2 × 2 subimage and the lower-right 2 × 2 subimage of A. Thus, the output should be Yes.\n\nSample Input 2\n\n4 1\n....\n....\n....\n....\n#\n\nSample Output 2\n\nNo\n\nThe template image B, composed of a black pixel, is not contained in the image A composed of white pixels.", "sample_input": "3 2\n#.#\n.#.\n#.#\n#.\n.#\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03804", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels.\n\nA pixel is the smallest element of an image, and in this problem it is a square of size 1×1.\n\nAlso, the given images are binary images, and the color of each pixel is either white or black.\n\nIn the input, every pixel is represented by a character: . corresponds to a white pixel, and # corresponds to a black pixel.\n\nThe image A is given as N strings A_1,...,A_N.\n\nThe j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N).\n\nSimilarly, the template image B is given as M strings B_1,...,B_M.\n\nThe j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M).\n\nDetermine whether the template image B is contained in the image A when only parallel shifts can be applied to the images.\n\nConstraints\n\n1≦M≦N≦50\n\nA_i is a string of length N consisting of # and ..\n\nB_i is a string of length M consisting of # and ..\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\nA_1\nA_2\n:\nA_N\nB_1\nB_2\n:\nB_M\n\nOutput\n\nPrint Yes if the template image B is contained in the image A. Print No otherwise.\n\nSample Input 1\n\n3 2\n#.#\n.#.\n#.#\n#.\n.#\n\nSample Output 1\n\nYes\n\nThe template image B is identical to the upper-left 2 × 2 subimage and the lower-right 2 × 2 subimage of A. Thus, the output should be Yes.\n\nSample Input 2\n\n4 1\n....\n....\n....\n....\n#\n\nSample Output 2\n\nNo\n\nThe template image B, composed of a black pixel, is not contained in the image A composed of white pixels.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 468, "cpu_time_ms": 31, "memory_kb": 3064}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s833099001", "group_id": "codeNet:p03805", "input_text": "import itertools\nN,M=map(int,input().split())\nedges={tuple(sorted(map(int,input().split()))) for i in range(M)}\nprint(edges)\nans=0\nfor i in itertools.permutations(range(2,N+1),N-1):\n l=[1]+list(i)\n ans+=sum(1 for edge in zip(l,l[1:]) if tuple(sorted(edge)) in edges)==N-1\nprint(l)\nprint(ans)", "language": "Python", "metadata": {"date": 1565979627, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03805.html", "problem_id": "p03805", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03805/input.txt", "sample_output_relpath": "derived/input_output/data/p03805/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03805/Python/s833099001.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s833099001", "user_id": "u248670337"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import itertools\nN,M=map(int,input().split())\nedges={tuple(sorted(map(int,input().split()))) for i in range(M)}\nprint(edges)\nans=0\nfor i in itertools.permutations(range(2,N+1),N-1):\n l=[1]+list(i)\n ans+=sum(1 for edge in zip(l,l[1:]) if tuple(sorted(edge)) in edges)==N-1\nprint(l)\nprint(ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges.\n\nHere, a self-loop is an edge where a_i = b_i (1≤i≤M), and double edges are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i 6:\n print((x//11) * 2 + 2)\n else:\n if x%11 == 0:\n print((x//11) * 2)\n else:\n print((x//11) * 2 + 1)\n\nif __name__ == \"__main__\":\n main()", "language": "Python", "metadata": {"date": 1568586695, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03815.html", "problem_id": "p03815", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03815/input.txt", "sample_output_relpath": "derived/input_output/data/p03815/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03815/Python/s973748183.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s973748183", "user_id": "u480138356"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import sys\ninput = sys.stdin.readline\n\ndef main():\n x = int(input())\n if x%11 > 6:\n print((x//11) * 2 + 2)\n else:\n if x%11 == 0:\n print((x//11) * 2)\n else:\n print((x//11) * 2 + 1)\n\nif __name__ == \"__main__\":\n main()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.\n\nSnuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation:\n\nOperation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward.\n\nFor example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure.\nIf the die is rotated toward the right as shown in the figure, the side showing 3 will face upward.\nBesides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back.\n\nFind the minimum number of operation Snuke needs to perform in order to score at least x points in total.\n\nConstraints\n\n1 ≦ x ≦ 10^{15}\n\nx is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n2\n\nSample Input 2\n\n149696127901\n\nSample Output 2\n\n27217477801", "sample_input": "7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03815", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.\n\nSnuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation:\n\nOperation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward.\n\nFor example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure.\nIf the die is rotated toward the right as shown in the figure, the side showing 3 will face upward.\nBesides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back.\n\nFind the minimum number of operation Snuke needs to perform in order to score at least x points in total.\n\nConstraints\n\n1 ≦ x ≦ 10^{15}\n\nx is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n2\n\nSample Input 2\n\n149696127901\n\nSample Output 2\n\n27217477801", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 270, "cpu_time_ms": 17, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s374022795", "group_id": "codeNet:p03815", "input_text": "x=int(input())\nx-=1\nans=(x//11)*2\ntmp=x%11\n\nif tmp==0:\n print(ans)\n exit()\n\nif tmp<=5:\n ans+=1\nelif tmp<11:\n ans+=2\nprint(ans)\n\n ", "language": "Python", "metadata": {"date": 1524281902, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03815.html", "problem_id": "p03815", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03815/input.txt", "sample_output_relpath": "derived/input_output/data/p03815/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03815/Python/s374022795.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s374022795", "user_id": "u559823804"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "x=int(input())\nx-=1\nans=(x//11)*2\ntmp=x%11\n\nif tmp==0:\n print(ans)\n exit()\n\nif tmp<=5:\n ans+=1\nelif tmp<11:\n ans+=2\nprint(ans)\n\n ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.\n\nSnuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation:\n\nOperation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward.\n\nFor example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure.\nIf the die is rotated toward the right as shown in the figure, the side showing 3 will face upward.\nBesides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back.\n\nFind the minimum number of operation Snuke needs to perform in order to score at least x points in total.\n\nConstraints\n\n1 ≦ x ≦ 10^{15}\n\nx is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n2\n\nSample Input 2\n\n149696127901\n\nSample Output 2\n\n27217477801", "sample_input": "7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03815", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.\n\nSnuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation:\n\nOperation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward.\n\nFor example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure.\nIf the die is rotated toward the right as shown in the figure, the side showing 3 will face upward.\nBesides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back.\n\nFind the minimum number of operation Snuke needs to perform in order to score at least x points in total.\n\nConstraints\n\n1 ≦ x ≦ 10^{15}\n\nx is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n2\n\nSample Input 2\n\n149696127901\n\nSample Output 2\n\n27217477801", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s418676974", "group_id": "codeNet:p03815", "input_text": "x=int(input())\nans=(x//11)*2\ntmp=x%11\n\nif tmp==0:\n print(ans)\n exit()\n\nif tmp<=5:\n ans+=1\nelif tmp<11:\n ans+=2\nprint(ans)\n\n \n\n", "language": "Python", "metadata": {"date": 1524281166, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03815.html", "problem_id": "p03815", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03815/input.txt", "sample_output_relpath": "derived/input_output/data/p03815/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03815/Python/s418676974.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s418676974", "user_id": "u559823804"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "x=int(input())\nans=(x//11)*2\ntmp=x%11\n\nif tmp==0:\n print(ans)\n exit()\n\nif tmp<=5:\n ans+=1\nelif tmp<11:\n ans+=2\nprint(ans)\n\n \n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.\n\nSnuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation:\n\nOperation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward.\n\nFor example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure.\nIf the die is rotated toward the right as shown in the figure, the side showing 3 will face upward.\nBesides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back.\n\nFind the minimum number of operation Snuke needs to perform in order to score at least x points in total.\n\nConstraints\n\n1 ≦ x ≦ 10^{15}\n\nx is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n2\n\nSample Input 2\n\n149696127901\n\nSample Output 2\n\n27217477801", "sample_input": "7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03815", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.\n\nSnuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation:\n\nOperation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward.\n\nFor example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure.\nIf the die is rotated toward the right as shown in the figure, the side showing 3 will face upward.\nBesides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back.\n\nFind the minimum number of operation Snuke needs to perform in order to score at least x points in total.\n\nConstraints\n\n1 ≦ x ≦ 10^{15}\n\nx is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n2\n\nSample Input 2\n\n149696127901\n\nSample Output 2\n\n27217477801", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 142, "cpu_time_ms": 17, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s700699673", "group_id": "codeNet:p03829", "input_text": "N, A, B = map(int, input().split())\nX = list(map(int, input().split()))\nans = 0\nfor i in range(1, N):\n if (X[i] - X[i-1]) * A >= B:\n ans += B\n else:\n ans += (X[i] - X[i-1]) * A\nprint(ans)", "language": "Python", "metadata": {"date": 1596230046, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03829.html", "problem_id": "p03829", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03829/input.txt", "sample_output_relpath": "derived/input_output/data/p03829/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03829/Python/s700699673.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s700699673", "user_id": "u528470578"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "N, A, B = map(int, input().split())\nX = list(map(int, input().split()))\nans = 0\nfor i in range(1, N):\n if (X[i] - X[i-1]) * A >= B:\n ans += B\n else:\n ans += (X[i] - X[i-1]) * A\nprint(ans)", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N towns on a line running east-west.\nThe towns are numbered 1 through N, in order from west to east.\nEach point on the line has a one-dimensional coordinate, and a point that is farther east has a greater coordinate value.\nThe coordinate of town i is X_i.\n\nYou are now at town 1, and you want to visit all the other towns.\nYou have two ways to travel:\n\nWalk on the line.\nYour fatigue level increases by A each time you travel a distance of 1, regardless of direction.\n\nTeleport to any location of your choice.\nYour fatigue level increases by B, regardless of the distance covered.\n\nFind the minimum possible total increase of your fatigue level when you visit all the towns in these two ways.\n\nConstraints\n\nAll input values are integers.\n\n2≤N≤10^5\n\n1≤X_i≤10^9\n\nFor all i(1≤i≤N-1), X_i= i:\n if a[i] != 0:\n i += 1\n continue\n j = 2 * i\n while j <= n:\n a[j] = 1\n j += i\n i += 1\n return [i for i, ai in enumerate(a) if ai == 0]\n\n\nn = int(input())\nf = factorial(n)\nprimes = prime(n)\ncounter = Counter()\n\nwhile f > 1:\n for p in primes:\n if f % p == 0:\n counter[p] += 1\n f = f // p\n\nans = 1\nfor val in counter.values():\n ans *= (val + 1)\n\nprint(ans % (10**9 + 7))", "language": "Python", "metadata": {"date": 1567622747, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03830.html", "problem_id": "p03830", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03830/input.txt", "sample_output_relpath": "derived/input_output/data/p03830/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03830/Python/s543811628.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s543811628", "user_id": "u982594421"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "from math import factorial\nfrom collections import Counter\n\ndef prime(n):\n a = [0] * (n + 1)\n a[0] = 1\n a[1] = 1\n i = 2\n while n // i >= i:\n if a[i] != 0:\n i += 1\n continue\n j = 2 * i\n while j <= n:\n a[j] = 1\n j += i\n i += 1\n return [i for i, ai in enumerate(a) if ai == 0]\n\n\nn = int(input())\nf = factorial(n)\nprimes = prime(n)\ncounter = Counter()\n\nwhile f > 1:\n for p in primes:\n if f % p == 0:\n counter[p] += 1\n f = f // p\n\nans = 1\nfor val in counter.values():\n ans *= (val + 1)\n\nprint(ans % (10**9 + 7))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\nFind the number of the positive divisors of N!, modulo 10^9+7.\n\nConstraints\n\n1≤N≤10^3\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of the positive divisors of N!, modulo 10^9+7.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n4\n\nThere are four divisors of 3! =6: 1, 2, 3 and 6. Thus, the output should be 4.\n\nSample Input 2\n\n6\n\nSample Output 2\n\n30\n\nSample Input 3\n\n1000\n\nSample Output 3\n\n972926972", "sample_input": "3\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03830", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\nFind the number of the positive divisors of N!, modulo 10^9+7.\n\nConstraints\n\n1≤N≤10^3\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of the positive divisors of N!, modulo 10^9+7.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n4\n\nThere are four divisors of 3! =6: 1, 2, 3 and 6. Thus, the output should be 4.\n\nSample Input 2\n\n6\n\nSample Output 2\n\n30\n\nSample Input 3\n\n1000\n\nSample Output 3\n\n972926972", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 631, "cpu_time_ms": 107, "memory_kb": 3316}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s498136013", "group_id": "codeNet:p03831", "input_text": "n,a,b = map(int,input().split())\nx = list(map(int,input().split()))\nans = 0\nfor i in range(n-1):\n if (x[i+1]-x[i]) * a <= b:\n ans += (x[i+1]-x[i]) * a\n else:\n ans += b\nprint(ans)", "language": "Python", "metadata": {"date": 1586987989, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03831.html", "problem_id": "p03831", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03831/input.txt", "sample_output_relpath": "derived/input_output/data/p03831/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03831/Python/s498136013.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s498136013", "user_id": "u201928947"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "n,a,b = map(int,input().split())\nx = list(map(int,input().split()))\nans = 0\nfor i in range(n-1):\n if (x[i+1]-x[i]) * a <= b:\n ans += (x[i+1]-x[i]) * a\n else:\n ans += b\nprint(ans)", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N towns on a line running east-west.\nThe towns are numbered 1 through N, in order from west to east.\nEach point on the line has a one-dimensional coordinate, and a point that is farther east has a greater coordinate value.\nThe coordinate of town i is X_i.\n\nYou are now at town 1, and you want to visit all the other towns.\nYou have two ways to travel:\n\nWalk on the line.\nYour fatigue level increases by A each time you travel a distance of 1, regardless of direction.\n\nTeleport to any location of your choice.\nYour fatigue level increases by B, regardless of the distance covered.\n\nFind the minimum possible total increase of your fatigue level when you visit all the towns in these two ways.\n\nConstraints\n\nAll input values are integers.\n\n2≤N≤10^5\n\n1≤X_i≤10^9\n\nFor all i(1≤i≤N-1), X_i 0:\n ans += 1\nelif (I % 2 == 1) and (L % 2 == 1) and J > 0:\n ans += 1\nelif (J % 2 == 1) and (L % 2 == 1) and I > 0:\n ans += 1\n\nprint ans", "language": "Python", "metadata": {"date": 1582900926, "filename_ext": "py", "original_language": "Python (2.7.6)", "problem_description_relpath": "problem_descriptions/p03840.html", "problem_id": "p03840", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03840/input.txt", "sample_output_relpath": "derived/input_output/data/p03840/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03840/Python/s944749420.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s944749420", "user_id": "u695197008"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "I, O, T, J, L, S, Z = map(int, raw_input().strip().split())\n\nans = O\nans += 2*(I/2)\nans += 2*(J/2)\nans += 2*(L/2)\n\nif (I % 2 == 1) and (J % 2 == 1) and (L % 2 == 1):\n ans += 3\nelif (I % 2 == 1) and (J % 2 == 1) and L > 0:\n ans += 1\nelif (I % 2 == 1) and (L % 2 == 1) and J > 0:\n ans += 1\nelif (J % 2 == 1) and (L % 2 == 1) and I > 0:\n ans += 1\n\nprint ans", "problem_context": "Score : 600 points\n\nProblem Statement\n\nA tetromino is a figure formed by joining four squares edge to edge.\nWe will refer to the following seven kinds of tetromino as I-, O-, T-, J-, L-, S- and Z-tetrominos, respectively:\n\nSnuke has many tetrominos. The number of I-, O-, T-, J-, L-, S- and Z-tetrominos in his possession are a_I, a_O, a_T, a_J, a_L, a_S and a_Z, respectively.\nSnuke will join K of his tetrominos to form a rectangle that is two squares tall and 2K squares wide.\nHere, the following rules must be followed:\n\nWhen placing each tetromino, rotation is allowed, but reflection is not.\n\nEach square in the rectangle must be covered by exactly one tetromino.\n\nNo part of each tetromino may be outside the rectangle.\n\nSnuke wants to form as large a rectangle as possible.\nFind the maximum possible value of K.\n\nConstraints\n\n0≤a_I,a_O,a_T,a_J,a_L,a_S,a_Z≤10^9\n\na_I+a_O+a_T+a_J+a_L+a_S+a_Z≥1\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na_I a_O a_T a_J a_L a_S a_Z\n\nOutput\n\nPrint the maximum possible value of K. If no rectangle can be formed, print 0.\n\nSample Input 1\n\n2 1 1 0 0 0 0\n\nSample Output 1\n\n3\n\nOne possible way to form the largest rectangle is shown in the following figure:\n\nSample Input 2\n\n0 0 10 0 0 0 0\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.", "sample_input": "2 1 1 0 0 0 0\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03840", "source_text": "Score : 600 points\n\nProblem Statement\n\nA tetromino is a figure formed by joining four squares edge to edge.\nWe will refer to the following seven kinds of tetromino as I-, O-, T-, J-, L-, S- and Z-tetrominos, respectively:\n\nSnuke has many tetrominos. The number of I-, O-, T-, J-, L-, S- and Z-tetrominos in his possession are a_I, a_O, a_T, a_J, a_L, a_S and a_Z, respectively.\nSnuke will join K of his tetrominos to form a rectangle that is two squares tall and 2K squares wide.\nHere, the following rules must be followed:\n\nWhen placing each tetromino, rotation is allowed, but reflection is not.\n\nEach square in the rectangle must be covered by exactly one tetromino.\n\nNo part of each tetromino may be outside the rectangle.\n\nSnuke wants to form as large a rectangle as possible.\nFind the maximum possible value of K.\n\nConstraints\n\n0≤a_I,a_O,a_T,a_J,a_L,a_S,a_Z≤10^9\n\na_I+a_O+a_T+a_J+a_L+a_S+a_Z≥1\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na_I a_O a_T a_J a_L a_S a_Z\n\nOutput\n\nPrint the maximum possible value of K. If no rectangle can be formed, print 0.\n\nSample Input 1\n\n2 1 1 0 0 0 0\n\nSample Output 1\n\n3\n\nOne possible way to form the largest rectangle is shown in the following figure:\n\nSample Input 2\n\n0 0 10 0 0 0 0\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 358, "cpu_time_ms": 11, "memory_kb": 2568}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s857700621", "group_id": "codeNet:p03844", "input_text": "A, op, B = input().split()\nif op == '-':\n print(int(A) - int(B))\nelse:\n print(int(A) + (B))", "language": "Python", "metadata": {"date": 1601351719, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03844.html", "problem_id": "p03844", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03844/input.txt", "sample_output_relpath": "derived/input_output/data/p03844/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03844/Python/s857700621.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s857700621", "user_id": "u085186789"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "A, op, B = input().split()\nif op == '-':\n print(int(A) - int(B))\nelse:\n print(int(A) + (B))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nJoisino wants to evaluate the formula \"A op B\".\nHere, A and B are integers, and the binary operator op is either + or -.\nYour task is to evaluate the formula instead of her.\n\nConstraints\n\n1≦A,B≦10^9\n\nop is either + or -.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA op B\n\nOutput\n\nEvaluate the formula and print the result.\n\nSample Input 1\n\n1 + 2\n\nSample Output 1\n\n3\n\nSince 1 + 2 = 3, the output should be 3.\n\nSample Input 2\n\n5 - 7\n\nSample Output 2\n\n-2", "sample_input": "1 + 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03844", "source_text": "Score : 100 points\n\nProblem Statement\n\nJoisino wants to evaluate the formula \"A op B\".\nHere, A and B are integers, and the binary operator op is either + or -.\nYour task is to evaluate the formula instead of her.\n\nConstraints\n\n1≦A,B≦10^9\n\nop is either + or -.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA op B\n\nOutput\n\nEvaluate the formula and print the result.\n\nSample Input 1\n\n1 + 2\n\nSample Output 1\n\n3\n\nSince 1 + 2 = 3, the output should be 3.\n\nSample Input 2\n\n5 - 7\n\nSample Output 2\n\n-2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 93, "cpu_time_ms": 26, "memory_kb": 9164}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s714461986", "group_id": "codeNet:p03844", "input_text": "#!/usr/bin/env python\n# -*- coding:utf-8 -*-\nimport sys\n\ndef read_data():\n lines = [line.rstrip() for line in sys.stdin]\n ns = [int(n) for n in lines[1].split()]\n ms = []\n for line in lines[3:]:\n num, sec = line.split()\n ms.append((int(num)-1, int(sec)))\n return ns, ms\n\ndef main():\n ns, ms = read_data()\n for (drink_num, drink_sec) in ms:\n result = sum(ns) - ns[drink_num] + drink_sec\n print result\n\n\nif __name__ == \"__main__\":\n main()", "language": "Python", "metadata": {"date": 1483373619, "filename_ext": "py", "original_language": "Python (2.7.6)", "problem_description_relpath": "problem_descriptions/p03844.html", "problem_id": "p03844", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03844/input.txt", "sample_output_relpath": "derived/input_output/data/p03844/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03844/Python/s714461986.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s714461986", "user_id": "u449045132"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "#!/usr/bin/env python\n# -*- coding:utf-8 -*-\nimport sys\n\ndef read_data():\n lines = [line.rstrip() for line in sys.stdin]\n ns = [int(n) for n in lines[1].split()]\n ms = []\n for line in lines[3:]:\n num, sec = line.split()\n ms.append((int(num)-1, int(sec)))\n return ns, ms\n\ndef main():\n ns, ms = read_data()\n for (drink_num, drink_sec) in ms:\n result = sum(ns) - ns[drink_num] + drink_sec\n print result\n\n\nif __name__ == \"__main__\":\n main()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nJoisino wants to evaluate the formula \"A op B\".\nHere, A and B are integers, and the binary operator op is either + or -.\nYour task is to evaluate the formula instead of her.\n\nConstraints\n\n1≦A,B≦10^9\n\nop is either + or -.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA op B\n\nOutput\n\nEvaluate the formula and print the result.\n\nSample Input 1\n\n1 + 2\n\nSample Output 1\n\n3\n\nSince 1 + 2 = 3, the output should be 3.\n\nSample Input 2\n\n5 - 7\n\nSample Output 2\n\n-2", "sample_input": "1 + 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03844", "source_text": "Score : 100 points\n\nProblem Statement\n\nJoisino wants to evaluate the formula \"A op B\".\nHere, A and B are integers, and the binary operator op is either + or -.\nYour task is to evaluate the formula instead of her.\n\nConstraints\n\n1≦A,B≦10^9\n\nop is either + or -.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA op B\n\nOutput\n\nEvaluate the formula and print the result.\n\nSample Input 1\n\n1 + 2\n\nSample Output 1\n\n3\n\nSince 1 + 2 = 3, the output should be 3.\n\nSample Input 2\n\n5 - 7\n\nSample Output 2\n\n-2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 488, "cpu_time_ms": 16, "memory_kb": 2684}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s118855306", "group_id": "codeNet:p03846", "input_text": "N = int(input())\nA = list(map(int, input().rstrip().split()))\nA.sort()\nANS = 2**(N//2)\n\nif N%2 == 0:\n if A[0] and A[1] != 1:\n print(0)\n exit()\n elif N == 2:\n if A[0] != A[1]:\n print(0)\n exit()\n else:\n for i in range(2,N,2):\n if A[i] != A[i+1] or A[i] - A[i-2] != 2:\n print(0)\n exit()\nelse:\n if A[0] != 0:\n print(0)\n exit()\n elif N == 3:\n if A[1] != A[2]:\n print(0)\n exit()\n else:\n for i in range(3,N,2):\n if A[i] != A[i+1] or A[i] - A[i-2] != 2:\n print(0)\n exit()\n\nprint(ANS%(10**9+7))\n", "language": "Python", "metadata": {"date": 1564947588, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03846.html", "problem_id": "p03846", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03846/input.txt", "sample_output_relpath": "derived/input_output/data/p03846/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03846/Python/s118855306.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s118855306", "user_id": "u644385250"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "N = int(input())\nA = list(map(int, input().rstrip().split()))\nA.sort()\nANS = 2**(N//2)\n\nif N%2 == 0:\n if A[0] and A[1] != 1:\n print(0)\n exit()\n elif N == 2:\n if A[0] != A[1]:\n print(0)\n exit()\n else:\n for i in range(2,N,2):\n if A[i] != A[i+1] or A[i] - A[i-2] != 2:\n print(0)\n exit()\nelse:\n if A[0] != 0:\n print(0)\n exit()\n elif N == 3:\n if A[1] != A[2]:\n print(0)\n exit()\n else:\n for i in range(3,N,2):\n if A[i] != A[i+1] or A[i] - A[i-2] != 2:\n print(0)\n exit()\n\nprint(ANS%(10**9+7))\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people, conveniently numbered 1 through N.\nThey were standing in a row yesterday, but now they are unsure of the order in which they were standing.\nHowever, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the number of the people who were standing to the right of that person.\nAccording to their reports, the difference above for person i is A_i.\n\nBased on these reports, find the number of the possible orders in which they were standing.\nSince it can be extremely large, print the answer modulo 10^9+7.\nNote that the reports may be incorrect and thus there may be no consistent order.\nIn such a case, print 0.\n\nConstraints\n\n1≦N≦10^5\n\n0≦A_i≦N-1\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the possible orders in which they were standing, modulo 10^9+7.\n\nSample Input 1\n\n5\n2 4 4 0 2\n\nSample Output 1\n\n4\n\nThere are four possible orders, as follows:\n\n2,1,4,5,3\n\n2,5,4,1,3\n\n3,1,4,5,2\n\n3,5,4,1,2\n\nSample Input 2\n\n7\n6 4 0 2 4 0 2\n\nSample Output 2\n\n0\n\nAny order would be inconsistent with the reports, thus the answer is 0.\n\nSample Input 3\n\n8\n7 5 1 1 7 3 5 3\n\nSample Output 3\n\n16", "sample_input": "5\n2 4 4 0 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03846", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people, conveniently numbered 1 through N.\nThey were standing in a row yesterday, but now they are unsure of the order in which they were standing.\nHowever, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the number of the people who were standing to the right of that person.\nAccording to their reports, the difference above for person i is A_i.\n\nBased on these reports, find the number of the possible orders in which they were standing.\nSince it can be extremely large, print the answer modulo 10^9+7.\nNote that the reports may be incorrect and thus there may be no consistent order.\nIn such a case, print 0.\n\nConstraints\n\n1≦N≦10^5\n\n0≦A_i≦N-1\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the possible orders in which they were standing, modulo 10^9+7.\n\nSample Input 1\n\n5\n2 4 4 0 2\n\nSample Output 1\n\n4\n\nThere are four possible orders, as follows:\n\n2,1,4,5,3\n\n2,5,4,1,3\n\n3,1,4,5,2\n\n3,5,4,1,2\n\nSample Input 2\n\n7\n6 4 0 2 4 0 2\n\nSample Output 2\n\n0\n\nAny order would be inconsistent with the reports, thus the answer is 0.\n\nSample Input 3\n\n8\n7 5 1 1 7 3 5 3\n\nSample Output 3\n\n16", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 686, "cpu_time_ms": 94, "memory_kb": 14008}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s222677379", "group_id": "codeNet:p03853", "input_text": "h, w = map(int, input().split())\n\nfor i in range(h):\n c = input()\n for k in range(2):\n print(c)", "language": "Python", "metadata": {"date": 1592858480, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03853.html", "problem_id": "p03853", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03853/input.txt", "sample_output_relpath": "derived/input_output/data/p03853/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03853/Python/s222677379.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s222677379", "user_id": "u895641117"}, "prompt_components": {"gold_output": "*.\n*.\n.*\n.*\n", "input_to_evaluate": "h, w = map(int, input().split())\n\nfor i in range(h):\n c = input()\n for k in range(2):\n print(c)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either . or *. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}.\n\nExtend this image vertically so that its height is doubled. That is, print a image with a height of 2H pixels and a width of W pixels where the pixel at the i-th row and j-th column is equal to C_{(i+1)/2,j} (the result of division is rounded down).\n\nConstraints\n\n1≦H, W≦100\n\nC_{i,j} is either . or *.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nC_{1,1}...C_{1,W}\n:\nC_{H,1}...C_{H,W}\n\nOutput\n\nPrint the extended image.\n\nSample Input 1\n\n2 2\n*.\n.*\n\nSample Output 1\n\n*.\n*.\n.*\n.*\n\nSample Input 2\n\n1 4\n***.\n\nSample Output 2\n\n***.\n***.\n\nSample Input 3\n\n9 20\n.....***....***.....\n....*...*..*...*....\n...*.....**.....*...\n...*.....*......*...\n....*.....*....*....\n.....**..*...**.....\n.......*..*.*.......\n........**.*........\n.........**.........\n\nSample Output 3\n\n.....***....***.....\n.....***....***.....\n....*...*..*...*....\n....*...*..*...*....\n...*.....**.....*...\n...*.....**.....*...\n...*.....*......*...\n...*.....*......*...\n....*.....*....*....\n....*.....*....*....\n.....**..*...**.....\n.....**..*...**.....\n.......*..*.*.......\n.......*..*.*.......\n........**.*........\n........**.*........\n.........**.........\n.........**.........", "sample_input": "2 2\n*.\n.*\n"}, "reference_outputs": ["*.\n*.\n.*\n.*\n"], "source_document_id": "p03853", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either . or *. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}.\n\nExtend this image vertically so that its height is doubled. That is, print a image with a height of 2H pixels and a width of W pixels where the pixel at the i-th row and j-th column is equal to C_{(i+1)/2,j} (the result of division is rounded down).\n\nConstraints\n\n1≦H, W≦100\n\nC_{i,j} is either . or *.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nC_{1,1}...C_{1,W}\n:\nC_{H,1}...C_{H,W}\n\nOutput\n\nPrint the extended image.\n\nSample Input 1\n\n2 2\n*.\n.*\n\nSample Output 1\n\n*.\n*.\n.*\n.*\n\nSample Input 2\n\n1 4\n***.\n\nSample Output 2\n\n***.\n***.\n\nSample Input 3\n\n9 20\n.....***....***.....\n....*...*..*...*....\n...*.....**.....*...\n...*.....*......*...\n....*.....*....*....\n.....**..*...**.....\n.......*..*.*.......\n........**.*........\n.........**.........\n\nSample Output 3\n\n.....***....***.....\n.....***....***.....\n....*...*..*...*....\n....*...*..*...*....\n...*.....**.....*...\n...*.....**.....*...\n...*.....*......*...\n...*.....*......*...\n....*.....*....*....\n....*.....*....*....\n.....**..*...**.....\n.....**..*...**.....\n.......*..*.*.......\n.......*..*.*.......\n........**.*........\n........**.*........\n.........**.........\n.........**.........", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 108, "cpu_time_ms": 32, "memory_kb": 9192}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s470606557", "group_id": "codeNet:p03861", "input_text": "# coding: utf-8\n\na, b, x = map(int, input().split(\" \"))\n\nn = b - a - 1\n \nif a % x == 0 or b % x == 0:\n print(n // x + 1)\nelse:\n print(n // x)\n", "language": "Python", "metadata": {"date": 1594599748, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03861.html", "problem_id": "p03861", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03861/input.txt", "sample_output_relpath": "derived/input_output/data/p03861/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03861/Python/s470606557.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s470606557", "user_id": "u755116850"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "# coding: utf-8\n\na, b, x = map(int, input().split(\" \"))\n\nn = b - a - 1\n \nif a % x == 0 or b % x == 0:\n print(n // x + 1)\nelse:\n print(n // x)\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given nonnegative integers a and b (a ≤ b), and a positive integer x.\nAmong the integers between a and b, inclusive, how many are divisible by x?\n\nConstraints\n\n0 ≤ a ≤ b ≤ 10^{18}\n\n1 ≤ x ≤ 10^{18}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b x\n\nOutput\n\nPrint the number of the integers between a and b, inclusive, that are divisible by x.\n\nSample Input 1\n\n4 8 2\n\nSample Output 1\n\n3\n\nThere are three integers between 4 and 8, inclusive, that are divisible by 2: 4, 6 and 8.\n\nSample Input 2\n\n0 5 1\n\nSample Output 2\n\n6\n\nThere are six integers between 0 and 5, inclusive, that are divisible by 1: 0, 1, 2, 3, 4 and 5.\n\nSample Input 3\n\n9 9 2\n\nSample Output 3\n\n0\n\nThere are no integer between 9 and 9, inclusive, that is divisible by 2.\n\nSample Input 4\n\n1 1000000000000000000 3\n\nSample Output 4\n\n333333333333333333\n\nWatch out for integer overflows.", "sample_input": "4 8 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03861", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given nonnegative integers a and b (a ≤ b), and a positive integer x.\nAmong the integers between a and b, inclusive, how many are divisible by x?\n\nConstraints\n\n0 ≤ a ≤ b ≤ 10^{18}\n\n1 ≤ x ≤ 10^{18}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b x\n\nOutput\n\nPrint the number of the integers between a and b, inclusive, that are divisible by x.\n\nSample Input 1\n\n4 8 2\n\nSample Output 1\n\n3\n\nThere are three integers between 4 and 8, inclusive, that are divisible by 2: 4, 6 and 8.\n\nSample Input 2\n\n0 5 1\n\nSample Output 2\n\n6\n\nThere are six integers between 0 and 5, inclusive, that are divisible by 1: 0, 1, 2, 3, 4 and 5.\n\nSample Input 3\n\n9 9 2\n\nSample Output 3\n\n0\n\nThere are no integer between 9 and 9, inclusive, that is divisible by 2.\n\nSample Input 4\n\n1 1000000000000000000 3\n\nSample Output 4\n\n333333333333333333\n\nWatch out for integer overflows.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 151, "cpu_time_ms": 28, "memory_kb": 9052}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s751726545", "group_id": "codeNet:p03861", "input_text": "a,b,x = map(int, input().split())\n\n\nif a == 0:\n print(b//x+1)\nelse:\n print(b//x-(a-1)//x)", "language": "Python", "metadata": {"date": 1585884308, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03861.html", "problem_id": "p03861", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03861/input.txt", "sample_output_relpath": "derived/input_output/data/p03861/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03861/Python/s751726545.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s751726545", "user_id": "u291628833"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "a,b,x = map(int, input().split())\n\n\nif a == 0:\n print(b//x+1)\nelse:\n print(b//x-(a-1)//x)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given nonnegative integers a and b (a ≤ b), and a positive integer x.\nAmong the integers between a and b, inclusive, how many are divisible by x?\n\nConstraints\n\n0 ≤ a ≤ b ≤ 10^{18}\n\n1 ≤ x ≤ 10^{18}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b x\n\nOutput\n\nPrint the number of the integers between a and b, inclusive, that are divisible by x.\n\nSample Input 1\n\n4 8 2\n\nSample Output 1\n\n3\n\nThere are three integers between 4 and 8, inclusive, that are divisible by 2: 4, 6 and 8.\n\nSample Input 2\n\n0 5 1\n\nSample Output 2\n\n6\n\nThere are six integers between 0 and 5, inclusive, that are divisible by 1: 0, 1, 2, 3, 4 and 5.\n\nSample Input 3\n\n9 9 2\n\nSample Output 3\n\n0\n\nThere are no integer between 9 and 9, inclusive, that is divisible by 2.\n\nSample Input 4\n\n1 1000000000000000000 3\n\nSample Output 4\n\n333333333333333333\n\nWatch out for integer overflows.", "sample_input": "4 8 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03861", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given nonnegative integers a and b (a ≤ b), and a positive integer x.\nAmong the integers between a and b, inclusive, how many are divisible by x?\n\nConstraints\n\n0 ≤ a ≤ b ≤ 10^{18}\n\n1 ≤ x ≤ 10^{18}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b x\n\nOutput\n\nPrint the number of the integers between a and b, inclusive, that are divisible by x.\n\nSample Input 1\n\n4 8 2\n\nSample Output 1\n\n3\n\nThere are three integers between 4 and 8, inclusive, that are divisible by 2: 4, 6 and 8.\n\nSample Input 2\n\n0 5 1\n\nSample Output 2\n\n6\n\nThere are six integers between 0 and 5, inclusive, that are divisible by 1: 0, 1, 2, 3, 4 and 5.\n\nSample Input 3\n\n9 9 2\n\nSample Output 3\n\n0\n\nThere are no integer between 9 and 9, inclusive, that is divisible by 2.\n\nSample Input 4\n\n1 1000000000000000000 3\n\nSample Output 4\n\n333333333333333333\n\nWatch out for integer overflows.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 95, "cpu_time_ms": 186, "memory_kb": 38384}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s673410077", "group_id": "codeNet:p03943", "input_text": "a,b,c = input().split()\nif a + b == c or a + c == b or b + c == a:\n print(\"Yes\")\nelse:\n print(\"No\")", "language": "Python", "metadata": {"date": 1589223944, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03943.html", "problem_id": "p03943", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03943/input.txt", "sample_output_relpath": "derived/input_output/data/p03943/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03943/Python/s673410077.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s673410077", "user_id": "u027403702"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "a,b,c = input().split()\nif a + b == c or a + c == b or b + c == a:\n print(\"Yes\")\nelse:\n print(\"No\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTwo students of AtCoder Kindergarten are fighting over candy packs.\n\nThere are three candy packs, each of which contains a, b, and c candies, respectively.\n\nTeacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible.\n\nNote that Evi cannot take candies out of the packs, and the whole contents of each pack must be given to one of the students.\n\nConstraints\n\n1 ≦ a, b, c ≦ 100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b c\n\nOutput\n\nIf it is possible to distribute the packs so that each student gets the same number of candies, print Yes. Otherwise, print No.\n\nSample Input 1\n\n10 30 20\n\nSample Output 1\n\nYes\n\nGive the pack with 30 candies to one student, and give the two packs with 10 and 20 candies to the other. Then, each gets 30 candies.\n\nSample Input 2\n\n30 30 100\n\nSample Output 2\n\nNo\n\nIn this case, the student who gets the pack with 100 candies always has more candies than the other.\n\nNote that every pack must be given to one of them.\n\nSample Input 3\n\n56 25 31\n\nSample Output 3\n\nYes", "sample_input": "10 30 20\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03943", "source_text": "Score : 100 points\n\nProblem Statement\n\nTwo students of AtCoder Kindergarten are fighting over candy packs.\n\nThere are three candy packs, each of which contains a, b, and c candies, respectively.\n\nTeacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible.\n\nNote that Evi cannot take candies out of the packs, and the whole contents of each pack must be given to one of the students.\n\nConstraints\n\n1 ≦ a, b, c ≦ 100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b c\n\nOutput\n\nIf it is possible to distribute the packs so that each student gets the same number of candies, print Yes. Otherwise, print No.\n\nSample Input 1\n\n10 30 20\n\nSample Output 1\n\nYes\n\nGive the pack with 30 candies to one student, and give the two packs with 10 and 20 candies to the other. Then, each gets 30 candies.\n\nSample Input 2\n\n30 30 100\n\nSample Output 2\n\nNo\n\nIn this case, the student who gets the pack with 100 candies always has more candies than the other.\n\nNote that every pack must be given to one of them.\n\nSample Input 3\n\n56 25 31\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 105, "cpu_time_ms": 19, "memory_kb": 3060}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s999774387", "group_id": "codeNet:p03946", "input_text": "N,_=map(int,input().split())\nA=list(map(int,input().split()))\nif N<=2: print(1)\nelse:\n ans=1\n mm=A[0]\n mx=A[1]-A[0]\n for i in range(2,N):\n mm=min(mm,A[i-1])\n xx=A[i]-mm\n if mx==xx:\n ans+=1\n elif mx0:\n print(Q.pop())", "language": "Python", "metadata": {"date": 1560816792, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p03952.html", "problem_id": "p03952", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03952/input.txt", "sample_output_relpath": "derived/input_output/data/p03952/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03952/Python/s730567569.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s730567569", "user_id": "u785989355"}, "prompt_components": {"gold_output": "Yes\n1\n6\n3\n7\n4\n5\n2\n", "input_to_evaluate": "from collections import deque\n\nN,x = list(map(int,input().split()))\n\nif x==2*N-1 or x==1:\n print(\"No\")\nelse:\n Q=deque()\n if x<=N:\n Q.append(x)\n Q.append(x-1)\n for i in range(2*N-1,0,-1):\n if i!=x and i!=x-1:\n if i%2==0:\n Q.append(i)\n else:\n Q.appendleft(i)\n else:\n Q.append(x)\n Q.append(x+1)\n for i in range(1,2*N):\n if i!=x and i!=x-1:\n if i%2==0:\n Q.append(i)\n else:\n Q.appendleft(i)\n\n print(\"Yes\")\n\n while len(Q)>0:\n print(Q.pop())", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a pyramid with N steps, built with blocks.\nThe steps are numbered 1 through N from top to bottom.\nFor each 1≤i≤N, step i consists of 2i-1 blocks aligned horizontally.\nThe pyramid is built so that the blocks at the centers of the steps are aligned vertically.\n\nA pyramid with N=4 steps\n\nSnuke wrote a permutation of (1, 2, ..., 2N-1) into the blocks of step N.\nThen, he wrote integers into all remaining blocks, under the following rule:\n\nThe integer written into a block b must be equal to the median of the three integers written into the three blocks directly under b, or to the lower left or lower right of b.\n\nWriting integers into the blocks\n\nAfterwards, he erased all integers written into the blocks.\nNow, he only remembers that the integer written into the block of step 1 was x.\n\nConstruct a permutation of (1, 2, ..., 2N-1) that could have been written into the blocks of step N, or declare that Snuke's memory is incorrect and such a permutation does not exist.\n\nConstraints\n\n2≤N≤10^5\n\n1≤x≤2N-1\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\n\nOutput\n\nIf no permutation of (1, 2, ..., 2N-1) could have been written into the blocks of step N, print No.\n\nOtherwise, print Yes in the first line, then print 2N-1 lines in addition.\n\nThe i-th of these 2N-1 lines should contain the i-th element of a possible permutation.\n\nSample Input 1\n\n4 4\n\nSample Output 1\n\nYes\n1\n6\n3\n7\n4\n5\n2\n\nThis case corresponds to the figure in the problem statement.\n\nSample Input 2\n\n2 1\n\nSample Output 2\n\nNo\n\nNo matter what permutation was written into the blocks of step N, the integer written into the block of step 1 would be 2.", "sample_input": "4 4\n"}, "reference_outputs": ["Yes\n1\n6\n3\n7\n4\n5\n2\n"], "source_document_id": "p03952", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a pyramid with N steps, built with blocks.\nThe steps are numbered 1 through N from top to bottom.\nFor each 1≤i≤N, step i consists of 2i-1 blocks aligned horizontally.\nThe pyramid is built so that the blocks at the centers of the steps are aligned vertically.\n\nA pyramid with N=4 steps\n\nSnuke wrote a permutation of (1, 2, ..., 2N-1) into the blocks of step N.\nThen, he wrote integers into all remaining blocks, under the following rule:\n\nThe integer written into a block b must be equal to the median of the three integers written into the three blocks directly under b, or to the lower left or lower right of b.\n\nWriting integers into the blocks\n\nAfterwards, he erased all integers written into the blocks.\nNow, he only remembers that the integer written into the block of step 1 was x.\n\nConstruct a permutation of (1, 2, ..., 2N-1) that could have been written into the blocks of step N, or declare that Snuke's memory is incorrect and such a permutation does not exist.\n\nConstraints\n\n2≤N≤10^5\n\n1≤x≤2N-1\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\n\nOutput\n\nIf no permutation of (1, 2, ..., 2N-1) could have been written into the blocks of step N, print No.\n\nOtherwise, print Yes in the first line, then print 2N-1 lines in addition.\n\nThe i-th of these 2N-1 lines should contain the i-th element of a possible permutation.\n\nSample Input 1\n\n4 4\n\nSample Output 1\n\nYes\n1\n6\n3\n7\n4\n5\n2\n\nThis case corresponds to the figure in the problem statement.\n\nSample Input 2\n\n2 1\n\nSample Output 2\n\nNo\n\nNo matter what permutation was written into the blocks of step N, the integer written into the block of step 1 would be 2.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 298, "memory_kb": 52824}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s701641713", "group_id": "codeNet:p03971", "input_text": "n,a,b = map(int,input().split())\ns = input()\nna = 0\nnb = 0\nfor i in range(len(s)):\n if na + nb >= a+b:\n print(\"No\")\n elif s[i]==\"a\":\n na += 1\n print(\"Yes\")\n elif s[i]==\"b\":\n if nb < b:\n nb += 1\n print(\"Yes\")\n else:\n print(\"No\")\n else:\n print(\"No\")", "language": "Python", "metadata": {"date": 1598296013, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p03971.html", "problem_id": "p03971", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03971/input.txt", "sample_output_relpath": "derived/input_output/data/p03971/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03971/Python/s701641713.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s701641713", "user_id": "u423389475"}, "prompt_components": {"gold_output": "Yes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\n", "input_to_evaluate": "n,a,b = map(int,input().split())\ns = input()\nna = 0\nnb = 0\nfor i in range(len(s)):\n if na + nb >= a+b:\n print(\"No\")\n elif s[i]==\"a\":\n na += 1\n print(\"Yes\")\n elif s[i]==\"b\":\n if nb < b:\n nb += 1\n print(\"Yes\")\n else:\n print(\"No\")\n else:\n print(\"No\")", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these.\n\nOnly Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from the top rank down. Participants who are not students cannot pass the Qualification contests.\n\nA Japanese student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B.\n\nAn overseas student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B and the student ranks B-th or above among all overseas students.\n\nA string S is assigned indicating attributes of all participants. If the i-th character of string S is a, this means the participant ranked i-th in the Qualification contests is a Japanese student; b means the participant ranked i-th is an overseas student; and c means the participant ranked i-th is neither of these.\n\nWrite a program that outputs for all the participants in descending rank either Yes if they passed the Qualification contests or No if they did not pass.\n\nConstraints\n\n1≦N,A,B≦100000\n\nA+B≦N\n\nS is N characters long.\n\nS consists only of the letters a, b and c.\n\nInput\n\nInputs are provided from Standard Input in the following form.\n\nN A B\nS\n\nOutput\n\nOutput N lines. On the i-th line, output Yes if the i-th participant passed the Qualification contests or No if that participant did not pass.\n\nSample Input 1\n\n10 2 3\nabccabaabb\n\nSample Output 1\n\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\n\nThe first, second, fifth, sixth, and seventh participants pass the Qualification contests.\n\nSample Input 2\n\n12 5 2\ncabbabaacaba\n\nSample Output 2\n\nNo\nYes\nYes\nYes\nYes\nNo\nYes\nYes\nNo\nYes\nNo\nNo\n\nThe sixth participant is third among overseas students and thus does not pass the Qualification contests.\n\nSample Input 3\n\n5 2 2\nccccc\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nNo", "sample_input": "10 2 3\nabccabaabb\n"}, "reference_outputs": ["Yes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\n"], "source_document_id": "p03971", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these.\n\nOnly Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from the top rank down. Participants who are not students cannot pass the Qualification contests.\n\nA Japanese student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B.\n\nAn overseas student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B and the student ranks B-th or above among all overseas students.\n\nA string S is assigned indicating attributes of all participants. If the i-th character of string S is a, this means the participant ranked i-th in the Qualification contests is a Japanese student; b means the participant ranked i-th is an overseas student; and c means the participant ranked i-th is neither of these.\n\nWrite a program that outputs for all the participants in descending rank either Yes if they passed the Qualification contests or No if they did not pass.\n\nConstraints\n\n1≦N,A,B≦100000\n\nA+B≦N\n\nS is N characters long.\n\nS consists only of the letters a, b and c.\n\nInput\n\nInputs are provided from Standard Input in the following form.\n\nN A B\nS\n\nOutput\n\nOutput N lines. On the i-th line, output Yes if the i-th participant passed the Qualification contests or No if that participant did not pass.\n\nSample Input 1\n\n10 2 3\nabccabaabb\n\nSample Output 1\n\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\n\nThe first, second, fifth, sixth, and seventh participants pass the Qualification contests.\n\nSample Input 2\n\n12 5 2\ncabbabaacaba\n\nSample Output 2\n\nNo\nYes\nYes\nYes\nYes\nNo\nYes\nYes\nNo\nYes\nNo\nNo\n\nThe sixth participant is third among overseas students and thus does not pass the Qualification contests.\n\nSample Input 3\n\n5 2 2\nccccc\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 284, "cpu_time_ms": 120, "memory_kb": 75532}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s105652080", "group_id": "codeNet:p03971", "input_text": "N, A, B = map(int,input().split())\nS = input()\nS = \"a\"*10000\nyosen = 0\nyosen_b = 1\nfor i in range(N):\n if S[i] == \"a\" and yosen < (A + B):\n print(\"Yes\")\n yosen += 1\n elif S[i] == \"b\" and yosen < (A + B) and yosen_b <= B:\n print(\"Yes\")\n yosen += 1\n yosen_b += 1\n else:\n print(\"No\")", "language": "Python", "metadata": {"date": 1595126251, "filename_ext": "py", "original_language": "Python (3.8.2)", "problem_description_relpath": "problem_descriptions/p03971.html", "problem_id": "p03971", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03971/input.txt", "sample_output_relpath": "derived/input_output/data/p03971/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03971/Python/s105652080.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s105652080", "user_id": "u188305619"}, "prompt_components": {"gold_output": "Yes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\n", "input_to_evaluate": "N, A, B = map(int,input().split())\nS = input()\nS = \"a\"*10000\nyosen = 0\nyosen_b = 1\nfor i in range(N):\n if S[i] == \"a\" and yosen < (A + B):\n print(\"Yes\")\n yosen += 1\n elif S[i] == \"b\" and yosen < (A + B) and yosen_b <= B:\n print(\"Yes\")\n yosen += 1\n yosen_b += 1\n else:\n print(\"No\")", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these.\n\nOnly Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from the top rank down. Participants who are not students cannot pass the Qualification contests.\n\nA Japanese student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B.\n\nAn overseas student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B and the student ranks B-th or above among all overseas students.\n\nA string S is assigned indicating attributes of all participants. If the i-th character of string S is a, this means the participant ranked i-th in the Qualification contests is a Japanese student; b means the participant ranked i-th is an overseas student; and c means the participant ranked i-th is neither of these.\n\nWrite a program that outputs for all the participants in descending rank either Yes if they passed the Qualification contests or No if they did not pass.\n\nConstraints\n\n1≦N,A,B≦100000\n\nA+B≦N\n\nS is N characters long.\n\nS consists only of the letters a, b and c.\n\nInput\n\nInputs are provided from Standard Input in the following form.\n\nN A B\nS\n\nOutput\n\nOutput N lines. On the i-th line, output Yes if the i-th participant passed the Qualification contests or No if that participant did not pass.\n\nSample Input 1\n\n10 2 3\nabccabaabb\n\nSample Output 1\n\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\n\nThe first, second, fifth, sixth, and seventh participants pass the Qualification contests.\n\nSample Input 2\n\n12 5 2\ncabbabaacaba\n\nSample Output 2\n\nNo\nYes\nYes\nYes\nYes\nNo\nYes\nYes\nNo\nYes\nNo\nNo\n\nThe sixth participant is third among overseas students and thus does not pass the Qualification contests.\n\nSample Input 3\n\n5 2 2\nccccc\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nNo", "sample_input": "10 2 3\nabccabaabb\n"}, "reference_outputs": ["Yes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\n"], "source_document_id": "p03971", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these.\n\nOnly Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from the top rank down. Participants who are not students cannot pass the Qualification contests.\n\nA Japanese student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B.\n\nAn overseas student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B and the student ranks B-th or above among all overseas students.\n\nA string S is assigned indicating attributes of all participants. If the i-th character of string S is a, this means the participant ranked i-th in the Qualification contests is a Japanese student; b means the participant ranked i-th is an overseas student; and c means the participant ranked i-th is neither of these.\n\nWrite a program that outputs for all the participants in descending rank either Yes if they passed the Qualification contests or No if they did not pass.\n\nConstraints\n\n1≦N,A,B≦100000\n\nA+B≦N\n\nS is N characters long.\n\nS consists only of the letters a, b and c.\n\nInput\n\nInputs are provided from Standard Input in the following form.\n\nN A B\nS\n\nOutput\n\nOutput N lines. On the i-th line, output Yes if the i-th participant passed the Qualification contests or No if that participant did not pass.\n\nSample Input 1\n\n10 2 3\nabccabaabb\n\nSample Output 1\n\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\n\nThe first, second, fifth, sixth, and seventh participants pass the Qualification contests.\n\nSample Input 2\n\n12 5 2\ncabbabaacaba\n\nSample Output 2\n\nNo\nYes\nYes\nYes\nYes\nNo\nYes\nYes\nNo\nYes\nNo\nNo\n\nThe sixth participant is third among overseas students and thus does not pass the Qualification contests.\n\nSample Input 3\n\n5 2 2\nccccc\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 30, "memory_kb": 9088}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s022240268", "group_id": "codeNet:p03971", "input_text": "def myAnswer(A: int, B: int, S: list) -> None:\n counter = 0\n foreignStu = 1\n for i, s in enumerate(S):\n if(s == 'a' and counter < (A + B)): #国内の学生で、カウンタの値が(A+B)未満なら通過\n print(\"Yes\")\n counter += 1#カウンタの値を更新\n elif(s == 'b' and counter < (A + B) and foreignStu <= B): #海外の学生で、カウンタの値が(A+B)未満かつ海外学生の順位がB以下なら通過\n print(\"Yes\")\n counter += 1\n foreignStu += 1\n else:\n print(\"No\")\n\n\ndef main():\n N, A, B = map(int, input().split())\n S = list(input())\n myAnswer(A, B, S)\n\n\nif __name__ == \"__main__\":\n main()", "language": "Python", "metadata": {"date": 1586621879, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p03971.html", "problem_id": "p03971", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03971/input.txt", "sample_output_relpath": "derived/input_output/data/p03971/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03971/Python/s022240268.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s022240268", "user_id": "u301624971"}, "prompt_components": {"gold_output": "Yes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\n", "input_to_evaluate": "def myAnswer(A: int, B: int, S: list) -> None:\n counter = 0\n foreignStu = 1\n for i, s in enumerate(S):\n if(s == 'a' and counter < (A + B)): #国内の学生で、カウンタの値が(A+B)未満なら通過\n print(\"Yes\")\n counter += 1#カウンタの値を更新\n elif(s == 'b' and counter < (A + B) and foreignStu <= B): #海外の学生で、カウンタの値が(A+B)未満かつ海外学生の順位がB以下なら通過\n print(\"Yes\")\n counter += 1\n foreignStu += 1\n else:\n print(\"No\")\n\n\ndef main():\n N, A, B = map(int, input().split())\n S = list(input())\n myAnswer(A, B, S)\n\n\nif __name__ == \"__main__\":\n main()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these.\n\nOnly Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from the top rank down. Participants who are not students cannot pass the Qualification contests.\n\nA Japanese student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B.\n\nAn overseas student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B and the student ranks B-th or above among all overseas students.\n\nA string S is assigned indicating attributes of all participants. If the i-th character of string S is a, this means the participant ranked i-th in the Qualification contests is a Japanese student; b means the participant ranked i-th is an overseas student; and c means the participant ranked i-th is neither of these.\n\nWrite a program that outputs for all the participants in descending rank either Yes if they passed the Qualification contests or No if they did not pass.\n\nConstraints\n\n1≦N,A,B≦100000\n\nA+B≦N\n\nS is N characters long.\n\nS consists only of the letters a, b and c.\n\nInput\n\nInputs are provided from Standard Input in the following form.\n\nN A B\nS\n\nOutput\n\nOutput N lines. On the i-th line, output Yes if the i-th participant passed the Qualification contests or No if that participant did not pass.\n\nSample Input 1\n\n10 2 3\nabccabaabb\n\nSample Output 1\n\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\n\nThe first, second, fifth, sixth, and seventh participants pass the Qualification contests.\n\nSample Input 2\n\n12 5 2\ncabbabaacaba\n\nSample Output 2\n\nNo\nYes\nYes\nYes\nYes\nNo\nYes\nYes\nNo\nYes\nNo\nNo\n\nThe sixth participant is third among overseas students and thus does not pass the Qualification contests.\n\nSample Input 3\n\n5 2 2\nccccc\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nNo", "sample_input": "10 2 3\nabccabaabb\n"}, "reference_outputs": ["Yes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\n"], "source_document_id": "p03971", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these.\n\nOnly Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from the top rank down. Participants who are not students cannot pass the Qualification contests.\n\nA Japanese student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B.\n\nAn overseas student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B and the student ranks B-th or above among all overseas students.\n\nA string S is assigned indicating attributes of all participants. If the i-th character of string S is a, this means the participant ranked i-th in the Qualification contests is a Japanese student; b means the participant ranked i-th is an overseas student; and c means the participant ranked i-th is neither of these.\n\nWrite a program that outputs for all the participants in descending rank either Yes if they passed the Qualification contests or No if they did not pass.\n\nConstraints\n\n1≦N,A,B≦100000\n\nA+B≦N\n\nS is N characters long.\n\nS consists only of the letters a, b and c.\n\nInput\n\nInputs are provided from Standard Input in the following form.\n\nN A B\nS\n\nOutput\n\nOutput N lines. On the i-th line, output Yes if the i-th participant passed the Qualification contests or No if that participant did not pass.\n\nSample Input 1\n\n10 2 3\nabccabaabb\n\nSample Output 1\n\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\n\nThe first, second, fifth, sixth, and seventh participants pass the Qualification contests.\n\nSample Input 2\n\n12 5 2\ncabbabaacaba\n\nSample Output 2\n\nNo\nYes\nYes\nYes\nYes\nNo\nYes\nYes\nNo\nYes\nNo\nNo\n\nThe sixth participant is third among overseas students and thus does not pass the Qualification contests.\n\nSample Input 3\n\n5 2 2\nccccc\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 724, "cpu_time_ms": 95, "memory_kb": 4712}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s051298265", "group_id": "codeNet:p03993", "input_text": "# -*- coding: utf-8 -*-\nimport sys\nsys.setrecursionlimit(10**9)\nINF=10**18\nMOD=10**9+7\ninput=lambda: sys.stdin.readline().rstrip()\nYesNo=lambda b: bool([print('Yes')] if b else print('No'))\nYESNO=lambda b: bool([print('YES')] if b else print('NO'))\nint1=lambda x:int(x)-1\n\nN=int(input())\na=list(map(int1,input().split()))\nans=0\nfor i,x in enumerate(a):\n if i==a[x]:\n ans+=1\nans//=2\nprint(ans)", "language": "Python", "metadata": {"date": 1597895912, "filename_ext": "py", "original_language": "PyPy3 (7.3.0)", "problem_description_relpath": "problem_descriptions/p03993.html", "problem_id": "p03993", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p03993/input.txt", "sample_output_relpath": "derived/input_output/data/p03993/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03993/Python/s051298265.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s051298265", "user_id": "u714642969"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "# -*- coding: utf-8 -*-\nimport sys\nsys.setrecursionlimit(10**9)\nINF=10**18\nMOD=10**9+7\ninput=lambda: sys.stdin.readline().rstrip()\nYesNo=lambda b: bool([print('Yes')] if b else print('No'))\nYESNO=lambda b: bool([print('YES')] if b else print('NO'))\nint1=lambda x:int(x)-1\n\nN=int(input())\na=list(map(int1,input().split()))\nans=0\nfor i,x in enumerate(a):\n if i==a[x]:\n ans+=1\nans//=2\nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N rabbits, numbered 1 through N.\n\nThe i-th (1≤i≤N) rabbit likes rabbit a_i.\nNote that no rabbit can like itself, that is, a_i≠i.\n\nFor a pair of rabbits i and j (i<j), we call the pair (i,j) a friendly pair if the following condition is met.\n\nRabbit i likes rabbit j and rabbit j likes rabbit i.\n\nCalculate the number of the friendly pairs.\n\nConstraints\n\n2≤N≤10^5\n\n1≤a_i≤N\n\na_i≠i\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the number of the friendly pairs.\n\nSample Input 1\n\n4\n2 1 4 3\n\nSample Output 1\n\n2\n\nThere are two friendly pairs: (1,2) and (3,4).\n\nSample Input 2\n\n3\n2 3 1\n\nSample Output 2\n\n0\n\nThere are no friendly pairs.\n\nSample Input 3\n\n5\n5 5 5 5 1\n\nSample Output 3\n\n1\n\nThere is one friendly pair: (1,5).", "sample_input": "4\n2 1 4 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03993", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N rabbits, numbered 1 through N.\n\nThe i-th (1≤i≤N) rabbit likes rabbit a_i.\nNote that no rabbit can like itself, that is, a_i≠i.\n\nFor a pair of rabbits i and j (i<j), we call the pair (i,j) a friendly pair if the following condition is met.\n\nRabbit i likes rabbit j and rabbit j likes rabbit i.\n\nCalculate the number of the friendly pairs.\n\nConstraints\n\n2≤N≤10^5\n\n1≤a_i≤N\n\na_i≠i\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the number of the friendly pairs.\n\nSample Input 1\n\n4\n2 1 4 3\n\nSample Output 1\n\n2\n\nThere are two friendly pairs: (1,2) and (3,4).\n\nSample Input 2\n\n3\n2 3 1\n\nSample Output 2\n\n0\n\nThere are no friendly pairs.\n\nSample Input 3\n\n5\n5 5 5 5 1\n\nSample Output 3\n\n1\n\nThere is one friendly pair: (1,5).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 402, "cpu_time_ms": 87, "memory_kb": 84912}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s721982207", "group_id": "codeNet:p04000", "input_text": "#from collections import deque,defaultdict\nprintn = lambda x: print(x,end='')\ninn = lambda : int(input())\ninl = lambda: list(map(int, input().split()))\ninm = lambda: map(int, input().split())\nins = lambda : input().strip()\nDBG = True # and False\nBIG = 10**18\nR = 10**9 + 7\n\ndef ddprint(x):\n if DBG:\n print(x)\n\ndef foo(a,b,ans):\n z = d[a][b]\n for p in range(3):\n for q in range(3):\n if a-2+p<0 or a+p>=h or b-2+q<0 or b+q>=w:\n continue\n ok = True\n reachorig = False\n v = 0\n for i in range(3):\n for j in range(3):\n if p+i==q+j==2:\n reachorig = True\n if z[p+i][q+j]==1:\n if reachorig:\n v += 1\n else:\n ok = False\n break\n if ok:\n ans[v] += 1\n\nh,w,n = inm()\nd = {}\nab = []\nfor i in range(n):\n a,b = inm()\n a -= 1\n b -= 1\n ab.append((a,b))\n if a not in d:\n d[a] = {}\n d[a][b] = [[0]*5 for j in range(5)]\n d[a][b][2][2] = 1\nfor a,b in ab:\n for dx in range(-2,3):\n for dy in range(-2,3):\n if a+dx in d and b+dy in d[a+dx] and not (dx==dy==0):\n d[a+dx][b+dy][2-dx][2-dy] = 1\n\nif False and DBG:\n for i in range(h):\n for j in range(w):\n if i in d and j in d[i]:\n #print(f\"{i=} {j=}\")\n for k in range(5):\n print(d[i][j][k])\nans = [0]*10\nfor a,b in ab:\n foo(a,b,ans)\nprint((h-2)*(w-2)-sum(ans))\nfor i in range(1,10):\n print(ans[i])\n", "language": "Python", "metadata": {"date": 1592406926, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p04000.html", "problem_id": "p04000", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p04000/input.txt", "sample_output_relpath": "derived/input_output/data/p04000/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04000/Python/s721982207.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s721982207", "user_id": "u102445737"}, "prompt_components": {"gold_output": "0\n0\n0\n2\n4\n0\n0\n0\n0\n0\n", "input_to_evaluate": "#from collections import deque,defaultdict\nprintn = lambda x: print(x,end='')\ninn = lambda : int(input())\ninl = lambda: list(map(int, input().split()))\ninm = lambda: map(int, input().split())\nins = lambda : input().strip()\nDBG = True # and False\nBIG = 10**18\nR = 10**9 + 7\n\ndef ddprint(x):\n if DBG:\n print(x)\n\ndef foo(a,b,ans):\n z = d[a][b]\n for p in range(3):\n for q in range(3):\n if a-2+p<0 or a+p>=h or b-2+q<0 or b+q>=w:\n continue\n ok = True\n reachorig = False\n v = 0\n for i in range(3):\n for j in range(3):\n if p+i==q+j==2:\n reachorig = True\n if z[p+i][q+j]==1:\n if reachorig:\n v += 1\n else:\n ok = False\n break\n if ok:\n ans[v] += 1\n\nh,w,n = inm()\nd = {}\nab = []\nfor i in range(n):\n a,b = inm()\n a -= 1\n b -= 1\n ab.append((a,b))\n if a not in d:\n d[a] = {}\n d[a][b] = [[0]*5 for j in range(5)]\n d[a][b][2][2] = 1\nfor a,b in ab:\n for dx in range(-2,3):\n for dy in range(-2,3):\n if a+dx in d and b+dy in d[a+dx] and not (dx==dy==0):\n d[a+dx][b+dy][2-dx][2-dy] = 1\n\nif False and DBG:\n for i in range(h):\n for j in range(w):\n if i in d and j in d[i]:\n #print(f\"{i=} {j=}\")\n for k in range(5):\n print(d[i][j][k])\nans = [0]*10\nfor a,b in ab:\n foo(a,b,ans)\nprint((h-2)*(w-2)-sum(ans))\nfor i in range(1,10):\n print(ans[i])\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns. At first, all cells were painted white.\n\nSnuke painted N of these cells. The i-th ( 1 \\leq i \\leq N ) cell he painted is the cell at the a_i-th row and b_i-th column.\n\nCompute the following:\n\nFor each integer j ( 0 \\leq j \\leq 9 ), how many subrectangles of size 3×3 of the grid contains exactly j black cells, after Snuke painted N cells?\n\nConstraints\n\n3 \\leq H \\leq 10^9\n\n3 \\leq W \\leq 10^9\n\n0 \\leq N \\leq min(10^5,H×W)\n\n1 \\leq a_i \\leq H (1 \\leq i \\leq N)\n\n1 \\leq b_i \\leq W (1 \\leq i \\leq N)\n\n(a_i, b_i) \\neq (a_j, b_j) (i \\neq j)\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W N\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint 10 lines.\nThe (j+1)-th ( 0 \\leq j \\leq 9 ) line should contain the number of the subrectangles of size 3×3 of the grid that contains exactly j black cells.\n\nSample Input 1\n\n4 5 8\n1 1\n1 4\n1 5\n2 3\n3 1\n3 2\n3 4\n4 4\n\nSample Output 1\n\n0\n0\n0\n2\n4\n0\n0\n0\n0\n0\n\nThere are six subrectangles of size 3×3. Two of them contain three black cells each, and the remaining four contain four black cells each.\n\nSample Input 2\n\n10 10 20\n1 1\n1 4\n1 9\n2 5\n3 10\n4 2\n4 7\n5 9\n6 4\n6 6\n6 7\n7 1\n7 3\n7 7\n8 1\n8 5\n8 10\n9 2\n10 4\n10 9\n\nSample Output 2\n\n4\n26\n22\n10\n2\n0\n0\n0\n0\n0\n\nSample Input 3\n\n1000000000 1000000000 0\n\nSample Output 3\n\n999999996000000004\n0\n0\n0\n0\n0\n0\n0\n0\n0", "sample_input": "4 5 8\n1 1\n1 4\n1 5\n2 3\n3 1\n3 2\n3 4\n4 4\n"}, "reference_outputs": ["0\n0\n0\n2\n4\n0\n0\n0\n0\n0\n"], "source_document_id": "p04000", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns. At first, all cells were painted white.\n\nSnuke painted N of these cells. The i-th ( 1 \\leq i \\leq N ) cell he painted is the cell at the a_i-th row and b_i-th column.\n\nCompute the following:\n\nFor each integer j ( 0 \\leq j \\leq 9 ), how many subrectangles of size 3×3 of the grid contains exactly j black cells, after Snuke painted N cells?\n\nConstraints\n\n3 \\leq H \\leq 10^9\n\n3 \\leq W \\leq 10^9\n\n0 \\leq N \\leq min(10^5,H×W)\n\n1 \\leq a_i \\leq H (1 \\leq i \\leq N)\n\n1 \\leq b_i \\leq W (1 \\leq i \\leq N)\n\n(a_i, b_i) \\neq (a_j, b_j) (i \\neq j)\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W N\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint 10 lines.\nThe (j+1)-th ( 0 \\leq j \\leq 9 ) line should contain the number of the subrectangles of size 3×3 of the grid that contains exactly j black cells.\n\nSample Input 1\n\n4 5 8\n1 1\n1 4\n1 5\n2 3\n3 1\n3 2\n3 4\n4 4\n\nSample Output 1\n\n0\n0\n0\n2\n4\n0\n0\n0\n0\n0\n\nThere are six subrectangles of size 3×3. Two of them contain three black cells each, and the remaining four contain four black cells each.\n\nSample Input 2\n\n10 10 20\n1 1\n1 4\n1 9\n2 5\n3 10\n4 2\n4 7\n5 9\n6 4\n6 6\n6 7\n7 1\n7 3\n7 7\n8 1\n8 5\n8 10\n9 2\n10 4\n10 9\n\nSample Output 2\n\n4\n26\n22\n10\n2\n0\n0\n0\n0\n0\n\nSample Input 3\n\n1000000000 1000000000 0\n\nSample Output 3\n\n999999996000000004\n0\n0\n0\n0\n0\n0\n0\n0\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1683, "cpu_time_ms": 1954, "memory_kb": 136708}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s127619363", "group_id": "codeNet:p04000", "input_text": "F=lambda:tuple(int(X)for X in input().split());H,W,N=F();S={F()for _ in[0]*N};T=set();Z=[0]*10\nfor Y,X in S:\n\tfor A in range(9):\n\t\tA,B=X+A%3-1,Y+A//3-1\n\t\tif 0K:\n print(K*X+(N-K)*Y)\nelse:\n print(N*X)", "language": "Python", "metadata": {"date": 1545235524, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p04011.html", "problem_id": "p04011", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p04011/input.txt", "sample_output_relpath": "derived/input_output/data/p04011/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04011/Python/s799006732.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s799006732", "user_id": "u439392790"}, "prompt_components": {"gold_output": "48000\n", "input_to_evaluate": "a=[N,K,X,Y]\nfor i in range(0,4):\n a=a.append(input())\nif N>K:\n print(K*X+(N-K)*Y)\nelse:\n print(N*X)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is a hotel with the following accommodation fee:\n\nX yen (the currency of Japan) per night, for the first K nights\n\nY yen per night, for the (K+1)-th and subsequent nights\n\nTak is staying at this hotel for N consecutive nights.\nFind his total accommodation fee.\n\nConstraints\n\n1 \\leq N, K \\leq 10000\n\n1 \\leq Y < X \\leq 10000\n\nN,\\,K,\\,X,\\,Y are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nK\nX\nY\n\nOutput\n\nPrint Tak's total accommodation fee.\n\nSample Input 1\n\n5\n3\n10000\n9000\n\nSample Output 1\n\n48000\n\nThe accommodation fee is as follows:\n\n10000 yen for the 1-st night\n\n10000 yen for the 2-nd night\n\n10000 yen for the 3-rd night\n\n9000 yen for the 4-th night\n\n9000 yen for the 5-th night\n\nThus, the total is 48000 yen.\n\nSample Input 2\n\n2\n3\n10000\n9000\n\nSample Output 2\n\n20000", "sample_input": "5\n3\n10000\n9000\n"}, "reference_outputs": ["48000\n"], "source_document_id": "p04011", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is a hotel with the following accommodation fee:\n\nX yen (the currency of Japan) per night, for the first K nights\n\nY yen per night, for the (K+1)-th and subsequent nights\n\nTak is staying at this hotel for N consecutive nights.\nFind his total accommodation fee.\n\nConstraints\n\n1 \\leq N, K \\leq 10000\n\n1 \\leq Y < X \\leq 10000\n\nN,\\,K,\\,X,\\,Y are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nK\nX\nY\n\nOutput\n\nPrint Tak's total accommodation fee.\n\nSample Input 1\n\n5\n3\n10000\n9000\n\nSample Output 1\n\n48000\n\nThe accommodation fee is as follows:\n\n10000 yen for the 1-st night\n\n10000 yen for the 2-nd night\n\n10000 yen for the 3-rd night\n\n9000 yen for the 4-th night\n\n9000 yen for the 5-th night\n\nThus, the total is 48000 yen.\n\nSample Input 2\n\n2\n3\n10000\n9000\n\nSample Output 2\n\n20000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 108, "cpu_time_ms": 18, "memory_kb": 2940}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s928309216", "group_id": "codeNet:p04012", "input_text": "w = raw_input()\n\nfor c in w :\n if w.count(c) % 2 != 0 :\n print \"No\"\n break\nelse :\n print \"Yes\"\n", "language": "Python", "metadata": {"date": 1473565144, "filename_ext": "py", "original_language": "Python (2.7.6)", "problem_description_relpath": "problem_descriptions/p04012.html", "problem_id": "p04012", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p04012/input.txt", "sample_output_relpath": "derived/input_output/data/p04012/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04012/Python/s928309216.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s928309216", "user_id": "u870040448"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "w = raw_input()\n\nfor c in w :\n if w.count(c) % 2 != 0 :\n print \"No\"\n break\nelse :\n print \"Yes\"\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet w be a string consisting of lowercase letters.\nWe will call w beautiful if the following condition is satisfied:\n\nEach lowercase letter of the English alphabet occurs even number of times in w.\n\nYou are given the string w. Determine if w is beautiful.\n\nConstraints\n\n1 \\leq |w| \\leq 100\n\nw consists of lowercase letters (a-z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nw\n\nOutput\n\nPrint Yes if w is beautiful. Print No otherwise.\n\nSample Input 1\n\nabaccaba\n\nSample Output 1\n\nYes\n\na occurs four times, b occurs twice, c occurs twice and the other letters occur zero times.\n\nSample Input 2\n\nhthth\n\nSample Output 2\n\nNo", "sample_input": "abaccaba\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p04012", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet w be a string consisting of lowercase letters.\nWe will call w beautiful if the following condition is satisfied:\n\nEach lowercase letter of the English alphabet occurs even number of times in w.\n\nYou are given the string w. Determine if w is beautiful.\n\nConstraints\n\n1 \\leq |w| \\leq 100\n\nw consists of lowercase letters (a-z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nw\n\nOutput\n\nPrint Yes if w is beautiful. Print No otherwise.\n\nSample Input 1\n\nabaccaba\n\nSample Output 1\n\nYes\n\na occurs four times, b occurs twice, c occurs twice and the other letters occur zero times.\n\nSample Input 2\n\nhthth\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 103, "cpu_time_ms": 27, "memory_kb": 2568}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s866314828", "group_id": "codeNet:p04020", "input_text": "N=int(input())\nA=[int(input()) for _ in range(N)]\n \nans=0\nfor i in range(0,N-1,2):\n a,b=A[i],A[i+1] \n if b%2==1 and a%2==1: \n ans+=a%2\n A[i]-=1\n A[i+1]-=1\n\nfor a in A:\n ans+= a//2\nprint(ans)\n", "language": "Python", "metadata": {"date": 1551795470, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p04020.html", "problem_id": "p04020", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p04020/input.txt", "sample_output_relpath": "derived/input_output/data/p04020/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04020/Python/s866314828.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s866314828", "user_id": "u572144347"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "N=int(input())\nA=[int(input()) for _ in range(N)]\n \nans=0\nfor i in range(0,N-1,2):\n a,b=A[i],A[i+1] \n if b%2==1 and a%2==1: \n ans+=a%2\n A[i]-=1\n A[i+1]-=1\n\nfor a in A:\n ans+= a//2\nprint(ans)\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke has a large collection of cards. Each card has an integer between 1 and N, inclusive, written on it.\nHe has A_i cards with an integer i.\n\nTwo cards can form a pair if the absolute value of the difference of the integers written on them is at most 1.\n\nSnuke wants to create the maximum number of pairs from his cards, on the condition that no card should be used in multiple pairs. Find the maximum number of pairs that he can create.\n\nConstraints\n\n1 ≦ N ≦ 10^5\n\n0 ≦ A_i ≦ 10^9 (1 ≦ i ≦ N)\n\nAll input values are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum number of pairs that Snuke can create.\n\nSample Input 1\n\n4\n4\n0\n3\n2\n\nSample Output 1\n\n4\n\nFor example, Snuke can create the following four pairs: (1,1),(1,1),(3,4),(3,4).\n\nSample Input 2\n\n8\n2\n0\n1\n6\n0\n8\n2\n1\n\nSample Output 2\n\n9", "sample_input": "4\n4\n0\n3\n2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p04020", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke has a large collection of cards. Each card has an integer between 1 and N, inclusive, written on it.\nHe has A_i cards with an integer i.\n\nTwo cards can form a pair if the absolute value of the difference of the integers written on them is at most 1.\n\nSnuke wants to create the maximum number of pairs from his cards, on the condition that no card should be used in multiple pairs. Find the maximum number of pairs that he can create.\n\nConstraints\n\n1 ≦ N ≦ 10^5\n\n0 ≦ A_i ≦ 10^9 (1 ≦ i ≦ N)\n\nAll input values are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum number of pairs that Snuke can create.\n\nSample Input 1\n\n4\n4\n0\n3\n2\n\nSample Output 1\n\n4\n\nFor example, Snuke can create the following four pairs: (1,1),(1,1),(3,4),(3,4).\n\nSample Input 2\n\n8\n2\n0\n1\n6\n0\n8\n2\n1\n\nSample Output 2\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 203, "cpu_time_ms": 521, "memory_kb": 50136}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s162139100", "group_id": "codeNet:p04022", "input_text": "def examA():\n S = SI()\n if \"W\" in S and not \"E\" in S:\n print(\"No\")\n elif \"E\" in S and not \"W\" in S:\n print(\"No\")\n elif \"N\" in S and not \"S\" in S:\n print(\"No\")\n elif \"S\" in S and not \"N\" in S:\n print(\"No\")\n else:\n print(\"Yes\")\n return\n\ndef examB():\n N = I()\n A = [I()for _ in range(N)]\n ans = 0\n for i in range(N-1):\n ans += A[i]//2\n if A[i]%2 and A[i+1]>=1:\n ans += 1\n A[i+1] -= 1\n ans += A[N-1]//2\n print(ans)\n return\n\ndef examC():\n N = I()\n A = [I()for _ in range(N)]\n if N==1:\n print(0)\n return\n odd = set()\n for i in range(N):\n if i&1==0:\n odd.add(A[i])\n A.sort()\n ans = 0\n for i in range((N+1)//2):\n if A[i*2] in odd:\n continue\n ans += 1\n print(ans)\n return\n\ndef examD():\n def factorization_(a):\n rep = [[]for _ in range(2)]\n pair = []\n for i in range(2,int(10**(10*1/3))+2):\n cur = 0\n while a%i==0:\n cur += 1\n a //= i\n if cur>0:\n cur %= 3\n if cur==0:\n continue\n rep[0].append((i,cur))\n pair.append((i,3-cur))\n if not rep[0]:\n rep[0].append((0,0))\n rep[1] = a\n rep[0] = tuple(rep[0])\n\n rep = tuple(rep)\n pair = tuple(pair)\n return rep, pair\n\n N = I()\n S = [I()for _ in range(N)]\n group = defaultdict(int)\n P = defaultdict(tuple)\n for s in S:\n g,p = factorization_(s)\n group[g] += 1\n P[g[0]] = p\n #print(group)\n G2 = deepcopy(group)\n #print(P)\n used = set()\n ans = 0\n for key,c in group.items():\n rep, rest = key\n if (rep,rest) in used:\n continue\n pair = rest**2\n if rep==((0,0),) and rest==1:\n ans += 1\n else:\n ans += max(c,G2[(P[rep],pair)])\n used.add((rep,rest))\n used.add((P[rep], pair))\n #print(ans)\n print(ans)\n return\n\ndef examE():\n ans = 0\n print(ans)\n return\n\ndef examF():\n ans = 0\n print(ans)\n return\n\nimport sys,bisect,itertools,heapq,math,random\nfrom copy import deepcopy\nfrom heapq import heappop,heappush,heapify\nfrom collections import Counter,defaultdict,deque\ndef I(): return int(sys.stdin.readline())\ndef LI(): return list(map(int,sys.stdin.readline().split()))\ndef LSI(): return list(map(str,sys.stdin.readline().split()))\ndef LS(): return sys.stdin.readline().split()\ndef SI(): return sys.stdin.readline().strip()\nglobal mod,mod2,inf,alphabet,_ep\nmod = 10**9 + 7\nmod2 = 998244353\ninf = 10**18\n_ep = 10**(-12)\nalphabet = [chr(ord('a') + i) for i in range(26)]\n\nsys.setrecursionlimit(10**6)\n\nif __name__ == '__main__':\n examD()\n\n\"\"\"\n\n\"\"\"\n", "language": "Python", "metadata": {"date": 1584506530, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p04022.html", "problem_id": "p04022", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p04022/input.txt", "sample_output_relpath": "derived/input_output/data/p04022/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04022/Python/s162139100.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s162139100", "user_id": "u638795007"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "def examA():\n S = SI()\n if \"W\" in S and not \"E\" in S:\n print(\"No\")\n elif \"E\" in S and not \"W\" in S:\n print(\"No\")\n elif \"N\" in S and not \"S\" in S:\n print(\"No\")\n elif \"S\" in S and not \"N\" in S:\n print(\"No\")\n else:\n print(\"Yes\")\n return\n\ndef examB():\n N = I()\n A = [I()for _ in range(N)]\n ans = 0\n for i in range(N-1):\n ans += A[i]//2\n if A[i]%2 and A[i+1]>=1:\n ans += 1\n A[i+1] -= 1\n ans += A[N-1]//2\n print(ans)\n return\n\ndef examC():\n N = I()\n A = [I()for _ in range(N)]\n if N==1:\n print(0)\n return\n odd = set()\n for i in range(N):\n if i&1==0:\n odd.add(A[i])\n A.sort()\n ans = 0\n for i in range((N+1)//2):\n if A[i*2] in odd:\n continue\n ans += 1\n print(ans)\n return\n\ndef examD():\n def factorization_(a):\n rep = [[]for _ in range(2)]\n pair = []\n for i in range(2,int(10**(10*1/3))+2):\n cur = 0\n while a%i==0:\n cur += 1\n a //= i\n if cur>0:\n cur %= 3\n if cur==0:\n continue\n rep[0].append((i,cur))\n pair.append((i,3-cur))\n if not rep[0]:\n rep[0].append((0,0))\n rep[1] = a\n rep[0] = tuple(rep[0])\n\n rep = tuple(rep)\n pair = tuple(pair)\n return rep, pair\n\n N = I()\n S = [I()for _ in range(N)]\n group = defaultdict(int)\n P = defaultdict(tuple)\n for s in S:\n g,p = factorization_(s)\n group[g] += 1\n P[g[0]] = p\n #print(group)\n G2 = deepcopy(group)\n #print(P)\n used = set()\n ans = 0\n for key,c in group.items():\n rep, rest = key\n if (rep,rest) in used:\n continue\n pair = rest**2\n if rep==((0,0),) and rest==1:\n ans += 1\n else:\n ans += max(c,G2[(P[rep],pair)])\n used.add((rep,rest))\n used.add((P[rep], pair))\n #print(ans)\n print(ans)\n return\n\ndef examE():\n ans = 0\n print(ans)\n return\n\ndef examF():\n ans = 0\n print(ans)\n return\n\nimport sys,bisect,itertools,heapq,math,random\nfrom copy import deepcopy\nfrom heapq import heappop,heappush,heapify\nfrom collections import Counter,defaultdict,deque\ndef I(): return int(sys.stdin.readline())\ndef LI(): return list(map(int,sys.stdin.readline().split()))\ndef LSI(): return list(map(str,sys.stdin.readline().split()))\ndef LS(): return sys.stdin.readline().split()\ndef SI(): return sys.stdin.readline().strip()\nglobal mod,mod2,inf,alphabet,_ep\nmod = 10**9 + 7\nmod2 = 998244353\ninf = 10**18\n_ep = 10**(-12)\nalphabet = [chr(ord('a') + i) for i in range(26)]\n\nsys.setrecursionlimit(10**6)\n\nif __name__ == '__main__':\n examD()\n\n\"\"\"\n\n\"\"\"\n", "problem_context": "Score : 1100 points\n\nProblem Statement\n\nSnuke got positive integers s_1,...,s_N from his mother, as a birthday present. There may be duplicate elements.\n\nHe will circle some of these N integers. Since he dislikes cubic numbers, he wants to ensure that if both s_i and s_j (i ≠ j) are circled, the product s_is_j is not cubic. For example, when s_1=1,s_2=1,s_3=2,s_4=4, it is not possible to circle both s_1 and s_2 at the same time. It is not possible to circle both s_3 and s_4 at the same time, either.\n\nFind the maximum number of integers that Snuke can circle.\n\nConstraints\n\n1 ≦ N ≦ 10^5\n\n1 ≦ s_i ≦ 10^{10}\n\nAll input values are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\ns_1\n:\ns_N\n\nOutput\n\nPrint the maximum number of integers that Snuke can circle.\n\nSample Input 1\n\n8\n1\n2\n3\n4\n5\n6\n7\n8\n\nSample Output 1\n\n6\n\nSnuke can circle 1,2,3,5,6,7.\n\nSample Input 2\n\n6\n2\n4\n8\n16\n32\n64\n\nSample Output 2\n\n3\n\nSample Input 3\n\n10\n1\n10\n100\n1000000007\n10000000000\n1000000009\n999999999\n999\n999\n999\n\nSample Output 3\n\n9", "sample_input": "8\n1\n2\n3\n4\n5\n6\n7\n8\n"}, "reference_outputs": ["6\n"], "source_document_id": "p04022", "source_text": "Score : 1100 points\n\nProblem Statement\n\nSnuke got positive integers s_1,...,s_N from his mother, as a birthday present. There may be duplicate elements.\n\nHe will circle some of these N integers. Since he dislikes cubic numbers, he wants to ensure that if both s_i and s_j (i ≠ j) are circled, the product s_is_j is not cubic. For example, when s_1=1,s_2=1,s_3=2,s_4=4, it is not possible to circle both s_1 and s_2 at the same time. It is not possible to circle both s_3 and s_4 at the same time, either.\n\nFind the maximum number of integers that Snuke can circle.\n\nConstraints\n\n1 ≦ N ≦ 10^5\n\n1 ≦ s_i ≦ 10^{10}\n\nAll input values are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\ns_1\n:\ns_N\n\nOutput\n\nPrint the maximum number of integers that Snuke can circle.\n\nSample Input 1\n\n8\n1\n2\n3\n4\n5\n6\n7\n8\n\nSample Output 1\n\n6\n\nSnuke can circle 1,2,3,5,6,7.\n\nSample Input 2\n\n6\n2\n4\n8\n16\n32\n64\n\nSample Output 2\n\n3\n\nSample Input 3\n\n10\n1\n10\n100\n1000000007\n10000000000\n1000000009\n999999999\n999\n999\n999\n\nSample Output 3\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2857, "cpu_time_ms": 4921, "memory_kb": 180092}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s609139246", "group_id": "codeNet:p04025", "input_text": "n = int(input())\n\nli = list(map(int,input().split()))\n\nans = 10**10\n\n\nfor i in range(-100,101):\n temp = 0\n for x in li:\n temp += (x - i) ** 2\n if ans > temp:\n ans = temp\n \nprint(ans)", "language": "Python", "metadata": {"date": 1564958486, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p04025.html", "problem_id": "p04025", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p04025/input.txt", "sample_output_relpath": "derived/input_output/data/p04025/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04025/Python/s609139246.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s609139246", "user_id": "u346395915"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "n = int(input())\n\nli = list(map(int,input().split()))\n\nans = 10**10\n\n\nfor i in range(-100,101):\n temp = 0\n for x in li:\n temp += (x - i) ** 2\n if ans > temp:\n ans = temp\n \nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nEvi has N integers a_1,a_2,..,a_N. His objective is to have N equal integers by transforming some of them.\n\nHe may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (See Sample 2).\n\nFind the minimum total cost to achieve his objective.\n\nConstraints\n\n1≦N≦100\n\n-100≦a_i≦100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum total cost to achieve Evi's objective.\n\nSample Input 1\n\n2\n4 8\n\nSample Output 1\n\n8\n\nTransforming the both into 6s will cost (4-6)^2+(8-6)^2=8 dollars, which is the minimum.\n\nSample Input 2\n\n3\n1 1 3\n\nSample Output 2\n\n3\n\nTransforming the all into 2s will cost (1-2)^2+(1-2)^2+(3-2)^2=3 dollars. Note that Evi has to pay (1-2)^2 dollar separately for transforming each of the two 1s.\n\nSample Input 3\n\n3\n4 2 5\n\nSample Output 3\n\n5\n\nLeaving the 4 as it is and transforming the 2 and the 5 into 4s will achieve the total cost of (2-4)^2+(5-4)^2=5 dollars, which is the minimum.\n\nSample Input 4\n\n4\n-100 -100 -100 -100\n\nSample Output 4\n\n0\n\nWithout transforming anything, Evi's objective is already achieved. Thus, the necessary cost is 0.", "sample_input": "2\n4 8\n"}, "reference_outputs": ["8\n"], "source_document_id": "p04025", "source_text": "Score : 200 points\n\nProblem Statement\n\nEvi has N integers a_1,a_2,..,a_N. His objective is to have N equal integers by transforming some of them.\n\nHe may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (See Sample 2).\n\nFind the minimum total cost to achieve his objective.\n\nConstraints\n\n1≦N≦100\n\n-100≦a_i≦100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum total cost to achieve Evi's objective.\n\nSample Input 1\n\n2\n4 8\n\nSample Output 1\n\n8\n\nTransforming the both into 6s will cost (4-6)^2+(8-6)^2=8 dollars, which is the minimum.\n\nSample Input 2\n\n3\n1 1 3\n\nSample Output 2\n\n3\n\nTransforming the all into 2s will cost (1-2)^2+(1-2)^2+(3-2)^2=3 dollars. Note that Evi has to pay (1-2)^2 dollar separately for transforming each of the two 1s.\n\nSample Input 3\n\n3\n4 2 5\n\nSample Output 3\n\n5\n\nLeaving the 4 as it is and transforming the 2 and the 5 into 4s will achieve the total cost of (2-4)^2+(5-4)^2=5 dollars, which is the minimum.\n\nSample Input 4\n\n4\n-100 -100 -100 -100\n\nSample Output 4\n\n0\n\nWithout transforming anything, Evi's objective is already achieved. Thus, the necessary cost is 0.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 212, "cpu_time_ms": 24, "memory_kb": 3316}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s367251615", "group_id": "codeNet:p04034", "input_text": "#!/usr/bin/env python3\nimport sys\nsys.setrecursionlimit(10000000)\nINF = 1<<32\n\n\ndef solve(N: int, M: int, x: \"List[int]\", y: \"List[int]\"):\n c = [1] * (N+1)\n p = [False] * (N+1)\n p[1] = True\n\n for i in range(M):\n if p[x[i]] is True:\n p[y[i]] = True\n c[y[i]] += 1\n c[x[i]] -= 1\n \n if c[x[i]] == 0:\n p[x[i]] = False\n\n print([i for i in p if i is True].count(True))\n return\n\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n M = int(next(tokens)) # type: int\n x = [int()] * (M) # type: \"List[int]\"\n y = [int()] * (M) # type: \"List[int]\"\n for i in range(M):\n x[i] = int(next(tokens))\n y[i] = int(next(tokens))\n solve(N, M, x, y)\n\nif __name__ == '__main__':\n main()\n", "language": "Python", "metadata": {"date": 1581646445, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p04034.html", "problem_id": "p04034", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p04034/input.txt", "sample_output_relpath": "derived/input_output/data/p04034/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04034/Python/s367251615.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s367251615", "user_id": "u386819480"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "#!/usr/bin/env python3\nimport sys\nsys.setrecursionlimit(10000000)\nINF = 1<<32\n\n\ndef solve(N: int, M: int, x: \"List[int]\", y: \"List[int]\"):\n c = [1] * (N+1)\n p = [False] * (N+1)\n p[1] = True\n\n for i in range(M):\n if p[x[i]] is True:\n p[y[i]] = True\n c[y[i]] += 1\n c[x[i]] -= 1\n \n if c[x[i]] == 0:\n p[x[i]] = False\n\n print([i for i in p if i is True].count(True))\n return\n\n\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n M = int(next(tokens)) # type: int\n x = [int()] * (M) # type: \"List[int]\"\n y = [int()] * (M) # type: \"List[int]\"\n for i in range(M):\n x[i] = int(next(tokens))\n y[i] = int(next(tokens))\n solve(N, M, x, y)\n\nif __name__ == '__main__':\n main()\n", "problem_context": "Problem Statement\n\nWe have N boxes, numbered 1 through N. At first, box 1 contains one red ball, and each of the other boxes contains one white ball.\n\nSnuke will perform the following M operations, one by one. In the i-th operation, he randomly picks one ball from box x_i, then he puts it into box y_i.\n\nFind the number of boxes that may contain the red ball after all operations are performed.\n\nConstraints\n\n2≤N≤10^5\n\n1≤M≤10^5\n\n1≤x_i,y_i≤N\n\nx_i≠y_i\n\nJust before the i-th operation is performed, box x_i contains at least 1 ball.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\nx_1 y_1\n:\nx_M y_M\n\nOutput\n\nPrint the number of boxes that may contain the red ball after all operations are performed.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\n2\n\nJust after the first operation, box 1 is empty, box 2 contains one red ball and one white ball, and box 3 contains one white ball.\n\nNow, consider the second operation. If Snuke picks the red ball from box 2, the red ball will go into box 3. If he picks the white ball instead, the red ball will stay in box 2.\nThus, the number of boxes that may contain the red ball after all operations, is 2.\n\nSample Input 2\n\n3 3\n1 2\n2 3\n2 3\n\nSample Output 2\n\n1\n\nAll balls will go into box 3.\n\nSample Input 3\n\n4 4\n1 2\n2 3\n4 1\n3 4\n\nSample Output 3\n\n3", "sample_input": "3 2\n1 2\n2 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p04034", "source_text": "Problem Statement\n\nWe have N boxes, numbered 1 through N. At first, box 1 contains one red ball, and each of the other boxes contains one white ball.\n\nSnuke will perform the following M operations, one by one. In the i-th operation, he randomly picks one ball from box x_i, then he puts it into box y_i.\n\nFind the number of boxes that may contain the red ball after all operations are performed.\n\nConstraints\n\n2≤N≤10^5\n\n1≤M≤10^5\n\n1≤x_i,y_i≤N\n\nx_i≠y_i\n\nJust before the i-th operation is performed, box x_i contains at least 1 ball.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\nx_1 y_1\n:\nx_M y_M\n\nOutput\n\nPrint the number of boxes that may contain the red ball after all operations are performed.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\n2\n\nJust after the first operation, box 1 is empty, box 2 contains one red ball and one white ball, and box 3 contains one white ball.\n\nNow, consider the second operation. If Snuke picks the red ball from box 2, the red ball will go into box 3. If he picks the white ball instead, the red ball will stay in box 2.\nThus, the number of boxes that may contain the red ball after all operations, is 2.\n\nSample Input 2\n\n3 3\n1 2\n2 3\n2 3\n\nSample Output 2\n\n1\n\nAll balls will go into box 3.\n\nSample Input 3\n\n4 4\n1 2\n2 3\n4 1\n3 4\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 934, "cpu_time_ms": 151, "memory_kb": 13336}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s741108276", "group_id": "codeNet:p04041", "input_text": "# -*- coding: utf-8 -*-\n\nimport sys\n\ndef input(): return sys.stdin.readline().strip()\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\ndef list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]\ndef ceil(x, y=1): return int(-(-x // y))\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]\ndef Yes(): print('Yes')\ndef No(): print('No')\ndef YES(): print('YES')\ndef NO(): print('NO')\nsys.setrecursionlimit(10 ** 9)\nINF = 10 ** 18\nMOD = 10 ** 9 + 7\n\nN, X, Y, Z = MAP()\nM = X + Y + Z\n\n# XYZとの一致をチェックするビット列\ncheck = 1<<(X+Y+Z-1) | 1<<(Y+Z-1) | 1<<(Z-1)\ndp = list2d(N+1, 1<<(M-1), 0)\n# dp[i][S] := i個目まで見て、前の値M-1以下までの集合がSの時の、XYZを含まないものの通り数\ndp[0][0] = 1\nmsk1 = (1<= 10:\n purchase += forgive(1) * (10 ** dig)\n\nprint(purchase)\n", "language": "Python", "metadata": {"date": 1589152694, "filename_ext": "py", "original_language": "Python (3.4.3)", "problem_description_relpath": "problem_descriptions/p04045.html", "problem_id": "p04045", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p04045/input.txt", "sample_output_relpath": "derived/input_output/data/p04045/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04045/Python/s747219788.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s747219788", "user_id": "u517630860"}, "prompt_components": {"gold_output": "2000\n", "input_to_evaluate": "# -*- coding: utf-8 -*-\ndef forgive(num):\n for i in range(10):\n if ((num + i) % 10) in unforgiven:\n continue\n else:\n return num + i\n\n\nN, K = map(int, input().split())\nunforgiven = list(map(int, input().split()))\nunforgiven.sort()\n\nprice = [int(x) for x in str(N)]\npurchase = 0\ndig = 0\nforgiven = 0\nfor num in reversed(price):\n forgiven = forgive(num + forgiven // 10)\n purchase += (forgiven % 10) * (10 ** dig)\n dig += 1\nelse:\n if forgiven >= 10:\n purchase += forgive(1) * (10 ** dig)\n\nprint(purchase)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K.\n\nShe is shopping, and now paying at the cashier.\nHer total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change).\n\nHowever, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.\n\nFind the amount of money that she will hand to the cashier.\n\nConstraints\n\n1 ≦ N < 10000\n\n1 ≦ K < 10\n\n0 ≦ D_1 < D_2 < … < D_K≦9\n\n\\{D_1,D_2,...,D_K\\} ≠ \\{1,2,3,4,5,6,7,8,9\\}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\nD_1 D_2 … D_K\n\nOutput\n\nPrint the amount of money that Iroha will hand to the cashier.\n\nSample Input 1\n\n1000 8\n1 3 4 5 6 7 8 9\n\nSample Output 1\n\n2000\n\nShe dislikes all digits except 0 and 2.\n\nThe smallest integer equal to or greater than N=1000 whose decimal notation contains only 0 and 2, is 2000.\n\nSample Input 2\n\n9999 1\n0\n\nSample Output 2\n\n9999", "sample_input": "1000 8\n1 3 4 5 6 7 8 9\n"}, "reference_outputs": ["2000\n"], "source_document_id": "p04045", "source_text": "Score : 300 points\n\nProblem Statement\n\nIroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K.\n\nShe is shopping, and now paying at the cashier.\nHer total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change).\n\nHowever, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.\n\nFind the amount of money that she will hand to the cashier.\n\nConstraints\n\n1 ≦ N < 10000\n\n1 ≦ K < 10\n\n0 ≦ D_1 < D_2 < … < D_K≦9\n\n\\{D_1,D_2,...,D_K\\} ≠ \\{1,2,3,4,5,6,7,8,9\\}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\nD_1 D_2 … D_K\n\nOutput\n\nPrint the amount of money that Iroha will hand to the cashier.\n\nSample Input 1\n\n1000 8\n1 3 4 5 6 7 8 9\n\nSample Output 1\n\n2000\n\nShe dislikes all digits except 0 and 2.\n\nThe smallest integer equal to or greater than N=1000 whose decimal notation contains only 0 and 2, is 2000.\n\nSample Input 2\n\n9999 1\n0\n\nSample Output 2\n\n9999", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 560, "cpu_time_ms": 20, "memory_kb": 3188}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s772888529", "group_id": "codeNet:p04046", "input_text": "import os\nimport sys\n\nif os.getenv(\"LOCAL\"):\n sys.stdin = open(\"_in.txt\", \"r\")\n\nsys.setrecursionlimit(2147483647)\nINF = float(\"inf\")\nIINF = 10 ** 18\nMOD = 10 ** 9 + 7\n\nH, W, A, B = list(map(int, sys.stdin.readline().split()))\n\n\n# dp = np.ones(W, dtype=int)\n# for h in range(1, H - A):\n# dp = dp.cumsum() % MOD\n# for h in range(H - A, H):\n# dp[B:] = dp[B:].cumsum() % MOD\n# print(dp[-1])\n\n\ndef get_factorials(max, mod=None):\n \"\"\"\n 階乗 0!, 1!, 2!, ..., max!\n :param int max:\n :param int mod:\n :return:\n \"\"\"\n ret = [1]\n n = 1\n if mod:\n for i in range(1, max + 1):\n n *= i\n n %= mod\n ret.append(n)\n else:\n for i in range(1, max + 1):\n n *= i\n ret.append(n)\n return ret\n\ndef mod_inv(a, mod):\n \"\"\"\n a の逆元\n :param int a:\n :param int mod:\n :return:\n \"\"\"\n return pow(a, mod - 2, mod)\n\n\nfactorials = get_factorials(H + W, MOD)\n\n\ndef ncr(n, r, mod=None):\n \"\"\"\n scipy.misc.comb または scipy.special.comb と同じ\n 組み合わせの数 nCr\n :param int n:\n :param int r:\n :param int mod: 3 以上の素数であること\n :rtype: int\n \"\"\"\n if n < r:\n return 0\n\n return factorials[n] * mod_inv(factorials[r], mod) * mod_inv(factorials[n - r], mod) % mod\n\n\nans = 0\nfor i in range(W - B):\n ans += ncr((H - A - 1) + (W - i - 1), W - i - 1, MOD) * ncr((A - 1) + i, i, MOD)\n ans %= MOD\nprint(ans)\n", "language": "Python", "metadata": {"date": 1562208294, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p04046.html", "problem_id": "p04046", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p04046/input.txt", "sample_output_relpath": "derived/input_output/data/p04046/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04046/Python/s772888529.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s772888529", "user_id": "u389910364"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import os\nimport sys\n\nif os.getenv(\"LOCAL\"):\n sys.stdin = open(\"_in.txt\", \"r\")\n\nsys.setrecursionlimit(2147483647)\nINF = float(\"inf\")\nIINF = 10 ** 18\nMOD = 10 ** 9 + 7\n\nH, W, A, B = list(map(int, sys.stdin.readline().split()))\n\n\n# dp = np.ones(W, dtype=int)\n# for h in range(1, H - A):\n# dp = dp.cumsum() % MOD\n# for h in range(H - A, H):\n# dp[B:] = dp[B:].cumsum() % MOD\n# print(dp[-1])\n\n\ndef get_factorials(max, mod=None):\n \"\"\"\n 階乗 0!, 1!, 2!, ..., max!\n :param int max:\n :param int mod:\n :return:\n \"\"\"\n ret = [1]\n n = 1\n if mod:\n for i in range(1, max + 1):\n n *= i\n n %= mod\n ret.append(n)\n else:\n for i in range(1, max + 1):\n n *= i\n ret.append(n)\n return ret\n\ndef mod_inv(a, mod):\n \"\"\"\n a の逆元\n :param int a:\n :param int mod:\n :return:\n \"\"\"\n return pow(a, mod - 2, mod)\n\n\nfactorials = get_factorials(H + W, MOD)\n\n\ndef ncr(n, r, mod=None):\n \"\"\"\n scipy.misc.comb または scipy.special.comb と同じ\n 組み合わせの数 nCr\n :param int n:\n :param int r:\n :param int mod: 3 以上の素数であること\n :rtype: int\n \"\"\"\n if n < r:\n return 0\n\n return factorials[n] * mod_inv(factorials[r], mod) * mod_inv(factorials[n - r], mod) % mod\n\n\nans = 0\nfor i in range(W - B):\n ans += ncr((H - A - 1) + (W - i - 1), W - i - 1, MOD) * ncr((A - 1) + i, i, MOD)\n ans %= MOD\nprint(ans)\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a large square grid with H rows and W columns.\nIroha is now standing in the top-left cell.\nShe will repeat going right or down to the adjacent cell, until she reaches the bottom-right cell.\n\nHowever, she cannot enter the cells in the intersection of the bottom A rows and the leftmost B columns. (That is, there are A×B forbidden cells.) There is no restriction on entering the other cells.\n\nFind the number of ways she can travel to the bottom-right cell.\n\nSince this number can be extremely large, print the number modulo 10^9+7.\n\nConstraints\n\n1 ≦ H, W ≦ 100,000\n\n1 ≦ A < H\n\n1 ≦ B < W\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W A B\n\nOutput\n\nPrint the number of ways she can travel to the bottom-right cell, modulo 10^9+7.\n\nSample Input 1\n\n2 3 1 1\n\nSample Output 1\n\n2\n\nWe have a 2×3 grid, but entering the bottom-left cell is forbidden. The number of ways to travel is two: \"Right, Right, Down\" and \"Right, Down, Right\".\n\nSample Input 2\n\n10 7 3 4\n\nSample Output 2\n\n3570\n\nThere are 12 forbidden cells.\n\nSample Input 3\n\n100000 100000 99999 99999\n\nSample Output 3\n\n1\n\nSample Input 4\n\n100000 100000 44444 55555\n\nSample Output 4\n\n738162020", "sample_input": "2 3 1 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p04046", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a large square grid with H rows and W columns.\nIroha is now standing in the top-left cell.\nShe will repeat going right or down to the adjacent cell, until she reaches the bottom-right cell.\n\nHowever, she cannot enter the cells in the intersection of the bottom A rows and the leftmost B columns. (That is, there are A×B forbidden cells.) There is no restriction on entering the other cells.\n\nFind the number of ways she can travel to the bottom-right cell.\n\nSince this number can be extremely large, print the number modulo 10^9+7.\n\nConstraints\n\n1 ≦ H, W ≦ 100,000\n\n1 ≦ A < H\n\n1 ≦ B < W\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W A B\n\nOutput\n\nPrint the number of ways she can travel to the bottom-right cell, modulo 10^9+7.\n\nSample Input 1\n\n2 3 1 1\n\nSample Output 1\n\n2\n\nWe have a 2×3 grid, but entering the bottom-left cell is forbidden. The number of ways to travel is two: \"Right, Right, Down\" and \"Right, Down, Right\".\n\nSample Input 2\n\n10 7 3 4\n\nSample Output 2\n\n3570\n\nThere are 12 forbidden cells.\n\nSample Input 3\n\n100000 100000 99999 99999\n\nSample Output 3\n\n1\n\nSample Input 4\n\n100000 100000 44444 55555\n\nSample Output 4\n\n738162020", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1468, "cpu_time_ms": 544, "memory_kb": 52464}, "variant": "high_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Python:s827241805", "group_id": "codeNet:p04049", "input_text": "import sys\ndef input():\n\treturn sys.stdin.readline()[:-1]\nn, k = map(int, input().split())\nadj = [[] for _ in range(n)]\nfor _ in range(n-1):\n\ta, b = map(int, input().split())\n\tadj[a-1].append(b-1)\n\tadj[b-1].append(a-1)\n\ndef bfs(start, nxt):\n\tvis = [-1 for _ in range(n)]\n\tvis[start] = 0\n\tvis[nxt] = 1\n\ts = [nxt]\n\tcnt = 1\n\twhile s:\n\t\tl = s.pop()\n\t\tcnt += 1\n\t\tif vis[l] < k:\n\t\t\tfor c in adj[l]:\n\t\t\t\tif vis[c] < 0:\n\t\t\t\t\ts.append(c)\n\t\t\t\t\tvis[c] = vis[l] + 1\n\treturn n - cnt\n\nans = n-2\nfor i in range(n):\n\tfor j in adj[i]:\n\t\tans = min(ans, bfs(i, j))\nprint(ans)", "language": "Python", "metadata": {"date": 1557038267, "filename_ext": "py", "original_language": "PyPy3 (2.4.0)", "problem_description_relpath": "problem_descriptions/p04049.html", "problem_id": "p04049", "resource_group": "high_resource", "sample_input_relpath": "derived/input_output/data/p04049/input.txt", "sample_output_relpath": "derived/input_output/data/p04049/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04049/Python/s827241805.py", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s827241805", "user_id": "u218843509"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import sys\ndef input():\n\treturn sys.stdin.readline()[:-1]\nn, k = map(int, input().split())\nadj = [[] for _ in range(n)]\nfor _ in range(n-1):\n\ta, b = map(int, input().split())\n\tadj[a-1].append(b-1)\n\tadj[b-1].append(a-1)\n\ndef bfs(start, nxt):\n\tvis = [-1 for _ in range(n)]\n\tvis[start] = 0\n\tvis[nxt] = 1\n\ts = [nxt]\n\tcnt = 1\n\twhile s:\n\t\tl = s.pop()\n\t\tcnt += 1\n\t\tif vis[l] < k:\n\t\t\tfor c in adj[l]:\n\t\t\t\tif vis[c] < 0:\n\t\t\t\t\ts.append(c)\n\t\t\t\t\tvis[c] = vis[l] + 1\n\treturn n - cnt\n\nans = n-2\nfor i in range(n):\n\tfor j in adj[i]:\n\t\tans = min(ans, bfs(i, j))\nprint(ans)", "problem_context": "Score : 600 points\n\nProblem Statement\n\nGiven an undirected tree, let the distance between vertices u and v be the\nnumber of edges on the simple path from u to v.\nThe diameter of a tree is the maximum among the distances between any two vertices.\nWe will call a tree good if and only if its diameter is at most K.\n\nYou are given an undirected tree with N vertices numbered 1 through N.\nFor each i (1≦i≦N-1), there is an edge connecting vertices A_i and B_i.\n\nYou want to remove zero or more vertices from the tree, so that the resulting tree is good.\nWhen a vertex is removed, all incident edges will also be removed.\nThe resulting graph must be connected.\n\nFind the minimum number of vertices that you need to remove in order to produce a good tree.\n\nConstraints\n\n2≦N≦2000\n\n1≦K≦N-1\n\n1≦A_i≦N, 1≦B_i≦N\n\nThe graph defined by A_i and B_i is a tree.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\nA_1 B_1\nA_2 B_2\n:\nA_{N-1} B_{N-1}\n\nOutput\n\nPrint the minimum number of vertices that you need to remove in order to produce a good tree.\n\nSample Input 1\n\n6 2\n1 2\n3 2\n4 2\n1 6\n5 6\n\nSample Output 1\n\n2\n\nThe tree is shown below. Removing vertices 5 and 6 will result in a good tree with the diameter of 2.\n\nSample Input 2\n\n6 5\n1 2\n3 2\n4 2\n1 6\n5 6\n\nSample Output 2\n\n0\n\nSince the given tree is already good, you do not need to remove any vertex.", "sample_input": "6 2\n1 2\n3 2\n4 2\n1 6\n5 6\n"}, "reference_outputs": ["2\n"], "source_document_id": "p04049", "source_text": "Score : 600 points\n\nProblem Statement\n\nGiven an undirected tree, let the distance between vertices u and v be the\nnumber of edges on the simple path from u to v.\nThe diameter of a tree is the maximum among the distances between any two vertices.\nWe will call a tree good if and only if its diameter is at most K.\n\nYou are given an undirected tree with N vertices numbered 1 through N.\nFor each i (1≦i≦N-1), there is an edge connecting vertices A_i and B_i.\n\nYou want to remove zero or more vertices from the tree, so that the resulting tree is good.\nWhen a vertex is removed, all incident edges will also be removed.\nThe resulting graph must be connected.\n\nFind the minimum number of vertices that you need to remove in order to produce a good tree.\n\nConstraints\n\n2≦N≦2000\n\n1≦K≦N-1\n\n1≦A_i≦N, 1≦B_i≦N\n\nThe graph defined by A_i and B_i is a tree.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\nA_1 B_1\nA_2 B_2\n:\nA_{N-1} B_{N-1}\n\nOutput\n\nPrint the minimum number of vertices that you need to remove in order to produce a good tree.\n\nSample Input 1\n\n6 2\n1 2\n3 2\n4 2\n1 6\n5 6\n\nSample Output 1\n\n2\n\nThe tree is shown below. Removing vertices 5 and 6 will result in a good tree with the diameter of 2.\n\nSample Input 2\n\n6 5\n1 2\n3 2\n4 2\n1 6\n5 6\n\nSample Output 2\n\n0\n\nSince the given tree is already good, you do not need to remove any vertex.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 556, "cpu_time_ms": 545, "memory_kb": 47324}, "variant": "high_resource"}