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\nLet's define the cost of a string s as the number of index pairs i and j (1 ≤ i < j < |s|) such that s_i = s_j and s_{i+1} = s_{j+1}.\n\nYou are given two positive integers n and k. Among all strings with length n that co...
[{"type": "stdin_stdout", "input": "97849 7\n", "output": "aabacadaeafagbbcbdbebfbgccdcecfcgddedfdgeefegffggaabacadaeafagbbcbdbebfbgccdcecfcgddedfdgeefegffggaabacadaeafagbbcbdbebfbgccdcecfcgddedfdgeefegffggaabacadaeafagbbcbdbebfbgccdcecfcgddedfdgeefegffggaabacadaeafagbbcbdbebfbgccdcecfcgddedfdgeefegffggaabacadaeafagbbc...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMarina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.\n\nMore formally, you are given two strings s_1,...
[{"type": "stdin_stdout", "input": "100 85\njknccpmanwhxqnxivdgguahjcuyhdrazmbfwoptatlgytakxsfvdzzcsglhmswfxafxyregdbeiwpawrjgwcqrkbhmrfcscgoszf\nhknccpmanwhxjnxivdggeahjcuyhdrazmbfwoqtatlgytdkxsfvdztcsglhmssfxsfxyrngdbeiwpawrjgwcqrkbhmrfcsckoskf\n", "output": "aaaaaaabaaaaaaaaaaaaabaaaaaaaabaaaaaaaabaaaaabaaaaaaaaaaaa...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt's a Pokemon battle! Your task is to calculate the damage that a particular move would do using the following formula (not the actual one from the game):\n\nWhere:\n\n* attack = your attack power\n* defense = the oppone...
[{"input": "\"electric\"\n\"fire\"\n100\n100", "output": "[50]", "fn_name": "calculate_damage"}, {"input": "\"grass\"\n\"electric\"\n57\n19", "output": "[150]", "fn_name": "calculate_damage"}, {"input": "\"grass\"\n\"water\"\n100\n100", "output": "[100]", "fn_name": "calculate_damage"}, {"input": "\"fire\"\n\"electric\...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIgor the analyst fell asleep on the work and had a strange dream. In the dream his desk was crowded with computer mice, so he bought a mousetrap to catch them.\n\nThe desk can be considered as an infinite plane, then the ...
[{"type": "stdin_stdout", "input": "4\n17501 63318 51967 74514\n1305 84026 135736 -78504\n41159 81000 -44104 -42722\n31063 65435 25578 33487\n18330 79949 83467 -74531\n", "output": "0.15181873510135294\n"}, {"type": "stdin_stdout", "input": "4\n17501 63318 51967 74514\n1305 84026 135736 -78504\n41159 81000 -44104 -4272...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHeidi has finally found the mythical Tree of Life – a legendary combinatorial structure which is said to contain a prophecy crucially needed to defeat the undead armies.\n\nOn the surface, the Tree of Life is just a regul...
[{"type": "stdin_stdout", "input": "10\n5 1\n1 2\n9 1\n10 8\n6 3\n8 5\n2 7\n2 3\n10 4\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "10\n5 1\n1 2\n9 5\n10 5\n6 3\n8 10\n2 7\n2 3\n1 4\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "10\n5 1\n1 2\n9 5\n10 5\n6 3\n8 10\n2 7\n1 3\n1 4\n", "output": "12\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA popular reality show is recruiting a new cast for the third season! $n$ candidates numbered from $1$ to $n$ have been interviewed. The candidate $i$ has aggressiveness level $l_i$, and recruiting this candidate will cos...
[{"type": "stdin_stdout", "input": "34 5\n2 2 5 4 3 1 3 5 3 1 3 1 3 5 5 2 1 3 3 3 1 1 1 4 5 1 3 2 5 5 2 1 2 2\n1357 797 4642 4072 3953 4020 207 344 1412 4061 400 214 708 389 567 3294 1336 3746 1513 3539 4220 4720 329 4516 1741 1744 2537 3963 4941 664 1169 4512 3358 4144\n-4668 -1085 109 -899 769 -1132 -2587 1503 760 -2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp plays a computer game (yet again). In this game, he fights monsters using magic spells.\n\nThere are two types of spells: fire spell of power $x$ deals $x$ damage to the monster, and lightning spell of power $y$ ...
[{"type": "stdin_stdout", "input": "6\n1 5\n0 10\n1 -5\n1 14\n1 11\n0 -10\n", "output": "5\n25\n10\n34\n59\n39\n"}, {"type": "stdin_stdout", "input": "6\n1 5\n0 10\n1 -5\n0 14\n1 11\n0 -10\n", "output": "5\n25\n10\n24\n49\n39\n"}, {"type": "stdin_stdout", "input": "6\n1 5\n0 10\n1 -5\n1 14\n1 16\n0 -10\n", "output": "5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's call an array good if there is an element in the array that equals to the sum of all other elements. For example, the array $a=[1, 3, 3, 7]$ is good because there is the element $a_4=7$ which equals to the sum $1 + ...
[{"type": "stdin_stdout", "input": "4\n500000 500000 1000000 1000000\n", "output": "2\n3 4 \n"}, {"type": "stdin_stdout", "input": "4\n500000 500000 1000000 1000000\n", "output": "2\n3 4\n"}, {"type": "stdin_stdout", "input": "4\n500000 251993 1000000 1000000\n", "output": "0\n\n"}, {"type": "stdin_stdout", "input": "6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Aizuwakamatsu Village, which is located far north of Aizuwakamatsu City, a bridge called \"Yabashi\" is the only way to move to the surrounding villages. Despite the large number of passers-by, the bridge is so old tha...
[{"type": "stdin_stdout", "input": "3\n125 -1 15\n108 12 25\n149 10 50\n3\n32 -1 10\n70 10 41\n22 67 84\n0", "output": "NG\nOK\n"}, {"type": "stdin_stdout", "input": "3\n125 -1 15\n108 8 25\n246 10 42\n3\n32 -1 10\n70 10 41\n22 67 129\n0", "output": "NG\nOK\n"}, {"type": "stdin_stdout", "input": "3\n125 -1 15\n108 7 25...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nValera loves to participate in competitions. Especially in programming contests. Today he has participated in the contest with his team, consisting of n students (including Valera). This contest was an individual competit...
[{"type": "stdin_stdout", "input": "1000 1000 1 1000 1000000 1000000\n", "output": "1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAssume we take a number `x` and perform any one of the following operations:\n```Pearl\na) Divide x by 3 (if it is divisible by 3), or\nb) Multiply x by 2\n```\nAfter each operation, we write down the result. If we start ...
[{"input": "[558, 744, 1488, 279, 2232, 1116]", "output": "[[279, 558, 1116, 2232, 744, 1488]]", "fn_name": "solve"}, {"input": "[12, 3, 9, 4, 6, 8]", "output": "[[9, 3, 6, 12, 4, 8]]", "fn_name": "solve"}, {"input": "[4, 8, 6, 3, 12, 9]", "output": "[[9, 3, 6, 12, 4, 8]]", "fn_name": "solve"}, {"input": "[3000, 9000]"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it mean...
[{"type": "stdin_stdout", "input": "RRS\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "SSS\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "RSR\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "SRS\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "SSR\n", "output": "1\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVova again tries to play some computer card game.\n\nThe rules of deck creation in this game are simple. Vova is given an existing deck of n cards and a magic number k. The order of the cards in the deck is fixed. Each ca...
[{"type": "stdin_stdout", "input": "100 72\n8 8 7 9 6 1 4 5 3 7 5 10 5 4 1 3 4 1 3 1 6 6 4 5 4 5 6 1 10 7 9 1 6 10 6 6 9 3 3 4 5 9 4 9 8 1 5 9 3 7 1 8 5 2 1 1 7 7 7 6 6 4 2 9 10 2 8 3 1 1 4 8 5 9 7 10 9 4 2 3 7 7 6 7 8 5 1 3 8 5 1 8 9 10 3 7 1 8 10 5\n", "output": "4549\n"}, {"type": "stdin_stdout", "input": "100 72\n8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn a circle lie $2n$ distinct points, with the following property: however you choose $3$ chords that connect $3$ disjoint pairs of points, no point strictly inside the circle belongs to all $3$ chords. The points are num...
[{"type": "stdin_stdout", "input": "4\n6 2\n8 2\n1 4\n1 1\n2 1\n2 0\n10 2\n14 12\n4 20\n9 10\n13 18\n30 18\n11 7\n", "output": "12\n0\n1\n32\n"}, {"type": "stdin_stdout", "input": "4\n5 2\n8 2\n1 4\n1 1\n2 1\n2 0\n15 1\n13 12\n4 20\n9 10\n13 18\n30 18\n13 12\n", "output": "7\n0\n1\n91\n"}, {"type": "stdin_stdout", "inp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a square matrix n × n, consisting of non-negative integer numbers. You should find such a way on it that \n\n * starts in the upper left cell of the matrix; \n * each following cell is to the right or down from...
[{"type": "stdin_stdout", "input": "10\n10 8 6 5 9 8 2 5 3 2\n3 1 8 10 8 10 5 10 7 8\n5 9 7 7 4 9 7 2 5 2\n5 9 9 5 4 2 6 6 8 1\n10 6 9 9 10 5 6 3 5 9\n6 7 10 3 1 4 3 6 7 6\n10 10 4 7 4 4 8 2 7 4\n10 5 8 2 2 7 4 4 1 4\n8 4 6 10 10 6 1 3 3 1\n9 9 7 2 11 5 1 8 6 3\n", "output": "1\nDRDDDRRDDDRRDRDRRR\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.\n\nStrictly speaking, it makes a photo of a...
[{"type": "stdin_stdout", "input": "2\n282238675 111160538 526707498 169652181\n", "output": "14299383119546189\n"}, {"type": "stdin_stdout", "input": "2\n229872385 40870434 715428884 160550871\n", "output": "46761413035493300\n"}, {"type": "stdin_stdout", "input": "2\n186213023 111160538 526707498 169652181\n", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn fact, the problems E1 and E2 do not have much in common. You should probably think of them as two separate problems.\n\nYou are given an integer array $a[1 \\ldots n] = [a_1, a_2, \\ldots, a_n]$.\n\nLet us consider an ...
[{"type": "stdin_stdout", "input": "6\n4\n2 11 8 -1\n3\n10 2 1\n3\n3 10 2\n4\n1 2 1 -1\n4\n4 0 1 6\n5\n1 5 1 -1 0\n", "output": "1\n0\n0\n0\n1\n1\n"}, {"type": "stdin_stdout", "input": "6\n4\n2 11 8 -1\n3\n10 2 1\n3\n5 10 2\n4\n1 2 1 -1\n4\n1 0 1 6\n5\n1 5 1 -1 0\n", "output": "1\n0\n0\n0\n0\n1\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet’s try a dice puzzle. The rules of this puzzle are as follows.\n\n1. Dice with six faces as shown in Figure 1 are used in the puzzle.\n\n<image>\n\nFigure 1: Faces of a die\n\n2. With twenty seven such dice, a 3 × 3 × ...
[{"type": "stdin_stdout", "input": "4\n0 0 1\n0 1 0\n0 2 2\n0 2 2\n1 2 2\n6 -1 0\n0 7 4\n0 4 1\n4 1 0\n6 1 0\n12 -1 0\n4 1 -2\n1 -1 0\n1 2 0\n0 -1 -1\n5 1 2\n10 0 2\n-2 1 -2\n3 -1 -1\n-1 6 -2\n0 0 -1\n0 1 0\n-2 1 0\n3 0 0", "output": "0\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "4\n0 0 1\n0 1 0\n0 2 2\n0 2 2\n1 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nImplement a function to calculate the sum of the numerical values in a nested list. For example :\n\n```python\nsum_nested([1, [2, [3, [4]]]]) -> 10\n```\n\nWrite your solution by modifying this code:\n\n```python\ndef su...
[{"input": "[[[[], [], [[[[[[[[[[]]]]]]]]]]], [], [], [[[], [[]]]]], []]", "output": "[0]", "fn_name": "sum_nested"}, {"input": "[1, [1], [1, [1]], [1, [1], [1, [1]]]]", "output": "[8]", "fn_name": "sum_nested"}, {"input": "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]", "output": "[55]", "fn_name": "sum_nested"}, {"input": "[1, ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider the numbers `6969` and `9116`. When you rotate them `180 degrees` (upside down), these numbers remain the same. To clarify, if we write them down on a paper and turn the paper upside down, the numbers will be the...
[{"input": "60000\n130000", "output": "[55]", "fn_name": "solve"}, {"input": "60000\n70000", "output": "[15]", "fn_name": "solve"}, {"input": "1000\n10000", "output": "[20]", "fn_name": "solve"}, {"input": "10000\n15000", "output": "[6]", "fn_name": "solve"}, {"input": "15000\n20000", "output": "[9]", "fn_name": "solve...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp has spent the entire day preparing problems for you. Now he has to sleep for at least $a$ minutes to feel refreshed.\n\nPolycarp can only wake up by hearing the sound of his alarm. So he has just fallen asleep an...
[{"type": "stdin_stdout", "input": "7\n10 3 6 4\n11 3 6 4\n5 9 4 10\n6 5 2 3\n1 1 1 1\n3947465 47342 338129 123123\n234123843 13 361451236 361451000\n", "output": "27\n27\n9\n-1\n1\n6471793\n358578060125049\n"}, {"type": "stdin_stdout", "input": "7\n10 3 6 4\n11 3 6 0\n5 9 4 10\n6 5 2 3\n1 1 1 1\n3947465 47342 338129 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Finite Encyclopedia of Integer Sequences (FEIS), all integer sequences of lengths between 1 and N (inclusive) consisting of integers between 1 and K (inclusive) are listed.\nLet the total number of sequences listed in ...
[{"type": "stdin_stdout", "input": "0 39", "output": "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"}, {"type": "stdin_stdout", "input": "0 28", "output": "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"}, {"type": "stdin_stdout", "input": "13 27", "output": "7 7 7 7 7 7 7 7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWilliam has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $c_1, c_2, \\dots, c_n$ where $c_i$ is the number of consecutive brackets \"(\" if...
[{"type": "stdin_stdout", "input": "50\n980145241 167620437 937571657 683888733 687342940 596264451 470954757 312707590 782743417 441517678 539214535 498906886 521201165 581866343 987986939 770597138 136540061 812371324 567649512 704604401 873600670 364129557 600605741 459396557 173915633 607977424 480952533 834953681 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA recently found Ancient Prophesy is believed to contain the exact Apocalypse date. The prophesy is a string that only consists of digits and characters \"-\".\n\nWe'll say that some date is mentioned in the Prophesy if t...
[{"type": "stdin_stdout", "input": "12-12-201312-12-201312-12-201313--12-201313--12-201313--12-201313--12-201313--12-201313--12-201313--12-201313--12-2013\n", "output": "12-12-2013\n"}, {"type": "stdin_stdout", "input": "12-12-211312-12-201312-12-201313--12-201313--02-201313--12-201313--12-201313--12-201313--12-201313-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn some game by Playrix it takes t minutes for an oven to bake k carrot cakes, all cakes are ready at the same moment t minutes after they started baking. Arkady needs at least n cakes to complete a task, but he currently...
[{"type": "stdin_stdout", "input": "1000 1000 1000 1000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1000 1000 1000 1000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1000 1000 1001 1000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1000 1000 1 1000\n", "output": "YES\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi and Aoki are playing a stone-taking game. Initially, there are N piles of stones, and the i-th pile contains A_i stones and has an associated integer K_i.\nStarting from Takahashi, Takahashi and Aoki take altern...
[{"type": "stdin_stdout", "input": "200\n48018902 1000000000\n671608134 1000000000\n821230959 1000000000\n839046240 1000000000\n871451860 1000000000\n201326387 1000000000\n95653264 1000000000\n118998199 1000000000\n661381768 1000000000\n265950246 1000000000\n443323091 1000000000\n621558889 1000000000\n486583499 1000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJohn Doe has an n × m table. John Doe can paint points in some table cells, not more than one point in one table cell. John Doe wants to use such operations to make each square subtable of size n × n have exactly k points...
[{"type": "stdin_stdout", "input": "100 1000000000000000000 10000\n", "output": " 1\n"}, {"type": "stdin_stdout", "input": "1 1000000000000000000 0\n", "output": " 1\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe research center Q has developed a new multi-core processor. The processor consists of n cores and has k cells of cache memory. Consider the work of this processor.\n\nAt each cycle each core of the processor gets one ...
[{"type": "stdin_stdout", "input": "100 1 100\n59\n37\n53\n72\n37\n15\n8\n93\n92\n74\n11\n11\n68\n16\n92\n40\n76\n20\n10\n86\n76\n5\n9\n95\n5\n81\n44\n57\n10\n24\n22\n2\n57\n6\n26\n67\n48\n95\n34\n97\n55\n33\n70\n66\n51\n70\n74\n65\n35\n85\n37\n9\n27\n43\n65\n6\n5\n57\n54\n27\n22\n41\n8\n29\n10\n50\n9\n68\n78\n9\n92\n3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese, Russian and Vietnamese as well. \nLittle Egor likes to play with positive integers and their divisors. Bigger the number to play with, more the fun! The boy asked you to come ...
[{"type": "stdin_stdout", "input": "2\n1 18\n76 209", "output": "139\n15682\n"}, {"type": "stdin_stdout", "input": "2\n1 16\n76 209", "output": "108\n15682\n"}, {"type": "stdin_stdout", "input": "2\n1 7\n114 127", "output": "25\n1447\n"}, {"type": "stdin_stdout", "input": "2\n1 7\n76 209", "output": "25\n15682\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S of length N consisting of A, B and C, and an integer K which is between 1 and N (inclusive).\nPrint the string S after lowercasing the K-th character in it.\n\n-----Constraints-----\n - 1 ≤ N ≤ 50...
[{"type": "stdin_stdout", "input": "50 27\nACBCABCCCAACACCBBBACCBCBBBCCBAAAABAACACAAACCACCCCA\n", "output": "ACBCABCCCAACACCBBBACCBCBBBcCBAAAABAACACAAACCACCCCA\n"}, {"type": "stdin_stdout", "input": "50 50\nCABABCBBCBABCAACBCBBAAAACBCBCBBABBABBBCCBAACCAACAB\n", "output": "CABABCBBCBABCAACBCBBAAAACBCBCBBABBABBBCCBAACCAA...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen you want to get the square of a binomial of two variables x and y, you will have:\n\n`$(x+y)^2 = x^2 + 2xy + y ^2$`\n\nAnd the cube:\n\n`$(x+y)^3 = x^3 + 3x^2y + 3xy^2 +y^3$`\n\nIt is known from many centuries ago th...
[{"input": "10", "output": "[[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2047]]", "fn_name": "f"}, {"input": "6", "output": "[[1, 2, 4, 8, 16, 32, 64, 127]]", "fn_name": "f"}, {"input": "3", "output": "[[1, 2, 4, 8, 15]]", "fn_name": "f"}, {"input": "2", "output": "[[1, 2, 4, 7]]", "fn_name": "f"}, {"input": "1", "ou...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nIn the area where Kazakhstan is now located, there used to be a trade route called the \"Silk Road\".\n\nThere are N + 1 cities on the Silk Road, numbered from west as city 0, city 1, ..., city N. The distance ...
[{"type": "stdin_stdout", "input": "3 5\n10\n25\n15\n50\n30\n15\n12\n30", "output": "855\n"}, {"type": "stdin_stdout", "input": "3 5\n10\n38\n18\n50\n30\n6\n40\n30", "output": "1068\n"}, {"type": "stdin_stdout", "input": "3 5\n10\n38\n18\n50\n30\n6\n40\n34", "output": "1140\n"}, {"type": "stdin_stdout", "input": "3 5\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere was a big bank robbery in Tablecity. In order to catch the thief, the President called none other than Albert – Tablecity’s Chief of Police. Albert does not know where the thief is located, but he does know how he m...
[{"type": "stdin_stdout", "input": "\u0412 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u043d\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430.\nThis problem doesn't have sample inout and output.", "output": "2000\n1 1 1 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $n$ streets along the Eastern direction and $m$ streets across the Southern direction. Naturally, this city has $n...
[{"type": "stdin_stdout", "input": "1 100\n855 316 601 28 311 798 783 276 504 1230 521 358 377 467 623 767 481 645 855 608 157 95 273 261 110 713 948 897 872 476 855 337 147 377 648 441 215 1231 505 69 858 99 877 187 237 115 824 98 955 192 773 99 538 385 861 849 772 993 470 249 582 635 986 515 84 7 476 831 903 74 79 54...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNote that the memory limit is unusual.\n\nYou are given an integer n and two sequences a_1, a_2, ..., a_n and b_1, b_2, ..., b_n.\n\nLet's call a set of integers S such that S ⊆ \\{1, 2, 3, ..., n\\} strange, if, for ever...
[{"type": "stdin_stdout", "input": "20\n27 6 6 60 47 97 62 25 67 28 41 93 65 32 16 56 57 53 66 61\n84392 -11227 -93200 -52089 4854 -99982 -81560 95957 -35579 -91088 31023 -68447 -41338 -27132 43558 23876 35055 -36267 77633 -94930\n", "output": "294839\n"}, {"type": "stdin_stdout", "input": "20\n27 6 6 60 47 97 62 25 67...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a colored permutation $p_1, p_2, \\dots, p_n$. The $i$-th element of the permutation has color $c_i$.\n\nLet's define an infinite path as infinite sequence $i, p[i], p[p[i]], p[p[p[i]]] \\dots$ where all ele...
[{"type": "stdin_stdout", "input": "3\n4\n1 3 4 2\n1 1 2 3\n5\n2 3 4 5 1\n1 2 5 10 3\n8\n7 4 5 6 1 8 3 2\n5 3 4 4 12 5 8 9\n", "output": "1\n5\n4\n"}, {"type": "stdin_stdout", "input": "3\n4\n1 3 4 2\n1 2 2 3\n5\n2 3 4 5 1\n1 2 10 4 5\n8\n7 4 5 6 1 8 3 2\n5 3 6 4 7 5 8 4\n", "output": "1\n5\n2\n"}, {"type": "stdin_stdo...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIchihime is the current priestess of the Mahjong Soul Temple. She claims to be human, despite her cat ears.\n\nThese days the temple is holding a math contest. Usually, Ichihime lacks interest in these things, but this ti...
[{"type": "stdin_stdout", "input": "14\n2374453 2374454 8591131 23094546\n5813291 5813292 9709163 35032815\n4280399 23049698 23049701 34728360\n15184184 18688462 22400847 22400849\n24397371 31462070 33936330 33936331\n21376685 28241116 38909200 38909202\n29491847 31628480 31628482 45225214\n15144763 15414479 36902879 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJAG mock qualifying practice session\n\nThe ACM-ICPC OB / OG Association (Japanese Alumni Group; JAG) has N questions in stock of questions to be asked in the mock contest, and each question is numbered with an integer fr...
[{"type": "stdin_stdout", "input": "5 3\n1 1\n2 3\n3 2\n3 17\n2 1\n4 2\n1 7\n2 1\n1 3\n2 5\n6 1\n1 3\n1 2\n1 8\n1 2\n1 7\n1 6\n20 9\n4 10\n2 6\n8 3\n1 6\n6 3\n7 4\n8 10\n4 12\n7 5\n1 8\n5 7\n1 5\n4 6\n9 9\n5 8\n6 7\n1 4\n6 4\n7 10\n3 5\n19 6\n4 2\n6 5\n5 10\n1 10\n3 10\n3 6\n2 3\n1 4\n2 10\n1 8\n3 4\n3 1\n5 4\n1 10\n1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCreate a function that takes any sentence and redistributes the spaces (and adds additional spaces if needed) so that each word starts with a vowel. The letters should all be in the same order but every vowel in the sente...
[{"input": "\"oranges, apples, melon, pineapple\"", "output": "[\"or ang es appl esm el onp in e appl e\"]", "fn_name": "vowel_start"}, {"input": "\"It is beautiful weather today!\"", "output": "[\"it isb e a ut if ulw e ath ert od ay\"]", "fn_name": "vowel_start"}, {"input": "\"my number is 0208-533-2325\"", "output":...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya wants to turn on Christmas lights consisting of m bulbs. Initially, all bulbs are turned off. There are n buttons, each of them is connected to some set of bulbs. Vasya can press any of these buttons. When the butto...
[{"type": "stdin_stdout", "input": "1 100\n100 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBerkomnadzor — Federal Service for Supervision of Communications, Information Technology and Mass Media — is a Berland federal executive body that protects ordinary residents of Berland from the threats of modern internet...
[{"type": "stdin_stdout", "input": "35\n-0.0.0.47\n+0.0.0.39/32\n+0.0.0.23\n+0.0.0.6/31\n-0.0.0.2\n+0.0.0.8/32\n+0.0.0.54/32\n-0.0.0.43\n-0.0.0.31/32\n-0.0.0.0\n+0.0.0.26/32\n-0.0.0.42\n+0.0.0.52\n-0.0.0.10/31\n+0.0.0.53\n+0.0.0.28/32\n-0.0.0.19/32\n-0.0.0.12\n-0.0.0.16/31\n-0.0.0.35/32\n+0.0.0.51\n+0.0.0.24/31\n-0.0.0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRingo is giving a present to Snuke.\n\nRingo has found out that Snuke loves yakiniku (a Japanese term meaning grilled meat. yaki: grilled, niku: meat). He supposes that Snuke likes grilled things starting with `YAKI` in J...
[{"type": "stdin_stdout", "input": "UKINIKAY", "output": "No\n"}, {"type": "stdin_stdout", "input": "UAKOYAKI", "output": "No\n"}, {"type": "stdin_stdout", "input": "NKIUIKAY", "output": "No\n"}, {"type": "stdin_stdout", "input": "IKAYOKAU", "output": "No\n"}, {"type": "stdin_stdout", "input": "NKIUAKIY", "output": "No...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads two integers x and y, and prints them in ascending order.\n\nConstraints\n\n* 0 ≤ x, y ≤ 10000\n* the number of datasets ≤ 3000\n\nInput\n\nThe input consists of multiple datasets. Each dataset...
[{"type": "stdin_stdout", "input": "3 0\n-1 2\n15 3\n0 0", "output": "0 3\n-1 2\n3 15\n"}, {"type": "stdin_stdout", "input": "3 -1\n0 2\n27 3\n0 0", "output": "-1 3\n0 2\n3 27\n"}, {"type": "stdin_stdout", "input": "4 -1\n0 2\n27 3\n0 0", "output": "-1 4\n0 2\n3 27\n"}, {"type": "stdin_stdout", "input": "4 -1\n0 2\n18 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday, Yasser and Adel are at the shop buying cupcakes. There are $n$ cupcake types, arranged from $1$ to $n$ on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of type $i$ is an integer ...
[{"type": "stdin_stdout", "input": "12\n3\n7 -4 5\n3\n7 -5 4\n3\n4 -5 7\n3\n5 -4 7\n4\n5 -5 -6 6\n5\n100 100 100 -50 50\n10\n11 5 -12 7 -10 20 30 -10 50 60\n10\n10 5 -14 7 -7 20 30 -50 50 60\n2\n1 1\n2\n-1 -1\n3\n1000000000 1010000000 1000000000\n3\n-1000000000 -1000000000 -1000000000\n", "output": "YES\nNO\nNO\nYES\nN...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGildong was hiking a mountain, walking by millions of trees. Inspired by them, he suddenly came up with an interesting idea for trees in data structures: What if we add another edge in a tree?\n\nThen he found that such t...
[{"type": "stdin_stdout", "input": "14\n4 9\n3 7\n4 1\n3 2\n14 9\n7 6\n10 13\n8 7\n5 7\n7 10\n1 3\n12 3\n7 11\n20\n13 6 14 9 1\n6 4 3 7 9\n9 3 6 13 7\n6 11 11 5 9\n14 5 2 3 4\n13 12 4 2 7\n13 14 7 3 2\n9 5 13 13 6\n8 9 7 3 7\n14 10 11 12 7\n6 12 13 1 1\n8 13 8 10 8\n1 5 13 10 7\n1 4 13 2 6\n1 5 6 4 10\n6 9 11 8 5\n9 7 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nImagine a city with n horizontal streets crossing m vertical streets, forming an (n - 1) × (m - 1) grid. In order to increase the traffic flow, mayor of the city has decided to make each street one way. This means in each...
[{"type": "stdin_stdout", "input": "20 20\n><<><<<<<<<>>><>>><<\n^^^^^^^^vvvv^vv^vvvv\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "20 20\n<>>>>>>>><>>><>><<<>\nvv^^vv^^^^v^vv^v^^^^\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "20 20\n>>><<<<<>>><><><<><<\n^^^vvv^^^v^^v^^v^vvv\n", "output": "Y...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l.\n\nYou are given N numbers X_1, X_2, ..., X_N, where N is an even number. For each i =...
[{"type": "stdin_stdout", "input": "6\n5 -1 -1 -1 13 -1", "output": "-1\n-1\n-1\n-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "6\n5 -1 -1 -1 13 0", "output": "-1\n0\n0\n0\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "6\n5 -2 -1 0 15 -2", "output": "-1\n0\n0\n-1\n-1\n0\n"}, {"type": "stdin_stdout", "input": "6\n5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAn NBA game runs 48 minutes (Four 12 minute quarters). Players do not typically play the full game, subbing in and out as necessary. Your job is to extrapolate a player's points per game if they played the full 48 minutes...
[{"input": "16\n27", "output": "[28.4]", "fn_name": "nba_extrap"}, {"input": "11\n19", "output": "[27.8]", "fn_name": "nba_extrap"}, {"input": "14\n33", "output": "[20.4]", "fn_name": "nba_extrap"}, {"input": "1\n7.5", "output": "[6.4]", "fn_name": "nba_extrap"}, {"input": "6\n13", "output": "[22.2]", "fn_name": "nba_e...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nChildan is making up a legendary story and trying to sell his forgery — a necklace with a strong sense of \"Wu\" to the Kasouras. But Mr. Kasoura is challenging the truth of Childan's story. So he is going to ask a few qu...
[{"type": "stdin_stdout", "input": "12 1 1\n0 1 2 3 2 5 6 11 0 10 10 17\n001010001000\n001010001000 100\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "12 1 1\n0 1 2 3 2 6 6 11 0 10 10 17\n001010001000\n001010001000 100\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "12 1 1\n0 1 2 3 2 2 6 11 0 10 10 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's denote that some array $b$ is bad if it contains a subarray $b_l, b_{l+1}, \\dots, b_{r}$ of odd length more than $1$ ($l < r$ and $r - l + 1$ is odd) such that $\\forall i \\in \\{0, 1, \\dots, r - l\\}$ $b_{l + i}...
[{"type": "stdin_stdout", "input": "10 11\n-1 11 -1 -1 -1 -1 10 -1 -1 -1\n", "output": "100000000\n"}, {"type": "stdin_stdout", "input": "10 11\n-1 11 -1 -1 -1 -1 10 -1 -1 -1\n", "output": "100000000\n"}, {"type": "stdin_stdout", "input": "10 17\n-1 11 -1 -1 -1 -1 10 -1 -1 -1\n", "output": "301989884\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the 17th century, Fermat wrote that he proved for any integer $n \\geq 3$, there exist no positive integers $x$, $y$, $z$ such that $x^n + y^n = z^n$. However he never disclosed the proof. Later, this claim was named F...
[{"type": "stdin_stdout", "input": "6\n3\n13\n0", "output": "27\n11\n126\n"}, {"type": "stdin_stdout", "input": "6\n25\n12\n0", "output": "27\n64\n54\n"}, {"type": "stdin_stdout", "input": "6\n6\n15\n0", "output": "27\n27\n119\n"}, {"type": "stdin_stdout", "input": "6\n15\n2\n0", "output": "27\n119\n6\n"}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the 0 key, the 1 key and the backspace key.\nTo begin with, he is using a plain text editor with this keyboard. This e...
[{"type": "stdin_stdout", "input": "01B0\n", "output": "00\n"}, {"type": "stdin_stdout", "input": "B010", "output": "010\n"}, {"type": "stdin_stdout", "input": "B110", "output": "110\n"}, {"type": "stdin_stdout", "input": "B011", "output": "011\n"}, {"type": "stdin_stdout", "input": "B101", "output": "101\n"}, {"type":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicious drink. One day, as you probably know, he found himself in year 2084, and buying kefir there is much more comp...
[{"type": "stdin_stdout", "input": "1000000000000000000\n999999998000000000\n999999999000000000\n999999998000000000\n", "output": " 3\n"}, {"type": "stdin_stdout", "input": "1\n1000000000000000000\n1000000000\n999999999\n", "output": " ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this Kata you are a game developer and have programmed the #1 MMORPG(Massively Multiplayer Online Role Playing Game) worldwide!!! Many suggestions came across you to make the game better, one of which you are intereste...
[{"input": "769832696988485\n170", "output": "[\"You have already reached level 170.\"]", "fn_name": "xp_to_target_lvl"}, {"input": "10396\n11", "output": "[\"You have already reached level 11.\"]", "fn_name": "xp_to_target_lvl"}, {"input": "2017\n4", "output": "[\"You have already reached level 4.\"]", "fn_name": "xp_...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\n## Task\n\nGiven a positive integer `n`, calculate the following sum: \n\n```\nn + n/2 + n/4 + n/8 + ...\n``` \n\nAll elements of the sum are the results of integer division.\n\n## Example\n\n```\n25 => 25 + 12 + 6 + 3 ...
[{"input": "127", "output": "[247]", "fn_name": "halving_sum"}, {"input": "320", "output": "[638]", "fn_name": "halving_sum"}, {"input": "101", "output": "[198]", "fn_name": "halving_sum"}, {"input": "257", "output": "[512]", "fn_name": "halving_sum"}, {"input": "25", "output": "[47]", "fn_name": "halving_sum"}, {"inpu...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable pri...
[{"type": "stdin_stdout", "input": "4 2\n50 40 100 80\n7 3\n400 139 100 700 200 600 500\n0 0", "output": "150\n2000\n"}, {"type": "stdin_stdout", "input": "4 2\n50 40 100 80\n7 3\n400 300 100 700 116 600 500\n0 0", "output": "150\n2100\n"}, {"type": "stdin_stdout", "input": "4 3\n50 40 100 80\n7 3\n400 290 000 1162 352...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo neighboring kingdoms decided to build a wall between them with some gates to enable the citizens to go from one kingdom to another. Each time a citizen passes through a gate, he has to pay one silver coin.\n\nThe worl...
[{"type": "stdin_stdout", "input": "100\nRUURUURRUURUUUUURRUUURRRRUURRURRURRRRUUUUUURRUURRRRURUUURUURURRRRRURUURRUURUURRUUURUUUUUURRUUUURUUUR\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "100\nRUURUURRUURUUUUURRUUURRRRUURRURRURRRRUUUUUURRUURRRRURUUURUURURRRRRURUURRUURUURRUUURUUUUUURRUUUURUUUR\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle boy Gerald studies at school which is quite far from his house. That's why he has to go there by bus every day. The way from home to school is represented by a segment of a straight line; the segment contains exact...
[{"type": "stdin_stdout", "input": "68 74\n51 54\n3 22\n12 24\n3 27\n32 42\n36 55\n60 64\n1 4\n4 23\n11 64\n54 62\n50 56\n21 34\n27 63\n15 54\n28 61\n13 57\n39 53\n12 32\n32 40\n33 67\n55 61\n33 67\n30 37\n15 49\n27 45\n21 41\n8 42\n24 63\n40 48\n28 41\n30 67\n0 4\n7 15\n27 59\n60 62\n25 65\n30 31\n38 67\n24 43\n14 64\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCyael is a teacher at a very famous school in Byteland and she is known by her students for being very polite to them and also to encourage them to get good marks on their tests.\nThen, if they get good marks she will rew...
[{"type": "stdin_stdout", "input": "2\n17 0\n100 1", "output": "0 17\n100 0\n"}, {"type": "stdin_stdout", "input": "2\n17 0\n101 0", "output": "0 17\n0 101\n"}, {"type": "stdin_stdout", "input": "2\n17 0\n101 1", "output": "0 17\n101 0\n"}, {"type": "stdin_stdout", "input": "2\n10 2\n100 3\n", "output": "5 0\n33 1\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven a string made up of letters a, b, and/or c, switch the position of letters a and b (change a to b and vice versa). Leave any incidence of c untouched.\n\nExample:\n\n'acb' --> 'bca'\n'aabacbaa' --> 'bbabcabb'\n\nWri...
[{"input": "\"abababababababab\"", "output": "[\"babababababababa\"]", "fn_name": "switcheroo"}, {"input": "\"aaabcccbaaa\"", "output": "[\"bbbacccabbb\"]", "fn_name": "switcheroo"}, {"input": "\"ccccc\"", "output": "[\"ccccc\"]", "fn_name": "switcheroo"}, {"input": "\"aaaaa\"", "output": "[\"bbbbb\"]", "fn_name": "swi...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's define a good tree:It is a tree with k * n nodes labeled from 0 to k * n - 1\nNode i and node j are not adjacent, for all 0 ≤ i, j < k * n such that i div k = j div k (here div means integer division. E.g. 7 div 2 ...
[{"type": "stdin_stdout", "input": "11 11", "output": "459104785\n"}, {"type": "stdin_stdout", "input": "11 14", "output": "737454094\n"}, {"type": "stdin_stdout", "input": "11 28", "output": "685943622\n"}, {"type": "stdin_stdout", "input": "4 10", "output": "994788518\n"}, {"type": "stdin_stdout", "input": "6 10", "o...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Task\n Given a sorted array of integers `A`, find such an integer x that the value of `abs(A[0] - x) + abs(A[1] - x) + ... + abs(A[A.length - 1] - x)`\nis the smallest possible (here abs denotes the `absolute value`).\n...
[{"input": "[-10, -10, -10, -10, -10, -9, -9, -9, -8, -8, -7, -6, -5, -4, -3, -2, -1, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]", "output": "[15]", "fn_name": ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAt the first holiday in spring, the town Shortriver traditionally conducts a flower festival. Townsfolk wear traditional wreaths during these festivals. Each wreath contains exactly $k$ flowers.\n\nThe work material for t...
[{"type": "stdin_stdout", "input": "100 15 6 10\n6 9 1 7 6 4 1 9 3 2 4 6 2 5 3 10 9 2 9 1 6 5 6 2 3 10 7 10 7 4 5 4 4 4 4 7 1 10 8 4 8 3 10 10 7 4 4 10 6 1 8 5 4 6 2 3 10 3 2 5 7 5 6 10 10 3 4 5 4 3 3 1 7 8 10 10 10 10 8 3 7 4 2 1 8 6 5 6 5 8 7 9 2 1 5 2 4 6 10 8\n6 9 7 8 7 1 4 3 5 8\n", "output": "2\n76 77 \n"}, {"typ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour task is to sort a given string. Each word in the string will contain a single number. This number is the position the word should have in the result.\n\nNote: Numbers can be from 1 to 9. So 1 will be the first word (...
[{"input": "\"d4o dru7nken sh2all w5ith s8ailor wha1t 3we a6\"", "output": "[\"wha1t sh2all 3we d4o w5ith a6 dru7nken s8ailor\"]", "fn_name": "order"}, {"input": "\"4of Fo1r pe6ople g3ood th5e the2\"", "output": "[\"Fo1r the2 g3ood 4of th5e pe6ople\"]", "fn_name": "order"}, {"input": "\"is2 Thi1s T4est 3a\"", "output":...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string s (that is, a consecutive part of s).\nFind the greatest length of the string Snuke can construct. Here, th...
[{"type": "stdin_stdout", "input": "HASFJGHOGAKZZFEGA\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "HASFJGHOGAK[ZFEGA", "output": "12\n"}, {"type": "stdin_stdout", "input": "IBAG[IHNGFKKZSFGB", "output": "11\n"}, {"type": "stdin_stdout", "input": "AIEFZGKAFOFGJZSAH", "output": "14\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a positive even number N.\n\nFind the number of strings s of length N consisting of `A`, `B`, and `C` that satisfy the following condition:\n\n* s can be converted to the empty string by repeating the following o...
[{"type": "stdin_stdout", "input": "1100000", "output": "298228697\n"}, {"type": "stdin_stdout", "input": "0110000", "output": "784164463\n"}, {"type": "stdin_stdout", "input": "0110010", "output": "189920713\n"}, {"type": "stdin_stdout", "input": "1100010", "output": "865187132\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA number is self-descriptive when the n'th digit describes the amount n appears in the number.\n\nE.g. 21200:\n\nThere are two 0's in the number, so the first digit is 2.\n\nThere is one 1 in the number, so the second dig...
[{"input": "6210001000", "output": "[true]", "fn_name": "self_descriptive"}, {"input": "51120111", "output": "[false]", "fn_name": "self_descriptive"}, {"input": "42101000", "output": "[true]", "fn_name": "self_descriptive"}, {"input": "3211000", "output": "[true]", "fn_name": "self_descriptive"}, {"input": "21230", "o...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis version of the problem differs from the next one only in the constraint on n.\n\nNote that the memory limit in this problem is lower than in others.\n\nYou have a vertical strip with n cells, numbered consecutively f...
[{"type": "stdin_stdout", "input": "162685 187160003\n", "output": "175888140\n"}, {"type": "stdin_stdout", "input": "200000 316925344\n", "output": "253547906\n"}, {"type": "stdin_stdout", "input": "140750 887458748\n", "output": "669831877\n"}, {"type": "stdin_stdout", "input": "197426 364348492\n", "output": "289708...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLimak and Radewoosh are going to compete against each other in the upcoming algorithmic contest. They are equally skilled but they won't solve problems in the same order.\n\nThere will be n problems. The i-th problem has ...
[{"type": "stdin_stdout", "input": "50 1\n6 17 44 82 94 127 134 156 187 211 212 252 256 292 294 303 352 355 379 380 398 409 424 434 480 524 584 594 631 714 745 756 777 778 789 793 799 821 841 849 859 878 879 895 925 932 944 952 958 990\n15 16 40 42 45 71 143 100 117 120 174 181 186 318 221 268 289 332 376 394 403 409 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Background\n\nMy pet bridge-maker ants are marching across a terrain from left to right.\n\nIf they encounter a gap, the first one stops and then next one climbs over him, then the next, and the next, until a bridge is ...
[{"input": "\"JIHGFEDCBA\"\n\"--........------.-........-........---....-----\"", "output": "[\"GFEDCBAJIH\"]", "fn_name": "ant_bridge"}, {"input": "\"JIHGFEDCBA\"\n\"-.....------........-.......-.......----\"", "output": "[\"CBAJIHGFED\"]", "fn_name": "ant_bridge"}, {"input": "\"JIHGFEDCBA\"\n\"-------.......-.......-...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is an N-car train.\nYou are given an integer i. Find the value of j such that the following statement is true: \"the i-th car from the front of the train is the j-th car from the back.\"\n\n-----Constraints-----\n -...
[{"type": "stdin_stdout", "input": "-108 -1", "output": "-106\n"}, {"type": "stdin_stdout", "input": "-108 71", "output": "-178\n"}, {"type": "stdin_stdout", "input": "-159 71", "output": "-229\n"}, {"type": "stdin_stdout", "input": "-116 71", "output": "-186\n"}, {"type": "stdin_stdout", "input": "-74 36", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs you know, majority of students and teachers of Summer Informatics School live in Berland for the most part of the year. Since corruption there is quite widespread, the following story is not uncommon.\n\nElections are ...
[{"type": "stdin_stdout", "input": "10 10\n7 29\n10 31\n9 40\n5 17\n5 30\n6 85\n2 53\n7 23\n4 57\n10 9\n", "output": "49\n"}, {"type": "stdin_stdout", "input": "10 10\n5 81\n7 68\n7 48\n1 10\n5 37\n7 97\n8 54\n7 41\n7 56\n5 21\n", "output": "110\n"}, {"type": "stdin_stdout", "input": "10 10\n5 81\n7 68\n7 48\n1 10\n5 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA triangular number is the number of dots in an equilateral triangle uniformly filled with dots. For example, three dots can be arranged in a triangle; thus three is a triangular number. The n-th triangular number is the ...
[{"type": "stdin_stdout", "input": "300\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "406\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "253\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "276\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "496\n", "output": "YES\n"}, {"ty...
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\nPetr, Nikita G. and Nikita are the most influential music critics in Saint-Petersburg. They have recently downloaded their favorite band's new album an...
[{"type": "stdin_stdout", "input": "3\n6\n6\n6", "output": "14.7\n14.7\n14.7\n"}, {"type": "stdin_stdout", "input": "3\n1\n6\n6", "output": "1.0\n14.7\n14.7\n"}, {"type": "stdin_stdout", "input": "3\n2\n6\n6", "output": "3.0\n14.7\n14.7\n"}, {"type": "stdin_stdout", "input": "3\n6\n1\n6", "output": "14.7\n1.0\n14.7\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDevu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. \n\nAs Devu is...
[{"type": "stdin_stdout", "input": "10 10\n23 101 38 38 73 54 59 69 44 150\n100 100 100 100 100 100 100 100 100 100\n", "output": "402\n"}, {"type": "stdin_stdout", "input": "10 10\n23 101 38 38 73 54 59 69 44 150\n100 100 100 100 100 100 100 101 100 100\n", "output": "403\n"}, {"type": "stdin_stdout", "input": "10 10\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVK news recommendation system daily selects interesting publications of one of $n$ disjoint categories for each user. Each publication belongs to exactly one category. For each category $i$ batch algorithm selects $a_i$ p...
[{"type": "stdin_stdout", "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 2 4 4 12 5 4 11 8 1 2 8 11 19 18 4\n52258 5648 46847 9200 63940 79328 118413 54479 1788 60107 8234 64215 15419 84411 50307 78075 92548 17867 43456 7970 1390 99373 97297 90662 82950 678 79356 51351 2794 82477 16508 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ra...
[{"type": "stdin_stdout", "input": "1s 2s 3s\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "9m 9m 9m\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "3p 9m 2p\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "8p 2s 9m\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "5s 8m 5s\n", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou're given an array $a$ of length $n$. You can perform the following operation on it as many times as you want: Pick two integers $i$ and $j$ $(1 \\le i,j \\le n)$ such that $a_i+a_j$ is odd, then swap $a_i$ and $a_j$....
[{"type": "stdin_stdout", "input": "36\n398353608 662365068 456456182 594572278 958026500 524977116 903404403 382220192 142092809 137516115 522872496 527845939 116437661 423289717 907151540 961740613 981968938 143206666 773454188 691188206 95402302 602570397 986508327 617421132 46091276 866348540 485487643 843511039 76...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n children in Jzzhu's school. Jzzhu is going to give some candies to them. Let's number all the children from 1 to n. The i-th child wants to get at least a_{i} candies.\n\nJzzhu asks children to line up. Initia...
[{"type": "stdin_stdout", "input": "100 20\n21 19 61 70 54 97 98 14 61 72 25 94 24 56 55 25 12 80 76 11 35 17 80 26 11 94 52 47 84 61 10 2 74 25 10 21 2 79 55 50 30 75 10 64 44 5 60 96 52 16 74 41 20 77 20 44 8 86 74 36 49 61 99 13 54 64 19 99 50 43 12 73 48 48 83 55 72 73 63 81 30 27 95 9 97 82 24 3 89 90 33 14 47 88 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCreate a function that transforms any positive number to a string representing the number in words. The function should work for all numbers between 0 and 999999.\n\n### Examples\n\n```\nnumber2words(0) ==> \"zero\"\nn...
[{"input": "888887", "output": "[\"eight hundred eighty-eight thousand eight hundred eighty-seven\"]", "fn_name": "number2words"}, {"input": "99997", "output": "[\"ninety-nine thousand nine hundred ninety-seven\"]", "fn_name": "number2words"}, {"input": "7217", "output": "[\"seven thousand two hundred seventeen\"]", "f...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya follows a basketball game and marks the distances from which each team makes a throw. He knows that each successful throw has value of either 2 or 3 points. A throw is worth 2 points if the distance it was made from...
[{"type": "stdin_stdout", "input": "18\n450 3726 12063 42865 29689 35320 33937 4067 45951 80313 53004 59541 75551 75836 151186 81297 93876 96211\n47\n3393 11375 6494 7645 9549 8499 11145 13121 14801 15578 24104 24125 25871 31280 35036 38969 29966 41342 42708 46033 47491 25404 49152 51905 55002 9827 56565 57901 104645 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAdilbek was assigned to a special project. For Adilbek it means that he has $n$ days to run a special program and provide its results. But there is a problem: the program needs to run for $d$ days to calculate the results...
[{"type": "stdin_stdout", "input": "50\n1000000000 1000000000\n999999999 1000000000\n999999998 1000000000\n999999997 1000000000\n999999996 1000000000\n999999995 1000000000\n999999994 1000000000\n999999900 1000000000\n1 11\n2 11\n3 11\n4 11\n5 11\n6 11\n7 11\n8 11\n9 11\n10 11\n11 11\n4 18\n4 20\n3 19\n3 18\n3 167\n3 15...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S of length n with each character being one of the first m lowercase English letters. \n\nCalculate how many different strings T of length n composed from the first m lowercase English letters exist...
[{"type": "stdin_stdout", "input": "100 26\njysrixyptvsesnapfljeqkytlpeepjopspmkviqdqbdkylvfiawhdjjdvqqvcjmmsgfdmpjwahuwhgsyfcgnefzmqlvtvqqfbfsf\n", "output": "237400\n"}, {"type": "stdin_stdout", "input": "100 26\njysrixyptvsesnapfljeqkytlpeepjopspmkviqdqbdkylvfiawhdjjdvqqvcjmmsgfdmpjwahuwhgsyfcgnefzmqlvtvqqfbfsf\n", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of p...
[{"type": "stdin_stdout", "input": "xlmw mw xli tmgxyvi xlex m xsso mr ilx xvmt.", "output": "this is the picture that i took in eht trip.\n"}, {"type": "stdin_stdout", "input": "xlmw mw xli tmgxyvi xlex m ossx mr ilx xvmt.", "output": "this is the picture that i koot in eht trip.\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day, early in the morning, you decided to buy yourself a bag of chips in the nearby store. The store has chips of $n$ different flavors. A bag of the $i$-th flavor costs $a_i$ burles.\n\nThe store may run out of some ...
[{"type": "stdin_stdout", "input": "4\n1\n1337\n3\n31 7 1\n5\n0 2 2 6 10\n3\n9 143 1515\n", "output": "446\n11\n4\n506\n"}, {"type": "stdin_stdout", "input": "4\n1\n1337\n3\n10 2 1\n5\n2 2 3 4 5\n3\n10 115 1546\n", "output": "446\n5\n3\n516\n"}, {"type": "stdin_stdout", "input": "4\n1\n1337\n3\n31 7 1\n5\n0 2 2 6 10\n3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ of length $2n$. Consider a partition of array $a$ into two subsequences $p$ and $q$ of length $n$ each (each element of array $a$ should be in exactly one subsequence: either in $p$ or in $q$).\...
[{"type": "stdin_stdout", "input": "16\n998244362 998244362 1545401713 998244362 998244362 998244362 998244362 998244362 1483557929 998244362 998244362 356870606 998244362 998244362 998244362 998244362 998244363 998244363 998244363 998244363 998244363 998244363 998244363 998244363 998244363 998244363 998244363 99824436...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasiliy lives at point (a, b) of the coordinate plane. He is hurrying up to work so he wants to get out of his house as soon as possible. New app suggested n available Beru-taxi nearby. The i-th taxi is located at point (...
[{"type": "stdin_stdout", "input": "66 -82\n43\n27 -21 70\n-64 46 58\n-7 -20 41\n-42 60 57\n-93 -7 95\n26 -61 26\n-10 -72 25\n-78 -18 55\n-62 -64 69\n-33 95 50\n24 59 45\n4 72 37\n66 57 61\n16 -60 5\n17 -78 36\n-75 56 59\n-60 98 77\n-94 37 28\n76 6 63\n99 -35 75\n69 -40 1\n9 -48 56\n-94 -11 19\n69 1 63\n43 42 80\n-28 -...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIs there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras. \n\nInspired by this adventure and an a...
[{"type": "stdin_stdout", "input": "wwwbbwbbbwbwbwwbwwbbbwbwbwwbbbwbwwwbwwbwbbbbwwbwwwwwbwwwwwwwwbbwwwwbbbbbwbwbbwwbbbbbwbwbbwbwwwbbwwbbbwwwbbwwbwwbbbbwwbwbbwbwwbbwbwbwbbwwbwwwbwbwbbbwwwwwwbwwbbbwwbwwbwbwwwbbwwwwwwwwwbwwbwbbbwbwwwwbwwbbwbbwbwwbwwbwwbbwbbwwwwbwwwbwwwbwbwwwbbwwbbwwbwbwwwwwwbwbwwwwbbwwwbwbwwwbbwwwwwbwwbwb...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $1$, and in each cell you can eithe...
[{"type": "stdin_stdout", "input": "16\n2 2 1\n10\n11 1\n2 1 2\n01\n5 6\n2 2 2\n11\n9 11\n2 2 2\n00\n8 3\n2 2 2\n10\n9 10\n2 1 2\n11\n7 2\n2 2 1\n01\n3 1\n2 1 2\n00\n5 4\n2 2 2\n01\n2 7\n2 1 1\n11\n6 3\n2 1 2\n10\n7 1\n2 1 1\n01\n9 10\n2 2 1\n00\n11 3\n2 1 1\n00\n4 10\n2 2 1\n11\n7 8\n2 1 1\n10\n10 4\n", "output": "11\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour task is to return the sum of Triangular Numbers up-to-and-including the `nth` Triangular Number.\n\nTriangular Number: \"any of the series of numbers (1, 3, 6, 10, 15, etc.) obtained by continued summation of the nat...
[{"input": "943", "output": "[140205240]", "fn_name": "sum_triangular_numbers"}, {"input": "34", "output": "[7140]", "fn_name": "sum_triangular_numbers"}, {"input": "-291", "output": "[0]", "fn_name": "sum_triangular_numbers"}, {"input": "-971", "output": "[0]", "fn_name": "sum_triangular_numbers"}, {"input": "6", "out...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob are controlling a robot. They each have one switch that controls the robot.\n\nAlice started holding down her button A second after the start-up of the robot, and released her button B second after the start...
[{"type": "stdin_stdout", "input": "56 100 33 100\n", "output": "44\n"}, {"type": "stdin_stdout", "input": "0 100 0 100\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "0 75 25 100\n", "output": "50\n"}, {"type": "stdin_stdout", "input": "10 90 20 80\n", "output": "60\n"}, {"type": "stdin_stdout", "input": "7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere's a new security company in Paris, and they decided to give their employees an algorithm to make first name recognition faster. In the blink of an eye, they can now detect if a string is a first name, no matter if i...
[{"input": "\"Bernard-Henry-Levy\"", "output": "[true]", "fn_name": "show_me"}, {"input": "\"Jean-Luc-Picard-\"", "output": "[false]", "fn_name": "show_me"}, {"input": "\"A-a-a-a----a-a\"", "output": "[false]", "fn_name": "show_me"}, {"input": "\"Z-------------\"", "output": "[false]", "fn_name": "show_me"}, {"input": ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou a captain of a ship. Initially you are standing in a point $(x_1, y_1)$ (obviously, all positions in the sea can be described by cartesian plane) and you want to travel to a point $(x_2, y_2)$. \n\nYou know the weathe...
[{"type": "stdin_stdout", "input": "0 0\n1000000000 1000000000\n2\nDR\n", "output": "2000000000\n"}, {"type": "stdin_stdout", "input": "0 0\n1000000000 1000000000\n2\nDR\n", "output": "2000000000\n"}, {"type": "stdin_stdout", "input": "0 0\n1000000010 1000000000\n2\nDR\n", "output": "2000000010\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.\n\nAll children love to cry loudly at the reception at the dentist. We enumerate th...
[{"type": "stdin_stdout", "input": "10\n9 8 8\n2 9 33\n10 7 42\n7 2 18\n3 5 82\n9 9 25\n3 2 86\n1 5 49\n5 3 72\n4 4 71\n", "output": "10\n1 2 3 4 5 6 7 8 9 10 "}, {"type": "stdin_stdout", "input": "10\n9 8 8\n2 9 33\n10 7 42\n7 2 18\n3 4 82\n9 9 25\n3 2 86\n1 5 49\n5 3 72\n4 4 71\n", "output": "10\n1 2 3 4 5 6 7 8 9 10...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLuke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit t means replacing it with digit 9 - t. \n\nHelp Chewbacca to transform the initial ...
[{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "1000001000000000000\n", "output": "1000001000000000000\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe cities of Byteland and Berland are located on the axis $Ox$. In addition, on this axis there are also disputed cities, which belong to each of the countries in their opinion. Thus, on the line $Ox$ there are three typ...
[{"type": "stdin_stdout", "input": "15\n-9518 R\n-6858 P\n-6726 B\n-6486 R\n-4496 P\n-4191 P\n-772 B\n-258 R\n-194 P\n1035 R\n2297 P\n4816 B\n5779 R\n9342 B\n9713 B\n", "output": "25088\n"}, {"type": "stdin_stdout", "input": "15\n-9518 R\n-6858 P\n-6726 B\n-6486 R\n-4496 P\n-4191 P\n-772 B\n-258 R\n-194 P\n1035 R\n2297...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMy friend wants a new band name for her band. She like bands that use the formula: \"The\" + a noun with the first letter capitalized, for example:\n\n`\"dolphin\" -> \"The Dolphin\"`\n\nHowever, when a noun STARTS and EN...
[{"input": "\"sandles\"", "output": "[\"Sandlesandles\"]", "fn_name": "band_name_generator"}, {"input": "\"knife\"", "output": "[\"The Knife\"]", "fn_name": "band_name_generator"}, {"input": "\"tart\"", "output": "[\"Tartart\"]", "fn_name": "band_name_generator"}, {"input": "\"bed\"", "output": "[\"The Bed\"]", "fn_nam...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\n\...
[{"type": "stdin_stdout", "input": "1000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "477\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "124\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "480\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "141\n", "output": "YES\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's introduce the designation <image>, where x is a string, n is a positive integer and operation \" + \" is the string concatenation operation. For example, [abc, 2] = abcabc.\n\nWe'll say that string s can be obtained...
[{"type": "stdin_stdout", "input": "10000000 10000000\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "10000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour task is to create a new implementation of `modpow` so that it computes `(x^y)%n` for large `y`. The problem with the current implementation is that the output of `Math.pow` is so large on our inputs that it won't fit...
[{"input": "31\n902938423012\n1023", "output": "[961]", "fn_name": "power_mod"}, {"input": "29\n1013293125\n492", "output": "[161]", "fn_name": "power_mod"}, {"input": "13\n81230123\n22", "output": "[19]", "fn_name": "power_mod"}, {"input": "5\n100000000\n19", "output": "[5]", "fn_name": "power_mod"}, {"input": "11\n10...
code_functional