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\nOne day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.\n\nVitaly...
[{"type": "stdin_stdout", "input": "100 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 0\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n0 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 0\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a_1, a_2, \\dots, a_n$. All $a_i$ are pairwise distinct.\n\nLet's define function $f(l, r)$ as follows: let's define array $b_1, b_2, \\dots, b_{r - l + 1}$, where $b_i = a_{l - 1 + i}$; sort ar...
[{"type": "stdin_stdout", "input": "3\n123456789 214365879 987654321\n", "output": "582491518\n"}, {"type": "stdin_stdout", "input": "2\n1 1000000000\n", "output": "999999988\n"}, {"type": "stdin_stdout", "input": "8\n6 4 5 8 2 9 10 7\n", "output": "2432\n"}, {"type": "stdin_stdout", "input": "8\n3 8 10 6 7 5 2 9\n", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOld timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?\n\nThere are $n$ stu...
[{"type": "stdin_stdout", "input": "20 4\n1\n1\n1\n1\n1\n2\n2\n2\n2\n2\n3\n3\n3\n3\n3\n4\n4\n4\n4\n4\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "16 4\n1\n1\n1\n1\n1\n2\n2\n2\n2\n2\n3\n3\n3\n3\n4\n4\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "16 6\n1\n1\n1\n2\n2\n2\n3\n3\n3\n4\n4\n4\n5\n5\n6\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSome large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the efficiency of the SMSC. \n\nFor...
[{"type": "stdin_stdout", "input": "23\n5 1045\n12 703\n16 26\n23 3384\n28 4563\n30 4501\n34 1033\n35 1393\n36 4095\n37 1279\n38 1787\n39 770\n40 5362\n41 4569\n42 3148\n43 2619\n44 5409\n45 3919\n46 732\n47 1297\n48 4512\n49 3231\n50 5169\n", "output": "64551 64501\n"}, {"type": "stdin_stdout", "input": "10\n964416 39...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe administration of the Tomsk Region firmly believes that it's time to become a megacity (that is, get population of one million). Instead of improving the demographic situation, they decided to achieve its goal by expa...
[{"type": "stdin_stdout", "input": "30 505231\n-18 16 88130\n-10 16 15693\n16 -32 660\n-27 17 19042\n30 -37 6680\n36 19 299674\n-45 21 3300\n11 27 76\n-49 -34 28649\n-1 11 31401\n25 42 20858\n-40 6 455660\n-29 43 105001\n-38 10 6042\n19 -45 65551\n20 -9 148533\n-5 -24 393442\n-43 2 8577\n-39 18 97059\n12 28 39189\n35 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of t_{i} minutes. Eugeny listens to each song, perhaps more than once. He listens to song number i c_{i} times....
[{"type": "stdin_stdout", "input": "10 10\n3 1\n2 7\n5 1\n7 2\n9 10\n9 5\n2 5\n4 10\n9 9\n1 9\n26 34 37 141 146 201 239 245 296 299\n", "output": "4\n4\n5\n6\n6\n8\n9\n9\n9\n9\n"}, {"type": "stdin_stdout", "input": "9 9\n2 5\n7 1\n8 2\n8 8\n8 8\n4 4\n6 10\n10 9\n2 9\n1 10 36 48 76 151 229 276 310\n", "output": "1\n1\n4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAt the children's day, the child came to Picks's house, and messed his house up. Picks was angry at him. A lot of important things were lost, in particular the favorite set of Picks.\n\nFortunately, Picks remembers someth...
[{"type": "stdin_stdout", "input": "247 3270\n", "output": "62\n3228 3223 3212 3243 3230 3241 3263 3227 3255 3265 3262 3239 3261 3235 3219 3236 3231 3267 3210 3233 3258 3266 3237 3232 3252 3218 3251 3222 3242 3216 3256 3238 3253 3247 3214 3259 3217 3211 3269 3215 3220 3246 3221 3225 3264 3244 3250 3257 3209 3248 3234 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConstanze is the smartest girl in her village but she has bad eyesight.\n\nOne day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For examp...
[{"type": "stdin_stdout", "input": "nnnnnnnnnnnnnnnnnnnnnuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuunnnnnnnnnnnnnnnnnnnnnuuuuuuuuuunnunnu\n", "output": "281595619\n"}, {"type": "stdin_stdout", "input": "qmwknxcyrykskllhwnxlvlmckdhfpkuizzkeixxdvxlqyrspdtuccnbvpcvktzgmgvvebmdfdjsoyfhzigwvxrklbiunhzxjnayk\n", "output": "0\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTeachers of one programming summer school decided to make a surprise for the students by giving them names in the style of the \"Hobbit\" movie. Each student must get a pseudonym maximally similar to his own name. The pse...
[{"type": "stdin_stdout", "input": "10\nabaabbaaa\nacccccaacabc\nacbaabaaabbca\naaccca\ncbbba\naaba\nacab\nac\ncbac\nca\nbbbbc\nbacbcbcaac\nc\ncba\na\nabba\nbcabc\nabcccaa\nab\na\n", "output": "10\n1 9\n6 5\n4 10\n8 6\n7 8\n9 4\n10 3\n3 2\n2 1\n5 7\n"}, {"type": "stdin_stdout", "input": "10\nbaa\na\nba\naabab\naa\nbaab...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day Squidward, Spongebob and Patrick decided to go to the beach. Unfortunately, the weather was bad, so the friends were unable to ride waves. However, they decided to spent their time building sand castles.\n\nAt the...
[{"type": "stdin_stdout", "input": "101\n1 50 170 148 214 153 132 234 181 188 180 225 226 200 197 122 181 168 87 220 223 160 235 94 257 145 199 235 102 146 119 60 109 134 209 260 210 191 180 271 236 195 155 169 166 143 246 102 208 137 278 269 156 251 198 165 111 198 151 213 256 121 276 163 179 285 104 99 139 122 188 18...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is a harder version of the problem. In this version, $n \\le 50\\,000$.\n\nThere are $n$ distinct points in three-dimensional space numbered from $1$ to $n$. The $i$-th point has coordinates $(x_i, y_i, z_i)$. The nu...
[{"type": "stdin_stdout", "input": "8\n-100000000 -100000000 -100000000\n100000000 100000000 100000000\n-100000000 100000000 100000000\n-100000000 -100000000 100000000\n100000000 100000000 -100000000\n100000000 -100000000 -100000000\n-100000000 100000000 -100000000\n100000000 -100000000 100000000\n", "output": "1 4\n7 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAnu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation. For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ va...
[{"type": "stdin_stdout", "input": "100\n8650752 65536 131072 134217728 2112 8 0 0 0 0 0 1 0 0 268435456 1024 0 18890756 0 0 0 135364608 6291464 0 0 0 0 0 32 0 16384 0 0 0 0 33554560 256 0 16 0 0 536870912 536870912 0 0 128 0 0 4096 2048 0 0 0 0 268435456 64 1 0 0 262144 524288 0 8192 0 0 0 2 2 512 131072 0 0 67108864 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is v_{i}. Kuriyama Mirai wants to know something about these stones so she will ask yo...
[{"type": "stdin_stdout", "input": "56\n43 100 44 66 65 11 26 75 96 77 5 15 75 96 11 44 11 97 75 53 33 26 32 33 90 26 68 72 5 44 53 26 33 88 68 25 84 21 25 92 1 84 21 66 94 35 76 51 11 95 67 4 61 3 34 18\n27\n1 20 38\n1 11 46\n2 42 53\n1 8 11\n2 11 42\n2 35 39\n2 37 41\n1 48 51\n1 32 51\n1 36 40\n1 31 56\n1 18 38\n2 9 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOri and Sein have overcome many difficult challenges. They finally lit the Shrouded Lantern and found Gumon Seal, the key to the Forlorn Ruins. When they tried to open the door to the ruins... nothing happened.\n\nOri was...
[{"type": "stdin_stdout", "input": "20 7\n18525 35038\n15816 31586\n18641 46864\n35863 38632\n13563 35915\n41614 98684\n13573 35863\n25851 35985\n41687 55831\n31583 80871\n18525 35038\n15816 31586\n18641 46864\n35863 38632\n13563 35915\n41614 98684\n13573 35863\n25851 35985\n41687 55831\n31583 80871\n", "output": "4112...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.\n\nThe dot product of two integer number vectors x and y of size n is the sum of the produc...
[{"type": "stdin_stdout", "input": "5\n1 0 1 0 1\n0 1 0 1 0\n1 0 1 0 1\n0 1 0 1 0\n1 0 1 0 1\n7\n3\n2 4\n1 3\n3\n2 5\n1 5\n3\n", "output": "111\n"}, {"type": "stdin_stdout", "input": "3\n1 1 1\n0 1 1\n1 0 0\n12\n3\n2 3\n3\n2 2\n2 2\n1 3\n3\n3\n1 2\n2 1\n1 1\n3\n", "output": "01001\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCompanies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those ...
[{"type": "stdin_stdout", "input": "111\n15 45 14 65 49 25 102 86 14 80 54 73 43 78 42 32 47 60 55 66 84 69 49 22 26 72 89 52 26 80 71 35 56 2 88 23 23 53 65 92 46 73 29 65 88 99 19 99 87 10 47 96 109 20 60 89 63 105 29 92 109 20 95 65 31 89 107 3 3 50 58 9 28 39 104 42 41 36 70 49 59 96 16 9 3 108 38 42 2 67 32 86 20 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPermutation p is an ordered set of integers p_1, p_2, ..., p_{n}, consisting of n distinct positive integers, each of them doesn't exceed n. We'll denote the i-th element of permutation p as p_{i}. We'll call number n ...
[{"type": "stdin_stdout", "input": "10 4\n", "output": "10 9 8 7 1 2 3 4 5 6\n"}, {"type": "stdin_stdout", "input": "6 3\n", "output": "6 5 4 1 2 3\n"}, {"type": "stdin_stdout", "input": "5 2\n", "output": "1 5 2 4 3\n"}, {"type": "stdin_stdout", "input": "4 0\n", "output": "1 2 3 4\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n[Image] \n\nAs some of you know, cubism is a trend in art, where the problem of constructing volumetrical shape on a plane with a combination of three-dimensional geometric shapes comes to the fore. \n\nA famous sculptor ...
[{"type": "stdin_stdout", "input": "53\n1014364 40727 75774 243769 314 406417 5272684 14138 10640282 64955 2763 5667043 2121887 204672692 567643 60183 5183 11361359 2792918 199155 174809 16182540 21 392221 19434423 9140891 159733 15438 67903 3816799 616 429181 30392293 413992581 10847741 20771 16366654 1163 414283 1561...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLately, a national version of a bingo game has become very popular in Berland. There are n players playing the game, each player has a card with numbers. The numbers on each card are distinct, but distinct cards can have ...
[{"type": "stdin_stdout", "input": "40\n2 12 19\n4 10 7 1 3\n2 15 17\n1 6\n3 17 8 20\n4 8 16 11 18\n2 2 7\n4 12 13 8 7\n3 6 1 15\n3 19 11 13\n1 2\n2 16 14\n5 1 17 8 9 5\n1 2\n3 15 17 12\n4 20 4 19 18\n1 10\n4 12 1 17 16\n4 5 10 8 11\n1 10\n1 13\n1 17\n2 19 18\n1 3\n2 6 20\n1 8\n2 3 14\n3 17 3 1\n2 4 3\n1 12\n1 15\n1 2\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nПамять компьютера состоит из n ячеек, которые выстроены в ряд. Пронумеруем ячейки от 1 до n слева направо. Про каждую ячейку известно, свободна она или принадлежит какому-либо процессу (в таком случае известен процесс, ко...
[{"type": "stdin_stdout", "input": "24\n0 0 6 6 6 0 22 22 0 23 23 0 19 19 19 19 0 0 17 0 0 3 3 3\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "21\n0 11 11 11 11 0 7 0 12 12 12 12 12 0 19 19 19 0 1 1 1\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "24\n6 6 0 0 0 22 0 0 23 0 0 19 0 0 0 0 17 17 0 3 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle penguin Polo adores integer segments, that is, pairs of integers [l; r] (l ≤ r). \n\nHe has a set that consists of n integer segments: [l_1; r_1], [l_2; r_2], ..., [l_{n}; r_{n}]. We know that no two segments of th...
[{"type": "stdin_stdout", "input": "47 21\n3 5\n-422 -417\n60 60\n-348 -348\n-3 -3\n-364 -361\n-49 -41\n-436 -430\n-250 -244\n-33 -26\n-162 -158\n-90 -88\n-357 -352\n-339 -337\n-25 -19\n-69 -67\n-261 -260\n-292 -283\n12 18\n44 44\n-277 -275\n-301 -293\n-108 -98\n-180 -172\n-327 -318\n-314 -309\n-12 -7\n-134 -130\n33 35...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ of length $n$ that has a special condition: every element in this array has at most 7 divisors. Find the length of the shortest non-empty subsequence of this array product of whose elements is a...
[{"type": "stdin_stdout", "input": "8\n6 15 35 77 143 221 34 26\n", "output": "3"}, {"type": "stdin_stdout", "input": "6\n10 8 75 6 7 35\n", "output": "3"}, {"type": "stdin_stdout", "input": "2\n97969 97969\n", "output": "1"}, {"type": "stdin_stdout", "input": "4\n2 3 5 7\n", "output": "-1"}, {"type": "stdin_stdout", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ people sitting in a circle, numbered from $1$ to $n$ in the order in which they are seated. That is, for all $i$ from $1$ to $n-1$, the people with id $i$ and $i+1$ are adjacent. People with id $n$ and $1$ a...
[{"type": "stdin_stdout", "input": "536870912\n", "output": "1 268435458 805306372 1879048200 4026531856 8321499168 16911433792 34091303040 68451041536 137170518528 274609472512 549487380480 1099243196416 2198754828288 4397778092032 8795824619520 17591917674496 35184103784448 70368476004352 140737220444160 281474709323...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDima's got a staircase that consists of n stairs. The first stair is at height a_1, the second one is at a_2, the last one is at a_{n} (1 ≤ a_1 ≤ a_2 ≤ ... ≤ a_{n}). \n\nDima decided to play with the staircase, so he is t...
[{"type": "stdin_stdout", "input": "5\n1 2 3 6 6\n25\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCowboy Beblop is a funny little boy who likes sitting at his computer. He somehow obtained two elastic hoops in the shape of 2D polygons, which are not necessarily convex. Since there's no gravity on his spaceship, the ho...
[{"type": "stdin_stdout", "input": "16\n0 1000 0\n436 1013 0\n509 517 0\n1000 500 0\n1000 1000 0\n1401 1028 0\n1434 461 0\n2086 442 0\n2079 1044 0\n2506 1032 0\n2549 450 0\n3077 446 0\n3063 1067 0\n3715 1062 0\n3756 -125 0\n0 0 0\n16\n-243 700 394\n109 700 365\n129 700 -366\n763 700 -366\n725 700 397\n1131 700 409\n117...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.\n\nHe is too selfish, so for a given n he wants to obtain a string of n characters, each of...
[{"type": "stdin_stdout", "input": "117\n", "output": "aabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabba\n"}, {"type": "stdin_stdout", "input": "109\n", "output": "aabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabb...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n employees working in company \"X\" (let's number them from 1 to n for convenience). Initially the employees didn't have any relationships among each other. On each of m next days one of the following events to...
[{"type": "stdin_stdout", "input": "2 10\n2 2\n1 2 1\n3 1 1\n3 1 1\n3 1 1\n2 2\n3 1 2\n3 1 1\n3 1 1\n3 1 2\n", "output": "NO\nNO\nNO\nYES\nNO\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "10 10\n2 9\n1 2 1\n1 3 2\n3 1 1\n3 1 1\n2 3\n3 1 1\n3 1 1\n3 1 2\n3 1 1\n", "output": "NO\nNO\nNO\nNO\nYES\nNO\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMislove had an array $a_1$, $a_2$, $\\cdots$, $a_n$ of $n$ positive integers, but he has lost it. He only remembers the following facts about it:\n\n\n\n The number of different numbers in the array is not less than $l$ a...
[{"type": "stdin_stdout", "input": "1000 20 20\n", "output": "1049555 514850815\n"}, {"type": "stdin_stdout", "input": "114 18 19\n", "output": "262239 25427967\n"}, {"type": "stdin_stdout", "input": "879 17 17\n", "output": "131933 56623103\n"}, {"type": "stdin_stdout", "input": "106 16 18\n", "output": "65625 1179647...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLunar New Year is approaching, and Bob is struggling with his homework – a number division problem.\n\nThere are $n$ positive integers $a_1, a_2, \\ldots, a_n$ on Bob's homework paper, where $n$ is always an even number. ...
[{"type": "stdin_stdout", "input": "100\n28 27 23 6 23 11 25 20 28 15 29 23 20 2 8 24 8 9 30 8 8 1 11 7 6 17 17 27 26 30 12 22 17 22 9 25 4 26 9 26 10 30 13 4 16 12 23 19 10 22 12 20 3 16 10 4 29 11 15 4 5 7 29 16 3 1 7 16 26 14 28 1 15 19 30 28 5 22 14 28 13 12 11 30 3 4 7 10 22 8 4 10 22 12 17 27 23 11 18 7\n", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIlya is a very good-natured lion. He likes maths. Of all mathematical objects, his favourite one is matrices. Now he's faced a complicated matrix problem he needs to solve.\n\nHe's got a square 2^{n} × 2^{n}-sized matrix ...
[{"type": "stdin_stdout", "input": "16\n978618343 473608041 799158564 800910753 461479363 520477481 780529176 678879534 118274424 720632652 639921017 582019792 143353286 537373229 944668919 758615621\n", "output": "14440495117\n"}, {"type": "stdin_stdout", "input": "16\n666766712 653140033 670637874 170909587 210382562...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPasha has recently bought a new phone jPager and started adding his friends' phone numbers there. Each phone number consists of exactly n digits.\n\nAlso Pasha has a number k and two sequences of length n / k (n is divisi...
[{"type": "stdin_stdout", "input": "100 1\n5 3 1 5 6 2 4 8 3 3 1 1 2 8 2 3 8 2 5 2 6 2 3 5 2 1 2 1 2 8 4 3 3 5 1 4 2 2 2 5 8 2 2 6 2 9 2 4 1 8 1 5 5 6 6 1 2 7 3 3 4 2 4 1 2 6 6 4 9 4 3 2 3 8 2 3 1 4 1 4 1 3 5 3 5 5 2 3 4 1 1 8 1 5 6 9 4 2 5 1\n6 0 4 5 3 1 0 7 5 3 9 4 5 4 0 2 1 6 2 2 4 3 1 9 5 9 2 2 6 8 6 5 9 6 4 9 9 7 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Robber Girl likes to scare animals in her zoo for fun. She decided to arrange the animals in a row in the order of non-decreasing height. However, the animals were so scared that they couldn't stay in the right pla...
[{"type": "stdin_stdout", "input": "47\n17462271 17619887 84928078 85012448 86003043 86499508 129945397 135545949 141951561 161227989 167459883 215243263 243500622 284922151 326608661 350939646 359121478 388866754 441241406 460673749 497339472 512847269 521291845 537280636 561101359 569788868 581107309 588113051 619849...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string s, consisting of characters \"x\" and \"y\", and uses two following operations at runtime:...
[{"type": "stdin_stdout", "input": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n", "output": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"}, {"type": "stdin_stdout", "input": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\n", "output": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\n"}, {"type": "stdin_stdout", "input": "xx...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Vasya had n boxes with balls in the room. The boxes stood in a row and were numbered with numbers from 1 to n from left to right.\n\nOnce Vasya chose one of the boxes, let's assume that its number is i, took all ba...
[{"type": "stdin_stdout", "input": "48 19\n227460648 746912227 53993110 682685526 621533699 666833118 492590399 167395932 678377837 66509685 638633256 713194370 386921921 34175133 704550052 220688092 499436761 495071386 102952102 137372655 0 720974146 209203457 946682102 237312198 943872065 957150897 357568282 36700674...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInnokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Inno...
[{"type": "stdin_stdout", "input": "10\nIJGDI KHB\nHBI CKKCG\nFHE GCAA\nEDCGH HHICE\nGFH AIHD\nHED KIK\nDCK BCFIJ\nFFIHE FDB\nJGB AKKI\nIJD CAG\n", "output": "YES\nIJG\nHBI\nFHE\nEDC\nGFH\nHED\nDCK\nFFI\nJGB\nIJD\n"}, {"type": "stdin_stdout", "input": "10\nADE GBH\nJJDGJ AAF\nJJDGJ BBKG\nADE FKH\nADE CIA\nAIE JCBJ\nAIE...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: \"Fox\"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. \n\nAfter checking some e...
[{"type": "stdin_stdout", "input": "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever\n", "output": "aghjlnopefikdmbcqrstuvwxyz\n"}, {"type": "stdin_stdout", "input": "1\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAndrew and Jerry are playing a game with Harry as the scorekeeper. The game consists of three rounds. In each round, Andrew and Jerry draw randomly without replacement from a jar containing n balls, each labeled with a di...
[{"type": "stdin_stdout", "input": "20\n11 37 81 56 61 2 26 27 59 69 24 7 71 76 45 54 89 17 95 20\n", "output": "0.1931218837\n"}, {"type": "stdin_stdout", "input": "19\n55 91 63 21 30 82 14 38 9 67 50 44 90 93 68 6 73 65 29\n", "output": "0.1920376960\n"}, {"type": "stdin_stdout", "input": "18\n69 88 49 91 42 56 58 13...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya often uses public transport. The transport in the city is of two types: trolleys and buses. The city has n buses and m trolleys, the buses are numbered by integers from 1 to n, the trolleys are numbered by integers ...
[{"type": "stdin_stdout", "input": "680 871 347 800\n10 100\n872 156 571 136 703 201 832 213 15 333\n465 435 870 95 660 237 694 594 423 405 27 866 325 490 255 989 128 345 278 125 708 210 771 848 961 448 871 190 745 343 532 174 103 999 874 221 252 500 886 129 185 208 137 425 800 34 696 39 198 981 91 50 545 885 194 583 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVlad likes to eat in cafes very much. During his life, he has visited cafes n times. Unfortunately, Vlad started to feel that his last visits are not any different from each other. To fix that Vlad had a small research.\n...
[{"type": "stdin_stdout", "input": "8\n200000 1 200000 1 200000 1 200000 2\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n100 1000 1000 1000 1000\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "11\n1 1 1 1 1 1 1 1 1 1 1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n20000 1 2 3 4\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWilbur is playing with a set of n points on the coordinate plane. All points have non-negative integer coordinates. Moreover, if some point (x, y) belongs to the set, then all points (x', y'), such that 0 ≤ x' ≤ x and 0 ≤...
[{"type": "stdin_stdout", "input": "40\n0 0\n0 1\n0 2\n0 3\n0 4\n0 5\n0 6\n0 7\n0 8\n0 9\n0 10\n0 11\n0 12\n1 0\n1 1\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n2 0\n3 0\n4 0\n5 0\n6 0\n7 0\n8 0\n9 0\n10 0\n11 0\n12 0\n13 0\n14 0\n15 0\n16 0\n17 0\n18 0\n19 0\n20 0\n0 1 2 -1 -2 3 4 -3 5 6 7 8 0 -4 -5 1 -6 -7 -8 -9 -10 -11 9 2 -12 -...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nZibi is a competitive programming coach. There are $n$ competitors who want to be prepared well. The training contests are quite unusual – there are two people in a team, two problems, and each competitor will code exactl...
[{"type": "stdin_stdout", "input": "40 39\n0 -2\n-2 3\n3 3\n3 -2\n-1 1\n2 0\n-3 2\n-2 1\n0 -3\n-1 -3\n1 -1\n-3 -1\n2 1\n0 2\n1 -3\n-2 -1\n1 2\n-1 -2\n-1 0\n3 2\n1 3\n-3 1\n-2 -3\n-3 -2\n3 0\n-1 3\n3 1\n-2 2\n0 3\n3 -1\n2 -3\n1 1\n-1 -1\n0 1\n-3 0\n1 0\n-3 3\n-3 -3\n2 2\n-1 2\n1 29\n29 2\n29 3\n29 4\n5 29\n29 6\n7 29\n8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is an easier version of the problem. In this version $n \\le 1000$\n\nThe outskirts of the capital are being actively built up in Berland. The company \"Kernel Panic\" manages the construction of a residential comple...
[{"type": "stdin_stdout", "input": "100\n82 51 81 14 37 17 78 92 64 15 8 86 89 8 87 77 66 10 15 12 100 25 92 47 21 78 20 63 13 49 41 36 41 79 16 87 87 69 3 76 80 60 100 49 70 59 72 8 38 71 45 97 71 14 76 54 81 4 59 46 39 29 92 3 49 22 53 99 59 52 74 31 92 43 42 23 44 9 82 47 7 40 12 9 3 55 37 85 46 22 84 52 98 41 21 77...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1 ≤ i ≤ n) he makes a_{i} money. Kefa loves progress, that's why he wants to know the length of the maximum...
[{"type": "stdin_stdout", "input": "100\n1 838 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1 605 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 10...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minutes. There is a straight road of length s from the service to the cinema. Let's introduce a coo...
[{"type": "stdin_stdout", "input": "4 13 400 600\n13 30\n1 19\n1 160\n1 113\n58 73 15 319 194 362 128 157 336 162 77 90 96\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1 15 100 200\n283 8\n30 58 16 45 80 82 55 95 24 23 86 28 51 47 20\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "2 1 1000000000 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a convex polygon P with n distinct vertices p_1, p_2, ..., p_{n}. Vertex p_{i} has coordinates (x_{i}, y_{i}) in the 2D plane. These vertices are listed in clockwise order.\n\nYou can choose a real number D ...
[{"type": "stdin_stdout", "input": "19\n449447997 711296339\n530233434 692216537\n535464528 613140435\n535533467 100893188\n530498867 -265063956\n519107979 -271820709\n482156929 -287792333\n-303730271 -287970295\n-416935204 -263348201\n-443613873 -249980523\n-453444829 -173903413\n-462102798 -80789280\n-462064673 -1322...
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. You can hack this problem if you solve it. But you can hack the previous problem only if you solve both problems.\n\nKirk has a binary string...
[{"type": "stdin_stdout", "input": "0111001100111011101000\n", "output": "0011001100001011101000\n"}, {"type": "stdin_stdout", "input": "0000000000000000\n", "output": "0000000000000000\n"}, {"type": "stdin_stdout", "input": "0100000001000001\n", "output": "0100000001000000\n"}, {"type": "stdin_stdout", "input": "00001...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOf course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory producing the rings for this wonderful game? Once upon a time, the ruler of the ancient Egypt ordered the worke...
[{"type": "stdin_stdout", "input": "15\n7 8 940377876\n5 26 602265950\n18 19 193066910\n23 24 754826087\n2 3 555140266\n6 25 830980693\n27 28 636793242\n20 21 809913904\n1 30 868457738\n10 17 698644057\n9 22 443624155\n13 16 941205435\n14 15 42481040\n4 29 305295425\n11 12 765921496\n", "output": "4732954493\n"}, {"typ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEugene likes working with arrays. And today he needs your help in solving one challenging task.\n\nAn array $c$ is a subarray of an array $b$ if $c$ can be obtained from $b$ by deletion of several (possibly, zero or all) ...
[{"type": "stdin_stdout", "input": "3\n41 -41 41\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "3\n1 2 -3\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "2\n-1 -1\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "2\n-1 0\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "2\n-1 1\n", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nValya and Tolya are an ideal pair, but they quarrel sometimes. Recently, Valya took offense at her boyfriend because he came to her in t-shirt with lettering that differs from lettering on her pullover. Now she doesn't wa...
[{"type": "stdin_stdout", "input": "242\nrrrrrrrrrrrrrmmmmmmmmmmmmmgggggggggggggwwwwwwwwwwwwwyyyyyyyyyyyyyhhhhhhhhhhhhhoooooooooooooqqqqqqqqqqqqqjjjjjjjjjjjjjvvvvvvvvvvvvvlllllllllllllnnnnnnnnnnnnnfffffffffffffeeeeeeeeaaaaaaaaiiiiiiiiuuuuuuuuzzzzzzzzbbbbbbbbxxxxxxxxttttttttsscckppdd\nrmgwyhoqjvlnfrmgwyhoqjvlnfrmgwyhoqj...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke has four cookies with deliciousness A, B, C, and D. He will choose one or more from those cookies and eat them. Is it possible that the sum of the deliciousness of the eaten cookies is equal to that of the remaining...
[{"type": "stdin_stdout", "input": "45445415 46908390 31865171 30402196\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "93407609 30427494 56229544 81174201\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "76041209 81456309 25817729 23366690\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "9...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven are integers S and P.\nIs there a pair of positive integers (N,M) such that N + M = S and N \\times M = P?\n\n-----Constraints-----\n - All values in input are integers.\n - 1 \\leq S,P \\leq 10^{12}\n\n-----Input--...
[{"type": "stdin_stdout", "input": "1000000000000 999999999999\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "50000000002 100000000000\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "978530427494 321593407609\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "203939391324 871114841657\n", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:...
[{"type": "stdin_stdout", "input": "dreamereraserdreamererasereraseeraserdreamererasereraserdreamdreamerdreamerdreamerdreamererasedreamereraseeraserdreamereraserdreamereraseeraserdreamdreamdreamerdreamerdreamerdreamdreamerdreameraseerasedreamererasererasererasedreamereraseerasererasedreamerasereraserdreamerdreamerasedr...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice has a string consisting of characters 'A', 'B' and 'C'. Bob can use the following transitions on any substring of our string in any order any number of times: A $\\rightarrow$ BC B $\\rightarrow$ AC C $\\rightar...
[{"type": "stdin_stdout", "input": "AAAAAA\nAAAAAA\n30\n3 4 1 2\n3 3 4 4\n5 6 3 4\n3 3 2 3\n6 6 1 5\n2 4 4 6\n1 6 2 5\n6 6 3 4\n3 5 1 4\n4 5 3 6\n2 3 2 4\n3 4 4 4\n6 6 4 6\n3 3 2 5\n1 5 3 3\n4 6 1 2\n6 6 6 6\n3 3 3 4\n6 6 6 6\n5 6 4 4\n6 6 5 5\n2 3 1 4\n3 6 4 5\n3 5 6 6\n4 5 2 6\n5 6 6 6\n1 4 2 5\n4 5 2 5\n4 5 1 3\n2 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters. \n\nSuitability of string s is calculated by following metric:\n\nAny two letters can be swapped positions, th...
[{"type": "stdin_stdout", "input": "ccaaa?bc?baccbccccbca?cccab??aacccbaac?bccacc?accccaccbcbbcbc\ncbaaacccc\n", "output": "ccaaaabcabaccbccccbcaacccabaaaacccbaaczbccacczaccccaccbcbbcbc\n"}, {"type": "stdin_stdout", "input": "mqwstphetbfrsyxuzdww\nrutseqtsbh\n", "output": "mqwstphetbfrsyxuzdww\n"}, {"type": "stdin_stdo...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecall that string $a$ is a subsequence of a string $b$ if $a$ can be obtained from $b$ by deletion of several (possibly zero or all) characters. For example, for the string $a$=\"wowwo\", the following strings are subseq...
[{"type": "stdin_stdout", "input": "ovvvvovovvvvovoovovovovvvvvvvoovoovvovvoooooovo\n", "output": "463\n"}, {"type": "stdin_stdout", "input": "vvovooovovvovoovoovvvvovovvvov\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "vovoovovvoovvvvvvovo\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "vvovvovv...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have n devices that you want to use simultaneously.\n\nThe i-th device uses a_{i} units of power per second. This usage is continuous. That is, in λ seconds, the device will use λ·a_{i} units of power. The i-th device...
[{"type": "stdin_stdout", "input": "20 16807\n75250 50074\n43659 8931\n11273 27545\n50879 77924\n37710 64441\n38166 84493\n43043 7988\n22504 82328\n31730 78841\n42613 44304\n33170 17710\n97158 29561\n70934 93100\n80279 51817\n95336 99098\n7827 13513\n29268 23811\n77634 80980\n79150 36580\n58822 11968\n", "output": "0.2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen Darth Vader gets bored, he sits down on the sofa, closes his eyes and thinks of an infinite rooted tree where each node has exactly n sons, at that for each node, the distance between it an its i-th left child equals...
[{"type": "stdin_stdout", "input": "97 78153\n2 2 1 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "86 95031\n1 1 2 1 1 2 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.\n\nAt the start of the day they have x ice cream packs. Since the ice cream is free, pe...
[{"type": "stdin_stdout", "input": "6 1000000000\n+ 1000000000\n+ 1000000000\n+ 1000000000\n+ 1000000000\n+ 1000000000\n+ 1000000000\n", "output": "7000000000 0\n"}, {"type": "stdin_stdout", "input": "11 1000\n- 100\n+ 100\n+ 100\n+ 100\n+ 100\n- 100\n- 100\n- 100\n- 100\n- 100\n- 100\n", "output": "700 0\n"}, {"type":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSereja loves integer sequences very much. He especially likes stairs.\n\nSequence a_1, a_2, ..., a_{|}a| (|a| is the length of the sequence) is stairs if there is such index i (1 ≤ i ≤ |a|), that the following condition i...
[{"type": "stdin_stdout", "input": "102\n1830 2653 1293 4285 4679 3563 3668 4499 3507 2666 3507 1120 466 290 4280 60 4135 1120 289 1752 2101 2699 653 2811 3885 4018 4097 3142 2932 561 193 3662 3017 3487 3158 2876 3396 2806 3440 4503 1728 362 2194 2743 2946 596 1892 4785 3661 2971 3487 17 3616 2710 1189 613 915 3891 265...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSometimes it is not easy to come to an agreement in a bargain. Right now Sasha and Vova can't come to an agreement: Sasha names a price as high as possible, then Vova wants to remove as many digits from the price as possi...
[{"type": "stdin_stdout", "input": "89653869601520065918099842252939425873261986401967787530625300860685703011479905851664663625597640495748720791302990531416409889170329328492276398890871323755880144010733994706479132908918729855565786473847956211671142121453760475332628675489221779768932083810273365664919372769368554...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's analyze a program written on some strange programming language. The variables in this language have names consisting of $1$ to $4$ characters, and each character is a lowercase or an uppercase Latin letter, or a dig...
[{"type": "stdin_stdout", "input": "9\nc111=a&b\nd=b^a\ne=c111#d\nd=d\nf=f\nf=c111$d\ng=e$f\nh=e#f\nres=g^h\n", "output": "7\naaaa=a&b\naaab=b^a\naaac=aaaa#aaab\naaad=aaaa$aaab\naaae=aaac$aaad\naaaf=aaac#aaad\nres=aaae^aaaf\n"}, {"type": "stdin_stdout", "input": "9\nc=a$b\ne=c#c\nf=c$c\nh=a$b\nx=h$h\ny=h#h\nz=x^y\ng=f^...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree consisting of $n$ nodes. You want to write some labels on the tree's edges such that the following conditions hold:\n\n Every label is an integer between $0$ and $n-2$ inclusive. All the written lab...
[{"type": "stdin_stdout", "input": "13\n1 4\n2 4\n3 4\n4 5\n5 11\n11 12\n12 13\n13 6\n6 7\n7 8\n7 9\n7 10\n", "output": "4\n5\n6\n7\n8\n9\n10\n11\n0\n1\n2\n3\n"}, {"type": "stdin_stdout", "input": "11\n2 3\n3 4\n4 7\n7 8\n1 3\n3 5\n4 10\n4 11\n6 7\n7 9\n", "output": "4\n5\n0\n1\n6\n7\n8\n9\n2\n3\n"}, {"type": "stdin_st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya and Vasya are tossing a coin. Their friend Valera is appointed as a judge. The game is very simple. First Vasya tosses a coin x times, then Petya tosses a coin y times. If the tossing player gets head, he scores one...
[{"type": "stdin_stdout", "input": "10 10 1 1\n", "output": "45\n2 1\n3 1\n3 2\n4 1\n4 2\n4 3\n5 1\n5 2\n5 3\n5 4\n6 1\n6 2\n6 3\n6 4\n6 5\n7 1\n7 2\n7 3\n7 4\n7 5\n7 6\n8 1\n8 2\n8 3\n8 4\n8 5\n8 6\n8 7\n9 1\n9 2\n9 3\n9 4\n9 5\n9 6\n9 7\n9 8\n10 1\n10 2\n10 3\n10 4\n10 5\n10 6\n10 7\n10 8\n10 9\n"}, {"type": "stdin_s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations.\n\nMax is a young biologist. For $n$ days he watc...
[{"type": "stdin_stdout", "input": "127\n64 96 63 112 62 95 61 120 60 94 59 111 58 93 57 124 56 92 55 110 54 91 53 119 52 90 51 109 50 89 49 126 48 88 47 108 46 87 45 118 44 86 43 107 42 85 41 123 40 84 39 106 38 83 37 117 36 82 35 105 34 81 33 127 32 80 31 104 30 79 29 116 28 78 27 103 26 77 25 122 24 76 23 102 22 75 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA PIN code is a string that consists of exactly $4$ digits. Examples of possible PIN codes: 7013, 0000 and 0990. Please note that the PIN code can begin with any digit, even with 0.\n\nPolycarp has $n$ ($2 \\le n \\le 10$...
[{"type": "stdin_stdout", "input": "14\n3\n0000\n0000\n0001\n3\n0000\n0001\n0000\n3\n0001\n0000\n0000\n3\n0000\n0000\n1000\n3\n0000\n1000\n0000\n3\n1000\n0000\n0000\n3\n0000\n0001\n0001\n3\n0001\n0000\n0001\n3\n0001\n0001\n0000\n3\n0000\n1000\n1000\n3\n1000\n0000\n1000\n3\n1000\n1000\n0000\n4\n0000\n0001\n0001\n0002\n4...
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\nVasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receive...
[{"type": "stdin_stdout", "input": "KASFLS\nASJBGGDLJFDDFHHTHJH\n42\n2 a 68 y\n4 h 64 r\n5 a 24 y\n6 h 20 r\n8 a 16 r\n9 a 96 y\n10 h 36 r\n12 a 44 y\n13 h 69 r\n16 a 62 r\n18 a 99 r\n20 h 12 r\n21 a 68 y\n25 h 40 y\n26 h 54 r\n28 h 91 r\n29 a 36 r\n33 a 91 y\n36 h 93 r\n37 h 60 r\n38 a 82 r\n41 a 85 y\n42 a 62 r\n46 a...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the school computer room there are n servers which are responsible for processing several computing tasks. You know the number of scheduled tasks for each server: there are m_{i} tasks assigned to the i-th server.\n\nI...
[{"type": "stdin_stdout", "input": "10\n19999 19999 20000 20000 19999 20000 20000 20000 19999 19999\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "7\n10 11 10 11 10 11 11\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n0 0 0 0 0 0 0 0 0 0\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a \"plus\") and negative (a \"minus\"). If t...
[{"type": "stdin_stdout", "input": "115\n10\n10\n10\n10\n01\n01\n10\n10\n10\n01\n01\n10\n01\n01\n10\n10\n10\n01\n10\n01\n10\n10\n01\n01\n10\n10\n10\n10\n01\n10\n01\n01\n10\n10\n10\n10\n01\n10\n10\n10\n01\n10\n01\n10\n10\n10\n10\n01\n01\n01\n10\n10\n01\n01\n01\n10\n10\n01\n10\n01\n01\n01\n01\n10\n10\n01\n10\n01\n01\n01\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's call beauty of an array $b_1, b_2, \\ldots, b_n$ ($n > 1$)  — $\\min\\limits_{1 \\leq i < j \\leq n} |b_i - b_j|$.\n\nYou're given an array $a_1, a_2, \\ldots a_n$ and a number $k$. Calculate the sum of beauty over ...
[{"type": "stdin_stdout", "input": "52 52\n19752 66708 73109 84463 95683 96876 98503 98812 99766 99778 99913 99975 99977 99997 99997 99997 99998 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 playing a new famous fighting game: Kortal Mombat XII. You have to perform a brutality on your opponent's character.\n\nYou are playing the game on the new generation console so your gamepad have $26$ buttons. Eac...
[{"type": "stdin_stdout", "input": "38 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 53 53 53 1 1 1 1 1 1 1 1 1 1 1\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "53\n"}, {"type": "stdin_stdout", "input": "38 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 53 53 1 1 1 1 1 1 1 1 1 1 1 1\naaaaaaaaaaaaaaaa...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider a football tournament where n teams participate. Each team has two football kits: for home games, and for away games. The kit for home games of the i-th team has color x_{i} and the kit for away games of this tea...
[{"type": "stdin_stdout", "input": "30\n25 8\n25 4\n21 9\n25 1\n7 16\n23 21\n22 17\n27 29\n7 29\n20 3\n13 23\n7 13\n16 18\n25 14\n13 17\n28 15\n10 23\n25 18\n2 3\n23 13\n30 8\n13 15\n20 15\n11 29\n10 23\n5 16\n4 14\n4 30\n7 20\n11 1\n", "output": "29 29\n31 27\n29 29\n29 29\n30 28\n30 28\n29 29\n29 29\n29 29\n29 29\n31...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem you have to simulate the workflow of one-thread server. There are n queries to process, the i-th will be received at moment t_{i} and needs to be processed for d_{i} units of time. All t_{i} are guaranteed...
[{"type": "stdin_stdout", "input": "4 3\n999999996 1000000000\n999999997 1000000000\n999999998 1000000000\n999999999 1000000000\n", "output": "1999999996 2999999996 3999999996 4999999996 \n"}, {"type": "stdin_stdout", "input": "10 3\n1 14\n3 2\n5 4\n6 9\n9 1\n12 22\n15 11\n18 8\n28 2\n29 4\n", "output": "15 17 21 30 -1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGena loves sequences of numbers. Recently, he has discovered a new type of sequences which he called an almost arithmetical progression. A sequence is an almost arithmetical progression, if its elements can be represented...
[{"type": "stdin_stdout", "input": "73\n531 626 701 57 708 511 54 441 297 697 411 253 397 652 21 59 851 561 539 461 629 894 275 417 127 505 433 243 963 247 5 368 969 541 408 485 319 117 441 131 265 357 1 659 267 983 643 285 913 782 813 569 99 781 297 636 645 341 6 17 601 129 509 197 226 105 241 737 86 128 762 647 849\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya has an array $a$ consisting of $n$ integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of element...
[{"type": "stdin_stdout", "input": "10 -196228170\n-181402541 328251238 624722764 682518931 783857631 969228879 547715844 -149364638 823684584 833196798\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "5 450402558\n-840167367 -231820501 586187125 -627664644 -428228185\n", "output": "14\n"}, {"type": "stdin_stdo...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp has just invented a new binary protocol for data transmission. He is encoding positive integer decimal number to binary string using following algorithm:\n\n Each digit is represented with number of '1' characte...
[{"type": "stdin_stdout", "input": "89\n11111111101111111110111111111011111111101111111110111111111011111111101111111110111111111\n", "output": "999999999\n"}, {"type": "stdin_stdout", "input": "53\n10110111011110111110111111011111110111111110111111111\n", "output": "123456789\n"}, {"type": "stdin_stdout", "input": "31...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya has the sequence consisting of n integers. Vasya consider the pair of integers x and y k-interesting, if their binary representation differs from each other exactly in k bits. For example, if k = 2, the pair of inte...
[{"type": "stdin_stdout", "input": "100 14\n8192 8192 8192 8192 8191 8192 8192 8192 8192 8192 8191 8191 8191 8192 8191 8191 8191 8192 8192 8192 8192 8192 8191 8191 8191 8192 8191 8192 8192 8192 8192 8192 8192 8191 8191 8192 8192 8191 8191 8192 8192 8192 8191 8191 8192 8191 8191 8191 8191 8191 8191 8192 8191 8191 8192 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOnce little Vasya read an article in a magazine on how to make beautiful handmade garland from colored paper. Vasya immediately went to the store and bought n colored sheets of paper, the area of each sheet is 1 square me...
[{"type": "stdin_stdout", "input": "hvewdvwdwudrwarwmddwnazmwauzatrmwptwwevavpmwrtruwnpwantewrnwmepdwvtmnveanunrvrtwpvhhnuhnmpptdttzmmndtvudmzhhannmmnahdpzamuvhzaavnhtnumwrwvttdetvuewaaennddwuvzvaptdzrzhtetwwzmzedrwuvrwznprhdvnavrruvvhzuwpdtmpwmzrwvermrhdamv\nuvzhwtpuputnahwwarduzddhpnwwvettprwavdmnztdnrddmarmvuevtdezn...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIgor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week and Igor knows about each item that its price now is a_{i}, and after a week of discounts its price will be b_{i}....
[{"type": "stdin_stdout", "input": "50 45\n80 125 152 122 85 62 123 195 157 73 8 127 47 193 70 132 131 38 98 97 185 98 68 166 114 53 144 106 141 106 191 123 44 199 35 18 84 169 46 52 129 102 155 130 63 169 116 145 154 41\n155 187 79 106 136 173 17 146 9 47 173 21 37 183 110 74 185 14 82 156 147 25 162 195 26 25 22 80 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis problem differs from the previous one only in the absence of the constraint on the equal length of all numbers $a_1, a_2, \\dots, a_n$.\n\nA team of SIS students is going to make a trip on a submarine. Their target i...
[{"type": "stdin_stdout", "input": "100\n463 6421 2912 1546 3999 5175 4357 2259 7380 6081 1148 7857 3532 4168 5643 8819 2568 6681 975 9216 4590 5217 6215 7422 6631 1651 39 4268 8290 2022 3175 8281 1552 980 9314 234 934 5133 6712 1880 2766 5042 5004 5455 6038 6010 6022 1553 4015 4544 3985 4033 223 7682 6302 2121 4832 39...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInaka has a disc, the circumference of which is $n$ units. The circumference is equally divided by $n$ points numbered clockwise from $1$ to $n$, such that points $i$ and $i + 1$ ($1 \\leq i < n$) are adjacent, and so are...
[{"type": "stdin_stdout", "input": "30000 28\n10601 1119\n11119 20601\n9493 25771\n14351 4869\n13101 3619\n23101 13619\n29869 9351\n6119 15601\n3101 23619\n1851 22369\n11851 2369\n8619 18101\n19579 20882\n18619 28101\n16851 7369\n8101 28619\n24869 4351\n24351 14869\n27369 6851\n9869 19351\n5601 26119\n3976 21301\n21851...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nT is a complete binary tree consisting of n vertices. It means that exactly one vertex is a root, and each vertex is either a leaf (and doesn't have children) or an inner node (and has exactly two children). All leaves of...
[{"type": "stdin_stdout", "input": "1125899906842623 1\n1\nUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUULLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLRRRRRRRRRRRRRRRRRRRRRR...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe problem uses a simplified TCP/IP address model, please make sure you've read the statement attentively.\n\nPolycarpus has found a job, he is a system administrator. One day he came across n IP addresses. Each IP addre...
[{"type": "stdin_stdout", "input": "15 8\n244.1.125.160\n39.50.68.162\n142.253.101.137\n52.239.241.147\n194.4.189.143\n200.238.160.30\n245.78.177.243\n89.249.140.19\n169.51.142.22\n123.246.20.99\n133.44.192.119\n226.240.179.30\n76.209.211.184\n98.15.6.117\n227.219.117.153\n", "output": "-1\n"}, {"type": "stdin_stdout",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKsusha is a beginner coder. Today she starts studying arrays. She has array a_1, a_2, ..., a_{n}, consisting of n positive integers.\n\nHer university teacher gave her a task. Find such number in the array, that all array...
[{"type": "stdin_stdout", "input": "5\n506904227 214303304 136194869 838256937 183952885\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "2\n500000000 1000000000\n", "output": "500000000\n"}, {"type": "stdin_stdout", "input": "1\n1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "5\n2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour favorite music streaming platform has formed a perfectly balanced playlist exclusively for you. The playlist consists of $n$ tracks numbered from $1$ to $n$. The playlist is automatic and cyclic: whenever track $i$ f...
[{"type": "stdin_stdout", "input": "100\n7585 5510 1017 4329 2840 8171 5089 1873 7308 9656 6833 7578 4914 6658 4408 7122 5265 1204 9800 3150 2151 6906 6041 3973 931 7239 4421 4211 156 8655 4266 3543 9752 3117 2731 6052 8950 9391 6367 996 9973 629 9489 4912 9226 9301 5166 4889 3710 6794 618 9155 2462 1120 5499 5861 3177...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nZS the Coder and Chris the Baboon are travelling to Udayland! To get there, they have to get on the special IOI bus. The IOI bus has n rows of seats. There are 4 seats in each row, and the seats are separated into pairs b...
[{"type": "stdin_stdout", "input": "61\nOX|XX\nOX|XX\nOX|XX\nXO|XO\nXX|XO\nXX|XX\nXX|XX\nOX|XX\nXO|XO\nOX|XO\nXO|OX\nXX|XX\nXX|XX\nOX|OX\nXX|OX\nOX|XO\nOX|XO\nXO|OX\nXO|XX\nOX|XX\nOX|XX\nXO|OX\nXO|XX\nXO|XX\nOX|XX\nXX|XX\nXX|XO\nXO|XX\nXX|XX\nXO|OX\nXX|XO\nXO|XX\nXO|XO\nXO|OX\nXX|OX\nXO|OX\nOX|XX\nXX|OX\nXX|XX\nOX|XO\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou went to the store, selling $n$ types of chocolates. There are $a_i$ chocolates of type $i$ in stock.\n\nYou have unlimited amount of cash (so you are not restricted by any prices) and want to buy as many chocolates as...
[{"type": "stdin_stdout", "input": "19\n10 10 8 11 6 1 6 13 8 20 8 14 9 18 18 7 5 20 6\n", "output": "21"}, {"type": "stdin_stdout", "input": "19\n3 1 16 11 12 10 3 13 12 9 1 9 8 4 19 16 19 3 3\n", "output": "6"}, {"type": "stdin_stdout", "input": "12\n6 20 12 12 1 8 15 19 5 19 5 16\n", "output": "31"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is a harder version of the problem. In this version $n \\le 500\\,000$\n\nThe outskirts of the capital are being actively built up in Berland. The company \"Kernel Panic\" manages the construction of a residential co...
[{"type": "stdin_stdout", "input": "100\n82 51 81 14 37 17 78 92 64 15 8 86 89 8 87 77 66 10 15 12 100 25 92 47 21 78 20 63 13 49 41 36 41 79 16 87 87 69 3 76 80 60 100 49 70 59 72 8 38 71 45 97 71 14 76 54 81 4 59 46 39 29 92 3 49 22 53 99 59 52 74 31 92 43 42 23 44 9 82 47 7 40 12 9 3 55 37 85 46 22 84 52 98 41 21 77...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nXenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right. \n\nSpy s has an important note. He has to pass the note to spy f. Xenia inte...
[{"type": "stdin_stdout", "input": "20 20 17 20\n1 16 20\n2 12 13\n3 14 16\n4 13 15\n5 3 15\n6 2 11\n7 18 18\n8 5 15\n9 6 12\n10 19 19\n11 9 11\n12 14 17\n13 19 19\n14 12 20\n15 1 1\n16 11 17\n17 13 14\n18 5 17\n19 2 10\n20 19 20\n", "output": "XRRR\n"}, {"type": "stdin_stdout", "input": "100 5 99 1\n1 1 2\n2 2 3\n3 3 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA class of students wrote a multiple-choice test.\n\nThere are $n$ students in the class. The test had $m$ questions, each of them had $5$ possible answers (A, B, C, D or E). There is exactly one correct answer for each q...
[{"type": "stdin_stdout", "input": "10 10\nCBBBBBBBBB\nABBBBEBBBB\nBDBBBBBBBB\nBBBBBBBBBB\nBABBBBBEBB\nEBBBBBBBBB\nBBBCBDCBBB\nBEBBEBBBBB\nBBBBBBBBBB\nBBBDBBBABB\n840 678 490 900 683 84 256 233 468 856\n", "output": "46953"}, {"type": "stdin_stdout", "input": "6 5\nAAAAA\nAAAAB\nAAABB\nAABBB\nABBBB\nBBBBB\n999 13 877 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe capital of Berland looks like a rectangle of size n × m of the square blocks of same size.\n\nFire!\n\nIt is known that k + 1 blocks got caught on fire (k + 1 ≤ n·m). Those blocks are centers of ignition. Moreover pos...
[{"type": "stdin_stdout", "input": "1000000000 1000000000 10\n946218581 843926244\n730038846 389721428\n400508549 779159281\n631299905 559948749\n352088629 132899572\n391396726 503295408\n57387601 686114055\n298922091 222110600\n523083048 28286278\n587730768 379340837\n", "output": "313885945\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne way to create a task is to learn from life. You can choose some experience in real life, formalize it and then you will get a new task.\n\nLet's think about a scene in real life: there are lots of people waiting in fr...
[{"type": "stdin_stdout", "input": "100 1\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 100 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA string is called bracket sequence if it does not contain any characters other than \"(\" and \")\". A bracket sequence is called regular (shortly, RBS) if it is possible to obtain correct arithmetic expression by insert...
[{"type": "stdin_stdout", "input": "20\n(())(()()())(())()()\n", "output": "01100111111001100000\n"}, {"type": "stdin_stdout", "input": "20\n(()()()())(()())()()\n", "output": "01111111100111100000\n"}, {"type": "stdin_stdout", "input": "20\n(())(())(())()(())()\n", "output": "01100110011000011000\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs the guys fried the radio station facilities, the school principal gave them tasks as a punishment. Dustin's task was to add comments to nginx configuration for school's website. The school has n servers. Each server ha...
[{"type": "stdin_stdout", "input": "10 10\nittmcs 112.147.123.173\njkt 228.40.73.178\nfwckqtz 88.28.31.198\nkal 224.226.34.213\nnacuyokm 49.57.13.44\nfouynv 243.18.250.17\ns 45.248.83.247\ne 75.69.23.169\nauwoqlch 100.44.219.187\nlkldjq 46.123.169.140\ngjcylatwzi 46.123.169.140;\ndxfi 88.28.31.198;\ngv 46.123.169.140;\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya and Petya take part in a Codeforces round. The round lasts for two hours and contains five problems.\n\nFor this round the dynamic problem scoring is used. If you were lucky not to participate in any Codeforces roun...
[{"type": "stdin_stdout", "input": "26\n3 -1 71 -1 42\n85 72 48 38 -1\n-1 -1 66 24 -1\n46 -1 60 99 107\n53 106 51 -1 104\n-1 17 98 54 -1\n44 107 66 65 102\n47 40 62 34 5\n-1 10 -1 98 -1\n-1 69 47 85 75\n12 62 -1 15 -1\n48 63 72 32 99\n91 104 111 -1 -1\n92 -1 52 -1 11\n118 25 97 1 108\n-1 61 97 37 -1\n87 47 -1 -1 21\n79...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA bracket sequence is a string containing only characters \"(\" and \")\".\n\nA regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters \"1\" and...
[{"type": "stdin_stdout", "input": "10\n()()(\n)((\n)()(((()(\n(((()(\n)(()((\n))\n()()()()\n))()))((\n)\n))())(\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "2\n((((((((((((((((((((((((\n))))))))))))))))))))))))\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "9\n(()\n((())\n(\n)\n(()()(()())))\n)\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDenis, after buying flowers and sweets (you will learn about this story in the next task), went to a date with Nastya to ask her to become a couple. Now, they are sitting in the cafe and finally... Denis asks her to be to...
[{"type": "stdin_stdout", "input": "10 10\n0101111\n0000000\n1111011\n1011011\n1011011\n1111011\n0010010\n1010010\n1101111\n0000000\n", "output": "8993391761"}, {"type": "stdin_stdout", "input": "10 10\n1101001\n0110000\n0111010\n0010000\n1010000\n0111000\n1011011\n1010010\n1101011\n1111110\n", "output": "9941743758"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThree years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one do...
[{"type": "stdin_stdout", "input": "250\n1 0 1 1 0 1 0 1 1 1 1 1 1 0 0 1 1 1 0 1 0 0 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 0 0 1 0 0 0 1 1 1 0 0 0 1 0 1 1 0 1 1 1 1 0 0 1 1 0 0 1 1 1 1 1 1 1 0 1 0 0 1 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 0 1 1 1 0 0 1 0 1 1 0 0 0 1 0 0 1 0 0 0 0 1 0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRingo found a string $s$ of length $n$ in his yellow submarine. The string contains only lowercase letters from the English alphabet. As Ringo and his friends love palindromes, he would like to turn the string $s$ into a ...
[{"type": "stdin_stdout", "input": "ittmcsvmoa\n", "output": "3\nL 2\nR 2\nR 19\n"}, {"type": "stdin_stdout", "input": "vdgcwgxbh\n", "output": "3\nL 2\nR 2\nR 17\n"}, {"type": "stdin_stdout", "input": "mcrpwaao\n", "output": "3\nL 2\nR 2\nR 15\n"}, {"type": "stdin_stdout", "input": "eaebyud\n", "output": "3\nL 2\nR 2\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe legend of the foundation of Vectorland talks of two integers $x$ and $y$. Centuries ago, the array king placed two markers at points $|x|$ and $|y|$ on the number line and conquered all the land in between (including ...
[{"type": "stdin_stdout", "input": "100\n404 523 -303 876 982 -275 498 287 255 491 -723 289 203 -796 -469 -299 -435 -869 58 577 55 600 153 -948 -11 726 129 797 -323 99 -934 -419 101 -307 -525 502 353 44 -905 371 -946 925 -538 614 -171 -867 -929 702 -429 720 94 -390 997 -803 451 379 57 -377 -545 -890 442 525 -975 -484 8...
code_stdio