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\nMike is given a matrix A, N and M are numbers of rows and columns respectively. A1, 1 is the number in the to...
[{"input": "3 2\n2 2\n4 1\n7 -1\n2\n1 2\n2 2", "output": "5\n"}, {"input": "3 2\n2 2\n7 0\n7 -1\n2\n1 2\n2 2", "output": "7\n"}, {"input": "3 2\n1 2\n3 5\n7 0\n2\n2 2\n2 2", "output": "10\n"}, {"input": "3 2\n1 2\n3 6\n7 0\n2\n2 2\n2 2", "output": "12\n"}, {"input": "3 2\n2 2\n4 0\n7 -1\n2\n1 2\n2 2", "output": "4\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 year of 2012 is coming...\n\nAccording to an ancient choradrican legend in this very year, in 2012, Diabl...
[{"input": "22\nCleo likes Snowy\nCleo likes Troll\nChapay likes Dracul\nSnowy likes Troll\nDracul likes Chapay\nDracul likes Snowy\nChapay likes Cleo\nSnowy likes Chapay\nDracul likes Troll\nAnka likes Hexadecimal\nSnowy likes Anka\nHexadecimal likes Cleo\nHexadecimal likes Troll\nDracul likes Anka\nCleo likes Hexadec...
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\nAndrewid the Android is a galaxy-famous detective. He is now investigating the case of vandalism at the exhib...
[{"input": "100 19\n6 62 72 83 91 94 97\n3 61 84 99\n1 63\n5 46 53 56 69 78\n5 41 43 49 74 89\n5 55 57 79 85 87\n3 47 59 98\n3 64 76 82\n3 48 66 75\n2 60 88\n2 67 77\n4 40 51 73 95\n41 1 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 44 71 81\n4 58 65 90 93\n1 100...
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\nSunake is in the form of a polygonal line consisting of n vertices (without self-intersection). First, Sunake...
[{"input": "11\n63 106\n87 143\n102 132\n115 169\n74 145\n41 177\n56 130\n28 102\n19 124\n0 156\n22 183", "output": "Impossible\n"}, {"input": "11\n63 106\n87 143\n102 132\n115 169\n74 145\n41 177\n56 130\n28 102\n19 124\n0 294\n22 183", "output": "Impossible\n"}, {"input": "11\n63 106\n87 143\n102 132\n115 169\n74 145...
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\nIt's been a while since I played with A, B, and C. Mr. A and Mr. B became players, and Mr. C became a referee...
[{"input": "AABBAAABABAABBBAABA\nAABBBABBABBAAABABABAAB\nBABAABAABABABBAAAB\nAABABAAABBAABBBABAA\nAAAAAAAAAAA\nABBBBBBBBBB\n0", "output": "11 8\n10 12\n11 7\n11 8\n11 0\n0 11\n"}, {"input": "ABAABBBAABABAAABBAA\nAABBBABBABBAAABABABAAB\nBABAABAABABABBAAAB\nAABABAAABBAABBBABAA\nAAAAAAAAAAA\nABBBBBABBBB\n0", "output": "11...
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\nMike and Ann are sitting in the classroom. The lesson is boring, so they decided to play an interesting game....
[{"input": "wfyjbwcuxjrvmunfbrhethdmepeampvjcypavwoolteucetnqntytdfstvunnfyvngydjcohnwgtfddcnvuewxcafwureiupfeljqydwtickfbokoytlxtuwmvmvflemfvcksszlwgcwtamzovectkzxuzdtvbujyfpvcruvzvgglozwktwawcbkkwkookmuhjlcyjvfrnzmgpglvnbrujtbvtwrsqbulusfwzulxnadaqbijfrsvteqqoirfaolhfbgorxdwigwxcydbfxhvhqzjqirtznnwcjlcbakbitsjwocfgwc...
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\nChef has a nice complete binary tree in his garden. Complete means that each node has exactly two sons, so th...
[{"input": "4\nrll\nrll\nr\nlllr", "output": "14\n14\n4\n13\n"}, {"input": "4\nlrl\nrll\nr\nrlll", "output": "10\n14\n4\n27\n"}, {"input": "4\nlrl\nrll\nr\nllrl", "output": "10\n14\n4\n15\n"}, {"input": "4\nrll\nrll\nr\nllrl", "output": "14\n14\n4\n15\n"}, {"input": "4\nrll\nrll\nr\nrlll", "output": "14\n14\n4\n27\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 are given an undirected graph with n vertices. There are no edge-simple cycles with the even length in it...
[{"input": "12 12\n5 1\n5 11\n1 11\n8 11\n8 9\n5 12\n6 9\n7 11\n9 3\n9 10\n4 12\n10 2\n78\n1 1\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n1 9\n2 10\n1 11\n1 12\n2 2\n2 3\n2 4\n2 5\n2 6\n2 7\n2 8\n3 9\n2 10\n2 11\n2 12\n3 3\n3 4\n3 5\n3 6\n4 7\n3 8\n3 9\n3 10\n3 11\n3 12\n4 4\n4 5\n4 6\n4 7\n4 8\n4 10\n4 10\n4 11\n4 12\n5 5\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\nJeff's got n cards, each card contains either digit 0, or digit 5. Jeff can choose several cards and put them...
[{"input": "214\n5 0 5 0 5 0 0 0 5 5 0 5 0 5 5 0 5 0 0 0 0 5 5 0 0 5 5 0 0 0 0 5 5 5 5 0 5 0 0 0 0 0 0 5 0 0 0 5 0 0 5 0 0 5 5 0 0 5 5 0 0 0 0 0 5 0 5 0 5 5 0 5 0 0 5 5 5 0 5 0 5 0 5 5 0 5 0 0 0 5 5 0 5 0 5 5 5 5 5 0 0 0 0 0 0 5 0 5 5 0 5 0 5 0 5 5 0 0 0 0 5 0 5 0 5 0 0 5 0 0 5 5 5 5 5 0 0 5 0 0 5 0 0 5 0 0 5 0 0 5 0 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\nThere are H rows and W columns of white square cells.\nYou will choose h of the rows and w of the columns, an...
[{"input": "21 -1\n-5 -5", "output": "104\n"}, {"input": "39 -1\n-5 -5", "output": "176\n"}, {"input": "13 13\n8 10\n", "output": "15\n"}, {"input": "20 20\n19 19\n", "output": "1\n"}, {"input": "19 19\n5 3\n", "output": "224\n"}, {"input": "20 20\n1 1\n", "output": "361\n"}, {"input": "20 20\n20 20\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\nYou've purchased a ready-meal from the supermarket.\n\nThe packaging says that you should microwave it for 4 ...
[{"input": "\"600W\"\n4\n20\n\"800W\"", "output": "[\"3 minutes 15 seconds\"]", "fn_name": "cooking_time"}, {"input": "\"100W\"\n8\n45\n\"50W\"", "output": "[\"17 minutes 30 seconds\"]", "fn_name": "cooking_time"}, {"input": "\"450W\"\n3\n25\n\"950W\"", "output": "[\"1 minutes 38 seconds\"]", "fn_name": "cooking_time"}...
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\nThe main street of Berland is a straight line with n houses built along it (n is an even number). The houses ...
[{"input": "100000 99999\n", "output": "50000\n"}, {"input": "100000 23458\n", "output": "38272\n"}, {"input": "100000 23457\n", "output": "11729\n"}, {"input": "92480 43074\n", "output": "24704\n"}, {"input": "85766 64050\n", "output": "10859\n"}, {"input": "67808 61809\n", "output": "30905\n"}, {"input": "80124 68695...
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 permutation of length n is an array containing each integer from 1 to n exactly once. For example, q = [4, ...
[{"input": "100\n94 22 24 99 58 97 20 29 67 30 38 64 77 50 15 44 92 88 39 42 25 70 2 76 84 6 37 49 17 71 31 19 26 79 10 35 65 63 32 95 5 8 52 27 83 18 53 93 13 81 48 68 54 82 34 60 87 23 16 86 55 40 61 45 28 7 74 41 14 91 3 72 33 11 98 89 90 69 78 36 80 59 56 21 43 1 75 46 47 12 96 73 57 51 4 85 9 100 66 62\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\nAnya has bought a new smartphone that uses Berdroid operating system. The smartphone menu has exactly n appli...
[{"input": "71 96 75634\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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71\n27 26 27 26 27 26 27 26 27 26 27 26 27 26 27 26 27 26 27 26 27 26 27 26 27 26 27 26 27 26 ...
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\nExample\n\nInput\n\n4 3\n1000 1\n2000 2\n3000 3\n\n\nOutput\n\n2 3 4 4### Format: Read the inputs from stdin ...
[{"input": "25 1\n1010 1\n3784 7\n3000 6", "output": "2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n"}, {"input": "25 2\n1011 2\n2889 1\n308 2", "output": "3 3 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n"}, {"input": "20 3\n0010 1\n4107 3\n4267 4", "output": "2 2 2 3 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n"}, {"inpu...
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 data which provides heights (in meter) of mountains. The data is only for ten mountains.\n\nWrite ...
[{"input": "1819\n2003\n1094\n2489\n1723\n492\n4419\n2848\n2834\n1724", "output": "4419\n2848\n2834\n"}, {"input": "1819\n2003\n1094\n2489\n1142\n492\n4419\n4289\n2834\n1724", "output": "4419\n4289\n2834\n"}, {"input": "1819\n2003\n876\n2840\n1723\n1799\n3776\n2848\n1592\n922", "output": "3776\n2848\n2840\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\nOne day Jeff got hold of an integer sequence a_1, a_2, ..., a_{n} of length n. The boy immediately decided to...
[{"input": "12\n10 19 7 3 1 8 15 17 14 9 4 5\n", "output": "12\n1 0\n3 0\n4 0\n5 0\n7 0\n8 0\n9 0\n10 0\n14 0\n15 0\n17 0\n19 0\n"}, {"input": "12\n10 19 7 3 1 8 15 17 14 15 4 5\n", "output": "11\n1 0\n3 0\n4 0\n5 0\n7 0\n8 0\n10 0\n14 0\n15 3\n17 0\n19 0\n"}, {"input": "12\n10 19 7 3 3 8 15 17 14 9 4 5\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\nYou are given N points (x_i,y_i) located on a two-dimensional plane.\nConsider a subset S of the N points tha...
[{"input": "200\n6961 9533\n1847 2184\n9391 1072\n8146 7944\n3403 1703\n2280 4570\n8872 8035\n9417 8677\n8552 1719\n6602 3237\n6223 2519\n654 7141\n8494 2638\n7204 8528\n1352 3164\n1638 4388\n1102 7239\n3795 5213\n6836 786\n9662 2985\n6241 9368\n1325 8963\n1237 5004\n8000 5104\n9833 4105\n8543 3581\n9753 6278\n7003 822...
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\nRemove the parentheses\n=\nIn this kata you are given a string for example:\n\n```python\n\"example(unwanted ...
[{"input": "\"hello example (words(more words) here) something\"", "output": "[\"hello example something\"]", "fn_name": "remove_parentheses"}, {"input": "\"example (unwanted thing) example\"", "output": "[\"example example\"]", "fn_name": "remove_parentheses"}, {"input": "\"example(unwanted thing)example\"", "output...
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 a string s, write a method (function) that will return true if its a valid single integer or floating n...
[{"input": "\"3 4 \"", "output": "[false]", "fn_name": "isDigit"}, {"input": "\"s2324\"", "output": "[false]", "fn_name": "isDigit"}, {"input": "\"-234.4\"", "output": "[true]", "fn_name": "isDigit"}, {"input": "\"34.65\"", "output": "[true]", "fn_name": "isDigit"}, {"input": "\"3 4\"", "output": "[false]", "fn_name"...
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\nATMs of a well-known bank of a small country are arranged so that they can not give any amount of money reque...
[{"input": "58 5\n1 6 9 18 34 41 82 99 164 179 183 204 240 396 636 1224 2023 2856 4488 4705 5712 9180 9266 18360 18850 20270 23086 60810 190701 197064 211140 214200 222970 243240 263510 314442 425670 486480 708288 789888 1009800 1025349 1054040 1094580 1325184 1579776 1748076 2050698 2635100 2895984 2918880 3975552 428...
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 aim of this Kata is to write a function which will reverse the case of all consecutive duplicate letters ...
[{"input": "\"parallel universe\"", "output": "[\"paraLLel universe\"]", "fn_name": "reverse"}, {"input": "\"hello world\"", "output": "[\"heLLo world\"]", "fn_name": "reverse"}, {"input": "\"HELLO WORLD\"", "output": "[\"HEllO WORLD\"]", "fn_name": "reverse"}, {"input": "\"HeLlo World\"", "output": "[\"HeLlo World\"]"...
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\nThis is a hard version of the problem. In this version, the given array can contain equal elements and the co...
[{"input": "9\n5\n4 7 2 2 10\n5\n5 0 2 1 11\n5\n1 2 2 4 0\n2\n0 1\n3\n0 1 0\n4\n0 2 0 0\n4\n0 1 0 1\n4\n0 1 0 2\n20\n16 15 1 10 0 14 0 10 3 16 0 5 4 5 17 13 14 14 1 9\n", "output": "2\n3\n1\n0\n1\n1\n1\n1\n15\n"}, {"input": "9\n5\n4 7 2 2 10\n5\n5 0 2 1 7\n5\n1 2 2 4 0\n2\n0 1\n3\n0 1 0\n4\n0 1 0 0\n4\n0 1 0 1\n4\n0 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\nScheduling is how the processor decides which jobs (processes) get to use the processor and for how long. Thi...
[{"input": "[10, 20, 1, 2, 3]\n5\n2", "output": "[11]", "fn_name": "roundRobin"}, {"input": "[10, 20, 1, 2, 3]\n5\n0", "output": "[21]", "fn_name": "roundRobin"}, {"input": "[10, 20, 1, 2, 3]\n4\n3", "output": "[11]", "fn_name": "roundRobin"}, {"input": "[10, 20, 1, 2, 3]\n4\n2", "output": "[9]", "fn_name": "roundRobin...
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 types of coins in Byteland. Conveniently, the denomination of the coin type k divides the denomin...
[{"input": "100\n4 1 5 3 2 1 1 1 4 1 1 2 1 1 1 4 1 1 3 1 3 1 1 1 1 4 5 1 5 2 5 3 1 1 1 1 1 1 1 3 2 1 1 3 1 1 3 4 3 2 4 1 1 4 1 1 2 2 4 1 4 1 2 5 1 2 2 1 5 3 1 5 4 2 1 1 2 5 5 1 4 4 2 3 1 4 1 3 2 1 1 1 4 1 3 1 1 5 1\n0 18 10 2 1 9 9 0 9 5 6 8 11 6 28 11 29 50 25 15 9 4 3 51 13 4 68 31 4 6 2 5 26 1 21 7 3 4 9 7 40 3 0 7 ...
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 elections to Berland parliament are happening today. Voting is in full swing!\n\nTotally there are n cand...
[{"input": "100 100 100 100\n71 22 92 3 19 90 1 16 88 56 62 37 56 84 52 46 4 64 21 19 37 54 21 81 56 33 71 57 86 75 62 42 79 67 14 8 66 30 13 38 20 71 36 66 46 55 4 99 18 37 7 24 72 46 32 86 87 7 90 93 96 94 21 23 62 53 16 11 11 83 21 81 68 50 85 9 94 60 47 41 34 82 11 12 95 81 61 81 86 85 64 36 57 62 86 3 16 90 73 91\...
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\nLittle Mishka is a great traveller and she visited many countries. After thinking about where to travel this ...
[{"input": "76 24\n6814 3834 1131 6256 2598 850 7353 1702 5773 1699 35 5103 1368 2258 7891 7455 8546 7316 7428 8864 6536 5750 8455 2624 7326 2197 8239 3806 3016 7126 85 3249 1138 6783 9684 4417 7417 3660 6334 7324 9760 9755 7605 9891 3676 8784 8739 8266 3272 9250 5875 939 4130 6540 7813 6867 9148 781 6190 964 5612 1864...
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<image>\n\n\nThis figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the...
[{"input": "1\n6\n-1\n13\n10\n0\n0\n0", "output": "10\n13\n-1\n"}, {"input": "1\n20\n0\n20\n11\n0\n0\n1", "output": "20\n11\n20\n"}, {"input": "1\n38\n0\n20\n11\n0\n0\n1", "output": "38\n11\n20\n"}, {"input": "1\n10\n0\n20\n11\n0\n0\n1", "output": "10\n11\n20\n"}, {"input": "1\n10\n0\n20\n14\n0\n0\n1", "output": "10\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\n# Task\n You are given an array of integers. Your task is to determine the minimum number of its elements tha...
[{"input": "[-10, -21, -20, -25, -13, 14, 2, 6, -50, -55, -60, -65, -70, -75, -80, -85, -90, -95, -100, -105, -110, -115, -120, -125, -130, 12, -24, -15, -150, 7, -160, -165, -170, -175, -180, -185, -190, -195, -200, -3, -6, -215, -220, -225, -230, -235, -240, -20, -250, -255, -260, 23, -270, -275, -280, -7, -290, -295...
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\nWe’ve all seen katas that ask for conversion from snake-case to camel-case, from camel-case to snake-case, or...
[{"input": "\"hello-to-the-world\"", "output": "[\"kebab\"]", "fn_name": "case_id"}, {"input": "\"hello_to_the_world\"", "output": "[\"snake\"]", "fn_name": "case_id"}, {"input": "\"hello-To-The-World\"", "output": "[\"none\"]", "fn_name": "case_id"}, {"input": "\"hello_To_The_World\"", "output": "[\"none\"]", "fn_name...
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\n2^k teams participate in a playoff tournament. The tournament consists of 2^k - 1 games. They are held as fol...
[{"input": "3\n0110?11\n6\n5 1\n6 ?\n7 ?\n1 ?\n5 ?\n1 1\n", "output": "\n1\n2\n3\n3\n5\n4\n"}, {"input": "3\n0110?11\n6\n5 1\n6 ?\n7 ?\n2 ?\n5 ?\n1 1\n", "output": "1\n2\n3\n4\n5\n5\n"}, {"input": "3\n0110?11\n6\n5 1\n6 ?\n6 ?\n1 ?\n5 ?\n1 1\n", "output": "1\n2\n2\n2\n2\n2\n"}, {"input": "3\n11?0110\n6\n5 1\n6 ?\n7 ?\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\nGiven an integer, if the length of it's digits is a perfect square, return a square block of sqroot(length) *...
[{"input": "11137980416513326753900366614118127597534595333758924261793440915871873756952319756649737238032191522372673120386100703535104754039588400552740678721535237244611848291138569327958593044675614468557005002330545247507161735907754581937618290513118338573433800934507948491646900563507252698934433726005748974840...
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\nAs Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of...
[{"input": "64 28\n+54\n+44\n+55\n-3\n+33\n-54\n-54\n-7\n+33\n+54\n+54\n+26\n-54\n+14\n-54\n-47\n+25\n-54\n-54\n-54\n-52\n+54\n+54\n+54\n+54\n+20\n+7\n+54\n+4\n+32\n+46\n-54\n-47\n+15\n+32\n-54\n+7\n+62\n-16\n-54\n+3\n+54\n+54\n+54\n+54\n-54\n+54\n-54\n+54\n-52\n+27\n-7\n+54\n-5\n-54\n-18\n+1\n+58\n+28\n-46\n+61\n-54\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 are given a book with n chapters.\n\nEach chapter has a specified list of other chapters that need to be ...
[{"input": "5\n4\n1 2\n0\n2 1 4\n1 3\n5\n1 5\n1 1\n1 1\n1 1\n1 4\n5\n0\n0\n2 1 2\n1 2\n2 2 1\n4\n2 2 3\n0\n0\n2 3 2\n5\n1 2\n1 3\n1 4\n1 3\n0\n", "output": "-1\n-1\n1\n2\n-1\n"}, {"input": "5\n4\n1 2\n0\n2 1 4\n1 2\n5\n1 5\n1 1\n1 1\n1 1\n1 4\n5\n0\n0\n2 1 2\n1 2\n2 2 1\n4\n2 2 4\n0\n0\n2 3 1\n5\n1 2\n1 3\n1 4\n1 3\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\nYou are given a function $f$ written in some basic language. The function accepts an integer value, which is ...
[{"input": "83\nadd\nfor 58\nend\nadd\nadd\nfor 36\nfor 84\nadd\nadd\nfor 86\nadd\nadd\nend\nend\nadd\nadd\nadd\nadd\nfor 23\nadd\nadd\nadd\nfor 70\nadd\nadd\nend\nfor 24\nfor 58\nend\nadd\nend\nend\nend\nfor 41\nfor 51\nend\nfor 22\nfor 39\nend\nfor 94\nfor 47\nadd\nfor 57\nend\nadd\nend\nfor 55\nadd\nfor 75\nfor 90\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\nSnuke loves puzzles.\n\nToday, he is working on a puzzle using `S`- and `c`-shaped pieces. In this puzzle, yo...
[{"input": "12345 267141", "output": "72957\n"}, {"input": "12345 263982", "output": "72168\n"}, {"input": "10389 263982", "output": "71190\n"}, {"input": "10389 232248", "output": "63256\n"}, {"input": "12345 678901", "output": "175897"}, {"input": "5656 263982", "output": "68823\n"}, {"input": "10389 85698", "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\nAs you know, Bob's brother lives in Flatland. In Flatland there are n cities, connected by n - 1 two-way road...
[{"input": "50\n7 34\n5 34\n5 11\n11 23\n42 5\n41 11\n12 41\n41 49\n1 49\n12 6\n7 15\n17 42\n20 6\n17 46\n20 19\n46 22\n49 40\n44 40\n43 46\n22 8\n17 29\n44 18\n31 18\n46 9\n7 16\n32 11\n13 41\n20 36\n34 25\n46 28\n39 34\n30 42\n11 47\n45 15\n37 17\n4 23\n35 17\n17 48\n2 17\n34 24\n1 10\n21 5\n2 3\n50 16\n33 5\n20 14\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\nVasya works as a watchman in the gallery. Unfortunately, one of the most expensive paintings was stolen while...
[{"input": "100000 100000 100000 100000 100000\n", "output": "10000000000\n"}, {"input": "100000 100000 100000 100000 100000\n", "output": "10000000000"}, {"input": "100000 83958 32567 91083 110780\n", "output": "1466200000\n"}, {"input": "100000 80015 84290 50777 30497\n", "output": "1696900000\n"}, {"input": "100000 ...
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# Fix the Bugs (Syntax) - My First Kata\n\n## Overview\n\nHello, this is my first Kata so forgive me if it is...
[{"input": "\"hello\"\n{}", "output": "[false]", "fn_name": "my_first_kata"}, {"input": "[]\n\"pippi\"", "output": "[false]", "fn_name": "my_first_kata"}, {"input": "\"hello\"\n3", "output": "[false]", "fn_name": "my_first_kata"}, {"input": "true\ntrue", "output": "[false]", "fn_name": "my_first_kata"}, {"input": "67\n...
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\nThree-valued logic is a logic system that has, in addition to \"true\" and \"false\", \"unknown\" as a valid ...
[{"input": "(Q*P)\n(--R+(Q*R))\n(P+-Q)\n2\n-1\n(-1+(((---P+Q)*(--Q+---R))+(-R+-P)))\n.", "output": "3\n9\n15\n27\n0\n19\n"}, {"input": "(P*Q)\n(--R+(P*Q))\n(P*-P)\n2\n2\n(-1+(((---P+Q)*(--Q+---R))*(-R+-P)))\n.", "output": "3\n11\n0\n27\n27\n7\n"}, {"input": "(P*R)\n(--R*(P*R))\n(P+-P)\n0\n2\n(-1+(((---P+Q)*(--Q+---P))*...
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 grid with R rows and C columns. We call the cell in the r-th row and c-th column (r,c).\n\nMr. Tak...
[{"input": "2 3\n5\n2 1 0\n1 2 10\n1 3 20\n2 1 30\n2 3 40", "output": "No\n"}, {"input": "2 3\n5\n2 1 0\n1 2 10\n1 3 37\n2 1 30\n2 3 40", "output": "No\n"}, {"input": "4 3\n5\n2 1 0\n1 2 10\n1 3 20\n2 1 30\n2 3 40", "output": "No\n"}, {"input": "2 3\n5\n1 1 0\n1 2 10\n1 3 20\n2 1 33\n2 3 40", "output": "No\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\n# ASC Week 1 Challenge 5 (Medium #2)\n\nCreate a function that takes a 2D array as an input, and outputs anot...
[{"input": "[[2, 3, 9, 10, 7], [12, 6, 89, 45, 3], [9, 12, 56, 10, 34], [67, 23, 1, 88, 34]]", "output": "[[22.5, 11, 38.75, 38.25, 19.5]]", "fn_name": "avg_array"}, {"input": "[[1.2, 8.521, 0.4, 3.14, 1.9], [2, 4.5, 3.75, 0.987, 1.0]]", "output": "[[1.6, 6.5105, 2.075, 2.0635, 1.45]]", "fn_name": "avg_array"}, {"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\nA company has N members, who are assigned ID numbers 1, ..., N.\nEvery member, except the member numbered 1, ...
[{"input": "10\n1 1 1 1 1 1 1 1 1\n", "output": "9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n"}, {"input": "10\n1 1 1 1 1 2 1 1 1", "output": "8\n1\n0\n0\n0\n0\n0\n0\n0\n0\n"}, {"input": "10\n1 1 1 2 1 2 1 1 1", "output": "7\n2\n0\n0\n0\n0\n0\n0\n0\n0\n"}, {"input": "10\n1 1 1 2 1 2 1 1 2", "output": "6\n3\n0\n0\n0\n0\n0\n0\n0\n0\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\nPetya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representat...
[{"input": "1000000000 1000000000\n", "output": "1022"}, {"input": "852355975 1000000000\n", "output": "1022\n"}, {"input": "444747744 1000000000\n", "output": "554"}, {"input": "70407598 1000000000\n", "output": "382\n"}, {"input": "77777779 1000000000\n", "output": "508"}, {"input": "1577407 95554455\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\nSean is trying to save a large file to a USB flash drive. He has n USB flash drives with capacities equal to ...
[{"input": "100\n32630\n548\n21\n756\n138\n56\n719\n97\n140\n599\n531\n464\n137\n737\n239\n626\n179\n170\n271\n335\n178\n298\n597\n616\n104\n190\n216\n333\n606\n621\n310\n70\n286\n593\n655\n472\n556\n77\n625\n744\n395\n487\n762\n316\n469\n258\n475\n596\n651\n180\n737\n101\n511\n708\n163\n713\n475\n557\n649\n705\n583\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\nLittle walrus Fangy loves math very much. That's why when he is bored he plays with a number performing some ...
[{"input": "1000101100110000000001111010110000000010001001111110011011000011101011001001010010111\n", "output": "133\n"}, {"input": "1000101100100000000001111010110000000010001001111110011011000011101011001001010010111\n", "output": "134\n"}, {"input": "100010110010000000000111101010000000001000100111111001101100001110...
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 got an undirected graph, consisting of n vertices and m edges. We will consider the graph's vertices n...
[{"input": "50 47\n21 17 47 15 50 47 47 41 28 18 27 47 29 28 32 26 16 26 8 22 27 10 45 21 17 30 31 38 14 8 9 40 29 35 41 24 22 14 40 46 44 34 40 31 48 40 8 50 1 28\n10 5\n34 2\n42 5\n36 28\n8 44\n36 3\n40 15\n33 18\n5 50\n1 6\n25 20\n39 24\n45 35\n14 27\n14 39\n17 47\n19 49\n28 10\n7 13\n34 3\n22 26\n5 6\n8 17\n32 18\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\nRecently Adaltik discovered japanese crosswords. Japanese crossword is a picture, represented as a table size...
[{"input": "100\nWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWB\n", "output": "50\n1 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 "}, {"input": "100\nWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBW...
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 positive integers A and B.\nIf A is a divisor of B, print A + B; otherwise, print B - A.\n\n---...
[{"input": "10 111", "output": "101\n"}, {"input": "110 40", "output": "-70\n"}, {"input": "111 40", "output": "-71\n"}, {"input": "111 62", "output": "-49\n"}, {"input": "111 68", "output": "-43\n"}, {"input": "101 68", "output": "-33\n"}, {"input": "111 90", "output": "-21\n"}, {"input": "20 20\n", "output": "40\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\nPositive integer $x$ is called divisor of positive integer $y$, if $y$ is divisible by $x$ without remainder....
[{"input": "2\n14\n100\n", "output": "527\n21311\n"}, {"input": "2\n14\n110\n", "output": "527\n25199\n"}, {"input": "2\n14\n111\n", "output": "527\n25651\n"}, {"input": "2\n60\n25\n", "output": "7747\n1711\n"}, {"input": "2\n22\n29\n", "output": "1081\n1891\n"}, {"input": "2\n40\n31\n", "output": "3403\n2627\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\nFor the New Year, Polycarp decided to send postcards to all his $n$ friends. He wants to make postcards with ...
[{"input": "16\n8192 8192 67108864\n8192 8192 67108865\n8192 8192 70000000\n8192 8192 67108863\n1 1 1\n13 13 1\n1000 1000 100\n100 15 16\n157 185 95\n1992 1895 12\n1888 4984 164\n1564 8917 15\n150 15 2\n1500 10 40\n1 10000 1000\n1 10000 10000\n", "output": "YES\nNO\nNO\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nYES\nNO\nYES\nNO\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 a grid with infinitely many rows and columns. In this grid, there is a rectangular region with conse...
[{"input": "1495 932", "output": "1388490\n"}, {"input": "582 1592", "output": "922200\n"}, {"input": "1018 932", "output": "944880\n"}, {"input": "1018 374", "output": "377952\n"}, {"input": "314 1692", "output": "527280\n"}, {"input": "218 1592", "output": "343440\n"}, {"input": "582 1178", "output": "682080\n"}, {"i...
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\n\"Ritsumeikan University Competitive Programming Camp\" will be held this year as well. I am very ...
[{"input": "1234 5 4 789012345678901234 5 6", "output": "1357101234567708000\n"}, {"input": "2017 4 2 789012345678901234 5 6", "output": "1357101234567706652\n"}, {"input": "2684 2 6 699116447311015755 5 1", "output": "1202480289374942482\n"}, {"input": "2152 4 2 789012345678901234 5 6", "output": "1357101234567706421\...
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\nSereja has two sequences a and b and number p. Sequence a consists of n integers a1, a2, ..., an. Similarly, ...
[{"input": "82 50 1\n4 2 2 4 4 3 2 2 3 3 4 3 4 1 4 1 4 3 5 3 4 2 4 4 5 2 5 4 2 4 2 5 3 2 3 4 2 5 4 3 3 4 3 4 1 1 5 2 4 1 3 3 2 4 1 2 2 5 4 4 5 3 3 1 2 3 4 5 3 1 2 3 3 5 5 2 4 1 4 2 3 1\n4 3 3 3 4 1 4 4 5 5 5 2 5 4 1 2 2 1 3 3 3 3 2 5 3 2 4 3 2 2 4 4 4 3 4 2 1 2 3 2 1 1 5 2 3 5 4 5 3 4\n", "output": "2\n24 28 "}, {"inpu...
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\nLittle Vlad is fond of popular computer game Bota-2. Recently, the developers announced the new add-on named ...
[{"input": "100\n955 479 355 759 257 497 690 598 275 446 439 787 257 326 584 713 322 5 253 781 434 307 164 154 241 381 38 942 771 906 240 11 431 478 628 1892 346 74 493 964 455 1105 950 41 585 549 892 687 264 41 487 676 63 453 861 980 620 844 80 907 285 506 772 748 773 743 44 925 529 685 845 313 419 504 770 324 2 559 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\nGregor is learning about RSA cryptography, and although he doesn't understand how RSA works, he is now fascin...
[{"input": "5\n5\n11\n11\n13\n19\n", "output": "2 4\n2 10\n2 10\n2 12\n2 18\n"}, {"input": "5\n5\n7\n11\n13\n19\n", "output": "2 4\n2 6\n2 10\n2 12\n2 18\n"}, {"input": "5\n5\n7\n11\n13\n19\n", "output": "2 4\n2 6\n2 10\n2 12\n2 18\n"}, {"input": "5\n5\n7\n13\n13\n19\n", "output": "2 4\n2 6\n2 12\n2 12\n2 18\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\nThis is a hard version of the problem. The actual problems are different, but the easy version is almost a su...
[{"input": "500\nhvmmnbwnblqfvwwrcbzkccvcdrhoxbvzwkopagpwntjwwqppduunnenopvyjumjotgcnkoorjcbzctddppezypklfhmxcmufnhcuwxhzbpumlevwdufpyasriaupqdjhpccvtxwqkjseqpsatgbkihgteuclmpaamloxpbtbxhekgpbjvndelmrenhtotvuaymrzpyhmlaujjttwrrlamijsxyegcwagncdscpbvprkwgpwdikdsbqrpkecilprocbyzsupmanekspjzoebjqvmjxjggleinlhipqtbxduimcol...
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\nBleatrix Trotter the sheep has devised a strategy that helps her fall asleep faster. First, she picks a numbe...
[{"input": "1250000", "output": "[90000000]", "fn_name": "trotter"}, {"input": "459923", "output": "[4139307]", "fn_name": "trotter"}, {"input": "691520", "output": "[2074560]", "fn_name": "trotter"}, {"input": "163444", "output": "[653776]", "fn_name": "trotter"}, {"input": "206929", "output": "[620787]", "fn_name": "...
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\nLet's define a split of $n$ as a nonincreasing sequence of positive integers, the sum of which is $n$. \n\nFo...
[{"input": "1000000000\n", "output": "500000001\n"}, {"input": "1000000000\n", "output": "500000001\n"}, {"input": "1223796969\n", "output": "611898485\n"}, {"input": "1074371686\n", "output": "537185844\n"}, {"input": "1141423649\n", "output": "570711825\n"}, {"input": "1000100000\n", "output": "500050001\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\nIn this Kata, you will be given two numbers, n and k and your task will be to return the k-digit array that s...
[{"input": "276\n12", "output": "[[3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 78]]", "fn_name": "solve"}, {"input": "24\n6", "output": "[[1, 2, 3, 4, 5, 9]]", "fn_name": "solve"}, {"input": "24\n5", "output": "[[1, 2, 3, 4, 14]]", "fn_name": "solve"}, {"input": "18\n5", "output": "[[1, 2, 3, 4, 8]]", "fn_name": "solve"},...
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\nWe have two indistinguishable pieces placed on a number line. Both pieces are initially at coordinate 0. (The...
[{"input": "1010000 100000 200000", "output": "489638142\n"}, {"input": "1010000 100001 200000", "output": "645079609\n"}, {"input": "1011000 100001 200000", "output": "150445035\n"}, {"input": "1011001 100001 200000", "output": "160610610\n"}, {"input": "1000000 110000 200000", "output": "385341624\n"}, {"input": "101...
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 Anton found a box with digits in his room. There are k_2 digits 2, k_3 digits 3, k_5 digits 5 and k_...
[{"input": "5000000 5000000 5000000 5000000\n", "output": "1280000000\n"}, {"input": "4759823 3520376 4743363 4743363\n", "output": "1214827648\n"}, {"input": "4759823 3520376 4743363 4743363\n", "output": "1214827648\n"}, {"input": "5000000 5000000 5000000 5000000\n", "output": "1280000000\n"}, {"input": "4288078 3520...
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\nPolycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save...
[{"input": "100\nggogogoooggogooggoggogggggogoogoggooooggooggoooggogoooggoggoogggoogoggogggoooggoggoggogggogoogggoooo\n", "output": "gg***oogg***oggoggoggggg******ggooooggooggooogg***ooggoggoogggo***ggogggoooggoggoggoggg***ogggoooo\n"}, {"input": "100\nggogogoooggogooggoggogggggogoogoggooooggooggoooggogoooggoggoogggoog...
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 Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west...
[{"input": "10 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", "output": "7\n9\n10\n6\n8\n9\n6\n7\n8\n10\n"}, {"input": "10 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 10\n3 10\n3 8\n3 9\n3 10\n1 10", "output": "7\...
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\nInternational Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receiv...
[{"input": "9\nIAO'0\nIAO'00\nIAO'000\nIAO'0000\nIAO'00000\nIAO'000000\nIAO'0000000\nIAO'00000000\nIAO'000000000\n", "output": "1990\n2000\n3000\n10000\n100000\n1000000\n10000000\n100000000\n1000000000\n"}, {"input": "9\nIAO'0\nIAO'00\nIAO'000\nIAO'0000\nIAO'00000\nIAO'000000\nIAO'0000000\nIAO'00000000\nIAO'000000000\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\nAndrew skipped lessons on the subject 'Algorithms and Data Structures' for the entire term. When he came to t...
[{"input": "100\n0 1 1 1 0 0 0 2 1 2 2 1 2 2 2 0 0 2 1 2 0 1 1 0 2 0 1 2 2 0 2 0 1 0 1 2 0 2 1 1 0 1 0 1 0 0 0 2 2 2 2 1 1 1 0 2 1 0 0 0 0 0 1 0 2 -1 1 0 0 2 0 2 2 1 0 2 2 0 2 0 2 1 2 1 1 1 0 2 1 0 2 1 1 2 1 2 0 1 2 2\n", "output": "36 30 38 35 35 33 34 31 28 22 22 23 19 16 19 20 22 23 24 25 25 26 26 27 26 26 26 26 25 ...
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 two boards, each divided into a grid with N rows and N columns. For both of these boards, the squar...
[{"input": "5\nabcde\nfghij\nklmno\npqrst\nuvvxy", "output": "0\n"}, {"input": "5\nabcde\nfghij\nonmlk\npqrst\nuvwxy", "output": "0\n"}, {"input": "5\nedcba\nfghij\nonmlk\npqrst\nuvwxy", "output": "0\n"}, {"input": "5\nedcba\njihgf\nonmlk\npqrst\nuvwxy", "output": "0\n"}, {"input": "5\nedcba\njihfg\nonmlk\npqrst\nuvwxy...
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 mathematics, a **pandigital number** is a number that in a given base has among its significant digits eac...
[{"input": "-9999999999\n25", "output": "[[1023456789, 1023456798, 1023456879, 1023456897, 1023456978, 1023456987, 1023457689, 1023457698, 1023457869, 1023457896, 1023457968, 1023457986, 1023458679, 1023458697, 1023458769, 1023458796, 1023458967, 1023458976, 1023459678, 1023459687, 1023459768, 1023459786, 1023459867, 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\nThere is a card game called \"Durak\", which means \"Fool\" in Russian. The game is quite popular in the coun...
[{"input": "D\n9S 8S\n", "output": "YES\n"}, {"input": "H\nTH 8H\n", "output": "YES\n"}, {"input": "H\nAH KH\n", "output": "YES\n"}, {"input": "H\nAD KD\n", "output": "YES\n"}, {"input": "H\nAC QC\n", "output": "YES\n"}, {"input": "H\n7D 6D\n", "output": "YES\n"}, {"input": "H\nJS TS\n", "output": "YES\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\nWrite a program to check whether a triangle is valid or not, when the three angles of the triangle are the in...
[{"input": "3 \n30 40 110\n45 45 90\n180 0 0", "output": "YES\nYES\nNO\n"}, {"input": "3 \n30 40 110\n12 45 90\n180 0 0", "output": "YES\nNO\nNO\n"}, {"input": "3 \n30 77 110\n45 45 90\n180 0 0", "output": "NO\nYES\nNO\n"}, {"input": "3 \n30 40 110\n12 56 90\n180 0 0", "output": "YES\nNO\nNO\n"}, {"input": "3 \n30 77 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\nBoboniu likes bit operations. He wants to play a game with you.\n\nBoboniu gives you two sequences of non-neg...
[{"input": "30 55\n194 478 207 22 344 507 374 462 107 506 317 299 326 308 459 396 330 317 138 342 126 473 423 180 41 165 435 72 53 71\n44 229 106 350 420 462 412 115 452 364 452 294 280 171 325 250 94 266 33 329 197 384 50 36 495 464 67 283 83 3 335 62 101 307 474 296 484 388 315 444 203 304 110 97 70 169 170 369 384 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\nYou are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can ...
[{"input": "123456789987654321 987654321123456789 999999999 1000000000\n", "output": "864197529407407405\n"}, {"input": "314159265358979323 846264338327950288 419716939 937510582\n", "output": "532105071133627368\n"}, {"input": "827191816666888190 908822776155224411 1000000000 300000000\n", "output": "81630959161812384...
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\nThor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this pho...
[{"input": "10 85\n2 2\n1 10\n1 1\n2 6\n1 2\n1 4\n1 7\n2 1\n1 1\n3 3\n1 9\n1 6\n1 8\n1 10\n1 8\n2 8\n1 6\n1 3\n1 9\n1 6\n1 3\n1 8\n1 1\n1 6\n1 10\n2 1\n2 10\n1 10\n1 1\n1 10\n1 6\n1 2\n1 8\n1 3\n1 4\n1 9\n1 5\n1 5\n2 2\n2 4\n1 7\n1 1\n2 4\n1 9\n2 1\n1 7\n1 8\n3 33\n1 10\n2 2\n1 3\n1 10\n1 6\n3 32\n2 3\n1 5\n2 10\n2 2\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\nBerland State University has received a new update for the operating system. Initially it is installed only o...
[{"input": "13\n576460752303423486 576460752303423486\n576460752303423487 576460752303423487\n576460752303423488 576460752303423488\n576460752303423489 576460752303423489\n576460752303423490 576460752303423490\n576460752303423488 288230376151711743\n576460752303423488 288230376151711744\n576460752303423488 288230376151...
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\nLong long ago, there was a thief. Looking for treasures, he was running about all over the world. One day, he...
[{"input": "3\n2 5\n-1 13\n2 2\n3\n2 0\n3 6\n2 3\n0", "output": "Yes\nNo\n"}, {"input": "3\n3 5\n-1 13\n2 2\n3\n2 0\n3 6\n2 3\n0", "output": "Yes\nNo\n"}, {"input": "3\n2 5\n0 8\n2 2\n3\n2 -1\n3 10\n2 2\n0", "output": "Yes\nNo\n"}, {"input": "3\n2 4\n0 8\n2 2\n3\n2 -1\n3 10\n2 2\n0", "output": "Yes\nNo\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\nYou are given two arrays $a$ and $b$ of positive integers, with length $n$ and $m$ respectively. \n\nLet $c$ ...
[{"input": "235 1\n1 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 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_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 stardate is 1977 and the science and art of detecting Death Stars is in its infancy. Princess Heidi has r...
[{"input": "10\nXXXOOOOXOX\nOOOXXXOXXO\nXOXXXXOOXX\nXOOOXXOXOO\nOOXOOOOOOX\nXXXXOXOOOO\nXXXOOXOXOX\nOOOOXOXOXX\nXOXXOXOOXO\nOOOOOXOOOO\nXXXOOOOXOX\nOOOXXXOXXO\nXOXXXXOOXX\nXOOOXXOXOO\nOOXOOOOOOX\nXXXXOXOOOO\nXXXOOXOXOX\nOOOOXOXOXX\nXOXXOXOOXO\nOOOOOXOOOO\n", "output": "Yes\n"}, {"input": "10\nXXOXXOXOOX\nOOOOXOOXXO\nOX...
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\nVasya lives in a round building, whose entrances are numbered sequentially by integers from 1 to n. Entrance ...
[{"input": "100 37 -100\n", "output": "37\n"}, {"input": "100 37 -100\n", "output": "37\n"}, {"input": "100 37 -124\n", "output": "13\n"}, {"input": "145 38 106\n", "output": "144\n"}, {"input": "100 54 100\n", "output": "54\n"}, {"input": "100 54 100\n", "output": "54\n"}, {"input": "100 54 101\n", "output": "55\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\nTwo deer, AtCoDeer and TopCoDeer, are playing a game called Honest or Dishonest.\nIn this game, an honest pla...
[{"input": "H H\n", "output": "H\n"}, {"input": "D H\n", "output": "D\n"}, {"input": "D D\n", "output": "H\n"}, {"input": "H 14", "output": "D\n"}, {"input": "H 15", "output": "D\n"}, {"input": "H 23", "output": "D\n"}, {"input": "H 17", "output": "D\n"}, {"input": "H 13", "output": "D\n"}, {"input": "H 12", "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\nIf we write out the digits of \"60\" as English words we get \"sixzero\"; the number of letters in \"sixzero\...
[{"input": "999", "output": "[[\"nineninenine\", \"onetwo\", \"six\", \"three\", \"five\", \"four\"]]", "fn_name": "numbers_of_letters"}, {"input": "311", "output": "[[\"threeoneone\", \"oneone\", \"six\", \"three\", \"five\", \"four\"]]", "fn_name": "numbers_of_letters"}, {"input": "37", "output": "[[\"threeseven\", \...
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 given N non-negative integers A_1, A_2, ..., A_N and another non-negative integer K.\nFor a integer X...
[{"input": "1 0\n1000000000000\n", "output": "1000000000000\n"}, {"input": "4 9\n7 4 0 3\n", "output": "46\n"}, {"input": "3 7\n1 6 3\n", "output": "14\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 are given an array $a$ consisting of $n$ integers $a_1, a_2, \\dots , a_n$.\n\nIn one operation you can c...
[{"input": "2\n5\n3 1 10 4 1\n7\n1 0 1 1 1 2 2\n", "output": "2\n3\n"}, {"input": "2\n5\n3 1 10 5 1\n7\n1 0 1 1 1 2 2\n", "output": "2\n3\n"}, {"input": "2\n5\n3 1 10 5 1\n7\n1 0 1 1 1 2 4\n", "output": "2\n3\n"}, {"input": "2\n5\n3 1 10 5 1\n7\n1 0 1 1 0 2 4\n", "output": "2\n4\n"}, {"input": "2\n5\n3 1 10 5 1\n7\n1 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\nTwo players play a simple game. Each player is provided with a box with balls. First player's box contains ex...
[{"input": "50 50 50 50\n", "output": "Second\n"}, {"input": "48 50 12 11\n", "output": "Second\n"}, {"input": "49 50 11 12\n", "output": "Second\n"}, {"input": "50 50 50 50\n", "output": "Second\n"}, {"input": "48 50 12 11\n", "output": "Second\n"}, {"input": "49 50 11 12\n", "output": "Second\n"}, {"input": "50 50 87...
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 in a warehouse and $n$ packages he wants to collect. The warehouse can be represented as a c...
[{"input": "3\n5\n1 3\n1 2\n3 3\n5 5\n4 3\n2\n1 0\n0 1\n1\n4 3\n", "output": "YES\nRUUURRRRUU\nNO\nYES\nRRRRUUU\n"}, {"input": "3\n5\n1 3\n1 2\n3 3\n5 5\n2 3\n2\n1 0\n0 1\n1\n4 3\n", "output": "YES\nRUUURRRRUU\nNO\nYES\nRRRRUUU\n"}, {"input": "3\n5\n1 3\n1 0\n3 3\n5 5\n4 3\n2\n1 0\n0 1\n1\n4 3\n", "output": "YES\nRUUUR...
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\nOn the competitive programming platform CodeCook, every person has a rating graph described by an array of in...
[{"input": "5\n5\n1 5 3 4 2\n4\n1 3 2 1\n5\n1 3 3 3 1\n10\n1 2 3 4 5 10 7 8 9 10\n3\n3 3 2\n", "output": "10111\n0001\n00001\n0000011111\n000\n"}, {"input": "5\n5\n2 5 3 4 2\n4\n1 3 2 1\n5\n1 3 3 3 2\n10\n1 1 1 4 10 6 2 8 9 10\n3\n3 3 2\n", "output": "00000\n0001\n00111\n0000000001\n000\n"}, {"input": "5\n5\n1 5 3 4 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\nATMs of a well-known bank of a small country are arranged so that they can not give any amount of money reque...
[{"input": "58 5\n1 6 9 18 34 41 82 99 164 179 183 204 240 396 636 1224 2023 2856 4488 4705 5712 9180 9266 18360 18850 20270 23086 60810 190701 197064 211140 214200 222970 243240 263510 314442 425670 486480 708288 789888 1009800 1025349 1054040 1094580 1325184 1579776 1748076 2050698 2635100 2895984 2918880 3975552 428...
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\nIs it rated?\n\nHere it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And...
[{"input": "10\n4078 4078\n2876 2876\n1061 1061\n3721 3721\n143 143\n2992 2992\n3279 3279\n3389 3389\n1702 1702\n1110 1110\n", "output": "unrated\n"}, {"input": "10\n4078 4078\n2876 2876\n1061 1061\n3721 3721\n143 143\n2992 2992\n3279 3279\n3389 3389\n1702 1702\n1110 1110\n", "output": "unrated\n"}, {"input": "10\n4078...
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##Overview\n\nWrite a helper function that takes in a Time object and converts it to a more human-readable fo...
[{"input": "10000000", "output": "[\"16 weeks ago\"]", "fn_name": "to_pretty"}, {"input": "40000", "output": "[\"11 hours ago\"]", "fn_name": "to_pretty"}, {"input": "1000000", "output": "[\"a week ago\"]", "fn_name": "to_pretty"}, {"input": "30", "output": "[\"30 seconds ago\"]", "fn_name": "to_pretty"}, {"input": "18...
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\nMikhail walks on a Cartesian plane. He starts at the point $(0, 0)$, and in one move he can go to any of eigh...
[{"input": "3\n7 0 0\n3 1 0\n22 0 2\n", "output": "-1\n-1\n-1\n"}, {"input": "3\n1 1 1\n9 -1 5\n35 0 1\n", "output": "1\n-1\n-1\n"}, {"input": "3\n2 2 3\n6 2 18\n10 0 1\n", "output": "1\n18\n-1\n"}, {"input": "3\n1 0 1\n9 -1 5\n35 0 1\n", "output": "0\n-1\n-1\n"}, {"input": "3\n1 0 1\n9 0 5\n35 -1 1\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\nLet $s$ be some string consisting of symbols \"0\" or \"1\". Let's call a string $t$ a substring of string $s...
[{"input": "99985 45273\n", "output": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
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 creating a level for a video game. The level consists of $n$ rooms placed in a circle. The rooms are ...
[{"input": "50\n499 1400 1621 123 72 526 944 482 862 136 265 605 5 616 974 967 713 187 969 467 573 845 71 224 17 873 648 120 239 1722 438 574 404 129 899 583 632 314 525 496 443 857 241 78 575 2 430 137 387 911\n", "output": "459200194 19968654 978281891 778632355 119790684 519088159 339403985 279509183 259544188 47915...
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\nAyoub thinks that he is a very smart person, so he created a function $f(s)$, where $s$ is a binary string (a...
[{"input": "5\n6 4\n5 2\n3 2\n2 1\n10 2\n", "output": "19\n12\n5\n2\n40\n"}, {"input": "5\n6 4\n5 2\n4 2\n2 1\n10 2\n", "output": "19\n12\n8\n2\n40\n"}, {"input": "5\n6 1\n0 0\n5 0\n16 1\n8 1\n", "output": "12\n0\n0\n72\n20\n"}, {"input": "5\n6 4\n5 2\n4 2\n2 2\n10 2\n", "output": "19\n12\n8\n3\n40\n"}, {"input": "5\n6...
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 and B are preparing themselves for programming contests.\n\nTo train their logical thinking and solve probl...
[{"input": "...QK...\n........\n........\n........\n........\n........\n........\n...rk...\n", "output": "White\n"}, {"input": "rppppppr\n...k....\n........\n........\n........\n........\nK...Q...\n........\n", "output": "Black\n"}, {"input": "....bQ.K\n.B......\n.....P..\n........\n........\n........\n...N.P..\n.....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\nWe have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two intege...
[{"input": "10 8\n10 3 6 8 7 10 9 1 2 4\n2 1\n4 1\n5 9\n4 2\n6 2\n3 5\n8 9\n7 9", "output": "2\n"}, {"input": "10 8\n10 3 6 8 7 10 9 1 2 4\n2 1\n3 1\n5 9\n4 2\n6 2\n3 5\n8 9\n7 9", "output": "7\n"}, {"input": "10 8\n10 3 6 8 7 10 9 1 2 4\n2 1\n4 1\n5 9\n4 2\n6 1\n3 5\n8 9\n7 9", "output": "2\n"}, {"input": "10 8\n5 3 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\nTheater stage is a rectangular field of size n Γ— m. The director gave you the stage's plan which actors will ...
[{"input": "10 20\n0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n0 1 1 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\nOne day, little Vasya found himself in a maze consisting of (n + 1) rooms, numbered from 1 to (n + 1). Initia...
[{"input": "129\n1 1 3 3 1 3 7 4 3 5 8 11 3 9 15 4 11 15 1 6 18 9 11 13 17 22 8 18 26 13 16 20 3 16 35 26 23 28 27 30 39 29 43 8 14 6 17 32 26 31 2 18 3 47 52 21 57 1 35 35 53 47 16 26 30 65 48 2 1 11 10 5 4 1 4 53 71 21 53 8 58 49 17 6 19 80 1 49 43 60 12 60 35 25 86 45 47 97 69 74 10 91 93 31 69 41 80 90 67 4 111 100...
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\nTarly has two different type of items, food boxes and wine barrels. There are f food boxes and w wine barrels...
[{"input": "100000 100000 10000\n", "output": "308343288\n"}, {"input": "100000 100000 10000\n", "output": "308343288\n"}, {"input": "100000 100000 1000\n", "output": "402115033\n"}, {"input": "100000 100000 1000\n", "output": "402115033\n"}, {"input": "100000 100000 1001\n", "output": "500272705\n"}, {"input": "100000...
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 Russian here \nChef has a special affection for sets of binary strings of equal l...
[{"input": "1\n57 0 -2", "output": "000000000000000000000000000000000000000000000000000000000\n"}, {"input": "1\n51 2 0", "output": "000000000000000000000000000000000000000000000000000\n"}, {"input": "1\n51 2 1", "output": "000000000000000000000000000000000000000000000000011\n"}, {"input": "1\n43 0 -2", "output": "0000...
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 and your $n - 1$ friends have found an array of integers $a_1, a_2, \\dots, a_n$. You have decided to sha...
[{"input": "4\n6 3 2\n4 16 1 3 8 5\n4 4 1\n2 13 60 4\n4 2 3\n1 -1 2 2\n2 2 0\n2 2\n", "output": "16\n4\n2\n2\n"}, {"input": "4\n6 3 2\n2 9 2 3 10 5\n4 4 1\n2 13 60 4\n4 2 3\n1 2 2 1\n2 2 0\n1 2\n", "output": "10\n4\n2\n1\n"}, {"input": "4\n6 3 2\n2 9 2 3 10 5\n4 4 1\n2 13 60 4\n4 3 3\n1 2 2 1\n2 2 0\n2 2\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\nConsider an infinite sequence a_1, a_2, … Initially, the values of all the terms are 0, and from this state w...
[{"input": "5\n56 114834\n72 -134386\n100 190757\n192 -132693\n240 133108", "output": "438699\n"}, {"input": "5\n56 114834\n72 -134386\n100 190757\n192 -132693\n240 261716", "output": "567307\n"}, {"input": "5\n92 114834\n125 -176641\n100 13125\n192 -68478\n240 133108", "output": "261067\n"}, {"input": "5\n42 114834\n1...
code_stdio