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\nBarney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1...
[{"input": "10\n2 37526406560905229 37526426361107171\n2 37526424114740747 18763396439955441\n2 300485276957081578 301492476099962199\n1 75035386466351570 441803674395985082 642312512\n2 300197522144700185 220954108245114486\n1 150105696341181576 559187296 100113944\n1 300197522135707767 150242638470761995 170574370\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 is a right triangle ABC with ∠ABC=90°.\nGiven the lengths of the three sides, |AB|,|BC| and |CA|, find ...
[{"input": "28 96 100\n", "output": "1344\n"}, {"input": "35 84 91\n", "output": "1470\n"}, {"input": "77 36 85\n", "output": "1386\n"}, {"input": "32 69 101", "output": "1104\n"}, {"input": "45 28 53\n", "output": "630\n"}, {"input": "24 10 26\n", "output": "120\n"}, {"input": "13 84 85\n", "output": "546\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\nTenten runs a weapon shop for ninjas. Today she is willing to sell n shurikens which cost 1, 2, ..., n ryo (l...
[{"input": "10\n+\n- 3\n+\n+\n+\n+\n- 1\n- 7\n- 9\n- 10\n+\n+\n+\n- 4\n- 5\n- 8\n+\n- 6\n+\n- 2\n", "output": "YES\n3 10 9 7 1 8 5 4 6 2 "}, {"input": "10\n+\n- 1\n+\n+\n+\n+\n- 1\n- 7\n- 9\n- 10\n+\n+\n+\n- 7\n- 10\n- 8\n+\n+\n- 6\n- 2\n", "output": "NO\n"}, {"input": "10\n+\n- 3\n+\n+\n+\n+\n- 1\n- 7\n- 9\n- 10\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\nYou are given an array of positive integers. While there are at least two equal elements, we will perform the...
[{"input": "34\n967614464 967614464 1000000000 1000000000 1000000000 1000000000 1000000000 1010000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000000...
code_stdio
[ { "content": "You are an expert Python programmer. 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 playing euchre and you want to know the new score after finishing a hand. There are two teams and eac...
[{"input": "[4, 0]\n1\nfalse\n[2, 2, 2, 2, 2]", "output": "[[4, 2]]", "fn_name": "update_score"}, {"input": "[4, 4]\n2\nfalse\n[2, 2, 2, 2, 2]", "output": "[[4, 6]]", "fn_name": "update_score"}, {"input": "[4, 6]\n2\ntrue\n[2, 2, 2, 2, 2]", "output": "[[4, 10]]", "fn_name": "update_score"}, {"input": "[7, 2]\n1\nfalse\...
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 students and M checkpoints on the xy-plane.\n\nThe coordinates of the i-th student (1 \\leq i \\l...
[{"input": "50 50\n-87868672 9773500\n38180447 36636308\n-93470873 38029088\n49678522 -87311634\n62792334 -82584220\n50941177 2445768\n-21746015 -16856077\n-69539173 -40150977\n-82915111 -60619217\n-42155179 93071641\n-3205477 16657057\n26789545 -1410866\n-32360553 -38239433\n-69707837 59109468\n-8767620 51549299\n-195...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N.\nYou can perform the following operation ...
[{"input": "9\n1 4 1 2 3 10 2 12 14", "output": "1\n"}, {"input": "9\n1 4 0 2 3 10 2 12 14", "output": "1\n"}, {"input": "9\n1 1 0 2 3 10 2 12 14", "output": "1\n"}, {"input": "9\n1 1 1 2 3 10 2 12 14", "output": "1\n"}, {"input": "9\n1 4 1 2 3 10 2 6 10", "output": "1\n"}, {"input": "9\n1 4 1 2 3 10 2 6 14", "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\nAtCoDeer the deer has found two positive integers, a and b.\nDetermine whether the concatenation of a and b i...
[{"input": "100 100\n", "output": "No\n"}, {"input": "000 001", "output": "Yes\n"}, {"input": "010 000", "output": "Yes\n"}, {"input": "000 000", "output": "Yes\n"}, {"input": "000 100", "output": "Yes\n"}, {"input": "110 100", "output": "No\n"}, {"input": "101 100", "output": "No\n"}, {"input": "101 101", "output": "N...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn a strategic computer game \"Settlers II\" one has to build defense structures to expand and protect the te...
[{"input": "100 100\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100...
code_stdio
[ { "content": "You are an expert Python programmer. 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 all know that GukiZ often plays with arrays. \n\nNow he is thinking about this problem: how many arrays a,...
[{"input": "1000000000000000000 1000000000000000000 64 1000000007\n", "output": "818137911\n"}, {"input": "1000000000000000000 1000000000000000100 64 1000000007\n", "output": "705677915\n"}, {"input": "85689952135646564 456465135103154 61 554556465\n", "output": "526174733\n"}, {"input": "94056881908542814 456465135103...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nRecently, Duff has been practicing weight lifting. As a hard practice, Malek gave her a task. He gave her a s...
[{"input": "100\n196 1681 196 0 61 93 196 196 196 196 196 0 0 96 18 1576 0 93 666463 18 93 1 1278 8939 93 196 196 1278 3 0 67416 869956 10 56489 196 745 39 783 196 8939 196 81 69634 4552 39 3 14 20 25 8 10 4 7302 0 19579 20 1140 15990 7302 0 19579 4142 11 1354 75252 93 311 1278 0 79475 10 75252 93 7302 0 81 408441 1957...
code_stdio
[ { "content": "You are an expert Python programmer. 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 was an electronic store heist last night.\n\nAll keyboards which were in the store yesterday were numbe...
[{"input": "40\n194 121 110 134 172 142 195 135 186 187 128 161 185 132 117 175 178 131 143 151 170 181 188 140 133 145 119 129 179 149 109 123 124 106 100 199 197 155 141 183\n", "output": "60\n"}, {"input": "40\n194 121 110 134 172 142 195 135 186 187 128 161 185 132 117 175 178 131 143 151 170 181 188 140 133 145 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\nOnce Bob took a paper stripe of n squares (the height of the stripe is 1 square). In each square he wrote an ...
[{"input": "100\n3 0 -5 2 -3 -1 -1 0 -2 -5 -4 2 1 2 -2 -1 -1 -4 3 -1 -3 -1 5 0 -4 -4 -1 0 -2 -2 0 1 -1 -2 -1 -5 -4 -2 3 1 -3 0 -1 1 0 -1 2 0 -2 -1 -3 1 -2 2 3 2 -3 -5 2 2 -2 -2 1 2 -2 -1 3 0 -4 7 -2 2 1 4 -9 -1 -2 -1 0 -1 0 -2 -2 -1 1 1 -4 2 -3 -3 7 1 1 -3 -7 0 -2 0 5 -2\n", "output": "5\n"}, {"input": "100\n3 0 -5 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\nFor this problem you must create a program that says who ate the last cookie. If the input is a string then \...
[{"input": "1.98528462", "output": "[\"Who ate the last cookie? It was Monica!\"]", "fn_name": "cookie"}, {"input": "false", "output": "[\"Who ate the last cookie? It was the dog!\"]", "fn_name": "cookie"}, {"input": "true", "output": "[\"Who ate the last cookie? It was the dog!\"]", "fn_name": "cookie"}, {"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\nLet x be an array of integers x = [x_1, x_2, ..., x_n]. Let's define B(x) as a minimal size of a partition of...
[{"input": "5\n1 1 1 1 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "530612279\n"}, {"input": "10\n10 1 9 3 9 4 10 3 8 5\n10 1 10 14 12 4 10 4 10 7\n", "output": "875000103\n"}, {"input": "10\n10 1 9 3 9 4 10 3 8 5\n10 2 10 14 12 4 10 4 10 7\n", "output": "875000103\n"}, {"input": "10\n10 1 9...
code_stdio
[ { "content": "You are an expert Python programmer. 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 going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called hea...
[{"input": "5 2 1\n900000000\n900000000\n1000000000\n1000000000\n1000000000\n", "output": "800000000\n"}, {"input": "5 2 1\n105611412\n1737860309\n1010000000\n1000000101\n1100000000", "output": "969572082\n"}, {"input": "5 3 1\n105611412\n1151487296\n1010000000\n1000000101\n1100000000", "output": "710247900\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\nIlya is an experienced player in tic-tac-toe on the 4 × 4 field. He always starts and plays with Xs. He playe...
[{"input": "xx..\n.oo.\nx...\noox.\n", "output": "YES\n"}, {"input": "x..x\n..oo\no...\nx.xo\n", "output": "YES\n"}, {"input": ".xox\no.x.\nx.o.\n..o.\n", "output": "YES\n"}, {"input": "o.oo\n.x.o\nx.x.\n.x..\n", "output": "YES\n"}, {"input": ".xx.\n.xoo\n.oox\n....\n", "output": "YES\n"}, {"input": "xxox\no.x.\nx.oo\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\nSehr Sus is an infinite hexagonal grid as pictured below, controlled by MennaFadali, ZerooCool and Hosssam.\n...
[{"input": "10\n45996\n1494\n17871\n87082\n59317\n76537\n37514\n56796\n60195\n80410\n", "output": "263\n48\n164\n362\n299\n339\n238\n292\n301\n348\n"}, {"input": "5\n66\n6666\n666666\n66666666\n666666666\n", "output": "10\n100\n1000\n10000\n31623\n"}, {"input": "3\n390\n398\n285\n", "output": "25\n25\n21\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\nProblem\n\nKND is a student programmer at the University of Aizu. His neighbor is known to be very annoying. ...
[{"input": "3 3 100\n2\n5 20 3 10\n2\n13 50 16 60\n2\n8 30 22 100\n0 1 2\n\n1 1 30\n1\n13 16\n0", "output": "27 100\n13 16\n"}, {"input": "3 3 100\n2\n5 20 3 10\n2\n13 60 16 60\n2\n8 30 22 100\n0 1 2\n\n1 1 30\n1\n13 17\n0", "output": "27 100\n13 17\n"}, {"input": "3 3 100\n2\n5 20 3 10\n2\n13 60 16 41\n2\n8 30 22 100\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\nHowever, if the result exceeds 10^{18},...
[{"input": "31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n", "output": "0\n"}, {"input": "31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 0 2 7 9 5 0", "output": "0\n"}, {"input": "31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0", "output": "0"}, {"input": "2\n1000000000 100...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are n workers in a company, each of them has a unique id from 1 to n. Exaclty one of them is a chief, h...
[{"input": "10 10\n3 0 0 0 0 0 1 1 1 0\n", "output": "5\n"}, {"input": "10 10\n3 0 0 0 0 0 1 0 1 0\n", "output": "6\n"}, {"input": "10 10\n3 0 0 0 0 1 1 0 1 0\n", "output": "5\n"}, {"input": "10 10\n3 0 0 0 1 1 1 0 1 0\n", "output": "4\n"}, {"input": "10 10\n3 0 0 0 0 2 1 0 1 0\n", "output": "5\n"}, {"input": "10 6\n3 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nOnce upon a time, Oolimry saw a suffix array. He wondered how many strings can produce this suffix array.\n\n...
[{"input": "73 95\n4 53 37 9 45 54 16 34 12 10 13 24 2 36 33 48 50 43 15 11 47 42 46 30 27 52 67 72 66 19 56 61 69 21 68 1 70 49 64 62 3 51 44 65 29 25 38 28 8 5 39 59 17 6 26 20 63 7 41 23 22 32 40 14 57 60 55 31 35 58 18 0 71\n", "output": "423380456"}, {"input": "73 95\n4 53 37 9 45 54 16 34 12 10 13 24 2 36 33 48 5...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWe have N squares assigned the numbers 1,2,3,\\ldots,N. Each square has an integer written on it, and the int...
[{"input": "15\n1 10 145 15 87 138 51 194 1 18 77 20 9 17 93", "output": "8\n"}, {"input": "15\n15 11 46 15 50 98 93 129 31 43 44 11 6 24 14", "output": "3\n"}, {"input": "15\n15 11 46 15 50 98 93 129 41 43 44 11 6 24 14", "output": "3\n"}, {"input": "15\n15 11 46 15 50 98 93 87 31 43 44 11 10 24 14", "output": "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\nThere are N integers, A_1, A_2, ..., A_N, written on the blackboard.\nYou will choose one of them and replace...
[{"input": "3206\n2048 536870912 536870912 268435456 2097152 8192 128 16 16777216 4096 4096 16777216 32 131072 67108864 16777216 256 8388608 1048576 8 2048 8388608 4 16777216 33554432 8 512 16777216 8 33554432 65536 8192 64 64 4 16777216 524288 16 8192 16777216 67108864 536870912 268435456 536870912 4096 33554432 26214...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nFirecrackers scare Nian the monster, but they're wayyyyy too noisy! Maybe fireworks make a nice complement.\n...
[{"input": "3\n-10 4 10\n10 4 10\n0 -7 10\n", "output": "7\n"}, {"input": "3\n-10 4 10\n10 4 10\n0 -7 10\n", "output": "7\n"}, {"input": "3\n-3 -2 3\n-4 -12 3\n-6 -4 9\n", "output": "5\n"}, {"input": "3\n1 -7 10\n-7 9 10\n-2 -1 4\n", "output": "8\n"}, {"input": "3\n-3 -2 3\n-4 -6 3\n-6 -4 9\n", "output": "5\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\nDima the hamster enjoys nibbling different things: cages, sticks, bad problemsetters and even trees!\n\nRecen...
[{"input": "36\n3 41 82 123 174 216 432 864 1080 1228 2149 4298 8596 11052 22104 33156 35919 71838 179595 359190 431028 862056 994680 1315440 1753920 3507840 7015680 10523520 21047040 26500200 53000400 106000800 132501000 176668000 353336000 530004000\n", "output": "Yes\n"}, {"input": "36\n3 41 82 123 174 216 432 864 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-----Problem Statement-----\nWrite a program that accepts a number, n, and outputs the same.\n\n-----Input---...
[{"input": "1047", "output": "1047\n"}, {"input": "1652", "output": "1652\n"}, {"input": "3133", "output": "3133\n"}, {"input": "1313", "output": "1313\n"}, {"input": "1107", "output": "1107\n"}, {"input": "2085", "output": "2085\n"}, {"input": "2863", "output": "2863\n"}, {"input": "-160", "output": "-160\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\nVasya has n pairs of socks. In the morning of each day Vasya has to put on a pair of socks before he goes to ...
[{"input": "100 100\n", "output": "101\n"}, {"input": "100 100\n", "output": "101\n"}, {"input": "99 100\n", "output": "99\n"}, {"input": "100 3\n", "output": "149\n"}, {"input": "100 2\n", "output": "199\n"}, {"input": "99 10\n", "output": "109\n"}, {"input": "100 5\n", "output": "124\n"}, {"input": "95 16\n", "output...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given two arrays $a$ and $b$, both of length $n$. All elements of both arrays are from $0$ to $n-1$.\...
[{"input": "10\n6 3 0 5 4 5 5 5 8 5\n3 8 2 9 5 4 1 0 3 6\n", "output": "0 1 0 0 0 4 6 7 1 8 \n"}, {"input": "10\n6 3 0 5 4 5 5 5 8 5\n3 8 2 9 5 4 1 0 3 6\n", "output": "0 1 0 0 0 4 6 7 1 8 "}, {"input": "10\n6 3 0 5 4 5 5 4 8 5\n3 8 2 9 5 4 1 0 3 6\n", "output": "0 1 0 0 0 4 6 6 1 8\n"}, {"input": "10\n6 3 0 5 6 5 5 5 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nInitially Ildar has an empty array. He performs $n$ steps. On each step he takes a subset of integers already...
[{"input": "3\n0 1 1000000000\n", "output": "3\n"}, {"input": "3\n1 1 1000000000\n", "output": "1\n"}, {"input": "3\n1 0 1000000000\n", "output": "1\n"}, {"input": "3\n1 0 0000000000\n", "output": "1\n"}, {"input": "3\n1 0 0000001000\n", "output": "1\n"}, {"input": "3\n0 0 0000001000\n", "output": "3\n"}, {"input": "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\nTwo countries, Country A and Country B, are at war. As a soldier in Country A, you will lead n soldiers to oc...
[{"input": "10\n10\n10\n14\n10\n10\n10\n10\n10\n10\n10", "output": "97\n"}, {"input": "10\n6\n10\n14\n10\n10\n10\n10\n10\n10\n20", "output": "103\n"}, {"input": "10\n6\n10\n14\n10\n10\n10\n10\n10\n18\n20", "output": "111\n"}, {"input": "10\n6\n10\n14\n10\n10\n10\n10\n10\n11\n20", "output": "104\n"}, {"input": "10\n6\n1...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are fed up with your messy room, so you decided to clean it up.\n\nYour room is a bracket sequence s=s_{1...
[{"input": "4\n8 2\n)())(()(\n10 4\n))()()()((\n2 1\n)(\n2 1\n)(\n", "output": "4\n1 2\n3 5\n4 6\n5 8\n5\n1 3\n3 5\n5 7\n7 9\n8 10\n1\n1 2\n1\n1 2\n"}, {"input": "4\n8 2\n)())(()(\n10 5\n)))(()()((\n2 1\n)(\n2 1\n)(\n", "output": "4\n1 2\n3 5\n4 6\n5 8\n5\n1 4\n3 5\n5 7\n7 9\n9 10\n1\n1 2\n1\n1 2\n"}, {"input": "4\n8 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\nGiven are a positive integer N and a string S of length N consisting of lowercase English letters.\nDetermine...
[{"input": "100\ntttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt\n", "output": "Yes\n"}, {"input": "100\nyyxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\n", "output": "No\n"}, {"input": "99\nbbbbbbbbbbbbbbbbbbbbbbb...
code_stdio
[ { "content": "You are an expert Python programmer. 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 task you need to process a set of stock exchange orders and use them to create order book.\n\nAn orde...
[{"input": "3 3\nB 16671 5044\nS 23924 4895\nS 76276 1905\n", "output": "S 76276 1905\nS 23924 4895\nB 16671 5044\n"}, {"input": "3 3\nB 16671 5006\nS 23924 4895\nS 76276 1905\n", "output": "S 76276 1905\nS 23924 4895\nB 16671 5006\n"}, {"input": "3 3\nB 16671 5006\nS 23924 4895\nS 76276 3800\n", "output": "S 76276 380...
code_stdio
[ { "content": "You are an expert Python programmer. 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 grid with (2^N - 1) rows and (2^M-1) columns. You are asked to write 0 or 1 in each of these square...
[{"input": "9 7", "output": "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n1010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101\n111111111111111111111111111111111...
code_stdio
[ { "content": "You are an expert Python programmer. 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 C Medical Checkup\n\nStudents of the university have to go for a medical checkup, consisting of lots ...
[{"input": "3 102\n1\n3\n0", "output": "103\n34\n34\n"}, {"input": "3 35\n1\n3\n3", "output": "36\n12\n11\n"}, {"input": "3 55\n1\n3\n4", "output": "56\n19\n13\n"}, {"input": "3 55\n1\n3\n0", "output": "56\n19\n19\n"}, {"input": "3 55\n1\n4\n0", "output": "56\n14\n14\n"}, {"input": "3 55\n2\n4\n0", "output": "28\n14\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\nC: Divisor Game\n\nproblem\n\ntsutaj is trying to play about a few games.\n\nIn a divisor game, a natural num...
[{"input": "1008", "output": "3 29\n"}, {"input": "3690", "output": "4 23\n"}, {"input": "5184", "output": "2 34\n"}, {"input": "120", "output": "3 15\n"}, {"input": "324", "output": "2 14\n"}, {"input": "330", "output": "4 15\n"}, {"input": "560", "output": "3 19\n"}, {"input": "180", "output": "3 17\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\nВ самолёте есть n рядов мест. Если смотреть на ряды сверху, то в каждом ряду есть 3 места слева, затем проход...
[{"input": "30 1\nPPP-PPP.-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWhen Petya went to school, he got interested in large numbers and what they were called in ancient times. For...
[{"input": "2147483647\n2147483647\n", "output": "YES\n0\n"}, {"input": "2147483646\n2147483647\n", "output": "NO\n"}, {"input": "1094841453\n1656354409\n", "output": "NO\n"}, {"input": "2147483647\n2147483646\n", "output": "NO\n"}, {"input": "1470193122\n1420950405\n", "output": "NO\n"}, {"input": "1470193122\n1180021...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAndrewid the Android is a galaxy-famous detective. He is now chasing a criminal hiding on the planet Oxa-5, t...
[{"input": "20 10\n4 9\n10 15\n17 18\n20 21\n11 27\n13 32\n35 40\n46 48\n49 51\n53 56\n59 60\n63 111\n130 68\n69 70\n74 50\n79 80\n89 82\n84 87\n88 91\n98 001\n4 7 6 1 5 4 3 1 8 2\n", "output": "No\n"}, {"input": "20 10\n4 9\n10 15\n17 18\n20 21\n25 27\n13 32\n35 40\n46 48\n49 51\n53 56\n59 60\n63 64\n130 68\n69 70\n74...
code_stdio
[ { "content": "You are an expert Python programmer. 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 studying in the last class of school and soon he will take exams. He decided to study polynomials. P...
[{"input": "1000000000000000000 1000000000000000000 1000000000000000000\n", "output": "2\n"}, {"input": "1000000000000000000 1000000000000000000 1000000000000000000\n", "output": "2\n"}, {"input": "1001000000000000000 1000000000000000000 1000000000000000000\n", "output": "1\n"}, {"input": "1001000000000000000 100000000...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given an array $a_{1}, a_{2}, \\ldots, a_{n}$. You can remove at most one subsegment from it. The rem...
[{"input": "87\n65 97 97 99 57 78 92 55 68 89 63 94 71 54 74 63 94 60 97 75 96 82 87 90 62 72 83 100 76 67 95 69 61 53 55 79 73 99 77 85 79 84 51 58 66 96 97 89 69 84 87 72 53 67 90 63 92 65 73 57 82 69 96 77 73 53 85 96 84 86 61 54 84 52 52 68 100 94 80 60 61 83 89 91 74 92 55\n", "output": "72\n"}, {"input": "87\n65 ...
code_stdio
[ { "content": "You are an expert Python programmer. 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\nKa ka ka cypher is a cypher used by small children in some country. When a girl wants to p...
[{"input": "\"Incomprehensibilities\"", "output": "[\"kaIkancokamprekahekansikabikalikatiekas\"]", "fn_name": "ka_co_ka_de_ka_me"}, {"input": "\"maintenance\"", "output": "[\"kamaikantekanakance\"]", "fn_name": "ka_co_ka_de_ka_me"}, {"input": "\"Woodie\"", "output": "[\"kaWookadie\"]", "fn_name": "ka_co_ka_de_ka_me"}, ...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThis function should test if the `factor` is a factor of `base`.\n\nReturn `true` if it is a factor or `false...
[{"input": "24617\n3", "output": "[false]", "fn_name": "check_for_factor"}, {"input": "24612\n3", "output": "[true]", "fn_name": "check_for_factor"}, {"input": "2453\n5", "output": "[false]", "fn_name": "check_for_factor"}, {"input": "2450\n5", "output": "[true]", "fn_name": "check_for_factor"}, {"input": "653\n7", "ou...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nShaass has decided to hunt some birds. There are n horizontal electricity wires aligned parallel to each othe...
[{"input": "100\n54 15 25 18 64 62 23 59 70 137 50 26 87 35 75 86 0 22 6 60 70 41 21 9 75 50 25 3 69 14 39 68 64 46 59 99 2 0 21 76 90 12 61 42 12 91 36 39 47 41 93 81 66 57 70 36 68 89 52 1 19 93 67 22 76 20 8 81 123 18 100 73 61 93 75 80 53 72 40 20 2 86 33 70 27 16 11 26 55 44 47 55 94 58 2 55 82 22 9 95\n0\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\nGiven are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number...
[{"input": "sjpvbzildfxlaukqtfznjjyryrdawsycubdpieejlzsexyhuajiqqigetwdyjeignkuuedzguvqhyrubpdfsenayqahbaqnyhavlaptlqtrotfzvbqbtpkuddnopjzoteuubxgkthzdyepesqgozkdvkcakraxeulhhqtnpolbtcsgxgskjjzdimcyhclnnwfbxwmznpvjaqjqqogwgwmzzpcvhywpcocmsxxmgsodckxvipzobspvwjezxugjlivdhefgdfkzzidktxjcnayjubmsqmpuaaidduwpmhkewaqtkvsudo...
code_stdio
[ { "content": "You are an expert Python programmer. 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 side length `n`, traveling only right and down how many ways are there to get from the top left corne...
[{"input": "165", "output": "[95995892383488599901870820732368671856306475542669347911637204757217297906428740013991568571288240]", "fn_name": "routes"}, {"input": "156", "output": "[376594020312425061595746241557406711201605603899894320577733841460621358204120168599683135056]", "fn_name": "routes"}, {"input": "126", "...
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 decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival h...
[{"input": "10\n877105545 939360757 849826701 845946140 803128820 926787996 967305000 1743698496 717018470 971203310\n", "output": "181734622\n"}, {"input": "10\n877105545 939360757 849826701 845946140 803128820 926787996 967305000 904694971 921301848 971203310\n", "output": "861364152\n"}, {"input": "10\n877105545 939...
code_stdio
[ { "content": "You are an expert Python programmer. 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 assume that \n\n * v(n) is the largest prime number, that does not exceed n;\n * u(n) is the smallest...
[{"input": "6\n999\n1095\n821\n635\n63\n480\n", "output": "1003961/2011946\n1196833/2398042\n674039/1351366\n403199/808942\n3959/8174\n232303/466546\n"}, {"input": "6\n999\n588\n821\n635\n63\n480\n", "output": "1003961/2011946\n346909/696182\n674039/1351366\n403199/808942\n3959/8174\n232303/466546\n"}, {"input": "6\n88...
code_stdio
[ { "content": "You are an expert Python programmer. 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 cities numbered 1 to N, connected by M railroads.\nYou are now at City 1, with 10^{100} gold coin...
[{"input": "50 98 49\n12 13 38 966876944\n35 47 5 419053521\n20 23 39 513566946\n43 45 31 973756616\n11 39 45 339701654\n8 12 34 119183522\n5 16 50 644322683\n37 44 42 476275226\n3 4 41 832102486\n29 45 1 974869661\n6 21 32 929876961\n23 33 18 660381903\n12 19 26 747314758\n9 45 22 109205766\n43 50 9 353453224\n18 23 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\nCaracal is fighting with a monster.\nThe health of the monster is H.\nCaracal can attack by choosing one mons...
[{"input": "1000000000000\n", "output": "1099511627775\n"}, {"input": "999999999999\n", "output": "1099511627775\n"}, {"input": "549755813888\n", "output": "1099511627775\n"}, {"input": "707813884927\n", "output": "1099511627775\n"}, {"input": "913056879650\n", "output": "1099511627775\n"}, {"input": "1010000000000", "...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nRead problems statements in Mandarin Chinese, Russian and Vietnamese as well. \n\nEugene loves sequences, esp...
[{"input": "2\n-3 3 -2 -2\n2 2 126 3", "output": "6\n-609\n"}, {"input": "2\n-3 3 -2 -2\n2 2 126 0", "output": "6\n-621\n"}, {"input": "2\n-1 6 -2 -2\n2 2 92 -1", "output": "8\n-461\n"}, {"input": "2\n-2 6 -2 -2\n2 2 92 -1", "output": "7\n-461\n"}, {"input": "2\n-2 6 0 -2\n2 2 92 -1", "output": "-4\n-461\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\nPolycarpus has a ribbon, its length is n. He wants to cut the ribbon in a way that fulfils the following two ...
[{"input": "3043 317 1141 2438\n", "output": "7\n"}, {"input": "3399 2035 2 3334\n", "output": "683\n"}, {"input": "4000 500 1000 2000\n", "output": "8\n"}, {"input": "4000 500 1000 1671\n", "output": "8\n"}, {"input": "918 102 1327 1733\n", "output": "9\n"}, {"input": "595 2263 3625 1\n", "output": "595\n"}, {"input":...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given integers N,\\ A and B. Determine if there exists a permutation (P_0,\\ P_1,\\ ...\\ P_{2^N-1}) ...
[{"input": "2 1 0", "output": "YES\n1 3 2 0\n"}, {"input": "2 2 0", "output": "YES\n2 3 1 0\n"}, {"input": "2 3 2", "output": "YES\n3 1 0 2\n"}, {"input": "2 0 2", "output": "YES\n0 1 3 2\n"}, {"input": "2 2 3", "output": "YES\n2 0 1 3\n"}, {"input": "2 3 1", "output": "YES\n3 2 0 1\n"}, {"input": "2 0 1", "output": "Y...
code_stdio
[ { "content": "You are an expert Python programmer. 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 board with a 2 \\times N grid.\nSnuke covered the board with N dominoes without overlaps.\nHere, a ...
[{"input": "52\nRvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn\nRLLwwdWIxxNNQUUXXVVMMooBBaggDKqcimmeYrhAljOOTTJuuzzn\n", "output": "958681902\n"}, {"input": "52\nLLJngjjWwrKFFqcXNNYYaaGiimDtlsuuCTTyppVkkfobOOvxxAAU\nIIJnghhWwrKRRqcXZZQQddGMMmDtlsPPCeeyzzVSSfobHHvBBEEU\n", "output": "358954489\n"}, {"input": "52\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn the year of 30XX participants of some world programming championship live in a single large hotel. The hot...
[{"input": "10 10 1 8 4\n10\n2 3 4 5 6 7 8 9\n10\n1 1 3 1\n2 1 7 1\n1 1 9 1\n7 1 4 1\n10 1 7 1\n2 1 7 1\n3 1 2 1\n5 1 2 1\n10 1 5 1\n6 1 9 1\n", "output": "3\n4\n4\n3\n3\n4\n3\n3\n4\n3\n"}, {"input": "10 18 1 8 4\n10\n2 3 4 5 6 7 8 9\n10\n1 1 3 1\n2 1 7 1\n1 1 9 1\n7 1 4 1\n10 1 7 1\n2 1 7 1\n3 1 2 1\n5 1 2 1\n10 1 5 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\nproblem\n\nChairman K is a regular customer of the JOI pizza shop in the center of JOI city. For some reason,...
[{"input": "3\n16 2\n358\n87\n1601\n010", "output": "108\n"}, {"input": "3\n16 2\n696\n77\n1150\n010", "output": "102\n"}, {"input": "3\n12 2\n200\n87\n1514\n010", "output": "122\n"}, {"input": "3\n12 2\n491\n77\n1150\n010", "output": "117\n"}, {"input": "3\n12 2\n200\n87\n1149\n010", "output": "96\n"}, {"input": "3\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\nPolycarp had an array $a$ of $3$ positive integers. He wrote out the sums of all non-empty subsequences of th...
[{"input": "5\n1 3 4 4 5 7 8\n1 2 3 4 5 6 7\n300000000 300000000 300000000 600000000 600000000 600000000 900000000\n1 1 2 999999998 999999999 999999999 1000000000\n1 2 2 3 3 4 5\n", "output": "1 3 4\n1 2 4\n300000000 300000000 300000000\n1 1 999999998\n1 2 2\n"}, {"input": "5\n1 3 4 4 5 7 8\n1 2 3 4 5 6 7\n300000000 30...
code_stdio
[ { "content": "You are an expert Python programmer. 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, two players, Alice and Bob, are playing a palindrome game. Alice starts with `string1`, Bob sta...
[{"input": "\"qtkxttl\"\n\"utvohqk\"", "output": "[2]", "fn_name": "solve"}, {"input": "\"mctimp\"\n\"eyqbnh\"", "output": "[1]", "fn_name": "solve"}, {"input": "\"btzgd\"\n\"svjyb\"", "output": "[2]", "fn_name": "solve"}, {"input": "\"eyfjy\"\n\"ooigv\"", "output": "[1]", "fn_name": "solve"}, {"input": "\"abc\"\n\"xyz...
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 an array $a_1, a_2, \\dots, a_n$ consisting of $n$ distinct integers. You are allowed to perform the...
[{"input": "57\n241 444 553 126 612 550 441 420 742 879 520 664 590 198 910 731 308 740 791 680 904 629 324 606 621 75 350 253 57 164 440 970 876 648 581 258 989 851 186 117 700 537 837 284 654 130 728 955 859 988 820 345 901 294 244 125 512\n", "output": "48"}, {"input": "10\n239529 302993 398153 204081 370085 184103 ...
code_stdio
[ { "content": "You are an expert Python programmer. 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: Isono, let's do that! --Sendame -\n\nstory\n\nNakajima \"Isono ~, let's do that!\"\n\nIsono \"What is that...
[{"input": "3\ntameru\ntameru\nuremat\ntameru\nkougekida\ntameru", "output": "Nakajima-kun\n"}, {"input": "3\ntameru\ntameru\nuremat\ntameru\nadikeguok\ntameru", "output": "Hikiwake-kun\n"}, {"input": "3\ntameru\ntameru\nuremat\ntameru\nadikeguok\ntamdru", "output": "Hikiwake-kun\n"}, {"input": "3\ntameru\nuremat\nurem...
code_stdio
[ { "content": "You are an expert Python programmer. 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 is going to participate in the contest. It starts at $h_1:m_1$ and ends at $h_2:m_2$. It is guarante...
[{"input": "10:00\n11:00\n", "output": "10:30\n"}, {"input": "11:10\n11:12\n", "output": "11:11\n"}, {"input": "01:02\n03:02\n", "output": "02:02\n"}, {"input": "00:00\n23:58\n", "output": "11:59\n"}, {"input": "00:01\n23:59\n", "output": "12:00\n"}, {"input": "00:00\n00:02\n", "output": "00:01\n"}, {"input": "23:57\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 three friend living on the straight line Ox in Lineland. The first friend lives at the point x_1, t...
[{"input": "131 21 80\n", "output": "110\n"}, {"input": "138 23 56\n", "output": "115\n"}, {"input": "149 93 35\n", "output": "114\n"}, {"input": "29 97 147\n", "output": "118\n"}, {"input": "149 93 25\n", "output": "124\n"}, {"input": "235 31 80\n", "output": "204\n"}, {"input": "131 31 80\n", "output": "100\n"}, {"in...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere is a right triangle with legs of length a and b. Your task is to determine whether it is possible to lo...
[{"input": "1000 1000\n", "output": "YES\n0 0\n280 960\n-960 280"}, {"input": "545 175\n", "output": "YES\n0 0\n327 436\n-140 105\n"}, {"input": "385 850\n", "output": "YES\n0 0\n231 308\n-680 510\n"}, {"input": "280 210\n", "output": "YES\n0 0\n168 224\n-168 126"}, {"input": "408 765\n", "output": "YES\n0 0\n360 192\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are n problems prepared for the next Codeforces round. They are arranged in ascending order by their di...
[{"input": "100000 10\n99562 484\n1099 99684\n593 99867\n99529 175\n99738 616\n99523 766\n99503 121\n99784 158\n199 99199\n15 99849\n", "output": "98100\n"}, {"input": "100000 10\n99562 484\n1099 99684\n593 99867\n99529 175\n99738 616\n99523 766\n42925 121\n99784 158\n199 99199\n15 99849\n", "output": "41826\n"}, {"inp...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nRecently a serious bug has been found in the FOS code. The head of the F company wants to find the culprit an...
[{"input": "10 3\n6 3\n6 10\n2 5\n5 7\n6 2\n9 2\n8 1\n10 5\n5 10\n7 6\n", "output": "34\n"}, {"input": "10 2\n10 2\n9 3\n9 4\n7 2\n4 6\n10 1\n9 2\n3 10\n7 1\n5 1\n", "output": "43\n"}, {"input": "10 3\n6 3\n6 10\n2 5\n5 7\n6 2\n9 2\n8 1\n10 5\n5 10\n7 3\n", "output": "37\n"}, {"input": "10 3\n6 3\n6 10\n2 5\n2 7\n6 2\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTakahashi has N days of summer vacation.\nHis teacher gave him M summer assignments. It will take A_i days fo...
[{"input": "1000000 10000\n10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 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 grid with H horizontal rows and W vertical columns. Let (i, j) denote the square at the i-th row f...
[{"input": "100000 100000 1\n50000 23836", "output": "920202332\n"}, {"input": "100000 100000 1\n50000 25003", "output": "717307015\n"}, {"input": "100000 100000 1\n50000 29731", "output": "587968146\n"}, {"input": "100000 100000 1\n84868 25003", "output": "677865158\n"}, {"input": "100000 100000 0\n50000 29731", "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\n— This is not playing but duty as allies of justice, Nii-chan!\n\n— Not allies but justice itself, Onii-chan!...
[{"input": "5000 5000 5000\n", "output": "986778560\n"}, {"input": "1171 2989 2853\n", "output": "234725427\n"}, {"input": "3238 2923 4661\n", "output": "636587126\n"}, {"input": "4539 2805 2702\n", "output": "356944655\n"}, {"input": "4998 4998 4998\n", "output": "259368717\n"}, {"input": "2048 4096 1024\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\nStepan likes to repeat vowel letters when he writes words. For example, instead of the word \"pobeda\" he can...
[{"input": "200\nmmffggzvuuzzlkafduueqocuybiiaaeeoiioouaaurccuqoouuooooooyjjtyyxxiipnoeufyuuoyxxhhkaaeoooxapauuoppzabuuoiiuuggcciissuugejjiirruummsiifaauyypauwoofiemzaeeeeeeiioozzttyyidaaaiggizzerkooooeeepueeauupathhb\n", "output": "mmffggzvuzzlkafdueqocuybiaeeoioouaurccuqoouoyjjtyxxipnoeufyuoyxxhhkaeoxapauoppzabuoiugg...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n500-yen Saving\n\n\"500-yen Saving\" is one of Japanese famous methods to save money. The method is quite sim...
[{"input": "4\n800\n700\n1600\n600\n4\n300\n1205\n1600\n30\n4\n300\n700\n1600\n650\n3\n1001\n2000\n638\n3\n250\n250\n1000\n4\n1251\n1466\n698\n299\n0", "output": "2 2900\n4 3135\n3 3250\n2 1639\n3 1500\n4 3714\n"}, {"input": "4\n800\n700\n1600\n600\n4\n300\n1205\n1600\n30\n4\n300\n700\n1600\n650\n3\n1001\n2000\n638\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\nHolidays have finished. Thanks to the help of the hacker Leha, Noora managed to enter the university of her d...
[{"input": "12 1000000000\n", "output": "479001600\n"}, {"input": "1000000000 12\n", "output": "479001600\n"}, {"input": "1000000000 12\n", "output": "479001600\n"}, {"input": "12 1000000000\n", "output": "479001600\n"}, {"input": "1000000100 12\n", "output": "479001600\n"}, {"input": "12 1000100000\n", "output": "4790...
code_stdio
[ { "content": "You are an expert Python programmer. 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 infinite board of square tiles. Initially all tiles are white.\n\nVova has a red marker and a blu...
[{"input": "99999999999973 99999999999971\n", "output": "199999999999948\n"}, {"input": "99999999999962 99999999999973\n", "output": "133333333333296\n"}, {"input": "99999999999973 99999999999930\n", "output": "399999999999808\n"}, {"input": "49999819999926 50000000000155\n", "output": "199999640000164\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\nCQXYM is counting permutations length of $2n$.\n\nA permutation is an array consisting of $n$ distinct intege...
[{"input": "20\n597\n2791\n71\n1\n6\n14\n196\n1\n4335\n14\n5133\n6\n17\n3620\n5111\n1\n119\n992\n76848\n127\n", "output": "924058387\n309126958\n25034588\n1\n239500800\n517878947\n323758520\n1\n41675960\n517878947\n479930293\n239500800\n971636156\n715097853\n974503605\n1\n796779807\n613317322\n14480144\n386977425\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 that takes a single array as an argument (containing multiple strings and/or positive number...
[{"input": "[[1, 23, 456, 78910], [\"abcdef\", \"ghijklmno\", \"pqrstuvwxy\"], [[1, 23, 456, 78910, [\"abcdef\", \"ghijklmno\", \"pqrstuvwxy\"]], 1234]]", "output": "[\"Decreasing\"]", "fn_name": "order_type"}, {"input": "[[\"ab\", \"cdef\", \"g\"], [\"hi\", \"jk\", \"lmnopq\"], [\"rst\", \"uv\", \"wx\"], [\"yz\"]]", "...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are a mayor of Berlyatov. There are $n$ districts and $m$ two-way roads between them. The $i$-th road con...
[{"input": "5 5 4\n1 2 5\n4 3 4\n1 4 3\n4 3 10\n3 5 2\n1 5\n1 3\n3 3\n1 5\n", "output": "13\n"}, {"input": "5 5 4\n1 2 5\n4 3 4\n1 4 3\n4 3 10\n3 5 2\n1 2\n1 3\n3 3\n1 5\n", "output": "13\n"}, {"input": "5 5 4\n1 2 5\n2 3 4\n1 4 3\n4 3 7\n3 5 2\n1 5\n1 3\n3 3\n1 5\n", "output": "13\n"}, {"input": "5 5 4\n1 2 5\n2 3 4\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSuppose $a_1, a_2, \\dots, a_n$ is a sorted integer sequence of length $n$ such that $a_1 \\leq a_2 \\leq \\d...
[{"input": "10\n2 1\n1000000000\n3 2\n-100000000 -150000003\n3 2\n-100000000 -150000004\n3 2\n-100000000 -150000001\n3 2\n-100000000 -150000002\n3 2\n-100000000 -150000000\n3 2\n-100000000 -149999999\n3 2\n-100000000 -149999999\n3 2\n-100000000 -149999998\n3 2\n-100000000 -149999997\n", "output": "Yes\nNo\nNo\nNo\nNo\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA number is called almost prime if it has exactly two distinct prime divisors. For example, numbers 6, 18, 24...
[{"input": "2998\n", "output": "1375\n"}, {"input": "2999\n", "output": "1375\n"}, {"input": "2997\n", "output": "1374\n"}, {"input": "3000\n", "output": "1375\n"}, {"input": "2990\n", "output": "1370\n"}, {"input": "2608\n", "output": "1216\n"}, {"input": "2103\n", "output": "1001\n"}, {"input": "1429\n", "output": "7...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTakahashi made N problems for competitive programming.\nThe problems are numbered 1 to N, and the difficulty ...
[{"input": "29108\n82 21 41 24 13 39 53 14 10 42 19 46 48 18 81 69 6 62 80 32 58 97 9 7 19 16 84 91 25 47 83 25 75 19 16 16 70 10 29 45 89 89 68 59 75 30 51 78 86 4 63 73 31 64 24 82 44 16 40 11 15 75 95 27 41 33 2 2 37 57 83 2 33 2 24 93 29 78 49 3 51 76 54 73 48 28 50 67 26 4 78 32 19 4 83 29 36 92 93 71 5 22 72 66 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 had a strictly increasing sequence of positive integers a_1, ..., a_{n}. Vasya used it to build a new s...
[{"input": "100\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n6\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\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 and Aoki will play a game on a tree. The tree has N vertices numbered 1 to N, and the i-th of the N...
[{"input": "7\n1 7\n3 1\n3 4\n2 5\n6 3\n2 1", "output": "Second\n"}, {"input": "7\n1 7\n7 1\n3 7\n2 5\n6 3\n4 1", "output": "Second\n"}, {"input": "7\n1 7\n4 1\n6 4\n7 5\n6 4\n2 1", "output": "Second\n"}, {"input": "7\n1 7\n5 1\n3 6\n3 5\n6 3\n2 1", "output": "Second\n"}, {"input": "7\n1 7\n3 1\n3 4\n4 5\n6 3\n2 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\nRead problems statements in Mandarin Chinese and Russian as well. \n\nJohn's barn has a fence consisting of N...
[{"input": "1\n7 -1\nRGGRGRG", "output": "6\n"}, {"input": "1\n7 -1\nRGGSGRG", "output": "4\n"}, {"input": "1\n7 -1\nGGGRRRG", "output": "2\n"}, {"input": "1\n7 -2\nGGGRRRG", "output": "2\n"}, {"input": "1\n7 -1\nGRGRGGR", "output": "5\n"}, {"input": "1\n7 -1\nGRGQGGR", "output": "3\n"}, {"input": "1\n7 -1\nQGGRGRG", "...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nDNA is a biomolecule that carries genetic information. It is composed of four different building blocks, call...
[{"input": "\"TGCTACGTACGATCGACGATCCACGAC\"\n\"GTCGTGGATCGTCGATCGTACGTAGCA\"", "output": "[true]", "fn_name": "check_DNA"}, {"input": "\"CGACATCGAGGGGGCTCAGAAGTACTGA\"\n\"CATGGCGTCAGTACTTCTGAGCC\"", "output": "[false]", "fn_name": "check_DNA"}, {"input": "\"ATGCCTACGGCCATATATATTTAG\"\n\"CTAAATATGTATGGCCGTAGGCAT\"", "ou...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nMy little sister came back home from school with the following task:\ngiven a squared sheet of paper she has ...
[{"input": "7654322", "output": "[[1, 4, 11, 69, 3912, 7654321]]", "fn_name": "decompose"}, {"input": "7654321", "output": "[[6, 10, 69, 3912, 7654320]]", "fn_name": "decompose"}, {"input": "123456", "output": "[[1, 2, 7, 29, 496, 123455]]", "fn_name": "decompose"}, {"input": "1234567", "output": "[[2, 8, 32, 1571, 123...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe Smart Beaver from ABBYY decided to have a day off. But doing nothing the whole day turned out to be too b...
[{"input": "1000000000\n", "output": "1998535156\n"}, {"input": "1000001000\n", "output": "1906011808\n"}, {"input": "1549355491\n", "output": "1559780582\n"}, {"input": "1292236879\n", "output": "1292236880\n"}, {"input": "999996270\n", "output": "1705144136\n"}, {"input": "999999999\n", "output": "1494160827\n"}, {"i...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLet's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b....
[{"input": "8 20\n0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 0\n1 0 1 0 1 0 0 0 0 1 0 1 0 1 1 0 1 1 1 1\n1 0 1 0 1 0 0 0 0 1 0 1 0 1 1 0 1 1 1 1\n0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 0\n0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 0\n1 0 1 0 1 0 0 0 0 1 0 1 0 1 1 0 1 1 1 1\n1 0 1 0 1 0 0 0 0 1 0 1 0 1 1 0 1 1 1 1\n0 0 1 1 1 1 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 are given undirected weighted graph. Find the length of the shortest cycle which starts from the vertex 1...
[{"input": "15 32\n15 9 8860\n12 4 9045\n12 12 8221\n9 6 8306\n11 14 9052\n13 14 8176\n14 5 8857\n6 8 8835\n3 9 8382\n10 14 8212\n13 13 9061\n2 14 8765\n4 13 9143\n13 13 8276\n13 11 8723\n7 10 8775\n8 15 8965\n15 5 8800\n4 5 9317\n5 13 9178\n1 7 9031\n4 10 9114\n10 4 8628\n9 1 8584\n5 7 8701\n6 15 8177\n3 3 9325\n4 5 9...
code_stdio
[ { "content": "You are an expert Python programmer. 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 function describeList which returns \"empty\" if the list is empty or \"singleton\" if it contains only...
[{"input": "[\"one\", \"two\"]", "output": "[\"longer\"]", "fn_name": "describeList"}, {"input": "[1, 2, 5, 4]", "output": "[\"longer\"]", "fn_name": "describeList"}, {"input": "[[1, 2]]", "output": "[\"singleton\"]", "fn_name": "describeList"}, {"input": "[\"one\"]", "output": "[\"singleton\"]", "fn_name": "describeLi...
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 a small but very proud high school it was decided to win ACM ICPC. This goal requires to compose as many t...
[{"input": "1000 1000 1000 1000 1000 1000\n", "output": "YES\n"}, {"input": "1000 1000 1000 1000 1000 1000\n", "output": "YES\n"}, {"input": "1000 1001 1000 1000 1000 1000\n", "output": "NO\n"}, {"input": "1000 1001 1000 0000 1000 1000\n", "output": "NO\n"}, {"input": "1000 1000 999 1000 1000 1000\n", "output": "NO\n"}...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIvan plays an old action game called Heretic. He's stuck on one of the final levels of this game, so he needs...
[{"input": "2\n3 2\n1 3 5\n4 1\n5 2 3 5\n", "output": "2\n2\n"}, {"input": "2\n3 2\n1 3 5\n4 1\n5 4 3 5\n", "output": "2\n3\n"}, {"input": "2\n3 2\n1 1 5\n4 1\n5 4 3 5\n", "output": "1\n3\n"}, {"input": "2\n3 2\n0 1 5\n4 1\n5 2 3 5\n", "output": "1\n2\n"}, {"input": "2\n3 2\n0 1 5\n4 1\n5 4 3 5\n", "output": "1\n3\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# Task\n\nThe function `fold_cube(number_list)` should return a boolean based on a net (given as a number lis...
[{"input": "[18, 16, 17, 15, 13, 14]", "output": "[true]", "fn_name": "fold_cube"}, {"input": "[24, 20, 14, 19, 18, 9]", "output": "[true]", "fn_name": "fold_cube"}, {"input": "[12, 14, 13, 9, 10, 6]", "output": "[false]", "fn_name": "fold_cube"}, {"input": "[1, 7, 6, 17, 12, 16]", "output": "[false]", "fn_name": "fold...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere is an integer sequence A of length N whose values are unknown.\nGiven is an integer sequence B of lengt...
[{"input": "100\n100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 10...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given an integer a that consists of n digits. You are also given a sequence of digits s of length m. ...
[{"input": "123456789012345678905764345\n00001\n", "output": "123456789112345678905764345\n"}, {"input": "123456789012345678905764345\n01001\n", "output": "123456789112345678915764345"}, {"input": "123456789012345678905764345\n11001\n", "output": "123456789112345678915764345"}, {"input": "123456789012345678905764345\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\nAt the big break Nastya came to the school dining room. There are $n$ pupils in the school, numbered from $1$...
[{"input": "20 47\n4 6 11 15 9 17 3 1 19 14 12 8 2 5 7 20 16 18 13 10\n18 10\n6 3\n15 17\n18 7\n4 5\n19 10\n6 7\n11 3\n1 10\n17 3\n6 14\n7 10\n19 5\n12 10\n1 8\n6 11\n18 5\n6 8\n12 12\n1 5\n20 11\n16 8\n3 10\n20 19\n17 8\n19 10\n2 5\n19 8\n6 9\n16 3\n16 10\n19 7\n17 16\n10 13\n8 9\n12 5\n17 10\n2 15\n6 15\n4 9\n10 1\n1...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTakahashi participated in a contest on AtCoder.\nThe contest had N problems.\nTakahashi made M submissions du...
[{"input": "100000 3\n7777 AC\n7777 AC\n7777 AC\n", "output": "1 0\n"}, {"input": "100000 3\n12676 AC\n7777 AC\n7777 CA", "output": "2 0\n"}, {"input": "100000 3\n7777 AC\n7777 AC\n7777 CA", "output": "1 0\n"}, {"input": "100000 3\n6234 AC\n7777 AC\n7777 AC", "output": "2 0\n"}, {"input": "100000 3\n7777 AC\n7777 AC\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\nSome integral numbers are odd. All are more odd, or less odd, than others.\n\nEven numbers satisfy `n = 2m` (...
[{"input": "[-42, -41, -40, -39, -38, -37, -36, -35, -34, -33, -32, -31, -30, -29, -28, -27, -26, -25, -24, -23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, ...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA series or sequence of numbers is usually the product of a function and can either be infinite or finite.\n\...
[{"input": "[3, 5, 8, 9, 14, 23]", "output": "[1]", "fn_name": "sequence_classifier"}, {"input": "[3, 5, 8, 8, 14, 14]", "output": "[2]", "fn_name": "sequence_classifier"}, {"input": "[14, 14, 8, 8, 5, 3]", "output": "[4]", "fn_name": "sequence_classifier"}, {"input": "[3, 5, 8, 1, 14, 3]", "output": "[0]", "fn_name": ...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLet S(n) denote the sum of the digits in the decimal notation of n.\nFor example, S(101) = 1 + 0 + 1 = 2.\nGi...
[{"input": "1000000000\n", "output": "Yes\n"}, {"input": "999999999\n", "output": "Yes\n"}, {"input": "873041724\n", "output": "Yes\n"}, {"input": "689670774\n", "output": "Yes\n"}, {"input": "506479109\n", "output": "Yes\n"}, {"input": "693828976\n", "output": "No\n"}, {"input": "972655544\n", "output": "No\n"}, {"inp...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are n kangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another...
[{"input": "100\n154\n60\n97\n638\n139\n150\n570\n579\n601\n647\n804\n237\n245\n549\n288\n347\n778\n282\n916\n441\n974\n145\n957\n886\n655\n702\n930\n618\n132\n520\n972\n48\n94\n54\n682\n433\n896\n134\n845\n636\n242\n842\n125\n141\n240\n130\n409\n666\n948\n938\n604\n110\n474\n484\n364\n40\n807\n271\n438\n288\n201\n814\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nGrandma Laura came to the market to sell some apples. During the day she sold all the apples she had. But gra...
[{"input": "40 562\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalf\nhalf\nhalf\nhalfplus\nhalf\nhalf\nhalfplus\nhalf\nhalfplus\nhalf\nhalfplus\nhalf\nhalfplus\nhalf\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalf\nhalf\nhalfplus\nhalf\nhalfplus\nhalfplus\nhalf\nhalf\nhalfpl...
code_stdio