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\nMalek lives in an apartment block with 100 floors numbered from 0 to 99. The apartment has an elevator with a...
[{"input": "73\n", "output": "15\n"}, {"input": "11\n", "output": "49\n"}, {"input": "55\n", "output": "16\n"}, {"input": "77\n", "output": "25\n"}, {"input": "67\n", "output": "10\n"}, {"input": "35\n", "output": "12\n"}, {"input": "57\n", "output": "20\n"}, {"input": "77\n", "output": "25\n"}, {"input": "35\n", "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\nA popular game in a certain country, Pachimon Creature, has been remade and released in Japan. If you love ga...
[{"input": "6 6\nS.1..4\n5..3..\n..4.1.\n4....5\n.2.32.\n5.1..G\n3 2\n...\nS.G\n0 0", "output": "3 12\nNA\n"}, {"input": "6 6\nS.1..4\n3..5..\n..4.1.\n4...5.\n.2.32.\n5.1..G\n3 2\n...\nS.G\n0 0", "output": "2 10\nNA\n"}, {"input": "6 6\nS.1..4\n4..5..\n..4.1.\n4....5\n.2.32.\n5.1..G\n3 2\n...\nS.G\n0 0", "output": "3 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\nIgor is a post-graduate student of chemistry faculty in Berland State University (BerSU). He needs to conduct...
[{"input": "11\n1 1 1 1 1 1 1 1 1 1 1\n1 1000000001 1000000001 1000000001 1000000001 1000000001 1000000001 1000000001 1000000001 1000000001 1000000001\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n", "output": "NO\n"}, {"inpu...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are N cities in Republic of AtCoder. The size of the i-th city is A_{i}. Takahashi would like to build ...
[{"input": "12 5\n95 94 27 3 104 328 93 25 27 19 46 13", "output": "1076\n"}, {"input": "12 5\n95 112 27 3 104 328 93 25 27 19 46 5", "output": "1070\n"}, {"input": "12 5\n95 94 27 3 104 328 56 25 27 19 46 7", "output": "1023\n"}, {"input": "12 5\n95 94 27 3 104 328 93 25 27 19 46 7", "output": "1060\n"}, {"input": "12...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nHongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road...
[{"input": "24 38 2\n4 13\n7 1\n24 1\n2 8\n17 2\n2 18\n22 2\n23 3\n5 9\n21 5\n6 7\n6 19\n6 20\n11 7\n7 20\n13 8\n16 8\n9 10\n14 9\n21 9\n12 10\n10 22\n23 10\n17 11\n11 24\n20 12\n13 16\n13 23\n15 14\n17 14\n14 20\n19 16\n17 20\n17 23\n18 22\n18 23\n22 19\n21 20\n23 24\n", "output": "215\n"}, {"input": "24 38 2\n4 13\n7...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou already know that Valery's favorite sport is biathlon. Due to your help, he learned to shoot without miss...
[{"input": "20 20 2\nbaaaaaaaaaaaaaaaaaaa\nbfffffffacfffffffffa\nbgggggggaccgggggggga\nbhhhhhhhaccchhhhhhha\nbiiiiiiiacccciiiiiia\nbjjjjjjjacccccjjjjja\nbkkkkkkkacccccckkkka\nblllllllacccccccllla\nbbbbbbbbSccccccccmma\nbddddddddddcccccccna\nbodddddddcccccccccca\nbppddddddddTaaaaaaaa\nbqqqdddddddbqqqqqqqa\nbrrrrddddddbr...
code_stdio
[ { "content": "You are an expert Python programmer. 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 is taking exams on N subjects. The score on each subject will be an integer between 0 and K (inclus...
[{"input": "100 100 100\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100...
code_stdio
[ { "content": "You are an expert Python programmer. 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 people and k keys on a straight line. Every person wants to get to the office which is located on...
[{"input": "50 55 2000\n9518 9743 9338 9956 9827 9772 9094 9644 9242 9292 11221 9205 9907 9860 9530 9814 9662 9482 9725 9227 9105 9424 9268 9427 9470 9578 9808 9976 9143 9070 9079 9896 9367 9235 9925 9009 9619 9012 9669 9077 9870 9766 9479 9598 9055 9988 9792 9197 9377 9610\n828 656 345 412 69 506 274 994 384 766 587 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 are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\nSnuke can ...
[{"input": "6 1\n1 6 1 2 0 4\n", "output": "11\n"}, {"input": "-2 124\n10 2 2 6 3", "output": "0\n"}, {"input": "-2 124\n10 1 2 6 3", "output": "0\n"}, {"input": "-2 189\n10 1 2 6 3", "output": "0\n"}, {"input": "-1 124\n10 2 2 6 3", "output": "0\n"}, {"input": "-2 124\n10 1 4 6 3", "output": "0\n"}, {"input": "6 1\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\nProblem\n\nIf you bring an empty bottle of $ a $ milk, you can exchange it for a new bottle of $ b $ milk.\nH...
[{"input": "560118409912468 316250877917599 1316995007040099", "output": "500636509\n"}, {"input": "316250877917604 316250877917599 672514164456590", "output": "265329493\n"}, {"input": "560118409912468 316250877917599 681260158257385", "output": "29192407\n"}, {"input": "560118409912468 316250877917599 21421406777778"...
code_stdio
[ { "content": "You are an expert Python programmer. 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 Little Elephant loves playing with arrays. He has array a, consisting of n positive integers, indexed fro...
[{"input": "6 6\n2 1 2 3 3 10\n1 2\n2 2\n1 3\n2 4\n3 6\n2 2\n", "output": "1\n1\n2\n1\n0\n1\n"}, {"input": "6 6\n1 2 2 3 3 3\n1 2\n2 2\n1 3\n2 4\n4 6\n1 6\n", "output": "1\n0\n2\n1\n1\n3\n"}, {"input": "6 6\n1 2 2 3 3 3\n1 2\n2 2\n1 3\n4 4\n4 6\n1 6\n", "output": "1\n0\n2\n0\n1\n3\n"}, {"input": "6 6\n1 2 2 3 3 3\n1 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\nJoisino is planning to record N TV programs with recorders.\nThe TV can receive C channels numbered 1 through...
[{"input": "2 4\n51 60 4\n28 48 4\n89 108 5\n52 127 2\n108 134 0\n71 68 3\n31 86 3\n70 96 1\n22 12 3", "output": "1\n"}, {"input": "2 4\n56 60 4\n28 48 4\n89 90 5\n52 127 2\n108 112 0\n71 68 3\n31 86 3\n70 96 1\n11 12 3", "output": "1\n"}, {"input": "2 4\n56 60 4\n28 48 4\n89 90 5\n52 127 2\n108 112 0\n71 68 3\n31 86 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\nYour job is to write function last_digits(n,d) which return the last `d` digits of an integer `n` as a list.\...
[{"input": "34625647867585\n10", "output": "[[5, 6, 4, 7, 8, 6, 7, 5, 8, 5]]", "fn_name": "solution"}, {"input": "123767\n4", "output": "[[3, 7, 6, 7]]", "fn_name": "solution"}, {"input": "1343\n5", "output": "[[1, 3, 4, 3]]", "fn_name": "solution"}, {"input": "24134\n-4", "output": "[[]]", "fn_name": "solution"}, {"in...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n## Description\n\nYou've been working with a lot of different file types recently as your interests have broa...
[{"input": "[\"cLgvr.P.als\", \"sgeFl.FL.als\", \"j9Yei.Kyu.py\", \"RljRS.v.ala\", \"1CJaz.EJF.pr\", \"Zxc1b.tOw.maya\", \"s0lXz.P7z.txt\", \"QvISi.b8l.Ue4\", \"3XtjW.rSSH.zbrush\", \"6TsCH.dJy.zbrush\", \"ZbL5a.zeqk.ala\", \"1RReC.Pk3.zbrush\", \"0EfHO.Ic.pr\", \"VGBzm.o.h\", \"BJZtt.6.xml\", \"xU84j.0MC.pt\", \"l3JMW...
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\nArtist Shinagawa was asked to exhibit n works. Therefore, I decided to exhibit the six sides of the cube colo...
[{"input": "3\nCyan Yellow Red Magenta Green Blue\nCyan Yellow Red Magenta Green Blue\nRed Yellow Magenta Blue Green Cyan\n4\nRed Mahenta Blue Green Yellow Cyan\nRed Yellow Magenta Blue Green Cyan\nMagenta Green Red Cyan Yellow Blue\nCyan Green Yellow Blue Magenta Red\n0", "output": "1\n1\n"}, {"input": "3\nCyan Yellow...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nKalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in o...
[{"input": "6\n1 2 3 10 20 30\n6 5 4 3 2 0\n", "output": "138\n"}, {"input": "6\n2 2 3 10 20 30\n6 5 4 3 2 0\n", "output": "138\n"}, {"input": "6\n1 2 3 10 20 25\n6 5 4 3 2 0\n", "output": "118\n"}, {"input": "6\n1 1 2 10 20 25\n6 5 4 3 2 0\n", "output": "112\n"}, {"input": "6\n1 2 3 10 20 39\n6 5 4 3 2 0\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\n#Unflatten a list (Easy)\n\nThere are several katas like \"Flatten a list\".\nThese katas are done by so many...
[{"input": "[1, 4, 5, 2, 1, 2, 4, 5, 2, 6, 2, 3, 3]", "output": "[[1, [4, 5, 2, 1], 2, [4, 5, 2, 6], 2, [3, 3]]]", "fn_name": "unflatten"}, {"input": "[3, 1, 1, 3, 1, 1]", "output": "[[[3, 1, 1], [3, 1, 1]]]", "fn_name": "unflatten"}, {"input": "[99, 1, 1, 1]", "output": "[[[99, 1, 1, 1]]]", "fn_name": "unflatten"}, {"...
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\nImplement a class/function, which should parse time expressed as `HH:MM:SS`, or `null/nil/None` otherwise.\n\...
[{"input": "\"99:59:59\"", "output": "[359999]", "fn_name": "to_seconds"}, {"input": "\"00:00:00\\n\"", "output": "[null]", "fn_name": "to_seconds"}, {"input": "\"\\n00:00:00\"", "output": "[null]", "fn_name": "to_seconds"}, {"input": "\"100:59:59\"", "output": "[null]", "fn_name": "to_seconds"}, {"input": "\"09:059:59...
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\nPeople in Silverland use square coins. Not only they have square shapes but also their values are square numb...
[{"input": "2\n19\n51\n0", "output": "1\n10\n107\n"}, {"input": "2\n19\n92\n0", "output": "1\n10\n804\n"}, {"input": "2\n173\n0\n-6", "output": "1\n13027\n"}, {"input": "2\n10\n51\n0", "output": "1\n4\n107\n"}, {"input": "2\n27\n37\n0", "output": "1\n21\n46\n"}, {"input": "2\n25\n39\n0", "output": "1\n19\n50\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\nGame \"Minesweeper 1D\" is played on a line of squares, the line's height is 1 square, the line's width is n ...
[{"input": "?2*?2*??1*2**?2*1???*2???100?????*???*?*????0????2?*?*?1??1??*?01**2**1001??**??**??1*?*???00??**??*\n", "output": "147483634\n"}, {"input": "?2*?2*??1*2**?2*1???*2???100?????*???*?*????0????2?*?*?1??1??*?01**2**1001??**??**??1*?*???00??**??*\n", "output": "147483634\n"}, {"input": "*??**??00???*?*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\nTrouble came from the overseas lands: a three-headed dragon Gorynych arrived. The dragon settled at point C a...
[{"input": "-1000000000 1000000000\n-1000000000 -1000000000\n1000000000 -1000000000\n", "output": "LEFT\n"}, {"input": "-1000000000 1000001000\n-1000000000 -1000000000\n1000000000 -1000000000\n", "output": "LEFT\n"}, {"input": "-1000000000 1000000010\n-1000000000 -1000000000\n1000000000 -1000000000\n", "output": "LEFT\...
code_stdio
[ { "content": "You are an expert Python programmer. 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 working on a new project called \"Polychat\". Following modern tendencies in IT, he decided, that...
[{"input": "+qlHEc2AuYy\nqlHE02AuYy:YYRwDc edNZgpE nGfOguRWnMYpTpGUVM aXDKGWo1GL1tHv9\n0Upwze6PcQNBcUovrqmIcPsG3hvy:yYuA2cEHlq oaNiKV49p[KatlVAx\nqlHEc2AuYy:zuCO6Opey L eu7lTwysaSk00zjpv zrDfbt8l ufHph\n+pErDMxgVgh\nsiLF1I:yYu@1cEHlq mmQbZtd8Ui7y 2vcax6yZBMhVdRD6Ahlq7MNCw\nqlHEc2AuYy:lz MFUNJZhlqBYckHUDlNhLiDkmecSh1...
code_stdio
[ { "content": "You are an expert Python programmer. 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 permutation p of size n is the sequence p_1, p_2, ..., p_{n}, consisting of n distinct integers, each of th...
[{"input": "16440\n", "output": "2 16440 4 16438 6 16436 8 16434 10 16432 12 16430 14 16428 16 16426 18 16424 20 16422 22 16420 24 16418 26 16416 28 16414 30 16412 32 16410 34 16408 36 16406 38 16404 40 16402 42 16400 44 16398 46 16396 48 16394 50 16392 52 16390 54 16388 56 16386 58 16384 60 16382 62 16380 64 16378 66 ...
code_stdio
[ { "content": "You are an expert Python programmer. 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 term of this problem is the same as the previous one, the only exception — increased restrictions.\n\n\n-...
[{"input": "80 979\n2 1 1 1 2 1 1 1 3 1 4 4 2 1 1 3 1 1 2 1 4 1 1 2 5 4 8 1 3 6 5 7 2 3 4 1 2 2 6 1 2 2 4 1 1 2 3 2 8 1 1 3 3 4 1 1 2 1 4 4 1 4 3 2 6 5 2 1 4 1 2 3 2 1 3 3 2 2 1 3\n498 976 513 869 917 914 664 656 957 893 981 947 985 693 576 958 987 822 981 718 884 729 295 683 485 998 730 894 731 975 739 854 906 740 987...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nFollowing from the previous kata and taking into account how cool psionic powers are compare to the Vance spe...
[{"input": "21\n30", "output": "[448]", "fn_name": "psion_power_points"}, {"input": "1\n10", "output": "[0]", "fn_name": "psion_power_points"}, {"input": "1\n11", "output": "[2]", "fn_name": "psion_power_points"}, {"input": "0\n11", "output": "[0]", "fn_name": "psion_power_points"}, {"input": "1\n20", "output": "[4]", ...
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\nScrooge McDuck keeps his most treasured savings in a home safe with a combination lock. Each time he wants to...
[{"input": "125\n23269567683904664184142384849516523616863461607751021071772615078579713054027902974007001544768640273491193035874486891541257\n47635110303703399505805044019026243695451609639556649012447370081552870340011971572363458960190590266459684717415349529509024\n", "output": "305\n"}, {"input": "125\n2326956768...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given an integer N. Determine if there exists a tree with 2N vertices numbered 1 to 2N satisfying the...
[{"input": "3", "output": "Yes\n1 2\n2 3\n3 4\n4 5\n5 6"}, {"input": "001", "output": "No\n"}, {"input": "128", "output": "No\n"}, {"input": "256", "output": "No\n"}, {"input": "001", "output": "No\n"}, {"input": "256", "output": "No\n"}, {"input": "128", "output": "No\n"}, {"input": "16", "output": "No\n"}, {"input": ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPolycarpus analyzes a string called abracadabra. This string is constructed using the following algorithm: \n...
[{"input": "156642200 503020953 296806626 871864091\n", "output": "234585497\n"}, {"input": "462616550 929253987 199885647 365920450\n", "output": "166034804\n"}, {"input": "166724572 472113234 358126054 528083792\n", "output": "125430608\n"}, {"input": "443495607 813473994 192923319 637537620\n", "output": "268435455\...
code_stdio
[ { "content": "You are an expert Python programmer. 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 the multiset of positive integers $s=\\{s_1,s_2,\\dots,s_k\\}$, define the Greatest Common Divisor (GCD) ...
[{"input": "10\n972 972 324 972 324 648 1944 243 324 474\n", "output": "162\n"}, {"input": "10\n972 972 324 972 324 648 1944 243 324 474\n", "output": "162\n"}, {"input": "10\n540 648 1116 648 720 540 594 864 972 648\n", "output": "36\n"}, {"input": "10\n972 1224 324 972 324 507 1868 392 324 474\n", "output": "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\nJust like in the [\"father\" kata](http://www.codewars.com/kata/find-fibonacci-last-digit/), you will have to...
[{"input": "1000000009", "output": "[9]", "fn_name": "last_fib_digit"}, {"input": "900000008", "output": "[1]", "fn_name": "last_fib_digit"}, {"input": "80000007", "output": "[8]", "fn_name": "last_fib_digit"}, {"input": "7000006", "output": "[3]", "fn_name": "last_fib_digit"}, {"input": "600005", "output": "[5]", "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\nA sequence of positive integers is called great for a positive integer $x$, if we can split it into pairs in ...
[{"input": "1\n11 100000\n310065408 310065408 310065408 310065408 89000 89000 89000 89000 10000000 5 69\n", "output": "11\n"}, {"input": "4\n4 4\n1 16 4 4\n6 2\n1 2 2 2 4 7\n5 3\n5 2 3 5 15\n9 10\n10 10 10 20 1 100 200 2000 3\n", "output": "0\n2\n3\n3\n"}, {"input": "1\n8 1000000\n100000000 100000000 276447232 1000 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\nYou are given two integers $n$ and $k$.\n\nYou should create an array of $n$ positive integers $a_1, a_2, \\d...
[{"input": "25\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n1000000000 3\n1000000000...
code_stdio
[ { "content": "You are an expert Python programmer. 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 substring of some string is called the most frequent, if the number of its occurrences is not less than num...
[{"input": "76\namnctposz\nmnctpos\nos\nu\ne\nam\namnc\neamnctpo\nl\nx\nq\nposzq\neamnc\nctposzq\nctpos\nmnc\ntpos\namnctposzql\ntposzq\nmnctposz\nnctpos\nctposzql\namnctpos\nmnct\np\nux\nposzql\ntpo\nmnctposzql\nmnctp\neamnctpos\namnct\ntposzql\nposz\nz\nct\namnctpo\noszq\neamnct\ntposz\ns\nmn\nn\nc\noszql\npo\no\nmnc...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nVova had a pretty weird sleeping schedule. There are $h$ hours in a day. Vova will sleep exactly $n$ times. T...
[{"input": "65 654 560 571\n83 511 615 263 171 146 241 511 582 216 352 632 506 538 536 217 627 213 324 579 172 241 363 584 450 144 447 536 241 523 162 21 437 291 191 111 567 502 170 570 231 493 169 360 107 114 322 160 574 611 460 558 616 361 284 58 41 345 450 560 543 520 105 416 38\n", "output": "2\n"}, {"input": "65 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\nLet's dive into one of the most interesting areas of magic — writing spells. Learning this exciting but chall...
[{"input": "# a \n # a \n\n # a \n\n\n # a \n \n # a \n \n\n # a \n\n \n # a\n \n \n # a \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\nVasya should paint a fence in front of his own cottage. The fence is a sequence of n wooden boards arranged i...
[{"input": "118\n8850 1770\n97 19 137 20 92 16 145 35 2 86 4 83 147 135 125 7 145 84 142 124 14 91 169 132 149 117 67 41 137 132 91 34 162 70 92 75 73 24 6 143 24 12 149 48 107 82 146 119 107 174 166 103 42 31 70 142 156 25 153 159 116 108 151 21 156 43 38 85 68 2 107 16 163 179 92 150 48 52 85 115 37 186 82 94 67 170 ...
code_stdio
[ { "content": "You are an expert Python programmer. 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 every string, after every occurrence of `'and'` and `'but'`, insert the substring `'apparently'` directly...
[{"input": "\"A fast-food resteraunt down the street was grumbling my tummy but I could not go.\"", "output": "[\"A fast-food resteraunt down the street was grumbling my tummy but apparently I could not go.\"]", "fn_name": "apparently"}, {"input": "\"but the bread and butter apparently brand apparently\"", "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\nCurry making\n\nAs the ACM-ICPC domestic qualifying is approaching, you who wanted to put more effort into pr...
[{"input": "10 5 3 4\n1 6 2 3\n150 13 7 62\n10 1 3 5\n20 100 3 20\n2 14 13 1\n0 0 0 0", "output": "2\n4\n0\n0\n14\n180\n"}, {"input": "10 5 3 4\n1 5 2 3\n150 13 12 62\n10 1 11 5\n20 100 3 20\n3 14 3 1\n0 0 0 0", "output": "2\n3\n1\n1\n14\n39\n"}, {"input": "10 5 6 4\n1 5 2 3\n150 13 12 62\n10 1 11 5\n20 100 3 20\n3 14 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA remote island chain contains n islands, labeled 1 through n. Bidirectional bridges connect the islands to f...
[{"input": "10\n2 4 8 3 6 1 15 0 5 14\n3 6 1 10 0 5 7 2 14 4\n", "output": "NO\n"}, {"input": "10\n2 4 8 3 6 1 15 0 5 7\n3 6 1 10 0 5 7 2 14 4\n", "output": "NO\n"}, {"input": "10\n2 4 8 3 6 1 15 0 5 7\n3 6 1 10 0 5 7 2 22 4\n", "output": "NO\n"}, {"input": "10\n2 0 1 6 4 12 8 5 3 7\n12 4 11 0 5 3 7 2 1 8\n", "output":...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coinc...
[{"input": "11\n358 -724 -232 53 -520\n486 -554 -328 53 -220\n358 -554 -232 -372 -520\n358 -554 -232 308 -520\n868 -554 448 53 -520\n478 -554 -322 53 -600\n358 296 -232 53 -520\n256 -554 -368 53 -520\n230 -554 -136 53 -820\n-182 -554 173 53 -160\n358 -554 -232 53 -520\n", "output": "1\n11\n"}, {"input": "11\n358 -724 -...
code_stdio
[ { "content": "You are an expert Python programmer. 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 flowers arranged in a row. For each i (1 \\leq i \\leq N), the height and the beauty of the i-th ...
[{"input": "5\n1 2 3 4 5\n1000000000 1000000010 1000000000 1000000000 1000000000", "output": "5000000010\n"}, {"input": "5\n1 2 3 4 5\n1000000000 1000000010 1000000000 1010000000 1000000000", "output": "5010000010\n"}, {"input": "5\n1 2 3 4 5\n1000000000 1000000010 1000100000 1010000000 1000000000", "output": "50101000...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nNick is interested in prime numbers. Once he read about Goldbach problem. It states that every even integer g...
[{"input": "1000 1000\n", "output": "NO\n"}, {"input": "1000 1100\n", "output": "NO\n"}, {"input": "1000 44\n", "output": "YES\n"}, {"input": "428 23\n", "output": "YES\n"}, {"input": "332 20\n", "output": "YES\n"}, {"input": "802 35\n", "output": "YES\n"}, {"input": "640 32\n", "output": "YES\n"}, {"input": "995 44\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's define the sum of two permutations p and q of numbers 0, 1, ..., (n - 1) as permutation <image>, where ...
[{"input": "84\n83 4 68 34 24 2 48 38 22 51 5 62 31 67 66 53 49 70 9 71 46 41 30 8 50 17 28 79 15 80 32 43 14 74 29 42 81 60 56 65 23 0 77 76 58 78 1 11 37 27 75 35 18 73 54 20 57 33 36 6 61 69 64 55 39 10 3 45 13 26 59 82 21 25 63 52 16 44 47 72 19 12 7 40\n63 41 80 52 36 45 17 69 22 66 37 21 46 44 64 9 48 74 58 81 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\nVasya came up with his own weather forecasting method. He knows the information about the average air tempera...
[{"input": "100\n-85 -80 -76 -72 -68 -64 -60 -56 -52 -48 -44 -40 -36 -32 -28 -24 -20 -16 -12 -8 -4 0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 224 228 232 236 240 244 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\nLittle X and Little Z are good friends. They always chat online. But both of them have schedules.\n\nLittle Z...
[{"input": "13 42 292 733\n304 308\n362 365\n396 397\n686 688\n719 722\n815 816\n901 902\n904 905\n921 924\n929 933\n953 954\n977 980\n982 985\n28 30\n36 37\n108 112\n123 127\n134 135\n151 153\n160 162\n203 205\n208 212\n240 243\n261 264\n271 274\n294 297\n356 358\n383 385\n408 412\n415 418\n435 439\n444 447\n500 502\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\nAlice got a new doll these days. It can even walk!\n\nAlice has built a maze for the doll and wants to test i...
[{"input": "10 10 70\n10 4\n5 5\n6 10\n8 9\n3 8\n10 9\n10 10\n8 2\n2 10\n7 2\n7 3\n10 2\n8 3\n9 8\n2 9\n3 1\n6 5\n6 9\n2 8\n10 7\n8 4\n8 6\n7 6\n5 6\n9 10\n3 9\n5 8\n4 8\n3 10\n10 5\n5 2\n5 4\n8 8\n3 2\n3 6\n2 3\n1 9\n6 6\n2 4\n6 2\n5 3\n6 4\n7 9\n2 2\n5 9\n7 10\n7 8\n3 3\n2 6\n7 5\n8 10\n3 4\n6 8\n8 5\n1 8\n10 6\n10 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\nVova plans to go to the conference by train. Initially, the train is at the point $1$ and the destination poi...
[{"input": "10\n10 1 1 1\n10 1 1 2\n10 1 1 3\n10 1 1 4\n10 1 1 5\n10 1 1 6\n10 1 1 7\n10 1 1 8\n10 1 1 9\n10 1 1 10\n", "output": "9\n8\n7\n6\n5\n4\n3\n2\n1\n0\n"}, {"input": "10\n10 2 1 1\n10 2 1 2\n10 2 1 3\n10 2 1 4\n10 2 1 5\n10 2 1 6\n10 2 1 7\n10 2 1 8\n10 2 1 9\n10 2 1 10\n", "output": "5\n4\n4\n3\n3\n2\n2\n1\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\nIahub got lost in a very big desert. The desert can be represented as a n × n square matrix, where each cell ...
[{"input": "999999989 38\n999999980 999999981\n10 8\n2 5\n999999978 999999981\n999999978 999999985\n7 9\n8 10\n9 10\n999999984 999999980\n6 6\n999999985 999999986\n999999982 999999978\n999999981 999999987\n8 5\n999999982 999999980\n999999989 999999980\n999999988 999999983\n999999982 999999984\n10 9\n6 2\n999999980 9999...
code_stdio
[ { "content": "You are an expert Python programmer. 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$ packages of $w_i$ kg from a belt conveyor in order ($i = 0, 1, ... n-1$). You should load a...
[{"input": "4 2\n11\n17\n10\n0\n6", "output": "27\n"}, {"input": "4 4\n-1\n4\n18\n5\n4", "output": "18\n"}, {"input": "4 4\n-1\n2\n17\n1\n4", "output": "17\n"}, {"input": "4 6\n-2\n3\n5\n13\n8", "output": "13\n"}, {"input": "2 1\n11\n12\n5\n2\n6", "output": "23\n"}, {"input": "4 4\n-2\n3\n11\n4\n4", "output": "11\n"}, ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWrite a program to determine if two numbers are coprime. A pair of numbers are coprime if their greatest shar...
[{"input": "12\n39", "output": "[false]", "fn_name": "are_coprime"}, {"input": "17\n34", "output": "[false]", "fn_name": "are_coprime"}, {"input": "34\n17", "output": "[false]", "fn_name": "are_coprime"}, {"input": "35\n10", "output": "[false]", "fn_name": "are_coprime"}, {"input": "20\n27", "output": "[true]", "fn_nam...
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\nThree poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right.\nWe wi...
[{"input": "-1 -1 -1", "output": "YES\n"}, {"input": "-2 -3 -4", "output": "YES\n"}, {"input": "-1 -2 -1", "output": "NO\n"}, {"input": "-1 -3 -1", "output": "NO\n"}, {"input": "-2 -4 -1", "output": "NO\n"}, {"input": "-2 -2 -1", "output": "NO\n"}, {"input": "-2 -1 -1", "output": "NO\n"}, {"input": "-2 -3 -1", "output"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nGiven a lowercase string that has alphabetic characters only and no spaces, return the highest value of conso...
[{"input": "\"mischtschenkoana\"", "output": "[80]", "fn_name": "solve"}, {"input": "\"twelfthstreet\"", "output": "[103]", "fn_name": "solve"}, {"input": "\"chruschtschov\"", "output": "[80]", "fn_name": "solve"}, {"input": "\"catchphrase\"", "output": "[73]", "fn_name": "solve"}, {"input": "\"khrushchev\"", "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\nYou are given two integers $x$ and $y$. You can perform two types of operations: Pay $a$ dollars and increa...
[{"input": "3\n1 3\n391 555\n129 8437\n9 4\n321 654\n3 4\n", "output": "1337\n75288\n2283\n"}, {"input": "3\n1 3\n391 555\n129 8437\n9 4\n321 654\n3 4\n", "output": "1337\n75288\n2283\n"}, {"input": "3\n1 6\n391 555\n129 8437\n9 4\n321 654\n3 4\n", "output": "2510\n75288\n2283\n"}, {"input": "3\n1 6\n391 555\n129 9245\...
code_stdio
[ { "content": "You are an expert Python programmer. 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 got two number: a and b. However, Vasya finds number a too short. So he decided to repeat the opera...
[{"input": "99999 334 94854\n", "output": "9999960000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
code_stdio
[ { "content": "You are an expert Python programmer. 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 came up with a password to register for EatForces — a string s. The password in EatForces should be a s...
[{"input": "6\n11b\n4bh\nBeh\nTuY\n1YJ\nP28\n", "output": "A1b\n4Ah\nB1h\n1uY\n1aJ\nPa8\n"}, {"input": "6\n11b\n4bh\nBeh\nTvY\n1YJ\nP28\n", "output": "A1b\n4Ah\nB1h\n1vY\n1aJ\nPa8\n"}, {"input": "6\n11b\n4bh\nBeh\nvTY\n1YJ\nP28\n", "output": "A1b\n4Ah\nB1h\nv1Y\n1aJ\nPa8\n"}, {"input": "6\n11b\n4bh\nBeh\nvYT\n1YJ\nP28\...
code_stdio
[ { "content": "You are an expert Python programmer. 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 start with a string $s$ consisting only of the digits $1$, $2$, or $3$. The length of $s$ is denoted by $|...
[{"input": "9\n1500\n1212\n1500\n1221\n1500\n122\n1500\n12121\n1500\n22\n1500\n1111112111111112\n1500\n1111111111221111111\n1500\n111111122\n1500\n11111121111121111111\n", "output": "1504\n1599\n1502\n1598\n1502\n1510\n1657\n1502\n1763\n"}, {"input": "9\n1500\n1212\n1500\n1221\n1500\n122\n1500\n12121\n1500\n22\n1500\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\nGiven an undirected tree, let the distance between vertices u and v be the number of edges on the simple path...
[{"input": "6 10\n1 3\n3 2\n4 1\n1 6\n5 6", "output": "0\n"}, {"input": "6 10\n1 3\n3 2\n4 2\n1 6\n5 6", "output": "0\n"}, {"input": "6 10\n1 3\n6 2\n4 2\n1 6\n5 6", "output": "0\n"}, {"input": "6 1\n1 2\n3 2\n4 2\n1 6\n5 6", "output": "4\n"}, {"input": "6 7\n1 2\n3 2\n4 2\n1 6\n5 6", "output": "0\n"}, {"input": "6 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\nWrite a regex to validate a 24 hours time string.\nSee examples to figure out what you should check for:\n\nA...
[{"input": "\"foo12:00bar\"", "output": "[false]", "fn_name": "validate_time"}, {"input": "\"12: 60\"", "output": "[false]", "fn_name": "validate_time"}, {"input": "\"24o:00\"", "output": "[false]", "fn_name": "validate_time"}, {"input": "\"24:000\"", "output": "[false]", "fn_name": "validate_time"}, {"input": "\"010: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\nYou are given 2 numbers is `n` and `k`. You need to find the number of integers between 1 and n (inclusive) t...
[{"input": "10000000000000000000000\n21", "output": "[2407217760893271902598]", "fn_name": "almost_everywhere_zero"}, {"input": "10000000000000000000000\n3", "output": "[1122660]", "fn_name": "almost_everywhere_zero"}, {"input": "500309160\n2", "output": "[2604]", "fn_name": "almost_everywhere_zero"}, {"input": "100010...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLet's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a sin...
[{"input": "1000000000000\n", "output": "1\n"}, {"input": "1000000000000\n", "output": "1\n"}, {"input": "1000000000000\n", "output": "1\n"}, {"input": "100000000000\n", "output": "0\n"}, {"input": "100000000000\n", "output": "0\n"}, {"input": "999999999999\n", "output": "9\n"}, {"input": "100000000004\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\nHarry Potter is on a mission to destroy You-Know-Who's Horcruxes. The first Horcrux that he encountered in th...
[{"input": "9\nliyzmbjwnzryjokufuxcqtzwworjeoxkbaqrujrhdidqdvwdfzilwszgnzglnnbogaclckfnbqovtziuhwvyrqwmskx\nliyzmbjwnzryjokufuxcqtzwworjeoxkbaqrujrhdidqdvwdfzilwszgnzglnnbogaclckfnbqovtziuhwvyrqwmskx\nliyzmbjwnzryjokufuxcqtzwworjeoxkbaqrujrhdidqdvwdfzilwszgnzglnnbogaclckfnbqovtziuhwvyrqwmskx\nhrtm\nssjqvixduertmotgagiz...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nStep up and down\n\nKazuki, commonly known as Kerr, who attends JAG University, was invited by your friend th...
[{"input": "4\nlu ru ld rd\n4\nlu ld lu ru\n1\nlu\n10\nru lu ld rd ru rd ru lu rd ld\n0", "output": "2\n1\n0\n4"}, {"input": "4\nlu ru ld rd\n4\nlu ld lu ru\n0\nlu\n10\nur lu ld rd ru rd ru lu rd ld\n-1", "output": "2\n1\n"}, {"input": "4\nlu ru ld rd\n4\nlu ld lu ru\n0\nlu\n10\nur lu ld rd ru rd ru lu sd ld\n-1", "out...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nProfessor Tsukuba invented a mysterious jewelry box that can be opened with a special gold key whose shape is...
[{"input": "19\n 1 +x 1 +y +z 3 +z\n 3 +y -z +x +y -z -x +z 2 +z\n 2 +y\n19\n 1 +x 1 +x +z 3 +y -z +x +y -z -x +z 2 +y\n 3 +z\n 2 +z\n19\n 1 +x 1 +y +z 3 +z\n 3 +y -z +x +y -z -x +z 2 +y\n 2 +z\n18\n 1 -y\n 1 +y -z +x\n 1 +z +y +x +z +y -x -y 1 -y\n 2 +z\n3 +x +y +z\n3 +y +z -x\n0", "output": "DIFFERENT\nD...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays...
[{"input": "100 3\n.*.\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\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\nRead problems statements in Mandarin Chinese, Russian and Vietnamese as well. \nToday a plane was hijacked by...
[{"input": "2\n-1 -1 2\n0\n-1 0 3\n-3", "output": "-2\n-11\n"}, {"input": "2\n-1 0 2\n-1\n-1 0 3\n-3", "output": "-5\n-11\n"}, {"input": "2\n-1 0 4\n-2\n-1 1 5\n-3", "output": "-8\n-11\n"}, {"input": "2\n1 1 10\n-2\n-1 1 -2\n-1", "output": "-8\n-5\n"}, {"input": "2\n1 1 10\n-2\n-1 1 -1\n-2", "output": "-8\n-8\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\nTakahashi is a member of a programming competition site, ButCoder.\nEach member of ButCoder is assigned two v...
[{"input": "100 4111\n", "output": "4111\n"}, {"input": "22 3051\n", "output": "3051\n"}, {"input": "10 3141\n", "output": "3141\n"}, {"input": "11 3141\n", "output": "3141\n"}, {"input": "2 2919\n", "output": "3719\n"}, {"input": "1 4111\n", "output": "5011\n"}, {"input": "9 3141\n", "output": "3241\n"}, {"input": "3 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nProblem\n\nGPA is an abbreviation for \"Galaxy Point of Aizu\" and takes real numbers from 0 to 4.\nGPA rock-...
[{"input": "3\n1.2162360718264462\n2.9346880694304285\n3.9759367558439593", "output": "0\n3\n6\n"}, {"input": "3\n1.3676423535538285\n2.5451927881659007\n3.4551403734048662", "output": "0\n3\n6\n"}, {"input": "3\n2.2132650658019095\n2.5451927881659007\n3.4551403734048662", "output": "0\n3\n6\n"}, {"input": "3\n2.234124...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLittle Artem is fond of dancing. Most of all dances Artem likes rueda — Cuban dance that is danced by pairs o...
[{"input": "364 57\n1 -101\n1 110\n1 -76\n1 329\n2\n2\n2\n1 -191\n1 97\n1 189\n1 305\n1 -313\n1 312\n1 -148\n2\n1 -104\n1 85\n1 -55\n1 -79\n1 230\n1 -94\n1 58\n1 -72\n2\n2\n2\n1 -104\n1 -351\n1 23\n2\n1 215\n2\n2\n2\n1 58\n1 -237\n2\n2\n2\n1 198\n2\n1 83\n2\n1 -205\n2\n2\n2\n2\n1 -110\n2\n2\n2\n2\n1 153\n1 -344\n1 -281...
code_stdio
[ { "content": "You are an expert Python programmer. 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 an integer sequence A of length N, where A_1 = X, A_{i+1} = A_i + D (1 \\leq i < N ) holds.\nTakahas...
[{"input": "199903 -42042635 15996643\n", "output": "1331394274247808\n"}, {"input": "199937 46898475 97994148\n", "output": "1332073730358274\n"}, {"input": "199903 2748118 -84690464\n", "output": "1331394274247808\n"}, {"input": "199961 71272203 60243765\n", "output": "1322010346302492\n"}, {"input": "199966 -4418116...
code_stdio
[ { "content": "You are an expert Python programmer. 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 the easy and hard versions is that the given string $s$ in the easy version is in...
[{"input": "3\n3\n110\n2\n00\n4\n1010\n", "output": "\nALICE\nBOB\nALICE\n"}, {"input": "3\n3\n110\n2\n00\n4\n1010\n", "output": "ALICE\nBOB\nALICE\n"}, {"input": "3\n3\n110\n2\n00\n4\n1011\n", "output": "ALICE\nBOB\nALICE\n"}, {"input": "3\n3\n110\n2\n00\n4\n0011\n", "output": "ALICE\nBOB\nALICE\n"}, {"input": "3\n3\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n> If you've finished this kata, you can try the [more difficult version](https://www.codewars.com/kata/5b2561...
[{"input": "\"RLRLRLRRLRLL\"", "output": "[[290, 179]]", "fn_name": "promenade"}, {"input": "\"LRRLLRLLRLRR\"", "output": "[[161, 229]]", "fn_name": "promenade"}, {"input": "\"LRRLRLLLLRLL\"", "output": "[[107, 149]]", "fn_name": "promenade"}, {"input": "\"LLRLRLLRLLRL\"", "output": "[[112, 295]]", "fn_name": "promenad...
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\nChief Judge's log, stardate 48642.5. We have decided to make a problem from elementary number theory. The pro...
[{"input": "205920\n34152\n262200\n279936\n152244\n1", "output": "205920: 6 8 13 15 20 22 55 99\n34152: 6 8 4269 5692\n262200: 6 8 15 20 50 57 69 76 92 190 230 475 575 874 2185\n279936: 6 8 27\n152244: 6 4229\n"}, {"input": "205920\n262144\n262200\n9766\n81220\n1", "output": "205920: 6 8 13 15 20 22 55 99\n262144: 8\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\nIn this exercise, you will have to create a function named tiyFizzBuzz. This function will take on a string p...
[{"input": "\"Hello WORLD!\"", "output": "[\"IronYardllYard IronIron YardIronIronIron!\"]", "fn_name": "tiy_fizz_buzz"}, {"input": "\"H6H4Na ./?U\"", "output": "[\"Iron6Iron4IronYard ./?Iron Yard\"]", "fn_name": "tiy_fizz_buzz"}, {"input": "\"A\"", "output": "[\"Iron Yard\"]", "fn_name": "tiy_fizz_buzz"}, {"input": "\"...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given three positive integers $n$, $a$ and $b$. You have to construct a string $s$ of length $n$ cons...
[{"input": "1\n3495 231 24\n", "output": "abcdefghijklmnopqrstuvwxabcdefghijklmnopqrstuvwxabcdefghijklmnopqrstuvwxabcdefghijklmnopqrstuvwxabcdefghijklmnopqrstuvwxabcdefghijklmnopqrstuvwxabcdefghijklmnopqrstuvwxabcdefghijklmnopqrstuvwxabcdefghijklmnopqrstuvwxabcdefghijklmnopqrstuvwxabcdefghijklmnopqrstuvwxabcdefghijklmn...
code_stdio
[ { "content": "You are an expert Python programmer. 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=s_1s_2\\dots s_n$ of length $n$, which only contains digits $1$, $2$, ..., $9$.\n\n...
[{"input": "39\n263254663359864483324578786753512345165\n", "output": "327\n"}, {"input": "39\n263254663359864483324578786753512345165\n", "output": "327"}, {"input": "10\n9572683145\n", "output": "24\n"}, {"input": "10\n9572683145\n", "output": "24"}, {"input": "4\n2864\n", "output": "10\n"}, {"input": "4\n2244\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\nChef Jessie has a lot of recipes with her (N). She often remembered the starting few characters of the recipe...
[{"input": "4\nflour-with-eggs 100\nchicken-ham -10\nflour-without-eggs 200\nfish-with-pepper 1100\n6\nf\nflour-with\nflour-with-\nc\nfl\nciik", "output": "fish-with-pepper\nflour-without-eggs\nflour-with-eggs\nchicken-ham\nflour-without-eggs\nNO\n"}, {"input": "4\nflour-with-eggs 100\nchicken-ham -10\nflour-without-eg...
code_stdio
[ { "content": "You are an expert Python programmer. 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# Background:\n\nYou're working in a number zoo, and it seems that one of the numbers has gone missing!\n\nZo...
[{"input": "[2, 3, 4]", "output": "[1]", "fn_name": "find_missing_number"}, {"input": "[1, 3, 4]", "output": "[2]", "fn_name": "find_missing_number"}, {"input": "[1, 2, 4]", "output": "[3]", "fn_name": "find_missing_number"}, {"input": "[1, 2, 3]", "output": "[4]", "fn_name": "find_missing_number"}, {"input": "[1]", "o...
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# Hey You !\n\nSort these integers for me ...\n\nBy name ...\n\nDo it now !\n\n\n---\n\n## Input\n\n* Range i...
[{"input": "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 7...
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\nAllen has a LOT of money. He has $n$ dollars in the bank. For security reasons, he wants to withdraw it in ca...
[{"input": "1000000000\n", "output": "10000000\n"}, {"input": "1230910855\n", "output": "12309112\n"}, {"input": "1199225057\n", "output": "11992256\n"}, {"input": "1100000000\n", "output": "11000000\n"}, {"input": "1173603402\n", "output": "11736036\n"}, {"input": "1100010000\n", "output": "11000100\n"}, {"input": "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\nPetya studies in a school and he adores Maths. His class has been studying arithmetic expressions. On the las...
[{"input": "10\n10\n10\n", "output": "1000\n"}, {"input": "10\n10\n10\n", "output": "1000\n"}, {"input": "10\n5\n6\n", "output": "300\n"}, {"input": "10\n5\n6\n", "output": "300\n"}, {"input": "9\n14\n2\n", "output": "252\n"}, {"input": "4\n3\n10\n", "output": "120\n"}, {"input": "10\n9\n6\n", "output": "540\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\n# The Problem\n\nDan, president of a Large company could use your help. He wants to implement a system that w...
[{"input": "[[\"09:30\", \"10:15\"], [\"12:20\", \"15:50\"]]\n\"10:00\"", "output": "[\"10:15\"]", "fn_name": "check_availability"}, {"input": "[[\"09:30\", \"10:15\"], [\"12:20\", \"15:50\"]]\n\"11:00\"", "output": "[true]", "fn_name": "check_availability"}, {"input": "[[\"09:30\", \"10:15\"], [\"12:20\", \"15:50\"]]\...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nComplete the solution so that it returns the number of times the search_text is found within the full_text. \...
[{"input": "\"ccddeeccddeecc\"\n\"cc\"", "output": "[3]", "fn_name": "solution"}, {"input": "\"abcdefdvbhibjkb\"\n\"b\"", "output": "[4]", "fn_name": "solution"}, {"input": "\"abccded\"\n\"cc\"", "output": "[1]", "fn_name": "solution"}, {"input": "\"abccded\"\n\"d\"", "output": "[2]", "fn_name": "solution"}, {"input": ...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou finally got a magic pot, an alchemy pot. You can create a new item by putting multiple items in the alche...
[{"input": "8\nwood 5003\nstring 1120\nrice 32\nwater -1\nracket 5000\nmicrophone 4961\nonigiri 140\nguitar 98000\n3\nracket 2 wood string\nonigiri 2 rice water\nguitar 3 tekcar microphone onigiri\nguitar\n1\ncomputer 112750\n-1\ncomputer\n0", "output": "4992\n112750\n"}, {"input": "8\nwood 5003\nstring 1120\nrice 32\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\nManao works on a sports TV. He's spent much time watching the football games of some country. After a while h...
[{"input": "30\n44 17\n44 17\n44 17\n17 44\n44 17\n44 17\n17 44\n17 44\n17 44\n44 17\n44 17\n44 17\n44 17\n44 17\n17 44\n17 44\n17 44\n44 17\n44 17\n17 44\n44 17\n44 17\n44 17\n17 44\n17 44\n44 17\n17 44\n44 17\n44 17\n44 17\n", "output": "418\n"}, {"input": "30\n67 21\n85 39\n85 87\n21 39\n66 85\n10 95\n10 21\n87 85\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\nAquaMoon has n friends. They stand in a row from left to right, and the i-th friend from the left wears a T-s...
[{"input": "10\n10\n6 2 1 1 1 10 10 2 10 5\n8\n1 3 1 1 4 5 4 4\n9\n9 6 9 9 2 8 7 2 2\n10\n9 4 3 3 5 4 3 10 4 5\n9\n7 5 1 7 5 5 5 5 6\n8\n8 8 4 4 7 6 2 8\n10\n6 8 1 6 8 8 5 6 8 4\n10\n5 5 5 8 3 4 3 3 10 10\n8\n1 1 3 6 6 7 1 2\n8\n4 1 3 5 3 1 3 3\n", "output": "NO\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nNO\n"}, {"input"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a string $s$ consisting only of characters + and -. You perform some process with this string. ...
[{"input": "15\n-\n--\n+\n+-\n-\n+\n-\n+\n-\n-+\n-+\n-+\n-+\n-+\n-+\n", "output": "2\n5\n1\n2\n2\n1\n2\n1\n2\n3\n3\n3\n3\n3\n3\n"}, {"input": "15\n-\n--\n+\n+-\n-\n+\n-\n+\n-\n-+\n-+\n-+\n-+\n-+\n-+\n", "output": "2\n5\n1\n2\n2\n1\n2\n1\n2\n3\n3\n3\n3\n3\n3\n"}, {"input": "15\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\nAppleman has n cards. Each card has an uppercase letter written on it. Toastman must choose k cards from Appl...
[{"input": "100 50\nYYIYYAAAIEAAYAYAEAIIIAAEAAYEAEYYYIAEYAYAYYAAAIAYAEAAYAYYIYAAYYAAAAAAIYYYAAYAAEAAYAIEIYIYAYAYAYIIAAEY\n", "output": "1972\n"}, {"input": "100 90\nFAFAOOAOOAFAOTFAFAFFATAAAOFAAOAFBAAAFBOAOFFFOAOAFAPFOFAOFAAFOAAAAFAAFOFAAOFPPAAOOAAOOFFOFFFOFAOTOFAF\n", "output": "2828\n"}, {"input": "100 99\nBFFBBFBFBQ...
code_stdio
[ { "content": "You are an expert Python programmer. 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\nYou are in charge of quality control at a machine manufacturing plant. This machine requires a pow...
[{"input": "2 2 8\n4\n1 1 1 0\n5 3 4 0\n1 4 0 0\n1 3 0 0\n0 0 0", "output": "2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n"}, {"input": "1 2 8\n4\n4 1 1 0\n5 0 5 0\n-1 4 0 0\n1 3 2 0\n0 0 0", "output": "2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n"}, {"input": "4 2 4\n4\n3 1 -1 0\n5 3 4 1\n1 4 1 0\n1 3 0 0\n0 0 0", "output": "2\n2\n1\n1\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\nRead problems statements in Mandarin and Russian. Translations in Vietnamese to be uploaded soon. \n\nYou hav...
[{"input": "2\n2\n1 3\n2 4\n3\n2 7 9\n1 4 8\n3 6 5", "output": "4\n13\n"}, {"input": "2\n2\n1 3\n2 4\n3\n1 7 9\n3 4 8\n2 6 5", "output": "4\n12\n"}, {"input": "2\n2\n1 3\n2 4\n3\n1 7 9\n2 4 8\n6 3 5", "output": "4\n14\n"}, {"input": "2\n2\n1 3\n2 4\n3\n1 7 5\n2 4 8\n6 3 9", "output": "4\n16\n"}, {"input": "2\n2\n2 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\nThis is the easy version of the problem. The difference is the constraints on $n$, $m$ and $t$. You can make ...
[{"input": "10\n74 66 762901908\n543 237 181918820\n455 298 213830486\n54 35 373479158\n85 72 98863599\n85 72 351650459\n106 18 450755091\n344 26 748825922\n65 48 594595004\n189 52 282125334\n", "output": "271485562\n845881147\n625043331\n624104397\n478865056\n346406768\n733766402\n149326158\n296003967\n345448913\n"}, ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nGiven is a string S consisting of digits from 1 through 9.\nFind the number of pairs of integers (i,j) (1 ≤ i...
[{"input": "17363411548681837295128261415319567339781353176864449667411811151437528238242154453591258857339631698313648443916861223514163135267434612598561425414167173299132999132912477426521378378857571251998814421613836117444161875651252375139311654156139512913688822685276844411124583145973751484529881214395471691922...
code_stdio
[ { "content": "You are an expert Python programmer. 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\nSoccer is popular in JOI, and a league match called the JOI League is held every week.\n\nThere ar...
[{"input": "4\n1 1 0 21\n1 4 2 0\n1 -1 12 2\n4 3 1 3\n4 16 6 1\n-1 1 1 12", "output": "1\n4\n2\n2\n"}, {"input": "4\n1 2 0 19\n2 3 2 2\n1 0 22 1\n3 3 3 -1\n3 16 6 0\n0 1 -1 8", "output": "2\n3\n1\n4\n"}, {"input": "4\n1 2 0 19\n2 3 8 1\n2 0 22 1\n3 0 3 0\n3 16 5 0\n0 1 0 16", "output": "3\n1\n2\n4\n"}, {"input": "4\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\nSergey Semyonovich is a mayor of a county city N and he used to spend his days and nights in thoughts of furt...
[{"input": "10\n2 3\n3 9\n6 3\n9 8\n9 10\n4 10\n3 1\n2 5\n7 2\n", "output": "70\n"}, {"input": "10\n2 3\n2 9\n6 3\n9 8\n9 10\n4 10\n3 1\n2 5\n7 2\n", "output": "70\n"}, {"input": "10\n2 3\n3 9\n6 4\n10 8\n9 10\n4 2\n3 1\n3 5\n7 1\n", "output": "75\n"}, {"input": "10\n2 3\n2 9\n6 3\n9 8\n5 10\n4 10\n3 1\n2 5\n7 2\n", "o...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe Cereal Guy's friend Serial Guy likes to watch soap operas. An episode is about to start, and he hasn't wa...
[{"input": "4 10 10\n\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n\n..........\n..........\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\nGiven an array $a$, consisting of $n$ integers, find:\n\n$$\\max\\limits_{1 \\le i < j \\le n} LCM(a_i,a_j),$...
[{"input": "174\n28 44 12 32 9 27 23 5 23 47 14 49 39 5 10 5 20 9 4 34 18 40 16 4 45 30 32 44 44 30 29 23 21 27 35 13 23 46 5 32 47 45 44 23 12 2 9 28 47 23 22 27 45 27 40 41 22 39 50 14 40 44 20 40 49 23 14 29 27 23 16 40 45 44 15 18 28 9 23 15 21 10 46 29 18 6 15 3 11 34 1 15 35 27 46 36 4 20 30 20 5 35 24 37 42 42 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 a multiset $S$ initially consisting of $n$ distinct non-negative integers. A multiset is a set,...
[{"input": "7\n5 1000000000\n4 2 3 0 1\n4 0\n5 2 0 1\n3 0\n100 0 1\n6 1234567\n1 2 3 4 5 0\n3 114514\n8 0 4\n1 1000000\n0\n1 10000000\n1\n", "output": "1000000005\n4\n3\n1234573\n4\n1000001\n1\n"}, {"input": "7\n5 1000000000\n4 2 3 0 1\n4 0\n5 2 0 1\n3 0\n100 0 1\n6 1234567\n1 2 3 4 5 0\n3 114514\n8 0 4\n1 1000000\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\nChef recently saw the movie Matrix. He loved the movie overall but he didn't agree with some things in it. Pa...
[{"input": "3\n3 6\nabDefb\nbSooon\nNIKHil\n6 6\naaaaaa\nssssst\nxuisdP\noooooo\nioowoo\nbdylan\n6 5\njhfdb\ncacac\nopqrs\nddddd\nindia\nyucky", "output": "There is indeed no spoon!\nThere is indeed no spoon!\nThere is indeed no spoon!\n"}, {"input": "3\n3 6\nbfeDba\nbnpooS\nNIKHil\n6 6\naaaaaa\nssssss\nOdsiux\noooooo\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThumbelina has had an accident. She has found herself on a little island in the middle of a swamp and wants t...
[{"input": "200 72 29\n201 145 169 163 32 126 131 71 26 130 2 61 110 17 179 114 79 30 192 91 141 70 101 119 185 66 72 76 164 144 106 162 122 146 119 181 184 61 131 131 140 152 60 65 183 154 32 33 108 77 29 102 67 5 125 26 126 104 20 89 183 21 126 195 198 24 123 173 135 164 141 32\n160 65 136 22 194 110 155 138 92 118 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\nThe athletics competition 200M semi-final three races were held. Eight players (24 players in total) will par...
[{"input": "18 25.46\n16 26.23\n3 23.00\n10 25.483235609039603\n5 22.88\n11 24.901687688146353\n34 23.981112112664086\n1 25.301186029802214\n23 24.244672722558832\n2 23.844314504002764\n7 24.77498515307103\n17 24.26966625451088\n13 21.99\n26 22.86\n9 23.12\n6 24.09\n17 22.51\n22 23.49\n4 23.9495728367704\n14 22.23\n5 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 N dots in a two-dimensional plane. The coordinates of the i-th dot are (x_i, y_i).\nWe will repeat ...
[{"input": "1000\n75100 60743\n9726 45312\n39324 37026\n6218 24919\n37911 86455\n24562 12622\n88324 30198\n33847 67328\n2909 91511\n42029 31498\n41511 74704\n96712 15653\n86190 59227\n59789 67915\n15677 3177\n66597 62255\n27003 69079\n83921 51556\n49566 24925\n44399 87252\n70161 73909\n7368 27271\n54727 29016\n40590 56...
code_stdio