messages
listlengths
1
1
ground_truth
stringlengths
88
726k
dataset
stringclasses
1 value
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Monk is an extremely miser person. He hates spending money on things, be it for his own good or bad. But this time his friends have caught up with him, and are demanding a huge birthday treat. But, Monk is... well,...
[{"type": "stdin_stdout", "input": "78 30\n41 12\n6 28\n23 29\n44 32\n20 36\n31 28\n11 19\n41 4\n43 21\n20 16\n38 23\n18 29\n19 38\n10 10\n30 35\n16 30\n22 16\n42 35\n7 22\n36 27\n35 33\n37 21\n29 5\n24 26\n42 40\n35 18\n14 3\n14 46\n11 37\n10 9", "output": "1\n"}, {"type": "stdin_stdout", "input": "78 30\n41 12\n6 28\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRoy has a wooden log (tree trunk) of length L units. \nSince the log is too heavy for him to lift, he wants to cut it into pieces. \n\nHe can lift pieces of length 1 or 2 units. \n\nHe wonders in how many ways can he make...
[{"type": "stdin_stdout", "input": "19\n2\n10\n110\n1001\n10000\n100000\n1000000\n10000000\n100000000\n1000001000\n9\n96\n515\n11250\n151703\n999999\n10663009\n193683115\n1539023459", "output": "2 0\n6 4\n56 54\n501 500\n5001 4999\n50001 49999\n500001 499999\n5000001 4999999\n50000001 49999999\n500000501 500000499\n5 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is an integer N. Snuke will choose integers s_1, s_2, n_1, n_2, u_1, u_2, k_1, k_2, e_1, and e_2 so that all of the following six conditions will be satisfied:\n\n* 0 \\leq s_1 < s_2\n* 0 \\leq n_1 < n_2\n* 0 \\leq ...
[{"type": "stdin_stdout", "input": "4\n33\n1\n28\n0111010001", "output": "996765147\n0\n399637805\n501963061\n"}, {"type": "stdin_stdout", "input": "4\n33\n1\n28\n0111110001", "output": "996765147\n0\n399637805\n744953502\n"}, {"type": "stdin_stdout", "input": "4\n24\n2\n30\n0110110001", "output": "192839398\n0\n434820...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements?\n\nHere the bishop can on...
[{"type": "stdin_stdout", "input": "1001000000 1000000000", "output": "500500000000000000\n"}, {"type": "stdin_stdout", "input": "1001000000 1100000000", "output": "550550000000000000\n"}, {"type": "stdin_stdout", "input": "1001000010 1100000000", "output": "550550005500000000\n"}, {"type": "stdin_stdout", "input": "10...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are three airports A, B and C, and flights between each pair of airports in both directions.\n\nA one-way flight between airports A and B takes P hours, a one-way flight between airports B and C takes Q hours, and a...
[{"type": "stdin_stdout", "input": "001 -13 -101", "output": "-114\n"}, {"type": "stdin_stdout", "input": "111 -117 -5", "output": "-122\n"}, {"type": "stdin_stdout", "input": "011 -5 -101", "output": "-106\n"}, {"type": "stdin_stdout", "input": "000 -93 -7", "output": "-100\n"}, {"type": "stdin_stdout", "input": "010 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA university student, Takahashi, has to take N examinations and pass all of them. Currently, his readiness for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at l...
[{"type": "stdin_stdout", "input": "12\n757232153 372327760 440075441 195848680 354974235 458054863 463477172 740174259 615762794 632963102 529866931 64991604\n102338863 98239366 465611891 362739947 147060907 118867039 63189252 78303147 501410831 110823640 122948912 572905212", "output": "5\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N islands lining up from west to east, connected by N-1 bridges.\n\nThe i-th bridge connects the i-th island from the west and the (i+1)-th island from the west.\n\nOne day, disputes took place between some isla...
[{"type": "stdin_stdout", "input": "5 10\n1 2\n1 4\n1 4\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5", "output": "4\n"}, {"type": "stdin_stdout", "input": "5 10\n1 2\n1 3\n1 4\n1 5\n2 3\n2 4\n2 5\n3 5\n3 5\n4 5", "output": "3\n"}, {"type": "stdin_stdout", "input": "5 10\n1 2\n1 4\n1 4\n1 5\n2 3\n2 4\n2 5\n3 3\n3 5\n4 5", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer sequence of length N, a_1,a_2,...,a_N.\n\nFor each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing.\n\nAfter these operations, you select an integer X and count the ...
[{"type": "stdin_stdout", "input": "10\n-1 1 2 3 2 8 6 7 14 4", "output": "4\n"}, {"type": "stdin_stdout", "input": "10\n-1 2 1 5 8 2 8 4 20 0", "output": "4\n"}, {"type": "stdin_stdout", "input": "10\n-1 2 1 5 8 4 8 4 20 0", "output": "3\n"}, {"type": "stdin_stdout", "input": "10\n-1 2 1 5 8 4 8 4 17 0", "output": "3\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe king of a country loves prime numbers and gambling. The unit of currency in this country is called prime. As of November 1, 2007, Prime's cross-yen rate was just prime at 9973, so the King is overjoyed. Subsidiary coi...
[{"type": "stdin_stdout", "input": "4\n3 -1\n14 4\n3 24\n8 4\n1\n955049 29\n0", "output": "10\n4\n"}, {"type": "stdin_stdout", "input": "4\n0 -1\n13 1\n3 10\n8 3\n1\n964394 20\n0", "output": "6\n-1\n"}, {"type": "stdin_stdout", "input": "4\n0 -1\n18 2\n3 24\n8 4\n1\n190049 29\n0", "output": "10\n3\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn the Internet shopping site, on the same page as the product that the user is currently viewing, some other products that other users have bought in the past along with the product that they are currently viewing are di...
[{"type": "stdin_stdout", "input": "5 1\n3 eadrb knim naaabn\n3 llhm dornfmakes\n2 optato dareb inkk\n-1 cornglkaet arecd kmhm btuueq\n3 auotnp dbdqb", "output": "6\n2 dornfmakes\n2 llhm\ndornfmakes llhm\neadrb knim\neadrb naaabn\nknim naaabn\n"}, {"type": "stdin_stdout", "input": "5 1\n3 eadrb knin naaabn\n3 llhm dorn...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe rabbit, who successfully defeated the ambushed enemy, succeeded in advancing the hero into the enemy's castle. When the hero released the cats trapped in the castle dungeon, some of them were the hero's. It will help ...
[{"type": "stdin_stdout", "input": "2 1\n1.4305687758065515 0.5906592296173833 0.7172165110693307\n1.3875130101214004 1.4070366443867153 0.6797862263528347", "output": "1.176249354391\n"}, {"type": "stdin_stdout", "input": "2 1\n1.4305687758065515 0.9585354783138406 0.7172165110693307\n1.3875130101214004 1.407036644386...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou can obtain profits from foreign exchange margin transactions. For example, if you buy 1000 dollar at a rate of 100 yen per dollar, and sell them at a rate of 108 yen per dollar, you can obtain (108 - 100) × 1000 = 800...
[{"type": "stdin_stdout", "input": "6\n-10\n38\n2\n4\n-2\n8", "output": "48\n"}, {"type": "stdin_stdout", "input": "6\n-17\n38\n2\n4\n-2\n8", "output": "55\n"}, {"type": "stdin_stdout", "input": "6\n-17\n33\n2\n1\n-3\n8", "output": "50\n"}, {"type": "stdin_stdout", "input": "6\n-17\n61\n2\n1\n-3\n8", "output": "78\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInnopolis University scientists continue to investigate the periodic table. There are n·m known elements and they form a periodic table: a rectangle with n rows and m columns. Each element can be described by its coordina...
[{"type": "stdin_stdout", "input": "20 20 80\n5 3\n13 13\n8 5\n2 9\n12 16\n1 11\n15 11\n3 20\n10 7\n5 4\n11 2\n5 20\n14 8\n5 1\n8 13\n11 5\n19 2\n15 12\n12 7\n16 5\n17 3\n12 2\n17 16\n12 3\n12 6\n18 20\n2 20\n9 1\n5 10\n9 18\n17 1\n17 10\n20 1\n12 12\n19 14\n7 8\n2 19\n6 14\n5 6\n15 2\n18 14\n5 7\n14 14\n17 2\n20 20\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider a tree T (that is, a connected graph without cycles) with n vertices labelled 1 through n. We start the following process with T: while T has more than one vertex, do the following:\n\n * choose a random edge of...
[{"type": "stdin_stdout", "input": "50\n25 32\n25 36\n31 15\n40 18\n38 25\n44 15\n46 36\n6 15\n25 14\n15 7\n15 13\n41 40\n25 23\n1 40\n25 5\n3 25\n24 15\n40 22\n42 47\n36 42\n37 42\n11 42\n25 49\n42 35\n36 43\n36 30\n17 15\n4 36\n15 19\n12 25\n15 21\n36 50\n15 40\n20 36\n36 48\n8 15\n25 33\n36 10\n25 28\n2 42\n27 25\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence of integers a_1, a_2, ..., a_n. You need to paint elements in colors, so that: \n\n * If we consider any color, all elements of this color must be divisible by the minimal element of this color. ...
[{"type": "stdin_stdout", "input": "100\n94 83 55 57 63 89 73 59 75 97 77 54 77 81 70 81 99 52 88 76 98 88 79 67 76 80 89 50 60 60 53 83 96 87 75 99 61 91 75 85 88 80 90 54 84 88 98 93 69 97 93 54 83 59 57 92 88 78 53 55 99 63 60 70 61 52 60 55 100 85 80 58 53 97 59 61 50 90 75 85 86 63 91 96 67 68 86 96 79 98 51 83 82...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n[Æsir - CHAOS](https://soundcloud.com/kivawu/aesir-chaos)\n\n[Æsir - V.](https://soundcloud.com/kivawu/aesir-v)\n\n\"Everything has been planned out. No more hidden concerns. The condition of Cytus is also perfect.\n\nThe...
[{"type": "stdin_stdout", "input": "87\n1120 1120 1120 872 1120 731 3583 2815 4019 1291 4568 973 1120 1705 1120 822 203 1120 1120 1120 1120 4196 3166 4589 3030 1120 1120 1120 711 1120 500 1120 1120 3551 1120 1120 1120 1700 1120 1120 2319 4554 1120 1312 1120 1120 4176 1120 1120 3661 1120 1120 1120 1120 142 63 4125 1120 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a_1, a_2, ..., a_n. You can perform the following operation any number of times:\n\n * Choose a pair of two neighboring equal elements a_i = a_{i + 1} (if there is at least one such pair). \n * Re...
[{"type": "stdin_stdout", "input": "50\n1 1 1 1 1 2 1 1 2 1 2 1 1 1 2 1 1 1 2 2 2 1 1 2 2 1 2 1 1 2 2 1 1 2 2 1 1 1 1 1 2 2 2 2 2 1 2 2 2 1\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "50\n1 1 1 1 1 2 1 1 2 1 4 1 1 1 2 1 1 1 2 2 2 1 1 2 2 1 2 1 1 2 2 1 1 2 2 1 1 1 1 1 2 2 2 2 2 1 2 2 2 1\n", "output": "20\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a of length n, which initially is a permutation of numbers from 1 to n. In one operation, you can choose an index i (1 ≤ i < n) such that a_i < a_{i + 1}, and remove either a_i or a_{i + 1} from the...
[{"type": "stdin_stdout", "input": "4\n3\n1 2 3\n4\n3 1 2 4\n3\n2 3 1\n6\n2 4 12 1 3 10\n", "output": "YES\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "4\n3\n1 2 3\n4\n3 1 2 4\n3\n2 3 1\n6\n2 4 19 1 3 10\n", "output": "YES\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "4\n3\n1 2 3\n4\n3 1 2 4\n3\n2 3 1\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob play a game. The game consists of several sets, and each set consists of several rounds. Each round is won either by Alice or by Bob, and the set ends when one of the players has won x rounds in a row. For e...
[{"type": "stdin_stdout", "input": "12\n???1??????1?\n", "output": "12 6 4 3 2 2 1 1 1 1 1 1\n"}, {"type": "stdin_stdout", "input": "12\n?1?1????????\n", "output": "12 6 4 3 2 2 1 1 1 1 1 1\n"}, {"type": "stdin_stdout", "input": "12\n?1??????1???\n", "output": "12 6 4 3 2 2 1 1 1 1 1 1\n"}, {"type": "stdin_stdout", "in...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA matrix of size n × m is called nice, if all rows and columns of the matrix are palindromes. A sequence of integers (a_1, a_2, ... , a_k) is a palindrome, if for any integer i (1 ≤ i ≤ k) the equality a_i = a_{k - i + 1}...
[{"type": "stdin_stdout", "input": "9\n1 1\n132703760\n1 1\n33227322\n1 1\n943066084\n1 1\n729139464\n1 1\n450488051\n1 1\n206794512\n1 1\n372520051\n1 1\n552003271\n1 1\n319080560\n", "output": "0\n0\n0\n0\n0\n0\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "9\n1 1\n132703760\n1 1\n44528418\n1 1\n943066084\n1 1\n729...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given four integers n, c_0, c_1 and h and a binary string s of length n.\n\nA binary string is a string consisting of characters 0 and 1.\n\nYou can change any character of the string s (the string should be still...
[{"type": "stdin_stdout", "input": "7\n10 3 1 1\n1000000110\n1 10 1 1000\n0\n1 1 10 2\n1\n4 4 4 1\n1001\n1 1 1 1\n1\n2 1000 500 1000\n11\n3 500 500 1\n101\n", "output": "17\n10\n3\n16\n1\n1000\n1500\n"}, {"type": "stdin_stdout", "input": "7\n10 3 1 1\n1000000110\n1 10 1 1000\n0\n1 1 10 2\n1\n4 4 4 1\n1001\n1 0 1 1\n1\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence of n integers a_1, a_2, ..., a_n. Let us call an index j (2 ≤ j ≤ {{n-1}}) a hill if a_j > a_{{j+1}} and a_j > a_{{j-1}}; and let us call it a valley if a_j < a_{{j+1}} and a_j < a_{{j-1}}.\n\nLet...
[{"type": "stdin_stdout", "input": "4\n3\n3 14 1\n5\n3 3 2 2 4\n6\n1 6 2 2 2 10\n5\n1 12 1 4 2\n", "output": "0\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "4\n3\n3 14 1\n5\n3 3 2 1 4\n6\n1 6 2 2 2 10\n5\n1 12 1 4 2\n", "output": "0\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "4\n3\n1 5 0\n5\n5 4 2 2 -1\n6\n0 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet F_k denote the k-th term of Fibonacci sequence, defined as below:\n\n * F_0 = F_1 = 1\n * for any integer n ≥ 0, F_{n+2} = F_{n+1} + F_n\n\n\n\nYou are given a tree with n vertices. Recall that a tree is a connected...
[{"type": "stdin_stdout", "input": "13\n1 2\n1 7\n6 8\n1 11\n10 9\n8 10\n11 12\n11 13\n1 3\n3 10\n3 5\n4 12\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "13\n1 2\n1 7\n5 10\n2 11\n8 9\n8 10\n11 12\n11 13\n1 3\n3 4\n6 5\n4 6\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "13\n1 2\n1 7\n5 10\n2 11\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBaby Badawy's first words were \"AND 0 SUM BIG\", so he decided to solve the following problem. Given two integers n and k, count the number of arrays of length n such that:\n\n * all its elements are integers between 0 ...
[{"type": "stdin_stdout", "input": "10\n99281 18\n100000 16\n100000 15\n100000 14\n100000 6\n8823 3\n283 17\n299 18\n182 19\n1928 20\n", "output": "207307884\n95964640\n764800965\n570057652\n999657007\n829332965\n995193330\n759808819\n657208696\n258367760\n"}, {"type": "stdin_stdout", "input": "10\n99281 18\n100000 16\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a_1, a_2, ..., a_n consisting of n distinct integers. Count the number of pairs of indices (i, j) such that i < j and a_i ⋅ a_j = i + j.\n\nInput\n\nThe first line contains one integer t (1 ≤ t ≤ 10...
[{"type": "stdin_stdout", "input": "3\n2\n3 1\n3\n3 1 5\n5\n3 1 4 10 2\n", "output": "1\n2\n3\n"}, {"type": "stdin_stdout", "input": "3\n2\n2 1\n3\n4 2 5\n5\n3 1 4 10 2\n", "output": "0\n0\n3\n"}, {"type": "stdin_stdout", "input": "3\n2\n3 2\n3\n3 1 5\n5\n3 1 4 10 2\n", "output": "0\n2\n3\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMaxim has opened his own restaurant! The restaurant has got a huge table, the table's length is p meters.\n\nMaxim has got a dinner party tonight, n guests will come to him. Let's index the guests of Maxim's restaurant fr...
[{"type": "stdin_stdout", "input": "50\n15 28 34 29 17 21 20 34 37 17 10 20 37 10 18 25 31 25 16 1 37 27 39 3 5 18 2 32 10 35 20 17 29 20 3 29 3 25 9 32 37 5 25 23 25 33 35 8 31 29\n39\n", "output": "1.4997987526\n"}, {"type": "stdin_stdout", "input": "50\n15 28 34 29 17 21 20 34 37 17 10 20 37 10 18 25 31 25 16 1 37 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya and Vasya are playing a game. Petya's got n non-transparent glasses, standing in a row. The glasses' positions are indexed with integers from 1 to n from left to right. Note that the positions are indexed but the gl...
[{"type": "stdin_stdout", "input": "100 27 56\n58 18 50 41 33 37 14 87 77 73 61 53 15 8 70 68 45 96 54 78 39 120 51 60 80 12 93 99 20 92 17 79 4 13 62 91 69 29 49 36 98 34 90 35 84 64 38 83 28 89 165 94 9 16 26 48 10 57 23 75 27 88 44 21 72 76 30 43 32 2 71 24 100 1 31 99 42 40 47 55 86 85 66 5 52 43 95 74 11 19 7 82 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe king Copa often has been reported about the Codeforces site, which is rapidly getting more and more popular among the brightest minds of the humanity, who are using it for training and competing. Recently Copa underst...
[{"type": "stdin_stdout", "input": "01.01.98\n01.01.80\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "02.05.90\n08.03.50\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "29.02.80\n29.02.60\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "15.12.62\n17.12.21\n", "output": "YES\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA group of tourists is going to kayak and catamaran tour. A rented lorry has arrived to the boat depot to take kayaks and catamarans to the point of departure. It's known that all kayaks are of the same size (and each of ...
[{"type": "stdin_stdout", "input": "50 35\n2 93\n1 98\n2 62\n1 56\n1 86\n1 42\n2 67\n2 97\n2 59\n1 73\n1 83\n2 96\n1 20\n1 66\n1 84\n1 83\n1 91\n2 97\n1 81\n2 88\n2 63\n1 99\n2 57\n1 37\n1 74\n2 88\n1 30\n2 68\n1 100\n2 57\n1 87\n1 93\n1 83\n1 100\n1 91\n1 14\n1 38\n2 98\n2 85\n2 61\n1 44\n2 93\n2 66\n2 55\n2 74\n1 67\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev decided to build a house of cards. For that they've already found a hefty deck of n playing cards. Let's describe th...
[{"type": "stdin_stdout", "input": "1000000000000\n", "output": "272165"}, {"type": "stdin_stdout", "input": "225849940487\n", "output": "129343\n"}, {"type": "stdin_stdout", "input": "542905489591\n", "output": "200537\n"}, {"type": "stdin_stdout", "input": "376593918338\n", "output": "167021\n"}, {"type": "stdin_stdo...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem is used an extremely simplified version of HTML table markup. Please use the statement as a formal document and read it carefully.\n\nA string is a bHTML table, if it satisfies the grammar: \n \n \n ...
[{"type": "stdin_stdout", "input": "<table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td></td></tr></table></td></tr></table></td></tr></table></td></tr></table></...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo bored soldiers are playing card war. Their card deck consists of exactly n cards, numbered from 1 to n, all values are different. They divide cards between them in some manner, it's possible that they have different n...
[{"type": "stdin_stdout", "input": "10\n9 8 7 6 2 3 5 4 10 1\n1 9\n", "output": "103 1\n"}, {"type": "stdin_stdout", "input": "10\n1 10\n9 5 7 6 1 2 3 9 8 4\n", "output": "105 1\n"}, {"type": "stdin_stdout", "input": "10\n9 8 7 6 2 3 5 4 9 1\n1 10\n", "output": "105 2\n"}, {"type": "stdin_stdout", "input": "10\n8 1 6 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEdo has got a collection of n refrigerator magnets!\n\nHe decided to buy a refrigerator and hang the magnets on the door. The shop can make the refrigerator with any size of the door that meets the following restrictions:...
[{"type": "stdin_stdout", "input": "20 5\n1 12 21 22\n9 10 15 20\n10 12 12 20\n1 1 25 29\n5 10 21 22\n4 9 16 25\n12 10 14 24\n3 3 19 27\n3 4 23 28\n12 1 11 31\n9 14 17 18\n8 12 14 20\n8 11 18 19\n12 3 14 29\n7 8 13 22\n6 4 16 30\n11 3 13 27\n9 16 15 18\n6 13 14 21\n9 12 15 22\n", "output": "4\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two very long integers a, b (leading zeroes are allowed). You should check what number a or b is greater or determine that they are equal.\n\nThe input size is very large so don't use the reading of symbols ...
[{"type": "stdin_stdout", "input": "00011111111111111111111111111111111111000000000000000000000000000000000000000000000000000210000000000000000000000000000000000000000011000\n11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112091\n", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA remote island chain contains n islands, labeled 1 through n. Bidirectional bridges connect the islands to form a simple cycle — a bridge connects islands 1 and 2, islands 2 and 3, and so on, and additionally a bridge co...
[{"type": "stdin_stdout", "input": "10\n2 4 8 3 6 1 15 0 5 14\n3 6 1 10 0 5 7 2 14 4\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "10\n2 4 8 3 6 1 15 0 5 7\n3 6 1 10 0 5 7 2 14 4\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "10\n2 4 8 3 6 1 15 0 5 7\n3 6 1 10 0 5 7 2 22 4\n", "output": "NO\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGreatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such that both integers a and b are divisible by d. There are many efficient algorithms to find greatest common divisor ...
[{"type": "stdin_stdout", "input": "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "10000000000000000000000000000000000000000000000000000000000000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday Pari and Arya are playing a game called Remainders.\n\nPari chooses two positive integer x and k, and tells Arya k but not x. Arya have to find the value <image>. There are n ancient numbers c1, c2, ..., cn and Pari...
[{"type": "stdin_stdout", "input": "61 531012\n698043 698043 698043 963349 698043 698043 698043 963349 698043 698043 698043 963349 698043 698043 698043 698043 966694 698043 698043 698043 698043 698043 698043 636247 698043 963349 698043 698043 698043 698043 697838 698043 989253 698043 698043 966694 698043 698043 698043 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFind an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.\n\nInput\n\nThe only line contains odd integer n (1 ≤ n ≤ 49).\n\nOutput\n\nPrint n lines with n in...
[{"type": "stdin_stdout", "input": "53\n", "output": "2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 1 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102 104 \n106 108 110 112 114 116 118 120 122 124 126 128 130 132 134 136 138 140 142 144 146 148 150 152 154 3 5 7 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nArseniy is already grown-up and independent. His mother decided to leave him alone for m days and left on a vacation. She have prepared a lot of food, left some money and washed all Arseniy's clothes. \n\nTen minutes befo...
[{"type": "stdin_stdout", "input": "10 1 3\n2 2 1 3 1 2 1 2 2 2\n10 8\n9 6\n8 10\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10 1 3\n2 2 1 3 1 2 1 2 2 2\n10 8\n9 6\n3 10\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10 1 3\n2 2 1 3 1 2 1 2 3 2\n10 8\n9 6\n3 10\n", "output": "0\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA new dog show on TV is starting next week. On the show dogs are required to demonstrate bottomless stomach, strategic thinking and self-preservation instinct. You and your dog are invited to compete with other participan...
[{"type": "stdin_stdout", "input": "100 154\n132 88 72 98 184 47 176 56 68 168 137 88 188 140 198 18 162 139 94 133 90 91 37 156 196 28 186 1 51 47 4 92 18 51 37 121 86 195 153 195 183 191 15 24 104 174 94 83 102 61 131 40 149 46 22 112 13 136 133 177 3 175 160 152 172 48 44 174 77 100 155 157 167 174 64 109 118 194 12...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n incoming messages for Vasya. The i-th message is going to be received after ti minutes. Each message has a cost, which equals to A initially. After being received, the cost of a message decreases by B each min...
[{"type": "stdin_stdout", "input": "108 576 610 844 573\n242 134 45 515 430 354 405 179 174 366 155 4 300 176 96 36 508 70 75 316 118 563 55 340 128 214 138 511 507 437 454 478 341 443 421 573 270 362 208 107 256 471 436 378 336 507 383 352 450 411 297 34 179 551 119 524 141 288 387 9 283 241 304 214 503 559 416 447 49...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter passing a test, Vasya got himself a box of n candies. He decided to eat an equal amount of candies each morning until there are no more candies. However, Petya also noticed the box and decided to get some candies fo...
[{"type": "stdin_stdout", "input": "3345775397705614178\n", "output": "131353216887383264\n"}, {"type": "stdin_stdout", "input": "2750054323692292581\n", "output": "107965550311522536\n"}, {"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "39259424579862572\n"}, {"type": "stdin_stdout", "input": "128...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nChang loves solving mathematical puzzles. One day he was solving a puzzle. According to the problem statement of the puzzle: \"there are N integers. you are asked to delete some numbers such that the series obtained after...
[{"type": "stdin_stdout", "input": "6195\n6403 3644 845 9973 9342 2675 9819 6604 8763 5321 5530 1171 9770 7107 5727 677 2077 256 9514 9348 4285 4305 5069 1015 6477 1333 8896 2733 9938 1828 3545 9795 3713 9844 1641 9924 2241 9322 8702 2197 4817 835 7531 5806 6708 8260 8476 1684 6443 9140 1428 5324 5096 6609 1587 4859 26...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRakesh is very good in divisibility. He can easily tell the number is divisible by the given number or not. To make him work harder his teacher changed the question slightly. He will give the number and the other number w...
[{"type": "stdin_stdout", "input": "2\n1254756\n15\n1 7\n29490737\n132\n1 1\n\nSAMPEL", "output": "3\n0\n"}, {"type": "stdin_stdout", "input": "2\n2993708\n3\n1 7\n49610118\n250\n1 1\n\nSANPEL", "output": "13\n0\n"}, {"type": "stdin_stdout", "input": "2\n1323124\n10\n1 2\n130086802\n1\n2 9\n\nSAMPKE", "output": "0\n36\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Fajlu and Laal Baadshah are extremely good, and passionate Age of Empires 2 players. They're crazy about the game, and the passion they display for the game, if displayed for their semester exams - will make them t...
[{"type": "stdin_stdout", "input": "43\n7878 11534 994 594 238 1250\n907 25648 745 699 879 2683\n5983 25441 152 1125 329 2446\n9953 39484 664 217 183 803\n25088 23845 164 1000 625 1234\n20871 43034 798 473 321 2156\n17429 14156 492 470 862 358\n31262 31081 898 244 666 1707\n18780 19848 167 620 545 150\n15265 6082 995 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet there be a set of size N. \nPower set of a set S, denoted by P(S) is the set of all subsets of S, including the empty set and the S itself. \nSet A is said to be subset of set B if all elements of A are contained in B...
[{"type": "stdin_stdout", "input": "1\n151\n\nQNMSBC", "output": "748722695\n"}, {"type": "stdin_stdout", "input": "1\n107\n\nCBSMNQ", "output": "932478769\n"}, {"type": "stdin_stdout", "input": "1\n174\n\nCBNMSQ", "output": "410728596\n"}, {"type": "stdin_stdout", "input": "1\n247\n\nCBNMSQ", "output": "422521524\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC ...
[{"type": "stdin_stdout", "input": "5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a tree with N vertices. The vertices are numbered 1 to N, and the i-th edge connects Vertex a_i and Vertex b_i.\n\nTakahashi loves the number 3. He is seeking a permutation p_1, p_2, \\ldots , p_N of integers from...
[{"type": "stdin_stdout", "input": "5\n1 2\n1 3\n2 4\n3 5", "output": "2 1 4 5 3 "}, {"type": "stdin_stdout", "input": "5\n1 2\n2 3\n2 4\n3 5", "output": "2 1 5 3 4 "}, {"type": "stdin_stdout", "input": "5\n1 3\n2 3\n2 4\n3 5", "output": "2 5 1 4 3 "}, {"type": "stdin_stdout", "input": "5\n1 2\n4 3\n2 3\n2 5", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi and Aoki will take N exams numbered 1 to N. They have decided to compete in these exams. The winner will be determined as follows:\n\n* For each exam i, Takahashi decides its importance c_i, which must be an int...
[{"type": "stdin_stdout", "input": "10 1000\n451 4593 6263\n324 310 6991\n225 1431 7068\n133 1757 4072\n204 3676 4328\n840 6600 9080\n415 1545 15200\n709 5467 8674\n862 6504 9835\n283 4965 9980", "output": "2373\n"}, {"type": "stdin_stdout", "input": "10 1000\n451 4593 6263\n324 310 9662\n378 1431 7068\n120 1757 9218\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe server in company A has a structure where N devices numbered 1, 2, ..., N are connected with N - 1 cables. The i-th cable connects Device U_i and Device V_i. Any two different devices are connected through some number...
[{"type": "stdin_stdout", "input": "10\n5 4 15 5 1 5 -1 10 -10 -20\n10 4\n5 6\n8 1\n9 5\n7 1\n10 3\n2 8\n2 10\n9 1", "output": "1\n"}, {"type": "stdin_stdout", "input": "10\n3 4 9 6 1 10 -1 10 -10 -10\n7 4\n5 6\n8 1\n9 5\n7 1\n10 3\n2 8\n4 10\n9 2", "output": "4\n"}, {"type": "stdin_stdout", "input": "10\n3 4 9 6 0 10 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers a and b. Determine if a+b=15 or a\\times b=15 or neither holds.\n\nNote that a+b=15 and a\\times b=15 do not hold at the same time.\n\nConstraints\n\n* 1 \\leq a,b \\leq 15\n* All values in inpu...
[{"type": "stdin_stdout", "input": "-3 -5", "output": "*\n"}, {"type": "stdin_stdout", "input": "11 -1", "output": "x\n"}, {"type": "stdin_stdout", "input": "15 -1", "output": "x\n"}, {"type": "stdin_stdout", "input": "29 -1", "output": "x\n"}, {"type": "stdin_stdout", "input": "13 -1", "output": "x\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAtCoDeer the deer has N cards with positive integers written on them. The number on the i-th card (1≤i≤N) is a_i. Because he loves big numbers, he calls a subset of the cards good when the sum of the numbers written on th...
[{"type": "stdin_stdout", "input": "6 20\n10 4 5 10 25 2", "output": "0\n"}, {"type": "stdin_stdout", "input": "6 20\n10 4 5 10 25 3", "output": "0\n"}, {"type": "stdin_stdout", "input": "6 20\n10 4 3 10 25 2", "output": "3"}, {"type": "stdin_stdout", "input": "1 586\n-1 2 1 -2 5", "output": "1\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne of the simple ciphers is the affine cipher. First, replace the letters a to z with the numbers a = 0, b = 1, c = 2, ..., x = 23, y = 24, z = 25 and 0 to 25. Then replace the original alphabet with the following formul...
[{"type": "stdin_stdout", "input": "1\nx eazqyp pnop pngtg ye obmpngt xmybp mr lygw", "output": "p submit that there is another point of view\n"}, {"type": "stdin_stdout", "input": "1\nx pyqzae pnop pngtg ye obmpngt xmybp mr lygw", "output": "p timbus that there is another point of view\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have to organize a wedding party. The program of the party will include a concentration game played by the bride and groom. The arrangement of the concentration game should be easy since this game will be played to ma...
[{"type": "stdin_stdout", "input": "-2 1 -3 1 1 0 0 1\n1 -1 2 1 2 2 -1 3\n8", "output": "145\n0\n"}, {"type": "stdin_stdout", "input": "-2 1 0 1 1 0 1 3\n2 0 2 0 3 2 0 4\n10", "output": "173\n256\n"}, {"type": "stdin_stdout", "input": "-2 1 -2 1 1 0 1 2\n1 0 2 1 2 2 0 3\n5", "output": "145\n29\n"}, {"type": "stdin_stdo...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMs. Iyo Kiffa-Australis has a balance and only two kinds of weights to measure a dose of medicine.\n\nFor example, to measure 200mg of aspirin using 300mg weights and 700mg weights, she can put one 700mg weight on the sid...
[{"type": "stdin_stdout", "input": "700 300 200\n993 200 300\n244 200 500\n275 111 330\n275 010 385\n694 375 1747\n3 1 10010\n0 0 0", "output": "1 3\n100 495\n25 28\n21 55\n1 11\n163 297\n3336 2\n"}, {"type": "stdin_stdout", "input": "700 300 200\n500 283 300\n349 200 500\n275 110 330\n275 010 385\n1067 344 4002\n3 1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is a story in a depopulated area. In this area, houses are sparsely built along a straight road called Country Road. Until now, there was no electricity in this area, but this time the government will give us some ge...
[{"type": "stdin_stdout", "input": "6\n5 2\n10 30 40 70 100\n7 3\n3 5 10 53 21 26 28\n1 1\n100\n2 1\n-1 1000000\n3 5\n30 70 211\n6 5\n0 10 20 30 40 50", "output": "60\n-23\n0\n1000001\n0\n10\n"}, {"type": "stdin_stdout", "input": "6\n5 2\n10 30 40 70 100\n7 3\n3 5 10 53 21 26 28\n1 1\n100\n2 1\n-1 1000000\n3 5\n30 70 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe cave, called \"Mass of Darkness\", had been a agitating point of the evil, but the devil king and all of his soldiers were destroyed by the hero and the peace is there now.\n\nOne day, however, the hero was worrying a...
[{"type": "stdin_stdout", "input": "1 10\n3 3\nAAA\nABA\nCCC\n3\nA 0\nB 5\nC 14\n3\nD 2\nR 1\nU 2\n5\n10\n10\n10\n10\n10\n110 100\n10 10\nTHIRISAPEN\nTHISISAPEN\nTHISISAPEN\nTHISISAPEN\nTHISISAPEN\nTHISISAPEN\nTHISJSAPEN\nTHISISAPEN\nNEPASISIHT\nTHISISAPEN\n8\nT 0\nH 2\nJ 2\nS 3\nA 4\nP 5\nE 6\nN 7\n9\nR 1\nD 1\nR 10\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTaro is an elementary school student and has graffiti on the back of the leaflet. At one point, Taro came up with the next game.\n\n* Write n × n grid-like squares.\n* The initial state of each square is either marked or ...
[{"type": "stdin_stdout", "input": "4\n1 2 3 4\n1 2 3 4\n1 2 3 4\n2 2 3 4\n1 2 3 4\n1 2 3 4\n1 2 3 4\n1 2 3 4\noooo\noooo\noooo\noooo", "output": "30\n12\n1 1 erase\n1 2 erase\n1 3 erase\n2 1 erase\n2 2 erase\n2 4 erase\n3 1 erase\n3 3 erase\n3 4 erase\n4 2 erase\n4 3 erase\n4 4 erase\n"}, {"type": "stdin_stdout", "inp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nE-Election campaign\n\nProblem Statement\n\nYou are a supporter of Mr. X, a candidate for the next election. Mr. X is planning a street speech in front of the station and intends to give a speech in a place that can be se...
[{"type": "stdin_stdout", "input": "2 1\n5\n10 4\n102 1\n15 19\n5 20\n-1 10\n20 7", "output": "1\n"}, {"type": "stdin_stdout", "input": "2 1\n5\n18 4\n102 1\n15 19\n5 20\n-1 10\n20 7", "output": "1\n"}, {"type": "stdin_stdout", "input": "1 1\n5\n18 4\n102 1\n15 19\n5 20\n-1 10\n20 7", "output": "1\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nLet $ f (x) $ be the sum of each digit when the non-negative integer $ x $ is expressed in binary.\nGiven a positive integer $ N $, output the largest of $ f (0) $, $ f (1) $, ..., $ f (N) $.\n\n\nExample of ca...
[{"type": "stdin_stdout", "input": "10830", "output": "13\n"}, {"type": "stdin_stdout", "input": "1663", "output": "10\n"}, {"type": "stdin_stdout", "input": "2604", "output": "11\n"}, {"type": "stdin_stdout", "input": "5020", "output": "12\n"}, {"type": "stdin_stdout", "input": "170", "output": "7\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour task is to implement a double linked list.\n\nWrite a program which performs the following operations:\n\n* insert x: insert an element with key x into the front of the list.\n* delete x: delete the first element whi...
[{"type": "stdin_stdout", "input": "9\ninsert 19\ninsert 2\ninsert 2\ninsert 0\ndelete 3\ninsert 6\ndelete 5\ndeleteFirst\ndeleteLast", "output": "0 2 2\n"}, {"type": "stdin_stdout", "input": "9\ninsert 19\ninsert 3\ninsert 3\ninsert 0\ndelete 6\ninsert 6\ndeldte 5\ndeleteFirst\ndeleteLast", "output": "0 3 3\n"}, {"typ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to 10^9, and the columns are numbered from left to right from 1 to 10^9. Therefore, for each cell of the chessboar...
[{"type": "stdin_stdout", "input": "0 5\n1 192023486 84774294\n243235878 312125306 50510976\n326016273 338641867 50510976\n570999440 445224816 125759940\n456157384 569789185 50510976\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 5\n1 192023486 50510976\n243235878 312125306 50510976\n326016273 338641867 505...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMaksim walks on a Cartesian plane. Initially, he stands at the point (0, 0) and in one move he can go to any of four adjacent points (left, right, up, down). For example, if Maksim is currently at the point (0, 0), he can...
[{"type": "stdin_stdout", "input": "39\n27 47\n30 9\n18 28\n49 16\n10 12\n25 13\n44 11\n13 9\n3 8\n30 2\n8 30\n38 32\n7 29\n38 43\n27 37\n6 13\n21 25\n31 18\n17 26\n51 52\n27 40\n10 43\n50 27\n41 41\n2 11\n38 45\n37 43\n20 52\n36 11\n43 46\n4 39\n22 32\n42 11\n8 37\n9 17\n38 8\n41 1\n24 50\n47 7\n", "output": "861\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInternational Coding Procedures Company (ICPC) writes all its code in Jedi Script (JS) programming language. JS does not get compiled, but is delivered for execution in its source form. Sources contain comments, extra whi...
[{"type": "stdin_stdout", "input": "8\n< > << >> in out fun in>>out\n6\n# let's rock\nin>>out in >> out inout>>outin bin>>out # yay!\nfun>>in>>out funin>>out out>>in <in> > <out>\nin> >> >>> >>>> >>>>>out\n# what's going on here?\n<> <> <> <> <fun> <funfun> <not so fun>\n", "output": "in>>outin>> out a>>b c>>out fun>>i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have a garland consisting of n lamps. Each lamp is colored red, green or blue. The color of the i-th lamp is s_i ('R', 'G' and 'B' — colors of lamps in the garland).\n\nYou have to recolor some lamps in this garland (...
[{"type": "stdin_stdout", "input": "500\nRRGBBGGRRGGRRBGRGGGBRBBRRRGRBBGBGGGRBRGGGRBGBGRRRRGRBGBBBBRRGRGRBRBBRBGRRRRGGBRBRRRBGGRBGGGBRRGGGGBBRRBGGBGRBRRGGBRGGGRRGBGGRBGGGBBRRGBBGBGRBGRGRRRGGBGRGRRGBGBRGBRGRBGGBGRGGRRBGBRBBBBRBRRGBGGRGBBBGGGGGGRBGBBBBRBBRBGRBRGRGBBRRGBBGGRRBRRRGBGRGRRBBRRBRGGRRRRBRRGRBGGGBRRRRGBBRBGBRRR...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string, consisting of lowercase Latin letters.\n\nA pair of neighbouring letters in a string is considered ugly if these letters are also neighbouring in a alphabet. For example, string \"abaca\" contains ...
[{"type": "stdin_stdout", "input": "100\nc\nda\na\nee\ned\ndb\nece\nab\nabe\nd\neeb\na\nbab\nbbd\nc\ncab\nc\nbda\ndb\ncca\nbcd\nbae\neb\nde\ndc\naee\nada\nba\nab\nde\ned\nae\nbc\nbec\ndae\nc\nb\ndab\nd\na\ndbd\nda\nb\ne\nde\nbe\nc\na\nb\nc\nbac\nee\nb\ncce\nc\nde\nc\ndee\ned\ncb\nb\ndc\ncc\na\neb\nec\nbcd\na\ndc\nf\nce...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice bought a Congo Prime Video subscription and was watching a documentary on the archaeological findings from Factor's Island on Loch Katrine in Scotland. The archaeologists found a book whose age and origin are unknow...
[{"type": "stdin_stdout", "input": "cbabacacacbabacababcabcbabacababcbcabacacacbababcbcacacbcbabcbcbabacacacabacbcbacacbcabacbcabcbabcbabababcaca\n", "output": "cabaaacbabcababcbcaacbabccaaaccbabbccaccbbabccaaaccbabcaacbcbabacbabcaaabac"}, {"type": "stdin_stdout", "input": "cbabacacacb`bacababcabcbabacababcbcabacacacba...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the size of the input.\n\nYou are given a string s consisting of n characters, each character is 'R', 'G' or 'B'.\n\nYou are also given an integer k. Your task is to c...
[{"type": "stdin_stdout", "input": "3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR\n", "output": "1\n0\n3\n"}, {"type": "stdin_stdout", "input": "3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBRBR\n", "output": "1\n0\n2\n"}, {"type": "stdin_stdout", "input": "3\n5 3\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR\n", "output": "1\n0\n3\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAuthors have come up with the string s consisting of n lowercase Latin letters.\n\nYou are given two permutations of its indices (not necessary equal) p and q (both of length n). Recall that the permutation is the array o...
[{"type": "stdin_stdout", "input": "6 5\n5 6 1 2 3 4\n6 5 1 2 3 4\n", "output": "YES\nbcdeaa\n"}, {"type": "stdin_stdout", "input": "5 2\n5 2 4 3 1\n5 4 3 1 2\n", "output": "YES\nbbbba\n"}, {"type": "stdin_stdout", "input": "5 1\n1 3 2 4 5\n2 3 5 1 4\n", "output": "YES\naaaaa\n"}, {"type": "stdin_stdout", "input": "5 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider a tunnel on a one-way road. During a particular day, n cars numbered from 1 to n entered and exited the tunnel exactly once. All the cars passed through the tunnel at constant speeds.\n\nA traffic enforcement cam...
[{"type": "stdin_stdout", "input": "7\n5 2 3 6 7 1 4\n2 3 6 7 1 4 5\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "5\n3 5 2 1 4\n4 3 2 5 1\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "2\n1 2\n1 2\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "2\n1 2\n2 1\n", "output": "1\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBob watches TV every day. He always sets the volume of his TV to b. However, today he is angry to find out someone has changed the volume to a. Of course, Bob has a remote control that can change the volume.\n\nThere are ...
[{"type": "stdin_stdout", "input": "3\n-1 -1\n13 93\n3 2\n", "output": "0\n16\n1\n"}, {"type": "stdin_stdout", "input": "3\n-1 -1\n15 93\n3 2\n", "output": "0\n17\n1\n"}, {"type": "stdin_stdout", "input": "3\n-1 -1\n19 93\n3 2\n", "output": "0\n16\n1\n"}, {"type": "stdin_stdout", "input": "3\n-1 -1\n9 93\n3 6\n", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider the following experiment. You have a deck of m cards, and exactly one card is a joker. n times, you do the following: shuffle the deck, take the top card of the deck, look at it and return it into the deck.\n\nLe...
[{"type": "stdin_stdout", "input": "569716410 849619604 5000\n", "output": "122094144\n"}, {"type": "stdin_stdout", "input": "232213466 585535513 4789\n", "output": "454306758\n"}, {"type": "stdin_stdout", "input": "251134010 189925189 5000\n", "output": "103457138\n"}, {"type": "stdin_stdout", "input": "588636954 7308...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n water tanks in a row, i-th of them contains a_i liters of water. The tanks are numbered from 1 to n from left to right.\n\nYou can perform the following operation: choose some subsegment [l, r] (1≤ l ≤ r ≤ n),...
[{"type": "stdin_stdout", "input": "65\n1000000 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\n", "output": "15416.615384615392\n15416.615384615392\n15416.615384615392\n15416.61538461...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA bracketed sequence is called correct (regular) if by inserting \"+\" and \"1\" you can get a well-formed mathematical expression from it. For example, sequences \"(())()\", \"()\" and \"(()(()))\" are correct, while \")...
[{"type": "stdin_stdout", "input": "101\n(())))))()))()())(()))((())))((())(()()()(()()((()()((()((())))((()))()(())(()(())((()))(()))()(((()(\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "101\n(())))))()))()())(()))((())))((())(()()()(()(*((()()((()((())))((()))()(())(()(())((()))(()))()(((()(\n", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKoa the Koala and her best friend want to play a game.\n\nThe game starts with an array a of length n consisting of non-negative integers. Koa and her best friend move in turns and each have initially a score equal to 0. ...
[{"type": "stdin_stdout", "input": "4\n5\n4 1 5 1 4\n4\n1 0 1 12\n1\n0\n2\n5 4\n", "output": "LOSE\nWIN\nDRAW\nWIN\n"}, {"type": "stdin_stdout", "input": "4\n5\n4 1 4 1 4\n4\n1 0 1 12\n1\n0\n2\n5 0\n", "output": "LOSE\nWIN\nDRAW\nWIN\n"}, {"type": "stdin_stdout", "input": "4\n5\n4 1 4 1 4\n4\n1 0 1 12\n1\n0\n2\n5 4\n",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nChaneka has a hobby of playing with animal toys. Every toy has a different fun value, a real number. Chaneka has four boxes to store the toys with specification: \n\n * The first box stores toys with fun values in range ...
[{"type": "stdin_stdout", "input": "2\n4 0 0 1\n0 0 1 0\n", "output": "Tidak Tidak Tidak Ya\nTidak Tidak Ya Tidak\n"}, {"type": "stdin_stdout", "input": "2\n4 0 0 1\n0 1 1 0\n", "output": "Tidak Tidak Tidak Ya\nTidak Ya Tidak Tidak\n"}, {"type": "stdin_stdout", "input": "2\n2 0 0 1\n0 1 0 0\n", "output": "Tidak Tidak T...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a given sequence of distinct non-negative integers (b_1, b_2, ..., b_k) we determine if it is good in the following way:\n\n * Consider a graph on k nodes, with numbers from b_1 to b_k written on them.\n * For every...
[{"type": "stdin_stdout", "input": "109\n74 18 237 179 195 112 156 11 72 68 173 202 78 250 224 251 107 55 186 144 57 62 28 210 132 64 93 6 211 0 174 163 248 226 167 246 46 102 253 180 121 56 151 35 150 254 168 201 242 118 190 158 196 30 75 116 187 96 215 244 192 73 12 175 33 222 131 256 181 230 114 165 128 234 63 90 44...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob are going to celebrate Christmas by playing a game with a tree of presents. The tree has n nodes (numbered 1 to n, with some node r as its root). There are a_i presents are hanging from the i-th node.\n\nBef...
[{"type": "stdin_stdout", "input": "4 3\n1 2\n1 3\n3 4\n1000000000 999999999 0 1\n", "output": "0 1 0 1 "}, {"type": "stdin_stdout", "input": "4 3\n1 2\n1 3\n3 4\n1000000000 999999999 0 2\n", "output": "0 1 0 1\n"}, {"type": "stdin_stdout", "input": "4 3\n1 2\n1 3\n1 4\n1000000000 999999999 0 2\n", "output": "0 0 0 0\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are playing the game \"Arranging The Sheep\". The goal of this game is to make the sheep line up. The level in the game is described by a string of length n, consisting of the characters '.' (empty space) and '*' (she...
[{"type": "stdin_stdout", "input": "5\n6\n**.*..\n5\n*****\n3\n.*.\n3\n...\n10\n*.*...*.**\n", "output": "\n1\n0\n0\n0\n9\n"}, {"type": "stdin_stdout", "input": "5\n6\n..*.**\n5\n*****\n3\n.*.\n3\n...\n10\n*.*...*.**\n", "output": "1\n0\n0\n0\n9\n"}, {"type": "stdin_stdout", "input": "5\n6\n**..*.\n5\n*****\n3\n.*.\n3\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTo get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, and then sell the bought it...
[{"type": "stdin_stdout", "input": "5 10 15\nDdunkjly\n13 12 4\n83 26 1\n63 42 3\n83 22 2\n57 33 0\n59 10 1\n89 31 1\n57 17 2\n98 79 5\n46 41 3\nFbpbc\n28 21 0\n93 66 5\n66 21 0\n68 58 0\n59 17 3\n57 23 1\n72 71 1\n55 51 2\n58 40 5\n70 67 2\nKeiotmh\n73 44 4\n98 14 0\n19 7 0\n55 10 5\n30 25 4\n66 48 2\n66 51 4\n82 79 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLearn, learn and learn again — Valera has to do this every day. He is studying at mathematical school, where math is the main discipline. The mathematics teacher loves her discipline very much and tries to cultivate this ...
[{"type": "stdin_stdout", "input": "100\n-88 -5 -96 -45 -11 -81 -68 -58 -73 -91 -27 -23 -89 -34 -51 -46 -70 -95 -9 -77 -99 -61 -74 -98 -88 -44 -61 -88 -35 -71 -43 -23 -25 -98 -23 0 -1 -80 -52 -47 -26 -92 -82 -73 -45 -37 -15 -49 -9 -7 -47 0 -6 -76 -91 -20 -58 -46 -74 -57 -54 -39 -61 -18 -65 -61 -19 -64 -93 -29 -82 -25 -...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day, little Vasya found himself in a maze consisting of (n + 1) rooms, numbered from 1 to (n + 1). Initially, Vasya is at the first room and to get out of the maze, he needs to get to the (n + 1)-th one.\n\nThe maze i...
[{"type": "stdin_stdout", "input": "129\n1 1 3 3 1 4 7 4 3 5 8 11 3 9 15 4 11 17 1 6 18 9 11 13 17 22 8 18 26 13 16 20 3 16 35 26 23 28 27 30 39 29 43 8 14 6 17 32 26 31 2 18 3 47 52 21 57 1 35 35 53 47 16 26 30 65 48 2 32 11 10 5 4 1 4 53 71 21 53 8 58 49 17 6 19 80 1 49 43 60 12 60 35 25 86 45 47 97 52 74 10 91 93 31...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nStudent Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. ...
[{"type": "stdin_stdout", "input": "1\n1000000000 999999999\n", "output": "999999999\n"}, {"type": "stdin_stdout", "input": "1\n1010000000 999999999\n", "output": "999999999\n"}, {"type": "stdin_stdout", "input": "1\n1010000000 498441652\n", "output": "498441652\n"}, {"type": "stdin_stdout", "input": "1\n1000000000 115...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, d...
[{"type": "stdin_stdout", "input": "19\n1 13\n0 0\n1 9\n1 11\n1 11\n2 3\n2 30\n0 -1\n1 5\n1 2\n0 0\n5 29\n1 6\n2 11\n0 0\n0 0\n0 0\n0 -1\n2 13\n", "output": "10\n0 13\n2 9\n3 11\n4 11\n8 5\n12 6\n13 11\n5 11\n6 18\n11 18\n\n"}, {"type": "stdin_stdout", "input": "19\n1 13\n0 0\n1 9\n1 11\n1 11\n2 3\n2 30\n0 -1\n1 5\n1 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day Vasya was sitting on a not so interesting Maths lesson and making an origami from a rectangular a mm × b mm sheet of paper (a > b). Usually the first step in making an origami is making a square piece of paper f...
[{"type": "stdin_stdout", "input": "1000000000000 999999999999\n", "output": "1000000000000\n"}, {"type": "stdin_stdout", "input": "1000000000000 999999999998\n", "output": "500000000000\n"}, {"type": "stdin_stdout", "input": "1370863279309 1265273992487\n", "output": "2167\n"}, {"type": "stdin_stdout", "input": "10555...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVanya got bored and he painted n distinct points on the plane. After that he connected all the points pairwise and saw that as a result many triangles were formed with vertices in the painted points. He asks you to count ...
[{"type": "stdin_stdout", "input": "62\n-53 -58\n29 89\n-92 15\n-91 -19\n96 23\n-1 -57\n-83 11\n56 -95\n-39 -47\n-75 77\n52 -95\n-13 -12\n-51 80\n32 -78\n94 94\n-51 81\n53 -28\n-83 -78\n76 -25\n91 -60\n-40 -27\n55 86\n-26 1\n-41 89\n61 -23\n81 31\n-21 82\n-12 47\n20 36\n-95 54\n-81 73\n-19 -83\n52 51\n-60 68\n-58 35\n6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA string is called palindrome if it reads the same from left to right and from right to left. For example \"kazak\", \"oo\", \"r\" and \"mikhailrubinchikkihcniburliahkim\" are palindroms, but strings \"abb\" and \"ij\" ar...
[{"type": "stdin_stdout", "input": "wrwrwfrrfrffrrwwwffffwrfrrwfrrfrwwfwfrwfwfwffwrrwfrrrwwwfrrrwfrrfwrwwrwrrrffffwrrrwrwfffwrffrwwwrwww\n", "output": "fffffffffffffffrrrrrrrrrrrrrrrrrrwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrrrrrrrrrrrrrrrrrrfffffffffffffff\n"}, {"type": "stdin_stdout", "input": "wrwrwfwrfrffrrwwrffffwrfrrw...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe all know the impressive story of Robin Hood. Robin Hood uses his archery skills and his wits to steal the money from rich, and return it to the poor.\n\nThere are n citizens in Kekoland, each person has ci coins. Each ...
[{"type": "stdin_stdout", "input": "123 54564\n38 44 41 42 59 3 95 15 45 32 44 69 35 83 94 57 65 85 64 47 24 20 34 86 26 91 98 12 36 96 80 4 70 40 95 38 70 22 58 50 34 84 80 45 14 60 61 43 11 56 19 59 50 63 21 15 97 98 27 13 9 71 32 18 90 10 2 99 75 87 74 83 79 37 89 3 49 27 92 95 49 1 26 50 72 75 81 37 60 98 28 28 10 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlyona has a tree with n vertices. The root of the tree is the vertex 1. In each vertex Alyona wrote an positive integer, in the vertex i she wrote ai. Moreover, the girl wrote a positive integer to every edge of the tree...
[{"type": "stdin_stdout", "input": "10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n1 1000000000\n2 1000000000\n3 1000000000\n4 1000000000\n5 1000000000\n6 1000000000\n7 1000000000\n8 1000000000\n9 1000000000\n", "output": "1 1 1 1 1 1 1 1 1 0 "}, {"typ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers n and k. Find k-th smallest divisor of n, or report that it doesn't exist.\n\nDivisor of n is any such natural number, that n can be divided by it without remainder.\n\nInput\n\nThe first line c...
[{"type": "stdin_stdout", "input": "866421317361600 26880\n", "output": "866421317361600"}, {"type": "stdin_stdout", "input": "999999961946176 63\n", "output": "999999961946176"}, {"type": "stdin_stdout", "input": "100000000000000 200\n", "output": "160000000000\n"}, {"type": "stdin_stdout", "input": "999999999999989 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAnton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes.\n\nAnton has n variants when he will attend chess classes, i-th variant is given by a ...
[{"type": "stdin_stdout", "input": "5\n999612104 999858319\n68705639 989393889\n297814302 732073321\n577979321 991069087\n601930055 838139173\n14\n109756300 291701768\n2296272 497162877\n3869085 255543683\n1508007702 820993688\n54005870 912134860\n1052 99089\n477043210 1124154939\n233115268 920170255\n575163323 7569045...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNot so long ago the Codecraft-17 contest was held on Codeforces. The top 25 participants, and additionally random 25 participants out of those who got into top 500, will receive a Codeforces T-shirt.\n\nUnfortunately, you...
[{"type": "stdin_stdout", "input": "101 14627 14479\n", "output": "21\n"}, {"type": "stdin_stdout", "input": "186 18666 18329\n", "output": "23"}, {"type": "stdin_stdout", "input": "406 16527 16314\n", "output": "22"}, {"type": "stdin_stdout", "input": "424 10906 10346\n", "output": "13"}, {"type": "stdin_stdout", "inp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the...
[{"type": "stdin_stdout", "input": "20 20\n-1012 625 39 -1747 -1626 898 -1261 180 -876 -1417 -1853 -1510 -1499 -561 -1824 442 -895 13 1857 1860\n-1269013 -1270956 -1264151 -1266004 -1268121 -1258341 -1269574 -1271851 -1258302 -1271838 -1260049 -1258966 -1271398 -1267514 -1269981 -1262038 -1261675 -1262734 -1260777 -126...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou all know that the Library of Bookland is the largest library in the world. There are dozens of thousands of books in the library.\n\nSome long and uninteresting story was removed...\n\nThe alphabet of Bookland is so l...
[{"type": "stdin_stdout", "input": "10 10\n8 1 1 6 10 2 2 9 7\n6 2 7 1 9 5 10\n1 5\n7 3 6 9 6 3 7 6\n10 3 9 10 3 6 7 10 6 9 6\n10 4 4 9 8 2 10 3 6 2 9\n8 4 8 6 4 6 4 8 6\n2 7 5\n6 8 6 2 1 9 8\n3 10 2 10\n", "output": "Yes\n3\n1 2 5 "}, {"type": "stdin_stdout", "input": "10 10\n8 1 1 6 10 2 2 9 7\n6 2 7 1 9 5 10\n1 5\n7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne Martian boy called Zorg wants to present a string of beads to his friend from the Earth — Masha. He knows that Masha likes two colours: blue and red, — and right in the shop where he has come, there is a variety of ad...
[{"type": "stdin_stdout", "input": "50 161245081749292\n", "output": "00101100010110000001101000110001001101000011000011\n"}, {"type": "stdin_stdout", "input": "50 250144743882708\n", "output": "01010101010010111011000010110101001100000110000101\n"}, {"type": "stdin_stdout", "input": "50 264823400156610\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPushok the dog has been chasing Imp for a few hours already.\n\n<image>\n\nFortunately, Imp knows that Pushok is afraid of a robot vacuum cleaner. \n\nWhile moving, the robot generates a string t consisting of letters 's'...
[{"type": "stdin_stdout", "input": "100\nh\nshh\nh\nhs\nshh\nhh\nh\nssh\nhss\nh\nhh\nh\nh\nh\nh\nh\nh\nh\nh\nh\nhh\nh\nh\nh\nh\nhhh\nh\nh\nhhh\nsh\nhh\nhs\nh\nh\nshs\nh\nh\nh\nshh\nsh\nhs\nh\nh\nh\nhhh\nh\nhhs\nhh\nh\nssh\nh\nh\nhh\nsh\nh\nhss\nh\nhh\nsh\nhh\nhh\nhhh\nhs\nh\nh\nh\nshs\nhs\nshs\nsh\nh\nh\nhs\nh\nh\nh\nh...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n dormitories in Berland State University, they are numbered with integers from 1 to n. Each dormitory consists of rooms, there are a_i rooms in i-th dormitory. The rooms in i-th dormitory are numbered from 1 to...
[{"type": "stdin_stdout", "input": "3 10\n1010000000 1000000000 1000000000\n330201655 567869543 1000000000 1000000001 1500000000 1999999999 2000000000 2000000001 2754432345 3000000000\n", "output": "1 330201655\n1 567869543\n1 1000000000\n1 1000000001\n2 490000000\n2 989999999\n2 990000000\n2 990000001\n3 744432345\n3 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is a fact for almost all the students out there that Mathematics subject is a very fearful subject for them.\n\nAnd no wonder this fact is also true for our friend Primo. But to challenge his fear he went to the Math...
[{"type": "stdin_stdout", "input": "3\n113\n111\n1100\n\nFAONLS", "output": "-1 -1\n2 109\n523 577\n"}, {"type": "stdin_stdout", "input": "3\n104\n100\n1100\n\nSANPLE", "output": "43 61\n47 53\n523 577\n"}, {"type": "stdin_stdout", "input": "3\n100\n100\n1100\n\nSANPLE", "output": "47 53\n47 53\n523 577\n"}, {"type": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nI and my flatmate ,Sayan, went to see the magnificient fountains in the Jubilee park on 3rd March.It was the eve of the 184rd Bithday of the late Mr. J.N.Tata and the fountains were set to blow at regular intervals.\nI sa...
[{"type": "stdin_stdout", "input": "3\n402\n891 2508 4058 9592 3556 7829 9775 1638 6683 2202 4077 669 4776 3487 6231 5125 6495 9302 2328 6610 2696 3979 1937 6755 3373 6593 4975 8243 2180 9309 4923 4432 5621 5864 9653 3440 5886 7867 6927 5999 223 613 6208 9545 4036 806 8199 8377 2232 9144 6137 1237 9432 5986 3896 6935 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPuchi hates to carry luggage, but unfortunately he got a job to carry the luggage of his N friends in office. Each day, one of his N friends, gives him the luggage of a particular weight to carry. You will be given the w...
[{"type": "stdin_stdout", "input": "1\n4\n2\n1\n4\n3\n\nSAMPLE", "output": "1 0 1 0\n"}]
code_stdio