messages listlengths 1 1 | ground_truth stringlengths 156 726k | dataset stringclasses 2
values |
|---|---|---|
[
{
"content": "Let's define `increasing` numbers as the numbers whose digits, read from left to right, are never less than the previous ones: 234559 is an example of increasing number.\n\nConversely, `decreasing` numbers have all the digits read from left to right so that no digits is bigger than the previous on... | [{"input": "50", "output": "[87959698326]", "fn_name": "total_inc_dec"}, {"input": "20", "output": "[40059819]", "fn_name": "total_inc_dec"}, {"input": "10", "output": "[277033]", "fn_name": "total_inc_dec"}, {"input": "6", "output": "[12952]", "fn_name": "total_inc_dec"}, {"input": "4", "output": "[1675]", "fn_name": ... | code_functional |
[
{
"content": "Read problems statements in Mandarin Chinese and Russian as well. \n\nMike likes strings. He is also interested in algorithms. A few days ago he discovered for himself a very nice problem:\n\nYou are given an AB-string S. You need to count the number of substrings of S, which have an equal number ... | [{"input": "ABACABA\n", "output": "2\n"}, {"input": "ABBCABA", "output": "2\n"}, {"input": "ABABBBA", "output": "0\n"}, {"input": "@BABBBA", "output": "1\n"}, {"input": "@BABCBA", "output": "3\n"}, {"input": "AB@BCAB", "output": "4\n"}, {"input": "BCABACB", "output": "6\n"}, {"input": "ABCBACB", "output": "5\n"}, {"inp... | code_stdio |
[
{
"content": "Two players decided to play one interesting card game.\n\nThere is a deck of $n$ cards, with values from $1$ to $n$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the game, the deck is completely distributed between playe... | [{"input": "2\n2 1 1\n2\n-1\n5 2 3\n1 3\n2 11 5\n", "output": "YES\nNO\n"}, {"input": "2\n2 1 1\n2\n-1\n5 2 3\n2 3\n2 2 5\n", "output": "YES\nNO\n"}, {"input": "2\n2 1 1\n2\n1\n5 2 3\n2 3\n-1 6 5\n", "output": "YES\nNO\n"}, {"input": "2\n2 1 1\n2\n-1\n5 2 3\n2 3\n3 2 5\n", "output": "YES\nNO\n"}, {"input": "2\n2 1 1\n2... | code_stdio |
[
{
"content": "Today, Snuke will eat B pieces of black chocolate and W pieces of white chocolate for an afternoon snack.\n\nHe will repeat the following procedure until there is no piece left:\n\n* Choose black or white with equal probability, and eat a piece of that color if it exists.\n\n\n\nFor each integer i... | [{"input": "69 1", "output": "500000004\n750000006\n875000007\n437500004\n718750006\n859375007\n429687504\n714843756\n857421882\n928710945\n464355473\n232177737\n116088869\n58044435\n29022218\n514511113\n257255557\n128627779\n64313890\n532156949\n266078475\n133039238\n566519623\n283259812\n641629910\n820814959\n4104074... | code_stdio |
[
{
"content": "Read problems statements in Mandarin Chinese and Russian. \n\nRecently Chef has decided to make some changes in our beloved Codechef. As you know, each problem at Codechef has its memory and time limits. To make problems even more challenging, he decided to measure allocated memory in a different... | [{"input": "3\n2\n0 4\n5\n0 2 10 2 3\n3\n1 1 1", "output": "4\n11\n1\n"}, {"input": "3\n2\n2 2\n5\n0 0 11 4 3\n3\n0 3 0", "output": "2\n11\n3\n"}, {"input": "3\n2\n0 2\n5\n1 2 12 2 3\n3\n1 0 1", "output": "2\n13\n2\n"}, {"input": "3\n2\n2 2\n5\n0 2 12 4 3\n3\n1 0 1", "output": "2\n12\n2\n"}, {"input": "3\n2\n3 12\n5\n0... | code_stdio |
[
{
"content": "Example\n\nInput\n\n3\naab\nczc\nbaa\n\n\nOutput\n\naac\n\nWrite Python code to solve this problem. Your program should read the input from stdin and write the output to stdout. Enclose your complete solution in a single ```python code block.",
"role": "user"
}
] | [{"input": "3\naab\nccz\nbaa", "output": "aac\n"}, {"input": "3\nbba\nzcc\nbaa", "output": "aaz\n"}, {"input": "3\nabb\nzbc\nbaa", "output": "aab\n"}, {"input": "3\nbbb\nzcd\nbaa", "output": "abc\n"}, {"input": "3\nabb\ncyc\nbba", "output": "aay\n"}, {"input": "3\nbba\nzbc\nbba", "output": "abb\n"}, {"input": "3\nbbb\n... | code_stdio |
[
{
"content": "Let's call an array consisting of n integer numbers a_1, a_2, ..., a_{n}, beautiful if it has the following property:\n\n consider all pairs of numbers x, y (x ≠ y), such that number x occurs in the array a and number y occurs in the array a; for each pair x, y must exist some position j (1 ≤ j ... | [{"input": "58 38\n6384 48910\n97759 90589\n28947 5031\n45169 32592\n85656 26360\n88538 42484\n44042 88351\n42837 79021\n96022 59200\n485 96735\n98000 3939\n3789 64468\n10894 58484\n26422 26618\n25515 95617\n37452 5250\n39557 66304\n79009 40610\n80703 60486\n90344 37588\n57504 61201\n62619 79797\n51282 68799\n15158 276... | code_stdio |
[
{
"content": "A string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied:\n - S is a palindrome.\n - Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.\n - The string consisting of the (N+3... | [{"input": "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\n", "output": "Yes\n"}, {"input": "kszhkbpphykinkezplvfjaqmpmqajfvlpzeknikyhppbkhzskokszhkbpphykinkezplvfjaqmpmqajfvlpzeknikyhppbkhzsk\n", "output": "Yes\n"}, {"input": "avtvnrdyluacvrayggwnpnzidiznpnwggyarvc... | code_stdio |
[
{
"content": "Everyone loves a freebie. Especially students.\n\nIt is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times \"Fly, freebie, fly!\" — then flown freebie helps him to pass the upcoming exam.\n\nIn the night before the exam... | [{"input": "100\n98 63 672 100 254 218 623 415 426 986 920 915 736 795 407 541 382 213 935 743 961 59 660 512 134 935 248 378 739 356 543 714 28 667 602 596 759 791 103 564 225 520 159 542 966 332 983 655 517 273 95 242 593 940 286 236 41 318 941 727 384 225 319 627 982 359 232 769 854 172 643 598 215 231 305 30 347 46... | code_stdio |
[
{
"content": "Write a program which print coordinates $(x_i, y_i)$ of given $n$ points on the plane by the following criteria.\n\n1. first by $x$-coordinate\n2. in case of a tie, by $y$-coordinate\n\nConstraints\n\n* $1 \\leq n \\leq 100,000$\n* $-1,000,000,000 \\leq x_i, y_i \\leq 1,000,000,000$\n\nInput\n\nTh... | [{"input": "5\n-1 3\n1 15\n-1 1\n-1 -1\n-1 -1", "output": "-1 -1\n-1 -1\n-1 1\n-1 3\n1 15\n"}, {"input": "5\n-1 3\n1 15\n-1 0\n-1 -1\n-1 -1", "output": "-1 -1\n-1 -1\n-1 0\n-1 3\n1 15\n"}, {"input": "5\n-1 3\n1 22\n-1 0\n-1 -1\n-1 -1", "output": "-1 -1\n-1 -1\n-1 0\n-1 3\n1 22\n"}, {"input": "5\n-1 5\n1 22\n-1 0\n-1 -1... | code_stdio |
[
{
"content": "Motorist Kojiro spent 10 years saving up for his favorite car brand, Furrari. Finally Kojiro's dream came true! Kojiro now wants to get to his girlfriend Johanna to show off his car to her.\n\nKojiro wants to get to his girlfriend, so he will go to her along a coordinate line. For simplicity, we c... | [{"input": "386 20 29 30\n1 349\n2 482\n1 112\n1 93\n2 189\n1 207\n2 35\n2 -5\n1 422\n1 442\n1 402\n2 238\n3 258\n3 54\n2 369\n2 290\n2 329\n3 74\n3 -62\n2 170\n1 462\n2 15\n2 222\n1 309\n3 150\n1 -25\n3 130\n1 271\n1 -43\n351 250 91 102 0 286 123 93 100 205 328 269 188 83 73 35 188 223 73 215 199 64 47 379 61 298 295 ... | code_stdio |
[
{
"content": "There are N cities. There are also K roads and L railways, extending between the cities. The i-th road bidirectionally connects the p_i-th and q_i-th cities, and the i-th railway bidirectionally connects the r_i-th and s_i-th cities. No two roads connect the same pair of cities. Similarly, no two ... | [{"input": "25 4 4\n1 2\n3 3\n2 5\n6 7\n3 5\n4 3\n3 4\n6 7", "output": "1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n"}, {"input": "27 0 1\n0 0\n2 10\n3 -1\n1 0", "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\n"}, {"input": "23 3 0\n-4 2\n2 4\n3 4\n10 5", "output": "1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... | code_stdio |
[
{
"content": "Vasily the bear has got a sequence of positive integers a_1, a_2, ..., a_{n}. Vasily the Bear wants to write out several numbers on a piece of paper so that the beauty of the numbers he wrote out was maximum. \n\nThe beauty of the written out numbers b_1, b_2, ..., b_{k} is such maximum non-negati... | [{"input": "39\n37749932 37750076 37750391 37750488 37750607 37750812 37750978 37751835 37752173 37752254 75497669 75497829 75497852 75498044 75498061 75498155 75498198 75498341 75498382 75498465 150994988 150994989 150995009 150995019 150995024 150995030 150995031 150995069 150995072 805306369 805306373 805306375 8053... | code_stdio |
[
{
"content": "A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string \"aab\" is an anagram of the string \"aba\" and the string \"aaa\" is not.\n\nThe string t is called a substring of the string s if it can b... | [{"input": "??fb???a??\ndeeefc\n", "output": "0\n"}, {"input": "??fb???a??\ndedefc\n", "output": "0\n"}, {"input": "??fb???a??\ndedefd\n", "output": "0\n"}, {"input": "??a???bf??\ndedefd\n", "output": "0\n"}, {"input": "??fb?a????\ndeeefc\n", "output": "0\n"}, {"input": "??a???bf??\ndedefc\n", "output": "0\n"}, {"input... | code_stdio |
[
{
"content": "Today is August 24, one of the five Product Days in a year.\n\nA date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):\n\n* d_... | [{"input": "15 38", "output": "10\n"}, {"input": "16 38", "output": "11\n"}, {"input": "16 57", "output": "16\n"}, {"input": "16 94", "output": "19\n"}, {"input": "12 94", "output": "12\n"}, {"input": "26 38", "output": "15\n"}, {"input": "24 94", "output": "31\n"}, {"input": "14 68", "output": "13\n"}, {"input": "31 4... | code_stdio |
[
{
"content": "Scheme? - Too loudly said. Just a new idea. Now Chef is expanding his business. He wants to make some new restaurants in the big city of Lviv. To make his business competitive he should interest customers. Now he knows how. But don't tell anyone - it is a secret plan. Chef knows four national Ukr... | [{"input": "3\n17\n7\n20", "output": "129140160\n2184\n486784383\n"}, {"input": "3\n19\n7\n21", "output": "162261457\n2184\n460353130\n"}, {"input": "3\n12\n13\n11", "output": "531444\n1594320\n177144\n"}, {"input": "3\n17\n7\n12", "output": "129140160\n2184\n531444\n"}, {"input": "3\n17\n7\n11", "output": "129140160\n... | code_stdio |
[
{
"content": "Permutation p is an ordered set of integers p_1, p_2, ..., p_{n}, consisting of n distinct positive integers, each of them doesn't exceed n. We'll denote the i-th element of permutation p as p_{i}. We'll call number n the size or the length of permutation p_1, p_2, ..., p_{n}.\n\nPetya decid... | [{"input": "011\n", "output": "890786230\n"}, {"input": "13\n", "output": "695720788\n"}, {"input": "15\n", "output": "150347555\n"}, {"input": "11\n", "output": "890786230\n"}, {"input": "11\n", "output": "890786230\n"}, {"input": "15\n", "output": "150347555\n"}, {"input": "13\n", "output": "695720788\n"}, {"input": ... | code_stdio |
[
{
"content": "You are given an array of n positive integers a_1, a_2, …, a_n. Your task is to calculate the number of arrays of n positive integers b_1, b_2, …, b_n such that: \n\n * 1 ≤ b_i ≤ a_i for every i (1 ≤ i ≤ n), and \n * b_i ≠ b_{i+1} for every i (1 ≤ i ≤ n - 1). \n\n\n\nThe number of such arrays ca... | [{"input": "100\n23 39 20 46 127 72 41 70 37 18 8 40 24 61 12 79 51 148 61 66 85 97 78 14 70 47 100 40 15 40 23 52 19 30 6 91 82 56 10 6 68 24 97 61 31 136 18 45 88 6 37 38 51 86 37 42 66 30 79 56 50 14 61 18 24 20 57 3 93 15 24 74 32 21 71 93 4 66 20 82 75 10 86 108 30 31 6 49 15 33 100 35 1 96 161 63 29 21 41 22\n", ... | code_stdio |
[
{
"content": "You are given an array consisting of $n$ integers $a_1$, $a_2$, ..., $a_n$. Initially $a_x = 1$, all other elements are equal to $0$.\n\nYou have to perform $m$ operations. During the $i$-th operation, you choose two indices $c$ and $d$ such that $l_i \\le c, d \\le r_i$, and swap $a_c$ and $a_d$.... | [{"input": "9\n100 50 6\n1 49\n51 100\n40 60\n30 70\n20 30\n70 80\n100 1 11\n1 1\n1 1\n1 1\n2 2\n2 100\n1 4\n2 3\n3 7\n5 6\n6 100\n4 5\n1 1 5\n1 1\n1 1\n1 1\n1 1\n1 1\n11 6 4\n6 6\n1 5\n7 11\n6 6\n3 3 2\n1 2\n2 3\n1000000000 1 1\n1 1000000000\n1000000000 1 1\n1 999999999\n1000000000 1 1\n2 1000000000\n1000000000 2 1\n1... | code_stdio |
[
{
"content": "Write a program which identifies the number of combinations of three integers which satisfy the following conditions:\n\n* You should select three distinct integers from 1 to n.\n* A total sum of the three integers is x.\n\n\n\nFor example, there are two combinations for n = 5 and x = 9.\n\n* 1 + ... | [{"input": "37 49\n0 0", "output": "151\n"}, {"input": "13 14\n0 0", "output": "10\n"}, {"input": "16 22\n0 0", "output": "26\n"}, {"input": "20 20\n0 0", "output": "24\n"}, {"input": "19 22\n0 0", "output": "30\n"}, {"input": "20 32\n0 0", "output": "45\n"}, {"input": "20 48\n0 0", "output": "12\n"}, {"input": "12 22\... | code_stdio |
[
{
"content": "Luba thinks about watering her garden. The garden can be represented as a segment of length k. Luba has got n buckets, the i-th bucket allows her to water some continuous subsegment of garden of length exactly a_{i} each hour. Luba can't water any parts of the garden that were already watered, als... | [{"input": "100 100\n2 46 24 18 86 90 31 38 84 49 58 28 15 80 14 24 87 56 62 87 41 87 55 71 87 32 41 56 91 32 24 75 43 42 35 30 72 53 31 26 54 61 87 85 36 75 44 31 7 38 77 57 61 54 70 77 45 96 39 57 11 8 91 42 52 15 42 30 92 41 27 26 34 27 3 80 32 86 26 97 63 91 30 75 14 7 19 23 45 11 8 43 44 73 11 56 3 55 63 16\n", "o... | 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": "Little boy Gerald studies at school which is quite far from his house. That's why he has to go there by bus every day. The way from home to school is represented by a segment of a straight line; the segment contains exactly n + 1 bus stops. All of them are numbered with integers from 0 to n in the... | [{"input": "68 74\n51 54\n3 22\n12 24\n3 27\n32 42\n36 55\n60 64\n1 4\n4 23\n11 64\n54 62\n50 56\n21 34\n27 63\n15 54\n28 61\n13 57\n39 53\n12 32\n32 40\n33 67\n55 61\n33 67\n30 37\n15 49\n27 45\n21 41\n8 42\n24 63\n40 48\n28 41\n30 67\n0 4\n7 15\n27 59\n60 62\n25 65\n30 31\n38 67\n24 43\n14 64\n26 46\n8 12\n34 41\n32 ... | code_stdio |
[
{
"content": "Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys have lowercase Latin letters on them and some of the keys work like the \"Shift\" key on standard keyboa... | [{"input": "10 10 2\nfriuxvShvg\nerslojqtgu\nzeqsmdewry\nwvhbeeyeSu\ngkofbjaavr\ntwkcdxugps\nnzlylSmafu\nstamkpxnzt\nuwxwximkrm\nmzxyboazbl\n100\nmRIfAtrLKmztpVkAmojDCiIgseBwlUilBIiyDQhqNhNAqVLLIobuCIretLdSvixNNdCiouFMXtwHZFlObCeaygmIiFBfaCirbmCa\n", "output": "19\n"}, {"input": "10 10 1\nmgziiihbkq\niobjknuogh\nvntwah... | code_stdio |
[
{
"content": "The Hedgehog likes to give presents to his friend, but no less he likes to receive them.\n\nHaving received another present today, the Hedgehog suddenly understood that he has no place to put it as there was no room left on the special shelf in the cupboard. He will have to choose another shelf, b... | [{"input": "350 22\n73 1 4 8 10 14 16 19 28 37 41 42 43 55 56 64 66 67 79 80 84 87 96 99 101 103 119 120 121 122 127 128 135 141 142 143 148 156 159 160 161 166 167 169 173 189 201 202 205 219 223 227 233 242 243 244 250 257 260 262 263 264 273 291 301 302 305 306 307 314 326 336 342 345\n", "output": "73\n"}, {"input"... | code_stdio |
[
{
"content": "City X consists of n vertical and n horizontal infinite roads, forming n × n intersections. Roads (both vertical and horizontal) are numbered from 1 to n, and the intersections are indicated by the numbers of the roads that form them.\n\nSand roads have long been recognized out of date, so the dec... | [{"input": "9\n4 5\n2 3\n8 3\n5 6\n9 3\n4 4\n5 4\n4 7\n1 7\n8 4\n1 4\n1 5\n5 7\n7 8\n7 1\n9 9\n8 7\n7 5\n3 7\n6 6\n7 3\n5 2\n3 6\n7 4\n9 6\n5 8\n9 7\n6 3\n7 9\n1 2\n1 1\n6 2\n5 3\n7 2\n1 6\n4 1\n6 1\n8 9\n2 2\n3 9\n2 9\n7 7\n2 8\n9 4\n2 5\n8 6\n3 4\n2 1\n2 7\n6 5\n9 1\n3 3\n3 8\n5 5\n4 3\n3 1\n1 9\n6 4\n3 2\n6 8\n2 6\n... | code_stdio |
[
{
"content": "Let's call a string \"s-palindrome\" if it is symmetric about the middle of the string. For example, the string \"oHo\" is \"s-palindrome\", but the string \"aa\" is not. The string \"aa\" is not \"s-palindrome\", because the second half of it is not a mirror reflection of the first half.\n\n [Ima... | [{"input": "mmmmmmmmmmmmmmmm\n", "output": "NIE\n"}, {"input": "mmmmmmmmmmmmmmmm\n", "output": "NIE\n"}, {"input": "mmmmmmmmmmmmmmmn\n", "output": "NIE\n"}, {"input": "nnnnnnnnnnnnn\n", "output": "NIE\n"}, {"input": "nnnnnnnnnnnnn\n", "output": "NIE\n"}, {"input": "onnnnnnnnnnnn\n", "output": "NIE\n"}, {"input": "AAAAN... | code_stdio |
[
{
"content": "You have a team of N people. For a particular task, you can pick any non-empty subset of people. The cost of having x people for the task is x^{k}. \n\nOutput the sum of costs over all non-empty subsets of people.\n\n\n-----Input-----\n\nOnly line of input contains two integers N (1 ≤ N ≤ 10^9) re... | [{"input": "1000000000 5000\n", "output": "642932262\n"}, {"input": "1000000000 5000\n", "output": "642932262\n"}, {"input": "158260522 4575\n", "output": "875142289\n"}, {"input": "602436426 4445\n", "output": "582490088\n"}, {"input": "262703497 2202\n", "output": "813734619\n"}, {"input": "971407775 4325\n", "output... | code_stdio |
[
{
"content": "You are given a polynomial of degree N with integer coefficients: f(x)=a_Nx^N+a_{N-1}x^{N-1}+...+a_0. Find all prime numbers p that divide f(x) for every integer x.\n\nConstraints\n\n* 0 \\leq N \\leq 10^4\n* |a_i| \\leq 10^9(0\\leq i\\leq N)\n* a_N \\neq 0\n* All values in input are integers.\n\n... | [{"input": "0\n461740266", "output": "2\n3\n13\n1327\n1487\n"}, {"input": "0\n1326078230", "output": "2\n5\n1051\n126173\n"}, {"input": "0\n754892205", "output": "3\n5\n41\n853\n1439\n"}, {"input": "0\n732779016", "output": "2\n3\n17\n263\n6829\n"}, {"input": "0\n663325004", "output": "2\n29\n197\n29027\n"}, {"input": ... | code_stdio |
[
{
"content": "Sitting in a station waiting room, Joisino is gazing at her train ticket.\nThe ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).\nIn the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with + or - so that the formula ho... | [{"input": "1222\n", "output": "1+2+2+2=7\n"}, {"input": "0290\n", "output": "0-2+9+0=7\n"}, {"input": "3242\n", "output": "3+2+4-2=7\n"}, {"input": "2364", "output": "2+3+6-4=7\n"}, {"input": "1114", "output": "1+1+1+4=7\n"}, {"input": "2005", "output": "2+0+0+5=7\n"}, {"input": "1455", "output": "1-4+5+5=7\n"}, {"inp... | code_stdio |
[
{
"content": "You have $r$ red and $b$ blue beans. You'd like to distribute them among several (maybe, one) packets in such a way that each packet:\n\nhas at least one red bean (or the number of red beans $r_i \\ge 1$);\n\nhas at least one blue bean (or the number of blue beans $b_i \\ge 1$);\n\nthe number of r... | [{"input": "10\n1 1000000000 1000000000\n1 1000000000 1000000000\n1 1000000000 1000000000\n1 1000000000 1000000000\n1 1000000000 1000000000\n1 1000000000 1000000000\n1 1000000000 1000000000\n1 1000000000 1000000000\n1 1000000000 1000000000\n1 1000000000 1000000000\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\n... | code_stdio |
[
{
"content": "Amidakuji is a traditional method of lottery in Japan.\nTo make an amidakuji, we first draw W parallel vertical lines, and then draw horizontal lines that connect them. The length of each vertical line is H+1 [cm], and the endpoints of the horizontal lines must be at 1, 2, 3, ..., or H [cm] from t... | [{"input": "100 8 8\n", "output": "467571711\n"}, {"input": "100 8 3\n", "output": "938282570\n"}, {"input": "100 8 1\n", "output": "755868507\n"}, {"input": "15 8 5\n", "output": "437760187\n"}, {"input": "77 7 7\n", "output": "237739357\n"}, {"input": "98 7 6\n", "output": "736412603\n"}, {"input": "57 5 1\n", "outpu... | code_stdio |
[
{
"content": "You've got an n × m pixel picture. Each pixel can be white or black. Your task is to change the colors of as few pixels as possible to obtain a barcode picture.\n\nA picture is a barcode if the following conditions are fulfilled: \n\n * All pixels in each column are of the same color. \n * The w... | [{"input": "56 2 2 2\n##\n##\n##\n..\n..\n##\n.#\n.#\n..\n##\n##\n..\n..\n#.\n#.\n#.\n#.\n##\n..\n.#\n..\n##\n##\n.#\n#.\n.#\n..\n..\n#.\n..\n##\n..\n#.\n.#\n#.\n#.\n#.\n##\n#.\n##\n##\n.#\n#.\n##\n..\n.#\n#.\n#.\n##\n..\n..\n#.\n##\n..\n..\n##\n", "output": "55\n"}, {"input": "56 2 2 2\n##\n##\n##\n..\n..\n##\n.#\n.#\... | code_stdio |
[
{
"content": "The last contest held on Johnny's favorite competitive programming platform has been received rather positively. However, Johnny's rating has dropped again! He thinks that the presented tasks are lovely, but don't show the truth about competitors' skills.\n\nThe boy is now looking at the ratings o... | [{"input": "3\n576460752303423484\n576460752303423484\n576460752303423485\n", "output": "1152921504606846911\n1152921504606846911\n1152921504606846912\n"}, {"input": "3\n576460752303423484\n576460752303423484\n576460752303423485\n", "output": "1152921504606846911\n1152921504606846911\n1152921504606846912\n"}, {"input":... | code_stdio |
[
{
"content": "There are N people standing in a row from west to east. Each person is facing east or west. The directions of the people is given as a string S of length N. The i-th person from the west is facing east if S_i = `E`, and west if S_i = `W`.\n\nYou will appoint one of the N people as the leader, then... | [{"input": "12\nEWWWEEEWEWEW", "output": "5\n"}, {"input": "12\nWWWWEEEWEWEE", "output": "6\n"}, {"input": "12\nEWWEWEEEWWWE", "output": "4\n"}, {"input": "12\nWEWWEEWWEWEE", "output": "6\n"}, {"input": "12\nEEWEWEEEWWWW", "output": "2\n"}, {"input": "12\nEWWWEEEWEWWE", "output": "5\n"}, {"input": "12\nEWWWEEEWWWEE", "... | code_stdio |
[
{
"content": "You are given a matrix f with 4 rows and n columns. Each element of the matrix is either an asterisk (*) or a dot (.).\n\nYou may perform the following operation arbitrary number of times: choose a square submatrix of f with size k × k (where 1 ≤ k ≤ 4) and replace each element of the chosen subma... | [{"input": "33\n548 102 31 979\n.**..**.**...******.*.**....**.**\n**..******...*.*...*.....*....*.*\n.**..*...*.**.*.....*..*..**.*..*\n.....**.....*..*...***.***..**.**\n", "output": "527\n"}, {"input": "33\n548 102 31 730\n.**..**.**...******.*.**....**.**\n**..******...*.*...*.....*....*.*\n.**..*...*.**.*.....*..*... | code_stdio |
[
{
"content": "problem\n\nYou decide to invite your friends of the school and your friends of a friend to the Christmas party. The number of students in your school is n, and each student is assigned a number from 1 to n. Your number is 1. You have a list of who and who are your friends. Based on this list, crea... | [{"input": "6\n5\n1 2\n1 3\n3 4\n2 3\n4 5\n10\n5\n2 3\n3 4\n4 3\n5 6\n1 6\n0\n0", "output": "3\n2\n"}, {"input": "6\n5\n1 2\n1 3\n3 4\n2 3\n4 5\n6\n5\n2 3\n3 4\n4 5\n5 6\n2 6\n0\n0", "output": "3\n0\n"}, {"input": "6\n5\n1 2\n1 3\n3 4\n2 3\n4 5\n6\n5\n2 3\n3 4\n1 5\n5 6\n2 6\n0\n0", "output": "3\n2\n"}, {"input": "6\n5... | code_stdio |
[
{
"content": "Authors have come up with the string $s$ consisting of $n$ lowercase Latin letters.\n\nYou are given two permutations of its indices (not necessary equal) $p$ and $q$ (both of length $n$). Recall that the permutation is the array of length $n$ which contains each integer from $1$ to $n$ exactly on... | [{"input": "6 5\n5 6 1 2 3 4\n6 5 1 2 3 4\n", "output": "YES\nbcdeaa\n"}, {"input": "6 5\n5 6 1 2 3 4\n6 5 1 2 3 4\n", "output": "YES\nbcdeaa\n"}, {"input": "5 2\n5 2 4 3 1\n5 4 3 1 2\n", "output": "YES\nbbbba\n"}, {"input": "5 2\n5 2 4 3 1\n5 4 3 1 2\n", "output": "YES\nbbbba\n"}, {"input": "5 1\n1 3 2 4 5\n2 3 5 1 4\... | code_stdio |
[
{
"content": "You are given a set of $2n+1$ integer points on a Cartesian plane. Points are numbered from $0$ to $2n$ inclusive. Let $P_i$ be the $i$-th point. The $x$-coordinate of the point $P_i$ equals $i$. The $y$-coordinate of the point $P_i$ equals zero (initially). Thus, initially $P_i=(i,0)$.\n\nThe giv... | [{"input": "1000000000000000000 1000000000000000000\n", "output": "1\n"}, {"input": "1 1000000000000000000\n", "output": "1000000000000000000\n"}, {"input": "1000000001 1000000000000000000\n", "output": "1000000000\n"}, {"input": "1000000001 1000000000000000000\n", "output": "1000000000\n"}, {"input": "1000000000000000... | code_stdio |
[
{
"content": "Kostya likes the number 4 much. Of course! This number has such a lot of properties, like:\n\n- Four is the smallest composite number;\n- It is also the smallest Smith number;\n- The smallest non-cyclic group has four elements;\n- Four is the maximal degree of the equation that can be solved in ra... | [{"input": "5\n794947\n1850\n2424\n119\n24", "output": "2\n0\n2\n0\n1\n"}, {"input": "5\n1167956\n340\n2424\n40\n42", "output": "0\n1\n2\n1\n1\n"}, {"input": "5\n163328\n953\n2213\n157\n12", "output": "0\n0\n0\n0\n0\n"}, {"input": "5\n406876\n1014\n1542\n74\n18", "output": "1\n1\n1\n1\n0\n"}, {"input": "5\n428282\n1310... | code_stdio |
[
{
"content": "Polycarp starts his own business. Tomorrow will be the first working day of his car repair shop. For now the car repair shop is very small and only one car can be repaired at a given time.\n\nPolycarp is good at marketing, so he has already collected n requests from clients. The requests are numbe... | [{"input": "30\n522692116 159\n589719489 488\n662495181 961\n915956552 470\n683572975 271\n498400137 480\n327010963 181\n200704287 367\n961198611 54\n978100746 208\n345455616 986\n106372142 876\n446972337 42\n309349333 200\n93462198 543\n167946793 318\n325598940 427\n121873339 459\n174934933 598\n279521023 1152\n739750... | code_stdio |
[
{
"content": "Given is a string S consisting of `0` and `1`. Find the number of strings, modulo 998244353, that can result from applying the following operation on S between 0 and K times (inclusive):\n\n* Choose a pair of integers i, j (1\\leq i < j\\leq |S|) such that the i-th and j-th characters of S are `0`... | [{"input": "1100011010101110110111101111011111011000111101110110010010101000101 108", "output": "298688651\n"}, {"input": "1100011010101110110111101111011111011000111101110110010011101000101 108", "output": "573021841\n"}, {"input": "1100011010101110110111101111010111011000111101110110010011101000101 108", "output": "9... | code_stdio |
[
{
"content": "There are three points marked on the coordinate plane. The goal is to make a simple polyline, without self-intersections and self-touches, such that it passes through all these points. Also, the polyline must consist of only segments parallel to the coordinate axes. You are to find the minimum num... | [{"input": "1000000000 -1000000000\n1000000000 1000000000\n-1000000000 -1000000000\n", "output": "2\n"}, {"input": "1000000000 -1000000000\n1000000000 1000000000\n-1000000000 -1000000000\n", "output": "2\n"}, {"input": "1000000000 -1000000000\n1000000000 1000000010\n-1000000000 -1000000000\n", "output": "2\n"}, {"input... | code_stdio |
[
{
"content": "# Introduction\n\n\nFish are an integral part of any ecosystem. Unfortunately, fish are often seen as high maintenance. Contrary to popular belief, fish actually reduce pond maintenance as they graze on string algae and bottom feed from the pond floor. They also make very enjoyable pets, providing... | [{"input": "\"111111111111111111112222222222\"", "output": "[5]", "fn_name": "fish"}, {"input": "\"151128241212192113722321331\"", "output": "[5]", "fn_name": "fish"}, {"input": "\"111122223333\"", "output": "[4]", "fn_name": "fish"}, {"input": "\"111111111111\"", "output": "[3]", "fn_name": "fish"}, {"input": "\"11112... | code_functional |
[
{
"content": "Gigi is a clever monkey, living in the zoo, his teacher (animal keeper) recently taught him some knowledge of \"0\".\n\nIn Gigi's eyes, \"0\" is a character contains some circle(maybe one, maybe two).\n\nSo, a is a \"0\",b is a \"0\",6 is also a \"0\",and 8 have two \"0\" ,etc...\n\nNow, write som... | [{"input": "\"abcdefghijklmnopqrstuvwxyz\"", "output": "[8]", "fn_name": "countzero"}, {"input": "\"1234567890\"", "output": "[5]", "fn_name": "countzero"}, {"input": "\"0oO0oO\"", "output": "[6]", "fn_name": "countzero"}, {"input": "\"BRA\"", "output": "[3]", "fn_name": "countzero"}, {"input": "\"()\"", "output": "[1]... | code_functional |
[
{
"content": "Create a function that will return true if all numbers in the sequence follow the same counting pattern. If the sequence of numbers does not follow the same pattern, the function should return false.\n\nSequences will be presented in an array of varied length. Each array will have a minimum of 3 n... | [{"input": "[2, 4, 6, 8, 10, 12, 14, 16, 18, 22]", "output": "[false]", "fn_name": "validate_sequence"}, {"input": "[2, 4, 6, 8, 10, 12, 13, 16, 18, 20]", "output": "[false]", "fn_name": "validate_sequence"}, {"input": "[2, 4, 6, 8, 10, 12, 14, 16, 18, 20]", "output": "[true]", "fn_name": "validate_sequence"}, {"input"... | code_functional |
[
{
"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": "XXI Berland Annual Fair is coming really soon! Traditionally fair consists of $n$ booths, arranged in a circle. The booths are numbered $1$ through $n$ clockwise with $n$ being adjacent to $1$. The $i$-th booths sells some candies for the price of $a_i$ burles per item. Each booth has an unlimited... | [{"input": "78 74\n20194 1621 21498 13827 31277 19791 6583 13579 11160 20419 26490 160 3450 12925 18134 10381 27009 28815 10209 6478 18504 15371 32608 14197 12075 13723 12612 19020 28762 11057 12891 31164 16684 13717 19933 25453 2742 4955 6814 2863 10397 15461 20616 10905 2600 20137 4681 9199 27033 14388 32585 7241 351... | code_stdio |
[
{
"content": "Frog Gorf is traveling through Swamp kingdom. Unfortunately, after a poor jump, he fell into a well of $n$ meters depth. Now Gorf is on the bottom of the well and has a long way up.\n\nThe surface of the well's walls vary in quality: somewhere they are slippery, but somewhere have convenient ledge... | [{"input": "19\n1 1 3 4 5 3 5 0 0 6 3 1 10 3 13 9 1 4 2\n3 0 6 3 8 6 8 7 8 6 0 0 5 0 0 1 1 1 0\n", "output": "5\n17 15 2 1 0\n"}, {"input": "19\n1 1 3 4 5 3 5 11 0 6 5 3 10 3 13 9 1 4 17\n3 0 6 3 8 6 8 7 8 6 -1 0 5 0 0 1 1 1 0\n", "output": "3\n2 1 0\n"}, {"input": "19\n1 1 3 4 5 3 5 11 0 6 5 3 10 3 13 9 1 4 17\n3 0 6 ... | code_stdio |
[
{
"content": "Ivan had string s consisting of small English letters. However, his friend Julia decided to make fun of him and hid the string s. Ivan preferred making a new string to finding the old one. \n\nIvan knows some information about the string s. Namely, he remembers, that string t_{i} occurs in string ... | [{"input": "20\nadabacabaeabacabada 1 359\nabadabacabafabaca 1 213\nacabagabacaba 1 315\ncabaeabacabadabacab 1 268\nfabacabadabacabaeab 1 352\ncabafabacabada 1 28\nacabadabacabaea 1 67\ncabadabacabaeabacaba 1 484\nabacabadabacaba 1 209\nacabaiabacaba 1 251\nacabafabacabadabac 1 475\nabacabaeabacabadaba 1 105\ncabadabac... | code_stdio |
[
{
"content": "Write a program which reads $n$ dices constructed in the same way as Dice I, and determines whether they are all different. For the determination, use the same way as Dice III.\n\nConstraints\n\n* $2 \\leq n \\leq 100$\n* $0 \\leq $ the integer assigned to a face $ \\leq 100$\n\nInput\n\nIn the fi... | [{"input": "3\n-1 10 1 14 13 17\n6 0 35 1 0 0\n4 4 2 7 -1 -1", "output": "Yes\n"}, {"input": "3\n-1 10 1 14 13 17\n6 0 35 1 0 0\n4 4 2 5 -1 -1", "output": "Yes\n"}, {"input": "3\n0 10 1 14 9 17\n6 0 35 1 0 0\n13 4 2 7 -1 -1", "output": "Yes\n"}, {"input": "3\n0 10 1 14 13 17\n6 0 35 1 0 0\n4 4 2 7 -1 -1", "output": "Ye... | code_stdio |
[
{
"content": "Polycarp was given an array of $a[1 \\dots n]$ of $n$ integers. He can perform the following operation with the array $a$ no more than $n$ times:\n\nPolycarp selects the index $i$ and adds the value $a_i$ to one of his choice of its neighbors. More formally, Polycarp adds the value of $a_i$ to $a_... | [{"input": "50\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n", "... | code_stdio |
[
{
"content": "Berland scientists noticed long ago that the world around them depends on Berland population. Due to persistent research in this area the scientists managed to find out that the Berland chronology starts from the moment when the first two people came to that land (it is considered to have happened... | [{"input": "5833850738115444790123301858525860464609052423198474077217629208584932325696195827387610627649689452307781278299607661979317839675618367523485801890948530770658677574385684508313179053341358796468870615462459993169923271075382282788408147405323998383308800\n", "output": "YES\n1\n465\n232\n468898754020481677... | code_stdio |
[
{
"content": "You are at the top left cell $(1, 1)$ of an $n \\times m$ labyrinth. Your goal is to get to the bottom right cell $(n, m)$. You can only move right or down, one cell per step. Moving right from a cell $(x, y)$ takes you to the cell $(x, y + 1)$, while moving down takes you to the cell $(x + 1, y)$... | [{"input": "10 10\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n", "output": "48620\n"}, {"input": "10 10\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n", "output": "4862... | code_stdio |
[
{
"content": "Connected undirected graph without cycles is called a tree. Trees is a class of graphs which is interesting not only for people, but for ants too.\n\nAn ant stands at the root of some tree. He sees that there are n vertexes in the tree, and they are connected by n - 1 edges so that there is a path... | [{"input": "51\n28 3\n42 40\n40 51\n48 20\n13 28\n18 40\n44 40\n22 5\n22 27\n45 34\n40 9\n34 46\n40 34\n22 1\n22 11\n40 7\n28 40\n40 22\n14 40\n34 30\n40 20\n47 40\n12 34\n28 23\n40 24\n40 43\n41 40\n28 15\n49 32\n40 8\n32 10\n40 50\n40 36\n40 21\n16 33\n40 38\n34 2\n28 16\n34 4\n17 34\n19 40\n32 35\n40 29\n6 40\n40 39... | code_stdio |
[
{
"content": "While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.\n\nGiven two strings a and b, find the length of their longest uncommon subsequence, which is the longest string th... | [{"input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n", "ou... | code_stdio |
[
{
"content": "The [Chinese zodiac](https://en.wikipedia.org/wiki/Chinese_zodiac) is a repeating cycle of 12 years, with each year being represented by an animal and its reputed attributes. The lunar calendar is divided into cycles of 60 years each, and each year has a combination of an animal and an element. Th... | [{"input": "6673", "output": "[\"Water Rooster\"]", "fn_name": "chinese_zodiac"}, {"input": "1968", "output": "[\"Earth Monkey\"]", "fn_name": "chinese_zodiac"}, {"input": "2323", "output": "[\"Water Rabbit\"]", "fn_name": "chinese_zodiac"}, {"input": "1938", "output": "[\"Earth Tiger\"]", "fn_name": "chinese_zodiac"},... | code_functional |
[
{
"content": "Taro is addicted to a novel. The novel has n volumes in total, and each volume has a different thickness. Taro likes this novel so much that he wants to buy a bookshelf dedicated to it. However, if you put a large bookshelf in the room, it will be quite small, so you have to devise to make the wid... | [{"input": "3 9\n1051\n300\n800\n200\n100\n600\n900\n1032\n400\n4 3\n1000\n1000\n1000\n0 0", "output": "2151\n1000\n"}, {"input": "3 9\n1051\n300\n800\n200\n100\n600\n900\n1032\n400\n4 3\n1000\n1000\n1001\n0 0", "output": "2151\n1001\n"}, {"input": "3 9\n500\n300\n800\n200\n100\n600\n900\n1032\n400\n4 3\n1000\n1000\n10... | code_stdio |
[
{
"content": "You are a judge of a programming contest. You are preparing a dataset for a graph problem to seek for the cost of the minimum cost path. You've generated some random cases, but they are not interesting. You want to produce a dataset whose answer is a desired value such as the number representing t... | [{"input": "3 3 3\n1 2 3\n2 3 4\n1 3 8\n12 12 2010\n1 2 0\n2 3 3000\n3 4 0\n4 5 1940\n5 6 3000\n6 12 2010\n2 7 100\n7 8 200\n8 9 506\n12 10 400\n10 11 500\n11 6 512\n10 18 1\n1 2 7\n1 3 2\n1 4 16\n2 5 0\n3 6 10\n2 7 2\n3 5 10\n3 6 3\n3 7 10\n4 7 6\n5 8 10\n6 8 2\n6 9 11\n7 9 3\n1 9 16\n8 10 8\n9 10 1\n8 2 0\n0 0 0", "o... | code_stdio |
[
{
"content": "A binary heap which satisfies max-heap property is called max-heap. In a max-heap, for every node $i$ other than the root, $A[i] \\leq A[parent(i)]$, that is, the value of a node is at most the value of its parent. The largest element in a max-heap is stored at the root, and the subtree rooted at ... | [{"input": "10\n-1 2 2 0 140 11 1 1 12 5", "output": " 140 12 11 1 5 2 1 -1 0 2\n"}, {"input": "10\n0 2 2 0 140 11 1 -1 12 5", "output": " 140 12 11 0 5 2 1 -1 0 2\n"}, {"input": "10\n1 -1 0 0 15 18 1 -1 -1 2", "output": " 18 15 1 0 2 0 1 -1 -1 -1\n"}, {"input": "10\n1 -1 1 -2 16 18 1 0 -1 1", "output": " 18 16 1 0 1 1... | code_stdio |
[
{
"content": "The store sells $n$ beads. The color of each bead is described by a lowercase letter of the English alphabet (\"a\"–\"z\"). You want to buy some beads to assemble a necklace from them.\n\nA necklace is a set of beads connected in a circle.\n\nFor example, if the store sells beads \"a\", \"b\", \"c... | [{"input": "1\n364 1485\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeefffffffffffffffffffffffffffgggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh... | code_stdio |
[
{
"content": "Codeforces user' handle color depends on his rating — it is red if his rating is greater or equal to 2400; it is orange if his rating is less than 2400 but greater or equal to 2200, etc. Each time participant takes part in a rated contest, his rating is changed depending on his performance.\n\nAnt... | [{"input": "9\nmwAz9lQ 1786 -1631\nnYgYFXZQfY -1849 -1775\nKU4jF -1773 -3376\nopR 3752 2931\nGl -1481 -1002\nR -1111 3778\n0i9B21DC 3650 279\nQ8L2dS0 358 -3305\ng -2662 3968\n", "output": "NO\n"}, {"input": "9\nmwAz9lQ 1786 -1631\nnYgYFXZQfY -1849 -1775\nKU4jF -1773 -3376\nopR 3752 2854\nGl -1481 -1002\nR -1111 3778\n0... | code_stdio |
[
{
"content": "Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase \"how are you\" he c... | [{"input": "babbbbabbabbbababbabbbbbbabaabaababaaabbbbbabbbbaaaaabbaaabbaabaabbbbabbbababbabaaabbababaaababbbaaa\n", "output": "babababababababababababa\n"}, {"input": "aaabbbabaaabababbaaababbababbbabbbbaabaabbaaabbaaaaabbbbabbbbbaaababaabaababbbbbbabbababbbabbabbbbab\n", "output": "abababababababababababab\n"}, {"inp... | code_stdio |
[
{
"content": "Once Bob got to a sale of old TV sets. There were n TV sets at that sale. TV set with index i costs ai bellars. Some TV sets have a negative price — their owners are ready to pay Bob if he buys their useless apparatus. Bob can «buy» any TV sets he wants. Though he's very strong, Bob can carry at m... | [{"input": "99 17\n-993 -1745 -959 -989 -991 -995 -976 -997 -990 -1000 -996 -994 -999 -354 -1000 -983 -979 -1000 -989 -968 -994 -992 -962 -1593 -999 -983 -991 -979 -995 -993 -973 -999 -995 -995 -999 -993 -995 -992 -947 -1000 -999 -998 -982 -988 -757 -993 -426 -988 -980 -990 -979 -976 -995 -999 -981 -988 -998 -999 -970 ... | code_stdio |
[
{
"content": "You can't possibly imagine how cold our friends are this winter in Nvodsk! Two of them play the following game to warm up: initially a piece of paper has an integer q. During a move a player should write any integer number that is a non-trivial divisor of the last written number. Then he should ru... | [{"input": "7938986881993\n", "output": "1\n378028993\n"}, {"input": "472670214391\n", "output": "1\n23020027\n"}, {"input": "1468526771489\n", "output": "1\n613783\n"}, {"input": "1245373417369\n", "output": "1\n908209\n"}, {"input": "1307514188557\n", "output": "1\n39283\n"}, {"input": "1408514752349\n", "output": "1... | code_stdio |
[
{
"content": "Consider creating the following number pattern.\n\n\n4 8 2 3 1 0 8 3 7 6\n2 0 5 4 1 8 1 0 3\n2 5 9 5 9 9 1 3\n7 4 4 4 8 0 4\n1 8 8 2 8 4\n9 6 0 0 2\n5 6 0 2\n1 6 2\n7 8\nFive\n\n\nThis pattern follows the rules below.\n\n\nA B\nC\n\n\nIn the sequence of numbers, C is the ones digit of A + B. For e... | [{"input": "4823108376\n2273064329\n0123456789", "output": "5\n1\n4\n"}, {"input": "4823108376\n2314825047\n0123456789", "output": "5\n4\n4\n"}, {"input": "4823108376\n1842094049\n0123456789", "output": "5\n0\n4\n"}, {"input": "4823108376\n2704372300\n0123456789", "output": "5\n7\n4\n"}, {"input": "4823108376\n28114748... | code_stdio |
[
{
"content": "There is a directed graph with N vertices numbered 1 to N and M edges.\nThe i-th edge is directed from Vertex A_i to Vertex B_i, and there are C_i coins placed along that edge.\nAdditionally, there is a button on Vertex N.\nWe will play a game on this graph.\nYou start the game on Vertex 1 with ze... | [{"input": "2500 5000 0\n1206 2272 100000\n315 2399 100000\n1186 1435 100000\n303 1569 100000\n2364 581 100000\n1683 1969 100000\n700 1088 100000\n717 410 100000\n1412 1595 100000\n2066 813 100000\n1190 949 100000\n258 2307 100000\n423 2263 100000\n671 425 100000\n1712 1110 100000\n787 1469 100000\n1954 1281 100000\n23... | code_stdio |
[
{
"content": "Write a function, which takes a non-negative integer (seconds) as input and returns the time in a human-readable format (`HH:MM:SS`)\n\n* `HH` = hours, padded to 2 digits, range: 00 - 99\n* `MM` = minutes, padded to 2 digits, range: 00 - 59\n* `SS` = seconds, padded to 2 digits, range: 00 - 59\n\n... | [{"input": "359999", "output": "[\"99:59:59\"]", "fn_name": "make_readable"}, {"input": "86399", "output": "[\"23:59:59\"]", "fn_name": "make_readable"}, {"input": "86400", "output": "[\"24:00:00\"]", "fn_name": "make_readable"}, {"input": "3599", "output": "[\"00:59:59\"]", "fn_name": "make_readable"}, {"input": "3600... | code_functional |
[
{
"content": "Taro is playing with a puzzle that places numbers 1-9 in 9x9 squares. In this puzzle, you have to arrange the numbers according to the following rules.\n\n* One number appears exactly once in the same column\n* A number appears exactly once on the same line\n* In each of the 3x3 ranges separated b... | [{"input": "2\n-1 2 3 3 4 10 8 13 9\n6 5 1 7 39 9 1 2 3\n7 11 11 2 -1 3 2 5 8\n2 4 0 1 6 9 12 9 0\n0 8 7 8 9 1 2 1 4\n8 9 1 0 3 4 2 8 7\n1 4 5 8 7 8 9 1 3\n8 12 8 9 1 4 3 4 5\n12 0 2 3 4 0 13 7 0\n2 1 3 2 5 4 7 8 14\n4 5 6 7 8 9 0 1 3\n7 8 13 1 4 4 8 5 8\n2 6 4 8 6 7 8 9 1\n5 6 12 8 9 1 2 6 3\n2 14 1 2 3 4 5 6 2\n3 7 5... | code_stdio |
[
{
"content": "Cascading Style Sheets (CSS) is a style sheet language used for describing the look and formatting of a document written in a markup language. A style sheet consists of a list of rules. Each rule or rule-set consists of one or more selectors, and a declaration block. Selector describes which eleme... | [{"input": "\".test1 .test2.test3\"\n\".test1 .test4 .test5 .test6\"", "output": "[\".test1 .test4 .test5 .test6\"]", "fn_name": "compare"}, {"input": "\"div p span a\"\n\"div p span a b\"", "output": "[\"div p span a b\"]", "fn_name": "compare"}, {"input": "\".item\"\n\"#menu div ul li a\"", "output": "[\"#menu div ul... | code_functional |
[
{
"content": "Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for exactly t seconds. It takes the girl one second to light one candle. More formally, Anya can spend one s... | [{"input": "138 245 30\n3 5 6 8 9 13 15 16 19 20 24 25 27 29 30 32 33 34 35 36 37 38 40 42 47 51 52 53 55 56 58 59 63 66 67 68 69 72 73 74 75 77 78 80 81 82 85 86 87 89 91 93 95 96 99 100 102 104 105 108 110 111 112 117 122 124 125 128 129 131 133 136 139 144 145 146 147 148 149 151 153 155 156 159 162 163 164 165 168 ... | code_stdio |
[
{
"content": "Your search for Heidi is over – you finally found her at a library, dressed up as a human. In fact, she has spent so much time there that she now runs the place! Her job is to buy books and keep them at the library so that people can borrow and read them. There are n different books, numbered 1 th... | [{"input": "80 4\n71 49 41 21 72 71 37 14 51 59 73 11 70 15 36 46 32 57 58 15 72 67 16 75 70 11 67 3 40 36 2 9 63 68 32 22 63 52 67 55 35 19 72 59 22 19 44 55 59 74 4 34 53 3 22 57 32 27 78 12 71 4 26 15 43 21 79 10 67 39 34 74 38 26 31 78 2 78 69 42\n", "output": "62\n"}, {"input": "80 4\n71 49 41 21 72 71 37 14 51 59... | code_stdio |
[
{
"content": "The robot is placed in the top left corner of a grid, consisting of $n$ rows and $m$ columns, in a cell $(1, 1)$.\n\nIn one step, it can move into a cell, adjacent by a side to the current one:\n\n$(x, y) \\rightarrow (x, y + 1)$;\n\n$(x, y) \\rightarrow (x + 1, y)$;\n\n$(x, y) \\rightarrow (x, y ... | [{"input": "3\n2 3 1 3 0\n2 3 1 3 1\n5 5 3 4 1\n", "output": "3\n-1\n8\n"}, {"input": "2\n3 5 2 3 1\n5 3 3 2 1\n", "output": "-1\n-1\n"}, {"input": "2\n2 3 1 3 0\n2 3 1 3 1\n", "output": "3\n-1\n"}, {"input": "2\n3 3 2 2 1\n5 5 3 3 1\n", "output": "-1\n8\n"}, {"input": "1\n972 439 242 299 296\n", "output": "1409\n"}, {... | code_stdio |
[
{
"content": "Harry Water, Ronaldo, Her-my-oh-knee and their friends have started a new school year at their MDCS School of Speechcraft and Misery. At the time, they are very happy to have seen each other after a long time. The sun is shining, birds are singing, flowers are blooming, and their Potions class tea... | [{"input": "2\n10\n10\n", "output": "200\n"}, {"input": "2\n19\n10\n", "output": "380\n"}, {"input": "2\n4\n18\n", "output": "144\n"}, {"input": "2\n6\n18\n", "output": "216\n"}, {"input": "2\n6\n23\n", "output": "276\n"}, {"input": "2\n6\n30\n", "output": "360\n"}, {"input": "2\n6\n39\n", "output": "468\n"}, {"input":... | code_stdio |
[
{
"content": "It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells with positive numbers from 1 to n from the left to the right... | [{"input": "95 97575868 5\n4612 1644 3613 5413 5649 2419 5416 3926 4610 4419 2796 5062 2112 1071 3790 4220 3955 2142 4638 2832 2702 2115 2045 4085 3599 2452 5495 4767 1368 2344 4625 4132 5755 5815 2581 6259 1330 4938 815 5430 1628 3108 4342 3692 2928 1941 3714 4498 4471 4842 1822 867 3395 2587 3372 6394 6423 3728 3720 ... | code_stdio |
[
{
"content": "Write a function ```convert_temp(temp, from_scale, to_scale)``` converting temperature from one scale to another. \nReturn converted temp value. \n\nRound converted temp value to an integer(!).\n\nReading: http://en.wikipedia.org/wiki/Conversion_of_units_of_temperature\n\n```\npossible scale input... | [{"input": "128.25\n\"Ro\"\n\"C\"", "output": "[230]", "fn_name": "convert_temp"}, {"input": "373.15\n\"K\"\n\"N\"", "output": "[33]", "fn_name": "convert_temp"}, {"input": "-273.15\n\"C\"\n\"R\"", "output": "[0]", "fn_name": "convert_temp"}, {"input": "-30\n\"De\"\n\"K\"", "output": "[393]", "fn_name": "convert_temp"}... | code_functional |
[
{
"content": "There are three airports A, B and C, and flights between each pair of airports in both directions.\nA one-way flight between airports A and B takes P hours, a one-way flight between airports B and C takes Q hours, and a one-way flight between airports C and A takes R hours.\nConsider a route where... | [{"input": "001 -13 -101", "output": "-114\n"}, {"input": "100 100 100\n", "output": "200\n"}, {"input": "111 -117 -5", "output": "-122\n"}, {"input": "011 -5 -101", "output": "-106\n"}, {"input": "000 -93 -7", "output": "-100\n"}, {"input": "010 -10 -10", "output": "-20\n"}, {"input": "010 -10 -18", "output": "-28\n"}... | code_stdio |
[
{
"content": "The Metropolis computer network consists of n servers, each has an encryption key in the range from 0 to 2^k - 1 assigned to it. Let c_i be the encryption key assigned to the i-th server. Additionally, m pairs of servers are directly connected via a data communication channel. Because of the encry... | [{"input": "10 40 10\n838 215 738 782 183 422 127 283 103 129\n1 2\n1 4\n1 5\n1 6\n1 7\n1 8\n1 9\n1 10\n2 3\n2 4\n2 5\n2 6\n2 7\n2 8\n2 9\n2 10\n3 3\n3 5\n3 6\n3 7\n3 8\n3 9\n3 10\n4 5\n4 6\n4 7\n4 9\n4 10\n5 7\n5 8\n5 9\n5 10\n6 7\n6 8\n6 9\n6 10\n7 9\n7 10\n8 10\n9 10\n", "output": "1028608\n"}, {"input": "10 40 10\n... | code_stdio |
[
{
"content": "Unscramble the eggs.\n\nThe string given to your function has had an \"egg\" inserted directly after each consonant. You need to return the string before it became eggcoded.\n\n## Example\n\nKata is supposed to be for beginners to practice regular expressions, so commenting would be appreciated.\... | [{"input": "\"veggegeggyeggmeggitegge onegg teggoaseggtegg\"", "output": "[\"vegymite on toast\"]", "fn_name": "unscramble_eggs"}, {"input": "\"seggceggreggameggbeggleggedegg egegggeggsegg\"", "output": "[\"scrambled eggs\"]", "fn_name": "unscramble_eggs"}, {"input": "\"Heggeleggleggo weggoreggleggdegg\"", "output": "[... | code_functional |
[
{
"content": "The student council has a shared document file. Every day, some members of the student council write the sequence TMT (short for Towa Maji Tenshi) in it.\n\nHowever, one day, the members somehow entered the sequence into the document at the same time, creating a jumbled mess. Therefore, it is Sugu... | [{"input": "5\n3\nTMT\n3\nTMT\n6\nTMTMTT\n6\nTMTTTT\n6\nTTMMTT\n", "output": "YES\nYES\nYES\nNO\nYES\n"}, {"input": "5\n3\nTMT\n3\nMTT\n6\nTMTMTT\n6\nTMTTTT\n6\nTTMMTT\n", "output": "\nYES\nNO\nYES\nNO\nYES\n"}, {"input": "5\n3\nTMT\n3\nMTT\n6\nTMTMTT\n6\nTMTTTT\n6\nTTMMTT\n", "output": "YES\nNO\nYES\nNO\nYES\n"}, {"in... | code_stdio |
[
{
"content": "Yaroslav has an array, consisting of (2·n - 1) integers. In a single operation Yaroslav can change the sign of exactly n elements in the array. In other words, in one operation Yaroslav can select exactly n array elements, and multiply each of them by -1.\n\nYaroslav is now wondering: what maximum... | [{"input": "56\n-157 136 457 598 -138 -586 -338 752 -566 -718 -333 -965 309 -125 -938 -188 -390 17 -75 -902 -320 163 820 -970 -525 -329 81 488 -412 978 138 344 305 -358 -273 -967 253 -665 -245 187 602 252 -825 -511 828 764 -402 278 995 541 542 549 612 -536 527 -884 225 800 160 -409 -926 -795 -321 -791 981 812 599 381 7... | code_stdio |
[
{
"content": "There are $n$ people who want to participate in a boat competition. The weight of the $i$-th participant is $w_i$. Only teams consisting of two people can participate in this competition. As an organizer, you think that it's fair to allow only teams with the same total weight.\n\nSo, if there are ... | [{"input": "4\n14\n2 6 5 9 5 8 13 14 12 5 6 14 5 2\n36\n15 22 27 14 23 36 10 17 33 21 18 22 3 4 32 24 8 19 36 22 17 11 24 10 33 4 30 6 2 17 11 16 18 1 2 20\n2\n2 2\n12\n4 9 10 6 1 9 5 8 12 9 9 12\n", "output": "3\n11\n1\n4\n"}, {"input": "4\n14\n2 6 5 9 5 8 13 14 12 5 6 14 5 2\n36\n15 22 27 14 23 36 10 17 33 21 18 22 3... | code_stdio |
[
{
"content": "Alice has a string $s$. She really likes the letter \"a\". She calls a string good if strictly more than half of the characters in that string are \"a\"s. For example \"aaabb\", \"axaa\" are good strings, and \"baca\", \"awwwa\", \"\" (empty string) are not.\n\nAlice can erase some characters from... | [{"input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "50\n"}, {"input": "ababababababababababababababababababababababababav\n", "output": "49\n"}, {"input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "50\n"}, {"input": "ababababababababababababababababababababababababav\n"... | code_stdio |
[
{
"content": "You are given a multiset of n integers. You should select exactly k of them in a such way that the difference between any two of them is divisible by m, or tell that it is impossible.\n\nNumbers can be repeated in the original multiset and in the multiset of selected numbers, but number of occurre... | [{"input": "108 29 72\n738 192 711 235 288 288 679 36 785 233 706 71 216 144 216 1419 338 583 495 648 144 432 72 720 541 288 158 328 154 393 10 533 867 176 707 216 314 397 440 142 326 458 568 701 745 144 61 634 520 720 744 144 409 127 526 476 101 469 72 432 738 432 235 641 695 276 144 144 231 555 630 9 109 319 437 288 ... | code_stdio |
[
{
"content": "There is a plane like Figure 1 with 8 vertical and 8 horizontal squares. There are several bombs on that plane. Figure 2 shows an example (● = bomb).\n\n| □ | □ | □ | □ | □ | □ | □ | □\n--- | --- | --- | --- | --- | --- | --- | ---\n□ | □ | □ | □ | □ | □ | □ | □\n□ | □ | □ | □ | □ | □ | □ | □\n□ |... | [{"input": "2\n\n00010010\n00000100\n10001001\n00100010\n01000000\n00001000\n10100010\n01010010\n2\n5\n\n00010010\n00000100\n10001001\n00100010\n01000000\n00001000\n10100000\n01010010\n2\n5", "output": "Data 1:\n00000000\n00000100\n10001001\n00100000\n00000000\n00001000\n10100000\n00000000\nData 2:\n00010010\n00000100\... | code_stdio |
[
{
"content": "I decided to play rock-paper-scissors with a group of five good friends. Rock-paper-scissors has three hands: goo, choki, and par. If the game between goo and choki is a match between goo and choki, goo is \"winning\" and choki is \"losing\". , Par and Goo have the rule that Par is \"winning\" and... | [{"input": "1\n3\n3\n2\n1\n1\n2\n2\n2\n1\n0", "output": "3\n3\n3\n3\n3\n1\n2\n2\n2\n1\n"}, {"input": "1\n1\n1\n2\n1\n1\n2\n2\n2\n1\n0", "output": "1\n1\n1\n2\n1\n1\n2\n2\n2\n1\n"}, {"input": "1\n2\n3\n2\n1\n1\n1\n2\n2\n1\n0", "output": "3\n3\n3\n3\n3\n1\n1\n2\n2\n1\n"}, {"input": "1\n2\n2\n2\n1\n1\n1\n2\n2\n1\n0", "out... | code_stdio |
[
{
"content": "Prior to having fancy iPhones, teenagers would wear out their thumbs sending SMS\nmessages on candybar-shaped feature phones with 3x4 numeric keypads.\n\n ------- ------- -------\n | | | ABC | | DEF |\n | 1 | | 2 | | 3 |\n ------- ------- -------\n ------- ------- -------\... | [{"input": "\"WHERE DO U WANT 2 MEET L8R\"", "output": "[47]", "fn_name": "presses"}, {"input": "\"IS NE1 OUT THERE\"", "output": "[31]", "fn_name": "presses"}, {"input": "\"#codewars #rocks\"", "output": "[36]", "fn_name": "presses"}, {"input": "\"HOW R U\"", "output": "[13]", "fn_name": "presses"}, {"input": "\"ZER0\... | code_functional |
[
{
"content": "You want to go on a trip with a friend. However, friends who have a habit of spending money cannot easily save travel expenses. I don't know when my friends will go on a trip if they continue their current lives. So, if you want to travel early, you decide to create a program to help your friends ... | [{"input": "10000\n1225 3150\n861 12737\n0 -1\n5000 1050\n5000 4211\n5000 412\n5000 5000\n5000 5000\n-1 -1\n5075 1951\n9143 2494\n5000 2100\n29170\n100000 000000\n100010 110000\n100000 100000\n100000 100000\n100100 100100\n100000 111000\n100000 100000\n101000 100000\n100000 100010\n100000 100000\n100000 000000\n100000 ... | code_stdio |
[
{
"content": "Recently, Norge found a string $s = s_1 s_2 \\ldots s_n$ consisting of $n$ lowercase Latin letters. As an exercise to improve his typing speed, he decided to type all substrings of the string $s$. Yes, all $\\frac{n (n + 1)}{2}$ of them!\n\nA substring of $s$ is a non-empty string $x = s[a \\ldots... | [{"input": "200 13\nvgfjhgkgwkftaeqejmbgildembgxdbskxfndwmcckjfkbeekxkgakmcjhclqsecpnkaigcxxhfghgegfadjktckftdhtifriemfifakygoesjfginnddjjklwiwlbjsgftwhtjdxmcadpvhaeddxwnmguwhetwbmffbmvdvuhecgjckddrbikgwkrfwfhdhqolidgkfm\na b c d e f g h i j k l m\n", "output": "578\n"}, {"input": "200 13\nvgfjhgkgwkftaeqejmbgildembgxd... | code_stdio |
[
{
"content": "For his computer science class, Jacob builds a model tree with sticks and balls containing n nodes in the shape of a tree. Jacob has spent ai minutes building the i-th ball in the tree.\n\nJacob's teacher will evaluate his model and grade Jacob based on the effort he has put in. However, she does ... | [{"input": "10 3\n703660 186846 317819 628672 131569 58472 247014 480113 252764 860936\n10 6\n7 4\n10 9\n9 5\n6 3\n6 2\n10 1\n10 7\n10 8\n", "output": "480113\n"}, {"input": "10 3\n703660 186846 317819 1004549 74457 58472 247014 480113 252764 1263340\n10 6\n7 4\n10 9\n9 5\n9 3\n6 2\n7 1\n10 7\n10 8\n", "output": "25276... | code_stdio |
[
{
"content": "Lord Omkar has permitted you to enter the Holy Church of Omkar! To test your worthiness, Omkar gives you a password which you must interpret!\n\nA password is an array $a$ of $n$ positive integers. You apply the following operation to the array: pick any two adjacent numbers that are not equal to ... | [{"input": "80\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1... | code_stdio |
[
{
"content": "As Famil Door’s birthday is coming, some of his friends (like Gabi) decided to buy a present for him. His friends are going to buy a string consisted of round brackets since Famil Door loves string of brackets of length n more than any other strings!\n\nThe sequence of round brackets is called val... | [{"input": "1980 464\n))(()()))(((((((((()))))))(()(((()((()))()()())()))()))(()))))))(())((())))()())()((())())()())))(())()(()))(()())()((((()))())()(())))))(()()(()(((((()(()()))(((()))(())))))()())(())))))())()()((())))))))((()(())))))()()(()((()((()()))(()))(())(()))()((((())()()))))))()(())))()(()())()())(((((())... | code_stdio |
[
{
"content": "The \"BerCorp\" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of languages, which he knows. This list could be empty, i. e. an employee may k... | [{"input": "100 100\n1 33\n0\n2 35 4\n2 40 78\n1 69\n0\n1 2\n0\n0\n2 81 34\n1 45\n0\n1 87\n1 50\n1 97\n0\n2 100 59\n0\n0\n0\n1 45\n0\n0\n0\n1 6\n1 54\n0\n0\n0\n4 79 96 52 84\n1 86\n0\n0\n0\n0\n0\n0\n0\n0\n3 90 2 80\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n1 2\n0\n1 64\n0\n1 78\n1 82\n0\n0\n0\n0\n0\n1 6\n0\n0\n2 47 57\n1 95\n0\n2... | code_stdio |
[
{
"content": "The classic programming language of Bitland is Bit++. This language is so peculiar and complicated.\n\nThe language is that peculiar as it has exactly one variable, called x. Also, there are two operations:\n\n Operation ++ increases the value of variable x by 1. Operation -- decreases the value... | [{"input": "101\nX++\nX++\nX++\n++X\n--X\nX--\nX++\nX--\nX--\n--X\n--X\n++X\nX++\n++X\n++X\nX--\n--X\n++X\nX++\nX--\n++X\n--X\n--X\n--X\n++X\n--X\n++X\nX++\nX++\n++X\n--X\nX++\nX--\nX++\n++X\n++X\nX--\nX--\nX--\nX++\nX++\nX--\nX--\nX++\n++X\n++X\n++X\n--X\n--X\n++X\nX--\nX--\n--X\n++X\nX--\n++X\nX++\n++X\nX--\nX--\n--X... | code_stdio |
[
{
"content": "This is the story of 20XX. The number of air passengers increased as a result of the stable energy supply by the renewable power network and the invention of liquefied synthetic fuel. However, the threat of terrorism by aircraft still exists, and the importance of fast and highly reliable automati... | [{"input": "6\n1 1\n.\n3 3\n...\n.W.\n...\n10 10\n..........\n.DDDDCCC..\n.DDDDCCC..\n.DDDDCCC..\nADDDDCCC..\nAAA..CCC..\n..CBBBBAAA\nAAABBBB...\n..BBBBB...\n..........\n10 10\n..........\n.DDDDDD...\n.DDDDCCC..\n.DDDDCCC..\nADDDDCCC..\nAAA.-CCC..\nAAABBBBC..\nAAABBBB...\n..BBBBB...\n..........\n10 10\nR..E..C.T.\nR.EE... | code_stdio |
[
{
"content": "Problem F Pizza Delivery\n\nAlyssa is a college student, living in New Tsukuba City. All the streets in the city are one-way. A new social experiment starting tomorrow is on alternative traffic regulation reversing the one-way directions of street sections. Reversals will be on one single street s... | [{"input": "4 5\n1 3 7\n4 2 6\n4 3 0\n2 1 34\n3 3 12", "output": "SOSO\nSOSO\nHAPPY\nHAPPY\nSOSO\n"}, {"input": "4 5\n1 1 5\n3 4 6\n4 2 13\n2 1 6\n2 3 17", "output": "SOSO\nSOSO\nSOSO\nHAPPY\nSOSO\n"}, {"input": "4 5\n1 3 5\n3 4 6\n2 2 7\n2 1 1\n2 3 17", "output": "SOSO\nSOSO\nSOSO\nHAPPY\nHAPPY\n"}, {"input": "4 5\n1 ... | code_stdio |
[
{
"content": "Billy investigates the question of applying greedy algorithm to different spheres of life. At the moment he is studying the application of greedy algorithm to the problem about change. There is an amount of n coins of different face values, and the coins of each value are not limited in number. Th... | [{"input": "91\n4000000 3000000 2900000 2511334 2511333 2102003 1901011 1700000 1200000 999999 800000 750000 600000 508111 202000 101000 35000 20000 9000 5000 2000 899 630 629 628 627 626 625 624 623 622 621 620 619 618 617 616 615 614 613 612 611 610 609 608 607 606 605 604 603 602 601 504 405 404 403 402 401 305 304 ... | code_stdio |
[
{
"content": "The new camp by widely-known over the country Spring Programming Camp is going to start soon. Hence, all the team of friendly curators and teachers started composing the camp's schedule. After some continuous discussion, they came up with a schedule s, which can be represented as a binary string, ... | [{"input": "01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101... | code_stdio |
[
{
"content": "This problem is a simplified version of D2, but it has significant differences, so read the whole statement.\n\nPolycarp has an array of $n$ ($n$ is even) integers $a_1, a_2, \\dots, a_n$. Polycarp conceived of a positive integer $k$. After that, Polycarp began performing the following operations ... | [{"input": "10\n10\n25 25 7 61 97 -47 43 7 -11 -29\n10\n44 -10 -10 -64 -64 98 -64 62 -10 -64\n10\n20 50 65 35 65 -40 50 20 -55 -10\n10\n7 -91 -77 -91 -21 7 77 35 21 -7\n10\n56 -76 78 12 -54 -43 23 1 -65 45\n10\n-68 12 -88 -48 52 -8 -28 -8 92 -88\n10\n55 -2 -2 74 36 -59 -59 55 36 -78\n10\n70 -66 -76 71 3 44 96 -78 50 -5... | code_stdio |
[
{
"content": "Bob is playing a game of Spaceship Solitaire. The goal of this game is to build a spaceship. In order to do this, he first needs to accumulate enough resources for the construction. There are $n$ types of resources, numbered $1$ through $n$. Bob needs at least $a_i$ pieces of the $i$-th resource t... | [{"input": "2\n4 4\n9\n1 1 1\n1 2 1\n1 3 1\n2 1 2\n2 2 2\n2 3 2\n2 3 1\n2 2 1\n2 1 1\n", "output": "7\n6\n5\n4\n3\n2\n2\n3\n4\n"}, {"input": "2\n4 4\n9\n1 1 1\n1 2 1\n1 3 1\n2 1 2\n2 2 2\n2 3 2\n2 3 1\n2 2 1\n2 1 1\n", "output": "7\n6\n5\n4\n3\n2\n2\n3\n4\n"}, {"input": "2\n4 4\n9\n1 1 1\n2 2 1\n1 3 1\n2 1 2\n2 2 2\n2 ... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.