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\nAn array of integers $p_1, p_2, \\dots, p_n$ is called a permutation if it contains each number from $1$ to $n$ exactly once. For example, the following arrays are permutations: $[3, 1, 2]$, $[1]$, $[1, 2, 3, 4, 5]$ and $...
[{"type": "stdin_stdout", "input": "5\n-1 2 -3 -1\n", "output": "4 3 5 2 1 "}, {"type": "stdin_stdout", "input": "5\n3 -2 1 -3\n", "output": "2 5 3 4 1 "}, {"type": "stdin_stdout", "input": "5\n-4 1 2 -1\n", "output": "5 1 2 4 3 "}, {"type": "stdin_stdout", "input": "5\n1 1 -3 4\n", "output": "2 3 4 1 5 "}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi is standing on a multiplication table with infinitely many rows and columns.\nThe square (i,j) contains the integer i \\times j. Initially, Takahashi is standing at (1,1).\nIn one move, he can move from (i,j) to...
[{"type": "stdin_stdout", "input": "613921846801\n", "output": "613921846800\n"}, {"type": "stdin_stdout", "input": "550310490859\n", "output": "550310490858\n"}, {"type": "stdin_stdout", "input": "571704556531\n", "output": "571704556530\n"}, {"type": "stdin_stdout", "input": "472249589291\n", "output": "472249589290\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob have decided to play the game \"Rock, Paper, Scissors\". \n\nThe game consists of several rounds, each round is independent of each other. In each round, both players show one of the following things at the ...
[{"type": "stdin_stdout", "input": "1000000000\n156489182 145117627 698393191\n584283682 217785715 197930603\n", "output": "282676873 885890491\n"}, {"type": "stdin_stdout", "input": "931934723\n512340462 202375672 217218589\n24862054 655510760 251561909\n", "output": "235916499 739578188\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis problem is given in two editions, which differ exclusively in the constraints on the number $n$.\n\nYou are given an array of integers $a[1], a[2], \\dots, a[n].$ A block is a sequence of contiguous (consecutive) ele...
[{"type": "stdin_stdout", "input": "50\n-100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 -100000 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings $s$ and $t$. Both strings have length $n$ and consist of lowercase Latin letters. The characters in the strings are numbered from $1$ to $n$.\n\nYou can successively perform the following move an...
[{"type": "stdin_stdout", "input": "50\naclojlojlojlojlojlojlojlojlojlojlojlojlojlojlojloj\nlojlojlojlojlojlojlojlojlojlojlojlojlojlojlojlojac\n", "output": "96\n2 1 3 2 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIvan wants to play a game with you. He picked some string $s$ of length $n$ consisting only of lowercase Latin letters. \n\nYou don't know this string. Ivan has informed you about all its improper prefixes and suffixes (i...
[{"type": "stdin_stdout", "input": "18\nd\nh\ndj\nxh\ndjs\njxh\ndjsh\nzjxh\ndjshf\nkzjxh\ndjshfk\nhkzjxh\ndjshfkj\nkhkzjxh\ndjshfkje\nskhkzjxh\ndjshfkjeh\ndskhkzjxh\ndjshfkjehd\nhdskhkzjxh\ndjshfkjehds\nehdskhkzjxh\ndjshfkjehdsk\njehdskhkzjxh\ndjshfkjehdskh\nkjehdskhkzjxh\ndjshfkjehdskhk\nfkjehdskhkzjxh\ndjshfkjehdskhk...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSalve, mi amice.\n\nEt tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non potest creatio ex nihilo. Necesse est partibus.\n\nRp:\n\nΒ Β Β Β I Aqua Fortis\n\nΒ Β Β Β I Aqua Regia\n\nΒ Β Β Β II Amalg...
[{"type": "stdin_stdout", "input": "100 100 100 100 100\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "60 92 82 71 53\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "67 66 69 96 92\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "50 27 17 31 89\n", "output": "4\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a house with $n$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $n$ integer numbers $a_1, a_2, \\dots, a_n$, where $a_i = 1$ if...
[{"type": "stdin_stdout", "input": "100\n0 0 0 0 0 1 1 0 1 0 1 0 1 0 0 1 0 0 1 1 0 0 1 0 1 1 1 1 1 1 1 0 1 1 1 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 1 0 1 1 0 0 1 0 0 0 1 1 1 1 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 0 0 1 1 0\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "100\n0 0 1 0 1 1 1 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ consisting of $n$ integers.\n\nYour task is to say the number of such positive integers $x$ such that $x$ divides each number from the array. In other words, you have to find the number of commo...
[{"type": "stdin_stdout", "input": "6\n10000100623 10000100623 10000100623 10000100623 10000100623 10000100623\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\n99999999977 99999999977 99999999977 99999999977 99999999977\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "6\n100001623 100001623 100001623...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVova's house is an array consisting of $n$ elements (yeah, this is the first problem, I think, where someone lives in the array). There are heaters in some positions of the array. The $i$-th element of the array is $1$ if...
[{"type": "stdin_stdout", "input": "187 64\n1 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 1 1 1 1 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a positive integer N.\nHow many tuples (A,B,C) of positive integers satisfy A \\times B + C = N?\n\n-----Constraints-----\n - 2 \\leq N \\leq 10^6\n - All values in input are integers.\n\n-----Input-----\nInput ...
[{"type": "stdin_stdout", "input": "1000000\n", "output": "13969985\n"}, {"type": "stdin_stdout", "input": "877046\n", "output": "12137262\n"}, {"type": "stdin_stdout", "input": "999931\n", "output": "13968881\n"}, {"type": "stdin_stdout", "input": "999901\n", "output": "13968459\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a bracket sequence $s$ consisting of $n$ opening '(' and closing ')' brackets.\n\nA regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting ch...
[{"type": "stdin_stdout", "input": "20\n(())(()((((()())()((\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "19\n)(()()()()))(()))))\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "17\n))((()(((()()))()\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "16\n((())()((()()(()\n", "output": "0\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the length of the string.\n\nYou are given a string $s$ and a string $t$, both consisting only of lowercase Latin letters. It is guaranteed that $t$ can be obtained fr...
[{"type": "stdin_stdout", "input": "ziurxtzxixmsmewfuffsqdkpphssdcgybwtmzavkosqtmcntspzvftqybaldjllvgttblectspqinfdhhnpvkcbwjlqlquajueqsgymyekuswjctumsbnvvaiinxjlzcnyixfaykolkeogufvzvhnatqtelgjkqfvexghiznwubwihjkznkhepjzrnyzftmimqtlihpn\nzurzximmewfuffskppsdcybwmzavkosqtmctspvftybaljlgtltsqinfdhhpvkcwjlqlqymykusctumsbn...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\n-----Constraints-----\n - -10^9 \\leq a \\leq b \\leq 10^9\n ...
[{"type": "stdin_stdout", "input": "-1000000000 1000000000 -1000000000 1000000000\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "418379342 802780784 -790013317 -445130206\n", "output": "-186233282690604452\n"}, {"type": "stdin_stdout", "input": "-477104372 -381646699 -939378260 508013173\n",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVova had a pretty weird sleeping schedule. There are $h$ hours in a day. Vova will sleep exactly $n$ times. The $i$-th time he will sleep exactly after $a_i$ hours from the time he woke up. You can assume that Vova woke u...
[{"type": "stdin_stdout", "input": "65 654 560 571\n83 511 615 263 171 146 241 511 582 216 352 632 506 538 536 217 627 213 324 579 172 241 363 584 450 144 447 536 241 523 162 21 437 291 191 111 567 502 170 570 231 493 169 360 107 114 322 160 574 611 460 558 616 361 284 58 41 345 450 560 543 520 105 416 38\n", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a problemset consisting of $n$ problems. The difficulty of the $i$-th problem is $a_i$. It is guaranteed that all difficulties are distinct and are given in the increasing order.\n\nYou have to assemble the ...
[{"type": "stdin_stdout", "input": "9\n4 6 9 12 100 150 200 400 800\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "10\n1 2 5 11 12 24 25 26 27 28\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "10\n1 2 5 6 7 10 21 23 24 49\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "8\n2 4 6 23 60 120 20...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ consisting of $n$ integers $a_1, a_2, \\dots, a_n$.\n\nYour problem is to find such pair of indices $i, j$ ($1 \\le i < j \\le n$) that $lcm(a_i, a_j)$ is minimum possible.\n\n$lcm(x, y)$ is the...
[{"type": "stdin_stdout", "input": "4\n9999991 9999883 9999659 9999433\n", "output": "3 4\n"}, {"type": "stdin_stdout", "input": "3\n10000000 9999999 9999997\n", "output": "2 3\n"}, {"type": "stdin_stdout", "input": "3\n10000000 9999999 9999998\n", "output": "1 3\n"}, {"type": "stdin_stdout", "input": "2\n10000000 9999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step.\nHe can climb up one or two steps at a time.\nHowever, the treads of the a_1-th, a_2-th, a_3-th, \\ldots, ...
[{"type": "stdin_stdout", "input": "16090 15931\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProgrammers' kids solve this riddle in 5-10 minutes. How fast can you do it?\n\n\n-----Input-----\n\nThe input contains a single integer n (0 ≀ n ≀ 2000000000).\n\n\n-----Output-----\n\nOutput a single integer.\n\n\n-----...
[{"type": "stdin_stdout", "input": "2000000000\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "143165576\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "1919020031\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "1795248373\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "1818960378\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n-----Input-----\n\nThe input contains a single integer a (1 ≀ a ≀ 30).\n\n\n-----Output-----\n\nOutput a single integer.\n\n\n-----Example-----\nInput\n3\n\nOutput\n27\n\nThe input will be stdin and you should print your ...
[{"type": "stdin_stdout", "input": "10\n", "output": "265\n"}, {"type": "stdin_stdout", "input": "11\n", "output": "274\n"}, {"type": "stdin_stdout", "input": "12\n", "output": "319\n"}, {"type": "stdin_stdout", "input": "13\n", "output": "346\n"}, {"type": "stdin_stdout", "input": "14\n", "output": "355\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n-----Input-----\n\nThe input contains a single integer a (10 ≀ a ≀ 999).\n\n\n-----Output-----\n\nOutput 0 or 1.\n\n\n-----Examples-----\nInput\n13\n\nOutput\n1\n\nInput\n927\n\nOutput\n1\n\nInput\n48\n\nOutput\n0\n\nThe ...
[{"type": "stdin_stdout", "input": "927\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "999\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "142\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "309\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "572\n", "output": "0\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDO YOU EXPECT ME TO FIND THIS OUT?\n\nWHAT BASE AND/XOR LANGUAGE INCLUDES string?\n\nDON'T BYTE OF MORE THAN YOU CAN CHEW\n\nYOU CAN ONLY DISTORT THE LARGEST OF MATHEMATICS SO FAR\n\nSAYING \"ABRACADABRA\" WITHOUT A MAGIC...
[{"type": "stdin_stdout", "input": "10\n5 5 10 10 10 2 4 3 4 10\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n8 10 6 10 4 3 4 6 7 4\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "10\n5 6 4 8 11 4 10 4 8 4\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "8\n4 7 11 3 11 3 1 1\n", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp wants to buy exactly $n$ shovels. The shop sells packages with shovels. The store has $k$ types of packages: the package of the $i$-th type consists of exactly $i$ shovels ($1 \\le i \\le k$). The store has an in...
[{"type": "stdin_stdout", "input": "10\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n", "output": "104395301\n104395301\n104395301\n104395301\n104395301\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have N switches with \"on\" and \"off\" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M.\nBulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lig...
[{"type": "stdin_stdout", "input": "10 10\n10 6 7 4 3 9 2 8 5 10 1\n10 8 7 3 2 5 10 4 6 9 1\n10 7 4 2 5 10 8 3 9 6 1\n10 5 6 8 4 2 10 7 3 1 9\n10 9 10 7 4 6 1 8 2 5 3\n10 6 2 7 9 8 3 1 4 5 10\n10 1 8 4 10 7 6 5 2 3 9\n10 3 1 4 6 5 2 9 7 10 8\n10 4 3 9 2 5 10 7 6 8 1\n10 1 7 2 5 3 8 6 10 4 9\n1 1 1 1 1 1 1 1 1 1\n", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates...
[{"type": "stdin_stdout", "input": "1000 1000 6 1\n", "output": "1997.69677296990135817456\n"}, {"type": "stdin_stdout", "input": "858 203 11 21\n", "output": "1031.72462874262234588940\n"}, {"type": "stdin_stdout", "input": "944 305 10 32\n", "output": "1142.87647693641628066086\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer sequence $a_1, a_2, \\dots, a_n$.\n\nFind the number of pairs of indices $(l, r)$ ($1 \\le l \\le r \\le n$) such that the value of median of $a_l, a_{l+1}, \\dots, a_r$ is exactly the given numbe...
[{"type": "stdin_stdout", "input": "15 2\n1 2 3 1 2 3 1 2 3 1 2 3 1 2 3\n", "output": "97\n"}, {"type": "stdin_stdout", "input": "10 7\n14 20 3 3 8 16 17 13 6 4\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "9 8\n10 8 8 15 1 2 13 8 6\n", "output": "27\n"}, {"type": "stdin_stdout", "input": "8 2\n2 6 11 14 10 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is a number of elements in the array.\n\nYou are given an array $a$ consisting of $n$ integers. The value of the $i$-th element of the array is $a_i$.\n\nYou are also giv...
[{"type": "stdin_stdout", "input": "50 50\n1 -9 8 -9 5 -4 -4 3 -2 -1 3 -8 -6 -6 2 -5 -1 -2 -5 10 2 0 10 10 5 -3 7 -1 -9 9 -10 4 7 0 -6 0 -1 4 8 0 -3 -8 10 10 6 6 -3 -5 -3 -8\n28 41\n28 49\n49 49\n6 38\n22 30\n50 50\n41 45\n30 32\n17 44\n24 25\n27 39\n17 39\n50 50\n10 14\n11 12\n18 28\n11 20\n36 42\n45 49\n29 36\n32 44\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA string is called diverse if it contains consecutive (adjacent) letters of the Latin alphabet and each letter occurs exactly once. For example, the following strings are diverse: \"fced\", \"xyz\", \"r\" and \"dabcef\". ...
[{"type": "stdin_stdout", "input": "69\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is a number of elements in the array.\n\nYou are given an array $a$ consisting of $n$ integers. The value of the $i$-th element of the array is $a_i$.\n\nYou are also giv...
[{"type": "stdin_stdout", "input": "50 50\n1 -9 8 -9 5 -4 -4 3 -2 -1 3 -8 -6 -6 2 -5 -1 -2 -5 10 2 0 10 10 5 -3 7 -1 -9 9 -10 4 7 0 -6 0 -1 4 8 0 -3 -8 10 10 6 6 -3 -5 -3 -8\n28 41\n28 49\n49 49\n6 38\n22 30\n50 50\n41 45\n30 32\n17 44\n24 25\n27 39\n17 39\n50 50\n10 14\n11 12\n18 28\n11 20\n36 42\n45 49\n29 36\n32 44\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).\n\nYou are given a sequence $a$ consisting of $n$ integers. All these int...
[{"type": "stdin_stdout", "input": "100\n2 3 4 6 7 8 9 12 13 14 15 16 17 19 20 21 24 25 27 28 31 32 34 40 42 43 45 46 47 49 54 55 58 59 60 61 62 63 68 71 74 75 80 81 82 85 86 87 88 89 91 92 95 96 98 99 100 97 94 93 90 84 83 79 78 77 76 73 72 70 69 67 66 65 64 57 56 53 52 51 50 48 44 41 39 38 37 36 35 33 30 29 26 23 22 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ consisting of $n$ integers.\n\nYou can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.\n\nYour task is to calculate the maximum possible length o...
[{"type": "stdin_stdout", "input": "12\n123654 1 2 3 4 5 6 7 8 9 10 11\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "15\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "11\n123654 1 2 3 4 5 6 7 8 9 10\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "8\n53 43 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the number of elements in the array.\n\nYou are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down ...
[{"type": "stdin_stdout", "input": "50 25\n199970 199997 199998 199988 199999 199981 200000 199990 199974 199985 199932 200000 199966 199999 199999 199951 199983 199975 199974 199996 199974 199992 199979 199995 199955 199989 199960 199975 199983 199990 199950 199952 199999 199999 199962 199939 199979 199977 199962 1999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi has many red balls and blue balls. Now, he will place them in a row.\nInitially, there is no ball placed.\nTakahashi, who is very patient, will do the following operation 10^{100} times:\n - Place A blue balls a...
[{"type": "stdin_stdout", "input": "984159202374430527 552558592232591693 265756112319848958\n", "output": "718403090054581569\n"}, {"type": "stdin_stdout", "input": "994914121424164663 818665214162491101 129546857230076861\n", "output": "865367264194087802\n"}, {"type": "stdin_stdout", "input": "501719768609305159 370...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe guessed some integer number $x$. You are given a list of almost all its divisors. Almost all means that there are all divisors except $1$ and $x$ in the list.\n\nYour task is to find the minimum possible integer $x$ th...
[{"type": "stdin_stdout", "input": "25\n2\n999389 999917\n2\n999307 999613\n2\n999529 999611\n2\n999221 999853\n2\n999683 999433\n2\n999907 999749\n2\n999653 999499\n2\n999769 999931\n2\n999809 999287\n2\n999233 999239\n2\n999553 999599\n2\n999371 999763\n2\n999491 999623\n2\n999961 999773\n2\n999671 999269\n2\n999883 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp knows that if the sum of the digits of a number is divisible by $3$, then the number itself is divisible by $3$. He assumes that the numbers, the sum of the digits of which is divisible by $4$, are also somewhat ...
[{"type": "stdin_stdout", "input": "1000\n", "output": "1003\n"}, {"type": "stdin_stdout", "input": "997\n", "output": "1003\n"}, {"type": "stdin_stdout", "input": "999\n", "output": "1003\n"}, {"type": "stdin_stdout", "input": "432\n", "output": "435\n"}, {"type": "stdin_stdout", "input": "237\n", "output": "237\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp wrote on the board a string $s$ containing only lowercase Latin letters ('a'-'z'). This string is known for you and given in the input.\n\nAfter that, he erased some letters from the string $s$, and he rewrote th...
[{"type": "stdin_stdout", "input": "10\nvzsxyuyy\n3\n1 0 3\nwwvutuxsuxywut\n2\n0 0\nsuzvsvutvvstuz\n3\n3 1 0\nstyuwsutv\n4\n6 3 0 1\nzsustytvzsyw\n6\n0 9 5 7 7 5\nsvwxwwwyxuvszx\n1\n0\nxuyyvuztxwuuvsxwz\n5\n5 7 0 0 7\nuxuztuwsxz\n5\n4 2 2 0 10\nxystzstwtzwsz\n2\n1 0\nuuzss\n1\n0\n", "output": "yzx\nxx\nuvz\nuvyw\nztwtv...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n - the dogs numbere...
[{"type": "stdin_stdout", "input": "1000000000000001\n", "output": "gbdpxgrzxjm\n"}, {"type": "stdin_stdout", "input": "530000050000000\n", "output": "csoypdctwnh\n"}, {"type": "stdin_stdout", "input": "95678123450002\n", "output": "qpdjiixlxb\n"}, {"type": "stdin_stdout", "input": "1000000000\n", "output": "cfdgsxl\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a text consisting of $n$ space-separated words. There is exactly one space character between any pair of adjacent words. There are no spaces before the first word and no spaces after the last word. The lengt...
[{"type": "stdin_stdout", "input": "250\nf r s d b f f k d e k v m b t k k j t t a o m m s n d w l v g e k x d w k v a j h c a g x s d e t z z w q z d h n r i k b z k u s q l k c v o d o w w c y i a q v r i g i m l b x z h t a i j t h q u e v j o h w m o v k g r r x j a c m z z i s i r a p p i i l e i g m f f f y v k m...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp is practicing his problem solving skill. He has a list of $n$ problems with difficulties $a_1, a_2, \\dots, a_n$, respectively. His plan is to practice for exactly $k$ days. Each day he has to solve at least one ...
[{"type": "stdin_stdout", "input": "18 15\n18 2 13 1 18 3 2 18 18 20 9 2 20 20 4 20 9 12\n", "output": "204\n1 2 2 1 2 1 1 1 1 1 1 1 1 1 1\n"}, {"type": "stdin_stdout", "input": "16 15\n14 4 9 12 17 1 1 8 12 13 6 9 17 2 18 12\n", "output": "154\n1 1 1 1 1 2 1 1 1 1 1 1 1 1 1\n"}, {"type": "stdin_stdout", "input": "18 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKolya got an integer array $a_1, a_2, \\dots, a_n$. The array can contain both positive and negative integers, but Kolya doesn't like $0$, so the array doesn't contain any zeros.\n\nKolya doesn't like that the sum of some...
[{"type": "stdin_stdout", "input": "100\n-6 2 8 -9 -9 3 -3 -2 7 3 2 -2 -9 -7 -10 -9 10 4 5 -9 8 -5 7 -2 6 -2 4 4 -2 -5 6 4 8 -8 9 7 -4 2 -3 7 4 -10 -7 -4 8 2 10 -8 -3 -8 -5 -5 -10 -6 -8 -5 7 -1 7 -5 9 10 3 5 10 -7 -3 -7 1 -5 -8 5 1 -1 4 10 2 6 -4 9 3 10 -5 -10 -10 -2 1 9 10 1 10 2 8 -3 -3 -1 7 -5 8 -4\n", "output": "11...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers $n$ and $m$. You have to construct the array $a$ of length $n$ consisting of non-negative integers (i.e. integers greater than or equal to zero) such that the sum of elements of this array is ex...
[{"type": "stdin_stdout", "input": "5\n1 100\n2 2\n5 5\n2 1000000000\n1000000000 1000000000\n", "output": "0\n2\n10\n1000000000\n2000000000\n"}, {"type": "stdin_stdout", "input": "2\n12345 12345\n12345 12345\n", "output": "24690\n24690\n"}, {"type": "stdin_stdout", "input": "2\n12345 12345\n1 1\n", "output": "24690\n0\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi loves the number 7 and multiples of K.\nWhere is the first occurrence of a multiple of K in the sequence 7,77,777,\\ldots? (Also see Output and Sample Input/Output below.)\nIf the sequence contains no multiples ...
[{"type": "stdin_stdout", "input": "999983\n", "output": "999982\n"}, {"type": "stdin_stdout", "input": "999863\n", "output": "999862\n"}, {"type": "stdin_stdout", "input": "999953\n", "output": "999952\n"}, {"type": "stdin_stdout", "input": "531441\n", "output": "531441\n"}, {"type": "stdin_stdout", "input": "823543\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a permutation $p_1, p_2, \\dots, p_n$. A permutation of length $n$ is a sequence such that each integer between $1$ and $n$ occurs exactly once in the sequence.\n\nFind the number of pairs of indices $(l, r)...
[{"type": "stdin_stdout", "input": "100 50\n2 4 82 12 47 63 52 91 87 45 53 1 17 25 64 50 9 13 22 54 21 30 43 24 38 33 68 11 41 78 99 23 28 18 58 67 79 10 71 56 49 61 26 29 59 20 90 74 5 75 89 8 39 95 72 42 66 98 44 32 88 35 92 3 97 55 65 51 77 27 81 76 84 69 73 85 19 46 62 100 60 37 7 36 57 6 14 83 40 48 16 70 96 15 31...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the constraints.\n\nPolycarp has to write a coursework. The coursework consists of $m$ pages.\n\nPolycarp also has $n$ cups of coffee. The coffee in the $i$-th cup has...
[{"type": "stdin_stdout", "input": "100 10000\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp likes arithmetic progressions. A sequence $[a_1, a_2, \\dots, a_n]$ is called an arithmetic progression if for each $i$ ($1 \\le i < n$) the value $a_{i+1} - a_i$ is the same. For example, the sequences $[42]$, $...
[{"type": "stdin_stdout", "input": "4\n1 1000000000 1000000000 1000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "10\n9 5 3 4 7 1 2 8 10 6\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "10\n10 9 8 7 6 1 2 3 4 5\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "2\n1000000000 1\n", "o...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are a coach at your local university. There are $n$ students under your supervision, the programming skill of the $i$-th student is $a_i$.\n\nYou have to form $k$ teams for yet another new programming competition. As ...
[{"type": "stdin_stdout", "input": "100 4\n4741 3440 2421 1765 4810 1955 4346 1365 2697 3255 3337 386 1154 115 4951 2306 4058 279 4849 3962 1737 1147 362 4799 4796 3670 481 2913 435 1032 592 1187 4676 1295 2262 3757 2494 862 2134 1898 4159 530 3038 2610 4399 2707 1041 4337 3275 3569 4437 166 4730 3165 4022 3317 1763 22...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi is taking exams on N subjects. The score on each subject will be an integer between 0 and K (inclusive).\nHe has already taken exams on N-1 subjects and scored A_i points on the i-th subject.\nHis goal is to ach...
[{"type": "stdin_stdout", "input": "100 100 100\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows....
[{"type": "stdin_stdout", "input": "1000 993 1000\n176\n400\n733\n753\n822\n429\n929\n697\n176\n191\n80\n247\n40\n891\n773\n889\n453\n777\n451\n40\n120\n222\n697\n906\n441\n251\n324\n193\n970\n558\n824\n390\n824\n36\n209\n120\n849\n548\n393\n668\n561\n289\n560\n970\n575\n53\n154\n931\n750\n404\n478\n120\n542\n98\n551\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a binary matrix $a$ of size $n \\times m$. A binary matrix is a matrix where each element is either $0$ or $1$.\n\nYou may perform some (possibly zero) operations with this matrix. During each operation you ...
[{"type": "stdin_stdout", "input": "4 5\n0 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n", "output": "YES\n0000\n00000\n"}, {"type": "stdin_stdout", "input": "3 4\n0 0 0 1\n0 0 0 0\n1 1 1 1\n", "output": "YES\n010\n0000\n"}, {"type": "stdin_stdout", "input": "2 3\n0 1 0\n0 1 0\n", "output": "YES\n00\n101\n"}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n-----Input-----\n\nThe only line of the input contains a string of digits. The length of the string is between 1 and 10, inclusive.\n\n\n-----Output-----\n\nOutput \"Yes\" or \"No\".\n\n\n-----Examples-----\nInput\n373\n\...
[{"type": "stdin_stdout", "input": "4357087936\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "3333333333\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "806975480\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "673902416\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "8800897...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne very experienced problem writer decided to prepare a problem for April Fools Day contest. The task was very simple - given an arithmetic expression, return the result of evaluating this expression. However, looks like...
[{"type": "stdin_stdout", "input": "255+255+255+255+255+255+255+255+255+255\n", "output": "-42450\n"}, {"type": "stdin_stdout", "input": "101+200+195+231+107+222+146+254+160+209\n", "output": "-43175\n"}, {"type": "stdin_stdout", "input": "255-100-100-100-100-100-100-100-100-100\n", "output": "26355\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe king of Berland organizes a ball! $n$ pair are invited to the ball, they are numbered from $1$ to $n$. Each pair consists of one man and one woman. Each dancer (either man or woman) has a monochrome costume. The color...
[{"type": "stdin_stdout", "input": "69 42\n", "output": "YES\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 8\n8 9\n9 10\n10 11\n11 12\n12 13\n13 14\n14 15\n15 16\n16 17\n17 18\n18 19\n19 20\n20 21\n21 22\n22 23\n23 24\n24 25\n25 26\n26 27\n27 28\n28 29\n29 30\n30 31\n31 32\n32 33\n33 34\n34 35\n35 36\n36 37\n37 38\n38 39\n39 40\n40...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the constraints.\n\nVova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $n$ consecutive pictures (with kitt...
[{"type": "stdin_stdout", "input": "200 103 37\n1 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 1 1 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou work as a system administrator in a dormitory, which has $n$ rooms one after another along a straight hallway. Rooms are numbered from $1$ to $n$.\n\nYou have to connect all $n$ rooms to the Internet.\n\nYou can conne...
[{"type": "stdin_stdout", "input": "200 10\n10000010101010110011110010100010010000001100101111011001010010001101001011111110011010111101000101011110101001001101101011010011100000100101000010110111000110000010101110110000110000100000101110111100\n", "output": "989\n"}, {"type": "stdin_stdout", "input": "100 5\n110111111...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi, who is a novice in competitive programming, wants to learn M algorithms.\nInitially, his understanding level of each of the M algorithms is 0.\nTakahashi is visiting a bookstore, where he finds N books on algor...
[{"type": "stdin_stdout", "input": "12 12 48311\n2997 79802 84238 34346 35199 2284 77696 46340 54797 36702 97764 42765 11582\n82923 47331 39508 81928 63775 90952 64439 99662 74546 15843 11552 23897 87476\n26261 21259 714 72469 92132 94958 69101 38760 4916 38769 60706 90149 70017\n35433 97674 53722 44881 95786 42614 799...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a sc...
[{"type": "stdin_stdout", "input": "10 10550000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n", "output": "1000\n"}, {"type": "stdin_stdout", "input": "10 100\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 10000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTanya has $n$ candies numbered from $1$ to $n$. The $i$-th candy has the weight $a_i$.\n\nShe plans to eat exactly $n-1$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their num...
[{"type": "stdin_stdout", "input": "105\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 5 5 5 6\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "9\n2 3 4 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the constraints.\n\nVova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $n$ consecutive pictures (with kitt...
[{"type": "stdin_stdout", "input": "25 4 15\n172043124 384297369 650214870 426077944 587045971 576701397 865475689 261462255 763837593 285228401 629011531 611623799 456424430 820020943 166915939 903479811 384167579 561107351 177427070 14589838 994169358 683167027 193684940 439658261 237500762\n", "output": "9968015975\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLa Confiserie d'ABC sells cakes at 4 dollars each and doughnuts at 7 dollars each.\nDetermine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you c...
[{"type": "stdin_stdout", "input": "100\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "11\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "40\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "12\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "15\n", "output": "Yes\n"}, {"type":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc.\n\nThe pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y...
[{"type": "stdin_stdout", "input": "100\n10 12 512917373\n6 9 512917366\n66 44 512917421\n49 18 512917412\n57 96 512917426\n65 72 512917442\n62 59 512917440\n27 77 512917437\n31 13 512917395\n38 39 512917428\n15 72 512917430\n0 69 512917418\n22 22 512917395\n9 69 512917427\n37 96 512917428\n12 23 512917386\n100 90 5129...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.\nGiven is a string S. Find the minimum number o...
[{"type": "stdin_stdout", "input": "cgayikejwockvntzlvpsfjtzlqfhoqoiahcodvinogbpuxhvohhcvhzmidloliztdhrntxqurzqjztjmwpylaknjncowkeuikhgc\n", "output": "30\n"}, {"type": "stdin_stdout", "input": "pgfqwbxjygkpqanpkicpaxfgeembvdgtllvtiyamxfpwtknorxxvonpntkwcffyjtvwlqgvvbzmmgfgkwezkemmxpagyihbkqidk\n", "output": "32\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together.\nGiven an integer N, determine whether N can be represented as the product of two integers between 1 and 9...
[{"type": "stdin_stdout", "input": "10\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "81\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "12\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "15\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "16\n", "output": "Yes\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\nGiven are two integers A and B.\nIf Takahashi can calculate A \\times...
[{"type": "stdin_stdout", "input": "20 20\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "5 10\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "1 11\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "20 1\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "11 3\n", "output": "-1\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ cities in Berland. Some pairs of cities are connected by roads. All roads are bidirectional. Each road connects two different cities. There is at most one road between a pair of cities. The cities are number...
[{"type": "stdin_stdout", "input": "16 20 100\n7 8\n6 5\n15 1\n7 2\n2 12\n1 7\n7 9\n13 15\n11 14\n3 10\n8 3\n2 14\n3 4\n1 5\n4 15\n10 12\n11 4\n4 8\n7 16\n14 13\n", "output": "8\n11111111011101101010\n11111111010111101010\n11111111001101111010\n11111111000111111010\n11111111011001101011\n11111111010011101011\n111111110...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVova's family is building the Great Vova Wall (named by Vova himself). Vova's parents, grandparents, grand-grandparents contributed to it. Now it's totally up to Vova to put the finishing touches.\n\nThe current state of ...
[{"type": "stdin_stdout", "input": "10\n1 9 7 6 2 4 7 8 1 3\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "2\n99999999 99999998\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "9\n2 5 1 9 6 5 7 3 1\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "7\n10 2 3 4 2 8 8\n", "output": "YES\n"}, {"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA superhero fights with a monster. The battle consists of rounds, each of which lasts exactly $n$ minutes. After a round ends, the next round starts immediately. This is repeated over and over again.\n\nEach round has the...
[{"type": "stdin_stdout", "input": "1000000000000 10\n-6 5 -2 -2 -10 -7 -5 -9 -3 -4\n", "output": "232558139536\n"}, {"type": "stdin_stdout", "input": "1000000000000 10\n-2 -8 -3 10 4 -8 2 -1 -3 3\n", "output": "1666666666652\n"}, {"type": "stdin_stdout", "input": "1000000000000 10\n8 10 3 0 -4 3 -7 -6 3 -6\n", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo-gram is an ordered pair (i.e. string of length two) of capital Latin letters. For example, \"AZ\", \"AA\", \"ZA\" β€” three distinct two-grams.\n\nYou are given a string $s$ consisting of $n$ capital Latin letters. Your...
[{"type": "stdin_stdout", "input": "100\nURXCAIZFIBNJTPCZHBQIBCILLPXZCFGMKKZMNPLCYGAVJVIBMCZEBSJWPSCPQDYCTTKPOKIJRSKIZPDGCHVOUTMPNECYORSFZFNC\n", "output": "IB\n"}, {"type": "stdin_stdout", "input": "100\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n", "output": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied:\n - S is a palindrome.\n - Let N be the length of S. The string formed by the 1-st through ((N-1)...
[{"type": "stdin_stdout", "input": "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "kszhkbpphykinkezplvfjaqmpmqajfvlpzeknikyhppbkhzskokszhkbpphykinkezplvfjaqmpmqajfvlpzeknikyhppbkhzsk\n", "output": "Yes\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\n-----Constraints-----\n - 0 \\leq A \\leq 10^{15}\n - 0 \\leq B < 10\n - A is an integer.\n - B is a number with two digits after t...
[{"type": "stdin_stdout", "input": "1000000000000000 9.99\n", "output": "9990000000000000\n"}, {"type": "stdin_stdout", "input": "776013196293085 2.60\n", "output": "2017634310362021\n"}, {"type": "stdin_stdout", "input": "776013196293085 8.11\n", "output": "6293467021936919\n"}, {"type": "stdin_stdout", "input": "9999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are two sisters Alice and Betty. You have $n$ candies. You want to distribute these $n$ candies between two sisters in such a way that: Alice will get $a$ ($a > 0$) candies; Betty will get $b$ ($b > 0$) candies; ...
[{"type": "stdin_stdout", "input": "98\n710\n896\n635\n909\n528\n799\n184\n970\n731\n285\n481\n62\n829\n815\n204\n927\n48\n958\n858\n549\n722\n900\n290\n96\n414\n323\n488\n140\n494\n286\n783\n551\n896\n580\n724\n766\n841\n914\n200\n170\n384\n664\n14\n203\n582\n203\n678\n502\n677\n318\n189\n144\n97\n330\n169\n20\n492\n2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ cities and $m$ roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.\n\nWhat is the minimum number of new roads that need to be built to make all the cities reachable from ...
[{"type": "stdin_stdout", "input": "39 40 38\n4 8\n24 28\n16 17\n7 25\n4 29\n34 35\n16 24\n21 10\n23 36\n36 14\n28 16\n34 19\n15 21\n22 38\n22 37\n37 27\n28 33\n3 29\n32 22\n12 30\n9 15\n5 19\n23 27\n19 17\n25 17\n24 11\n39 10\n6 20\n16 6\n3 18\n34 21\n15 38\n11 19\n11 3\n32 4\n15 13\n16 11\n11 7\n33 7\n3 33\n", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.\nCity i is established in year Y_i and belongs to Prefecture P_i.\nYou can assume that there are no multiple citie...
[{"type": "stdin_stdout", "input": "75634 912\n18125 601244640\n58230 951349939\n4017 753730550\n23636 124912128\n45120 23758881\n51811 316477853\n19326 139861106\n48018 406348942\n68864 391719264\n1850 712458521\n2796 385027567\n12731 564315721\n43367 828330253\n30104 102450015\n64351 340641907\n19781 414658282\n53502...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGolorps are mysterious creatures who feed on variables. Golorp's name is a program in some programming language. Some scientists believe that this language is Befunge; golorps are tantalizingly silent.\n\nVariables consum...
[{"type": "stdin_stdout", "input": "?(_*__*___*____*_____*______*_______*________*_________*__________*___________*____________):-__<___,___<____,____<_____,_____<______,______<_______,_______<________,________<_________,_________<__________,__________<___________,___________<____________.\n", "output": "false\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a rectangular grid of size $n \\times m$. Each cell has a number written on it; the number on the cell ($i, j$) is $a_{i, j}$. Your task is to calculate the number of paths from the upper-left cell ($1, 1$) to th...
[{"type": "stdin_stdout", "input": "10 10 524287\n1 2 4 8 16 32 64 128 256 512\n2 4 8 16 32 64 128 256 512 1024\n4 8 16 32 64 128 256 512 1024 2048\n8 16 32 64 128 256 512 1024 2048 4096\n16 32 64 128 256 512 1024 2048 4096 8192\n32 64 128 256 512 1024 2048 4096 8192 16384\n64 128 256 512 1024 2048 4096 8192 16384 3276...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA string $s$ of length $n$ can be encrypted by the following algorithm: iterate over all divisors of $n$ in decreasing order (i.e. from $n$ to $1$), for each divisor $d$, reverse the substring $s[1 \\dots d]$ (i.e. the ...
[{"type": "stdin_stdout", "input": "100\nedykhvzcntljuuoqghptioetqnfllwekzohiuaxelgecabvsbibgqodqxvyfkbyjwtgbyhvssntinkwsinwsmalusiwnjmtcoovf\n", "output": "fvooctmjnwisulamswniswknitnssvhybgtwjybkfyvxqdoqgbqteoitnczvkyedhljuuoqghptnfllwekzohiuaxelgecabvsbi\n"}, {"type": "stdin_stdout", "input": "100\nooooooooooooooooo...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA + B is often used as an example of the easiest problem possible to show some contest platform. However, some scientists have observed that sometimes this problem is not so easy to get accepted. Want to try?\n\n\n-----In...
[{"type": "stdin_stdout", "input": "723 350\n", "output": "1073\n"}, {"type": "stdin_stdout", "input": "923 488\n", "output": "1411\n"}, {"type": "stdin_stdout", "input": "953 553\n", "output": "1506\n"}, {"type": "stdin_stdout", "input": "441 915\n", "output": "1356\n"}, {"type": "stdin_stdout", "input": "740 519\n", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem you will write a simple generator of Brainfuck (https://en.wikipedia.org/wiki/Brainfuck) calculators.\n\nYou are given an arithmetic expression consisting of integers from 0 to 255 and addition/subtraction...
[{"type": "stdin_stdout", "input": "0-255-255-255-255+255+255+255+255+255\n", "output": "++++++++++++++++++++++++++++++++++++++++++++++++++.>\n+++++++++++++++++++++++++++++++++++++++++++++++++++++.>\n+++++++++++++++++++++++++++++++++++++++++++++++++++++.>\n"}, {"type": "stdin_stdout", "input": "255-255+255-255+255-255+...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between the easy and the hard versions is the maximum value of $k$.\n\nYou are given an infinite sequence of form \"112123123412345$\\dots$\" which consist of blocks of all consecutive positive integer...
[{"type": "stdin_stdout", "input": "19\n1\n10\n100\n1000\n10000\n100000\n1000000\n10000000\n100000000\n1000000000\n10000000000\n100000000000\n1000000000000\n10000000000000\n100000000000000\n1000000000000000\n10000000000000000\n100000000000000000\n1000000000000000000\n", "output": "1\n4\n1\n4\n9\n2\n6\n2\n6\n8\n1\n1\n9\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer N. Among the integers between 1 and N (inclusive), how many Shichi-Go-San numbers (literally \"Seven-Five-Three numbers\") are there?\nHere, a Shichi-Go-San number is a positive integer that satis...
[{"type": "stdin_stdout", "input": "999999999\n", "output": "26484\n"}, {"type": "stdin_stdout", "input": "500000000\n", "output": "14384\n"}, {"type": "stdin_stdout", "input": "777757375\n", "output": "26423\n"}, {"type": "stdin_stdout", "input": "777777752\n", "output": "26483\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nN tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.\nThe i-th tile from the left is painted black if the i-th character of S is 0, and painted white i...
[{"type": "stdin_stdout", "input": "01010000100110111100010011111100001010101111001100001010101000100101100011110011111110100011000001111011010011100010010111011001011000010110011100111010111111010100010111100100110000100010010011101001001110000100110101011001100000010111101101100100010011110010110010101100100011001010...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are an immigration officer in the Kingdom of AtCoder. The document carried by an immigrant has some number of integers written on it, and you need to check whether they meet certain criteria.\nAccording to the regulat...
[{"type": "stdin_stdout", "input": "100\n768 125 109 300 471 697 999 760 529 42 373 15 59 387 75 823 850 330 756 661 700 610 99 156 367 481 720 588 477 65 513 600 569 531 970 97 456 223 963 625 823 612 421 633 774 529 190 835 245 263 861 456 893 293 762 270 955 457 65 941 787 700 617 813 550 70 807 217 683 935 732 320 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn 2028 and after a continuous growth, AtCoder Inc. finally built an empire with six cities (City 1, 2, 3, 4, 5, 6)!\nThere are five means of transport in this empire:\n - Train: travels from City 1 to 2 in one minute. A ...
[{"type": "stdin_stdout", "input": "802565984633806\n802252530129536\n544410837252078\n872045491508709\n274353138702170\n562308817245826\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "956131704220258\n897098524760050\n55734601880356\n155602009554546\n559895124828099\n830172607676349\n", "output": "22\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHow many integer sequences A_1,A_2,\\ldots,A_N of length N satisfy all of the following conditions?\n - 0 \\leq A_i \\leq 9\n - There exists some i such that A_i=0 holds.\n - There exists some i such that A_i=9 holds.\nTh...
[{"type": "stdin_stdout", "input": "1000000\n", "output": "787616419\n"}, {"type": "stdin_stdout", "input": "260522\n", "output": "765255076\n"}, {"type": "stdin_stdout", "input": "914575\n", "output": "875983450\n"}, {"type": "stdin_stdout", "input": "436426\n", "output": "851976198\n"}, {"type": "stdin_stdout", "inpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFind the minimum prime number greater than or equal to X.\n\n-----Notes-----\nA prime number is an integer greater than 1 that cannot be evenly divided by any positive integer except 1 and itself.\nFor example, 2, 3, and ...
[{"type": "stdin_stdout", "input": "100000\n", "output": "100003\n"}, {"type": "stdin_stdout", "input": "99992\n", "output": "100003\n"}, {"type": "stdin_stdout", "input": "64993\n", "output": "64997\n"}, {"type": "stdin_stdout", "input": "90371\n", "output": "90371\n"}, {"type": "stdin_stdout", "input": "92227\n", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\nWe assume that A fo...
[{"type": "stdin_stdout", "input": "26\nYIHVXVZROUSFCUXIOGFIOUSIYDBTQLMECEEHARRBWUDXRITQZSTXNECYMODBOSODWDSWEFEXTVVPENGERSVLYSBDSJOKYSGTJQPEDQWMLFZANYYWWHRHPCOYXLEEBUPOBJMZVUTWCPXQEEHRPSUKCMIDRSBGHBRBAYXUGTZGFRSZTHEVFCFOOTPWYQMXJICOFMXDLCBINVZCPVWRKWDVGBDTDCWRNKPOXANOHOOCKXCSZBSHXXTGCKTSKBRZZTFAAQYFKZGNIZJJZSYTBOKKMTSH...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAuthors guessed an array $a$ consisting of $n$ integers; each integer is not less than $2$ and not greater than $2 \\cdot 10^5$. You don't know the array $a$, but you know the array $b$ which is formed from it with the fo...
[{"type": "stdin_stdout", "input": "100\n3 3 2 2 3 2 3 2 2 2 2 3 3 2 2 2 2 2 3 3 3 2 3 3 3 2 2 2 3 3 2 3 2 2 3 2 3 2 2 2 3 2 3 3 3 2 3 3 3 2 2 3 3 3 3 3 2 3 2 2 2 3 3 3 2 3 3 3 3 2 2 3 2 3 2 3 2 3 3 2 3 2 3 3 3 2 2 2 2 3 2 2 3 2 3 2 3 3 2 2 3 2 3 3 2 2 2 2 3 2 3 2 2 2 3 3 2 3 3 3 3 2 2 3 2 3 3 2 3 3 3 2 3 2 3 2 2 3 2 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ consisting of $n$ integers. Let's denote monotonic renumeration of array $a$ as an array $b$ consisting of $n$ integers such that all of the following conditions are met:\n\n $b_1 = 0$; for ev...
[{"type": "stdin_stdout", "input": "200\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA sequence $a_1, a_2, \\dots, a_n$ is called good if, for each element $a_i$, there exists an element $a_j$ ($i \\ne j$) such that $a_i+a_j$ is a power of two (that is, $2^d$ for some non-negative integer $d$).\n\nFor exa...
[{"type": "stdin_stdout", "input": "10\n2 10 9 1 10 4 7 8 5 4\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "6\n4 7 1 5 4 9\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "6\n1 7 7 7 7 7\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n1 1 1 1023\n", "output": "0\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0.\nYou are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h...
[{"type": "stdin_stdout", "input": "100\n0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100 0 100 100...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe busses in Berland are equipped with a video surveillance system. The system records information about changes in the number of passengers in a bus after stops.\n\nIf $x$ is the number of passengers in a bus just befor...
[{"type": "stdin_stdout", "input": "102 1\n1 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\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "2 1000000000\n-1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ distinct points on a coordinate line, the coordinate of $i$-th point equals to $x_i$. Choose a subset of the given set of points such that the distance between each pair of points in a subset is an integral ...
[{"type": "stdin_stdout", "input": "3\n0 -536870912 536870912\n", "output": "3\n-536870912 0 536870912 \n"}, {"type": "stdin_stdout", "input": "2\n536870912 -536870912\n", "output": "2\n-536870912 536870912 \n"}, {"type": "stdin_stdout", "input": "6\n3 5 4 7 10 12\n", "output": "3\n3 4 5 \n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\nAssuming that nothing other t...
[{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "3760\n"}, {"type": "stdin_stdout", "input": "822981260158260822\n", "output": "3740\n"}, {"type": "stdin_stdout", "input": "779547116602436626\n", "output": "3735\n"}, {"type": "stdin_stdout", "input": "578223540024980345\n", "output": "3705\n"}, {"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFind \\displaystyle{\\sum_{a=1}^{K}\\sum_{b=1}^{K}\\sum_{c=1}^{K} \\gcd(a,b,c)}.\nHere \\gcd(a,b,c) denotes the greatest common divisor of a, b, and c.\n\n-----Constraints-----\n - 1 \\leq K \\leq 200\n - K is an integer....
[{"type": "stdin_stdout", "input": "200\n", "output": "10813692\n"}, {"type": "stdin_stdout", "input": "199\n", "output": "10611772\n"}, {"type": "stdin_stdout", "input": "198\n", "output": "10493367\n"}, {"type": "stdin_stdout", "input": "197\n", "output": "10290813\n"}, {"type": "stdin_stdout", "input": "196\n", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTak performed the following action N times: rolling two dice.\nThe result of the i-th roll is D_{i,1} and D_{i,2}.\nCheck if doublets occurred at least three times in a row.\nSpecifically, check if there exists at lease o...
[{"type": "stdin_stdout", "input": "100\n3 3\n1 1\n5 5\n4 4\n1 1\n3 3\n3 3\n5 5\n2 2\n3 3\n2 2\n2 2\n3 3\n3 3\n5 5\n3 3\n1 1\n3 3\n4 4\n1 1\n4 4\n3 3\n3 3\n4 4\n6 6\n5 5\n2 2\n6 6\n3 3\n1 1\n6 6\n4 4\n3 3\n3 3\n6 6\n2 2\n5 5\n5 5\n1 1\n1 1\n5 5\n6 6\n6 6\n4 4\n6 6\n6 6\n5 5\n3 3\n2 2\n1 1\n1 1\n4 4\n6 6\n5 5\n3 3\n2 2\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is an integer r.\nHow many times is the area of a circle of radius r larger than the area of a circle of radius 1?\nIt can be proved that the answer is always an integer under the constraints given.\n\n-----Constrai...
[{"type": "stdin_stdout", "input": "100\n", "output": "10000\n"}, {"type": "stdin_stdout", "input": "87\n", "output": "7569\n"}, {"type": "stdin_stdout", "input": "76\n", "output": "5776\n"}, {"type": "stdin_stdout", "input": "91\n", "output": "8281\n"}, {"type": "stdin_stdout", "input": "88\n", "output": "7744\n"}, {"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDetermine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane.\nYou can use the following theorem:\nTheorem: an N-sided polygon satisfying the con...
[{"type": "stdin_stdout", "input": "10\n100 100 100 100 100 100 100 100 100 100\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "10\n72 91 66 75 90 52 94 1 87 59\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "10\n11 11 11 11 99 11 11 11 11 11\n", "output": "No\n"}, {"type": "stdin_stdout", "input"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n - The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For...
[{"type": "stdin_stdout", "input": "3 3\n1 7\n3 2\n1 7\n", "output": "702\n"}, {"type": "stdin_stdout", "input": "3 3\n3 1\n2 1\n1 4\n", "output": "411\n"}, {"type": "stdin_stdout", "input": "2 3\n2 0\n2 0\n2 0\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "3 2\n2 1\n2 3\n", "output": "-1\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the sam...
[{"type": "stdin_stdout", "input": "200000 1\n", "output": "8000000000000000\n"}, {"type": "stdin_stdout", "input": "200000 2\n", "output": "2000000000000000\n"}, {"type": "stdin_stdout", "input": "200000 3\n", "output": "296287407496296\n"}, {"type": "stdin_stdout", "input": "100004 8\n", "output": "3906718787501\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven an integer N, find the base -2 representation of N.\nHere, S is the base -2 representation of N when the following are all satisfied:\n - S is a string consisting of 0 and 1.\n - Unless S = 0, the initial character ...
[{"type": "stdin_stdout", "input": "-1000000000\n", "output": "11000101101001010100101000000000\n"}, {"type": "stdin_stdout", "input": "-790013317\n", "output": "11010001001111101010111110001111\n"}, {"type": "stdin_stdout", "input": "1000000000\n", "output": "1001100111011111101111000000000\n"}, {"type": "stdin_stdout...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.\nThere are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks ...
[{"type": "stdin_stdout", "input": "1 100000\n1000000000 100000\n", "output": "100000000000000\n"}, {"type": "stdin_stdout", "input": "4 30\n6 18\n2 5\n3 10\n7 9\n", "output": "130\n"}, {"type": "stdin_stdout", "input": "2 5\n4 9\n2 4\n", "output": "12\n"}]
code_stdio