messages
listlengths
1
1
ground_truth
stringlengths
156
726k
dataset
stringclasses
2 values
[ { "content": "Qwerty the Ranger took up a government job and arrived on planet Mars. He should stay in the secret lab and conduct some experiments on bacteria that have funny and abnormal properties. The job isn't difficult, but the salary is high.\n\nAt the beginning of the first experiment there is a single b...
[{"input": "1000000 1000000 1000000 1000000\n", "output": "1000000\n"}, {"input": "1000000 1001000 1000000 1000000\n", "output": "1000000\n"}, {"input": "100000 100000 1000010 1000000\n", "output": "1000009\n"}, {"input": "100000 100000 1000000 1000000\n", "output": "999999\n"}, {"input": "722229 410423 118215 838505\n...
code_stdio
[ { "content": "Read problems statements in Mandarin Chinese . \n\nYou are given two strings A and B of the same length. Each string contains N Lower case Latin character (from 'a' to 'z'). A shift operation will remove the first character of a string and add the same character at the end of that string. For exam...
[{"input": "5\nccade\nbddcc", "output": "3\n"}, {"input": "5\nccade\nccdcb", "output": "0\n"}, {"input": "5\nddacc\nbddcc", "output": "1\n"}, {"input": "5\nddacc\nccddb", "output": "2\n"}, {"input": "5\nccade\nbcdcc", "output": "3\n"}, {"input": "5\ncacde\nccdcb", "output": "0\n"}, {"input": "5\nc`cde\nccdcb", "output"...
code_stdio
[ { "content": "Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is YES or NO.\nWhen he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases.\nThen, he rewrote the code to correctl...
[{"input": "5 13", "output": "195788800\n"}, {"input": "100 5\n", "output": "608000\n"}, {"input": "3 10", "output": "18739200\n"}, {"input": "10 7", "output": "1740800\n"}, {"input": "110 5", "output": "640000\n"}, {"input": "15 7", "output": "1804800\n"}, {"input": "111 4", "output": "292800\n"}, {"input": "111 3", "...
code_stdio
[ { "content": "Read problems statements in Mandarin Chinese and Russian. \n\nAlok-nath is man of equality. He needs your help to divide his “sanskars” evenly amongst all his followers. By doing this, Alok-nath can create equality amongst his followers and he'll be called a true “sanskari”.\n\nAlok-nath has N sa...
[{"input": "2\n6 3\n1 4 14 4 11\n5 2\n-1 2 0 14 4", "output": "no\nno\n"}, {"input": "2\n6 3\n1 4 14 4 11\n5 4\n-1 2 0 14 4", "output": "no\nno\n"}, {"input": "2\n5 3\n1 2 14 4 11\n5 2\n-1 2 0 8 7", "output": "no\nno\n"}, {"input": "2\n5 3\n1 4 14 4 11\n5 2\n-1 2 0 8 7", "output": "no\nno\n"}, {"input": "2\n1 3\n0 2 12...
code_stdio
[ { "content": "Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.\n\nThe valid sizes of T-shirts are either \"M\" or from $0$ to $3$ \"X\" followed by \"S\" or \"L\". For example, sizes \"M\", \"XXS\", \"L\", \"XXXL\" are...
[{"input": "43\nL\nXXXL\nM\nXS\nL\nXXL\nS\nL\nM\nXXXL\nXXS\nS\nXS\nS\nXS\nXL\nXXL\nXXL\nXS\nXXS\nXXL\nL\nXXXL\nL\nL\nXXL\nXXL\nM\nXXXS\nM\nXXL\nXXXS\nXXXL\nXXS\nL\nL\nXS\nL\nXS\nXS\nL\nXXL\nM\nXXXL\nXXL\nXXL\nXL\nL\nXS\nM\nXL\nXXXS\nXXXS\nS\nXXL\nXXXL\nXXL\nXS\nXXS\nL\nS\nXXXS\nXL\nL\nXL\nXXXS\nM\nL\nXXL\nL\nXL\nM\nM\n...
code_stdio
[ { "content": "# Description\n\"It's the end of trick-or-treating and we have a list/array representing how much candy each child in our group has made out with. We don't want the kids to start arguing, and using our parental intuition we know trouble is brewing as many of the children in the group have received...
[{"input": "[17, 20, 50, 61, 42, 44]", "output": "[132]", "fn_name": "candies"}, {"input": "[1, 2, 4, 6]", "output": "[11]", "fn_name": "candies"}, {"input": "[1, 3, 3, 7]", "output": "[14]", "fn_name": "candies"}, {"input": "[5, 8, 6, 4]", "output": "[9]", "fn_name": "candies"}, {"input": "[7, 7, 7, 7]", "output": "[0...
code_functional
[ { "content": "You are given three integers $a$, $b$ and $x$. Your task is to construct a binary string $s$ of length $n = a + b$ such that there are exactly $a$ zeroes, exactly $b$ ones and exactly $x$ indices $i$ (where $1 \\le i < n$) such that $s_i \\ne s_{i + 1}$. It is guaranteed that the answer always exi...
[{"input": "80 242 40\n", "output": "1010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
code_stdio
[ { "content": "Everybody knows the classic [\"half your age plus seven\"](https://en.wikipedia.org/wiki/Age_disparity_in_sexual_relationships#The_.22half-your-age-plus-seven.22_rule) dating rule that a lot of people follow (including myself). It's the 'recommended' age range in which to date someone. \n\n\n\n\n`...
[{"input": "17", "output": "[\"15-20\"]", "fn_name": "dating_range"}, {"input": "40", "output": "[\"27-66\"]", "fn_name": "dating_range"}, {"input": "15", "output": "[\"14-16\"]", "fn_name": "dating_range"}, {"input": "35", "output": "[\"24-56\"]", "fn_name": "dating_range"}, {"input": "53", "output": "[\"33-92\"]", "f...
code_functional
[ { "content": "This time the Berland Team Olympiad in Informatics is held in a remote city that can only be reached by one small bus. Bus has n passenger seats, seat i can be occupied only by a participant from the city a_{i}.\n\nToday the bus has completed m trips, each time bringing n participants. The partici...
[{"input": "1 1000000000 1000000000\n100000\n", "output": " 0"}, {"input": "5 3 2\n1 1 2 1 1\n", "output": " 7"}, {"input": "5 3 3\n1 2 2 1 1\n", "output": " ...
code_stdio
[ { "content": "E869120 has A 1-yen coins and infinitely many 500-yen coins.\n\nDetermine if he can pay exactly N yen using only these coins.\n\n-----Constraints-----\n - N is an integer between 1 and 10000 (inclusive).\n - A is an integer between 0 and 1000 (inclusive).\n\n-----Input-----\nInput is given from St...
[{"input": "2018\n218\n", "output": "Yes\n"}, {"input": "2018\n113", "output": "Yes\n"}, {"input": "2018\n111", "output": "Yes\n"}, {"input": "2018\n101", "output": "Yes\n"}, {"input": "2018\n100", "output": "Yes\n"}, {"input": "2018\n110", "output": "Yes\n"}, {"input": "2763\n-113", "output": "No\n"}, {"input": "2763\...
code_stdio
[ { "content": "There is a square grid of size $n \\times n$. Some cells are colored in black, all others are colored in white. In one operation you can select some rectangle and color all its cells in white. It costs $\\min(h, w)$ to color a rectangle of size $h \\times w$. You are to make all cells white for mi...
[{"input": "1000 24\n190 39 552 958\n539 146 763 587\n31 526 423 673\n208 432 953 442\n263 69 719 635\n162 428 623 797\n49 126 94 963\n749 623 979 919\n190 461 367 855\n211 240 939 914\n169 80 336 203\n684 546 829 582\n80 218 324 327\n560 452 656 637\n316 534 982 642\n521 634 758 686\n514 324 753 437\n342 395 384 995\n...
code_stdio
[ { "content": "Auction\n\nsquare1001 You were watching a certain auction.\n\nAn auction is a transaction in which when there are a large number of buyers and the number of items is limited, the one with the highest price is given the right to buy. (From the 7th edition of the Shinmei Kokugo Dictionary)\n\nThe ru...
[{"input": "5\n-1 -1 -2 -2 3", "output": "4\n5\n"}, {"input": "5\n-1 -1 -3 -2 3", "output": "3\n5\n"}, {"input": "5\n-1 -1 -3 -1 3", "output": "3\n5\n"}, {"input": "5\n-1 -1 -6 -1 3", "output": "3\n5\n"}, {"input": "5\n-1 -2 -6 -1 3", "output": "3\n5\n"}, {"input": "5\n-1 -1 -6 -2 3", "output": "3\n5\n"}, {"input": "5\...
code_stdio
[ { "content": "Tomya is a girl. She loves Chef Ciel very much.\n\nToday, too, Tomya is going to Ciel's restaurant.\nOf course, Tomya would like to go to Ciel's restaurant as soon as possible.\nTherefore Tomya uses one of the shortest paths from Tomya's house to Ciel's restaurant.\nOn the other hand, Tomya is bor...
[{"input": "2\n3 3\n1 2 3\n2 3 11\n1 2 14\n3 3\n2 2 3\n2 3 1\n2 3 9", "output": "1\n0\n"}, {"input": "2\n3 3\n1 1 3\n3 3 11\n1 2 7\n3 3\n2 2 3\n2 3 1\n2 1 9", "output": "0\n1\n"}, {"input": "2\n3 3\n1 2 1\n2 3 6\n1 3 7\n3 3\n2 3 4\n2 3 6\n1 3 12", "output": "2\n1\n"}, {"input": "2\n3 3\n1 2 3\n2 3 4\n1 3 7\n6 3\n2 3 3\...
code_stdio
[ { "content": "Devu is a renowned classical singer. He is invited to many big functions/festivals. Recently he was invited to \"All World Classical Singing Festival\". Other than Devu, comedian Churu was also invited.\n\nDevu has provided organizers a list of the songs and required time for singing them. He will...
[{"input": "100 6000\n41 31 23 17 24 78 26 96 93 48 46 2 49 33 35 9 73 100 34 48 83 36 33 69 43 24 3 74 8 81 27 33 94 38 77 9 76 90 62 90 21 67 22 22 12 2 17 27 102 18 72 85 59 65 71 38 90 75 74 66 60 47 58 50 90 95 75 10 5 100 97 29 83 88 65 26 93 90 22 98 36 55 70 38 50 92 88 72 99 96 25 14 74 16 25 92 67 94 77 96\n"...
code_stdio
[ { "content": "In the $2022$ year, Mike found two binary integers $a$ and $b$ of length $n$ (both of them are written only by digits $0$ and $1$) that can have leading zeroes. In order not to forget them, he wanted to construct integer $d$ in the following way:\n\nhe creates an integer $c$ as a result of bitwise...
[{"input": "5\n1\n0\n3\n011\n3\n110\n6\n111000\n6\n001011\n", "output": "\n1\n110\n100\n101101\n101110\n"}, {"input": "5\n1\n0\n3\n011\n3\n110\n6\n111000\n6\n001011\n", "output": "1\n110\n100\n101101\n101110\n"}, {"input": "5\n1\n0\n3\n011\n3\n110\n6\n111100\n6\n001011\n", "output": "1\n110\n100\n101001\n101110\n"}, {"...
code_stdio
[ { "content": "Consider a simplified penalty phase at the end of a football match.\n\nA penalty phase consists of at most $10$ kicks, the first team takes the first kick, the second team takes the second kick, then the first team takes the third kick, and so on. The team that scores more goals wins; if both team...
[{"input": "4\n1001???0?1\n1111111111\n??????????\n0100001000\n", "output": "8\n10\n6\n10\n"}, {"input": "4\n1?0???1001\n1111111111\n??????????\n0000000000\n", "output": "7\n10\n6\n10\n"}, {"input": "4\n1001?1?0??\n0111111011\n??????????\n1100011000\n", "output": "9\n10\n6\n10\n"}, {"input": "4\n0?0???1001\n1111111111\...
code_stdio
[ { "content": "Given an array $a$ of length $n$ and an integer $k$, find the number of indices $1 \\leq i \\leq n - k$ such that the subarray $[a_i, \\dots, a_{i+k}]$ with length $k+1$ (not with length $k$) has the following property:\n\nIf you multiply the first element by $2^0$, the second element by $2^1$, .....
[{"input": "1\n40 39\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1...
code_stdio
[ { "content": "Takahashi has a string S consisting of lowercase English letters.\nStarting with this string, he will produce a new one in the procedure given as follows.\nThe procedure consists of Q operations. In Operation i (1 \\leq i \\leq Q), an integer T_i is provided, which means the following:\n - If T_i ...
[{"input": "a\n6\n2 2 a\n2 1 b\n1\n2 2 c\n1\n1\n", "output": "aabc\n"}, {"input": "a\n6\n2 2 a\n2 1 b\n1\n2 2 d\n1\n1", "output": "aabd\n"}, {"input": "a\n6\n2 2 b\n2 1 b\n1\n2 2 d\n1\n1", "output": "babd\n"}, {"input": "a\n6\n2 2 a\n2 1 b\n1\n2 1 c\n1\n1", "output": "caab\n"}, {"input": "a\n6\n2 2 a\n2 1 b\n1\n2 1 b\n...
code_stdio
[ { "content": "Let's consider a table consisting of n rows and n columns. The cell located at the intersection of i-th row and j-th column contains number i × j. The rows and columns are numbered starting from 1.\n\nYou are given a positive integer x. Your task is to count the number of cells in a table that con...
[{"input": "100000 1000000000\n", "output": "16\n"}, {"input": "100000 183783600\n", "output": "438\n"}, {"input": "100000 551350800\n", "output": "392\n"}, {"input": "100000 479001600\n", "output": "254\n"}, {"input": "100000 1000000000\n", "output": "16\n"}, {"input": "100000 479001600\n", "output": "254\n"}, {"input...
code_stdio
[ { "content": "Vasily has a deck of cards consisting of n cards. There is an integer on each of the cards, this integer is between 1 and 100 000, inclusive. It is possible that some cards have the same integers on them.\n\nVasily decided to sort the cards. To do this, he repeatedly takes the top card from the de...
[{"input": "100\n12 9 97 55 14 8 55 34 35 67 3 18 73 92 41 49 15 60 18 66 9 26 97 47 43 88 71 97 19 63 48 96 79 53 8 47 69 49 21 23 77 12 21 176 66 9 29 13 61 69 54 77 10 13 4 68 37 74 7 6 29 76 55 72 89 4 78 27 29 82 18 83 12 4 32 69 89 85 66 13 92 54 38 5 26 56 17 55 29 4 17 39 29 94 3 67 85 79 21 14\n", "output": "1...
code_stdio
[ { "content": "# Do you ever wish you could talk like Siegfried of KAOS ?\n\n## YES, of course you do!\n\nhttps://en.wikipedia.org/wiki/Get_Smart\n\n\n\n# Task\n\nWrite the function ```siegfried``` to replace the letters of a given sentence.\n\nApply the rules using the course notes below. Each week you will lea...
[{"input": "5\n\"And another thing Mr Smart, I want no more trouble!\"", "output": "[\"Und unozer zink Mr Schmart, I vunt no mor trubl!\"]", "fn_name": "siegfried"}, {"input": "5\n\"You ought to behave yourself Smart!\"", "output": "[\"Yu ught to behav yurself Schmart!\"]", "fn_name": "siegfried"}, {"input": "5\n\"Smar...
code_functional
[ { "content": "Recall that MEX of an array is a minimum non-negative integer that does not belong to the array. Examples: for the array $[0, 0, 1, 0, 2]$ MEX equals to $3$ because numbers $0, 1$ and $2$ are presented in the array and $3$ is the minimum non-negative integer not presented in the array; for the a...
[{"input": "7 3\n0\n1\n2\n2\n0\n0\n10\n", "output": "1\n2\n3\n3\n4\n4\n7\n"}, {"input": "7 5\n0\n1\n2\n2\n0\n0\n10\n", "output": "1\n2\n3\n3\n3\n3\n3\n"}, {"input": "7 3\n0\n1\n2\n2\n0\n0\n10\n", "output": "1\n2\n3\n3\n4\n4\n7\n"}, {"input": "4 4\n0\n1\n2\n2\n0\n0\n10\n", "output": "1\n2\n3\n3\n"}, {"input": "3 3\n0\n1...
code_stdio
[ { "content": "Write a function \n\n`titleToNumber(title) or title_to_number(title) or titleToNb title ...`\n\n(depending on the language)\n\nthat given a column title as it appears in an Excel sheet, returns its corresponding column number. All column titles will be uppercase.\n\nExamples:\n```\ntitleTonumber('...
[{"input": "\"UNFORGIVABLE\"", "output": "[79089429845931757]", "fn_name": "title_to_number"}, {"input": "\"LONELINESS\"", "output": "[68400586976949]", "fn_name": "title_to_number"}, {"input": "\"CODEWARS\"", "output": "[28779382963]", "fn_name": "title_to_number"}, {"input": "\"ZZZTOP\"", "output": "[321268054]", "fn...
code_functional
[ { "content": "Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a_1 percent and second one is charged at a_2 percent. You can connect charger to a joystick only at the beginning of each minute. In one minute joystick either discharge...
[{"input": "100 100\n", "output": "197\n"}, {"input": "100 100\n", "output": "197\n"}, {"input": "100 25\n", "output": "122\n"}, {"input": "100 25\n", "output": "122\n"}, {"input": "100 26\n", "output": "124\n"}, {"input": "155 25\n", "output": "178\n"}, {"input": "155 18\n", "output": "171\n"}, {"input": "131 18\n", "...
code_stdio
[ { "content": "Recently Polycarpus has learned the \"bitwise AND\" operation (which is also called \"AND\") of non-negative integers. Now he wants to demonstrate the school IT teacher his superb manipulation with the learned operation.\n\nFor that Polycarpus came to school a little earlier and wrote on the board...
[{"input": "7\n-1 1000000000 999999488 999999488 1000000000 1000000000 999999488\n1000000000 -1 999999488 999999488 1000000000 1000000000 999999488\n999999488 999999488 -1 999999999 999999488 999999488 999999999\n999999488 999999488 999999999 -1 999999488 999999488 999999999\n1000000000 1000000000 999999488 999999488 -...
code_stdio
[ { "content": "Given are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\n-----Constraints-----\n - S and T are strings consisting of lowercase English letters.\n - The lengths of S and T are between 1 and...
[{"input": "oekdkfjdjgjknbfkwnfnhaoekdkfjdjgjknbfkwnfnhahjekkengkfoekdkfjdjgjknbfkwnfnhaoekdkfjdjgjknbfkwnfnhahj yowkymbmhkkgjjeokdlakbndkkworqotkfnblgpnkkrogjrfnvmbjisnbkzvmbnrrrigeoibgpefjobvmovpqosqoqrgrkengrlk\n", "output": "yowkymbmhkkgjjeokdlakbndkkworqotkfnblgpnkkrogjrfnvmbjisnbkzvmbnrrrigeoibgpefjobvmovpqosqoqr...
code_stdio
[ { "content": "Yet another Armageddon is coming! This time the culprit is the Julya tribe calendar. \n\nThe beavers in this tribe knew math very well. Smart Beaver, an archaeologist, got a sacred plate with a magic integer on it. The translation from Old Beaverish is as follows: \n\n\"May the Great Beaver bless ...
[{"input": "1000000000000000000\n", "output": "113502443819651915\n"}, {"input": "999999899799299198\n", "output": "113502432686240713\n"}, {"input": "999999999999999998\n", "output": "113502443819651913\n"}, {"input": "999999999999999999\n", "output": "113502443819651914\n"}, {"input": "999999999999999997\n", "output"...
code_stdio
[ { "content": "Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook for a rubles, a pack of two copybooks for b r...
[{"input": "999999999 1000000000 1000000000 1000000000\n", "output": "1000000000\n"}, {"input": "1714658473 1000000000 999999990 1000000000\n", "output": "1000000000\n"}, {"input": "999999999 1000000000 1000000100 1000000000\n", "output": "1000000000\n"}, {"input": "999999999 1000000000 1000000000 1000000000\n", "outpu...
code_stdio
[ { "content": "Given an array containing only integers, add all the elements and return the binary equivalent of that sum.\n\nIf the array contains any non-integer element (e.g. an object, a float, a string and so on), return false.\n\n**Note:** The sum of an empty array is zero.\n\n```python\narr2bin([1,2]) == ...
[{"input": "[1, 10, 100, 1000]", "output": "[\"10001010111\"]", "fn_name": "arr2bin"}, {"input": "[1, 2, 3, 4, 5]", "output": "[\"1111\"]", "fn_name": "arr2bin"}, {"input": "[1, 2, -1, -2, 1]", "output": "[\"1\"]", "fn_name": "arr2bin"}, {"input": "[1, 2, -1, -2]", "output": "[\"0\"]", "fn_name": "arr2bin"}, {"input": ...
code_functional
[ { "content": "Creatnx has $n$ mirrors, numbered from $1$ to $n$. Every day, Creatnx asks exactly one mirror \"Am I beautiful?\". The $i$-th mirror will tell Creatnx that he is beautiful with probability $\\frac{p_i}{100}$ for all $1 \\le i \\le n$.\n\nCreatnx asks the mirrors one by one, starting from the $1$-s...
[{"input": "100\n60 79 48 35 18 24 87 1 44 65 60 78 11 43 71 79 90 6 94 49 22 91 58 93 55 21 22 31 7 15 17 65 76 9 100 89 50 96 14 38 27 87 29 93 54 12 99 35 27 51 36 44 6 26 91 1 53 8 49 63 18 4 31 55 95 15 77 1 16 98 75 26 26 43 2 11 18 70 3 65 11 74 64 69 26 54 9 51 25 82 98 12 90 75 19 23 78 93 6 7\n", "output": "2...
code_stdio
[ { "content": "Imagine that your city is an infinite 2D plane with Cartesian coordinate system. The only crime-affected road of your city is the x-axis. Currently, there are n criminals along the road. No police station has been built on this road yet, so the mayor wants to build one.\n\nAs you are going to be i...
[{"input": "44 37298\n-100 -100 -98 -93 -92 -91 -91 -89 -87 -86 -84 -80 -79 -76 -71 -70 -58 -53 -52 -52 -49 -48 -45 -45 -40 -39 -37 -35 -31 -30 -30 -29 -29 -28 -22 -22 -21 -11 -8 -7 -7 -6 -1 0\n", "output": "200\n"}, {"input": "45 45\n-95 -94 -92 -83 -83 -76 -75 -74 -71 -70 -68 -44 -36 -31 -20 -18 -14 -11 -8 -7 -2 -2 -...
code_stdio
[ { "content": "One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of the English alphabet. Jump ability is the maxim...
[{"input": "VRPHBNWNWVWBWMFJJDCTJQJDJBKSJRZLVQRVVFLTZFSGCGDXCWQVWWWMFVCQHPKXXVRKTGWGPSMQTPKNDQJHNSKLXPCXDJDQDZZD\n", "output": "101\n"}, {"input": "DZZDQDJDXCPXLKSNHJQDNKPTQMSPGWGTKRVXXKPHQCVFMWWWVQWCXDGCGSFZTLFVVRQVLZRJSKBJDJQJTCDJJFMWBWVWNWNBHPRV\n", "output": "101\n"}, {"input": "VRPHBNWNWVWBWMFJJDCTJQJDJBKSJRZLVQRV...
code_stdio
[ { "content": "Mishka has got n empty boxes. For every i (1 ≤ i ≤ n), i-th box is a cube with side length a_{i}.\n\nMishka can put a box i into another box j if the following conditions are met:\n\n i-th box is not put into another box; j-th box doesn't contain any other boxes; box i is smaller than box j (a_...
[{"input": "100\n981 288 186 186 292 876 341 288 663 360 783 907 292 186 341 292 360 1510 360 360 1230 398 783 288 366 398 876 981 398 907 133 360 288 981 907 186 360 288 186 981 186 288 907 876 288 907 876 360 341 292 907 694 907 783 284 981 907 292 876 398 895 876 154 341 876 33 288 186 981 341 398 595 907 981 208 18...
code_stdio
[ { "content": "Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes:\n\n* Hit his pocket, which magically increases the number of biscuits by one.\n* Exchange A biscuits to 1 yen.\n* Exchange 1 yen to B ...
[{"input": "314159265 35897932 384626433", "output": "48518828981938099"}, {"input": "407766107 9307229 14836778", "output": "1101648954500241\n"}, {"input": "407766107 9307229 25447105", "output": "3215538450316794\n"}, {"input": "296771207 9307229 25447105", "output": "2319816489000594\n"}, {"input": "513602852 93072...
code_stdio
[ { "content": "We have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n - For each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\nDetermine whether Snuke can a...
[{"input": "6\n2 7 1 8 2 8\n", "output": "Yes\n"}, {"input": "6\n4 7 0 -1 6 4", "output": "Yes\n"}, {"input": "6\n2 7 2 12 2 8", "output": "Yes\n"}, {"input": "6\n4 7 2 8 2 10", "output": "Yes\n"}, {"input": "6\n2 7 2 8 2 8", "output": "Yes\n"}, {"input": "6\n4 7 2 8 2 8", "output": "Yes\n"}, {"input": "6\n6 7 2 8 2 8"...
code_stdio
[ { "content": "Write a function called that takes a string of parentheses, and determines if the order of the parentheses is valid. The function should return `true` if the string is valid, and `false` if it's invalid.\n\n## Examples\n\n```\n\"()\" => true\n\")(()))\" => false\n\"(\" ...
[{"input": "\"(c(b(a)))(d)\"", "output": "[true]", "fn_name": "valid_parentheses"}, {"input": "\"((())()())\"", "output": "[true]", "fn_name": "valid_parentheses"}, {"input": "\"hi(hi))(\"", "output": "[false]", "fn_name": "valid_parentheses"}, {"input": "\"hi(hi)(\"", "output": "[false]", "fn_name": "valid_parentheses...
code_functional
[ { "content": "Find the number of integers between 1 and N (inclusive) that contains exactly K non-zero digits when written in base ten.\n\n-----Constraints-----\n - 1 \\leq N < 10^{100}\n - 1 \\leq K \\leq 3\n\n-----Input-----\nInput is given from Standard Input in the following format:\nN\nK\n\n-----Output----...
[{"input": "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n3\n", "output": "117879300\n"}, {"input": "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n3", "output": "117879300"}, {"input": "9999999999999999999999...
code_stdio
[ { "content": "π (spelled pi in English) is a mathematical constant representing the circumference of a circle whose di- ameter is one unit length. The name π is said to come from the first letter of the Greek words περιφέρεια (meaning periphery) and περίμετρος (perimeter).\n\nRecently, the government of some co...
[{"input": "1.1386381399168386\n0.08430864816896695\n0.0", "output": "3/1\n16/5\n"}, {"input": "0.5656950408067312\n0.06616503278329884\n0.0", "output": "3/1\n16/5\n"}, {"input": "0.9300839575225542\n0.09342351193849237\n0.0", "output": "3/1\n16/5\n"}, {"input": "0.7461955408233221\n0.09342351193849237\n0.0", "output":...
code_stdio
[ { "content": "Jack has become a soldier now. Unfortunately, he has trouble with the drill. Instead of marching beginning with the left foot and then changing legs with each step, as ordered, he keeps repeating a sequence of steps, in which he sometimes makes the wrong steps or — horror of horrors! — stops for a...
[{"input": "RXLLRXXLLRLRLLXXXXRXXRLLRRRRXLLRRLXXLRXXLXLRLLLLLRXLRXLXRXLXLRRXXRRLXLXLRLRXRXLXXXLRXLLXLRRRRXRLLXRRLLRRXRRRLRLLRLRXXXRLXLXLLLRXXLLXLRXXLLLRLXRRXRLXLXXXXXXLXRXXRXXXRXLXXRRXLLXRRXLXXRRXLXXRLXLXXLXRXXRLRLLXLXLXLRXLXLXLLLRLXXLXLLRLLLLRLRRRRXRRLLRLXLXXRLRRLXRRXXXRLLXRRRXXRRRXXLRXRLLXRRRXRXRXXLLLRLRXXRLRLXRLLXLX...
code_stdio
[ { "content": "You are playing a game called Guru Guru Gururin. In this game, you can move with the vehicle called Gururin. There are two commands you can give to Gururin: 'R' and 'L'. When 'R' is sent, Gururin rotates clockwise by 90 degrees. Otherwise, when 'L' is sent, Gururin rotates counterclockwise by 90 d...
[{"input": "RRLRRLRRRRLRRLRRRRLRRLRRRRLRRLRR", "output": "4"}, {"input": "RLLRRLLLRRRLLLLRR", "output": "0\n"}, {"input": "RLLRRLLMRRRLLLLRR", "output": "0\n"}, {"input": "RLLRLLLLRRRLLLRRR", "output": "0"}, {"input": "RRRRLLLLRRRR", "output": "2"}, {"input": "RL", "output": "0\n"}, {"input": "QL", "output": "0\n"}, {"...
code_stdio
[ { "content": "You are given $q$ queries in the following form:\n\nGiven three integers $l_i$, $r_i$ and $d_i$, find minimum positive integer $x_i$ such that it is divisible by $d_i$ and it does not belong to the segment $[l_i, r_i]$.\n\nCan you answer all the queries?\n\nRecall that a number $x$ belongs to segm...
[{"input": "30\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n...
code_stdio
[ { "content": "From 1603 to 1867, people call that era the EDO era. EDO stands for Enhanced Driving Operation, the most advanced space navigation technology at the time, and was developed by Dr. Izy in 1603.\n\nYou are a space adventurer, flying around the universe and adventuring on various planets. During that...
[{"input": "2\n10 11\n11 12\n2\nN 2\nE 1\n2\n10 11\n11 12\n2\nN 2\nW 1\n3\n0 15\n5 10\n5 15\n5\nW 20\nS 10\nN 20\nE 10\nS 10\n0", "output": "Yes\nNo\nNo\n"}, {"input": "2\n10 11\n11 12\n2\nN 2\nE 1\n2\n10 11\n11 12\n2\nN 3\nW 1\n3\n0 15\n5 10\n5 15\n5\nW 20\nS 10\nN 20\nE 10\nS 10\n0", "output": "Yes\nNo\nNo\n"}, {"inp...
code_stdio
[ { "content": "Your friend Cody has to sell a lot of jam, so he applied a good 25% discount to all his merchandise.\n\nTrouble is that he mixed all the prices (initial and discounted), so now he needs your cool coding skills to filter out only the discounted prices.\n\nFor example, consider this inputs:\n```\n\"...
[{"input": "\"10349349 13799132 14426622 17347290 19235496 23129720 24791793 32049435 33055724 42732580 48771579 51731211 58387395 59065617 65028772 67572870 68974948 71437914 77849860 78754156 81661776 88101462 90097160 95250552 97020531 108882368 114334791 117468616 128978592 129360708 138971622 140891505 151010565 1...
code_functional
[ { "content": "Capitalization is writing a word with its first letter as a capital letter. Your task is to capitalize the given word.\n\nNote, that during capitalization all the letters except the first one remains unchanged.\n\n\n-----Input-----\n\nA single line contains a non-empty word. This word consists of ...
[{"input": "lZqBqKeGvNdSeYuWxRiVnFtYbKuJwQtUcKnVtQhAlOeUzMaAuTaEnDdPfDcNyHgEoBmYjZyFePeJrRiKyAzFnBfAuGiUyLrIeLrNhBeBdVcEeKgCcBrQzDsPwGcNnZvTsEaYmFfMeOmMdNuZbUtDoQoNcGwDqEkEjIdQaPwAxJbXeNxOgKgXoEbZiIsVkRrNpNyAkLeHkNfEpLuQvEcMbIoGaDzXbEtNsLgGfOkZaFiUsOvEjVeCaMcZqMzKeAdXxJsVeCrZaFpJtZxInQxFaSmGgSsVyGeLlFgFqTpIbAvPkIfJrVcJ...
code_stdio
[ { "content": "Write a program which reads an integer and prints sum of its digits.\n\n\n\nInput\n\nThe input consists of multiple datasets. For each dataset, an integer x is given in a line. The number of digits in x does not exceed 1000.\n\nThe input ends with a line including single zero. Your program should ...
[{"input": "123\n158\n1100\n0", "output": "6\n14\n2\n"}, {"input": "123\n181\n1111\n0", "output": "6\n10\n4\n"}, {"input": "123\n418\n1100\n0", "output": "6\n13\n2\n"}, {"input": "123\n418\n1110\n0", "output": "6\n13\n3\n"}, {"input": "123\n736\n1110\n0", "output": "6\n16\n3\n"}, {"input": "123\n239\n1000\n0", "output"...
code_stdio
[ { "content": "There is data on sales of your company. Your task is to write a program which identifies good workers.\n\nThe program should read a list of data where each item includes the employee ID i, the amount of sales q and the corresponding unit price p. Then, the program should print IDs of employees who...
[{"input": "4\n1001 2000 520\n1002 3520 450\n1003 1600 625\n1001 200 1220\n2\n1001 100 3\n1005 1000 100\n2\n2013 5000 010\n2013 5000 100\n0", "output": "1001\n1002\n1003\nNA\nNA\n"}, {"input": "4\n0110 2000 520\n11 2363 29\n1507 8024 1160\n1101 670 2276\n2\n0001 100 0\n502 1100 100\n2\n715 1354 100\n1668 14106 100\n0",...
code_stdio
[ { "content": "Your task is to calculate logical value of boolean array. Test arrays are one-dimensional and their size is in the range 1-50.\n\nLinks referring to logical operations: [AND](https://en.wikipedia.org/wiki/Logical_conjunction), [OR](https://en.wikipedia.org/wiki/Logical_disjunction) and [XOR](https...
[{"input": "[true, false, false, false]\n\"AND\"", "output": "[false]", "fn_name": "logical_calc"}, {"input": "[true, true, false, false]\n\"AND\"", "output": "[false]", "fn_name": "logical_calc"}, {"input": "[true, true, false, false]\n\"XOR\"", "output": "[false]", "fn_name": "logical_calc"}, {"input": "[true, false,...
code_functional
[ { "content": "Scheduling is how the processor decides which jobs(processes) get to use the processor and for how long. This can cause a lot of problems. Like a really long process taking the entire CPU and freezing all the other processes. One solution is Shortest Job First(SJF), which today you will be impleme...
[{"input": "[3, 10, 20, 1, 2, 10, 10]\n5", "output": "[26]", "fn_name": "SJF"}, {"input": "[3, 10, 10, 20, 1, 2]\n1", "output": "[16]", "fn_name": "SJF"}, {"input": "[3, 10, 10, 20, 1, 2]\n2", "output": "[26]", "fn_name": "SJF"}, {"input": "[3, 10, 20, 1, 2, 3]\n5", "output": "[9]", "fn_name": "SJF"}, {"input": "[3, 10...
code_functional
[ { "content": "Takahashi, who is A years old, is riding a Ferris wheel.\nIt costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charg...
[{"input": "30 100\n", "output": "100\n"}, {"input": "13 298\n", "output": "298\n"}, {"input": "60 654\n", "output": "654\n"}, {"input": "12 100\n", "output": "50\n"}, {"input": "6 482\n", "output": "241\n"}, {"input": "15 100", "output": "100\n"}, {"input": "16 110", "output": "110\n"}, {"input": "17 101", "output": "...
code_stdio
[ { "content": "International Christmas Present Company (ICPC) is a company to employ Santa and deliver presents on Christmas. Many parents request ICPC to deliver presents to their children at specified time of December 24. Although same Santa can deliver two or more presents, because it takes time to move betwe...
[{"input": "3 2 3\n0 1 10\n1 2 15\n0 -1\n1 8\n2 -1\n3 2 4\n0 1 10\n1 2 10\n0 0\n1 19\n2 20\n0 25\n13 10 10\n0 1 39\n2 3 48\n3 5 20\n4 8 25\n3 9 10\n8 9 40\n3 4 5\n5 0 17\n0 7 93\n1 3 13\n0 0\n1 100000000\n2 100\n3 543\n4 500\n5 400\n6 300\n6 200\n8 100\n9 100\n0 0 0", "output": "3\n3\n4\n"}, {"input": "3 2 3\n0 1 10\n1...
code_stdio
[ { "content": "## Task\n\nYou have to write three functions namely - `PNum, GPNum and SPNum` (JS, Coffee), `p_num, g_p_num and s_p_num` (Python and Ruby), `pNum, gpNum and spNum` (Java, C#), `p-num, gp-num and sp-num` (Clojure) - to check whether a given argument `n` is a Pentagonal, Generalized Pentagonal, or S...
[{"input": "100", "output": "[false]", "fn_name": "p_num"}, {"input": "0", "output": "[false]", "fn_name": "p_num"}, {"input": "2", "output": "[false]", "fn_name": "p_num"}, {"input": "3", "output": "[false]", "fn_name": "p_num"}, {"input": "4", "output": "[false]", "fn_name": "p_num"}, {"input": "1", "output": "[true]...
code_functional
[ { "content": "Airport Codes\n\nAirport code\n\nIn the Kingdom of JAG, airport codes are assigned to each domestic airport for identification.\n\nAirport codes are assigned according to the following rules based on the name of the airport in lowercase English alphabet:\n\n1. Extract the first letter of the name ...
[{"input": "3\nhaneda\noookayama\nssu\n2\nazusa\nazishirabe\n2\nsnuke\nsnake\n4\nhaneda\nhonda\nhanamaki\nhawaii\n0", "output": "1\n4\n-1\n3\n"}, {"input": "3\nhaneda\noookayama\nstu\n2\nazusa\nebarihsiza\n2\nsnuke\nsnake\n4\nhaneda\nhonda\nhanamaki\nhawaih\n0", "output": "1\n1\n-1\n3\n"}, {"input": "3\nhaneca\noookaya...
code_stdio
[ { "content": "You are working for an administration office of the International Center for Picassonian Cubism (ICPC), which plans to build a new art gallery for young artists. The center is organizing an architectural design competition to find the best design for the new building.\n\nSubmitted designs will loo...
[{"input": "4 5\n..33\n33..\n2222\n..1.\n.111\n5 7\n....1\n.1..1\n1..1.\n11..1\n.2222\n..111\n...1.\n3 6\n.3.\n233\n23.\n22.\n.11\n.11\n4 3\n2222\n..11\n..11\n4 5\n.3..\n..33\n322.\n2211\n.11.\n3 3\n222\n2.1\n111\n3 4\n11.\n11.\n.2/\n222\n3 4\n.11\n.11\n.2.\n222\n2 7\n11\n.1\n21\n22\n23\n.3\n33\n2 3\n1.\n11\n1.59382700...
code_stdio
[ { "content": "Did you know that the yummy golden triangle was introduced in India as early as 13th century ? By the way, I'm referring to the popular South Asian snack, Samosa. I guess its hard to code while thinking of Samosa, especially if you are very hungry now ; so lets not get in to any recipe or eating g...
[{"input": "1\n4\n10 20 34 89\n4\n10 26\n7 21\n14 21\n7 35", "output": "2\n"}, {"input": "1\n4\n10 20 34 89\n4\n7 14\n7 21\n14 21\n7 35", "output": "2\n"}, {"input": "1\n4\n10 20 34 55\n4\n7 14\n7 21\n14 6\n13 35", "output": "2\n"}, {"input": "1\n4\n10 20 34 89\n4\n7 26\n7 21\n14 21\n7 35", "output": "2\n"}, {"input": ...
code_stdio
[ { "content": "Eshag has an array $a$ consisting of $n$ integers.\n\nEshag can perform the following operation any number of times: choose some subsequence of $a$ and delete every element from it which is strictly larger than $AVG$, where $AVG$ is the average of the numbers in the chosen subsequence.\n\nFor exam...
[{"input": "3\n6\n1 1 1 7 3 1\n6\n17 17 8 11 9 12\n6\n10 2 2 2 1 1\n", "output": "2\n5\n4\n"}, {"input": "3\n6\n1 1 1 7 3 1\n6\n17 17 8 11 9 12\n6\n10 2 2 2 0 1\n", "output": "2\n5\n5\n"}, {"input": "3\n6\n1 1 2 7 3 1\n6\n17 17 8 11 9 12\n6\n10 2 2 2 0 1\n", "output": "3\n5\n5\n"}, {"input": "3\n6\n1 1 1 2 3 3\n6\n9 9 ...
code_stdio
[ { "content": "Rikhail Mubinchik believes that the current definition of prime numbers is obsolete as they are too complex and unpredictable. A palindromic number is another matter. It is aesthetically pleasing, and it has a number of remarkable properties. Help Rikhail to convince the scientific community in th...
[{"input": "10000 239\n", "output": "1168638\n"}, {"input": "10001 239\n", "output": "1168798\n"}, {"input": "10000 239\n", "output": "1168638"}, {"input": "10278 674\n", "output": "204510\n"}, {"input": "15744 9999\n", "output": "1020\n"}, {"input": "10000 10000\n", "output": "40\n"}, {"input": "5858 674\n", "output":...
code_stdio
[ { "content": "Once again, Boris needs the help of Anton in creating a task. This time Anton needs to solve the following problem:\n\nThere are two arrays of integers $a$ and $b$ of length $n$. It turned out that array $a$ contains only elements from the set $\\{-1, 0, 1\\}$.\n\nAnton can perform the following s...
[{"input": "5\n3\n1 -1 0\n1 1 -2\n3\n0 1 1\n0 2 2\n2\n1 -1\n1 44\n2\n-1 0\n-1 -38\n5\n1 1 -1 1 -1\n1 1 -1 1 -1\n", "output": "YES\nNO\nYES\nYES\nYES\n"}, {"input": "5\n3\n0 -1 -1\n1 1 -2\n3\n0 1 1\n0 1 2\n2\n1 0\n1 41\n2\n-1 0\n-1 -41\n5\n0 1 -1 1 -1\n0 1 -1 1 -1\n", "output": "NO\nYES\nYES\nYES\nYES\n"}, {"input": "5\...
code_stdio
[ { "content": "Inna and Dima bought a table of size n × m in the shop. Each cell of the table contains a single letter: \"D\", \"I\", \"M\", \"A\".\n\nInna loves Dima, so she wants to go through his name as many times as possible as she moves through the table. For that, Inna acts as follows:\n\n initially, Inn...
[{"input": "14 34\nDDDDDDDDDDDDIMADDDDDDDDDDDDDDDIMAD\nDDDDDDIMADDDDDDDDDDDDDDDDDDDDDIMAD\nDDDDDDDDDDDDDIDDDDDDDDDDDIDIMIDIMA\nDDDDDDIMDDDDDDDDDDDDDIDDDDDDDDDDDD\nDDDDDDDDDDDDDDDDDMADDDDDDDDDDDDDMD\nDDDDDDIMIDDDDDDDDDDDDIMIDIMIDDDIDD\nDDDDDDDDDDDDDDDDDMIMDDDDIMDDIMADIM\nDDDDDDDDDDDADIMADIDDDDDDIDIMADADDD\nDDDDDDDDIDDDD...
code_stdio
[ { "content": "### Task\nYou've just moved into a perfectly straight street with exactly ```n``` identical houses on either side of the road. Naturally, you would like to find out the house number of the people on the other side of the street. The street looks something like this:\n\n--------------------\n### St...
[{"input": "20\n3400", "output": "[6781]", "fn_name": "over_the_road"}, {"input": "10\n22", "output": "[35]", "fn_name": "over_the_road"}, {"input": "7\n11", "output": "[16]", "fn_name": "over_the_road"}, {"input": "9\n26", "output": "[44]", "fn_name": "over_the_road"}, {"input": "20\n10", "output": "[1]", "fn_name": "...
code_functional
[ { "content": "Let'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 all subsequences of the array of length exactly $k$. As this number can be ve...
[{"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 100000 100000 100000 100...
code_stdio
[ { "content": "Given a string, turn each letter into its ASCII character code and join them together to create a number - let's call this number `total1`:\n\n```\n'ABC' --> 'A' = 65, 'B' = 66, 'C' = 67 --> 656667\n```\n\nThen replace any incidence of the number `7` with the number `1`, and call this number 'tota...
[{"input": "\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"", "output": "[96]", "fn_name": "calc"}, {"input": "\"jfmgklf8hglbe\"", "output": "[6]", "fn_name": "calc"}, {"input": "\"aaaaaddddr\"", "output": "[30]", "fn_name": "calc"}, {"input": "\"ifkhchlhfd\"", "output": "[6]", "fn_name": "calc"}, {"input": "\...
code_functional
[ { "content": "Construct a function 'coordinates', that will return the distance between two points on a cartesian plane, given the x and y coordinates of each point.\n\nThere are two parameters in the function, ```p1``` and ```p2```. ```p1``` is a list ```[x1,y1]``` where ```x1``` and ```y1``` are the x and y c...
[{"input": "[-4, -5]\n[-5, -4]\n1", "output": "[1.4]", "fn_name": "coordinates"}, {"input": "[-2, 5]\n[-2, -10]\n2", "output": "[15]", "fn_name": "coordinates"}, {"input": "[4, 7]\n[6, 2]\n3", "output": "[5.385]", "fn_name": "coordinates"}, {"input": "[5, 3]\n[10, 15]\n2", "output": "[13]", "fn_name": "coordinates"}, {...
code_functional
[ { "content": "Bob came to a cash & carry store, put n items into his trolley, and went to the checkout counter to pay. Each item is described by its price ci and time ti in seconds that a checkout assistant spends on this item. While the checkout assistant is occupied with some item, Bob can steal some other it...
[{"input": "10\n3 512981548\n0 214269975\n2 603901234\n3 772872647\n0 224281389\n4 561877930\n1 809519308\n4 1128067436\n1 114469023\n2 184038037\n", "output": "860384990\n"}, {"input": "10\n3 512981548\n0 214269975\n2 603901234\n3 772872647\n0 224281389\n4 561877930\n1 809519308\n4 1128067436\n1 40056209\n2 184038037\...
code_stdio
[ { "content": "Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board cells. Then for n - 1 minutes, Gerald every minute moves each chip into an adjacent cell. He moves each ...
[{"input": "10 5\n2 1\n4 4\n2 2\n4 3\n1 1\n", "output": "11\n"}, {"input": "5 5\n3 2\n5 4\n3 3\n2 3\n1 2\n", "output": "1\n"}, {"input": "5 5\n3 2\n1 4\n5 1\n4 5\n3 1\n", "output": "2\n"}, {"input": "5 5\n2 2\n5 3\n2 3\n5 1\n4 4\n", "output": "1\n"}, {"input": "6 5\n2 6\n6 5\n3 1\n2 2\n1 2\n", "output": "4\n"}, {"input...
code_stdio
[ { "content": "There are N arrays. The length of each array is M and initially each array contains integers (1,2,...,M) in this order.\n\nMr. Takahashi has decided to perform Q operations on those N arrays. For the i-th (1≤i≤Q) time, he performs the following operation.\n\n* Choose an arbitrary array from the N ...
[{"input": "11 12\n6\n-2 0 3 6 -1 3", "output": "No\n"}, {"input": "11 12\n6\n-3 0 3 6 -1 3", "output": "No\n"}, {"input": "11 12\n6\n-3 0 3 6 -2 3", "output": "No\n"}, {"input": "1 6\n6\n-1 -2 1 4 0 1", "output": "Yes\n"}, {"input": "4 6\n6\n-1 -2 1 4 -1 5", "output": "No\n"}, {"input": "1 6\n6\n-1 -2 1 2 0 1", "outpu...
code_stdio
[ { "content": "Toad Zitz has an array of integers, each integer is between 0 and m-1 inclusive. The integers are a_1, a_2, …, a_n.\n\nIn one operation Zitz can choose an integer k and k indices i_1, i_2, …, i_k such that 1 ≤ i_1 < i_2 < … < i_k ≤ n. He should then change a_{i_j} to ((a_{i_j}+1) mod m) for each c...
[{"input": "100 1000\n980 755 745 448 424 691 210 545 942 979 555 783 425 942 495 741 487 514 752 434 187 874 372 617 414 505 659 445 81 397 243 986 441 587 31 350 831 801 194 103 723 166 108 182 252 846 328 905 639 690 738 638 986 340 559 626 572 808 442 410 179 549 880 153 449 99 434 945 163 687 173 797 999 274 975 6...
code_stdio
[ { "content": "You are given a string s consisting of n lowercase Latin letters. You have to type this string using your keyboard.\n\nInitially, you have an empty string. Until you type the whole string, you may perform the following operation: add a character to the end of the string. \n\nBesides, at most once...
[{"input": "100\nyeywsnxcwslfyiqbbeoaawtmioksfdndptxxcwzfmrpcixjbzvicijofjrbcvzaedglifuoczgjlqylddnsvsjfmfsccxbdveqgu\n", "output": "100\n"}, {"input": "100\nyeywsnxcwslfyiqbbeoaawtmioksfdndptxxcwzfmrpcixjbzvicijofjrbcvzaedglifuoczgjlqylddnsvsjfmfsccxbdveqgu\n", "output": "100\n"}, {"input": "100\nyeywsnxcwslfyiqbbeoia...
code_stdio
[ { "content": "In the world of DragonBool there are fierce warriors called Soints. Also there are even fiercer warriors called Sofloats – the mortal enemies of Soints.\n\nThe power of each warrior is determined by the amount of chakra he possesses which is some positive integer. Warriors with zero level of chakr...
[{"input": "2\n2 3\n10 1\n20 2\n5 2\n4 2\n18 1\n5 5\n73 87\n100 13\n36 36\n77 46\n16 93\n49 46\n27 93\n118 87\n172 13\n63 36", "output": "8\n155\n"}, {"input": "2\n2 3\n7 1\n20 2\n5 2\n4 2\n18 1\n5 5\n73 87\n100 13\n36 36\n77 46\n16 93\n49 46\n27 93\n118 87\n172 13\n63 36", "output": "11\n155\n"}, {"input": "2\n2 3\n10...
code_stdio
[ { "content": "Given the triangle of consecutive odd numbers:\n\n```\n 1\n 3 5\n 7 9 11\n 13 15 17 19\n21 23 25 27 29\n...\n```\n\nCalculate the row sums of this triangle from the row index (starting at index 1) e.g.:\n\n```python\nrow_sum_odd_numbers(...
[{"input": "101", "output": "[1030301]", "fn_name": "row_sum_odd_numbers"}, {"input": "74", "output": "[405224]", "fn_name": "row_sum_odd_numbers"}, {"input": "86", "output": "[636056]", "fn_name": "row_sum_odd_numbers"}, {"input": "93", "output": "[804357]", "fn_name": "row_sum_odd_numbers"}, {"input": "41", "output":...
code_functional
[ { "content": "A ski base is planned to be built in Walrusland. Recently, however, the project is still in the constructing phase. A large land lot was chosen for the construction. It contains n ski junctions, numbered from 1 to n. Initially the junctions aren't connected in any way.\n\nIn the constructing proce...
[{"input": "2 40\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n", "output": "0\n1\n3\n7\n15\n31\n63\n127\n255\n511\n1023\n2047\n4095\n8191\n16383\n32767\n65535\n1310...
code_stdio
[ { "content": "Cheesy Cheeseman just got a new monitor! He is happy with it, but he just discovered that his old desktop wallpaper no longer fits. He wants to find a new wallpaper, but does not know which size wallpaper he should be looking for, and alas, he just threw out the new monitor's box. Luckily he remem...
[{"input": "3840\n\"32:9\"", "output": "[\"3840x1080\"]", "fn_name": "find_screen_height"}, {"input": "1920\n\"16:9\"", "output": "[\"1920x1080\"]", "fn_name": "find_screen_height"}, {"input": "5120\n\"32:9\"", "output": "[\"5120x1440\"]", "fn_name": "find_screen_height"}, {"input": "1280\n\"16:9\"", "output": "[\"1280...
code_functional
[ { "content": "Given is an integer x that is greater than or equal to 0, and less than or equal to 1.\nOutput 1 if x is equal to 0, or 0 if x is equal to 1.\n\n-----Constraints-----\n - 0 \\leq x \\leq 1\n - x is an integer\n\n-----Input-----\nInput is given from Standard Input in the following format:\nx\n\n---...
[{"input": "000", "output": "1\n"}, {"input": "000", "output": "1\n"}, {"input": "1\n", "output": "0\n"}, {"input": "0\n", "output": "1\n"}, {"input": "1", "output": "0"}, {"input": "0", "output": "1"}]
code_stdio
[ { "content": "Phoenix has $n$ coins with weights $2^1, 2^2, \\dots, 2^n$. He knows that $n$ is even.\n\nHe wants to split the coins into two piles such that each pile has exactly $\\frac{n}{2}$ coins and the difference of weights between the two piles is minimized. Formally, let $a$ denote the sum of weights in...
[{"input": "100\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\...
code_stdio
[ { "content": "You are given a long decimal number $a$ consisting of $n$ digits from $1$ to $9$. You also have a function $f$ that maps every digit from $1$ to $9$ to some (possibly the same) digit from $1$ to $9$.\n\nYou can perform the following operation no more than once: choose a non-empty contiguous subseg...
[{"input": "20\n58832646452639258958\n9 2 2 1 1 4 8 6 6\n", "output": "58832646452639258958\n"}, {"input": "20\n58832646452639258958\n9 2 2 1 1 4 8 6 6\n", "output": "58832646452639258958"}, {"input": "19\n4752348644348366742\n6 7 9 7 5 7 9 9 5\n", "output": "7957979777979977977\n"}, {"input": "19\n2612437771227631192\...
code_stdio
[ { "content": "# 'Magic' recursion call depth number\n\nThis Kata was designed as a Fork to the one from donaldsebleung Roboscript series with a reference to:\n\nhttps://www.codewars.com/collections/roboscript\n\nIt is not more than an extension of Roboscript infinite \"single-\" mutual recursion handling to a \...
[{"input": "\"p6023R6F95L64R98P3321L15qP8886P8063P2161p3321P6023P6023F86L64qp8886F12F3L33P3321P3321R57qp8063P3321L35P3321P8886P6023F51qp2161P8063P8063F32R6F46q\"", "output": "[[3, 5]]", "fn_name": "magic_call_depth_number"}, {"input": "\"p5048L50R23P2998R9qp2125P3445R41R48qp1776R41P392qP2904p2998R4P2125P1776qp3445F57P1...
code_functional
[ { "content": "Given is a string S. Replace every character in S with x and print the result.\n\n-----Constraints-----\n - S is a string consisting of lowercase English letters.\n - The length of S is between 1 and 100 (inclusive).\n\n-----Input-----\nInput is given from Standard Input in the following format:\n...
[{"input": "kvtvweokpottycaeeyfthzfvsgckwjmgqadfekjfitnsieylhumxjjezqvidkxjpywokrnzxxwraamuimhmrjwqeyvjvyjjzsxxf\n", "output": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"}, {"input": "qvssniprlkdntynymqcjoxpttvplhodrlkpqwtnkdfkgmokodexzspghvslwqrerrsiasriutrr...
code_stdio
[ { "content": "You are given an integer N.\nFind the number of the positive divisors of N!, modulo 10^9+7.\n\n-----Constraints-----\n - 1≤N≤10^3\n\n-----Input-----\nThe input is given from Standard Input in the following format:\nN\n\n-----Output-----\nPrint the number of the positive divisors of N!, modulo 10^9...
[{"input": "1000\n", "output": "972926972\n"}, {"input": "1001", "output": "513172208\n"}, {"input": "108", "output": "875619122\n"}, {"input": "111", "output": "130571620\n"}, {"input": "101", "output": "167902493\n"}, {"input": "100", "output": "583951250\n"}, {"input": "110", "output": "277966376\n"}, {"input": "115...
code_stdio
[ { "content": "You are given two positive integers $x$ and $y$. You can perform the following operation with $x$: write it in its binary form without leading zeros, add $0$ or $1$ to the right of it, reverse the binary form and turn it into a decimal number which is assigned as the new value of $x$.\n\nFor examp...
[{"input": "1740680371580423905 1636173592742219971\n", "output": "NO\n"}, {"input": "999999999999999999 1636173592742219971\n", "output": "NO\n"}, {"input": "616543106594181990 1600944574522397396\n", "output": "NO\n"}, {"input": "470060730774588924 1202400343260876277\n", "output": "NO\n"}, {"input": "616543106594181...
code_stdio
[ { "content": "Snuke is buying a bicycle.\nThe bicycle of his choice does not come with a bell, so he has to buy one separately.\nHe has very high awareness of safety, and decides to buy two bells, one for each hand.\nThe store sells three kinds of bells for the price of a, b and c yen (the currency of Japan), r...
[{"input": "10000 10000 10000\n", "output": "20000\n"}, {"input": "10000 10100 10000", "output": "20000\n"}, {"input": "10000 00100 10000", "output": "10100\n"}, {"input": "11000 10100 10000", "output": "20100\n"}, {"input": "11000 10110 10000", "output": "20110\n"}, {"input": "11000 10111 10000", "output": "20111\n"},...
code_stdio
[ { "content": "Square Route\n\nSquare root\n\nEnglish text is not available in this practice contest.\n\nMillionaire Shinada, who has decided to build a new mansion, is wondering in which city to build the new mansion. To tell the truth, Mr. Shinada is a strange person who likes squares very much, so he wants to...
[{"input": "3 3\n2\n1\n2\n-1\n3\n1\n1 2\n22\n11\n10\n0 0", "output": "7\n0\n"}, {"input": "3 3\n1\n1\n2\n1\n1\n1\n1 2\n10\n10\n23\n0 0", "output": "11\n1\n"}, {"input": "3 3\n1\n1\n1\n2\n3\n1\n1 2\n10\n10\n10\n0 0", "output": "6\n2\n"}, {"input": "3 3\n1\n1\n1\n1\n3\n1\n1 2\n10\n10\n10\n0 0", "output": "7\n2\n"}, {"inp...
code_stdio
[ { "content": "A `bouncy number` is a positive integer whose digits neither increase nor decrease. For example, 1235 is an increasing number, 5321 is a decreasing number, and 2351 is a bouncy number. By definition, all numbers under 100 are non-bouncy, and 101 is the first bouncy number.\n\nDetermining if a numb...
[{"input": "50", "output": "[99999999999999999999999999999999999999912040301674]", "fn_name": "bouncy_count"}, {"input": "20", "output": "[99999999999959940181]", "fn_name": "bouncy_count"}, {"input": "10", "output": "[9999722967]", "fn_name": "bouncy_count"}, {"input": "6", "output": "[987048]", "fn_name": "bouncy_cou...
code_functional
[ { "content": "Takahashi became a pastry chef and opened a shop La Confiserie d'ABC to celebrate AtCoder Beginner Contest 100.\nThe shop sells N kinds of cakes.\n\nEach kind of cake has three parameters \"beauty\", \"tastiness\" and \"popularity\". The i-th kind of cake has the beauty of x_i, the tastiness of y_...
[{"input": "1000 1000\n-10000000000 -10000000000 -10000000000\n-10000000000 -10000000000 -10000000000\n-10000000000 -10000000000 -10000000000\n-10000000000 -10000000000 -10000000000\n-10000000000 -10000000000 -10000000000\n-10000000000 -10000000000 -10000000000\n-10000000000 -10000000000 -10000000000\n-10000000000 -100...
code_stdio
[ { "content": "Read problems statements in Mandarin Chinese . \n\nGiven an array of n non-negative integers: A_{1}, A_{2}, …, A_{N}. Your mission is finding a pair of integers A_{u}, A_{v} (1 ≤ u < v ≤ N) such that (A_{u} and A_{v}) is as large as possible.\nAnd is a bit-wise operation which is corresponding to...
[{"input": "4\n1\n11\n23\n11", "output": "11\n"}, {"input": "4\n4\n11\n18\n16", "output": "16\n"}, {"input": "4\n1\n15\n17\n14", "output": "14\n"}, {"input": "4\n13\n10\n3\n13", "output": "13\n"}, {"input": "4\n2\n30\n26\n11", "output": "26\n"}, {"input": "4\n37\n23\n0\n36", "output": "36\n"}, {"input": "4\n37\n49\n0\n...
code_stdio
[ { "content": "Once Volodya was at the museum and saw a regular chessboard as a museum piece. And there were only four chess pieces on it: two white rooks, a white king and a black king. \"Aha, blacks certainly didn't win!\", — Volodya said and was right for sure. And your task is to say whether whites had won o...
[{"input": "e8 e7 d8 g8\n", "output": "CHECKMATE\n"}, {"input": "d4 e5 b7 a5\n", "output": "CHECKMATE\n"}, {"input": "a5 b5 g2 a8\n", "output": "CHECKMATE\n"}, {"input": "d8 d7 h8 f8\n", "output": "CHECKMATE\n"}, {"input": "g8 h5 a6 h3\n", "output": "CHECKMATE\n"}, {"input": "b3 a5 g6 a8\n", "output": "CHECKMATE\n"}, {...
code_stdio
[ { "content": "For a given sequence of distinct non-negative integers $(b_1, b_2, \\dots, b_k)$ we determine if it is good in the following way:\n\nConsider a graph on $k$ nodes, with numbers from $b_1$ to $b_k$ written on them.\n\nFor every $i$ from $1$ to $k$: find such $j$ ($1 \\le j \\le k$, $j\\neq i$), for...
[{"input": "109\n74 18 237 179 195 112 156 11 72 68 173 202 78 250 224 251 107 55 186 144 57 62 28 210 132 64 93 6 211 0 174 163 248 226 167 246 46 102 253 180 121 56 151 35 150 254 168 201 242 118 190 158 196 30 75 116 187 96 215 244 192 73 12 175 33 222 131 256 181 230 114 165 128 234 63 90 44 70 229 182 101 69 92 26...
code_stdio
[ { "content": "This is an easier version of the next problem. The difference is only in constraints.\n\nYou are given a rectangular $n \\times m$ matrix $a$. In one move you can choose any column and cyclically shift elements in this column. You can perform this operation as many times as you want (possibly zero...
[{"input": "40\n2 2\n5 2\n1 5\n1 1\n3\n1 2\n1 1\n1 2\n1 1\n1 2\n2 3\n2 1\n1\n1\n1 1\n1\n2 1\n1\n1\n1 2\n2 3\n2 2\n1 3\n3 3\n1 1\n1\n2 1\n3\n4\n1 1\n2\n2 2\n1 1\n1 1\n2 2\n1 1\n1 1\n1 1\n1\n2 1\n1\n1\n2 1\n5\n3\n1 1\n2\n1 2\n2 2\n2 1\n1\n1\n2 2\n3 2\n2 4\n1 1\n5\n1 2\n2 1\n1 2\n1 1\n1 2\n1 1\n1 2\n1 1\n1 1\n3\n2 2\n1 2\...
code_stdio
[ { "content": "Bomboslav likes to look out of the window in his room and watch lads outside playing famous shell game. The game is played by two persons: operator and player. Operator takes three similar opaque shells and places a ball beneath one of them. Then he shuffles the shells by swapping some pairs and t...
[{"input": "2000000000\n0\n", "output": "1\n"}, {"input": "1999999995\n0\n", "output": "2\n"}, {"input": "1999999995\n1\n", "output": "1\n"}, {"input": "1999999995\n2\n", "output": "0\n"}, {"input": "1999999996\n0\n", "output": "2\n"}, {"input": "1999999996\n1\n", "output": "0\n"}, {"input": "1999999996\n2\n", "output"...
code_stdio
[ { "content": "You are at a water bowling training. There are l people who play with their left hand, r people, who play with their right hand, and a ambidexters, who can play with left or right hand.\n\nThe coach decided to form a team of even number of players, exactly half of the players should play with thei...
[{"input": "100 100 100\n", "output": "300\n"}, {"input": "100 100 100\n", "output": "300\n"}, {"input": "100 101 100\n", "output": "300\n"}, {"input": "99 100 100\n", "output": "298\n"}, {"input": "100 99 100\n", "output": "298\n"}, {"input": "100 100 99\n", "output": "298\n"}, {"input": "99 100 100\n", "output": "298...
code_stdio
[ { "content": "You have an array of integers (initially empty).\n\nYou have to perform $q$ queries. Each query is of one of two types:\n\n\"$1$ $x$\" — add the element $x$ to the end of the array;\n\n\"$2$ $x$ $y$\" — replace all occurrences of $x$ in the array with $y$.\n\nFind the resulting array after perform...
[{"input": "8\n2 1 4\n1 1\n1 4\n1 2\n2 2 4\n2 4 3\n1 2\n2 2 7\n", "output": "1 3 3 7 \n"}, {"input": "8\n2 1 4\n1 1\n1 4\n1 2\n2 2 4\n2 4 3\n1 2\n2 2 7\n", "output": "1 3 3 7 "}, {"input": "8\n2 2 4\n1 1\n1 4\n1 2\n2 2 4\n2 4 3\n1 2\n2 2 7\n", "output": "1 3 3 7"}, {"input": "8\n2 2 4\n1 1\n1 4\n1 2\n2 2 6\n2 4 3\n1 2\...
code_stdio
[ { "content": "> I would, if I could,\n> If I couldn't how could I?\n> I couldn't, without I could, could I?\n> Could you, without you could, could ye?\n> Could ye? could ye?\n> Could you, without you could, could ye?\n\nIt is true, as this old rhyme says, that we can only DO what we can DO and we cannot DO...
[{"input": "15 2 3\n16 3 6\n110 9 112\n0 0 0", "output": "1\n11\n98\n"}, {"input": "15 2 4\n16 3 6\n110 9 112\n0 0 0", "output": "8\n11\n98\n"}, {"input": "15 2 4\n15 3 6\n110 9 112\n0 0 0", "output": "8\n10\n98\n"}, {"input": "10 2 3\n10 2 5\n100 13 40\n0 0 0", "output": "1\n2\n86\n"}, {"input": "10 2 3\n28 2 5\n100 1...
code_stdio
[ { "content": "Gildong is now developing a puzzle game. The puzzle consists of n platforms numbered from 1 to n. The player plays the game as a character that can stand on each platform and the goal of the game is to move the character from the 1-st platform to the n-th platform.\n\nThe i-th platform is labeled ...
[{"input": "3\n4\n1 1 1 0\n5\n4 3 2 1 0\n9\n4 1 4 2 1 0 2 1 0\n", "output": "\n0\n3\n2\n"}, {"input": "3\n4\n1 1 1 0\n5\n4 3 2 1 0\n9\n4 1 4 3 1 0 2 1 0\n", "output": "0\n3\n2\n"}, {"input": "3\n4\n1 1 1 0\n5\n4 3 2 1 0\n9\n4 1 4 2 1 0 2 0 0\n", "output": "0\n3\n1\n"}, {"input": "3\n4\n1 1 1 0\n5\n2 3 2 1 0\n9\n3 1 4 1...
code_stdio
[ { "content": "In number world, two different numbers are friends if they have a lot in common, but also each one has unique perks.\n\nMore precisely, two different numbers a and b are friends if gcd(a,b), (a)/(gcd(a,b)), (b)/(gcd(a,b)) can form sides of a triangle.\n\nThree numbers a, b and c can form sides of ...
[{"input": "100\n42 486 341 527 189 740 490 388 989 489 711 174 305 844 971 492 998 757 832 442 176 619 906 154 293 395 439 735 738 915 453 748 2353 895 871 932 693 326 53 904 732 835 354 364 691 669 157 719 282 875 573 672 695 790 58 872 732 751 557 779 329 70 213 844 289 137 50 951 284 671 474 829 906 736 395 366 22 ...
code_stdio
[ { "content": "Snuke found a record of a tree with N vertices in ancient ruins. The findings are as follows:\n\n* The vertices of the tree were numbered 1,2,...,N, and the edges were numbered 1,2,...,N-1.\n* Edge i connected Vertex a_i and b_i.\n* The length of each edge was an integer between 1 and 10^{18} (inc...
[{"input": "15\n9 10\n9 15\n15 4\n4 13\n13 2\n13 11\n2 14\n13 6\n11 1\n2 12\n12 3\n12 7\n2 5\n14 8\n1154 890 2365 883 2930 2076 1590 1104 1726 1791 1091 1226 151 1000 1657", "output": "5\n6\n86\n104\n739\n85\n10\n148\n4\n37\n87\n28\n156\n8\n"}, {"input": "15\n9 10\n9 15\n15 4\n4 13\n13 2\n13 11\n2 14\n13 11\n11 1\n1 12...
code_stdio
[ { "content": "In this kata, you will write a function that returns the positions and the values of the \"peaks\" (or local maxima) of a numeric array.\n\nFor example, the array `arr = [0, 1, 2, 5, 1, 0]` has a peak at position `3` with a value of `5` (since `arr[3]` equals `5`).\n\n~~~if-not:php,cpp,java,csharp...
[{"input": "[1, 2, 5, 4, 3, 2, 3, 6, 4, 1, 2, 3, 3, 4, 5, 3, 2, 1, 2, 3, 5, 5, 4, 3]", "output": "[{\"pos\": [2, 7, 14, 20], \"peaks\": [5, 6, 5, 5]}]", "fn_name": "pick_peaks"}, {"input": "[3, 2, 3, 6, 4, 1, 2, 3, 2, 1, 2, 2, 2, 1]", "output": "[{\"pos\": [3, 7, 10], \"peaks\": [6, 3, 2]}]", "fn_name": "pick_peaks"}, ...
code_functional
[ { "content": "###Story\nSometimes we are faced with problems when we have a big nested dictionary with which it's hard to work. Now, we need to solve this problem by writing a function that will flatten a given dictionary.\n\n###Info\nPython dictionaries are a convenient data type to store and process configura...
[{"input": "{\"glossary\": {\"GlossDiv\": {\"GlossList\": {\"GlossEntry\": {\"GlossDef\": {\"GlossSeeAlso\": {\"1\": \"GML\", \"2\": \"XML\"}, \"para\": \"A meta-markup language, used to create markup languages such as DocBook.\"}, \"GlossSee\": \"markup\", \"Acronym\": \"SGML\", \"GlossTerm\": \"Standard Generalized M...
code_functional
[ { "content": "In an attempt to escape the Mischievous Mess Makers' antics, Farmer John has abandoned his farm and is traveling to the other side of Bovinia. During the journey, he and his k cows have decided to stay at the luxurious Grand Moo-dapest Hotel. The hotel consists of n rooms located in a row, some of...
[{"input": "491 172\n01111101111111100000111010110001010001110111000010101111101000100010010111011101110110111101101010111000111000011100011010010010111111000011011010100110001000011100111000001011100010001111101111101000111001100110010100101000001110010100100100100101001100010101001000010000111110011000000100000100101...
code_stdio
[ { "content": "At Aizu Riverside Hospital, inpatients walk twice a day for rehabilitation and health promotion. As the number of people trying to recover their physical strength by walking is increasing day by day in order to leave the hospital energetically, the director plans to give a present to the person wh...
[{"input": "5\n263 1519 1817\n2 1240 1985\n11656 1896 4132\n10001 503 3107\n51 1421 2690\n3\n345 1628 2181\n7 3910 1590\n5982 2525 3616\n0", "output": "11656 6028\n5982 6141\n"}, {"input": "5\n263 1519 1817\n2 1240 1985\n11656 1896 4132\n10001 503 3107\n51 1421 2690\n3\n345 1628 2181\n7 3910 1590\n5982 2525 5629\n0", "...
code_stdio
[ { "content": "Write a function that takes as its parameters *one or more numbers which are the diameters of circles.* \n\nThe function should return the *total area of all the circles*, rounded to the nearest integer in a string that says \"We have this much circle: xyz\". \n\nYou don't know how many circles yo...
[{"input": "56894.04839\n843975.4839\n4.08437403489", "output": "[\"We have this much circle: 561977165367\"]", "fn_name": "sum_circles"}, {"input": "5\n6\n7\n8\n9\n10\n105083\n48839\n4853\n28\n483", "output": "[\"We have this much circle: 10564760498\"]", "fn_name": "sum_circles"}, {"input": "4.5456\n746.5\n98.34\n344...
code_functional
[ { "content": "You are the \"computer expert\" of a local Athletic Association (C.A.A.).\nMany teams of runners come to compete. Each time you get a string of \nall race results of every team who has run.\nFor example here is a string showing the individual results of a team of 5 runners:\n\n` \"01|15|59, 1|47|6...
[{"input": "\"11|15|59, 10|16|16, 12|17|20, 9|22|34, 13|19|34, 11|15|17, 11|22|00, 10|26|37, 12|17|48, 9|16|30, 12|20|14, 11|25|11\"", "output": "[\"Range: 04|03|04 Average: 11|14|36 Median: 11|18|59\"]", "fn_name": "stat"}, {"input": "\"1|15|59, 1|16|16, 1|17|20, 1|22|34, 1|19|34, 1|15|17, 1|22|00, 1|26|37, 1|17|48, 1...
code_functional
[ { "content": "A sequence $a_1, a_2, \\dots, a_n$ is called good if, for each element $a_i$, there exists an element $a_j$ ($i \\ne j$) such that $a_i+a_j$ is a power of two (that is, $2^d$ for some non-negative integer $d$).\n\nFor example, the following sequences are good: $[5, 3, 11]$ (for example, for $a_1=...
[{"input": "10\n3 10 14 1 10 12 5 16 5 2\n", "output": "4\n"}, {"input": "10\n3 10 14 1 10 8 5 16 5 2\n", "output": "4\n"}, {"input": "10\n3 10 9 1 10 8 5 16 5 2\n", "output": "6\n"}, {"input": "10\n2 10 9 1 10 4 7 8 5 4\n", "output": "5\n"}, {"input": "10\n2 10 9 1 10 4 5 8 5 4\n", "output": "8\n"}, {"input": "10\n3 1...
code_stdio