messages
listlengths
1
1
ground_truth
stringlengths
156
726k
dataset
stringclasses
2 values
[ { "content": "There are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total?\n\n-----Constraints-----\n - 1≦N≦100\n\n-----In...
[{"input": "-465", "output": "107880\n"}, {"input": "-792", "output": "313236\n"}, {"input": "-937", "output": "438516\n"}, {"input": "-845", "output": "356590\n"}, {"input": "-647", "output": "208981\n"}, {"input": "-164", "output": "13366\n"}, {"input": "-152", "output": "11476\n"}, {"input": "-299", "output": "44551...
code_stdio
[ { "content": "A kindergarten teacher Natalia Pavlovna has invented a new ball game. This game not only develops the children's physique, but also teaches them how to count. \n\nThe game goes as follows. Kids stand in circle. Let's agree to think of the children as numbered with numbers from 1 to n clockwise and...
[{"input": "102\n", "output": "2 4 7 11 16 22 29 37 46 56 67 79 92 4 19 35 52 70 89 7 28 50 73 97 20 46 73 101 28 58 89 19 52 86 19 55 92 28 67 5 46 88 29 73 16 62 7 55 2 52 1 53 4 58 11 67 22 80 37 97 56 16 79 41 4 70 35 1 70 38 7 79 50 22 97 71 46 22 101 79 58 38 19 1 86 70 55 41 28 16 5 97 88 80 73 67 62 58 55 53 52...
code_stdio
[ { "content": "Let's call a string a phone number if it has length 11 and fits the pattern \"8xxxxxxxxxx\", where each \"x\" is replaced by a digit.\n\nFor example, \"80123456789\" and \"80000000000\" are phone numbers, while \"8012345678\" and \"79000000000\" are not.\n\nYou have $n$ cards with digits, and you ...
[{"input": "100\n10073026040057460848727605087211482331696312132261702754626166388448133087167204984955299978572844873\n", "output": "9\n"}, {"input": "100\n12214470388509637187316171407185732399094381485438987303313809772379863936872280956215437122989955784\n", "output": "9\n"}, {"input": "100\n88202862851852449384524...
code_stdio
[ { "content": "There are n heroes fighting in the arena. Initially, the i-th hero has a_i health points.\n\nThe fight in the arena takes place in several rounds. At the beginning of each round, each alive hero deals 1 damage to all other heroes. Hits of all heroes occur simultaneously. Heroes whose health is les...
[{"input": "371 306\n", "output": "512015273\n"}, {"input": "222 500\n", "output": "382157018\n"}, {"input": "124 212\n", "output": "806210307\n"}, {"input": "300 500\n", "output": "567125736\n"}, {"input": "224 375\n", "output": "555865043\n"}, {"input": "365 500\n", "output": "552203508\n"}, {"input": "444 500\n", "o...
code_stdio
[ { "content": "One day, after a difficult lecture a diligent student Sasha saw a graffitied desk in the classroom. She came closer and read: \"Find such positive integer n, that among numbers n + 1, n + 2, ..., 2·n there are exactly m numbers which binary representation contains exactly k digits one\".\n\nThe gi...
[{"input": "101628400788615604 30\n", "output": "999999999999995905\n"}, {"input": "101628400798615604 31\n", "output": "981546175132942729\n"}, {"input": "101628400798615604 31\n", "output": "981546175132942729\n"}, {"input": "101628400788615604 30\n", "output": "999999999999995905\n"}, {"input": "10000000000000000 35...
code_stdio
[ { "content": "You have full control over a robot that walks around in a rectangular field paved with square tiles like a chessboard. There are m columns of tiles from west to east, and n rows of tiles from south to north (1 <= m, n <= 100). Each tile is given a pair of coordinates, such as (i, j), where 1 <= i ...
[{"input": "11 5\nFORWARD 3\nRIGHT\nFORWARD 10\nLEFT\nBACKWARD 3\nSTOP\n3 1\nFORWARD 2\nSTOP\n0 0", "output": "11 1\n1 1\n"}, {"input": "14 5\nFORWARD 3\nRIGHT\nFORWARD 8\nLEFT\nBACKWARD 2\nSTOP\n3 1\nFORVARD 5\nSTOP\n0 0", "output": "9 2\n1 1\n"}, {"input": "1 10\nFORDARW 1\nRIGHT\nFORWARD 5\nLEFT\nBACKWARD 1\nSTOP\n3...
code_stdio
[ { "content": "In this Kata we are passing a number (n) into a function. \n\nYour code will determine if the number passed is even (or not). \n\nThe function needs to return either a true or false. \n\nNumbers may be positive or negative, integers or floats.\n\nFloats are considered UNeven for this kata.\n\nWrit...
[{"input": "222222221", "output": "[false]", "fn_name": "is_even"}, {"input": "500000000", "output": "[true]", "fn_name": "is_even"}, {"input": "0.5", "output": "[false]", "fn_name": "is_even"}, {"input": "15", "output": "[false]", "fn_name": "is_even"}, {"input": "220", "output": "[true]", "fn_name": "is_even"}, {"inp...
code_functional
[ { "content": "We have a 3×3 square grid, where each square contains a lowercase English letters.\nThe letter in the square at the i-th row from the top and j-th column from the left is c_{ij}.\nPrint the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecti...
[{"input": "ant\nobe\nrec\n", "output": "abc\n"}, {"input": "edu\ncat\nion\n", "output": "ean\n"}, {"input": "ant\nobe\nrfc", "output": "abc\n"}, {"input": "ddu\ncat\nion", "output": "dan\n"}, {"input": "ant\nobe\nrcf", "output": "abf\n"}, {"input": "ddu\ncat\nioo", "output": "dao\n"}, {"input": "ddu\ncat\nooi", "outpu...
code_stdio
[ { "content": "The Resistance is trying to take control over as many planets of a particular solar system as possible. Princess Heidi is in charge of the fleet, and she must send ships to some planets in order to maximize the number of controlled planets.\n\nThe Galaxy contains N planets, connected by bidirectio...
[{"input": "24\n19 14\n8 15\n13 4\n18 16\n1 17\n10 3\n22 21\n10 14\n6 11\n9 12\n15 22\n11 3\n21 7\n2 12\n7 4\n4 19\n16 9\n24 17\n5 15\n8 2\n23 10\n20 12\n18 24\n", "output": "1 20 21 22 23 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24\n"}, {"input": "24\n19 14\n8 15\n13 4\n18 16\n1 17\n10 3\n22 21\n10 14\n6 ...
code_stdio
[ { "content": "Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something else does not look neat, he rushes to correct it. For example, number sequence written like \"1,2 ,3,..., 1...
[{"input": ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\n", "output": ", , , , , , , , , , , , , , , , , , ,...
code_stdio
[ { "content": "You survived several months of exam wars and were able to enter ICPC University on a sunny day. On the day of admission, there was an enthusiastic recruitment of circles on the campus of the university, and you received a large number of pamphlets and returned. When you return to your room, you fi...
[{"input": "9\n315\n0", "output": "2\n11\n"}, {"input": "9\n256\n0", "output": "2\n0\n"}, {"input": "9\n160\n0", "output": "2\n1\n"}, {"input": "9\n213\n0", "output": "2\n3\n"}, {"input": "9\n200\n0", "output": "2\n2\n"}, {"input": "9\n135\n0", "output": "2\n7\n"}, {"input": "9\n350\n0", "output": "2\n5\n"}, {"input": ...
code_stdio
[ { "content": "You are given an integer array $a_1, a_2, \\ldots, a_n$.\n\nThe array $b$ is called to be a subsequence of $a$ if it is possible to remove some elements from $a$ to get $b$.\n\nArray $b_1, b_2, \\ldots, b_k$ is called to be good if it is not empty and for every $i$ ($1 \\le i \\le k$) $b_i$ is div...
[{"input": "50\n170081 797965 40736 224325 102476 20832 954026 923972 391400 247099 95141 927386 79799 749285 104039 200818 623552 872203 355273 838168 352783 850365 389351 930945 847154 608047 727586 549184 520573 608953 338849 536466 345479 589848 882827 771475 874283 787115 992590 128903 97800 74550 674140 282514 51...
code_stdio
[ { "content": "Limak can repeatedly remove one of the first two characters of a string, for example abcxyx \\rightarrow acxyx \\rightarrow cxyx \\rightarrow cyx.\n\nYou are given N different strings S_1, S_2, \\ldots, S_N. Among N \\cdot (N-1) / 2 pairs (S_i, S_j), in how many pairs could Limak obtain one string...
[{"input": "3\nabcxyx\ncyx\nabb", "output": "1\n"}, {"input": "3\nabxxyc\ncyx\nabb", "output": "0\n"}, {"input": "6\nb\na\nabb\nc\nd\nab", "output": "5\n"}, {"input": "6\nb\na\nabb\nc\nd\nba", "output": "4\n"}, {"input": "3\naxxbyc\ncyx\nabb", "output": "0\n"}, {"input": "3\naxxbyc\ncyx\naab", "output": "0\n"}, {"input...
code_stdio
[ { "content": "Polycarp is very fond of playing the game Minesweeper. Recently he found a similar game and there are such rules.\n\nThere are mines on the field, for each the coordinates of its location are known ($x_i, y_i$). Each mine has a lifetime in seconds, after which it will explode. After the explosion,...
[{"input": "3\n\n5 0\n0 0 1\n-1 1 4\n1 1 2\n1 0 3\n2 2 9\n\n5 2\n0 -1 1\n0 1 4\n2 0 2\n1 1 3\n2 2 9\n\n6 1\n1 -1 3\n0 -1 9\n0 1 7\n-1 0 1\n0 1 14\n-1 -1 11\n", "output": "2\n1\n1"}, {"input": "3\n\n5 0\n0 0 1\n-1 1 4\n1 0 2\n1 0 3\n2 2 11\n\n5 2\n0 0 0\n0 1 4\n3 0 2\n1 1 3\n2 2 15\n\n6 1\n1 -1 3\n0 -1 9\n0 1 9\n-1 0 1\...
code_stdio
[ { "content": "Let's call a list of positive integers $a_0, a_1, ..., a_{n-1}$ a power sequence if there is a positive integer $c$, so that for every $0 \\le i \\le n-1$ then $a_i = c^i$.\n\nGiven a list of $n$ positive integers $a_0, a_1, ..., a_{n-1}$, you are allowed to: Reorder the list (i.e. pick a permuta...
[{"input": "100\n881 479 355 759 257 497 690 598 275 446 439 787 257 326 436 713 322 5 253 781 434 307 164 154 241 381 38 942 680 906 240 11 431 478 628 1203 346 74 493 964 455 746 950 41 585 549 892 687 264 41 487 676 63 453 861 980 477 901 80 907 285 506 619 748 773 743 56 925 651 685 845 313 419 504 770 324 2 559 40...
code_stdio
[ { "content": "Everybody knows that the m-coder Tournament will happen soon. m schools participate in the tournament, and only one student from each school participates.\n\nThere are a total of n students in those schools. Before the tournament, all students put their names and the names of their schools into th...
[{"input": "100 10 1\n62 68 24 82 66 47 73 43 85 23 78 13 94 14 84 17 27 5 72 48 59 46 97 81 88 9 76 69 11 15 12 61 130 7 91 34 99 52 54 57 56 64 55 67 40 38 74 25 30 4 22 92 33 3 86 45 37 26 150 53 75 71 58 96 98 20 36 1 95 63 10 49 19 41 89 21 39 100 93 42 32 90 28 83 6 29 60 65 44 35 18 16 8 50 80 31 51 2 146 79\n6 ...
code_stdio
[ { "content": "Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y.\n\nIn a single second, he can modify the length of a single side of the ...
[{"input": "100000 25000\n", "output": "5\n"}, {"input": "100000 25000\n", "output": "5\n"}, {"input": "167552 16353\n", "output": "7\n"}, {"input": "113151 20996\n", "output": "6\n"}, {"input": "141391 23890\n", "output": "6\n"}, {"input": "100100 25000\n", "output": "5\n"}, {"input": "119562 71629\n", "output": "3\n"...
code_stdio
[ { "content": "We have an undirected graph G with N vertices numbered 1 to N and N edges as follows:\n - For each i=1,2,...,N-1, there is an edge between Vertex i and Vertex i+1.\n - There is an edge between Vertex X and Vertex Y.\nFor each k=1,2,...,N-1, solve the problem below:\n - Find the number of pairs of ...
[{"input": "2000 999 1001\n", "output": "2000\n1999\n1998\n1997\n1996\n1995\n1994\n1993\n1992\n1991\n1990\n1989\n1988\n1987\n1986\n1985\n1984\n1983\n1982\n1981\n1980\n1979\n1978\n1977\n1976\n1975\n1974\n1973\n1972\n1971\n1970\n1969\n1968\n1967\n1966\n1965\n1964\n1963\n1962\n1961\n1960\n1959\n1958\n1957\n1956\n1955\n195...
code_stdio
[ { "content": "Create a program that converts the date expressed in the Christian era to the Japanese calendar using the era name and outputs the date. The input is three integers, as shown in the example, in the order year, month, and day. Convert this as shown in the sample output. If the date before the Meiji...
[{"input": "3559 9 5\n2425 12 2\n2980 9 14", "output": "heisei 1571 9 5\nheisei 437 12 2\nheisei 992 9 14\n"}, {"input": "3559 9 5\n2425 12 2\n2980 9 7", "output": "heisei 1571 9 5\nheisei 437 12 2\nheisei 992 9 7\n"}, {"input": "3080 6 3\n2027 12 3\n3210 9 1", "output": "heisei 1092 6 3\nheisei 39 12 3\nheisei 1222 9 ...
code_stdio
[ { "content": "Dwarfs have planted a very interesting plant, which is a triangle directed \"upwards\". This plant has an amusing feature. After one year a triangle plant directed \"upwards\" divides into four triangle plants: three of them will point \"upwards\" and one will point \"downwards\". After another ye...
[{"input": "1000000000000000000\n", "output": "899770636\n"}, {"input": "148049062285906746\n", "output": "913927498\n"}, {"input": "615812227854199662\n", "output": "357939938\n"}, {"input": "585335721566249104\n", "output": "301383716\n"}, {"input": "791809296233191092\n", "output": "369199735\n"}, {"input": "5228421...
code_stdio
[ { "content": "You are given an array $a_1, a_2, \\dots, a_n$, consisting of $n$ positive integers. \n\nInitially you are standing at index $1$ and have a score equal to $a_1$. You can perform two kinds of moves: move right — go from your current index $x$ to $x+1$ and add $a_{x+1}$ to your score. This move ca...
[{"input": "4\n5 4 0\n1 5 4 3 2\n5 4 1\n1 5 7 3 2\n5 4 4\n10 20 30 40 78\n10 7 3\n4 6 12 2 9 12 14 4 10 9\n", "output": "15\n25\n178\n71\n"}, {"input": "4\n5 4 0\n1 5 4 3 2\n5 4 1\n1 5 7 3 2\n5 4 4\n10 20 30 40 50\n10 7 3\n4 6 8 2 9 12 14 4 10 9\n", "output": "15\n25\n150\n67\n"}, {"input": "4\n5 4 0\n1 5 4 3 2\n5 4 1\...
code_stdio
[ { "content": "Make a program that takes a value (x) and returns \"Bang\" if the number is divisible by 3, \"Boom\" if it is divisible by 5, \"BangBoom\" if it divisible by 3 and 5, and \"Miss\" if it isn't divisible by any of them.\nNote: Your program should only return one value\n\nEx: Input: 105 --> Output: \...
[{"input": "41535", "output": "[\"BangBoom\"]", "fn_name": "multiple"}, {"input": "10003823", "output": "[\"Miss\"]", "fn_name": "multiple"}, {"input": "30", "output": "[\"BangBoom\"]", "fn_name": "multiple"}, {"input": "15", "output": "[\"BangBoom\"]", "fn_name": "multiple"}, {"input": "45", "output": "[\"BangBoom\"]"...
code_functional
[ { "content": "Tashizan Hikizan (Calculation Training)\n\nsquare1001 You gave E869120 two numbers, $ A $ and $ B $, as birthday presents.\n\nE869120 You decided to use these two numbers for calculation training.\n\nSpecifically, E869120 does the following for these numbers exactly $ N $ times:\n\n* Replace $ A $...
[{"input": "3\n-2 -10", "output": "10 -2\n"}, {"input": "3\n-2 -15", "output": "15 -2\n"}, {"input": "3\n-2 -21", "output": "21 -2\n"}, {"input": "3\n-2 -27", "output": "27 -2\n"}, {"input": "3\n-1 -27", "output": "27 -1\n"}, {"input": "3\n-1 -21", "output": "21 -1\n"}, {"input": "3\n-1 -24", "output": "24 -1\n"}, {"in...
code_stdio
[ { "content": "Find the least common multiple (LCM) of given n integers.\n\nConstraints\n\n* 2 ≤ n ≤ 10\n* 1 ≤ ai ≤ 1000\n* Product of given integers ai(i = 1, 2, ... n) does not exceed 231-1\n\nInput\n\n\nn\na1 a2 ... an\n\n\nn is given in the first line. Then, n integers are given in the second line.\n\nOutput...
[{"input": "3\n12 39 11", "output": "1716\n"}, {"input": "4\n1 2 5 24", "output": "120\n"}, {"input": "3\n3 37 10", "output": "1110\n"}, {"input": "4\n1 2 5 44", "output": "220\n"}, {"input": "3\n9 37 10", "output": "3330\n"}, {"input": "4\n1 3 5 44", "output": "660\n"}, {"input": "3\n9 39 10", "output": "1170\n"}, {"i...
code_stdio
[ { "content": "Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible diverse words in lexicographical order.\n\nA word is called diverse if and only if it is a nonempty str...
[{"input": "abcdefghijklmnopqrytuvwzsx", "output": "abcdefghijklmnopqrytuvwzx\n"}, {"input": "abcpefghijklmnodqrytuvwzsx", "output": "abcpefghijklmnodqrytuvwzx\n"}, {"input": "azcdefghijklmnopqrstuvwbyx", "output": "azcdefghijklmnopqrstuvwx\n"}, {"input": "abcdefghijklmnopqrstuvwzyx", "output": "abcdefghijklmnopqrstuvx...
code_stdio
[ { "content": "A pair of numbers has a unique LCM but a single number can be the LCM of more than one possible\npairs. For example `12` is the LCM of `(1, 12), (2, 12), (3,4)` etc. For a given positive integer N, the number of different integer pairs with LCM is equal to N can be called the LCM cardinality of th...
[{"input": "101101291", "output": "[5]", "fn_name": "lcm_cardinality"}, {"input": "12345676", "output": "[68]", "fn_name": "lcm_cardinality"}, {"input": "30858025", "output": "[63]", "fn_name": "lcm_cardinality"}, {"input": "1251562", "output": "[41]", "fn_name": "lcm_cardinality"}, {"input": "9801", "output": "[23]", ...
code_functional
[ { "content": "In this problem we consider a special type of an auction, which is called the second-price auction. As in regular auction n bidders place a bid which is price a bidder ready to pay. The auction is closed, that is, each bidder secretly informs the organizer of the auction price he is willing to pay...
[{"input": "100\n2515 3324 7975 6171 4240 1217 4829 5203 8603 6900 3031 4699 4732 6070 4221 3228 6497 7359 9130 4346 4619 1109 3945 5442 3271 16 9711 2045 6410 2301 3406 8125 6003 1892 1260 9661 3940 6692 4708 7027 4930 6925 1979 5361 4263 3144 867 8639 6230 5562 9714 3676 4231 3347 4733 4920 4881 3431 1059 7313 8912 3...
code_stdio
[ { "content": "Cat Snuke is learning to write characters.\nToday, he practiced writing digits 1 and 9, but he did it the other way around.\nYou are given a three-digit integer n written by Snuke.\nPrint the integer obtained by replacing each digit 1 with 9 and each digit 9 with 1 in n.\n\n-----Constraints-----\n...
[{"input": "119\n", "output": "991\n"}, {"input": "999\n", "output": "111\n"}, {"input": "191\n", "output": "919\n"}, {"input": "111\n", "output": "999\n"}, {"input": "191\n", "output": "919\n"}, {"input": "199\n", "output": "911\n"}, {"input": "911\n", "output": "199\n"}, {"input": "919\n", "output": "191\n"}, {"input...
code_stdio
[ { "content": "Lee tried so hard to make a good div.2 D problem to balance his recent contest, but it still doesn't feel good at all. Lee invented it so tediously slow that he managed to develop a phobia about div.2 D problem setting instead. And now he is hiding behind the bushes...\n\nLet's define a Rooted Dea...
[{"input": "7\n2\n2\n6\n8\n5\n110\n1478999\n", "output": "0\n0\n24\n96\n12\n782548134\n793574295\n"}, {"input": "7\n3\n2\n5\n8\n5\n101\n2000000\n", "output": "4\n0\n12\n96\n12\n981997171\n804665184\n"}, {"input": "3\n1234567\n1268501\n1268499\n", "output": "788765312\n999997375\n999999350\n"}, {"input": "3\n1234567\n12...
code_stdio
[ { "content": "The robot is located on a checkered rectangular board of size $n \\times m$ ($n$ rows, $m$ columns). The rows in the board are numbered from $1$ to $n$ from top to bottom, and the columns — from $1$ to $m$ from left to right.\n\nThe robot is able to move from the current cell to one of the four ce...
[{"input": "4\n1 1\nL\n12 2\nL\n3 3\nUULDRR\n10 3\nUULLLDRRDUUL\n", "output": "1 1\n1 2\n3 2\n3 3\n"}, {"input": "4\n1 1\nL\n12 2\nL\n3 3\nUULDRR\n11 3\nUULLLDRRDUUL\n", "output": "1 1\n1 2\n3 2\n3 3\n"}, {"input": "4\n1 1\nL\n12 2\nL\n5 3\nUULDRR\n10 3\nUULLLDRRDUUL\n", "output": "1 1\n1 2\n3 2\n3 3\n"}, {"input": "4\...
code_stdio
[ { "content": "A famous gang of pirates, Sea Dogs, has come back to their hideout from one of their extravagant plunders. They want to split their treasure fairly amongst themselves, that is why You, their trusted financial advisor, devised a game to help them:\n\nAll of them take a sit at their round table, som...
[{"input": "1000000000 3\n30490 19232\n45250 999980767\n264372930 1\n", "output": "-1"}, {"input": "1000000000 3\n30490 19232\n45250 999980767\n264372930 1\n", "output": "-1"}, {"input": "221407444 1\n999999999 999999999\n", "output": "-1\n"}, {"input": "300 4\n1 200\n2 200\n50 100\n70 100\n", "output": "-1"}, {"input"...
code_stdio
[ { "content": "In the spirit of the holidays, Saitama has given Genos two grid paths of length n (a weird gift even by Saitama's standards). A grid path is an ordered sequence of neighbouring squares in an infinite grid. Two squares are neighbouring if they share a side.\n\nOne example of a grid path is (0, 0) →...
[{"input": "200\nNESENEESEESWWWNWWSWSWNWNNWNNESWSWNNWNWNENESENNESSWSESWWSSSEEEESSENNNESSWWSSSSESWSWWNNEESSWWNNWSWSSWWNWNNEENNENWWNESSSENWNESWNESWNESEESSWNESSSSSESESSWNNENENESSWWNNWWSWWNESEENWWWWNWWNWWNENESESSWWSWWSES\nNWNESESSENNNESWNWWSWWWNWSESSSWWNWWNNWSENWSWNENNNWWSWWSWNNNESWWWSSESSWWWSSENWSENWWNENESESWNENNESWNWNNEN...
code_stdio
[ { "content": "Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.\n\nThe text includes only alphabetical characters and spaces. A word is a sequence of l...
[{"input": "Thank you for your mail amd your lectures", "output": "your lectures\n"}, {"input": "ahTnk you for your mail and your serutcel", "output": "your serutcel\n"}, {"input": "Uhank you for your mail mad your lrctuees", "output": "your lrctuees\n"}, {"input": "ahTnk you for your mail and your leeturcs", "output":...
code_stdio
[ { "content": "Complete the function that accepts a string parameter, and reverses each word in the string. **All** spaces in the string should be retained.\n\n## Examples\n```\n\"This is an example!\" ==> \"sihT si na !elpmaxe\"\n\"double spaces\" ==> \"elbuod secaps\"\n```\n\nWrite Python code to solve ...
[{"input": "\"The quick brown fox jumps over the lazy dog.\"", "output": "[\"ehT kciuq nworb xof spmuj revo eht yzal .god\"]", "fn_name": "reverse_words"}, {"input": "\"double spaced words\"", "output": "[\"elbuod decaps sdrow\"]", "fn_name": "reverse_words"}, {"input": "\"stressed desserts\"", "output": "[\"desser...
code_functional
[ { "content": "Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties together two students. Besides, if two students are tied, then t...
[{"input": "96 70\n30 37\n47 56\n19 79\n15 28\n2 43\n43 54\n59 75\n42 22\n38 18\n18 14\n47 41\n60 29\n35 11\n90 4\n14 41\n11 71\n41 24\n68 28\n45 92\n14 15\n34 63\n77 32\n67 38\n36 8\n37 4\n58 95\n68 84\n69 81\n35 23\n56 63\n78 91\n35 44\n66 63\n80 19\n87 88\n28 14\n62 35\n24 23\n83 37\n54 89\n14 40\n9 35\n94 9\n56 46\...
code_stdio
[ { "content": "Polycarpus takes part in the \"Field of Wonders\" TV show. The participants of the show have to guess a hidden word as fast as possible. Initially all the letters of the word are hidden.\n\nThe game consists of several turns. At each turn the participant tells a letter and the TV show host respond...
[{"input": "42\n*****o*******t********************oo******\n10\nvcrccobltkeidtxhsxhccaslkjhfyeqsetoowaemso\nuimjsoxifamvctkgqmrwhyjrgmlydczzqjoobnnwch\nuvmjsoqizfavctkxemrpaycngmlyemzzqjoobszwbh\nusmjsoviskzvctkljmrlmylugmlydfzzqvoobzawgh\nfeqweodinkhiatqmfokaxwcmlmbmvskssyookgcrax\ntackfosjhxeqftkgjynbbedrczegtimuvooo...
code_stdio
[ { "content": "Write a program to simulate rolling a dice, which can be constructed by the following net.\n\n\n<image>\n<image>\n\n\n\n\nAs shown in the figures, each face is identified by a different label from 1 to 6.\n\nWrite a program which reads integers assigned to each face identified by the label and a s...
[{"input": "-1 4 13 -2 100 13\nES", "output": "100\n"}, {"input": "0 2 0 16 25 35\nEESWN", "output": "35\n"}, {"input": "0 2 0 16 25 38\nEESWN", "output": "38\n"}, {"input": "0 2 4 12 16 14\nEESWN", "output": "14\n"}, {"input": "1 2 4 14 24 30\nEESWN", "output": "30\n"}, {"input": "1 2 1 14 24 30\nEESWN", "output": "30...
code_stdio
[ { "content": "In Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of n tiles that are lain in a row and are numbered from 1 to n from right to left. The opposition should start walking on the tile number 1 and the finish on the tile number n. During the walk it is...
[{"input": "250\n5 3 5 1 3 5 3 4 4 3 1 5 2 2 1 1 5 2 3 3 2 5 4 3 2 4 2 3 5 4 1 2 3 5 2 2 5 4 1 3 3 5 4 4 4 4 4 2 4 2 3 5 1 4 3 3 2 3 5 3 3 4 4 2 3 1 3 4 1 4 5 4 1 2 3 4 1 5 3 3 2 3 5 4 2 5 2 2 3 5 4 3 5 4 2 1 4 1 4 1 1 3 5 1 1 2 1 3 4 5 4 3 2 5 1 3 5 1 1 3 3 5 1 4 5 1 2 1 1 5 5 3 5 1 4 1 4 4 4 4 4 1 4 3 4 5 4 1 2 2 5 2...
code_stdio
[ { "content": "Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\n\nPetya loves tickets very much. As we know, each ticket has a number that i...
[{"input": "50\n44747747774474747747747447777447774747447477444474\n", "output": "YES"}, {"input": "50\n44444444444444444444444444444444444444444444444444\n", "output": "YES"}, {"input": "50\n77777777777777777777777777777777777777777777777777\n", "output": "YES"}, {"input": "50\n4099666333439734310852914372075143390351...
code_stdio
[ { "content": "We have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\nWe assume that A follows Z. For example, shifting A by 2 results in C (A \\to B \\to C), and shi...
[{"input": "26\nYIHVXVZROUSFCUXIOGFIOUSIYDBTQLMECEEHARRBWUDXRITQZSTXNECYMODBOSODWDSWEFEXTVVPENGERSVLYSBDSJOKYSGTJQPEDQWMLFZANYYWWHRHPCOYXLEEBUPOBJMZVUTWCPXQEEHRPSUKCMIDRSBGHBRBAYXUGTZGFRSZTHEVFCFOOTPWYQMXJICOFMXDLCBINVZCPVWRKWDVGBDTDCWRNKPOXANOHOOCKXCSZBSHXXTGCKTSKBRZZTFAAQYFKZGNIZJJZSYTBOKKMTSHMXUPAMANKSBOPRGAAVHRNWCH...
code_stdio
[ { "content": "Joisino is about to compete in the final round of a certain programming competition.\nIn this contest, there are N problems, numbered 1 through N.\nJoisino knows that it takes her T_i seconds to solve problem i(1≦i≦N).\nAlso, there are M kinds of drinks offered to the contestants, numbered 1 throu...
[{"input": "5\n7 5 1 10 5\n3\n4 3\n1 11\n3 12", "output": "21\n32\n39\n"}, {"input": "5\n7 5 1 10 5\n3\n4 3\n2 11\n3 12", "output": "21\n34\n39\n"}, {"input": "5\n7 8 1 10 11\n3\n4 3\n0 11\n3 7", "output": "30\n37\n43\n"}, {"input": "5\n7 2 3 8 5\n3\n4 2\n1 7\n4 13\n", "output": "19\n25\n30\n"}, {"input": "5\n7 2 3 10 ...
code_stdio
[ { "content": "While purchasing certain items, a discount of 10% is offered if the quantity purchased is more than 1000. \nIf the quantity and price per item are input, write a program to calculate the total expenses.\n\n------ Input Format ------ \n\nThe first line contains an integer T, total number of test ca...
[{"input": "3 \n100 120\n10 20\n1200 20\n", "output": "12000.000000\n200.000000\n21600.000000\n"}, {"input": "3 \n100 120\n10 20\n1200 40", "output": "12000.000000\n200.000000\n43200.000000\n"}, {"input": "3 \n100 215\n10 20\n1200 40", "output": "21500.000000\n200.000000\n43200.000000\n"}, {"input": "3 \n100 215\n10 20...
code_stdio
[ { "content": "One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got access to the memory of his not less mean sister Hexadecimal. He loaded there a huge amount of n different natural numbers from 1 to n to obtain total control over her energy.\n\nBut his plan faile...
[{"input": "1000000000\n", "output": "512\n"}, {"input": "999999999\n", "output": "511\n"}, {"input": "121212121\n", "output": "511\n"}, {"input": "101010101\n", "output": "341\n"}, {"input": "901556123\n", "output": "511\n"}, {"input": "312410141\n", "output": "511\n"}, {"input": "111111111\n", "output": "511\n"}, {"i...
code_stdio
[ { "content": "You are given $n$ lengths of segments that need to be placed on an infinite axis with coordinates.\n\nThe first segment is placed on the axis so that one of its endpoints lies at the point with coordinate $0$. Let's call this endpoint the \"start\" of the first segment and let's call its \"end\" a...
[{"input": "6\n2\n1 3\n3\n1 2 3\n4\n1 2 3 14\n4\n6 12 4 14\n7\n1 2 4 9 7 10 3\n8\n8 6 0 3 3 4 3 6\n", "output": "3\n3\n14\n16\n12\n8\n"}, {"input": "6\n2\n1 3\n3\n1 2 3\n4\n1 2 3 14\n4\n6 8 4 14\n7\n1 2 4 9 13 10 3\n8\n8 6 0 3 3 4 3 6\n", "output": "3\n3\n14\n14\n13\n8\n"}, {"input": "6\n2\n1 3\n3\n1 2 3\n4\n1 2 3 14\n...
code_stdio
[ { "content": "Here is a very simple variation of the game backgammon, named “Minimal Backgammon”. The game is played by only one player, using only one of the dice and only one checker (the token used by the player).\n\nThe game board is a line of (N + 1) squares labeled as 0 (the start) to N (the goal). At the...
[{"input": "10 1 0 0\n7 1 0 0\n13 0 0 0\n6 11 1 1\n2\n5\n7 1 0 6\n1\n1\n3\n4\n5\n6\n0 0 0 0", "output": "0.000000\n0.000000\n0.000000\n0.829031\n0.000000\n"}, {"input": "6 1 0 0\n7 1 0 0\n7 2 0 0\n12 3 1 1\n2\n5\n8 10 0 6\n1\n3\n4\n4\n5\n6\n0 0 0 0", "output": "0.166667\n0.000000\n0.166667\n0.106481\n0.229136\n"}, {"in...
code_stdio
[ { "content": "There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right. That is, if his coordinate at time...
[{"input": "12814", "output": "160\n"}, {"input": "19710", "output": "199\n"}, {"input": "36877", "output": "272\n"}, {"input": "49568", "output": "315\n"}, {"input": "44971", "output": "300\n"}, {"input": "34941", "output": "264\n"}, {"input": "27935", "output": "236\n"}, {"input": "43035", "output": "293\n"}, {"input...
code_stdio
[ { "content": "The only difference between the easy and the hard versions is constraints.\n\nA subsequence is a string that can be derived from another string by deleting some or no symbols without changing the order of the remaining symbols. Characters to be deleted are not required to go successively, there ca...
[{"input": "100 1000000000100\ndjgykfqaywhkhpocyxcpvbiiouyielmighclnuopadzuvrirbecucwnzwahahagvfstbxxaednajfauscxwttiglbbxtomnnalcl\n", "output": "8854753826235\n"}, {"input": "100 1000000000000\ndjgykfqaywhkhpocyxcpvbiiouyielmighclnuopadzuvrirbecucwnzwahahagvfstbxxaednajfauscxwttiglbbxtomnnalcl\n", "output": "88547538...
code_stdio
[ { "content": "Input\n\nThe input is given from standard input in the following format.\n\n\n> $H \\ W$ $a_{1, 1} \\ a_{1, 2} \\ \\cdots \\ a_{1, W}$ $a_{2, 1} \\ a_{2, 2} \\ \\cdots \\ a_{2, W}$ $\\vdots \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\vdots \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\vdots$ $a_{H, 1} \\ a_{H, 2} \\ \\cdot...
[{"input": "4 6\n2 3 3 8 2 3\n11 8 9 0 2 0\n0 1 0 1 8 5\n3 10 3 5 9 27\n0 1 1 -1 2 4\n2 19 1 12 1 15", "output": "107\n"}, {"input": "4 6\n2 3 3 7 1 3\n11 8 9 0 2 0\n0 1 4 1 8 5\n3 10 3 5 9 14\n0 1 1 0 2 2\n2 19 1 12 1 10", "output": "96\n"}, {"input": "6 6\n2 2 3 4 3 3\n8 8 9 -1 4 0\n0 1 14 1 5 9\n2 6 2 2 5 9\n2 15 1 ...
code_stdio
[ { "content": "Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got hold of lots of wooden cubes somewhere. They started making cube towers by placing the cubes one on top of the other. They defined multiple towers standing in a line as a wall. A wall can c...
[{"input": "53 3\n1 3 4 4 5 7 10 14 19 25 32 40 23 59 70 82 148 109 124 140 157 175 194 214 235 257 280 304 329 355 382 410 439 469 500 532 565 599 634 670 388 745 784 824 865 907 950 994 1039 1085 1132 1180 1229\n1 2 40\n", "output": "0\n"}, {"input": "53 3\n1 3 4 4 5 7 10 14 19 10 32 40 23 59 70 82 148 109 124 140 15...
code_stdio
[ { "content": "A new innovative ticketing systems for public transport is introduced in Bytesburg. Now there is a single travel card for all transport. To make a trip a passenger scan his card and then he is charged according to the fare.\n\nThe fare is constructed in the following manner. There are three types ...
[{"input": "10\n13\n45\n46\n60\n103\n115\n126\n150\n256\n516\n", "output": "20\n20\n10\n0\n20\n0\n0\n20\n20\n10\n"}, {"input": "10\n11\n45\n46\n60\n103\n115\n126\n150\n256\n516\n", "output": "20\n20\n10\n0\n20\n0\n0\n20\n20\n10\n"}, {"input": "10\n13\n45\n46\n60\n103\n115\n126\n150\n256\n516\n", "output": "20\n20\n10\n...
code_stdio
[ { "content": "During the winter holidays, the demand for Christmas balls is exceptionally high. Since it's already 2018, the advances in alchemy allow easy and efficient ball creation by utilizing magic crystals.\n\nGrisha needs to obtain some yellow, green and blue balls. It's known that to produce a yellow ba...
[{"input": "1000000000 1000000000\n1000000000 1000000000 1000000000\n", "output": "5000000000\n"}, {"input": "1000000000 1000000000\n1000000000 1000000000 1000000000\n", "output": "5000000000\n"}, {"input": "1000000000 1000000000\n1000100000 1000000000 1000000000\n", "output": "5000200000\n"}, {"input": "1000000000 101...
code_stdio
[ { "content": "# The Invitation\n\nMost of us played with toy blocks growing up. It was fun and you learned stuff. So what else can you do but rise to the challenge when a 3-year old exclaims, \"Look, I made a square!\", then pointing to a pile of blocks, \"Can _you_ do it?\"\n\n# These Blocks\n\nJust to play al...
[{"input": "[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]", "output": "[true]", "fn_name": "build_square"}, {"input": "[1, 3, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1]", "output": "[false]", "fn_name": "build_square"}, {"input": "[2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4]", "output": "[false]", "fn_name": "build_square"}, {"input": "[1,...
code_functional
[ { "content": "We have a sandglass consisting of two bulbs, bulb A and bulb B. These bulbs contain some amount of sand.\nWhen we put the sandglass, either bulb A or B lies on top of the other and becomes the upper bulb. The other bulb becomes the lower bulb.\nThe sand drops from the upper bulb to the lower bulb ...
[{"input": "100\n5\n48 141 231 554 425\n7\n0 19\n50 98\n143 30\n231 55\n342 0\n365 100\n600 10", "output": "19\n52\n91\n10\n100\n100\n100\n"}, {"input": "100\n5\n48 179 142 554 425\n7\n0 19\n50 98\n143 30\n231 55\n342 0\n365 100\n600 9", "output": "19\n52\n95\n100\n100\n100\n100\n"}, {"input": "100\n5\n48 179 142 554 4...
code_stdio
[ { "content": "Encryption System\n\nA programmer developed a new encryption system. However, his system has an issue that two or more distinct strings are `encrypted' to the same string.\n\nWe have a string encrypted by his system. To decode the original string, we want to enumerate all the candidates of the str...
[{"input": "enw\nabc\nabcdefghijklmnopqrst\ny\n#", "output": "1\nfox\n5\nacc\nacd\nbbd\nbcc\nbcd\n17711\nacceeggiikkmmooqqssu\nacceeggiikkmmooqqstt\nacceeggiikkmmooqqstu\nacceeggiikkmmooqrrtt\nacceeggiikkmmooqrrtu\nbcdefghijklmnopqrrtt\nbcdefghijklmnopqrrtu\nbcdefghijklmnopqrssu\nbcdefghijklmnopqrstt\nbcdefghijklmnopqr...
code_stdio
[ { "content": "Astronaut Natasha arrived on Mars. She knows that the Martians are very poor aliens. To ensure a better life for the Mars citizens, their emperor decided to take tax from every tourist who visited the planet. Natasha is the inhabitant of Earth, therefore she had to pay the tax to enter the territo...
[{"input": "2 420\n412 363\n", "output": "420\n0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 9...
code_stdio
[ { "content": "We have N bags numbered 1 through N and N dishes numbered 1 through N.\nBag i contains a_i coins, and each dish has nothing on it initially.\nTaro the first and Jiro the second will play a game against each other.\nThey will alternately take turns, with Taro the first going first.\nIn each player'...
[{"input": "3\n1\n10\n2\n1 2\n21\n476523737 103976339 266993 706803678 802362985 892644371 953855359 196462821 817301757 409460796 773943961 488763959 405483423 616934516 710762957 239829390 55474813 818352359 312280585 185800870 255245162\n", "output": "Second\nFirst\nSecond\n"}]
code_stdio
[ { "content": "You are given two integers A and B as the input. Output the value of A + B.\nHowever, if A + B is 10 or greater, output error instead.\n\n-----Constraints-----\n - A and B are integers.\n - 1 ≤ A, B ≤ 9\n\n-----Input-----\nInput is given from Standard Input in the following format:\nA B\n\n-----Ou...
[{"input": "-169 -1", "output": "-170\n"}, {"input": "-169 -2", "output": "-171\n"}, {"input": "-279 -2", "output": "-281\n"}, {"input": "-279 -1", "output": "-280\n"}, {"input": "-433 -1", "output": "-434\n"}, {"input": "-408 -1", "output": "-409\n"}, {"input": "-347 -1", "output": "-348\n"}, {"input": "-1 -139", "out...
code_stdio
[ { "content": "You have an array a[1], a[2], ..., a[n], containing distinct integers from 1 to n. Your task is to sort this array in increasing order with the following operation (you may need to apply it multiple times):\n\n choose two indexes, i and j (1 ≤ i < j ≤ n; (j - i + 1) is a prime number); swap the ...
[{"input": "100\n100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\n", "output...
code_stdio
[ { "content": "You are given a chessboard of size 1 × n. It is guaranteed that n is even. The chessboard is painted like this: \"BWBW...BW\".\n\nSome cells of the board are occupied by the chess pieces. Each cell contains no more than one chess piece. It is known that the total number of pieces equals to $\\frac...
[{"input": "100\n93 54 57 61 68 66 70 96 64 82 80 75 69 77 76 94 67 86 90 73 74 58 100 83 92 89 56 99 88 59 95 72 81 51 85 71 97 60 91 63 65 98 79 84 53 62 87 55 52 78\n", "output": "1225\n"}, {"input": "100\n93 54 57 61 68 66 70 96 64 82 80 75 69 77 76 94 67 86 90 73 74 58 100 83 92 89 56 99 88 59 95 72 81 51 85 71 97...
code_stdio
[ { "content": "Two players are playing a game. The game is played on a sequence of positive integer pairs. The players make their moves alternatively. During his move the player chooses a pair and decreases the larger integer in the pair by a positive multiple of the smaller integer in the pair in such a way tha...
[{"input": "3\n1\n2 5\n2\n4 10\n5 10\n2\n2 3\n1 5", "output": "YES\nYES\nYES\n"}, {"input": "3\n1\n1 5\n2\n4 10\n5 10\n2\n2 3\n1 5", "output": "YES\nYES\nYES\n"}, {"input": "3\n1\n1 3\n2\n4 10\n5 10\n2\n4 3\n3 5", "output": "YES\nYES\nYES\n"}, {"input": "3\n1\n2 4\n2\n10 5\n5 6\n1\n2 6\n5 0", "output": "YES\nYES\nYES\n...
code_stdio
[ { "content": "Your task is to find the number couple with the greatest difference from a given array of number-couples. \n\nAll number couples will be given as strings and all numbers in them will be positive integers. \n\nFor instance: ['56-23','1-100']; in this case, you should identify '1-100' as the number...
[{"input": "[\"45896-2354\", \"4654-556767\", \"2455-423522\", \"3455-355\", \"34-34\", \"2524522-0\"]", "output": "[\"2524522-0\"]", "fn_name": "diff"}, {"input": "[\"43-45\", \"1021-55\", \"000-18888\", \"92-34\", \"76-32\", \"99-1\", \"1020-54\"]", "output": "[\"000-18888\"]", "fn_name": "diff"}, {"input": "[\"1-100...
code_functional
[ { "content": "Assume that a, b, and n are all positive integers. Let f (i) be the i-th fraction of the fraction a / b (0 ≤ f (i) ≤ 9). At this time, let s be the sum of f (i) from i = 1 to n.\n\ns = f (1) + f (2) + ... + f (n)\n\n\nCreate a program that reads a, b, n, outputs s, and exits.\n\n\n\nInput\n\nThe i...
[{"input": "2 3 2\n2 7 3\n13 3 5\n4 6 2", "output": "12\n15\n15\n12\n"}, {"input": "1 3 2\n2 7 3\n13 3 5\n4 6 2", "output": "6\n15\n15\n12\n"}, {"input": "2 3 2\n2 7 3\n13 3 5\n4 4 2", "output": "12\n15\n15\n0\n"}, {"input": "2 3 2\n2 7 2\n13 3 5\n4 4 2", "output": "12\n10\n15\n0\n"}, {"input": "0 4 1\n2 3 2\n10 4 3\n5...
code_stdio
[ { "content": "A tree is a connected graph that doesn't contain any cycles.\n\nThe distance between two vertices of a tree is the length (in edges) of the shortest path between these vertices.\n\nYou are given a tree with n vertices and a positive number k. Find the number of distinct pairs of the vertices which...
[{"input": "50 3\n2 1\n3 2\n4 3\n5 4\n6 5\n7 6\n8 7\n9 8\n10 9\n11 10\n12 11\n13 12\n14 13\n15 14\n16 15\n17 16\n18 17\n19 18\n20 19\n21 20\n22 21\n23 22\n24 23\n25 24\n26 25\n27 26\n28 27\n29 28\n30 29\n31 30\n32 31\n33 32\n34 33\n35 34\n36 35\n37 36\n38 37\n39 38\n40 39\n41 40\n42 41\n43 42\n44 43\n45 44\n46 45\n47 4...
code_stdio
[ { "content": "At regular competition Vladik and Valera won a and b candies respectively. Vladik offered 1 his candy to Valera. After that Valera gave Vladik 2 his candies, so that no one thought that he was less generous. Vladik for same reason gave 3 candies to Valera in next turn.\n\nMore formally, the guys t...
[{"input": "1000000000 1000000000\n", "output": "Vladik\n"}, {"input": "1000000000 1000000000\n", "output": "Vladik\n"}, {"input": "1000000000 1387445955\n", "output": "Vladik\n"}, {"input": "1000000000 1000000001\n", "output": "Vladik\n"}, {"input": "1000000000 1214716107\n", "output": "Vladik\n"}, {"input": "10000000...
code_stdio
[ { "content": "Johnny has just found the new, great tutorial: \"How to become a grandmaster?\". The tutorial tells many strange and unexpected for Johnny things, such as you have to be patient or that very important is solving many harder and harder problems. \n\nThe boy has found an online judge with tasks divi...
[{"input": "1\n71 2\n100 99 98 97 96 95 94 93 92 91 90 87 86 82 79 78 76 71 70 69 68 66 64 63 62 56 55 53 52 51 50 46 43 42 39 38 37 35 33 31 30 29 22 20 19 18 11 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "999999985\n"}, {"input": "1\n71 2\n100 99 98 97 96 95 94 93 92 91 90 87 86 82 79 78 36 71 70 6...
code_stdio
[ { "content": "You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\n-----Constraints-----\n - -40 \\leq X \\leq 40\n - X is an integer.\n\n-----Input---...
[{"input": "30\n", "output": "Yes\n"}, {"input": "40\n", "output": "Yes\n"}, {"input": "-40\n", "output": "No\n"}, {"input": "-29\n", "output": "No\n"}, {"input": "-30\n", "output": "No\n"}, {"input": "31\n", "output": "Yes\n"}, {"input": "-36\n", "output": "No\n"}, {"input": "32\n", "output": "Yes\n"}, {"input": "32\n...
code_stdio
[ { "content": "Two beavers, Timur and Marsel, play the following game.\n\nThere are n logs, each of exactly m meters in length. The beavers move in turns. For each move a beaver chooses a log and gnaws it into some number (more than one) of equal parts, the length of each one is expressed by an integer and is no...
[{"input": "1000000000 1000000000 1000000000\n", "output": "Marsel\n"}, {"input": "1000000000 1000000000 1100000000\n", "output": "Marsel\n"}, {"input": "999999999 1000000000 1000000000\n", "output": "Marsel\n"}, {"input": "999999999 1000000000 1000000100\n", "output": "Marsel\n"}, {"input": "1262564090 1000000000 5000...
code_stdio
[ { "content": "At the first holiday in spring, the town Shortriver traditionally conducts a flower festival. Townsfolk wear traditional wreaths during these festivals. Each wreath contains exactly k flowers.\n\nThe work material for the wreaths for all n citizens of Shortriver is cut from the longest flowered li...
[{"input": "100 15 6 10\n12 9 1 7 6 4 1 9 3 2 4 6 2 5 3 8 9 2 9 1 6 5 6 2 3 10 7 10 7 4 5 4 4 4 4 7 1 10 8 4 8 3 10 10 7 4 4 10 6 1 8 5 4 6 2 4 10 3 2 5 7 5 6 10 10 3 4 5 4 3 3 1 7 8 10 10 10 10 8 3 7 4 2 1 8 6 5 6 5 8 7 9 2 1 9 2 4 6 10 8\n6 9 7 8 7 1 4 5 5 8\n", "output": "9\n18 19 23 24 25 26 28 32 33 "}, {"input": ...
code_stdio
[ { "content": "Bakry faced a problem, but since he's lazy to solve it, he asks for your help.\n\nYou are given a tree of $n$ nodes, the $i$-th node has value $a_i$ assigned to it for each $i$ from $1$ to $n$. As a reminder, a tree on $n$ nodes is a connected graph with $n-1$ edges.\n\nYou want to delete at least...
[{"input": "5\n2 2\n1 3\n1 2\n5 5\n3 3 3 3 3\n1 2\n2 3\n1 4\n4 5\n5 2\n1 7 2 3 5\n1 2\n2 3\n1 4\n4 5\n5 3\n1 6 4 1 2\n1 2\n2 3\n1 4\n4 5\n3 3\n1 7 4\n1 2\n2 3\n", "output": "NO\nYES\nNO\nYES\nNO\n"}, {"input": "1\n9 3\n2 2 1 1 3 2 1 1 2\n1 2\n2 3\n2 4\n1 5\n1 6\n6 7\n6 8\n6 9\n", "output": "NO\n"}, {"input": "1\n8 3\n1...
code_stdio
[ { "content": "On a chessboard with a width of $10^9$ and a height of $10^9$, the rows are numbered from bottom to top from $1$ to $10^9$, and the columns are numbered from left to right from $1$ to $10^9$. Therefore, for each cell of the chessboard you can assign the coordinates $(x,y)$, where $x$ is the column...
[{"input": "0 5\n1 192023486 84774294\n243235878 312125306 50510976\n326016273 338641867 50510976\n570999440 445224816 125759940\n456157384 569789185 50510976\n", "output": "0\n"}, {"input": "0 5\n1 192023486 50510976\n243235878 312125306 50510976\n326016273 338641867 50510976\n570999440 445224816 50510976\n456157384 5...
code_stdio
[ { "content": "Write a program which counts and reports the number of each alphabetical letter. Ignore the case of characters.\n\nConstraints\n\n* The number of characters in the sentence < 1200\n\nInput\n\nA sentence in English is given in several lines.\n\nOutput\n\nPrints the number of alphabetical letters in...
[{"input": "This is ` pen.", "output": "a : 0\nb : 0\nc : 0\nd : 0\ne : 1\nf : 0\ng : 0\nh : 1\ni : 2\nj : 0\nk : 0\nl : 0\nm : 0\nn : 1\no : 0\np : 1\nq : 0\nr : 0\ns : 2\nt : 1\nu : 0\nv : 0\nw : 0\nx : 0\ny : 0\nz : 0\n"}, {"input": "This si a pen.", "output": "a : 1\nb : 0\nc : 0\nd : 0\ne : 1\nf : 0\ng : 0\nh : 1\...
code_stdio
[ { "content": "The string $s$ is given, the string length is odd number. The string consists of lowercase letters of the Latin alphabet.\n\nAs long as the string length is greater than $1$, the following operation can be performed on it: select any two adjacent letters in the string $s$ and delete them from the ...
[{"input": "5\nabcde\nc\nabcde\nb\nx\ny\naaaaaaaaaaaaaaa\na\ncontest\nt\n", "output": "YES\nNO\nNO\nYES\nYES\n"}, {"input": "5\nabcde\nc\nabcde\nb\nx\ny\nabobobussss\ns\ncontest\nt\n", "output": "YES\nNO\nNO\nYES\nYES\n"}, {"input": "1\nqwertyuioppoiuytrewqplkmnjiuhbs\nz\n", "output": "NO\n"}, {"input": "1\nadsfdxvxvsd...
code_stdio
[ { "content": "Andi and Budi were given an assignment to tidy up their bookshelf of $n$ books. Each book is represented by the book title — a string $s_i$ numbered from $1$ to $n$, each with length $m$. Andi really wants to sort the book lexicographically ascending, while Budi wants to sort it lexicographically ...
[{"input": "5 2\nAA\nAB\nBB\nBA\nAZ\n", "output": "5 2 1 3 4 \n"}, {"input": "5 2\nAA\nAB\nBB\nBA\nAZ\n", "output": "5 2 1 3 4\n"}, {"input": "5 2\nAA\nAB\nBB\nBA\nZA\n", "output": "2 1 3 4 5\n"}, {"input": "5 2\nAA\nAB\nCB\nBA\nAZ\n", "output": "5 2 1 4 3\n"}, {"input": "5 2\nAA\nAB\nBC\nBA\nAZ\n", "output": "5 2 1 3 ...
code_stdio
[ { "content": "We have a grid with H rows and W columns, where all the squares are initially white.\n\nYou will perform some number of painting operations on the grid. In one operation, you can do one of the following two actions:\n\n* Choose one row, then paint all the squares in that row black.\n* Choose one c...
[{"input": "14\n0\n15028", "output": "1074\n"}, {"input": "14\n0\n19420", "output": "1388\n"}, {"input": "14\n0\n25749", "output": "1840\n"}, {"input": "14\n0\n16704", "output": "1194\n"}, {"input": "14\n1\n20917", "output": "1495\n"}, {"input": "14\n2\n28787", "output": "2057\n"}, {"input": "14\n4\n25994", "output": "...
code_stdio
[ { "content": "Three companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a non-zero area. \n\nAdvertisers will put up the ad only if it is possible to place all three logos on the billboard so that they do not overlap an...
[{"input": "17 100 100 22 61 100\n", "output": "100\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
code_stdio
[ { "content": "Hr0d1y has $q$ queries on a binary string $s$ of length $n$. A binary string is a string containing only characters '0' and '1'.\n\nA query is described by a pair of integers $l_i$, $r_i$ $(1 \\leq l_i \\lt r_i \\leq n)$.\n\nFor each query, he has to determine whether there exists a good subsequen...
[{"input": "2\n6 3\n001000\n2 4\n1 3\n3 5\n4 2\n1111\n1 4\n2 3\n", "output": "\nYES\nNO\nYES\nNO\nYES\n"}, {"input": "2\n6 3\n001000\n2 4\n1 3\n3 5\n4 2\n1111\n1 4\n2 3\n", "output": "YES\nNO\nYES\nNO\nYES\n"}, {"input": "2\n6 3\n001000\n2 4\n1 3\n3 5\n4 2\n1111\n1 4\n1 3\n", "output": "YES\nNO\nYES\nNO\nYES\n"}, {"inp...
code_stdio
[ { "content": "To write a research paper, you should definitely follow the structured format. This format, in many cases, is strictly defined, and students who try to write their papers have a hard time with it.\n\nOne of such formats is related to citations. If you refer several pages of a material, you should ...
[{"input": "5\n1 2 1 4 11\n3\n12 28 16\n0", "output": "1-2 1 4 11\n12 28 16\n"}, {"input": "5\n1 2 1 4 9\n3\n12 28 16\n0", "output": "1-2 1 4 9\n12 28 16\n"}, {"input": "5\n1 2 1 4 0\n3\n12 28 16\n0", "output": "1-2 1 4 0\n12 28 16\n"}, {"input": "5\n1 2 4 4 9\n3\n13 14 14\n0", "output": "1-2 4 4 9\n13-14 14\n"}, {"inp...
code_stdio
[ { "content": "Takahashi has a maze, which is a grid of H \\times W squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column is a \"wall\" square if S_{ij} is #, and a \"road\" square if S_{ij} is ..\nFrom a road square, you can move to a horizontally or...
[{"input": "20 20\n....................\n###################.\n....................\n.###################\n....................\n###################.\n....................\n.###################\n....................\n###################.\n....................\n.###################\n....................\n###############...
code_stdio
[ { "content": "For given an integer $n$, print all permutations of $\\\\{1, 2, ..., n\\\\}$ in lexicographic order.\n\nConstraints\n\n* $1 \\leq n \\leq 9$\n\nInput\n\nAn integer $n$ is given in a line.\n\nOutput\n\nPrint each permutation in a line in order. Separate adjacency elements by a space character.\n\nE...
[{"input": "5", "output": "1 2 3 4 5\n1 2 3 5 4\n1 2 4 3 5\n1 2 4 5 3\n1 2 5 3 4\n1 2 5 4 3\n1 3 2 4 5\n1 3 2 5 4\n1 3 4 2 5\n1 3 4 5 2\n1 3 5 2 4\n1 3 5 4 2\n1 4 2 3 5\n1 4 2 5 3\n1 4 3 2 5\n1 4 3 5 2\n1 4 5 2 3\n1 4 5 3 2\n1 5 2 3 4\n1 5 2 4 3\n1 5 3 2 4\n1 5 3 4 2\n1 5 4 2 3\n1 5 4 3 2\n2 1 3 4 5\n2 1 3 5 4\n2 1 4 3...
code_stdio
[ { "content": "Today an outstanding event is going to happen in the forest — hedgehog Filya will come to his old fried Sonya!\n\nSonya is an owl and she sleeps during the day and stay awake from minute l_1 to minute r_1 inclusive. Also, during the minute k she prinks and is unavailable for Filya.\n\nFilya works ...
[{"input": "519325240668210886 776112702001665034 360568516809443669 1272711703453279586 994594983925273138\n", "output": "256787461333454149\n"}, {"input": "519325240668210886 776112702001665034 360568516809443669 875594219634943179 994594983925273138\n", "output": "256787461333454149\n"}, {"input": "51932524066821088...
code_stdio
[ { "content": "Given are two integer sequences of N elements each: A_1,...,A_N and B_1,...,B_N. Determine if it is possible to do the following operation at most N-2 times (possibly zero) so that, for every integer i from 1 to N, A_i \\leq B_i holds:\n\n* Choose two distinct integers x and y between 1 and N (inc...
[{"input": "6\n0 0 1 2 3 12\n0 2 14 6 2 3", "output": "Yes\n"}, {"input": "6\n1 0 1 2 3 12\n0 2 14 6 2 3", "output": "Yes\n"}, {"input": "6\n1 0 1 2 3 12\n0 4 14 6 2 3", "output": "Yes\n"}, {"input": "6\n1 0 1 2 3 12\n1 4 14 6 2 3", "output": "Yes\n"}, {"input": "6\n0 0 1 2 3 6\n1 2 14 6 2 3", "output": "Yes\n"}, {"inp...
code_stdio
[ { "content": "A special type of prime is generated by the formula `p = 2^m * 3^n + 1` where `m` and `n` can be any non-negative integer.\n\nThe first `5` of these primes are `2, 3, 5, 7, 13`, and are generated as follows: \n```Haskell\n2 = 2^0 * 3^0 + 1\n3 = 2^1 * 3^0 + 1\n5 = 2^2 * 3^0 + 1\n7 = 2^1 * 3^1 + 1\n...
[{"input": "1000000\n1500000", "output": "[2]", "fn_name": "solve"}, {"input": "750000\n1000000", "output": "[3]", "fn_name": "solve"}, {"input": "500000\n1000000", "output": "[5]", "fn_name": "solve"}, {"input": "300000\n900000", "output": "[6]", "fn_name": "solve"}, {"input": "100\n1000000", "output": "[32]", "fn_nam...
code_functional
[ { "content": "The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.\n\nThe Little Elephant doesn't want to call the police until he understands if he could have accidentally changed the array himself. ...
[{"input": "128\n1 2 4 6 8 17 20 20 23 33 43 49 49 49 52 73 74 75 82 84 85 87 90 91 102 103 104 105 111 111 401 142 142 152 155 160 175 176 178 181 183 184 101 188 191 193 326 202 202 214 224 225 236 239 240 243 246 247 249 249 257 257 261 264 265 271 277 281 284 284 286 289 290 296 297 303 305 307 307 317 318 320 322 ...
code_stdio
[ { "content": "Monocarp is the coach of the Berland State University programming teams. He decided to compose a problemset for a training session for his teams.\n\nMonocarp has $n$ problems that none of his students have seen yet. The $i$-th problem has a topic $a_i$ (an integer from $1$ to $n$) and a difficulty...
[{"input": "2\n4\n2 4\n3 4\n2 1\n1 3\n5\n1 5\n2 4\n3 3\n4 2\n5 1\n", "output": "3\n10\n"}, {"input": "2\n4\n2 4\n3 4\n2 1\n2 3\n5\n1 5\n2 4\n3 3\n4 2\n5 1\n", "output": "2\n10\n"}, {"input": "2\n4\n2 4\n3 3\n2 2\n1 3\n5\n1 5\n2 4\n3 3\n4 2\n5 1\n", "output": "4\n10\n"}, {"input": "2\n4\n4 4\n3 3\n2 2\n2 3\n5\n1 5\n2 4\...
code_stdio
[ { "content": "Shortest Common Non-Subsequence\n\nA subsequence of a sequence $P$ is a sequence that can be derived from the original sequence $P$ by picking up some or no elements of $P$ preserving the order. For example, \"ICPC\" is a subsequence of \"MICROPROCESSOR\".\n\nA common subsequence of two sequences ...
[{"input": "0101\n1101001", "output": "0000\n"}, {"input": "0101\n1101000", "output": "0001\n"}, {"input": "0101\n0011001", "output": "1000\n"}, {"input": "0101\n0110001", "output": "0010\n"}, {"input": "0101\n1001001", "output": "0110\n"}, {"input": "0101\n0101001", "output": "1110\n"}, {"input": "0101\n0100101", "out...
code_stdio
[ { "content": "Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.\n\nWhen the numbers of points of both wrestlers are equal, the wrestler whose sequence of points is lexicographically greater, wi...
[{"input": "131\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n0\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\...
code_stdio
[ { "content": "Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?\n\nYou are given a system of equations: \n\n<image>\n\nYou should c...
[{"input": "1000 1010\n", "output": "0\n"}, {"input": "1000 1000\n", "output": "0"}, {"input": "1190 225\n", "output": "0\n"}, {"input": "1190 315\n", "output": "0\n"}, {"input": "1491 512\n", "output": "0\n"}, {"input": "247 438\n", "output": "0\n"}, {"input": "529 780\n", "output": "0\n"}, {"input": "120 433\n", "out...
code_stdio
[ { "content": "You are a given a list of integers $a_1, a_2, \\ldots, a_n$ and $s$ of its segments $[l_j; r_j]$ (where $1 \\le l_j \\le r_j \\le n$).\n\nYou need to select exactly $m$ segments in such a way that the $k$-th order statistic of the multiset of $a_i$, where $i$ is contained in at least one segment, ...
[{"input": "5 10 1 1\n1000000000 1000000000 1000000000 1 1000000000\n1 1\n1 3\n5 5\n1 1\n2 3\n3 3\n3 4\n1 2\n2 2\n3 3\n", "output": "1\n"}, {"input": "5 10 1 1\n1000000000 1000000000 1000000000 1 1000000000\n1 1\n1 3\n5 5\n1 1\n2 3\n3 3\n3 4\n1 2\n2 2\n3 3\n", "output": "1\n"}, {"input": "5 10 1 1\n1000000000 100000000...
code_stdio
[ { "content": "Seiji Hayashi had been a professor of the Nisshinkan Samurai School in the domain of Aizu for a long time in the 18th century. In order to reward him for his meritorious career in education, Katanobu Matsudaira, the lord of the domain of Aizu, had decided to grant him a rectangular estate within a...
[{"input": "16\n10 8\n2 2\n2 6\n2 7\n6 6\n4 8\n4 2\n5 5\n4 8\n10 2\n6 7\n7 7\n7 8\n8 1\n5 4\n9 1\n10 3\n4 3\n8\n6 4\n2 2\n2 1\n2 4\n3 4\n4 2\n5 3\n1 1\n3 2\n3 3\n0", "output": "5\n5\n"}, {"input": "16\n10 9\n2 4\n2 6\n2 7\n6 6\n4 8\n4 2\n5 5\n4 8\n6 4\n6 7\n7 6\n7 8\n8 0\n8 4\n9 1\n10 3\n1 3\n8\n6 13\n1 2\n2 1\n2 4\n3 ...
code_stdio
[ { "content": "problem\n\nThere are many $ N $ colored balls of different weights in the queue. The queue is in ascending order from the beginning: $ 1,2,3, \\ dots, N-1, N, 1,2,3, \\ dots, N-1, N, 1,2,3, \\ dots $ The balls are lined up, followed by the balls of color $ N $, followed by the balls of color $ 1 $...
[{"input": "8 4\n46 70 57 10 174 41 130 43", "output": "193\n"}, {"input": "8 4\n46 70 57 10 174 33 130 43", "output": "201\n"}, {"input": "8 7\n46 70 57 3 174 25 130 43", "output": "1302\n"}, {"input": "8 4\n46 70 57 10 174 38 130 43", "output": "196\n"}, {"input": "8 4\n46 105 57 3 174 25 130 60", "output": "251\n"},...
code_stdio
[ { "content": "One not particularly beautiful evening Valera got very bored. To amuse himself a little bit, he found the following game.\n\nHe took a checkered white square piece of paper, consisting of n × n cells. After that, he started to paint the white cells black one after the other. In total he painted m ...
[{"input": "10 60\n6 7\n2 4\n3 6\n1 4\n8 7\n2 8\n5 7\n6 4\n5 10\n1 7\n3 9\n3 4\n9 2\n7 1\n3 8\n10 7\n9 7\n9 1\n5 5\n4 7\n5 8\n4 2\n2 2\n9 4\n3 3\n7 5\n7 4\n7 7\n8 2\n8 1\n4 5\n1 10\n9 6\n3 1\n1 3\n3 2\n10 10\n4 6\n5 4\n7 3\n10 1\n3 7\n5 1\n10 9\n4 10\n6 10\n7 10\n5 9\n5 6\n1 2\n7 8\n3 5\n9 8\n9 5\n8 10\n4 3\n10 6\n9 10...
code_stdio
[ { "content": "The only difference between easy and hard versions is constraints.\n\nNauuo is a girl who loves random picture websites.\n\nOne day she made a random picture website by herself which includes $n$ pictures.\n\nWhen Nauuo visits the website, she sees exactly one picture. The website does not display...
[{"input": "100 3000\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n10 8 1 9 7 5 12 9 15 7 16 5 17 5 17 21 11 3 4 4 30 17 3 84 12 30 2 8 2 2 22 24 15 11 15 13 7 17 1...
code_stdio
[ { "content": "This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.\n\nAlice received a set of Toy Train™ from Bob. It consists of one train and a connected railway network of $n$ stations, enumerated from $1$ through $n$. The...
[{"input": "5000 1\n4008 1126\n", "output": "6125 6124 6123 6122 6121 6120 6119 6118 6117 6116 6115 6114 6113 6112 6111 6110 6109 6108 6107 6106 6105 6104 6103 6102 6101 6100 6099 6098 6097 6096 6095 6094 6093 6092 6091 6090 6089 6088 6087 6086 6085 6084 6083 6082 6081 6080 6079 6078 6077 6076 6075 6074 6073 6072 6071 ...
code_stdio
[ { "content": "You are given a string S. Each character of S is uppercase or lowercase English letter.\nDetermine if S satisfies all of the following conditions:\n - The initial character of S is an uppercase A.\n - There is exactly one occurrence of C between the third character from the beginning and the secon...
[{"input": "AccccCcccc\n", "output": "AC\n"}, {"input": "AmvlkweClF\n", "output": "WA\n"}, {"input": "AcCCCCCCCc\n", "output": "WA\n"}, {"input": "zzzzzzzzzz\n", "output": "WA\n"}, {"input": "abcarCagc\n", "output": "WA\n"}, {"input": "ApproaCh\n", "output": "AC\n"}, {"input": "AcCepted\n", "output": "AC\n"}, {"input":...
code_stdio
[ { "content": "Implement a function which takes a string, and returns its hash value.\n\nAlgorithm steps:\n\n* `a` := sum of the ascii values of the input characters\n* `b` := sum of every difference between the consecutive characters of the input (second char minus first char, third minus second, ...)\n* `c` :=...
[{"input": "\"int main(int argc, char *argv[]) { return 0; }\"", "output": "[188]", "fn_name": "string_hash"}, {"input": "\"; -----> end of hash <-----\"", "output": "[-7136]", "fn_name": "string_hash"}, {"input": "\"int hash(const char *str);\"", "output": "[-9232]", "fn_name": "string_hash"}, {"input": "\" Yo - What'...
code_functional
[ { "content": "Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so). After that they talked very often and eventually they became a coupl...
[{"input": "yufkkfwyhhvcjntsgsvpzbhqtmtgyxifqoewmuplphykmptfdebjxuaxigomjtwgtljwdjhjernkitifbomifbhysnmadtnyn\n", "output": "CHAT WITH HER!\n"}, {"input": "yufkkfwyhhvcjntsgsvpzbhqtmtgyxifqoewmuplphykmptfdebjxuaxigomjtwgtljwdjhjernkitifbomifbhysnmadtnyn\n", "output": "CHAT WITH HER!\n"}, {"input": "yufkkfwyhhvcjntsgsvp...
code_stdio
[ { "content": "There are $n$ children numbered from $1$ to $n$ in a kindergarten. Kindergarten teacher gave $a_i$ ($1 \\leq a_i \\leq n$) candies to the $i$-th child. Children were seated in a row in order from $1$ to $n$ from left to right and started eating candies. \n\nWhile the $i$-th child was eating candie...
[{"input": "50\n0 0 2 3 2 4 4 4 0 5 5 10 4 6 6 13 13 13 3 14 14 7 15 7 7 7 5 8 8 8 22 22 3 23 6 24 10 25 25 10 10 3 28 28 0 29 8 4 14 32\n0 0 7 29 2 10 10 10 0 9 9 22 5 8 8 19 19 19 1 18 18 7 17 7 7 7 4 6 6 6 10 10 1 9 3 8 4 7 7 4 4 1 4 4 0 3 1 0 0 0\n", "output": "YES\n50 50 41 18 46 36 36 36 50 36 36 18 41 36 36 18 1...
code_stdio
[ { "content": "Simple interest on a loan is calculated by simply taking the initial amount (the principal, p) and multiplying it by a rate of interest (r) and the number of time periods (n). \n\nCompound interest is calculated by adding the interest after each time period to the amount owed, then calculating the...
[{"input": "100\n0.1\n10", "output": "[[200, 259]]", "fn_name": "interest"}, {"input": "100\n0.1\n1", "output": "[[110, 110]]", "fn_name": "interest"}, {"input": "100\n0.1\n2", "output": "[[120, 121]]", "fn_name": "interest"}, {"input": "100\n0.1\n0", "output": "[[100, 100]]", "fn_name": "interest"}, {"input": "100\n0\...
code_functional
[ { "content": "*Based on this Numberphile video: https://www.youtube.com/watch?v=Wim9WJeDTHQ*\n\n---\n\nMultiply all the digits of a nonnegative integer `n` by each other, repeating with the product until a single digit is obtained. The number of steps required is known as the **multiplicative persistence**.\n\n...
[{"input": "277777788888899", "output": "[[4996238671872, 438939648, 4478976, 338688, 27648, 2688, 768, 336, 54, 20, 0]]", "fn_name": "per"}, {"input": "3778888999", "output": "[[438939648, 4478976, 338688, 27648, 2688, 768, 336, 54, 20, 0]]", "fn_name": "per"}, {"input": "2379", "output": "[[378, 168, 48, 32, 6]]", "f...
code_functional
[ { "content": "Chefs from all over the globe gather each year for an international convention. Each chef represents some country. Please, note that more than one chef can represent a country.\nEach of them presents their best dish to the audience. The audience then sends emails to a secret and secure mail server...
[{"input": "2 2\nNewton Englaod\nEuclid Greece\nNewton\nEuclid", "output": "Englaod\nEuclid\n"}, {"input": "2 1\nNewton Englaod\nEuclid Greece\nNewton\nEuclid", "output": "Englaod\nNewton\n"}, {"input": "2 1\nNewton England\nEuclid Greece\nNewton\nEuclid", "output": "England\nNewton\n"}, {"input": "2 1\nNewton dnalgnE\...
code_stdio