messages
listlengths
1
1
ground_truth
stringlengths
156
726k
dataset
stringclasses
2 values
[ { "content": "Snuke has an integer sequence A of length N.\n\nHe will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the sadness of Snuke is calculated as follows:\n\n* abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N))\n\n\n\nHere, abs(x) ...
[{"input": "9\n1 -4 4 -6 -16 1 1 24 -1", "output": "59\n"}, {"input": "9\n0 -1 -7 2 -1 0 -1 6 -3", "output": "28\n"}, {"input": "9\n0 -1 -7 2 -1 0 -1 6 -2", "output": "27\n"}, {"input": "9\n2 0 5 -2 -2 1 -2 10 -7", "output": "41\n"}, {"input": "9\n1 -4 4 -4 -4 1 0 18 -1", "output": "40\n"}, {"input": "9\n1 -4 4 -4 -8 1...
code_stdio
[ { "content": "Stephen Queen wants to write a story. He is a very unusual writer, he uses only letters 'a', 'b', 'c', 'd' and 'e'!\n\nTo compose a story, Stephen wrote out $n$ words consisting of the first $5$ lowercase letters of the Latin alphabet. He wants to select the maximum number of words to make an inte...
[{"input": "6\n3\nbac\naaada\ne\n3\naba\nabcde\naba\n2\nbaba\nbaba\n4\nab\nab\nc\nbc\n5\ncbdca\nd\na\nd\ne\n3\nb\nc\nca\n", "output": "3\n2\n0\n2\n3\n2\n"}, {"input": "6\n3\nbac\naaada\ne\n3\naba\nabcde\naba\n2\nbaba\nbaba\n4\nba\nab\nc\nbc\n5\ncbdca\nd\na\nd\ne\n3\nb\nc\nca\n", "output": "3\n2\n0\n2\n3\n2\n"}, {"input...
code_stdio
[ { "content": "#### Task:\n\nYour job here is to implement a method, `approx_root` in Ruby/Python/Crystal and `approxRoot` in JavaScript/CoffeeScript, that takes one argument, `n`, and returns the approximate square root of that number, rounded to the nearest hundredth and computed in the following manner.\n\n1....
[{"input": "401", "output": "[20.02]", "fn_name": "approx_root"}, {"input": "120", "output": "[10.95]", "fn_name": "approx_root"}, {"input": "106", "output": "[10.29]", "fn_name": "approx_root"}, {"input": "111", "output": "[10.52]", "fn_name": "approx_root"}, {"input": "168", "output": "[12.96]", "fn_name": "approx_ro...
code_functional
[ { "content": "Kevin has just recevied his disappointing results on the USA Identification of Cows Olympiad (USAICO) in the form of a binary string of length n. Each character of Kevin's string represents Kevin's score on one of the n questions of the olympiad—'1' for a correctly identified cow and '0' otherwise...
[{"input": "93\n010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010\n", "output": "93\n"}, {"input": "93\n010101010101010101010101010101010101010101010101010101010101010101010101011101010101010101010\n", "output": "93\n"}, {"input": "93\n0101010101010101010101010101010101010101...
code_stdio
[ { "content": "You are given a connected undirected weighted graph consisting of $n$ vertices and $m$ edges.\n\nYou need to print the $k$-th smallest shortest path in this graph (paths from the vertex to itself are not counted, paths from $i$ to $j$ and from $j$ to $i$ are counted as one).\n\nMore formally, if $...
[{"input": "28 27 378\n1 2 1000000000\n2 3 1000000000\n3 4 1000000000\n4 5 1000000000\n5 6 1000000000\n6 7 1000000000\n7 8 1000000000\n8 9 1000000000\n9 10 1000000000\n10 11 1000000000\n11 12 1000000000\n12 13 1000000000\n13 14 1000000000\n14 15 1000000000\n15 16 1000000000\n16 17 1000000000\n17 18 1000000000\n18 19 10...
code_stdio
[ { "content": "Karen has just arrived at school, and she has a math test today!\n\n<image>\n\nThe test is about basic addition and subtraction. Unfortunately, the teachers were too busy writing tasks for Codeforces rounds, and had no time to make an actual test. So, they just put one question in the test that is...
[{"input": "19\n716981305 764655030 1148561420 914539062 853464027 317088317 653721289 239862203 605157354 943428394 261437390 821695238 312192823 432992892 547139308 121208111 1614663126 223751525 1084180198\n", "output": "399181927\n"}, {"input": "19\n469776209 764655030 1148561420 914539062 853464027 317088317 65372...
code_stdio
[ { "content": "Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset.\n\nArtem wants to create a basic multiset of integers. He wants these structure to support...
[{"input": "10\n1 1 1000000000\n1 4 1000000000\n2 2 1000000000\n1 5 1000000000\n1 8 1000000000\n2 15 1000000000\n3 3 1000000000\n3 10 1000000000\n3 6 1000000000\n3 7 1000000000\n", "output": "0\n3\n2\n2\n"}, {"input": "10\n1 1 1000000000\n1 4 1000000000\n2 2 1000000000\n1 5 1000000000\n1 8 1000000000\n2 15 1000000000\n...
code_stdio
[ { "content": "Moscow is hosting a major international conference, which is attended by n scientists from different countries. Each of the scientists knows exactly one language. For convenience, we enumerate all languages of the world with integers from 1 to 10^9.\n\nIn the evening after the conference, all n sc...
[{"input": "20\n2 2 1 6 6 5 10 3 5 4 4 8 6 8 8 10 2 1 5 6\n20\n1 9 1 1 5 1 9 10 1 10 9 9 8 7 5 1 1 10 2 7\n5 5 9 2 10 8 2 16 6 7 8 8 6 5 3 4 6 3 7 4\n", "output": "13\n"}, {"input": "20\n2 2 1 6 6 5 10 3 5 4 4 8 6 8 8 10 2 1 5 6\n20\n1 9 1 1 5 1 9 10 1 10 9 9 8 7 5 1 1 10 2 7\n5 5 9 2 10 8 2 16 5 7 8 8 6 5 3 4 6 3 7 4\...
code_stdio
[ { "content": "Problem\n\nAlice and Bob are competing in the 50m dash.\nHowever, in this world, the higher the AOJ rate is, the better, so the higher the AOJ rate wins.\nIf there is no AOJ rate on either side, there is no comparison, so there is no choice but to compete in the 50m sprint time. In this case, the ...
[{"input": "2 11 1010 1000", "output": "Alice\n"}, {"input": "2 11 1011 1000", "output": "Alice\n"}, {"input": "3 11 1011 1000", "output": "Alice\n"}, {"input": "3 11 1011 1001", "output": "Alice\n"}, {"input": "3 16 1001 0110", "output": "Alice\n"}, {"input": "3 11 1011 1011", "output": "Draw\n"}, {"input": "4 9 1001 ...
code_stdio
[ { "content": "Takahashi has two positive integers A and B.\n\nIt is known that A plus B equals N. Find the minimum possible value of \"the sum of the digits of A\" plus \"the sum of the digits of B\" (in base 10).\n\nConstraints\n\n* 2 ≤ N ≤ 10^5\n* N is an integer.\n\nInput\n\nInput is given from Standard Inpu...
[{"input": "100000", "output": "10"}, {"input": "1697", "output": "23\n"}, {"input": "199", "output": "19\n"}, {"input": "178", "output": "16\n"}, {"input": "389", "output": "20\n"}, {"input": "499", "output": "22\n"}, {"input": "789", "output": "24\n"}, {"input": "795", "output": "21\n"}, {"input": "989", "output": "2...
code_stdio
[ { "content": "Read problems statements in Mandarin Chinese and Russian as well. \n\n\tA version control system(VCS) is a repository of files, often the files for the source code of computer programs, with monitored access. Every change made to the source is tracked, along with who made the change, why they made...
[{"input": "2\n19 4 6\n1 4 6 7\n1 2 3 4 6 8\n12 2 2\n1 4\n1 4", "output": "3 12\n2 10\n"}, {"input": "2\n19 4 6\n1 4 6 7\n1 2 3 4 6 7\n12 2 2\n1 4\n1 4", "output": "4 13\n2 10\n"}, {"input": "2\n17 4 6\n1 3 6 11\n1 2 3 5 6 7\n5 2 2\n2 4\n3 4", "output": "3 10\n1 2\n"}, {"input": "2\n21 4 6\n2 3 6 14\n1 2 3 4 6 9\n4 2 2...
code_stdio
[ { "content": "You are given a huge decimal number consisting of $n$ digits. It is guaranteed that this number has no leading zeros. Each digit of this number is either 0 or 1.\n\nYou may perform several (possibly zero) operations with this number. During each operation you are allowed to change any digit of you...
[{"input": "213 5 3\n111001111110111001101011111100010010011001000001111010110110011000100000101010111110010001111110001010011001101000000011111110101001101100100100110100000111111100010100011010010001011100111011000001110000111000101\n", "output": "3\n"}, {"input": "213 5 3\n1110011111101110011010111111000100100110010...
code_stdio
[ { "content": "Maya writes weekly articles to a well known magazine, but she is missing one word each time she is about to send the article to the editor. The article is not complete without this word. Maya has a friend, Dan, and he is very good with words, but he doesn't like to just give them away. He texts Ma...
[{"input": "103247", "output": "[\"boiled\"]", "fn_name": "hidden"}, {"input": "942547", "output": "[\"melted\"]", "fn_name": "hidden"}, {"input": "49632", "output": "[\"email\"]", "fn_name": "hidden"}, {"input": "12674", "output": "[\"blade\"]", "fn_name": "hidden"}, {"input": "56124", "output": "[\"table\"]", "fn_nam...
code_functional
[ { "content": "If you draw a few infinitely long straight lines on an infinitely wide plane, this plane will be divided into several areas. For example, if you draw a straight line, the plane will be divided into two areas. Even if you draw the same number of straight lines, the number of areas obtained will dif...
[{"input": "1\n705", "output": "2\n248866\n"}, {"input": "1\n506", "output": "2\n128272\n"}, {"input": "1\n154", "output": "2\n11936\n"}, {"input": "1\n238", "output": "2\n28442\n"}, {"input": "1\n373", "output": "2\n69752\n"}, {"input": "1\n155", "output": "2\n12091\n"}, {"input": "1\n159", "output": "2\n12721\n"}, {"...
code_stdio
[ { "content": "Mr. E Ven only likes even length words.\nPlease create a translator so that he doesn't have to hear those pesky odd length words.\nFor some reason he also hates punctuation, he likes his sentences to flow.\n\nYour translator should take in a string and output it with all odd length words having an...
[{"input": "\"underscore is not considered a word..in this case,\"", "output": "[\"underscore is nott considered aa wordin this case\"]", "fn_name": "evenator"}, {"input": "\"lorem is so ipsum. why bother?\"", "output": "[\"loremm is so ipsumm whyy bother\"]", "fn_name": "evenator"}, {"input": "\"hi. how are you? Bye!!...
code_functional
[ { "content": "At 17:00, special agent Jack starts to escape from the enemy camp. There is a cliff in between the camp and the nearest safety zone. Jack has to climb the almost vertical cliff by stepping his feet on the blocks that cover the cliff. The cliff has slippery blocks where Jack has to spend time to ta...
[{"input": "6 6\n4 4 X X T T\n4 7 8 2 X 7\n1 X X X 1 8\n1 2 X X X 6\n1 1 2 4 4 7\nS S 2 3 X X\n2 10\nT 1\n1 X\n1 X\n1 X\n1 1\n1 X\n1 X\n1 1\n1 X\nS S\n2 10\nT X\n1 X\n1 X\n1 X\n1 1\n1 X\n1 X\n1 1\n1 X\nS S\n10 10\nT T T T T T T T T T\nX 2 X X X X X 3 4 X\n9 8 9 X X X 2 9 X 9\n7 7 X 7 3 X X 8 9 X\n8 9 9 9 6 3 X 5 X 5\n8...
code_stdio
[ { "content": "There are n positive integers a_1, a_2, ..., a_n. For the one move you can choose any even value c and divide by two all elements that equal c.\n\nFor example, if a=[6,8,12,6,3,12] and you choose c=6, and a is transformed into a=[3,8,12,3,3,12] after the move.\n\nYou need to find the minimal numbe...
[{"input": "4\n6\n37 6 40 3 20 1\n1\n1024\n4\n2 6 10 16\n3\n3 1 7\n", "output": "4\n10\n6\n0\n"}, {"input": "4\n6\n40 6 40 2 20 1\n1\n1024\n4\n2 4 8 16\n3\n3 1 14\n", "output": "5\n10\n4\n1\n"}, {"input": "4\n6\n37 6 79 3 20 1\n1\n1024\n4\n2 6 10 16\n1\n3 1 7\n", "output": "3\n10\n6\n0\n"}, {"input": "4\n6\n40 6 40 3 2...
code_stdio
[ { "content": "This kata is from check py.checkio.org\n\nYou are given an array with positive numbers and a number N. You should find the N-th power of the element in the array with the index N. If N is outside of the array, then return -1. Don't forget that the first element has the index 0.\n\nLet's look at a ...
[{"input": "[1, 1, 1, 1, 1, 1, 1, 1, 1, 100]\n9", "output": "[1000000000000000000]", "fn_name": "index"}, {"input": "[75, 68, 35, 61, 9, 36, 89, 0, 30]\n10", "output": "[-1]", "fn_name": "index"}, {"input": "[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n9", "output": "[1]", "fn_name": "index"}, {"input": "[1, 3, 10, 100]\n3", "outpu...
code_functional
[ { "content": "We have an H \\times W grid whose squares are painted black or white. The square at the i-th row from the top and the j-th column from the left is denoted as (i, j).\nSnuke would like to play the following game on this grid. At the beginning of the game, there is a character called Kenus at square...
[{"input": "10 37\n.....................................\n...#...####...####..###...###...###..\n..#.#..#...#.##....#...#.#...#.#...#.\n..#.#..#...#.#.....#...#.#...#.#...#.\n.#...#.#..##.#.....#...#.#.###.#.###.\n.#####.####..#.....#...#..##....##...\n.#...#.#...#.#.....#...#.#...#.#...#.\n.#...#.#...#.##....#...#.#.....
code_stdio
[ { "content": "The official capital and the cultural capital of Berland are connected by a single road running through n regions. Each region has a unique climate, so the i-th (1 ≤ i ≤ n) region has a stable temperature of ti degrees in summer.\n\nThis summer a group of m schoolchildren wants to get from the off...
[{"input": "20 102\n73 79 75 27\n13 15 62 47\n74 75 85 86\n49 81 23 69\n43 17 45 27\n35 14 90 35\n51 74 35 33\n54 66 46 24\n33 76 49 3\n34 53 25 76\n69 72 76 31\n41 31 8 48\n49 48 85 24\n19 2 59 83\n19 31 51 86\n31 10 45 76\n56 47 79 86\n49 33 15 1\n77 89 26 64\n7 52 76 77\n", "output": "59201\n"}, {"input": "20 102\n7...
code_stdio
[ { "content": "Nezzar has $n$ balls, numbered with integers $1, 2, \\ldots, n$. Numbers $a_1, a_2, \\ldots, a_n$ are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that $a_i \\leq a_{i+1}$ for all $1 \\leq i < n$.\n\nNezzar wants to color the balls using the min...
[{"input": "5\n6\n1 1 1 2 3 4\n5\n1 1 2 2 3\n4\n2 2 2 2\n3\n1 2 3\n1\n1\n", "output": "\n3\n2\n4\n1\n1\n"}, {"input": "5\n6\n1 1 1 2 3 4\n5\n1 1 2 2 3\n4\n2 2 2 2\n3\n1 2 3\n1\n1\n", "output": "3\n2\n4\n1\n1\n"}, {"input": "5\n6\n1 1 1 2 3 4\n5\n1 1 2 2 3\n4\n2 2 2 2\n3\n2 2 3\n1\n1\n", "output": "3\n2\n4\n2\n1\n"}, {"...
code_stdio
[ { "content": "We, the researchers who discovered and investigated the ancient nation Iwashiro, finally discovered the temple in the center of Iwashiro. A lithograph dedicated to the god of Iwashiro was stored in the temple. On the lithograph, two strings were written, one for each sentence and one for the spell...
[{"input": "aaaabaaaabaaaabaaaab\naabaa", "output": "1576\n"}, {"input": "aaaabaaaabaa`abaaaab\naabaa", "output": "1248\n"}, {"input": "aaaabaaaabaa`ababaaa\naabaa", "output": "1446\n"}, {"input": "aaaabaaaabaaaabaaaab\nbaaaa", "output": "566\n"}, {"input": "aa`abbbaaaaa``bababa\na`bab", "output": "180\n"}, {"input": "...
code_stdio
[ { "content": "Boolean Expression Compressor\n\nYou are asked to build a compressor for Boolean expressions that transforms expressions to the shortest form keeping their meaning.\n\nThe grammar of the Boolean expressions has terminals `0` `1` `a` `b` `c` `d` `-` `^` `*` `(` `)`, start symbol <E> and the followi...
[{"input": "0\n(a*(0*b))\n(1^a)\n(-(-a*-b)*a)\n(a^(b^(c^d)))\n.", "output": "1\n1\n2\n1\n13\n"}, {"input": "0\n(a*(1*b))\n(1^b)\n(-(-a*-b)*a)\n(a^(b^(c^d)))\n.", "output": "1\n5\n2\n1\n13\n"}, {"input": "0\n(a*(1*b))\n(0^a)\n(-(-b*-c)*a)\nca^(b^((^e)))\n.", "output": "1\n5\n1\n12\n1\n"}, {"input": "0\n(a*(1*c))\n(1^a)\...
code_stdio
[ { "content": "Snuke is visiting a shop in Tokyo called 109 to buy some logs.\nHe wants n logs: one of length 1, one of length 2, ..., and one of length n.\nThe shop has n+1 logs in stock: one of length 1, one of length 2, \\dots, and one of length n+1. Each of these logs is sold for 1 yen (the currency of Japan...
[{"input": "1000000000000000000\n", "output": "999999998585786440\n"}, {"input": "109109109109109109\n", "output": "109109108641970782\n"}, {"input": "252509054433933446\n", "output": "252509053723287187\n"}, {"input": "335408917861648771\n", "output": "335408917042614075\n"}, {"input": "522842184971407774\n", "output"...
code_stdio
[ { "content": "You are given a string $s$ consisting of $n$ lowercase Latin letters.\n\nYou have to remove at most one (i.e. zero or one) character of this string in such a way that the string you obtain will be lexicographically smallest among all strings that can be obtained using this operation.\n\nString $s ...
[{"input": "26\nlolthisiscoolfreehackforya\n", "output": "llthisiscoolfreehackforya\n"}, {"input": "26\nlolthisiscoolfreehackforya\n", "output": "llthisiscoolfreehackforya\n"}, {"input": "26\nlolthisiscoolfrfehackforya\n", "output": "llthisiscoolfrfehackforya\n"}, {"input": "26\nayrofkcahefrfloocsisihtlol\n", "output":...
code_stdio
[ { "content": "Some positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representations does a given positive integer have? For example, the integer 53 has two representations 5 + 7 + 11 + 13 + 17 and 53. The integer 41 has three representations 2 + 3 + 5 + 7 + 1...
[{"input": "2\n6\n17\n34\n20\n1266\n24\n20\n0", "output": "1\n0\n2\n0\n0\n1\n1\n0\n"}, {"input": "2\n3\n17\n41\n20\n666\n24\n53\n0", "output": "1\n1\n2\n3\n0\n0\n1\n2\n"}, {"input": "2\n3\n17\n41\n20\n666\n24\n56\n0", "output": "1\n1\n2\n3\n0\n0\n1\n1\n"}, {"input": "2\n3\n17\n41\n20\n666\n24\n20\n0", "output": "1\n1\n...
code_stdio
[ { "content": "Omkar is playing his favorite pixelated video game, Bed Wars! In Bed Wars, there are $n$ players arranged in a circle, so that for all $j$ such that $2 \\leq j \\leq n$, player $j - 1$ is to the left of the player $j$, and player $j$ is to the right of player $j - 1$. Additionally, player $n$ is t...
[{"input": "5\n4\nRLRL\n6\nLRRRRL\n8\nRLLRRRLL\n12\nLLLLRRLRRRLL\n5\nRRRRR\n", "output": "0\n1\n1\n3\n2\n"}, {"input": "5\n4\nRLRL\n6\nLRRRRL\n8\nRLLRRRLL\n12\nLLRRRLRRLLLL\n5\nRRRRR\n", "output": "0\n1\n1\n3\n2\n"}, {"input": "5\n4\nRLRL\n6\nRRRLRL\n8\nRLLRRRLL\n12\nLLLLRRLRLRRL\n5\nRRRRR\n", "output": "0\n1\n1\n1\n2\...
code_stdio
[ { "content": "Notice that the memory limit is non-standard.\n\nRecently Arthur and Sasha have studied correct bracket sequences. Arthur understood this topic perfectly and become so amazed about correct bracket sequences, so he even got himself a favorite correct bracket sequence of length 2n. Unlike Arthur, Sa...
[{"input": "50\n97 97\n61 61\n59 59\n29 29\n13 13\n7 7\n5 5\n3 3\n1 1\n3 3\n1 1\n13 13\n11 11\n9 9\n3 3\n1 1\n1 1\n1 1\n27 27\n25 25\n1 1\n21 21\n19 19\n17 17\n15 15\n5 5\n1 1\n1 1\n7 7\n1 1\n3 3\n1 1\n15 15\n13 13\n1 1\n9 9\n7 7\n5 5\n3 3\n1 1\n15 15\n5 5\n1 1\n1 1\n3 3\n1 1\n1 1\n1 1\n1 1\n1 1\n", "output": "((((((((...
code_stdio
[ { "content": "Wherever the destination is, whoever we meet, let's render this song together.\n\nOn a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no collisions will happen before one enters the s...
[{"input": "20 50000 50000\n2 45955 55488\n1 19804 29337\n2 3767 90811\n2 24025 33558\n1 46985 56518\n2 21094 30627\n2 5787 15320\n1 4262 91306\n2 37231 46764\n1 18125 27658\n1 36532 12317\n1 31330 40863\n1 18992 28525\n1 29387 38920\n1 44654 54187\n2 45485 55018\n2 36850 46383\n1 44649 54182\n1 40922 50455\n2 12781 99...
code_stdio
[ { "content": "We ask you to select some number of positive integers, and calculate the sum of them.\nIt is allowed to select as many integers as you like, and as large integers as you wish.\nYou have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one...
[{"input": "103 135 85", "output": "YES\n"}, {"input": "1 100 97\n", "output": "YES\n"}, {"input": "40 98 58\n", "output": "YES\n"}, {"input": "103 98 58", "output": "YES\n"}, {"input": "103 98 87", "output": "YES\n"}, {"input": "103 77 58", "output": "YES\n"}, {"input": "103 98 85", "output": "YES\n"}, {"input": "117 ...
code_stdio
[ { "content": "Given an integer N, let us consider a triangle of numbers of N lines in which a number a_{11} appears in the first line, two numbers a_{21} and a_{22} appear in the second line, three numbers a_{31}, a_{32} and a_{33} appear in the third line, etc. In general, i numbers a_{i1}, a_{i2} \\dots a_{ii...
[{"input": "2\n3\n1\n8 1\n41 4 3\n4 \n5 \n-1 0 \n2 -4 0\n3 0 12 -1", "output": "50\n17\n"}, {"input": "2\n3\n1\n4 2\n28 4 1\n4 \n4 \n1 0 \n5 -1 -1\n3 0 2 -1", "output": "33\n13\n"}, {"input": "2\n3\n1\n4 2\n28 4 2\n4 \n4 \n1 0 \n2 -1 -1\n3 0 4 -1", "output": "33\n10\n"}, {"input": "2\n3\n1\n8 1\n41 4 3\n4 \n14 \n0 0 \n...
code_stdio
[ { "content": "Students Vasya and Petya are studying at the BSU (Byteland State University). At one of the breaks they decided to order a pizza. In this problem pizza is a circle of some radius. The pizza was delivered already cut into n pieces. The i-th piece is a sector of angle equal to a_{i}. Vasya and Petya...
[{"input": "222\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
code_stdio
[ { "content": "One day, the teacher came up with the following game.\nThe game uses n cards with one number from 1 to 10 and proceeds as follows.\n\n\n1. The teacher pastes n cards on the blackboard in a horizontal row so that the numbers can be seen, and declares an integer k (k ≥ 1) to the students. For n card...
[{"input": "4 3\n15\n3\n16\n5\n0 0", "output": "480\n"}, {"input": "4 3\n12\n3\n16\n5\n0 0", "output": "384\n"}, {"input": "4 3\n8\n3\n16\n5\n0 0", "output": "256\n"}, {"input": "4 2\n8\n3\n10\n5\n0 0", "output": "30\n"}, {"input": "4 2\n4\n1\n14\n3\n0 0", "output": "14\n"}, {"input": "4 2\n8\n3\n16\n5\n0 0", "output":...
code_stdio
[ { "content": "You are visiting a large electronics store to buy a refrigerator and a microwave.\n\nThe store sells A kinds of refrigerators and B kinds of microwaves. The i-th refrigerator ( 1 \\le i \\le A ) is sold at a_i yen (the currency of Japan), and the j-th microwave ( 1 \\le j \\le B ) is sold at b_j y...
[{"input": "5 5 0\n-10 0\n12 10 -2\n-1 2 1", "output": "-12\n"}, {"input": "2 10 0\n-5 -1\n13 10 -1\n0 2 7", "output": "-6\n"}, {"input": "3 10 -1\n-5 0\n11 10 -2\n0 2 1", "output": "-7\n"}, {"input": "5 10 0\n-6 0\n12 10 -2\n-1 2 1", "output": "-8\n"}, {"input": "5 5 0\n-8 0\n12 10 -2\n-1 2 1", "output": "-10\n"}, {"i...
code_stdio
[ { "content": "Hands that shed innocent blood!\n\nThere are n guilty people in a line, the i-th of them holds a claw with length L_{i}. The bell rings and every person kills some of people in front of him. All people kill others at the same time. Namely, the i-th person kills the j-th person if and only if j < i...
[{"input": "11\n1 0 0 1 1 3 2 0 0 2 3\n", "output": "4\n"}, {"input": "11\n1 0 0 1 1 3 2 0 0 2 3\n", "output": "4\n"}, {"input": "11\n1 0 0 1 0 3 2 0 0 2 3\n", "output": "4\n"}, {"input": "11\n1 0 0 1 0 3 2 0 0 2 2\n", "output": "4\n"}, {"input": "2\n1000000000 1000000000\n", "output": "1\n"}, {"input": "2\n1000000000 ...
code_stdio
[ { "content": "Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it.\nThey will share these cards.\nFirst, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards.\nHere, both Snuke and Raccoon have to take at...
[{"input": "6\n1 30 1 10 -1 6", "output": "15\n"}, {"input": "6\n1 36 1 10 -1 6", "output": "21\n"}, {"input": "6\n1 36 1 10 -1 1", "output": "26\n"}, {"input": "6\n0 3 3 7 1 24", "output": "10\n"}, {"input": "6\n-1 10 3 3 1 8", "output": "0\n"}, {"input": "6\n-1 10 3 3 1 4", "output": "2\n"}, {"input": "6\n-1 15 3 3 1...
code_stdio
[ { "content": "In Japan, temperature is usually expressed using the Celsius (℃) scale. In America, they used the Fahrenheit (℉) scale instead. $20$ degrees Celsius is roughly equal to $68$ degrees Fahrenheit. A phrase such as \"Today’s temperature is $68$ degrees\" is commonly encountered while you are in Americ...
[{"input": "22485", "output": "11227\n"}, {"input": "37535", "output": "18752\n"}, {"input": "54760", "output": "27365\n"}, {"input": "10347", "output": "5158\n"}, {"input": "10699", "output": "5334\n"}, {"input": "19116", "output": "9543\n"}, {"input": "11734", "output": "5852\n"}, {"input": "14312", "output": "7141\n...
code_stdio
[ { "content": "You planned a trip using trains and buses.\nThe train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket.\nSimilarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ...
[{"input": "549\n817\n715\n603\n", "output": "1152\n"}, {"input": "600\n300\n220\n420\n", "output": "520\n"}, {"input": "555\n555\n400\n200\n", "output": "755\n"}, {"input": "549\n838\n715\n603", "output": "1152\n"}, {"input": "555\n312\n400\n200", "output": "512\n"}, {"input": "600\n548\n220\n420", "output": "768\n"},...
code_stdio
[ { "content": "This time no story, no theory. The examples below show you how to write function `accum`:\n\n**Examples:**\n```\naccum(\"abcd\") -> \"A-Bb-Ccc-Dddd\"\naccum(\"RqaEzty\") -> \"R-Qq-Aaa-Eeee-Zzzzz-Tttttt-Yyyyyyy\"\naccum(\"cwAt\") -> \"C-Ww-Aaa-Tttt\"\n```\n\nThe parameter of accum is a string which...
[{"input": "\"ZpglnRxqenU\"", "output": "[\"Z-Pp-Ggg-Llll-Nnnnn-Rrrrrr-Xxxxxxx-Qqqqqqqq-Eeeeeeeee-Nnnnnnnnnn-Uuuuuuuuuuu\"]", "fn_name": "accum"}, {"input": "\"NyffsGeyylB\"", "output": "[\"N-Yy-Fff-Ffff-Sssss-Gggggg-Eeeeeee-Yyyyyyyy-Yyyyyyyyy-Llllllllll-Bbbbbbbbbbb\"]", "fn_name": "accum"}, {"input": "\"MjtkuBovqrU\""...
code_functional
[ { "content": "You have two friends. You want to present each of them several positive integers. You want to present cnt_1 numbers to the first friend and cnt_2 numbers to the second friend. Moreover, you want all presented numbers to be distinct, that also means that no number should be presented to both friend...
[{"input": "500000000 500000000 29983 29989\n", "output": "1000000001\n"}, {"input": "500000000 500000000 29959 29983\n", "output": "1000000001\n"}, {"input": "500000000 500000000 29983 29989\n", "output": "1000000001\n"}, {"input": "500000000 500000000 29959 29983\n", "output": "1000000001\n"}, {"input": "500000000 33...
code_stdio
[ { "content": "Little penguin Polo likes permutations. But most of all he likes permutations of integers from 0 to n, inclusive.\n\nFor permutation p = p_0, p_1, ..., p_{n}, Polo has defined its beauty — number $(0 \\oplus p_{0}) +(1 \\oplus p_{1}) + \\cdots +(n \\oplus p_{n})$.\n\nExpression $x \\oplus y$ means...
[{"input": "15475\n", "output": "239491100\n3 2 1 0 11 10 9 8 7 6 5 4 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 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 ...
code_stdio
[ { "content": "Limak is a little polar bear. He doesn't have many toys and thus he often plays with polynomials.\n\nHe considers a polynomial valid if its degree is n and its coefficients are integers not exceeding k by the absolute value. More formally:\n\nLet a0, a1, ..., an denote the coefficients, so <image>...
[{"input": "100 1000\n-62 57 -27 -67 49 -10 66 -64 -36 -78 62 -75 -39 75 -47 -36 41 -88 62 -43 22 29 -20 58 40 16 71 -2 -87 12 86 -90 -92 67 -12 -48 -10 -26 78 68 22 -3 66 -95 -81 34 14 -76 -27 76 -60 87 -84 3 35 -60 46 -65 29 -29 2 -44 -55 18 -75 91 36 34 -86 53 59 -54 -29 33 -95 66 9 72 67 -44 37 44 32 -52 -34 -4 -99...
code_stdio
[ { "content": "It is winter now, and Max decided it's about time he watered the garden.\n\nThe garden can be represented as n consecutive garden beds, numbered from 1 to n. k beds contain water taps (i-th tap is located in the bed x_{i}), which, if turned on, start delivering water to neighbouring beds. If the t...
[{"input": "1\n177 99\n1 4 7 10 11 13 14 15 16 17 19 21 22 24 25 26 27 28 32 34 35 38 39 40 42 45 46 52 54 55 57 58 59 60 62 64 65 67 70 71 74 77 78 79 80 81 83 84 88 92 93 94 95 100 101 102 104 106 107 108 109 110 112 113 114 115 116 118 122 123 124 125 127 128 129 130 134 135 137 138 139 140 142 146 148 149 154 158 1...
code_stdio
[ { "content": "You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to th...
[{"input": "100000000 100000000 100000000 100000000 1\n100000000 100000000 100001000 1\n", "output": "100000999\n"}, {"input": "100000000 100000000 100000000 100000000 1\n100000000 100000000 100000000 1\n", "output": "99999999\n"}, {"input": "100000000 100000000 100000000 100000000 1\n100000000 100000000 100000000 1\n"...
code_stdio
[ { "content": "We have a rectangular grid of squares with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left. On this grid, there is a piece, which is initially placed at square (s_r,s_c).\n\nTakahashi and Aoki will play a game, wh...
[{"input": "2 6 11\n2 1\nRLDRRUDDLRL\nURRDRLLDLRD", "output": "NO\n"}, {"input": "5 6 11\n2 0\nRLDRRUDDLRL\nURRDRLLDLRD", "output": "NO\n"}, {"input": "4 6 11\n2 1\nRLDRRUDDLRL\nURRDRLLDLRD", "output": "NO\n"}, {"input": "5 1 11\n2 0\nRLDRRUDDLRL\nURRDRLLDLRD", "output": "NO\n"}, {"input": "5 6 11\n2 1\nRLDRRUDDLSL\nUR...
code_stdio
[ { "content": "For an array $b$ of length $m$ we define the function $f$ as $ f(b) = \\begin{cases} b[1] & \\quad \\text{if } m = 1 \\\\ f(b[1] \\oplus b[2],b[2] \\oplus b[3],\\dots,b[m-1] \\oplus b[m]) & \\quad \\text{otherwise,} \\end{cases} $ \n\nwhere $\\oplus$ is bitwise exclusive OR.\n\nFor example, $f(1,...
[{"input": "6\n0 1 6 12 51 68\n4\n1 6\n2 6\n3 3\n2 4\n", "output": "125\n125\n6\n13\n"}, {"input": "6\n1 2 4 12 16 32\n4\n1 6\n2 6\n3 4\n1 4\n", "output": "56\n56\n12\n14\n"}, {"input": "6\n1 2 4 12 32 32\n4\n1 6\n2 6\n3 4\n1 4\n", "output": "44\n44\n12\n14\n"}, {"input": "6\n1 2 4 12 16 31\n4\n1 6\n2 6\n3 4\n1 4\n", "...
code_stdio
[ { "content": "At Akabeko Elementary School, all the students participate in a slightly unusual jogging. Students run their own lap courses at their own pace. After going around each of your courses, you will be returned to elementary school. How many laps do they all meet at the same time in elementary school a...
[{"input": "2\n3 4\n13 4\n5\n789 289\n166 46\n9 4\n617 272\n972 303\n2\n11 5\n23 20\n0", "output": "13\n3\n1598397732\n1209243492\n1939462992\n1923746112\n1360317793\n23\n44\n"}, {"input": "2\n3 4\n13 4\n5\n789 289\n166 46\n9 4\n617 272\n972 303\n2\n11 5\n32 20\n0", "output": "13\n3\n1598397732\n1209243492\n1939462992\...
code_stdio
[ { "content": "Now I have a card with n numbers on it. Consider arranging some or all of these appropriately to make numbers. Find the number obtained by adding all the numbers created at this time.\n\nFor example, if you have 1 and 2, you will get 4 numbers 1, 2, 12, 21 so the total number is 36. Even if the sa...
[{"input": "4\n2\n8\n6\n10", "output": "1177916\n"}, {"input": "4\n4\n8\n6\n10", "output": "1315948\n"}, {"input": "4\n1\n5\n7\n17", "output": "1022430\n"}, {"input": "4\n4\n8\n3\n10", "output": "1108900\n"}, {"input": "4\n1\n7\n7\n17", "output": "1160462\n"}, {"input": "4\n2\n7\n7\n17", "output": "1229478\n"}, {"input...
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. To complete ...
[{"input": "129347924210", "output": "[true]", "fn_name": "is_bouncy"}, {"input": "92722983", "output": "[true]", "fn_name": "is_bouncy"}, {"input": "234689", "output": "[false]", "fn_name": "is_bouncy"}, {"input": "98874", "output": "[false]", "fn_name": "is_bouncy"}, {"input": "2379", "output": "[false]", "fn_name": ...
code_functional
[ { "content": "Write a function named `first_non_repeating_letter` that takes a string input, and returns the first character that is not repeated anywhere in the string.\n\nFor example, if given the input `'stress'`, the function should return `'t'`, since the letter *t* only occurs once in the string, and occu...
[{"input": "\"Go hang a salami, I'm a lasagna hog!\"", "output": "[\",\"]", "fn_name": "first_non_repeating_letter"}, {"input": "\"hello world, eh?\"", "output": "[\"w\"]", "fn_name": "first_non_repeating_letter"}, {"input": "\"moonmen\"", "output": "[\"e\"]", "fn_name": "first_non_repeating_letter"}, {"input": "\"~><#...
code_functional
[ { "content": "Vasya has got a robot which is situated on an infinite Cartesian plane, initially in the cell $(0, 0)$. Robot can perform the following four kinds of operations: U — move from $(x, y)$ to $(x, y + 1)$; D — move from $(x, y)$ to $(x, y - 1)$; L — move from $(x, y)$ to $(x - 1, y)$; R — move fr...
[{"input": "386\nRUDLURLUURDDLLLRLDURLRRDLDUUURLLRDLRRDLDRLDDURDURURDRLUULLDUULRULDLLLLDLUURRLRRRUDULRDDRDLDULRLDDRDDRLRLDLDULLULUDULLLDUUDURURDDLDRLUDDDDLDUDUURLUUDURRUDRLUDRLULLRLRRDLULDRRURUULLRDLDRLURDUDRLDLRLLUURLURDUUDRDURUDDLLDURURLLRRULURULRRLDLDRLLUUURURDRRRLRDRURULUDURRLRLDRUDLRRRRLLRURDUUDLLLLURDLRLRRDLDLLLD...
code_stdio
[ { "content": "In some country live wizards. They love playing with numbers. \n\nThe blackboard has two numbers written on it — a and b. The order of the numbers is not important. Let's consider a ≤ b for the sake of definiteness. The players can cast one of the two spells in turns:\n\n * Replace b with b - ak....
[{"input": "66\n7 0\n5 7\n1 3\n3 2\n3 5\n0 6\n1 2\n0 7\n4 5\n4 7\n5 1\n2 0\n4 0\n0 5\n3 6\n7 2\n6 0\n5 3\n6 6\n1 7\n5 6\n2 2\n3 4\n2 0\n5 3\n4 6\n6 1\n5 3\n100000000000 0000000000000000000\n0 1\n4 1\n2 6\n5 5\n4 5\n0 3\n3 7\n3 1\n1 0\n4 4\n1000000000000000000 100000000000\n12 6\n4 2\n7 5\n1 6\n6 1\n2 7\n7 7\n6 7\n2 4\n...
code_stdio
[ { "content": "As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.\n\nSnuke, an employee, would like to play with this sequence.\nSpecifically, he would like to repeat the following operation as many times as possib...
[{"input": "10000\n126382592 432418816 117063168 213396480 379143680 515038208 324231168 266539520 602792960 314653184 650153984 883734016 33309696 9005056 46451200 158759424 33279488 319342080 499438080 853167616 310094336 919876608 882363392 132034048 288561664 745817600 28561408 9703936 792974336 310508544 125830656...
code_stdio
[ { "content": "Four players participate in the playoff tournament. The tournament is held according to the following scheme: the first player will play with the second, and the third player with the fourth, then the winners of the pairs will play in the finals of the tournament.\n\nIt is known that in a match be...
[{"input": "4\n3 7 9 5\n4 5 6 1\n5 3 8 1\n2 5 3 2\n", "output": "YES\nYES\nYES\nYES\n"}, {"input": "4\n3 7 2 5\n4 5 6 9\n5 3 15 1\n2 5 3 1\n", "output": "YES\nNO\nYES\nYES\n"}, {"input": "4\n3 7 9 5\n4 5 6 9\n5 3 8 1\n2 5 3 2\n", "output": "YES\nNO\nYES\nYES\n"}, {"input": "4\n3 7 9 5\n4 5 6 9\n5 3 8 1\n2 5 3 1\n", "ou...
code_stdio
[ { "content": "For a given positive integer n denote its k-rounding as the minimum positive integer x, such that x ends with k or more zeros in base 10 and is divisible by n.\n\nFor example, 4-rounding of 375 is 375·80 = 30000. 30000 is the minimum integer such that it ends with 4 or more zeros and is divisible ...
[{"input": "1005856822 8\n", "output": "50292841100000000\n"}, {"input": "1522186596 8\n", "output": "38054664900000000\n"}, {"input": "123456789 8\n", "output": "12345678900000000\n"}, {"input": "999999999 8\n", "output": "99999999900000000\n"}, {"input": "222222222 8\n", "output": "11111111100000000\n"}, {"input": "6...
code_stdio
[ { "content": "You are fed up with your messy room, so you decided to clean it up.\n\nYour room is a bracket sequence $s=s_{1}s_{2}\\dots s_{n}$ of length $n$. Each character of this string is either an opening bracket '(' or a closing bracket ')'.\n\nIn one operation you can choose any consecutive substring of ...
[{"input": "4\n8 3\n)())(()(\n10 3\n))()()()((\n2 1\n)(\n2 1\n)(\n", "output": "4\n1 2\n3 5\n5 6\n6 8\n5\n1 3\n3 5\n5 7\n6 9\n7 10\n1\n1 2\n1\n1 2\n"}, {"input": "4\n8 2\n)())(()(\n10 4\n))()()()((\n2 1\n)(\n2 1\n)(\n", "output": "4\n1 2\n3 5\n4 6\n5 8\n5\n1 3\n3 5\n5 7\n7 9\n8 10\n1\n1 2\n1\n1 2\n"}, {"input": "4\n8 1...
code_stdio
[ { "content": "You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.\n\nFor example, the string \"Hello\" for p = 2, q = 3 can be split to the two strings \"Hel\" and \"lo\" or to the two strings \"He\" and \"llo\".\n\nNote it is allowed to split the string ...
[{"input": "100 1 1\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n", "output": "100\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb...
code_stdio
[ { "content": "In this problem you have to solve a simple classification task: given an image, determine whether it depicts a Fourier doodle. \n\nYou are given a set of 50 images with ids 1 through 50. You are also given a text file labels.txt containing the labels for images with ids 1 through 20, which compris...
[{"input": "-116\n", "output": "0\n1\n1\n0\n1\n1\n0\n1\n1\n1\n1\n1\n0\n1\n0\n1\n1\n1\n0\n1\n1\n1\n1\n1\n0\n1\n0\n1\n1\n1\n"}, {"input": "-132\n", "output": "0\n1\n1\n0\n1\n1\n0\n1\n1\n1\n1\n1\n0\n1\n0\n1\n1\n1\n0\n1\n1\n1\n1\n1\n0\n1\n0\n1\n1\n1\n"}, {"input": "-119\n", "output": "0\n1\n1\n0\n1\n1\n0\n1\n1\n1\n1\n1\n0\...
code_stdio
[ { "content": "A substring of some string is called the most frequent, if the number of its occurrences is not less than number of occurrences of any other substring.\n\nYou are given a set of strings. A string (not necessarily from this set) is called good if all elements of the set are the most frequent substr...
[{"input": "76\namnctposz\nmnctpos\nos\nu\ne\nam\namnc\neamnctpo\nl\nx\nq\nposzq\neamnc\nctposzq\nctpos\nmnc\ntpos\namnctposzql\ntposzq\nmnctposz\nnctpos\nctposzql\namnctpos\nmnct\np\nux\nposzql\ntpo\nmnctposzql\nmnctp\neamnctpos\namnct\ntposzql\nposz\nz\nct\namnctpo\noszq\neamnct\ntposz\ns\nmn\nn\nc\noszql\npo\no\nmnc...
code_stdio
[ { "content": "You are given a permutation $p_1, p_2, \\ldots, p_n$.\n\nIn one move you can swap two adjacent values.\n\nYou want to perform a minimum number of moves, such that in the end there will exist a subsegment $1,2,\\ldots, k$, in other words in the end there should be an integer $i$, $1 \\leq i \\leq n...
[{"input": "100\n98 52 63 2 18 96 31 58 84 40 41 45 66 100 46 71 26 48 81 20 73 91 68 76 13 93 17 29 64 95 79 21 55 75 19 85 54 51 89 78 15 87 43 59 36 1 90 35 65 56 62 28 86 5 82 49 3 99 33 9 92 32 74 69 27 22 77 16 44 94 34 6 57 70 23 12 61 25 8 11 67 47 83 88 10 14 30 7 97 60 42 37 24 38 53 50 4 80 72 39\n", "output...
code_stdio
[ { "content": "Write a function which outputs the positions of matching bracket pairs. The output should be a dictionary with keys the positions of the open brackets '(' and values the corresponding positions of the closing brackets ')'.\n\nFor example: input = \"(first)and(second)\" should return {0:6, 10:17}\n...
[{"input": "\"(a(b)c()d)\"", "output": "[{\"0\": 9, \"2\": 4, \"6\": 7}]", "fn_name": "bracket_pairs"}, {"input": "\"len(list)\"", "output": "[{\"3\": 8}]", "fn_name": "bracket_pairs"}, {"input": "\"f(x[0])\"", "output": "[{\"1\": 6}]", "fn_name": "bracket_pairs"}, {"input": "\"def f(x\"", "output": "[false]", "fn_name...
code_functional
[ { "content": "Addition of Big Integers\n\nGiven two integers $A$ and $B$, compute the sum, $A + B$.\n\nInput\n\nTwo integers $A$ and $B$ separated by a space character are given in a line.\n\nOutput\n\nPrint the sum in a line.\n\nConstraints\n\n* $-1 \\times 10^{100000} \\leq A, B \\leq 10^{100000}$\n\n\n\nSamp...
[{"input": "109 30", "output": "139\n"}, {"input": "195 30", "output": "225\n"}, {"input": "302 30", "output": "332\n"}, {"input": "552 30", "output": "582\n"}, {"input": "139 37", "output": "176\n"}, {"input": "139 39", "output": "178\n"}, {"input": "107 39", "output": "146\n"}, {"input": "107 73", "output": "180\n"},...
code_stdio
[ { "content": "Celebrating the new year, many people post videos of falling dominoes; Here's a list of them: https://www.youtube.com/results?search_query=New+Years+Dominos\n\nUser ainta, who lives in a 2D world, is going to post a video as well.\n\nThere are n dominoes on a 2D Cartesian plane. i-th domino (1 ≤ i...
[{"input": "10\n142699629 183732682\n229190264 203769218\n582937498 331846994\n637776490 872587100\n646511567 582113351\n708368481 242093919\n785185417 665206490\n827596004 933089845\n905276008 416253629\n916536536 583835690\n5\n9 10\n4 9\n1 10\n6 10\n4 5\n", "output": "0\n0\n149978016\n0\n0\n"}, {"input": "10\n1426996...
code_stdio
[ { "content": "George has recently entered the BSUCP (Berland State University for Cool Programmers). George has a friend Alex who has also entered the university. Now they are moving into a dormitory. \n\nGeorge and Alex want to live in the same room. The dormitory has n rooms in total. At the moment the i-th r...
[{"input": "100\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0...
code_stdio
[ { "content": "Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high enough on the search engines. If only he could rename his pr...
[{"input": "3\nAZAMON ALPPE\nAZOMAN ABABILAAAAAAAAAAA\nAPPLE ANAOAB\n", "output": "AAZMON\nAAOMZN\nAEPLP\n"}, {"input": "3\nAZANOM APPLE\nAAZMON ABABILAAAAAAAAAAA\nAPPLF ANANAB\n", "output": "AAZNOM\nAAMZON\nAFPLP\n"}, {"input": "3\nZAAMON APPLE\nAZAMON ABABHLAAAA@AAAAAA\nAPPLF ANANAB\n", "output": "AAZMON\nAAZMON\nAFP...
code_stdio
[ { "content": "Bob is preparing to pass IQ test. The most frequent task in this test is `to find out which one of the given numbers differs from the others`. Bob observed that one number usually differs from the others in **evenness**. Help Bob — to check his answers, he needs a program that among the given numb...
[{"input": "\"9 31 27 93 17 77 75 9 9 53 89 39 51 99 5 1 11 39 27 49 91 17 27 79 81 71 37 75 35 13 93 4 99 55 85 11 23 57 5 43 5 61 15 35 23 91 3 81 99 85 43 37 39 27 5 67 7 33 75 59 13 71 51 27 15 93 51 63 91 53 43 99 25 47 17 71 81 15 53 31 59 83 41 23 73 25 91 9\"", "output": "[32]", "fn_name": "iq_test"}, {"input":...
code_functional
[ { "content": "Kate has a set $S$ of $n$ integers $\\{1, \\dots, n\\} $. \n\nShe thinks that imperfection of a subset $M \\subseteq S$ is equal to the maximum of $gcd(a, b)$ over all pairs $(a, b)$ such that both $a$ and $b$ are in $M$ and $a \\neq b$. \n\nKate is a very neat girl and for each $k \\in \\{2, \\do...
[{"input": "21031\n", "output": "1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
code_stdio
[ { "content": "Chef is fan of pairs and he likes all things that come in pairs. He even has a doll collection in which the dolls come in pairs. One day while going through his collection he found that there are odd number of dolls. Someone had stolen a doll!!! \nHelp chef find which type of doll is missing..\n\...
[{"input": "1\n1\n100 \n3\n1", "output": "100\n"}, {"input": "1\n5\n1\n1\n3\n3\n3", "output": "3\n"}, {"input": "1\n5\n1\n1\n3\n6\n3", "output": "6\n"}, {"input": "1\n5\n1\n1\n2\n2\n5", "output": "5\n"}, {"input": "1\n5\n1\n1\n3\n3\n9", "output": "9\n"}, {"input": "1\n1\n48 \n9\n-1", "output": "48\n"}, {"input": "1\n1\...
code_stdio
[ { "content": "A string is called palindrome if it reads the same from left to right and from right to left. For example \"kazak\", \"oo\", \"r\" and \"mikhailrubinchikkihcniburliahkim\" are palindroms, but strings \"abb\" and \"ij\" are not.\n\nYou are given string s consisting of lowercase Latin letters. At on...
[{"input": "wrwrwfrrfrffrrwwwffffwrfrrwfrrfrwwfwfrwfwfwffwrrwfrrrwwwfrrrwfrrfwrwwrwrrrffffwrrrwrwfffwrffrwwwrwww\n", "output": "fffffffffffffffrrrrrrrrrrrrrrrrrrwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrrrrrrrrrrrrrrrrrrfffffffffffffff\n"}, {"input": "wrwrwfrrfrffrrwwwffffwrfrrwfrrfrwwfwfrwfwfwffwrrwfrrrwwwfrrrwfrrfwrwwrwrrrf...
code_stdio
[ { "content": "You might have heard about our new goodie distribution program aka the \"Laddu Accrual System\". This problem is designed to give you a glimpse of its rules. You can read the page once before attempting the problem if you wish, nonetheless we will be providing all the information needed here itsel...
[{"input": "2\n4 INDIAN\nCONTEST_WON 0\nTOP_CONTRIBUTOR\nBUG_FOUND 110\nCONTEST_HOSTED\n2 NON_INDIAN\nCONTEST_WON -1\nTOP_CONTRIBUTOR\nBUH_FOUND 100\nCONTEST_HOSTED", "output": "3\n1\n"}, {"input": "2\n4 INDIAN\nCONTEST_WON 0\nTOP_CONTRIBUTOR\nBUG_FOUND 110\nCONTEST_HOSTED\n2 NON_INDIAN\nCONTEST_WON -1\nTOP_CONTRIBUTOR...
code_stdio
[ { "content": "The only difference between easy and hard versions are constraints on $n$ and $k$.\n\nYou are messaging in one of the popular social networks via your smartphone. Your smartphone can show at most $k$ most recent conversations with your friends. Initially, the screen is empty (i.e. the number of di...
[{"input": "10 4\n2 3 3 1 1 2 1 4 3 3\n", "output": "4\n4 1 3 2\n"}, {"input": "10 4\n2 3 5 1 1 2 1 4 3 3\n", "output": "4\n4 1 5 3\n"}, {"input": "10 4\n2 3 5 2 1 2 1 4 2 3\n", "output": "4\n3 2 4 1\n"}, {"input": "10 4\n2 3 3 1 1 2 1 2 4 3\n", "output": "4\n4 1 3 2\n"}, {"input": "10 4\n2 3 5 2 1 2 1 4 3 3\n", "outpu...
code_stdio
[ { "content": "According to Berland laws it is only allowed to sell alcohol to people not younger than 18 years. Vasya's job is to monitor the law's enforcement. Tonight he entered a bar and saw n people sitting there. For every one of them Vasya happened to determine either the age or the drink the person is ha...
[{"input": "4\n1475\nKXJURNYJHVLVKULJBPRBCZSOTKNTOGKGFKIQDQEMEAFTPNXQTIQWROI\nKTR\nRHVRWGODYWWTYZFLFYKCVUFFRTQDINKNWPKFHZBFWBHWINWJW\n", "output": "0\n"}, {"input": "4\n1475\nKXJURNYJHVLVKULJBPRBCZSOTKNTOGKGFKIQDQEMEAFTPNXQTIQWROI\nRTK\nRHVRWGODYWWTYZFLFYKCVUFFRTQDINKNWPKFHZBFWBHWINWJW\n", "output": "0\n"}, {"input": "...
code_stdio
[ { "content": "You are given a sequence $a_1, a_2, \\dots, a_n$ consisting of $n$ integers.\n\nYou may perform the following operation on this sequence: choose any element and either increase or decrease it by one.\n\nCalculate the minimum possible difference between the maximum element and the minimum element i...
[{"input": "100 1186\n619 240 80 547 446 128 43 285 725 220 56 690 770 431 777 5 41 549 405 203 2 477 919 481 453 787 680 326 318 241 942 497 504 324 598 925 346 628 851 38 355 493 748 685 901 63 698 676 154 162 313 964 455 617 381 41 479 746 83 253 164 907 950 918 264 307 980 743 257 322 845 419 559 496 434 759 584 95...
code_stdio
[ { "content": "In this problem is used an extremely simplified version of HTML table markup. Please use the statement as a formal document and read it carefully.\n\nA string is a bHTML table, if it satisfies the grammar: \n \n \n \n TABLE ::= <table>ROWS</table> \n ROWS ::= ROW | ROW ROWS \n ...
[{"input": "<table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></t...
code_stdio
[ { "content": "Snuke stands on a number line. He has L ears, and he will walk along the line continuously under the following conditions:\n\n* He never visits a point with coordinate less than 0, or a point with coordinate greater than L.\n* He starts walking at a point with integer coordinate, and also finishes...
[{"input": "7\n180356616\n666988621\n1507983937\n574614921\n254436000\n1351749818\n0", "output": "0\n"}, {"input": "7\n314159265\n429733551\n846264338\n327950288\n419716939\n937510582\n-1", "output": "0\n"}, {"input": "7\n314159265\n274050664\n846264338\n327950288\n419716939\n937510582\n-1", "output": "0\n"}, {"input":...
code_stdio
[ { "content": "In one of the games Arkady is fond of the game process happens on a rectangular field. In the game process Arkady can buy extensions for his field, each extension enlarges one of the field sizes in a particular number of times. Formally, there are n extensions, the i-th of them multiplies the widt...
[{"input": "82424 40643 9 2 200\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
code_stdio
[ { "content": "One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps:\n\n 1. Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; \n 2. Delete the firs...
[{"input": "20 20\n20 1 19 2 18 3 17 4 16 5 15 6 14 7 13 8 12 9 11 10\n", "output": "19\n"}, {"input": "20 10\n1 2 3 4 8 6 7 10 9 10 1 1 1 1 1 1 1 1 1 1\n", "output": "-1\n"}, {"input": "20 10\n1 2 3 4 8 6 7 10 9 10 1 1 1 1 0 1 1 1 1 1\n", "output": "-1\n"}, {"input": "20 10\n1 1 3 4 8 6 7 10 9 10 1 1 1 1 0 1 1 1 1 1\n...
code_stdio
[ { "content": "Mr. A, who will graduate next spring, decided to move when he got a job. The company that finds a job has offices in several towns, and the offices that go to work differ depending on the day. So Mr. A decided to live in a town where he had a short time to go to any office.\n\nSo you decided to fi...
[{"input": "6\n0 1 80\n1 3 20\n0 2 60\n2 4 50\n3 2 66\n0 4 165\n2\n0 1 1\n1 2 1\n0", "output": "2 262\n1 2\n"}, {"input": "6\n0 1 80\n1 3 20\n0 2 60\n2 4 50\n3 2 66\n0 4 165\n2\n0 1 1\n0 2 1\n0", "output": "2 262\n0 2\n"}, {"input": "6\n0 1 113\n1 4 20\n0 2 60\n2 2 47\n3 4 66\n1 4 90\n2\n0 1 1\n1 2 1\n0", "output": "1 ...
code_stdio
[ { "content": "Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were the first integer is the number of vertices adjacent to v...
[{"input": "19\n1 13\n0 0\n1 9\n1 11\n1 11\n2 3\n2 30\n0 0\n1 5\n1 2\n0 0\n5 29\n1 6\n2 11\n0 0\n0 0\n0 0\n0 0\n2 13\n", "output": "10\n0 13\n2 9\n3 11\n4 11\n8 5\n12 6\n13 11\n5 11\n6 18\n11 18\n"}, {"input": "18\n0 0\n0 0\n2 19\n1 2\n2 29\n0 0\n1 7\n1 6\n1 12\n1 13\n0 0\n1 12\n4 23\n1 9\n0 0\n0 0\n2 14\n1 4\n", "outp...
code_stdio
[ { "content": "B: Dansunau www --Dance Now!-\n\nstory\n\nLast lab life! Daigakuin! !! Dosanko Snow has won 9th place in the event \"Master Idol World\", which can be said to be the outpost of the biggest competition \"Lab Life\" where master idols compete. The sharp dance is ridiculed as \"9th place dance\", and...
[{"input": "9\n9 8 7 6 9 5 3 2 1\n1 1 1\n3 4 2\n4 3 3\n4 0 4\n5 10 5\n12 9 7\n7 7 7\n8 11 8\n9 11 9", "output": "3\n"}, {"input": "9\n9 8 7 6 9 5 3 2 1\n1 1 1\n3 4 2\n4 3 3\n4 0 4\n5 10 5\n12 9 7\n7 7 7\n8 8 8\n9 11 9", "output": "3\n"}, {"input": "9\n9 8 7 6 9 5 3 2 1\n1 1 1\n3 4 2\n8 3 3\n4 0 4\n5 10 5\n12 9 7\n7 7 7...
code_stdio
[ { "content": "Write a function that takes a positive integer and returns the next smaller positive integer containing the same digits.\n\nFor example:\n\n```python\nnext_smaller(21) == 12\nnext_smaller(531) == 513\nnext_smaller(2071) == 2017\n```\n\nReturn -1 (for `Haskell`: return `Nothing`, for `Rust`: return...
[{"input": "59884848483559", "output": "[59884848459853]", "fn_name": "next_smaller"}, {"input": "51226262651257", "output": "[51226262627551]", "fn_name": "next_smaller"}, {"input": "1234567908", "output": "[1234567890]", "fn_name": "next_smaller"}, {"input": "123456798", "output": "[123456789]", "fn_name": "next_smal...
code_functional
[ { "content": "problem\n\nFive students, Taro, Jiro, Saburo, Shiro, and Hanako, participated in the JOI High School class.\n\nIn this class, a final exam was conducted. All five people took the final exam. For students with a final exam score of 40 or higher, the final exam score was used as is. All students wit...
[{"input": "10\n130\n100\n37\n101", "output": "82\n"}, {"input": "10\n130\n100\n65\n101", "output": "87\n"}, {"input": "10\n130\n100\n98\n101", "output": "93\n"}, {"input": "10\n130\n110\n98\n100", "output": "95\n"}, {"input": "10\n130\n111\n98\n000", "output": "83\n"}, {"input": "10\n100\n111\n225\n4", "output": "103\...
code_stdio
[ { "content": "Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given a and b.\n\nConstraints\n\n* 0 < a, b ≤ 2,000,000,000\n* LCM(a, b) ≤ 2,000,000,000\n* The number of data sets ≤ 50\n\nInput\n\nInput consists of several data sets. Each data set contains a...
[{"input": "34 12\n234598000 42842091", "output": "2 204\n1 10050668864418000\n"}, {"input": "34 12\n234598000 60832539", "output": "2 204\n1 14271191984322000\n"}, {"input": "34 9\n234598000 42842091", "output": "1 306\n1 10050668864418000\n"}, {"input": "13 24\n38128567 122348608", "output": "1 312\n1 466497709748473...
code_stdio
[ { "content": "You have a string s = s_1s_2...s_{|}s|, where |s| is the length of string s, and s_{i} its i-th character. \n\nLet's introduce several definitions: A substring s[i..j] (1 ≤ i ≤ j ≤ |s|) of string s is string s_{i}s_{i} + 1...s_{j}. The prefix of string s of length l (1 ≤ l ≤ |s|) is string s[1.....
[{"input": "AAAAAAAAAAAAAAAAXAAAAAAAAAAAAAAAAAAAAAAA\n", "output": "17\n1 39\n2 37\n3 35\n4 33\n5 31\n6 29\n7 27\n8 25\n9 23\n10 21\n11 19\n12 17\n13 15\n14 13\n15 11\n16 9\n40 1\n"}, {"input": "AAAAAAAAAAAAAAAAXAAAAAAAAAAAAAAAAAAAAAAA\n", "output": "17\n1 39\n2 37\n3 35\n4 33\n5 31\n6 29\n7 27\n8 25\n9 23\n10 21\n11 1...
code_stdio
[ { "content": "You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room.\n\nFor each notice, you are given four integers b, f, r and v which represent that v persons ent...
[{"input": "3\n-1 1 10 18\n3 3 6 20\n4 3 8 -1", "output": " 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n####################\n 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0 0 0 0\n####################\n 0 0 0 0 0 0 0 0 0 18\n 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 20 0 0 0 0\n#################...
code_stdio
[ { "content": "Takahashi has a lot of peculiar devices. These cylindrical devices receive balls from left and right. Each device is in one of the two states A and B, and for each state, the device operates as follows:\n\n* When a device in state A receives a ball from either side (left or right), the device thro...
[{"input": "4 123456789\nAABA", "output": "BABA\n"}, {"input": "4 110986646\nAABB", "output": "BABA\n"}, {"input": "4 123456789\nAAAA", "output": "BABA\n"}, {"input": "4 110986646\nBABA", "output": "BABA\n"}, {"input": "4 164919271\nBAAA", "output": "BABA\n"}, {"input": "4 219940491\nBAAA", "output": "BABA\n"}, {"input...
code_stdio
[ { "content": "See the following triangle:\n```\n____________________________________\n 1 \n 2 4 2 \n 3 6 9 6 3 \n 4 8 12 16 12 8 4 \n 5 10 15 20 25 20 15 10 5 \n ___________________...
[{"input": "50", "output": "[[1625625, 1235000, 390625]]", "fn_name": "mult_triangle"}, {"input": "10", "output": "[[3025, 2400, 625]]", "fn_name": "mult_triangle"}, {"input": "5", "output": "[[225, 144, 81]]", "fn_name": "mult_triangle"}, {"input": "4", "output": "[[100, 84, 16]]", "fn_name": "mult_triangle"}, {"input...
code_functional
[ { "content": "Step through my `green glass door`.\n\nYou can take the `moon`, but not the `sun`.\n\nYou can take your `slippers`, but not your `sandals`.\n\nYou can go through `yelling`, but not `shouting`.\n\nYou can't run through `fast`, but you can run with `speed`.\n\nYou can take a `sheet`, but not your `b...
[{"input": "\"airplane\"", "output": "[false]", "fn_name": "step_through_with"}, {"input": "\"aardvark\"", "output": "[true]", "fn_name": "step_through_with"}, {"input": "\"glasses\"", "output": "[true]", "fn_name": "step_through_with"}, {"input": "\"branch\"", "output": "[false]", "fn_name": "step_through_with"}, {"in...
code_functional
[ { "content": "You are given a string S of length 2N, containing N occurrences of `a` and N occurrences of `b`.\n\nYou will choose some of the characters in S. Here, for each i = 1,2,...,N, it is not allowed to choose exactly one of the following two: the i-th occurrence of `a` and the i-th occurrence of `b`. (T...
[{"input": "9\nbbbbbaaaababbaabaa", "output": "bbbbbaaaababbaabaa\n"}, {"input": "9\nbbbbbabaabbaaabaaa", "output": "bbbbbabaabbaaabaaa\n"}, {"input": "9\nabbbbabaababaabbaa", "output": "bbbabaababaabbaa\n"}, {"input": "9\nabbbbabaaabbabaaba", "output": "bbbabaaabbabaaba\n"}, {"input": "9\nabbbbabaabababaaab", "output"...
code_stdio
[ { "content": "10^{10^{10}} participants, including Takahashi, competed in two programming contests.\nIn each contest, all participants had distinct ranks from first through 10^{10^{10}}-th.\nThe score of a participant is the product of his/her ranks in the two contests.\nProcess the following Q queries:\n - In ...
[{"input": "99\n207579013 207579013\n376140463 376140463\n186969586 186969586\n326402540 326402540\n158176573 158176573\n127860890 127860890\n570870045 570870045\n178509023 178509023\n61263305 61263305\n558212775 558212775\n26389630 26389630\n496148000 496148000\n837151741 837151741\n656585276 656585276\n902071051 9020...
code_stdio
[ { "content": "After you had helped Fedor to find friends in the «Call of Soldiers 3» game, he stopped studying completely. Today, the English teacher told him to prepare an essay. Fedor didn't want to prepare the essay, so he asked Alex for help. Alex came to help and wrote the essay for Fedor. But Fedor didn't...
[{"input": "2\nABBABAABBAABABBABAABABBAABBABAABBAABABBAABBABAABABBABAABBAABABBA ABBABAABBAABABBABAABABBAABBABAABBAABABBAABBABAABABBABAABBAABABA\n2\nABBABAABBAABABBABAABABBAABBABAAABAABABBAABBABAABABBABAABBAABABA neuzaiheshi\nABBABAABBAABABBABAABABBAABBABAABBAABABBAABBABAABABBABAABBAABABBA ABBABAABBAABABBABAABABBAABBABA...
code_stdio
[ { "content": "Gerald has been selling state secrets at leisure. All the secrets cost the same: n marks. The state which secrets Gerald is selling, has no paper money, only coins. But there are coins of all positive integer denominations that are powers of three: 1 mark, 3 marks, 9 marks, 27 marks and so on. The...
[{"input": "243\n", "output": " 1\n"}, {"input": "108\n", "output": " 2\n"}, {"input": "81\n", "output": " 1\n"}, {"input": "10\n", "o...
code_stdio
[ { "content": "N of us are going on a trip, by train or taxi.\nThe train will cost each of us A yen (the currency of Japan).\nThe taxi will cost us a total of B yen.\nHow much is our minimum total travel expense?\n\n-----Constraints-----\n - All values in input are integers.\n - 1 \\leq N \\leq 20\n - 1 \\leq A ...
[{"input": "12 -13 -107", "output": "-156\n"}, {"input": "-1719 1 -2", "output": "-1719\n"}, {"input": "10 -2 -141", "output": "-141\n"}, {"input": "10 -2 -162", "output": "-162\n"}, {"input": "10 -7 -107", "output": "-107\n"}, {"input": "19 -7 -107", "output": "-133\n"}, {"input": "13 -13 -48", "output": "-169\n"}, {"...
code_stdio
[ { "content": "Pari wants to buy an expensive chocolate from Arya. She has n coins, the value of the i-th coin is c_{i}. The price of the chocolate is k, so Pari will take a subset of her coins with sum equal to k and give it to Arya.\n\nLooking at her coins, a question came to her mind: after giving the coins t...
[{"input": "9 436\n1 2 4 8 14 32 27 128 256\n", "output": "160\n0 1 2 3 4 6 8 9 10 11 14 15 16 17 18 20 22 23 24 25 27 28 29 30 32 34 35 36 37 38 41 42 43 44 46 48 49 50 51 52 128 129 130 131 132 134 136 137 138 139 142 143 144 145 146 148 150 151 152 153 155 156 157 158 160 162 163 164 165 166 169 170 171 172 174 176 ...
code_stdio
[ { "content": "Write a program which reads three integers a, b and c, and prints \"Yes\" if a < b < c, otherwise \"No\".\n\nConstraints\n\n* 0 ≤ a, b, c ≤ 100\n\nInput\n\nThree integers a, b and c separated by a single space are given in a line.\n\nOutput\n\nPrint \"Yes\" or \"No\" in a line.\n\nExamples\n\nInpu...
[{"input": "-1 -1 -1", "output": "No\n"}, {"input": "-1 -1 -2", "output": "No\n"}, {"input": "18 10 10", "output": "No\n"}, {"input": "-1 0 2", "output": "Yes\n"}, {"input": "-1 -1 2", "output": "No\n"}, {"input": "-1 -1 1", "output": "No\n"}, {"input": "-1 -1 0", "output": "No\n"}, {"input": "18 16 5", "output": "No\n...
code_stdio
[ { "content": "A population of bears consists of black bears, brown bears, and white bears.\n\nThe input is an array of two elements. \n\nDetermine whether the offspring of the two bears will return `'black'`, `'brown'`, `'white'`, `'dark brown'`, `'grey'`, `'light brown'`, or `'unknown'`.\n\nElements in the the...
[{"input": "[\"white\", \"brown\"]", "output": "[\"light brown\"]", "fn_name": "bear_fur"}, {"input": "[\"black\", \"brown\"]", "output": "[\"dark brown\"]", "fn_name": "bear_fur"}, {"input": "[\"pink\", \"black\"]", "output": "[\"unknown\"]", "fn_name": "bear_fur"}, {"input": "[\"black\", \"black\"]", "output": "[\"bl...
code_functional
[ { "content": "You're given an array $a$. You should repeat the following operation $k$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.\n\n\n-----Input-----\n\nThe first line contains inte...
[{"input": "50 48\n26 87 99 27 2 2 94 10 21 9 6 7 85 10 66 56 16 55 101 51 16 151 100 28 93 70 33 84 50 87 55 36 93 84 63 94 119 2 42 84 37 54 34 76 38 78 14 21 6 4\n", "output": "2\n2\n2\n1\n2\n1\n4\n2\n5\n5\n1\n1\n5\n1\n2\n1\n1\n4\n8\n1\n3\n1\n1\n7\n3\n4\n6\n2\n6\n1\n2\n6\n1\n5\n1\n1\n18\n32\n0\n0\n0\n0\n0\n0\n0\n0\n...
code_stdio
[ { "content": "Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.\n\nAt first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however...
[{"input": "2\n3\nnetman vladik Fedosik\n2\n?: users are netman, vladik, kisodeF\nvladik: something wrong with shis chat\n4\nnetman tigerrrrr banany2001 klinchuh\n4\n?: tigerrrrr, banany2001, klinchuh- my favourite team evdr, are you ready?\nklinchuh: xes, coach!\n?: yes, netman\nbanany2001: yes of .esruoc\n", "output"...
code_stdio
[ { "content": "Arithmetic Progressions\n\nAn arithmetic progression is a sequence of numbers $a_1, a_2, ..., a_k$ where the difference of consecutive members $a_{i+1} - a_i$ is a constant ($1 \\leq i \\leq k-1$). For example, the sequence 5, 8, 11, 14, 17 is an arithmetic progression of length 5 with the common ...
[{"input": "6\n-2 11 12 30 3 0", "output": "2\n"}, {"input": "6\n-4 1 6 2 13 -1", "output": "3\n"}, {"input": "6\n-2 1 -1 8 13 9", "output": "2\n"}, {"input": "6\n-2 11 5 20 8 0", "output": "3\n"}, {"input": "6\n-2 11 6 20 8 0", "output": "2\n"}, {"input": "6\n-2 11 6 20 3 0", "output": "3\n"}, {"input": "6\n-2 11 6 30...
code_stdio
[ { "content": "A triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\n-----Constraints-----\n - A, B, and C are all integers betw...
[{"input": "1 -2 -2", "output": "Yes\n"}, {"input": "0 -2 -2", "output": "Yes\n"}, {"input": "5 7 5\n", "output": "Yes\n"}, {"input": "3 3 4\n", "output": "Yes\n"}, {"input": "6 1 6\n", "output": "Yes\n"}, {"input": "8 8 2\n", "output": "Yes\n"}, {"input": "9 1 1\n", "output": "Yes\n"}, {"input": "7 8 8\n", "output": "...
code_stdio