messages
listlengths
1
1
ground_truth
stringlengths
156
726k
dataset
stringclasses
2 values
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA valid parentheses sequence is a non-empty string where each character is either '(' or ')', which satisfies...
[{"input": "1\n((((((((((", "output": "(((((((((())))))))))\n"}, {"input": "1\n((((((((()", "output": "((((((((()))))))))\n"}, {"input": "1\n(((((((())", "output": "(((((((())))))))\n"}, {"input": "1\n(((()(((((", "output": "(((((((())))))))\n"}, {"input": "1\n((((((()))", "output": "((((((()))))))\n"}, {"input": "1\n(...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIf the girl doesn't go to Denis, then Denis will go to the girl. Using this rule, the young man left home, bo...
[{"input": "30 8\n0 1 7 10 23 24 26 30\n40 13\n", "output": "30\n"}, {"input": "30 8\n0 1 7 10 23 24 26 30\n40 7\n", "output": "30\n"}, {"input": "30 8\n0 1 7 12 23 24 26 30\n40 7\n", "output": "30\n"}, {"input": "30 8\n0 2 7 10 23 24 26 30\n40 7\n", "output": "30\n"}, {"input": "30 8\n0 2 7 10 23 24 26 30\n44 7\n", "o...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSnuke has an integer sequence A of length N.\nHe will make three cuts in A and divide it into four (non-empty...
[{"input": "5574\n150872158 2 6 1 3 8 10 4 9 3 5 2 10 2 8 4 2 3 10 8 4 3 1 8 3 5 8 3 7 3 10 7 4 6 1 1 8 10 1 1 10 9 7 9 1 3 7 7 8 6 7 8 6 10 5 2 1 2 2 2 6 10 3 6 6 2 8 1 9 3 6 8 10 10 5 1 8 4 5 1 6 2 7 7 5 3 6 10 6 9 2 9 9 10 1 10 9 10 5 3 10 8 6 10 2 3 1 7 2 7 2 5 8 7 10 3 10 4 1 2 2 1 2 9 2 3 1 4 5 5 5 5 7 2 7 7 6 5 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA sequence of $n$ numbers is called a permutation if it contains all integers from $1$ to $n$ exactly once. F...
[{"input": "1\n50 870\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50\n", "output": "YES\n"}, {"input": "5\n3 13\n3 1 4\n1 1\n1\n3 3\n1 4 2\n2 1\n4 3\n5 6\n1 2 3 4 5\n", "output": "YES\nNO\nYES\nNO\nYES\n"}, {"input": "2\n1 9\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere is a triangle formed by three points $(x_1, y_1)$, $(x_2, y_2)$, $(x_3, y_3)$ on a plain.\n\nWrite a pr...
[{"input": "2.5236948660396488 1.2449675008007697 3.467160130839816 2.2489154237675044 4.3267713977209254 3.696599910445261 2.778529750649784 0.5428461273225557\n0.3648696681668867 1.6775294144371997 2.646749575901687 5.368903351235283 5.958977255484857 4.673632823800934 -0.048505034276450476 4.940590828500139", "outpu...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n# Task\n You're given a two-dimensional array of integers `matrix`. Your task is to determine the smallest no...
[{"input": "[[4, 5, 3, -4, 3, 8], [2, 0, 6, 5, 4, 9], [7, 5, 6, 8, 2, 6], [1, 4, 7, 8, 9, 11], [1, 3, 10, 5, 5, 1], [12, 7, 3, 4, 4, 3]]", "output": "[13]", "fn_name": "smallest_integer"}, {"input": "[[4, 5, 3, 21, 3, 8], [2, 2, 6, 5, 10, 9], [7, 5, 6, 8, 2, 6], [1, 4, 7, 8, 9, 0], [1, 3, 6, 5, 5, 1], [2, 7, 3, 4, 4, 3...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).\n\nWe will collect ...
[{"input": "3\n-2 -1\n10 16\n10 4", "output": "2\n"}, {"input": "4\n1 1\n1 4\n2 1\n2 2", "output": "3\n"}, {"input": "3\n-2 -1\n5 16\n10 4", "output": "2\n"}, {"input": "3\n-4 7\n9 34\n24 -1", "output": "2\n"}, {"input": "3\n0 7\n10 33\n24 -1", "output": "2\n"}, {"input": "3\n-1 7\n9 34\n24 -1", "output": "2\n"}, {"inp...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given N integers; the i-th of them is A_i. Find the maximum possible sum of the absolute differences ...
[{"input": "5\n52\n-1\n-2\n-2\n-1", "output": "110\n"}, {"input": "5\n89\n-1\n-2\n-2\n-1", "output": "184\n"}, {"input": "5\n46\n-1\n-4\n-2\n-1", "output": "102\n"}, {"input": "5\n115\n-1\n0\n-2\n-1", "output": "236\n"}, {"input": "5\n115\n-1\n0\n-2\n-2", "output": "237\n"}, {"input": "5\n115\n-2\n0\n-1\n-3", "output":...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTriangular number is the amount of points that can fill equilateral triangle. \n\nExample: the number 6 is a ...
[{"input": "14", "output": "[false]", "fn_name": "is_triangular"}, {"input": "27", "output": "[false]", "fn_name": "is_triangular"}, {"input": "10", "output": "[true]", "fn_name": "is_triangular"}, {"input": "15", "output": "[true]", "fn_name": "is_triangular"}, {"input": "21", "output": "[true]", "fn_name": "is_triang...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSherlock has a new girlfriend (so unlike him!). Valentine's day is coming and he wants to gift her some jewel...
[{"input": "49711\n", "output": "2\n1 1 2 1 2 1 2 2 2 1 2 1 2 2 2 1 2 1 2 2 2 1 2 2 2 2 2 1 2 1 2 2 2 2 2 1 2 2 2 1 2 1 2 2 2 1 2 2 2 2 2 1 2 2 2 2 2 1 2 1 2 2 2 2 2 1 2 2 2 1 2 1 2 2 2 2 2 1 2 2 2 1 2 2 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 1 2 1 2 2 2 1 2 1 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 2 2 1 2 1 2 2 2 2 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nBob wants to put a new bargaining table in his office. To do so he measured the office room thoroughly and dr...
[{"input": "20 20\n00000000000000000000\n00000000000000000000\n00000000000000000000\n00000100000000000000\n00000000000000000000\n00000000000000000000\n00000000000000000000\n00000000000000000000\n00000000000000000000\n00000000000000000000\n00000000000000000000\n00000000000000000000\n00000000000000000000\n000000000000000...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are two standard ways to represent a graph $G = (V, E)$, where $V$ is a set of vertices and $E$ is a se...
[{"input": "4\n1 1 0 4\n2 1 1\n-1 -1\n4 1 2", "output": "0 0 0 1\n1 0 0 0\n0 0 0 0\n0 1 0 0\n"}, {"input": "4\n1 2 2 4\n2 1 4\n3 -1\n4 1 3", "output": "0 1 0 1\n0 0 0 1\n0 0 0 0\n0 0 1 0\n"}, {"input": "4\n1 2 1 4\n2 1 4\n1 -1\n4 1 3", "output": "1 0 0 1\n0 0 0 1\n0 0 0 0\n0 0 1 0\n"}, {"input": "4\n1 2 2 4\n2 1 4\n3 -...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nGiven are integers A, B, and N.\nFind the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-ne...
[{"input": "1000000 1000000000000 1000000000000\n", "output": "999999\n"}, {"input": "1000000 948240928204 329810943092\n", "output": "347813\n"}, {"input": "133333 329230329032 493028310923\n", "output": "133332\n"}, {"input": "998999 1 998998998323\n", "output": "0\n"}, {"input": "39209 9404 9402\n", "output": "39200...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nEverybody seems to think that the Martians are green, but it turns out they are metallic pink and fat. Ajs ha...
[{"input": "36 81\n4 5 7 8 13 14 16 17 22 23 25 26 31 32 34 35 40 41 43 44 49 50 52 53 58 59 61 62 67 68 70 71 76 77 79 80\n", "output": "9\n3 12 21 30 39 48 57 66 75\n"}, {"input": "36 156\n8 1 8 9 26 14 13 33 22 32 24 70 31 32 34 35 40 41 52 44 49 50 36 53 46 56 61 62 98 132 70 71 76 132 79 80\n", "output": "0\n"}, {...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLeha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Gr...
[{"input": "10 10\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n6 7\n8 3\n6 2\n4 2\n9 2\n5 10\n9 8\n10 7\n5 1\n6 2\n", "output": "0\n\n"}, {"input": "10 10\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n6 7\n8 3\n6 4\n4 4\n9 2\n5 10\n9 8\n10 7\n5 1\n6 2\n", "output": "0\n\n"}, {"input": "10 10\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n6 7\n8 3\n6 2\n4 2\n9 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nProfessor Pathfinder is a distinguished authority on the structure of hyperlinks in the World Wide Web. For e...
[{"input": "5 6\n/home/ACM/index.html\nlmth.xedni/CPCI/\n/ICPC/general.html\n/ICPC/japanese/index.html\n/ICPC/secret/confidential/2005/index.html\n/home/ACM/\n/ho/e/ICPC/..mACM/\n/ICPC/secret/\n/ICPC/secret/index.html\n/ICPC\n/ICPC/../ICPC/index.html\n/ICPC\n/ICPC/general.html\n/ICPC/japanese/.././\n/ICPC/japandse/./.....
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nFrom Wikipedia : \"The n-back task is a continuous performance task that is commonly used as an assessment in...
[{"input": "1\n[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nUtkarsh is forced to play yet another one of Ashish's games. The game progresses turn by turn and as usual, A...
[{"input": "5\n16 1\n3 2\n9 1\n65 19\n14195 55\n", "output": "Utkarsh\nUtkarsh\nUtkarsh\nUtkarsh\nUtkarsh\n"}, {"input": "5\n10 1\n3 2\n9 1\n65 19\n14195 55\n", "output": "Utkarsh\nUtkarsh\nUtkarsh\nUtkarsh\nUtkarsh\n"}, {"input": "5\n16 1\n4 2\n9 1\n34 20\n14195 91\n", "output": "Utkarsh\nUtkarsh\nUtkarsh\nUtkarsh\nUt...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSnuke loves constructing integer sequences.\nThere are N piles of stones, numbered 1 through N.\nThe pile num...
[{"input": "10\n1 3 2 6 2 4 4 5 8 1", "output": "10\n14\n0\n10\n0\n0\n0\n0\n2\n0\n"}, {"input": "10\n1 3 1 6 3 4 6 6 4 1", "output": "10\n14\n0\n11\n0\n0\n0\n0\n0\n0\n"}, {"input": "10\n1 4 0 1 1 4 4 0 22 1", "output": "8\n12\n0\n0\n0\n0\n0\n0\n18\n0\n"}, {"input": "10\n2 3 0 0 2 4 4 0 35 1", "output": "13\n4\n0\n0\n0\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are two persons, numbered 0 and 1, and a variable x whose initial value is 0. The two persons now play ...
[{"input": "3\n2\n0 0\n14\n0\n1 0\n16\n6\n2 6 3 11 14 7\n011000", "output": "0\n0\n0\n"}, {"input": "3\n2\n1 2\n14\n0\n0 0\n16\n6\n2 6 3 12 14 7\n011000", "output": "1\n0\n0\n"}, {"input": "3\n2\n1 2\n14\n0\n1 0\n16\n6\n2 6 3 12 14 7\n011000", "output": "1\n0\n0\n"}, {"input": "3\n2\n1 2\n14\n0\n1 0\n16\n6\n2 6 3 11 14...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nFor given three integers $a, b, c$, print the minimum value and the maximum value.\n\nConstraints\n\n* $-1,00...
[{"input": "-30 -1 -1", "output": "-30 -1\n"}, {"input": "-22 -1 -1", "output": "-22 -1\n"}, {"input": "-22 -2 -2", "output": "-22 -2\n"}, {"input": "-2 10 -1", "output": "-2 10\n"}, {"input": "-2 28 -1", "output": "-2 28\n"}, {"input": "10 -4 -1", "output": "-4 10\n"}, {"input": "12 -5 -1", "output": "-5 12\n"}, {"inp...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAnia has a large integer S. Its decimal representation has length n and doesn't contain any leading zeroes. A...
[{"input": "400 224\n34034718296316650556302576767095880542740697596682657060609028712014739414658241556774411582749368771597248873201583574900424227251655547840887764275893533353440635216728376201808545879398359535670372855472971530695051695650262058940466340529417646357776899296790403916961389072619545914097176242329...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nDetermine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by ...
[{"input": "135 27", "output": "YES\n"}, {"input": "135 47", "output": "YES\n"}, {"input": "149 47", "output": "YES\n"}, {"input": "149 50", "output": "YES\n"}, {"input": "151 50", "output": "YES\n"}, {"input": "151 14", "output": "YES\n"}, {"input": "178 14", "output": "YES\n"}, {"input": "178 24", "output": "YES\n"},...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere is an array with n elements a_1, a_2, ..., a_{n} and the number x.\n\nIn one operation you can select s...
[{"input": "5 119899\n60825 99853 69251 68402 1266\n", "output": "-1\n"}, {"input": "5 65537\n60825 99853 69251 68402 1266\n", "output": "2\n"}, {"input": "5 65537\n60825 99853 69251 68402 1266\n", "output": "2\n"}, {"input": "5 132\n10060 81912 13624 40413 19012\n", "output": "2\n"}, {"input": "5 132\n10060 81912 1362...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe Chef has prepared the appetizers in the shapes of letters to spell a special message for the guests. Ther...
[{"input": "2\n2 chef\n4 eipelpparuoyojne", "output": "cehf\nerlopopniupjeyae\n"}, {"input": "2\n2 chef\n4 enjoyourappmepie", "output": "cehf\neayejpuinpopomre\n"}, {"input": "2\n2 cief\n4 enjoyourappmepie", "output": "ceif\neayejpuinpopomre\n"}, {"input": "2\n2 cgef\n4 enjoyourapplepie", "output": "cegf\neayejpuinpopo...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i...
[{"input": "6 5\n8 6 9 1 2 1\n1 3\n4 2\n4 3\n4 6\n4 6\n", "output": "3\n"}, {"input": "6 5\n8 6 18 1 4 1\n1 3\n4 0\n4 0\n4 6\n4 6", "output": "3\n"}, {"input": "6 5\n8 6 18 1 4 0\n1 3\n4 0\n4 0\n4 6\n4 6", "output": "4\n"}, {"input": "6 5\n13 6 9 1 2 1\n1 3\n1 1\n4 0\n3 3\n4 6", "output": "2\n"}, {"input": "6 5\n8 6 9 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nRead problems statements in Mandarin Chinese and Russian. \nAll bandits are afraid of Sheriff. Sheriff const...
[{"input": "2\n2\n1 2 3\n5\n2 3 1 5 4", "output": "1\n6\n"}, {"input": "2\n3\n1 2 3\n5\n4 3 1 5 2", "output": "1\n5\n"}, {"input": "2\n3\n2 1 3\n5\n4 3 1 5 2", "output": "2\n5\n"}, {"input": "2\n2\n1 2 3\n5\n4 3 1 5 2", "output": "1\n5\n"}, {"input": "2\n1\n1 2 3\n5\n2 3 1 5 4", "output": "1\n6\n"}, {"input": "2\n1\n1 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nRecently you have bought a snow walking robot and brought it home. Suppose your home is a cell $(0, 0)$ on an...
[{"input": "6\nLRU\nDURLDRUDRULRDURDDL\nLRUDDLRUDRUL\nLLLLRRRR\nURDUR\nLLL\n", "output": "2\nLR\n14\nLLLUUUURRRDDDD\n12\nLLLUUURRRDDD\n2\nLR\n2\nUD\n0\n\n"}, {"input": "6\nLRU\nDURLDRUDRULRDURDDL\nLRUDDLRUDRUL\nLLLLRRRR\nURDUR\nLLL\n", "output": "2\nLR\n14\nLLLUUUURRRDDDD\n12\nLLLUUURRRDDD\n2\nLR\n2\nUD\n0\n\n"}, {"inp...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLet's imagine that you're playing the following simple computer game. The screen displays n lined-up cubes. E...
[{"input": "99 10 17\n3 2 2 9 7 10 10 10 10 6 6 6 3 7 3 3 1 2 2 2 2 2 10 10 2 2 7 7 7 7 1 8 8 8 8 10 9 10 10 10 5 5 2 2 5 5 5 1 4 9 9 2 2 3 3 2 2 9 9 9 9 9 9 9 7 4 8 8 4 8 8 10 10 4 5 9 9 10 5 5 5 5 5 8 8 8 8 2 2 2 2 1 8 8 5 10 10 2 2\n", "output": "11\n"}, {"input": "99 10 17\n3 2 2 9 7 10 10 10 10 6 6 6 3 7 3 3 7 2 2...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nBritish mathematician John Littlewood once said about Indian mathematician Srinivasa Ramanujan that \"every p...
[{"input": "1\n69\n2 4 10 16 22 28 19 40 37 52 92 43 70 76 118 88 94 100 106 112 118 124 130 200 142 148 154 160 166 324 178 184 190 196 300 208 214 129 226 167 238 244 250 209 262 322 274 280 286 462 298 304 310 316 322 328 169 110 591 352 358 364 370 376 382 388 391 397 403\n", "output": "25\n"}, {"input": "1\n69\n2 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nOur hardworking chef is bored of sleeping in his restaurants. He has decided to settle down. The first thing ...
[{"input": "3\n5\n0 0\n-1 -1\n2 0\n-1 1\n0 -2\n5\n31 11\n30 -41\n20 13\n25 28\n25 38\n2\n-1 0\n1 2", "output": "1\n1\n9\n"}, {"input": "3\n5\n-1 0\n-1 0\n1 4\n0 0\n0 -1\n5\n31 11\n52 -41\n18 1\n25 18\n25 60\n2\n-1 -1\n2 5", "output": "1\n1\n28\n"}, {"input": "3\n5\n-1 0\n-1 0\n1 4\n0 0\n0 -1\n5\n31 11\n52 -41\n18 1\n25...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThis is the hard version of the problem. The difference between the versions is that in the easy version all ...
[{"input": "2\n1000000000 1000000000\n", "output": "0\n1000000000 1000000000 "}, {"input": "2\n1000000000 1000000000\n", "output": "0\n1000000000 1000000000 "}, {"input": "10\n1 2 3 3 3 3 3 3 4 5\n", "output": "3\n3 1 3 2 3 3 4 3 5 3 "}, {"input": "10\n1 2 3 3 3 3 3 6 4 5\n", "output": "4\n3 1 3 2 4 3 5 3 6 3\n"}, {"in...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSagheer is playing a game with his best friend Soliman. He brought a tree with n nodes numbered from 1 to n a...
[{"input": "21\n6194737 6429360 6047962 1014039 9196042 2483033 9232471 5444322 4437778 6614229 4791649 7417126 7679607 790939 3062370 174847 8404336 832859 2083127 9041108 3074902\n1 2 3 4 4 6 7 2 9 10 9 12 12 1 15 1 17 1 19 19\n", "output": "0\n"}, {"input": "21\n6194737 6429360 6047962 1014039 9196042 2483033 923247...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nProblem\n\nOne day, mo3tthi and tubuann decided to play a game with magic pockets and biscuits.\nNow there ar...
[{"input": "10\n2 14\n5 17\n7 20\n12 41\n21 48\n112 112\n4 5\n7 14\n3367 8923\n1 29", "output": "mo3tthi\n"}, {"input": "10\n2 14\n5 17\n7 20\n12 41\n21 48\n112 112\n4 5\n7 14\n3367 8923\n1 36", "output": "mo3tthi\n"}, {"input": "10\n2 14\n5 9\n7 20\n12 41\n21 48\n112 112\n4 5\n7 14\n2344 8923\n1 29", "output": "mo3tth...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are N blocks, numbered 1, 2, \\ldots, N. For each i (1 \\leq i \\leq N), Block i has a weight of w_i, a...
[{"input": "5\n1 10000 1000000001\n1 10000 1000000000\n1 10000 1000000000\n1 10000 1000000000\n1 10000 1000000000", "output": "5000000001\n"}, {"input": "5\n1 11000 1000000001\n1 10100 1000000000\n1 10000 1000000000\n1 00000 1000000000\n1 00000 1000000000", "output": "4000000001\n"}, {"input": "5\n1 11000 1000000001\n1...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTo participate in a prize draw each one gives his/her firstname. \n\nEach letter of a firstname\nhas a value ...
[{"input": "\"Addison,Jayden,Sofia,Michael,Andrew,Lily,Benjamin\"\n[4, 2, 1, 4, 3, 1, 2]\n8", "output": "[\"Not enough participants\"]", "fn_name": "rank"}, {"input": "\"Addison,Jayden,Sofia,Michael,Andrew,Lily,Benjamin\"\n[4, 2, 1, 4, 3, 1, 2]\n4", "output": "[\"Benjamin\"]", "fn_name": "rank"}, {"input": "\"Avery,Oli...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Happy Holidays fellow Code Warriors!\n\nNow, Dasher! Now, Dancer! Now, Prancer, and Vixen! On, Comet! On,...
[{"input": "[\"Yasuo Kodai\", \"Kenjiro Sado\", \"Daisuke Aihara\", \"Susumu Shima\", \"Akira Sanada\", \"Yoshikazu Okita\", \"Shiro Yabu\", \"Sukeharu Nanbu\", \"Sakezo Yamamoto\", \"Hikozaemon Ohta\", \"Juzo Mori\", \"Saburo Tokugawa\"]", "output": "[[\"Daisuke Aihara\", \"Yasuo Kodai\", \"Juzo Mori\", \"Sukeharu Nan...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Background\n\nWe **all** know about \"balancing parentheses\" (plus brackets, braces and chevrons) and ev...
[{"input": "\"(Hello Mother can you hear me?)[Monkeys, in my pockets!!](Gosh!!)\"\n\"()[]\"", "output": "[true]", "fn_name": "is_balanced"}, {"input": "\"(Hello Mother can you hear me?)[Monkeys, in my pockets!!]\"\n\"()[]\"", "output": "[true]", "fn_name": "is_balanced"}, {"input": "\"Hello Mother can you hear me?)[Mon...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nCompute A + B.\n\nConstraints\n\n* -1000 ≤ A, B ≤ 1000\n\nInput\n\nThe input will consist of a series of pair...
[{"input": "1 2\n10 5\n101 20", "output": "3\n15\n121\n"}, {"input": "1 2\n10 4\n101 20", "output": "3\n14\n121\n"}, {"input": "1 2\n10 4\n101 37", "output": "3\n14\n138\n"}, {"input": "1 2\n11 4\n101 37", "output": "3\n15\n138\n"}, {"input": "1 3\n11 4\n101 37", "output": "4\n15\n138\n"}, {"input": "1 6\n11 4\n101 37"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn the city of Saint Petersburg, a day lasts for $2^{100}$ minutes. From the main station of Saint Petersburg...
[{"input": "1000010011100010111000001101000011001010011101011001101100000001011011000000101101101011101111011011\n", "output": "50\n"}, {"input": "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n", "output": "50\n"}, {"input": "10000100111000101110000011010000110010...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a rooted tree consisting of $n$ vertices numbered from $1$ to $n$. The root of the tree is a ve...
[{"input": "10 6\n1 2\n1 3\n1 4\n2 5\n2 6\n5 7\n7 8\n7 9\n9 10\n4 3 8 9 10\n3 2 4 6\n3 4 1 5\n3 4 8 2\n2 6 10\n3 5 4 7\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\n"}, {"input": "10 6\n1 2\n1 3\n1 4\n2 5\n2 6\n5 7\n7 8\n7 9\n9 10\n4 3 8 9 10\n3 2 4 6\n3 4 1 5\n3 4 8 1\n2 6 10\n3 5 4 7\n", "output": "YES\nYES\nYES\nYES\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a string $s$ consisting of $n$ lowercase Latin letters.\n\nLet's define a substring as a contig...
[{"input": "12\nparapapapaaa\n", "output": "YES\n1 2\n"}, {"input": "12\nparapapapaaa\n", "output": "YES\n1 2\n"}, {"input": "12\nparap`papaaa\n", "output": "YES\n1 2\n"}, {"input": "12\nparaq`papaaa\n", "output": "YES\n1 2\n"}, {"input": "12\noaraq`papaaa\n", "output": "YES\n1 2\n"}, {"input": "12\noaraq`papaab\n", "o...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA new set of desks just arrived, and it's about time! Things were getting quite cramped in the office. You've...
[{"input": "50\n73 1\n65 73\n16 65\n57 65\n33 16\n34 57\n98 16\n84 98\n55 34\n64 84\n80 55\n75 64\n28 75\n20 75\n42 75\n88 42\n50 20\n48 28\n32 48\n58 88\n92 76\n76 53\n53 15\n15 1\n1 10\n10 71\n71 37\n37 95\n95 63\n63 92\n45 97\n97 51\n51 96\n96 12\n12 62\n62 31\n31 5\n5 29\n29 19\n19 49\n49 6\n6 40\n40 18\n18 22\n22 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTwo positive integers a and b have a sum of s and a bitwise XOR of x. How many possible values are there for ...
[{"input": "549755813887 549755813887\n", "output": "549755813886\n"}, {"input": "549755813888 549755813886\n", "output": "274877906944\n"}, {"input": "547616456703 547599679487\n", "output": "68719476736\n"}, {"input": "274861129991 274861129463\n", "output": "34359738368\n"}, {"input": "549688705887 549688703839\n", ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are N slimes standing on a number line. The i-th slime from the left is at position x_i.\n\nIt is guaru...
[{"input": "12\n367101616 467388357 159541726 1477792495 1190847685 1723370727 668687333 270216579 135685914 125686970 1191846896 1765707086", "output": "469392584\n"}, {"input": "12\n367101616 467388357 127795962 1640220090 1190847685 1723370727 402149677 270216579 135685914 923078537 628600728 1765707086", "output": ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA binary string is a string that consists of characters $0$ and $1$.\n\nLet $\\operatorname{MEX}$ of a binary...
[{"input": "6\n01\n1111\n01100\n101\n0000\n01010\n", "output": "1\n0\n2\n1\n1\n2\n"}, {"input": "6\n01\n1111\n01100\n100\n0000\n01010\n", "output": "1\n0\n2\n1\n1\n2\n"}, {"input": "6\n01\n1011\n01100\n100\n0000\n01010\n", "output": "1\n1\n2\n1\n1\n2\n"}, {"input": "6\n01\n1001\n01100\n111\n0000\n01010\n", "output": "1...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA Bingo game is played by one gamemaster and several players. At the beginning of a game, each player is give...
[{"input": "4 3\n10 25 11 20 6 2 1 15 23\n5 21 1 12 23 17 7 26 2\n8 18 4 22 13 27 16 5 11\n19 9 24 2 11 5 14 28 16\n4 3\n12 13 20 24 28 32 15 16 17\n12 13 21 25 29 33 16 17 18\n12 13 22 26 30 34 17 18 15\n12 13 23 27 31 35 18 15 16\n4 3\n11 12 13 14 15 16 17 18 19\n21 22 23 24 25 26 27 28 29\n31 32 33 34 35 36 37 38 39...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take e...
[{"input": "50\n515844718 503470143 928669067 209884122 322869098 241621928 844696197 105586164 552680307 968792756 135928721 842094825 298782438 829020472 791637138 285482545 811025527 428952878 887796419 11883658 546401594 6272027 100292274 308219869 372132044 955814846 644008184 521195760 919389466 215065725 6877641...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which...
[{"input": "21 7\n3 6\n5 2\n......*\n.****.*\n.****.*\n....*.*\n**.**.*\n**.**.*\n**.**.*\n**.**.*\n*.**.**\n**.**.*\n**.**.*\n**.**.*\n**.**.*\n**.**.*\n**.**.*\n**.**.*\n**.**.*\n**.**.*\n**....*\n**....*\n*******\n", "output": "22\n"}, {"input": "21 7\n3 6\n5 2\n.*.....\n.****.*\n.****.*\n....*.*\n**.**.*\n**.**.*\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nFind the number of ways to choose a pair of an even number and an odd number from the positive integers betwe...
[{"input": "-2373", "output": "1407782\n"}, {"input": "-1265", "output": "400056\n"}, {"input": "-1867", "output": "871422\n"}, {"input": "-1056", "output": "278784\n"}, {"input": "-1235", "output": "381306\n"}, {"input": "-1494", "output": "558009\n"}, {"input": "-1464", "output": "535824\n"}, {"input": "-931", "outpu...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere is a robot on a checkered field that is endless in all directions. Initially, the robot is located in t...
[{"input": "4\nL\nLUUDR\nLLUU\nDDDUUUUU\n", "output": "-1 0\n-1 2\n0 0\n0 1\n"}, {"input": "4\nL\nLUUDR\nLLUU\nUUUUUDDD\n", "output": "-1 0\n-1 2\n0 0\n0 4\n"}, {"input": "4\nL\nLUUDR\nLLUU\nUDUUUDDU\n", "output": "-1 0\n-1 2\n0 0\n0 2\n"}, {"input": "4\nL\nLDUUR\nLLUU\nUUUUDDDU\n", "output": "-1 0\n-1 1\n0 0\n0 3\n"},...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are n kangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another...
[{"input": "100\n154\n60\n97\n638\n139\n150\n570\n579\n601\n647\n804\n237\n245\n549\n288\n347\n778\n282\n916\n441\n974\n145\n957\n1006\n655\n702\n930\n618\n132\n520\n972\n48\n94\n54\n682\n433\n896\n134\n845\n636\n242\n842\n125\n141\n240\n130\n409\n666\n948\n938\n604\n110\n474\n484\n364\n40\n807\n271\n438\n288\n201\n814...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nMitya has a rooted tree with n vertices indexed from 1 to n, where the root has index 1. Each vertex v initia...
[{"input": "25\n1 2 1 4 4 4 1 2 8 5 1 8 1 6 9 6 10 10 7 10 8 17 14 6\n846 -1 941 -1 1126 1691 988 -1 1352 1235 -1 -1 864 -1 -1 -1 -1 -1 -1 -1 -1 1508 1802 1713 -1\n", "output": "4346\n"}, {"input": "25\n1 2 1 4 4 4 1 2 8 5 1 8 1 6 9 6 10 10 7 10 11 17 14 6\n846 -1 676 -1 1126 1691 988 -1 1352 1235 -1 -1 864 -1 -1 -1 -1...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nJohny likes numbers n and k very much. Now Johny wants to find the smallest integer x greater than n, so it i...
[{"input": "1000000000 1000000000\n", "output": "2000000000\n"}, {"input": "1000000010 1000000000\n", "output": "2000000000\n"}, {"input": "1398941105 1000000001\n", "output": "2000000002\n"}, {"input": "1000100010 1000010000\n", "output": "2000020000\n"}, {"input": "1000100010 1100010000\n", "output": "1100010000\n"},...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTakahashi is not good at problems about trees in programming contests, and Aoki is helping him practice.\n\nF...
[{"input": "10 0\n1 1\n2 6\n11 2\n-1 4\n0 10", "output": "YES\n"}, {"input": "10 -1\n1 1\n2 6\n11 2\n-1 5\n0 5", "output": "YES\n"}, {"input": "10 -1\n1 1\n2 3\n11 2\n-1 5\n0 5", "output": "YES\n"}, {"input": "10 0\n1 1\n11 6\n5 2\n-1 4\n1 3", "output": "YES\n"}, {"input": "10 0\n1 1\n2 6\n11 2\n-1 4\n1 5", "output": "...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n()\n\nProblem Statement\n\nThere is a string S. Initially, S is an empty string.\nPerform the following proce...
[{"input": "5\n( 2\n) 0\n( 3\n) 1\n) 4", "output": "YES\n"}, {"input": "5\n( 2\n) 0\n( 1\n( 1\n) 4", "output": "YES\n"}, {"input": "5\n( -1\n) 0\n' 1\n( 1\n( 4", "output": "NO\n"}, {"input": "5\n( -1\n) 0\n' 1\n( 2\n( 4", "output": "NO\n"}, {"input": "5\n* 0\n* 0\n( 2\n* 2\n' 0", "output": "YES\n"}, {"input": "5\n) 0\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe city of Fishtopia can be imagined as a grid of 4 rows and an odd number of columns. It has two main villa...
[{"input": "100 80\n", "output": "YES\n....................................................................................................\n.########################################...........................................................\n.########################################.......................................
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe only difference between easy and hard versions is constraints.\n\nIf you write a solution in Python, then...
[{"input": "10 50\n10 10 10 10 10 10 10 10 10 10\n", "output": "0 0 0 0 0 1 2 3 4 5 \n"}, {"input": "10 50\n10 10 10 10 10 10 10 10 10 10\n", "output": "0 0 0 0 0 1 2 3 4 5 "}, {"input": "10 71\n10 10 10 10 10 10 10 10 10 10\n", "output": "0 0 0 0 0 0 0 1 2 3\n"}, {"input": "10 71\n10 10 10 10 10 10 10 10 10 14\n", "ou...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSome new animals have arrived at the zoo. The zoo keeper is concerned that perhaps the animals do not have th...
[{"input": "\"Giraffe\"\n\"d\"", "output": "[false]", "fn_name": "correct_tail"}, {"input": "\"Meerkat\"\n\"t\"", "output": "[true]", "fn_name": "correct_tail"}, {"input": "\"Badger\"\n\"s\"", "output": "[false]", "fn_name": "correct_tail"}, {"input": "\"Rhino\"\n\"o\"", "output": "[true]", "fn_name": "correct_tail"}, ...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nDima got into number sequences. Now he's got sequence a_1, a_2, ..., a_{n}, consisting of n positive integers...
[{"input": "8\n851991424 32517099 310793856 776130403 342626527 58796623 49544509 517126753\n", "output": "2\n"}, {"input": "8\n851991424 32517099 310793856 771296843 342626527 58796623 49544509 517126753\n", "output": "1\n"}, {"input": "8\n851991424 32517099 310793856 440880219 342626527 58796623 49544509 517126753\n"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe hero of our story, Valera, and his best friend Arcady are still in school, and therefore they spend all t...
[{"input": "110000000\n", "output": "165000000\n"}, {"input": "134067708\n", "output": "201101562\n"}, {"input": "111000000\n", "output": "166500000\n"}, {"input": "111000010\n", "output": "166500015\n"}, {"input": "111001010\n", "output": "166501515\n"}, {"input": "110001010\n", "output": "165001515\n"}, {"input": "10...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSnuke, a water strider, lives in a rectangular pond that can be seen as a grid with H east-west rows and W no...
[{"input": "3 10 -1\n3 3 3 4\n.....\n.@..@\n-.@..", "output": "-1\n"}, {"input": "3 10 -1\n3 4 3 4\n.....\n.@..@\n-.@..", "output": "0\n"}, {"input": "3 10 0\n3 3 3 4\n.....\n.@..@\n-.@..", "output": "-1\n"}, {"input": "5 10 0\n3 3 3 4\n.....\n.@..@\n-.@..", "output": "-1\n"}, {"input": "5 12 0\n3 3 3 4\n.....\n.@..@\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nRead problems statements in Mandarin Chinese , Russian and Vietnamese as well. \n\nChef belongs to a very ric...
[{"input": "3\n5\n13\n106", "output": "2\n4\n14\n"}, {"input": "3\n5\n13\n68", "output": "2\n4\n11\n"}, {"input": "3\n5\n1\n106", "output": "2\n1\n14\n"}, {"input": "3\n5\n1\n122", "output": "2\n1\n15\n"}, {"input": "3\n1\n17\n11", "output": "1\n5\n4\n"}, {"input": "3\n1\n11\n14", "output": "1\n4\n4\n"}, {"input": "3\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAfter the piece of a devilish mirror hit the Kay's eye, he is no longer interested in the beauty of the roses...
[{"input": "7 4\n1 1 3 3 5 3\n2\n2\n3\n5\n", "output": "2\n2\n3\n5\n"}, {"input": "7 4\n1 1 3 3 5 3\n2\n4\n3\n5\n", "output": "2\n4\n3\n5\n"}, {"input": "7 4\n1 1 3 3 5 3\n2\n3\n3\n5\n", "output": "2\n3\n3\n5\n"}, {"input": "7 4\n1 1 3 3 5 3\n2\n4\n3\n3\n", "output": "2\n4\n3\n3\n"}, {"input": "7 4\n1 1 3 3 5 6\n2\n4\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nMisha and Vanya have played several table tennis sets. Each set consists of several serves, each serve is won...
[{"input": "1 1000000000 1000000000\n", "output": "2000000000\n"}, {"input": "1000000000 1000000000 1000000000\n", "output": "2\n"}, {"input": "2 1000000000 1000000000\n", "output": "1000000000\n"}, {"input": "1000000000 999999999 999999999\n", "output": "-1\n"}, {"input": "999999999 1000000000 999999998\n", "output": ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThis problem consists of three subproblems: for solving subproblem F1 you will receive 8 points, for solving ...
[{"input": "10 4\n2\n7\n1\n9\n8\n10\n5\n10\n1\n20\n", "output": "38\n"}, {"input": "10 4\n1\n7\n1\n9\n8\n10\n5\n10\n1\n20\n", "output": "39\n"}, {"input": "10 5\n2\n13\n3\n9\n8\n7\n9\n7\n1\n18\n", "output": "36\n"}, {"input": "10 5\n2\n13\n3\n9\n8\n7\n2\n7\n1\n18\n", "output": "39\n"}, {"input": "10 2\n2\n22\n5\n9\n10\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nFor a finite set of integers X, let f(X)=\\max X - \\min X.\nGiven are N integers A_1,...,A_N.\nWe will choos...
[{"input": "10 6\n1000000000 1000000000 1000000000 1000000000 1000000000 0 0 0 0 0\n", "output": "999998537\n"}, {"input": "10 8\n1000000000 1100000000 1000001010 1000000000 1000000000 0 0 -2 0 0", "output": "600007816\n"}, {"input": "10 8\n1000000000 1100000000 1000001010 1100000000 1000000000 0 0 -2 0 0", "output": "...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSome time ago Leonid have known about idempotent functions. Idempotent function defined on a set {1, 2, ..., ...
[{"input": "142\n34 88 88 88 88 88 131 53 88 130 131 88 88 130 88 131 53 130 130 34 88 88 131 130 53 88 88 34 131 130 88 131 130 34 130 53 53 34 53 34 130 34 88 88 130 88 131 130 34 53 88 34 53 88 130 53 34 53 88 131 130 34 88 88 130 88 130 130 131 131 130 53 131 130 131 130 53 34 131 34 88 53 88 53 34 130 88 88 130 53...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nHow Many Divisors?\n\nWrite a program which reads three integers a, b and c, and prints the number of divisor...
[{"input": "4 32 120", "output": "10\n"}, {"input": "13 14 107", "output": "0\n"}, {"input": "5 14 149", "output": "0\n"}, {"input": "13 14 80", "output": "0\n"}, {"input": "5 14 241", "output": "0\n"}, {"input": "2 14 241", "output": "0\n"}, {"input": "2 14 113", "output": "0\n"}, {"input": "2 19 113", "output": "0\n"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA nested list (or *array* in JavaScript) is a list that apears as a value inside another list, \n```python\n[...
[{"input": "[1, [2, [3, [4, [5, [6], 5], 4], 3], 2], 1]", "output": "[6]", "fn_name": "list_depth"}, {"input": "[2.0, [2, 0], 3.7, [3, 7], 6.7, [6, 7]]", "output": "[2]", "fn_name": "list_depth"}, {"input": "[true, false, true, [false], true]", "output": "[2]", "fn_name": "list_depth"}, {"input": "[2, \"yes\", [true, [...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nGilbert is the network admin of Ginkgo company. His boss is mad about the messy network cables on the floor. ...
[{"input": "4\n 0 2 2 2\n 2 0 2 2\n 2 2 -1 2\n 2 2 2 0\n4\n -1 2 4 4\n 2 -1 4 4\n 4 4 -1 2\n 4 4 2 0\n2\n 0 12\n 12 0\n0", "output": "4\n2 3 3\n2 2 2 2 2 2 2 2 2 2 2\n"}, {"input": "4\n -1 2 2 2\n 2 0 2 2\n 2 2 -1 2\n 2 2 2 0\n4\n 0 2 4 4\n 2 0 4 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a directed graph consisting of n vertices and m edges (each edge is directed, so it can be trav...
[{"input": "500 50\n396 340\n47 341\n422 140\n492 209\n263 248\n461 300\n124 495\n33 6\n93 384\n389 182\n130 297\n217 329\n131 136\n355 94\n388 275\n115 368\n279 462\n126 285\n185 287\n223 221\n207 167\n203 127\n39 245\n394 444\n166 99\n399 328\n3 276\n142 325\n284 153\n65 3\n102 5\n459 168\n156 17\n99 162\n293 194\n49...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAccording to a new ISO standard, a flag of every country should have, strangely enough, a chequered field n ×...
[{"input": "1 500\nwljexjwjwsxhascgpyezfotqyieywzyzpnjzxqebroginhlpsvtbgmbckgqixkdveraxlgleieeagubywaacncxoouibbhwyxhjiczlymscsqlttecvundzjqtuizqwsjalmizgeekugacatlwhiiyaamjuiafmyzxadbxsgwhfawotawfxkpyzyoceiqfppituvaqmgfjinulkbkgpnibaefqaqiptctoqhcnnfihmzijnwpxdikwefpxicbspdkppznpiqrpkyvcxapoaofjbliepgfwmppgwypgflzdtzv...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nCan you imagine our life if we removed all zeros from it? For sure we will have many problems.\n\nIn this pro...
[{"input": "1000000000\n1000000000\n", "output": "YES\n"}, {"input": "1000000000\n1000010000\n", "output": "NO\n"}, {"input": "1000000000\n1001010000\n", "output": "NO\n"}, {"input": "999999999\n999999999\n", "output": "YES\n"}, {"input": "341781108\n1068141937\n", "output": "NO\n"}, {"input": "501871728\n1015604246\n"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou've had a baby.\n\nWell done. Nice isn't it? Life destroying... but in a good way.\n\nPart of your new rou...
[{"input": "\"Why the hell are there so many babies?!\"", "output": "[1]", "fn_name": "baby_count"}, {"input": "\"Anyone remember life before babies?\"", "output": "[1]", "fn_name": "baby_count"}, {"input": "\"none here\"", "output": "[\"Where's the baby?!\"]", "fn_name": "baby_count"}, {"input": "\"Happy babies boom b...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSereja loves all sorts of algorithms. He has recently come up with a new algorithm, which receives a string a...
[{"input": "yxzyzxzzxyyzzxxxzyyzzyzxxzxyzyyzxyzxyxxyzxyxzyzxyzxyyxzzzyzxyyxyzxxy\n10\n17 67\n6 35\n12 45\n56 56\n14 30\n25 54\n1 1\n46 54\n3 33\n19 40\n", "output": "NO\nNO\nNO\nYES\nYES\nNO\nYES\nNO\nNO\nYES\n"}, {"input": "yxzyzxzzxyyzzxxxzyyzzyzxxzxyzyyzxyzxyxxyzxyxzyzxyzxyyxzzzyzxyyxyzxxy\n10\n17 67\n6 35\n12 45\n5...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTakahashi, who is a novice in competitive programming, wants to learn M algorithms.\nInitially, his understan...
[{"input": "12 12 48311\n2997 79802 84238 34346 35199 2284 77696 46340 54797 36702 97764 42765 11582\n82923 47331 39508 81928 63775 90952 64439 99662 74546 15843 11552 23897 87476\n26261 21259 714 72469 92132 94958 69101 38760 4916 38769 60706 90149 70017\n35433 97674 53722 44881 95786 42614 79922 49582 34615 36414 806...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled \"Spe...
[{"input": "-100 -97 20 40\n-151 -97 30 100\n", "output": "1\n"}, {"input": "-123 -29 20 40\n-39 -19 99 100\n", "output": "0\n"}, {"input": "-100 -97 20 40\n-90 -97 30 100\n", "output": "2"}, {"input": "-45 -93 20 40\n-36 -93 31 127\n", "output": "2\n"}, {"input": "-26 -65 20 40\n52 -123 98 100\n", "output": "0\n"}, {"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nFennec and Snuke are playing a board game.\nOn the board, there are N cells numbered 1 through N, and N-1 roa...
[{"input": "7\n3 6\n1 2\n3 1\n7 4\n5 7\n1 4\n", "output": "Fennec\n"}, {"input": "7\n3 6\n2 2\n3 1\n7 4\n5 7\n1 4", "output": "Fennec\n"}, {"input": "7\n3 6\n2 2\n3 1\n7 4\n4 7\n1 4", "output": "Fennec\n"}, {"input": "7\n3 6\n1 2\n3 2\n7 4\n5 7\n1 4", "output": "Fennec\n"}, {"input": "7\n3 6\n2 2\n3 1\n5 4\n4 7\n1 4", ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nConsider the following equation: \n\n<image> where sign [a] represents the integer part of number a.\n\nLet's...
[{"input": "14\n", "output": " 373391776\n"}, {"input": "38\n", "output": " 90046024\n"}, {"input": "25\n", "output": " 470083777\n"}, {"input": "22\n", "out...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nProblem statement\n\nThere is a rational number sequence $ X_0, X_1, X_2, ..., X_N $. Each term is defined as...
[{"input": "4\n-1 2\n12 0\n1 -3\n3 13", "output": "-39\n"}, {"input": "4\n-2 4\n7 1\n-1 8\n2 25", "output": "-25\n"}, {"input": "4\n-1 -2\n2 3\n3 2\n2 22", "output": "-28\n"}, {"input": "4\n-1 -2\n2 5\n3 2\n2 22", "output": "-32\n"}, {"input": "4\n-1 -2\n2 1\n3 2\n2 22", "output": "-24\n"}, {"input": "4\n-6 1\n58 0\n0 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nMarcin is a coach in his university. There are $n$ students who want to attend a training camp. Marcin is a s...
[{"input": "10\n206158430208 206162624513 68719476737 137506062337 206162624513 4194305 68719476737 206225539072 137443147777 109376694609\n202243898 470292528 170057449 290025540 127995253 514454151 607963029 768676450 611202521 68834463\n", "output": "2704208829\n"}, {"input": "10\n206158430208 206162624513 687194767...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nOnce upon a time in the Kingdom of Far Far Away lived Sam the Farmer. Sam had a cow named Dawn and he was dee...
[{"input": "1256336691\n", "output": "2931452299 10050693537\n"}, {"input": "1359531323\n", "output": "6797656627 10876250593\n"}, {"input": "1544906479\n", "output": "1581910903 12359251841\n"}, {"input": "1278463385\n", "output": "2301234121 10227707089\n"}, {"input": "1369156222\n", "output": "110960153 10953249785\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nRecently, on the course of algorithms and data structures, Valeriy learned how to use a deque. He built a deq...
[{"input": "71 57\n9 26 80 2 65 60 63 1 15 109 114 1 58 27 41 97 42 9 42 56 87 22 10 28 34 90 13 70 71 56 65 21 0 78 47 96 56 77 32 83 28 16 10 41 0 18 118 12 27 112 4 67 21 41 111 20 21 52 74 10 83 74 43 123 2 15 0 63 68 7 72\n81\n47\n81\n81\n5\n9\n41\n76\n81\n92\n95\n94\n78\n93\n47\n30\n152\n3\n45\n50\n42\n88\n17\n3\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n# Largest Rectangle in Background\n\nImagine a photo taken to be used in an advertisement. The background on ...
[{"input": "[100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 10...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\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)...
[{"input": "8\n5 7 4 2 6 8 1 3\n", "output": "4\n"}, {"input": "8\n5 14 4 2 6 8 1 3", "output": "4\n"}, {"input": "8\n5 28 4 2 6 8 1 3", "output": "4\n"}, {"input": "8\n5 14 4 2 6 4 1 3", "output": "4\n"}, {"input": "8\n5 28 4 2 8 8 1 3", "output": "4\n"}, {"input": "8\n5 7 4 2 6 8 1 0", "output": "5\n"}, {"input": "6\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWrite a function which takes a number and returns the corresponding ASCII char for that value.\n\nExample: \n...
[{"input": "34", "output": "[\"\\\"\"]", "fn_name": "get_char"}, {"input": "65", "output": "[\"A\"]", "fn_name": "get_char"}, {"input": "33", "output": "[\"!\"]", "fn_name": "get_char"}, {"input": "35", "output": "[\"#\"]", "fn_name": "get_char"}, {"input": "36", "output": "[\"$\"]", "fn_name": "get_char"}, {"input": "...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are an environmental activist at heart but the reality is harsh and you are just a cashier in a cinema. B...
[{"input": "4\n1\n100\n50 2\n49 1\n100\n8\n100 200 100 200 100 200 100 100\n16 2\n15 3\n107\n3\n1000000000 1000000000 1000000000\n50 1\n50 1\n4850788900\n5\n200 100 100 100 100\n105 5\n31 1\n90\n", "output": "-1\n6\n-1\n2\n"}, {"input": "4\n1\n100\n50 2\n49 1\n100\n8\n100 200 100 200 100 200 100 100\n16 2\n15 3\n107\n3...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And...
[{"input": "48 14\n1 1 1 1 1 6 1 1 1 1 1 1 3 3 1 1 1 1 1 2 2 2 1 1 1 1 1 1 2 1 4 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 5\n", "output": "42\n"}, {"input": "48 14\n1 1 1 1 1 6 1 1 1 1 1 1 3 3 1 1 2 1 1 2 2 2 1 1 1 1 1 1 2 1 4 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 5\n", "output": "42\n"}, {"input": "48 14\n1 1 1 1 1 6 1 1 1 1 2 1 3 3...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nImagine that there is a group of three friends: A, B and С. A owes B 20 rubles and B owes C 20 rubles. The to...
[{"input": "100 48\n1 56 6\n2 42 3\n3 52 1\n9 26 8\n10 96 8\n11 39 2\n12 51 6\n12 68 7\n13 40 5\n14 18 10\n14 70 6\n15 37 8\n15 38 8\n15 82 6\n15 85 5\n16 48 3\n16 50 9\n16 71 9\n17 18 3\n17 100 10\n20 73 3\n22 32 9\n22 89 9\n23 53 3\n24 53 1\n27 78 10\n30 50 5\n33 94 8\n34 87 9\n35 73 3\n36 51 8\n37 88 10\n37 97 2\n40...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type...
[{"input": "3\n>(======#======~\n~~=Q=Q=Q=Q=Q=Q=Q=^=QQ>\n>'===#==~>=", "output": "NA\nNA\nNA\n"}, {"input": "3\n>(======#======~\n~~=Q=Q=Q=Q===Q=Q=^QQQ>\n>'===#==~>=", "output": "NA\nNA\nNA\n"}, {"input": "3\n>(======#======~\n~~=P=Q=Q=Q===Q=Q=^QQQ>\n>'===#==~>=", "output": "NA\nNA\nNA\n"}, {"input": "3\n>(======#=====...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are N Snuke Cats numbered 1, 2, \\ldots, N, where N is even.\nEach Snuke Cat wears a red scarf, on whic...
[{"input": "4\n141 1 -1 2", "output": "-4 -144 142 -141\n"}, {"input": "4\n102 2 -1 2", "output": "-1 -101 102 -101\n"}, {"input": "4\n102 2 -1 1", "output": "-4 -104 101 -101\n"}, {"input": "4\n13 -17 0 0", "output": "-17 13 -30 -30\n"}, {"input": "4\n12 -17 2 0", "output": "-19 14 -29 -31\n"}, {"input": "4\n12 -17 2 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSomething happened in Uzhlyandia again... There are riots on the streets... Famous Uzhlyandian superheroes Sh...
[{"input": "100\n23 64 60 -45 -36 -64 -59 15 -75 69 -30 -7 -20 17 -77 58 93 -76 -98 -22 -31 16 -50 6 -20 -85 1 64 -88 -8 -15 -6 -57 25 91 10 2 -90 74 -66 -42 73 28 49 -85 59 96 79 -25 49 -59 -89 -75 12 -96 -33 -65 -8 -100 -81 17 99 -91 -5 7 -21 1 85 63 86 -26 85 -31 11 -75 35 -82 15 98 93 -55 66 70 36 -38 8 92 -63 -5 6...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nRamesses came to university to algorithms practice, and his professor, who is a fairly known programmer, gave...
[{"input": "10 10\n1 1 1 0 1 1 0 0 0 1\n1 1 1 1 0 0 0 0 0 1\n0 1 0 0 0 0 0 0 1 0\n0 0 0 0 0 1 0 0 0 0\n0 1 1 1 0 1 1 1 0 0\n0 0 0 1 1 1 0 1 0 0\n0 0 0 0 1 1 0 0 1 1\n0 0 0 1 1 0 1 1 1 1\n1 1 0 1 1 0 1 1 0 0\n1 0 0 0 0 0 0 0 1 0\n0 1 0 1 0 1 1 1 0 0\n0 1 1 0 0 0 0 0 0 1\n0 1 0 0 0 1 0 0 0 0\n0 1 0 0 1 1 1 0 0 1\n0 1 1 0...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nRecently a new building with a new layout was constructed in Monocarp's hometown. According to this new layou...
[{"input": "4\n30\n67\n8\n14\n", "output": "10 0 0\n20 0 1\n1 1 0\n3 1 0\n"}, {"input": "4\n30\n44\n8\n14\n", "output": "10 0 0\n13 1 0\n1 1 0\n3 1 0\n"}, {"input": "4\n18\n44\n14\n14\n", "output": "6 0 0\n13 1 0\n3 1 0\n3 1 0\n"}, {"input": "4\n30\n44\n8\n11\n", "output": "10 0 0\n13 1 0\n1 1 0\n2 1 0\n"}, {"input": "...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA railroad running from west to east in Atcoder Kingdom is now complete.\nThere are N stations on the railroa...
[{"input": "4\n12 13 1\n44 17 17\n66 4096 64\n", "output": "4162\n4162\n4162\n0\n"}, {"input": "4\n1 13 1\n44 17 22\n101 4096 64", "output": "4197\n4197\n4197\n0\n"}, {"input": "4\n1 13 1\n44 17 22\n120 4096 64", "output": "4216\n4216\n4216\n0\n"}, {"input": "4\n1 18 1\n44 17 22\n111 4096 64", "output": "4207\n4207\n42...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe development of a text editor is a hard problem. You need to implement an extra module for brackets colori...
[{"input": "21\n(RRRRR)LLLL(RRR)LL(R)\n", "output": "-1 -1 -1 -1 -1 -1 1 1 1 1 1 -1 -1 -1 -1 2 2 2 -1 -1 3 "}, {"input": "21\n(RRRRR)LLLL(RRR)LL(R)\n", "output": "-1 -1 -1 -1 -1 -1 1 1 1 1 1 -1 -1 -1 -1 2 2 2 -1 -1 3 "}, {"input": "11\n'R)R(R)Ra)c\n", "output": "0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1\n"}, {"input": "11\n'R)R(R...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWhat's in a name?\n..Or rather, what's a name in? For us, a particular string is where we are looking for a n...
[{"input": "\"A crew that boards the ship\"\n\"chris\"", "output": "[false]", "fn_name": "name_in_str"}, {"input": "\"Just enough nice friends\"\n\"Jennifer\"", "output": "[false]", "fn_name": "name_in_str"}, {"input": "\"Across the rivers\"\n\"chris\"", "output": "[true]", "fn_name": "name_in_str"}, {"input": "\"Next ...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n[Haikus](https://en.wikipedia.org/wiki/Haiku_in_English) are short poems in a three-line format, with 17 syll...
[{"input": "\"My code is cool, right?\\nJava # Pyhton ; Ruby // Go:\\nI know them all, yay! ;-)\"", "output": "[true]", "fn_name": "is_haiku"}, {"input": "\"An old silent pond...\\nA frog jumps into the pond,\\nsplash!\\nSilence again.\"", "output": "[false]", "fn_name": "is_haiku"}, {"input": "\"An old silent pond...\...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAn art exhibition will be held in JOI. At the art exhibition, various works of art from all over the country ...
[{"input": "3\n1 12\n26 -1\n2 0", "output": "12\n"}, {"input": "3\n1 11\n80 0\n2 -1", "output": "11\n"}, {"input": "3\n0 17\n14 1\n13 2", "output": "17\n"}, {"input": "3\n0 16\n54 3\n5 1", "output": "16\n"}, {"input": "3\n0 16\n48 3\n0 2", "output": "18\n"}, {"input": "3\n0 16\n48 3\n0 4", "output": "20\n"}, {"input": ...
code_stdio