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\nYou are given a sequence of N integer numbers A. Calculate the sum of A_{i} AND A_{j} for all the pairs (i, j...
[{"input": "5\n2 14 11 2 0", "output": "20\n"}, {"input": "5\n13 2 12 4 2", "output": "22\n"}, {"input": "5\n11 1 29 8 2", "output": "29\n"}, {"input": "5\n4 2 5 15 12", "output": "35\n"}, {"input": "5\n4 2 5 28 12", "output": "32\n"}, {"input": "5\n2 3 11 6 9", "output": "23\n"}, {"input": "5\n2 3 11 9 9", "output": "...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe only difference between easy and hard versions is that you should complete all the projects in easy versi...
[{"input": "50 15000\n142 -300\n20 -298\n560 -300\n1815 -292\n282 -297\n92 -293\n34 -284\n555 -299\n408 -293\n504 -284\n278 -284\n139 -291\n64 -298\n311 -293\n130 -293\n89 -298\n129 -294\n385 -295\n136 -288\n41 -293\n112 -290\n416 -295\n178 -294\n154 -300\n110 -300\n346 -299\n209 -294\n1394 -295\n209 -299\n16 -297\n592...
code_stdio
[ { "content": "You are an expert Python programmer. 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 string is a palindrome if it reads the same from the left to the right and from the right to the left. For ...
[{"input": "wobervhvvkihcuyjtmqhaaigvvgiaahqmtjyuchikvvhvrebow\n", "output": "49\n"}, {"input": "wobervhvvkihcuyjtmqhaaigvahheoqleromusrartldojsjvy\n", "output": "50\n"}, {"input": "wobervhvvkihcuyjtmqhaaigvvgiaahqmtjyuchikvvhvrebow\n", "output": "49\n"}, {"input": "wobervhvvkihcuyjtmqhaaigvahheoqleromusrartldojsjvy\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Есть n-подъездный дом, в каждом подъезде по m этажей, и на каждом этаже каждого подъезда ровно k квартир. Так...
[{"input": "1000 1000 1000\n1000000000 990000001\n", "output": "1144\n"}, {"input": "491 980 907\n253658701 421137262\n", "output": "3985\n"}, {"input": "200 970 827\n113595903 145423943\n", "output": "1484\n"}, {"input": "841 727 726\n101540521 305197765\n", "output": "6264\n"}, {"input": "727 645 804\n101269988 37448...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThey say \"years are like dominoes, tumbling one after the other\". But would a year fit into a grid? I don't...
[{"input": "7 39\n.......................................\n.###..###..#..###.....###..###..#..###.\n...#..#.#..#..#.........#..#.#..#..#...\n.###..#.#..#..###.....###..#.#..#..###.\n.#....#.#..#....#.....#....#.#..#..#.#.\n.###..###..#..###.....###..###..#..###.\n.......................................\n6\n1 1 3 20\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\nFor a given weighted directed graph G(V, E), find the distance of the shortest route that meets the following...
[{"input": "2 -1\n-1 2 8\n-1 15 4\n-1 0 12\n1 -2 3\n-1 0 4\n3 -1 1", "output": "-1\n"}, {"input": "2 -1\n-1 2 8\n-1 10 4\n-1 0 12\n1 -2 3\n-1 0 4\n3 -1 1", "output": "-1\n"}, {"input": "2 -1\n-1 2 8\n-1 10 4\n-1 0 12\n1 -2 3\n-1 0 4\n3 -1 2", "output": "-1\n"}, {"input": "2 -1\n-1 2 8\n-1 10 2\n-1 0 12\n1 -2 3\n-1 0 4\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given N positive integers a_1, a_2, ..., a_N.\nFor a non-negative integer m, let f(m) = (m\\ mod\\ a_...
[{"input": "3000\n68281 84761 81533 73757 80783 82723 93949 79397 68399 85061 99103 81671 82231 90073 83639 82813 68389 92767 94999 69931 85087 99487 72893 72269 76129 77719 69313 74471 96911 89917 98713 87011 66359 96479 88427 95873 97987 89021 75133 73189 83791 68483 75329 78929 99787 87181 75011 87281 75149 94889 76...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSquirrel Liss lived in a forest peacefully, but unexpected trouble happens. Stones fall from a mountain. Init...
[{"input": "rrlllrrrlrrlrrrlllrlrlrrrlllrllrrllrllrrlrlrrllllrlrrrrlrlllrlrrrlrlrllrlrlrrlrrllrrrlrlrlllrrllllrl\n", "output": "1\n2\n6\n7\n8\n10\n11\n13\n14\n15\n19\n21\n23\n24\n25\n29\n32\n33\n36\n39\n40\n42\n44\n45\n50\n52\n53\n54\n55\n57\n61\n63\n64\n65\n67\n69\n72\n74\n76\n77\n79\n80\n83\n84\n85\n87\n89\n93\n94\n9...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPolycarp is mad about coding, that is why he writes Sveta encoded messages. He calls the median letter in a w...
[{"input": "501\noilesjbgowlnayckhpoaitijewsyhgavnthycaecwnvzpxgjqfjyxnjcjknvvsmjbjwtcoyfbegmnnheeamvtfjkigqoanhvgdfrjchdqgowrstlmrjmcsuuwvvoeucfyhnxivosrxblfoqwikfxjnnyejdiihpenfcahtjwcnzwvxxseicvdfgqhtvefswznuyohmmljlnxubhevywpmnitnkhecsgccpstxkmdzabsnwxkokdfsogzbpnfvgudvqlstxojzfzugxbfrozveaiofrzksegdelxsdhcjlqwqlgj...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTakahashi has N cards. The i-th of these cards has an integer A_i written on it.\nTakahashi will choose an in...
[{"input": "5\n1 2 3 4 5\n", "output": "5\n2\n1\n1\n1\n"}, {"input": "5\n1 2 3 3 5", "output": "5\n2\n1\n1\n0\n"}, {"input": "5\n2 2 3 3 5", "output": "5\n2\n1\n0\n0\n"}, {"input": "5\n4 2 2 4 4", "output": "5\n2\n0\n0\n0\n"}, {"input": "5\n4 4 5 4 4", "output": "5\n1\n0\n0\n0\n"}, {"input": "5\n5 1 2 3 4", "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 k sensors located in the rectangular room of size n × m meters. The i-th sensor is located at point...
[{"input": "11 17 10\n1 8\n1 7\n2 3\n3 2\n4 8\n5 3\n2 15\n8 6\n6 3\n3 1\n", "output": "-1\n109\n-1\n-1\n26\n71\n-1\n74\n-1\n69\n"}, {"input": "10 17 10\n1 8\n1 7\n2 3\n7 2\n4 8\n10 3\n2 8\n8 6\n6 3\n3 1\n", "output": "-1\n41\n-1\n-1\n76\n-1\n42\n28\n-1\n103\n"}, {"input": "11 17 10\n1 8\n1 7\n0 3\n3 2\n4 8\n5 3\n2 15\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\nCalvin the robot lies in an infinite rectangular grid. Calvin's source code contains a list of n commands, ea...
[{"input": "200\nUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUD\n", "output": "10000\n"}, {"input": "200\nDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDU...
code_stdio
[ { "content": "You are an expert Python programmer. 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 an array $a$ of length $n$ with elements numbered from $1$ to $n$. It is possible to remove the $i$-...
[{"input": "1337 424242424242\n", "output": "119112628\n"}, {"input": "300000 1000000000\n", "output": "590856313\n"}, {"input": "2 1000000000000\n", "output": "138131255\n"}, {"input": "17957 2\n", "output": "653647969\n"}, {"input": "300000 1\n", "output": "299999\n"}, {"input": "4 6\n", "output": "1494\n"}, {"input"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted heigh...
[{"input": "190877881 20\n3 100000000\n14 100000000\n22 100000000\n24 100000000\n31 100000000\n41 100100000\n46 100000000\n84 100000000\n94 100000000\n98 100000000\n99999912 100000000\n99999915 100000000\n99999916 100000000\n99999923 100000000\n99999935 100000000\n99999937 100000000\n99999954 100000000\n99999955 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\nWe have a sequence A of N non-negative integers.\nCompute the sum of \\prod _{i = 1} ^N \\dbinom{B_i}{A_i} ov...
[{"input": "2000 4000001\n2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000...
code_stdio
[ { "content": "You are an expert Python programmer. 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 when given a URL as a string, parses out just the domain name and returns it as a strin...
[{"input": "\"http://www.codewars.com/kata/\"", "output": "[\"codewars\"]", "fn_name": "domain_name"}, {"input": "\"https://hyphen-site.org\"", "output": "[\"hyphen-site\"]", "fn_name": "domain_name"}, {"input": "\"http://codewars.com\"", "output": "[\"codewars\"]", "fn_name": "domain_name"}, {"input": "\"https://youtu...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are n vertical lines in the Amidakuji. This Amidakuji meets the following conditions.\n\n* Draw a horiz...
[{"input": "5\n2\n3\n9\n1010\n1001\n0100\n1001\n0010\n1000\n0000\n0101\n1010\n0", "output": "6 4\n"}, {"input": "5\n2\n3\n9\n1010\n1001\n1000\n1001\n0010\n1000\n0000\n0101\n1001\n0", "output": "5 1\n"}, {"input": "5\n2\n3\n9\n1010\n0001\n0000\n1001\n0010\n1000\n0000\n0101\n1001\n0", "output": "2 1\n"}, {"input": "5\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\nA dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo stri...
[{"input": "200\n2 1 1 2 1 2 2 2 2 2 1 2 2 1 1 2 2 1 1 1 2 1 1 2 2 2 2 2 1 1 2 1 2 1 1 2 1 1 1 1 2 1 2 2 1 2 1 1 1 2 1 1 1 2 2 2 1 1 1 1 2 2 2 1 2 2 2 1 2 2 2 1 2 1 2 1 2 1 1 1 1 2 2 2 1 1 2 1 2 1 2 1 2 2 1 1 1 2 2 2 2 1 2 2 2 1 1 1 1 2 1 1 1 2 2 1 2 1 2 2 2 1 2 1 2 1 2 1 2 2 2 1 2 2 2 1 1 1 1 2 1 2 1 1 1 2 1 2 2 2 1 2...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a range of positive integers from $l$ to $r$.\n\nFind such a pair of integers $(x, y)$ that $l ...
[{"input": "3\n6969 696969\n11103 49805\n6969 696969\n", "output": "6969 13938\n11103 22206\n6969 13938\n"}, {"input": "3\n9989 359575\n11103 49805\n6969 253442\n", "output": "9989 19978\n11103 22206\n6969 13938\n"}, {"input": "3\n6787 359575\n11103 49805\n6969 465579\n", "output": "6787 13574\n11103 22206\n6969 13938\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThroughout Igor K.'s life he has had many situations worthy of attention. We remember the story with the viru...
[{"input": "446237720 920085248 296916273 439113596\n", "output": "1\n"}, {"input": "491259590 529594367 305425951 326414536\n", "output": "1\n"}, {"input": "733405771 1387069059 19971607 389270995\n", "output": "1\n"}, {"input": "446237720 920085248 296916273 296925221\n", "output": "1\n"}, {"input": "733405771 830380...
code_stdio
[ { "content": "You are an expert Python programmer. 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 the function p(x), where x is an array of m integers, which returns an array y consisting of m + 1 i...
[{"input": "4 1000000000000000000\n612929642 983621174 279363954 332455288\n", "output": "2137\n"}, {"input": "4 1000000000000000000\n612929642 983621174 279363954 332455288\n", "output": "2137\n"}, {"input": "4 1000000000000000000\n612929642 983621174 97116392 332455288\n", "output": "2137\n"}, {"input": "18 100000000...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou have a string $s$ of length $n$ consisting of only characters > and <. You may do some operations with th...
[{"input": "14\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n<\n", "output": "0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n"}, {"input": "14\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n<\n", "output": "0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\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\nVitaly is a diligent student who never missed a lesson in his five years of studying in the university. He al...
[{"input": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyzyyyyyyyyyyyyyyyyyyyyyy\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\n", "output": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyzyyyyyyyyyyyy...
code_stdio
[ { "content": "You are an expert Python programmer. 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 wrote all your unit test names in camelCase.\nBut some of your colleagues have troubles reading these lon...
[{"input": "\"_IfATestStartAndEndsWithUnderscore_ItShouldBeTheSame_\"", "output": "[\"_If_A_Test_Start_And_Ends_With_Underscore_It_Should_Be_The_Same_\"]", "fn_name": "toUnderScore"}, {"input": "\"ThisShouldBeSplittedCorrectIntoUnderscore\"", "output": "[\"This_Should_Be_Splitted_Correct_Into_Underscore\"]", "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\nVasya, or Mr. Vasily Petrov is a dean of a department in a local university. After the winter exams he got hi...
[{"input": "92 3\n418\n665\n861\n766\n529\n416\n476\n676\n561\n995\n415\n185\n291\n176\n776\n631\n556\n488\n118\n188\n437\n496\n466\n131\n914\n118\n766\n365\n113\n897\n386\n639\n276\n946\n759\n169\n494\n837\n338\n351\n783\n311\n261\n862\n598\n132\n246\n982\n575\n364\n615\n347\n374\n368\n523\n132\n774\n161\n552\n492\n59...
code_stdio
[ { "content": "You are an expert Python programmer. 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 would like to get the 'weight' of a name by getting the sum of the ascii values. However you believe that...
[{"input": "\"George Washington\"", "output": "[1275]", "fn_name": "get_weight"}, {"input": "\"King George II\"", "output": "[1012]", "fn_name": "get_weight"}, {"input": "\"Billy Bob Joe\"", "output": "[909]", "fn_name": "get_weight"}, {"input": "\"r2d2\"", "output": "[150]", "fn_name": "get_weight"}, {"input": "\"R2D2...
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\nDo you know that The Chef has a special interest in palindromes? Yes he does! Almost all of the dishes in his...
[{"input": "5\n1\n2\n15\n10\n100", "output": "26\n52\n533228165\n24713260\n508533804\n"}, {"input": "5\n1\n1\n15\n10\n100", "output": "26\n26\n533228165\n24713260\n508533804\n"}, {"input": "5\n1\n2\n8\n10\n110", "output": "26\n52\n950508\n24713260\n316452997\n"}, {"input": "5\n1\n2\n8\n10\n100", "output": "26\n52\n9505...
code_stdio
[ { "content": "You are an expert Python programmer. 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 chef has just been introduced to the world of numbers! While experimenting with addition and multiplic...
[{"input": "2\n3\n3 16 10\n4\n1 1 0 1", "output": "3\n0\n"}, {"input": "2\n3\n3 8 10\n4\n1 1 0 -1", "output": "3\n0\n"}, {"input": "2\n3\n3 16 10\n4\n0 1 0 1", "output": "3\n0\n"}, {"input": "2\n3\n3 16 10\n4\n0 2 0 1", "output": "3\n0\n"}, {"input": "2\n3\n9 10 5\n4\n4 1 1 2", "output": "3\n1\n"}, {"input": "2\n3\n0 3...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere were $n$ types of swords in the theater basement which had been used during the plays. Moreover there w...
[{"input": "10\n100000000 200000000 300000000 20 500000000 600000000 700000000 800000000 900000000 1000000000\n", "output": "244999999 20\n"}, {"input": "10\n100000000 200000000 300000000 20 500000000 600000000 700000000 800000000 900000000 1000000000\n", "output": "244999999 20\n"}, {"input": "10\n100000000 200000000 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPiegirl got bored with binary, decimal and other integer based counting systems. Recently she discovered some...
[{"input": "1000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000\n11111111111111111111111111111111111111111111111111111111111...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSnuke has come to a store that sells boxes containing balls. The store sells the following three kinds of box...
[{"input": "13 2 1 3000", "output": "174001\n"}, {"input": "13 1 1 3000", "output": "347886\n"}, {"input": "13 2 1 3118", "output": "187920\n"}, {"input": "22 2 1 3118", "output": "111399\n"}, {"input": "13 2 4 3000", "output": "43732\n"}, {"input": "8 2 1 3000", "output": "282376\n"}, {"input": "7 2 1 3000", "output":...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nOne player came to a casino and found a slot machine where everything depends only on how he plays. The rules...
[{"input": "66\n909090909090909090909090909090909909090909090909090909090909090909\n190909090909090909090909090909090090909090909090909090909090909091\n", "output": " 9736\n33 -1\n32 1\n31 -1\n30 1\n29 -1\n28 1\n27 -1\n26 1\n25 -1\n24 1\n23 -1\n22 1\n21 -1\n20 ...
code_stdio
[ { "content": "You are an expert Python programmer. 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 tree (an undirected connected acyclic graph) consisting of n vertices. You are playing a game...
[{"input": "52\n1 52\n2 52\n3 18\n4 52\n5 52\n6 52\n7 52\n8 52\n9 52\n10 52\n11 52\n12 52\n13 52\n14 52\n15 52\n16 52\n17 52\n18 52\n19 52\n20 52\n21 52\n22 52\n23 52\n24 52\n25 52\n26 52\n27 52\n28 52\n29 52\n30 52\n31 52\n32 52\n33 52\n34 52\n35 52\n36 52\n37 52\n38 52\n39 52\n40 52\n41 52\n42 52\n43 52\n44 52\n45 52...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIf you like Taco Bell, you will be familiar with their signature doritos locos taco. They're very good.\n\n\n...
[{"input": "\"Alex is Super Cool\"", "output": "[[\"shell\", \"beef\", \"lettuce\", \"beef\", \"beef\", \"salsa\", \"salsa\", \"beef\", \"beef\", \"cheese\", \"beef\", \"beef\", \"lettuce\", \"shell\"]]", "fn_name": "tacofy"}, {"input": "\"abtlcgs\"", "output": "[[\"shell\", \"beef\", \"tomato\", \"lettuce\", \"cheese\...
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\nAlice and Bob are meeting after a long time. As usual they love to play some math games. This times Alice tak...
[{"input": "5\n23\n13\n20\n1100\n99991", "output": "yes\nyes\nno\nno\nyes\n"}, {"input": "5\n31\n17\n7\n1100\n99991", "output": "yes\nyes\nyes\nno\nyes\n"}, {"input": "5\n29\n21\n31\n1100\n99991", "output": "yes\nno\nyes\nno\nyes\n"}, {"input": "5\n23\n23\n20\n1000\n99991", "output": "yes\nyes\nno\nno\nyes\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\nMakes solves problems on Decoforces and lots of other different online judges. Each problem is denoted by its...
[{"input": "100 10\n246 286 693 607 87 612 909 312 621 37 801 558 504 914 416 762 187 974 976 123 635 488 416 659 988 998 93 662 92 749 889 78 214 786 735 625 921 372 713 617 975 119 402 411 878 138 548 905 802 762 940 336 529 373 745 835 805 880 816 94 166 114 475 699 974 462 61 337 555 805 968 815 392 746 591 558 740...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nRock... Paper!\n\nAfter Karen have found the deterministic winning (losing?) strategy for rock-paper-scissors...
[{"input": "30\n1143673 436496 1214486 1315862 148404 724601 1430740 1433008 1654610 1635673 614673 1713408 1270999 1697 1463796 50027 525482 1659078 688200 842647 518551 877506 1017082 1807856 3280 759698 1208220 470180 829800 1960886\n1312613 1965095 967255 1289012 1950383 582960 856825 49684 808824 319418 1968270 19...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given an H \\times W grid. The square at the top-left corner will be represented by (0, 0), and the s...
[{"input": "1000000 1000000\n0\n0 0", "output": "333218986"}, {"input": "1000000 1000000\n1\n0 0", "output": "333211937"}, {"input": "1000001 1000000\n0\n0 1", "output": "40554683"}, {"input": "4 4\n4\n0 1\n1 1\n2 1\n2 2", "output": "268"}, {"input": "14 13\n0\n-1 -2", "output": "148239"}, {"input": "14 14\n0\n0 -1", "...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere is a robot staying at $X=0$ on the $Ox$ axis. He has to walk to $X=n$. You are controlling this robot a...
[{"input": "100 1 1\n0 0 0 1 1 0 1 0 1 0 1 0 -1 1 0 0 1 1 0 1 2 0 1 1 1 1 1 1 1 0 1 1 1 0 -1 0 0 0 -1 0 1 0 0 1 1 0 1 0 0 1 0 1 1 0 0 1 0 0 0 1 1 1 1 1 0 0 1 0 0 1 0 0 0 0 1 0 0 0 1 1 0 1 1 0 1 1 1 0 1 1 -1 1 1 0 0 1 1 0 1 1\n", "output": "2\n"}, {"input": "100 1 1\n0 0 0 1 1 0 1 0 1 0 1 0 -1 1 0 0 1 1 0 1 2 0 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\nYou are given a matrix $a$ of size $n \\times m$ consisting of integers.\n\nYou can choose no more than $\\le...
[{"input": "10 20 69\n7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7\n7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7\n7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7\n7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7\n7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7\n7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7\n7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7\n7 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\nA long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce...
[{"input": "sosossosossosossosossosossosossosossosossosossosossosossosossosossosossosossosossosossosossosossosos\nsos\n", "output": "20"}, {"input": "sosossosossosossosossosossosossosossosossosossosossosossosossosossosossosossosossosossosossosossosos\nsos\n", "output": "20"}, {"input": "sosossosossosossosossosossososso...
code_stdio
[ { "content": "You are an expert Python programmer. 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 middle of Tyrrhenian Sea, there is a small volcanic island called Chronus. The island is now uninhabit...
[{"input": "3\n8 8 28\n32 34 32\n57 2 108\n5\n49 3 49\n7 46 44\n27 21 21\n33 56 56\n21 46 4\n3\n45 52 28\n46 26 36\n40 55 62\n10\n33 8 39\n50 57 43\n61 21 12\n21 17 11\n16 22 106\n45 40 53\n45 30 53\n39 1 8\n24 48 30\n7 48 15\n0", "output": "03:16:36 03:21:07\n06:14:56 06:32:09\n02:18:54 02:21:01\n02:17:21 02:20:00\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\nVanya wants to pass n exams and get the academic scholarship. He will get the scholarship if the average grad...
[{"input": "9 846678 205000\n102282 593538\n246630 24854\n545346 409737\n334264 443193\n37717 191227\n154582 913095\n97105 345066\n65504 578960\n163348 394257\n", "output": "2441209588\n"}, {"input": "9 846678 205000\n102282 593538\n246630 24854\n545346 409737\n334264 443193\n37717 191227\n154582 913095\n97105 345066\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWe have a sandglass that runs for X seconds. The sand drops from the upper bulb at a rate of 1 gram per secon...
[{"input": "1111100011 0101011000", "output": "1010089011\n"}, {"input": "1111100111 0101011000", "output": "1010089111\n"}, {"input": "1100001110 0010011100", "output": "1089990010\n"}, {"input": "1110001110 0010011100", "output": "1099990010\n"}, {"input": "1110001100 0010011100", "output": "1099990000\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\nGiven are integers N and X. For each integer k between 0 and X (inclusive), find the answer to the following ...
[{"input": "30\n001110011011011101010101011100", "output": "549313318"}, {"input": "30\n001010011011011101010101011100", "output": "515761610"}, {"input": "30\n001010011010011101010101011100", "output": "500033010"}, {"input": "30\n001010011010011111010101011100", "output": "500524530"}, {"input": "30\n0011100110100111...
code_stdio
[ { "content": "You are an expert Python programmer. 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 group of n schoolboys decided to ride bikes. As nobody of them has a bike, the boys need to rent them.\n\nT...
[{"input": "40 40 61\n28 59 8 27 45 67 33 32 61 3 29 2 3 37 8 8 10 61 1 2 65 28 34 27 8 35 45 49 30 49 10 23 23 53 20 48 14 74 16 6\n69 56 34 66 42 73 45 49 29 70 26 77 73 26 78 11 50 69 64 72 78 66 66 29 80 40 50 75 58 47 78 113 41 70 52 52 69 22 69 66\n", "output": "23 960\n"}, {"input": "40 40 61\n28 59 8 27 45 67 3...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPavel cooks barbecue. There are n skewers, they lay on a brazier in a row, each on one of n positions. Pavel ...
[{"input": "100\n87 69 49 86 96 12 10 79 29 66 48 77 73 62 70 52 22 28 97 35 91 5 33 82 65 85 68 80 64 8 38 23 94 34 75 53 57 6 100 2 56 50 55 58 74 9 18 44 40 3 43 45 99 51 21 92 89 36 88 54 42 14 78 71 25 76 13 11 27 72 7 32 93 46 83 30 26 37 39 31 95 59 47 24 67 16 4 15 1 98 19 81 84 61 90 41 17 20 63 60\n1 1 1 0 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\nOh no! Ghosts have reportedly swarmed the city. It's your job to get rid of them and save the day!\n\nIn this...
[{"input": "\"BusStation\"", "output": "[\"You just wanted my autograph didn't you?\"]", "fn_name": "ghostbusters"}, {"input": "\"YourHouse\"", "output": "[\"You just wanted my autograph didn't you?\"]", "fn_name": "ghostbusters"}, {"input": "\"O f fi ce\"", "output": "[\"Office\"]", "fn_name": "ghostbusters"}, {"inpu...
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 two strings $s$ and $t$. Both strings have length $n$ and consist of lowercase Latin letters. T...
[{"input": "50\naabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyz\nzyxxwwvvuuttssrrqqppoonnmmllkkjjiihhggffeeddccbbaa\n", "output": "1201\n49 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 49 48 47 46 45 44 43 42 41 40 39 38 37 36 ...
code_stdio
[ { "content": "You are an expert Python programmer. 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 message from humans to extraterrestrial intelligence was sent through the Arecibo radio telescope in Puerto...
[{"input": "5 1 2\n99999 999 999\n1680 10 16\n1970 1 2\n2002 4 11\n0 0 0", "output": "2 2\n313 313\n37 43\n37 53\n37 53\n"}, {"input": "10 1 9\n99999 999 1768\n1495 5 16\n973 1 2\n2002 4 11\n0 0 0", "output": "2 5\n257 389\n31 47\n31 31\n37 53\n"}, {"input": "12 1 5\n99999 999 1356\n1680 5 16\n973 1 2\n2002 4 11\n0 0 0...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWrite a function that takes an arbitrary number of strings and interlaces them (combines them by alternating ...
[{"input": "\"abcd\"\n\"123\"\n\"$%^&\"\n\"qwertyuiop\"\n\"X\"", "output": "[\"a1$qXb2%wc3^ed&rtyuiop\"]", "fn_name": "combine_strings"}, {"input": "\"abcd\"\n\"123\"\n\"$%^&\"\n\"qwertyuiop\"", "output": "[\"a1$qb2%wc3^ed&rtyuiop\"]", "fn_name": "combine_strings"}, {"input": "\"abcd\"\n\"123\"\n\"$%^&\"", "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\nGaurang has grown up in a mystical universe. He is faced by $n$ consecutive 2D planes. He shoots a particle o...
[{"input": "37\n30 16\n22 37\n37 43\n25 31\n12 12\n15 30\n42 11\n29 28\n26 32\n12 32\n18 12\n11 48\n24 25\n15 40\n40 38\n17 12\n22 27\n35 32\n11 29\n35 24\n42 35\n21 14\n25 11\n16 14\n28 31\n49 45\n48 24\n28 20\n21 19\n43 49\n42 24\n14 21\n23 19\n19 16\n32 35\n28 10\n14 22\n", "output": "500692159\n20910845\n885314984\...
code_stdio
[ { "content": "You are an expert Python programmer. 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 group of people played a game. All players had distinct scores, which are positive integers.\n\nTakahashi k...
[{"input": "2\n-1 0011111111\n1100001111 -1", "output": "1100001110\n"}, {"input": "2\n-1 0011111111\n1100001111 -2", "output": "1100001109\n"}, {"input": "2\n-2 0011111111\n1100001111 -3", "output": "1100001108\n"}, {"input": "2\n-1 1000000011\n1100001010 0", "output": "1100001010\n"}, {"input": "2\n-1 1000000011\n110...
code_stdio
[ { "content": "You are an expert Python programmer. 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 image with a height of H pixels and a width of W pixels. Each of the pixels is represented by eit...
[{"input": "9 20\n.....***....***.....\n....*...*..*...*....\n...*.....**.....*...\n...*.....*......*...\n....*.....*....*....\n.....**..*...**.....\n.......*..*.*.......\n........**.*........\n.........**.........\n", "output": ".....***....***.....\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\nWitua is a little student from the University of Lviv. He enjoys studying math. Witua knows a lot of famous m...
[{"input": "3\n12\n27\n11", "output": "11\n23\n11\n"}, {"input": "3\n12\n27\n16", "output": "11\n23\n13\n"}, {"input": "3\n12\n27\n23", "output": "11\n23\n23\n"}, {"input": "3\n6\n17\n11", "output": "5\n17\n11\n"}, {"input": "3\n6\n27\n11", "output": "5\n23\n11\n"}, {"input": "3\n6\n37\n11", "output": "5\n37\n11\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 is a double-track line (up and down are separate lines and pass each other everywhere). There are 11 st...
[{"input": "06,04,1,2,1,1,1,1,1,1,1,2\n1,1,1,1,1,4,3,3,3,3,505,0\n10,10,10,10,10,10,10,10,10,10,50,49", "output": "2\n10\n6\n"}, {"input": "06,14,1,1,0,1,1,1,1,1,1,0\n1,1,1,1,1,3,3,3,3,3,40,50\n10,10,10,10,10,10,10,20,10,10,59,40", "output": "10\n7\n7\n"}, {"input": "06,01,0,1,1,4,1,2,1,1,1,1\n05,05,3,3,3,3,3,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\nRead problems statements in Mandarin Chinese and Russian. \n\nYou are given a multiset of N integers. Please...
[{"input": "1\n3\n4 4 4", "output": "3\n1 2 3 \n"}, {"input": "1\n3\n2 5 2", "output": "3\n1 2 3 \n"}, {"input": "1\n3\n4 11 3", "output": "2\n1 2 \n"}, {"input": "1\n3\n1 11 3", "output": "2\n1 2 \n"}, {"input": "1\n3\n4 20 3", "output": "2\n1 2 \n"}, {"input": "1\n3\n7 11 3", "output": "2\n1 2 \n"}, {"input": "...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA coordinate line has n segments, the i-th segment starts at the position l_{i} and ends at the position r_{i...
[{"input": "55\n3 4\n6 8\n9 10\n3 9\n9 9\n2 5\n4 8\n3 8\n8 10\n1 1\n4 9\n10 10\n6 6\n8 8\n1 8\n5 5\n4 5\n5 9\n2 2\n3 10\n4 6\n3 6\n1 6\n1 7\n6 10\n2 6\n3 7\n2 4\n4 4\n5 10\n1 4\n2 9\n1 3\n7 9\n7 8\n1 9\n1 10\n2 8\n8 9\n6 7\n1 2\n6 9\n7 7\n4 7\n3 3\n2 7\n4 10\n7 10\n2 3\n2 10\n5 7\n3 5\n5 8\n1 5\n5 6\n", "output": "37\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and ...
[{"input": "6\n13\n29\n48\n105\n100\n", "output": "Yay!\n"}, {"input": "25\n26\n27\n28\n29\n91\n", "output": "Yay!\n"}, {"input": "0\n7\n9\n52\n123\n123\n", "output": "Yay!\n"}, {"input": "15\n18\n26\n35\n36\n18\n", "output": ":(\n"}, {"input": "5\n12\n29\n46\n75\n69\n", "output": ":(\n"}, {"input": "2\n22\n25\n32\n35\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nComplete the method so that it formats the words into a single comma separated value. The last word should be...
[{"input": "[\"one\", \"two\", \"three\", \"four\"]", "output": "[\"one, two, three and four\"]", "fn_name": "format_words"}, {"input": "[\"one\", \"\", \"three\"]", "output": "[\"one and three\"]", "fn_name": "format_words"}, {"input": "[\"one\", \"two\", \"\"]", "output": "[\"one and two\"]", "fn_name": "format_words...
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\nToday at the lesson Vitya learned a very interesting function — mex. Mex of a sequence of numbers is the mini...
[{"input": "17 30\n4194 1990 2257 1363 2798 386 3311 3152 1808 1453 3874 4388 1268 3924 3799 1269 968\n11\n8\n8\n8\n8\n8\n8\n8\n8\n8\n8\n8\n8\n8\n8\n8\n8\n8\n8\n8\n8\n8\n0\n8\n8\n8\n8\n8\n8\n8\n", "output": "0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n"}, {"input": "17 30\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\nAs Gerald sets the table, Alexander sends the greeting cards, and Sergey and his twins create an army of clon...
[{"input": "100\n46 353 325 357 342 31 186 689 447 377 484 297 517 92 408 336 389 651 346 464 521 670 353 577 73 477 21 84 659 180 454 386 274 425 274 8 306 131 688 313 342 144 589 277 225 520 442 704 72 376 334 200 92 180 205 602 138 286 668 39 714 447 477 684 491 38 44 186 274 614 127 5 585 566 242 578 361 445 550 31...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou have unlimited number of coins with values $1, 2, \\ldots, n$. You want to select some set of coins havin...
[{"input": "100000 1000000000\n", "output": "10000\n"}, {"input": "1 1000000000\n", "output": "1000000000\n"}, {"input": "1 1010000000\n", "output": "1010000000\n"}, {"input": "1 1452428327\n", "output": "1452428327\n"}, {"input": "15666 1840331709\n", "output": "117473\n"}, {"input": "1 1000000000\n", "output": "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\nIvan has n different boxes. The first of them contains some balls of n different colors.\n\nIvan wants to pla...
[{"input": "8\n1517404878 380061316 129207228 90851747 825473738 704702117 365421523 251930836\n", "output": "7232760863\n"}, {"input": "8\n1517404878 75235306 129207228 90851747 861687101 1031974081 365421523 251930836\n", "output": "6811358611\n"}, {"input": "8\n1517404878 75235306 129207228 90851747 861687101 149707...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nHow many strings can be obtained by applying the following operation on a string S exactly K times: \"choose ...
[{"input": "37564\nwhydidyoudesertme\n", "output": "318008117\n"}, {"input": "37564\nwhydidzoudesertme", "output": "318008117\n"}, {"input": "37564\nwhxdidzoudesertme", "output": "318008117\n"}, {"input": "37564\nwhxdidzoudesertne", "output": "318008117\n"}, {"input": "37564\nwhxdiczoudesertne", "output": "318008117\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\nYour boss decided to save money by purchasing some cut-rate optical character recognition software for scanni...
[{"input": "\"My \\\"me3ssy\\\" d8ata issues2! Will1 th4ey ever, e3ver be3 so0lved?\"", "output": "[\"My \\\"messy\\\" data issues! Will they ever, ever be solved?\"]", "fn_name": "string_clean"}, {"input": "\"Wh7y can't we3 bu1y the goo0d software3? #cheapskates3\"", "output": "[\"Why can't we buy the good software? #...
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\nAfter returned from forest, Alyona started reading a book. She noticed strings s and t, lengths of which are ...
[{"input": "120 362 6\ncaaccbbbabbbcbaacbaccacaaccacaaababccaccaabaccacccbbaaaaababbccbbacccaacabacbaaacabbacbabcccbccbcbbcaabaaabaabcccaabacbb\nabcbbaaccbbcabbcbbcacbabaacbaaacabcbabcabbabccbcaaacaccaaabbcbaacccccbcabacaacabbbcabaabcbbccabacbaaaacbbbbbccabccccbababcbacbbbcbbaabcaabcacbaaaaaccbaabbabacbcbbbaabbbcabcaac...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nBear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right....
[{"input": "150\n28 124 138 71 71 18 78 136 138 93 145 93 18 15 71 47 47 64 18 72 138 72 18 150 7 71 109 149 18 115 149 52 15 106 124 27 72 124 28 108 138 109 108 111 148 138 78 27 28 150 138 100 15 145 109 47 102 62 28 7 115 108 102 149 150 27 111 64 149 124 13 21 108 64 7 15 72 72 124 47 102 28 109 18 124 28 111 138 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given an array $a$ consisting of $n$ integers. Initially all elements of $a$ are either $0$ or $1$. Y...
[{"input": "5 5\n0 1 0 1 0\n2 3\n2 2\n2 3\n2 1\n2 5\n", "output": "0\n1\n0\n1\n0\n"}, {"input": "5 5\n0 0 0 1 0\n2 3\n2 2\n2 3\n2 2\n2 5\n", "output": "0\n0\n0\n0\n0\n"}, {"input": "5 5\n1 0 1 0 0\n2 3\n2 3\n2 3\n2 1\n2 5\n", "output": "0\n0\n0\n1\n0\n"}, {"input": "5 5\n0 0 1 1 0\n2 1\n2 4\n2 3\n2 2\n2 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\nSnuke is standing on a two-dimensional plane. In one operation, he can move by 1 in the positive x-direction,...
[{"input": "1000000 1000000 1000000 1000000\n", "output": "192151600\n"}, {"input": "799999 789898 979797 999999\n", "output": "50188529\n"}, {"input": "53245 34234 643323 948342\n", "output": "574642047\n"}, {"input": "33400 31000 33400 593020\n", "output": "67962523\n"}, {"input": "349 602 998593 983904\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\nMislove had an array $a_1$, $a_2$, $\\cdots$, $a_n$ of $n$ positive integers, but he has lost it. He only rem...
[{"input": "1000 20 20\n", "output": "1049555 514850815\n"}, {"input": "1000 20 20\n", "output": "1049555 514850815\n"}, {"input": "114 18 19\n", "output": "262239 25427967\n"}, {"input": "879 17 17\n", "output": "131933 56623103\n"}, {"input": "114 18 19\n", "output": "262239 25427967\n"}, {"input": "879 17 17\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\nRecently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n ⋅ k cities...
[{"input": "98752 97209\n41218 39020\n", "output": "21427641 3199861056\n"}, {"input": "65536 32768\n6427 13573\n", "output": "67108864 1073741824\n"}, {"input": "100000 100000\n10 1\n", "output": "10000000000 10000000000\n"}, {"input": "100000 99737\n34242 43667\n", "output": "99737 9973700000\n"}, {"input": "100000 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\nPhoenix is playing with a new puzzle, which consists of $n$ identical puzzle pieces. Each puzzle piece is a r...
[{"input": "3\n524304\n61032704\n61560720\n", "output": "NO\nNO\nNO\n"}, {"input": "3\n524304\n61032704\n61560720\n", "output": "NO\nNO\nNO\n"}, {"input": "3\n524304\n61032704\n10950212\n", "output": "NO\nNO\nNO\n"}, {"input": "3\n524304\n61032704\n14778357\n", "output": "NO\nNO\nNO\n"}, {"input": "3\n524304\n61032704\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAlex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening...
[{"input": "100\n4 8 10 1 8 8 8 1 10 3 1 8 6 8 6 1 10 3 3 3 3 7 2 1 1 4 10 1 7 9 8 10 3 8 6 2 2 6 7 6 10 8 9 11 2 3 10 5 3 9 10 5 10 8 8 5 7 8 2 5 3 9 9 2 7 8 1 10 4 9 2 8 10 19 5 8 5 1 7 3 4 5 2 5 9 3 2 5 6 2 3 10 1 5 9 6 10 4 10 8\n", "output": "383\n"}, {"input": "100\n4 8 10 1 8 8 8 1 10 3 1 8 6 8 6 1 10 3 3 3 3 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\nA word or a sentence in some language is called a pangram if all the characters of the alphabet of this langu...
[{"input": "100\nmKtsiDRJypUieHIkvJaMFkwaKxcCIbBszZQLIyPpCDCjhNpAnYFngLjRpnKWpKWtGnwoSteeZXuFHWQxxxOpFlNeYTwKocsXuCoa\n", "output": "YES\n"}, {"input": "100\nmKtsiDRJypUieHIkvJaMFkwaKxcCIbBszZQLIyPpCDCjhNpAnYFngLjRpnKWpKWtGnwoSteeZXuFHWQxxxOpFlNeYTwKocsXuCoa\n", "output": "YES\n"}, {"input": "100\naoCuXscoKwTYeNlFpOxxx...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSmart Beaver decided to be not only smart, but also a healthy beaver! And so he began to attend physical educ...
[{"input": "200\n1 2 1 1 2 2 1 1 1 1 1 1 2 1 2 2 2 2 2 1 2 2 1 1 2 2 2 2 2 1 2 1 1 2 2 2 1 2 2 2 1 1 2 2 2 1 2 2 1 2 1 2 2 1 2 2 2 2 2 1 2 2 1 2 1 1 2 2 2 2 2 2 2 1 2 2 2 1 1 2 2 2 2 1 1 2 2 1 1 1 2 2 1 1 2 2 1 1 2 2 2 1 2 2 2 1 2 1 2 2 2 2 2 2 2 1 1 1 2 2 2 2 1 2 2 2 1 1 2 2 2 2 2 1 2 1 2 1 1 1 2 2 2 1 2 1 2 2 1 2 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\nWhere do odds begin, and where do they end? Where does hope emerge, and will they ever break?\n\nGiven an int...
[{"input": "100\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe campus has $m$ rooms numbered from $0$ to $m - 1$. Also the $x$-mouse lives in the campus. The $x$-mouse ...
[{"input": "100000000000000 99999999999999\n", "output": "50000000000001\n"}, {"input": "100000000000000 99999999999999\n", "output": "50000000000001\n"}, {"input": "97821761637600 97821761637493\n", "output": "11943039006\n"}, {"input": "97821761637600 97821761637493\n", "output": "11943039006\n"}, {"input": "97821761...
code_stdio
[ { "content": "You are an expert Python programmer. 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 decide to develop a game with your friends. The title of the game is \"Battle Town\". This is a game with...
[{"input": "4\n4 6\n*.*..*\n*.....\n...-..\n^.*#..\n10\nSRSSRRUSSR\n2 2\n<.\n..\n12\nDDSRRSUUSLLS\n3 5\n>-#**\n.-*#*\n.-**#\n15\nSSSDRSSSDRSSSUU\n5 5\nv****\n*****\n*****\n*****\n*****\n44\nSSSSDDRSDRSRDSULUURSSSSRRRRDSSSSDDLSDLSDLSSD", "output": "*....*\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\nTwo participants are each given a pair of distinct numbers from 1 to 9 such that there's exactly one number t...
[{"input": "12 12\n1 6 2 6 8 3 6 4 4 8 7 2 7 5 9 4 2 4 9 5 8 5 3 6\n2 8 6 15 2 6 7 4 6 5 6 3 5 8 7 8 7 1 1 9 9 7 7 3\n", "output": "-1\n"}, {"input": "12 12\n7 6 3 8 8 4 4 7 1 9 9 5 7 5 4 9 8 6 2 7 7 3 3 6\n9 1 2 4 9 8 5 3 6 7 3 8 2 7 5 9 6 4 3 1 2 6 1 4\n", "output": "-1\n"}, {"input": "12 12\n1 6 2 6 8 3 6 4 4 8 7 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\nThere are two rectangles.\nThe lengths of the vertical sides of the first rectangle are A, and the lengths of...
[{"input": "100 600 200 300\n", "output": "60000\n"}, {"input": "100 600 200 300", "output": "60000"}, {"input": "100 600 200 6", "output": "60000\n"}, {"input": "100 480 244 6", "output": "48000\n"}, {"input": "100 169 362 6", "output": "16900\n"}, {"input": "100 311 362 6", "output": "31100\n"}, {"input": "110 222 18...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere is a grid with N rows and N columns of squares. Let (i,j) be the square at the i-th row from the top an...
[{"input": "153 17\n0 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1 1 1 1000 1000\n1000 0 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1 1 1 1000 1000\n1000 1000 0 1000 1000 1000 1000 1000 1000 1000 1000 1000 1 1 1 1000 1000\n1000 1000 1000 0 1000 1000 1000 1000 1000 1000 1000 1000 1 1 1 1000 1000\n1000...
code_stdio
[ { "content": "You are an expert Python programmer. 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 directed graph G with N vertices and M edges. The vertices are numbered 1, 2, \\ldots, N, and for ...
[{"input": "5 8\n5 3\n2 3\n2 4\n5 2\n5 1\n1 4\n4 3\n1 3", "output": "3"}, {"input": "4 -1\n2 2\n1 0\n3 2\n2 6\n11 8", "output": "0\n"}, {"input": "4 -1\n2 2\n1 0\n3 2\n2 5\n11 8", "output": "0\n"}, {"input": "8 -1\n2 2\n1 0\n3 2\n2 5\n11 8", "output": "0\n"}, {"input": "4 0\n2 2\n1 0\n3 2\n2 6\n11 8", "output": "0\n"},...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere is a set A = \\\\{ a_1, a_2, \\ldots, a_N \\\\} consisting of N positive integers. Taro and Jiro will p...
[{"input": "-1 100000\n1", "output": "Second\n"}, {"input": "1 100000\n2", "output": "Second\n"}, {"input": "1 100000\n4", "output": "Second\n"}, {"input": "3 36\n1 1 3", "output": "Second\n"}, {"input": "0 100000\n1", "output": "Second\n"}, {"input": "3 21\n2 1 4", "output": "Second\n"}, {"input": "1 100010\n1", "outp...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThis is the easy version of the problem. The only difference is that in this version q = 1. You can make hack...
[{"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 57 0 19 34 94\n0 0 0 0 0...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nBlackjack is a type of card game played in casinos, where the game is played using cards with numbers from 1 ...
[{"input": "1\n3 7 4\n13 7 13\n10 2\n10 1 1\n0", "output": "11\n14\n0\n12\n12\n"}, {"input": "1\n11 3 4\n1 7 8\n2 1\n10 3 1\n0", "output": "11\n17\n16\n13\n14\n"}, {"input": "1\n7 7 3\n11 10 8\n8 1\n10 2 1\n0", "output": "11\n17\n0\n19\n13\n"}, {"input": "1\n7 7 4\n11 10 8\n1 1\n10 2 1\n0", "output": "11\n18\n0\n12\n13...
code_stdio
[ { "content": "You are an expert Python programmer. 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 new innovative ticketing systems for public transport is introduced in Bytesburg. Now there is a single tra...
[{"input": "10\n13\n45\n46\n60\n103\n115\n126\n150\n256\n516\n", "output": "20\n20\n10\n0\n20\n0\n0\n20\n20\n10\n"}, {"input": "7\n000\n138\n279\n308\n381\n718\n1185\n", "output": "20\n20\n20\n20\n20\n20\n0\n"}, {"input": "7\n100\n138\n279\n308\n396\n412\n1265\n", "output": "20\n20\n20\n20\n20\n20\n0\n"}, {"input": "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\nLittle Vasya's uncle is a postman. The post offices are located on one circular road. Besides, each post offi...
[{"input": "20\n10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10\n10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10\n", "output": "20\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \n"}, {"input": "20\n31 16 20 30 19 35 8 11 20 45 10 26 21 39 29 52 8 10 37 49\n16 33 41 32 43 24 35 48 19 37 28 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nCreate a function that takes a string and an integer (`n`).\n\nThe function should return a string that repea...
[{"input": "\"243624\"\n22", "output": "[\"243624243624243624243624243624243624243624243624243624243624243624243624243624243624243624243624243624243624243624243624243624243624\"]", "fn_name": "repeat_it"}, {"input": "\"Hello\"\n11", "output": "[\"HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHello\"]", "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\nLittle Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings co...
[{"input": "AanbDfbZNlUodtBQlvPMyomStKNhgvSGhSbTdabxGFGGXCdpsJDimsAykKjfBDPMulkhBMsqLmVKLDoesHZsRAEEdEzqigueXInY\ncwfyjoppiJNrjrOLNZkqcGimrpTsiyFBVgMWEPXsMrxLJDDbtYzerXiFGuLBcQYitLdqhGHBpdjRnkUegmnwhGHAKXGyFtscWDSI\n", "output": "-1\n"}, {"input": "sSvpcITJAwghVfJaLKBmyjOkhltTGjYJVLWCYMFUomiJaKQYhXTajvZVHIMHbyckYROGQZz...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAlice and Bob play a game. They have a binary string $s$ (a string such that each character in it is either $...
[{"input": "5\n01111001\n0000\n111111\n101010101\n011011110111\n", "output": "4\n0\n6\n3\n6\n"}, {"input": "5\n01111101\n0000\n111111\n101010101\n011011110111\n", "output": "5\n0\n6\n3\n6\n"}, {"input": "5\n01111101\n0000\n111111\n101010101\n011001110111\n", "output": "5\n0\n6\n3\n5\n"}, {"input": "5\n01111101\n0000\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\n'Jeopardy!' is an intellectual game where players answer questions and earn points. Company Q conducts a simp...
[{"input": "50 30\n6015200 8643865 4116771 6555197 304415 8580071 8414182 3089212 5684567 7595481 1272699 7127763 3309618 1410297 4349070 2027355 136702 6863504 1800751 5585842 5924142 5188269 4805201 9313209 8941399 5137060 4983630 8467668 1646260 7804684 8646497 7067118 6896291 9109696 6197162 1366002 1703718 3852639...
code_stdio
[ { "content": "You are an expert Python programmer. 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 text consisting of $n$ space-separated words. There is exactly one space character between an...
[{"input": "250\nf r s d b f f k d e k v m b t k k j t t a o m m s n d w l v g e k x d w k v a j h c a g x s d e t z z w q z d h n r i k b z k u s q l k c v o d o w w c y i a q v r i g i m l b x z h t a i j t h q u e v j o h w m o v k g r r x j a c m z z i s i r a p p i i l e i g m f f f y v k m c l p n n n j j u t t q...
code_stdio
[ { "content": "You are an expert Python programmer. 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 was gifted an array $a$ of length $n$. Polycarp considers an array beautiful if there exists a numbe...
[{"input": "1\n36\n1 2 2 3 3 11 14 4 4 10 5 5 6 8 6 10 7 2 7 7 13 8 8 15 9 9 9 9 10 17 10 10 12 12 12 19\n", "output": "16\n"}, {"input": "1\n36\n1 2 2 3 2 38 14 4 1 10 5 2 2 8 6 6 16 4 7 7 13 8 5 9 9 2 2 9 10 17 10 10 24 12 29 37\n", "output": "17\n"}, {"input": "1\n36\n1 2 2 3 2 21 14 4 4 10 5 5 6 8 12 6 8 2 7 7 13 8...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou have a string $s$ consisting of $n$ characters. Each character is either 0 or 1.\n\nYou can perform opera...
[{"input": "5\n6\n111010\n1\n0\n1\n1\n2\n11\n6\n101010\n", "output": "3\n1\n1\n1\n3\n"}, {"input": "5\n6\n111010\n1\n1\n1\n1\n2\n11\n6\n101010\n", "output": "3\n1\n1\n1\n3\n"}, {"input": "5\n6\n111000\n1\n1\n1\n1\n2\n11\n6\n101010\n", "output": "2\n1\n1\n1\n3\n"}, {"input": "5\n6\n011011\n1\n0\n1\n1\n2\n11\n6\n111000\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\nDraw a rectangle which has a height of H cm and a width of W cm. Draw a 1-cm square by single '#'.\n\nConstra...
[{"input": "8 2\n5 22\n4 -2\n0 0", "output": "##\n##\n##\n##\n##\n##\n##\n##\n\n######################\n######################\n######################\n######################\n######################\n\n\n\n\n\n\n"}, {"input": "3 4\n15 6\n2 4\n0 0", "output": "####\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\nYou are given an undirected graph consisting of $n$ vertices and $n$ edges. It is guaranteed that the given g...
[{"input": "3\n3\n1 2\n2 3\n1 3\n4\n1 2\n2 3\n3 4\n4 2\n5\n1 2\n2 3\n1 3\n2 5\n4 3\n", "output": "\n6\n11\n18\n"}, {"input": "3\n3\n1 2\n2 3\n1 3\n4\n1 2\n2 3\n3 4\n4 2\n5\n1 2\n2 3\n1 3\n2 5\n4 3\n", "output": "6\n11\n18\n"}, {"input": "3\n3\n1 2\n2 3\n1 3\n4\n1 4\n2 3\n3 4\n4 2\n5\n1 2\n2 3\n1 3\n2 5\n4 3\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\nChef loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representati...
[{"input": "3\n25\n46\n102", "output": "2\n1\n3\n"}, {"input": "3\n103\n46\n32", "output": "3\n1\n2\n"}, {"input": "3\n15\n162\n19", "output": "2\n3\n2\n"}, {"input": "3\n15\n162\n17", "output": "2\n3\n1\n"}, {"input": "3\n61\n65\n010", "output": "2\n2\n3\n"}, {"input": "3\n2\n110\n150", "output": "1\n3\n3\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\nG: Tree\n\nproblem\n\nGiven a tree consisting of N vertices. Each vertex of the tree is numbered from 1 to N....
[{"input": "1 2\n2 3\n-1 3", "output": "0\n"}, {"input": "1 2\n4 3\n-1 3", "output": "0\n"}, {"input": "1 4\n-1 2\n1 2", "output": "0\n"}, {"input": "1 1\n3 0\n-1 5", "output": "1\n"}, {"input": "1 1\n3 0\n-1 2", "output": "1\n"}, {"input": "1 1\n3 0\n-1 0", "output": "1\n"}, {"input": "1 2\n2 3\n-1 2", "output": "0\n"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPolycarp has an integer $n$ that doesn't contain the digit 0. He can do the following operation with his numb...
[{"input": "4\n3876\n387\n4489\n3\n", "output": "0\n2\n1\n-1\n"}, {"input": "1\n77771449\n", "output": "2\n"}, {"input": "1\n841419\n", "output": "1\n"}, {"input": "1\n21328\n", "output": "0\n"}, {"input": "1\n87454\n", "output": "0\n"}, {"input": "1\n77778\n", "output": "0\n"}, {"input": "1\n77774\n", "output": "0\n"}...
code_stdio