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\nTakahashi and Aoki are going to together construct a sequence of integers.\nFirst, Takahashi will provide a s...
[{"input": "1000000000 1000000000\n", "output": "875699961\n"}, {"input": "1000000000 146388030\n", "output": "329875629\n"}, {"input": "1000000000 121963892\n", "output": "419967204\n"}, {"input": "1000000000 153662193\n", "output": "749048454\n"}, {"input": "1000001000 1000000000", "output": "212353005\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\nWe have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.\nWe will choose K or more of these integers. Fin...
[{"input": "123333 101429\n", "output": "175623902\n"}, {"input": "141421 35623\n", "output": "220280457\n"}, {"input": "154242 56347\n", "output": "520400358\n"}, {"input": "105711 80705\n", "output": "801552417\n"}, {"input": "223214 200001", "output": "534704743\n"}, {"input": "402106 200001", "output": "533363909\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\nIvan unexpectedly saw a present from one of his previous birthdays. It is array of $n$ numbers from $1$ to $2...
[{"input": "37\n52 52 66 149 149 130 47 47 26 110 185 -1 73 73 65 -1 -1 130 -1 -1 -1 94 97 190 -1 -1 49 49 54 -1 92 92 5 25 48 79 79\n", "output": "903952722\n"}, {"input": "37\n52 52 66 149 149 130 47 47 26 110 185 -1 73 73 65 -1 -1 130 -1 -1 -1 94 97 190 -1 -1 49 49 54 -1 92 92 5 25 48 79 79\n", "output": "903952722\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nGeneral primality test are often computationally expensive, so in the biggest prime number race the idea is t...
[{"input": "11215", "output": "[false]", "fn_name": "lucas_lehmer"}, {"input": "11213", "output": "[true]", "fn_name": "lucas_lehmer"}, {"input": "101", "output": "[false]", "fn_name": "lucas_lehmer"}, {"input": "10", "output": "[false]", "fn_name": "lucas_lehmer"}, {"input": "33", "output": "[false]", "fn_name": "luca...
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\nKarafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use K...
[{"input": "447 74474 4\n47 777474 1358\n74 744744 74477\n477 477447 777\n7 477777 444444\n", "output": "-1\n-1\n-1\n7\n"}, {"input": "447 74474 4\n47 777474 747\n74 744744 74477\n477 477447 777\n7 477777 444444\n", "output": "-1\n-1\n-1\n7\n"}, {"input": "447 74474 4\n47 777474 747\n74 744744 74477\n477 477447 777\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\nYour task is to determine the top 3 place finishes in a pole vault competition involving several different co...
[{"input": "[{\"name\": \"Anna\", \"results\": [\"XO\", \"O\", \"XO\", \"XO\"]}, {\"name\": \"Allison\", \"results\": [\"XO\", \"O\", \"XXO\", \"XXX\"]}, {\"name\": \"Olivia\", \"results\": [\"O\", \"XO\", \"XXO\", \"XXX\"]}, {\"name\": \"Rhiana\", \"results\": [\"XO\", \"O\", \"XO\", \"XO\"]}, {\"name\": \"Zola\", \"r...
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\nOne day, Niwango-kun, an employee of Dwango Co., Ltd., found an integer sequence (a_1, ..., a_N) of length N....
[{"input": "8 2\n13 0 11 2 14 4 11 8", "output": "55\n"}, {"input": "8 4\n10 2 18 7 21 1 10 1", "output": "58\n"}, {"input": "8 4\n10 2 28 7 23 0 10 3", "output": "70\n"}, {"input": "8 2\n18 0 28 5 17 1 16 1", "output": "84\n"}, {"input": "8 2\n13 0 11 2 14 5 6 4", "output": "51\n"}, {"input": "8 2\n13 0 11 2 14 5 6 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\nZonk is addictive dice game. In each round player rolls 6 dice. Then (s)he composes combinations from them. E...
[{"input": "[1, 1, 1, 1, 1, 1]", "output": "[4000]", "fn_name": "get_score"}, {"input": "[3, 3, 3, 3, 3, 3]", "output": "[1200]", "fn_name": "get_score"}, {"input": "[4, 4, 4, 4, 4, 4]", "output": "[1600]", "fn_name": "get_score"}, {"input": "[5, 5, 5, 5, 5, 5]", "output": "[2000]", "fn_name": "get_score"}, {"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\nKing of Berland Berl IV has recently died. Hail Berl V! As a sign of the highest achievements of the deceased...
[{"input": "30 50\n17 >= 29\n19 <= 18\n3 > 50\n54 >= 56\n47 < 15\n50 <= 33\n49 < 8\n57 <= 16\n30 > 35\n49 < 21\n3 >= 37\n56 <= 51\n46 > 51\n35 >= 48\n32 < 15\n12 <= 4\n38 > 57\n55 < 9\n49 <= 1\n9 >= 38\n60 = 60\n1 > 12\n40 >= 43\n13 > 38\n24 >= 39\n9 < 2\n12 > 58\n15 >= 30\n13 > 50\n42 <= 16\n23 >= 54\n16 < 10\n1 > 43\...
code_stdio
[ { "content": "You are an expert Python programmer. 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 Matsuzaki is a scientist studying the truth of the universe. Life, the universe, all the answers ar...
[{"input": "0 55\n0 1\n0 2\n0 3\n10 1\n10 2\n10 3\n10 4\n10 5\n10 6\n11 1\n11 2\n11 3\n100001 100\n-1 -1", "output": "42\n4\n5\n6\n22\n24\n26\n28\n30\n30\n26\n30\n32\n200274\n"}, {"input": "0 55\n0 1\n0 2\n0 3\n10 1\n10 2\n10 3\n10 4\n10 5\n10 1\n11 1\n11 2\n11 3\n100001 100\n-1 -1", "output": "42\n4\n5\n6\n22\n24\n26\...
code_stdio
[ { "content": "You are an expert Python programmer. 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 robot is put at the origin in a two-dimensional plane.\nInitially, the robot is facing in the positive x-ax...
[{"input": "FTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFTFT...
code_stdio
[ { "content": "You are an expert Python programmer. 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 only of lowercase Latin letters.\n\nA substring of a stri...
[{"input": "420\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
code_stdio
[ { "content": "You are an expert Python programmer. 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 Bus of Characters there are $n$ rows of seat, each having $2$ seats. The width of both seats in the $i...
[{"input": "10\n24 53 10 128 141 9 15 62 32 47\n00100000000111111111\n", "output": "6 3 3 7 1 9 10 2 8 4 5 5 4 8 2 10 9 1 7 6\n"}, {"input": "10\n24 53 10 128 141 9 15 97 32 47\n00100000000111111111\n", "output": "6 3 3 7 1 9 10 2 8 4 5 5 4 8 2 10 9 1 7 6\n"}, {"input": "10\n24 53 10 99 83 9 15 62 33 47\n00100000000111...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWe have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i.\nVertex i has an integer ...
[{"input": "10\n1 2 4 2 11 1 7 11 0 4\n1 3\n2 3\n3 4\n7 5\n2 6\n6 7\n1 8\n2 9\n2 10", "output": "1\n2\n2\n2\n4\n2\n3\n2\n2\n3\n"}, {"input": "10\n1 2 4 0 12 1 7 11 0 4\n1 5\n2 3\n3 4\n7 5\n2 6\n6 7\n1 8\n2 9\n2 10", "output": "1\n2\n3\n3\n2\n2\n2\n2\n2\n3\n"}, {"input": "10\n1 2 6 2 7 1 2 10 0 4\n1 3\n2 3\n3 4\n10 5\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\nWe have a string of letters 'a' and 'b'. We want to perform some operations on it. On each step we choose one...
[{"input": "abaaaaaabaaaabbabbaaabbbbabababaaaaabbaabbaaaaabbbaababaaaaaaabbbbbaaaaabaababbabababbabbbbabbbaabbabbbabaabbaabbaaaaaab\n", "output": "502032780\n"}, {"input": "abaaaaaabaaaabbabbaaabbababababaaaaabbaabbaaaaabbbaababaaaaaaabbbbbaaaaabbababbabababbabbbbabbbaabbabbbabaabbaabbaaaaaab\n", "output": "366132879\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L.\nShe will concatenate a...
[{"input": "3 3\ndxx\naxx\ncxx\n", "output": "axxcxxdxx\n"}, {"input": "3 3\ndxx\naxx\ndxx", "output": "axxdxxdxx\n"}, {"input": "3 3\ndxx\naxx\nxxd", "output": "axxdxxxxd\n"}, {"input": "3 3\ndxx\nxxa\nxxd", "output": "dxxxxaxxd\n"}, {"input": "3 3\ncxx\nxxa\nxxd", "output": "cxxxxaxxd\n"}, {"input": "3 3\ndxx\n`xx\nc...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSuppose there is a $h \\times w$ grid consisting of empty or full cells. Let's make some definitions:\n\n $r...
[{"input": "19 16\n16 16 16 16 15 15 0 5 0 4 9 9 1 4 4 0 8 16 12\n6 12 19 15 8 6 19 19 14 6 12 16 10 11 15 4\n", "output": "974740338\n"}, {"input": "19 16\n16 16 16 16 15 15 0 5 0 4 9 9 1 4 4 0 8 16 12\n6 12 19 15 8 6 19 19 14 6 9 16 10 11 15 4\n", "output": "797922655\n"}, {"input": "19 16\n16 16 16 16 15 15 0 5 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\nIn the online judge system, a judge file may include multiple datasets to check whether the submitted program...
[{"input": "3\n14\n11\n14\n2\n58\n0", "output": "Case 1: 3\nCase 2: 14\nCase 3: 11\nCase 4: 14\nCase 5: 2\nCase 6: 58\n"}, {"input": "3\n5\n11\n14\n26\n34\n0", "output": "Case 1: 3\nCase 2: 5\nCase 3: 11\nCase 4: 14\nCase 5: 26\nCase 6: 34\n"}, {"input": "3\n14\n15\n14\n2\n58\n0", "output": "Case 1: 3\nCase 2: 14\nCase...
code_stdio
[ { "content": "You are an expert Python programmer. 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 statistic of price changes for one product represented as an array of $n$ positive integers $p_0, ...
[{"input": "2\n4 1\n20100 1 202 525\n3 101\n1 0 1\n", "output": "32197\n0\n"}, {"input": "2\n4 1\n20100 1 182 525\n3 101\n1 0 1\n", "output": "32217\n0\n"}, {"input": "2\n4 1\n33029 1 202 525\n3 101\n1 0 1\n", "output": "19268\n0\n"}, {"input": "2\n4 1\n20100 1 182 649\n3 101\n1 0 1\n", "output": "44617\n0\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\nAll of the animals are having a feast! Each animal is bringing one dish. There is just one rule: the dish mus...
[{"input": "\"great blue heron\"\n\"garlic naan\"", "output": "[true]", "fn_name": "feast"}, {"input": "\"blue-footed booby\"\n\"blueberry\"", "output": "[true]", "fn_name": "feast"}, {"input": "\"chickadee\"\n\"chocolate cake\"", "output": "[true]", "fn_name": "feast"}, {"input": "\"brown bear\"\n\"bear claw\"", "outp...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n<image> <image>\n\n*The two images are equivalent, feel free to use either one.\n\nInput\n\nThe input contain...
[{"input": "-1079\n", "output": "-1164239\n"}, {"input": "-340\n", "output": "-115598\n"}, {"input": "-449\n", "output": "-201599\n"}, {"input": "-685\n", "output": "-469223\n"}, {"input": "-432\n", "output": "-186622\n"}, {"input": "-346\n", "output": "-119714\n"}, {"input": "-410\n", "output": "-168098\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 are S sheep and W wolves.\nIf the number of wolves is greater than or equal to that of sheep, the wolve...
[{"input": "100 100\n", "output": "unsafe\n"}, {"input": "10 10\n", "output": "unsafe\n"}, {"input": "99 99\n", "output": "unsafe\n"}, {"input": "74 74\n", "output": "unsafe\n"}, {"input": "63 64\n", "output": "unsafe\n"}, {"input": "1 100\n", "output": "unsafe\n"}, {"input": "-1 -1", "output": "unsafe\n"}, {"input": "...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn a very ancient country the following game was popular. Two people play the game. Initially first player wr...
[{"input": "1000000000 100050 1000001\n", "output": "1 000000101\n"}, {"input": "702034015 6007275 9777625\n", "output": "1 000000001\n"}, {"input": "123456789 1234561 1234567\n", "output": "1 000549636\n"}, {"input": "972037745 4602117 5090186\n", "output": "1 000000011\n"}, {"input": "585173560 4799128 5611727\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\nThe pair of integer numbers `(m, n)`, such that `10 > m > n > 0`, (below 10), that its sum, `(m + n)`, and r...
[{"input": "150", "output": "[[149, 140]]", "fn_name": "closest_pair_tonum"}, {"input": "200", "output": "[[197, 28]]", "fn_name": "closest_pair_tonum"}, {"input": "100", "output": "[[97, 72]]", "fn_name": "closest_pair_tonum"}, {"input": "30", "output": "[[29, 20]]", "fn_name": "closest_pair_tonum"}, {"input": "50", "...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n# Task\n Alireza and Ali have a `3×3 table` and playing on that. they have 4 table(2×2) A,B,C and D in this t...
[{"input": "[[3, 7, 4], [5, 16, 11], [2, 9, 7]]", "output": "[[3, 4, 2, 7]]", "fn_name": "table_game"}, {"input": "[[1, 3, 2], [5, 10, 5], [4, 7, 3]]", "output": "[[1, 2, 4, 3]]", "fn_name": "table_game"}, {"input": "[[1, 2, 1], [2, 4, 2], [1, 2, 1]]", "output": "[[1, 1, 1, 1]]", "fn_name": "table_game"}, {"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\nTakahashi had a pair of two positive integers not exceeding N, (a,b), which he has forgotten. He remembers th...
[{"input": "38823 9265", "output": "550080294\n"}, {"input": "11695 7143", "output": "10362628\n"}, {"input": "31415 9265", "output": "287927211"}, {"input": "11695 9265", "output": "2953665\n"}, {"input": "11695 8033", "output": "6706953\n"}, {"input": "3903 337", "output": "10168461\n"}, {"input": "4275 337", "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\nFood contains three nutrients called \"protein\", \"fat\" and \"carbohydrate\", which are called three major ...
[{"input": "4\n1 7 14 47\n2 5 35 55\n3 6 3 59\n4 6 5 15\n10 15 50 110\n2\n1 8 10 116\n-1 4 18 33\n10 10 50 300\n0", "output": "NA\nNA\n"}, {"input": "4\n1 7 14 47\n2 5 35 55\n3 6 3 59\n4 6 5 15\n10 15 50 110\n2\n1 8 10 116\n0 4 18 33\n10 10 50 300\n0", "output": "NA\nNA\n"}, {"input": "4\n1 7 14 47\n2 5 35 55\n3 6 3 59...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAndrew, Fedor and Alex are inventive guys. Now they invent the game with strings for two players.\n\nGiven a ...
[{"input": "5 6\nabas\ndsfdf\nabacaba\ndartsidius\nkolobok\n", "output": "Second\n"}, {"input": "5 6\nabas\ndsfdf\nabacaba\ndartsidius\nkolobok\n", "output": "Second\n"}, {"input": "5 6\nabas\ndsfdf\nabacaba\ndartsidius\nkobolok\n", "output": "Second\n"}, {"input": "5 6\nabas\ndsfdf\nabacaba\ndadtsirius\nkolobok\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\nI'm traveling to a country with a rabbit. There are n cities in this country numbered from 1 to n, and the ra...
[{"input": "5\n101.13623414746552 91.04161232454778\n1 -1\n1 10\n0 3\n19 -1\n20 7", "output": "9\n"}, {"input": "5\n100.60853142327974 90.65666260699702\n1 0\n1 10\n8 3\n10 -1\n12 10", "output": "2\n"}, {"input": "5\n100.60853142327974 90.65666260699702\n1 0\n1 10\n8 3\n19 -1\n12 10", "output": "3\n"}, {"input": "5\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\nNumbers of black and white points are placed on a plane. Let's imagine that a straight line of infinite lengt...
[{"input": "3 3\n100 700\n200 200\n600 600\n500 100\n605 300\n800 578\n3 3\n100 300\n400 600\n400 100\n600 400\n500 900\n300 300\n3 4\n300 300\n935 300\n400 600\n100 100\n200 900\n500 900\n158 110\n1 2\n300 300\n100 100\n500 500\n1 1\n100 100\n200 100\n2 2\n0 0\n500 700\n1000 1400\n1500 2100\n2 2\n0 0\n1000 1000\n1010 ...
code_stdio
[ { "content": "You are an expert Python programmer. 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 tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and t...
[{"input": "bbw\nbww\n+b+\nbwb\nwbx\nwbw\n0", "output": "NA\nNA\n"}, {"input": "caw\nwbw\n+b+\nbwb\nwxb\nwbw\n0", "output": "NA\nNA\n"}, {"input": "bbw\nbww\n+b+\nbwb\nwbx\nwbv\n0", "output": "NA\nNA\n"}, {"input": "cbw\nbww\n+b+\nbwb\nwbx\nwbw\n0", "output": "NA\nNA\n"}, {"input": "caw\nwbw\n+b+\nbwb\nwxb\nwbv\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\nPetya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully st...
[{"input": "10\n3 5 1 3\n0 0 1\n2 1 4\n2 5 2 3\n1 0\n3 2\n1 20 2 4\n0\n16\n6 20 2 5\n1 1 0 1 0 0\n0 8 2 9 11 6\n4 12 3 6\n1 0 1 1\n8 3 5 6\n6 20 3 12\n0 1 0 0 1 0\n20 11 3 20 16 17\n7 17 1 6\n1 1 0 1 0 0 0\n1 8 0 11 15 15 10\n6 17 2 6\n0 0 1 0 0 1\n7 11 2 7 10 12\n5 17 2 5\n1 1 1 1 0\n17 11 10 6 4\n1 1 1 2\n0\n1\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\n\"Hey, it's homework time\" — thought Polycarpus and of course he started with his favourite subject, IT. Pol...
[{"input": "100\n340 14 3275 2283 2673 1107 817 2243 1226 32 2382 3638 4652 418 68 4962 387 764 4647 159 1846 225 2760 4904 3150 403 3 2439 91 4428 92 4705 75 348 1566 1465 69 6 49 4 62 4643 564 1090 3447 1871 2255 139 24 99 2669 969 86 61 4550 158 4537 3993 1589 872 2907 1888 401 80 1825 1483 63 1 2264 4068 4113 2548 ...
code_stdio
[ { "content": "You are an expert Python programmer. 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 is reading a e-book. The file of the book consists of $n$ pages, numbered from $1$ to $n$. The screen i...
[{"input": "5\n20 10 2 9\n1000000000 2 89 4\n1000000000 2 89 8\n1000000000 142 1 1000000000\n1000000000 1000000000 4 3\n", "output": "4\n23\n12\n1\n333333332\n"}, {"input": "5\n20 10 2 9\n1000000000 2 89 4\n1000000000 2 89 5\n1000000000 142 1 1000000000\n1000000000 1000000000 4 3\n", "output": "4\n23\n-1\n1\n333333332\...
code_stdio
[ { "content": "You are an expert Python programmer. 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\nChef loves to prepare delicious dishes. This t...
[{"input": "2\n3\n3 14 3\n4\n1 2 3 3", "output": "2\n3\n"}, {"input": "2\n3\n1 14 3\n4\n1 2 3 3", "output": "3\n3\n"}, {"input": "2\n2\n3 3 1\n4\n1 12 3 3", "output": "2\n3\n"}, {"input": "2\n3\n6 14 3\n4\n1 2 3 3", "output": "3\n3\n"}, {"input": "2\n3\n1 14 3\n4\n1 2 3 2", "output": "3\n3\n"}, {"input": "2\n3\n3 3 3\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWrite a function\n```python\nalternate_sort(l)\n```\nthat combines the elements of an array by sorting the el...
[{"input": "[-5, -2, 3, 9, 4, -2, -8, 0, 9, -9]", "output": "[[-2, 0, -2, 3, -5, 4, -8, 9, -9, 9]]", "fn_name": "alternate_sort"}, {"input": "[5, -42, -8, 2, -3, -4, -9]", "output": "[[-3, 2, -4, 5, -8, -9, -42]]", "fn_name": "alternate_sort"}, {"input": "[5, -42, 2, -3, -4, 8, 9]", "output": "[[-3, 2, -4, 5, -42, 8, 9...
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\nLeha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Gr...
[{"input": "10 10\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n6 7\n8 3\n6 4\n4 2\n9 1\n5 10\n9 8\n10 7\n5 1\n6 2\n", "output": "0\n\n"}, {"input": "10 10\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n6 7\n8 3\n4 4\n4 2\n9 1\n5 10\n9 8\n10 7\n5 1\n6 2\n", "output": "0\n\n"}, {"input": "10 10\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n6 7\n8 3\n6 4\n4 2\n9 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWe define $x \\bmod y$ as the remainder of division of $x$ by $y$ ($\\%$ operator in C++ or Java, mod operato...
[{"input": "500000 250000\n", "output": "803991687\n"}, {"input": "500000 250000\n", "output": "803991687\n"}, {"input": "500000 471528\n", "output": "588862109\n"}, {"input": "500000 121854\n", "output": "377057930\n"}, {"input": "123456 78901\n", "output": "963821949\n"}, {"input": "123456 78901\n", "output": "963821...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSome programming contest problems are really tricky: not only do they\nrequire a different output format from...
[{"input": "4\n-2 1 2 4\n5\n-1 3 0 3 0\n1\n1\n0", "output": "not ambiguous\nnot ambiguous\nambiguous\n"}, {"input": "4\n-1 4 2 4\n5\n0 3 4 3 0\n1\n1\n0", "output": "not ambiguous\nnot ambiguous\nambiguous\n"}, {"input": "4\n-1 4 2 1\n5\n0 3 4 3 0\n1\n1\n0", "output": "not ambiguous\nnot ambiguous\nambiguous\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\nLexicographic permutations are ordered combinations of a set of items ordered in a specific way.\n\nFor insta...
[{"input": "1000000\n10", "output": "[\"2783915460\"]", "fn_name": "nth_perm"}, {"input": "3000000\n10", "output": "[\"8241697530\"]", "fn_name": "nth_perm"}, {"input": "1234567\n10", "output": "[\"3469702158\"]", "fn_name": "nth_perm"}, {"input": "654321\n10", "output": "[\"1827653409\"]", "fn_name": "nth_perm"}, {"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\nThere are n boys and m girls attending a theatre club. To set a play \"The Big Bang Theory\", they need to ch...
[{"input": "30 30 30\n", "output": "118264581548187697"}, {"input": "30 29 19\n", "output": "1396982287132530\n"}, {"input": "30 30 19\n", "output": "2044156982307300\n"}, {"input": "30 29 42\n", "output": "277508869722315\n"}, {"input": "21 30 30\n", "output": "114456652814979\n"}, {"input": "30 30 44\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\nThere is a special offer in Vasya's favourite supermarket: if the customer buys $a$ chocolate bars, he or she...
[{"input": "16\n1 1 1 1\n1 1 1 1000000000\n1 1 1000000000 1\n1 1 1000000000 1000000000\n1 1000000000 1 1\n1 1000000000 1 1000000000\n1 1000000000 1000000000 1\n1 1000000000 1000000000 1000000000\n1000000000 1 1 1\n1000000000 1 1 1000000000\n1000000000 1 1000000000 1\n1000000000 1 1000000000 1000000000\n1000000000 10000...
code_stdio
[ { "content": "You are an expert Python programmer. 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 bar of chocolate with a height of H blocks and a width of W blocks.\nSnuke is dividing this bar in...
[{"input": "100000 100000\n", "output": "50000\n"}, {"input": "100100 100000", "output": "50000\n"}, {"input": "100100 110000", "output": "50050\n"}, {"input": "100111 100001", "output": "83371\n"}, {"input": "100100 100010", "output": "50005\n"}, {"input": "110111 100001", "output": "86704\n"}, {"input": "101111 01000...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTattah is asleep if and only if Tattah is attending a lecture. This is a well-known formula among Tattah's co...
[{"input": "04:50\n", "output": "05:50\n"}, {"input": "02:17\n", "output": "02:20\n"}, {"input": "12:14\n", "output": "12:21\n"}, {"input": "03:44\n", "output": "04:40\n"}, {"input": "00:17\n", "output": "01:10\n"}, {"input": "15:51\n", "output": "20:02\n"}, {"input": "23:31\n", "output": "23:32\n"}, {"input": "07:56\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\nJ: City\n\nSanta decides to deliver a present to a city.\n\nThe city has a rectangular shape divided into nor...
[{"input": "2 -2 11 0", "output": "Yes\n"}, {"input": "0 -1 12 1", "output": "Yes\n"}, {"input": "-1 2 0 14", "output": "Yes\n"}, {"input": "0 -1 1 11", "output": "Yes\n"}, {"input": "1 -2 11 0", "output": "Yes\n"}, {"input": "3 1 2 12", "output": "Yes\n"}, {"input": "2 2 0 14", "output": "Yes\n"}, {"input": "0 2 0 14"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nVasya plays the LionAge II. He was bored of playing with a stupid computer, so he installed this popular MMOR...
[{"input": "emrvvhupytoxzhqxmuop 1\n49\ng g -558\nd g 845\nd k -745\nb g -773\nf f -733\nb s -491\na s -894\ng d -565\ns k -756\nb a 373\nb d 398\nk f 250\na b 531\nf g -27\nf b 125\na g -555\ns f 540\ng b 194\nk s -636\ns b -955\nd a -520\ng f -97\nf s -204\ns a 171\nb k -304\ns g -160\na a -567\na f -455\nd d -571\nd...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nFind the smallest possible sum of the digits in the decimal notation of a positive multiple of K.\n\n-----Con...
[{"input": "79992\n", "output": "36\n"}, {"input": "10989", "output": "27\n"}, {"input": "37450", "output": "3\n"}, {"input": "70620", "output": "6\n"}, {"input": "11849", "output": "5\n"}, {"input": "48730", "output": "4\n"}, {"input": "45794", "output": "3\n"}, {"input": "34375", "output": "2\n"}, {"input": "31041", ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nProblem Statement\n\nThe Animal School is a primary school for animal children. You are a fox attending this ...
[{"input": "3?4\n?21\n5?5\n14??\n?7?5\n3?9?\n?????\n?????\n?????\n0", "output": "10\n100\n200039979\n"}, {"input": "3?5\n1?1\n5?6\n41??\n5?7?\n9??2\n?????\n?????\n?????\n0", "output": "45\n823\n200039979\n"}, {"input": "3?5\n1?1\n5?6\n41??\n5?6?\n9??2\n?????\n?????\n?????\n0", "output": "45\n833\n200039979\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 are N positive integers written on a blackboard: A_1, ..., A_N.\nSnuke can perform the following operat...
[{"input": "6\n382253568 723152896 37802240 379425024 404894720 471526144\n", "output": "8\n"}, {"input": "6\n348324507 1154626501 32183854 379425024 590201381 471526144", "output": "0\n"}, {"input": "6\n586050932 1154626501 32183854 379425024 590201381 471526144", "output": "0\n"}, {"input": "6\n586050932 1154626501 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\nThere are n integers b_1, b_2, ..., b_{n} written in a row. For all i from 1 to n, values a_{i} are defined b...
[{"input": "10\n-38980 0001000000 -1000000000 1000000000 -1000000000 1000010010 -1000000000 1010000010 -1556535198 1000000000\n", "output": "961020 -999000000 0 0 10010 10010 10000010 -546535188 -556535198 1000000000\n"}, {"input": "10\n-38980 0001000000 -1000000000 1000000000 -1000000000 1000010011 -1000000000 1010000...
code_stdio
[ { "content": "You are an expert Python programmer. 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 (yet again) a string good if its length is even, and every character in odd position of this strin...
[{"input": "100\nababbaaabaaabaabbabbaaabbabaaabbbabbbbbbbbababbbbbabbaaaabbbabbaababaabaababbbabababbbababbbbaabbbba\n", "output": "34\nababbaabababbabaabbabaabbababababaabbabaabababababbabababababaabba\n"}, {"input": "100\nabbbbaabbbbababbbabababbbabaabaababaabbabbbaaaabbabbbbbababbbbbbbbabbbaaababbaaabbabbaabaaabaaa...
code_stdio
[ { "content": "You are an expert Python programmer. 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 polynomials:\n\n * P(x) = a0·xn + a1·xn - 1 + ... + an - 1·x + an and \n * Q(x) = b0·xm +...
[{"input": "69 69\n-7 38 -3 -22 65 -78 -65 -99 -76 63 0 -4 -78 -51 54 -61 -53 60 80 34 -96 162 -78 -96 21 -10 -86 33 -9 -81 -19 -2 -76 -3 -66 -80 -55 -21 -50 37 -86 -37 47 44 76 -39 54 -25 41 -86 -3 -25 -67 94 18 67 27 -5 -30 -69 2 -76 7 -97 -52 -35 -55 -20 92 2\n90 -94 37 41 -27 -54 96 -15 -60 -29 -75 -93 -57 62 7 -88...
code_stdio
[ { "content": "You are an expert Python programmer. 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 fence consisting of $n$ vertical boards. The width of each board is $1$. The height of the $i$-th ...
[{"input": "3\n3\n3 4\n2 1\n3 7\n3\n2 3\n2 2\n2 0\n4\n1 7\n12 2\n2 15\n1000000000 8\n", "output": "0\n2\n0\n"}, {"input": "3\n3\n3 4\n2 1\n3 4\n3\n2 3\n2 2\n2 0\n4\n1 7\n12 2\n2 15\n1000000000 8\n", "output": "0\n2\n0\n"}, {"input": "3\n3\n3 4\n2 1\n3 7\n3\n2 3\n2 2\n2 0\n4\n1 7\n12 2\n3 15\n1000000000 8\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\nThe Collatz Conjecture states that for any natural number n, if n is even, divide it by 2. If n is odd, multi...
[{"input": "73567465519280238573", "output": "[362]", "fn_name": "collatz"}, {"input": "1000000000000000", "output": "[276]", "fn_name": "collatz"}, {"input": "1000000000", "output": "[101]", "fn_name": "collatz"}, {"input": "500", "output": "[111]", "fn_name": "collatz"}, {"input": "100", "output": "[26]", "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\nHow many ways are there to place a black and a white knight on an N * M chessboard such that they do not atta...
[{"input": "3\n29 5\n2 2\n16 7", "output": "20112\n12\n11796\n"}, {"input": "3\n16 3\n4 3\n12 4", "output": "2084\n104\n2048\n"}, {"input": "3\n29 3\n2 2\n16 7", "output": "7154\n12\n11796\n"}, {"input": "3\n16 2\n4 3\n12 3", "output": "936\n104\n1136\n"}, {"input": "3\n16 2\n4 3\n12 4", "output": "936\n104\n2048\n"}, ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a positive decimal number x.\n\nYour task is to convert it to the \"simple exponential notation...
[{"input": "2206815224318443962208128404511577750057653265995300414539703580103256087275661997018352502651118684\n", "output": "2.206815224318443962208128404511577750057653265995300414539703580103256087275661997018352502651118684E99\n"}, {"input": "22068152243184439622081284045115777500576532659953004145397035801032560...
code_stdio
[ { "content": "You are an expert Python programmer. 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 learning a lot about space exploration, a little girl named Ana wants to change the subject.\n\nAna is ...
[{"input": "20\niw\nix\nudb\nbg\noi\nuo\njsm\num\ns\nquy\nqo\nbxct\nng\nrmr\nnu\nps\nio\nkh\nw\nk\n", "output": "5\n"}, {"input": "20\niw\nix\nudb\nbg\noi\nuo\njsm\nmu\ns\nquy\nqo\nbxct\nng\nrmr\nnu\nps\nio\nkh\nw\nk\n", "output": "5\n"}, {"input": "20\niw\nix\nudb\nbg\nni\nuo\njsm\nmu\ns\nquy\nqo\nbxct\nng\nrmr\nnu\np...
code_stdio
[ { "content": "You are an expert Python programmer. 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 Little Elephant from the Zoo of Lviv likes lucky strings, i.e., the strings that consist only of the lucky ...
[{"input": "2 4\n2\n752\n25003\n1329\n10896\n39952297003683893618248919566249112695937429123", "output": "Good\nGood\nBad\nGood\n"}, {"input": "2 4\n1\n752\n28466\n1329\n10896\n95142413585696281004906476796906063037090967865", "output": "Bad\nGood\nGood\nGood\n"}, {"input": "2 4\n24\n501\n16429\n1329\n10896\n9514241358...
code_stdio
[ { "content": "You are an expert Python programmer. 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\"Search\" is an operation to obtain the desired information from a large amount of information. Familiar exa...
[{"input": "7\n11\n15\n-2\n53\n51\n17\n109\n42\n4\n1\n2\n3\n10\n-1\n0", "output": "3\n2\n"}, {"input": "7\n11\n15\n-2\n53\n51\n17\n109\n42\n4\n1\n2\n3\n10\n-2\n0", "output": "3\n2\n"}, {"input": "7\n11\n15\n-2\n53\n51\n17\n109\n42\n4\n2\n2\n3\n10\n-2\n0", "output": "3\n2\n"}, {"input": "7\n11\n15\n-1\n53\n51\n56\n109\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nGiven is a string S. Each character in S is either a digit (0, ..., 9) or ?.\nAmong the integers obtained by ...
[{"input": "???????????????2?????????????8???????????6????????5?6?5????1???8????1???????????????????????????????????3??????9????????????3??6???????????6???????????????????3???????????9???????3????6?5?????????????????2???????????5418??????????8????????9????????????0????????????????????????9????????????????????9??????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\nYou are given an undirected connected graph with N vertices and M edges that does not contain self-loops and ...
[{"input": "7 7\n1 3\n2 7\n3 4\n4 5\n4 6\n5 6\n6 7\n", "output": "4\n"}, {"input": "7 7\n1 3\n2 7\n3 4\n4 5\n4 6\n5 6\n6 7", "output": "4"}, {"input": "6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n", "output": "5\n"}, {"input": "6 5\n1 2\n2 3\n3 4\n3 5\n5 6", "output": "5\n"}, {"input": "6 5\n1 2\n2 3\n3 4\n4 5\n2 6", "output": "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\nTaro went to a toy store to buy a game of life made by Aizu Hobby. Life games are played using a board with s...
[{"input": "1 2 0\n1\n1 2 1\n1\n1 2 101\n1 2 1\n1\n1 2 100\n2 2 1\n1 2\n1 2 100\n4 5 3\n1 2 3 4\n1 1 2\n2 2 100\n4 3 32\n0 0 0", "output": "0\n101\n100\n50\n22\n"}, {"input": "1 2 0\n1\n1 2 1\n1\n1 2 100\n1 2 1\n1\n1 2 100\n2 2 1\n1 2\n1 2 100\n4 5 3\n1 2 3 4\n1 1 2\n2 2 100\n4 3 32\n0 0 0", "output": "0\n100\n100\n50\...
code_stdio
[ { "content": "You are an expert Python programmer. 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 start from some definitions.\n\nStrings A and B are called anagrams if it's possible to rearrange the l...
[{"input": "3\nmpei\nelepgaot\nitco", "output": "no such string\n"}, {"input": "3\nmpei\nglepeaot\nitco", "output": "no such string\n"}, {"input": "3\niepm\nglepeaot\nitco", "output": "no such string\n"}, {"input": "3\niepm\ngleoeaot\nitco", "output": "no such string\n"}, {"input": "3\niepm\ngleoeaot\nhtco", "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\nVitya has just started learning Berlanese language. It is known that Berlanese uses the Latin alphabet. Vowel...
[{"input": "auuaoonntanonnuewannnnpuuinniwoonennyolonnnvienonpoujinndinunnenannmuveoiuuhikucuziuhunnnmunzancenen\n", "output": "YES\n"}, {"input": "auuaoonntanonnuewannnnpuuinniwoonennyolonnnvienonpoujinndinunnenannmuveoiuuhikucuziuhunnnmunzancenen\n", "output": "YES\n"}, {"input": "auuaoonntanonnuewannnopuuinniwoonenn...
code_stdio
[ { "content": "You are an expert Python programmer. 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 Bubble Cup hypothesis stood unsolved for 130 years. Who ever proves the hypothesis will be regarded as on...
[{"input": "100\n751 557 779 329 39 213 844 289 137 50 951 284 671 474 829 906 736 395 366 22 133 418 552 649 636 109 974 775 852 971 384 945 335 961 472 651 335 543 560 135 85 952 558 838 147 644 688 727 940 978 309 705 409 27 774 951 92 277 835 804 589 103 529 11 304 171 655 378 792 876 1161 36 125 378 152 958 746 98...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nBob is about to take a hot bath. \n\nThere are two taps to fill the bath: a hot water tap and a cold water ta...
[{"input": "1000000 1000000 1000000 1000000 1000000\n", "output": "1000000 1000000\n"}, {"input": "1000000 1000000 999999 999998 1000000\n", "output": "999999 999998\n"}, {"input": "129630 805489 631548 761110 577559\n", "output": "227930 447929\n"}, {"input": "581106 975502 703094 487920 637713\n", "output": "675578 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 four integers $a$, $b$, $x$ and $y$. Initially, $a \\ge x$ and $b \\ge y$. You can do the follo...
[{"input": "7\n10 10 8 5 3\n12 8 8 7 2\n12343 43 4543 39 123212\n1000000000 1000000000 1 1 1\n1000000000 1000000000 1 1 1000000000\n10 11 2 1 5\n10 11 9 1 10\n", "output": "70\n77\n177177\n999999999000000000\n999999999\n55\n10\n"}, {"input": "7\n10 10 8 5 3\n12 8 0 7 2\n12343 43 4543 39 123212\n1000000000 1000000000 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\nBob likes to draw camels: with a single hump, two humps, three humps, etc. He draws a camel by connecting poi...
[{"input": "19 7\n", "output": "197939352\n"}, {"input": "20 8\n", "output": "503245466\n"}, {"input": "19 8\n", "output": "109824208\n"}, {"input": "20 7\n", "output": "468541040\n"}, {"input": "20 9\n", "output": "90700276\n"}, {"input": "19 6\n", "output": "69183464\n"}, {"input": "20 6\n", "output": "96046590\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 grasshopper is located on the numeric axis at the point with coordinate $x_0$.\n\nHaving nothing else to ...
[{"input": "9\n0 1\n0 2\n10 10\n10 197\n177 25\n10000000000 1895528572\n-433494437 87178291199\n1 0\n-1 1\n", "output": "-1\n1\n11\n-187\n202\n10000000000\n-87611785637\n1\n0\n"}, {"input": "9\n0 1\n0 2\n10 11\n10 197\n177 25\n10000000000 1895528572\n-433494437 87178291199\n1 0\n-1 1\n", "output": "-1\n1\n22\n-187\n202...
code_stdio
[ { "content": "You are an expert Python programmer. 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 found an undirected connected graph with N vertices and M edges. The vertices are numbered 1 throug...
[{"input": "4 6\n1 3 10\n4 1 10\n2 4 8\n3 2 2\n3 4 8\n2 1 3\n1\n2 3", "output": "11\n"}, {"input": "4 6\n1 3 10\n4 1 10\n2 4 6\n3 2 2\n3 4 8\n2 2 3\n1\n2 3", "output": "16\n"}, {"input": "4 6\n2 1 10\n4 1 23\n2 4 6\n2 2 4\n3 4 4\n3 2 6\n1\n2 3", "output": "14\n"}, {"input": "4 6\n2 1 10\n4 1 10\n2 4 6\n3 2 2\n3 4 5\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\nLittle Artem likes electronics. He can spend lots of time making different schemas and looking for novelties ...
[{"input": "13 21 1\n2 11\n", "output": "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 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\nWe will call a string that can be obtained by concatenating two equal strings an even string.\nFor example, x...
[{"input": "akasakaakasakasakaakas\n", "output": "14\n"}, {"input": "akasakaakasakasaka`kas", "output": "14\n"}, {"input": "akasakaakasakasakb`kas", "output": "14\n"}, {"input": "akakasaakasakasakaakas", "output": "4\n"}, {"input": "akakasaakasakas`kaakas", "output": "4\n"}, {"input": "akakasaakasakbs`kaakas", "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\nAlex decided to go on a touristic trip over the country.\n\nFor simplicity let's assume that the country has ...
[{"input": "30 30\n81 86 81 91 90 100 98 89 96 97 88 99 68 23 82 107 94 80 99 67 70 90 81 74 91 100 92 89 74 98\n16 26\n20 3\n23 16\n17 27\n30 22\n18 23\n14 30\n25 4\n3 8\n18 9\n29 26\n27 21\n26 6\n10 7\n28 5\n1 30\n28 30\n12 15\n17 25\n26 15\n30 2\n5 15\n14 20\n10 4\n24 16\n8 7\n11 30\n19 8\n21 9\n13 15\n2\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\nGiven is a string S of length N-1. Each character in S is `<` or `>`.\n\nA sequence of N non-negative integer...
[{"input": "<>>><<<<<><<>>><", "output": "29\n"}, {"input": "<>>>><<<<><<<>><", "output": "28\n"}, {"input": "<>><<<><<<<>>>><", "output": "26\n"}, {"input": "<<>><<><<<<>>>><", "output": "24\n"}, {"input": "<>>>><<<<><<>><<", "output": "27\n"}, {"input": "<>>>>><<<><<<><<", "output": "30\n"}, {"input": "<>>><>><<><<<>...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA non-empty string is called palindrome, if it reads the same from the left to the right and from the right t...
[{"input": "21\narozaupalanalapuazora\n", "output": "aaaaaaaallnoopprruuzz\n"}, {"input": "16\ngagadbcgghhchbdf\n", "output": "aabbccddfgggghhh\n"}, {"input": "15\nabacabadabacaba\n", "output": "aaaaaaaabbbbccd\n"}, {"input": "10\nmsunonames\n", "output": "aemmnnossu\n"}, {"input": "9\nabcabcabc\n", "output": "aaabbbcc...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou've got a string a_1, a_2, ..., a_n, consisting of zeros and ones.\n\nLet's call a sequence of consecutive...
[{"input": "25 999999998 999999999\n1011001110101010100110001\n", "output": "7999999985\n"}, {"input": "25 999999998 999999999\n1011001110101010100110101\n", "output": "8999999983\n"}, {"input": "25 999999998 999999999\n1011001110101010100111001\n", "output": "7999999985"}, {"input": "4 360253575 1080814150\n1101\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\nGildong is playing a video game called Block Adventure. In Block Adventure, there are $n$ columns of blocks i...
[{"input": "1\n30 0 0\n-1 1 0 -1 1 0 0 0 0 0 0 -1 2 1 -1 -1 0 -1 0 0 0 1 1 -2 2 0 -1 2 0 -1 -2 -1 0 1 0 0 1 1 -1 1 0 0 1 1 0 0 1 0 0 0 0 1 0 -1 2 0 1 1 1 0 0 1 -1 0 1 -1 1 -1 -2 -1 0 0 0 0 -1 0 2 0 0 0 -1 -2 0 1 1 -1 1 1 0 1 -1 -1 -1 -4 -2 0 0\n", "output": "NO\n"}, {"input": "1\n30 0 0\n-1 1 0 -1 1 0 0 0 0 0 0 -1 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\nNezzar's favorite digit among $1,\\ldots,9$ is $d$. He calls a positive integer lucky if $d$ occurs at least ...
[{"input": "2\n3 3\n24 21 27\n10 4\n74 13 26 95 102 51 34 58 42 60\n", "output": "YES\nYES\nYES\nYES\nNO\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\n"}, {"input": "2\n3 3\n27 21 27\n10 4\n74 13 26 95 102 51 34 58 42 60\n", "output": "YES\nYES\nYES\nYES\nNO\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\n"}, {"input": "2\n3 3\n27...
code_stdio
[ { "content": "You are an expert Python programmer. 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 complete binary tree with the height of H, we index the nodes respectively top-down and left-right fr...
[{"input": "2\n2 1 6\n3\n7 2 26 2 16 8 13\n0", "output": "12\n2366\n"}, {"input": "2\n1 2 3\n3\n6 2 10 2 12 20 13\n0", "output": "3\n1200\n"}, {"input": "2\n1 2 3\n3\n6 2 10 2 12 9 17\n0", "output": "3\n1020\n"}, {"input": "2\n2 1 3\n3\n7 2 14 2 16 8 13\n0", "output": "6\n1274\n"}, {"input": "2\n2 1 3\n3\n7 2 26 2 16 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\nThanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.\n\nLet...
[{"input": "5 3 10000 3241\n5 12 2\n", "output": "58892\n"}, {"input": "5 3 3521 10000\n5 12 2\n", "output": "58168\n"}, {"input": "5 3 10000 2737\n5 12 2\n", "output": "52844\n"}, {"input": "5 3 3521 10010\n5 12 2\n", "output": "58198\n"}, {"input": "5 3 3521 10000\n6 12 2\n", "output": "58168\n"}, {"input": "5 3 1000...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAlan decided to get in shape for the summer, so he created a precise workout plan to follow. His plan is to g...
[{"input": "5 00000\n10000 30000 30000 40000 19505\n27261\n14 2 8 5 6\n", "output": "16\n"}, {"input": "5 00000\n10000 30000 30000 40000 19505\n27261\n14 0 8 5 6\n", "output": "14\n"}, {"input": "5 10000\n10000 40000 30000 30000 20000\n10000\n5 2 8 3 6\n", "output": "-1\n"}, {"input": "5 10000\n10000 37530 30000 30000 ...
code_stdio
[ { "content": "You are an expert Python programmer. 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 following process. \n\nThere is a platform with $n$ columns. $1 \\times 1$ squares are appear...
[{"input": "1000 10\n999 999 998 34 454 546 343 35 34 1000\n", "output": "0\n"}, {"input": "1000 10\n999 999 998 34 454 546 343 35 34 1000\n", "output": "0\n"}, {"input": "1000 10\n999 999 998 34 454 546 343 69 34 1000\n", "output": "0\n"}, {"input": "1000 10\n999 999 998 34 454 546 343 67 34 1000\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\nProfessor Dumbledore is helping Harry destroy the Horcruxes. He went to Gaunt Shack as he suspected a Horcrux...
[{"input": "43 959134961 -868367850 142426380\n921743429 63959718 -797293233 122041422 -407576197 700139744 299598010 168207043 362252658 591926075 941946099 812263640 -76679927 -824267725 89529990 -73303355 83596189 -982699817 -235197848 654773327 125211479 -497091570 -2301804 203486596 -126652024 309810546 -581289415...
code_stdio
[ { "content": "You are an expert Python programmer. 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 got n candies and m friends (n ≥ m). He wants to make a New Year present with candies to each ...
[{"input": "100 100\n", "output": "1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 "}, {"input": "100 100\n", "output": "1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n# Task\n Timed Reading is an educational tool used in many schools to improve and advance reading skills. A y...
[{"input": "5\n\"Now and then, however, he is horribly thoughtless, and seems to take a real delight in giving me pain.\"", "output": "[14]", "fn_name": "timed_reading"}, {"input": "6\n\"Zebras evolved among the Old World horses within the last four million years.\"", "output": "[11]", "fn_name": "timed_reading"}, {"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\nIn Byteland they have a very strange monetary system.\n\nEach Bytelandian gold coin has an integer number wri...
[{"input": "12\n10", "output": "13\n10\n"}, {"input": "12\n19", "output": "13\n19\n"}, {"input": "12\n11", "output": "13\n11\n"}, {"input": "12\n21", "output": "13\n22\n"}, {"input": "12\n27", "output": "13\n28\n"}, {"input": "12\n12", "output": "13\n13\n"}, {"input": "12\n15", "output": "13\n15\n"}, {"input": "12\n14"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSherlock Holmes and Dr. Watson played some game on a checkered board n × n in size. During the game they put ...
[{"input": "12\n8 42 23 20 39 5 23 86 26 65 93 82\n48 35 12 4 59 19 19 28 38 81 97 99\n93 24 31 44 97 50 44 99 50 7 10 64\n79 43 65 29 84 43 46 41 89 16 6 1\n34 90 33 1 7 12 46 84 67 30 1 58\n58 21 100 66 56 22 7 24 72 73 86 37\n2 17 85 6 2 73 85 44 43 79 34 65\n3 53 29 76 87 2 27 19 11 42 71 38\n69 82 73 52 44 23 92 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\nTheory\n This section does not need to be read and can be skipped, but it does provide some clarity into the ...
[{"input": "[-11, -9, -7, -6, -4, -2, 0, 1, 3, 6, 8, 10, 12, 13, 15]", "output": "[true]", "fn_name": "is_tune"}, {"input": "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]", "output": "[false]", "fn_name": "is_tune"}, {"input": "[-4, -2, 0, 1, 3, 6, 8, 10, 12, 13, 15]", "output": "[true]", "fn_name": "is_tune"}, {"input": "[1...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou have $2n$ integers $1, 2, \\dots, 2n$. You have to redistribute these $2n$ elements into $n$ pairs. After...
[{"input": "3\n1\n1\n5\n1 4 5 9 10\n2\n3 4\n", "output": "\n1\n3\n1\n"}, {"input": "3\n1\n1\n5\n1 4 5 9 10\n2\n3 4\n", "output": "1\n3\n1\n"}, {"input": "3\n1\n1\n5\n1 4 5 9 10\n2\n1 4\n", "output": "1\n3\n1\n"}, {"input": "3\n1\n1\n5\n1 4 5 9 10\n2\n2 4\n", "output": "1\n3\n2\n"}, {"input": "3\n1\n1\n5\n1 4 5 7 10\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\nOn a two-dimensional plane, there are N red points and N blue points.\nThe coordinates of the i-th red point ...
[{"input": "5\n0 0\n4 1\n5 5\n6 6\n13 11\n2 2\n6 3\n-1 4\n8 4\n14 17", "output": "3\n"}, {"input": "5\n0 0\n4 1\n5 5\n6 6\n13 11\n2 2\n6 3\n-1 4\n8 4\n9 17", "output": "3\n"}, {"input": "5\n0 0\n4 1\n5 5\n6 6\n13 11\n2 2\n8 3\n-1 4\n14 4\n9 4", "output": "2\n"}, {"input": "5\n0 0\n4 1\n5 5\n6 6\n13 11\n2 2\n3 3\n1 4\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\nFind the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.\n\nConstra...
[{"input": "1265641936938969", "output": "135\n"}, {"input": "2005985506723837", "output": "136\n"}, {"input": "5193523582167964", "output": "139\n"}, {"input": "4944180382968715", "output": "138\n"}, {"input": "7493811264493993", "output": "141\n"}, {"input": "813322357948504", "output": "133\n"}, {"input": "127248513...
code_stdio
[ { "content": "You are an expert Python programmer. 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, the capital is located in city s, and the historic home town of the President is in cit...
[{"input": "2 9 1 2\n1 2 1000000\n1 2 1000000\n1 2 1100000\n1 2 1000000\n1 2 2\n1 2 1000000\n1 2 1000000\n1 2 1000000\n1 2 1000000\n", "output": "CAN 999999\nCAN 999999\nCAN 1099999\nCAN 999999\nYES\nCAN 999999\nCAN 999999\nCAN 999999\nCAN 999999\n"}, {"input": "2 9 1 2\n1 2 1000000\n1 2 1000000\n1 2 1000000\n1 2 10000...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere is an array of strings. All strings contains similar _letters_ except one. Try to find it!\n\n```python...
[{"input": "[\"Tom Marvolo Riddle\", \"I am Lord Voldemort\", \"Harry Potter\"]", "output": "[\"Harry Potter\"]", "fn_name": "find_uniq"}, {"input": "[\"foobar\", \"barfo\", \"fobara\", \" \", \"fobra\", \"oooofrab\"]", "output": "[\" \"]", "fn_name": "find_uniq"}, {"input": "[\"Aa\", \"aaa\", \"aaaaa\", \"BbBb\", ...
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 integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,...
[{"input": "32\n29 19 7 10 26 32 27 4 11 20 2 8 16 23 5 14 6 12 17 22 18 30 28 24 15 1 25 3 13 21 19 31 9\n", "output": "32\n525\n5453\n40919\n237336\n1107568\n4272048\n13884156\n38567100\n92561040\n193536720\n354817320\n573166440\n818809200\n37158313\n166803103\n166803103\n37158313\n818809200\n573166440\n354817320\n19...
code_stdio
[ { "content": "You are an expert Python programmer. 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 tetromino is a figure formed by joining four squares edge to edge. We will refer to the following seven kin...
[{"input": "10 1 2 0 0 -1 0", "output": "11\n"}, {"input": "1 13 1 0 1 -1 2", "output": "13\n"}, {"input": "10 2 0 0 4 -1 0", "output": "16\n"}, {"input": "1 26 1 0 1 -1 2", "output": "26\n"}, {"input": "10 3 0 0 4 -1 0", "output": "17\n"}, {"input": "1 26 1 0 2 -1 2", "output": "28\n"}, {"input": "10 1 0 0 4 -1 0", "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\nYouKn0wWho has an integer sequence $a_1, a_2, \\ldots a_n$. Now he will split the sequence $a$ into one or mo...
[{"input": "4\n7\n1 12 3 0 1 1 5\n3\n2 2 5\n5\n1 3 2 4 4\n4\n4 5 -1 1\n", "output": "YES\nYES\nYES\nYES\n"}, {"input": "4\n7\n1 11 3 2 1 1 5\n3\n2 2 5\n5\n1 3 2 4 4\n4\n4 5 -2 1\n", "output": "YES\nYES\nYES\nYES\n"}, {"input": "4\n7\n1 4 3 2 -1 1 -1\n3\n1 6 0\n3\n1 4 2 4 2\n4\n4 2 1 1\n", "output": "YES\nYES\nYES\nYES\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou have a large rectangular board which is divided into $n \\times m$ cells (the board has $n$ rows and $m$ ...
[{"input": "5 4\noooo\no*oo\noooo\n**oo\nooo*\n", "output": "239616\n"}, {"input": "5 4\noooo\no*oo\noooo\n**oo\nooo*\n", "output": "239616\n"}, {"input": "5 4\noooo\no*oo\noooo\n**oo\n*ooo\n", "output": "249856\n"}, {"input": "5 4\noooo\no*oo\noooo\no*o*\nooo*\n", "output": "233472\n"}, {"input": "5 4\noooo\no*oo\nooo...
code_stdio
[ { "content": "You are an expert Python programmer. 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 $d_1, d_2, \\dots, d_n$ consisting of $n$ integer numbers.\n\nYour task is to split th...
[{"input": "5\n2 3 5 4 10\n", "output": "10\n"}, {"input": "1\n1000000000\n", "output": "0\n"}, {"input": "1\n1000000000\n", "output": "0\n"}, {"input": "1\n1000000100\n", "output": "0\n"}, {"input": "5\n1 15 4 2 1\n", "output": "1\n"}, {"input": "1\n1000000110\n", "output": "0\n"}, {"input": "5\n2 3 5 4 6\n", "output"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are n pearls in a row. Let's enumerate them with integers from 1 to n from the left to the right. The p...
[{"input": "10\n460626451 460626451 460626451 460626451 460626451 460626451 460626451 460626451 460626451 460626451\n", "output": "5\n1 2\n3 4\n5 6\n7 8\n9 10\n"}, {"input": "10\n460626451 460626451 460626451 460626451 460626451 460626451 460626451 460626451 460626451 460626451\n", "output": "5\n1 2\n3 4\n5 6\n7 8\n9 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\nAlice has a string consisting of characters 'A', 'B' and 'C'. Bob can use the following transitions on any su...
[{"input": "AAAAAA\nAAAAAA\n30\n3 4 1 2\n3 3 4 4\n5 6 3 4\n3 3 2 3\n6 6 1 5\n2 4 4 6\n1 6 2 5\n6 6 3 4\n3 5 1 4\n4 5 3 6\n2 3 2 4\n3 4 4 4\n6 6 4 6\n3 3 2 5\n1 5 3 3\n4 6 1 2\n6 6 6 6\n3 3 3 4\n6 6 6 6\n5 6 4 4\n6 6 5 5\n2 3 1 4\n3 6 4 5\n3 5 6 6\n4 5 2 6\n5 6 6 6\n1 4 2 5\n4 5 2 5\n4 5 1 3\n2 2 4 6\n", "output": "1110...
code_stdio