messages
listlengths
1
1
ground_truth
stringlengths
88
726k
dataset
stringclasses
2 values
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset.\n\nArtem want...
[{"type": "stdin_stdout", "input": "10\n1 1 1000000000\n1 4 1000000000\n2 2 1000000000\n1 5 1000000000\n1 8 1000000000\n2 15 1000000000\n3 3 1000000000\n3 10 1000000000\n3 6 1000000000\n3 7 1000000000\n", "output": "0\n3\n2\n2\n"}, {"type": "stdin_stdout", "input": "10\n1 1 1000000000\n1 4 1000000000\n2 2 1000000000\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N holes in a two-dimensional plane. The coordinates of the i-th hole are (x_i,y_i).\n\nLet R=10^{10^{10^{10}}}. Ringo performs the following operation:\n\n* Randomly choose a point from the interior of a circle ...
[{"type": "stdin_stdout", "input": "5\n0 0\n2 8\n4 5\n2 6\n3 10", "output": "0.43160120892732328768\n0.03480224363653196956\n0.13880483535586193855\n0.00000000000000000000\n0.39479171208028279727"}, {"type": "stdin_stdout", "input": "5\n1 0\n2 13\n-1 1\n4 10\n3 10", "output": "0.277405019286\n0.367426913906\n0.21519775...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi has two positive integers A and B.\n\nIt is known that A plus B equals N. Find the minimum possible value of \"the sum of the digits of A\" plus \"the sum of the digits of B\" (in base 10).\n\nConstraints\n\n* 2...
[{"type": "stdin_stdout", "input": "100000", "output": "10"}, {"type": "stdin_stdout", "input": "1697", "output": "23\n"}, {"type": "stdin_stdout", "input": "199", "output": "19\n"}, {"type": "stdin_stdout", "input": "178", "output": "16\n"}, {"type": "stdin_stdout", "input": "389", "output": "20\n"}, {"type": "stdin_s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian as well. \n\n\tA version control system(VCS) is a repository of files, often the files for the source code of computer programs, with monitored access. Every change...
[{"type": "stdin_stdout", "input": "2\n19 4 6\n1 4 6 7\n1 2 3 4 6 8\n12 2 2\n1 4\n1 4", "output": "3 12\n2 10\n"}, {"type": "stdin_stdout", "input": "2\n19 4 6\n1 4 6 7\n1 2 3 4 6 7\n12 2 2\n1 4\n1 4", "output": "4 13\n2 10\n"}, {"type": "stdin_stdout", "input": "2\n17 4 6\n1 3 6 11\n1 2 3 5 6 7\n5 2 2\n2 4\n3 4", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a huge decimal number consisting of $n$ digits. It is guaranteed that this number has no leading zeros. Each digit of this number is either 0 or 1.\n\nYou may perform several (possibly zero) operations with ...
[{"type": "stdin_stdout", "input": "213 5 3\n111001111110111001101011111100010010011001000001111010110110011000100000101010111110010001111110001010011001101000000011111110101001101100100100110100000111111100010100011010010001011100111011000001110000111000101\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "213 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMaya writes weekly articles to a well known magazine, but she is missing one word each time she is about to send the article to the editor. The article is not complete without this word. Maya has a friend, Dan, and he is ...
[{"input": "103247", "output": "[\"boiled\"]", "fn_name": "hidden"}, {"input": "942547", "output": "[\"melted\"]", "fn_name": "hidden"}, {"input": "49632", "output": "[\"email\"]", "fn_name": "hidden"}, {"input": "12674", "output": "[\"blade\"]", "fn_name": "hidden"}, {"input": "56124", "output": "[\"table\"]", "fn_nam...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIf you draw a few infinitely long straight lines on an infinitely wide plane, this plane will be divided into several areas. For example, if you draw a straight line, the plane will be divided into two areas. Even if you ...
[{"type": "stdin_stdout", "input": "1\n705", "output": "2\n248866\n"}, {"type": "stdin_stdout", "input": "1\n506", "output": "2\n128272\n"}, {"type": "stdin_stdout", "input": "1\n154", "output": "2\n11936\n"}, {"type": "stdin_stdout", "input": "1\n238", "output": "2\n28442\n"}, {"type": "stdin_stdout", "input": "1\n373...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMr. E Ven only likes even length words.\nPlease create a translator so that he doesn't have to hear those pesky odd length words.\nFor some reason he also hates punctuation, he likes his sentences to flow.\n\nYour transla...
[{"input": "\"underscore is not considered a word..in this case,\"", "output": "[\"underscore is nott considered aa wordin this case\"]", "fn_name": "evenator"}, {"input": "\"lorem is so ipsum. why bother?\"", "output": "[\"loremm is so ipsumm whyy bother\"]", "fn_name": "evenator"}, {"input": "\"hi. how are you? Bye!!...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAt 17:00, special agent Jack starts to escape from the enemy camp. There is a cliff in between the camp and the nearest safety zone. Jack has to climb the almost vertical cliff by stepping his feet on the blocks that cove...
[{"type": "stdin_stdout", "input": "6 6\n4 4 X X T T\n4 7 8 2 X 7\n1 X X X 1 8\n1 2 X X X 6\n1 1 2 4 4 7\nS S 2 3 X X\n2 10\nT 1\n1 X\n1 X\n1 X\n1 1\n1 X\n1 X\n1 1\n1 X\nS S\n2 10\nT X\n1 X\n1 X\n1 X\n1 1\n1 X\n1 X\n1 1\n1 X\nS S\n10 10\nT T T T T T T T T T\nX 2 X X X X X 3 4 X\n9 8 9 X X X 2 9 X 9\n7 7 X 7 3 X X 8 9 X...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis kata is from check py.checkio.org\n\nYou are given an array with positive numbers and a number N. You should find the N-th power of the element in the array with the index N. If N is outside of the array, then return...
[{"input": "[1, 1, 1, 1, 1, 1, 1, 1, 1, 100]\n9", "output": "[1000000000000000000]", "fn_name": "index"}, {"input": "[75, 68, 35, 61, 9, 36, 89, 0, 30]\n10", "output": "[-1]", "fn_name": "index"}, {"input": "[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n9", "output": "[1]", "fn_name": "index"}, {"input": "[1, 3, 10, 100]\n3", "outpu...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe official capital and the cultural capital of Berland are connected by a single road running through n regions. Each region has a unique climate, so the i-th (1 ≤ i ≤ n) region has a stable temperature of ti degrees in...
[{"type": "stdin_stdout", "input": "20 102\n73 79 75 27\n13 15 62 47\n74 75 85 86\n49 81 23 69\n43 17 45 27\n35 14 90 35\n51 74 35 33\n54 66 46 24\n33 76 49 3\n34 53 25 76\n69 72 76 31\n41 31 8 48\n49 48 85 24\n19 2 59 83\n19 31 51 86\n31 10 45 76\n56 47 79 86\n49 33 15 1\n77 89 26 64\n7 52 76 77\n", "output": "59201\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNezzar has $n$ balls, numbered with integers $1, 2, \\ldots, n$. Numbers $a_1, a_2, \\ldots, a_n$ are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that $a_i \\leq a_{i+...
[{"type": "stdin_stdout", "input": "5\n6\n1 1 1 2 3 4\n5\n1 1 2 2 3\n4\n2 2 2 2\n3\n1 2 3\n1\n1\n", "output": "\n3\n2\n4\n1\n1\n"}, {"type": "stdin_stdout", "input": "5\n6\n1 1 1 2 3 4\n5\n1 1 2 2 3\n4\n2 2 2 2\n3\n1 2 3\n1\n1\n", "output": "3\n2\n4\n1\n1\n"}, {"type": "stdin_stdout", "input": "5\n6\n1 1 1 2 3 4\n5\n1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe, the researchers who discovered and investigated the ancient nation Iwashiro, finally discovered the temple in the center of Iwashiro. A lithograph dedicated to the god of Iwashiro was stored in the temple. On the lith...
[{"type": "stdin_stdout", "input": "aaaabaaaabaaaabaaaab\naabaa", "output": "1576\n"}, {"type": "stdin_stdout", "input": "aaaabaaaabaa`abaaaab\naabaa", "output": "1248\n"}, {"type": "stdin_stdout", "input": "aaaabaaaabaa`ababaaa\naabaa", "output": "1446\n"}, {"type": "stdin_stdout", "input": "aaaabaaaabaaaabaaaab\nbaaa...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $s$ consisting of $n$ lowercase Latin letters.\n\nYou have to remove at most one (i.e. zero or one) character of this string in such a way that the string you obtain will be lexicographically smalle...
[{"type": "stdin_stdout", "input": "26\nlolthisiscoolfreehackforya\n", "output": "llthisiscoolfreehackforya\n"}, {"type": "stdin_stdout", "input": "26\nlolthisiscoolfreehackforya\n", "output": "llthisiscoolfreehackforya\n"}, {"type": "stdin_stdout", "input": "26\nlolthisiscoolfrfehackforya\n", "output": "llthisiscoolfr...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOmkar is playing his favorite pixelated video game, Bed Wars! In Bed Wars, there are $n$ players arranged in a circle, so that for all $j$ such that $2 \\leq j \\leq n$, player $j - 1$ is to the left of the player $j$, an...
[{"type": "stdin_stdout", "input": "5\n4\nRLRL\n6\nLRRRRL\n8\nRLLRRRLL\n12\nLLLLRRLRRRLL\n5\nRRRRR\n", "output": "0\n1\n1\n3\n2\n"}, {"type": "stdin_stdout", "input": "5\n4\nRLRL\n6\nLRRRRL\n8\nRLLRRRLL\n12\nLLRRRLRRLLLL\n5\nRRRRR\n", "output": "0\n1\n1\n3\n2\n"}, {"type": "stdin_stdout", "input": "5\n4\nRLRL\n6\nRRRLR...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNotice that the memory limit is non-standard.\n\nRecently Arthur and Sasha have studied correct bracket sequences. Arthur understood this topic perfectly and become so amazed about correct bracket sequences, so he even go...
[{"type": "stdin_stdout", "input": "50\n97 97\n61 61\n59 59\n29 29\n13 13\n7 7\n5 5\n3 3\n1 1\n3 3\n1 1\n13 13\n11 11\n9 9\n3 3\n1 1\n1 1\n1 1\n27 27\n25 25\n1 1\n21 21\n19 19\n17 17\n15 15\n5 5\n1 1\n1 1\n7 7\n1 1\n3 3\n1 1\n15 15\n13 13\n1 1\n9 9\n7 7\n5 5\n3 3\n1 1\n15 15\n5 5\n1 1\n1 1\n3 3\n1 1\n1 1\n1 1\n1 1\n1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWherever the destination is, whoever we meet, let's render this song together.\n\nOn a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and ...
[{"type": "stdin_stdout", "input": "20 50000 50000\n2 45955 55488\n1 19804 29337\n2 3767 90811\n2 24025 33558\n1 46985 56518\n2 21094 30627\n2 5787 15320\n1 4262 91306\n2 37231 46764\n1 18125 27658\n1 36532 12317\n1 31330 40863\n1 18992 28525\n1 29387 38920\n1 44654 54187\n2 45485 55018\n2 36850 46383\n1 44649 54182\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe ask you to select some number of positive integers, and calculate the sum of them.\nIt is allowed to select as many integers as you like, and as large integers as you wish.\nYou have to follow these, however: each sele...
[{"type": "stdin_stdout", "input": "103 135 85", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1 100 97\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "40 98 58\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "103 98 58", "output": "YES\n"}, {"type": "stdin_stdout", "input": "103 98 87", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it ...
[{"type": "stdin_stdout", "input": "100000000 100000000 100000000 100000000 1\n100000000 100000000 100001000 1\n", "output": "100000999\n"}, {"type": "stdin_stdout", "input": "100000000 100000000 100000000 100000000 1\n100000000 100000000 100000000 1\n", "output": "99999999\n"}, {"type": "stdin_stdout", "input": "10000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a rectangular grid of squares with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left. On this grid, there is a piece, which is ini...
[{"type": "stdin_stdout", "input": "2 6 11\n2 1\nRLDRRUDDLRL\nURRDRLLDLRD", "output": "NO\n"}, {"type": "stdin_stdout", "input": "5 6 11\n2 0\nRLDRRUDDLRL\nURRDRLLDLRD", "output": "NO\n"}, {"type": "stdin_stdout", "input": "4 6 11\n2 1\nRLDRRUDDLRL\nURRDRLLDLRD", "output": "NO\n"}, {"type": "stdin_stdout", "input": "5 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor an array $b$ of length $m$ we define the function $f$ as $ f(b) = \\begin{cases} b[1] & \\quad \\text{if } m = 1 \\\\ f(b[1] \\oplus b[2],b[2] \\oplus b[3],\\dots,b[m-1] \\oplus b[m]) & \\quad \\text{otherwise,} \\en...
[{"type": "stdin_stdout", "input": "6\n0 1 6 12 51 68\n4\n1 6\n2 6\n3 3\n2 4\n", "output": "125\n125\n6\n13\n"}, {"type": "stdin_stdout", "input": "6\n1 2 4 12 16 32\n4\n1 6\n2 6\n3 4\n1 4\n", "output": "56\n56\n12\n14\n"}, {"type": "stdin_stdout", "input": "6\n1 2 4 12 32 32\n4\n1 6\n2 6\n3 4\n1 4\n", "output": "44\n4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAt Akabeko Elementary School, all the students participate in a slightly unusual jogging. Students run their own lap courses at their own pace. After going around each of your courses, you will be returned to elementary s...
[{"type": "stdin_stdout", "input": "2\n3 4\n13 4\n5\n789 289\n166 46\n9 4\n617 272\n972 303\n2\n11 5\n23 20\n0", "output": "13\n3\n1598397732\n1209243492\n1939462992\n1923746112\n1360317793\n23\n44\n"}, {"type": "stdin_stdout", "input": "2\n3 4\n13 4\n5\n789 289\n166 46\n9 4\n617 272\n972 303\n2\n11 5\n32 20\n0", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNow I have a card with n numbers on it. Consider arranging some or all of these appropriately to make numbers. Find the number obtained by adding all the numbers created at this time.\n\nFor example, if you have 1 and 2, ...
[{"type": "stdin_stdout", "input": "4\n2\n8\n6\n10", "output": "1177916\n"}, {"type": "stdin_stdout", "input": "4\n4\n8\n6\n10", "output": "1315948\n"}, {"type": "stdin_stdout", "input": "4\n1\n5\n7\n17", "output": "1022430\n"}, {"type": "stdin_stdout", "input": "4\n4\n8\n3\n10", "output": "1108900\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA **bouncy number** is a positive integer whose digits neither increase nor decrease. For example, `1235` is an increasing number, `5321` is a decreasing number, and `2351` is a bouncy number. By definition, all numbers u...
[{"input": "129347924210", "output": "[true]", "fn_name": "is_bouncy"}, {"input": "92722983", "output": "[true]", "fn_name": "is_bouncy"}, {"input": "234689", "output": "[false]", "fn_name": "is_bouncy"}, {"input": "98874", "output": "[false]", "fn_name": "is_bouncy"}, {"input": "2379", "output": "[false]", "fn_name": ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAssume that you started to store items in progressively expanding square location, like this for the first 9 numbers:\n\n```\n05 04 03\n06 01 02\n07 08 09\n```\n\nAnd like this for the expanding to include up to the first...
[{"input": "25", "output": "[3]", "fn_name": "layers"}, {"input": "30", "output": "[4]", "fn_name": "layers"}, {"input": "50", "output": "[5]", "fn_name": "layers"}, {"input": "1", "output": "[1]", "fn_name": "layers"}, {"input": "5", "output": "[2]", "fn_name": "layers"}]
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nTaking into consideration the [3.5 edition rules](http://www.dandwiki.com/wiki/SRD:Ability_Scores#Table:_Ability_Modifiers_and_Bonus_Spells), your goal is to build a function that takes an ability score (worry not about v...
[{"input": "20", "output": "[{\"modifier\": 5, \"maximum_spell_level\": 9, \"extra_spells\": [2, 1, 1, 1, 1]}]", "fn_name": "char_attribute"}, {"input": "1", "output": "[{\"modifier\": -5, \"maximum_spell_level\": -1, \"extra_spells\": []}]", "fn_name": "char_attribute"}, {"input": "5", "output": "[{\"modifier\": -3, \...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a function named `first_non_repeating_letter` that takes a string input, and returns the first character that is not repeated anywhere in the string.\n\nFor example, if given the input `'stress'`, the function shoul...
[{"input": "\"Go hang a salami, I'm a lasagna hog!\"", "output": "[\",\"]", "fn_name": "first_non_repeating_letter"}, {"input": "\"hello world, eh?\"", "output": "[\"w\"]", "fn_name": "first_non_repeating_letter"}, {"input": "\"moonmen\"", "output": "[\"e\"]", "fn_name": "first_non_repeating_letter"}, {"input": "\"~><#...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya has got a robot which is situated on an infinite Cartesian plane, initially in the cell $(0, 0)$. Robot can perform the following four kinds of operations: U — move from $(x, y)$ to $(x, y + 1)$; D — move from $(...
[{"type": "stdin_stdout", "input": "386\nRUDLURLUURDDLLLRLDURLRRDLDUUURLLRDLRRDLDRLDDURDURURDRLUULLDUULRULDLLLLDLUURRLRRRUDULRDDRDLDULRLDDRDDRLRLDLDULLULUDULLLDUUDURURDDLDRLUDDDDLDUDUURLUUDURRUDRLUDRLULLRLRRDLULDRRURUULLRDLDRLURDUDRLDLRLLUURLURDUUDRDURUDDLLDURURLLRRULURULRRLDLDRLLUUURURDRRRLRDRURULUDURRLRLDRUDLRRRRLLRU...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn some country live wizards. They love playing with numbers. \n\nThe blackboard has two numbers written on it — a and b. The order of the numbers is not important. Let's consider a ≤ b for the sake of definiteness. The p...
[{"type": "stdin_stdout", "input": "66\n7 0\n5 7\n1 3\n3 2\n3 5\n0 6\n1 2\n0 7\n4 5\n4 7\n5 1\n2 0\n4 0\n0 5\n3 6\n7 2\n6 0\n5 3\n6 6\n1 7\n5 6\n2 2\n3 4\n2 0\n5 3\n4 6\n6 1\n5 3\n100000000000 0000000000000000000\n0 1\n4 1\n2 6\n5 5\n4 5\n0 3\n3 7\n3 1\n1 0\n4 4\n1000000000000000000 100000000000\n12 6\n4 2\n7 5\n1 6\n6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven a hash of letters and the number of times they occur, recreate all of the possible anagram combinations that could be created using all of the letters, sorted alphabetically.\n\nThe inputs will never include numbers...
[{"input": "{\"2\": [\"i\", \"a\"], \"1\": [\"z\", \"x\"]}", "output": "[[\"aaiixz\", \"aaiizx\", \"aaixiz\", \"aaixzi\", \"aaizix\", \"aaizxi\", \"aaxiiz\", \"aaxizi\", \"aaxzii\", \"aaziix\", \"aazixi\", \"aazxii\", \"aiaixz\", \"aiaizx\", \"aiaxiz\", \"aiaxzi\", \"aiazix\", \"aiazxi\", \"aiiaxz\", \"aiiazx\", \"aiix...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.\n\nSnuke, an employee, would like to play with this sequence.\nSpecific...
[{"type": "stdin_stdout", "input": "10000\n126382592 432418816 117063168 213396480 379143680 515038208 324231168 266539520 602792960 314653184 650153984 883734016 33309696 9005056 46451200 158759424 33279488 319342080 499438080 853167616 310094336 919876608 882363392 132034048 288561664 745817600 28561408 9703936 79297...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a given positive integer n denote its k-rounding as the minimum positive integer x, such that x ends with k or more zeros in base 10 and is divisible by n.\n\nFor example, 4-rounding of 375 is 375·80 = 30000. 30000 is...
[{"type": "stdin_stdout", "input": "1005856822 8\n", "output": "50292841100000000\n"}, {"type": "stdin_stdout", "input": "1522186596 8\n", "output": "38054664900000000\n"}, {"type": "stdin_stdout", "input": "123456789 8\n", "output": "12345678900000000\n"}, {"type": "stdin_stdout", "input": "999999999 8\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.\n\nFor example, the string \"Hello\" for p = 2, q = 3 can be split to the two strings \"Hel\" and \"lo\" or to t...
[{"type": "stdin_stdout", "input": "100 1 1\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n", "output": "100\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\nb\nb...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem you have to solve a simple classification task: given an image, determine whether it depicts a Fourier doodle. \n\nYou are given a set of 50 images with ids 1 through 50. You are also given a text file lab...
[{"type": "stdin_stdout", "input": "-116\n", "output": "0\n1\n1\n0\n1\n1\n0\n1\n1\n1\n1\n1\n0\n1\n0\n1\n1\n1\n0\n1\n1\n1\n1\n1\n0\n1\n0\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "-132\n", "output": "0\n1\n1\n0\n1\n1\n0\n1\n1\n1\n1\n1\n0\n1\n0\n1\n1\n1\n0\n1\n1\n1\n1\n1\n0\n1\n0\n1\n1\n1\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVus the Cossack holds a programming competition, in which $n$ people participate. He decided to award them all with pens and notebooks. It is known that Vus has exactly $m$ pens and $k$ notebooks.\n\nDetermine whether the...
[{"type": "stdin_stdout", "input": "100 100 100\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "100 100 100\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "000 100 000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "000 100 100\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA substring of some string is called the most frequent, if the number of its occurrences is not less than number of occurrences of any other substring.\n\nYou are given a set of strings. A string (not necessarily from thi...
[{"type": "stdin_stdout", "input": "76\namnctposz\nmnctpos\nos\nu\ne\nam\namnc\neamnctpo\nl\nx\nq\nposzq\neamnc\nctposzq\nctpos\nmnc\ntpos\namnctposzql\ntposzq\nmnctposz\nnctpos\nctposzql\namnctpos\nmnct\np\nux\nposzql\ntpo\nmnctposzql\nmnctp\neamnctpos\namnct\ntposzql\nposz\nz\nct\namnctpo\noszq\neamnct\ntposz\ns\nmn\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a function which outputs the positions of matching bracket pairs. The output should be a dictionary with keys the positions of the open brackets '(' and values the corresponding positions of the closing brackets ')'...
[{"input": "\"(a(b)c()d)\"", "output": "[{\"0\": 9, \"2\": 4, \"6\": 7}]", "fn_name": "bracket_pairs"}, {"input": "\"len(list)\"", "output": "[{\"3\": 8}]", "fn_name": "bracket_pairs"}, {"input": "\"f(x[0])\"", "output": "[{\"1\": 6}]", "fn_name": "bracket_pairs"}, {"input": "\"def f(x\"", "output": "[false]", "fn_name...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAddition of Big Integers\n\nGiven two integers $A$ and $B$, compute the sum, $A + B$.\n\nInput\n\nTwo integers $A$ and $B$ separated by a space character are given in a line.\n\nOutput\n\nPrint the sum in a line.\n\nConst...
[{"type": "stdin_stdout", "input": "109 30", "output": "139\n"}, {"type": "stdin_stdout", "input": "195 30", "output": "225\n"}, {"type": "stdin_stdout", "input": "302 30", "output": "332\n"}, {"type": "stdin_stdout", "input": "552 30", "output": "582\n"}, {"type": "stdin_stdout", "input": "139 37", "output": "176\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDiamond Miner is a game that is similar to Gold Miner, but there are $n$ miners instead of $1$ in this game.\n\nThe mining area can be described as a plane. The $n$ miners can be regarded as $n$ points on the y-axis. Ther...
[{"type": "stdin_stdout", "input": "3\n2\n0 1\n1 0\n0 -1\n-2 0\n4\n1 0\n3 0\n-5 0\n6 0\n0 3\n0 1\n0 2\n0 4\n5\n3 0\n0 4\n0 -3\n4 0\n2 0\n2 0\n-3 0\n0 -10\n0 -1\n0 -10\n", "output": "3.6502815398728847\n18.061819283610365\n32.052255376143336\n"}, {"type": "stdin_stdout", "input": "3\n2\n0 1\n1 0\n0 -1\n-2 0\n4\n1 0\n3 0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKate has a set $S$ of $n$ integers $\\{1, \\dots, n\\} $. \n\nShe thinks that imperfection of a subset $M \\subseteq S$ is equal to the maximum of $gcd(a, b)$ over all pairs $(a, b)$ such that both $a$ and $b$ are in $M$ ...
[{"type": "stdin_stdout", "input": "21031\n", "output": "1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA string is called palindrome if it reads the same from left to right and from right to left. For example \"kazak\", \"oo\", \"r\" and \"mikhailrubinchikkihcniburliahkim\" are palindroms, but strings \"abb\" and \"ij\" ar...
[{"type": "stdin_stdout", "input": "wrwrwfrrfrffrrwwwffffwrfrrwfrrfrwwfwfrwfwfwffwrrwfrrrwwwfrrrwfrrfwrwwrwrrrffffwrrrwrwfffwrffrwwwrwww\n", "output": "fffffffffffffffrrrrrrrrrrrrrrrrrrwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrrrrrrrrrrrrrrrrrrfffffffffffffff\n"}, {"type": "stdin_stdout", "input": "wrwrwfrrfrffrrwwwffffwrfrrw...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou might have heard about our new goodie distribution program aka the \"Laddu Accrual System\". This problem is designed to give you a glimpse of its rules. You can read the page once before attempting the problem if you...
[{"type": "stdin_stdout", "input": "2\n4 INDIAN\nCONTEST_WON 1\nTOP_CONTRIBUTOR\nBUG_FOUND 100\nCONTEST_HOSTED\n4 NON_INDIAN\nCONTEST_WON 1\nTOP_CONTRIBUTOR\nBUG_FOUND 100\nCONTEST_HOSTED\n", "output": "3\n1\n"}, {"type": "stdin_stdout", "input": "2\n4 INDIAN\nCONTEST_WON 0\nTOP_CONTRIBUTOR\nBUG_FOUND 110\nCONTEST_HOST...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions are constraints on $n$ and $k$.\n\nYou are messaging in one of the popular social networks via your smartphone. Your smartphone can show at most $k$ most recent conversat...
[{"type": "stdin_stdout", "input": "10 4\n2 3 3 1 1 2 1 4 3 3\n", "output": "4\n4 1 3 2\n"}, {"type": "stdin_stdout", "input": "10 4\n2 3 5 1 1 2 1 4 3 3\n", "output": "4\n4 1 5 3\n"}, {"type": "stdin_stdout", "input": "10 4\n2 3 5 2 1 2 1 4 2 3\n", "output": "4\n3 2 4 1\n"}, {"type": "stdin_stdout", "input": "10 4\n2 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAccording to Berland laws it is only allowed to sell alcohol to people not younger than 18 years. Vasya's job is to monitor the law's enforcement. Tonight he entered a bar and saw n people sitting there. For every one of ...
[{"type": "stdin_stdout", "input": "4\n1475\nKXJURNYJHVLVKULJBPRBCZSOTKNTOGKGFKIQDQEMEAFTPNXQTIQWROI\nKTR\nRHVRWGODYWWTYZFLFYKCVUFFRTQDINKNWPKFHZBFWBHWINWJW\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n1475\nKXJURNYJHVLVKULJBPRBCZSOTKNTOGKGFKIQDQEMEAFTPNXQTIQWROI\nRTK\nRHVRWGODYWWTYZFLFYKCVUFFRTQDINKNWPK...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence $a_1, a_2, \\dots, a_n$ consisting of $n$ integers.\n\nYou may perform the following operation on this sequence: choose any element and either increase or decrease it by one.\n\nCalculate the mini...
[{"type": "stdin_stdout", "input": "100 1186\n619 240 80 547 446 128 43 285 725 220 56 690 770 431 777 5 41 549 405 203 2 477 919 481 453 787 680 326 318 241 942 497 504 324 598 925 346 628 851 38 355 493 748 685 901 63 698 676 154 162 313 964 455 617 381 41 479 746 83 253 164 907 950 918 264 307 980 743 257 322 845 41...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem is used an extremely simplified version of HTML table markup. Please use the statement as a formal document and read it carefully.\n\nA string is a bHTML table, if it satisfies the grammar: \n \n \n ...
[{"type": "stdin_stdout", "input": "<table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td></td></tr></table></td></tr></table></td></tr></table></td></tr></table></...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this simple exercise, you will build a program that takes a value, `integer `, and returns a list of its multiples up to another value, `limit `. If `limit` is a multiple of ```integer```, it should be included as well...
[{"input": "4\n27", "output": "[[4, 8, 12, 16, 20, 24]]", "fn_name": "find_multiples"}, {"input": "5\n25", "output": "[[5, 10, 15, 20, 25]]", "fn_name": "find_multiples"}, {"input": "11\n54", "output": "[[11, 22, 33, 44]]", "fn_name": "find_multiples"}, {"input": "1\n2", "output": "[[1, 2]]", "fn_name": "find_multiples...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps:\n\n 1. Find the number that goes k-th in the current sequen...
[{"type": "stdin_stdout", "input": "20 20\n20 1 19 2 18 3 17 4 16 5 15 6 14 7 13 8 12 9 11 10\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "20 10\n1 2 3 4 8 6 7 10 9 10 1 1 1 1 1 1 1 1 1 1\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "20 10\n1 2 3 4 8 6 7 10 9 10 1 1 1 1 0 1 1 1 1 1\n", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMr. A, who will graduate next spring, decided to move when he got a job. The company that finds a job has offices in several towns, and the offices that go to work differ depending on the day. So Mr. A decided to live in ...
[{"type": "stdin_stdout", "input": "6\n0 1 80\n1 3 20\n0 2 60\n2 4 50\n3 2 66\n0 4 165\n2\n0 1 1\n1 2 1\n0", "output": "2 262\n1 2\n"}, {"type": "stdin_stdout", "input": "6\n0 1 80\n1 3 20\n0 2 60\n2 4 50\n3 2 66\n0 4 165\n2\n0 1 1\n0 2 1\n0", "output": "2 262\n0 2\n"}, {"type": "stdin_stdout", "input": "6\n0 1 113\n1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nB: Dansunau www --Dance Now!-\n\nstory\n\nLast lab life! Daigakuin! !! Dosanko Snow has won 9th place in the event \"Master Idol World\", which can be said to be the outpost of the biggest competition \"Lab Life\" where m...
[{"type": "stdin_stdout", "input": "9\n9 8 7 6 9 5 3 2 1\n1 1 1\n3 4 2\n4 3 3\n4 0 4\n5 10 5\n12 9 7\n7 7 7\n8 11 8\n9 11 9", "output": "3\n"}, {"type": "stdin_stdout", "input": "9\n9 8 7 6 9 5 3 2 1\n1 1 1\n3 4 2\n4 3 3\n4 0 4\n5 10 5\n12 9 7\n7 7 7\n8 8 8\n9 11 9", "output": "3\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nFive students, Taro, Jiro, Saburo, Shiro, and Hanako, participated in the JOI High School class.\n\nIn this class, a final exam was conducted. All five people took the final exam. For students with a final exam...
[{"type": "stdin_stdout", "input": "10\n130\n100\n37\n101", "output": "82\n"}, {"type": "stdin_stdout", "input": "10\n130\n100\n65\n101", "output": "87\n"}, {"type": "stdin_stdout", "input": "10\n130\n100\n98\n101", "output": "93\n"}, {"type": "stdin_stdout", "input": "10\n130\n110\n98\n100", "output": "95\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given a and b.\n\nConstraints\n\n* 0 < a, b ≤ 2,000,000,000\n* LCM(a, b) ≤ 2,000,000,000\n* The number of data sets ≤...
[{"type": "stdin_stdout", "input": "34 12\n234598000 42842091", "output": "2 204\n1 10050668864418000\n"}, {"type": "stdin_stdout", "input": "34 12\n234598000 60832539", "output": "2 204\n1 14271191984322000\n"}, {"type": "stdin_stdout", "input": "34 9\n234598000 42842091", "output": "1 306\n1 10050668864418000\n"}, {"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi has a lot of peculiar devices. These cylindrical devices receive balls from left and right. Each device is in one of the two states A and B, and for each state, the device operates as follows:\n\n* When a device...
[{"type": "stdin_stdout", "input": "4 123456789\nAABA", "output": "BABA\n"}, {"type": "stdin_stdout", "input": "4 110986646\nAABB", "output": "BABA\n"}, {"type": "stdin_stdout", "input": "4 123456789\nAAAA", "output": "BABA\n"}, {"type": "stdin_stdout", "input": "4 110986646\nBABA", "output": "BABA\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a programming language in which every program is a non-empty sequence of \"<\" and \">\" signs and digits. Let's explain how the interpreter of this programming language works. A program is interpreted using move...
[{"type": "stdin_stdout", "input": "2 100\n44\n1 2\n2 2\n2 2\n1 2\n1 1\n2 2\n2 2\n1 2\n1 1\n1 1\n1 2\n1 1\n1 2\n1 1\n2 2\n1 1\n1 2\n2 2\n1 2\n1 2\n2 2\n2 2\n1 2\n1 1\n1 1\n1 2\n1 1\n2 2\n1 2\n1 2\n2 2\n1 2\n1 2\n2 2\n1 2\n2 2\n1 1\n1 1\n1 2\n1 2\n2 2\n1 2\n1 1\n1 2\n1 2\n2 2\n1 1\n2 2\n1 2\n1 1\n2 2\n1 1\n1 2\n2 2\n1 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSee the following triangle:\n```\n____________________________________\n 1 \n 2 4 2 \n 3 6 9 6 3 \n 4 8 12 16 12 8 ...
[{"input": "50", "output": "[[1625625, 1235000, 390625]]", "fn_name": "mult_triangle"}, {"input": "10", "output": "[[3025, 2400, 625]]", "fn_name": "mult_triangle"}, {"input": "5", "output": "[[225, 144, 81]]", "fn_name": "mult_triangle"}, {"input": "4", "output": "[[100, 84, 16]]", "fn_name": "mult_triangle"}, {"input...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nStep through my `green glass door`.\n\nYou can take the `moon`, but not the `sun`.\n\nYou can take your `slippers`, but not your `sandals`.\n\nYou can go through `yelling`, but not `shouting`.\n\nYou can't run through `fa...
[{"input": "\"airplane\"", "output": "[false]", "fn_name": "step_through_with"}, {"input": "\"aardvark\"", "output": "[true]", "fn_name": "step_through_with"}, {"input": "\"glasses\"", "output": "[true]", "fn_name": "step_through_with"}, {"input": "\"branch\"", "output": "[false]", "fn_name": "step_through_with"}, {"in...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\n10^{10^{10}} participants, including Takahashi, competed in two programming contests.\nIn each contest, all participants had distinct ranks from first through 10^{10^{10}}-th.\nThe score of a participant is the product of...
[{"type": "stdin_stdout", "input": "99\n207579013 207579013\n376140463 376140463\n186969586 186969586\n326402540 326402540\n158176573 158176573\n127860890 127860890\n570870045 570870045\n178509023 178509023\n61263305 61263305\n558212775 558212775\n26389630 26389630\n496148000 496148000\n837151741 837151741\n656585276 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter you had helped Fedor to find friends in the «Call of Soldiers 3» game, he stopped studying completely. Today, the English teacher told him to prepare an essay. Fedor didn't want to prepare the essay, so he asked Ale...
[{"type": "stdin_stdout", "input": "2\nABBABAABBAABABBABAABABBAABBABAABBAABABBAABBABAABABBABAABBAABABBA ABBABAABBAABABBABAABABBAABBABAABBAABABBAABBABAABABBABAABBAABABA\n2\nABBABAABBAABABBABAABABBAABBABAAABAABABBAABBABAABABBABAABBAABABA neuzaiheshi\nABBABAABBAABABBABAABABBAABBABAABBAABABBAABBABAABABBABAABBAABABBA ABBABA...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGerald has been selling state secrets at leisure. All the secrets cost the same: n marks. The state which secrets Gerald is selling, has no paper money, only coins. But there are coins of all positive integer denomination...
[{"type": "stdin_stdout", "input": "243\n", "output": " 1\n"}, {"type": "stdin_stdout", "input": "108\n", "output": " 2\n"}, {"type": "stdin_stdout", "input": "81\n", "output": " ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nN of us are going on a trip, by train or taxi.\nThe train will cost each of us A yen (the currency of Japan).\nThe taxi will cost us a total of B yen.\nHow much is our minimum total travel expense?\n\n-----Constraints----...
[{"type": "stdin_stdout", "input": "12 -13 -107", "output": "-156\n"}, {"type": "stdin_stdout", "input": "-1719 1 -2", "output": "-1719\n"}, {"type": "stdin_stdout", "input": "10 -2 -141", "output": "-141\n"}, {"type": "stdin_stdout", "input": "10 -2 -162", "output": "-162\n"}, {"type": "stdin_stdout", "input": "10 -7 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPari wants to buy an expensive chocolate from Arya. She has n coins, the value of the i-th coin is c_{i}. The price of the chocolate is k, so Pari will take a subset of her coins with sum equal to k and give it to Arya.\n...
[{"type": "stdin_stdout", "input": "9 436\n1 2 4 8 14 32 27 128 256\n", "output": "160\n0 1 2 3 4 6 8 9 10 11 14 15 16 17 18 20 22 23 24 25 27 28 29 30 32 34 35 36 37 38 41 42 43 44 46 48 49 50 51 52 128 129 130 131 132 134 136 137 138 139 142 143 144 145 146 148 150 151 152 153 155 156 157 158 160 162 163 164 165 166 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads three integers a, b and c, and prints \"Yes\" if a < b < c, otherwise \"No\".\n\nConstraints\n\n* 0 ≤ a, b, c ≤ 100\n\nInput\n\nThree integers a, b and c separated by a single space are given i...
[{"type": "stdin_stdout", "input": "-1 -1 -1", "output": "No\n"}, {"type": "stdin_stdout", "input": "-1 -1 -2", "output": "No\n"}, {"type": "stdin_stdout", "input": "18 10 10", "output": "No\n"}, {"type": "stdin_stdout", "input": "-1 0 2", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-1 -1 2", "output": "No\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA population of bears consists of black bears, brown bears, and white bears.\n\nThe input is an array of two elements. \n\nDetermine whether the offspring of the two bears will return `'black'`, `'brown'`, `'white'`, `'da...
[{"input": "[\"white\", \"brown\"]", "output": "[\"light brown\"]", "fn_name": "bear_fur"}, {"input": "[\"black\", \"brown\"]", "output": "[\"dark brown\"]", "fn_name": "bear_fur"}, {"input": "[\"pink\", \"black\"]", "output": "[\"unknown\"]", "fn_name": "bear_fur"}, {"input": "[\"black\", \"black\"]", "output": "[\"bl...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nClock shows 'h' hours, 'm' minutes and 's' seconds after midnight.\n\nYour task is to make 'Past' function which returns time converted to milliseconds.\n\n## Example:\n\n```python\npast(0, 1, 1) == 61000\n```\n\nInput co...
[{"input": "1\n1\n1", "output": "[3661000]", "fn_name": "past"}, {"input": "1\n0\n1", "output": "[3601000]", "fn_name": "past"}, {"input": "1\n0\n0", "output": "[3600000]", "fn_name": "past"}, {"input": "0\n1\n1", "output": "[61000]", "fn_name": "past"}, {"input": "0\n0\n0", "output": "[0]", "fn_name": "past"}]
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a permutation of n numbers p1, p2, ..., pn. We perform k operations of the following type: choose uniformly at random two indices l and r (l ≤ r) and reverse the order of the elements pl, pl + 1, ..., pr. Yo...
[{"type": "stdin_stdout", "input": "30 153\n18 5 24 7 12 6 25 14 21 20 27 4 30 8 23 19 11 13 17 1 29 28 15 22 16 9 2 10 26 3\n", "output": "217.500536909325035\n"}, {"type": "stdin_stdout", "input": "30 136\n1 29 20 25 15 2 3 16 24 30 17 14 7 10 11 22 6 8 23 18 12 5 19 9 26 21 28 13 27 4\n", "output": "217.499666343987...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDante is engaged in a fight with \"The Savior\". Before he can fight it with his sword, he needs to break its shields. He has two guns, Ebony and Ivory, each of them is able to perform any non-negative number of shots.\n\...
[{"type": "stdin_stdout", "input": "63 100 1960\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "73 100 3111\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "26 100 5582\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "128 81 3880\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nArithmetic Progressions\n\nAn arithmetic progression is a sequence of numbers $a_1, a_2, ..., a_k$ where the difference of consecutive members $a_{i+1} - a_i$ is a constant ($1 \\leq i \\leq k-1$). For example, the sequen...
[{"type": "stdin_stdout", "input": "6\n-2 11 12 30 3 0", "output": "2\n"}, {"type": "stdin_stdout", "input": "6\n-4 1 6 2 13 -1", "output": "3\n"}, {"type": "stdin_stdout", "input": "6\n-2 1 -1 8 13 9", "output": "2\n"}, {"type": "stdin_stdout", "input": "6\n-2 11 5 20 8 0", "output": "3\n"}, {"type": "stdin_stdout", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherw...
[{"type": "stdin_stdout", "input": "1 -2 -2", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "0 -2 -2", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "5 7 5\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "3 3 4\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "6 1 6\n", "output": "Yes...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are playing a strange game with Li Chen. You have a tree with n nodes drawn on a piece of paper. All nodes are unlabeled and distinguishable. Each of you independently labeled the vertices from 1 to n. Neither of you ...
[{"type": "stdin_stdout", "input": "2\n6\n5 3 2 4 1 6\n1 2\n1 3\n1 4\n4 5\n4 6\n4\n1 3 4 5\n3\n3 5 2\n6\n5 3 2 4 1 6\n1 2\n1 3\n1 4\n4 5\n4 6\n3\n1 2 3\n3\n4 1 6\n", "output": "B 4\nA 4\nC -1\nB 2\nC 1\n"}, {"type": "stdin_stdout", "input": "2\n6\n5 3 2 8 1 6\n1 2\n1 3\n1 4\n4 5\n4 6\n4\n1 3 4 5\n3\n3 5 2\n6\n5 3 2 4 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIvan unexpectedly saw a present from one of his previous birthdays. It is array of $n$ numbers from $1$ to $200$. Array is old and some numbers are hard to read. Ivan remembers that for all elements at least one of its ne...
[{"type": "stdin_stdout", "input": "37\n52 52 66 149 149 130 47 47 26 110 185 -1 73 73 65 -1 -1 130 -1 -1 -1 94 97 190 -1 -1 49 49 54 -1 92 92 5 25 48 79 79\n", "output": "903952722\n"}, {"type": "stdin_stdout", "input": "37\n52 52 66 149 149 130 47 47 26 110 185 -1 73 73 65 -1 -1 130 -1 -1 -1 94 97 190 -1 -1 49 49 54 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGeneral primality test are often computationally expensive, so in the biggest prime number race the idea is to study special sub-families of prime number and develop more effective tests for them. \n\n[Mersenne Primes](ht...
[{"input": "11215", "output": "[false]", "fn_name": "lucas_lehmer"}, {"input": "11213", "output": "[true]", "fn_name": "lucas_lehmer"}, {"input": "101", "output": "[false]", "fn_name": "lucas_lehmer"}, {"input": "10", "output": "[false]", "fn_name": "lucas_lehmer"}, {"input": "33", "output": "[false]", "fn_name": "luca...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nKarafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. [Image] \n\nEach Karafs has a positive ...
[{"type": "stdin_stdout", "input": "447 74474 4\n47 777474 1358\n74 744744 74477\n477 477447 777\n7 477777 444444\n", "output": "-1\n-1\n-1\n7\n"}, {"type": "stdin_stdout", "input": "447 74474 4\n47 777474 747\n74 744744 74477\n477 477447 777\n7 477777 444444\n", "output": "-1\n-1\n-1\n7\n"}, {"type": "stdin_stdout", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAnu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ v...
[{"type": "stdin_stdout", "input": "100\n8650752 65536 131072 134217728 2112 8 0 0 0 0 0 1 0 0 268435456 1024 0 18890756 0 0 0 135364608 6291464 0 0 0 0 0 32 0 16384 0 0 0 0 33554560 256 0 16 0 0 536870912 536870912 0 0 128 0 0 4096 2048 0 0 0 0 268435456 64 1 0 0 262144 524288 0 11769 0 0 0 2 2 512 131072 0 0 67108864...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour task is to determine the top 3 place finishes in a pole vault competition involving several different competitors. This is isn't always so simple, and it is often a source of confusion for people who don't know the a...
[{"input": "[{\"name\": \"Anna\", \"results\": [\"XO\", \"O\", \"XO\", \"XO\"]}, {\"name\": \"Allison\", \"results\": [\"XO\", \"O\", \"XXO\", \"XXX\"]}, {\"name\": \"Olivia\", \"results\": [\"O\", \"XO\", \"XXO\", \"XXX\"]}, {\"name\": \"Rhiana\", \"results\": [\"XO\", \"O\", \"XO\", \"XO\"]}, {\"name\": \"Zola\", \"r...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day, Niwango-kun, an employee of Dwango Co., Ltd., found an integer sequence (a_1, ..., a_N) of length N. He is interested in properties of the sequence a.\n\nFor a nonempty contiguous subsequence a_l, ..., a_r (1 \\l...
[{"type": "stdin_stdout", "input": "8 2\n13 0 11 2 14 4 11 8", "output": "55\n"}, {"type": "stdin_stdout", "input": "8 4\n10 2 18 7 21 1 10 1", "output": "58\n"}, {"type": "stdin_stdout", "input": "8 4\n10 2 28 7 23 0 10 3", "output": "70\n"}, {"type": "stdin_stdout", "input": "8 2\n18 0 28 5 17 1 16 1", "output": "84\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nZonk is addictive dice game. In each round player rolls 6 dice. Then (s)he composes combinations from them. Each combination gives certain points. \n\nThen player can take one or more dice combinations to his hand and re-...
[{"input": "[1, 1, 1, 1, 1, 1]", "output": "[4000]", "fn_name": "get_score"}, {"input": "[3, 3, 3, 3, 3, 3]", "output": "[1200]", "fn_name": "get_score"}, {"input": "[4, 4, 4, 4, 4, 4]", "output": "[1600]", "fn_name": "get_score"}, {"input": "[5, 5, 5, 5, 5, 5]", "output": "[2000]", "fn_name": "get_score"}, {"input": "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nKing of Berland Berl IV has recently died. Hail Berl V! As a sign of the highest achievements of the deceased king the new king decided to build a mausoleum with Berl IV's body on the main square of the capital.\n\nThe ma...
[{"type": "stdin_stdout", "input": "30 50\n17 >= 29\n19 <= 18\n3 > 50\n54 >= 56\n47 < 15\n50 <= 33\n49 < 8\n57 <= 16\n30 > 35\n49 < 21\n3 >= 37\n56 <= 51\n46 > 51\n35 >= 48\n32 < 15\n12 <= 4\n38 > 57\n55 < 9\n49 <= 1\n9 >= 38\n60 = 60\n1 > 12\n40 >= 43\n13 > 38\n24 >= 39\n9 < 2\n12 > 58\n15 >= 30\n13 > 50\n42 <= 16\n23...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProfessor Matsuzaki is a scientist studying the truth of the universe. Life, the universe, all the answers are said to be 42, but Professor Matsuzaki thinks that this alone is not enough to elucidate the truth of the univ...
[{"type": "stdin_stdout", "input": "0 55\n0 1\n0 2\n0 3\n10 1\n10 2\n10 3\n10 4\n10 5\n10 6\n11 1\n11 2\n11 3\n100001 100\n-1 -1", "output": "42\n4\n5\n6\n22\n24\n26\n28\n30\n30\n26\n30\n32\n200274\n"}, {"type": "stdin_stdout", "input": "0 55\n0 1\n0 2\n0 3\n10 1\n10 2\n10 3\n10 4\n10 5\n10 1\n11 1\n11 2\n11 3\n100001 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the Bus of Characters there are $n$ rows of seat, each having $2$ seats. The width of both seats in the $i$-th row is $w_i$ centimeters. All integers $w_i$ are distinct.\n\nInitially the bus is empty. On each of $2n$ s...
[{"type": "stdin_stdout", "input": "10\n24 53 10 128 141 9 15 62 32 47\n00100000000111111111\n", "output": "6 3 3 7 1 9 10 2 8 4 5 5 4 8 2 10 9 1 7 6\n"}, {"type": "stdin_stdout", "input": "10\n24 53 10 128 141 9 15 97 32 47\n00100000000111111111\n", "output": "6 3 3 7 1 9 10 2 8 4 5 5 4 8 2 10 9 1 7 6\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i.\nVertex i has an integer a_i written on it.\nFor every integer k from 1 through N, solve the following problem:\n - We will make a sequen...
[{"type": "stdin_stdout", "input": "10\n1 2 4 2 11 1 7 11 0 4\n1 3\n2 3\n3 4\n7 5\n2 6\n6 7\n1 8\n2 9\n2 10", "output": "1\n2\n2\n2\n4\n2\n3\n2\n2\n3\n"}, {"type": "stdin_stdout", "input": "10\n1 2 4 0 12 1 7 11 0 4\n1 5\n2 3\n3 4\n7 5\n2 6\n6 7\n1 8\n2 9\n2 10", "output": "1\n2\n3\n3\n2\n2\n2\n2\n2\n3\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a string of letters 'a' and 'b'. We want to perform some operations on it. On each step we choose one of substrings \"ab\" in the string and replace it with the string \"bba\". If we have no \"ab\" as a substring,...
[{"type": "stdin_stdout", "input": "abaaaaaabaaaabbabbaaabbbbabababaaaaabbaabbaaaaabbbaababaaaaaaabbbbbaaaaabaababbabababbabbbbabbbaabbabbbabaabbaabbaaaaaab\n", "output": "502032780\n"}, {"type": "stdin_stdout", "input": "abaaaaaabaaaabbabbaaabbababababaaaaabbaabbaaaaabbbaababaaaaaaabbbbbaaaaabbababbabababbabbbbabbbaab...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L.\nShe will concatenate all of the strings in some order, to produce a long string.\nAmong all strings that she can produce in this way, ...
[{"type": "stdin_stdout", "input": "3 3\ndxx\naxx\ncxx\n", "output": "axxcxxdxx\n"}, {"type": "stdin_stdout", "input": "3 3\ndxx\naxx\ndxx", "output": "axxdxxdxx\n"}, {"type": "stdin_stdout", "input": "3 3\ndxx\naxx\nxxd", "output": "axxdxxxxd\n"}, {"type": "stdin_stdout", "input": "3 3\ndxx\nxxa\nxxd", "output": "dxxx...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSuppose there is a $h \\times w$ grid consisting of empty or full cells. Let's make some definitions:\n\n $r_{i}$ is the number of consecutive full cells connected to the left side in the $i$-th row ($1 \\le i \\le h$). ...
[{"type": "stdin_stdout", "input": "19 16\n16 16 16 16 15 15 0 5 0 4 9 9 1 4 4 0 8 16 12\n6 12 19 15 8 6 19 19 14 6 12 16 10 11 15 4\n", "output": "974740338\n"}, {"type": "stdin_stdout", "input": "19 16\n16 16 16 16 15 15 0 5 0 4 9 9 1 4 4 0 8 16 12\n6 12 19 15 8 6 19 19 14 6 9 16 10 11 15 4\n", "output": "797922655\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets....
[{"type": "stdin_stdout", "input": "3\n14\n11\n14\n2\n58\n0", "output": "Case 1: 3\nCase 2: 14\nCase 3: 11\nCase 4: 14\nCase 5: 2\nCase 6: 58\n"}, {"type": "stdin_stdout", "input": "3\n5\n11\n14\n26\n34\n0", "output": "Case 1: 3\nCase 2: 5\nCase 3: 11\nCase 4: 14\nCase 5: 26\nCase 6: 34\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAll of the animals are having a feast! Each animal is bringing one dish. There is just one rule: the dish must start and end with the same letters as the animal's name. For example, the great blue heron is bringing garlic...
[{"input": "\"great blue heron\"\n\"garlic naan\"", "output": "[true]", "fn_name": "feast"}, {"input": "\"blue-footed booby\"\n\"blueberry\"", "output": "[true]", "fn_name": "feast"}, {"input": "\"chickadee\"\n\"chocolate cake\"", "output": "[true]", "fn_name": "feast"}, {"input": "\"brown bear\"\n\"bear claw\"", "outp...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\n<image> <image>\n\n*The two images are equivalent, feel free to use either one.\n\nInput\n\nThe input contains a single integer a (-100 ≤ a ≤ 100).\n\nOutput\n\nOutput the result – an integer number.\n\nExample\n\nInput\n...
[{"type": "stdin_stdout", "input": "-1079\n", "output": "-1164239\n"}, {"type": "stdin_stdout", "input": "-340\n", "output": "-115598\n"}, {"type": "stdin_stdout", "input": "-449\n", "output": "-201599\n"}, {"type": "stdin_stdout", "input": "-685\n", "output": "-469223\n"}, {"type": "stdin_stdout", "input": "-432\n", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are S sheep and W wolves.\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\n-----Cons...
[{"type": "stdin_stdout", "input": "100 100\n", "output": "unsafe\n"}, {"type": "stdin_stdout", "input": "10 10\n", "output": "unsafe\n"}, {"type": "stdin_stdout", "input": "99 99\n", "output": "unsafe\n"}, {"type": "stdin_stdout", "input": "74 74\n", "output": "unsafe\n"}, {"type": "stdin_stdout", "input": "63 64\n", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe pair of integer numbers `(m, n)`, such that `10 > m > n > 0`, (below 10), that its sum, `(m + n)`, and rest, `(m - n)`, are perfect squares, is (5, 4).\n\nLet's see what we have explained with numbers.\n```\n5 + 4 = ...
[{"input": "150", "output": "[[149, 140]]", "fn_name": "closest_pair_tonum"}, {"input": "200", "output": "[[197, 28]]", "fn_name": "closest_pair_tonum"}, {"input": "100", "output": "[[97, 72]]", "fn_name": "closest_pair_tonum"}, {"input": "30", "output": "[[29, 20]]", "fn_name": "closest_pair_tonum"}, {"input": "50", "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi had a pair of two positive integers not exceeding N, (a,b), which he has forgotten. He remembers that the remainder of a divided by b was greater than or equal to K. Find the number of possible pairs that he may...
[{"type": "stdin_stdout", "input": "38823 9265", "output": "550080294\n"}, {"type": "stdin_stdout", "input": "11695 7143", "output": "10362628\n"}, {"type": "stdin_stdout", "input": "31415 9265", "output": "287927211"}, {"type": "stdin_stdout", "input": "11695 9265", "output": "2953665\n"}, {"type": "stdin_stdout", "in...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFood contains three nutrients called \"protein\", \"fat\" and \"carbohydrate\", which are called three major nutrients. It is calculated that protein and carbohydrate are 4 kcal (kilocalories) and fat is 9 kcal per 1 g (g...
[{"type": "stdin_stdout", "input": "4\n1 7 14 47\n2 5 35 55\n3 6 3 59\n4 6 5 15\n10 15 50 110\n2\n1 8 10 116\n-1 4 18 33\n10 10 50 300\n0", "output": "NA\nNA\n"}, {"type": "stdin_stdout", "input": "4\n1 7 14 47\n2 5 35 55\n3 6 3 59\n4 6 5 15\n10 15 50 110\n2\n1 8 10 116\n0 4 18 33\n10 10 50 300\n0", "output": "NA\nNA\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nI'm traveling to a country with a rabbit. There are n cities in this country numbered from 1 to n, and the rabbit is now in city 1. City i is a point on the coordinate plane (xi, yi) ).\n\nRabbits travel to meet the follo...
[{"type": "stdin_stdout", "input": "5\n101.13623414746552 91.04161232454778\n1 -1\n1 10\n0 3\n19 -1\n20 7", "output": "9\n"}, {"type": "stdin_stdout", "input": "5\n100.60853142327974 90.65666260699702\n1 0\n1 10\n8 3\n10 -1\n12 10", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\n100.60853142327974 90.656662606...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNumbers of black and white points are placed on a plane. Let's imagine that a straight line of infinite length is drawn on the plane. When the line does not meet any of the points, the line divides these points into two g...
[{"type": "stdin_stdout", "input": "3 3\n100 700\n200 200\n600 600\n500 100\n605 300\n800 578\n3 3\n100 300\n400 600\n400 100\n600 400\n500 900\n300 300\n3 4\n300 300\n935 300\n400 600\n100 100\n200 900\n500 900\n158 110\n1 2\n300 300\n100 100\n500 500\n1 1\n100 100\n200 100\n2 2\n0 0\n500 700\n1000 1400\n1500 2100\n2 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one ...
[{"type": "stdin_stdout", "input": "bbw\nbww\n+b+\nbwb\nwbx\nwbw\n0", "output": "NA\nNA\n"}, {"type": "stdin_stdout", "input": "caw\nwbw\n+b+\nbwb\nwxb\nwbw\n0", "output": "NA\nNA\n"}, {"type": "stdin_stdout", "input": "bbw\nbww\n+b+\nbwb\nwbx\nwbv\n0", "output": "NA\nNA\n"}, {"type": "stdin_stdout", "input": "cbw\nbww...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes.\n\nThe exam consists of $n$ problems that can be solved in $T$ minutes...
[{"type": "stdin_stdout", "input": "10\n3 5 1 3\n0 0 1\n2 1 4\n2 5 2 3\n1 0\n3 2\n1 20 2 4\n0\n16\n6 20 2 5\n1 1 0 1 0 0\n0 8 2 9 11 6\n4 12 3 6\n1 0 1 1\n8 3 5 6\n6 20 3 12\n0 1 0 0 1 0\n20 11 3 20 16 17\n7 17 1 6\n1 1 0 1 0 0 0\n1 8 0 11 15 15 10\n6 17 2 6\n0 0 1 0 0 1\n7 11 2 7 10 12\n5 17 2 5\n1 1 1 1 0\n17 11 10 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya is reading a e-book. The file of the book consists of $n$ pages, numbered from $1$ to $n$. The screen is currently displaying the contents of page $x$, and Vasya wants to read the page $y$. There are two buttons on ...
[{"type": "stdin_stdout", "input": "5\n20 10 2 9\n1000000000 2 89 4\n1000000000 2 89 8\n1000000000 142 1 1000000000\n1000000000 1000000000 4 3\n", "output": "4\n23\n12\n1\n333333332\n"}, {"type": "stdin_stdout", "input": "5\n20 10 2 9\n1000000000 2 89 4\n1000000000 2 89 5\n1000000000 142 1 1000000000\n1000000000 100000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \n\nChef loves to prepare delicious dishes. This time, Chef has decided to prepare a special dish for you, and needs to gather several apples to do so.\n\nChef ha...
[{"type": "stdin_stdout", "input": "2\n3\n3 14 3\n4\n1 2 3 3", "output": "2\n3\n"}, {"type": "stdin_stdout", "input": "2\n3\n1 14 3\n4\n1 2 3 3", "output": "3\n3\n"}, {"type": "stdin_stdout", "input": "2\n2\n3 3 1\n4\n1 12 3 3", "output": "2\n3\n"}, {"type": "stdin_stdout", "input": "2\n3\n6 14 3\n4\n1 2 3 3", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is constraints.\n\nThere are $n$ kids, each of them is reading a unique book. At the end of any day, the $i$-th kid will give his book to the $p_i$-th kid (in case of $i ...
[{"type": "stdin_stdout", "input": "20\n10\n3 8 1 4 9 6 10 2 7 5\n10\n10 4 8 6 5 3 1 2 9 7\n1\n1\n2\n2 1\n10\n2 5 3 6 9 7 4 10 8 1\n10\n1 7 4 6 9 10 8 2 3 5\n8\n3 8 1 7 6 4 2 5\n8\n7 4 5 2 8 1 6 3\n5\n1 2 4 3 5\n6\n4 2 5 6 3 1\n5\n5 3 2 4 1\n5\n4 3 5 1 2\n7\n6 5 1 7 4 2 3\n6\n6 2 4 1 5 3\n3\n3 1 2\n4\n1 3 4 2\n3\n3 1 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe define $x \\bmod y$ as the remainder of division of $x$ by $y$ ($\\%$ operator in C++ or Java, mod operator in Pascal).\n\nLet's call an array of positive integers $[a_1, a_2, \\dots, a_k]$ stable if for every permutat...
[{"type": "stdin_stdout", "input": "500000 250000\n", "output": "803991687\n"}, {"type": "stdin_stdout", "input": "500000 250000\n", "output": "803991687\n"}, {"type": "stdin_stdout", "input": "500000 471528\n", "output": "588862109\n"}, {"type": "stdin_stdout", "input": "500000 121854\n", "output": "377057930\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n boys and m girls attending a theatre club. To set a play \"The Big Bang Theory\", they need to choose a group containing exactly t actors containing no less than 4 boys and no less than one girl. How many ways...
[{"type": "stdin_stdout", "input": "30 30 30\n", "output": "118264581548187697"}, {"type": "stdin_stdout", "input": "30 29 19\n", "output": "1396982287132530\n"}, {"type": "stdin_stdout", "input": "30 30 19\n", "output": "2044156982307300\n"}, {"type": "stdin_stdout", "input": "30 29 42\n", "output": "277508869722315\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a special offer in Vasya's favourite supermarket: if the customer buys $a$ chocolate bars, he or she may take $b$ additional bars for free. This special offer can be used any number of times.\n\nVasya currently h...
[{"type": "stdin_stdout", "input": "16\n1 1 1 1\n1 1 1 1000000000\n1 1 1000000000 1\n1 1 1000000000 1000000000\n1 1000000000 1 1\n1 1000000000 1 1000000000\n1 1000000000 1000000000 1\n1 1000000000 1000000000 1000000000\n1000000000 1 1 1\n1000000000 1 1 1000000000\n1000000000 1 1000000000 1\n1000000000 1 1000000000 1000...
code_stdio