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\nLet's call left cyclic shift of some string $t_1 t_2 t_3 \\dots t_{n - 1} t_n$ as string $t_2 t_3 \\dots t_{n...
[{"input": "3\n142345\n100120013\n253858690946\n", "output": "4\n5\n8\n"}, {"input": "3\n175995\n155501496\n289014129764\n", "output": "4\n6\n8\n"}, {"input": "3\n142345\n100120013\n339309424207\n", "output": "4\n5\n8\n"}, {"input": "3\n142345\n186796866\n339309424207\n", "output": "4\n5\n8\n"}, {"input": "3\n180899\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\nWrite a function with the signature shown below:\n```python\ndef is_int_array(arr):\n return True\n```\n* ...
[{"input": "[-11, -12, -13, -14]", "output": "[true]", "fn_name": "is_int_array"}, {"input": "[1.0, 2.0, 3.0001]", "output": "[false]", "fn_name": "is_int_array"}, {"input": "[1.0, 2.0, 3.0]", "output": "[true]", "fn_name": "is_int_array"}, {"input": "[1, 2, null]", "output": "[false]", "fn_name": "is_int_array"}, {"in...
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 people are arranged in a row from left to right.\nYou are given a string S of length N consisting of 0 and ...
[{"input": "98351 25613\n1010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nKolya got string s for his birthday, the string consists of small English letters. He immediately added k mor...
[{"input": "jhfwjyyzwrjiyrrgveiqkoltivghgkontrqragikttxxuwszjwqhwxindyrdqhucnbwgwrppgqmsasrzohezjlfmkzsqptwpratprcrxyxecnlsaiqrvimihmhjfgzwdtvmfhgbuonpsblphyoxzclkrwbwrkasahiirzqlfjdoomlosltldbpomyyhmdwfchzxnmwlh\n200\n", "output": "400\n"}, {"input": "nemtbujbscvkgxnbqboeohzfozihjvhcllfseiouggzojhqcoqrvtdsgkubiophnhah...
code_stdio
[ { "content": "You are an expert Python programmer. 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 of integers $a_1,a_2,\\ldots,a_n$. Find the maximum possible value of $a_ia_ja_ka_la_t...
[{"input": "4\n5\n-1 -1 -4 -1 -5\n6\n-4 -4 -3 1 2 -1\n6\n0 -1 -1 -1 -1 -1\n6\n-12 -7 -10 -3 -2 1\n", "output": "-20\n96\n0\n2520\n"}, {"input": "4\n5\n-1 -1 -4 -1 -5\n6\n-4 -4 -3 1 2 -1\n6\n0 -1 -1 -1 -1 -1\n6\n-9 -7 -10 -3 -2 1\n", "output": "-20\n96\n0\n1890\n"}, {"input": "4\n5\n-1 -1 -3 -4 -5\n6\n-1 -2 -3 1 2 -1\n6...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTaro, a boy who hates any inefficiencies, pays coins so that the number of coins to be returned as change is ...
[{"input": "123 3 0 2 0 2 0\n1263 14 10 9 3 18 1\n0 0 0 0 0 0 0", "output": "6\n13\n"}, {"input": "167 3 1 2 1 2 1\n1826 9 9 9 1 15 10\n0 0 0 0 0 0 0", "output": "6\n10\n"}, {"input": "123 6 1 2 1 1 2\n999 17 15 9 2 16 10\n0 0 0 0 0 0 0", "output": "6\n3\n"}, {"input": "123 6 1 2 1 1 2\n999 17 15 9 2 14 10\n0 0 0 0 0 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\nYou have k pieces of laundry, each of which you want to wash, dry and fold. You are at a laundromat that has ...
[{"input": "10000 1000 1000 1000 1000 1000 1000\n", "output": "12000\n"}, {"input": "10000 1000 1000 1000 1010 1000 1000\n", "output": "12100\n"}, {"input": "10000 1000 1000 1000 1010 1001 1000\n", "output": "12101\n"}, {"input": "10000 1000 1000 1000 1000 1000 1000\n", "output": "12000"}, {"input": "10000 1 1 1 1000 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\nRead problems statements in Mandarin Chinese and Russian. \n\nFor positive integer x let define function F(x...
[{"input": "1 20\n1 17 2 0 6", "output": "18\n"}, {"input": "1 19\n1 12 0 6 5", "output": "15\n"}, {"input": "5 22\n0 27 0 4 2", "output": "13\n"}, {"input": "8 34\n1 3 3 4 10", "output": "28\n"}, {"input": "15 23\n2 3 3 4 3", "output": "17\n"}, {"input": "0 27\n2 26 2 0 1", "output": "23\n"}, {"input": "15 23\n2 3 0 4...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nBoboniu likes playing chess with his employees. As we know, no employee can beat the boss in the chess game, ...
[{"input": "95 147 67 82\n", "output": "67 82\n1 82\n1 1\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n1 9\n1 10\n1 11\n1 12\n1 13\n1 14\n1 15\n1 16\n1 17\n1 18\n1 19\n1 20\n1 21\n1 22\n1 23\n1 24\n1 25\n1 26\n1 27\n1 28\n1 29\n1 30\n1 31\n1 32\n1 33\n1 34\n1 35\n1 36\n1 37\n1 38\n1 39\n1 40\n1 41\n1 42\n1 43\n1 44\n1 45\n1 46\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\nMultiplication of Big Integers\n\nGiven two integers $A$ and $B$, compute the product, $A \\times B$.\n\nInpu...
[{"input": "2 -134", "output": "-268\n"}, {"input": "3 -134", "output": "-402\n"}, {"input": "6 -134", "output": "-804\n"}, {"input": "-124 4", "output": "-496\n"}, {"input": "-103 -1", "output": "103\n"}, {"input": "2 -67", "output": "-134\n"}, {"input": "6 -51", "output": "-306\n"}, {"input": "7 -51", "output": "-357...
code_stdio
[ { "content": "You are an expert Python programmer. 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 managed to intercept an important message and you are trying to read it.\n\nYou realise that the mes...
[{"input": "\"qzezxirkg rh z srts ovevo wbmznrx fmgbkvw zmw rmgvikivgvw kiltiznnrmt ozmtfztv rg szh yvvm hgzmwziwravw rm gsv vxnzxirkg ozmtfztv hkvxrurxzgrlm zolmthrwv sgno zmw xhh rg rh lmv lu gsv gsivv vhhvmgrzo gvxsmloltrvh lu dliow drwv dvy xlmgvmg kilwfxgrlm gsv nzqlirgb lu dvyhrgvh vnkolb rg zmw rg rh hfkkligvw y...
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\nRailroad Trip\n\nThere are N cities in the JOI country, numbered 1, 2, ..., and N, respectively. In addition,...
[{"input": "4 4\n1 3 2 4\n147 131 100\n100 50 80\n250 70 130", "output": "577\n"}, {"input": "4 4\n1 3 3 4\n147 131 100\n100 50 80\n250 70 130", "output": "447\n"}, {"input": "4 4\n1 3 2 4\n120 90 100\n110 50 96\n250 138 130", "output": "616\n"}, {"input": "4 4\n1 3 2 4\n120 90 100\n110 50 111\n115 75 130", "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\nIn this Kata, you will be given a string of numbers in sequence and your task will be to return the missing n...
[{"input": "\"900001900002900004900005900006\"", "output": "[900003]", "fn_name": "missing"}, {"input": "\"998999100010011003\"", "output": "[1002]", "fn_name": "missing"}, {"input": "\"99991000110002\"", "output": "[10000]", "fn_name": "missing"}, {"input": "\"979899100101102\"", "output": "[-1]", "fn_name": "missing"...
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\nSasha and Kolya decided to get drunk with Coke, again. This time they have k types of Coke. i-th type is char...
[{"input": "971 108\n706 706 991 706 988 997 996 997 991 996 706 706 996 706 996 984 1000 991 996 1000 724 724 997 991 997 984 997 1000 984 996 996 997 724 997 997 1000 997 724 984 997 996 988 997 706 706 997 1000 991 706 988 997 724 988 706 996 706 724 997 988 996 991 1000 1000 724 988 996 1000 988 984 996 991 724 706...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nGenos needs your help. He was asked to solve the following programming problem by Saitama:\n\nThe length of s...
[{"input": "1001101001101110101101000\n01111000010011111111110010001101000100011110101111\n", "output": "321\n"}, {"input": "1110010001000101001011111\n00011011000000100001010000010100110011010001111010\n", "output": "316\n"}, {"input": "1001101001101110101101000\n01111000010011111111110010001101000100011110101111\n", ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAfter a probationary period in the game development company of IT City Petya was included in a group of the p...
[{"input": "1000000000\n", "output": "3000000003000000001\n"}, {"input": "1147564610\n", "output": "3950713605816050131\n"}, {"input": "1000010000\n", "output": "3000060003300030001\n"}, {"input": "1065935402\n", "output": "3408654846908511019\n"}, {"input": "1000010010\n", "output": "3000060063300630331\n"}, {"input":...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n<image>\n\n\nArrange integers (0 or more and 99 or less) in a rhombus as illustrated in Fig. 1. Create a prog...
[{"input": "7\n3,8\n8,1,0\n2,9,5,4\n4,5,2,6,5\n2,7,4,4\n8,1,1\n8,3\n10", "output": "65\n"}, {"input": "7\n8,3\n8,1,0\n4,4,7,1\n5,6,2,5,4\n2,7,4,4\n8,1,0\n8,3\n15", "output": "71\n"}, {"input": "7\n8,3\n8,1,0\n4,4,7,1\n5,6,2,5,4\n2,7,4,4\n8,1,0\n8,3\n24", "output": "80\n"}, {"input": "7\n3,8\n8,1,0\n2,7,4,4\n4,5,2,6,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\nA bracket sequence is a string, containing only characters \"(\", \")\", \"[\" and \"]\".\n\nA correct bracke...
[{"input": "[()][([[]])][[[]()]][()[]]()()([[][]][[]][](()))[[[(())]]][]()(([([])(([[[]]()])(()))]((())))([()]([()[[[]([][[[[][(())([[]()])]]][[(())]([])]()][[](())]()[])]()[][]]([[]])[]])[(()[()((()[][()]))][])[]()()([]())](()[][][])()()[]()))[]()[]\n", "output": "61\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\nThere are the following games.\n\nN characters are lined up in a vertical row. The color of these ...
[{"input": "12\n3\n2\n1\n1\n1\n3\n2\n1\n2\n1\n1\n5\n2\n3\n2\n1\n2\n2\n5\n0\n0\n3\n2\n-1\n0\n0", "output": "8\n2\n1\n2\n"}, {"input": "12\n3\n2\n1\n1\n1\n3\n2\n2\n2\n2\n1\n5\n2\n3\n2\n1\n2\n2\n5\n1\n0\n3\n2\n-1\n0\n0", "output": "3\n2\n1\n2\n"}, {"input": "12\n3\n1\n0\n1\n0\n3\n2\n2\n3\n1\n1\n3\n12\n4\n4\n2\n1\n2\n5\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\nThere are n sheets of square paper of the same size. Align the bottom of these papers horizontally and arrang...
[{"input": "5\n29\n0", "output": "5\n4 1\n3 2\n3 1 1\n2 2 1\n2 1 1 1\n1 1 1 1 1\n29\n28 1\n27 2\n27 1 1\n26 3\n26 2 1\n26 1 1 1\n25 4\n25 3 1\n25 2 2\n25 2 1 1\n25 1 1 1 1\n24 5\n24 4 1\n24 3 2\n24 3 1 1\n24 2 2 1\n24 2 1 1 1\n24 1 1 1 1 1\n23 6\n23 5 1\n23 4 2\n23 4 1 1\n23 3 3\n23 3 2 1\n23 3 1 1 1\n23 2 2 2\n23 2 2 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nOnce upon a time a little frog whose name was Vasya decided to travel around his home swamp. Overall there ar...
[{"input": "10000\n", "output": "1 10000 2 9999 3 9998 4 9997 5 9996 6 9995 7 9994 8 9993 9 9992 10 9991 11 9990 12 9989 13 9988 14 9987 15 9986 16 9985 17 9984 18 9983 19 9982 20 9981 21 9980 22 9979 23 9978 24 9977 25 9976 26 9975 27 9974 28 9973 29 9972 30 9971 31 9970 32 9969 33 9968 34 9967 35 9966 36 9965 37 9964...
code_stdio
[ { "content": "You are an expert Python programmer. 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$ coins of value $n$ and $b$ coins of value $1$. You always pay in exact change, so you want to kn...
[{"input": "6\n1 1000000000 1 1000000000\n1 1000000000 1 1000000000\n1 1000000000 1 1000000000\n1 1000000000 1 1000000000\n1 1000000000 1 1000000000\n1 1000000000 1 1000000000\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\n"}, {"input": "6\n1 1000000000 1 1000000000\n1 1000000000 1 1000000000\n1 1000000000 1 1000000000\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# Definition\n\nAn **_element is leader_** *if it is greater than The Sum all the elements to its right side*...
[{"input": "[0, -1, -29, 3, 2]", "output": "[[0, -1, 3, 2]]", "fn_name": "array_leaders"}, {"input": "[16, 17, 4, 3, 5, 2]", "output": "[[17, 5, 2]]", "fn_name": "array_leaders"}, {"input": "[-36, -12, -27]", "output": "[[-36, -12]]", "fn_name": "array_leaders"}, {"input": "[-1, -29, -26, -2]", "output": "[[-1]]", "fn_...
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 given two circles $c1$ and $c2$, print\n\n\n4\n\n\nif they do not cross (there are 4 common tangent lines...
[{"input": "-26 -2 -2\n15 2 -1", "output": "4\n"}, {"input": "-26 -2 -2\n15 2 -2", "output": "4\n"}, {"input": "-26 -2 -1\n15 2 -2", "output": "4\n"}, {"input": "-26 -2 -1\n21 2 -2", "output": "4\n"}, {"input": "-35 -1 -1\n46 3 0", "output": "4\n"}, {"input": "-35 -1 -2\n46 3 0", "output": "4\n"}, {"input": "-35 -1 -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\nIahub recently has learned Bubble Sort, an algorithm that is used to sort a permutation with n elements a_1, ...
[{"input": "100\n36 48 92 87 28 85 42 10 44 41 39 3 79 9 14 56 1 16 46 35 93 8 82 26 100 59 60 2 96 52 13 98 70 81 71 94 54 91 17 88 33 30 19 50 18 73 65 29 78 21 61 7 99 97 45 89 57 27 76 11 49 72 84 69 43 62 4 22 75 6 66 83 38 34 86 15 40 51 37 74 67 31 20 63 77 80 12 53 5 25 58 90 68 24 64 23 95 32 55 47\n", "output...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are an immigration officer in the Kingdom of AtCoder. The document carried by an immigrant has some numbe...
[{"input": "5\n-1 -1 1 1 321", "output": "APPROVED\n"}, {"input": "5\n-1 -1 1 1 337", "output": "APPROVED\n"}, {"input": "5\n-1 -1 1 1 200", "output": "APPROVED\n"}, {"input": "5\n-1 -1 1 1 385", "output": "APPROVED\n"}, {"input": "5\n0 -1 5 1 252", "output": "APPROVED\n"}, {"input": "5\n6 7 3 10 31", "output": "APPROV...
code_stdio
[ { "content": "You are an expert Python programmer. 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, the Pythagorean theorem — is a relation in Euclidean geometry among the three sides of a righ...
[{"input": "10000\n", "output": "12471\n"}, {"input": "9999\n", "output": "12467\n"}, {"input": "10000\n", "output": "12471"}, {"input": "9999\n", "output": "12467"}, {"input": "1000\n", "output": "881\n"}, {"input": "1201\n", "output": "1096"}, {"input": "1590\n", "output": "1520"}, {"input": "1195\n", "output": "1091...
code_stdio
[ { "content": "You are an expert Python programmer. 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 the Jumbo will practice golf.\nHis objective is to get a carry distance that is a multiple of K, wh...
[{"input": "1000\n2 1000\n", "output": "OK\n"}, {"input": "279\n691 872\n", "output": "OK\n"}, {"input": "379\n400 757\n", "output": "NG\n"}, {"input": "1000\n1 999\n", "output": "NG\n"}, {"input": "17\n629 629\n", "output": "OK\n"}, {"input": "48\n888 912\n", "output": "OK\n"}, {"input": "23\n391 404\n", "output": "OK...
code_stdio
[ { "content": "You are an expert Python programmer. 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 probably know, Anton goes to school. One of the school subjects that Anton studies is Bracketology. On...
[{"input": "((((()())))())((((((()(()())(()())()((()()))(((())()()()(())))))()())())))(()()(()))))()(((()(((())()))())())))))(()()()((((((())(()())())()())(()))))()(()))(((()()()))())()(((()(()(((()))(()))()(()))((((((((())))))()))())(())))))()(()(()(((()((()()()())(((())())((()())(((((()()(())()()(()())()()))((()()())...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given $n$ integers $a_1, a_2, \\ldots, a_n$. Find the maximum value of $max(a_l, a_{l + 1}, \\ldots, ...
[{"input": "4\n3\n2 3 3\n4\n3 0 10 1\n2\n359 139\n6\n229275 372495 402638 1125346 388084 422281\n", "output": "9\n10\n49901\n453107062748\n"}, {"input": "4\n3\n2 5 3\n4\n3 0 12 1\n2\n359 80\n6\n229275 718820 272407 1125346 388084 775159\n", "output": "15\n12\n28720\n436728777064\n"}, {"input": "4\n3\n2 3 3\n4\n3 0 6 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\nConsider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right....
[{"input": "100 400\n", "output": "201 1 202 2 203 3 204 4 205 5 206 6 207 7 208 8 209 9 210 10 211 11 212 12 213 13 214 14 215 15 216 16 217 17 218 18 219 19 220 20 221 21 222 22 223 23 224 24 225 25 226 26 227 27 228 28 229 29 230 30 231 31 232 32 233 33 234 34 235 35 236 36 237 37 238 38 239 39 240 40 241 41 242 42 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the...
[{"input": "40 3 8\n9 1 80\n7 8 13\n1 4 64\n5 2 60\n10 10 84\n5 6 64\n2 10 43\n9 2 73\n8 3 43\n8 2 53\n10 10 26\n4 4 20\n4 10 82\n9 7 96\n4 6 15\n1 3 45\n6 7 53\n3 3 92\n7 7 74\n4 2 62\n8 4 68\n3 7 7\n5 4 73\n5 10 22\n3 5 37\n2 10 88\n3 9 74\n1 7 80\n3 6 20\n7 9 5\n6 2 79\n9 9 20\n1 10 100\n9 7 39\n1 3 33\n8 8 39\n5 1 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nOne day Vasya was going home when he saw a box lying on the road. The box can be represented as a rectangular...
[{"input": "-827584 -680412 -103147\n897186 313672 388429\n892050 717946 505625 200144 311983 606037\n", "output": "1709658\n"}, {"input": "-827584 -680412 -103147\n897186 313672 388429\n892050 717946 505625 278931 311983 606037\n", "output": "1709658\n"}, {"input": "-827584 -680412 -103147\n897186 313672 388429\n89205...
code_stdio
[ { "content": "You are an expert Python programmer. 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 has n markers and m marker caps. Each marker is described by two numbers: xi is the color and yi i...
[{"input": "6 7\n2 1\n1 1\n2 2\n1 2\n1 1\n1 2\n2 1\n1 1\n1 1\n1 1\n1 2\n2 2\n1 1\n", "output": "5 5\n"}, {"input": "6 7\n1 1\n1 1\n1 2\n1 2\n2 2\n1 2\n2 1\n2 1\n2 1\n2 1\n1 1\n1 1\n1 2\n", "output": "3 3\n"}, {"input": "6 7\n2 1\n2 2\n2 1\n1 1\n2 1\n1 2\n2 2\n2 2\n2 2\n1 2\n2 2\n1 1\n1 2\n", "output": "3 3\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\nThis is the easier version of the problem. In this version 1 ≤ n, m ≤ 100. You can hack this problem only if ...
[{"input": "5\n3 1 4 1 2\n15\n5 5\n5 4\n5 3\n5 2\n5 1\n4 4\n4 3\n4 2\n4 1\n3 3\n3 2\n3 1\n2 2\n2 1\n1 1\n", "output": "2\n1\n4\n1\n3\n2\n4\n1\n3\n2\n4\n3\n4\n3\n4\n"}, {"input": "5\n3 1 4 2 2\n15\n5 5\n5 4\n5 3\n5 2\n5 1\n4 4\n4 3\n4 2\n4 1\n3 3\n3 2\n3 1\n2 2\n2 1\n1 1\n", "output": "2\n2\n4\n1\n3\n2\n2\n4\n3\n2\n4\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\nRead problems statements in Mandarin Chinese and Russian as well. \nYour friend Сhef has prepared a rectangul...
[{"input": "2\n1 1 10 32\n11 11 20 20\n1 1 20 20\n11 11 30 76", "output": "360\n1515\n"}, {"input": "2\n1 1 10 10\n11 7 20 20\n1 1 20 20\n11 11 30 55", "output": "198\n1116\n"}, {"input": "2\n1 1 10 20\n11 7 20 20\n1 1 20 20\n11 11 30 55", "output": "288\n1116\n"}, {"input": "2\n1 1 10 4\n11 11 20 20\n1 1 20 20\n11 11 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA country called Berland consists of n cities, numbered with integer numbers from 1 to n. Some of them are co...
[{"input": "10 45 9\n2 1 428\n3 1 610\n3 2 357\n4 1 855\n4 2 528\n4 3 508\n5 1 425\n5 2 185\n5 3 349\n5 4 845\n6 1 206\n6 2 969\n6 3 153\n6 4 854\n6 5 640\n7 1 87\n7 2 250\n7 3 953\n7 4 456\n7 5 742\n7 6 588\n8 1 641\n8 2 898\n8 3 396\n8 4 960\n8 5 654\n8 6 410\n8 7 640\n9 1 707\n9 2 707\n9 3 707\n9 4 707\n9 5 707\n9 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\nYou are given $n$ elements numbered from $1$ to $n$, the element $i$ has value $a_i$ and color $c_i$, initial...
[{"input": "13\n1 2 3 2 1 3 3 4 5 5 5 4 7\n", "output": "7\n"}, {"input": "7\n1 2 1 2 7 4 7\n", "output": "2\n"}, {"input": "3\n1 1 2\n", "output": "0\n"}, {"input": "3\n1 1 1\n", "output": "1\n"}, {"input": "3\n1 2 1\n", "output": "1\n"}, {"input": "3\n1 2 2\n", "output": "0\n"}, {"input": "3\n1 2 3\n", "output": "0\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given n points on the plane. The polygon formed from all the n points is strictly convex, that is, th...
[{"input": "20\n-2967010 48581504\n-2967318 48581765\n-2967443 48581988\n-2967541 48582265\n-2967443 48582542\n-2967318 48582765\n-2967010 48583026\n-2966691 48583154\n-2966252 48583234\n-2965813 48583154\n-2965494 48583026\n-2965186 48582765\n-2965061 48582542\n-2964963 48582265\n-2965061 48581988\n-2965186 48581765\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\nWe have N bricks arranged in a row from left to right.\nThe i-th brick from the left (1 \\leq i \\leq N) has ...
[{"input": "10\n3 1 4 1 10 17 1 11 0 3", "output": "9\n"}, {"input": "10\n4 1 4 1 10 17 1 11 0 3", "output": "9\n"}, {"input": "10\n4 1 4 1 10 31 1 11 0 3", "output": "9\n"}, {"input": "10\n4 1 5 1 10 31 1 11 0 3", "output": "9\n"}, {"input": "10\n4 1 5 1 10 31 2 11 0 3", "output": "7\n"}, {"input": "10\n4 1 5 1 11 31 ...
code_stdio
[ { "content": "You are an expert Python programmer. 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 Petya loves inequations. Help him find n positive integers a1, a2, ..., an, such that the following tw...
[{"input": "45678 1409926355077 1564465\n", "output": "1518788\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIt is the hard version of the problem. The difference is that in this version, there are nodes with already c...
[{"input": "5\n9\n31 yellow\n30 green\n26 yellow\n13 red\n2 red\n22 white\n12 red\n6 orange\n29 blue\n", "output": "0\n"}, {"input": "5\n9\n31 yellow\n30 green\n26 yellow\n13 red\n2 red\n22 white\n12 red\n6 orange\n29 blue\n", "output": "0\n"}, {"input": "5\n9\n31 yellow\n30 green\n26 yellow\n25 red\n2 red\n22 white\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\nThere is an easy way to obtain a new task from an old one called \"Inverse the problem\": we give an output o...
[{"input": "5\n0 0 0 0 0\n0 0 0 0 0\n0 0 0 0 0\n0 0 0 0 0\n0 0 0 0 0\n", "output": "NO\n"}, {"input": "4\n0 3 7 6\n3 -1 4 9\n7 4 0 2\n11 9 2 0\n", "output": "NO\n"}, {"input": "4\n0 3 7 6\n3 -1 4 9\n7 4 0 2\n16 9 2 0\n", "output": "NO\n"}, {"input": "4\n0 3 3 6\n3 -1 4 9\n7 4 0 2\n16 9 2 0\n", "output": "NO\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\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs a...
[{"input": "001010 001011", "output": "931093537\n"}, {"input": "000101 000101", "output": "414723868\n"}, {"input": "000110 000111", "output": "399920258\n"}, {"input": "001111 001110", "output": "292820538\n"}, {"input": "010010 010011", "output": "475486457\n"}, {"input": "010100 010100", "output": "449134091\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# Introduction\n\nThere is a war and nobody knows - the alphabet war! \nThere are two groups of hostile lett...
[{"input": "\"z*dq*mw*pb*s\"", "output": "[\"Let's fight again!\"]", "fn_name": "alphabet_war"}, {"input": "\"zdqmwpbs\"", "output": "[\"Let's fight again!\"]", "fn_name": "alphabet_war"}, {"input": "\"*wwwwww*z*\"", "output": "[\"Left side wins!\"]", "fn_name": "alphabet_war"}, {"input": "\"sz**z**zs\"", "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\nOn a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to...
[{"input": "0 5\n-1 96762320 34608098\n243235878 312125306 50510976\n326016273 498514053 50510976\n614560077 445224816 25950222\n1077021507 901150398 37242747\n", "output": "0\n"}, {"input": "0 5\n-1 96762320 34608098\n243235878 312125306 50510976\n326016273 498514053 90733839\n614560077 445224816 25950222\n1077021507 ...
code_stdio
[ { "content": "You are an expert Python programmer. 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, Arkady's friend, prepares to the programming competition and decides to write a contest. The contes...
[{"input": "2\n4\n1.9585346052548882 31.000\n12 0\n11 6\n30 1\n5 1\n3\n1.360280845492949 30.337801087585063\n0 10\n10 8\n20 8\n", "output": "7\n18\n"}, {"input": "2\n4\n1.557488533293537 31.000\n12 0\n11 6\n30 1\n5 1\n3\n1.360280845492949 30.337801087585063\n0 10\n10 8\n20 8\n", "output": "7\n18\n"}, {"input": "2\n4\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\nProfessor Ibrahim has prepared the final homework for his algorithm’s class. He asked his students to impleme...
[{"input": "100 10\n39 242 238 155 95 30 129 132 72 59 22 91 203 113 99 81 253 204 160 109 92 187 11 227 145 211 100 42 78 14 113 91 140 197 123 182 4 185 208 27 182 207 63 146 102 39 159 195 26 100 72 127 157 159 152 53 0 117 101 125 19 188 179 145 240 50 205 207 113 246 42 56 161 13 188 244 159 222 119 204 26 182 212...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn the city of Ultima Thule job applicants are often offered an IQ test. \n\nThe test is as follows: the pers...
[{"input": "####\n.#..\n####\n....\n", "output": "YES\n"}, {"input": "....\n....\n....\n....\n", "output": "YES\n"}, {"input": "#..#\n.##.\n####\n####\n", "output": "YES\n"}, {"input": "#.#.\n.###\n#.#.\n.###\n", "output": "YES\n"}, {"input": "#..#\n.##.\n.##.\n#..#\n", "output": "YES\n"}, {"input": ".##.\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\nNobody knows, but $N$ frogs live in Chef's garden.\nNow they are siting on the X-axis and want to speak to ea...
[{"input": "5 6 3\n0 3 8 8 12\n1 2\n1 3\n2 5", "output": "Yes\nYes\nYes\n"}, {"input": "5 3 3\n0 3 15 8 12\n1 2\n1 3\n3 5", "output": "Yes\nNo\nYes\n"}, {"input": "5 4 3\n0 3 2 4 23\n1 2\n1 3\n2 1", "output": "Yes\nYes\nYes\n"}, {"input": "5 4 3\n0 3 3 4 23\n1 2\n1 3\n2 1", "output": "Yes\nYes\nYes\n"}, {"input": "5 6 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n[0, 0]\n[0, 1] [1, 1]\n[0, 2] [1, 2] [2, 2]\n[0, 3] [1, 3] [2, 3] [3, 3]\n[0, 4] [1, 4] [2, 4] [3, 4...
[{"input": "6\n16 23 16 16 15 25\n10\n00 01 11 02 12 22 03 13 13 33", "output": "Yes\nYes\n"}, {"input": "6\n13 23 14 16 15 25\n10\n00 01 11 02 12 30 03 13 36 33", "output": "Yes\nYes\n"}, {"input": "6\n11 23 16 16 15 25\n10\n00 01 11 02 12 22 03 13 13 33", "output": "Yes\nYes\n"}, {"input": "6\n13 23 14 16 15 25\n10\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\nJack loved his house very much, because his lovely cats take a nap on the wall of his house almost every day....
[{"input": "4 6\ns 0 1\ns 2 3\ns 2 1\nw 0\ns 5 2\ns 5 2\n2 3\ns 0 2\ns 1 1\ns 0 1\n0 0", "output": "0\n1\nimpossible\nimpossible\nimpossible\nEND\n0\nimpossible\nimpossible\nEND\n"}, {"input": "4 6\ns 0 2\ns 1 2\ns 2 2\nw 0\ns 3 4\ns 8 4\n2 3\ns 1 1\ns 1 2\ns 2 2\n0 0", "output": "0\n2\nimpossible\nimpossible\nimpossib...
code_stdio
[ { "content": "You are an expert Python programmer. 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 squirrel Chokudai has N acorns. One day, he decides to do some trades in multiple precious metal exchange...
[{"input": "23\n1 2 1\n20 1 10", "output": "920\n"}, {"input": "23\n1 2 4\n10 1 4", "output": "460\n"}, {"input": "23\n1 12 1\n1 1 1", "output": "276\n"}, {"input": "23\n2 11 1\n2 1 2", "output": "506\n"}, {"input": "23\n2 2 4\n10 1 4", "output": "222\n"}, {"input": "23\n2 2 1\n20 1 2", "output": "444\n"}, {"input": "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 has a simple graph (that is, a graph without loops or multiple edges) consisting of $n$ vertices and $m...
[{"input": "20 10\n487490574 766859182 860731945 956220596 584871933 815478522 698429627 781975977 485357256 396825095 566947997 680691964 834523631 323163346 665972495 5503804 738797202 410201497 91359028 708811641\n16 15 598574211\n8 7 332007499\n11 1 942159718\n3 1 24779817\n20 4 192862192\n16 6 965177283\n20 5 2673...
code_stdio
[ { "content": "You are an expert Python programmer. 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\nTuzik is a little dog. But despite the fact he...
[{"input": "2\n10 16\n14 18", "output": "10\n14\n"}, {"input": "2\n130 45\n4 17", "output": "42\n4\n"}, {"input": "2\n10 4\n21 19", "output": "2\n10\n"}, {"input": "2\n44 45\n2 17", "output": "44\n2\n"}, {"input": "2\n10 22\n4 16", "output": "10\n4\n"}, {"input": "2\n12 22\n4 16", "output": "12\n4\n"}, {"input": "2\n10...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPaul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p let...
[{"input": "333 9\nedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedce...
code_stdio
[ { "content": "You are an expert Python programmer. 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 other world, today is Christmas.\nMr. Takaha decides to make a multi-dimensional burger in his party....
[{"input": "50 4321098765432109\n", "output": "2160549382716056\n"}, {"input": "50 2251799813685246\n", "output": "1125899906842623\n"}, {"input": "50 2251799813685247\n", "output": "1125899906842624\n"}, {"input": "50 2251799813685297\n", "output": "1125899906842625\n"}, {"input": "50 4503599627370442\n", "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 table consisting of n rows and m columns. Each cell of the table contains a number, 0 or 1. I...
[{"input": "10 10\n0000000000\n0000001000\n0000000100\n0101000100\n0000000000\n0000000000\n1000110000\n1011010010\n0000110000\n0000001001\n", "output": "-1\n"}, {"input": "10 10\n0000000000\n0000001000\n0000000100\n0101000100\n0000000000\n0000000000\n1000110000\n1011010010\n0000100000\n0000001001\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\nLearn, learn and learn again — Valera has to do this every day. He is studying at mathematical school, where ...
[{"input": "100\n-88 -5 -96 -45 -11 -81 -68 -58 -73 -91 -27 -23 -89 -34 -51 -46 -70 -95 -9 -77 -99 -61 -74 -98 -88 -44 -61 -88 -35 -71 -43 -23 -25 -98 -23 0 -1 -80 -52 -47 -26 -92 -82 -73 -45 -37 -15 -49 -9 -7 -47 0 -6 -76 -91 -20 -58 -46 -74 -57 -54 -39 -61 -18 -65 -61 -19 -64 -93 -29 -82 -25 -100 -89 -90 -68 -36 -91 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of...
[{"input": "70\n644488 5444 150441 714420 602059 335330 510670 196555 546346 740011 509449 850947 692874 524857 750434 952985 223744 533151 896124 609694 367352 679050 560202 172728 569291 778616 332116 286927 843598 372698 244906 498046 900681 709791 420904 724593 864493 813094 791377 39998 296710 1033347 403891 57923...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPolycarp has prepared $n$ competitive programming problems. The topic of the $i$-th problem is $a_i$, and som...
[{"input": "55\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3\n", "output": "49\n"}, {"input": "55\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3\n", "output": "49"}, {"input": "18\n2 1 2 10 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\nHongcow likes solving puzzles.\n\nOne day, Hongcow finds two identical puzzle pieces, with the instructions \...
[{"input": "1 500\n.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nMonocarp wants to watch $n$ videos. Each video is only one minute long, but its size may be arbitrary. The $i...
[{"input": "6 1000000000\n999999995 999999996 999999997 999999998 999999999 1000000000\n", "output": "5999999991\n"}, {"input": "5 1000000000\n500000000 500000000 500000000 500000000 500000000\n", "output": "2500000001\n"}, {"input": "5 999999999\n500000000 500000000 500000000 500000000 500000000\n", "output": "2500000...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPablo Squarson is a well-known cubism artist. This year's theme for Pablo Squarson is \"Squares\". Today we a...
[{"input": "1\n5\n0 0\n0 -1\n0 2\n0 3\n12\n0 0\n0 0\n2 0\n3 0\n4 1\n5 1\n6 2\n3 2\n8 2\n9 3\n10 3\n10\n0 2\n1 3\n2 2\n3 2\n2 1\n5 1\n6 1\n7 1\n3 0\n0", "output": "1 1\n3 2\n4 5\n4 5\n"}, {"input": "1\n5\n0 -1\n0 1\n0 2\n0 3\n12\n0 0\n1 0\n2 0\n3 1\n4 1\n5 1\n6 2\n7 1\n8 2\n9 3\n10 3\n10\n0 2\n1 3\n2 2\n3 2\n2 1\n5 1\n6...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are appointed director of a famous concert hall, to save it from bankruptcy. The hall is very popular, an...
[{"input": "4\n1 2 10\n2 3 10\n3 3 10\n1 3 10\n6\n1 20 1000\n5 25 10000\n2 30 8781\n22 300 5500\n10 117 9000\n7 7 2175\n8\n32 251 2396\n132 281 1659\n222 235 5641\n162 217 1883\n22 158 7195\n194 198 9190\n119 274 1469\n122 334 13708\n0", "output": "30\n21175\n35734\n"}, {"input": "4\n1 2 10\n2 3 10\n3 3 10\n1 3 10\n6\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\nWe have N bulbs arranged on a number line, numbered 1 to N from left to right. Bulb i is at coordinate i.\n\n...
[{"input": "5 0\n-8 -10 1 -1 2", "output": "-8 -10 1 -1 2\n"}, {"input": "5 0\n-11 -10 1 0 2", "output": "-11 -10 1 0 2\n"}, {"input": "5 0\n-8 -5 2 -1 2", "output": "-8 -5 2 -1 2\n"}, {"input": "5 0\n-8 -5 1 -1 2", "output": "-8 -5 1 -1 2\n"}, {"input": "5 0\n-8 -10 1 0 2", "output": "-8 -10 1 0 2\n"}, {"input": "5 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\nThere is a train going from Station A to Station B that costs X yen (the currency of Japan).\nAlso, there is ...
[{"input": "100 100\n", "output": "150\n"}, {"input": "81 58\n", "output": "110\n"}, {"input": "100 2\n", "output": "101\n"}, {"input": "76 48\n", "output": "100\n"}, {"input": "-1 -17", "output": "-10\n"}, {"input": "-1 -31", "output": "-17\n"}, {"input": "-11 -1", "output": "-12\n"}, {"input": "0 1003", "output": "50...
code_stdio
[ { "content": "You are an expert Python programmer. 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 ( and ). Your task is to insert some number of ( and ) int...
[{"input": "8\n))))((((\n", "output": "(((())))(((())))\n"}, {"input": "8\n)))(((((", "output": "((()))((((()))))\n"}, {"input": "8\n)))))(((", "output": "((((()))))((()))\n"}, {"input": "8\n))))))))", "output": "(((((((())))))))\n"}, {"input": "8\n))))((((", "output": "(((())))(((())))"}, {"input": "8\n))))(()(", "out...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the 0 ...
[{"input": "5000\n01000001011101000100001101101111011001000110010101110010000\n", "output": "500886057\n"}, {"input": "5000\n01000001011101010100001101101111011001000110010101110010000", "output": "500886057\n"}, {"input": "5000\n01000001011001010100001101101111011001000110010101110010000", "output": "500886057\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\nLittle C loves number «3» very much. He loves all things about it.\n\nNow he is playing a game on a chessboar...
[{"input": "1000000000 1000000000\n", "output": "1000000000000000000\n"}, {"input": "1000000000 1000010000\n", "output": "1000010000000000000\n"}, {"input": "1000000000 1000000000\n", "output": "1000000000000000000"}, {"input": "1226545551 143389547\n", "output": "175873810932755396\n"}, {"input": "1109972776 380634006...
code_stdio
[ { "content": "You are an expert Python programmer. 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 accidentally discovered a secret lab. He found there n devices ordered in a line, numbered from 1 to n ...
[{"input": "250\n6 1 4 3 3 7 4 5 3 2 4 4 2 6 4 2 1 7 6 2 4 5 3 3 4 5 3 4 5 4 6 4 6 5 3 3 1 5 4 5 3 4 2 4 2 5 1 4 3 3 3 2 6 6 4 7 2 6 5 3 3 6 5 2 1 3 3 5 2 2 3 7 3 5 6 4 7 3 5 3 4 5 5 4 11 5 1 5 3 3 3 1 4 6 4 4 5 5 5 5 2 5 9 3 2 2 5 6 10 5 4 2 5 4 2 5 5 3 4 2 5 4 3 2 4 4 2 5 4 1 5 3 9 6 4 6 3 5 4 5 3 6 7 4 5 10 3 6 2 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\nDrazil is playing a math game with Varda.\n\nLet's define <image> for positive integer x as a product of fact...
[{"input": "15\n989898989898989\n", "output": "777777777777777333333333333333322222222222222222222222222222\n"}, {"input": "15\n999999999999990\n", "output": "77777777777777333333333333333333333333333322222222222222\n"}, {"input": "15\n997953296764414\n", "output": "7777775553333333333333322222222222\n"}, {"input": "15...
code_stdio
[ { "content": "You are an expert Python programmer. 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 three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contest...
[{"input": "50\n0 0 0\n0 1 1\n1 1 1\n0 1 0\n1 0 1\n1 1 1\n0 0 1\n1 0 0\n1 1 0\n1 0 1\n0 1 0\n0 0 1\n1 1 0\n0 1 0\n1 1 0\n0 0 0\n1 1 1\n1 0 1\n0 0 1\n1 1 0\n1 1 1\n0 1 1\n1 1 0\n0 0 0\n0 0 0\n1 1 1\n0 0 0\n1 1 1\n0 1 1\n0 0 1\n0 0 0\n0 0 0\n1 1 0\n1 1 0\n1 0 1\n1 0 0\n1 0 1\n1 0 1\n0 1 1\n1 1 0\n1 1 0\n0 1 0\n1 0 1\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\nYou are locked in a room with a door that has a keypad with 10 keys corresponding to digits from 0 to 9. To e...
[{"input": "10 10\n1 2 3 4 5 6 7 8 9 0\n4 5 6 7 1 2 3 0 9 8\n", "output": "1 2 3 4 5 6 7 8 9 0\n"}, {"input": "10 10\n1 2 3 4 5 6 7 8 9 0\n4 5 6 7 1 2 3 0 9 8\n", "output": "1 2 3 4 5 6 7 8 9 0\n"}, {"input": "10 6\n7 1 2 3 8 0 6 4 5 9\n1 5 8 2 3 6\n", "output": "1 2 3 8 6 5\n"}, {"input": "10 6\n7 1 2 3 8 0 6 4 5 9\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\nThe \"BerCorp\" company has got n employees. These employees can use m approved official languages for the fo...
[{"input": "100 100\n1 33\n0\n2 35 4\n2 40 78\n1 69\n0\n1 2\n0\n0\n2 81 34\n1 45\n0\n1 87\n1 50\n1 97\n0\n2 100 59\n0\n0\n0\n1 45\n0\n0\n0\n1 6\n1 54\n0\n0\n0\n4 79 96 52 84\n1 86\n0\n0\n0\n0\n0\n0\n0\n0\n3 90 2 80\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n1 2\n0\n1 64\n0\n1 78\n1 82\n0\n0\n0\n0\n0\n1 6\n0\n0\n2 47 57\n1 95\n0\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\nTheofanis decided to visit his uncle's farm. There are $s$ animals and $n$ animal pens on the farm. For utili...
[{"input": "4\n1 1 1\n1 1 1\n100 50 200\n56220 47258 14497\n", "output": "YES\nYES\nNO\nYES\n"}, {"input": "4\n1 1 1\n1 -1 2\n110 50 200\n56220 47258 14497\n", "output": "YES\nNO\nNO\nYES\n"}, {"input": "4\n1 1 1\n1 -1 2\n110 53 200\n56220 47258 14497\n", "output": "YES\nNO\nNO\nYES\n"}, {"input": "4\n1 1 1\n-1 -1 2\n0...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < ...
[{"input": "3\n30 10 20\n41 15 30\n18 13 18\n", "output": "2\n7\n1\n"}, {"input": "3\n30 10 20\n41 15 26\n18 13 18\n", "output": "2\n2\n1\n"}, {"input": "3\n30 10 20\n41 15 30\n18 13 18\n", "output": "2\n7\n1\n"}, {"input": "1\n114515 114514 114514\n", "output": "2\n"}, {"input": "1\n999855 999262 999557\n", "output": ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThis is an interactive problem. Refer to the Interaction section below for better understanding.\n\nIthea and...
[{"input": "10 120 15\n6\n11\n9\n11\n3\n12\n11\n12\n2\n8\n3\n11\n13\n5\n12\n18\n9\n3\n10\n9\n9\n13\n13\n5\n6\n11\n3\n15\n8\n8\n10\n13\n7\n6\n4\n14\n9\n10\n5\n13\n4\n1\n8\n6\n13\n1\n3\n4\n9\n12\n2\n7\n3\n3\n7\n2\n2\n9\n2\n4\n2\n2\n11\n12\n15\n13\n6\n2\n11\n1\n8\n3\n13\n6\n15\n6\n4\n3\n4\n15\n15\n9\n5\n8\n3\n6\n14\n14\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\n### Background\n\nI was reading a [book](http://www.amazon.co.uk/Things-Make-Do-Fourth-Dimension/dp/184614764...
[{"input": "\"123220\"\n10", "output": "[false]", "fn_name": "is_polydivisible"}, {"input": "\"30043052\"\n6", "output": "[true]", "fn_name": "is_polydivisible"}, {"input": "\"12345\"\n10", "output": "[false]", "fn_name": "is_polydivisible"}, {"input": "\"1234\"\n10", "output": "[false]", "fn_name": "is_polydivisible"}...
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 the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president ...
[{"input": "100\n10 12 512917373\n6 9 512917366\n66 44 512917421\n49 18 512917412\n57 96 512917426\n65 72 512917442\n62 59 512917440\n27 77 512917437\n31 13 512917395\n38 39 512917428\n15 72 512917430\n0 69 512917418\n22 22 512917395\n9 69 512917427\n37 96 512917428\n12 23 512917386\n100 90 512917389\n4 60 512917415\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\nOne of the most important products of the R1 company is a popular @r1.com mail service. The R1 mailboxes rece...
[{"input": "gerald.agapov1991@gmail.com\n", "output": " 18"}, {"input": "x@x.x@x.x_e_@r1.com\n", "output": " 8"}, {"input": "0000000a@000a111.r\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\nVanya has a scales for weighing loads and weights of masses w^0, w^1, w^2, ..., w^100 grams where w is some i...
[{"input": "1000000000 1000000000\n", "output": "YES\n"}, {"input": "1000000000 1000000000\n", "output": "YES\n"}, {"input": "1100000000 1000000000\n", "output": "NO\n"}, {"input": "441890232 441890232\n", "output": "YES\n"}, {"input": "401739553 401739553\n", "output": "YES\n"}, {"input": "285681920 285681919\n", "out...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nVasya has a sequence of cubes and exactly one integer is written on each cube. Vasya exhibited all his cubes ...
[{"input": "10 1 10\n6 7 6 1 10 10 9 5 3 9\n7 10 9 6 1 5 9 3 10 6\n", "output": "TRUTH\n"}, {"input": "10 1 10\n6 7 6 1 10 10 9 5 3 9\n7 10 9 6 1 5 9 3 10 6\n", "output": "TRUTH\n"}, {"input": "8 3 6\n5 3 1 1 1 1 1 10\n3 3 1 1 1 1 5 5\n", "output": "LIE\n"}, {"input": "8 4 6\n5 3 1 1 2 1 3 5\n3 3 1 1 1 2 8 10\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\nBob is an avid fan of the video game \"League of Leesins\", and today he celebrates as the League of Leesins ...
[{"input": "9\n7 5 3\n8 9 4\n8 1 7\n8 9 1\n1 5 7\n2 3 5\n6 3 2\n", "output": "4 9 8 1 7 5 3 2 6 \n"}, {"input": "9\n1 8 9\n9 6 4\n2 1 3\n1 2 8\n3 5 2\n6 7 4\n8 9 4\n", "output": "5 3 2 1 8 9 4 6 7 \n"}, {"input": "9\n6 9 8\n2 3 4\n2 3 1\n5 6 8\n4 6 5\n7 8 9\n3 5 4\n", "output": "1 2 3 4 5 6 8 9 7 \n"}, {"input": "9\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\nPolycarp wants to cook a soup. To do it, he needs to buy exactly $n$ liters of water.\n\nThere are only two t...
[{"input": "4\n10 1 3\n7 5 2\n1 1000 1\n1000000000000 42 88\n", "output": "10\n11\n1000\n42000000000000\n"}, {"input": "4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88\n", "output": "10\n9\n1000\n42000000000000\n"}, {"input": "4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88\n", "output": "10\n9\n1000\n42000000000000\n"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTakahashi is a user of a site that hosts programming contests.\n\nWhen a user competes in a contest, the rati...
[{"input": "2002\n2017\n", "output": "2032\n"}, {"input": "4500\n-140", "output": "-4780\n"}, {"input": "4500\n-148", "output": "-4796\n"}, {"input": "4500\n-237", "output": "-4974\n"}, {"input": "2002\n416", "output": "-1170\n"}, {"input": "2002\n468", "output": "-1066\n"}, {"input": "4500\n-15", "output": "-4530\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 frog is initially at position $0$ on the number line. The frog has two positive integers $a$ and $b$. From ...
[{"input": "997674659 11231 35496\n", "output": "497677363010575988\n"}, {"input": "881706694 5710 46369\n", "output": "388703347089502553\n"}, {"input": "952549276 31416 33000\n", "output": "1718466614644254\n"}, {"input": "952549276 31416 33000\n", "output": "1718466614644254\n"}, {"input": "952549276 31416 6292\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 Little Elephant from the Zoo of Lviv currently is on the military mission. There are N enemy buildings pl...
[{"input": "3\n3\n011\n5\n10001\n7\n0000000", "output": "0\n1\n7\n"}, {"input": "3\n3\n010\n5\n10001\n7\n0010000", "output": "0\n1\n4\n"}, {"input": "3\n3\n010\n5\n10001\n7\n1010000", "output": "0\n1\n3\n"}, {"input": "3\n3\n010\n5\n10000\n7\n1010000", "output": "0\n3\n3\n"}, {"input": "3\n3\n010\n5\n10011\n7\n0000000"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nDon Drumphet lives in a nice neighborhood, but one of his neighbors has started to let his house go. Don Dru...
[{"input": "\"Melania\"", "output": "[[\"Melania\", \"Me\"]]", "fn_name": "who_is_paying"}, {"input": "\"Melissa\"", "output": "[[\"Melissa\", \"Me\"]]", "fn_name": "who_is_paying"}, {"input": "\"Mexico\"", "output": "[[\"Mexico\", \"Me\"]]", "fn_name": "who_is_paying"}, {"input": "\"Me\"", "output": "[[\"Me\"]]", "fn_...
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 a sequence of $n$ pairs of integers: $(a_1, b_1), (a_2, b_2), \\dots , (a_n, b_n)$. This sequen...
[{"input": "4\n2 3\n1 2\n2 1\n2 4\n", "output": "17\n"}, {"input": "4\n2 3\n1 2\n2 1\n0 4\n", "output": "21\n"}, {"input": "4\n3 3\n2 3\n2 1\n2 4\n", "output": "16\n"}, {"input": "4\n2 3\n4 2\n2 1\n4 4\n", "output": "19\n"}, {"input": "4\n1 2\n4 2\n2 1\n2 4\n", "output": "20\n"}, {"input": "4\n2 3\n4 2\n2 1\n2 4\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 three positive integers x, y, n. Your task is to find the nearest fraction to fraction [Image] ...
[{"input": "43003 70913 108889\n", "output": "43003/70913\n"}, {"input": "76730 157792 71438\n", "output": "33069/68005\n"}, {"input": "43003 75615 108889\n", "output": "43003/75615\n"}, {"input": "76730 157792 50090\n", "output": "22477/46223\n"}, {"input": "113725 82924 57380\n", "output": "69226/50477\n"}, {"input":...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWrite a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm sh...
[{"input": "6\n16 4 2 2 1 -1", "output": "16 4 2 2 1 -1\n4 16 2 2 1 -1\n2 4 16 2 1 -1\n2 2 4 16 1 -1\n1 2 2 4 16 -1\n-1 1 2 2 4 16\n"}, {"input": "6\n2 2 2 -1 2 -2", "output": "2 2 2 -1 2 -2\n2 2 2 -1 2 -2\n2 2 2 -1 2 -2\n-1 2 2 2 2 -2\n-1 2 2 2 2 -2\n-2 -1 2 2 2 2\n"}, {"input": "6\n2 0 2 -1 2 -2", "output": "2 0 2 -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\nVasya has recently learned to type and log on to the Internet. He immediately entered a chat room and decided...
[{"input": "hyyhddqhxhekehkwfhlnlsihzefwchzerevcjtokefplholrbvxlltdlafjxrfhleglrvlolojoqaolagtbeyogxlbgfolllslli\n", "output": "YES\n"}, {"input": "jhfbndhyzdvhbvhmhmefqllujdflwdpjbehedlsqfdsqlyelwjtyloxwsvasrbqosblzbowlqjmyeilcvotdlaouxhdpoeloaovb\n", "output": "YES\n"}, {"input": "hellllllllllllllllllllllllllllllllll...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPolycarp has decided to decorate his room because the New Year is soon. One of the main decorations that Poly...
[{"input": "100\n25 100 32 34 25 99 19 99 84 52 20 83 34 12 59 89 51 86 5 63 57 2 61 23 48 27 90 28 29 65 31 73 40 79 89 29 18 86 49 14 48 84 100 17 65 79 37 71 52 47 98 100 40 20 71 94 90 53 41 54 47 2 40 36 35 63 14 66 35 11 2 97 23 90 26 88 17 79 2 59 12 22 14 61 78 15 7 62 7 38 43 94 43 12 77 80 60 9 2\n", "output"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nOne evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have dec...
[{"input": "1\n10000001\n", "output": "5000001\n"}, {"input": "1\n10000001\n", "output": "5000001\n"}, {"input": "1\n10001001\n", "output": "5000501\n"}, {"input": "1\n11001001\n", "output": "5500501\n"}, {"input": "1\n11011001\n", "output": "5505501\n"}, {"input": "1\n11001100\n", "output": "5500551\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\nThe window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which h...
[{"input": "2 -777", "output": "1556\n"}, {"input": "2 -839", "output": "1680\n"}, {"input": "1 -839", "output": "1679\n"}, {"input": "100 100\n", "output": "0\n"}, {"input": "181 21", "output": "139\n"}, {"input": "194 13", "output": "168\n"}, {"input": "125 12", "output": "101\n"}, {"input": "122 -1", "output": "124\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWe have two bottles for holding water.\nBottle 1 can hold up to A milliliters of water, and now it contains B...
[{"input": "20 20 20\n", "output": "20\n"}, {"input": "6 113 -1", "output": "106\n"}, {"input": "6 228 -1", "output": "221\n"}, {"input": "2 228 -1", "output": "225\n"}, {"input": "2 396 -1", "output": "393\n"}, {"input": "2 666 -1", "output": "663\n"}, {"input": "2 481 -1", "output": "478\n"}, {"input": "2 931 -1", "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\nVladik had started reading a complicated book about algorithms containing n pages. To improve understanding o...
[{"input": "20 20\n18 17 2 3 16 15 1 9 12 8 20 11 13 14 4 5 19 7 10 6\n13 15 15\n1 1 1\n2 2 2\n11 14 11\n10 11 10\n2 8 6\n12 18 16\n4 8 8\n2 2 2\n5 11 11\n4 18 9\n5 6 6\n3 20 12\n8 8 8\n6 16 11\n9 18 18\n8 18 17\n1 1 1\n2 6 5\n1 4 3\n", "output": "No\nYes\nYes\nNo\nYes\nYes\nNo\nNo\nYes\nYes\nNo\nNo\nNo\nYes\nNo\nNo\nY...
code_stdio
[ { "content": "You are an expert Python programmer. 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## Objective\n\nGiven a number `n` we will define it's sXORe to be `0 XOR 1 XOR 2 ... XOR n` where `XOR` is t...
[{"input": "9999999999999999999999999", "output": "[0]", "fn_name": "sxore"}, {"input": "1000000", "output": "[1000000]", "fn_name": "sxore"}, {"input": "1000001", "output": "[1]", "fn_name": "sxore"}, {"input": "50", "output": "[51]", "fn_name": "sxore"}, {"input": "0", "output": "[0]", "fn_name": "sxore"}, {"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\nConsider a table of size $n \\times m$, initially fully white. Rows are numbered $1$ through $n$ from top to ...
[{"input": "96 1\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nB\nW\nW\nW\nW\nW\nW\nW\n", "output": "...
code_stdio