messages
listlengths
1
1
ground_truth
stringlengths
156
726k
dataset
stringclasses
2 values
[ { "content": "You are given an array $a$ of length $n$ consisting of integers. You can apply the following operation, consisting of several steps, on the array $a$ zero or more times:\n\nyou select two different numbers in the array $a_i$ and $a_j$;\n\nyou remove $i$-th and $j$-th elements from the array.\n\nFo...
[{"input": "5\n6\n1 6 1 1 4 4\n2\n1 2\n2\n1 1\n5\n4 5 4 5 4\n6\n2 3 2 1 3 1\n", "output": "\n0\n0\n2\n1\n0\n"}, {"input": "5\n6\n1 6 1 1 4 4\n2\n1 2\n2\n1 1\n5\n4 5 4 5 4\n6\n2 3 2 1 3 1\n", "output": "0\n0\n2\n1\n0\n"}, {"input": "5\n6\n2 6 1 1 4 4\n2\n1 2\n2\n1 1\n5\n4 5 4 5 4\n6\n2 3 2 1 3 1\n", "output": "0\n0\n2\n...
code_stdio
[ { "content": "You are given n patterns p_1, p_2, ..., p_n and m strings s_1, s_2, ..., s_m. Each pattern p_i consists of k characters that are either lowercase Latin letters or wildcard characters (denoted by underscores). All patterns are pairwise distinct. Each string s_j consists of k lowercase Latin letters...
[{"input": "10 10 4\n_a_c\n_aac\nb__a\n__cb\nab__\n__ab\n_c__\n____\n_bbd\nb_bc\nbcbc 8\nabac 8\ncadc 8\ncaac 8\ndaab 8\naccb 8\ncbcd 8\nabbd 8\nbdba 8\nbcac 8\n", "output": "YES\n8 9 10 7 6 5 4 3 2 1 \n"}, {"input": "10 10 4\n_a_c\n_aac\nb__a\n__cb\nab__\n__ab\n_c__\n____\n_bbd\nb_bc\nbcbc 8\nabac 8\ncadc 8\ncaac 8\nd...
code_stdio
[ { "content": "You are given a set of points on a straight line. Each point has a color assigned to it. For point a, its neighbors are the points which don't have any other points between them and a. Each point has at most two neighbors - one from the left and one from the right.\n\nYou perform a sequence of ope...
[{"input": "aaaaaaaaabbbbbaaaabaaaaaaaaaaaaaaaaabaaaaaabbbbbbbaaabbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "12\n"}, {"input": "bbbbbbbbbbbbbbbbbbbbbbddddddddddddddddaaaaaaaaaaaaaccccccccbbbbbbbaaaaaaaaaabbbbbbbbaaaaaaaaaacccccc\n", "output": "11\n"}, {"input": "bbbbbbbbbbbbbbbbbbbbbbbbbbdddddddddddd...
code_stdio
[ { "content": "Given is a positive integer N.\nWe will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.\n - Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.\nIn how many choices of K will N become 1 in the end?\n\n-...
[{"input": "1000000000000\n", "output": "266\n"}, {"input": "523968956449\n", "output": "385\n"}, {"input": "145329450841\n", "output": "289\n"}, {"input": "642507465600\n", "output": "12\n"}, {"input": "540024979445\n", "output": "12\n"}, {"input": "962623690081\n", "output": "96\n"}, {"input": "171518565905\n", "outp...
code_stdio
[ { "content": "During a New Year special offer the \"Sudislavl Bars\" offered n promo codes. Each promo code consists of exactly six digits and gives right to one free cocktail at the bar \"Mosquito Shelter\". Of course, all the promocodes differ.\n\nAs the \"Mosquito Shelter\" opens only at 9, and partying in S...
[{"input": "58\n145410\n686144\n766870\n859775\n922809\n470967\n034349\n318920\n019664\n667953\n295078\n908733\n691385\n774622\n325695\n443254\n817406\n984471\n512092\n635832\n303546\n189826\n128551\n720334\n569318\n377719\n281502\n956352\n758447\n207280\n583935\n246631\n160045\n452683\n594100\n806017\n232727\n673001\n...
code_stdio
[ { "content": "For a given sequence $A = \\\\{a_0, a_1, ..., a_{n-1}\\\\}$ which is sorted by ascending order, find a specific value $k$ given as a query.\n\nConstraints\n\n* $1 \\leq n \\leq 100,000$\n* $1 \\leq q \\leq 200,000$\n* $0 \\leq a_0 \\leq a_1 \\leq ... \\leq a_{n-1} \\leq 1,000,000,000$\n* $0 \\leq ...
[{"input": "4\n-1 0 1 4\n3\n-3\n4\n14", "output": "0\n1\n0\n"}, {"input": "4\n-1 0 1 4\n3\n-2\n4\n14", "output": "0\n1\n0\n"}, {"input": "4\n-1 0 1 4\n3\n-4\n4\n14", "output": "0\n1\n0\n"}, {"input": "4\n-1 0 1 4\n3\n-4\n0\n14", "output": "0\n1\n0\n"}, {"input": "4\n-1 0 1 4\n3\n-4\n1\n14", "output": "0\n1\n0\n"}, {"in...
code_stdio
[ { "content": "Squirrel Liss is interested in sequences. She also has preferences of integers. She thinks n integers a1, a2, ..., an are good.\n\nNow she is interested in good sequences. A sequence x1, x2, ..., xk is called good if it satisfies the following three conditions:\n\n * The sequence is strictly incr...
[{"input": "49\n10 34 58 72 126 166 176 180 198 200 208 228 238 248 302 332 340 344 350 354 380 406 418 428 438 442 482 532 536 544 546 554 596 626 642 682 684 704 714 792 804 820 862 880 906 946 954 966 970\n", "output": "49\n"}, {"input": "44\n1 5 37 97 107 147 185 187 195 241 249 295 311 323 341 345 363 391 425 431 ...
code_stdio
[ { "content": "Polycarp knows that if the sum of the digits of a number is divisible by $3$, then the number itself is divisible by $3$. He assumes that the numbers, the sum of the digits of which is divisible by $4$, are also somewhat interesting. Thus, he considers a positive integer $n$ interesting if its sum...
[{"input": "1000\n", "output": "1003\n"}, {"input": "1000\n", "output": "1003\n"}, {"input": "997\n", "output": "1003\n"}, {"input": "999\n", "output": "1003\n"}, {"input": "997\n", "output": "1003\n"}, {"input": "999\n", "output": "1003\n"}, {"input": "432\n", "output": "435\n"}, {"input": "237\n", "output": "237\n"},...
code_stdio
[ { "content": "Takahashi has A untasty cookies containing antidotes, B tasty cookies containing antidotes and C tasty cookies containing poison.\n\nEating a cookie containing poison results in a stomachache, and eating a cookie containing poison while having a stomachache results in a death. As he wants to live,...
[{"input": "-2 -101 -9", "output": "-203\n"}, {"input": "-1 -101 -1", "output": "-202\n"}, {"input": "-1 -5 -143", "output": "-148\n"}, {"input": "-2 -74 -4", "output": "-149\n"}, {"input": "-2 -82 -4", "output": "-165\n"}, {"input": "0 -101 -1", "output": "-201\n"}, {"input": "1 -2 -180", "output": "-182\n"}, {"input"...
code_stdio
[ { "content": "In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \\dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. (Takoyaki is the name of a Japanese snac...
[{"input": "314159265358979323846264338327950288419716939937551058209749445923078164062862089986280348253421170\n", "output": "243\n"}, {"input": "476640020082194381531155118436783393866726953614433851622190777875571135215042541028243752681838573", "output": "259\n"}, {"input": "4024190595003667858693588822821631596741...
code_stdio
[ { "content": "Bob has a favorite number k and ai of length n. Now he asks you to answer m queries. Each query is given by a pair li and ri and asks you to count the number of pairs of integers i and j, such that l ≀ i ≀ j ≀ r and the xor of the numbers ai, ai + 1, ..., aj is equal to k.\n\nInput\n\nThe first li...
[{"input": "5 3 1\n0 1 1 1 1\n1 5\n2 4\n1 3\n", "output": "8\n4\n3\n"}, {"input": "5 3 1\n0 1 1 1 1\n1 5\n2 4\n1 2\n", "output": "8\n4\n2\n"}, {"input": "5 3 0\n0 1 1 1 1\n1 5\n2 4\n1 2\n", "output": "7\n2\n1\n"}, {"input": "5 3 1\n0 1 2 1 1\n1 5\n2 4\n1 2\n", "output": "4\n2\n2\n"}, {"input": "5 3 1\n0 1 2 1 1\n1 5\n3...
code_stdio
[ { "content": "Let's denote a function $f(x)$ in such a way: we add $1$ to $x$, then, while there is at least one trailing zero in the resulting number, we remove that zero. For example, $f(599) = 6$: $599 + 1 = 600 \\rightarrow 60 \\rightarrow 6$; $f(7) = 8$: $7 + 1 = 8$; $f(9) = 1$: $9 + 1 = 10 \\rightarro...
[{"input": "1000000000\n", "output": "91\n"}, {"input": "1000000000\n", "output": "91\n"}, {"input": "1472811722\n", "output": "57\n"}, {"input": "1660033091\n", "output": "63\n"}, {"input": "1100000000\n", "output": "90\n"}, {"input": "1516433257\n", "output": "55\n"}, {"input": "932415950\n", "output": "53\n"}, {"inp...
code_stdio
[ { "content": "Implement the function which should return `true` if given object is a vowel (meaning `a, e, i, o, u`), and `false` otherwise.\n\nWrite Python code to solve this problem. Define a top-level function named `is_vowel` that takes the input arguments described above and returns the answer directly -- ...
[{"input": "\"lol\"", "output": "[false]", "fn_name": "is_vowel"}, {"input": "\"ou\"", "output": "[false]", "fn_name": "is_vowel"}, {"input": "\"z\"", "output": "[false]", "fn_name": "is_vowel"}, {"input": "\"\"", "output": "[false]", "fn_name": "is_vowel"}, {"input": "\"a\"", "output": "[true]", "fn_name": "is_vowel"}...
code_functional
[ { "content": "Vasya's bicycle chain drive consists of two parts: n stars are attached to the pedal axle, m stars are attached to the rear wheel axle. The chain helps to rotate the rear wheel by transmitting the pedal rotation.\n\nWe know that the i-th star on the pedal axle has ai (0 < a1 < a2 < ... < an) teeth...
[{"input": "50\n159 880 1070 1139 1358 1608 1691 1841 2073 2171 2213 2597 2692 2759 2879 2931 3173 3217 3441 4201 4878 5106 5129 5253 5395 5647 5968 6019 6130 6276 6286 6330 6409 6728 7488 7713 7765 7828 7899 8064 8264 8457 8483 8685 8900 8946 8965 9133 9187 9638\n45\n57 159 1070 1139 1391 1608 1691 1841 2171 2213 2692...
code_stdio
[ { "content": "Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:\n\n if the character $w_{i-x}$ exists a...
[{"input": "3\n100110\n2\n01\n1\n111\n1\n", "output": "011001\n10\n111\n"}, {"input": "3\n100110\n2\n01\n1\n101\n1\n", "output": "011001\n10\n010\n"}, {"input": "3\n100110\n2\n01\n0\n101\n1\n", "output": "011001\n01\n010\n"}, {"input": "3\n111110\n1\n01\n0\n101\n1\n", "output": "111101\n01\n010\n"}, {"input": "3\n10010...
code_stdio
[ { "content": "A number is called powerful if it is a power of two or a factorial. In other words, the number $m$ is powerful if there exists a non-negative integer $d$ such that $m=2^d$ or $m=d!$, where $d!=1\\cdot 2\\cdot \\ldots \\cdot d$ (in particular, $0! = 1$). For example $1$, $4$, and $6$ are powerful n...
[{"input": "100\n101\n102\n103\n104\n105\n106\n107\n108\n109\n110\n111\n112\n113\n114\n115\n116\n117\n118\n119\n120\n121\n122\n123\n124\n125\n126\n127\n128\n129\n130\n131\n132\n133\n134\n135\n136\n137\n138\n139\n140\n141\n142\n143\n144\n145\n146\n147\n148\n149\n150\n151\n152\n153\n154\n155\n156\n157\n158\n159\n160\n161...
code_stdio
[ { "content": "Theatre Square in the capital city of Berland has a rectangular shape with the size n Γ— m meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each flagstone is of the size a Γ— a.\n\nWhat is the least number of flagstones needed...
[{"input": "1000000000 1000000000 1\n", "output": "1000000000000000000\n"}, {"input": "1000000000 987654321 1\n", "output": "987654321000000000\n"}, {"input": "1000000000 989104164 1\n", "output": "989104164000000000\n"}, {"input": "1000000000 980932347 1\n", "output": "980932347000000000\n"}, {"input": "1000000000 100...
code_stdio
[ { "content": "You're given an array $b$ of length $n$. Let's define another array $a$, also of length $n$, for which $a_i = 2^{b_i}$ ($1 \\leq i \\leq n$). \n\nValerii says that every two non-intersecting subarrays of $a$ have different sums of elements. You want to determine if he is wrong. More formally, you ...
[{"input": "2\n6\n4 3 0 1 2 0\n2\n2 5\n", "output": "YES\nNO\n"}, {"input": "2\n6\n0 3 0 1 2 0\n2\n2 5\n", "output": "YES\nNO\n"}, {"input": "2\n6\n4 3 0 1 2 0\n2\n4 5\n", "output": "YES\nNO\n"}, {"input": "2\n6\n4 3 0 1 2 0\n2\n4 3\n", "output": "YES\nNO\n"}, {"input": "2\n6\n4 3 0 1 2 0\n2\n4 6\n", "output": "YES\nNO...
code_stdio
[ { "content": "F: Tea Party\n\nYun decided to hold a tea party at the company.\n\nThe shop sells $ N $ sets of bread, each containing $ A_1, A_2, A_3, \\ dots, A_N $.\n\nYun decided to make a sandwich by combining two breads into a pair.\n\nYun-san is very careful, so I want to make sure that I don't have any le...
[{"input": "5\n11 1 59 18 30", "output": "59\n"}, {"input": "5\n4 0 13 10 17", "output": "22\n"}, {"input": "5\n7 4 11 10 10", "output": "21\n"}, {"input": "5\n4 0 35 14 17", "output": "35\n"}, {"input": "5\n30 21 2 0 15", "output": "34\n"}, {"input": "5\n4 0 35 17 30", "output": "43\n"}, {"input": "5\n30 21 3 0 15", "...
code_stdio
[ { "content": "On the Planet AtCoder, there are four types of bases: A, C, G and T. A bonds with T, and C bonds with G.\nYou are given a letter b as input, which is A, C, G or T. Write a program that prints the letter representing the base that bonds with the base b.\n\n-----Constraints-----\n - b is one of the ...
[{"input": "A\n", "output": "T\n"}, {"input": "G\n", "output": "C\n"}, {"input": "C\n", "output": "G\n"}, {"input": "T\n", "output": "A\n"}, {"input": "C", "output": "G\n"}, {"input": "T", "output": "A\n"}, {"input": "C", "output": "G\n"}, {"input": "T", "output": "A\n"}, {"input": "G", "output": "C"}, {"input": "A", "...
code_stdio
[ { "content": "When Mr. Kay was browsing a certain SNS as usual, the problem that \"there are people who can solve IQ150 or more\" came to the timeline. Mr. Kay has an IQ of over 150, so he solved the problem in an instant without even looking at it. For him, he doesn't have to work on such a mystery. It is enou...
[{"input": "2286", "output": "3\n"}, {"input": "1020", "output": "2\n"}, {"input": "1809", "output": "1\n"}, {"input": "2465", "output": "0\n"}, {"input": "4598", "output": "2\n"}, {"input": "4112", "output": "2\n"}, {"input": "2725", "output": "0\n"}, {"input": "3645", "output": "1\n"}, {"input": "2071", "output": "0\...
code_stdio
[ { "content": "You've gotten an n Γ— m sheet of squared paper. Some of its squares are painted. Let's mark the set of all painted squares as A. Set A is connected. Your task is to find the minimum number of squares that we can delete from set A to make it not connected.\n\nA set of painted squares is called conne...
[{"input": "20 20\n.....######.........\n.....#....#.........\n.....#....#.........\n.....#....#.........\n.....############...\n.........##.....#...\n..........#.....#...\n..........#.....#...\n..........###...#...\n............#...#...\n............#...#...\n............#...#...\n............#...#...\n............###...
code_stdio
[ { "content": "Takahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n - If Takahashi has one or more cookies, eat one of his cookies.\n - Otherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n - If they both have no cookies, do nothing.\nIn the end, ...
[{"input": "498881727339 49011419508 0000000100000", "output": "498881627339 49011419508\n"}, {"input": "498881727339 49011419508 0000001100000", "output": "498880627339 49011419508\n"}, {"input": "498881727339 50858735181 0000001100000", "output": "498880627339 50858735181\n"}, {"input": "498881727339 64133142411 0000...
code_stdio
[ { "content": "Write a program which prints $n$-th fibonacci number for a given integer $n$. The $n$-th fibonacci number is defined by the following recursive formula:\n\n\\begin{equation*} fib(n)= \\left \\\\{ \\begin{array}{ll} 1 & (n = 0) \\\\\\ 1 & (n = 1) \\\\\\ fib(n - 1) + fib(n - 2) & \\\\\\ \\end{array}...
[{"input": "44", "output": "1134903170\n"}, {"input": "44", "output": "1134903170\n"}, {"input": "41", "output": "267914296\n"}, {"input": "42", "output": "433494437\n"}, {"input": "43", "output": "701408733\n"}, {"input": "39", "output": "102334155\n"}, {"input": "40", "output": "165580141\n"}, {"input": "43", "output...
code_stdio
[ { "content": "# Task\n You are given a decimal number `n` as a **string**. Transform it into an array of numbers (given as **strings** again), such that each number has only one nonzero digit and their sum equals n.\n\n Each number in the output array should be written without any leading and trailing zeros.\n\...
[{"input": "\"1234567890.1234567890\"", "output": "[[\"1000000000\", \"200000000\", \"30000000\", \"4000000\", \"500000\", \"60000\", \"7000\", \"800\", \"90\", \".1\", \".02\", \".003\", \".0004\", \".00005\", \".000006\", \".0000007\", \".00000008\", \".000000009\"]]", "fn_name": "split_exp"}, {"input": "\"7970521.55...
code_functional
[ { "content": "Everlasting Sa-Ga, a new, hot and very popular role-playing game, is out on October 19, 2008. Fans have been looking forward to a new title of Everlasting Sa-Ga.\n\nLittle Jimmy is in trouble. He is a seven-year-old boy, and he obtained the Everlasting Sa-Ga and is attempting to reach the end of t...
[{"input": "10 24\n30 20\n0 0", "output": "a\nb\n"}, {"input": "19 24\n30 20\n0 0", "output": "a\nb\n"}, {"input": "10 3\n11 106\n0 0", "output": "b\nb\n"}, {"input": "10 3\n11 150\n0 0", "output": "b\na\n"}, {"input": "10 15\n58 20\n0 0", "output": "a\na\n"}, {"input": "11 24\n30 20\n0 0", "output": "a\nb\n"}, {"input...
code_stdio
[ { "content": "Tanechka is shopping in the toy shop. There are exactly $n$ toys in the shop for sale, the cost of the $i$-th toy is $i$ burles. She wants to choose two toys in such a way that their total cost is $k$ burles. How many ways to do that does she have?\n\nEach toy appears in the shop exactly once. Pai...
[{"input": "100000000000000 100000000000000\n", "output": "49999999999999\n"}, {"input": "100000000000000 100000000000000\n", "output": "49999999999999\n"}, {"input": "100000000010000 100000000000000\n", "output": "49999999999999\n"}, {"input": "105925489085800 100000000001000\n", "output": "50000000000499\n"}, {"input...
code_stdio
[ { "content": "There are N integers written on a blackboard. The i-th integer is A_i, and the greatest common divisor of these integers is 1.\n\nTakahashi and Aoki will play a game using these integers. In this game, starting from Takahashi the two player alternately perform the following operation:\n\n* Select ...
[{"input": "5\n7 2 10 12 2", "output": "Second\n"}, {"input": "5\n7 8 4 5 11", "output": "Second\n"}, {"input": "5\n7 2 8 8 8", "output": "Second\n"}, {"input": "4\n0 -1 1 22", "output": "Second\n"}, {"input": "4\n-1 0 1 22", "output": "Second\n"}, {"input": "5\n7 8 4 8 11", "output": "First\n"}, {"input": "5\n7 2 8 12...
code_stdio
[ { "content": "In this Kata, you will be given a number `n` (`n > 0`) and your task will be to return the smallest square number `N` (`N > 0`) such that `n + N` is also a perfect square. If there is no answer, return `-1` (`nil` in Clojure, `Nothing` in Haskell, `None` in Rust). \n\n```clojure \nsolve 13 = 36\n;...
[{"input": "290101", "output": "[429235524]", "fn_name": "solve"}, {"input": "88901", "output": "[5428900]", "fn_name": "solve"}, {"input": "10", "output": "[-1]", "fn_name": "solve"}, {"input": "11", "output": "[25]", "fn_name": "solve"}, {"input": "13", "output": "[36]", "fn_name": "solve"}, {"input": "17", "output":...
code_functional
[ { "content": "A game is played on a strip consisting of N cells consecutively numbered from 1 to N.\n\nAlice has her token on cell A. Borys has his token on a different cell B.\n\nPlayers take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell...
[{"input": "-1 -1 -1", "output": "Alice\n"}, {"input": "9 23 42", "output": "Borys\n"}, {"input": "9 23 18", "output": "Borys\n"}, {"input": "9 23 23", "output": "Alice\n"}, {"input": "9 44 23", "output": "Borys\n"}, {"input": "2 31 -1", "output": "Alice\n"}, {"input": "2 53 -1", "output": "Alice\n"}, {"input": "2 64 -...
code_stdio
[ { "content": "You have an array a of length n. For every positive integer x you are going to perform the following operation during the x-th second:\n\n * Select some distinct indices i_{1}, i_{2}, …, i_{k} which are between 1 and n inclusive, and add 2^{x-1} to each corresponding position of a. Formally, a_{i...
[{"input": "6\n3\n1000000100 0 -1000000000\n1\n6\n2\n-1000000000 1000000000\n2\n1000000000 -1000000000\n2\n1001000000 1000000000\n2\n-1000000000 -1000000000\n", "output": "31\n0\n0\n31\n20\n0\n"}, {"input": "6\n3\n1000000100 0 -1000000000\n1\n6\n2\n-1000000000 1000000000\n2\n1000000000 -1000000000\n2\n1001000000 100000...
code_stdio
[ { "content": "Captain Flint and his crew keep heading to a savage shore of Byteland for several months already, drinking rum and telling stories. In such moments uncle Bogdan often remembers his nephew Denis. Today, he has told a story about how Denis helped him to come up with an interesting problem and asked ...
[{"input": "2\n11405\n58469\n", "output": "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...
code_stdio
[ { "content": "Monocarp has forgotten the password to his mobile phone. The password consists of $4$ digits from $0$ to $9$ (note that it can start with the digit $0$).\n\nMonocarp remembers that his password had exactly two different digits, and each of these digits appeared exactly two times in the password. M...
[{"input": "12\n8\n1 2 3 5 6 7 8 9\n6\n4 5 6 7 8 9\n7\n0 4 5 6 7 8 9\n7\n1 4 5 6 7 8 9\n8\n0 1 4 5 6 7 8 9\n7\n2 4 5 6 7 8 9\n8\n0 2 4 5 6 7 8 9\n8\n1 2 4 5 6 7 8 9\n7\n3 4 5 6 7 8 9\n8\n0 3 4 5 6 7 8 9\n8\n1 3 4 5 6 7 8 9\n8\n2 3 4 5 6 7 8 9\n", "output": "6\n36\n18\n18\n6\n18\n6\n6\n18\n6\n6\n6\n"}, {"input": "7\n1\n...
code_stdio
[ { "content": "The Hedgehog recently remembered one of his favorite childhood activities, β€” solving puzzles, and got into it with new vigor. He would sit day in, day out with his friend buried into thousands of tiny pieces of the picture, looking for the required items one by one.\n\nSoon the Hedgehog came up wi...
[{"input": "20 20\nABBBAAABABAAAAABBABB\nBABABBAABAABBAAABABB\nBABBBAABAABBABBBBABA\nBAAABBAAABABBABBAAAA\nABBAABAABBBBAAABBBAA\nBAAAAAAAABABBAAAAABB\nAAAAAAABABBBBBAABAAB\nABBBBABAABBAAAAABAAA\nBAAAAABBABAAAAABAAAB\nABABAABABBBABBAABBAA\nBAAABBBAAAABBBBBABAA\nAAABBABABAABBABAABAB\nABBABABABABAAABABABA\nBAABAAAAABBAABB...
code_stdio
[ { "content": "Nastya owns too many arrays now, so she wants to delete the least important of them. However, she discovered that this array is magic! Nastya now knows that the array has the following properties:\n\n In one second we can add an arbitrary (possibly negative) integer to all elements of the array t...
[{"input": "13\n-2075 -32242 27034 -37618 -96962 145894 64846 29532 -71761 28908 -21222 -61370 46899\n", "output": "13\n"}, {"input": "13\n-2075 -32242 27034 -37618 -96962 82203 64846 48249 -71761 28908 -21222 -61370 46899\n", "output": "13\n"}, {"input": "13\n-2075 -32242 27034 -37618 -96962 82203 64846 48249 -71761 2...
code_stdio
[ { "content": "problem\n\nThere are $ N $ propositions, named $ 1, 2, \\ cdots, N $, respectively. Also, $ M $ information about the propositions is given. The $ i $ th information is \"$ a_i $$\". Given in the form \"b_i $\", which means that $ a_i $ is $ b_i $. (\"If\" is a logical conditional and the transiti...
[{"input": "211 0\n4 2\n0 3", "output": "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n71\n72\n...
code_stdio