messages
listlengths
1
1
ground_truth
stringlengths
88
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\nSolve the following coding problem using the programming language python:\n\nIn Berland a bus travels along t...
[{"type": "stdin_stdout", "input": "6\n2 3 5 7 9 11\n11\n1 2 2 3 3 4 4 5 5 5 6\n", "output": " 18\n"}, {"type": "stdin_stdout", "input": "6\n2 3 5 7 11 13\n9\n1 2 2 3 3 4 5 5 6\n", "output": " 16\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\nSolve the following coding problem using the programming language python:\n\nIn the spirit of the holidays, S...
[{"type": "stdin_stdout", "input": "200\nNESENEESEESWWWNWWSWSWNWNNWNNESWSWNNWNWNENESENNESSWSESWWSSSEEEESSENNNESSWWSSSSESWSWWNNEESSWWNNWSWSSWWNWNNEENNENWWNESSSENWNESWNESWNESEESSWNESSSSSESESSWNNENENESSWWNNWWSWWNESEENWWWWNWWNWWNENESESSWWSWWSES\nNWNESESSENNNESWNWWSWWWNWSESSSWWNWWNNWSENWSWNENNNWWSWWSWNNNESWWWSSESSWWWSSENWSE...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nFamil Door wants to celebrate hi...
[{"type": "stdin_stdout", "input": "40\nM 55 363\nF 117 252\nM 157 282\nF 322 345\nM 330 363\nF 154 231\nF 216 352\nF 357 365\nM 279 292\nF 353 359\nF 82 183\nM 78 297\nM 231 314\nM 107 264\nF 34 318\nM 44 244\nF 42 339\nM 253 307\nM 128 192\nF 119 328\nM 135 249\nF 303 358\nF 348 352\nF 8 364\nF 126 303\nM 226 346\nF ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nThe life goes up and down, just ...
[{"type": "stdin_stdout", "input": "50\n11836 28308 72527 92281 139289 93797 134555 148444 40866 111317 21564 87813 65466 20541 99238 2287 74647 128071 18163 61672 39766 55589 138385 147443 138100 142683 60703 15444 52566 72976 147412 116006 115986 110545 79993 100440 9876 71470 75209 62443 64906 88987 72232 2246 63160...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nThis is an interactive problem. ...
[{"type": "stdin_stdout", "input": "no\nyes\nno\nno\nno\n", "output": "2\n3\n5\n7\n11\n13\n17\n19\n23\n29\n31\n37\n41\n43\n47\n4\n9\n25\n49\nprime\n"}, {"type": "stdin_stdout", "input": "no\nyse\nno\nno\nno\n", "output": "2\n3\n5\n7\n11\n13\n17\n19\n23\n29\n31\n37\n41\n43\n47\n4\n9\n25\n49\nprime\n"}, {"type": "stdin_s...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nVasya has the square chessboard ...
[{"type": "stdin_stdout", "input": "500 43\n176 85\n460 171\n233 260\n73 397\n474 35\n290 422\n309 318\n280 415\n485 169\n106 22\n355 129\n180 301\n205 347\n197 93\n263 318\n336 382\n314 350\n476 214\n367 277\n333 166\n500 376\n236 17\n94 73\n116 204\n166 50\n168 218\n144 369\n340 91\n274 360\n171 360\n41 251\n262 478\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nPolycarp is a music editor at th...
[{"type": "stdin_stdout", "input": "80 63\n17 59 54 75 131 69 69 67 62 77 65 78 54 69 59 73 68 57 65 54 66 46 68 68 11 65 72 39 62 63 53 78 72 62 78 34 74 68 78 35 79 60 64 56 73 76 66 44 43 69 74 75 44 66 71 78 41 75 71 77 59 56 78 52 61 64 64 53 79 34 79 79 65 45 79 67 65 78 68 74\n", "output": "1 43\n17 1 2 3 4 5 6 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nHongcow likes solving puzzles.\n...
[{"type": "stdin_stdout", "input": "1 500\n.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nJon Snow is on the lookout for s...
[{"type": "stdin_stdout", "input": "8 10\n100\n200\n300\n400\n500\n600\n700\n800\n900\n1000\n", "output": "11\n13\n14\n15\n16\n16\n17\n18\n19\n20\n"}, {"type": "stdin_stdout", "input": "8 10\n100\n200\n300\n400\n500\n600\n700\n862\n900\n1000\n", "output": "11\n13\n14\n15\n16\n16\n17\n19\n19\n20\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nA positive integer number n is w...
[{"type": "stdin_stdout", "input": "53684795681792590016697187295561462737810600000146840941336328677293748561247888801665863139922929397968535048060292988802347668853531069156825523164438370977880256909710958836918627008217572514193873141535365258436916984535972865113877338591947508645026570682995314540038481160747606...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nSagheer is playing a game with h...
[{"type": "stdin_stdout", "input": "21\n6194737 6429360 6047962 1014039 9196042 2483033 9232471 5444322 4437778 6614229 4791649 7417126 7679607 790939 3062370 174847 8404336 832859 2083127 9041108 3074902\n1 2 3 4 4 6 7 2 9 10 9 12 12 1 15 1 17 1 19 19\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "23\n795895...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nYour security guard friend recen...
[{"type": "stdin_stdout", "input": "1000000\n", "output": "4000\n"}, {"type": "stdin_stdout", "input": "718351\n", "output": "3392\n"}, {"type": "stdin_stdout", "input": "246206\n", "output": "1986\n"}, {"type": "stdin_stdout", "input": "607443\n", "output": "3118\n"}, {"type": "stdin_stdout", "input": "999999\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\nSolve the following coding problem using the programming language python:\n\nRecently Luba bought a very inte...
[{"type": "stdin_stdout", "input": "100 1000000\n0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 -1 0 0 1 0 0 1 -1 -1 0 0 0 0 0 0 0 1 0 0 0 0 0 -1 -1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 1 0 0 0 0 -1 0 0 0\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "100 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\nSolve the following coding problem using the programming language python:\n\nCarol is currently curling.\n\nS...
[{"type": "stdin_stdout", "input": "5 300\n939 465 129 611 532\n", "output": "300 667.8641053432639 1164.9596695962555 1522.2774553276686 2117.0538839123933\n"}, {"type": "stdin_stdout", "input": "5 300\n594 465 129 611 532\n", "output": "300 885.9684291836891 1383.0639934366804 1740.3817791680935 2335.1582077528183\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\nSolve the following coding problem using the programming language python:\n\nLittle walrus Fangy loves math v...
[{"type": "stdin_stdout", "input": "1000101100110000000001111010110000000010001001111110011011000011101011001001010010111\n", "output": "133\n"}, {"type": "stdin_stdout", "input": "1000101100100000000001111010110000000010001001111110011011000011101011001001010010111\n", "output": "134\n"}, {"type": "stdin_stdout", "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\nSolve the following coding problem using the programming language python:\n\nConsider a new order of english ...
[{"type": "stdin_stdout", "input": "6\naaabc\naaade\nbcad\ncde\ncda\ncca\n\nSAMPLE", "output": "e\na\nb\nd\nc\n"}, {"type": "stdin_stdout", "input": "6\naaabc\naaade\nbacd\ncde\ncda\ncca\n\nSAMPLE", "output": "e\na\nb\nd\nc"}, {"type": "stdin_stdout", "input": "6\naaabc\naaade\ndacb\ncde\ncda\ncca\n\nELPMAS", "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\nSolve the following coding problem using the programming language python:\n\nFlip the world is a game. In thi...
[{"type": "stdin_stdout", "input": "30\n1 1\n1\n1 1\n0\n4 4\n0000\n1110\n0101\n1011\n4 4\n1100\n0010\n1010\n1101\n4 4\n1111\n1110\n0000\n0100\n4 4\n1000\n1110\n0011\n1110\n4 4\n0011\n0110\n0101\n1000\n4 4\n0010\n0111\n1100\n0100\n4 4\n0100\n1111\n1001\n0000\n4 4\n0001\n0011\n0111\n0100\n4 4\n0111\n1101\n1111\n0101\n4 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\nSolve the following coding problem using the programming language python:\n\nMike has a huge guitar collectio...
[{"type": "stdin_stdout", "input": "3\n2\n0\n14\n-1 -1\n4\n-1 1 2\n\nSAMPKE", "output": "1\n3\n5\n"}, {"type": "stdin_stdout", "input": "3\n1\n8\n2\n-1 -1\n12\n1 2 -1\n\nRAKPME", "output": "2\n3\n5\n"}, {"type": "stdin_stdout", "input": "3\n2\n11\n10\n-1 0\n3\n1 3 0\n\nSAMPKE", "output": "2\n2\n4\n"}, {"type": "stdin_s...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nGiven are integers A, B, and N.\...
[{"type": "stdin_stdout", "input": "35 10 3", "output": "10\n"}, {"type": "stdin_stdout", "input": "20 10 3", "output": "6\n"}, {"type": "stdin_stdout", "input": "56 12 1", "output": "4\n"}, {"type": "stdin_stdout", "input": "11 11 9", "output": "9\n"}, {"type": "stdin_stdout", "input": "-2 2 1", "output": "-1\n"}, {"t...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nLet us consider a grid of square...
[{"type": "stdin_stdout", "input": "311", "output": "aacd..........................................................................................................................................................................................................................................................................
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nGiven are two strings s and t co...
[{"type": "stdin_stdout", "input": "aa\naaaaaaa", "output": "-1"}, {"type": "stdin_stdout", "input": "abcabab\nab", "output": "3"}, {"type": "stdin_stdout", "input": "aa\nabaaaaa", "output": "0"}, {"type": "stdin_stdout", "input": "abcaabb\nab", "output": "1"}, {"type": "stdin_stdout", "input": "aa\naaaaaba", "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\nSolve the following coding problem using the programming language python:\n\nKurohashi has never participated...
[{"type": "stdin_stdout", "input": "426", "output": "444\n"}, {"type": "stdin_stdout", "input": "101", "output": "111\n"}, {"type": "stdin_stdout", "input": "638", "output": "666\n"}, {"type": "stdin_stdout", "input": "268", "output": "333\n"}, {"type": "stdin_stdout", "input": "457", "output": "555\n"}, {"type": "stdi...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nIn Finite Encyclopedia of Intege...
[{"type": "stdin_stdout", "input": "0 39", "output": "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"}, {"type": "stdin_stdout", "input": "0 28", "output": "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"}, {"type": "stdin_stdout", "input": "13 27", "output": "7 7 7 7 7 7 7 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\nSolve the following coding problem using the programming language python:\n\nMr. Tanaka died leaving the orch...
[{"type": "stdin_stdout", "input": "10 10\n####*****@\n*#*#@@@@#@\n@##***@@@*\n#****#*@**\n##@*#@@*##\n*@@@@*@@@#\n***#@*@##*\n*@@@*@@##@\n*@*#*@##**\n@****#@@#@\n0 0", "output": "33\n"}, {"type": "stdin_stdout", "input": "10 10\n####*****@\n@#@@@@#*#*\n@##***@@@*\n#****#*@**\n##@*#@@*##\n*@@@@*@@@#\n***#@*@##*\n*@@@*@...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nWelcome to PC Koshien, players. ...
[{"type": "stdin_stdout", "input": "1\n2\n-1\n-9\n-1\n2\n-1\n-32\n-1\n1", "output": "-39\n"}, {"type": "stdin_stdout", "input": "1\n2\n0\n-38\n-1\n1\n-1\n-17\n0\n1", "output": "-52\n"}, {"type": "stdin_stdout", "input": "1\n2\n0\n-38\n-1\n1\n-1\n-32\n0\n1", "output": "-67\n"}, {"type": "stdin_stdout", "input": "1\n2\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\nSolve the following coding problem using the programming language python:\n\nDr .: Peter, do you know \"Yes, ...
[{"type": "stdin_stdout", "input": "Yes I have a number\nHow I wish I could calculate an unused bolor for space\nThank you\nEND OF INPUT", "output": "31416\n31415926535\n53\n"}, {"type": "stdin_stdout", "input": "Yes I have a rebmun\nHow I wish I could calculate an unused bolor for space\nThank you\nEND OF INPUT", "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\nSolve the following coding problem using the programming language python:\n\nJim is planning to visit one of ...
[{"type": "stdin_stdout", "input": "3 6\n3 1\n1 2 1\n2 3 1\n3 3 1\n2 1 1\n1 3 4\n3 1 4\n3 6\n8 1\n1 2 1\n2 3 2\n3 2 1\n2 1 1\n1 3 4\n1 1 4\n4 5\n3 1\n3 1\n2 4 10\n2 3 5\n3 4 9\n4 2 5\n3 2 5\n2 1\n2 1 1\n0 0", "output": "8\n13\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "3 6\n3 1\n1 2 1\n2 3 0\n3 2 2\n2 1 1\n1 3 7\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\nSolve the following coding problem using the programming language python:\n\nBackground\n\nThe kindergarten a...
[{"type": "stdin_stdout", "input": "4 3 4 2\n3 1\n0 1\n3 3\n1 5\n4 2\n2 0\n5 0\n4 0\n3 2\n3 3\n4 3\n6 0\n6 10\n4 1\n3 4\n4 4\n5 10\n2 9", "output": "0.7490695671\n"}, {"type": "stdin_stdout", "input": "4 3 4 2\n3 1\n0 1\n3 3\n1 5\n4 2\n3 0\n5 0\n4 0\n3 2\n3 0\n4 3\n6 0\n6 10\n4 1\n3 4\n4 4\n5 10\n2 9", "output": "0.400...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nIn the International System of U...
[{"type": "stdin_stdout", "input": "7\n12.729479136172973 kilo metfrt\n0.45 mega sttaw\n0.000000000000000000000001 yotta mrags\n1000000000000000000000000 yocto seconds\n42 amperes\n0.951642419825234 joulfs\n1234.56789012345678901234567890 hecto pascals", "output": "1.2729479136172973 * 10^4 metfrt\n4.5 * 10^5 sttaw\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\nSolve the following coding problem using the programming language python:\n\nH - RLE Replacement\n\nProblem S...
[{"type": "stdin_stdout", "input": "R 100 L 20 E 10 \\$\nR 5 L 10 \\$\nX 20 \\$", "output": "R 95 X 20 L 10 E 10 \\$"}, {"type": "stdin_stdout", "input": "R 100 K 20 E 10 \\$\nS 1 L 11 \\#\nX 20 \\$", "output": "R 100 K 20 E 10 \\ 0 $\n"}, {"type": "stdin_stdout", "input": "R 100 L 20 D 10 \\$\nS 1 L 11 \\%\nW 20 \\$",...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nA: four tea\n\nproblem\n\nTea is...
[{"type": "stdin_stdout", "input": "10\n1 2 10 2\n0 0 0 15", "output": "2\n"}, {"type": "stdin_stdout", "input": "10\n1 1 3 2\n0 2 3 16", "output": "2\n"}, {"type": "stdin_stdout", "input": "10\n0 1 3 2\n1 2 3 16", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n0 1 6 1\n0 0 1 50", "output": "1\n"}, {"type": "...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nGag\n\nSegtree has $ N $ of \"ga...
[{"type": "stdin_stdout", "input": "1\n114525", "output": "114524\n"}, {"type": "stdin_stdout", "input": "1\n105905", "output": "105904\n"}, {"type": "stdin_stdout", "input": "1\n196252", "output": "196251\n"}, {"type": "stdin_stdout", "input": "1\n127413", "output": "127412\n"}, {"type": "stdin_stdout", "input": "1\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\nSolve the following coding problem using the programming language python:\n\nFor a given array $a_1, a_2, a_3...
[{"type": "stdin_stdout", "input": "6 5\n1 2 3 2 7 6\n12 12 12 21 15", "output": "14\n14\n14\n21\n18\n"}, {"type": "stdin_stdout", "input": "6 5\n1 4 3 2 12 6\n10 1 22 25 23", "output": "11\n1\n18\n19\n19\n"}, {"type": "stdin_stdout", "input": "6 5\n1 4 3 2 12 1\n10 1 22 25 23", "output": "11\n2\n20\n21\n21\n"}, {"type...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nYou are given a set of n segment...
[{"type": "stdin_stdout", "input": "100 100\n1 2\n1 3\n1 3\n2 3\n1 1\n1 2\n1 1\n1 2\n1 3\n1 2\n1 2\n1 5\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 2\n1 1\n1 1\n1 2\n2 2\n1 1\n1 5\n1 4\n1 1\n2 2\n2 9\n1 1\n1 5\n2 3\n2 3\n1 5\n1 2\n2 2\n2 2\n1 2\n1 2\n3 4\n1 5\n1 1\n1 1\n1 1\n1 1\n2 2\n1 3\n1 2\n1 2\n1 2\n1 1\n2 2\n1 4\n1 3\n1 1\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nYou are given n blocks, each of ...
[{"type": "stdin_stdout", "input": "40\n2 99891 4\n1 29593 4\n4 12318 1\n1 40460 3\n1 84340 2\n3 33349 4\n3 2121 4\n3 50068 3\n2 72029 4\n4 52319 3\n4 60726 2\n1 30229 1\n3 1887 2\n2 56145 4\n3 53121 1\n2 54227 4\n2 70016 3\n1 93754 4\n4 68567 3\n1 70373 2\n4 52983 3\n2 27467 2\n4 56860 2\n2 12665 2\n3 11282 3\n2 18731...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nYou have unlimited number of coi...
[{"type": "stdin_stdout", "input": "100000 1000000000\n", "output": "10000\n"}, {"type": "stdin_stdout", "input": "1 1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "1 1010000000\n", "output": "1010000000\n"}, {"type": "stdin_stdout", "input": "1 1452428327\n", "output": "1452428327\n"}, {"t...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nPetya has a simple graph (that i...
[{"type": "stdin_stdout", "input": "20 10\n487490574 766859182 860731945 956220596 584871933 815478522 698429627 781975977 485357256 396825095 566947997 680691964 834523631 323163346 665972495 5503804 738797202 410201497 91359028 708811641\n16 15 598574211\n8 7 332007499\n11 1 942159718\n3 1 24779817\n20 4 192862192\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\nSolve the following coding problem using the programming language python:\n\nYou are given an array a consist...
[{"type": "stdin_stdout", "input": "50 20\n1 1 1 1 1 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50\n", "output": "YES\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 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\nSolve the following coding problem using the programming language python:\n\nSasha and Dima want to buy two n...
[{"type": "stdin_stdout", "input": "10\n8 8 3 9 7 1 9 6 10 6 4 2 7 3 4 10 5 5 1 2\n", "output": "123\n"}, {"type": "stdin_stdout", "input": "9\n1 3 6 1 4 9 2 8 3 4 8 7 5 7 2 5 9 6\n", "output": "89\n"}, {"type": "stdin_stdout", "input": "8\n4 5 7 8 2 7 6 3 6 1 1 3 5 8 4 2\n", "output": "74\n"}, {"type": "stdin_stdout",...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nBertown has n junctions and m bi...
[{"type": "stdin_stdout", "input": "21 78\n12 2\n21 13\n17 5\n11 1\n12 17\n12 7\n21 8\n16 18\n3 2\n5 10\n6 7\n13 8\n3 16\n20 7\n16 1\n17 20\n2 13\n21 17\n9 19\n19 11\n12 14\n2 17\n6 12\n6 13\n7 18\n18 13\n3 12\n17 8\n16 19\n21 9\n17 10\n12 16\n8 10\n12 15\n14 13\n5 7\n13 7\n3 5\n4 2\n18 14\n4 5\n19 7\n19 5\n14 7\n5 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\nSolve the following coding problem using the programming language python:\n\nThe legendary Farmer John is thr...
[{"type": "stdin_stdout", "input": "100000 12\n8 11\n1 9\n5 4\n11 12\n7 11\n3 4\n6 5\n12 15\n15 13\n13 14\n7 11\n11 14\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "100000 12\n8 10\n1 9\n5 4\n11 12\n7 11\n3 4\n3 5\n12 15\n15 13\n13 14\n7 8\n11 14\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "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\nSolve the following coding problem using the programming language python:\n\nLet's introduce some definitions...
[{"type": "stdin_stdout", "input": "1000000000 1000000000000000000\n", "output": "997440007\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000010000000\n", "output": "778038345\n"}, {"type": "stdin_stdout", "input": "1000001001 1000000000010000000\n", "output": "141474221\n"}, {"type": "stdin_stdout", "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\nSolve the following coding problem using the programming language python:\n\n[Sakuzyo - Imprinting](https://w...
[{"type": "stdin_stdout", "input": "1\n100 52 99\n51 69 42 32 34 62 12 75 88 18 57 47 40 91 100 81 72 15 26 14 93 68 6 50 5 24 97 52 10 20 54 9 56 39 21 55 7 98 59 87 77 17 29 13 30 46 37 76 71 78 96 82 49 64 84 60 67 19 2 25 85 89 38 41 11 90 35 48 27 28 70 65 66 16 79 3 80 44 36 43 61 99 22 33 86 4 83 94 74 31 73 95 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nTired of boring office work, Den...
[{"type": "stdin_stdout", "input": "7\n1 4 1\n0 0 0\n16 0 1\n2 2 2\n2 3 2\n3 2 2\n0 4 4\n", "output": "3\n0\n2\n4\n5\n5\n3\n"}, {"type": "stdin_stdout", "input": "7\n0 1 1\n0 0 0\n11 1 1\n2 2 4\n3 3 3\n4 2 3\n0 6 1\n", "output": "2\n0\n3\n5\n6\n5\n2\n"}, {"type": "stdin_stdout", "input": "7\n1 2 1\n0 0 0\n16 1 1\n2 2 2...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nThe only difference between easy...
[{"type": "stdin_stdout", "input": "6\n8\n1 1 2 10 3 2 1 1\n3\n2 4 3\n4\n2 10 11 1\n1\n26\n2\n1 1\n3\n2 1 1\n", "output": "6\n1\n1\n1\n2\n2\n"}, {"type": "stdin_stdout", "input": "6\n8\n1 1 2 2 3 2 1 1\n3\n1 3 3\n4\n1 10 10 1\n1\n26\n2\n2 1\n3\n1 1 1\n", "output": "7\n2\n4\n1\n1\n3\n"}, {"type": "stdin_stdout", "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\nSolve the following coding problem using the programming language python:\n\nDue to the coronavirus pandemic,...
[{"type": "stdin_stdout", "input": "5\n2 1\n1 3\n2 2\n1 3\n5 4\n", "output": "1\n2\n2\n2\n10\n"}, {"type": "stdin_stdout", "input": "2\n461 5299\n118 177\n", "output": "1221420\n10443\n"}, {"type": "stdin_stdout", "input": "2\n461 5299\n176 177\n", "output": "1221420\n15576\n"}, {"type": "stdin_stdout", "input": "5\n5 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nYou have n gifts and you want to...
[{"type": "stdin_stdout", "input": "5\n3\n3 5 12\n3 2 3\n5\n1 2 3 4 5\n5 4 1 2 1\n3\n1 1 1\n2 2 2\n6\n1 1000000000 1000000000 1000000000 1000000000 1000000000\n1 1 2 1 1 1\n3\n10 24 8\n7 5 4\n", "output": "12\n16\n0\n4999999995\n19\n"}, {"type": "stdin_stdout", "input": "5\n3\n3 5 12\n3 2 3\n5\n1 2 6 4 5\n5 4 1 2 1\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\nSolve the following coding problem using the programming language python:\n\nSome time ago Lesha found an ent...
[{"type": "stdin_stdout", "input": "ggaaaawwwxxxxxxrrrrrrrrwwwwwwwwggggggggjjusszzzzqqqqqsssssssbbwwwwwwmmmmtttttttvvvvvvvvssssppppppggggsrrrrrrzzzzzzzyyyyyccccccchhhhhhhhjjrrrrhhhhhhhheeeeeeeaaaaaaaiiiiiuuuuuuuvvvvvjjjjjjjjffbbbbbbbbrrrrrllllllllggggggggooooollssvvvvvvvvvvnnnnnnnnuuuuuuuucccccyyyyyyyyyyzzzzzzzkkkkuuuu...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nThis is the hard version of the ...
[{"type": "stdin_stdout", "input": "5\n2 2\n10\n11\n3 3\n011\n101\n010\n4 4\n1111\n0110\n0110\n1111\n5 5\n01011\n11001\n00010\n11011\n10000\n2 3\n011\n101\n", "output": "1\n1 1 2 1 2 2 \n5\n1 2 1 3 2 2 \n2 1 2 2 3 2 \n2 2 3 2 2 3 \n2 2 2 3 3 3 \n3 2 2 3 3 3 \n8\n1 1 1 2 2 1 \n1 3 1 4 2 3 \n2 1 2 2 3 1 \n3 1 4 1 3 2 \n4...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nThis is the easy version of the ...
[{"type": "stdin_stdout", "input": "100\n45 21 34 56 15 0 46 59 40 39 78 83 29 77 19 30 60 39 90 64 11 47 10 47 35 79 30 13 21 31 26 68 0 67 52 43 29 94 100 76 16 61 74 34 62 63 4 41 78 31 77 21 90 2 43 70 53 15 53 29 47 87 33 20 23 30 55 57 13 25 19 89 10 17 92 24 47 6 4 91 52 9 11 25 81 14 82 75 46 49 66 62 28 84 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\nSolve the following coding problem using the programming language python:\n\nIn one one-dimensional world the...
[{"type": "stdin_stdout", "input": "1000000 1000000 1000000 999999\n", "output": "1000000000000\n"}, {"type": "stdin_stdout", "input": "615188 948759 924417 924407\n", "output": "183286007415\n"}, {"type": "stdin_stdout", "input": "593287 923881 864740 864733\n", "output": "121078300574\n"}, {"type": "stdin_stdout", "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\nSolve the following coding problem using the programming language python:\n\nYou've got table a, consisting o...
[{"type": "stdin_stdout", "input": "4\n40 40 24 5\n56 14 59 76 92 34 43 96 33 44 72 37 81 27 42 5 7 95 22 4 60 18 61 103 74 84 93 55 3 62 70 82 77 51 86 102 29 67 91 9\n71 53 21 64 17 45 46 101 97 30 109 100 57 16 80 87 28 12 94 23 39 98 32 52 54 10 19 41 90 11 66 65 99 89 40 36 58 20 78 108\n35 88 73 75 104 63 79 31 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\nSolve the following coding problem using the programming language python:\n\nPermutation p is an ordered set ...
[{"type": "stdin_stdout", "input": "1000 900\n", "output": "301804159\n"}, {"type": "stdin_stdout", "input": "1000 998\n", "output": "583666213\n"}, {"type": "stdin_stdout", "input": "1000 700\n", "output": "642759746\n"}, {"type": "stdin_stdout", "input": "1000 500\n", "output": "979041279\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nVasya’s elder brother Petya love...
[{"type": "stdin_stdout", "input": "70 1000 1\n91 2\n43 1\n100 1\n79 2\n26 1\n68 2\n4 2\n64 1\n100 1\n80 2\n20 2\n70 1\n25 1\n99 1\n64 1\n35 2\n60 1\n63 2\n93 1\n40 2\n100 1\n54 1\n100 1\n15 2\n72 1\n28 1\n5 1\n93 1\n100 2\n39 2\n54 2\n100 1\n55 1\n43 1\n20 1\n28 2\n21 1\n100 2\n98 1\n35 1\n12 2\n50 2\n7 2\n7 2\n12 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\nSolve the following coding problem using the programming language python:\n\nThere always is something to cho...
[{"type": "stdin_stdout", "input": "13\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\n", "output": "6 1x12 2x6 3x4 4x3 6x2 12x1 \n6 1x12 2x6 3x4 4x3 6x2 12x1 \n6 1x12 2x6 3x4 4x3 6x2 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\nSolve the following coding problem using the programming language python:\n\nThe prison of your city has n pr...
[{"type": "stdin_stdout", "input": "57 3 9\n4 5 2 7 12 1 1 3 2 9 4 9 0 6 12 5 -1 6 11 1 0 0 -1 3 1 0 5 1 0 31 8 8 0 1 7 3 1 13 4 4 5 1 4 -2 1 7 1 1 1 4 5 1 24 5 1 9 6\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "57 3 9\n4 5 2 7 12 1 1 0 2 9 4 9 0 6 12 5 -1 6 11 1 0 0 -1 3 1 0 5 1 0 31 8 8 0 1 7 3 1 13 4 4 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\nSolve the following coding problem using the programming language python:\n\nOne way to create a task is to l...
[{"type": "stdin_stdout", "input": "1440245\n", "output": "9 1440236\n"}, {"type": "stdin_stdout", "input": "1292186\n", "output": "4 1292182\n"}, {"type": "stdin_stdout", "input": "1805804\n", "output": "4 1805800\n"}, {"type": "stdin_stdout", "input": "1865135\n", "output": "9 1865126\n"}, {"type": "stdin_stdout", "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\nSolve the following coding problem using the programming language python:\n\nMike has a frog and a flower. Hi...
[{"type": "stdin_stdout", "input": "999983\n651224 992349\n803017 393514\n258455 402487\n888310 244420\n", "output": "126531\n"}, {"type": "stdin_stdout", "input": "999983\n420528 808305\n387096 497121\n596163 353326\n47177 758204\n", "output": "548500\n"}, {"type": "stdin_stdout", "input": "999961\n744938 661980\n8459...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nOne day Vitaly was going home la...
[{"type": "stdin_stdout", "input": "100 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 0\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n0 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 0\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nYou are given an undirected grap...
[{"type": "stdin_stdout", "input": "11 7\n1 2 B\n1 3 R\n3 2 R\n4 5 R\n6 7 R\n8 9 R\n10 11 R\n", "output": "5\n3 4 6 8 10 \n"}, {"type": "stdin_stdout", "input": "11 7\n1 2 B\n1 3 R\n3 2 R\n3 5 R\n6 7 R\n8 9 R\n10 11 R\n", "output": "4\n3 6 8 10 "}, {"type": "stdin_stdout", "input": "11 7\n1 2 B\n1 3 R\n3 2 R\n3 5 R\n6 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nRecently, Mike was very busy wit...
[{"type": "stdin_stdout", "input": "98\n17 17 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 90 90 90 90 90 90 90 90 90 90 90 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 95 95 95 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\nSolve the following coding problem using the programming language python:\n\nLittle Vlad is fond of popular c...
[{"type": "stdin_stdout", "input": "100\n955 479 355 759 257 497 690 598 275 446 439 787 257 326 584 713 322 5 253 781 434 307 164 154 241 381 38 942 771 906 240 11 431 478 628 1892 346 74 493 964 455 1105 950 41 585 549 892 687 264 41 487 676 63 453 861 980 620 844 80 907 285 506 772 748 773 743 44 925 529 685 845 313...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nAfter the fourth season Sherlock...
[{"type": "stdin_stdout", "input": "200\n89017372169770060638462517044634884577600285180365791227828841983192945639410766634962149214165390392679430585962408483864914959904870801002680423351144765728677610509881245693518626747873607530273392\n40898854086720755346440245259380080903151813657455435756392575099352741552156...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nErelong Leha was bored by calcul...
[{"type": "stdin_stdout", "input": "26 26\nabcdefghijklmnopqrstuvwxyz\nffffffffffffffffffffffffff\n", "output": "25\n1 2 3 4 5 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 \n"}, {"type": "stdin_stdout", "input": "26 26\nabcdefghijkkmnopqrstuvwxyz\nffffffffffffffffffffffffff\n", "output": "25\n1 2 3 4 5 7 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\nSolve the following coding problem using the programming language python:\n\nEven if the world is full of cou...
[{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000100000000\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1000000000001000000 1000000000100000000\n", "output": "0\n"}, {"type": "stdin_stdout", "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\nSolve the following coding problem using the programming language python:\n\nStudents Vasya and Petya are stu...
[{"type": "stdin_stdout", "input": "222\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 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\nSolve the following coding problem using the programming language python:\n\nJamie is preparing a Codeforces ...
[{"type": "stdin_stdout", "input": "10 19228\n", "output": "Yes\n-10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -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\nSolve the following coding problem using the programming language python:\n\nIn distant future on Earth day l...
[{"type": "stdin_stdout", "input": "100\n6072 8210 6405 1191 2533 8552 7594 8793 2207 8855 7415 6252 3433 2339 5532 3118 3054 5750 3690 9843 3881 1390 936 8611 7099 988 7730 3835 7065 5030 6932 6936 5531 5173 1331 8975 5454 1592 8516 328 1091 4368 8275 6462 8638 4002 5534 113 6295 5960 1688 3668 6604 9632 4214 8687 795...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nVasya is a regular participant a...
[{"type": "stdin_stdout", "input": "2684354990\n", "output": "2684354990\n"}, {"type": "stdin_stdout", "input": "2539579656\n", "output": "2539579656\n"}, {"type": "stdin_stdout", "input": "9663677133\n", "output": "9663677133\n"}, {"type": "stdin_stdout", "input": "6530347911\n", "output": "6530347911\n"}, {"type": "s...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nLittle Arihant has always wanted...
[{"type": "stdin_stdout", "input": "10001\n100028 100028 100028 2289 1226 3868 100028 100028 1231 1861 100028 1604 4238 100028 100028 3575 100028 100028 100028 100028 2423 100028 4927 100028 100028 100028 3565 1182 100028 100028 100028 100028 100028 100028 1113 4408 3507 161 1482 2957 2449 100028 100028 1444 3741 10002...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nAfter minting loads of money fro...
[{"type": "stdin_stdout", "input": "eeflaegzqpdlxswgunhnlglqhycorbcwdfhclmcrwekkzsvoosmfblljeenwfjyoifcvxihhhbeyhmhlkvtsekeglaovjnsi", "output": "I love you, too!\n"}, {"type": "stdin_stdout", "input": "isnjvoalgekestvklhmhyebhhhixvcfioyjfwneejllbfmsoovszkkewrcmlchfdwcbrocyhqlglnhnugwsxldpqzgealfee", "output": "I love ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nSee Russian Translation\n\nIt's ...
[{"type": "stdin_stdout", "input": "24\nabcd\nabdc\nacbd\nacdb\nadbc\nadcb\nbacd\nbadc\nbcad\nbcda\nbdac\nbdca\ncabd\ncadb\ncbad\ncbda\ncdab\ncdba\ndabc\ndacb\ndbac\ndbca\ndcab\ndcba", "output": "12\n"}, {"type": "stdin_stdout", "input": "24\nabcd\nabdc\nacbd\nacdb\nadbc\nadcb\nbacd\nbadc\nbcad\nbcda\ncadb\nbdca\ncabd\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nGiven an integer a as input, pri...
[{"type": "stdin_stdout", "input": "1109", "output": "1365169019\n"}, {"type": "stdin_stdout", "input": "488", "output": "116452904\n"}, {"type": "stdin_stdout", "input": "762", "output": "443032134\n"}, {"type": "stdin_stdout", "input": "767", "output": "451806719\n"}, {"type": "stdin_stdout", "input": "853", "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\nSolve the following coding problem using the programming language python:\n\nWe have a tree G with N vertices...
[{"type": "stdin_stdout", "input": "19\n2 4\n15 8\n1 16\n1 3\n12 19\n1 18\n7 11\n11 15\n12 9\n1 6\n7 14\n18 2\n13 12\n13 5\n16 13\n7 1\n11 10\n7 17", "output": "78732"}, {"type": "stdin_stdout", "input": "19\n2 4\n15 8\n1 16\n0 3\n12 19\n1 18\n7 11\n11 15\n12 9\n1 6\n7 14\n18 2\n13 12\n13 5\n16 13\n7 1\n11 10\n7 17", "...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nThere are N slimes lining up fro...
[{"type": "stdin_stdout", "input": "20\nxxzaffeeeeedfkkkkllq", "output": "10\n"}, {"type": "stdin_stdout", "input": "20\nxfzaffeeeeedxkkkkllq", "output": "11\n"}, {"type": "stdin_stdout", "input": "20\nxfzaffeeeeedxkkkkmlq", "output": "12\n"}, {"type": "stdin_stdout", "input": "20\nxfzaffedeeedxkkkkmlq", "output": "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\nSolve the following coding problem using the programming language python:\n\nSnuke found a random number gene...
[{"type": "stdin_stdout", "input": "4\n337 780 799 18 796 875 331 223 1804 67 268 483 390 565 116 355", "output": "0\n870892872\n738673049\n866136893\n809360917\n134965576\n496873404\n200938352\n392063026\n225113281\n769068776\n945265000\n612087551\n845908556\n726467732\n606029955\n"}, {"type": "stdin_stdout", "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\nSolve the following coding problem using the programming language python:\n\nKenkoooo is planning a trip in R...
[{"type": "stdin_stdout", "input": "8 12 5 5\n2 8 685087149 1569714306\n6 1 298270585 209942236\n2 4 346080035 234079976\n1 5 131857300 40131411\n1 8 30723332 173476334\n2 6 447829832 706415811\n1 4 181424400 548830121\n4 4 30593148 195056405\n7 8 211146752 588024753\n1 6 127300821 203530153\n3 1 336869679 115858230\n4...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nWe have N sticks with negligible...
[{"type": "stdin_stdout", "input": "10\n1 1 2 -3 2 8 1 218 -1 8", "output": "16\n"}, {"type": "stdin_stdout", "input": "10\n0 1 0 -2 4 34 1 34 0 4", "output": "136\n"}, {"type": "stdin_stdout", "input": "10\n-1 2 12 15 3 1 0 18 1 1", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n-2 2 12 1 4 2 1 41 -1 1", "ou...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nEvery day, N passengers arrive a...
[{"type": "stdin_stdout", "input": "6 4 3\n11\n6\n2\n13\n17\n5", "output": "4\n"}, {"type": "stdin_stdout", "input": "6 4 3\n11\n9\n2\n13\n17\n5", "output": "4\n"}, {"type": "stdin_stdout", "input": "6 3 3\n7\n6\n2\n13\n17\n5", "output": "4\n"}, {"type": "stdin_stdout", "input": "6 3 3\n7\n6\n2\n13\n10\n6", "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\nSolve the following coding problem using the programming language python:\n\nThere are N rabbits on a number ...
[{"type": "stdin_stdout", "input": "5\n0 1 3 6 10\n3 10\n2 3 4", "output": "0.0\n3.0\n7.0\n8.0\n10.0"}, {"type": "stdin_stdout", "input": "5\n-1 1 3 -1 17\n3 10\n4 4 3", "output": "-1\n1\n3\n-1\n17\n"}, {"type": "stdin_stdout", "input": "5\n-1 -1 2 1 10\n3 10\n2 3 4", "output": "-1\n-2\n7\n7\n10\n"}, {"type": "stdin_st...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nThere is a puzzle to complete by...
[{"type": "stdin_stdout", "input": "3649596966777\n4672433573317\n9118992346175\n9643871425498\n7755542764533\n1133557799246", "output": "2 3 5 8\n1 2 4 5 7\n1 2 3 4 5 6 7 8 9\n7 8 9\n1 2 3 4 6 7 8\n0\n"}, {"type": "stdin_stdout", "input": "3649596966777\n4672433573317\n9118992346175\n9643871425498\n7755542764533\n1079...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nDecimal numbers are a common not...
[{"type": "stdin_stdout", "input": "7\n4\n0\n24\n10\n10010\n-1", "output": "13\n10\n0\n120\n22\n2130122\n"}, {"type": "stdin_stdout", "input": "7\n4\n1\n24\n10\n10010\n-1", "output": "13\n10\n1\n120\n22\n2130122\n"}, {"type": "stdin_stdout", "input": "7\n4\n0\n12\n16\n10000\n-1", "output": "13\n10\n0\n30\n100\n2130100\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nThe appearance of the sun is cal...
[{"type": "stdin_stdout", "input": "-12 3", "output": "-1\n"}, {"type": "stdin_stdout", "input": "-15 3", "output": "-1\n"}, {"type": "stdin_stdout", "input": "-23 3", "output": "-1\n"}, {"type": "stdin_stdout", "input": "-10 6", "output": "-1\n"}, {"type": "stdin_stdout", "input": "-2 -1", "output": "-1\n"}, {"type": ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nAs the first step in algebra, st...
[{"type": "stdin_stdout", "input": "2 5 4\n1 0 1\n10 -7 -1\n2 0 -5\n0 0 0", "output": "Impossible\nImpossible\nImpossible\nImpossible\n"}, {"type": "stdin_stdout", "input": "4 5 2\n1 1 1\n11 -10 0\n1 0 -3\n0 0 0", "output": "Impossible\nImpossible\n11 -10 1 0\nImpossible\n"}, {"type": "stdin_stdout", "input": "4 5 4\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\nSolve the following coding problem using the programming language python:\n\nProfessor Pathfinder is a distin...
[{"type": "stdin_stdout", "input": "5 6\n/home/ACM/index.html\nlmth.xedni/CPCI/\n/ICPC/general.html\n/ICPC/japanese/index.html\n/ICPC/secret/confidential/2005/index.html\n/home/ACM/\n/ho/e/ICPC/..mACM/\n/ICPC/secret/\n/ICPC/secret/index.html\n/ICPC\n/ICPC/../ICPC/index.html\n/ICPC\n/ICPC/general.html\n/ICPC/japanese/.....
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nLook for the Winner!\n\nThe citi...
[{"type": "stdin_stdout", "input": "1\nA\n4\nA A B B\n5\nL M N L N\n6\nK K K K K K\n6\nX X X Y Z X\n10\nB A A B A C A C C B\n10\nV U U U U W V W V W\n0", "output": "A 1\nTIE\nTIE\nK 4\nX 5\nA 10\nU 10\n"}, {"type": "stdin_stdout", "input": "1\nA\n4\nA A B B\n5\nL M N L N\n6\nK K K K K K\n6\nX X X Y Z X\n10\nB A A B A C...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nInternational Car Production Com...
[{"type": "stdin_stdout", "input": "1 1\n180 253 3\n1 1\n180 180 19\n2 10\n694 -351 7\n-24 360 8\n3 2\n100 60 2\n-72 -72 10\n-59 -413 5\n0 0", "output": "-7.91148452\n5.59128446\n0.00000000\n59.69026042\n-16.09771605\n5.86169674\n-6.89851214\n-10.76376689\n"}, {"type": "stdin_stdout", "input": "1 2\n180 253 2\n1 2\n180...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nThe University of Aizu Elementar...
[{"type": "stdin_stdout", "input": "3 9 89\n2 0 2\n1 0 3\n2 1 1\n2 0 3\n0 1 1\n0 1 2\n1 2 3\n0 1 1\n1 0 2", "output": "34\n1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 0\n"}, {"type": "stdin_stdout", "input": "3 9 89\n2 0 2\n1 0 3\n2 1 1\n2 0 3\n0 1 1\n0 1 2\n1 2 3\n0 1 1\n1 0 0", "output": "34\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\nSolve the following coding problem using the programming language python:\n\nProblem Statement\n\nIn the head...
[{"type": "stdin_stdout", "input": "3 10 3\n000 0000000000\n110 0000001011\n101 1111111100\n2 6 0\n1 2 0\n2 1 1\n01 1\n11 11 10\n10000000000 10000000000\n11000000000 00000000000\n01100000000 00100000000\n00110000000 00010000000\n00011000000 00001000000\n00001100000 00000100000\n01000110000 00000010000\n00000011000 0000...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\njfen\n\nThere is a one-person ga...
[{"type": "stdin_stdout", "input": "b1/1b\n1 1 1 2\nb5/bbbbbb\n2 4 1 5\nb2b2b/7\n1 0 2 11\n#", "output": "1b/1b\nb3b1/bbb1bb\nb2b2b/7\n"}, {"type": "stdin_stdout", "input": "b1/1b\n1 1 1 2\nb5/bbbbbb\n2 4 1 4\nb2b2b/7\n1 4 2 6\n#", "output": "1b/1b\nb2b2/bbb1bb\nb5b/5b1\n"}, {"type": "stdin_stdout", "input": "b1/1b\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\nSolve the following coding problem using the programming language python:\n\nGeneralized leap year\n\nNormall...
[{"type": "stdin_stdout", "input": "3 295 2014\n695\n100\n4\n1 1000 1999\n1\n2 1111 4526\n1\n2\n6 2000 3409\n5\n11\n21\n9\n3\n13\n0 0 0", "output": "414\n1000\n3416\n1159\n"}, {"type": "stdin_stdout", "input": "3 295 2014\n695\n100\n4\n1 1000 1999\n1\n2 1111 4526\n1\n2\n6 2000 3409\n9\n11\n21\n9\n3\n13\n0 0 0", "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\nSolve the following coding problem using the programming language python:\n\nProblem\n\nThere are $ N $ stree...
[{"type": "stdin_stdout", "input": "43 16 2\n4 7\n-1 8\n10 0", "output": "48\n"}, {"type": "stdin_stdout", "input": "19 21 2\n0 3\n-1 11\n1 1", "output": "30\n"}, {"type": "stdin_stdout", "input": "12 31 1\n5 2\n-1 1\n14 0", "output": "36\n"}, {"type": "stdin_stdout", "input": "34 50 1\n9 1\n0 1\n-2 -1", "output": "74\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nWrite a program which reads an i...
[{"type": "stdin_stdout", "input": "123\n158\n1100\n0", "output": "6\n14\n2\n"}, {"type": "stdin_stdout", "input": "123\n181\n1111\n0", "output": "6\n10\n4\n"}, {"type": "stdin_stdout", "input": "123\n418\n1100\n0", "output": "6\n13\n2\n"}, {"type": "stdin_stdout", "input": "123\n418\n1110\n0", "output": "6\n13\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\nSolve the following coding problem using the programming language python:\n\nLira is now very keen on compile...
[{"type": "stdin_stdout", "input": "3\n<<>>\n><\n<>>>", "output": "4\n0\n2\n"}, {"type": "stdin_stdout", "input": "3\n<<>>\n<>\n<>>>", "output": "4\n2\n2\n"}, {"type": "stdin_stdout", "input": "3\n><<>\n<>\n<>>>", "output": "0\n2\n2\n"}, {"type": "stdin_stdout", "input": "3\n><<>\n><\n<>>>", "output": "0\n0\n2\n"}, {"t...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nThere is a beautiful garden of s...
[{"type": "stdin_stdout", "input": "50\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\n1000 1000 1000 1000 1000 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\nSolve the following coding problem using the programming language python:\n\nYou are given two arrays a and b...
[{"type": "stdin_stdout", "input": "235 1\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 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\nSolve the following coding problem using the programming language python:\n\nVasya is reading a e-book. The f...
[{"type": "stdin_stdout", "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"}, {"type": "stdin_stdout", "input": "5\n20 10 2 9\n1000000000 2 89 4\n1000000000 2 89 5\n1000000000 142 1 1000000000\n1000000000 100000...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nThere are n segments [l_i, r_i] ...
[{"type": "stdin_stdout", "input": "3\n2\n5 5\n2 3\n3\n3 5\n2 3\n2 3\n3\n3 3\n4 4\n5 5\n", "output": "2 1 \n-1\n1 2 2 \n"}, {"type": "stdin_stdout", "input": "3\n2\n4 10\n2 3\n3\n2 10\n1 5\n0 3\n3\n3 3\n4 4\n5 4\n", "output": "2 1\n-1\n1 2 2\n"}, {"type": "stdin_stdout", "input": "3\n2\n10 10\n2 2\n3\n1 5\n1 5\n0 3\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\nSolve the following coding problem using the programming language python:\n\nLittle Petya loves presents. His...
[{"type": "stdin_stdout", "input": "AanbDfbZNlUodtBQlvPMyomStKNhgvSGhSbTdabxGFGGXCdpsJDimsAykKjfBDPMulkhBMsqLmVKLDoesHZsRAEEdEzqigueXInY\ncwfyjoppiJNrjrOLNZkqcGimrpTsiyFBVgMWEPXsMrxLJDDbtYzerXiFGuLBcQYitLdqhGHBpdjRnkUegmnwhGHAKXGyFtscWDSI\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "sSvpcITJAwghVfJaLKBmyjO...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSolve the following coding problem using the programming language python:\n\nWhen little Petya grew up and en...
[{"type": "stdin_stdout", "input": "16 25\nbBZ\nEr\nZ\nrYJmfZLgmx\nPaJNrF\naHtRqSxOO\nD\nhsagsG\nMDuBOXrmWH\nSgjMQZ\nYXgWq\nxDwpppG\nSDY\nJwZWx\ncOzrgrBaE\nFJYX\nYXgWq SgjMQZ\nSDY PaJNrF\nFJYX rYJmfZLgmx\nhsagsG Er\nxDwpppG rYJmfZLgmx\naHtRqSxOO rYJmfZLgmx\nhsagsG bBZ\nJwZWx hsagsG\nFJYX cOzrgrBaE\nSDY YXgWq\nFJYX Z\nJ...
code_stdio