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\nPooja would like to withdraw X US from an ATM. The cash machine will only accept the transaction if X is a mu...
[{"input": "1013 120.00", "output": "120.00\n"}, {"input": "1676 120.00", "output": "120.00\n"}, {"input": "1038 120.00", "output": "120.00\n"}, {"input": "1022 120.00", "output": "120.00\n"}, {"input": "1471 120.00", "output": "120.00\n"}, {"input": "1808 120.00", "output": "120.00\n"}, {"input": "114 120.00", "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\nSince Sonya has just learned the basics of matrices, she decided to play with them a little bit.\n\nSonya ima...
[{"input": "20\n1 0 2 3 5 3 2 1 3 2 3 1 4 2 1 4 2 3 2 4\n", "output": "4 5\n2 2\n"}, {"input": "20\n1 0 2 3 5 3 2 1 3 2 3 1 4 2 1 4 2 3 2 4\n", "output": "4 5\n2 2\n"}, {"input": "18\n2 2 3 2 4 3 3 3 0 2 4 2 1 3 2 1 1 1\n", "output": "3 6\n2 3\n"}, {"input": "20\n1 0 2 3 5 10 2 2 5 4 3 2 2 2 1 3 0 3 2 4\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\nVasya has n days of vacations! So he decided to improve his IT skills and do sport. Vasya knows the following...
[{"input": "100\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "100\n"}, {"input": "100\n3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 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\nSnuke prepared 6 problems for a upcoming programming contest. For each of those problems, Rng judged whether ...
[{"input": "001011", "output": "3\n"}, {"input": "100000", "output": "1\n"}, {"input": "011011", "output": "4\n"}, {"input": "100100", "output": "2\n"}, {"input": "111011", "output": "5\n"}, {"input": "111111", "output": "6\n"}, {"input": "101100", "output": "3\n"}, {"input": "110100", "output": "3\n"}, {"input": "0100...
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 <var>Q</var> tuples of integers <var>(L_i, A_i, B_i, M_i)</var>. For each tuple, answer the fol...
[{"input": "31940 139378099479290043 26943708742238 1000000000\n", "output": "997629525\n"}, {"input": "1 999999999999999999 999999999999999999 998244353\n", "output": "716070897\n"}, {"input": "345 493299812499659259 1418510335032035 998244353\n", "output": "390889114\n"}, {"input": "18 912087068546306627 316457441004...
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\nAllen wants to enter a fan zone that occupies a round square and has $n$ entrances.\n\nThere already is a que...
[{"input": "30\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000...
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 define a multiplication operation between a string $a$ and a positive integer $x$: $a \\cdot x$ is the ...
[{"input": "13\na\na\na\na\na\na\na\na\na\na\na\na\nb\na\na\na\na\na\na\na\na\na\na\na\nb\na\n", "output": "a\na\na\na\na\na\n-1\na\na\na\na\na\n-1\n"}, {"input": "13\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\nb\na\n", "output": "a\na\na\na\na\na\na\na\na\na\na\na\n-1\n"}, {"input": "13\na...
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 $s$ consisting of $n$ digits from $1$ to $9$.\n\nYou have to divide it into at least...
[{"input": "21\n3\n123\n3\n123\n3\n123\n3\n123\n3\n123\n3\n213\n3\n123\n3\n123\n3\n123\n3\n321\n3\n123\n3\n321\n3\n132\n3\n322\n3\n321\n3\n341\n3\n123\n3\n421\n3\n421\n3\n421\n3\n421\n", "output": "YES\n2\n1 23\nYES\n2\n1 23\nYES\n2\n1 23\nYES\n2\n1 23\nYES\n2\n1 23\nYES\n2\n2 13\nYES\n2\n1 23\nYES\n2\n1 23\nYES\n2\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\nDuring the last Sereja's Codesecrof round the server crashed many times, so the round was decided to be made ...
[{"input": "10 0\n5 9 1 12 4 2 2 4 12 1\n", "output": "2\n3\n4\n5\n6\n7\n8\n9\n"}, {"input": "10 0\n5 16 1 7 4 2 2 5 18 3\n", "output": "2\n3\n4\n5\n6\n7\n8\n9\n"}, {"input": "10 0\n5 16 1 7 4 2 2 4 18 3\n", "output": "2\n3\n4\n5\n6\n7\n8\n9\n"}, {"input": "10 0\n5 16 1 7 7 2 2 4 18 3\n", "output": "2\n3\n4\n5\n6\n7\n8...
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 a billiard table of rectangular size $n \\times m$ with four pockets. Let's introduce a coordinate s...
[{"input": "1000000000 999999999 999999998 999999999 -1 -1\n", "output": "1000000000 999999999\n"}, {"input": "1000000000 999999999 999999998 999999999 -1 -1\n", "output": "1000000000 999999999"}, {"input": "1000000000 999999999 999999998 999999999 -1 1\n", "output": "1000000000 999999999\n"}, {"input": "1000000000 999...
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\nValera is a collector. Once he wanted to expand his collection with exactly one antique item.\n\nValera knows...
[{"input": "3 999999\n22 1000000 1000000 1250369 623205 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000100 1506663 1001000 1010000 999999 1000000 1000000 1010000 352800 999999 1000000\n14 999999 999999 1521826 1368902 999999 1000000 999999 1556972 999999 999999 418013 999999 1000000 999999\n5 999999 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\nYou are given a Young diagram. \n\nGiven diagram is a histogram with $n$ columns of lengths $a_1, a_2, \\ldot...
[{"input": "100\n1980 1932 1906 1898 1892 1883 1877 1858 3146 1833 1777 1710 1689 1678 1660 1653 1648 1647 1644 1639 1635 1635 1593 1571 1534 1470 1440 1435 1389 1272 1269 1268 1263 1255 1249 1237 1174 1174 1128 529 1067 981 1707 979 951 915 911 906 863 826 810 810 802 785 764 752 743 710 705 451 676 661 639 1208 616 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\nWrite a function that will encrypt a given sentence into International Morse Code, both the input and out put...
[{"input": "\"THE QUICK BROWN FOX\"", "output": "[\"- .... . --.- ..- .. -.-. -.- -... .-. --- .-- -. ..-. --- -..-\"]", "fn_name": "encryption"}, {"input": "\"WOLFRAM ALPHA 1\"", "output": "[\".-- --- .-.. ..-. .-. .- -- .- .-.. .--. .... .- .----\"]", "fn_name": "encryption"}, {"input": "\"Final basic test\...
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 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": "1000000100\n", "output": "49000004653\n"}, {"input": "1517731607\n", "output": "74368848496\n"}, {"input": "1000001100\n", "output": "49000053653\n"}, {"input": "1000001000\n", "output": "49000048753\n"}, {"input": "600000000\n", "output": "29399999753\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 internet is a very confounding place for some adults. Tom has just joined an online forum and is trying t...
[{"input": "\"Sometimes I use ? in the middle of a sentence; is that ok?!\"", "output": "[\"OMG ZOMETIMEZ I UZE ?????????????? IN the MIDDLE of A zentence; IZ that OK??????????????!1!1!1!1!1!1!1\"]", "fn_name": "n00bify"}, {"input": "\"Before you know it... wait, what does this have to do with UNO!?\"", "output": "[\"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\nA and B are preparing themselves for programming contests.\n\nB loves to debug his code. But before he runs t...
[{"input": "10\n460626451 802090732 277246428 661369649 388684428 784303821 376287098 656422756 9301599 25720377\n277246428 388684428 661369649 460626451 656422756 802090732 9301599 784303821 376287098\n376287098 802090732 388684428 9301599 656422756 784303821 460626451 277246428\n", "output": "25720377\n661369649\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 high school has a strange principal. On the first day, he has his students perform an odd opening day cerem...
[{"input": "950811894", "output": "[30835]", "fn_name": "num_of_open_lockers"}, {"input": "3991700", "output": "[1997]", "fn_name": "num_of_open_lockers"}, {"input": "74864", "output": "[273]", "fn_name": "num_of_open_lockers"}, {"input": "128", "output": "[11]", "fn_name": "num_of_open_lockers"}, {"input": "500", "out...
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\nPolycarp found a rectangular table consisting of $n$ rows and $m$ columns. He noticed that each cell of the t...
[{"input": "5\n1 1 1\n2 2 3\n3 10 11\n100 100 7312\n1001000 1000010 1000000000000\n", "output": "1\n2\n14\n1174\n1000009998991\n"}, {"input": "5\n1 1 1\n2 2 2\n3 10 11\n100 100 7312\n1001000 1000010 1000000000000\n", "output": "1\n3\n14\n1174\n1000009998991\n"}, {"input": "5\n1 1 1\n2 2 2\n3 10 11\n100 100 7312\n100100...
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 tree is an undirected connected graph without cycles.\n\nYou are given a tree of n vertices. Find the numbe...
[{"input": "8\n\n3 2\n3 1\n1 2\n\n5 5\n4 1\n5 4\n1 3\n2 4\n\n10 2\n2 5\n3 10\n9 4\n7 1\n6 2\n9 6\n3 1\n8 7\n10 2\n\n2 2\n2 1\n\n7 4\n5 1\n1 4\n3 6\n6 4\n3 7\n2 3\n\n10 4\n8 4\n1 6\n7 1\n5 1\n10 2\n8 9\n2 3\n2 4\n6 9\n\n5 5\n1 5\n3 5\n1 2\n4 2\n\n8 3\n1 2\n5 8\n5 4\n2 7\n7 6\n8 7\n3 2\n", "output": "3\n0\n45\n1\n0\n0\n0...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nNikolay has a lemons, b apples and c pears. He decided to cook a compote. According to the recipe the fruits ...
[{"input": "1000\n1000\n1000\n", "output": "1750\n"}, {"input": "1000\n1000\n1001\n", "output": "1750\n"}, {"input": "1000\n1010\n1001\n", "output": "1750\n"}, {"input": "1000\n500\n1000\n", "output": "1750\n"}, {"input": "1000\n1000\n1000\n", "output": "1750"}, {"input": "1000\n507\n1000\n", "output": "1750\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\nZiota found a video game called \"Monster Invaders\".\n\nSimilar to every other shooting RPG game, \"Monster ...
[{"input": "100 5 5 9 3\n3 4 2 3 4 3 8 5 2 1 1 4 1 1 10 10 7 5 2 9 4 2 10 10 8 2 4 9 6 2 6 7 7 5 7 7 1 8 10 9 9 3 10 3 10 1 1 8 3 6 4 5 5 4 9 5 9 4 8 2 10 8 9 1 5 9 7 2 1 7 9 3 2 9 1 5 4 2 3 10 6 7 8 2 10 1 6 2 1 6 10 9 1 2 2 7 2 8 4 4\n", "output": "1597\n"}, {"input": "100 5 5 9 3\n3 4 2 3 4 3 8 5 2 1 1 4 1 1 10 10 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\nYou are given a bracket sequence $s$ consisting of $n$ opening '(' and closing ')' brackets.\n\nA regular bra...
[{"input": "20\n(())(()((((()())()((\n", "output": "0\n"}, {"input": "20\n(())(((((((()())()()\n", "output": "0\n"}, {"input": "20\n(()())()((((()(())((\n", "output": "0\n"}, {"input": "20\n(())((((()(((())()()\n", "output": "0\n"}, {"input": "20\n(())(()(((())())()((\n", "output": "0\n"}, {"input": "19\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\nAs you might remember from the previous round, Vova is currently playing a strategic game known as Rage of Em...
[{"input": "5\n1 1\n1 4\n3 6 3\n1 4\n3 10 3\n", "output": "1\n0\n"}, {"input": "5\n1 3\n1 4\n3 11 3\n2 4\n3 6 2\n", "output": "0\n0\n"}, {"input": "5\n1 3\n1 4\n3 12 3\n1 4\n3 4 3\n", "output": "0\n2\n"}, {"input": "5\n1 3\n1 4\n3 8 3\n2 4\n3 6 3\n", "output": "0\n0\n"}, {"input": "5\n1 3\n1 4\n3 6 3\n1 4\n3 6 3\n", "o...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a permutation p of length n. Remove one element from permutation to make the number of records ...
[{"input": "92\n42 64 33 89 57 9 24 44 87 67 92 84 39 88 26 27 85 62 22 83 23 71 14 13 73 79 15 49 2 12 76 53 81 40 31 3 72 58 1 61 7 82 20 54 46 77 11 16 28 48 6 45 36 43 60 38 18 4 32 74 10 91 19 86 75 51 50 52 78 25 65 8 55 30 90 69 59 63 56 80 29 68 70 17 35 41 37 47 66 34 5 21\n", "output": "1\n"}, {"input": "92\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\nAlice has a birthday today, so she invited home her best friend Bob. Now Bob needs to find a way to commute t...
[{"input": "10 3\n0 1 1 0 1 0 0 2 -1 0\n1 4 1 2 -1 0 1 1 -1 1\n", "output": "NO\n"}, {"input": "10 10\n1 0 0 0 0 0 0 0 0 1\n0 0 0 0 0 0 0 0 0 0\n", "output": "YES\n"}, {"input": "10 10\n1 0 0 0 0 0 0 0 0 1\n0 0 0 0 0 0 0 0 0 0\n", "output": "YES\n"}, {"input": "10 3\n0 1 1 0 1 0 0 2 -1 0\n1 2 1 1 -1 0 1 1 0 1\n", "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\nLittle Elephant loves magic squares very much.\n\nA magic square is a 3 × 3 table, each cell contains some po...
[{"input": "0 100000 100000\n100000 0 100000\n100000 100000 0\n", "output": "100000 100000 100000\n100000 100000 100000\n100000 100000 100000\n"}, {"input": "0 100000 100000\n100000 0 100000\n100000 100000 0\n", "output": "100000 100000 100000\n100000 100000 100000\n100000 100000 100000\n"}, {"input": "0 98721 99776\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\nproblem\n\nThere are fine icicles under the eaves of JOI's house in Canada. Because of this, JOI decided to i...
[{"input": "1 56\n4\n-1\n-1\n-1", "output": "52\n"}, {"input": "2 71\n14\n6\n0\n0", "output": "122\n"}, {"input": "2 30\n14\n6\n3\n0", "output": "40\n"}, {"input": "2 17\n2\n3\n3\n-1", "output": "29\n"}, {"input": "2 38\n14\n6\n0\n0", "output": "56\n"}, {"input": "4 10\n7\n1\n3\n5", "output": "21\n"}, {"input": "4 11\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\nThird day at your new cryptoanalyst job and you come across your toughest assignment yet. Your job is to impl...
[{"input": "\"alpha bravo charlie\"\n\"delta\"", "output": "[\"djofd eqdvn lfdqjga\"]", "fn_name": "keyword_cipher"}, {"input": "\"WELCOME HOME\"\n\"gridlocked\"", "output": "[\"wlfimhl kmhl\"]", "fn_name": "keyword_cipher"}, {"input": "\"one two three\"\n\"rails\"", "output": "[\"mks twm tdpss\"]", "fn_name": "keyword...
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\nValery is very interested in magic. Magic attracts him so much that he sees it everywhere. He explains any st...
[{"input": "150\n0 -2 1 -2 0 0 0 0 -2 0 -2 -1 0 0 2 0 1 -2 1 -1 0 0 0 2 -2 2 -1 0 0 -1 -2 0 2 0 1 0 -2 0 -2 -1 0 -2 -2 2 0 0 1 -2 -2 -1 -2 0 2 1 1 -1 1 0 -2 2 0 0 0 1 -1 0 -2 -1 0 -2 1 1 1 0 0 2 0 0 2 -1 0 0 2 0 2 0 -2 -1 1 -2 1 0 0 -2 -1 -1 0 0 2 -1 -1 -1 -1 -2 0 0 2 -1 -1 1 0 0 1 -1 0 0 -1 2 2 0 0 0 -1 -2 0 1 0 -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\nJabber ID on the national Berland service «Babber» has a form <username>@<hostname>[/resource], where \n\n *...
[{"input": "IGsma3L6YTJRrXS@1g.yR3mC.c.xoCns7Wo1.9C.Oe.5ebkR/_97Ltj3\n", "output": "YES\n"}, {"input": "IGsma3K6YTJRrXS@1g.yR3mC.c.xoCns7Wo1.9C.Oe.5ebkR/_97Ltj3\n", "output": "YES\n"}, {"input": "POTjlYcxAZsbyZPDh@sPm.z6aVaO.H1wEUhD9YvROQFUk/M_jTHS_6!\n", "output": "NO\n"}, {"input": "POTjlYcxAZsbyZPDh9sPm.z6aVaO.H1wEU...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere is an airplane which has n rows from front to back. There will be m people boarding this airplane.\n\nT...
[{"input": "1000000 1000000\n", "output": "233176135\n"}, {"input": "1000000 1000000\n", "output": "233176135\n"}, {"input": "1000001 1000000\n", "output": "109334147\n"}, {"input": "1000000 500000\n", "output": "211837745\n"}, {"input": "1000000 500000\n", "output": "211837745\n"}, {"input": "1000000 481032\n", "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\nA boy named Vasya has taken part in an Olympiad. His teacher knows that in total Vasya got at least x points ...
[{"input": "10 168884\n75796 42057 25891 51127 40493 78380 30331 47660 58338 90812\n50469 28184 75581 61837 25050 90975 98279 81022 90217 31015\n", "output": "1 3\n"}, {"input": "10 168884\n29651 42057 25891 51127 40493 78380 30331 47660 58338 90812\n50469 28184 75581 61837 25050 90975 98279 81022 90217 31015\n", "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\nOh, New Year. The time to gather all your friends and reflect on the heartwarming events of the past year...\...
[{"input": "10\n10 7 10 10 7 10 7 7 10 10\n", "output": "2 6\n"}, {"input": "10\n10 7 10 10 7 10 7 7 10 10\n", "output": "2 6\n"}, {"input": "10\n10 7 10 10 7 10 7 5 10 10\n", "output": "2 7\n"}, {"input": "10\n1 2 3 4 5 6 7 8 9 10\n", "output": "4 10\n"}, {"input": "10\n1 2 3 4 5 6 7 8 9 10\n", "output": "4 10\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\n# Rock Paper Scissors\n\nLet's play! You have to return which player won! In case of a draw return `Draw!`.\n...
[{"input": "\"scissors\"\n\"paper\"", "output": "[\"Player 1 won!\"]", "fn_name": "rps"}, {"input": "\"paper\"\n\"scissors\"", "output": "[\"Player 2 won!\"]", "fn_name": "rps"}, {"input": "\"rock\"\n\"scissors\"", "output": "[\"Player 1 won!\"]", "fn_name": "rps"}, {"input": "\"scissors\"\n\"rock\"", "output": "[\"Pla...
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\nVasya has a non-negative integer n. He wants to round it to nearest integer, which ends up with 0. If n alrea...
[{"input": "1000000000\n", "output": "1000000000\n"}, {"input": "1031575393\n", "output": "1031575390\n"}, {"input": "1022742286\n", "output": "1022742290\n"}, {"input": "1259496606\n", "output": "1259496610\n"}, {"input": "1938879055\n", "output": "1938879050\n"}, {"input": "1178556713\n", "output": "1178556710\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\nNotes\n\nTemplate in C\n\nConstraints\n\n* 1 ≤ n ≤ 100000\n* 1 ≤ q ≤ 1000\n* 1 ≤ timei ≤ 50000\n* 1 ≤ length ...
[{"input": "5 100\np1 150\np2 216\np3 200\np4 548\np5 20", "output": "p5 420\np1 470\np3 670\np2 786\np4 1134\n"}, {"input": "5 100\np1 150\np2 216\no3 200\np4 548\np5 20", "output": "p5 420\np1 470\no3 670\np2 786\np4 1134\n"}, {"input": "5 100\np1 150\np2 216\no3 200\np4 548\nq5 20", "output": "q5 420\np1 470\no3 670...
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 string (`str`) containing a base-10 integer between `0` and `10000`, convert the integer to its binar...
[{"input": "\"8192\"", "output": "[\"Thirteen\"]", "fn_name": "max_consec_zeros"}, {"input": "\"2048\"", "output": "[\"Eleven\"]", "fn_name": "max_consec_zeros"}, {"input": "\"4096\"", "output": "[\"Twelve\"]", "fn_name": "max_consec_zeros"}, {"input": "\"6144\"", "output": "[\"Eleven\"]", "fn_name": "max_consec_zeros"...
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\nN problems have been chosen by the judges, now it's time to assign scores to them!\n\nProblem i must get an i...
[{"input": "157 925309799", "output": "391028716"}, {"input": "134 925309799", "output": "114482723"}, {"input": "134 569368125", "output": "166407741"}, {"input": "134 788899135", "output": "506695346"}, {"input": "48 126674882", "output": "104179983"}, {"input": "45 713052776", "output": "108412121"}, {"input": "90 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 text that consists of lowercase Latin letters, spaces and punctuation marks (dot, comma, excl...
[{"input": "ajdwlf ibvlfqadt sqdn aoj nsjtivfrsp !mquqfgzrbp w ow aydap ry s . jwlvg ? ocf segwvfauqt kicxdzjsxhi xorefcdtqc v zhvjjwhl bczcvve ayhkkl ujtdzbxg nggh fnuk xsspgvyz aze zjubgkwff?hgj spteldqbdo vkxtgnl uxckibqs vpzeaq roj jzsxme gmfpbjp uz ...
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 a rooted tree with N+1 vertices.\nThe vertices are numbered 0 through N, and Vertex 0 is the root o...
[{"input": "31\n0 1 0 2 4 0 4 1 6 4 3 9 7 3 7 2 15 6 12 10 12 16 5 3 20 1 25 20 23 24 23\n", "output": "730395550\n"}, {"input": "31\n0 1 0 2 4 0 4 1 6 4 3 9 7 3 7 3 15 6 12 10 12 16 5 3 20 1 25 20 23 24 23", "output": "831058846\n"}, {"input": "31\n0 1 0 2 4 0 4 0 6 4 3 9 7 3 7 3 15 6 12 10 12 16 5 3 20 1 25 20 23 24 ...
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 the Geometry Horse.\n\nThe game goal is to destroy geometric figures of the game world. A certain...
[{"input": "16\n196661091 17\n765544213 322\n134522506 115\n914609421 163\n219016066 227\n835576807 856\n682158845 914\n11248128 145\n876496017 854\n141052597 530\n163180278 315\n407245991 60\n294673989 270\n2976249 26\n674132026 519\n347829904 23\n16\n6280951514 53396669509 79113951711 87247958777 121933859963 2190625...
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 planning to buy an apartment in a $n$-floor building. The floors are numbered from $1$ to $n$ from th...
[{"input": "10 2\n7 6 15 6 16 18 2 17 17\n12 11 3 10 9 1 10 1 5\n", "output": "0 7 13 18 24 35 36 38 41 46\n"}, {"input": "10 2\n7 6 18 6 16 18 1 17 17\n6 9 3 10 9 1 10 1 5\n", "output": "0 7 13 18 24 35 36 37 40 45 \n"}, {"input": "10 2\n7 6 18 6 16 18 1 17 17\n6 17 3 10 9 1 10 1 5\n", "output": "0 7 13 18 24 35 36 37...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nHow many ways are there to choose two distinct positive integers totaling N, disregarding the order?\n\nConst...
[{"input": "3256265", "output": "1628132\n"}, {"input": "1527191", "output": "763595\n"}, {"input": "1743342", "output": "871670\n"}, {"input": "1412384", "output": "706191\n"}, {"input": "1339977", "output": "669988\n"}, {"input": "245898", "output": "122948\n"}, {"input": "235323", "output": "117661\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\nYou are given a string $s$ of 0's and 1's. You are allowed to perform the following operation:\n\nchoose a no...
[{"input": "64\n0000\n1000\n0100\n1100\n0010\n1010\n0110\n1110\n0001\n1001\n0101\n1101\n0011\n1011\n0111\n1111\n0000\n1000\n0100\n1100\n0010\n1010\n0110\n1110\n0001\n1001\n0101\n1101\n0011\n1011\n0111\n1111\n0000\n1000\n0100\n1100\n0010\n1010\n0110\n1110\n0001\n1001\n0101\n1101\n0011\n1011\n0111\n1111\n0000\n1000\n0100...
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 are playing a game. First each of them writes an integer from 1 to 6, and then a dice is thrown. ...
[{"input": "2 5\n", "output": "3 0 3\n"}, {"input": "2 4\n", "output": "2 1 3\n"}, {"input": "5 3\n", "output": "2 1 3\n"}, {"input": "1 6\n", "output": "3 0 3\n"}, {"input": "5 1\n", "output": "3 1 2\n"}, {"input": "6 3\n", "output": "2 0 4\n"}, {"input": "2 3\n", "output": "2 0 4\n"}, {"input": "5 6\n", "output": "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\nVasya tries to break in a safe. He knows that a code consists of n numbers, and every number is a 0 or a 1. V...
[{"input": "35 10\n11101100001010011101100010101111111 5\n11101100010011101100001010101011011 5\n11101100001101111110000011101111010 5\n11101100101001111100000110111111001 5\n11101100001011000100001011101111011 5\n10101000001011111010000010001111011 5\n11101100001011111100010000111110001 0\n1110100000111111110000001010...
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# Two samurai generals are discussing dinner plans after a battle, but they can't seem to agree.\n\nThe discu...
[{"input": "\"eat a burger and drink a coke\"\n\"drink a coke\"", "output": "[\"drink a coke\"]", "fn_name": "common_ground"}, {"input": "\"i like turtles\"\n\"what are you talking about\"", "output": "[\"death\"]", "fn_name": "common_ground"}, {"input": "\"eat chicken\"\n\"eat chicken and rice\"", "output": "[\"eat ch...
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 an array $a_1, a_2, \\dots, a_n$ and an integer $k$.\n\nYou are asked to divide this array into...
[{"input": "7 6\n-3 0 -1 -2 -2 -4 -1\n", "output": "-45\n"}, {"input": "7 6\n-6 1 -1 -1 -2 -4 -1\n", "output": "-43\n"}, {"input": "7 7\n-3 0 -1 -2 -2 -4 -1\n", "output": "-55\n"}, {"input": "7 6\n-5 1 -1 -1 -2 -4 -1\n", "output": "-42\n"}, {"input": "7 6\n-3 0 -1 -2 -2 -4 0\n", "output": "-39\n"}, {"input": "7 6\n-6 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\nIn number world, two different numbers are friends if they have a lot in common, but also each one has unique...
[{"input": "100\n42 486 341 527 189 740 490 388 989 489 711 174 305 844 971 492 998 954 832 442 424 619 906 154 293 395 439 735 738 915 453 748 786 550 871 932 693 326 53 904 732 835 354 364 691 669 203 719 282 875 573 672 695 640 58 872 732 751 557 779 102 39 213 844 289 137 50 951 284 671 474 829 906 736 395 366 22 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're given a tree with $n$ vertices.\n\nYour task is to determine the maximum possible number of edges that...
[{"input": "10\n7 1\n8 4\n8 10\n4 7\n6 10\n9 3\n3 5\n2 10\n2 5\n", "output": "4\n"}, {"input": "10\n8 1\n8 4\n8 10\n4 7\n6 10\n9 3\n3 5\n2 10\n2 5\n", "output": "4\n"}, {"input": "10\n4 1\n10 4\n8 10\n4 7\n6 5\n9 2\n3 5\n2 10\n2 5\n", "output": "0\n"}, {"input": "10\n4 1\n10 4\n8 10\n4 7\n6 1\n9 2\n3 5\n2 10\n2 5\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\nTak has N cards. On the i-th (1 \\leq i \\leq N) card is written an integer x_i. He is selecting one or more ...
[{"input": "33 3\n3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 3 3 3 3", "output": "4294967295\n"}, {"input": "33 3\n3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 3 3 3 3 3 3 3 3 3 3 3 1 3 3 3 3", "output": "2147483647\n"}, {"input": "33 3\n3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 0 3 3 3 3 3 3 3 3 3 3 1 3 3 3 3", "output": ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nComplete the function/method (depending on the language) to return `true`/`True` when its argument is an arra...
[{"input": "[1, \"[\", \"]\"]\n[\"[\", \"]\", 1]", "output": "[true]", "fn_name": "same_structure_as"}, {"input": "[1, [[[1]]]]\n[2, [[[2]]]]", "output": "[true]", "fn_name": "same_structure_as"}, {"input": "[1, [1, 1]]\n[[2, 2], 2]", "output": "[false]", "fn_name": "same_structure_as"}, {"input": "[1, [1, 1]]\n[2, [2]...
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, Russian and Vietnamese as well. \n\nPhantasialand boasts of its...
[{"input": "4\n1 -1 12 11", "output": "12\n"}, {"input": "4\n1 -2 12 11", "output": "11\n"}, {"input": "4\n-1 -1 0 36", "output": "17\n"}, {"input": "4\n-2 -2 0 36", "output": "16\n"}, {"input": "4\n-1 -1 0 42", "output": "20\n"}, {"input": "4\n1 -2 13 38", "output": "25\n"}, {"input": "4\n2 -2 13 38", "output": "26\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.\n\nYour task is to say the number of such positive int...
[{"input": "6\n10000100623 10000100623 10000100623 10000100623 10000100623 10000100623\n", "output": "2\n"}, {"input": "6\n10000100623 10000100623 10000100623 10000100623 10000100623 10000100623\n", "output": "2\n"}, {"input": "5\n153965681607 99999999977 99999999977 99999999977 99999999977\n", "output": "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\nCount the number of distinct sequences a_1, a_2, ..., a_{n} (1 ≤ a_{i}) consisting of positive integers such ...
[{"input": "495219 444706662\n", "output": "115165527\n"}, {"input": "495219 444706662\n", "output": "115165527\n"}, {"input": "1000000000 1000000000\n", "output": "1\n"}, {"input": "9357 18255507\n", "output": "745979764\n"}, {"input": "225 315096300\n", "output": "413133630\n"}, {"input": "34601 35742833\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\nThere is a grid with N rows and N columns of squares. Let (i, j) be the square at the i-th row from the top a...
[{"input": "176527 15\n1 81279\n2 22308\n2 133061\n1 80744\n2 44603\n1 170938\n2 139754\n2 15220\n1 172794\n1 159290\n2 156968\n1 56426\n2 77429\n1 97459\n2 71282\n", "output": "31159505795\n"}, {"input": "176527 15\n2 81279\n2 22308\n2 145342\n1 106634\n2 60988\n1 170938\n2 139754\n2 15220\n1 172794\n1 159290\n2 15696...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and t...
[{"input": "3\n000000\n24912\n20652", "output": "second\n"}, {"input": "3\n100000\n30000\n29639", "output": "first\n"}, {"input": "3\n000000\n30000\n29639", "output": "first\n"}, {"input": "3\n000001\n30000\n29639", "output": "first\n"}, {"input": "3\n000011\n30000\n29639", "output": "first\n"}, {"input": "3\n000010\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 will be given a contest schedule for D days and M queries of schedule modification. In the i-th query, gi...
[{"input": "5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 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\nThese days Arkady works as an air traffic controller at a large airport. He controls a runway which is usuall...
[{"input": "66 20\n0 16\n0 45\n0 58\n1 6\n1 19\n2 7\n2 9\n3 9\n3 25\n3 57\n4 38\n4 58\n5 21\n5 40\n6 16\n6 19\n6 58\n7 6\n7 26\n7 51\n8 13\n8 36\n8 55\n9 1\n9 15\n9 33\n10 12\n10 37\n11 15\n11 34\n12 8\n12 37\n12 55\n13 26\n14 0\n14 34\n14 36\n14 48\n15 23\n15 29\n15 43\n16 8\n16 41\n16 45\n17 5\n17 7\n17 15\n17 29\n17...
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# Definition\n\n**_Disarium number_** is the number that *The sum of its digits powered with their respective...
[{"input": "2646798", "output": "[\"Disarium !!\"]", "fn_name": "disarium_number"}, {"input": "1306", "output": "[\"Disarium !!\"]", "fn_name": "disarium_number"}, {"input": "2427", "output": "[\"Disarium !!\"]", "fn_name": "disarium_number"}, {"input": "1048576", "output": "[\"Not !!\"]", "fn_name": "disarium_number"}...
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 get to know our hero: Agent #134 - Mr. Slayer.\n\nHe was sent by his CSV agency to Ancient Rome in orde...
[{"input": "\"ksdjai8983hdk?}{\"\n15", "output": "[\"zHsypx8983wsz?}{\"]", "fn_name": "caesar_crypto_encode"}, {"input": "\"eBIIL TLOIA!\"\n-127", "output": "[\"Hello world!\"]", "fn_name": "caesar_crypto_encode"}, {"input": "\"Hello world!\"\n127", "output": "[\"eBIIL TLOIA!\"]", "fn_name": "caesar_crypto_encode"}, {"...
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\nFor long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movemen...
[{"input": "127\n64 96 63 112 62 95 61 120 60 94 59 111 58 93 57 124 56 92 55 110 54 91 53 119 52 90 51 109 50 89 49 126 48 88 47 108 46 87 45 118 44 86 43 107 42 85 41 123 40 84 39 106 38 83 37 117 36 82 35 105 34 81 33 127 32 80 31 104 30 79 29 116 28 78 27 103 26 77 25 122 24 76 23 102 22 75 21 115 20 74 19 101 18 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\nA linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:\...
[{"input": "5\n0 1 3 11 0\n5\n-1 12 2 0 7\n10\n46 2 28 27 203 31 14 81 122 141\n0", "output": "9 15 10\n6 11 13\n6 13 6\n"}, {"input": "5\n10 4 3 3 1\n5\n7 12 2 0 7\n10\n372 8 42 18 176 40 12 56 169 141\n0", "output": "0 1 1\n6 11 13\n0 15 15\n"}, {"input": "5\n5 1 3 11 0\n5\n0 12 2 0 7\n10\n46 2 28 27 203 31 14 81 122...
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. \nLeonid is developing new programming language. T...
[{"input": "2\n1000 2**3*3**1\n100000 4**2*2**11", "output": "24\n32768\n"}, {"input": "2\n1001 2**3*2**1\n100000 4**2*2**11", "output": "16\n32768\n"}, {"input": "2\n1000 2**4*3**1\n111000 4**2*2**11", "output": "48\n32768\n"}, {"input": "2\n1100 2**3*3**1\n110000 4**1*3**11", "output": "24\n48588\n"}, {"input": "2\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\nMany internet protocols these days include the option of associating a\nmedia type with the content being sen...
[{"input": "3 7\nhtml lmth/txft\nlht text/itml\ngnp image/png\nsug lmx+gvt/ehami\ntxt text/plajn\nindex.html\nthis.file.has.lots.of.dots.txt\nnoaotsdsall\nvires.uxe\ndont.let.the.png.fool.you\ncXT.trettam.esaT", "output": "unknown\nunknown\nlmth/txft\nunknown\nunknown\nunknown\nunknown\n"}, {"input": "2 7\nhmtl text/ht...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nOur brave travelers reached an island where pirates had buried treasure. However as the ship was about to moo...
[{"input": "20 20\n####################\n############.####.##\n#######..####..#####\n######............##\n######.....#...###.#\n#####E..........##.#\n#.##.#.........#####\n##NR....KO.....#####\n##B........#...#####\n#Y.W...H.......#####\n#####Z.....#...#####\n######...#.#...#####\n#A.......#.#...#####\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\nSince the giant heads have appeared in the sky all humanity is in danger, so all Ricks and Mortys from all pa...
[{"input": "100 50\n2 62 -62\n2 19 -19\n2 38 -38\n2 -84 84\n2 -16 16\n2 67 -67\n2 41 -41\n2 -32 32\n2 32 -32\n2 -62 62\n2 89 -89\n2 -84 84\n2 96 -96\n2 -11 11\n2 59 -59\n2 -13 13\n2 -70 70\n2 -3 3\n2 -41 41\n2 -74 74\n2 47 -47\n2 87 -87\n2 17 -17\n2 20 -20\n2 -14 14\n2 -67 67\n2 -95 95\n2 -15 15\n2 -49 49\n2 75 -75\n2 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn this Kata, you will be given a lower case string and your task will be to remove `k` characters from that ...
[{"input": "\"cccaabababaccbc\"\n3", "output": "[\"cccbbabaccbc\"]", "fn_name": "solve"}, {"input": "\"hxehmvkybeklnj\"\n5", "output": "[\"xmvkyklnj\"]", "fn_name": "solve"}, {"input": "\"abracadabra\"\n0", "output": "[\"abracadabra\"]", "fn_name": "solve"}, {"input": "\"abracadabra\"\n1", "output": "[\"bracadabra\"]",...
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\nEvery Turkish citizen has an identity number whose validity can be checked by these set of rules:\n\n- It is ...
[{"input": "\"x5810a78432\"", "output": "[false]", "fn_name": "check_valid_tr_number"}, {"input": "\"03868894286\"", "output": "[false]", "fn_name": "check_valid_tr_number"}, {"input": "692352217312", "output": "[false]", "fn_name": "check_valid_tr_number"}, {"input": "12762438338", "output": "[false]", "fn_name": "che...
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\nMakoto has a big blackboard with a positive integer $n$ written on it. He will perform the following action e...
[{"input": "1000000000000000 10000\n", "output": "215514159\n"}, {"input": "1000000000000000 10000\n", "output": "215514159\n"}, {"input": "1000000000001000 10000\n", "output": "150774797\n"}, {"input": "1172768550854780 8998\n", "output": "789402181\n"}, {"input": "1292761461062695 8123\n", "output": "574008655\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\nYouKn0wWho has two even integers x and y. Help him to find an integer n such that 1 ≤ n ≤ 2 ⋅ 10^{18} and n m...
[{"input": "4\n4 8\n4 1\n420 420\n167306 42068\n", "output": "8\n5\n420\n209374\n"}, {"input": "4\n4 8\n4 1\n420 420\n167306 11758\n", "output": "8\n5\n420\n179064\n"}, {"input": "4\n6 8\n4 1\n420 420\n167306 11758\n", "output": "7\n5\n420\n179064\n"}, {"input": "4\n4 8\n4 2\n420 420\n83876 42068\n", "output": "8\n6\n4...
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\nLife is not easy. Sometimes it is beyond your control. Now, as contestants of ACM ICPC, you might be just tas...
[{"input": "1\nnorth\n3\nnorth\neasu\nsouth\n0", "output": "5\n1\n"}, {"input": "1\nnorth\n0\nnorth\ntsae\nosuth\n-1", "output": "5\n"}, {"input": "1\nnorth\n0\nmorth\ntsae\nosuth\n-1", "output": "5\n"}, {"input": "1\nnorth\n0\nmorth\ntsae\nostth\n-1", "output": "5\n"}, {"input": "1\nnorth\n0\nntroh\ntsaf\nsouth\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\nNikolay has only recently started in competitive programming, but already qualified to the finals of one pres...
[{"input": "25\n5 1 1\n5 2 3\n5 5 5\n5 5 1\n5 4 4\n10 1 2\n10 3 7\n10 10 10\n10 3 1\n10 7 6\n1000000 21232 1234\n999999 999999 999999\n1000000 300001 966605\n1000000 290001 679121\n500000 111099 123456\n100 1 1\n1000000000 1 1000000000\n1000000000 1 500000000\n100000000 1 12345678\n1000000000 1 499999999\n1000000000 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\nIt's the fourth quater of the Super Bowl and your team is down by 4 points. You're 10 yards away from the end...
[{"input": "[[3, \"run\"], [3, \"run\"], [3, \"run\"], [10, \"turnover\"]]", "output": "[false]", "fn_name": "did_we_win"}, {"input": "[[10, \"run\"], [10, \"sack\"], [10, \"pass\"], [1, \"sack\"]]", "output": "[false]", "fn_name": "did_we_win"}, {"input": "[[5, \"pass\"], [5, \"pass\"], [10, \"sack\"], [10, \"run\"]]"...
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\nSince Grisha behaved well last year, at New Year's Eve he was visited by Ded Moroz who brought an enormous ba...
[{"input": "1000000000000000000 1000000000000000000\n", "output": "1152921504606846975\n"}, {"input": "1100000000000000000 1000000000000000000\n", "output": "1152921504606846975\n"}, {"input": "1100000000010000000 1000000000000000000\n", "output": "1152921504606846975\n"}, {"input": "1005016953863700545 145946161059548...
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 consisting of N vertices and M edges. The vertices are numbered 1 to N, and...
[{"input": "13 23\nABAAAABBBBAAB\n7 1\n10 6\n1 11\n2 10\n2 8\n2 11\n11 12\n8 3\n7 11\n11 2\n13 13\n11 9\n4 1\n9 7\n9 6\n8 13\n8 6\n4 10\n8 7\n4 3\n2 1\n8 12\n6 9", "output": "Yes\n"}, {"input": "13 23\nABAAAABBBBAAB\n7 1\n10 6\n1 11\n2 10\n2 8\n2 11\n11 12\n8 3\n7 12\n11 2\n13 13\n11 9\n4 1\n9 7\n9 6\n8 13\n8 6\n4 10\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\nIn this kata, you will make a function that converts between `camelCase`, `snake_case`, and `kebab-case`.\n\n...
[{"input": "\"doHTMLRequest\"\n\"kebab\"", "output": "[\"do-h-t-m-l-request\"]", "fn_name": "change_case"}, {"input": "\"some-lisp-name\"\n\"camel\"", "output": "[\"someLispName\"]", "fn_name": "change_case"}, {"input": "\"map_to_all\"\n\"kebab\"", "output": "[\"map-to-all\"]", "fn_name": "change_case"}, {"input": "\"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\nCreate a function that takes a number and finds the factors of it, listing them in **descending** order in an...
[{"input": "54", "output": "[[54, 27, 18, 9, 6, 3, 2, 1]]", "fn_name": "factors"}, {"input": "\"hello world\"", "output": "[-1]", "fn_name": "factors"}, {"input": "49", "output": "[[49, 7, 1]]", "fn_name": "factors"}, {"input": "-12", "output": "[-1]", "fn_name": "factors"}, {"input": "\"a\"", "output": "[-1]", "fn_nam...
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\nAtCoDeer has three cards, one red, one green and one blue.\n\nAn integer between 1 and 9 (inclusive) is writt...
[{"input": "4 3 2\n", "output": "YES\n"}, {"input": "2 3 4\n", "output": "NO\n"}, {"input": "7 3 2", "output": "YES\n"}, {"input": "7 6 0", "output": "YES\n"}, {"input": "2 6 0", "output": "YES\n"}, {"input": "9 6 0", "output": "YES\n"}, {"input": "0 6 0", "output": "YES\n"}, {"input": "5 6 0", "output": "YES\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\n*This is the advanced version of the \n[Minimum and Maximum Product of k Elements](https://www.codewars.com/k...
[{"input": "[0, -1, -2, -3, -4]\n3", "output": "[[-24, 0]]", "fn_name": "find_min_max_product"}, {"input": "[0, -1, -2, -3, -4]\n2", "output": "[[0, 12]]", "fn_name": "find_min_max_product"}, {"input": "[-1, -2, -3, -4]\n3", "output": "[[-24, -6]]", "fn_name": "find_min_max_product"}, {"input": "[-1, -2, -3, -4]\n2", "...
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\nIn some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to e...
[{"input": "290178 291177\n", "output": "208323\n"}, {"input": "336594 337545\n", "output": "115131\n"}, {"input": "124075 124692\n", "output": "65961\n"}, {"input": "82747 83560\n", "output": "247331\n"}, {"input": "61024 61453\n", "output": "30782\n"}, {"input": "130815 131327\n", "output": "1\n"}, {"input": "498500 ...
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 boys decided to compete in text typing on the site \"Key races\". During the competition, they have to ty...
[{"input": "1000 1000 1000 1000 1000\n", "output": "Friendship\n"}, {"input": "1000 1000 1000 1000 1000\n", "output": "Friendship\n"}, {"input": "13 849 819 723 918\n", "output": "Friendship\n"}, {"input": "13 849 819 723 918\n", "output": "Friendship\n"}, {"input": "37 261 207 1 1000\n", "output": "Friendship\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\nIn the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The ...
[{"input": "10\nR50C12\nR23C47\nY96\nR44C13\nR19C21\nR95C73\nBK12\nR51C74\nAY34\nR63C25\n", "output": "L50\nAU23\nR96C25\nM44\nU19\nBU95\nR12C63\nBV51\nR34C51\nY63\n"}, {"input": "10\nR50C12\nR23C47\nY96\nR44C13\nR19C21\nR95C73\nBK12\nR51C74\nAY34\nR62C25\n", "output": "L50\nAU23\nR96C25\nM44\nU19\nBU95\nR12C63\nBV51\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're given Q queries of the form (L, R). \n\nFor each query you have to find the number of such x that L ≤ ...
[{"input": "20\n862 928\n758 964\n541 789\n622 943\n328 900\n14 764\n217 1554\n461 847\n442 468\n544 1157\n518 529\n938 993\n620 851\n690 944\n484 601\n320 910\n98 1355\n816 794\n765 880\n551 1280\n", "output": "1\n4\n5\n6\n14\n32\n30\n9\n0\n12\n1\n1\n5\n4\n4\n15\n35\n0\n2\n13\n"}, {"input": "20\n862 928\n758 964\n541 ...
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\nHaving written another programming contest, three Rabbits decided to grab some lunch. The coach gave the team...
[{"input": "2 3\n1000000000 1\n2 2\n", "output": "1000000000\n"}, {"input": "2 3\n1000000000 1\n2 2\n", "output": "1000000000\n"}, {"input": "2 4\n1000000000 1\n2 2\n", "output": "1000000000\n"}, {"input": "2 4\n1000000000 1\n2 0\n", "output": "1000000000\n"}, {"input": "2 4\n1000000000 1\n3 0\n", "output": "1000000000...
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 positive integer n, we denote the integer obtained by reversing the decimal notation of n (without lead...
[{"input": "864197532", "output": "1920"}, {"input": "1663355059", "output": "0\n"}, {"input": "3070868988", "output": "0\n"}, {"input": "2599007699", "output": "0\n"}, {"input": "4586279406", "output": "0\n"}, {"input": "1877134154", "output": "0\n"}, {"input": "1149390088", "output": "0\n"}, {"input": "6200730", "out...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given two integer arrays a and b of length n.\n\nYou can reverse at most one subarray (continuous sub...
[{"input": "100\n8 4 3 5 10 9 5 8 5 7 4 9 4 6 8 8 2 6 3 3 10 7 10 8 6 2 7 4 9 7 7 2 4 5 2 4 9 5 10 1 10 5 10 4 1 3 4 2 6 9 9 9 10 6 2 5 3 1 8 10 4 10 3 4 9 5 5 4 10 4 5 3 7 10 2 7 3 8 6 6 1 0 5 5 4 6 6 4 4 1 5 1 6 6 6 8 8 6 2 6\n0 4 0 5 7 5 4 10 4 10 1 2 1 5 8 2 8 7 1 9 9 5 6 9 4 6 9 9 10 17 4 3 7 4 10 10 9 4 4 7 9 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\nAfter the contest in comparing numbers, Shapur's teacher found out that he is a real genius and that no one c...
[{"input": "Iran_\nPersian;\nW_o;n;d;e;r;f;u;l;\n7\nWonderfulPersianIran\nwonderful_PersIAN_IRAN;;_\nWONDERFUL___IRAN__PERSIAN__;;\nIra__Persiann__Wonderful\nWonder;;fulPersian___;I;r;a;n;\n__________IranPersianWonderful__________\nPersianIran_is_Wonderful\n", "output": "ACC\nACC\nACC\nWA\nACC\nACC\nWA\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 developing frog-shaped robots, and decided to race them against each other.\n\nFirst, you placed N ro...
[{"input": "13\n4 11 8 9 10 12 14 15 16 18 20 21 22", "output": "311014372\n"}, {"input": "13\n4 16 8 9 10 19 14 24 18 18 20 21 22", "output": "790015972\n"}, {"input": "13\n4 11 8 6 10 19 14 24 16 18 20 21 22", "output": "916006393\n"}, {"input": "13\n4 14 4 9 10 12 14 15 16 18 20 65 22", "output": "437004793\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\nBased on the information of the time when study started and the time when study ended, check whether the tota...
[{"input": "10\n3\n6 11\n12 15\n18 22\n14\n2\n6 14\n13 20\n0", "output": "OK\nOK\n"}, {"input": "10\n3\n6 11\n12 15\n34 22\n14\n2\n6 14\n13 20\n0", "output": "14\nOK\n"}, {"input": "10\n3\n20 11\n2 15\n34 22\n13\n2\n4 14\n13 33\n0", "output": "18\nOK\n"}, {"input": "10\n3\n12 11\n2 15\n34 22\n14\n2\n6 14\n13 20\n0", "o...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nBerland has n cities connected by m bidirectional roads. No road connects a city to itself, and each pair of ...
[{"input": "10 45\n3 5\n2 3\n4 8\n2 5\n6 8\n10 7\n2 1\n3 7\n5 10\n6 1\n9 8\n3 1\n2 10\n6 7\n1 7\n7 9\n6 9\n9 3\n4 2\n2 6\n5 6\n5 8\n3 4\n10 8\n7 8\n4 6\n9 1\n5 5\n7 4\n1 10\n9 2\n2 8\n6 10\n9 8\n1 5\n7 2\n10 3\n3 8\n2 10\n1 1\n10 7\n1 3\n1 8\n10 2\n4 10\n", "output": "0\n"}, {"input": "10 45\n3 5\n2 3\n4 8\n2 5\n6 8\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\nMy friend John likes to go to the cinema. He can choose between system A and system B.\n```\nSystem A : he bu...
[{"input": "2500\n20\n0.9", "output": "[135]", "fn_name": "movie"}, {"input": "100\n10\n0.95", "output": "[24]", "fn_name": "movie"}, {"input": "500\n15\n0.9", "output": "[43]", "fn_name": "movie"}, {"input": "250\n20\n0.9", "output": "[21]", "fn_name": "movie"}, {"input": "500\n20\n0.9", "output": "[34]", "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\nThree swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left ...
[{"input": "10\n992222955174044630 49635415 8474 173727148\n618311281854681640 657834994 40173216 75996939\n710602478618400425 332897175 71490165 534449640\n768753872531302819 113476460 449 799174641\n633188994852953277 834175592 3132 788542124\n964246686346975322 539872840 295075 782348226\n683685407217150496 18798310...
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\nSimon and Antisimon play a game. Initially each player receives one fixed positive integer that doesn't chang...
[{"input": "100 100 100\n", "output": "0\n"}, {"input": "100 101 100\n", "output": "0\n"}, {"input": "100 100 10\n", "output": "0\n"}, {"input": "100 110 10\n", "output": "0\n"}, {"input": "34 106 143\n", "output": "1\n"}, {"input": "165 49 110\n", "output": "1\n"}, {"input": "100 1 100\n", "output": "0\n"}, {"input": ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere will be a launch of a new, powerful and unusual collider very soon, which located along a straight line...
[{"input": "30\nRLLRLRLLRRRLRRRLLLLLLRRRLRRLRL\n128 610 1680 2436 2896 2994 3008 3358 3392 4020 4298 4582 4712 4728 5136 5900 6088 6232 6282 6858 6934 7186 7224 7256 7614 8802 8872 9170 9384 9794\n", "output": "7\n"}, {"input": "30\nRLLRLRLLRRRLRRRLLLLLLRRRLRRLRL\n128 610 1680 2436 2896 2994 3008 3358 3392 4020 4298 45...
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$ of $n$ integers, and another integer $k$ such that $2k \\le n$.\n\nYou have to per...
[{"input": "1\n88 38\n9 143 135 72 74 12 120 27 108 183 18 24 163 122 140 155 166 188 197 14 134 66 188 161 79 100 40 55 161 118 121 18 72 141 136 31 39 187 2 98 16 118 120 196 127 66 135 186 49 16 17 50 107 192 50 23 62 110 83 124 197 127 185 129 131 182 45 147 174 115 89 109 177 7 70 43 75 5 157 93 59 26 176 105 32 8...
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\nHeiankyo is known as a town with a grid of roads.\n\nHokusai, a cat who lives in Heiankyo, has to go from his...
[{"input": "4\n0 2\n0\n1 2\n2\n0 0 0 1\n0 0 1 0\n4 0\n4\n1 0 0 0\n3 5 2 3\n4 0 4 0\n0 2 0 4\n15 5\n0", "output": "1\nMiserable Hokusai!\nMiserable Hokusai!\n15504\n"}, {"input": "4\n2 2\n0\n1 2\n2\n0 0 0 1\n0 0 1 0\n4 0\n4\n1 0 0 0\n3 3 2 3\n4 0 4 0\n0 2 0 3\n15 3\n0", "output": "6\nMiserable Hokusai!\nMiserable Hokusa...
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\nDo you know \"sed,\" a tool provided with Unix? Its most popular use is to substitute every occurrence of a s...
[{"input": "2\na bb\nb aa\nb\nbbbbbbbb\n1\nb aa\nb\naaaaa\n3\nbb aab\nabc aadc\nad dee\nabc\ndeeeeeeeec\n10\na acb\nb bai\nc acf\nd bec\ne bbh\nf fag\ng abe\nh bag\ni aaj\nj bbb\na\nabaceaabe\n0", "output": "-1\n-1\n-1\n-1\n"}, {"input": "2\na bb\nb aa\nb\nbbbbbbbb\n1\nb aa\nb\naaaaa\n3\nbb aab\nabc aadc\nad dee\nbac\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\nTop-model Izabella participates in the competition. She wants to impress judges and show her mathematical ski...
[{"input": "1111111111101111111111111111111111111011111111111111111111111101111011111101111111111101111111111111\n", "output": "yes\n"}, {"input": "0110111111111111111111011111111110110111110111111111111111111111111111111111111110111111111111111111\n", "output": "yes\n"}, {"input": "110011000111101100110110100000111011...
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\nSo the Beautiful Regional Contest (BeRC) has come to an end! $n$ students took part in the contest. The final...
[{"input": "5\n12\n5 4 4 3 2 2 1 1 1 1 1 1\n4\n4 3 2 2\n1\n1000100\n20\n20 19 18 17 16 15 14 13 15 11 10 9 8 7 6 5 4 3 2 1\n32\n125 64 63 58 58 58 58 58 37 37 37 37 34 34 28 28 28 28 28 28 24 24 19 17 17 17 17 16 16 16 16 11\n", "output": "1 2 3\n0 0 0\n0 0 0\n1 2 7\n1 2 11\n"}, {"input": "5\n12\n5 4 4 3 2 2 1 1 1 1 1 ...
code_stdio