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\nВ Берляндском государственном университете локальная сеть между серверами не всегда работает без ошибок. При передаче двух одинаковых сообщений подряд возможна ошибка, в результате которой эти два сообщения сливаются в од...
[{"type": "stdin_stdout", "input": "wajaubjjlsvvatkrwphykszmkwajaubjjlsvvatkrwphykszmkwajaubjjlsvvatkrwphykszmkwajaubjjlsvvatkrwphykszmk\n", "output": "YES\nwajaubjjlsvvatkrwphykszmkwajaubjjlsvvatkrwphykszmkwajaubjjlsvvatkrwphykszmk\n"}, {"type": "stdin_stdout", "input": "twfflboprkkjobbgoubmybfkbmmconrjhsktwfflboprkkj...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a famous olympiad, which has more than a hundred participants. The Olympiad consists of two stages: the elimination stage, and the final stage. At least a hundred participants will advance to the final stage. The...
[{"type": "stdin_stdout", "input": "2\n1 2 2 1\n4 8 12 4\n", "output": "3\n16\n"}, {"type": "stdin_stdout", "input": "2\n1 2 3 1\n4 8 12 4\n", "output": "4\n16\n"}, {"type": "stdin_stdout", "input": "2\n1 2 2 1\n4 8 9 2\n", "output": "3\n12\n"}, {"type": "stdin_stdout", "input": "2\n1 2 2 1\n4 8 9 4\n", "output": "3\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s consisting of |s| small english letters.\n\nIn one move you can replace any character of this string to the next character in alphabetical order (a will be replaced with b, s will be replaced with...
[{"type": "stdin_stdout", "input": "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzabcdefghijklmnopqrstuvwxyzaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"}, {"type": "stdin_stdout...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen Kefa came to the restaurant and sat at a table, the waiter immediately brought him the menu. There were n dishes. Kefa knows that he needs exactly m dishes. But at that, he doesn't want to order the same dish twice t...
[{"type": "stdin_stdout", "input": "18 17 16\n298794979 56088167 220017066 212013239 193074498 269869999 238524920 107690830 236214025 114513789 305713075 41451289 198089336 246759776 267311824 142373649 312495533 217782770\n9 4 70536531\n13 14 235114377\n18 4 38527037\n3 7 39141694\n1 17 15392162\n6 17 35451325\n17 14...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently Ivan the Fool decided to become smarter and study the probability theory. He thinks that he understands the subject fairly well, and so he began to behave like he already got PhD in that area.\n\nTo prove his ski...
[{"type": "stdin_stdout", "input": "100000 100000\n", "output": "870472905\n"}, {"type": "stdin_stdout", "input": "100000 100000\n", "output": "870472905\n"}, {"type": "stdin_stdout", "input": "86821 24538\n", "output": "1000000005\n"}, {"type": "stdin_stdout", "input": "99999 100000\n", "output": "758107445\n"}, {"typ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEverybody know that you passed to much time awake during night time...\n\nYour task here is to define how much coffee you need to stay awake after your night. \nYou will have to complete a function that take an array of e...
[{"input": "[\"cw\", \"CAT\", \"DOG\"]", "output": "[\"You need extra sleep\"]", "fn_name": "how_much_coffee"}, {"input": "[\"cw\", \"CAT\", \"cw=others\"]", "output": "[3]", "fn_name": "how_much_coffee"}, {"input": "[\"cw\", \"CAT\"]", "output": "[3]", "fn_name": "how_much_coffee"}, {"input": "[\"cw\"]", "output": "[1...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nA chess tournament will be held soon, where $n$ chess players will take part. Every participant will play one game against every other participant. Each game ends in either a win for one player and a loss for another play...
[{"type": "stdin_stdout", "input": "3\n3\n111\n2\n11\n4\n2122\n", "output": "YES\nX==\n=X=\n==X\nYES\nX=\n=X\nYES\nX=+-\n=X==\n-=X+\n+=-X\n"}, {"type": "stdin_stdout", "input": "3\n3\n111\n1\n1\n4\n2122\n", "output": "YES\nX==\n=X=\n==X\nYES\nX\nYES\nX=+-\n=X==\n-=X+\n+=-X\n"}, {"type": "stdin_stdout", "input": "3\n3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n— Hey folks, how do you like this problem?\n\n— That'll do it. \n\nBThero is a powerful magician. He has got $n$ piles of candies, the $i$-th pile initially contains $a_i$ candies. BThero can cast a copy-paste spell as fo...
[{"type": "stdin_stdout", "input": "3\n2 2\n2 1\n3 5\n1 3 3\n3 12\n1 2 2\n", "output": "0\n4\n20\n"}, {"type": "stdin_stdout", "input": "3\n2 2\n1 1\n3 10\n1 2 4\n3 7\n3 2 2\n", "output": "1\n14\n4\n"}, {"type": "stdin_stdout", "input": "3\n2 2\n2 1\n3 5\n1 3 3\n3 24\n1 2 2\n", "output": "0\n4\n44\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCalendars in widespread use today include the Gregorian calendar, which is the de facto international standard, and is used almost everywhere in the world for civil purposes. The Gregorian reform modified the Julian calen...
[{"type": "stdin_stdout", "input": "1900:01:01\n2038:12:31\n", "output": "50768\n"}, {"type": "stdin_stdout", "input": "1903:09:27\n1988:06:15\n", "output": "30943\n"}, {"type": "stdin_stdout", "input": "1915:01:01\n2007:07:01\n", "output": "33784\n"}, {"type": "stdin_stdout", "input": "1925:07:15\n2010:06:22\n", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs many of you know, we have two major calendar systems used in Japan today. One of them is Gregorian calendar which is widely used across the world. It is also known as “Western calendar” in Japan.\n\nThe other calendar ...
[{"type": "stdin_stdout", "input": "4 3\nmeiji 10 1877\ntaisho 6 1917\nrhowa 62 1987\nheisei 22 2010\n2046\n1917\n1988\n1 1\nuniversalbentury 218 2168\n2010\n0 0", "output": "Unknown\ntaisho 6\nUnknown\nuniversalbentury 60\n"}, {"type": "stdin_stdout", "input": "4 3\nmeiji 10 1877\nasisho 6 3102\nsiowa 62 1987\nieisei ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a white sheet of paper lying on a rectangle table. The sheet is a rectangle with its sides parallel to the sides of the table. If you will take a look from above and assume that the bottom left corner of the tabl...
[{"type": "stdin_stdout", "input": "676584 172869 696986 939949\n217531 247380 771662 973703\n630670 592931 1018961 967883\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "347722 718484 584813 736820\n280059 317406 1617512 588815\n388486 281361 399827 854715\n", "output": "YES\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMike and Joe are playing a game with some stones. Specifically, they have $n$ piles of stones of sizes $a_1, a_2, \\ldots, a_n$. These piles are arranged in a circle.\n\nThe game goes as follows. Players take turns removi...
[{"type": "stdin_stdout", "input": "1\n50\n260939408 52936453 298470524 981491199 699765 834662291 553329721 651730905 665925345 395625534 162042985 788733611 54572656 795877605 826562363 882540598 190947839 644851021 335204703 226590818 150893107 902210973 547195018 694426040 952704242 409352930 73032182 137337830 840...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $s$ of length $n$ and $t$ of length $m$.\n\nA sequence $p_1, p_2, \\ldots, p_m$, where $1 \\leq p_1 < p_2...
[{"type": "stdin_stdout", "input": "99 54\nfdabegacbffbgcacafcegfaegcacaegdbcabfgaecgbgfgefddggcdgebaaaccbcafdgcceabddfcacgdccfcgebccfffdaccac\nfdabegabffbgcaafcegfgcacaegdbcabfaecgbgfcgbccfffdaccac\n", "output": "40\n"}, {"type": "stdin_stdout", "input": "99 54\nfdabegacbffbgcacafcegfaegcacaegdbcabfgaecgbgfgefddggcdge...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nGiven a natural number N less than or equal to 12, find the smallest natural number such that the number of divisors is exactly N.\n\nConstraints\n\n* 1 ≤ N ≤ 12\n\nInput\n\nOne natural number N is given in one...
[{"type": "stdin_stdout", "input": "011", "output": "1024\n"}, {"type": "stdin_stdout", "input": "011", "output": "1024\n"}, {"type": "stdin_stdout", "input": "11", "output": "1024\n"}, {"type": "stdin_stdout", "input": "11", "output": "1024\n"}, {"type": "stdin_stdout", "input": "010", "output": "48\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider a string, $S$, of $n$ lowercase English letters where each character, $s_i$ ($0\\leq i<n)$, denotes the letter at index $\\boldsymbol{i}$ in $S$. We define an $(a,b,c,d)$ palindromic tuple of $S$ to be a sequence...
[{"type": "stdin_stdout", "input": "kkkkkkz\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "kkkkkkz\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "ghhggh\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "abbaab\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "akakak\n", "output": "2\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWinnie-the-Pooh likes honey very much! That is why he decided to visit his friends. Winnie has got three best friends: Rabbit, Owl and Eeyore, each of them lives in his own house. There are winding paths between each pair...
[{"type": "stdin_stdout", "input": "100\n100\n100\n100\n", "output": "9900\n"}, {"type": "stdin_stdout", "input": "100\n100\n100\n100\n", "output": "9900\n"}, {"type": "stdin_stdout", "input": "100\n100\n110\n100\n", "output": "9900\n"}, {"type": "stdin_stdout", "input": "100\n100\n111\n100\n", "output": "9900\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA rabbit is playing a role-playing game. Just before entering the castle, he was ambushed by an enemy!\n\nIt was a battle between one hero operated by a rabbit and n enemies. Each character has four stats, health hi, atta...
[{"type": "stdin_stdout", "input": "1\n-2 11 -1 -2\n11011 11101 11000 00111", "output": "-1\n"}, {"type": "stdin_stdout", "input": "1\n-2 17 -1 -2\n11011 11101 11000 00111", "output": "-1\n"}, {"type": "stdin_stdout", "input": "1\n-2 17 -1 -2\n11011 11101 11000 00011", "output": "-1\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi has come to a party as a special guest.\nThere are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.\nTakahashi has decided to perform M handshakes to increase the happiness of the part...
[{"type": "stdin_stdout", "input": "9 73\n67597 102019 5828 66249 138664 64141 11513 192153 16076", "output": "11787970\n"}, {"type": "stdin_stdout", "input": "9 73\n67597 52981 5828 66249 138664 64141 11513 192153 16076", "output": "10905286\n"}, {"type": "stdin_stdout", "input": "9 73\n67597 52981 5828 66249 138664 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N persons called Person 1 through Person N.\nYou are given M facts that \"Person A_i and Person B_i are friends.\" The same fact may be given multiple times.\nIf X and Y are friends, and Y and Z are friends, the...
[{"type": "stdin_stdout", "input": "4 10\n1 2\n2 1\n1 2\n2 1\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "1 0\n1 1\n1 2\n0 6\n-1 1\n1 4\n0 12\n2 1\n4 3\n2 4\n4 0", "output": "1\n"}, {"type": "stdin_stdout", "input": "1 0\n1 1\n1 2\n0 6\n-1 1\n1 4\n0 12\n2 1\n4 3\n2 4\n7 0", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin.\n\nWe can think Central Perk as coordinate plane. There a...
[{"type": "stdin_stdout", "input": "235810013 344493922 0 0 975204641 211157253\n18\n977686151 621301932\n408277582 166435161\n595105725 194278844\n967498841 705149530\n551735395 659209387\n492239556 317614998\n741520864 843275770\n585383143 903832112\n272581169 285871890\n339100580 134101148\n920610054 824829107\n6579...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNian is a monster which lives deep in the oceans. Once a year, it shows up on the land, devouring livestock and even people. In order to keep the monster away, people fill their villages with red colour, light, and cracki...
[{"type": "stdin_stdout", "input": "24 24\n299931317 581208095 975349898 832722683 817690798 482251493 336949323 145902930 573001018 802990442 898055771 253410043 150981561 225791789 53290960 405421751 723296526 565432511 256399554 374970926 22699716 104391316 121063780 149329252\n-295118728 -830122321 -294539299 -9059...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSoma is a fashionable girl. She absolutely loves shiny stones that she can put on as jewellery accessories. She has been collecting stones since her childhood - now she has become really good with identifying which ones a...
[{"type": "stdin_stdout", "input": "4\nacb\nabcdef\naA\nabAZ\naaa\na\nwhat\nnone", "output": "3\n2\n1\n0\n"}, {"type": "stdin_stdout", "input": "4\nacb\nabcdef\nAa\nabZA\naaa\n`\nwhat\nnone", "output": "3\n2\n0\n0\n"}, {"type": "stdin_stdout", "input": "4\naca\nebcdaf\naA\nAbZa\n`aa\n`\nswha\nnomf", "output": "2\n2\n1\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn a public bath, there is a shower which emits water for T seconds when the switch is pushed.\nIf the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds.\...
[{"type": "stdin_stdout", "input": "4 1000000000\n0 1000 1000000 1000000000\n", "output": "2000000000\n"}, {"type": "stdin_stdout", "input": "9 10\n0 3 5 7 100 110 200 300 311\n", "output": "67\n"}, {"type": "stdin_stdout", "input": "2 4\n0 3\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "2 4\n0 5\n", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nПрофиль горного хребта схематично задан в виде прямоугольной таблицы из символов «.» (пустое пространство) и «*» (часть горы). Каждый столбец таблицы содержит хотя бы одну «звёздочку». Гарантируется, что любой из символов...
[{"type": "stdin_stdout", "input": "20 20\n........*...........\n........*........*..\n........*........*..\n.**.....*.......**..\n.**.....*.......**..\n.**.....*.....*.**..\n.**.....*.....*.**..\n.**.....*.....*.**..\n.**.....*.....*.**..\n.**.*...*.....*.**..\n.**.*...*.....*.**..\n.**.*...*....**.**..\n.**.*...*..*....
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Task\n`EvilCode` is a game similar to `Codewars`. You have to solve programming tasks as quickly as possible. However, unlike `Codewars`, `EvilCode` awards you with a medal, depending on the time you took to solve the t...
[{"input": "\"00:30:00\"\n\"00:15:00\"\n\"00:45:00\"\n\"01:15:00\"", "output": "[\"Silver\"]", "fn_name": "evil_code_medal"}, {"input": "\"00:10:01\"\n\"00:00:10\"\n\"00:01:40\"\n\"01:00:00\"", "output": "[\"Bronze\"]", "fn_name": "evil_code_medal"}, {"input": "\"03:15:00\"\n\"03:15:00\"\n\"03:15:01\"\n\"03:15:02\"", "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given matrix with n rows and n columns filled with zeroes. You should put k ones in it in such a way that the resulting matrix is symmetrical with respect to the main diagonal (the diagonal that goes from the top ...
[{"type": "stdin_stdout", "input": "100 10000\n", "output": "1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCaisa solved the problem with the sugar and now he is on the way back to home. \n\nCaisa is playing a mobile game during his path. There are (n + 1) pylons numbered from 0 to n in this game. The pylon with number 0 has ze...
[{"type": "stdin_stdout", "input": "99\n1401 2019 1748 3785 3236 3177 3443 3772 2138 1049 353 1195 310 2388 1322 88 2160 2783 435 2248 1471 706 2468 2319 3156 3506 2794 1999 1983 2519 2597 3735 537 344 3519 3772 3872 2961 3895 2010 10 247 3269 671 2986 942 758 1146 77 1545 3745 1547 2250 2565 217 1406 2070 3010 3404 40...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's define the following recurrence: $$a_{n+1} = a_{n} + minDigit(a_{n}) \\cdot maxDigit(a_{n}).$$\n\nHere $minDigit(x)$ and $maxDigit(x)$ are the minimal and maximal digits in the decimal representation of $x$ without ...
[{"type": "stdin_stdout", "input": "8\n1 4\n487 1\n487 2\n487 3\n487 4\n487 5\n937 6\n487 1\n", "output": "42\n487\n519\n528\n544\n564\n1000\n487\n"}, {"type": "stdin_stdout", "input": "8\n1 4\n487 1\n487 2\n487 3\n487 4\n487 5\n487 6\n487 10\n", "output": "42\n487\n519\n528\n544\n564\n588\n716\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlyona decided to go on a diet and went to the forest to get some apples. There she unexpectedly found a magic rooted tree with root in the vertex 1, every vertex and every edge of which has a number written on.\n\nThe gi...
[{"type": "stdin_stdout", "input": "39\n100 110 92 26 10 63 56 85 14 64 25 50 75 51 11 41 78 53 52 96 63 12 48 88 57 57 25 52 69 45 4 97 5 87 58 15 72 59 100\n35 -60\n33 -39\n1 65\n11 -65\n34 -63\n38 84\n4 76\n22 -9\n4 -91\n23 -65\n18 7\n2 -17\n29 -15\n19 26\n29 23\n14 -12\n30 -72\n9 14\n12 -1\n27 -21\n32 -67\n7 -3\n26...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarpus is an amateur businessman. Recently he was surprised to find out that the market for paper scissors is completely free! Without further ado, Polycarpus decided to start producing and selling such scissors.\n\nP...
[{"type": "stdin_stdout", "input": "1000000000000000000 999999999999999999\n", "output": "999999999999999999\n"}, {"type": "stdin_stdout", "input": "1000010000000000000 999999999999999999\n", "output": "999999999999999999\n"}, {"type": "stdin_stdout", "input": "999999999999999998 999999999999999997\n", "output": "89999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOnce upon a time, a CodeWarrior, after reading a [discussion on what can be the plural](http://www.codewars.com/kata/plural/discuss/javascript), took a look at [this page](http://en.wikipedia.org/wiki/Grammatical_number#T...
[{"input": "\"6 birds with 2 wings each = 12 legs\"", "output": "[\"6 birdzo with 2 buwing each = 12 galegga\"]", "fn_name": "sursurungal"}, {"input": "\"\\n3 pigs\\nmet 1 wolf\\n2 days ago\"", "output": "[\"\\n3 pigzo\\nmet 1 wolf\\n2 buday ago\"]", "fn_name": "sursurungal"}, {"input": "\"111 bananas\"", "output": "[\...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke is conducting an optical experiment using mirrors and his new invention, the rifle of Mysterious Light.\n\nThree mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangl...
[{"type": "stdin_stdout", "input": "1435 1", "output": "4302\n"}, {"type": "stdin_stdout", "input": "1556 2", "output": "4662\n"}, {"type": "stdin_stdout", "input": "457 3", "output": "1368\n"}, {"type": "stdin_stdout", "input": "371 4", "output": "1110\n"}, {"type": "stdin_stdout", "input": "702 4", "output": "2100\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet us define the oddness of a permutation p = {p_1,\\ p_2,\\ ...,\\ p_n} of {1,\\ 2,\\ ...,\\ n} as \\sum_{i = 1}^n |i - p_i|.\nFind the number of permutations of {1,\\ 2,\\ ...,\\ n} of oddness k, modulo 10^9+7.\n\n----...
[{"type": "stdin_stdout", "input": "49 1200\n", "output": "366641438\n"}, {"type": "stdin_stdout", "input": "50 1250\n", "output": "472467292\n"}, {"type": "stdin_stdout", "input": "38 716\n", "output": "810790165\n"}, {"type": "stdin_stdout", "input": "31 344\n", "output": "996412950\n"}, {"type": "stdin_stdout", "inp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven a string, return the minimal number of parenthesis reversals needed to make balanced parenthesis. \n\nFor example:\n```Javascript\nsolve(\")(\") = 2 Because we need to reverse \")\" to \"(\" and \"(\" to \")\". Thes...
[{"input": "\"())()))))()()(\"", "output": "[4]", "fn_name": "solve"}, {"input": "\"())(((\"", "output": "[3]", "fn_name": "solve"}, {"input": "\")()(\"", "output": "[2]", "fn_name": "solve"}, {"input": "\"((()\"", "output": "[1]", "fn_name": "solve"}, {"input": "\"(((\"", "output": "[-1]", "fn_name": "solve"}]
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet w be a string consisting of lowercase letters.\nWe will call w beautiful if the following condition is satisfied:\n - Each lowercase letter of the English alphabet occurs even number of times in w.\nYou are given the ...
[{"type": "stdin_stdout", "input": "abaccaba\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "ab`cc`ba", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "ab`ccaba", "output": "No\n"}, {"type": "stdin_stdout", "input": "`b`cc`ba", "output": "No\n"}, {"type": "stdin_stdout", "input": "ab`cc`b`", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDLS and JLS are bored with a Math lesson. In order to entertain themselves, DLS took a sheet of paper and drew $n$ distinct lines, given by equations $y = x + p_i$ for some distinct $p_1, p_2, \\ldots, p_n$.\n\nThen JLS d...
[{"type": "stdin_stdout", "input": "7\n2\n1000000000 0\n2\n1000000000 0\n2\n1 0\n2\n1000000000 0\n2\n1 0\n2\n1 0\n2\n1000000000 0\n2\n1 0\n1\n999999999\n1\n99999999\n1\n1000000000\n1\n999999999\n3\n1000000000 999999999 999999998\n7\n2 3 5 7 10 11 12\n", "output": "4\n2\n2\n2\n1\n0\n10\n"}, {"type": "stdin_stdout", "inp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSam is an avid collector of numbers. Every time he finds a new number he throws it on the top of his number-pile. Help Sam organise his collection so he can take it to the International Number Collectors Conference in Col...
[{"input": "[3, 2, 6, 2, 1, 3]", "output": "[[[3, 3], [2, 2], [6], [1]]]", "fn_name": "group"}, {"input": "[1, 100, 4, 2, 4]", "output": "[[[1], [100], [4, 4], [2]]]", "fn_name": "group"}, {"input": "[3, 2, 6, 2]", "output": "[[[3], [2, 2], [6]]]", "fn_name": "group"}, {"input": "[-1, 1, -1]", "output": "[[[-1, -1], [1...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nOnce when Gerald studied in the first year at school, his teacher gave the class the following homework. She offered the students a string consisting of n small Latin letters; the task was to learn the way the letters tha...
[{"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n99\n", "output": "1\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, {"type": "stdin_stdout", "input": "geovcaxzjyhxbpnbkbsxfp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp has a string $s[1 \\dots n]$ of length $n$ consisting of decimal digits. Polycarp performs the following operation with the string $s$ no more than once (i.e. he can perform operation $0$ or $1$ time):\n\nPolycar...
[{"type": "stdin_stdout", "input": "6\n8\n20192020\n8\n22019020\n4\n2020\n5\n20002\n6\n729040\n6\n200200\n", "output": "\nYES\nYES\nYES\nNO\nNO\nNO\n"}, {"type": "stdin_stdout", "input": "6\n8\n20192020\n8\n22019020\n4\n2020\n5\n20002\n6\n729040\n6\n200200\n", "output": "YES\nYES\nYES\nNO\nNO\nNO\n"}, {"type": "stdin_s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ startups. Startups can be active or acquired. If a startup is acquired, then that means it has exactly one active startup that it is following. An active startup can have arbitrarily many acquired startups t...
[{"type": "stdin_stdout", "input": "50\n36 36 45 44 -1 -1 13 -1 36 -1 44 36 -1 -1 -1 35 -1 36 36 35 -1 -1 -1 14 36 36 22 36 13 -1 35 -1 35 36 -1 -1 13 13 45 36 14 -1 36 -1 -1 -1 22 36 -1 13\n", "output": "949472419\n"}, {"type": "stdin_stdout", "input": "50\n36 36 45 44 -1 -1 13 -1 36 -1 44 36 -1 -1 -1 35 -1 36 36 35 -...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Johnny has recently learned about set theory. Now he is studying binary relations. You've probably heard the term \"equivalence relation\". These relations are very important in many areas of mathematics. For examp...
[{"type": "stdin_stdout", "input": "4000\n", "output": "341934157\n"}, {"type": "stdin_stdout", "input": "3000\n", "output": "949793998\n"}, {"type": "stdin_stdout", "input": "3555\n", "output": "810675957\n"}, {"type": "stdin_stdout", "input": "2999\n", "output": "634360769\n"}, {"type": "stdin_stdout", "input": "3789...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday is Wednesday, the third day of the week. What's more interesting is that tomorrow is the last day of the year 2015.\n\nLimak is a little polar bear. He enjoyed this year a lot. Now, he is so eager to the coming year...
[{"type": "stdin_stdout", "input": "30 of month\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "17 of month\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "10 of month\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "11 of month\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "12 o...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N sightseeing spots on the x-axis, numbered 1, 2, ..., N. Spot i is at the point with coordinate A_i. It costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with c...
[{"type": "stdin_stdout", "input": "6\n-168 -101 -3258 1873 -20088 -2101", "output": "50438\n50438\n44258\n40310\n14598\n50572\n"}, {"type": "stdin_stdout", "input": "6\n-168 -101 -3258 1873 -20088 -1768", "output": "50438\n50438\n44258\n40310\n13932\n50572\n"}, {"type": "stdin_stdout", "input": "6\n-679 -3431 -3258 30...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAndrewid the Android is a galaxy-famous detective. He is now investigating a case of frauds who make fake copies of the famous Stolp's gears, puzzles that are as famous as the Rubik's cube once was.\n\nIts most important ...
[{"type": "stdin_stdout", "input": "100\n15 86 17 88 19 90 21 92 23 94 25 96 27 98 29 0 31 2 33 4 35 6 37 8 39 10 41 12 43 14 45 16 47 18 49 20 51 22 53 24 55 26 57 28 59 30 61 32 63 34 65 36 67 38 69 40 71 42 73 44 75 46 77 48 79 50 81 52 83 54 85 56 87 58 89 60 91 62 93 64 95 66 97 68 99 70 1 72 3 74 5 76 7 78 9 80 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three distinct integer horizontal s...
[{"type": "stdin_stdout", "input": "1000000 1000000\n1000000 999999\n1000000 999998\n999999 1000000\n999999 999998\n999998 1000000\n999998 999999\n999998 999998\n", "output": "respectable\n"}, {"type": "stdin_stdout", "input": "1000000 1000000\n1000000 999999\n1000000 999998\n999999 1000000\n999999 999998\n999998 10000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider some square matrix A with side n consisting of zeros and ones. There are n rows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from left to right in this matrix. We'll denote the eleme...
[{"type": "stdin_stdout", "input": "100\n", "output": "15"}, {"type": "stdin_stdout", "input": "010\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "001\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "011\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "61\n", "output": "11"}, {"type": "stdin_s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a binary matrix $A$ of size $n \\times n$. Let's denote an $x$-compression of the given matrix as a matrix $B$ of size $\\frac{n}{x} \\times \\frac{n}{x}$ such that for every $i \\in [1, n], j \\in [1, n]$ t...
[{"type": "stdin_stdout", "input": "16\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "16\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFD0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\n", "output": "1\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMasha works in an advertising agency. In order to promote the new brand, she wants to conclude contracts with some bloggers. In total, Masha has connections of $n$ different bloggers. Blogger numbered $i$ has $a_i$ follow...
[{"type": "stdin_stdout", "input": "3\n4 3\n1 3 1 2\n4 2\n1 1 1 1\n2 1\n1 2\n", "output": "\n2\n6\n1\n"}, {"type": "stdin_stdout", "input": "3\n4 3\n1 3 1 2\n4 2\n1 1 1 1\n2 1\n1 2\n", "output": "2\n6\n1\n"}, {"type": "stdin_stdout", "input": "3\n4 3\n1 3 1 2\n4 2\n1 2 1 1\n2 1\n1 2\n", "output": "2\n3\n1\n"}, {"type":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind pr...
[{"type": "stdin_stdout", "input": "100 17\n20 61 7 74 87 84 87 35 64 7 36 5 72 20 62 29 29 58 67 51 50 45 82 20 76 79 39 21 5 39 94 13 65 11 3 21 26 2 15 56 20 75 49 27 64 48 51 96 32 80 57 10 57 48 36 83 51 25 45 65 24 22 3 92 45 52 52 58 15 90 23 43 56 88 46 50 72 70 60 47 91 68 40 24 16 44 82 90 17 17 51 71 25 94 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwilight Sparkle learnt that the evil Nightmare Moon would return during the upcoming Summer Sun Celebration after one thousand years of imprisonment on the moon. She tried to warn her mentor Princess Celestia, but the pr...
[{"type": "stdin_stdout", "input": "10 10\n1 2\n3 1\n4 3\n1 5\n6 5\n7 4\n8 7\n9 5\n10 4\n6 10\n1 0 0 1 1 0 1 1 0 0\n", "output": "33\n8 7 4 10 6 5 9 5 9 5 1 3 1 3 1 2 1 2 1 5 6 5 6 10 6 10 4 10 4 7 8 7 8 \n"}, {"type": "stdin_stdout", "input": "10 10\n1 2\n3 1\n4 3\n1 5\n6 1\n7 4\n8 7\n9 5\n10 4\n6 10\n1 0 0 1 1 0 1 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads a rectangle and a circle, and determines whether the circle is arranged inside the rectangle. As shown in the following figures, the upper right coordinate $(W, H)$ of the rectangle and the cen...
[{"type": "stdin_stdout", "input": "-2 -1 0 10 -18", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-2 -1 0 11 -18", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-2 1 3 10 -18", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-2 0 3 10 -18", "output": "Yes\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's consider one interesting word game. In this game you should transform one word into another through special operations. \n\nLet's say we have word w, let's split this word into two non-empty parts x and y so, that w...
[{"type": "stdin_stdout", "input": "dkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjij\ndddkikjjidkkidijjjjkkjjikjdikiidijjikikjijjiijdikkjjjiddjjijkkkjkiijijki...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are to write a function to transpose a guitar tab up or down a number of semitones. The amount to transpose is a number, positive or negative. The tab is given as an array, with six elements for each guitar string (fi...
[{"input": "2\n[\"e|-----------------------------------------------------------------------------|\", \"B|---------------------------8-----------------------8-------------------------|\", \"G|-------------------------7-----------------------7---------------------------|\", \"D|----8-----8-----8----8/9-------7-7/5-0----...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nPlease find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.\n\n\n\nInput\n\nThe input file consists of several lines with pairs of two natural numbers i...
[{"type": "stdin_stdout", "input": "010 90\n11 496", "output": "10\n1\n"}, {"type": "stdin_stdout", "input": "102 24\n101 116", "output": "6\n1\n"}, {"type": "stdin_stdout", "input": "110 103\n30 10", "output": "1\n10\n"}, {"type": "stdin_stdout", "input": "98 224\n28 84", "output": "14\n28\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the computer network of the Berland State University there are n routers numbered from 1 to n. Some pairs of routers are connected by patch cords. Information can be transmitted over patch cords in both direction. The ...
[{"type": "stdin_stdout", "input": "10\n2:7,4-2:5,8-1:3-1:6-1:2-2:10,9\n9:6,7,3,4,10,8,9,5,1\n9:2,1,7,6,9,4,8,10,5\n8:5,2,1,3,6,9,10,8-1:7\n1:8-8:9,10,2,6,3,1,7,4\n9:8,4,1,2,10,9,7,3,5\n9:1,3,6,2,9,10,5,8,4\n9:5,2,7,3,6,4,10,1,9\n9:3,7,6,8,10,5,1,2,4\n1:9-8:2,7,3,6,8,5,1,4\n", "output": "9\n1 2\n1 3\n1 4\n1 5\n1 6\n1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nZS the Coder and Chris the Baboon has arrived at Udayland! They walked in the park where n trees grow. They decided to be naughty and color the trees in the park. The trees are numbered with integers from 1 to n from left...
[{"type": "stdin_stdout", "input": "8 6 6\n0 0 0 0 0 0 0 0\n709812879 751993522 552838834 932579085 381597201 889756688\n77223016 35398130 932703875 852137134 124534767 472656085\n828677108 158247840 540181954 573979204 389860841 490718346\n666733838 404533406 50010075 311518758 460372535 69832342\n591244215 400838850 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasily exited from a store and now he wants to recheck the total price of all purchases in his bill. The bill is a string in which the names of the purchases and their prices are printed in a row without any spaces. Check...
[{"type": "stdin_stdout", "input": "amhppqxei543.370.32o544.196nocwgxticn776.562nm212.195dcftrrg635.773n646.814.94vrfmjjsgoi405.114k821.983.12rb749.955.62jifmdlgs615.101hg42.083.41gdqififg908.729qrrgopyn684.451avcjul727.150s864.068bcd196.732.37jd349.984.25ghn379.763.11dw881.650.19eysthrm790.534.68gilg546.048qs648.876pd...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecenlty Luba got a credit card and started to use it. Let's consider n consecutive days Luba uses the card.\n\nShe starts with 0 money on her account.\n\nIn the evening of i-th day a transaction a_{i} occurs. If a_{i} > ...
[{"type": "stdin_stdout", "input": "20 23036\n-1 1 -1 -1 -1 -1 1 -1 -1 0 0 1 1 0 -1 1 0 1 -1 -1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "20 23036\n-1 1 -1 -1 -1 -1 1 -1 -2 0 0 1 1 0 -1 1 0 1 -1 -1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "20 23036\n-1 1 -1 -1 -1 -1 1 -1 -2 0 0 1 1 0 -1 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is the easy version of the problem. The difference between the versions is the constraints on a_i. You can make hacks only if all versions of the problem are solved.\n\nLittle Dormi has recently received a puzzle fro...
[{"type": "stdin_stdout", "input": "5 7\n#....#.\n.#.#...\n#....#.\n#....##\n#.#....\n4 1 1 1 0 3 1\n", "output": "\n3\n"}, {"type": "stdin_stdout", "input": "3 10\n#..###..##\n...#..###.\n.###..##..\n1 1 1 3 1 1 2 2 2 1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "3 6\n..#..#\n......\n#####.\n1 1 2 1 1 1\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven a non-negative integer, return an array / a list of the individual digits in order.\n\nExamples:\n\n```\n123 => [1,2,3]\n\n1 => [1]\n\n8675309 => [8,6,7,5,3,0,9]\n```\n\nWrite your solution by modifying this code:\n...
[{"input": "8675309", "output": "[[8, 6, 7, 5, 3, 0, 9]]", "fn_name": "digitize"}, {"input": "1230", "output": "[[1, 2, 3, 0]]", "fn_name": "digitize"}, {"input": "123", "output": "[[1, 2, 3]]", "fn_name": "digitize"}, {"input": "1", "output": "[[1]]", "fn_name": "digitize"}, {"input": "0", "output": "[[0]]", "fn_name"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven two arrays of integers `m` and `n`, test if they contain *at least* one identical element. Return `true` if they do; `false` if not.\n\nYour code must handle any value within the range of a 32-bit integer, and must ...
[{"input": "[-2398632, -9172846, -4728162]\n[-2398632, -9235623, -8235492]", "output": "[true]", "fn_name": "duplicate_elements"}, {"input": "[2398632, 9172846, 4728162]\n[2398632, 9235623, 8235492]", "output": "[true]", "fn_name": "duplicate_elements"}, {"input": "[-2, -4, -6, -8]\n[-2, -3, -5, -7]", "output": "[true]...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya has a sequence $a$ consisting of $n$ integers $a_1, a_2, \\dots, a_n$. Vasya may pefrom the following operation: choose some number from the sequence and swap any pair of bits in its binary representation. For examp...
[{"type": "stdin_stdout", "input": "5\n1000000000000000000 352839520853234088 175235832528365792 753467583475385837 895062156280564685\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "5\n1000000000000000000 352839520853234088 175235832528365792 753467583475385837 895062156280564685\n", "output": "3\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour task is to write a function named `do_math` that receives a single argument. \nThis argument is a string that contains multiple whitespace delimited numbers. Each number has a single alphabet letter somewhere within ...
[{"input": "\"111a 222c 444y 777u 999a 888p\"", "output": "[1459]", "fn_name": "do_math"}, {"input": "\"10a 90x 14b 78u 45a 7b 34y\"", "output": "[60]", "fn_name": "do_math"}, {"input": "\"24z6 1z23 y369 89z 900b\"", "output": "[1414]", "fn_name": "do_math"}, {"input": "\"24z6 1x23 y369 89a 900b\"", "output": "[1299]",...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates...
[{"type": "stdin_stdout", "input": "1000 1000 6 1\n", "output": "1997.69677296990135817456\n"}, {"type": "stdin_stdout", "input": "858 203 11 21\n", "output": "1031.72462874262234588940\n"}, {"type": "stdin_stdout", "input": "944 305 10 32\n", "output": "1142.87647693641628066086\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two arrays $a$ and $b$, each contains $n$ integers.\n\nYou want to create a new array $c$ as follows: choose some real (i.e. not necessarily integer) number $d$, and then for every $i \\in [1, n]$ let $c_i :...
[{"type": "stdin_stdout", "input": "5\n-999999999 999999999 1252085585 999999998 -414067761\n-1011239935 -1000000000 -1000000000 -1397885361 1010000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n-999999999 999999999 1252085585 999999998 -421666581\n-1011239935 -1000000000 -1000000000 -1397885361 101000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDeoxyribonucleic acid (DNA) is a chemical found in the nucleus of cells and carries the \"instructions\" for the development and functioning of living organisms.\n\nIf you want to know more http://en.wikipedia.org/wiki/DN...
[{"input": "\"GTATCGATCGATCGATCGATTATATTTTCGACGAGATTTAAATATATATATATACGAGAGAATACAGATAGACAGATTA\"", "output": "[\"CATAGCTAGCTAGCTAGCTAATATAAAAGCTGCTCTAAATTTATATATATATATGCTCTCTTATGTCTATCTGTCTAAT\"]", "fn_name": "DNA_strand"}, {"input": "\"ATTGC\"", "output": "[\"TAACG\"]", "fn_name": "DNA_strand"}, {"input": "\"AAAA\"", "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nA daily train consists of N cars. Let's consider one particular car. It has 54 places numbered consecutively from 1 to 54, some of which are already booked and some are still free. The places are numbered in the following...
[{"type": "stdin_stdout", "input": "1 3\n100101110000001011000001111110010011110010010111000101\n001010000000101111100000000000000111101010101111111010\n011110011110000001010000101110001011111010001001111010", "output": "86\n"}, {"type": "stdin_stdout", "input": "1 3\n100101110000001111000001111110010011110010010111000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSerge came to the school dining room and discovered that there is a big queue here. There are $m$ pupils in the queue. He's not sure now if he wants to wait until the queue will clear, so he wants to know which dish he wi...
[{"type": "stdin_stdout", "input": "5 1\n8 4 8 7 3\n9\n5\n2 1 3\n1 5 1\n2 1 13\n2 1 7\n2 1 3\n", "output": "8\n8\n8\n8\n8\n"}, {"type": "stdin_stdout", "input": "5 1\n8 4 8 7 3\n13\n5\n2 1 3\n1 1 1\n2 1 8\n2 1 7\n2 1 3\n", "output": "8\n8\n7\n8\n8\n"}, {"type": "stdin_stdout", "input": "5 1\n8 1 8 7 3\n9\n5\n2 1 3\n1 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.\n(Assume that the positive x-axis points right, and the positive y-axis p...
[{"type": "stdin_stdout", "input": "67 -89 -90 -11\n", "output": "-168 -168 -11 -246\n"}, {"type": "stdin_stdout", "input": "-100 100 100 -100\n", "output": "300 100 100 300\n"}, {"type": "stdin_stdout", "input": "0 -100 -100 100\n", "output": "-300 0 -200 -200\n"}, {"type": "stdin_stdout", "input": "31 -41 -59 26\n", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\n* For each i = 1,2,..., n-2, a_i = a_{i+2}.\n* Exactly two different numbers appear in the sequence.\n\n\n\nYou are give...
[{"type": "stdin_stdout", "input": "6\n105 119 204 119 105 119", "output": "1\n"}, {"type": "stdin_stdout", "input": "6\n105 119 204 119 105 78", "output": "2\n"}, {"type": "stdin_stdout", "input": "6\n105 119 105 81 105 119", "output": "1\n"}, {"type": "stdin_stdout", "input": "6\n105 119 204 119 105 81", "output": "2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a function that takes an integer and returns an array `[A, B, C]`, where `A` is the number of multiples of 3 (but not 5) below the given integer, `B` is the number of multiples of 5 (but not 3) below the given integ...
[{"input": "91415", "output": "[[24377, 12188, 6094]]", "fn_name": "solution"}, {"input": "2020", "output": "[[539, 269, 134]]", "fn_name": "solution"}, {"input": "1415", "output": "[[377, 188, 94]]", "fn_name": "solution"}, {"input": "300", "output": "[[80, 40, 19]]", "fn_name": "solution"}, {"input": "141", "output":...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Patisserie AtCoder sells cakes with number-shaped candles.\nThere are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively.\nEach cake has an integer value called deliciousness, as foll...
[{"type": "stdin_stdout", "input": "1000 1000 1000 3000\n8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801 8864823801...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour favorite shop sells n Kinder Surprise chocolate eggs. You know that exactly s stickers and exactly t toys are placed in n eggs in total.\n\nEach Kinder Surprise can be one of three types:\n\n * it can contain a sing...
[{"type": "stdin_stdout", "input": "4\n1 1 1\n1000000000 1000000000 1000000000\n1000000000 999999999 1\n1247516660 666666667 666666666\n", "output": "1\n1\n1000000000\n580849995\n"}, {"type": "stdin_stdout", "input": "4\n1 1 1\n1000000000 1000000000 1000000000\n1000000000 999999999 1\n999999999 666666667 666666666\n", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou probably know the 42 number as \"The answer to life, the universe and everything\" according to Douglas Adams' \"The Hitchhiker's Guide to the Galaxy\". For Freud, the answer was quite different.\n\nIn the society he ...
[{"input": "\"You're becoming a true freudian expert\"", "output": "[\"sex sex sex sex sex sex\"]", "fn_name": "to_freud"}, {"input": "\"This is a longer test\"", "output": "[\"sex sex sex sex sex\"]", "fn_name": "to_freud"}, {"input": "\"This is a test\"", "output": "[\"sex sex sex sex\"]", "fn_name": "to_freud"}, {"i...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecall that the sequence $b$ is a a subsequence of the sequence $a$ if $b$ can be derived from $a$ by removing zero or more elements without changing the order of the remaining elements. For example, if $a=[1, 2, 1, 3, 1,...
[{"type": "stdin_stdout", "input": "10\n10\n-1 5 10 2 -8 -7 -6 5 -3 -1\n10\n2 2 1 4 5 6 12 3 9 10\n1\n6\n1\n-7\n11\n5 -4 1 2 3 -5 -7 -10 -2 1 12\n4\n-4 -5 -6 1\n7\n1 2 6 1 2 -6 -2\n5\n-1 -5 4 -2 -9\n1\n9\n3\n1 -1 1\n", "output": "7\n12\n6\n-7\n14\n-3\n4\n1\n9\n1\n"}, {"type": "stdin_stdout", "input": "10\n10\n-1 5 17 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one...
[{"type": "stdin_stdout", "input": "500 50\n72 474 467 241 442 437 336 234 410 120 438 164 405 177 142 114 27 20 445 235 46 176 88 488 242 391 28 414 145 92 206 334 152 343 367 254 100 243 155 348 148 450 461 483 97 34 471 69 416 362\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "500 50\n72 474 467 241 442 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHiking club \"Up the hill\" just returned from a walk. Now they are trying to remember which hills they've just walked through.\n\nIt is known that there were N stops, all on different integer heights between 1 and N kilo...
[{"type": "stdin_stdout", "input": "700\n399\n", "output": "400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou've got a string $S$ consisting of $n$ lowercase English letters from your friend. It turned out that this is a number written in poman numerals. The poman numeral system is long forgotten. All that's left is the algor...
[{"type": "stdin_stdout", "input": "49 3\nabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "49 3\nbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "7 -475391\nqohshra\n", "output": "Yes\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven three distinct integers $a$, $b$, and $c$, find the medium number between all of them.\n\nThe medium number is the number that is neither the minimum nor the maximum of the given three numbers.\n\nFor example, the m...
[{"type": "stdin_stdout", "input": "69\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the good old days, the Internet was free from fears and terrorism. People did not have to worry about any cyber criminals or mad computer scientists. Today, however, you are facing atrocious crackers wherever you are, ...
[{"type": "stdin_stdout", "input": "2 5\npermit 192168?? ?12??34?\ndeny 19216899 012243?5\n19216711 11233340 HiIamACracker\n19216891 01234345 Hello\n19216899 01234345 HiIamAlsoACracker\n19216809 11200340 World\n00000000 99999999 TheEndOfTheWorld\n1 2\npermit 12345678 23456789\n19216891 01234345 Hello\n12345678 23456789...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs technologies develop, manufacturers are making the process of unlocking a phone as user-friendly as possible. To unlock its new phone, Arkady's pet dog Mu-mu has to bark the password once. The phone represents a passwo...
[{"type": "stdin_stdout", "input": "bn\n100\ndf\nyb\nze\nml\nyr\nof\nnw\nfm\ndw\nlv\nzr\nhu\nzt\nlw\nld\nmo\nxz\ntp\nmr\nou\nme\npx\nvp\nes\nxi\nnr\nbx\nqc\ngm\njs\nkn\ntw\nrq\nkz\nuc\nvc\nqr\nab\nna\nro\nya\nqy\ngu\nvk\nqk\ngs\nyq\nop\nhw\nrj\neo\nlz\nbh\nkr\nkb\nma\nrd\nza\nuf\nhq\nmc\nmn\nti\nwn\nsh\nax\nsi\nnd\ntz\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp plays \"Game 23\". Initially he has a number $n$ and his goal is to transform it to $m$. In one move, he can multiply $n$ by $2$ or multiply $n$ by $3$. He can perform any number of moves.\n\nPrint the number of ...
[{"type": "stdin_stdout", "input": "289777775 341477104\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "100000000 100000001\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "289777775 341477104\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "100000000 100000001\n", "output": "-1\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe year of 2012 is coming...\n\nAccording to an ancient choradrican legend in this very year, in 2012, Diablo and his brothers Mephisto and Baal will escape from hell, and innumerable hordes of demons will enslave the hu...
[{"type": "stdin_stdout", "input": "22\nCleo likes Snowy\nCleo likes Troll\nChapay likes Dracul\nSnowy likes Troll\nDracul likes Chapay\nDracul likes Snowy\nChapay likes Cleo\nSnowy likes Chapay\nDracul likes Troll\nAnka likes Hexadecimal\nSnowy likes Anka\nHexadecimal likes Cleo\nHexadecimal likes Troll\nDracul likes ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSpecial Agent Smart Beaver works in a secret research department of ABBYY. He's been working there for a long time and is satisfied with his job, as it allows him to eat out in the best restaurants and order the most expe...
[{"type": "stdin_stdout", "input": "1023456789??????????????????????????????????????ABCDIFGHIJ\n", "output": "362880000000000000000000000000000000000000000"}, {"type": "stdin_stdout", "input": "?GJ??\n", "output": "81000\n"}, {"type": "stdin_stdout", "input": "BA?C?\n", "output": "64800\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi throws N dice, each having K sides with all integers from 1 to K. The dice are NOT pairwise distinguishable.\nFor each i=2,3,...,2K, find the following value modulo 998244353:\n - The number of combinations of N...
[{"type": "stdin_stdout", "input": "2000 3\n", "output": "337087647\n337087647\n337085647\n337085647\n337083647\n337083647\n337081647\n337081647\n337079647\n337079647\n337077647\n337077647\n337075647\n337075647\n337073647\n337073647\n337071647\n337071647\n337069647\n337069647\n337067647\n337067647\n337065647\n337065647...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAre you fond of collecting some kind of stuff? Mike is crazy about collecting stamps. He is an active member of Stamp Collecting Сommunity(SCC). \n\nSCC consists of N members which are fond of philately. A few days ago Mi...
[{"type": "stdin_stdout", "input": "5\n7 4 1 1 2\n\n\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "5\n1 1 1 1 1\n\n\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "5\n13 1 1 1 -1", "output": "YES\n"}, {"type": "stdin_stdout", "input": "5\n13 0 1 1 -1", "output": "NO\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGleb ordered pizza home. When the courier delivered the pizza, he was very upset, because several pieces of sausage lay on the crust, and he does not really like the crust.\n\nThe pizza is a circle of radius r and center ...
[{"type": "stdin_stdout", "input": "10 2\n11\n1 1 0\n2 2 3\n3 3 0\n6 4 0\n5 5 0\n6 6 0\n7 7 4\n8 8 7\n9 18 3\n10 10 100\n9 0 1\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "10 2\n11\n1 1 0\n2 2 3\n3 3 0\n6 4 0\n5 5 0\n6 6 0\n7 7 8\n8 8 7\n9 18 3\n10 10 100\n9 0 1\n", "output": "2\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\nanagram\ngrandmother\n\n\nOutput\n\n4\n\nThe input will be stdin and you should print your solution to stdout\n\n\nNow solve the problem and return the code.\n\nWrite Python code to solve this problem....
[{"type": "stdin_stdout", "input": "anagram\ngrandmosher", "output": "4\n"}, {"type": "stdin_stdout", "input": "anbgram\ngrandmosher", "output": "3\n"}, {"type": "stdin_stdout", "input": "anbfram\ngrandmosher", "output": "2\n"}, {"type": "stdin_stdout", "input": "narfamb\nreoahmodsrg", "output": "1\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday is Devu's birthday. For celebrating the occasion, he bought n sweets from the nearby market. He has invited his f friends. He would like to distribute the sweets among them. As he is a nice guy and the occasion is g...
[{"type": "stdin_stdout", "input": "40\n37 15\n48 10\n16 5\n30 23\n32 20\n24 4\n46 19\n16 13\n1 1\n37 22\n44 29\n24 6\n27 10\n39 16\n28 13\n5 4\n31 22\n9 2\n30 26\n23 16\n16 12\n43 5\n29 1\n20 5\n40 12\n18 14\n22 15\n29 2\n3 2\n6 3\n45 28\n42 34\n43 32\n10 10\n12 8\n10 8\n4 1\n17 17\n16 7\n8 7\n", "output": "796297179\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA sequence of non-negative integers $a_1, a_2, \\dots, a_n$ is called growing if for all $i$ from $1$ to $n - 1$ all ones (of binary representation) in $a_i$ are in the places of ones (of binary representation) in $a_{i +...
[{"type": "stdin_stdout", "input": "5\n4\n1 3 7 15\n4\n1 2 4 8\n5\n1 2 3 4 5\n4\n11 13 15 1\n1\n0\n", "output": "0 0 0 0 \n0 1 3 7 \n0 1 0 3 2 \n0 2 0 14 \n0 \n"}, {"type": "stdin_stdout", "input": "5\n4\n4 3 7 20\n4\n1 2 4 5\n5\n1 0 3 4 5\n4\n11 16 15 1\n1\n0\n", "output": "0 4 0 3\n0 1 3 2\n0 1 0 3 2\n0 11 16 30\n0\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nINTERCAL is the oldest of esoteric programming languages. One of its many weird features is the method of character-based output, known as Turing Tape method. It converts an array of unsigned 8-bit integers into a sequenc...
[{"type": "stdin_stdout", "input": "aMCT]:0hDJ*Up5g_l:O&>>%gjQkZkb(mi&;\\7dL\"nWOGz/;,6h*@Q0R53MS2<}F~+Ms\\\"cF-lgF0>C&y7)72\\.T\"8*#VO=|^OtYs\n", "output": "122\n212\n240\n152\n112\n94\n80\n246\n244\n208\n254\n170\n156\n98\n198\n236\n196\n218\n106\n142\n232\n0\n216\n190\n144\n204\n180\n124\n132\n144\n50\n94\n32\n50\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIntroduction \n\nMr. Safety loves numeric locks and his Nokia 3310. He locked almost everything in his house. He is so smart and he doesn't need to remember the combinations. He has an algorithm to generate new passcodes ...
[{"input": "\"waterheater\"", "output": "[\"92837432837\"]", "fn_name": "unlock"}, {"input": "\"birdhouse\"", "output": "[\"247346873\"]", "fn_name": "unlock"}, {"input": "\"toilet\"", "output": "[\"864538\"]", "fn_name": "unlock"}, {"input": "\"Nokia\"", "output": "[\"66542\"]", "fn_name": "unlock"}, {"input": "\"Valu...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nBackground\nThere is a message that is circulating via public media that claims a reader can easily read a message where the inner letters of each words is scrambled, as long as the first and last letters remain the same ...
[{"input": "\"you've gotta dance like there's nobody watching, love like you'll never be hurt, sing like there's nobody listening, and live like it's heaven on earth.\"", "output": "[\"you've gotta dacne like teehr's nbdooy wachintg, love like ylo'ul neevr be hrut, sing like teehr's nbdooy leiinnstg, and live like it's...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya lives in a strange world. The year has n months and the i-th month has ai days. Vasya got a New Year present — the clock that shows not only the time, but also the date.\n\nThe clock's face can display any number fr...
[{"type": "stdin_stdout", "input": "103\n100\n68 38 41 54 37 11 35 26 43 97 70 3 13 11 64 83 3 95 17 16 4 13 22 27 64 20 95 38 40 87 6 17 95 67 31 24 85 33 98 24 89 101 66 38 42 5 95 18 95 13 103 85 72 73 68 93 22 59 48 59 72 46 5 41 54 32 48 69 3 76 2 26 102 44 39 58 55 85 40 16 81 78 92 63 25 97 83 2 54 16 20 63 19 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two positive integer numbers a and b. Permute (change order) of the digits of a to construct maximal number not exceeding b. No number in input and/or output can start with the digit 0.\n\nIt is allowed to l...
[{"type": "stdin_stdout", "input": "1000000000000000000\n1000000000000000000\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "1000000000000000000\n1000000000000000000\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "1000000000000000000\n1000000000100000000\n", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVova plays a computer game known as Mages and Monsters. Vova's character is a mage. Though as he has just started, his character knows no spells.\n\nVova's character can learn new spells during the game. Every spell is ch...
[{"type": "stdin_stdout", "input": "15 100\n1 8 8\n2 200 101\n2 10 99\n1 9 9\n2 10 99\n2 200 101\n1 14 4\n2 194 195\n2 194 194\n2 990 290\n1 2 999992\n2 6 256\n2 7 256\n2 2 999988\n2 2 252\n", "output": "NO\nNO\nYES\nNO\nNO\nYES\nNO\nNO\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "15 100\n1 8 8\n2 200 101\n2 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA certain type of steel is graded according to the following conditions.\n\n1. Hardness of the steel must be greater than 50\n2. Carbon content of the steel must be less than 0.7\n3. Tensile strength must be greater than ...
[{"type": "stdin_stdout", "input": "3 \n127 1.5460478864469624 13440\n71 -1 8462\n1 -1 0", "output": "7\n10\n6\n"}, {"type": "stdin_stdout", "input": "3 \n127 1.5460478864469624 13440\n16 -1 14390\n1 -2 0", "output": "7\n8\n6\n"}, {"type": "stdin_stdout", "input": "3 \n127 2.9825462611697358 13440\n16 -2 14390\n1 -2 0"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAshish has an array $a$ of size $n$.\n\nA subsequence of $a$ is defined as a sequence that can be obtained from $a$ by deleting some elements (possibly none), without changing the order of the remaining elements.\n\nConsi...
[{"type": "stdin_stdout", "input": "10 4\n91239 51189 50977 96098 56330 55725 6448 7351 60071 93359\n", "output": "50977\n"}, {"type": "stdin_stdout", "input": "10 4\n91239 51189 50977 96098 56330 55725 6448 7351 82063 93359\n", "output": "50977\n"}, {"type": "stdin_stdout", "input": "10 4\n30551 51189 50977 96098 5633...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBroken crypto generator\n\nJAG (Japanese Alumni Group) is a mysterious organization composed of many programmers, and in order to enter the building where the headquarters of this organization is located, it is necessary ...
[{"type": "stdin_stdout", "input": "A+A++A\nZ-Z--Z+-Z\n[ESRVEER]\nJ---?---J\n++++++++A+++Z-----------A+++Z\n[[++-+--?[--++-?++-+++L]][-+-----+-O]]++++---+L\n.", "output": "ABC\nZYXZ\nREEVRSE\nJAG\nICPC\nJAPAN\n"}, {"type": "stdin_stdout", "input": "A+A++A\nZ-ZZ--+-Z\n[ESRVEER]\nJ---?---J\n++++++++A+++Z-----------A+++Z\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have $n$ students under your control and you have to compose exactly two teams consisting of some subset of your students. Each student had his own skill, the $i$-th student skill is denoted by an integer $a_i$ (diffe...
[{"type": "stdin_stdout", "input": "4\n7\n4 2 4 1 4 3 4\n5\n2 1 5 4 3\n1\n1\n4\n1 1 1 3\n", "output": "3\n1\n0\n2\n"}, {"type": "stdin_stdout", "input": "4\n7\n4 2 4 1 4 3 4\n5\n2 1 5 1 3\n1\n1\n4\n1 1 1 3\n", "output": "3\n2\n0\n2\n"}, {"type": "stdin_stdout", "input": "4\n7\n4 2 4 1 4 3 4\n5\n2 1 2 1 3\n1\n1\n4\n1 1 ...
code_stdio