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\n$n$ boys and $m$ girls came to the party. Each boy presented each girl some integer number of sweets (possibl...
[{"input": "2 2\n100000000 100000000\n100000000 100000000\n", "output": "400000000\n"}, {"input": "2 2\n000000000 100000000\n100000000 100000000\n", "output": "200000000\n"}, {"input": "2 2\n100000000 100000000\n100000000 100010000\n", "output": "400010000\n"}, {"input": "2 2\n000000000 100000000\n100000000 110000000\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n# Task\n You are given a binary string (a string consisting of only '1' and '0'). The only operation that can...
[{"input": "\"1010101011111111111111000000000\"", "output": "[10]", "fn_name": "bin_str"}, {"input": "\"00000000111111111\"", "output": "[1]", "fn_name": "bin_str"}, {"input": "\"10101010101010\"", "output": "[14]", "fn_name": "bin_str"}, {"input": "\"000001111100000\"", "output": "[2]", "fn_name": "bin_str"}, {"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\nDaniel is organizing a football tournament. He has come up with the following tournament format: In the fir...
[{"input": "288230376151711743\n", "output": "144115188344291328\n288230376151711744\n"}, {"input": "288230376151711743\n", "output": "144115188344291328\n288230376151711744\n"}, {"input": "72057594037927935\n", "output": "36028797153181696\n72057594037927936\n"}, {"input": "72057594037927935\n", "output": "36028797153...
code_stdio
[ { "content": "You are an expert Python programmer. 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## Euler's Method\n\nWe want to calculate the shape of an unknown curve which starts at a given point \nwith ...
[{"input": "1000", "output": "[0.000251]", "fn_name": "ex_euler"}, {"input": "1200", "output": "[0.000209]", "fn_name": "ex_euler"}, {"input": "1500", "output": "[0.000167]", "fn_name": "ex_euler"}, {"input": "2000", "output": "[0.000125]", "fn_name": "ex_euler"}, {"input": "100", "output": "[0.002524]", "fn_name": "ex...
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\nCatherine has a deck of n cards, each of which is either red, green, or blue. As long as there are at least t...
[{"input": "200\nBBRGRRBBRGGGBGBGBGRRGRGRGRBGRGRRBBGRGBGRRGRRRGGBBRGBGBGBRBBBBBBBGGBRGGRRRGGRGBGBGGBRRRRBRRRBRBBGGBGBRGRGBBBBGGBGBBBGBGRRBRRRGBGGBBBRBGRBRRGGGRRGBBBGBGRRRRRRGGRGRGBBBRGGGBGGGBRBBRRGBGRGRBRRRBRBGRGGBRBB\n", "output": "BGR\n"}, {"input": "200\nRGRGRRRRRGRRGRRRGRGRRRGGRGRRGGGRRGGRRRRRRRRRRRGRRGRRRGRRRGRRRR...
code_stdio
[ { "content": "You are an expert Python programmer. 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> Kyoto University Programming Contest is a programming contest voluntarily held by some Kyoto University stu...
[{"input": "9 3\nAPPLE\nANT\nATCODER\nBLOCK\nBULL\nBOSS\nCAT\nGOD\nEGG", "output": "3\n"}, {"input": "9 3\nAPPLE\nBNT\nATCODER\nBLOCK\nBULL\nBOSS\nCTA\nDOG\nEGG", "output": "2\n"}, {"input": "9 1\nELQPA\nUNB\nATCODER\nLCOLB\nKLUB\nOSSB\nTCA\nGCO\nGGE", "output": "9\n"}, {"input": "9 2\nLAPPE\nBNT\nRCDOETA\nKCOLC\nUBLM\...
code_stdio
[ { "content": "You are an expert Python programmer. 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 palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forw...
[{"input": "\"Hello world!\"", "output": "[\"Not valid\"]", "fn_name": "palindrome"}, {"input": "\"357665\"", "output": "[\"Not valid\"]", "fn_name": "palindrome"}, {"input": "\"ololo\"", "output": "[\"Not valid\"]", "fn_name": "palindrome"}, {"input": "-42", "output": "[\"Not valid\"]", "fn_name": "palindrome"}, {"inp...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are n lights aligned in a row. These lights are numbered 1 to n from left to right. Initially some of t...
[{"input": "100 100\n1 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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100\n", "ou...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAfter several latest reforms many tourists are planning to visit Berland, and Berland people understood that ...
[{"input": "70 203\n1 105\n1 105\n1 105\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\...
code_stdio
[ { "content": "You are an expert Python programmer. 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's got a birthday coming up and his mom decided to give him an array of positive integers a of length n....
[{"input": "25 7\n67 18 36 85 64 22 32 66 17 64 66 65 119 36 16 52 19 70 38 51 17 32 85 16 64\n", "output": "16\n"}, {"input": "25 7\n67 18 36 85 64 22 32 66 17 64 66 65 82 36 16 52 19 70 38 51 17 32 85 16 64\n", "output": "16\n"}, {"input": "25 7\n67 18 36 85 64 22 32 66 17 64 66 65 82 36 16 52 19 70 38 51 17 32 85 16...
code_stdio
[ { "content": "You are an expert Python programmer. 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 has recently found a treasure map. While he was looking for a treasure he found a locked door. There wa...
[{"input": "(#(()(((()((##)(()((((#()(((#((#)(((((((()((((((#)))(((()((((##(#)(()()((((#)(#()#((()))(((##((#(#(#\n", "output": "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n27\n"}, {"input": "(#(()(((()((##)(()((((#()(((#((#)(((((((()((((((#)))(((()((((##(#)(()()((((#)(#()#((())((((##((#(#(#\n", "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\nOne Martian boy called Zorg wants to present a string of beads to his friend from the Earth — Masha. He knows...
[{"input": "50 161245081749292\n", "output": "00101100010110000001101000110001001101000011000011\n"}, {"input": "50 250144743882708\n", "output": "01010101010010111011000010110101001100000110000101\n"}, {"input": "50 264823400156610\n", "output": "01100000110111100000001000001110010101010011111110\n"}, {"input": "50 28...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAlong a road running in an east-west direction, there are A shrines and B temples.\nThe i-th shrine from the ...
[{"input": "1 1 3\n1\n10000000000\n2\n9999999999\n5000000000\n", "output": "10000000000\n10000000000\n14999999998\n"}, {"input": "1 1 3\n1\n10000100000\n2\n9999999999\n5000000000", "output": "10000100000\n10000200000\n15000099998\n"}, {"input": "1 1 3\n1\n10000000000\n2\n9999999999\n1416092751", "output": "10000000000\...
code_stdio
[ { "content": "You are an expert Python programmer. 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 kata we want to convert a string into an integer. The strings simply represent the numbers in words.\...
[{"input": "\"eight hundred eighty-eight thousand eight hundred and eighty-eight\"", "output": "[888888]", "fn_name": "parse_int"}, {"input": "\"six hundred sixty-six thousand six hundred sixty-six\"", "output": "[666666]", "fn_name": "parse_int"}, {"input": "\"ninety-nine thousand nine hundred and ninety-nine\"", "out...
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\n7\n>>\n\n\nOutput\n\n7### Format: Read the inputs from stdin solve the problem and write ...
[{"input": "7\n>=", "output": "7\n"}, {"input": "7\n=>", "output": "7\n"}, {"input": "7\n?=", "output": "7\n"}, {"input": "7\n=?", "output": "7\n"}, {"input": "7\n<?", "output": "7\n"}, {"input": "7\n?<", "output": "7\n"}, {"input": "7\n><", "output": "7\n"}, {"input": "7\n>?", "output": "7\n"}, {"input": "7\n?>", "out...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nOne day, at the \"Russian Code Cup\" event it was decided to play football as an out of competition event. Al...
[{"input": "248 54\n", "output": "13392\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n1 9\n1 10\n1 11\n1 12\n1 13\n1 14\n1 15\n1 16\n1 17\n1 18\n1 19\n1 20\n1 21\n1 22\n1 23\n1 24\n1 25\n1 26\n1 27\n1 28\n1 29\n1 30\n1 31\n1 32\n1 33\n1 34\n1 35\n1 36\n1 37\n1 38\n1 39\n1 40\n1 41\n1 42\n1 43\n1 44\n1 45\n1 46\n1 47\n1 48\n1 49\...
code_stdio
[ { "content": "You are an expert Python programmer. 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 Patrick waits for a visit from his friend Spongebob. To prepare for the visit, Patrick needs to buy som...
[{"input": "100000000 100000000 100000000\n", "output": "300000000\n"}, {"input": "100000000 100000000 100000000\n", "output": "300000000\n"}, {"input": "73676138 150324676 35182\n", "output": "147422640\n"}, {"input": "73676138 230952454 17921\n", "output": "147388118\n"}, {"input": "73676138 230952454 18157\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\nOn a random day, Neko found $n$ treasure chests and $m$ keys. The $i$-th chest has an integer $a_i$ written o...
[{"input": "10 10\n522312461 931001459 598654597 488228616 544064902 21923894 329635457 980089248 988262691 654502493\n967529230 543358150 835120075 128123793 809901567 613170206 152157661 479980560 859252956 318029856\n", "output": "10\n"}, {"input": "10 10\n522312461 931001459 598654597 488228616 544064902 21923894 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\nPolycarpus just has been out of luck lately! As soon as he found a job in the \"Binary Cat\" cafe, the club g...
[{"input": "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n", "ou...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nMr. Morishita was in trouble ... I had Mr. Anehara write a program, but the program crashed.\n\nMr. Anehara w...
[{"input": "2\na 1 5\na 1 10\n5\n1 a a - -1", "output": "correct\n"}, {"input": "2\na 1 5\nb 1 10\n5\n1 a a - -1", "output": "correct\n"}, {"input": "2\na 1 5\na 0 10\n5\n1 a a - -1", "output": "correct\n"}, {"input": "2\na 1 5\nb 1 10\n5\n1 a b - -1", "output": "correct\n"}, {"input": "2\na 1 8\na 0 10\n5\n1 a a - -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 class of students wrote a multiple-choice test.\n\nThere are $n$ students in the class. The test had $m$ qu...
[{"input": "10 10\nCBBBBBBBBB\nABBBBEBBBB\nBDBBBBBBBB\nBCBBBBBBBB\nBABBBBBEBB\nEBBBBBBBBB\nBBBCBDCBBB\nBEBBEBBBBB\nBBBBBBBBBB\nBBBDBBBACB\n840 678 490 153 1118 84 256 405 468 856\n", "output": "45122\n"}, {"input": "10 10\nCBBBBBBBBB\nABBBBEBBBB\nBDBBBBBBBB\nBBBBBBBBBB\nBABBBBBEBB\nEBBBBBBBBB\nBBBCBDCBBB\nBEBBEBBBBB\nB...
code_stdio
[ { "content": "You are an expert Python programmer. 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 a hard quarter in the office you decide to get some rest on a vacation. So you will book a flight for y...
[{"input": "10", "output": "[350]", "fn_name": "rental_car_cost"}, {"input": "3", "output": "[100]", "fn_name": "rental_car_cost"}, {"input": "4", "output": "[140]", "fn_name": "rental_car_cost"}, {"input": "5", "output": "[180]", "fn_name": "rental_car_cost"}, {"input": "6", "output": "[220]", "fn_name": "rental_car_c...
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 a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They...
[{"input": "7002108534951820589946967018226114921984364117669853212254634761258884835434844673935047882480101006606512119541798298905598015607366335061012709906661245805358900665571472645463994925687210711492820804158354236327017974683658305043146543214454877759341394.202118562635032813887482826821207122147112325980213...
code_stdio
[ { "content": "You are an expert Python programmer. 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 multisets of pairs of colored sticks: $R$ pairs of red sticks, the first pair has lengt...
[{"input": "16 26 8\n13 13 0 24 56 74 72 4 172 98 43 4 6 30 82 12\n31 6 76 15 88 37 22 64 44 55 18 67 12 65 10 24 83 23 27 101 198 2 58 59 34 38\n31 61 138 21 67 86 63 6\n", "output": "101183\n"}, {"input": "16 26 8\n13 13 0 24 56 74 88 4 172 98 43 4 6 30 82 12\n31 6 76 15 88 37 22 64 44 55 18 67 12 65 10 24 83 23 27 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\nTo celebrate the opening of the Winter Computer School the organizers decided to buy in n liters of cola. How...
[{"input": "10000 5000 5000 5000\n", "output": "6253751\n"}, {"input": "10000 4534 2345 4231\n", "output": "2069003\n"}, {"input": "8765 2432 2789 4993\n", "output": "1697715\n"}, {"input": "8987 4000 2534 4534\n", "output": "2536267\n"}, {"input": "7777 4444 3333 2222\n", "output": "1236544\n"}, {"input": "2500 5000 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\nConverting a 24-hour time like \"0830\" or \"2030\" to a 12-hour time (like \"8:30 am\" or \"8:30 pm\") sound...
[{"input": "\"0000\"", "output": "[\"12:00 am\"]", "fn_name": "to12hourtime"}, {"input": "\"0001\"", "output": "[\"12:01 am\"]", "fn_name": "to12hourtime"}, {"input": "\"0002\"", "output": "[\"12:02 am\"]", "fn_name": "to12hourtime"}, {"input": "\"0003\"", "output": "[\"12:03 am\"]", "fn_name": "to12hourtime"}, {"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\nOne day Polycarp decided to rewatch his absolute favourite episode of well-known TV series \"Tufurama\". He w...
[{"input": "10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "45\n"}, {"input": "10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "45\n"}, {"input": "8\n13 2 7 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\nYou are given a permutation p = (p_1, \\ldots, p_N) of \\\\{ 1, \\ldots, N \\\\}. You can perform the followi...
[{"input": "4 1000000000 1000000000\n4 3 2 1", "output": "3000000000"}, {"input": "9 29 154\n2 3 6 7 6 1 2 12 8", "output": "174"}, {"input": "9 67 124\n5 3 4 7 6 1 3 24 8", "output": "402"}, {"input": "9 59 165\n5 4 4 5 8 1 2 12 7", "output": "354"}, {"input": "9 50 87\n16 2 4 7 6 1 3 12 8", "output": "300"}, {"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\nHey CodeWarrior,\n\nwe've got a lot to code today!\n\nI hope you know the basic string manipulation methods, ...
[{"input": "\"uid12 ab, uid#, uidMiXeDcHaRs\"", "output": "[[\"12 ab\", \"\", \"mixedchars\"]]", "fn_name": "get_users_ids"}, {"input": "\" uidin name whitespace\"", "output": "[[\"in name whitespace\"]]", "fn_name": "get_users_ids"}, {"input": "\"uid##doublehashtag\"", "output": "[[\"doublehashtag\"]]", "fn_name": "g...
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\nConsider an N \\times N matrix. Let us denote by a_{i, j} the entry in the i-th row and j-th column. For a_{i...
[{"input": "902\n0 1 1 2 0 2 0 2 2 0 2 0 0 1 0 2 1 0 0 1 1 1 2 0 0 2 0 2 1 2 0 2 2 0 1 2 0 0 2 1 1 0 2 0 0 1 2 0 0 1 0 0 1 1 2 0 0 0 2 2 0 2 1 0 0 2 2 0 0 2 2 1 0 2 2 2 2 0 0 0 1 1 2 0 2 0 1 2 1 1 0 0 1 2 2 2 1 0 2 0 1 2 2 1 2 2 0 0 2 0 1 0 1 0 2 0 0 2 0 0 2 1 2 1 0 2 2 1 1 2 0 2 1 0 1 2 0 0 2 0 0 1 1 2 0 1 2 2 0 0 0 1...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n# One is the loneliest number\n\n## Task\n\nThe range of vision of a digit is its own value. `1` can see one ...
[{"input": "65432165432", "output": "[false]", "fn_name": "loneliest"}, {"input": "8854778", "output": "[false]", "fn_name": "loneliest"}, {"input": "123456", "output": "[true]", "fn_name": "loneliest"}, {"input": "34315", "output": "[true]", "fn_name": "loneliest"}, {"input": "11111", "output": "[true]", "fn_name": "l...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a set S of strings consisting of `0` and `1`, and an integer K.\n\nFind the longest string that...
[{"input": "4 1\n1\n01\n1101\n01011110\n1101110011011100", "output": "0000\n"}, {"input": "4 1\n1\n01\n1111\n00111110\n0101110011111101", "output": "0001\n"}, {"input": "4 4\n-1\n01\n1111\n10111010\n1101100011111101", "output": "000\n"}, {"input": "4 6\n1\n01\n1111\n10111010\n1101110011111101", "output": "100\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\nExtended Euclid Algorithm\n\n\n\n\nGiven positive integers a and b, find the integer solution (x, y) to ax + ...
[{"input": "810 11", "output": "-3 221\n"}, {"input": "277 5", "output": "-2 111\n"}, {"input": "195 10", "output": "1 -19\n"}, {"input": "174 10", "output": "-2 35\n"}, {"input": "41 52", "output": "-19 15\n"}, {"input": "789 7", "output": "3 -338\n"}, {"input": "383 5", "output": "2 -153\n"}, {"input": "41 59", "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\nT is playing a game with his friend, HL.\n\nThere are n piles of stones, the i-th pile initially has a_i ston...
[{"input": "4\n5\n1 3 1 3 4\n1\n4\n1\n5\n2\n3 3\n", "output": "HL\nT\nT\nHL\n"}, {"input": "4\n5\n1 3 1 3 4\n1\n3\n1\n5\n2\n3 3\n", "output": "HL\nT\nT\nHL\n"}, {"input": "4\n5\n1 3 1 3 4\n1\n1\n1\n5\n2\n3 3\n", "output": "HL\nT\nT\nHL\n"}, {"input": "4\n5\n1 3 2 3 1\n1\n1\n1\n5\n2\n3 3\n", "output": "HL\nT\nT\nHL\n"},...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nZiota found a video game called \"Monster Invaders\".\n\nSimilar to every other shooting RPG game, \"Monster ...
[{"input": "100 4 8 9 2\n1 8 0 8 7 8 1 8 7 4 0 9 4 2 1 7 3 7 3 7 1 8 7 14 4 10 11 7 3 5 9 7 4 9 6 10 4 5 5 2 5 2 8 4 5 3 1 6 8 8 10 6 7 2 1 6 2 8 3 9 7 4 18 6 7 8 5 2 5 16 3 8 4 11 0 3 5 10 6 1 4 8 14 17 2 2 9 3 7 3 3 3 10 19 3 5 3 1 3 3\n", "output": "1584\n"}, {"input": "100 4 8 9 2\n1 8 0 8 7 8 1 8 7 4 7 9 4 2 1 7 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\nComputer graphics uses polygon models as a way to represent three-dimensional shapes. A polygon model is a mo...
[{"input": "6\n3 3 1\n1 2 4\n1 4 3\n-1 3 4\n5 -1 1\n2 3 1", "output": "0\n"}, {"input": "6\n3 3 1\n1 2 4\n1 4 3\n-1 4 4\n10 0 1\n2 3 1", "output": "0\n"}, {"input": "6\n3 1 1\n2 0 4\n0 4 1\n-1 4 4\n9 -1 2\n2 3 1", "output": "0\n"}, {"input": "6\n3 3 1\n1 2 4\n1 4 3\n-1 3 4\n5 0 1\n2 3 1", "output": "0\n"}, {"input": "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\nF: Miko Mi String-\n\nstory\n\nMikko Mikkomi ~! Everyone's idol, Miko Miko Tazawa! Today ~, with Mikoto ~, pr...
[{"input": "iNobiNociN", "output": "mitomerarenaiWA\n"}, {"input": "iNoaiNociN", "output": "mitomerarenaiWA\n"}, {"input": "iNoaiNochN", "output": "mitomerarenaiWA\n"}, {"input": "NhcoNiaoNi", "output": "mitomerarenaiWA\n"}, {"input": "NhcoNiNoai", "output": "mitomerarenaiWA\n"}, {"input": "NhcoNjNoai", "output": "mito...
code_stdio
[ { "content": "You are an expert Python programmer. 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[Image] \n\n\n-----Input-----\n\nThe first line of the input is a string (between 1 and 50 characters long, i...
[{"input": "MDJivQRiOIVRcCdkSuUlNbMEOkIVJRMTAnHbkVaOmOblLfignh\n25\n", "output": "MDJIVQRIOIVRCCDKSUULNBMEOKIVJRMTANHBKVAOMOBLLFIGNH\n"}, {"input": "aaaaaaAAAaaaaAaaAaaAaaaaAAaAAAaaAAaaaAAaaaaaAaaAAa\n2\n", "output": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"}, {"input": "aaaaAaaaaaaAAaaAaaAaAaaaAaaaaaAAaaA...
code_stdio
[ { "content": "You are an expert Python programmer. 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.codew...
[{"input": "[13, 12, -27, -302, 25, 37, 133, 155, -1]\n5", "output": "[247895375]", "fn_name": "max_product"}, {"input": "[14, 29, -28, 39, -16, -48]\n4", "output": "[-253344]", "fn_name": "max_product"}, {"input": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n5", "output": "[0]", "fn_name": "max_product"}, {"input": "[10, 2, 3, 8,...
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\nOn his free time, Chouti likes doing some housework. He has got one new task, paint some bricks in the yard.\...
[{"input": "1411 1081 1082\n", "output": "238077838\n"}, {"input": "1841 1185 1765\n", "output": "773828348\n"}, {"input": "2000 1234 1800\n", "output": "550745740\n"}, {"input": "2000 2000 1999\n", "output": "694730459\n"}, {"input": "1411 1081 1082\n", "output": "238077838\n"}, {"input": "2000 1234 1800\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\nOn a weekend, Qingshan suggests that she and her friend Daniel go hiking. Unfortunately, they are busy high s...
[{"input": "50\n3 10 13 26 31 27 22 20 9 8 33 30 12 21 16 7 17 11 6 24 14 5 19 25 29 36 37 40 41 44 45 46 47 48 49 50 43 42 39 38 35 34 32 28 23 18 15 4 2 1\n", "output": "1\n"}, {"input": "50\n3 10 13 26 31 27 22 20 9 8 33 30 12 21 16 7 17 11 6 24 14 5 19 25 29 36 37 40 41 44 45 46 47 48 49 50 43 42 39 38 35 34 32 28 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTwo coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r × c are given. The cost of moving from a...
[{"input": "1226 500 1 0 107 129", "output": "14190866\n"}, {"input": "912 500 2 -1 107 239", "output": "98025026\n"}, {"input": "500 500 -1 0 107 239", "output": "68765037\n"}, {"input": "1174 500 0 0 107 298", "output": "74076242\n"}, {"input": "1226 500 1 0 107 168", "output": "37811899\n"}, {"input": "272 500 -1 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\nAdding tip to a restaurant bill in a graceful way can be tricky, thats why you need make a function for it.\n...
[{"input": "983212", "output": "[1500000]", "fn_name": "graceful_tipping"}, {"input": "1149", "output": "[1500]", "fn_name": "graceful_tipping"}, {"input": "86", "output": "[100]", "fn_name": "graceful_tipping"}, {"input": "99", "output": "[150]", "fn_name": "graceful_tipping"}, {"input": "12", "output": "[15]", "fn_na...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are 3N participants in AtCoder Group Contest. The strength of the i-th participant is represented by an...
[{"input": "10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1100000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWe have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares.\nThe square (i,...
[{"input": "10 1000 10000\n11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nFind places where a string P is found within a text T. Print all indices of T where P found. The indices of T...
[{"input": "aaaaaa\naa", "output": "0\n1\n2\n3\n4\n"}, {"input": "aaaaab\naa", "output": "0\n1\n2\n3\n"}, {"input": "`aaaaa\naa", "output": "1\n2\n3\n4\n"}, {"input": "aaabaa\naa", "output": "0\n1\n4\n"}, {"input": "aaaaba\naa", "output": "0\n1\n2\n"}, {"input": "abaaaa\naa", "output": "2\n3\n4\n"}, {"input": "aa`aaa\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\nAri the monster always wakes up very early with the first ray of the sun and the first thing she does is feed...
[{"input": "54321\n", "output": "2950553761\n"}, {"input": "54320\n", "output": "2950445124\n"}, {"input": "54319\n", "output": "2950336489\n"}, {"input": "54318\n", "output": "2950227856\n"}, {"input": "54317\n", "output": "2950119225\n"}, {"input": "54316\n", "output": "2950010596\n"}, {"input": "54315\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 a string $s$ consisting of $n$ characters. Each character of $s$ is either 0 or 1.\n\nA substri...
[{"input": "7\n1110010\n", "output": "1111110\n"}, {"input": "5\n11010\n", "output": "11111\n"}, {"input": "5\n10110\n", "output": "11111\n"}, {"input": "5\n10111\n", "output": "11111\n"}, {"input": "5\n11011\n", "output": "11111\n"}, {"input": "5\n11000\n", "output": "11110\n"}, {"input": "5\n10000\n", "output": "1100...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n-----Input-----\n\nThe first line contains a single integer n (1 ≤ n ≤ 1000) — the number of points on a plan...
[{"input": "14\n99.19 -882.27\n468.09 310.41\n-539.17 665.55\n-355.65 -90.01\n490.35 -966.88\n-102.77 252.81393817771362\n981.63 -976.33\n-362.0898056216629 -435.09\n-43.98678039025838 -37.28\n948.1448687933764 530.68\n49.38 -299.65\n503.33 684.17\n199.7398403612267 328.89\n31.24 65.36\n", "output": "-55.688"}, {"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\nCarl is a beginner magician. He has a blue, b violet and c orange magic spheres. In one move he can transform...
[{"input": "1000000 1000000 1000000\n1000000 1000000 1000000\n", "output": "Yes\n"}, {"input": "1000000 1000000 1000000\n1000000 1000000 1000000\n", "output": "Yes\n"}, {"input": "1000100 1000000 1000000\n1000000 1000000 1000000\n", "output": "Yes\n"}, {"input": "1000000 500000 1000000\n500000 1000000 500000\n", "outpu...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLindsey Buckingham told Stevie Nicks \"Go your own way\". Nicks is now sad and wants to go away as quickly as...
[{"input": "2\n-3 1\n1 3 5 7 9 11\n1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "18\n1000000000000000000\n"}, {"input": "2\n-3 1\n1 3 5 7 9 11\n1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000 1100000000 1000000000\n", "output": "18\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\nHow many infinite sequences a_1, a_2, ... consisting of {{1, ... ,n}} satisfy the following conditions?\n - T...
[{"input": "1000000\n", "output": "267909856\n"}, {"input": "654321\n", "output": "968545283\n"}, {"input": "999745\n", "output": "371558098\n"}, {"input": "999880\n", "output": "488039603\n"}, {"input": "999999\n", "output": "373070711\n"}, {"input": "380467\n", "output": "858853071\n"}, {"input": "407774\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\nTanya wants to go on a journey across the cities of Berland. There are $n$ cities situated along the main rai...
[{"input": "15\n10 10 10 1 2 3 4 5 6 7 8 9 10 11 12\n", "output": "78\n"}, {"input": "10\n10 60 12 13 14 15 16 66 18 130\n", "output": "130\n"}, {"input": "9\n18 11 24 7 18 10 1 20 17\n", "output": "24\n"}, {"input": "9\n4 10 21 7 23 9 15 11 12\n", "output": "44\n"}, {"input": "10\n12 14 1 2 3 4 5 6 7 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\nThere are n wizards. They are numbered from 1 to n, and the i-th wizard has the magical power ri (1 ≤ i ≤ n)....
[{"input": "3 11\n0\n3\n10\n0 0", "output": "1\n"}, {"input": "3 11\n0\n3\n18\n0 0", "output": "2\n"}, {"input": "3 11\n0\n3\n20\n0 0", "output": "2\n"}, {"input": "3 13\n1\n3\n10\n0 0", "output": "0\n"}, {"input": "3 11\n0\n3\n17\n0 0", "output": "2\n"}, {"input": "3 22\n1\n3\n10\n0 0", "output": "0\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\nSereja has a bracket sequence s_1, s_2, ..., s_{n}, or, in other words, a string s of length n, consisting of...
[{"input": "(()((((()(())((((((((()((((((()((((\n71\n15 29\n17 18\n5 26\n7 10\n16 31\n26 35\n2 30\n16 24\n2 24\n7 12\n15 18\n12 13\n25 30\n1 30\n12 13\n16 20\n6 35\n20 28\n18 23\n9 31\n12 35\n14 17\n8 16\n3 10\n12 33\n7 19\n2 33\n7 17\n21 27\n10 30\n29 32\n9 28\n18 32\n28 31\n31 33\n4 26\n15 27\n10 17\n8 14\n11 28\n8 2...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given three integers A, B and C. Find the minimum number of operations required to make A, B and C al...
[{"input": "27 39 17\n", "output": "17\n"}, {"input": "19 43 41\n", "output": "13\n"}, {"input": "39 49 21\n", "output": "19\n"}, {"input": "26 37 19\n", "output": "16\n"}, {"input": "13 48 20\n", "output": "33\n"}, {"input": "31 41 5\n", "output": "23\n"}, {"input": "50 50 50\n", "output": "0\n"}, {"input": "50 50 49\...
code_stdio
[ { "content": "You are an expert Python programmer. 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 building the encrypted string:Take every 2nd char from the string, then the other chars, that are not eve...
[{"input": "\"hskt svr neetn!Ti aai eyitrsig\"\n1", "output": "[\"This kata is very interesting!\"]", "fn_name": "decrypt"}, {"input": "\"This is a test!\"\n-1", "output": "[\"This is a test!\"]", "fn_name": "decrypt"}, {"input": "\"This is a test!\"\n0", "output": "[\"This is a test!\"]", "fn_name": "decrypt"}, {"inpu...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAndrewid the Android is a galaxy-famous detective. He is now chasing a criminal hiding on the planet Oxa-5, t...
[{"input": "3 2\n1000000000000000 1000000000000000\n3000000000000000 4000000000000000\n6000000000000000 7000000000000000\n2000000000000000 4000000000000000\n", "output": "Yes\n1 2 \n"}, {"input": "3 2\n1000000000000000 1000000000000000\n3000000000000000 4000000000000000\n6000000000000000 7000000000000000\n2000000000000...
code_stdio
[ { "content": "You are an expert Python programmer. 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$ pillars aligned in a row and numbered from $1$ to $n$.\n\nInitially each pillar contains exactl...
[{"input": "100\n1 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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100\n", "output...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLet's call a set of positive integers a_1, a_2, ..., a_k quadratic if the product of the factorials of its el...
[{"input": "17027\n", "output": "17024\n1 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 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\n# Task\n In ChessLand there is a small but proud chess bishop with a recurring dream. \n \n In the dream the ...
[{"input": "[17, 19]\n[16, 18]\n[1, 1]\n239239239", "output": "[[10, 2]]", "fn_name": "chess_bishop_dream"}, {"input": "[1, 1]\n[0, 0]\n[1, -1]\n1000000000", "output": "[[0, 0]]", "fn_name": "chess_bishop_dream"}, {"input": "[17, 19]\n[14, 8]\n[1, -1]\n239239", "output": "[[4, 17]]", "fn_name": "chess_bishop_dream"}, {...
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\nDevu is a dumb guy, his learning curve is very slow. You are supposed to teach him n subjects, the i^{th} sub...
[{"input": "20 8\n6 16 0 2 6 10 1 4 1 5 3 5 9 2 2 8 0 2 3 3\n", "output": "109\n"}, {"input": "20 8\n6 16 0 2 6 13 1 4 6 5 3 5 9 2 2 8 0 2 3 3\n", "output": "121\n"}, {"input": "20 8\n6 16 0 2 6 10 1 4 6 5 3 5 9 2 2 8 0 2 3 3\n", "output": "118\n"}, {"input": "20 10\n6 6 1 2 6 4 5 3 6 5 4 5 6 5 4 6 6 2 3 3\n", "output"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nRead problems statements in Mandarin Chinese and Russian. \nSpring is interesting season of year. Chef is th...
[{"input": "18 6 1\n0 3\n-1 7 \n3 2 \n4 1\n6 3\n7 2", "output": "5\n5\n5\n5\n5\n5\n5\n5\n5\n5\n5\n5\n5\n5\n5\n5\n5\n5\n"}, {"input": "15 2 6\n3 0\n3 4 \n5 0 \n4 1\n4 0\n7 3", "output": "1\n1\n1\n0\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n"}, {"input": "13 4 6\n3 2\n3 4 \n5 0 \n4 0\n4 0\n7 3", "output": "3\n3\n4\n-1\n3\n3\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\nLittle Dima has two sequences of points with integer coordinates: sequence (a_1, 1), (a_2, 2), ..., (a_{n}, n...
[{"input": "100\n2 2 10 3 5 6 4 7 9 8 2 7 5 5 1 7 5 9 2 2 10 3 6 10 9 9 10 7 3 9 7 8 8 3 9 3 9 3 3 6 3 7 9 9 7 10 9 1 1 3 6 2 9 5 9 9 6 2 6 5 6 8 2 10 1 1 6 8 8 4 5 2 6 8 8 5 9 2 3 3 7 7 10 5 4 2 10 6 7 6 5 4 10 6 10 3 9 9 1 5\n3 5 6 4 2 3 2 9 3 8 3 1 10 7 4 3 6 9 3 5 9 5 3 10 4 7 9 7 4 3 3 6 9 8 1 1 10 9 1 6 8 8 8 2 1...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTheofanis really likes sequences of positive integers, thus his teacher (Yeltsa Kcir) gave him a problem abou...
[{"input": "3\n6 10\n4 20\n105 276\n", "output": "222\n272\n456030397\n"}, {"input": "3\n6 11\n2 17\n105 194\n", "output": "223\n17\n136912005\n"}, {"input": "3\n6 7\n4 20\n105 276\n", "output": "43\n272\n456030397\n"}, {"input": "3\n6 7\n2 12\n105 276\n", "output": "43\n12\n456030397\n"}, {"input": "3\n2 26\n0 10\n105...
code_stdio
[ { "content": "You are an expert Python programmer. 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 decided to give an allowance to your child depending on the outcome of the game that he will play no...
[{"input": "-1 12 1", "output": "120\n"}, {"input": "9 9 9\n", "output": "108\n"}, {"input": "9 2 8\n", "output": "100\n"}, {"input": "7 9 7\n", "output": "104\n"}, {"input": "9 9 4\n", "output": "103\n"}, {"input": "1 11 1", "output": "112\n"}, {"input": "1 21 1", "output": "212\n"}, {"input": "2 21 1", "output": "213...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLevian works as an accountant in a large company. Levian knows how much the company has earned in each of the...
[{"input": "17\n-542470641 -617247806 1649173051 111521800 509758067 -860452587 447120886 234437807 707835273\n5\n", "output": "17\n"}, {"input": "17\n-542470641 -617247806 998970243 699622219 732907519 -860452587 447120886 203125491 707835273\n5\n", "output": "17\n"}, {"input": "17\n-542470641 -617247806 998970243 699...
code_stdio
[ { "content": "You are an expert Python programmer. 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 breakthrough among computer games, \"Civilization XIII\", is striking in its scale and elaborate details. L...
[{"input": "1000000\n", "output": "1209197264797\n"}, {"input": "1010000\n", "output": "1233502153639\n"}, {"input": "1010100\n", "output": "1233746427001\n"}, {"input": "999811\n", "output": "1208740231393\n"}, {"input": "999998\n", "output": "1209192430093\n"}, {"input": "999999\n", "output": "1209194850235\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\nYou have $N$ items that you want to put them into a knapsack. Item $i$ has value $v_i$, weight $w_i$ and limi...
[{"input": "5 1000001100\n3 1 1000000010\n7 10 1000100110\n7 3 1000000000\n11 27 1100000000\n2 7 1000000000", "output": "3000002572\n"}, {"input": "5 1000000000\n1 1 1000000000\n7 11 1000100000\n4 4 1000000000\n6 20 1000000100\n3 5 1000000000", "output": "1000000000\n"}, {"input": "5 1000000000\n4 1 1000000000\n11 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\nOne day a highly important task was commissioned to Vasya — writing a program in a night. The program consist...
[{"input": "1001000000 10\n", "output": "900900002\n"}, {"input": "1000010000 10\n", "output": "900009002\n"}, {"input": "1000100000 10\n", "output": "900090002\n"}, {"input": "1000101000 10\n", "output": "900090903\n"}, {"input": "1000000000 10\n", "output": "900000001"}, {"input": "177583558 15\n", "output": "1657446...
code_stdio
[ { "content": "You are an expert Python programmer. 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's bonus time in the big city! The fatcats are rubbing their paws in anticipation... but who is going to ma...
[{"input": "10000\ntrue", "output": "[\"$100000\"]", "fn_name": "bonus_time"}, {"input": "25000\ntrue", "output": "[\"$250000\"]", "fn_name": "bonus_time"}, {"input": "10000\nfalse", "output": "[\"$10000\"]", "fn_name": "bonus_time"}, {"input": "60000\nfalse", "output": "[\"$60000\"]", "fn_name": "bonus_time"}, {"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\nPolycarp lives on the coordinate axis $Ox$ and travels from the point $x=a$ to $x=b$. It moves uniformly rect...
[{"input": "9\n4 17 0 0\n0 6 0 0\n5 0 7 3\n52 2 20 010\n-11 20 -40 0\n2 2 0 0\n-2 0 1 4\n-1 4 0 2\n0 4 -10 0\n", "output": "13\n6\n4\n30\n31\n0\n0\n2\n4\n"}, {"input": "9\n1 10 7 1\n3 3 1 0\n8 2 10 4\n10 2 10 100\n-10 20 -17 2\n-3 1 0 0\n-3 1 2 0\n2 3 0 3\n-1 1 -2 2\n", "output": "7\n0\n4\n0\n30\n4\n4\n0\n1\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\nYou are given a string $s$ consisting of lowercase Latin letters and $q$ queries for this string.\n\nRecall t...
[{"input": "dfcbbcfeeedbaea\n15\n1 1 e\n1 4 b\n2 10 15\n1 7 b\n1 12 c\n2 6 8\n2 1 6\n1 7 c\n1 2 f\n1 10 a\n2 7 11\n1 10 a\n1 14 b\n1 1 f\n2 1 11\n", "output": "4\n3\n4\n4\n6\n"}, {"input": "decbbcfeeedbafa\n15\n1 1 e\n1 4 b\n2 10 15\n1 7 b\n1 12 c\n2 6 8\n2 1 6\n1 7 c\n1 2 f\n1 10 a\n2 7 11\n1 10 a\n1 14 b\n1 1 f\n2 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\nTaro Aizu's company has a boss who hates being indivisible. When Taro goes out to eat with his boss, he pays ...
[{"input": "4 15000\n520\n41\n129\n500\n3 1047\n6\n20\n25\n3 359208\n5\n14\n17\n0 0", "output": "14983\n1039\n359207\n"}, {"input": "4 15000\n305\n260\n136\n500\n3 400\n10\n23\n30\n3 599838\n5\n1\n12\n0 0", "output": "14983\n397\n599831\n"}, {"input": "4 29657\n305\n131\n129\n500\n3 400\n10\n20\n30\n3 337371\n1\n14\n12...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA great king of a certain country suddenly decided to visit the land of a friendly country. The country is fa...
[{"input": "2\n1 2\nadd\n3\n12 4 0\nDDDA\n5\n3 1 3 5 2\ndcdkIlkP\n0", "output": "Zbc\nrzDo\nabafGijM\n"}, {"input": "2\n1 2\nadd\n3\n12 4 1\nDDDA\n5\n3 1 3 5 2\ndcdkIlkP\n0", "output": "Zbc\nrzCo\nabafGijM\n"}, {"input": "2\n1 0\nadd\n3\n12 4 1\nDDDA\n5\n3 1 3 5 2\ndcdkIlkP\n0", "output": "Zdc\nrzCo\nabafGijM\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\nProfessor GukiZ makes a new robot. The robot are in the point with coordinates (x_1, y_1) and should go to th...
[{"input": "-1000000000 -1000000000\n1000000000 -1000000000\n", "output": "2000000000\n"}, {"input": "-1000000000 -1000000000\n1000000000 -1000000000\n", "output": "2000000000\n"}, {"input": "-1000000000 -1000000000\n1000000000 1000000000\n", "output": "2000000000\n"}, {"input": "-1000000000 1000000000\n1000000000 -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\nGiven an array of numbers, return a string made up of four parts:\n\na) a four character 'word', made up of t...
[{"input": "[82, 98, 72, 71, 71, 72, 62, 67, 68, 115, 117, 112, 122, 121, 93]", "output": "[\"Rby]->Cyz-zyC>->Cyz\"]", "fn_name": "sort_transform"}, {"input": "[111, 121, 122, 124, 125, 126, 117, 118, 119, 121, 122, 73]", "output": "[\"oyzI-Io}~-~}oI-Io}~\"]", "fn_name": "sort_transform"}, {"input": "[78, 117, 110, 99,...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nGiven is a string S of length N.\nFind the maximum length of a non-empty string that occurs twice or more in ...
[{"input": "5000\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
code_stdio
[ { "content": "You are an expert Python programmer. 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 Nikita found the string containing letters \"a\" and \"b\" only. \n\nNikita thinks that string is bea...
[{"input": "bbabbbbbaaba\n", "output": "10\n"}, {"input": "bbbbbbabaaaa\n", "output": "11\n"}, {"input": "bbabbbbabbbb\n", "output": "10\n"}, {"input": "baabbbbbaaba\n", "output": "10\n"}, {"input": "baabaaaabbaa\n", "output": "10\n"}, {"input": "baabbbbbabba\n", "output": "10\n"}, {"input": "bbabbbabbbbb\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\nRead problems statements in Mandarin Chinese and Russian. \n\nThe following is an easy game that the setter ...
[{"input": "2\n3 0\n1 2\n1 4\n1 -1\n1 14\n2 3\n2 4", "output": "YES\nYES\n"}, {"input": "2\n3 0\n1 2\n1 4\n1 -1\n1 14\n2 1\n2 4", "output": "YES\nYES\n"}, {"input": "2\n3 0\n1 2\n1 4\n1 -1\n1 14\n2 1\n2 2", "output": "YES\nYES\n"}, {"input": "2\n3 0\n1 2\n1 4\n1 -1\n1 14\n0 1\n2 2", "output": "YES\nYES\n"}, {"input": "...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nHacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of e...
[{"input": "50 50\n5733 740 547 3647 5382 5109 6842 7102 5879 1502 3574 1628 7905 4357 8569 9564 8268 3542 2487 8532 425 7713 2585 925 6458 2697 2844 69 324 9030 495 4428 6724 3524 3304 4874 1303 2098 1136 1048 2464 7316 274 9586 534 2450 2368 8060 7795 70692\n1918 4122 6806 4914 6517 6278 9842 9480 6609 4221 9373 1728...
code_stdio
[ { "content": "You are an expert Python programmer. 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 fence in front of Polycarpus's home. The fence consists of n planks of the same width which go one...
[{"input": "10 5\n1 2 3 1 2 2 3 1 4 5\n", "output": "1\n"}, {"input": "10 2\n3 1 4 1 4 6 2 1 4 6\n", "output": "7\n"}, {"input": "10 4\n1 1 1 4 4 4 4 4 4 3\n", "output": "1\n"}, {"input": "10 2\n3 1 4 1 4 6 2 1 4 6\n", "output": "7\n"}, {"input": "10 4\n1 1 1 4 4 4 4 4 4 3\n", "output": "1\n"}, {"input": "10 5\n1 2 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\nYou are given an array a_1, a_2, ..., a_n and an array b_1, b_2, ..., b_n.\n\nFor one operation you can sort ...
[{"input": "10\n3\n1 2 1\n3 1 2\n1\n1\n1\n19\n15 10 19 11 6 16 1 5 1 14 8 6 8 7 1 8 1 5 13\n7 13 18 9 16 11 1 2 17 13 1 16 13 19 4 3 9 7 3\n15\n9 3 2 15 8 4 10 10 2 12 1 9 5 7 8\n4 5 6 15 1 7 9 10 3 2 1 2 14 6 12\n16\n5 6 11 12 8 2 3 12 2 4 6 15 2 8 15 7\n15 5 3 12 14 2 9 11 14 13 13 14 14 1 7 7\n17\n8 10 4 6 11 7 14 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\nTwo players play a game.\n\nInitially there are $n$ integers $a_1, a_2, \\ldots, a_n$ written on the board. E...
[{"input": "10\n58 26 65 15 13 81 111 48 22 50\n", "output": "48\n"}, {"input": "10\n58 26 65 15 13 81 111 48 22 55\n", "output": "48\n"}, {"input": "10\n58 26 77 15 53 81 68 48 22 65\n", "output": "53\n"}, {"input": "10\n58 26 77 15 13 81 68 48 22 65\n", "output": "48\n"}, {"input": "10\n58 26 77 15 13 81 68 48 22 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\nFirst-rate specialists graduate from Berland State Institute of Peace and Friendship. You are one of the most...
[{"input": "prntaxhysjfcfmrjngdsitlguahtpnwgbaxptubgpwcfxqehrulbxfcjssgocqncscduvyvarvwxzvmjoatnqfsvsilubexmwugedtzavyamqjqtkxzuslielibjnvkpvyrbndehsqcaqzcrmomqqwskwcypgqoawxdutnxmeivnfpzwvxiyscbfnloqjhjacsfnkfmbhgzpujrqdbaemjsqphokkiplblbflvadcyykcqrdohfasstobwrobslaofbasylwiizrpozvhtwyxtzl\n", "output": "505\nac\nacs...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAn ant moves on the real line with constant speed of $1$ unit per second. It starts at $0$ and always moves t...
[{"input": "5\n370534603 100000000 1\n600000000 400000000 0\n800000000 300000000 0\n900000000 700000000 1\n1000000000 500000000 0\n", "output": "444580501\n"}, {"input": "5\n370534603 100000000 1\n600000000 400000000 0\n800000000 300000000 0\n900000000 700000000 1\n1010000000 500000000 0\n", "output": "454580501\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 full exploration sister is a very talented woman. Your sister can easily count the number of routes in a ...
[{"input": "-2 1 -1 2\n6\n-1 2\n2 0\n1 -2\n1 1\n-1 -1\n-1 -1\n2 5", "output": "-1\n"}, {"input": "-2 1 -1 2\n6\n-1 2\n2 0\n1 -2\n1 1\n-1 -1\n-1 -1\n3 5", "output": "-1\n"}, {"input": "-2 0 -1 2\n6\n-1 2\n2 0\n1 -2\n1 1\n-1 -1\n-1 -1\n3 5", "output": "-1\n"}, {"input": "-4 0 -1 2\n6\n-1 2\n2 0\n1 -2\n1 1\n-1 -1\n-1 -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\nKsusha is a beginner coder. Today she starts studying arrays. She has array a_1, a_2, ..., a_{n}, consisting ...
[{"input": "5\n506904227 214303304 136194869 838256937 183952885\n", "output": "-1\n"}, {"input": "5\n506904227 214303304 136194869 838256937 183952885\n", "output": "-1\n"}, {"input": "5\n238711016 214303304 136194869 838256937 183952885\n", "output": "-1\n"}, {"input": "5\n310947607 214303304 136194869 838256937 1839...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSomeone gave Alyona an array containing n positive integers a_1, a_2, ..., a_{n}. In one operation, Alyona ca...
[{"input": "10\n1 1 1 10000000 10000000 10000000 10000000 10000000 10000000 10000000\n", "output": "9\n"}, {"input": "10\n1 1 1 10000000 10000000 10000000 10000000 10000000 10000000 10000000\n", "output": "9\n"}, {"input": "10\n1 1 1 10000000 10000000 10000000 10000000 10000000 10000000 11000000\n", "output": "9\n"}, {...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA positive integer number n is written on a blackboard. It consists of not more than 105 digits. You have to ...
[{"input": "53684795681792590016697187295561462737810600000146840941336328677293748561247888801665863139922929397968535048060292988802347668853531069156825523164438370977880256909710958836918627008217572514193873141535365258436916984535972865113877338591947508645026570682995314540038481160747606741045307222213966802022...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nChuck has lost count of how many asses he has kicked...\n\nChuck stopped counting at 100,000 because he prefe...
[{"input": "\" 76 B2L4D0A8C6.-T%8.90. lkd\"", "output": "[true]", "fn_name": "body_count"}, {"input": "\"ffr65A C8K4D9U7V5.-Y%8.00.\"", "output": "[true]", "fn_name": "body_count"}, {"input": "\"PP P6A6T5F5S3.-Z%1.11.hgr\"", "output": "[true]", "fn_name": "body_count"}, {"input": "\"d G8H1E2O9N3.-W%8.56. f\""...
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\nAn altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (...
[{"input": "8\nWRWWRWRR\n", "output": "3\n"}, {"input": "8\nRRWRWWRW", "output": "1\n"}, {"input": "8\nRRWWWRRW", "output": "2\n"}, {"input": "8\nWRWWWRRR", "output": "3\n"}, {"input": "8\nWWWWRRRR", "output": "4\n"}, {"input": "8\nRRWRVWRW", "output": "1\n"}, {"input": "8\nWRRWWWRR", "output": "2\n"}, {"input": "8\nRR...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWhile playing with geometric figures Alex has accidentally invented a concept of a $n$-th order rhombus in a ...
[{"input": "100\n", "output": "19801\n"}, {"input": "100\n", "output": "19801"}, {"input": "72\n", "output": "10225\n"}, {"input": "94\n", "output": "17485\n"}, {"input": "77\n", "output": "11705\n"}, {"input": "86\n", "output": "14621\n"}, {"input": "98\n", "output": "19013\n"}, {"input": "75\n", "output": "11101\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\nTired of boring office work, Denis decided to open a fast food restaurant.\n\nOn the first day he made $a$ po...
[{"input": "7\n1 4 1\n0 0 0\n16 0 1\n2 2 2\n2 3 2\n3 2 2\n0 4 4\n", "output": "3\n0\n2\n4\n5\n5\n3\n"}, {"input": "7\n0 1 1\n0 0 0\n11 1 1\n2 2 4\n3 3 3\n4 2 3\n0 6 1\n", "output": "2\n0\n3\n5\n6\n5\n2\n"}, {"input": "7\n1 2 1\n0 0 0\n16 1 1\n2 2 2\n2 3 2\n3 2 2\n0 4 4\n", "output": "3\n0\n3\n4\n5\n5\n3\n"}, {"input": ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nM-kun is a brilliant air traffic controller.\n\nOn the display of his radar, there are N airplanes numbered 1...
[{"input": "8\n285 224 U\n130 175 R\n111 322 D\n121 188 L\n201 116 U\n112 121 R\n145 239 D\n185 107 L", "output": "SAFE\n"}, {"input": "8\n285 224 U\n130 175 R\n101 322 D\n121 188 L\n201 116 U\n112 121 R\n145 239 D\n185 107 L", "output": "SAFE\n"}, {"input": "8\n285 224 U\n130 175 R\n111 198 D\n121 188 L\n201 116 U\n11...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n\n1 ...
[{"input": "5\n10\n1\n5\n9\n1", "output": "2\n4 1\n1\n1\n1\n5\n9\n10\n"}, {"input": "5\n10\n1\n5\n7\n1", "output": "2\n4 1\n1\n1\n1\n5\n7\n10\n"}, {"input": "5\n6\n1\n10\n7\n1", "output": "2\n4 1\n4\n1\n1\n6\n7\n10\n"}, {"input": "5\n6\n1\n1\n13\n2", "output": "2\n4 1\n4\n1\n1\n2\n6\n13\n"}, {"input": "5\n6\n1\n2\n13\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\nMonocarp is playing a computer game. In this game, his character fights different monsters.\n\nA fight betwee...
[{"input": "2\n1000000000000000 1\n1000000000000000 200000\n0 1 1\n1000000000000000 200000\n1000000000000000 1\n0 1 1\n", "output": "NO\nYES\n"}, {"input": "2\n1000000000000000 1\n1000000000000000 1000000000\n1000 10000 10000000000\n9 2\n16 4\n0 10 10\n", "output": "NO\nNO\n"}, {"input": "4\n25 4\n9 20\n1 1 10\n25 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\nThe Queen of England has n trees growing in a row in her garden. At that, the i-th (1 ≤ i ≤ n) tree from the ...
[{"input": "50 5\n232 6 17 6 21 26 27 36 41 88 665 56 61 66 71 76 602 86 28 712 101 106 111 116 121 126 131 136 141 146 151 156 161 166 755 176 181 186 191 196 201 206 211 216 5 226 172 236 241 246\n", "output": "12\n- 1 231\n- 3 6\n+ 4 10\n+ 7 4\n- 10 42\n- 11 614\n- 17 521\n+ 19 63\n- 20 616\n- 35 584\n+ 45 216\n+ 47...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nVK news recommendation system daily selects interesting publications of one of n disjoint categories for each...
[{"input": "40\n19 20 8 13 13 17 1 14 15 20 14 17 2 9 9 10 19 16 6 12 9 7 20 5 12 6 4 4 12 5 4 11 8 1 2 8 11 19 18 4\n52258 5648 46847 9200 101064 79328 64407 54479 1788 60107 8234 64215 15419 84411 50307 78075 92548 17867 43456 7970 1390 99373 97297 90662 82950 678 79356 51351 2794 82477 16508 19254 81295 9711 72350 1...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given three strings A, B and C. Check whether they form a word chain.\nMore formally, determine wheth...
[{"input": "aaaaaaaaab aaaaaaaaaa aaaaaaaaab\n", "output": "NO\n"}, {"input": "baaaa`aaaa aabaaaaaaa aaaaa`aaab", "output": "YES\n"}, {"input": "baaaaaaa`` `aaaaaabaa aaaaa`aaab", "output": "YES\n"}, {"input": "baaabaaa`` `aaaaaabaa aaaaa`aaab", "output": "YES\n"}, {"input": "baaabaaa`` `aaabaabaa aaaaa`aaab", "output"...
code_stdio