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\nOne day, liouzhou_101 got a chat record of Freda and Rainbow. Out of curiosity, he wanted to know which sente... | [{"input": "10\nmiao.vyscfysAtWcPkpFHdwZqAQ,UPPcjhKQTlala.\nmiao.KESqus DybUuYFoWVpo..LWZh.UqEdUsTHFlKfzqkThAUPklala.\nUNoE vfZIAdxkiWKhsHPfsqRPTNQoHgAxooVLYxRzugHjo jaEHWQFF\nCCmdIwr.UkoiYWK.Z,,ZesMpISTXNgnpYnJaWquCyL,gO\n.JvOayhXK_bgoYbfAtnXg\nbvdSzRrXoGxVgWvdXnsjEnEfxDzIQo_aZVGDGrzwuAMtzVAHioMBx_DHuTxyieGbGuSRNUojOR... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 A and B.\nFind the largest value among A+B, A-B and A \\times B.\n\n-----Constrain... | [{"input": "-17 -10", "output": "170\n"}, {"input": "-10 -10", "output": "100\n"}, {"input": "-156 -1", "output": "156\n"}, {"input": "-156 -2", "output": "312\n"}, {"input": "-156 -3", "output": "468\n"}, {"input": "-115 1", "output": "-114\n"}, {"input": "297 -1", "output": "298\n"}, {"input": "-34 15", "output": "-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\nAfter Misha's birthday he had many large numbers left, scattered across the room. Now it's time to clean up a... | [{"input": "10\n3035890458\n12148270198\n3004213265\n248593357\n5644084048\n14918970762\n8120649160\n4828464769\n183848555\n8135845959\n", "output": "0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n"}, {"input": "10\n3035890458\n12148270198\n5256278021\n248593357\n5644084048\n14918970762\n8120649160\n4828464769\n183848555\n8135845959\n"... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given an array of integers. Vasya can permute (change order) its integers. He wants to do it so that ... | [{"input": "6\n300000000 200000000 300000000 200000000 1000000000 300000000\n", "output": "3\n"}, {"input": "6\n300000000 200000000 173776099 200000000 1000000000 300000000\n", "output": "4\n"}, {"input": "6\n300000000 200000000 173776099 200000000 1000000000 42712044\n", "output": "4\n"}, {"input": "6\n300000000 59981... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 program that reads the sales unit price and sales quantity and outputs the total sales amount and th... | [{"input": "02,001\n50,10\n8,531", "output": "4750\n181\n"}, {"input": "0,1000\n01,05\n134,8", "output": "1077\n338\n"}, {"input": "0,1000\n01,05\n134,9", "output": "1211\n338\n"}, {"input": "0,1000\n11,05\n134,9", "output": "1261\n338\n"}, {"input": "0,1000\n12,05\n134,9", "output": "1266\n338\n"}, {"input": "0,1000\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 tree T with N vertices. The i-th edge connects Vertex A_i and B_i (1 \\leq A_i,B_i \\leq N).\nNow,... | [{"input": "7\n4 7\n3 1\n2 6\n5 2\n7 1\n2 7\n", "output": "570312505\n"}, {"input": "7\n4 7\n3 1\n2 6\n5 4\n7 1\n2 7", "output": "835937507\n"}, {"input": "7\n4 7\n3 1\n3 6\n5 4\n7 1\n2 7", "output": "679687506\n"}, {"input": "7\n4 7\n3 1\n2 6\n5 1\n7 1\n2 7", "output": "570312505\n"}, {"input": "7\n4 7\n3 1\n3 6\n5 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\nLast summer Peter was at his granny's in the country, when a wolf attacked sheep in the nearby forest. Now he... | [{"input": "1000000\n", "output": "958220352\n"}, {"input": "972408\n", "output": "377259665\n"}, {"input": "956022\n", "output": "864671299\n"}, {"input": "941322\n", "output": "359985814\n"}, {"input": "908550\n", "output": "307673807\n"}, {"input": "635758\n", "output": "524558133\n"}, {"input": "992164\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\nAlex is transitioning from website design to coding and wants to sharpen his skills with CodeWars. \nHe can ... | [{"input": "10\n120", "output": "[3]", "fn_name": "alex_mistakes"}, {"input": "11\n120", "output": "[3]", "fn_name": "alex_mistakes"}, {"input": "20\n120", "output": "[0]", "fn_name": "alex_mistakes"}, {"input": "20\n125", "output": "[1]", "fn_name": "alex_mistakes"}, {"input": "20\n130", "output": "[1]", "fn_name": "a... | code_functional |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn this problem you are to calculate the sum of all integers from 1 to n, but you should take all powers of t... | [{"input": "60\n536870912\n536870911\n536870913\n1000000000\n999999999\n1\n2\n3\n4\n268435456\n268435455\n268435457\n536870912\n536870911\n536870913\n1000000000\n999999999\n1\n2\n3\n4\n268435456\n268435455\n268435457\n536870912\n536870911\n536870913\n1000000000\n999999999\n1\n2\n3\n4\n268435456\n268435455\n268435457\n5... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nBerland scientists know that the Old Berland language had exactly n words. Those words had lengths of l1, l2,... | [{"input": "100\n17 18 22 15 14 18 9 21 14 19 14 20 12 15 9 23 19 20 19 22 13 22 17 11 21 22 8 17 23 18 21 23 22 23 15 18 21 17 17 9 13 21 23 19 18 23 15 14 17 19 22 23 12 16 23 16 20 9 12 17 18 11 10 17 16 21 8 21 16 19 21 17 12 20 14 16 17 10 22 20 17 13 15 19 9 22 12 20 20 13 19 16 18 7 15 18 6 18 19 21\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# Introduction and Warm-up (Highly recommended)\n\n# [Playing With Lists/Arrays Series](https://www.codewars.... | [{"input": "[-54, 37, 0, 64, -15, 640, 0]", "output": "[576]", "fn_name": "max_gap"}, {"input": "[24, 299, 131, 14, 26, 25]", "output": "[168]", "fn_name": "max_gap"}, {"input": "[-7, -42, -809, -14, -12]", "output": "[767]", "fn_name": "max_gap"}, {"input": "[12, -5, -7, 0, 290]", "output": "[278]", "fn_name": "max_ga... | 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\nLeo has developed a new programming language C+=. In C+=, integer variables can only be changed with a \"+=\"... | [{"input": "16\n1 1 1\n3 4 6\n4 5 16\n456 123 7890123\n1 1 1000000000\n45 12 782595420\n1 1000000000 1001000000\n1 999999999 1000000100\n1 99999 676497416\n5 6 1409378894\n8 9 1376775908\n500000000 500000000 1000000000\n1000000000 1000000000 1000000000\n999999999 1000000000 1000000000\n1066 1487360 987405273\n12116 537... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 sorted array $a_1, a_2, \\dots, a_n$ (for each index $i > 1$ condition $a_i \\ge a_{i-1}$ hol... | [{"input": "7 6\n-3 0 -1 -2 -2 -4 -1\n", "output": "-2\n"}, {"input": "8 1\n1 1 2 3 5 8 13 21\n", "output": "20\n"}, {"input": "5 3\n99 101 103 105 107\n", "output": "4\n"}, {"input": "5 3\n99 101 103 105 107\n", "output": "4\n"}, {"input": "8 2\n1 1 2 3 5 8 13 21\n", "output": "12\n"}, {"input": "8 4\n1 1 2 3 5 8 22 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\nAlice is playing a game with her good friend, Marisa.\n\nThere are n boxes arranged in a line, numbered with ... | [{"input": "8000 100\n7990 4432 5901 5019 423 1200 7760 5752 7422 4337 4802 2570 7354 4912 2185 2344 6538 2783 1473 5311 3987 4739 7159 1677 3438 502 2800 1318 5223 4518 4448 6451 3455 5012 1588 814 4971 5847 3849 6248 6420 3607 2610 6852 1045 3730 757 6905 5248 3738 2382 7251 1305 7380 2476 7346 5721 5946 7599 5321 62... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with inte... | [{"input": "4 4 4\n1 2\n2 3\n3 4\n1 3\n1 2 3\n1 3 4\n1 2 4\n1 3 2\n", "output": "-1\n"}, {"input": "4 4 2\n1 2\n2 3\n3 4\n1 3\n1 2 3\n1 3 4\n", "output": "4\n1 3 2 3 4\n"}, {"input": "4 4 1\n1 2\n2 3\n3 4\n1 3\n1 3 4\n", "output": "3\n1 2 3 4\n"}, {"input": "4 4 1\n1 2\n2 3\n3 4\n2 3\n1 3 4\n", "output": "3\n1 2 3 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\nTakahashi will play a game using a piece on an array of squares numbered 1, 2, \\cdots, N. Square i has an in... | [{"input": "5000 1000000000\n2736 2472 4235 589 1974 2469 3229 2748 1350 1280 163 2424 391 784 3174 608 3060 2125 3128 1366 1374 4193 4562 2456 2118 1870 2581 879 3424 3886 1917 847 4646 4880 4407 3527 252 770 3405 1122 4272 3227 4221 802 2571 3857 4554 3275 3243 3903 2258 401 2292 1447 1014 1 4210 4719 3693 3181 4044 ... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 initially a string of N characters, denoted by A1,A2...AN. You have to print the size of the largest... | [{"input": "2\nabd\naba", "output": "3\n2\n"}, {"input": "2\nabc\naaa", "output": "3\n1\n"}, {"input": "2\ncca\naaa", "output": "2\n1\n"}, {"input": "2\nccb\naab", "output": "2\n2\n"}, {"input": "2\nccb\ncba", "output": "2\n3\n"}, {"input": "2\nbbb\nbaa", "output": "1\n2\n"}, {"input": "2\nbbb\naaa", "output": "1\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\nYou talked to Polycarp and asked him a question. You know that when he wants to answer \"yes\", he repeats Ye... | [{"input": "12\nYES\nesYes\ncodeforces\nes\nse\nYesY\nesYesYesYesYesYesYe\nseY\nYess\nsY\no\nYes\n", "output": "NO\nYES\nNO\nYES\nNO\nYES\nYES\nNO\nNO\nYES\nNO\nYES\n"}, {"input": "1\nsYesYesYesYesYesYesYesYesYesYesYesYesYesYesYesYesY\n", "output": "YES\n"}, {"input": "1\nYesYesYesYesYesYesa\n", "output": "NO\n"}, {"in... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are n psychos standing in a line. Each psycho is assigned a unique integer from 1 to n. At each step ev... | [{"input": "100\n61 96 25 10 50 71 38 77 76 75 59 100 89 66 6 99 2 13 3 23 91 93 22 92 4 86 90 44 39 31 9 47 28 95 18 54 1 73 94 78 60 20 42 84 97 83 16 81 67 64 74 46 82 5 88 80 14 48 53 79 30 11 62 21 41 70 63 58 51 56 57 17 87 72 27 85 68 49 52 8 12 98 43 37 35 69 55 32 26 40 29 65 19 24 34 33 15 45 36 7\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\nMr. Matsudaira is always careful about eco-friendliness in his life. Last month's water charge was 4280 yen, ... | [{"input": "29\n104\n0\n-1", "output": "620\n-11360\n3130\n"}, {"input": "29\n112\n0\n-1", "output": "620\n-12640\n3130\n"}, {"input": "29\n130\n1\n-1", "output": "620\n-15520\n3130\n"}, {"input": "29\n97\n0\n-1", "output": "620\n-10240\n3130\n"}, {"input": "29\n96\n1\n-1", "output": "620\n-10080\n3130\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 n k-digit integers. You have to rearrange the digits in the integers so that the difference bet... | [{"input": "8 8\n83239439\n62184887\n58968944\n39808261\n68740623\n38480328\n81965504\n52600488\n", "output": "44481119\n"}, {"input": "8 8\n96805230\n73119021\n06552907\n86283347\n88650846\n19155689\n37032451\n19310120\n", "output": "53604668\n"}, {"input": "8 8\n68785928\n11981277\n32480720\n72495162\n69969623\n42118... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLet's consider all integers in the range from $1$ to $n$ (inclusive).\n\nAmong all pairs of distinct integers... | [{"input": "100\n2\n3\n4\n6\n6\n9\n8\n9\n10\n11\n12\n23\n14\n15\n5\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n11\n20\n35\n36\n37\n38\n65\n40\n41\n42\n43\n44\n70\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n71\n72\n73\n39\n49\n76\n77\n78\n79\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\nBamboo Blossoms\n\nThe bamboos live for decades, and at the end of their lives, they flower to make their see... | [{"input": "3 2\n2 6\n10 10\n110 181\n2 371896\n0 0", "output": "5\n17\n21\n379\n5361757\n"}, {"input": "12 1\n3 1\n10 20\n100 50\n3 202868\n0 0", "output": "13\n4\n47\n150\n2792771\n"}, {"input": "2 4\n3 1\n13 35\n100 47\n4 346519\n0 0", "output": "11\n4\n101\n147\n4969351\n"}, {"input": "3 2\n3 4\n10 20\n100 50\n2 50... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 knight - the chess piece - at the origin (0, 0) of a two-dimensional grid.\nWhen the knight is at ... | [{"input": "999999 999999\n", "output": "151840682\n"}, {"input": "803622 615354\n", "output": "984439211\n"}, {"input": "691947 979659\n", "output": "966489110\n"}, {"input": "411938 406831\n", "output": "625271651\n"}, {"input": "329039 389257\n", "output": "766659580\n"}, {"input": "544850 859069\n", "output": "7052... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAlas, finding one's true love is not easy. Masha has been unsuccessful in that yet. Her friend Dasha told Mas... | [{"input": "17601120900014764776764048700928872725171605903217\n", "output": "10428170619\n"}, {"input": "78767765544454334445445555455676565433343455432332\n", "output": "11031574582\n"}, {"input": "67676566654565654332111011212211111223433222110012\n", "output": "5882859948\n"}, {"input": "107644873278096903327544821... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nI am a craftsman specialized in interior works. A customer asked me to perform wiring work on a wall whose en... | [{"input": "1 -11", "output": "-10\n"}, {"input": "171 2", "output": "173\n"}, {"input": "120 3", "output": "121\n"}, {"input": "109 1", "output": "110\n"}, {"input": "119 1", "output": "120\n"}, {"input": "150 2", "output": "151\n"}, {"input": "148 1", "output": "149\n"}, {"input": "169 2", "output": "171\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 rabbit who came to the fair found that the prize for a game at a store was a carrot cake. The rules for thi... | [{"input": "4 6 1\n......\n...Y..\n/..Z..\nYRRRYY", "output": "YES\n"}, {"input": "4 6 1\n......\n...Y..\n..Z../\nYRRRYY", "output": "YES\n"}, {"input": "4 6 1\n......\n...Y./\n/..Z..\nYRRRYY", "output": "YES\n"}, {"input": "0 10 3\n......\n/.Y...\n/..Y..\nRRYRYY", "output": "NO\n"}, {"input": "4 6 1\n......\n...Y..\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, return the difference between the count of even numbers and the count of odd numbers. `0` wil... | [{"input": "[5, 15, 16, 10, 6, 4, 16, \"t\", 13, \"n\", 14, \"k\", \"n\", 0, \"q\", \"d\", 7, 9]", "output": "[2]", "fn_name": "solve"}, {"input": "[0, 15, \"z\", 16, \"m\", 13, 14, \"c\", 9, 10, 13, \"u\", 4, 3]", "output": "[0]", "fn_name": "solve"}, {"input": "[1, \"a\", 17, 8, \"e\", 3, \"i\", 12, 1]", "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\nMr. Infinity has a string S consisting of digits from 1 to 9. Each time the date changes, this string changes... | [{"input": "3822434535651488671388118263222567477765652247558781154667867787813244635482224781486555517652377271\n150250350450550650\n", "output": "3\n"}, {"input": "111111111111111111117322118756841484815524346474882856582285635434521523587354424471731255584\n975864753642531420\n", "output": "7\n"}, {"input": "1111111... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n_This kata is based on [Project Euler Problem 546](https://projecteuler.net/problem=546)_\n\n# Objective\n\nG... | [{"input": "3\n50000", "output": "[80887845303700596855]", "fn_name": "f"}, {"input": "100\n500000", "output": "[21469002551]", "fn_name": "f"}, {"input": "2\n1000", "output": "[264830889564]", "fn_name": "f"}, {"input": "97\n100000", "output": "[209497156]", "fn_name": "f"}, {"input": "2\n200", "output": "[7389572]", ... | 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\nSummer is coming! It's time for Iahub and Iahubina to work out, as they both want to look hot at the beach. T... | [{"input": "4 5\n87882 40786 3691 85313 46694\n28884 16067 3242 97367 78518\n4250 35501 9780 14435 19004\n64673 65438 56977 64495 27280\n", "output": "747898\n"}, {"input": "4 5\n2274 40786 3691 98933 46694\n28884 16067 3242 97367 73338\n8377 57682 9780 14435 19004\n64673 65438 103768 64495 27280\n", "output": "717521\... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWrite a simple regex to validate a username. Allowed characters are:\n\n- lowercase letters,\n- numbers,\n- u... | [{"input": "\"Hasd_12assssssasasasasasaasasasasas\"", "output": "[false]", "fn_name": "validate_usr"}, {"input": "\"asd43 34\"", "output": "[false]", "fn_name": "validate_usr"}, {"input": "\"asd43_34\"", "output": "[true]", "fn_name": "validate_usr"}, {"input": "\"asddsa\"", "output": "[true]", "fn_name": "validate_usr... | 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\nFormula 1 officials decided to introduce new competition. Cars are replaced by space ships and number of poin... | [{"input": "4 2\n29 16 13 10\n20 10 10 -1\n", "output": "1\n"}, {"input": "4 3\n50 30 20 10\n15 10 7 10\n", "output": "3\n"}, {"input": "4 4\n29 16 13 10\n20 10 8 -1\n", "output": "1\n"}, {"input": "4 3\n51 30 20 10\n15 10 7 10\n", "output": "3\n"}, {"input": "4 2\n29 16 13 10\n20 10 8 -1\n", "output": "1\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\nOranges on Cans\n\nsquare1001 You put a $ N $ can of aluminum on the table.\n\nE869120 You put $ M $ of orang... | [{"input": "-17 16", "output": "-272\n"}, {"input": "-17 30", "output": "-510\n"}, {"input": "-17 44", "output": "-748\n"}, {"input": "-2 125", "output": "-250\n"}, {"input": "-1 111", "output": "-111\n"}, {"input": "-2 110", "output": "-220\n"}, {"input": "-2 100", "output": "-200\n"}, {"input": "13 100", "output": "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 stones, numbered 1, 2, \\ldots, N. For each i (1 \\leq i \\leq N), the height of Stone i is h_i. ... | [{"input": "2 1000000100100\n1174717 1001000", "output": "1030177696189\n"}, {"input": "2 1000000000100\n1174717 1001000", "output": "1030177596189\n"}, {"input": "2 1000000000000\n1807061 1100100", "output": "1499793855521\n"}, {"input": "2 1000000000000\n1249354 1100100", "output": "1022276756516\n"}, {"input": "2 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\nGoal\nGiven a list of elements [a1, a2, ..., an], with each ai being a string, write a function **majority** ... | [{"input": "[\"A\", \"A\", \"A\", \"BBBBBBBB\"]", "output": "[\"A\"]", "fn_name": "majority"}, {"input": "[\"A\", \"B\", \"B\", \"A\"]", "output": "[null]", "fn_name": "majority"}, {"input": "[\"A\", \"A\", \"A\", \"A\"]", "output": "[\"A\"]", "fn_name": "majority"}, {"input": "[\"A\", \"B\", \"C\", \"C\"]", "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\nLimak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and ... | [{"input": "20 2 15\n12698951 55128070 116962690 156763505 188535242 332511771 269939893 428710623 802222241 483000923 516768937 552903993 633087286 656092270 671535141 714291344 1397620094 1268000284 879748146 937368929\n2 7\n1 2\n2 4\n2 19\n1 12\n1 5\n2 18\n2 11\n1 16\n2 1\n2 3\n2 19\n1 17\n2 4\n2 11\n", "output": "N... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nHappy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the na... | [{"input": "10 12\nsin im gye gap eul bynoeg jeong mu gj gyeong\nyu sul hae jb chuk in myo jin as o li sin\n14\n1\n1\n3\n4\n17\n17\n12\n13\n73\n2016\n32\n2018\n2019\n2020\n", "output": "sinyu\nsinyu\ngyehae\ngapjb\njeongchuk\njeongchuk\nimsin\ngyeyu\ngyeyu\nbynoegsin\nimjin\nmusul\ngjhae\ngyeongjb\n"}, {"input": "10 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\nRecently personal training sessions have finished in the Berland State University Olympiad Programmer Trainin... | [{"input": "7\n4 19 14 8 21 16 2 18 1 15 3 17 13 5 6 10 9 7 12 11 20\n4 19 10\n14 8 3\n21 17 9\n16 6 12\n2 13 20\n18 1 7\n15 5 11\n21\n", "output": "3 4 8 9 10 14 17 1 2 5 6 7 11 12 13 15 16 18 19 20\n"}, {"input": "6\n6 4 10 16 14 11 13 1 7 17 18 15 5 3 9 12 2 8\n6 10 1\n4 3 9\n16 11 13\n14 15 2\n7 18 5\n17 12 8\n7\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\nAccording to ISO 8601, the first calendar week (1) starts with the week containing the first thursday in janu... | [{"input": "\"2017-01-01\"", "output": "[52]", "fn_name": "get_calendar_week"}, {"input": "\"2018-12-24\"", "output": "[52]", "fn_name": "get_calendar_week"}, {"input": "\"2015-12-29\"", "output": "[53]", "fn_name": "get_calendar_week"}, {"input": "\"1995-12-31\"", "output": "[52]", "fn_name": "get_calendar_week"}, {"i... | 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 an array $a_1, a_2, \\dots, a_n$ where all $a_i$ are integers and greater than $0$.\n\n In one ... | [{"input": "4\n1\n8\n6\n4 4 6 6 2 9\n4\n4 5 6 10\n5\n10 10 2 2 4\n", "output": "YES\nYES\nYES\nYES\n"}, {"input": "4\n1\n8\n6\n4 4 6 6 2 9\n4\n4 5 6 7\n5\n10 10 2 2 4\n", "output": "YES\nYES\nYES\nYES\n"}, {"input": "4\n1\n8\n6\n4 4 6 6 2 15\n4\n4 5 6 7\n5\n7 10 2 2 3\n", "output": "YES\nYES\nYES\nNO\n"}, {"input": "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\nThe circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring ... | [{"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\nYou are given a sequence of $n$ integers $a_1, \\, a_2, \\, \\dots, \\, a_n$.\n\nDoes there exist a sequence ... | [{"input": "20\n5\n6711 19885 -3098 -16272 -10076\n4\n86522 29647 -12464 -9627\n4\n-82555 -5215 -15221 -63129\n4\n-18147 4 5 -5\n5\n-17427 -19079 17427 15043 19079\n5\n15148 5942 361 9206 21087\n3\n-1 -55 1\n5\n47214 53109 39369 11561 -22908\n4\n-74790 54187 -2 30242\n2\n-68120 94070\n3\n-27228 46215 -33546\n2\n75489 9... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn this problem you have to simulate the workflow of one-thread server. There are n queries to process, the i... | [{"input": "4 3\n999999996 1000000000\n999999997 1000000000\n999999998 1000000000\n999999999 1000000000\n", "output": "1999999996 2999999996 3999999996 4999999996 \n"}, {"input": "4 3\n999999996 1000000000\n999999997 1000000000\n999999998 1000000000\n999999999 1000000000\n", "output": "1999999996 2999999996 3999999996 ... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 play a strategic video game (yeah, we ran out of good problem legends). In this game you control a large ... | [{"input": "10 10 2\n2 1 1615\n2 1 1326\n0 0 3880\n2 0 1596\n1 2 4118\n0 0 4795\n0 1 814\n0 0 4555\n0 1 3284\n2 2 1910\n10 6\n2 1\n8 3\n8 7\n6 3\n4 1\n7 4\n6 4\n7 2\n10 9\n", "output": "27079\n"}, {"input": "10 10 0\n0 2 1413\n0 0 4466\n0 0 2681\n0 0 2959\n0 2 1182\n0 0 468\n0 1 3347\n0 0 3978\n0 2 2831\n0 3 3138\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\nWe have three boxes A, B, and C, each of which contains an integer.\n\nCurrently, the boxes A, B, and C conta... | [{"input": "100 100 100\n", "output": "100 100 100\n"}, {"input": "111 110 110", "output": "110 111 110\n"}, {"input": "110 110 110", "output": "110 110 110\n"}, {"input": "110 110 111", "output": "111 110 110\n"}, {"input": "010 100 100", "output": "100 10 100\n"}, {"input": "011 101 100", "output": "100 11 101\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 drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\nHow man... | [{"input": "5\ngrape\ngrape\ngrape\ngrape\ngrape\n", "output": "1\n"}, {"input": "5\ngrape\ngrape\ngraoe\ngrape\ngrape", "output": "2\n"}, {"input": "5\negapr\ngrape\ngraoe\ngr`pe\nepaqg", "output": "5\n"}, {"input": "5\ngrape\ngrape\ngraoe\ngrape\neparg", "output": "3\n"}, {"input": "5\ngrape\ngrape\ngraoe\ngrape\nepa... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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, Wet Shark is given n integers. Using any of these integers no more than once, Wet Shark wants to get m... | [{"input": "5\n999999999 503514429 850382710 999999999 1620498919\n", "output": "4974396056\n"}, {"input": "5\n999999999 503514429 850382710 999999999 1246839866\n", "output": "4097222574\n"}, {"input": "5\n999999999 999999999 850382710 999999999 999999999\n", "output": "4850382706\n"}, {"input": "5\n999999999 50351442... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nOnce when Gerald studied in the first year at school, his teacher gave the class the following homework. She ... | [{"input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n99\n", "output": "1\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"}, {"input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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, Petya learned about a new game \"Slay the Dragon\". As the name suggests, the player will have to f... | [{"input": "4\n3 0 2 3\n5\n6 12\n2 22\n2 14\n1 7\n14 17\n", "output": "10\n16\n8\n1\n23\n"}, {"input": "4\n3 5 2 3\n5\n6 12\n2 22\n2 14\n1 7\n14 17\n", "output": "5\n11\n3\n0\n18\n"}, {"input": "4\n3 5 2 3\n5\n6 4\n2 22\n2 14\n2 14\n14 17\n", "output": "1\n11\n3\n3\n18\n"}, {"input": "4\n3 5 2 3\n5\n3 12\n2 15\n1 14\n1... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a special jigsaw puzzle consisting of $n\\cdot m$ identical pieces. Every piece has three tabs ... | [{"input": "3\n1 10\n001000 100000\n10 2\n", "output": "YES\nNO\nNO\n"}, {"input": "3\n1 10\n001000 100000\n16 2\n", "output": "YES\nNO\nNO\n"}, {"input": "3\n1 12\n110000 101110\n1 2\n", "output": "YES\nNO\nYES\n"}, {"input": "3\n1 15\n001000 100000\n16 2\n", "output": "YES\nNO\nNO\n"}, {"input": "3\n1 12\n110000 1011... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 given picture with size $w \\times h$. Determine if the given picture has a single \"+\" shape or ... | [{"input": "10 10\n..........\n..........\n....*.....\n....*.....\n.*******..\n....*.....\n....*.....\n..........\n....*.....\n..........\n", "output": "NO\n"}, {"input": "10 10\n..........\n..........\n....*.....\n....*.....\n.*******..\n....*.....\n....*.....\n..........\n....**....\n..........\n", "output": "NO\n"},... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English... | [{"input": "9\ncjfferent\ndifferent\ntnereffid", "output": "10\n"}, {"input": "9\ntneredfic\nciffeernt\ndifferent", "output": "11\n"}, {"input": "9\ntnedergia\ncifreefnt\ndifsnfeet", "output": "14\n"}, {"input": "9\ntnedergib\nbifrfegnt\ntcdfmtfhe", "output": "16\n"}, {"input": "9\ntnedeqgib\nbifrfegnt\ngcdfmtfte", "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\nGiven a string, determine if it's a valid identifier.\n\n## Here is the syntax for valid identifiers:\n* Each... | [{"input": "\"1ok0okay\"", "output": "[false]", "fn_name": "is_valid"}, {"input": "\"okay_ok1\"", "output": "[true]", "fn_name": "is_valid"}, {"input": "\"myIdentf\"", "output": "[true]", "fn_name": "is_valid"}, {"input": "\"str-str\"", "output": "[false]", "fn_name": "is_valid"}, {"input": "\"str_STR\"", "output": "[t... | 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\nWrite\n```python\nfunction repeating_fractions(numerator, denominator)\n```\nthat given two numbers represent... | [{"input": "18018018\n80000000000", "output": "[\"0.(0)(2)5(2)5(2)5\"]", "fn_name": "repeating_fractions"}, {"input": "1554\n70", "output": "[\"22.2\"]", "fn_name": "repeating_fractions"}, {"input": "1\n3", "output": "[\"0.(3)\"]", "fn_name": "repeating_fractions"}, {"input": "0\n1", "output": "[\"0.0\"]", "fn_name": "... | code_functional |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA traveler is planning a water hike along the river. He noted the suitable rest points for the night and wrot... | [{"input": "19 2\n1 73\n2 96\n3 24\n5 96\n11 13\n14 96\n16 31\n17 60\n34 69\n39 41\n60 40\n61 96\n66 7\n67 56\n70 28\n73 12\n74 81\n78 77\n95 99\n", "output": "2 3 4 6 7 8 11 12 14 15 17 18 19\n"}, {"input": "20 8\n2 37\n9 28\n13 63\n14 85\n27 27\n29 90\n34 96\n36 60\n41 14\n45 25\n46 95\n48 59\n53 12\n55 69\n61 11\n76... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIt is a simplified version of problem F2. The difference between them is the constraints (F1: $k \\le 2$, F2:... | [{"input": "4\n1 1\n221 2\n177890 2\n998244353 1\n", "output": "1\n221\n181111\n999999999\n"}, {"input": "4\n1 1\n221 2\n177890 1\n998244353 1\n", "output": "1\n221\n222222\n999999999\n"}, {"input": "4\n1 1\n221 2\n108810 1\n998244353 1\n", "output": "1\n221\n111111\n999999999\n"}, {"input": "4\n2 1\n221 2\n177890 2\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\nYou are given an undirected graph with N vertices and 0 edges. Process Q queries of the following types.\n\n*... | [{"input": "4 7\n0 0 1\n-1 1 1\n-1 2 3\n1 0 1\n1 2 2\n-1 0 3\n-1 1 1", "output": "1\n0\n1\n1\n0\n1\n"}, {"input": "4 7\n0 0 1\n-1 2 1\n-1 2 3\n1 0 1\n1 2 2\n-1 0 3\n-1 1 1", "output": "0\n0\n1\n1\n0\n1\n"}, {"input": "9 7\n1 1 1\n-1 0 1\n-1 2 3\n1 0 2\n0 0 4\n-1 0 1\n2 1 3", "output": "1\n0\n0\n0\n0\n0\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\nThere are n heaps of stone. The i-th heap has h_i stones. You want to change the number of stones in the heap... | [{"input": "4\n4\n1 0 18 100\n4\n100 000 100 1\n5\n10 2 1 1 3\n6\n1 4 4 3 5 24\n", "output": "13\n1\n1\n3\n"}, {"input": "4\n4\n1 0 18 100\n4\n100 000 100 1\n5\n10 2 1 1 2\n6\n2 4 4 3 5 24\n", "output": "13\n1\n1\n4\n"}, {"input": "4\n4\n0 0 18 100\n4\n100 000 100 1\n5\n10 2 1 1 2\n6\n2 4 4 3 5 24\n", "output": "12\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\nYour task is to write function which takes string and list of delimiters as an input and returns list of stri... | [{"input": "\"Solve_this|kata-very\\\\quickly!\"\n[\"!\", \"|\", \"\\\\\", \"_\", \"-\"]", "output": "[[\"Solve\", \"this\", \"kata\", \"very\", \"quickly\"]]", "fn_name": "multiple_split"}, {"input": "\"((1+2))*(6-3)^9\"\n[\"+\", \"-\", \"(\", \")\", \"^\", \"*\"]", "output": "[[\"1\", \"2\", \"6\", \"3\", \"9\"]]", "... | 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\nExample\n\nInput\n\n3 2\nR1\n\n\nOutput\n\n3 1 2\n4 5 6\n7 8 9### Format: Read the inputs from stdin solve th... | [{"input": "73 2\nR2", "output": "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\n146 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 islands and M bridges.\nThe i-th bridge connects the A_i-th and B_i-th islands bidirectionally.\n... | [{"input": "29 45\n1 3\n2 3\n2 14\n2 19\n2 29\n3 26\n4 5\n4 6\n4 13\n4 17\n5 10\n5 19\n5 24\n6 18\n6 19\n6 24\n6 25\n6 28\n6 29\n8 9\n9 18\n9 25\n10 29\n11 16\n11 22\n12 14\n12 15\n12 26\n12 29\n13 14\n14 20\n14 27\n14 29\n15 16\n15 22\n15 25\n15 29\n16 29\n17 27\n19 26\n20 29\n24 26\n15 23\n1 21\n7 28\n", "output": "5... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nNiwango-kun is an employee of Dwango Co., Ltd.\nOne day, he is asked to generate a thumbnail from a video a u... | [{"input": "4\n-1 13 12 2", "output": "3\n"}, {"input": "4\n-1 19 12 6", "output": "2\n"}, {"input": "4\n0 10 12 2", "output": "1\n"}, {"input": "4\n0 20 12 2", "output": "2\n"}, {"input": "4\n0 20 12 1", "output": "2\n"}, {"input": "4\n0 13 12 2", "output": "3\n"}, {"input": "4\n0 19 12 2", "output": "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\nMike decided to teach programming to children in an elementary school. He knows that it is not an easy task t... | [{"input": "20\n43 48 38 34 23 18 8 22 12 7 47 1 13 20 3 15 49 6 10 26\n", "output": "5\n"}, {"input": "20\n43 48 38 34 23 18 8 22 12 7 47 1 13 20 3 15 49 6 10 26\n", "output": "5\n"}, {"input": "20\n43 48 38 34 41 18 8 22 12 7 47 1 13 20 3 15 49 6 10 26\n", "output": "6\n"}, {"input": "20\n43 48 38 34 23 18 8 22 12 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\nThe hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence!... | [{"input": "10 2\n0 2 3\n1 5 2\n0 7 3\n1 15 2\n0 14 3\n1 19 1\n1 5 3\n0 2 2\n0 10 2\n0 10 3\n", "output": "9\n"}, {"input": "10 2\n0 2 3\n1 5 2\n0 7 3\n1 15 2\n0 14 3\n1 19 1\n1 5 3\n0 2 2\n0 10 2\n0 10 3\n", "output": "9"}, {"input": "10 2\n0 2 3\n1 5 2\n0 7 3\n1 15 2\n0 3 3\n1 19 1\n1 5 3\n0 2 2\n0 10 2\n0 10 3\n", "... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nExample\n\nInput\n\n2\n1 2\n\n\nOutput\n\n2### Format: Read the inputs from stdin solve the problem and write... | [{"input": "2\n-1 -12", "output": "12\n"}, {"input": "2\n-1 12", "output": "-1\n"}, {"input": "2\n-1 24", "output": "-1\n"}, {"input": "2\n-2 24", "output": "-1\n"}, {"input": "2\n-2 22", "output": "-1\n"}, {"input": "2\n-2 -5", "output": "-1\n"}, {"input": "2\n10 16", "output": "-1\n"}, {"input": "2\n2 17", "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\nA chessboard n × m in size is given. During the zero minute we repaint all the black squares to the 0 color. ... | [{"input": "5000 5000\n1000000000\n", "output": "0\n"}, {"input": "2085 5000\n1000000000\n", "output": "0\n"}, {"input": "3762 3914\n1073\n", "output": "3386\n"}, {"input": "4583 2774\n1206\n", "output": "2535\n"}, {"input": "3432 4788\n1203\n", "output": "3410\n"}, {"input": "4643 3755\n1381\n", "output": "2876\n"}, {... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTakahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is g... | [{"input": "121980 33447 90629 11295524182", "output": "643972230\n"}, {"input": "111605 33447 77758 2284871002", "output": "762328834\n"}, {"input": "111605 33447 14069 2284871002", "output": "815838636\n"}, {"input": "42470 60074 125620 6171829514", "output": "334199188\n"}, {"input": "111605 33447 27166 2284871002",... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 likes numbers that are divisible by 3.\n\nHe has a huge number $s$. Polycarp wants to cut from it th... | [{"input": "1000000000000000000000000000000000\n", "output": "33\n"}, {"input": "1000010000000000000000000000000000\n", "output": "32\n"}, {"input": "1000010000000001000000000000000000\n", "output": "31\n"}, {"input": "1000000001000001000010000000000000\n", "output": "30\n"}, {"input": "10000000010000001000100000000010... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 the Great Magician and Conjurer loves all kinds of miracles and wizardry. In one wave of a magic wand h... | [{"input": "100 -4900 100\n", "output": "1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 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\nA prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For ... | [{"input": "11\n13\n20\n9\n10\n11\n13\n33\n14\n16\n12\n17", "output": "4\n"}, {"input": "11\n25\n20\n9\n10\n11\n13\n33\n14\n16\n12\n17", "output": "3\n"}, {"input": "11\n7\n10\n9\n10\n11\n13\n17\n14\n15\n16\n17", "output": "5\n"}, {"input": "11\n13\n20\n9\n10\n11\n13\n17\n14\n15\n8\n17", "output": "5\n"}, {"input": "11... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPolycarp likes arithmetic progressions. A sequence $[a_1, a_2, \\dots, a_n]$ is called an arithmetic progress... | [{"input": "4\n1 1000000000 1000000000 1000000000\n", "output": "-1\n"}, {"input": "4\n1 1000000000 1000000000 1000000000\n", "output": "-1\n"}, {"input": "4\n1 1000000000 1010000000 1000000000\n", "output": "-1\n"}, {"input": "4\n0 1000000000 1010000000 1000000000\n", "output": "-1\n"}, {"input": "4\n0 1000000010 1010... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nGennady owns a small hotel in the countryside where he lives a peaceful life. He loves to take long walks, wa... | [{"input": "AS\n2H 4C TH JH AD\n", "output": "YES\n"}, {"input": "4D\nAS AC AD AH 5H\n", "output": "YES\n"}, {"input": "KH\n3C QD 9S KS 8D\n", "output": "YES\n"}, {"input": "4H\nJH QC 5H 9H KD\n", "output": "YES\n"}, {"input": "QC\nQD KS AH 7S 2S\n", "output": "YES\n"}, {"input": "7H\n4H 6D AC KH 8H\n", "output": "YES\... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou have an integer variable x.\nInitially, x=0.\nSome person gave you a string S of length N, and using the ... | [{"input": "7\nDDIDDII\n", "output": "0\n"}, {"input": "7\nIIDDIDD", "output": "2\n"}, {"input": "7\nDIDDIID", "output": "0\n"}, {"input": "7\nIIIDDDD", "output": "3\n"}, {"input": "7\nDIIDDID", "output": "1\n"}, {"input": "7\nDIIDIDD", "output": "1\n"}, {"input": "7\nDDDIDII", "output": "0\n"}, {"input": "7\nIIDDDID",... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either cross... | [{"input": "XX.XX.....\n.....OOOO.\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n", "output": "YES\n"}, {"input": "XO........\n.XO.......\n..XO......\n....O.....\n....X.....\n..........\n..........\n..........\n..........\n..........\n", "output": "YES\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\nYour friend won't stop texting his girlfriend. It's all he does. All day. Seriously. The texts are so mushy... | [{"input": "\"You u youville utube you youyouyou uuu raiyou united youuuu u you\"", "output": "[\"your sister your sister youville utube your sister youyouyou uuu raiyou united your sister your sister your sister\"]", "fn_name": "autocorrect"}, {"input": "\"I want to film the bayou with you and put it on youtube\"", "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\nprison\n\nThere are an infinite number of prisoners. Initially, the prisoners are numbered 0, 1, 2, ....\n\nD... | [{"input": "41 2", "output": "1099511627775\n"}, {"input": "35 2", "output": "17179869183\n"}, {"input": "34 2", "output": "8589934591\n"}, {"input": "56 3", "output": "7854933626\n"}, {"input": "29 2", "output": "268435455\n"}, {"input": "26 2", "output": "33554431\n"}, {"input": "25 2", "output": "16777215\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# Task\n\n**_Given_** an *array/list [] of n integers* , *find maximum triplet sum in the array* **_Without d... | [{"input": "[-13, -50, 57, 13, 67, -13, 57, 108, 67]", "output": "[232]", "fn_name": "max_tri_sum"}, {"input": "[-7, 12, -7, 29, -5, 0, -7, 0, 0, 29]", "output": "[41]", "fn_name": "max_tri_sum"}, {"input": "[-14, -12, -7, -42, -809, -14, -12]", "output": "[-33]", "fn_name": "max_tri_sum"}, {"input": "[2, 1, 8, 0, 6, 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\nYou might have remembered Theatre square from the problem 1A. Now it's finally getting repaved.\n\nThe square... | [{"input": "1\n9 9 9 9\n.........\n.........\n.........\n.........\n.........\n.........\n.........\n.........\n.........\n", "output": "405\n"}, {"input": "1\n9 9 9 9\n.........\n.........\n.........\n.........\n.........\n.........\n.........\n.........\n.........\n", "output": "405\n"}, {"input": "4\n1 1 10 1\n.\n1 ... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given an integer $n$. In one move, you can either multiply $n$ by two or divide $n$ by $6$ (if it is ... | [{"input": "7\n2\n2\n2\n12\n45568\n15116544\n387420489\n", "output": "-1\n-1\n-1\n-1\n-1\n12\n36\n"}, {"input": "7\n2\n2\n2\n17\n45568\n15116544\n387420489\n", "output": "-1\n-1\n-1\n-1\n-1\n12\n36\n"}, {"input": "7\n5\n2\n4\n17\n60902\n15116544\n387420489\n", "output": "-1\n-1\n-1\n-1\n-1\n12\n36\n"}, {"input": "7\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\nThere are two buttons, one of size A and one of size B.\nWhen you press a button of size X, you get X coins a... | [{"input": "-134 -12", "output": "-25\n"}, {"input": "-134 -8", "output": "-17\n"}, {"input": "-13 -10", "output": "-21\n"}, {"input": "100 100", "output": "200\n"}, {"input": "111 111", "output": "222\n"}, {"input": "101 101", "output": "202\n"}, {"input": "-10 -10", "output": "-20\n"}, {"input": "110 110", "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\nCreate a function `isAlt()` that accepts a string as an argument and validates whether the vowels (a, e, i, o... | [{"input": "\"orange\"", "output": "[false]", "fn_name": "is_alt"}, {"input": "\"helipad\"", "output": "[true]", "fn_name": "is_alt"}, {"input": "\"amazon\"", "output": "[true]", "fn_name": "is_alt"}, {"input": "\"apple\"", "output": "[false]", "fn_name": "is_alt"}, {"input": "\"banana\"", "output": "[true]", "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\nThere is a cube which consists of n × n × n small cubes. Small cubes have marks on their surfaces. An example... | [{"input": "12 3\nxy 4 3\nxz 1 2\nyz 2 3\n7 5\nxy 1 1\nxy 3 3\nxz 3 2\nyz 2 1\nyz 3 3\n0 0", "output": "1692\n310\n"}, {"input": "12 3\nxy 4 3\nxz 1 2\nyz 2 3\n7 5\nxy 1 1\nyx 3 3\nxz 3 2\nyz 2 1\nyz 3 3\n0 0", "output": "1692\n315\n"}, {"input": "14 3\nxy 4 3\nxz 1 2\nyz 2 3\n4 5\nxy 1 1\nxy 3 3\nxz 3 2\nyz 2 1\nyz 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\nConstraints\n\n* 1 ≤ |V| ≤ 1000\n* 0 ≤ |E| ≤ 2000\n* -10000 ≤ di ≤ 10000\n* There are no parallel edges\n* Th... | [{"input": "42 0 1\n2 -1 3\n0 5 55\n1 0 -2\n-2 0 1\n2 4 -1", "output": "INF\n0\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\n"}, {"input": "38 0 1\n2 -2 3\n0 6 55\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\nAs Valeric and Valerko were watching one of the last Euro Championship games in a sports bar, they broke a mu... | [{"input": "5\n1000000000 1000000000\n1000000000 1000000000\n1000000000 1000000000\n1000000000 1000000000\n294967296 294967296\n", "output": "1\n"}, {"input": "5\n1000000000 1000000000\n1000000000 1000000000\n1000100000 1000000000\n1000000000 1000000000\n294967296 294967296\n", "output": "2\n"}, {"input": "5\n100000000... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 $a$, initially consisting of $n$ integers.\n\nYou want to transform this sequence so... | [{"input": "5\n3\n1 1 1\n5\n1 2 3 4 5\n5\n1 2 3 2 1\n7\n1 2 3 1 2 3 1\n11\n2 2 1 2 3 2 1 2 3 1 2\n", "output": "\n0\n1\n1\n2\n3\n"}, {"input": "5\n3\n1 1 1\n5\n1 2 3 4 5\n5\n1 2 3 2 1\n7\n1 2 3 1 2 3 1\n11\n2 2 1 2 3 2 1 2 3 1 2\n", "output": "0\n1\n1\n2\n3\n"}, {"input": "5\n3\n1 1 1\n5\n1 2 3 4 5\n5\n1 2 3 2 1\n7\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\nB: Hokkaido University Hard\n\nNote\n\nPlease note that the question settings are the same as question A, exc... | [{"input": "3 3\nB.B\nB..\n.BB", "output": "4\n"}, {"input": "2 3\nB.B\nB..\n.BB", "output": "3\n"}, {"input": "1 3\nB-B\n..B\n.BA", "output": "2\n"}, {"input": "1 1\nB-B\n..B\n.BA", "output": "0\n"}, {"input": "1 3\nBB.\nB..\n.AA", "output": "1\n"}, {"input": "3 3\nB.B\nB..\nBB.", "output": "4\n"}, {"input": "3 3\nB.B... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 `String#whitespace?(str)` (Ruby), `String.prototype.whitespace(str)` (JavaScript), `String::whitesp... | [{"input": "\"\\t \\n\\r\\n \"", "output": "[true]", "fn_name": "whitespace"}, {"input": "\"\\n\\r\\n\\r 3\"", "output": "[false]", "fn_name": "whitespace"}, {"input": "\"\\n\\r\\n\\r \"", "output": "[true]", "fn_name": "whitespace"}, {"input": "\"\\n\\r\\n\\r\"", "output": "[true]", "fn_name": "whitespace"}, {"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\nTakahashi is solving quizzes. He has easily solved all but the last one.\nThe last quiz has three choices: 1,... | [{"input": "3\n001", "output": "2\n"}, {"input": "3\n001", "output": "2\n"}, {"input": "3\n1\n", "output": "2\n"}, {"input": "1\n2\n", "output": "3\n"}, {"input": "1\n3\n", "output": "2\n"}, {"input": "3\n2\n", "output": "1\n"}, {"input": "2\n1\n", "output": "3\n"}, {"input": "2\n3\n", "output": "1\n"}, {"input": "3\n2... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given an array $a[0 \\ldots n-1]$ of length $n$ which consists of non-negative integers. Note that ar... | [{"input": "4\n4\n6 4 7 6\n3\n3 2 6\n1\n7\n3\n4 14 2 1 18 3 0\n", "output": "-1\n1\n-1\n-1\n"}, {"input": "4\n4\n3 2 0 6\n3\n6 4 4\n1\n7\n7\n7 7 2 1 18 1 2\n", "output": "-1\n-1\n-1\n-1\n"}, {"input": "4\n4\n3 2 7 8\n3\n6 2 8\n1\n7\n7\n6 13 2 1 19 1 1\n", "output": "2\n-1\n-1\n-1\n"}, {"input": "4\n4\n3 2 7 6\n3\n6 2 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\nThe postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen -, and the ot... | [{"input": "3 4\n269-6650\n", "output": "Yes\n"}, {"input": "6 4\n269-6650", "output": "No\n"}, {"input": "6 8\n269-6650", "output": "No\n"}, {"input": "6 1\n269-6650", "output": "No\n"}, {"input": "6 2\n269-6650", "output": "No\n"}, {"input": "6 2\n0566-962", "output": "No\n"}, {"input": "6 3\n0566-962", "output": "No... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nCQXYM found a rectangle A of size n × m. There are n rows and m columns of blocks. Each block of the rectangl... | [{"input": "1\n9 9\n001010001\n101110100\n000010011\n100000001\n101010101\n110001111\n000001111\n110100000\n000110000\n", "output": "5\n"}, {"input": "1\n8 9\n101110001\n101110100\n000010001\n001000001\n001011101\n110001111\n000001111\n110100010\n010110000\n", "output": "4\n"}, {"input": "1\n8 9\n101110001\n101110100\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\nNote that girls in Arpa’s land are really attractive.\n\nArpa loves overnight parties. In the middle of one o... | [{"input": "26\n8 10\n52 21\n2 33\n18 34\n30 51\n5 19\n22 32\n36 28\n42 16\n13 49\n11 17\n31 39\n43 37\n50 15\n29 20\n35 46\n47 23\n3 1\n44 7\n9 27\n6 48\n40 24\n26 14\n45 4\n12 25\n41 38\n", "output": "2 1\n1 2\n2 1\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n2 1\n1 2\n1 2\n1 2\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n1 2\n2 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\nMash 2 arrays together so that the returning array has alternating elements of the 2 arrays . Both arrays wil... | [{"input": "[\"h\", \"l\", \"o\", \"o\", \"l\"]\n[\"e\", \"l\", \"w\", \"r\", \"d\"]", "output": "[[\"h\", \"e\", \"l\", \"l\", \"o\", \"w\", \"o\", \"r\", \"l\", \"d\"]]", "fn_name": "array_mash"}, {"input": "[1, 8, \"hello\", \"dog\"]\n[\"fish\", \"2\", 9, 10]", "output": "[[1, \"fish\", 8, \"2\", \"hello\", 9, \"dog... | 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\nPolycarp wrote on the board a string $s$ containing only lowercase Latin letters ('a'-'z'). This string is kn... | [{"input": "10\nvzsxyuyy\n3\n1 0 3\nwwvutuxsuxywut\n2\n0 0\nsuzvsvutvvstuz\n3\n3 1 0\nstyuwsutv\n4\n6 3 0 1\nzsustytvzsyw\n6\n0 9 5 7 7 5\nsvwxwwwyxuvszx\n1\n0\nxuyyvuztxwuuvsxwz\n5\n5 7 0 0 7\nuxuztuwsxz\n5\n4 2 2 0 10\nxystzstwtzwsz\n2\n1 0\nuuzss\n1\n0\n", "output": "yzx\nxx\nuvz\nuvyw\nztwtvy\nz\nywzzx\nuxuzt\nyz\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 to remind, girls in Arpa's land are really nice.\n\nMehrdad wants to invite some Hoses to the palace for... | [{"input": "10 5 100\n64 109 3 94 96 97 52 54 82 26\n796554 444893 214351 43810 684158 1060686 686198 339093 383018 699152\n6 8\n8 3\n3 9\n2 3\n10 3\n", "output": "1495706\n"}, {"input": "10 5 100\n48 73 57 46 95 19 171 73 94 24\n501216 675859 843572 565104 879875 828759 80776 766980 213551 492652\n1 2\n6 5\n7 6\n10 5\... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are a rebel leader and you are planning to start a revolution in your country. But the evil Government fo... | [{"input": "5\n1 1000000000 999999998\n1 1000000000 999999999\n1 1000000000 1000000000\n1000000000 1000000000 2\n1000000000 1000000000 1000000000\n", "output": "REBEL\nREBEL\nOBEY\nOBEY\nOBEY\n"}, {"input": "5\n1 1000000000 999999998\n1 1000000000 999999999\n1 1000000000 1000000000\n1000000000 1000000000 2\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\nWrite a program which reads an directed graph $G = (V, E)$, and finds the shortest distance from vertex $1$ t... | [{"input": "4\n1 2 1 4\n2 -1 4\n0 -1\n4 1 0", "output": "1 0\n2 -1\n3 -1\n4 1\n"}, {"input": "4\n1 2 1 4\n2 0 4\n0 -1\n4 -1 0", "output": "1 0\n2 -1\n3 -1\n4 1\n"}, {"input": "4\n1 2 1 4\n3 0 4\n0 -1\n4 -1 0", "output": "1 0\n2 -1\n3 -1\n4 1\n"}, {"input": "4\n1 2 4 4\n2 0 4\n0 -1\n-1 0 1", "output": "1 0\n2 -1\n3 -1\n... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe only difference between easy and hard versions is the length of the string. You can hack this problem onl... | [{"input": "0111001100111011101000\n", "output": "0011001100001011101000\n"}, {"input": "0111001110111011101000\n", "output": "0011000010001011101000\n"}, {"input": "0111001110101011101000\n", "output": "0011000010101011101000\n"}, {"input": "0111011110101011101000\n", "output": "0001000010101011101000\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 university student, Takahashi, has to take N examinations and pass all of them. Currently, his readiness fo... | [{"input": "12\n757232153 372327760 440075441 195848680 354974235 458054863 463477172 740174259 615762794 632963102 529866931 64991604\n102338863 98239366 465611891 362739947 147060907 118867039 63189252 78303147 501410831 110823640 122948912 572905212", "output": "5\n"}, {"input": "12\n757232153 372327760 440075441 15... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.