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\nLong ago, Vasily built a good fence at his country house. Vasily calls a fence good, if it is a series of n c...
[{"input": "50\n1 3083990 976356336 922018335 1 170272482 1 547248035 1 1 1 1 1 928379588 1 1 1 270052499 315045369 1 1 556091215 1 655608230 424079072 1 1 185387009 77360256 1 1 942696777 228860271 1 487787709 1 437229749 167886535 1 1 904578415 319694007 1 313704390 1 1 957736320 771147030 458205965 497342117\n", "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\nPhilip's just turned four and he wants to know how old he will be in various years in the future such as 2090...
[{"input": "2010\n1500", "output": "[\"You will be born in 510 years.\"]", "fn_name": "calculate_age"}, {"input": "2000\n1990", "output": "[\"You will be born in 10 years.\"]", "fn_name": "calculate_age"}, {"input": "2000\n2000", "output": "[\"You were born this very year!\"]", "fn_name": "calculate_age"}, {"input": "2...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a string $s$, consisting of $n$ lowercase Latin letters.\n\nA substring of string $s$ is a cont...
[{"input": "25\nbbaaaaabaaaabbabaaaababaa\n", "output": "YES\nba\n"}, {"input": "25\nbbaaaaabaaaabbabaaaababaa\n", "output": "YES\nba\n"}, {"input": "25\nbbaaaaabaaaabbabaaaabab`a\n", "output": "YES\nba\n"}, {"input": "25\nbbaaaaabaaaabbabaaaacab`a\n", "output": "YES\nba\n"}, {"input": "25\na`bacaaaababbaaaabaaaaabb\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\nNot so long ago as a result of combat operations the main Berland place of interest — the magic clock — was d...
[{"input": "1000 -1000\n", "output": "white\n"}, {"input": "0000 -1000\n", "output": "black\n"}, {"input": "-1059 -929\n", "output": "black\n"}, {"input": "-215 -996\n", "output": "black\n"}, {"input": "-496 -644\n", "output": "black\n"}, {"input": "-196 -484\n", "output": "black\n"}, {"input": "-796 -365\n", "output":...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are N slimes lining up in a row. Initially, the i-th slime from the left has a size of a_i.\n\nTaro is ...
[{"input": "3\n1001000000 1000000000 1000000000", "output": "5001000000\n"}, {"input": "3\n1001000000 1000000001 1000000000", "output": "5001000002\n"}, {"input": "3\n1001000000 1010000001 1000000000", "output": "5021000002\n"}, {"input": "3\n1001000000 1010000011 1000000000", "output": "5021000022\n"}, {"input": "3\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\nSeryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (...
[{"input": "7\ni\nam\nont\nmain\nin\nthe\nfamily\n<3i<>3am<3the<3<main<3in<3the<3><3family<3\n", "output": "no\n"}, {"input": "7\ni\nam\nont\nmbin\nin\nthe\nfamily\n<3i<>3am<3the<3<main<3in<3the<3><3family<3\n", "output": "no\n"}, {"input": "7\ni\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\nEverybody knows that the Berland citizens are keen on health, especially students. Berland students are so to...
[{"input": "2000\naabaaabaabababbbbbbabbbbb\n", "output": "0\n"}, {"input": "2000\naabaaabaabababbbbbbabbbbb\n", "output": "0\n"}, {"input": "2000\naaaaaabaabababbbbbbabbbbb\n", "output": "0\n"}, {"input": "2000\naaaaaabaababaabbbbbabbbbb\n", "output": "0\n"}, {"input": "2000\nbbbbbabbbbbaababaabaaaaaa\n", "output": "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 two arrays A and B, each of size n. The error, E, between these two arrays is defined $E = \\su...
[{"input": "22 334 246\n-462653 -618002 4973 -348485 366658 192390 274752 200590 138367 779540 -661269 642587 113645 -110388 -604418 -491231 -933401 -219332 -603140 836439 167007 210226\n357638 -646669 -558432 -434313 -285851 -119233 323088 -512237 -729293 215256 39316 -984201 -209814 715016 -271932 796550 988227 -8957...
code_stdio
[ { "content": "You are an expert Python programmer. 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 simple function that takes polar coordinates (an angle in degrees and a radius) and returns the equiv...
[{"input": "1090\n10000", "output": "[[9848.0775301221, 1736.4817766693]]", "fn_name": "coordinates"}, {"input": "45\n1", "output": "[[0.7071067812, 0.7071067812]]", "fn_name": "coordinates"}, {"input": "-270\n1", "output": "[[0.0, 1.0]]", "fn_name": "coordinates"}, {"input": "90\n1", "output": "[[0.0, 1.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\nA binary tree of n nodes is given. Nodes of the tree are numbered from 1 to n and the root is the node 1. Eac...
[{"input": "50 50\navzqjbotzkdbrhpknuxxcndqnnkfpthvjriridgnocygczqeyy\n3 50\n0 0\n24 47\n0 0\n0 0\n0 36\n0 0\n42 0\n0 0\n0 0\n0 0\n2 9\n40 0\n0 0\n0 0\n0 0\n20 0\n5 0\n11 32\n0 0\n8 30\n0 34\n0 0\n17 21\n0 0\n0 0\n23 38\n15 39\n0 13\n19 0\n0 7\n10 14\n0 0\n4 41\n48 44\n33 27\n29 0\n0 0\n0 37\n0 0\n45 0\n31 25\n0 0\n12 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIahub recently has learned Bubble Sort, an algorithm that is used to sort a permutation with n elements a1, a...
[{"input": "100\n36 48 92 87 28 85 42 10 44 41 39 3 79 9 14 56 1 16 46 35 93 8 82 26 100 59 60 2 96 52 13 98 70 81 71 94 54 91 17 88 33 30 19 50 18 73 65 29 78 21 61 7 99 97 45 89 57 27 76 11 49 72 84 69 43 62 4 22 75 6 66 83 38 34 86 15 40 51 37 74 67 31 20 63 77 80 12 53 5 25 58 90 68 24 64 23 95 32 55 47\n", "output...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere is an infinitely large pond, which we consider as a number line.\nIn this pond, there are N lotuses flo...
[{"input": "11\n0 -4 0 -99 107 13 -43 -39 207 37 0", "output": "271\n"}, {"input": "11\n0 -4 0 -99 31 14 -26 -39 115 29 0", "output": "140\n"}, {"input": "11\n0 -4 0 -99 31 14 -26 -39 115 27 0", "output": "138\n"}, {"input": "11\n0 -4 0 -99 31 14 -26 -39 116 27 0", "output": "139\n"}, {"input": "11\n0 -4 0 -99 59 14 -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\nVasya has n burles. One bottle of Ber-Cola costs a burles and one Bars bar costs b burles. He can buy any non...
[{"input": "10000000\n10000000\n10000000\n", "output": "YES\n0 1\n"}, {"input": "10000000\n10000000\n10000000\n", "output": "YES\n0 1\n"}, {"input": "10000000\n10000100\n10000000\n", "output": "YES\n0 1\n"}, {"input": "10000000\n9999999\n1\n", "output": "YES\n0 10000000\n"}, {"input": "10000000\n1234523\n1\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\nI decided to do bowling as a recreation of the class. Create a program that inputs the pitching information f...
[{"input": "3\n1010 6 3 10 10 1 0 7 9 1 10 6 2 4 3 9 1 9 0\n1200 5 3 9 1 12 1 0 0 12 1 10 10 4 3 9 1 8 2 9\n1101 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n4\n3321 8 2 10 9 1 7 0 10 10 10 0 8 10 10 10 10\n3332 5 0 10 13 1 4 1 9 0 10 10 7 1 5 2 8 1\n3335 10 10 10 10 10 10 10 10 10 10 10 10\n3340 8 2 7 3 0 4 8 2 8 2 14 1 7...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given positive integers N and M.\nHow many sequences a of length N consisting of positive integers sa...
[{"input": "100000 1000000000\n", "output": "957870001\n"}, {"input": "100000 450968417\n", "output": "993000007\n"}, {"input": "100000 654885000\n", "output": "888903730\n"}, {"input": "100000 497668710\n", "output": "999983200\n"}, {"input": "100000 588153930\n", "output": "999983200\n"}, {"input": "100000 380570190\...
code_stdio
[ { "content": "You are an expert Python programmer. 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 huge integer $a$ consisting of $n$ digits ($n$ is between $1$ and $3 \\cdot 10^5$, inclusive)...
[{"input": "3\n0709\n1337\n246432\n", "output": "0079\n1337\n234642\n"}, {"input": "3\n0709\n1337\n246432\n", "output": "0079\n1337\n234642\n"}, {"input": "3\n477\n1337\n246432\n", "output": "477\n1337\n234642\n"}, {"input": "3\n477\n1216\n246432\n", "output": "477\n1126\n234642\n"}, {"input": "3\n716\n1216\n246432\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В Берляндском государственном университете локальная сеть между серверами не всегда работает без ошибок. При ...
[{"input": "wajaubjjlsvvatkrwphykszmkwajaubjjlsvvatkrwphykszmkwajaubjjlsvvatkrwphykszmkwajaubjjlsvvatkrwphykszmk\n", "output": "YES\nwajaubjjlsvvatkrwphykszmkwajaubjjlsvvatkrwphykszmkwajaubjjlsvvatkrwphykszmk\n"}, {"input": "twfflboprkkjobbgoubmybfkbmmconrjhsktwfflboprkkjobbgoubmybfkbmmconrjhsktwfflboprkkjobbgoubmybfkb...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nT is playing a game with his friend, HL.\n\nThere are $n$ piles of stones, the $i$-th pile initially has $a_i...
[{"input": "4\n5\n1 3 1 3 4\n1\n4\n1\n5\n2\n3 3\n", "output": "HL\nT\nT\nHL\n"}, {"input": "4\n5\n1 3 1 3 4\n1\n4\n1\n5\n2\n3 3\n", "output": "HL\nT\nT\nHL\n"}, {"input": "4\n5\n1 3 1 3 4\n1\n4\n1\n4\n2\n3 3\n", "output": "HL\nT\nT\nHL\n"}, {"input": "4\n5\n1 3 1 3 4\n1\n5\n1\n4\n2\n3 3\n", "output": "HL\nT\nT\nHL\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 have written N problems to hold programming contests. The i-th problem will have a score of P_i points if...
[{"input": "8\n3 14\n2 5 10 2 13 12 15 20", "output": "2\n"}, {"input": "8\n3 14\n2 5 10 2 13 12 15 22", "output": "2\n"}, {"input": "8\n3 14\n2 5 5 2 13 12 15 20", "output": "2\n"}, {"input": "8\n3 14\n2 5 6 2 13 12 15 22", "output": "2\n"}, {"input": "8\n3 14\n2 5 3 2 13 12 15 22", "output": "2\n"}, {"input": "7\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\n# RoboScript #2 - Implement the RS1 Specification\n\n## Disclaimer\n\nThe story presented in this Kata Series...
[{"input": "\"FFLFFFLFFFFLFFFFFLFFFFFFLFFFFFFFLFFFFFFFFLFFFFFFFFFLFFFFFFFFFF\"", "output": "[\"********* \\r\\n* * \\r\\n* ***** * \\r\\n* * * * \\r\\n* * * * \\r\\n* * *** * \\r\\n* * * \\r\\n* ******* \\r\\n* \\r\\n***********\"]", "fn_name": "execute"}, {"input": "\"FFFFLFFFFRFFFFRFFFF...
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 a famous olympiad, which has more than a hundred participants. The Olympiad consists of two stages: ...
[{"input": "2\n1 2 2 1\n4 8 12 4\n", "output": "3\n16\n"}, {"input": "2\n1 2 3 1\n4 8 12 4\n", "output": "4\n16\n"}, {"input": "2\n1 2 2 1\n4 8 9 2\n", "output": "3\n12\n"}, {"input": "2\n1 2 2 1\n4 8 9 4\n", "output": "3\n13\n"}, {"input": "2\n1 0 2 1\n4 8 9 4\n", "output": "3\n13\n"}, {"input": "2\n1 2 2 1\n4 8 9 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\nYou are given a string s consisting of |s| small english letters.\n\nIn one move you can replace any characte...
[{"input": "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzabcdefghijklmnopqrstuvwxyzaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"}, {"input": "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...
code_stdio
[ { "content": "You are an expert Python programmer. 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 Ivan the Fool decided to become smarter and study the probability theory. He thinks that he understa...
[{"input": "100000 100000\n", "output": "870472905\n"}, {"input": "100000 100000\n", "output": "870472905\n"}, {"input": "86821 24538\n", "output": "1000000005\n"}, {"input": "99999 100000\n", "output": "758107445\n"}, {"input": "100000 99999\n", "output": "758107445\n"}, {"input": "52702 64157\n", "output": "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\nWrite a program which performs the following operations to a binary search tree $T$ by adding the find operat...
[{"input": "10\ninsert 30\ninsert 100\ninsert 19\ninsert 1\ninsert 16\nfind 13\ninsert 17\ninsert 25\nfind 16\nprint", "output": "no\nyes\n 1 16 17 19 25 30 100\n 30 19 1 16 17 25 100\n"}, {"input": "10\ninsert 30\ninsert 100\ninsert 19\ninsert 1\ninsert 12\nfind 13\ninsert 17\ninsert 25\nfind 16\nprint", "output": "no...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nEverybody know that you passed to much time awake during night time...\n\nYour task here is to define how muc...
[{"input": "[\"cw\", \"CAT\", \"DOG\"]", "output": "[\"You need extra sleep\"]", "fn_name": "how_much_coffee"}, {"input": "[\"cw\", \"CAT\", \"cw=others\"]", "output": "[3]", "fn_name": "how_much_coffee"}, {"input": "[\"cw\", \"CAT\"]", "output": "[3]", "fn_name": "how_much_coffee"}, {"input": "[\"cw\"]", "output": "[1...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWhile Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge b...
[{"input": "2 100\n2 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\n", "output": "Possible\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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\nA chess tournament will be held soon, where $n$ chess players will take part. Every participant will play one...
[{"input": "3\n3\n111\n2\n11\n4\n2122\n", "output": "YES\nX==\n=X=\n==X\nYES\nX=\n=X\nYES\nX=+-\n=X==\n-=X+\n+=-X\n"}, {"input": "3\n3\n111\n1\n1\n4\n2122\n", "output": "YES\nX==\n=X=\n==X\nYES\nX\nYES\nX=+-\n=X==\n-=X+\n+=-X\n"}, {"input": "3\n3\n111\n2\n21\n4\n2122\n", "output": "YES\nX==\n=X=\n==X\nNO\nYES\nX=+-\n=X...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n— Hey folks, how do you like this problem?\n\n— That'll do it. \n\nBThero is a powerful magician. He has got ...
[{"input": "3\n2 2\n2 1\n3 5\n1 3 3\n3 12\n1 2 2\n", "output": "0\n4\n20\n"}, {"input": "3\n2 2\n1 1\n3 10\n1 2 4\n3 7\n3 2 2\n", "output": "1\n14\n4\n"}, {"input": "3\n2 2\n2 1\n3 5\n1 3 3\n3 24\n1 2 2\n", "output": "0\n4\n44\n"}, {"input": "3\n2 2\n1 1\n3 10\n1 3 4\n3 7\n3 2 2\n", "output": "1\n13\n4\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\nCalendars in widespread use today include the Gregorian calendar, which is the de facto international standar...
[{"input": "1900:01:01\n2038:12:31\n", "output": "50768\n"}, {"input": "1903:09:27\n1988:06:15\n", "output": "30943\n"}, {"input": "1915:01:01\n2007:07:01\n", "output": "33784\n"}, {"input": "1925:07:15\n2010:06:22\n", "output": "31023\n"}, {"input": "1986:08:24\n1926:04:13\n", "output": "22048\n"}, {"input": "1932: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\nAs many of you know, we have two major calendar systems used in Japan today. One of them is Gregorian calenda...
[{"input": "4 3\nmeiji 10 1877\ntaisho 6 1917\nrhowa 62 1987\nheisei 22 2010\n2046\n1917\n1988\n1 1\nuniversalbentury 218 2168\n2010\n0 0", "output": "Unknown\ntaisho 6\nUnknown\nuniversalbentury 60\n"}, {"input": "4 3\nmeiji 10 1877\nasisho 6 3102\nsiowa 62 1987\nieisei 25 2010\n526\n2891\n1988\n1 1\nuniversalcentury ...
code_stdio
[ { "content": "You are an expert Python programmer. 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 You are the manager of the famous rescue team: The Knights. Your task is to assign your knights to a...
[{"input": "[1, 1, 1, 1, 1, 1, 1, 1, 1]\n0\n1", "output": "[false]", "fn_name": "knight_rescue"}, {"input": "[1, 2, 3]\n456546\n23532", "output": "[true]", "fn_name": "knight_rescue"}, {"input": "[1, 5, 3, 7, 9]\n7\n8", "output": "[false]", "fn_name": "knight_rescue"}, {"input": "[1, 2]\n1\n0", "output": "[true]", "fn_...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere is a white sheet of paper lying on a rectangle table. The sheet is a rectangle with its sides parallel ...
[{"input": "676584 172869 696986 939949\n217531 247380 771662 973703\n630670 592931 1018961 967883\n", "output": "YES\n"}, {"input": "347722 718484 584813 736820\n280059 317406 1617512 588815\n388486 281361 399827 854715\n", "output": "YES\n"}, {"input": "347722 718484 584813 736820\n280059 317406 997137 588815\n388486...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYour classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two st...
[{"input": "99 54\nfdabegacbffbgcacafcegfaegcacaegdbcabfgaecgbgfgefddggcdgebaaaccbcafdgcceabddfcacgdccfcgebccfffdaccac\nfdabegabffbgcaafcegfgcacaegdbcabfaecgbgfcgbccfffdaccac\n", "output": "40\n"}, {"input": "99 54\nfdabegacbffbgcacafcegfaegcacaegdbcabfgaecgbgfgefddggcdgebaaaccbcafdgcceabddfcacgdccfcgebccfffdaccac\nfda...
code_stdio
[ { "content": "You are an expert Python programmer. 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 three piles of candies: red, green and blue candies: the first pile contains only red candies and t...
[{"input": "6\n2 1 1\n1 1 1\n4 1 2\n7 7 18\n12 1 4\n14 0 13\n", "output": "2\n1\n3\n14\n5\n13\n"}, {"input": "6\n1 1 1\n1 2 1\n4 1 1\n7 7 25\n8 1 4\n14 2 15\n", "output": "1\n2\n2\n14\n5\n15\n"}, {"input": "6\n1 1 1\n1 2 1\n4 1 1\n7 7 25\n8 1 4\n14 2 29\n", "output": "1\n2\n2\n14\n5\n16\n"}, {"input": "6\n1 1 1\n1 2 1\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nProblem\n\nGiven a natural number N less than or equal to 12, find the smallest natural number such that the ...
[{"input": "011", "output": "1024\n"}, {"input": "011", "output": "1024\n"}, {"input": "11", "output": "1024\n"}, {"input": "11", "output": "1024\n"}, {"input": "010", "output": "48\n"}, {"input": "010", "output": "48\n"}, {"input": "10", "output": "48\n"}, {"input": "12", "output": "60\n"}, {"input": "001", "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\nWinnie-the-Pooh likes honey very much! That is why he decided to visit his friends. Winnie has got three best...
[{"input": "100\n100\n100\n100\n", "output": "9900\n"}, {"input": "100\n100\n100\n100\n", "output": "9900\n"}, {"input": "100\n100\n110\n100\n", "output": "9900\n"}, {"input": "100\n100\n111\n100\n", "output": "9900\n"}, {"input": "100\n100\n010\n100\n", "output": "990\n"}, {"input": "73\n136\n69\n66\n", "output": "475...
code_stdio
[ { "content": "You are an expert Python programmer. 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 rabbit is playing a role-playing game. Just before entering the castle, he was ambushed by an enemy!\n\nIt ...
[{"input": "1\n-2 11 -1 -2\n11011 11101 11000 00111", "output": "-1\n"}, {"input": "1\n-2 17 -1 -2\n11011 11101 11000 00111", "output": "-1\n"}, {"input": "1\n-2 17 -1 -2\n11011 11101 11000 00011", "output": "-1\n"}, {"input": "1\n-1 2 -1 -1\n00101 00011 01000 10101", "output": "-1\n"}, {"input": "1\n-1 2 -1 -1\n00101 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nBreaking Good is a new video game which a lot of gamers want to have. There is a certain level in the game th...
[{"input": "13 58\n9 12 0\n8 11 0\n4 8 1\n2 12 1\n9 1 1\n10 6 1\n5 2 1\n3 9 0\n8 3 0\n9 10 0\n8 5 1\n11 3 0\n11 1 0\n2 6 1\n12 3 1\n11 6 0\n1 12 0\n2 1 1\n11 13 0\n6 8 1\n11 5 1\n8 9 0\n1 4 0\n12 7 1\n5 12 0\n11 7 0\n11 2 0\n5 11 1\n9 4 1\n7 5 1\n2 11 0\n13 12 1\n10 3 1\n1 13 0\n7 1 0\n6 3 0\n7 13 0\n4 10 0\n7 10 1\n12...
code_stdio
[ { "content": "You are an expert Python programmer. 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 young boy John is playing with eight triangular panels. These panels are all regular triangles of the same ...
[{"input": "lbeu blue eulb lbud bluf cleu bule bleu\nder fmub blue bleu beul blse blve eulb\nqdd red eulb bleu eula bkue cmue bltd", "output": "1680\n1680\n1680\n"}, {"input": "lbeu blue eulb lbud bluf cleu bule bleu\nder fmub blue uelb beul blse blve eulb\nqdd red eulb bleu eula bkue cmue bltd", "output": "1680\n1680\...
code_stdio
[ { "content": "You are an expert Python programmer. 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 come to a party as a special guest.\nThere are N ordinary guests at the party. The i-th ordinar...
[{"input": "9 73\n67597 102019 5828 66249 138664 64141 11513 192153 16076", "output": "11787970\n"}, {"input": "9 73\n67597 52981 5828 66249 138664 64141 11513 192153 16076", "output": "10905286\n"}, {"input": "9 73\n67597 52981 5828 66249 138664 64141 11513 132567 16076", "output": "9832738\n"}, {"input": "9 73\n67597...
code_stdio
[ { "content": "You are an expert Python programmer. 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 persons called Person 1 through Person N.\nYou are given M facts that \"Person A_i and Person B_i...
[{"input": "4 10\n1 2\n2 1\n1 2\n2 1\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4\n", "output": "4\n"}, {"input": "1 0\n1 1\n1 2\n0 6\n-1 1\n1 4\n0 12\n2 1\n4 3\n2 4\n4 0", "output": "1\n"}, {"input": "1 0\n1 1\n1 2\n0 6\n-1 1\n1 4\n0 12\n2 1\n4 3\n2 4\n7 0", "output": "1\n"}, {"input": "1 0\n1 1\n1 2\n0 6\n-1 1\n1 4\n0 12\n2 1\n4 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\nNian is a monster which lives deep in the oceans. Once a year, it shows up on the land, devouring livestock a...
[{"input": "24 24\n299931317 581208095 975349898 832722683 817690798 482251493 336949323 145902930 573001018 802990442 898055771 253410043 150981561 225791789 53290960 405421751 723296526 565432511 256399554 374970926 22699716 104391316 121063780 149329252\n-295118728 -830122321 -294539299 -905916790 -596056305 -120216...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSoma is a fashionable girl. She absolutely loves shiny stones that she can put on as jewellery accessories. S...
[{"input": "4\nacb\nabcdef\naA\nabAZ\naaa\na\nwhat\nnone", "output": "3\n2\n1\n0\n"}, {"input": "4\nacb\nabcdef\nAa\nabZA\naaa\n`\nwhat\nnone", "output": "3\n2\n0\n0\n"}, {"input": "4\naca\nebcdaf\naA\nAbZa\n`aa\n`\nswha\nnomf", "output": "2\n2\n1\n0\n"}, {"input": "4\nac`\nebcdae\naA\nAbZa\n`aa\n_\nsvha\nnome", "outpu...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nПрофиль горного хребта схематично задан в виде прямоугольной таблицы из символов «.» (пустое пространство) и ...
[{"input": "20 20\n........*...........\n........*........*..\n........*........*..\n.**.....*.......**..\n.**.....*.......**..\n.**.....*.....*.**..\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\n# Task\n`EvilCode` is a game similar to `Codewars`. You have to solve programming tasks as quickly as possibl...
[{"input": "\"00:30:00\"\n\"00:15:00\"\n\"00:45:00\"\n\"01:15:00\"", "output": "[\"Silver\"]", "fn_name": "evil_code_medal"}, {"input": "\"00:10:01\"\n\"00:00:10\"\n\"00:01:40\"\n\"01:00:00\"", "output": "[\"Bronze\"]", "fn_name": "evil_code_medal"}, {"input": "\"03:15:00\"\n\"03:15:00\"\n\"03:15:01\"\n\"03:15:02\"", "...
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\nCaisa solved the problem with the sugar and now he is on the way back to home. \n\nCaisa is playing a mobile ...
[{"input": "99\n1401 2019 1748 3785 3236 3177 3443 3772 2138 1049 353 1195 310 2388 1322 88 2160 2783 435 2248 1471 706 2468 2319 3156 3506 2794 1999 1983 2519 2597 3735 537 344 3519 3772 3872 2961 3895 2010 10 247 3269 671 2986 942 758 1146 77 1545 3745 1547 2250 2565 217 1406 2070 3010 3404 404 1528 2352 138 2065 304...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLet's define the following recurrence: $$a_{n+1} = a_{n} + minDigit(a_{n}) \\cdot maxDigit(a_{n}).$$\n\nHere ...
[{"input": "8\n1 4\n487 1\n487 2\n487 3\n487 4\n487 5\n937 6\n487 1\n", "output": "42\n487\n519\n528\n544\n564\n1000\n487\n"}, {"input": "8\n1 4\n487 1\n487 2\n487 3\n487 4\n487 5\n487 6\n487 10\n", "output": "42\n487\n519\n528\n544\n564\n588\n716\n"}, {"input": "8\n1 4\n487 1\n487 2\n487 3\n487 4\n487 5\n487 6\n487 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\nAlyona decided to go on a diet and went to the forest to get some apples. There she unexpectedly found a magi...
[{"input": "39\n100 110 92 26 10 63 56 85 14 64 25 50 75 51 11 41 78 53 52 96 63 12 48 88 57 57 25 52 69 45 4 97 5 87 58 15 72 59 100\n35 -60\n33 -39\n1 65\n11 -65\n34 -63\n38 84\n4 76\n22 -9\n4 -91\n23 -65\n18 7\n2 -17\n29 -15\n19 26\n29 23\n14 -12\n30 -72\n9 14\n12 -1\n27 -21\n32 -67\n7 -3\n26 -18\n12 -45\n33 75\n14 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a boolean function of three variables which is defined by its truth table. You need to find an ...
[{"input": "5\n01111000\n00110110\n00011000\n01110111\n01010010\n", "output": "!x&(y|z)|!y&!z&x\n!(x&z)&y|!y&x&z\n!x&y&z|!y&!z&x\ny|z\n!x&z|!z&x&y\n"}, {"input": "5\n01111000\n00110110\n00011100\n01110111\n01010010\n", "output": "!x&(y|z)|!y&!z&x\n!(x&z)&y|!y&x&z\n!x&y&z|!y&x\ny|z\n!x&z|!z&x&y\n"}, {"input": "5\n011110...
code_stdio
[ { "content": "You are an expert Python programmer. 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 is an amateur businessman. Recently he was surprised to find out that the market for paper scissor...
[{"input": "1000000000000000000 999999999999999999\n", "output": "999999999999999999\n"}, {"input": "1000010000000000000 999999999999999999\n", "output": "999999999999999999\n"}, {"input": "999999999999999998 999999999999999997\n", "output": "899999999999999999\n"}, {"input": "1365906875851574593 354162450334047\n", "o...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nOnce upon a time, a CodeWarrior, after reading a [discussion on what can be the plural](http://www.codewars.c...
[{"input": "\"6 birds with 2 wings each = 12 legs\"", "output": "[\"6 birdzo with 2 buwing each = 12 galegga\"]", "fn_name": "sursurungal"}, {"input": "\"\\n3 pigs\\nmet 1 wolf\\n2 days ago\"", "output": "[\"\\n3 pigzo\\nmet 1 wolf\\n2 buday ago\"]", "fn_name": "sursurungal"}, {"input": "\"111 bananas\"", "output": "[\...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSnuke is conducting an optical experiment using mirrors and his new invention, the rifle of Mysterious Light....
[{"input": "1435 1", "output": "4302\n"}, {"input": "1556 2", "output": "4662\n"}, {"input": "457 3", "output": "1368\n"}, {"input": "371 4", "output": "1110\n"}, {"input": "702 4", "output": "2100\n"}, {"input": "590 4", "output": "1764\n"}, {"input": "590 1", "output": "1767\n"}, {"input": "843 1", "output": "2526\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\nLet us define the oddness of a permutation p = {p_1,\\ p_2,\\ ...,\\ p_n} of {1,\\ 2,\\ ...,\\ n} as \\sum_{i...
[{"input": "49 1200\n", "output": "366641438\n"}, {"input": "50 1250\n", "output": "472467292\n"}, {"input": "38 716\n", "output": "810790165\n"}, {"input": "31 344\n", "output": "996412950\n"}, {"input": "43 668\n", "output": "484721091\n"}, {"input": "44 350\n", "output": "15060087\n"}, {"input": "17 56\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\nLet w be a string consisting of lowercase letters.\nWe will call w beautiful if the following condition is sa...
[{"input": "abaccaba\n", "output": "Yes\n"}, {"input": "ab`cc`ba", "output": "Yes\n"}, {"input": "ab`ccaba", "output": "No\n"}, {"input": "`b`cc`ba", "output": "No\n"}, {"input": "ab`cc`b`", "output": "No\n"}, {"input": "`b`cc`ca", "output": "No\n"}, {"input": "`b_cc`ca", "output": "No\n"}, {"input": "`b_dc`ca", "outpu...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nDLS and JLS are bored with a Math lesson. In order to entertain themselves, DLS took a sheet of paper and dre...
[{"input": "7\n2\n1000000000 0\n2\n1000000000 0\n2\n1 0\n2\n1000000000 0\n2\n1 0\n2\n1 0\n2\n1000000000 0\n2\n1 0\n1\n999999999\n1\n99999999\n1\n1000000000\n1\n999999999\n3\n1000000000 999999999 999999998\n7\n2 3 5 7 10 11 12\n", "output": "4\n2\n2\n2\n1\n0\n10\n"}, {"input": "7\n2\n1000000000 0\n2\n1000000000 0\n2\n1 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nDreamoon wants to climb up a stair of n steps. He can climb 1 or 2 steps at each move. Dreamoon wants the num...
[{"input": "10000 10\n", "output": "5000\n"}, {"input": "10000 10\n", "output": "5000\n"}, {"input": "24634 6\n", "output": "12318\n"}, {"input": "48898 6\n", "output": "24450\n"}, {"input": "26032 9\n", "output": "13023\n"}, {"input": "20108 9\n", "output": "10062\n"}, {"input": "10000 2\n", "output": "5000\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\nYou are going to eat X red apples and Y green apples.\n\nYou have A red apples of deliciousness p_1,p_2, \\do...
[{"input": "2 2 4 4 4\n11 12 13 14\n21 22 23 24\n1 2 3 4\n", "output": "74\n"}, {"input": "2 4 4 4 4\n11 15 13 14\n21 22 23 22\n1 2 3 4", "output": "117\n"}, {"input": "0 2 4 -1 4\n14 22 13 1\n18 15 31 74\n1 0 2 1", "output": "105\n"}, {"input": "2 2 4 4 4\n11 12 13 14\n21 22 23 22\n1 2 3 4", "output": "72\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\nOnce when Gerald studied in the first year at school, his teacher gave the class the following homework. She ...
[{"input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n99\n", "output": "1\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, {"input": "geovcaxzjyhxbpnbkbsxfpkyofopxquzzxeigdflfumisevzsjdywehxconimkkbvjyxbq...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPolycarp has a string $s[1 \\dots n]$ of length $n$ consisting of decimal digits. Polycarp performs the follo...
[{"input": "6\n8\n20192020\n8\n22019020\n4\n2020\n5\n20002\n6\n729040\n6\n200200\n", "output": "\nYES\nYES\nYES\nNO\nNO\nNO\n"}, {"input": "6\n8\n20192020\n8\n22019020\n4\n2020\n5\n20002\n6\n729040\n6\n200200\n", "output": "YES\nYES\nYES\nNO\nNO\nNO\n"}, {"input": "1\n8\n00202000\n", "output": "NO\n"}, {"input": "1\n8\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPetya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal r...
[{"input": "20 7\n1 4 5 8 47 777777777 1 5 4 8 5 9 5 4 7 4 5 7 7 44474\n", "output": "29172\n"}, {"input": "20 7\n1 2 5 8 47 777777777 1 5 4 8 5 9 5 4 7 4 5 7 7 44474\n", "output": "39468\n"}, {"input": "13 5\n44 44 49 44 44 44 44 44 77 102 66 99 55\n", "output": "111\n"}, {"input": "13 5\n44 44 44 44 44 44 44 44 77 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\nThere are $n$ startups. Startups can be active or acquired. If a startup is acquired, then that means it has ...
[{"input": "50\n36 36 45 44 -1 -1 13 -1 36 -1 44 36 -1 -1 -1 35 -1 36 36 35 -1 -1 -1 14 36 36 22 36 13 -1 35 -1 35 36 -1 -1 13 13 45 36 14 -1 36 -1 -1 -1 22 36 -1 13\n", "output": "949472419\n"}, {"input": "50\n36 36 45 44 -1 -1 13 -1 36 -1 44 36 -1 -1 -1 35 -1 36 36 35 -1 -1 -1 14 36 36 22 36 13 -1 35 -1 35 36 -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\nLittle Johnny has recently learned about set theory. Now he is studying binary relations. You've probably hea...
[{"input": "4000\n", "output": "341934157\n"}, {"input": "3000\n", "output": "949793998\n"}, {"input": "3555\n", "output": "810675957\n"}, {"input": "2999\n", "output": "634360769\n"}, {"input": "3789\n", "output": "397160465\n"}, {"input": "2000\n", "output": "323848720\n"}, {"input": "3333\n", "output": "938772236\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\nToday is Wednesday, the third day of the week. What's more interesting is that tomorrow is the last day of th...
[{"input": "30 of month\n", "output": "11\n"}, {"input": "17 of month\n", "output": "12\n"}, {"input": "10 of month\n", "output": "12\n"}, {"input": "11 of month\n", "output": "12\n"}, {"input": "12 of month\n", "output": "12\n"}, {"input": "13 of month\n", "output": "12\n"}, {"input": "14 of month\n", "output": "12\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 sightseeing spots on the x-axis, numbered 1, 2, ..., N. Spot i is at the point with coordinate A_...
[{"input": "6\n-168 -101 -3258 1873 -20088 -2101", "output": "50438\n50438\n44258\n40310\n14598\n50572\n"}, {"input": "6\n-168 -101 -3258 1873 -20088 -1768", "output": "50438\n50438\n44258\n40310\n13932\n50572\n"}, {"input": "6\n-679 -3431 -3258 3095 -3291 -4462", "output": "21976\n21630\n21976\n9270\n21976\n19634\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\nAndrewid the Android is a galaxy-famous detective. He is now investigating a case of frauds who make fake cop...
[{"input": "100\n15 86 17 88 19 90 21 92 23 94 25 96 27 98 29 0 31 2 33 4 35 6 37 8 39 10 41 12 43 14 45 16 47 18 49 20 51 22 53 24 55 26 57 28 59 30 61 32 63 34 65 36 67 38 69 40 71 42 73 44 75 46 77 48 79 50 81 52 83 54 85 56 87 58 89 60 91 62 93 64 95 66 97 68 99 70 1 72 3 74 5 76 7 78 9 80 11 82 13 84\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\nGerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all ...
[{"input": "1000000 1000000\n1000000 999999\n1000000 999998\n999999 1000000\n999999 999998\n999998 1000000\n999998 999999\n999998 999998\n", "output": "respectable\n"}, {"input": "1000000 1000000\n1000000 999999\n1000000 999998\n999999 1000000\n999999 999998\n999998 1000000\n999998 999999\n999998 999998\n", "output": "...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are $n$ lamps on a line, numbered from $1$ to $n$. Each one has an initial state off ($0$) or on ($1$)....
[{"input": "19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n", "output": "0\n1\n1\n1\n2\n2\n2\n3\n3\n3\n3\n4\n4\n4\n4\n4\n4\n4\n5\n"}, {"input": "19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n", "output": "0\n1\n1\n1\n2\n2\n2\n3\n3\n3\n3\n4\n4\n4\n4\n4\n4\n4\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\nConsider some square matrix A with side n consisting of zeros and ones. There are n rows numbered from 1 to n...
[{"input": "100\n", "output": "15"}, {"input": "010\n", "output": "5\n"}, {"input": "001\n", "output": "1\n"}, {"input": "011\n", "output": "5\n"}, {"input": "61\n", "output": "11"}, {"input": "98\n", "output": "15"}, {"input": "84\n", "output": "13"}, {"input": "43\n", "output": "11"}, {"input": "60\n", "output": "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\nYou are given a binary matrix $A$ of size $n \\times n$. Let's denote an $x$-compression of the given matrix ...
[{"input": "16\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\n", "output": "2\n"}, {"input": "16\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFD0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\n", "output": "1\n"}, {"input": "16\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFD0\nFFC0...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nMasha works in an advertising agency. In order to promote the new brand, she wants to conclude contracts with...
[{"input": "3\n4 3\n1 3 1 2\n4 2\n1 1 1 1\n2 1\n1 2\n", "output": "\n2\n6\n1\n"}, {"input": "3\n4 3\n1 3 1 2\n4 2\n1 1 1 1\n2 1\n1 2\n", "output": "2\n6\n1\n"}, {"input": "3\n4 3\n1 3 1 2\n4 2\n1 2 1 1\n2 1\n1 2\n", "output": "2\n3\n1\n"}, {"input": "3\n4 3\n1 3 1 2\n4 2\n1 1 1 1\n2 1\n2 2\n", "output": "2\n6\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\nFor this exercise you will create a global flatten method. The method takes in any number of arguments and fl...
[{"input": "[\"hello\", 2, [\"text\", [4, 5]]]\n[[]]\n\"[list]\"", "output": "[[\"hello\", 2, \"text\", 4, 5, \"[list]\"]]", "fn_name": "flatten"}, {"input": "[4, \"string\", 9, 3, 1]\n[]\n[]\n[]\n[]\n[\"string\"]", "output": "[[4, \"string\", 9, 3, 1, \"string\"]]", "fn_name": "flatten"}, {"input": "[1, 2]\n[3, 4, 5]\...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nVasya and Petya are playing a simple game. Vasya thought of number x between 1 and n, and Petya tries to gues...
[{"input": "1000\n", "output": "193\n2 4 8 16 32 64 128 256 512 3 9 27 81 243 729 5 25 125 625 7 49 343 11 121 13 169 17 289 19 361 23 529 29 841 31 961 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 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\nThe blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount o...
[{"input": "100 17\n20 61 7 74 87 84 87 35 64 7 36 5 72 20 62 29 29 58 67 51 50 45 82 20 76 79 39 21 5 39 94 13 65 11 3 21 26 2 15 56 20 75 49 27 64 48 51 96 32 80 57 10 57 48 36 83 51 25 45 65 24 22 3 92 45 52 52 58 15 90 23 43 56 88 46 50 72 70 60 47 91 68 40 24 16 44 82 90 17 17 51 71 25 94 13 42 26 25 53 95\n", "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\nRelated to MrZizoScream's Product Array kata. You might want to solve that one first :)\n\n```if:javascript\n...
[{"input": "[4, 7, 3, 6, 2, 11, 14, 4, 7, 5]", "output": "[[5433120, 3104640, 7244160, 3622080, 10866240, 1975680, 1552320, 5433120, 3104640, 4346496]]", "fn_name": "product_sans_n"}, {"input": "[3, 14, 9, 11, 11]", "output": "[[15246, 3267, 5082, 4158, 4158]]", "fn_name": "product_sans_n"}, {"input": "[-8, 1, 5, 13, -...
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\nSolve the mystery. \nInput:\nString which consists of words(all the characters of any word are lower case le...
[{"input": "890\n*a\na*\n*abbax\nhello *lleh\nhe.llo!ol?*eh.\namy, must i jujitsu *y ma?\nbbmqbhc*bqmbb\nrzowkkyhhykkwoz*\ndqscdxr*dcsqd\now*o\nxsjybldbefsarcbynecdyggxxpklorelerolkpxxggydcenybcrasfebdlbyj*x\nmpp*\nqfwkhopkmcoqhnwnkuewhsqmgbbuqcljjjl*qubbgmqshweuknwnhqocmkpohkwfq\nswmdkqtbxixmvtrrbljptnsnfw*fnsntpjlbrr...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWrite a program which reads a rectangle and a circle, and determines whether the circle is arranged inside th...
[{"input": "-2 -1 0 10 -18", "output": "Yes\n"}, {"input": "-2 -1 0 11 -18", "output": "Yes\n"}, {"input": "-2 1 3 10 -18", "output": "Yes\n"}, {"input": "-2 0 3 10 -18", "output": "Yes\n"}, {"input": "-2 0 0 10 -18", "output": "Yes\n"}, {"input": "-2 -1 0 6 -18", "output": "Yes\n"}, {"input": "-3 -1 0 6 -18", "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\nLet's consider one interesting word game. In this game you should transform one word into another through spe...
[{"input": "dkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjij\ndddkikjjidkkidijjjjkkjjikjdikiidijjikikjijjiijdikkjjjiddjjijkkkjkiijijkijdjjikikdjjjijdddjkjjdij...
code_stdio
[ { "content": "You are an expert Python programmer. 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 to write a function to transpose a guitar tab up or down a number of semitones. The amount to transpo...
[{"input": "2\n[\"e|-----------------------------------------------------------------------------|\", \"B|---------------------------8-----------------------8-------------------------|\", \"G|-------------------------7-----------------------7---------------------------|\", \"D|----8-----8-----8----8/9-------7-7/5-0----...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn the computer network of the Berland State University there are n routers numbered from 1 to n. Some pairs ...
[{"input": "10\n2:7,4-2:5,8-1:3-1:6-1:2-2:10,9\n9:6,7,3,4,10,8,9,5,1\n9:2,1,7,6,9,4,8,10,5\n8:5,2,1,3,6,9,10,8-1:7\n1:8-8:9,10,2,6,3,1,7,4\n9:8,4,1,2,10,9,7,3,5\n9:1,3,6,2,9,10,5,8,4\n9:5,2,7,3,6,4,10,1,9\n9:3,7,6,8,10,5,1,2,4\n1:9-8:2,7,3,6,8,5,1,4\n", "output": "9\n1 2\n1 3\n1 4\n1 5\n1 6\n1 10\n4 7\n5 8\n9 10\n"}, {...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nZS the Coder and Chris the Baboon has arrived at Udayland! They walked in the park where n trees grow. They d...
[{"input": "8 6 6\n0 0 0 0 0 0 0 0\n709812879 751993522 552838834 932579085 381597201 889756688\n77223016 35398130 932703875 852137134 124534767 472656085\n828677108 158247840 540181954 573979204 389860841 490718346\n666733838 404533406 50010075 311518758 460372535 69832342\n591244215 400838850 867732307 113910196 4459...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nMashmokh works in a factory. At the end of each day he must turn off all of the lights. \n\nThe lights on the...
[{"input": "100 100\n100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 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\n", "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\nVasily exited from a store and now he wants to recheck the total price of all purchases in his bill. The bill...
[{"input": "amhppqxei543.370.32o544.196nocwgxticn776.562nm212.195dcftrrg635.773n646.814.94vrfmjjsgoi405.114k821.983.12rb749.955.62jifmdlgs615.101hg42.083.41gdqififg908.729qrrgopyn684.451avcjul727.150s864.068bcd196.732.37jd349.984.25ghn379.763.11dw881.650.19eysthrm790.534.68gilg546.048qs648.876pdudevipn986.325jcwqq376.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\nRecenlty Luba got a credit card and started to use it. Let's consider n consecutive days Luba uses the card.\...
[{"input": "20 23036\n-1 1 -1 -1 -1 -1 1 -1 -1 0 0 1 1 0 -1 1 0 1 -1 -1\n", "output": "1\n"}, {"input": "20 23036\n-1 1 -1 -1 -1 -1 1 -1 -2 0 0 1 1 0 -1 1 0 1 -1 -1\n", "output": "1\n"}, {"input": "20 23036\n-1 1 -1 -1 -1 -1 1 -1 -2 0 0 1 1 0 -1 1 1 1 -1 -1\n", "output": "1\n"}, {"input": "20 23036\n-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\nThis is the easy version of the problem. The difference between the versions is the constraints on a_i. You c...
[{"input": "5 7\n#....#.\n.#.#...\n#....#.\n#....##\n#.#....\n4 1 1 1 0 3 1\n", "output": "\n3\n"}, {"input": "3 10\n#..###..##\n...#..###.\n.###..##..\n1 1 1 3 1 1 2 2 2 1\n", "output": "1\n"}, {"input": "3 6\n..#..#\n......\n#####.\n1 1 2 1 1 1\n", "output": "2\n"}, {"input": "3 3\n#.#\n#..\n##.\n3 1 1\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\nSome numbers have funny properties. For example:\n\n> 89 --> 8¹ + 9² = 89 * 1\n\n> 695 --> 6² + 9³ + 5⁴= 1390...
[{"input": "10383\n6", "output": "[12933]", "fn_name": "dig_pow"}, {"input": "3456789\n1", "output": "[-1]", "fn_name": "dig_pow"}, {"input": "3456789\n5", "output": "[-1]", "fn_name": "dig_pow"}, {"input": "2646798\n1", "output": "[1]", "fn_name": "dig_pow"}, {"input": "46288\n3", "output": "[51]", "fn_name": "dig_pow...
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\nGiven two arrays of integers `m` and `n`, test if they contain *at least* one identical element. Return `true...
[{"input": "[-2398632, -9172846, -4728162]\n[-2398632, -9235623, -8235492]", "output": "[true]", "fn_name": "duplicate_elements"}, {"input": "[2398632, 9172846, 4728162]\n[2398632, 9235623, 8235492]", "output": "[true]", "fn_name": "duplicate_elements"}, {"input": "[-2, -4, -6, -8]\n[-2, -3, -5, -7]", "output": "[true]...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nVasya has a sequence $a$ consisting of $n$ integers $a_1, a_2, \\dots, a_n$. Vasya may pefrom the following o...
[{"input": "5\n1000000000000000000 352839520853234088 175235832528365792 753467583475385837 895062156280564685\n", "output": "3\n"}, {"input": "5\n1000000000000000000 352839520853234088 175235832528365792 753467583475385837 895062156280564685\n", "output": "3\n"}, {"input": "4\n1 2 1 16\n", "output": "4\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\nE-training\n\nNene is writing a program to look up $ N $ integers $ V_1, V_2, V_3, \\ cdots, V_N $ for progra...
[{"input": "150 1 -12 -2", "output": "159\n"}, {"input": "150 1 -11 -2", "output": "158\n"}, {"input": "150 2 -11 -2", "output": "157\n"}, {"input": "150 2 -21 -2", "output": "167\n"}, {"input": "150 2 -19 -2", "output": "165\n"}, {"input": "150 2 -28 -2", "output": "174\n"}, {"input": "150 2 -39 -2", "output": "185\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 two arrays $a$ and $b$, each contains $n$ integers.\n\nYou want to create a new array $c$ as fo...
[{"input": "5\n-999999999 999999999 1252085585 999999998 -414067761\n-1011239935 -1000000000 -1000000000 -1397885361 1010000000\n", "output": "1\n"}, {"input": "5\n-999999999 999999999 1252085585 999999998 -421666581\n-1011239935 -1000000000 -1000000000 -1397885361 1010000000\n", "output": "1\n"}, {"input": "5\n-999999...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nDeoxyribonucleic acid (DNA) is a chemical found in the nucleus of cells and carries the \"instructions\" for ...
[{"input": "\"GTATCGATCGATCGATCGATTATATTTTCGACGAGATTTAAATATATATATATACGAGAGAATACAGATAGACAGATTA\"", "output": "[\"CATAGCTAGCTAGCTAGCTAATATAAAAGCTGCTCTAAATTTATATATATATATGCTCTCTTATGTCTATCTGTCTAAT\"]", "fn_name": "DNA_strand"}, {"input": "\"ATTGC\"", "output": "[\"TAACG\"]", "fn_name": "DNA_strand"}, {"input": "\"AAAA\"", "...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n```if:javascript\n`Array.prototype.length` will give you the number of top-level elements in an array.\n```\n...
[{"input": "[[[[[[[[[\"Everybody!\"]]]]]]]]]", "output": "[9]", "fn_name": "deep_count"}, {"input": "[\"cat\", [[\"dog\"]], [\"[bird]\"]]", "output": "[6]", "fn_name": "deep_count"}, {"input": "[1, 2, [3, 4, [5]]]", "output": "[7]", "fn_name": "deep_count"}, {"input": "[[[[[[[[[]]]]]]]]]", "output": "[8]", "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\nYou are given $n$ dominoes. Each domino has a left and a right cell. Each cell can be colored either black or...
[{"input": "100\n??\n??\n??\nB?\n??\nB?\n??\n?W\n?B\n??\n??\n??\n??\nWB\n??\nBW\n?B\nB?\nW?\nW?\nB?\n??\n??\n??\n??\n??\n??\nBB\n??\nWB\n?W\nBB\n??\n??\nW?\nB?\n?W\n?B\nW?\n??\n?W\n??\n??\nB?\nB?\n??\n??\n??\n?W\n??\n??\n?W\n?W\nW?\n??\n??\n??\n?W\nW?\nW?\n?W\nB?\n??\n??\n??\nB?\n??\n??\n??\n??\n??\nBB\n?B\nBW\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\nA daily train consists of N cars. Let's consider one particular car. It has 54 places numbered consecutively ...
[{"input": "1 3\n100101110000001011000001111110010011110010010111000101\n001010000000101111100000000000000111101010101111111010\n011110011110000001010000101110001011111010001001111010", "output": "86\n"}, {"input": "1 3\n100101110000001111000001111110010011110010010111000101\n0010100000001011111000000000000001111010101...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSerge came to the school dining room and discovered that there is a big queue here. There are $m$ pupils in t...
[{"input": "5 1\n8 4 8 7 3\n9\n5\n2 1 3\n1 5 1\n2 1 13\n2 1 7\n2 1 3\n", "output": "8\n8\n8\n8\n8\n"}, {"input": "5 1\n8 4 8 7 3\n13\n5\n2 1 3\n1 1 1\n2 1 8\n2 1 7\n2 1 3\n", "output": "8\n8\n7\n8\n8\n"}, {"input": "5 1\n8 1 8 7 3\n9\n5\n2 1 3\n1 5 1\n2 1 13\n2 1 7\n2 1 3\n", "output": "8\n8\n8\n8\n8\n"}, {"input": "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\nThere is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and...
[{"input": "67 -89 -90 -11\n", "output": "-168 -168 -11 -246\n"}, {"input": "-100 100 100 -100\n", "output": "300 100 100 300\n"}, {"input": "0 -100 -100 100\n", "output": "-300 0 -200 -200\n"}, {"input": "31 -41 -59 26\n", "output": "-126 -64 -36 -131\n"}, {"input": "1 -46 -103 12", "output": "-161 -92 -57 -150\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 sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\n* For ea...
[{"input": "6\n105 119 204 119 105 119", "output": "1\n"}, {"input": "6\n105 119 204 119 105 78", "output": "2\n"}, {"input": "6\n105 119 105 81 105 119", "output": "1\n"}, {"input": "6\n105 119 204 119 105 81", "output": "2\n"}, {"input": "6\n105 119 105 119 105 119", "output": "0"}, {"input": "6\n105 120 54 119 105 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\nWrite a function that takes an integer and returns an array `[A, B, C]`, where `A` is the number of multiples...
[{"input": "91415", "output": "[[24377, 12188, 6094]]", "fn_name": "solution"}, {"input": "2020", "output": "[[539, 269, 134]]", "fn_name": "solution"}, {"input": "1415", "output": "[[377, 188, 94]]", "fn_name": "solution"}, {"input": "300", "output": "[[80, 40, 19]]", "fn_name": "solution"}, {"input": "141", "output":...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe Patisserie AtCoder sells cakes with number-shaped candles.\nThere are X, Y and Z kinds of cakes with 1-sh...
[{"input": "1000 1000 1000 3000\n8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 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\nYour favorite shop sells n Kinder Surprise chocolate eggs. You know that exactly s stickers and exactly t toy...
[{"input": "4\n1 1 1\n1000000000 1000000000 1000000000\n1000000000 999999999 1\n1247516660 666666667 666666666\n", "output": "1\n1\n1000000000\n580849995\n"}, {"input": "4\n1 1 1\n1000000000 1000000000 1000000000\n1000000000 999999999 1\n999999999 666666667 666666666\n", "output": "1\n1\n1000000000\n333333334\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\nThe Squareland national forest is divided into equal 1 × 1 square plots aligned with north-south and east-wes...
[{"input": "0 1000\n1000 0\n1000 1000\n", "output": "2001\n0 1000\n1 1000\n2 1000\n3 1000\n4 1000\n5 1000\n6 1000\n7 1000\n8 1000\n9 1000\n10 1000\n11 1000\n12 1000\n13 1000\n14 1000\n15 1000\n16 1000\n17 1000\n18 1000\n19 1000\n20 1000\n21 1000\n22 1000\n23 1000\n24 1000\n25 1000\n26 1000\n27 1000\n28 1000\n29 1000\n3...
code_stdio