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\nGiven some positive integers, I wish to print the integers such that all take up the same width by adding a m...
[{"input": "1\n12\n34", "output": "[\"01\\n12\\n34\"]", "fn_name": "print_nums"}, {"input": "1009\n2", "output": "[\"1009\\n0002\"]", "fn_name": "print_nums"}, {"input": "1\n1\n13", "output": "[\"01\\n01\\n13\"]", "fn_name": "print_nums"}, {"input": "1\n8\n27", "output": "[\"01\\n08\\n27\"]", "fn_name": "print_nums"}, ...
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\"Contestant who earns a score equal to or greater than the k-th place finisher's score will advance to the n...
[{"input": "50 44\n100 100 99 97 95 91 91 84 83 83 79 71 70 69 69 62 61 60 59 59 58 102 58 55 55 54 52 48 47 45 44 44 38 36 38 31 28 28 25 25 24 24 24 22 17 15 14 13 12 4\n", "output": "44\n"}, {"input": "50 44\n100 100 99 97 95 91 91 84 83 83 79 71 70 69 69 62 61 60 59 59 58 58 58 55 55 54 52 48 47 45 44 44 38 36 32 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\nEverything got unclear to us in a far away constellation Tau Ceti. Specifically, the Taucetians choose names ...
[{"input": "abbabaaabaaabbbbabbbbbababababaaaabbabbbbabbbbbabbbbababbaaaaabbbabbbbabbbbbbabaabababaabbbabababbaz\nabaaabaabbbbaabbbbaabababbaabaabababbbaabbbaaabbabbabbbbbbbbaabbbbbabababbbbaaabaaaabbbbbbbbabababba\n", "output": "abaaabaabbbbaabbbbaabababbaabaabababbbaabbbaaabbabbabbbbbbbbaabbbbbabababbbbaaabaaaabbbbbb...
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\nIncreasing E869120 (Ninja E869120)\n\nE869120 You are good at alter ego.\n\nHere are $ N $ members of the PA ...
[{"input": "5\nE869120\nTMJN\nE869120\nASIAT\nYNYMXIAOLONGBAO", "output": "2\n"}, {"input": "5\nE869120\nTMJN\nE809126\nATIAT\nYNYMXIAOGONLBAO", "output": "1\n"}, {"input": "5\nE86912/\nTMJN\n621908E\nIATSA\nYNYMXIBOGONLBAO", "output": "0\n"}, {"input": "5\nE869120\nTMJN\nE869120\nASIAT\nYNYMXIAOGONLBAO", "output": "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\nYou are given a tree (an undirected connected graph without cycles) and an integer s.\n\nVanya wants to put w...
[{"input": "3 1000000000\n3 2\n2 1\n", "output": "1000000000.0000000000\n"}, {"input": "2 1000000000\n2 1\n", "output": "1000000000.0000000000\n"}, {"input": "6 1\n2 1\n4 3\n2 5\n5 4\n5 6\n", "output": "0.6666666667\n"}, {"input": "6 1\n2 1\n2 3\n2 5\n2 4\n5 6\n", "output": "0.5000000000\n"}, {"input": "6 2\n2 1\n4 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\nproblem\n\nJOI City will hold a large-scale exposition.\n\nThere are two themes for this exposition, and each...
[{"input": "5\n-9 -11\n1 0\n2 -1\n-22 -1\n-37 -2", "output": "21\n"}, {"input": "5\n-1 -1\n23 2\n4 -11\n-25 -1\n-1 -1", "output": "32\n"}, {"input": "5\n-1 -1\n23 2\n7 -11\n-25 0\n-1 -1", "output": "29\n"}, {"input": "5\n-1 -1\n39 2\n7 -11\n-25 0\n-1 -1", "output": "43\n"}, {"input": "5\n-2 -1\n39 2\n19 -22\n-7 0\n-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\nIn mathematics, a [Diophantine equation](https://en.wikipedia.org/wiki/Diophantine_equation) is a polynomial ...
[{"input": "900000012", "output": "[[[225000004, 112500001], [75000004, 37499999], [3358276, 1679071], [1119604, 559601]]]", "fn_name": "sol_equa"}, {"input": "90000001", "output": "[[[45000001, 22500000], [6428575, 3214284], [3461545, 1730766], [494551, 247230]]]", "fn_name": "sol_equa"}, {"input": "90009", "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\nRead problems statements in Mandarin Chinese and Russian. \n\nToday is Chef's birthday. His mom gifted him a...
[{"input": "2\n0 2\n1 3\n11 -1\n2", "output": "Chef\nChef\n"}, {"input": "2\n0 2\n0 3\n11 -1\n2", "output": "Chef\nChef\n"}, {"input": "2\n0 2\n0 3\n11 -2\n2", "output": "Chef\nChef\n"}, {"input": "2\n3 2\n1 4\n13 1\n1", "output": "Chef\nChef\n"}, {"input": "2\n3 2\n1 4\n25 1\n1", "output": "Chef\nChef\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\nFind the largest square number not exceeding N. Here, a square number is an integer that can be represented a...
[{"input": "1205711547", "output": "1205686729\n"}, {"input": "1258489257", "output": "1258475625\n"}, {"input": "1044195797", "output": "1044194596\n"}, {"input": "271828182\n", "output": "271821169\n"}, {"input": "115087508", "output": "115068529\n"}, {"input": "167542739", "output": "167521249\n"}, {"input": "317532...
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$ of length $n$ consisting of characters a and/or b.\n\nLet $\\operatorname{AB}(s)$ ...
[{"input": "1\naaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbab\n", "output": "baaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbab\n"}, {"input": "1\nabbabababbabababbababbbabbbbabbbabaabaabba\n", "output": "abbabababbabababbababbbabbbbabbbabaabaabba\n"}, {"input": "1\nabbabababbabababbababbbabbbbabbbabaabaabba\n", "output": "abbabab...
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\nPatrick likes to play baseball, but sometimes he will spend so many hours hitting home runs that his mind sta...
[{"input": "5\n5\n1 3 4 2 5\n4\n2 1 3 4\n5\n2 1 3 5 4\n7\n3 2 4 1 5 7 6\n6\n3 2 1 6 5 4\n", "output": "1\n1\n2\n2\n2\n"}, {"input": "5\n5\n1 3 4 2 5\n4\n2 1 3 4\n5\n2 1 3 5 4\n7\n3 2 4 1 5 7 6\n6\n3 2 1 6 5 1\n", "output": "1\n1\n2\n2\n2\n"}, {"input": "5\n5\n1 3 4 2 5\n4\n2 1 3 4\n5\n2 1 3 5 4\n7\n3 1 4 1 5 7 6\n6\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\nOne day Sasha visited the farmer 2D and his famous magnetic farm. On this farm, the crop grows due to the inf...
[{"input": "166\n61 19 19 67 11 11 73 89 73 11 47 2 59 43 61 31 19 83 71 19 29 97 89 97 2 11 5 73 19 2 19 7 41 53 5 23 11 89 2 23 47 47 83 71 17 71 67 67 43 3 29 97 17 83 11 19 67 17 97 7 19 29 29 41 13 71 29 19 19 43 47 17 71 3 13 71 41 19 47 7 29 43 29 97 31 11 43 17 23 83 37 61 79 31 17 5 59 13 67 29 29 11 43 67 89 ...
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 is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kinder...
[{"input": "37 99816\n19935 98486\n13473 97526\n12932 94864\n12400 98868\n13485 96232\n10902 93340\n10315 93206\n14926 98755\n13524 99060\n10391 94409\n14740 94040\n16968 94901\n18543 98563\n16376 96008\n16802 95903\n19742 97400\n10380 97416\n13674 91688\n16347 99505\n17541 91909\n19573 93640\n11353 96027\n10659 99302\...
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\nHappy PMP is freshman and he is learning about algorithmic problems. He enjoys playing algorithmic games a lo...
[{"input": "20\n1 12 9 6 11 13 2 8 20 7 16 19 4 18 3 15 10 17 14 5\n5 14 17 10 15 3 18 4 19 16 7 20 8 2 13 11 6 9 12 1\n", "output": "19\n"}, {"input": "10\n8 2 10 3 4 6 1 7 9 5\n8 2 10 3 4 6 1 7 9 5\n", "output": "0\n"}, {"input": "10\n2 1 10 3 7 8 5 6 9 4\n6 9 2 4 1 10 3 7 8 5\n", "output": "3\n"}, {"input": "10\n1 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\nIt’s still hot every day, but September has already come. It’s autumn according to the calendar. Looking arou...
[{"input": "-7 1028", "output": "1035\n"}, {"input": "-2 1028", "output": "1030\n"}, {"input": "-2 1094", "output": "1096\n"}, {"input": "-2 1349", "output": "1351\n"}, {"input": "-3 1349", "output": "1352\n"}, {"input": "-3 1765", "output": "1768\n"}, {"input": "-3 1569", "output": "1572\n"}, {"input": "-125 1", "outp...
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\nSummer holidays! Someone is going on trips, someone is visiting grandparents, but someone is trying to get a ...
[{"input": "50 2\n74 90\n68 33\n49 88\n52 13\n73 21\n77 63\n27 62\n8 52\n60 57\n42 83\n98 15\n79 11\n77 46\n55 91\n72 100\n70 86\n50 51\n57 39\n20 54\n64 95\n66 22\n79 64\n31 28\n11 89\n1 36\n13 4\n75 62\n16 62\n100 35\n43 96\n97 54\n86 33\n62 63\n94 24\n19 6\n20 58\n38 38\n11 76\n70 40\n44 24\n32 96\n28 100\n62 45\n41...
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\nIahub helps his grandfather at the farm. Today he must milk the cows. There are n cows sitting in a row, numb...
[{"input": "100\n1 1 0 0 1 1 1 1 0 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 1 1 1 0 0 1 0 0 1 1 0 1 1 1 1 1 1 0 0 0 0 1 1 0 0 0 0 0 1 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0 1 0 1 1 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 1 0 0 1 0 0\n", "output": "1446\n"}, {"input": "100\n1 1 0 0 1 1 1 1 0 1 1 1 0 1 1 1 0 0 0 0 0 0 1 1 0 1 0 0 0 0 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\nShichi-Go-San (literally \"Seven-Five-Three\") is a traditional event in a certain country to celebrate the g...
[{"input": "-132", "output": "NO\n"}, {"input": "-154", "output": "NO\n"}, {"input": "-133", "output": "NO\n"}, {"input": "-108", "output": "NO\n"}, {"input": "1271", "output": "NO\n"}, {"input": "5\n", "output": "YES\n"}, {"input": "3\n", "output": "YES\n"}, {"input": "7\n", "output": "YES\n"}, {"input": "-12", "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\nTwo students of AtCoder Kindergarten are fighting over candy packs.\nThere are three candy packs, each of whi...
[{"input": "10 30 20\n", "output": "Yes\n"}, {"input": "30 30 100\n", "output": "No\n"}, {"input": "56 25 31\n", "output": "Yes\n"}, {"input": "30 30 000", "output": "Yes\n"}, {"input": "106 25 31", "output": "No\n"}, {"input": "30 47 100", "output": "No\n"}, {"input": "30 26 100", "output": "No\n"}, {"input": "30 16 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\nΠšΠ°Ρ€Ρ‚Π° Π·Π²Ρ‘Π·Π΄Π½ΠΎΠ³ΠΎ Π½Π΅Π±Π° прСдставляСт собой ΠΏΡ€ΡΠΌΠΎΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΎΠ΅ ΠΏΠΎΠ»Π΅, состоящСС ΠΈΠ· n строк ΠΏΠΎ m символов Π² ΠΊΠ°ΠΆΠ΄ΠΎΠΉ строк...
[{"input": "7 10\n..........\n......*...\n....**..*.\n...**.....\n...*......\n..........\n..**.*....\n", "output": "7\n"}, {"input": "3 9\n.........\n......*..\n.........\n", "output": "1\n"}, {"input": "5 5\n....*\n....*\n....*\n..*..\n..*.*\n", "output": "5\n"}, {"input": "5 5\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\nComplete the function which returns the weekday according to the input number:\n\n* `1` returns `\"Sunday\"`\...
[{"input": "20", "output": "[\"Wrong, please enter a number between 1 and 7\"]", "fn_name": "whatday"}, {"input": "0", "output": "[\"Wrong, please enter a number between 1 and 7\"]", "fn_name": "whatday"}, {"input": "8", "output": "[\"Wrong, please enter a number between 1 and 7\"]", "fn_name": "whatday"}, {"input": "4...
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 a member of the space station engineering team, and are assigned a task in the construction process o...
[{"input": "3\n10.428063836405636 10.000 50.41258054211165 10.000\n40.000 10.67607738240928 53.01420883969367 10.791354692497457\n40.998260752412115 40.51646067399203 50.343828752057796 10.89540561727416\n2\n30.571866538226903 30.21421585553614 30.992025805702255 20.557461946050214\n40.000 40.897526923182255 40.8505801...
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 given two numbers your mission is to derive a function that evaluates whether two given numbers are **a...
[{"input": "220221\n282224", "output": "[\"deficient abundant not amicable\"]", "fn_name": "deficiently_abundant_amicable_numbers"}, {"input": "299920\n9284", "output": "[\"abundant deficient not amicable\"]", "fn_name": "deficiently_abundant_amicable_numbers"}, {"input": "999220\n2849", "output": "[\"abundant deficien...
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\nTo give credit where credit is due: This problem was taken from the ACMICPC-Northwest Regional Programming Co...
[{"input": "\"-7715?5--484?00=-28?9?5\"", "output": "[6]", "fn_name": "solve_runes"}, {"input": "\"50685?--1?5630=652?8?\"", "output": "[4]", "fn_name": "solve_runes"}, {"input": "\"-?56373--9216=-?47157\"", "output": "[8]", "fn_name": "solve_runes"}, {"input": "\"?8?170-1?6256=7?2?14\"", "output": "[9]", "fn_name": "s...
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\nObesity is cited as the cause of many adult diseases. In the past, with a few exceptions, it was unrelated to...
[{"input": "1011,50.0,1.60\n1002,60.1,0.70\n1003,60.0,0.80\n1004,80.0,1.71\n1005,90.0,1.60", "output": "1002\n1003\n1004\n1005\n"}, {"input": "1011,50.0,1.60\n1102,60.1,0.70\n1003,60.0,0.80\n1004,80.0,1.71\n1005,80.0,1.60", "output": "1102\n1003\n1004\n1005\n"}, {"input": "1011,50.0,1.61\n1072,60.0,1.00\n1003,70.8,1.00...
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 her way to programming school tiger Dasha faced her first test β€” a huge staircase! [Image] \n\nThe steps w...
[{"input": "100 100\n", "output": "YES\n"}, {"input": "100 100\n", "output": "YES\n"}, {"input": "100 101\n", "output": "YES\n"}, {"input": "110 111\n", "output": "YES\n"}, {"input": "111 111\n", "output": "YES\n"}, {"input": "100 99\n", "output": "YES\n"}, {"input": "99 100\n", "output": "YES\n"}, {"input": "100 99\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 `n`, find two integers `a` and `b` such that:\n```Pearl\nA) a >= 0 and b >= 0\nB) a + b = n\...
[{"input": "15569047737", "output": "[144]", "fn_name": "solve"}, {"input": "2452148459", "output": "[116]", "fn_name": "solve"}, {"input": "50000000", "output": "[68]", "fn_name": "solve"}, {"input": "1140", "output": "[33]", "fn_name": "solve"}, {"input": "7019", "output": "[35]", "fn_name": "solve"}, {"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\nTakahashi is going to set a 3-character password.\nHow many possible passwords are there if each of its chara...
[{"input": "-109", "output": "-1295029\n"}, {"input": "-61", "output": "-226981\n"}, {"input": "-57", "output": "-185193\n"}, {"input": "-68", "output": "-314432\n"}, {"input": "-95", "output": "-857375\n"}, {"input": "-52", "output": "-140608\n"}, {"input": "-59", "output": "-205379\n"}, {"input": "148", "output": "32...
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\nWell, here is another math class task. In mathematics, GCD is the greatest common divisor, and it's an easy t...
[{"input": "31607 999002449\n18\n31607 31607\n31606 31608\n31607 31608\n31606 31607\n31606 31606\n31608 31608\n1 31607\n1 31606\n1 31608\n1 1000000000\n31607 1000000000\n31606 1000000000\n31608 1000000000\n1000000000 1000000000\n1 1\n2 31606\n2 31607\n2 31608\n", "output": "31607\n31607\n31607\n31607\n-1\n-1\n31607\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\nGiven a sequence of numbers a1, a2, a3, ..., an, find the maximum sum of a contiguous subsequence of those nu...
[{"input": "7\n-4\n-4\n6\n14\n15\n-8\n-14\n13\n1\n0\n3\n2\n-3\n-1\n1\n1\n5\n3\n0\n-6\n2\n3\n1100\n-200\n145\n0", "output": "35\n12\n1100\n"}, {"input": "7\n-5\n-4\n6\n8\n15\n-6\n-12\n13\n1\n2\n3\n2\n-2\n-1\n1\n1\n3\n2\n0\n-4\n2\n3\n1100\n-200\n145\n0", "output": "29\n12\n1100\n"}, {"input": "7\n-5\n-4\n6\n8\n15\n-6\n-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\nThis problem consists of three subproblems: for solving subproblem C1 you will receive 4 points, for solving ...
[{"input": "40 3\n1 62395\n5 40319\n4 165445\n10 137479\n10 47829\n8 9741\n5 148106\n10 25494\n10 162856\n2 106581\n0 194523\n9 148086\n1 100862\n6 147600\n6 107486\n6 166873\n7 16721\n4 22192\n0 8827\n1 197146\n10 8949\n0 150443\n9 148348\n3 143935\n1 139371\n7 128821\n10 107760\n4 141821\n1 35852\n9 107522\n10 54717\...
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\nBankopolis is an incredible city in which all the n crossroads are located on a straight line and numbered fr...
[{"input": "10 7\n50\n4 7 655\n7 3 220\n3 5 15\n5 10 811\n10 1 490\n1 2 800\n7 10 200\n1 5 377\n1 4 656\n6 4 432\n3 7 563\n1 8 122\n2 9 777\n3 2 157\n5 8 912\n9 8 496\n9 2 740\n3 2 201\n6 7 653\n1 7 554\n6 9 660\n3 2 622\n6 10 227\n9 1 42\n2 6 346\n2 7 944\n3 10 654\n5 2 501\n1 6 786\n3 8 306\n6 1 998\n6 2 581\n10 1 84...
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 has an array $a$ consisting of $n$ integers. He wants to remove duplicate (equal) elements.\n\nPetya wa...
[{"input": "48\n992 995 992 991 994 992 995 999 996 993 999 995 993 992 1000 992 568 996 991 993 992 998 998 998 999 995 992 992 993 992 992 995 996 995 997 991 997 991 999 994 994 997 1000 32 1000 992 1000 999\n", "output": "12\n568 998 993 996 995 991 994 997 32 992 1000 999\n"}, {"input": "49\n991 997 995 991 995 99...
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 balls with the string S written on each of them and B balls with the string T written on each of th...
[{"input": "abcdeabcde opqrsopqrs\n7 2\nabcdeabcde\n", "output": "6 2\n"}, {"input": "airport door\n5 5\nairport\n", "output": "4 5\n"}, {"input": "length depth\n3 1\nlength\n", "output": "2 1\n"}, {"input": "tea coffee\n4 4\ncoffee\n", "output": "4 3\n"}, {"input": "rice bread\n3 6\nbread\n", "output": "3 5\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\nCreate a function that takes a positive integer and returns the next bigger number that can be formed by rear...
[{"input": "59884848459853", "output": "[59884848483559]", "fn_name": "next_bigger"}, {"input": "1234567890", "output": "[1234567908]", "fn_name": "next_bigger"}, {"input": "123456789", "output": "[123456798]", "fn_name": "next_bigger"}, {"input": "9876543210", "output": "[-1]", "fn_name": "next_bigger"}, {"input": "99...
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\nAlice and Bob have participated to a Rock Off with their bands. A jury of true metalheads rates the two chall...
[{"input": "[47, 7, 2]\n[47, 7, 2]", "output": "[\"0, 0: that looks like a \\\"draw\\\"! Rock on!\"]", "fn_name": "solve"}, {"input": "[5, 6, 7]\n[3, 6, 10]", "output": "[\"1, 1: that looks like a \\\"draw\\\"! Rock on!\"]", "fn_name": "solve"}, {"input": "[47, 50, 22]\n[26, 47, 12]", "output": "[\"3, 0: Alice made \\\...
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 \\mathrm{popcount}(n) be the number of `1`s in the binary representation of n. For example, \\mathrm{popc...
[{"input": "23\n00110111001011011001111", "output": "3\n3\n2\n2\n3\n3\n2\n3\n3\n3\n2\n2\n3\n2\n2\n2\n2\n3\n2\n3\n3\n3\n2\n"}, {"input": "23\n00110111001011011101111", "output": "4\n4\n3\n3\n4\n3\n3\n3\n4\n4\n3\n4\n3\n3\n4\n3\n3\n3\n4\n3\n3\n3\n2\n"}, {"input": "23\n00110111001011011101101", "output": "3\n3\n2\n2\n3\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\nThe developers of Looksery have to write an efficient algorithm that detects faces on a picture. Unfortunatel...
[{"input": "9 46\nuuexbaacesjclggslacermcbkxlcxhdgqtacdwfryxzuxc\naclrsaefakndbnzlkefenuphgcgoedhkaxefjtnkgfeaca\nefuqunpmfxdyyffyhvracozzrxlpekhtsrfhlilfmyhefg\numyacfzffvicqtdpiulefnwcojuwtfbvlxkfsiapdnzpqo\nactefvuxqptremlqjhdbdwacjxdxitxjktecvefacamjcz\neflarseklqrkayhosverpfefzirqigzlxezabhzeferkwm\nztpypwxyohtacs...
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 also. \nChef likes playing with strings. The most interesting game are na...
[{"input": "CHEFCHEFFFF\n", "output": "2"}, {"input": "CIEFCHEFFFF", "output": "1\n"}, {"input": "BHHHEEFFFCC", "output": "0\n"}, {"input": "CHEFCHEFGFF", "output": "2\n"}, {"input": "CHHHEEFFFCC", "output": "1\n"}, {"input": "FIEFCHECFFF", "output": "1\n"}, {"input": "FJEFCHECFFF", "output": "1\n"}, {"input": "BHIHEEF...
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\nF: Grid number\n\nproblem\n\nEbi-chan is trying to write exactly one integer from 1 to 2 \\ times n in a grid...
[{"input": "8 10 37", "output": "24\n"}, {"input": "5 4 11", "output": "10\n"}, {"input": "5 3 17", "output": "16\n"}, {"input": "5 4 18", "output": "14\n"}, {"input": "8 6 37", "output": "21\n"}, {"input": "8 6 42", "output": "34\n"}, {"input": "8 6 39", "output": "37\n"}, {"input": "8 6 77", "output": "13\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 are two main kinds of events in the life of top-model: fashion shows and photo shoots. Participating in...
[{"input": "10 1 1 1 2 0 10\n1 1\n2 1\n3 0\n4 0\n5 1\n6 1\n14 1\n8 1\n9 1\n10 1\n", "output": "5\n"}, {"input": "10 1 1 1 2 0 10\n1 1\n2 1\n3 0\n4 0\n5 1\n6 1\n7 1\n8 1\n9 1\n10 1\n", "output": "5\n"}, {"input": "10 1 1 1 2 0 10\n1 1\n2 1\n3 0\n4 0\n5 1\n6 1\n7 1\n8 1\n5 1\n10 1\n", "output": "5\n"}, {"input": "5 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 goddess of programming is reviewing a thick logbook, which is a yearly record of visitors to her holy alt...
[{"input": "14\n04/21 09:00 I 000\n04/21 09:00 I 001\n04/21 09:15 I 002\n04/21 90:30 O 001\n04/21 09:45 O 000\n12/40 10:00 O 002\n04/28 09:00 I 003\n04/28 09:15 I 000\n04/28 09:30 I 004\n04/28 09:45 P 004\n04/28 10:00 O 000\n04/28 10:15 O 003\n04/29 20:00 I 002\n04/29 21:30 O 002\n20\n06/01 09:00 I 001\n06/01 09:15 I 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\nLittle Vasya had n boxes with balls in the room. The boxes stood in a row and were numbered with numbers from...
[{"input": "48 19\n227460648 746912227 51958075 682685526 1080381698 666833118 492590399 167395932 678377837 125106811 638633256 713194370 386921921 34175133 704550052 220688092 499436761 495071386 57379330 137372655 0 720974146 209203457 946682102 237312198 943872065 957150897 357568282 367006748 0 730509325 68523190 ...
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 introduce a number system which is based on a roman digits. There are digits I, V, X, L which correspon...
[{"input": "1000000000\n", "output": "48999999753\n"}, {"input": "1000000001\n", "output": "48999999802\n"}, {"input": "1897400395\n", "output": "92972619108\n"}, {"input": "1100000001\n", "output": "53899999802\n"}, {"input": "1533257378\n", "output": "75129611275\n"}, {"input": "1100000011\n", "output": "53900000292\...
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 puzzle to complete by combining 14 numbers from 1 to 9. Complete by adding another number to the g...
[{"input": "3649596966777\n4672433573317\n9118992346175\n9643871425498\n7755542764533\n1133557799246", "output": "2 3 5 8\n1 2 4 5 7\n1 2 3 4 5 6 7 8 9\n7 8 9\n1 2 3 4 6 7 8\n0\n"}, {"input": "3649596966777\n4672433573317\n9118992346175\n9643871425498\n7755542764533\n1079549632139", "output": "2 3 5 8\n1 2 4 5 7\n1 2 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 a positive integer $m$ and two integer sequence: $a=[a_1, a_2, \\ldots, a_n]$ and $b=[b_1, b_2,...
[{"input": "20 1000000000\n667066860 170421783 139902912 635488786 31946329 289281524 541340760 264115900 680775010 102068388 128171043 636359373 477042326 879154458 716982402 654668379 256334407 874949294 737194458 663371809\n688973261 813186249 677241392 581016678 216137209 424019643 428224807 184559135 203738728 185...
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 you have an infinite 2D plane with Cartesian coordinate system. Some of the integral points are block...
[{"input": "18855321\n", "output": "106661800\n"}, {"input": "34609610\n", "output": "195781516\n"}, {"input": "40000000\n", "output": "226274168\n"}, {"input": "38450759\n", "output": "217510336\n"}, {"input": "39099999\n", "output": "221182992\n"}, {"input": "30426905\n", "output": "172120564\n"}, {"input": "39999996...
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 that takes a positive integer n, sums all the cubed values from 1 to n, and returns that sum...
[{"input": "123", "output": "[58155876]", "fn_name": "sum_cubes"}, {"input": "10", "output": "[3025]", "fn_name": "sum_cubes"}, {"input": "4", "output": "[100]", "fn_name": "sum_cubes"}, {"input": "3", "output": "[36]", "fn_name": "sum_cubes"}, {"input": "1", "output": "[1]", "fn_name": "sum_cubes"}, {"input": "2", "ou...
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\nPolycarpus participates in a competition for hacking into a new secure messenger. He's almost won.\n\nHaving ...
[{"input": "284254589153928171911281811000\n1009 1000\n", "output": "YES\n2842545891539\n28171911281811000\n"}, {"input": "284254589153928171911281811000\n1009 1100\n", "output": "YES\n2842545891539\n28171911281811000\n"}, {"input": "284254589153928171911281811000\n1009 1000\n", "output": "YES\n2842545891539\n281719112...
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\nAtCoder Inc. has decided to lock the door of its office with a 3-digit PIN code.\n\nThe company has an N-digi...
[{"input": "19\n5546189040285140044", "output": "273\n"}, {"input": "19\n4753841743850076999", "output": "311\n"}, {"input": "19\n9039528710159876563", "output": "412\n"}, {"input": "19\n3616863455241776042", "output": "322\n"}, {"input": "19\n2785343766571511696", "output": "239\n"}, {"input": "19\n2922045480066417189...
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 is about to take a hot bath. \n\nThere are two taps to fill the bath: a hot water tap and a cold water ta...
[{"input": "1000000 1000000 1000000 1000000 1000000\n", "output": "1000000 1000000\n"}, {"input": "1000000 1000000 999999 999998 1000000\n", "output": "999999 999998\n"}, {"input": "176902 1481077 847541 412251 587604\n", "output": "616526 283398\n"}, {"input": "1000000 1001000 1000000 1000000 1000000\n", "output": "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\nArkady and his friends love playing checkers on an $n \\times n$ field. The rows and the columns of the field...
[{"input": "1000000000 1\n", "output": "1000000000000000000\n"}, {"input": "1000000000 1000\n", "output": "3400000000000000\n"}, {"input": "1100000000 1000\n", "output": "4114000000000000\n"}, {"input": "1000010000 1\n", "output": "1000020000100000000\n"}, {"input": "1100010000 1000\n", "output": "4114074800340000\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 rectangular matrix of size $n \\times m$ consisting of integers from $1$ to $2 \\cdot 10^5$.\...
[{"input": "7 8\n110137 66175 74657 124739 63011 153464 30956 8\n9 62369 169892 183765 84737 20941 35760 132079\n20802 67434 149925 53269 150062 35286 50218 112696\n153864 26 7405 121648 170439 115181 195278 127323\n136381 197880 57522 109132 104537 38 39 47930\n51739 77547 43 169711 18955 134957 7223 37489\n53153 1084...
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. \n\nAditi recently discovered a new magic trick. F...
[{"input": "2\n12\n191", "output": "5\n11\n"}, {"input": "2\n14\n108", "output": "6\n10\n"}, {"input": "2\n21\n114", "output": "7\n10\n"}, {"input": "2\n25\n193", "output": "7\n11\n"}, {"input": "2\n38\n107", "output": "8\n10\n"}, {"input": "2\n14\n204", "output": "6\n11\n"}, {"input": "2\n25\n333", "output": "7\n12\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 connected weighted graph consisting of $n$ vertices and $m$ edges. Let's denote t...
[{"input": "9 9 7\n1 2 1000000000\n7 9 1000000000\n9 4 1000000000\n2 6 1000000000\n2 3 1000000000\n3 7 1000000000\n6 8 1000000000\n8 4 1000000000\n4 5 1000000000\n", "output": "7\n1 5 4 6 7 8 2 \n"}, {"input": "9 9 7\n1 2 1000000000\n7 9 1000000000\n9 4 1000000000\n2 6 1000000000\n2 3 1000000000\n3 7 1000000000\n6 8 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\nPeter likes to travel by train. He likes it so much that on the train he falls asleep. \n\nOnce in summer Pet...
[{"input": "aababaaababaabbaabababaaababaabababbaabbabaabababaabbabbbababbababababababaabababaababaaaabababaabab\nabaabababaa\nabaabbaa\n", "output": "backward\n"}, {"input": "aababaaababaabbaabababaaababaabababbaabbabaabababaabbabbbababbababababababaabababaababaaaabababaabab\nabaabababaa\naabbaaba\n", "output": "backw...
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 size n is an array of size n such that each integer from 1 to n occurs exactly once in this ...
[{"input": "1\n1\n10\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n", "output": "even\neven\neven\neven\neven\neven\neven\neven\neven\neven\n"}, {"input": "1\n1\n10\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n", "output": "even\neven\neven\neven\neven\neven\neven\neven\neven\neven\n"}, {"input": "7\n2 6 1 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\nDima is a beginner programmer. During his working process, he regularly has to repeat the following operation...
[{"input": "12 12\n10\n11\n5\n3\n11\n2\n8\n6\n4\n4\n12\n1\n", "output": "9\n6\n3\n2\n6\n7\n12\n8\n10\n10\n11\n1\n"}, {"input": "12 12\n9\n11\n5\n3\n11\n2\n8\n4\n4\n4\n12\n1\n", "output": "5\n6\n3\n2\n6\n7\n12\n10\n10\n10\n11\n1\n"}, {"input": "12 12\n9\n11\n5\n3\n11\n2\n8\n6\n4\n4\n12\n1\n", "output": "5\n6\n3\n2\n6\n7...
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\nThe University where A and B study is a set of ...
[{"input": "15\n1 2\n1 3\n1 4\n2 5\n2 6\n2 7\n5 8\n6 9\n9 14\n14 15\n7 10\n4 13\n3 11\n3 12\n6\n10 15\n13 12\n2 15\n8 4\n15 12\n6 13\n", "output": "1\n10\n1\n7\n0\n4\n"}, {"input": "15\n1 2\n1 3\n1 4\n2 5\n2 6\n2 7\n5 8\n6 9\n9 14\n14 15\n7 10\n4 13\n4 11\n3 12\n6\n10 15\n13 12\n2 15\n8 4\n15 12\n6 13\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\n# How much is the fish! (- Scooter )\nThe ocean is full of colorful fishes. We as programmers want to know th...
[{"input": "\"African glass catfish\"", "output": "[0]", "fn_name": "fisHex"}, {"input": "\"Airbreathing catfish\"", "output": "[12]", "fn_name": "fisHex"}, {"input": "\"Australasian salmon\"", "output": "[10]", "fn_name": "fisHex"}, {"input": "\"Atlantic silverside\"", "output": "[1]", "fn_name": "fisHex"}, {"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\nThis is an easy version of the problem. The only difference between an easy and a hard version is in the numb...
[{"input": "19\n15 19\n19 1\n12 19\n18 9\n13 19\n4 18\n19 11\n19 17\n5 9\n14 19\n8 19\n19 6\n16 9\n19 7\n3 19\n19 9\n19 10\n9 2\n5\n19\n11 12 18 14 2 3 16 15 4 17 8 9 19 1 10 13 7 6 5\n12\n1 2 4 5 7 8 9 12 13 14 15 16\n19\n5 17 2 19 1 18 7 12 15 14 4 9 16 10 11 3 13 8 6\n12\n2 3 4 5 6 7 9 10 12 14 16 18\n19\n8 10 18 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\nLimak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and ...
[{"input": "20 2 15\n1744261 55128070 116962690 156763505 188535242 194018601 134662359 428710623 442819431 483000923 516768937 552903993 633087286 373594646 415184994 714291344 717660646 846508634 879748146 937368929\n2 20\n1 2\n2 2\n1 19\n1 12\n2 2\n2 18\n2 11\n1 16\n2 1\n2 3\n2 19\n1 17\n2 9\n2 6\n", "output": "NO\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\nFor a given sequence $A = \\\\{a_0, a_1, ... a_{n-1}\\\\}$, the number of pairs $(i, j)$ where $a_i > a_j$ an...
[{"input": "5\n3 -13 7 -1 -4", "output": "6\n"}, {"input": "5\n3 -13 10 0 -4", "output": "6\n"}, {"input": "5\n3 -13 10 0 -5", "output": "6\n"}, {"input": "5\n2 -13 10 0 -5", "output": "6\n"}, {"input": "5\n2 -13 10 0 -1", "output": "6\n"}, {"input": "5\n0 -13 10 0 -1", "output": "5\n"}, {"input": "5\n0 -13 17 0 -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\nThere are $n$ detachments on the surface, numbered from $1$ to $n$, the $i$-th detachment is placed in a poin...
[{"input": "23\n-1000000000 -964752353\n-967012509 -1000000000\n34021744 1000000000\n-931956512 -34021744\n-1034253 967204159\n-1034253 -34021744\n-1034253 -1000000000\n-931956512 -1000000000\n-967012509 1000000000\n964944003 1225903\n1000000000 1225903\n-967012509 1225903\n-1034253 -964752353\n-931956512 1000000000\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 are given an array $a$ consisting of $n$ integers $a_1, a_2, \\dots, a_n$. You want to split it into exac...
[{"input": "3\n5 3\n7 18 3 14 1\n5 4\n1 2 3 4 1\n6 3\n3 1 1 4 10 0\n", "output": "YES\n1 3 5\nNO\nYES\n1 2 6\n"}, {"input": "3\n5 3\n7 18 3 14 1\n5 4\n1 2 3 4 5\n6 2\n3 1 8 4 10 2\n", "output": "YES\n1 3 5\nNO\nYES\n1 6\n"}, {"input": "3\n5 3\n7 18 3 14 1\n5 4\n1 2 3 4 1\n6 2\n3 1 8 4 10 2\n", "output": "YES\n1 3 5\nNO...
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 array a, consisting of n integers. The array elements are indexed from 1 to n. Let's determine ...
[{"input": "42 42\n42 42 42 42 74 42 42 42 3 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 59 42 42 42 42 42\n", "output": "42 1806 39732 595980 6853802 64426782 515432400 608248315 553670947 820980301 784579711 753219887 714714707 805611691 208784644 262712997 126286707 369857538 724...
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 just entered a programming contest and have a chance to win a million dollars. This is the last questi...
[{"input": "123\n456", "output": "[1419]", "fn_name": "code"}, {"input": "200\n100", "output": "[1698]", "fn_name": "code"}, {"input": "100\n200", "output": "[1698]", "fn_name": "code"}, {"input": "12\n8", "output": "[88]", "fn_name": "code"}, {"input": "3\n2", "output": "[13]", "fn_name": "code"}, {"input": "1\n1", "o...
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 will be given an array of strings. The words in the array should mesh together where one or more letters ...
[{"input": "[\"peanutbutterandjellyontoast\", \"jellyontoastcanbepleasant\", \"bepleasantpleaseorleave\", \"ventyouranger\", \"rangersinthepark\"]", "output": "[\"jellyontoastbepleasantveranger\"]", "fn_name": "word_mesh"}, {"input": "[\"caughtinthemiddle\", \"thesunshinesinthemiddle\", \"themiddleearthwasarealplaceint...
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 balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is t...
[{"input": "3 4 5 2\n", "output": "Balanced\n"}, {"input": "0 8 7 1", "output": "Balanced\n"}, {"input": "4 3 5 2", "output": "Balanced\n"}, {"input": "8 3 8 3", "output": "Balanced\n"}, {"input": "12 6 33 2", "output": "Right\n"}, {"input": "19 6 33 2", "output": "Right\n"}, {"input": "19 6 59 2", "output": "Right\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\nEach evening Roma plays online poker on his favourite website. The rules of poker on this website are a bit s...
[{"input": "20 7\n?LLLLLWWWWW?????????\n", "output": "WLLLLLWWWWWWWWWWDDDW\n"}, {"input": "20 6\n?LLLLLWWWWW?????????\n", "output": "WLLLLLWWWWWWWWWDDDDW\n"}, {"input": "20 5\n?LLLLLWWWWW?????????\n", "output": "WLLLLLWWWWWWWWDDDDDW"}, {"input": "10 3\nDWD?DL??LL\n", "output": "DWDWDLLLLL\n"}, {"input": "10 2\nD??W?WL?...
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 plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon.\n\nThe ...
[{"input": "001 1\n----------------------------------------------------------------------------------------------------X\n----------------------------------------------------------------------------------------------------X\n", "output": "YES\n"}, {"input": "011 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\nGru has not been in the limelight for a long time and is, therefore, planning something particularly nefariou...
[{"input": "1\n4 2\n-1 8 1 -1 -1", "output": "0\n"}, {"input": "1\n5 10\n2 4 1 62 1", "output": "1\n"}, {"input": "1\n5 20\n2 4 1 62 1", "output": "2\n"}, {"input": "1\n4 2\n0 14 1 -1 1", "output": "0\n"}, {"input": "1\n4 2\n0 15 1 -1 1", "output": "0\n"}, {"input": "1\n5 10\n2 6 1 35 1", "output": "0\n"}, {"input": "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\nMr. A loves sweets, but recently his wife has told him to go on a diet. One day, when Mr. A went out from his...
[{"input": "1 1 2 5\n13\nH L1 18\nC1 D 6\nC1 H 12\nL1 D 10\nC1 L1 24\n2 2 4 6\n100 112\nH L1 10\nC1 L1 12\nC1 D 11\nC2 L1 7\nC2 D 12\nL1 D 8\n0 0 0 0", "output": "23\n-24\n"}, {"input": "1 1 2 5\n25\nH L1 18\nC1 D 6\nC1 H 12\nL1 D 10\nC1 L1 24\n2 2 4 6\n100 112\nH L1 10\nC1 L1 12\nC1 D 11\nC2 L1 2\nC2 D 7\nL1 D 8\n0 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\nGiven an array $a$ of length $n$, find another array, $b$, of length $n$ such that:\n\n for each $i$ $(1 \\l...
[{"input": "10\n1 2 3 4 4 4 7 7 7 10\n", "output": "0 1 2 3 5 6 4 8 9 7 "}, {"input": "10\n1 2 3 4 4 4 7 7 7 10\n", "output": "0 1 2 3 5 6 4 8 9 7\n"}, {"input": "7\n0 0 2 2 3 5 6\n", "output": "1 4 0 7 2 3 5 \n"}, {"input": "7\n0 0 2 2 3 5 7\n", "output": "1 4 0 6 2 3 5 \n"}, {"input": "7\n0 0 2 4 5 5 6\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\nVlad has $n$ friends, for each of whom he wants to buy one gift for the New Year.\n\nThere are $m$ shops in t...
[{"input": "5\n\n2 2\n2 2\n3 3\n\n4 3\n1 5 1\n0 1 0\n2 2 2\n2 2 3\n\n2 3\n0 4 4\n3 2 1\n\n4 2\n14 15\n8 -1\n9 1\n2 23\n\n2 4\n6 6 2 1\n7 -1 9 0\n", "output": "3\n2\n3\n14\n1\n"}, {"input": "5\n\n2 2\n2 2\n3 7\n\n4 3\n1 3 1\n3 1 1\n1 2 2\n1 2 5\n\n2 3\n-1 3 4\n2 2 1\n\n4 2\n7 9\n8 1\n16 14\n4 13\n\n2 4\n6 8 0 2\n7 -1 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\nAn `non decreasing` number is one containing no two consecutive digits (left to right), whose the first is hi...
[{"input": "50", "output": "[12565671261]", "fn_name": "increasing_numbers"}, {"input": "20", "output": "[10015005]", "fn_name": "increasing_numbers"}, {"input": "10", "output": "[92378]", "fn_name": "increasing_numbers"}, {"input": "5", "output": "[2002]", "fn_name": "increasing_numbers"}, {"input": "6", "output": "[5...
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 unrest in the Galactic Senate. Several thousand solar systems have declared their intentions to leav...
[{"input": "6 6\n1 1 3 2 2 2\n1 0 0 1 0 0\n", "output": "-1\n"}, {"input": "6 6\n4 3 5 4 5 2\n0 1 0 1 2 0\n", "output": "0\n"}, {"input": "6 6\n1 1 3 2 2 2\n1 0 0 0 0 0\n", "output": "0\n"}, {"input": "6 6\n4 3 5 6 5 5\n0 0 1 1 0 0\n", "output": "0\n"}, {"input": "6 6\n6 2 6 2 5 4\n0 1 0 0 0 1\n", "output": "0\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\nYou are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequ...
[{"input": "59\n8593 5929 3016 -859 4366 -6842 8435 -3910 -2458 -8503 -3612 -9793 -5360 -9791 -362 -7180 727 -6245 -8869 -7316 8214 -7944 7098 3788 -5436 -6626 -1131 -2410 -5647 -7981 263 -5879 8786 709 6489 5316 -4039 4909 -4340 7979 -89 9844 -906 172 -7674 -3371 -6828 9505 3284 5895 3646 6680 -1255 3635 -9547 -5104 -...
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\nFox Ciel is playing a game with numbers now. \n\nCiel has n positive integers: x_1, x_2, ..., x_{n}. She can ...
[{"input": "100\n100 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 100 100 100 100 100 100 100 100 100 100 100 100 100 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\nThe magic sum of 3s is calculated on an array by summing up odd numbers which include the digit `3`. Write a ...
[{"input": "[3, 12, 5, 8, 30, 13]", "output": "[16]", "fn_name": "magic_sum"}, {"input": "[30, 34, 330]", "output": "[0]", "fn_name": "magic_sum"}, {"input": "[3, 13]", "output": "[16]", "fn_name": "magic_sum"}, {"input": "null", "output": "[0]", "fn_name": "magic_sum"}, {"input": "[3]", "output": "[3]", "fn_name": "ma...
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\nLimak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers i...
[{"input": "170\n1 2 1 2 1 1 1 1 2 3 2 1 1 2 2 1 2 1 2 1 1 2 3 3 2 1 1 1 1 1 1 1 1 2 1 2 3 3 2 1 2 2 1 2 3 2 1 1 2 3 2 1 2 1 1 1 2 3 3 2 1 2 1 2 1 1 1 2 1 2 1 1 2 2 1 1 2 1 2 2 1 2 1 2 2 1 2 1 2 3 2 1 1 2 3 4 4 3 2 1 2 1 2 1 2 3 3 2 1 2 1 1 1 1 1 1 1 2 2 1 1 2 1 1 1 1 2 1 1 2 3 2 1 2 2 1 2 1 1 1 2 2 1 2 1 2 3 2 1 2 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\nYou are given an integer sequence $1, 2, \\dots, n$. You have to divide it into two sets $A$ and $B$ in such ...
[{"input": "2000000000\n", "output": "0\n"}, {"input": "1999999999\n", "output": "0\n"}, {"input": "1999999997\n", "output": "1\n"}, {"input": "1999999998\n", "output": "1\n"}, {"input": "1000271094\n", "output": "1\n"}, {"input": "1825468885\n", "output": "1\n"}, {"input": "1000080110\n", "output": "1\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\nSaitama accidentally destroyed a hotel again. To repay the hotel company, Genos has volunteered to operate an...
[{"input": "100 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\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\nIn the wake of the npm's `left-pad` debacle, you decide to write a new super padding method that superceds th...
[{"input": "\"some other test\"\n10\n\"nope\"", "output": "[\"other test\"]", "fn_name": "super_pad"}, {"input": "\"some other test\"\n10\n\"> \"", "output": "[\"some other\"]", "fn_name": "super_pad"}, {"input": "\"test\"\n7\n\"^more complex\"", "output": "[\"motestm\"]", "fn_name": "super_pad"}, {"input": "\"test\"\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\nDrazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his fr...
[{"input": "91 98\n78 0 1 2 3 4 5 7 8 9 10 11 12 14 15 16 17 18 19 21 22 23 24 25 26 28 29 30 31 32 33 35 36 37 38 39 40 42 43 44 45 46 47 49 50 51 52 53 54 56 57 58 59 60 61 63 64 65 66 67 68 70 71 72 73 74 75 77 78 79 80 81 82 84 85 86 87 88 89\n84 0 1 2 3 4 5 7 8 9 10 11 12 14 15 16 17 18 19 21 22 23 24 25 26 28 29 ...
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\nn people are standing in a line to play table tennis. At first, the first two players in the line play a game...
[{"input": "100 2\n62 70 35 14 12 87 94 78 39 92 84 91 129 49 82 33 69 37 19 61 42 8 45 97 81 22 54 67 1 22 77 25 65 17 18 28 25 57 16 90 40 13 4 21 68 35 15 76 73 93 56 111 79 47 74 75 30 71 130 99 68 24 29 83 5 6 31 96 38 80 27 46 51 53 2 86 35 9 20 100 26 36 63 7 52 55 23 3 50 59 48 118 167 44 34 64 13 72 7 98\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 long time ago (probably even in the first book), Nicholas Flamel, a great alchemist and the creator of the ...
[{"input": "911 728 910 407 833 594\n", "output": "Hermione\n"}, {"input": "632 446 352 317 522 451\n", "output": "Hermione\n"}, {"input": "542 11 820 850 1201 738\n", "output": "Hermione\n"}, {"input": "911 728 910 180 833 594\n", "output": "Hermione\n"}, {"input": "542 11 820 850 791 738\n", "output": "Hermione\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 sequences A and B consisting of non-negative integers.\nThe lengths of both A and B are N, and ...
[{"input": "3\n11 3\n-1 1\n2 8", "output": "9\n"}, {"input": "3\n8 3\n0 1\n4 8\n", "output": "9\n"}, {"input": "3\n8 3\n-1 1\n5 8", "output": "9\n"}, {"input": "3\n8 3\n-1 0\n4 8", "output": "8\n"}, {"input": "3\n8 3\n0 1\n4 8", "output": "9"}, {"input": "2\n-1 1\n1 -1", "output": "1\n"}, {"input": "2\n-1 -1\n1 1", "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\nAoki is playing with a sequence of numbers a_{1}, a_{2}, ..., a_{N}. Every second, he performs the following ...
[{"input": "3\n2 20 33\n2 2 13", "output": "1048584\n"}, {"input": "3\n23 10 26\n0 4 7", "output": "524354\n"}, {"input": "3\n7 23 26\n3 6 5", "output": "131216\n"}, {"input": "3\n23 10 31\n0 4 6", "output": "66114\n"}, {"input": "3\n7 23 23\n3 6 5", "output": "131152\n"}, {"input": "3\n23 10 31\n1 4 6", "output": "661...
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 A and B have a list of $n$ integers each. They both want to maximize the subtraction between thei...
[{"input": "29\n254369 14511 114048 683934 553812 575014 620356 217938 286195 131704 268393 78202 296626 986697 175814 600746 146985 215868 740052 711417 11221 944700 940915 53378 698708 878644 704035 120164 437165\n3415 443979 327875 491782 974937 176118 37957 316844 12044 156497 462613 338831 796707 658031 906915 955...
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 animals in the queue to Dr. Dolittle. When an animal comes into the office, the doctor examines h...
[{"input": "150 2476\n70 21 114 127 22 11 29 59 51 59 35 3 53 88 5 8 44 4 8 100 1 27 1 25 27 56 48 22 23 103 85 66 14 58 20 7 176 11 19 26 105 97 83 3 29 30 52 92 59 11 135 37 59 8 66 20 47 19 143 16 93 18 57 71 1 13 141 1 119 6 2 87 40 68 28 22 20 53 31 19 15 33 32 9 70 63 16 26 77 7 45 52 73 25 22 21 68 79 16 3 164 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\nPetya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal r...
[{"input": "44447774444474477747774774477777474774744744477444447777477477744747477774744444744777777777747777477447744774744444747477744744\n77777474477477747774777777474474477444474777477747747777477747747744474474747774747747444777474444744744444477477777747744747477\n", "output": "37\n"}, {"input": "774774747744474...
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 has a string $s$ of length $n$. He decides to make the following modification to the string: Pick an ...
[{"input": "1\n440\ntcjbjlbtjfmvzdqutuwzvmgqrqtrvxwrdacxcowbmbwvwssihttgdsjntiawqavwspzmybakxmwpbcgaffpyhvjrulqsorkcuozvtdbkkmasxtemrrbhqnmkpgewwphdvcyhxmatrfjkesacujihmtyqtqcjfqhpsjhgzimegvkjylapylqprykvkjavlmipewlzqsfefjzecadsqmfutgnegngmwchqttcyklocfcyuhghvtygdbsxaoxkvtgdcnsqddzzakhgrribwxkuakxkjneasowsadprpcusmbevu...
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\nComplete the function that takes a string as an input, and return a list of all the unpaired characters (i.e....
[{"input": "\"\\u00bc x 4 = 1 and \\u00bd x 4 = 2\"", "output": "[[\"\\u00bc\", \"1\", \"a\", \"n\", \"d\", \"\\u00bd\", \"2\"]]", "fn_name": "odd_one_out"}, {"input": "\"Codewars\"", "output": "[[\"C\", \"o\", \"d\", \"e\", \"w\", \"a\", \"r\", \"s\"]]", "fn_name": "odd_one_out"}, {"input": "\"Hello World\"", "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\nThe concept of \"[smooth number](https://en.wikipedia.org/wiki/Smooth_number)\" is applied to all those numbe...
[{"input": "3125", "output": "[\"Hamming number\"]", "fn_name": "is_smooth"}, {"input": "60", "output": "[\"Hamming number\"]", "fn_name": "is_smooth"}, {"input": "98", "output": "[\"humble number\"]", "fn_name": "is_smooth"}, {"input": "4096", "output": "[\"power of 2\"]", "fn_name": "is_smooth"}, {"input": "7", "outp...
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 guessed a permutation $p$ consisting of $n$ integers. The permutation of length $n$ is the array of length...
[{"input": "5\n6\n3 2 5 6\n2 4 6\n3 1 3 4\n2 1 3\n4 1 2 4 6\n5\n2 2 3\n2 1 2\n2 1 4\n2 4 5\n7\n3 1 2 6\n4 1 3 5 6\n2 1 2\n3 4 5 7\n6 1 2 3 4 5 6\n3 1 3 6\n2\n2 1 2\n5\n2 2 5\n3 2 3 5\n4 2 3 4 5\n5 1 2 3 4 5\n", "output": "3 1 4 6 2 5 \n3 2 1 4 5 \n2 1 6 3 5 4 7 \n1 2 \n2 5 3 4 1 \n"}, {"input": "5\n6\n3 2 5 6\n2 4 6\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 have to create a function named reverseIt.\n\nWrite your function so that in the case a string or a numbe...
[{"input": "[1, 2, 3]", "output": "[[1, 2, 3]]", "fn_name": "reverse_it"}, {"input": "\"314159\"", "output": "[\"951413\"]", "fn_name": "reverse_it"}, {"input": "\"Hello\"", "output": "[\"olleH\"]", "fn_name": "reverse_it"}, {"input": "314159", "output": "[951413]", "fn_name": "reverse_it"}, {"input": "true", "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\nYou have a multiset containing several integers. Initially, it contains $a_1$ elements equal to $1$, $a_2$ el...
[{"input": "20\n1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2\n", "output": "11\n"}, {"input": "20\n1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2\n", "output": "11\n"}, {"input": "20\n1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 3\n", "output": "11\n"}, {"input": "20\n1 2 1 2 1 2 0 2 1 2 1 2 1 2 1 2 1 2 1 3\n", "output": "12\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're given two arrays $a[1 \\dots n]$ and $b[1 \\dots n]$, both of the same length $n$.\n\nIn order to perf...
[{"input": "4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 42\n1\n7\n6\n", "output": "YES\nNO\nYES\nNO\n"}, {"input": "4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\n1 2 1 3 1\n2\n42 42\n42 48\n1\n7\n6\n", "output": "YES\nNO\nYES\nNO\n"}, {"input": "4\n6\n3 7 1 4 1 2\n3 7 3 6 3 2\n5\n1 1 1 1 1\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\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N). Your objective is to rem...
[{"input": "8\n12 13 1 15 2 2 1 12", "output": "5\n"}, {"input": "8\n4 13 1 15 2 8 1 12", "output": "7\n"}, {"input": "8\n4 13 1 15 2 2 1 12", "output": "5\n"}, {"input": "8\n6 13 1 15 2 2 1 12", "output": "5\n"}, {"input": "8\n12 13 1 0 2 2 1 12", "output": "5\n"}, {"input": "8\n12 13 1 1 2 2 1 12", "output": "5\n"}, ...
code_stdio