messages
listlengths
1
1
ground_truth
stringlengths
156
726k
dataset
stringclasses
2 values
[ { "content": "Anatoly lives in the university dorm as many other students do. As you know, cockroaches are also living there together with students. Cockroaches might be of two colors: black and red. There are n cockroaches living in Anatoly's room.\n\nAnatoly just made all his cockroaches to form a single line...
[{"input": "166\nrbbbbbbbbbbbbrbrrbbrbbbrbbbbbbbbbbrbbbbbbrbbbrbbbbbrbbbbbbbrbbbbbbbrbbrbbbbbbbbrbbbbbbbbbbbbbbrrbbbrbbbbbbbbbbbbbbrbrbbbbbbbbbbbrbbbbbbbbbbbbbbrbbbbbbbbbbbbbbbbbbbbbb\n", "output": "70\n"}, {"input": "166\nrbbbbbbbbbbbbrbrrbbrbbbrbbbbbbbbbbrbbbbbbrbbbrbbbbbrbbbbbbbrbbbbbbbrbbrbbbbbbbbrbbbbbbbbbbbbbbrrb...
code_stdio
[ { "content": "We have a tree with N vertices. The vertices are numbered 0 through N - 1, and the i-th edge (0 ≤ i < N - 1) comnnects Vertex a_i and b_i. For each pair of vertices u and v (0 ≤ u, v < N), we define the distance d(u, v) as the number of edges in the path u-v.\n\nIt is expected that one of the vert...
[{"input": "10\n2 8\n6 0\n4 1\n7 6\n2 3\n8 6\n6 9\n2 4\n5 8", "output": "3"}, {"input": "5\n0 1\n0 2\n1 3\n3 4", "output": "1"}, {"input": "5\n0 1\n0 2\n0 3\n3 4", "output": "2"}, {"input": "2\n0 18", "output": "1"}, {"input": "2\n0 12", "output": "1"}, {"input": "2\n0 17", "output": "1"}, {"input": "2\n1 17", "output"...
code_stdio
[ { "content": "You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character \"0\" and \"1\") a and b. Then you try to turn a into b using two types of opera...
[{"input": "0\n00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
code_stdio
[ { "content": "You can print your name on a billboard ad. Find out how much it will cost you. Each letter has a default price of £30, but that can be different if you are given 2 parameters instead of 1.\n\nYou can not use multiplier \"*\" operator.\n\nIf your name would be Jeong-Ho Aristotelis, ad would cost £6...
[{"input": "\"Jeong-Ho Aristotelis\"", "output": "[600]", "fn_name": "billboard"}, {"input": "\"Abishai Charalampos\"", "output": "[570]", "fn_name": "billboard"}, {"input": "\"Zoroaster Donnchadh\"", "output": "[570]", "fn_name": "billboard"}, {"input": "\"Hjalmar Liupold\"\n40", "output": "[600]", "fn_name": "billboa...
code_functional
[ { "content": "# Task\n John is new to spreadsheets. He is well aware of rows and columns, but he is not comfortable with spreadsheets numbering system.\n```\nSpreadsheet Row Column\nA1 R1C1\nD5 R5C4\nAA48 R48C27\nBK12 R1...
[{"input": "\"AA48\"", "output": "[\"R48C27\"]", "fn_name": "spreadsheet"}, {"input": "\"BK12\"", "output": "[\"R12C63\"]", "fn_name": "spreadsheet"}, {"input": "\"R12C63\"", "output": "[\"BK12\"]", "fn_name": "spreadsheet"}, {"input": "\"R31C78\"", "output": "[\"BZ31\"]", "fn_name": "spreadsheet"}, {"input": "\"BZ31\"...
code_functional
[ { "content": "The north country is conquered by the great shogun-sama (which means king). Recently many beautiful dice which were made by order of the great shogun-sama were given to all citizens of the country. All citizens received the beautiful dice with a tear of delight. Now they are enthusiastically playi...
[{"input": "1 2\n10 8\n0 0\n0 1\n3 3\n1 3 5\n2 13 1\n1 0 2\n0 0\n0 2\n3 3\n1 2 4\n4 8 10\n1 1 2\n0 0\n1 2\n2 2\n1 2\n5 4\n1 0\n0 1\n2 3\n1 2 3\n5 5 6\n0 0\n1 2\n0 0", "output": "24\n14\n30\n11\n21\n"}, {"input": "1 2\n10 8\n0 0\n0 1\n3 3\n1 3 5\n2 13 1\n1 0 2\n0 0\n0 2\n3 3\n1 2 4\n4 8 10\n1 1 2\n0 0\n1 2\n2 2\n1 2\n3 ...
code_stdio
[ { "content": "Petya is having a party soon, and he has decided to invite his $n$ friends.\n\nHe wants to make invitations in the form of origami. For each invitation, he needs two red sheets, five green sheets, and eight blue sheets. The store sells an infinite number of notebooks of each color, but each notebo...
[{"input": "100000000 1\n", "output": "1500000000\n"}, {"input": "100000000 1\n", "output": "1500000000\n"}, {"input": "100000010 1\n", "output": "1500000150\n"}, {"input": "100010010 1\n", "output": "1500150150\n"}, {"input": "103616972 10575\n", "output": "146976\n"}, {"input": "100000000 3\n", "output": "500000001\n...
code_stdio
[ { "content": "Your program fails again. This time it gets \"Wrong answer on test 233\".\n\nThis is the harder version of the problem. In this version, $1 \\le n \\le 2\\cdot10^5$. You can hack this problem if you locked it. But you can hack the previous problem only if you locked both problems.\n\nThe problem i...
[{"input": "100 100\n82 51 14 14 37 17 78 92 64 15 8 86 89 8 87 77 30 15 15 12 100 25 161 47 21 78 20 63 13 49 41 36 41 79 16 87 87 69 3 76 80 60 100 49 70 59 72 8 38 71 45 148 71 14 76 54 81 4 59 46 39 29 92 3 49 22 53 99 118 52 74 31 92 43 70 23 44 9 82 47 7 40 12 9 3 55 37 85 46 22 84 52 98 41 11 47 40 17 62 91\n", ...
code_stdio
[ { "content": "Bad news came to Mike's village, some thieves stole a bunch of chocolates from the local factory! Horrible! \n\nAside from loving sweet things, thieves from this area are known to be very greedy. So after a thief takes his number of chocolates for himself, the next thief will take exactly k times ...
[{"input": "1000000000000000\n", "output": "4949100894494448\n"}, {"input": "1000000000000000\n", "output": "4949100894494448\n"}, {"input": "999999999999997\n", "output": "4949100894494440\n"}, {"input": "999999999999996\n", "output": "4949100894494432\n"}, {"input": "999999999999995\n", "output": "4949100894494424\n"...
code_stdio
[ { "content": "You are given an array $a$ of length $n$. The array is called 3SUM-closed if for all distinct indices $i$, $j$, $k$, the sum $a_i + a_j + a_k$ is an element of the array. More formally, $a$ is 3SUM-closed if for all integers $1 \\leq i < j < k \\leq n$, there exists some integer $1 \\leq l \\leq n...
[{"input": "4\n3\n-1 0 1\n5\n1 -2 -2 1 -3\n6\n0 0 0 0 0 0\n4\n-1 2 -3 4\n", "output": "YES\nNO\nYES\nNO\n"}, {"input": "1\n3\n0 65536 65536\n", "output": "NO\n"}, {"input": "1\n4\n-3 -1 1 1\n", "output": "YES\n"}, {"input": "1\n4\n3 -3 -3 9\n", "output": "YES\n"}, {"input": "1\n4\n-1 -4 2 3\n", "output": "NO\n"}, {"inp...
code_stdio
[ { "content": "You throw a ball vertically upwards with an initial speed `v (in km per hour)`. The height `h` of the ball at each time `t`\nis given by `h = v*t - 0.5*g*t*t` where `g` is Earth's gravity `(g ~ 9.81 m/s**2)`. A device is recording at every **tenth\nof second** the height of the ball.\nFor example ...
[{"input": "136", "output": "[39]", "fn_name": "max_ball"}, {"input": "127", "output": "[36]", "fn_name": "max_ball"}, {"input": "137", "output": "[39]", "fn_name": "max_ball"}, {"input": "37", "output": "[10]", "fn_name": "max_ball"}, {"input": "45", "output": "[13]", "fn_name": "max_ball"}, {"input": "99", "output": ...
code_functional
[ { "content": "Nauuo is a girl who loves playing cards.\n\nOne day she was playing cards but found that the cards were mixed with some empty ones.\n\nThere are n cards numbered from 1 to n, and they were mixed with another n empty cards. She piled up the 2n cards and drew n of them. The n cards in Nauuo's hands ...
[{"input": "20\n15 10 6 0 0 11 19 17 0 0 0 0 0 1 14 0 3 4 0 12\n20 7 0 0 0 0 0 0 5 8 2 16 18 0 0 13 9 0 0 0\n", "output": "30\n"}, {"input": "20\n0 0 0 0 5 6 7 8 0 0 11 12 13 14 15 16 17 18 0 0\n20 9 19 0 0 0 0 0 0 10 0 0 0 0 0 0 1 2 3 4\n", "output": "37\n"}, {"input": "19\n0 0 0 0 0 0 0 0 0 18 17 16 15 14 13 12 11 10...
code_stdio
[ { "content": "Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are?\n\nConstraints\n\n* 1 ≤ N,A,B ≤ 10^9\n* A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following for...
[{"input": "13 -10 2", "output": "133\n"}, {"input": "125 -2 0", "output": "247\n"}, {"input": "109 0 1", "output": "108\n"}, {"input": "109 0 2", "output": "215\n"}, {"input": "19 -7 -2", "output": "86\n"}, {"input": "48 -1 2", "output": "139\n"}, {"input": "69 -1 2", "output": "202\n"}, {"input": "36 -1 2", "output":...
code_stdio
[ { "content": "As we know, DZY loves playing games. One day DZY decided to play with a n × m matrix. To be more precise, he decided to modify the matrix with exactly k operations.\n\nEach modification is one of the following:\n\n 1. Pick some row of the matrix and decrease each element of the row by p. This ope...
[{"input": "10 10 50 80\n529 349 889 455 946 983 312 179 590 907\n436 940 407 1064 26 963 181 789 461 437\n367 505 888 521 449 741 900 994 342 629\n605 374 112 829 212 329 295 416 181 435\n661 647 676 144 436 629 660 282 545 470\n392 555 351 969 102 178 588 578 696 592\n837 115 669 760 324 680 584 822 909 75\n575 89 56...
code_stdio
[ { "content": "Polo, the Penguin, likes numbers. He says that the goodness of a number is itself multiplied by the number of digits in it's decimal representation. For example, the goodness of the integer 474 is 474*3 = 1422.\nHelp him to count the sum of goodness of all integers from L to R, inclusive. Since th...
[{"input": "1\n13 393", "output": "227157\n"}, {"input": "1\n15 149", "output": "28365\n"}, {"input": "1\n15 260", "output": "96630\n"}, {"input": "1\n13 260", "output": "96684\n"}, {"input": "1\n13 130", "output": "20439\n"}, {"input": "1\n1 345", "output": "174060\n"}, {"input": "1\n2 345", "output": "174059\n"}, {"i...
code_stdio
[ { "content": "There are $n$ people sitting in a circle, numbered from $1$ to $n$ in the order in which they are seated. That is, for all $i$ from $1$ to $n-1$, the people with id $i$ and $i+1$ are adjacent. People with id $n$ and $1$ are adjacent as well.\n\nThe person with id $1$ initially has a ball. He picks...
[{"input": "735134400\n", "output": "1 367567202 735134403 1102701604 1470268805 1837836006 2205403207 2572970408 2940537609 3308104810 3675672011 4043239212 4410806413 4778373614 5145940815 5513508016 5881075217 6248642418 6983776820 7351344021 7718911222 8454045624 8821612825 9189180026 9556747227 9924314428 10659448...
code_stdio
[ { "content": "Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to...
[{"input": "DpiNBmCRFWxpdbfGOzvvOcemjructoAdEwegTvbVbfWWRPGyEAxGdDRWVlqNyGWMWHMrHAIZpyxvgaflrsVZhhZRouvpxrKXFZam\nwwPLFtNfPtJXvMLuHjKfYyaRhreNSWSzOvDpqHCGcqllACNPGHxReeFUCmAqIKXYytsSQwIxJzNiiUtgebVuwRmWpRALLyKAzyDPvgIGxALSaeeTIqm\n", "output": "66 12\n"}, {"input": "DpiNBmCRFWxpdbfGOzvvOcemjructoAdEwegTvbVbfWWRPGyEAxGd...
code_stdio
[ { "content": "This is related to my other Kata about cats and dogs.\n\n# Kata Task\n\nI have a cat and a dog which I got as kitten / puppy.\n\nI forget when that was, but I do know their current ages as `catYears` and `dogYears`.\n\nFind how long I have owned each of my pets and return as a list [`ownedCat`, `o...
[{"input": "56\n64", "output": "[[10, 10]]", "fn_name": "owned_cat_and_dog"}, {"input": "15\n15", "output": "[[1, 1]]", "fn_name": "owned_cat_and_dog"}, {"input": "18\n21", "output": "[[1, 1]]", "fn_name": "owned_cat_and_dog"}, {"input": "19\n17", "output": "[[1, 1]]", "fn_name": "owned_cat_and_dog"}, {"input": "24\n24...
code_functional
[ { "content": "It is Borya's eleventh birthday, and he has got a great present: n cards with numbers. The i-th card has the number a_{i} written on it. Borya wants to put his cards in a row to get one greater number. For example, if Borya has cards with numbers 1, 31, and 12, and he puts them in a row in this or...
[{"input": "4\n2\n1 1\n3\n2 31 12\n3\n21646 67 98\n9\n1 2 3 14 4 11 7 8 9\n", "output": "2\n0\n1\n36288\n"}, {"input": "4\n2\n1 1\n3\n1 31 12\n3\n12345 67 84\n9\n1 2 3 4 5 1 7 8 16\n", "output": "2\n2\n2\n36288\n"}, {"input": "4\n2\n1 1\n3\n1 20 12\n3\n32697 67 98\n9\n1 2 3 4 13 6 7 8 6\n", "output": "2\n2\n0\n31104\n"...
code_stdio
[ { "content": "Roma works in a company that sells TVs. Now he has to prepare a report for the last year.\n\nRoma has got a list of the company's incomes. The list is a sequence that consists of n integers. The total income of the company is the sum of all integers in sequence. Roma decided to perform exactly k c...
[{"input": "78 13\n-9961 -9922 -9817 -9813 -9521 -9368 -9361 -9207 -9153 -9124 -9008 -8981 -8951 -8911 -8551 -8479 -8245 -8216 -7988 -7841 -7748 -7741 -7734 -7101 -6846 -6804 -6651 -6526 -6519 -6463 -6297 -6148 -6090 -5845 -5209 -5201 -5161 -5061 -4537 -4529 -4433 -4370 -4266 -4189 -4125 -3945 -3843 -3777 -3751 -3476 -...
code_stdio
[ { "content": "-----Problem Statement-----\nChef studies combinatorics. He tries to group objects by their rang (a positive integer associated with each object). He also gives the formula for calculating the number of different objects with rang N as following:\n\nthe number of different objects with rang N = F(...
[{"input": "4\n1 1 2 -1\n1\n3 1 0 0\n5\n0 1 1 0\n12\n1 4 1 7\n12", "output": "3\n342\n187771\n636400412\n"}, {"input": "4\n1 2 2 -1\n1\n3 1 0 0\n5\n0 1 1 0\n12\n1 4 1 7\n12", "output": "4\n342\n187771\n636400412\n"}, {"input": "4\n1 1 2 -1\n1\n5 1 0 0\n5\n0 1 2 0\n6\n1 4 0 7\n12", "output": "3\n1100\n2618\n549147970\n"...
code_stdio
[ { "content": "Given are 1-digit positive integers a and b. Consider these two strings: the concatenation of b copies of the digit a, and the concatenation of a copies of the digit b. Which of these is lexicographically smaller?\n\n-----Constraints-----\n - 1 \\leq a \\leq 9\n - 1 \\leq b \\leq 9\n - a and b are...
[{"input": "96 1", "output": "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n"}, {"input": "10 40", "output": "10101010101010101010101010101010101010101010101010101010101010101010101010101010\n"}, {"input": "80 1", "output": "1111111111111111111111111111111111111111111...
code_stdio
[ { "content": "A TV program called \"Saizo\" is popular in a certain country. In this program, participants challenge field athletics and get a prize if they successfully capture it.\n\nField athletics are made by arranging blocks of different heights in a row, and how to climb up and down the steps is important...
[{"input": "5\n5\n10 101 5 50 390\n2\n20 101\n2\n100 30\n3\n22 86 50\n7\n123 82 678 1617 272 971 1573", "output": "340 96\n81 0\n0 70\n64 36\n939 1345\n"}, {"input": "5\n5\n10 101 5 50 390\n2\n20 101\n2\n100 30\n3\n22 86 50\n7\n123 82 678 1617 106 971 1573", "output": "340 96\n81 0\n0 70\n64 36\n939 1511\n"}, {"input":...
code_stdio
[ { "content": "It's now 260 AD. Shapur, being extremely smart, became the King of Persia. He is now called Shapur, His majesty King of kings of Iran and Aniran.\n\nRecently the Romans declared war on Persia. They dreamed to occupy Armenia. In the recent war, the Romans were badly defeated. Now their senior army ...
[{"input": "17 17\n00000000000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "0\n"}, {"input": "34 17\n00000000000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "0\n"}, {"input": "4 2\n112233030100132210003330\n", "output": "101101011110011000100000111...
code_stdio
[ { "content": "We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements?\n\nHere the bishop can only move diagonally. More formally, the bishop can move from the square at the...
[{"input": "1001000000 1000000000", "output": "500500000000000000\n"}, {"input": "1001000000 1100000000", "output": "550550000000000000\n"}, {"input": "1001000010 1100000000", "output": "550550005500000000\n"}, {"input": "1001000010 1100100000", "output": "550600055500500000\n"}, {"input": "1001000011 1100100000", "out...
code_stdio
[ { "content": "The goal of 8 Queens Problem is to put eight queens on a chess-board such that none of them threatens any of others. A queen threatens the squares in the same row, in the same column, or on the same diagonals as shown in the following figure.\n\n<image>\n\n\nFor a given chess board where $k$ queen...
[{"input": "2\n1 4\n5 3", "output": "..Q.....\n....Q...\n.Q......\n.......Q\n.....Q..\n...Q....\n......Q.\nQ.......\n"}, {"input": "2\n0 4\n5 3", "output": "....Q...\n.Q......\n.....Q..\nQ.......\n......Q.\n...Q....\n.......Q\n..Q.....\n"}, {"input": "2\n0 4\n5 2", "output": "....Q...\n.Q......\n...Q....\n.....Q..\n......
code_stdio
[ { "content": "## Task\n\nFind the sum of the first `n` elements in the Recamán Sequence.\n\nInput range:\n\n```python\n1000 tests\n0 <= n <= 2,500,000\n```\n\n___\n\n## Sequence\n\nThe sequence is formed using the next formula:\n* We start with `0`\n* At each step `i`, we subtract `i` from the previous number\n...
[{"input": "10000", "output": "[82590002]", "fn_name": "rec"}, {"input": "1000", "output": "[837722]", "fn_name": "rec"}, {"input": "200", "output": "[36190]", "fn_name": "rec"}, {"input": "100", "output": "[7496]", "fn_name": "rec"}, {"input": "5", "output": "[12]", "fn_name": "rec"}, {"input": "0", "output": "[0]", "...
code_functional
[ { "content": "Snuke has N integers: 1,2,\\ldots,N. He will choose K of them and give those to Takahashi.\n\nHow many ways are there to choose K consecutive integers?\n\nConstraints\n\n* All values in input are integers.\n* 1 \\leq K \\leq N \\leq 50\n\nInput\n\nInput is given from Standard Input in the followin...
[{"input": "1 -159", "output": "161\n"}, {"input": "119 -1", "output": "121\n"}, {"input": "2 -107", "output": "110\n"}, {"input": "0 -159", "output": "160\n"}, {"input": "112 -1", "output": "114\n"}, {"input": "0 -103", "output": "104\n"}, {"input": "112 -2", "output": "115\n"}, {"input": "-1 -29", "output": "29\n"}, ...
code_stdio
[ { "content": "Sasha grew up and went to first grade. To celebrate this event her mother bought her a multiplication table $M$ with $n$ rows and $n$ columns such that $M_{ij}=a_i \\cdot a_j$ where $a_1, \\dots, a_n$ is some sequence of positive integers.\n\nOf course, the girl decided to take it to school with h...
[{"input": "10\n0 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 0 1 1 1 1 1 1 1 1\n1000000000 1 0 1 1 1 1 1 1 1\n1000000000 1 1 0 1 1 1 1 1 1\n1000000000 1 1 1 0 1 1 1 1 1\n1000000000 1 1 1 1 0 1 1 1 1\n1000000000 1 1 1 1 1 0 1 1 1\n1000000000 1 1 1 1 1 1...
code_stdio
[ { "content": "You are given a program that consists of $n$ instructions. Initially a single variable $x$ is assigned to $0$. Afterwards, the instructions are of two types:\n\nincrease $x$ by $1$;\n\ndecrease $x$ by $1$.\n\nYou are given $m$ queries of the following format:\n\nquery $l$ $r$ — how many distinct v...
[{"input": "2\n8 4\n-+--+--+\n1 8\n2 8\n2 5\n1 1\n4 10\n+-++\n1 1\n1 2\n2 2\n1 3\n2 3\n3 3\n1 4\n2 4\n3 4\n4 4\n", "output": "\n1\n2\n4\n4\n3\n3\n4\n2\n3\n2\n1\n2\n2\n2\n"}, {"input": "2\n8 4\n-+--+--+\n1 8\n2 8\n2 5\n1 1\n4 10\n+-++\n1 1\n1 2\n2 2\n1 3\n2 3\n3 3\n1 4\n2 4\n3 4\n4 4\n", "output": "1\n2\n4\n4\n3\n3\n4\n...
code_stdio
[ { "content": "Developers often face with regular expression patterns. A pattern is usually defined as a string consisting of characters and metacharacters that sets the rules for your search. These patterns are most often used to check whether a particular string meets the certain rules.\n\nIn this task, a patt...
[{"input": "100\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\n?b\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\nb?\...
code_stdio
[ { "content": "Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:(1^{n} + 2^{n} + 3^{n} + 4^{n}) mod 5\n\nfor given value of n. Fedya managed to complete the task. Can you? Note that given number n can be extremely large (e.g. it can exceed any integer type of your pro...
[{"input": "124356983594583453458888889\n", "output": "0\n"}, {"input": "124356983594583453458888889\n", "output": "0\n"}, {"input": "1134974\n", "output": "0\n"}, {"input": "1236642\n", "output": "0\n"}, {"input": "1068905\n", "output": "0\n"}, {"input": "1528132\n", "output": "4\n"}, {"input": "1580332\n", "output": ...
code_stdio
[ { "content": "Kuroni is very angry at the other setters for using him as a theme! As a punishment, he forced them to solve the following problem:\n\nYou have an array $a$ consisting of $n$ positive integers. An operation consists of choosing an element and either adding $1$ to it or subtracting $1$ from it, suc...
[{"input": "10\n648137704891 648137704891 648137704891 648137704891 648137704891 648137704891 648137704891 648137704891 648137704891 724560300002\n", "output": "2\n"}, {"input": "5\n169999847 169999847 169999847 300469729580 169999847\n", "output": "3\n"}, {"input": "5\n8082488 169999847 169999847 300469729580 16999984...
code_stdio
[ { "content": "You have multiset of n strings of the same length, consisting of lowercase English letters. We will say that those strings are easy to remember if for each string there is some position i and some letter c of the English alphabet, such that this string is the only string in the multiset that has l...
[{"input": "3 20\naaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaa\n127368 467778 376749 367872 201445 632491 733098 177711 678142 3202 840006 769776 381139 365553 457474 206005 99000 226191 795686 589632\n785172 213443 482364 357721 191016 596022 882906 601573 917829 966436 129825 285602 706196 722082 ...
code_stdio
[ { "content": "Sonya decided to organize an exhibition of flowers. Since the girl likes only roses and lilies, she decided that only these two kinds of flowers should be in this exhibition.\n\nThere are $n$ flowers in a row in the exhibition. Sonya can put either a rose or a lily in the $i$-th position. Thus eac...
[{"input": "1582 10\n587 646\n1148 843\n326 875\n439 485\n465 521\n330 387\n405 480\n477 115\n572 376\n715 771\n", "output": "01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...
code_stdio
[ { "content": "Long ago, when Petya was a schoolboy, he was very much interested in the Petr# language grammar. During one lesson Petya got interested in the following question: how many different continuous substrings starting with the sbegin and ending with the send (it is possible sbegin = send), the given st...
[{"input": "bgphoaomnjcjhgkgbflfclbjmkbfonpbmkdomjmkahaoclcbijdjlllnpfkbilgiiidbabgojbbfmliemhicaanadbaahagmfdldbbklelkihlcbkhchlikhefeeafbhkabfdlhnnjnlimbhneafcfeapcbeifgcnaijdnkjpikedmdbhahhgcijddfmamdiaapaeimdhfblpkedamifbbdndmmljmdcffcpmanndeeclnpnkdoieiahchdnkdmfnbocnimclgckdcbp\npcbeifgcnaijdnkjpikedmdbhahhgcijdd...
code_stdio
[ { "content": "Let's denote a m-free matrix as a binary (that is, consisting of only 1's and 0's) matrix such that every square submatrix of size m × m of this matrix contains at least one zero. \n\nConsider the following problem:\n\nYou are given two integers n and m. You have to construct an m-free square matr...
[{"input": "3\n21\n0\n1\n", "output": "5 2\n1 1\n-1\n"}, {"input": "3\n21\n0\n1\n", "output": "5 2\n1 1\n-1\n"}, {"input": "1\n297540\n", "output": "546 22\n"}, {"input": "1\n297540\n", "output": "546 22\n"}, {"input": "1\n1015463691\n", "output": "-1\n"}, {"input": "1\n420441920\n", "output": "-1\n"}, {"input": "1\n42...
code_stdio
[ { "content": "In Aizuwakamatsu City, there is a first city called \"Tokaichi\" on January 10th every year. This Tokaichi has a history of about 600 years and is the largest first city in the Aizu region. It is also well known that Okiagari-koboshi, a familiar lucky charm, is sold in the Aizu region. Okiagari-ko...
[{"input": "1593 4311\n4321 2155\n1256 11201\n5310 1455\n2152 5421\n1928 3386\n4528 1578\n1234 4321\n3330 3109\n2739 2199\n0 0", "output": "C 12457\nD 6439\n"}, {"input": "1593 4311\n4321 2155\n1256 12219\n5310 1455\n2152 5421\n1549 3288\n4528 3719\n1234 4321\n3330 2166\n2759 2199\n0 0", "output": "C 13475\nB 8247\n"},...
code_stdio
[ { "content": "Vasya wants to climb up a stair of certain amount of steps (Input parameter 1). There are 2 simple rules that he has to stick to.\n\n1. Vasya can climb 1 or 2 steps at each move.\n2. Vasya wants the number of moves to be a multiple of a certain integer. (Input parameter 2).\n\n### Task:\nWhat is t...
[{"input": "10000\n10", "output": "[5000]", "fn_name": "numberOfSteps"}, {"input": "10000\n2", "output": "[5000]", "fn_name": "numberOfSteps"}, {"input": "10000\n3", "output": "[5001]", "fn_name": "numberOfSteps"}, {"input": "9999\n10", "output": "[5000]", "fn_name": "numberOfSteps"}, {"input": "9999\n3", "output": "[5...
code_functional
[ { "content": "Patrick has just finished writing a message to his sweetheart Stacey when he noticed that the message didn't look fancy. Patrick was nervous while writing the message, so some of the letters there were lowercase and some of them were uppercase.\n\nPatrick believes that a message is fancy if any up...
[{"input": "MMVESdOCALHJCTBTUWWQRGUUVTTTABKKAAdIINAdKLRLLVLODHDXDPMcQfUhPNHFBJSDRGsHZNORSCPNvKOOIuZnZAmTPUCoPNlR\n", "output": "13\n"}, {"input": "MMbJIBhgFXPVpdQHLkWJkAHFIfJSpITTCRzRCzvRPRYECCheOknfINZWuKATDBOrEVKTcWXiYPjtzQMGUSGPNTMCUrvYCSWQHqAi\n", "output": "27\n"}, {"input": "mnAkOBuKxaiJwXhKnlcCvjxYXGXDoIqfUYkiLr...
code_stdio
[ { "content": "There are N people (with different names) and K clubs. For each club you know the list of members (so you have K unordered lists). Each person can be a member of many clubs (and also 0 clubs) and two different clubs might have exactly the same members. The value of the number K is the minimum poss...
[{"input": "119107271329329921", "output": "-1\n"}, {"input": "33213408621377322", "output": "-1\n"}, {"input": "26939847318901699", "output": "-1\n"}, {"input": "12809773843701327", "output": "-1\n"}, {"input": "15368855316243065", "output": "-1\n"}, {"input": "123456789123456789", "output": "-1"}, {"input": "54520540...
code_stdio
[ { "content": "Mike received an array $a$ of length $n$ as a birthday present and decided to test how pretty it is.\n\nAn array would pass the $i$-th prettiness test if there is a way to get an array with a sum of elements totaling $s_i$, using some number (possibly zero) of slicing operations.\n\nAn array slici...
[{"input": "2\n5 5\n1 2 3 4 5\n1\n5\n9\n12\n6\n5 5\n6 1 3 2 3\n1\n2\n3\n15\n11\n", "output": "Yes\nYes\nYes\nNo\nYes\nYes\nYes\nYes\nYes\nNo\n"}, {"input": "2\n5 5\n1 2 3 4 5\n1\n5\n3\n12\n6\n5 5\n6 1 3 2 3\n1\n2\n3\n15\n11\n", "output": "Yes\nYes\nYes\nNo\nYes\nYes\nYes\nYes\nYes\nNo\n"}, {"input": "2\n5 5\n1 2 3 4 5\...
code_stdio
[ { "content": "Given is a connected undirected graph with N vertices and M edges. The vertices are numbered 1 to N, and the edges are described by a grid of characters S. If S_{i,j} is `1`, there is an edge connecting Vertex i and j; otherwise, there is no such edge.\n\nDetermine whether it is possible to divide...
[{"input": "6\n010111\n101001\n010100\n101000\n100000\n010000", "output": "-1\n"}, {"input": "6\n010110\n101001\n010100\n101000\n100100\n010000", "output": "-1\n"}, {"input": "6\n010110\n001001\n010100\n101000\n100100\n010000", "output": "-1\n"}, {"input": "6\n010110\n001001\n010100\n101000\n000100\n010000", "output": ...
code_stdio
[ { "content": "You like playing chess tournaments online.\n\nIn your last tournament you played $n$ games. For the sake of this problem, each chess game is either won or lost (no draws). When you lose a game you get $0$ points. When you win you get $1$ or $2$ points: if you have won also the previous game you ge...
[{"input": "8\n5 2\nWLWLL\n6 5\nLLLWWL\n7 4\nLWLWLWL\n15 5\nWWWLLLWWWLLLWWW\n40 38\nLLWLWLWWWLWLLWLWWWLWLLWLLWLLLLWLLWWWLWWL\n1 0\nL\n1 0\nL\n6 0\nWLLWLW\n", "output": "7\n11\n13\n26\n79\n0\n0\n3\n"}, {"input": "8\n5 2\nWLWLL\n6 5\nLLLWWL\n7 4\nLWLWLWL\n15 2\nWWWLLLWWWLLLWWW\n40 38\nLLWLWLWWWLWLLWLWWWLWLLWLLWLLLLWLLWWW...
code_stdio
[ { "content": "Vasya commutes by train every day. There are n train stations in the city, and at the i-th station it's possible to buy only tickets to stations from i + 1 to a_{i} inclusive. No tickets are sold at the last station.\n\nLet ρ_{i}, j be the minimum number of tickets one needs to buy in order to get...
[{"input": "10\n2 10 8 7 8 8 10 9 10\n", "output": "63\n"}, {"input": "10\n2 10 8 7 8 8 10 9 10\n", "output": "63\n"}, {"input": "10\n2 10 8 7 8 9 10 9 10\n", "output": "62\n"}, {"input": "10\n3 10 8 7 8 9 10 9 10\n", "output": "61\n"}, {"input": "10\n2 10 8 6 8 8 10 9 10\n", "output": "66\n"}, {"input": "9\n2 9 7 6 9 ...
code_stdio
[ { "content": "After many years of research, Ikta has acquired the ability to predict the future! The time and money he spent on this research was enormous, but it's finally time to be rewarded. To get the money back, Ikta decided to start investing in stocks.\n\nIkta does not currently own any shares, but owns ...
[{"input": "3 3 10\n18 1 13\n15 3 3\n5 10 0", "output": "100\n"}, {"input": "3 3 10\n10 14 13\n14 2 6\n5 4 1", "output": "28\n"}, {"input": "3 3 10\n18 4 13\n15 3 3\n5 11 1", "output": "34\n"}, {"input": "3 3 10\n18 4 13\n15 5 3\n5 11 1", "output": "24\n"}, {"input": "3 3 18\n10 14 13\n14 3 3\n5 4 1", "output": "29\n"}...
code_stdio
[ { "content": "Programmer Vasya is studying a new programming language &K*. The &K* language resembles the languages of the C family in its syntax. However, it is more powerful, which is why the rules of the actual C-like languages are unapplicable to it. To fully understand the statement, please read the langua...
[{"input": "10\ntypedef &void**** youdyfpinzk\ntypeof &youdyfpinzk***\ntypedef &&&&youdyfpinzk****** nfbsgpjzhxzskmxc\ntypeof nfbsgpjzhxzskmxc***\ntypedef &&&void*** puerqioirikxej\ntypeof &puerqioirikxej********\ntypedef &puerqioirikxej******** xzgzsamjdufuyxz\ntypeof &xzgzsamjdufuyxz******\ntypedef &&&&xzgzsamjdufuyx...
code_stdio
[ { "content": "AtCoDeer the deer found two rectangles lying on the table, each with height 1 and width W.\nIf we consider the surface of the desk as a two-dimensional plane, the first rectangle covers the vertical range of [0,1] and the horizontal range of [a,a+W], and the second rectangle covers the vertical ra...
[{"input": "-1 -1 100", "output": "102\n"}, {"input": "-1 -1 101", "output": "103\n"}, {"input": "-1 -1 111", "output": "113\n"}, {"input": "0 -116 -1", "output": "115\n"}, {"input": "-2 -1 111", "output": "114\n"}, {"input": "2 -160 -1", "output": "157\n"}, {"input": "0 -155 -1", "output": "154\n"}, {"input": "0 -191 ...
code_stdio
[ { "content": "Adam Ivan is working as a system administrator at Soy Group, Inc. He is now facing at a big trouble: a number of computers under his management have been infected by a computer virus. Unfortunately, anti-virus system in his company failed to detect this virus because it was very new.\n\nAdam has i...
[{"input": "4 2\n1 1 3\n-1 2 -1\n5 2\n0 3 1\n1 0 0\n0 0", "output": "2\n1\n"}, {"input": "4 2\n0 1 3\n-1 2 -1\n5 2\n0 3 1\n1 0 0\n0 0", "output": "2\n1\n"}, {"input": "4 2\n0 1 3\n-1 2 -1\n6 2\n0 3 1\n1 0 0\n0 0", "output": "2\n1\n"}, {"input": "3 2\n0 1 3\n-1 2 -1\n6 2\n0 3 1\n1 0 0\n0 0", "output": "2\n1\n"}, {"input...
code_stdio
[ { "content": "Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exams on one day, and in any order.\n\nAccording...
[{"input": "1\n1001000000 999999999\n", "output": "999999999\n"}, {"input": "1\n1101010000 523461264\n", "output": "523461264\n"}, {"input": "1\n1101000000 193606579\n", "output": "193606579\n"}, {"input": "1\n1101000000 142743309\n", "output": "142743309\n"}, {"input": "1\n1101000000 121903142\n", "output": "121903142...
code_stdio
[ { "content": "Consider a football tournament where n teams participate. Each team has two football kits: for home games, and for away games. The kit for home games of the i-th team has color x_{i} and the kit for away games of this team has color y_{i} (x_{i} ≠ y_{i}).\n\nIn the tournament, each team plays exac...
[{"input": "30\n25 8\n25 4\n21 9\n25 1\n7 16\n23 21\n22 17\n27 29\n7 29\n20 3\n13 23\n7 13\n16 18\n25 14\n13 17\n28 15\n10 23\n25 18\n2 3\n23 13\n30 8\n13 15\n20 15\n11 29\n10 23\n5 16\n4 14\n4 30\n7 20\n11 1\n", "output": "29 29\n31 27\n29 29\n29 29\n30 28\n30 28\n29 29\n29 29\n29 29\n29 29\n31 27\n32 26\n29 29\n29 29...
code_stdio
[ { "content": "Прошло много лет, и на вечеринке снова встретились n друзей. С момента последней встречи техника шагнула далеко вперёд, появились фотоаппараты с автоспуском, и теперь не требуется, чтобы один из друзей стоял с фотоаппаратом, и, тем самым, оказывался не запечатлённым на снимке.\n\nУпрощенно процесс...
[{"input": "42\n13 62\n114 242\n265 839\n756 349\n298 476\n533 704\n348 277\n554 573\n654 112\n429 836\n574 766\n909 415\n163 891\n532 983\n873 457\n719 117\n1 302\n170 634\n166 585\n721 231\n208 609\n128 246\n845 726\n604 119\n859 110\n568 515\n656 913\n113 166\n794 566\n834 860\n983 596\n545 819\n167 9\n960 73\n260 6...
code_stdio
[ { "content": "We want to find the numbers higher or equal than 1000 that the sum of every four consecutives digits cannot be higher than a certain given value.\nIf the number is ``` num = d1d2d3d4d5d6 ```, and the maximum sum of 4 contiguous digits is ```maxSum```, then:\n```python\nd1 + d2 + d3 + d4 <= maxSum\...
[{"input": "3000\n7", "output": "[[141, 1600, 220756]]", "fn_name": "max_sumDig"}, {"input": "5000\n6", "output": "[[122, 2010, 244875]]", "fn_name": "max_sumDig"}, {"input": "5000\n7", "output": "[[196, 2110, 413306]]", "fn_name": "max_sumDig"}, {"input": "5000\n8", "output": "[[296, 2200, 649951]]", "fn_name": "max_s...
code_functional
[ { "content": "You are given n segments on a number line, numbered from 1 to n. The i-th segments covers all integer points from l_i to r_i and has a value w_i.\n\nYou are asked to select a subset of these segments (possibly, all of them). Once the subset is selected, it's possible to travel between two integer ...
[{"input": "45 100\n86 90 344\n67 71 63\n84 87 423\n96 98 297\n85 86 144\n75 80 489\n24 25 17\n75 78 363\n1 3 349\n17 19 146\n35 38 39\n90 93 236\n34 35 463\n59 64 259\n97 100 185\n71 75 214\n80 84 124\n63 67 324\n85 88 204\n47 51 420\n22 24 38\n30 34 41\n94 96 42\n3 6 312\n51 56 440\n84 85 337\n10 14 3\n30 31 390\n46 ...
code_stdio
[ { "content": "Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.\n\nYou know the rules of comparing...
[{"input": "50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n...
code_stdio
[ { "content": "A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot to do the homework. Specifically, he forgot to complete his physics tasks. Next day the teacher ...
[{"input": "44\n52 -54 -29\n-82 -5 -94\n-54 43 43\n91 16 71\n7 80 -91\n3 15 29\n-99 -6 -77\n-3 -77 -64\n73 67 34\n25 -10 -18\n-29 91 63\n-72 86 -16\n-68 85 -81\n-3 36 44\n-74 -14 -80\n34 -96 -97\n-76 -78 -33\n-24 44 -58\n98 12 77\n95 -63 -6\n-51 3 -90\n-92 -10 72\n7 3 -68\n57 -53 71\n29 57 -48\n35 -60 10\n79 -70 -61\n-...
code_stdio
[ { "content": "Given a string consisting of only numbers from 0 to 9, consider the operation of creating a new string from that string according to the following rules. Read the given string one character at a time from the left end. Go, if the same number a continues r, write the number r and the number a in th...
[{"input": "5\n28\n14\n1\n0", "output": "11131221121113122118\n311311222113111231131112132112311321322112111312211312111322212311322113212221\n"}, {"input": "5\n23\n14\n1\n0", "output": "11131221121113122113\n311311222113111231131112132112311321322112111312211312111322212311322113212221\n"}, {"input": "5\n19\n11\n0\n0"...
code_stdio
[ { "content": "After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passe...
[{"input": "78\n2 2 2 2 3 3 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 1 2 2 3 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\n", "output": "39\n"}, {"input": "78\n2 2 2 2 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 2 2 2 2 2 1 2 2 3 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 ...
code_stdio
[ { "content": "Suppose you have two points $p = (x_p, y_p)$ and $q = (x_q, y_q)$. Let's denote the Manhattan distance between them as $d(p, q) = |x_p - x_q| + |y_p - y_q|$.\n\nLet's say that three points $p$, $q$, $r$ form a bad triple if $d(p, r) = d(p, q) + d(q, r)$.\n\nLet's say that an array $b_1, b_2, \\dot...
[{"input": "3\n4\n2 4 1 3\n5\n6 9 1 18 12\n2\n13 37\n", "output": "10\n13\n3\n"}, {"input": "3\n4\n2 4 1 3\n5\n6 9 2 18 12\n2\n13 37\n", "output": "10\n13\n3\n"}, {"input": "3\n4\n2 4 1 3\n5\n0 9 2 18 12\n2\n13 37\n", "output": "10\n13\n3\n"}, {"input": "3\n4\n2 4 1 3\n5\n0 9 2 18 12\n2\n20 37\n", "output": "10\n13\n3\...
code_stdio
[ { "content": "Gag\n\nSegtree has $ N $ of \"gags\", each with a value of $ V_i $.\n\nSegtree decided to publish all the gags in any order.\n\nHere, the \"joy\" you get when you publish the $ i $ th gag to the $ j $ th is expressed as $ V_i --j $.\n\nFind the maximum sum of the \"joy\" you can get.\n\ninput\n\nI...
[{"input": "1\n114525", "output": "114524\n"}, {"input": "1\n105905", "output": "105904\n"}, {"input": "1\n196252", "output": "196251\n"}, {"input": "1\n127413", "output": "127412\n"}, {"input": "1\n318416", "output": "318415\n"}, {"input": "1\n26794", "output": "26793\n"}, {"input": "1\n22977", "output": "22976\n"}, {...
code_stdio
[ { "content": "Your task is to write a program which reads a sequence of integers and prints mode values of the sequence. The mode value is the element which occurs most frequently.\n\n\n\nInput\n\nA sequence of integers ai (1 ≤ ai ≤ 100). The number of integers is less than or equals to 100.\n\nOutput\n\nPrint ...
[{"input": "5\n11\n3\n5\n8\n10\n11\n8\n29\n1\n3\n2", "output": "3\n5\n8\n11\n"}, {"input": "5\n11\n4\n10\n4\n-1\n20\n8\n20\n2\n8\n0", "output": "4\n8\n20\n"}, {"input": "5\n11\n2\n11\n1\n-2\n20\n8\n22\n2\n6\n1", "output": "1\n2\n11\n"}, {"input": "5\n11\n1\n5\n8\n0\n11\n8\n51\n1\n3\n2", "output": "1\n5\n8\n11\n"}, {"in...
code_stdio
[ { "content": "Write a function `consonantCount`, `consonant_count` or `ConsonantCount` that takes a string of English-language text and returns the number of consonants in the string.\n\nConsonants are all letters used to write English excluding the vowels `a, e, i, o, u`.\n\nWrite Python code to solve this pro...
[{"input": "\"h^$&^#$&^elLo world\"", "output": "[7]", "fn_name": "consonant_count"}, {"input": "\"helLo world\"", "output": "[7]", "fn_name": "consonant_count"}, {"input": "\"0123456789\"", "output": "[0]", "fn_name": "consonant_count"}, {"input": "\"012345_Cb\"", "output": "[2]", "fn_name": "consonant_count"}, {"inpu...
code_functional
[ { "content": "B: Ebi-chan and Integer Sequences-\n\nproblem\n\nEbi-chan likes sequences. I especially like arithmetic progressions. This time, I decided to create a sequence that meets the following conditions.\n\n* Arithmetic progression of length n\n* When the i-th element of the sequence is defined as s_i, a...
[{"input": "2 36", "output": "1369\n"}, {"input": "11 54", "output": "305\n"}, {"input": "2 52", "output": "2809\n"}, {"input": "10 54", "output": "337\n"}, {"input": "2 58", "output": "3481\n"}, {"input": "2 39", "output": "1600\n"}, {"input": "2 13", "output": "196\n"}, {"input": "2 10", "output": "121\n"}, {"input":...
code_stdio
[ { "content": "Vasya's house is situated in a forest, and there is a mushroom glade near it. The glade consists of two rows, each of which can be divided into n consecutive cells. For each cell Vasya knows how fast the mushrooms grow in this cell (more formally, how many grams of mushrooms grow in this cell each...
[{"input": "6\n4 1 11 9 3 11\n12 32 19 12 19 11\n", "output": "1035\n"}, {"input": "6\n4 1 11 6 3 11\n12 32 19 12 19 11\n", "output": "1026\n"}, {"input": "6\n4 1 11 6 3 18\n12 32 19 12 19 11\n", "output": "1061\n"}, {"input": "6\n4 1 12 9 3 11\n12 20 19 12 19 11\n", "output": "917\n"}, {"input": "6\n4 1 12 9 3 11\n12 ...
code_stdio
[ { "content": "# Task\n An `amazon` (also known as a queen+knight compound) is an imaginary chess piece that can move like a `queen` or a `knight` (or, equivalently, like a `rook`, `bishop`, or `knight`). The diagram below shows all squares which the amazon attacks from e4 (circles represent knight-like moves wh...
[{"input": "\"e5\"\n\"f6\"", "output": "[[12, 10, 0, 33]]", "fn_name": "amazon_check_mate"}, {"input": "\"a1\"\n\"g5\"", "output": "[[0, 29, 1, 29]]", "fn_name": "amazon_check_mate"}, {"input": "\"a3\"\n\"e4\"", "output": "[[1, 32, 1, 23]]", "fn_name": "amazon_check_mate"}, {"input": "\"f3\"\n\"f2\"", "output": "[[6, 1...
code_functional
[ { "content": "Roy and Biv have a set of n points on the infinite number line.\n\nEach point has one of 3 colors: red, green, or blue.\n\nRoy and Biv would like to connect all the points with some edges. Edges can be drawn between any of the two of the given points. The cost of an edge is equal to the distance b...
[{"input": "4\n1 G\n123123 R\n987987987 B\n1000000000 G\n", "output": "1012135134\n"}, {"input": "4\n1 G\n123123 R\n987987987 B\n1000000100 G\n", "output": "1012135334\n"}, {"input": "4\n2 G\n123123 R\n987987987 B\n1000000000 G\n", "output": "1012135132\n"}, {"input": "4\n1 G\n123123 R\n179925707 B\n1000000100 G\n", "o...
code_stdio
[ { "content": "Perhaps many have heard that the World Biathlon Championship has finished. Although our hero Valera was not present at this spectacular event himself and only watched it on TV, it excited him so much that he decided to enroll in a biathlon section.\n\nOf course, biathlon as any sport, proved very ...
[{"input": "15\n17 5\n-19 5\n-8 3\n27 2\n45 3\n36 2\n-32 2\n49 1\n-3 2\n-41 2\n-35 1\n-46 1\n-29 1\n33 1\n0 1\n50\n24 -4\n41 3\n37 3\n9 2\n38 -4\n-30 2\n-41 -5\n-9 -5\n-33 3\n0 2\n-20 -3\n-49 -4\n34 1\n-38 -2\n17 -1\n-33 3\n-17 4\n16 3\n-49 2\n-3 -4\n-9 2\n35 3\n37 -5\n0 0\n-46 -5\n48 1\n-22 -4\n-29 -5\n-41 4\n-11 0\n-...
code_stdio
[ { "content": "Snuke is going to open a contest named \"AtCoder s Contest\".\nHere, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters.\nSnuke has decided to abbreviate the name of the contest as \...
[{"input": "AtCoder Beginner Contest\n", "output": "ABC\n"}, {"input": "AtCoder Befinner Contest", "output": "ABC\n"}, {"input": "AtCoder sennifeB Cpntest", "output": "AsC\n"}, {"input": "AtCoder rennigeB Contest", "output": "ArC\n"}, {"input": "AtCoder Aeifnnes Cpnsest", "output": "AAC\n"}, {"input": "AtCoder fBfinnes...
code_stdio
[ { "content": "Monocarp has got two strings $s$ and $t$ having equal length. Both strings consist of lowercase Latin letters \"a\" and \"b\". \n\nMonocarp wants to make these two strings $s$ and $t$ equal to each other. He can do the following operation any number of times: choose an index $pos_1$ in the string ...
[{"input": "101\nbabbbbabbbbaabbbbbbbabbbababababbbbbbbbabaababbababbaaabbababbbbbbbbbaabbbababbbbbabbbbbabbbaabbbaabb\nbbabbbbbbabbbbbbbbbbbabbbbbbbbbbabbabbbbbbbbbbbabbababbbabbabbbbbbbbbbbbbaabbbabbbbabbabbbbababbbbbab\n", "output": "20\n2 7\n12 13\n21 25\n27 29\n31 40\n42 43\n45 50\n54 55\n58 70\n71 77\n83 89\n93 9...
code_stdio
[ { "content": "Simple enough this one - you will be given an array. The values in the array will either be numbers or strings, or a mix of both. You will not get an empty array, nor a sparse one.\n\nYour job is to return a single array that has first the numbers sorted in ascending order, followed by the strings...
[{"input": "[\"Hackathon\", \"Katathon\", \"Code\", \"CodeWars\", \"Laptop\", \"Macbook\", \"JavaScript\", 1, 5, 2]", "output": "[[1, 2, 5, \"Code\", \"CodeWars\", \"Hackathon\", \"JavaScript\", \"Katathon\", \"Laptop\", \"Macbook\"]]", "fn_name": "db_sort"}, {"input": "[82, 18, 72, 1, 11, 12, 12, 12, 12, 115, 667, 12,...
code_functional
[ { "content": "The new £5 notes have been recently released in the UK and they've certainly became a sensation! Even those of us who haven't been carrying any cash around for a while, having given in to the convenience of cards, suddenly like to have some of these in their purses and pockets. But how many of the...
[{"input": "5300\n[1190, 1010, 1045, 55, 10, 19, 55]", "output": "[383]", "fn_name": "get_new_notes"}, {"input": "10000\n[1800, 500, 1200, 655, 150]", "output": "[1139]", "fn_name": "get_new_notes"}, {"input": "3600\n[1800, 350, 460, 500, 15]", "output": "[95]", "fn_name": "get_new_notes"}, {"input": "2300\n[590, 1500,...
code_functional
[ { "content": "Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1, p2, ..., pn.\n\nYour task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn -...
[{"input": "18247 939\n", "output": "1 940 2 939 3 938 4 937 5 936 6 935 7 934 8 933 9 932 10 931 11 930 12 929 13 928 14 927 15 926 16 925 17 924 18 923 19 922 20 921 21 920 22 919 23 918 24 917 25 916 26 915 27 914 28 913 29 912 30 911 31 910 32 909 33 908 34 907 35 906 36 905 37 904 38 903 39 902 40 901 41 900 42 89...
code_stdio
[ { "content": "Who's interested in football?\nRayne Wooney has been one of the top players for his football club for the last few years. But unfortunately, he got injured during a game a few months back and has been out of play ever since.\nHe's got proper treatment and is eager to go out and play for his team a...
[{"input": "3\n4\n3 7 1 4 2 4\n5\n7 4 3 3 1\n5\n4 3 2 2 0", "output": "4\nUNFIT\nUNFIT\n"}, {"input": "3\n6\n1 1 -1 4 2 4\n5\n4 4 3 2 1\n5\n4 3 1 2 3", "output": "5\nUNFIT\n2\n"}, {"input": "3\n6\n1 1 -1 4 2 1\n5\n4 4 3 2 1\n5\n4 0 1 2 3", "output": "5\nUNFIT\n3\n"}, {"input": "3\n6\n3 7 1 4 2 4\n5\n5 4 3 2 1\n5\n4 3 1...
code_stdio
[ { "content": "The only difference between easy and hard versions is constraints.\n\nIvan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character to be really cool, he wants to use some of these microtransactions — and he won't start playing until...
[{"input": "78 36\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0\n1 52\n2 6\n9 43\n10 52\n4 63\n9 35\n10 67\n9 17\n3 43\n4 38\n1 27\n9 44\n6 74\n7 3\n8 18\n1 52\n1 68\n5 51\n5 2\n11 50\n1 72\n1 37\n8 64\n10 30\...
code_stdio
[ { "content": "Mike has a sequence A = [a1, a2, ..., an] of length n. He considers the sequence B = [b1, b2, ..., bn] beautiful if the gcd of all its elements is bigger than 1, i.e. <image>. \n\nMike wants to change his sequence in order to make it beautiful. In one move he can choose an index i (1 ≤ i < n), del...
[{"input": "9\n57 30 28 81 88 32 3 42 25\n", "output": "YES\n8\n"}, {"input": "9\n57 12 28 81 88 32 3 42 25\n", "output": "YES\n8\n"}, {"input": "9\n57 12 29 81 88 32 3 42 37\n", "output": "YES\n7\n"}, {"input": "9\n57 12 28 81 88 32 3 42 37\n", "output": "YES\n8\n"}, {"input": "9\n57 2 29 81 88 32 3 42 37\n", "output"...
code_stdio
[ { "content": "Peter is a person with erratic sleep habits. He goes to sleep at twelve o'lock every midnight. He gets up just after one hour of sleep on some days; he may even sleep for twenty-three hours on other days. His sleeping duration changes in a cycle, where he always sleeps for only one hour on the fir...
[{"input": "2\n-1 23\n3\n1 1\n1 1\n3 -1\n0", "output": "0\n"}, {"input": "2\n1 23\n3\n2 1\n10 1\n3 1\n0", "output": "3\n"}, {"input": "2\n-1 23\n3\n1 1\n2 0\n5 2\n0", "output": "2\n"}, {"input": "2\n-1 13\n3\n1 2\n2 1\n3 1\n0", "output": "2\n"}, {"input": "2\n-1 13\n3\n2 2\n2 1\n3 1\n0", "output": "2\n"}, {"input": "2\...
code_stdio
[ { "content": "Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string s. Each character of s is one move operation. There are four move operations at all:\n\n * 'U': go up, (x, y) → (x, y+1); \n * 'D': go down, (x, y) → (x...
[{"input": "-1000000000 -1000000000\nDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDL\n", "output": "Yes\n"}, {"input": "1000000000 1000000000\nRURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURU\n", "output": "Yes\n"},...
code_stdio
[ { "content": "You are given an expression of the form $a{+}b$, where $a$ and $b$ are integers from $0$ to $9$. You have to evaluate it and print the result.\n\n\n-----Input-----\n\nThe first line contains one integer $t$ ($1 \\le t \\le 100$) — the number of test cases.\n\nEach test case consists of one line co...
[{"input": "100\n0+0\n0+1\n0+2\n0+3\n0+4\n0+5\n0+6\n0+7\n0+8\n0+9\n1+0\n1+1\n1+2\n1+3\n1+4\n1+5\n1+6\n1+7\n1+8\n1+9\n2+0\n2+1\n2+2\n2+3\n2+4\n2+5\n2+6\n2+7\n2+8\n2+9\n3+0\n3+1\n3+2\n3+3\n3+4\n3+5\n3+6\n3+7\n3+8\n3+9\n4+0\n4+1\n4+2\n4+3\n4+4\n4+5\n4+6\n4+7\n4+8\n4+9\n5+0\n5+1\n5+2\n5+3\n5+4\n5+5\n5+6\n5+7\n5+8\n5+9\n6+0...
code_stdio
[ { "content": "Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hack...
[{"input": "10\n877105545 939360757 849826701 845946140 733167691 265756841 967305000 1281921930 921301848 971203310\n", "output": "490950129\n"}, {"input": "10\n877105545 939360757 849826701 845946140 803128820 926787996 967305000 904694971 921301848 971203310\n", "output": "861364152\n"}, {"input": "10\n877105545 939...
code_stdio
[ { "content": "A marine themed rival site to Codewars has started. Codwars is advertising their website all over the internet using subdomains to hide or obfuscate their domain to trick people into clicking on their site.\n\nYour task is to write a function that accepts a URL as a string and determines if it wou...
[{"input": "\"https://this.is.an.unneccesarily.long.subdomain.codewars.com/katas.are.really.fun.codwars.com/\"", "output": "[false]", "fn_name": "find_codwars"}, {"input": "\"https://this.is.an.unneccesarily.long.subdomain.codwars.comp/katas.are.really.fun.codwars.com/\"", "output": "[false]", "fn_name": "find_codwars"...
code_functional
[ { "content": "As we all know Barney's job is \"PLEASE\" and he has not much to do at work. That's why he started playing \"cups and key\". In this game there are three identical cups arranged in a line from left to right. Initially key to Barney's heart is under the middle cup. [Image] \n\nThen at one turn Barn...
[{"input": "12\n254904759290707697 475737283258450340 533306428548398547 442127134828578937 779740159015946254 272877594683860919 93000149670491971 632184275887310175 498293278222136720 551099726729989816 149940343283925029 989425634209891686\n", "output": "461895893/385687671\n"}, {"input": "12\n254904759290707697 475...
code_stdio
[ { "content": "You are given string $s$ of length $n$ consisting of 0-s and 1-s. You build an infinite string $t$ as a concatenation of an infinite number of strings $s$, or $t = ssss \\dots$ For example, if $s =$ 10010, then $t =$ 100101001010010...\n\nCalculate the number of prefixes of $t$ with balance equal ...
[{"input": "1\n439 -6100238\n100011110101001111000100101001001100010100010101001011100000110000000010011011111100010011100100000010011000110100111010100100100101101101100111100001010000010110000111011100000001110111100111110011110001001001100010110101100101011111010110010110101111001011000111010000101110100011010101101...
code_stdio
[ { "content": "Nauuo is a girl who loves writing comments.\n\nOne day, she posted a comment on Codeforces, wondering whether she would get upvotes or downvotes.\n\nIt's known that there were $x$ persons who would upvote, $y$ persons who would downvote, and there were also another $z$ persons who would vote, but ...
[{"input": "000 100 100\n", "output": "?\n"}, {"input": "100 100 100\n", "output": "?"}, {"input": "100 100 100\n", "output": "?"}, {"input": "101 0 100\n", "output": "+\n"}, {"input": "25 24 100\n", "output": "?\n"}, {"input": "123 29 43\n", "output": "+\n"}, {"input": "100 110 0\n", "output": "-\n"}, {"input": "60 11...
code_stdio
[ { "content": "Given two arrays, the purpose of this Kata is to check if these two arrays are the same. \"The same\" in this Kata means the two arrays contains arrays of 2 numbers which are same and not necessarily sorted the same way. i.e. [[2,5], [3,6]] is same as [[5,2], [3,6]] or [[6,3], [5,2]] or [[6,3], [2...
[{"input": "[[2, 5], [3, 5], [6, 2]]\n[[2, 6], [5, 3], [2, 5]]", "output": "[true]", "fn_name": "same"}, {"input": "[[2, 5], [3, 5], [6, 2]]\n[[3, 5], [6, 2], [5, 2]]", "output": "[true]", "fn_name": "same"}, {"input": "[[2, 3], [3, 4]]\n[[4, 3], [2, 4]]", "output": "[false]", "fn_name": "same"}, {"input": "[[2, 5], [3...
code_functional
[ { "content": "The construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself.\n\nThere are n stations in the subway. It was built according to the Bertown Transport Law:\n\n For each station i there exists exactly one train that go...
[{"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": "Bessie is out grazing on the farm, which consists of $n$ fields connected by $m$ bidirectional roads. She is currently at field $1$, and will return to her home at field $n$ at the end of the day.\n\nThe Cowfederation of Barns has ordered Farmer John to install one extra bidirectional road. The fa...
[{"input": "42 41 20\n8 34 12 13 38 3 9 10 18 16 2 26 24 17 32 21 4 27 15 39\n1 35\n35 8\n1 31\n31 34\n1 40\n40 12\n1 30\n30 13\n1 33\n33 38\n1 37\n37 3\n1 22\n22 9\n1 20\n20 10\n1 25\n25 18\n1 14\n14 16\n1 42\n42 7\n7 2\n42 11\n11 26\n42 29\n29 24\n42 36\n36 17\n42 41\n41 32\n42 23\n23 21\n42 28\n28 4\n42 5\n5 27\n42 ...
code_stdio
[ { "content": "There is a game that uses numbers called \"Fizz Buzz\". In this game, multiple players count the numbers one by one, starting with 1, and each player says only one number after the previous player. At that time, you must say \"Fizz\" if it is divisible by 3, \"Buzz\" if it is divisible by 5, and \...
[{"input": "5 7\n1\n-1\nFizz\n2\nzuzB\n5\n2\n16 5\n1\n4\n5\n7\n8\n0 0", "output": "3\n1 6 7 8 9 10 11 12 13 14 15 16\n"}, {"input": "14 7\n1\n0\nzzFi\n4\nBuzz\n11\n1\n3 5\n-1\n3\n8\n4\n3\n0 0", "output": "1 4 5 8 9 10 11 12 13 14\n3\n"}, {"input": "14 7\n1\n0\nzzFi\n4\nAuzz\n11\n1\n3 5\n-1\n3\n8\n4\n3\n0 0", "output": ...
code_stdio
[ { "content": "Chouti was doing a competitive programming competition. However, after having all the problems accepted, he got bored and decided to invent some small games.\n\nHe came up with the following game. The player has a positive integer $n$. Initially the value of $n$ equals to $v$ and the player is abl...
[{"input": "1000000000\n", "output": "1\n"}, {"input": "1000000000\n", "output": "1\n"}, {"input": "1236540828\n", "output": "1\n"}, {"input": "1102703100\n", "output": "1\n"}, {"input": "1266106036\n", "output": "1\n"}, {"input": "1000000010\n", "output": "1\n"}, {"input": "1709258177\n", "output": "1\n"}, {"input": "...
code_stdio
[ { "content": "It is said that a legendary treasure left by Mr. Yao is sleeping somewhere in Hachioji long ago. The treasure map, which is said to show its whereabouts, has been handed down by Yao's n descendants, divided into several pieces.\n\nNow, the descendants of Mr. Yao were trying to cooperate to obtain ...
[{"input": "4\n1 1\n2 0 -1\n2 4 2\n3 2 16 10\n0", "output": "-1\n"}, {"input": "4\n1 1\n2 0 0\n2 4 2\n3 2 16 10\n0", "output": "-1\n"}, {"input": "4\n1 1\n2 0 -1\n2 4 2\n3 2 16 2\n0", "output": "-1\n"}, {"input": "4\n1 1\n2 -1 3\n2 1 2\n3 3 4 10\n0", "output": "-1\n"}, {"input": "4\n1 1\n2 -1 3\n2 2 2\n3 3 4 10\n0", "o...
code_stdio
[ { "content": "We have N balls. The i-th ball has an integer A_i written on it.\n\nFor each k=1, 2, ..., N, solve the following problem and print the answer. \n - Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on...
[{"input": "8\n1 1 1 1 1 0 4 1", "output": "10\n10\n10\n10\n10\n15\n15\n10\n"}, {"input": "8\n1 1 0 1 1 1 6 1", "output": "10\n10\n15\n10\n10\n10\n15\n10\n"}, {"input": "8\n1 1 1 3 1 0 4 1", "output": "6\n6\n6\n10\n6\n10\n10\n6\n"}, {"input": "8\n1 1 1 3 1 0 3 1", "output": "7\n7\n7\n10\n7\n11\n10\n7\n"}, {"input": "8\...
code_stdio
[ { "content": "We have an integer sequence of length N: A_0,A_1,\\cdots,A_{N-1}.\n\nFind the following sum (\\mathrm{lcm}(a, b) denotes the least common multiple of a and b):\n\n* \\sum_{i=0}^{N-2} \\sum_{j=i+1}^{N-1} \\mathrm{lcm}(A_i,A_j)\n\n\n\nSince the answer may be enormous, compute it modulo 998244353.\n\...
[{"input": "10\n356822 296174 484500 710640 610703 888250 259161 609120 592348 713644", "output": "963903348\n"}, {"input": "10\n356822 296174 484500 710640 231537 888250 259161 609120 592348 713644", "output": "669101188\n"}, {"input": "10\n356822 296174 484500 710640 231537 888250 100152 609120 592348 713644", "outpu...
code_stdio
[ { "content": "You're given a string of lower-case Latin letters. Your task is to find the length of its longest substring that can be met in the string at least twice. These occurrences can overlap (see sample test 2).\n\nInput\n\nThe first input line contains the string. It's guaranteed, that the string is non...
[{"input": "ipsrjylhpkjvlzncfixipstwcicxqygqcfrawpzzvckoveyqhathglblhpkjvlzncfixipfajaqobtzvthmhgbuawowoknirclxg\n", "output": "15\n"}, {"input": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbffffffffffffffffffffffgffffffffffffff\n", "output": "61\n"}, {"input": "bbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbb...
code_stdio
[ { "content": "Read problems statements in Mandarin Chinese and Russian as well. \n\nGiven an array of N numbers, a pair of numbers is called good if difference between the two numbers is strictly less than D.\nFind out maximum possible sum of all good disjoint pairs that can be made from these numbers.\nSum of ...
[{"input": "3\n3 0\n3 5 0\n4 3\n13 10 11 12\n5 3\n3 2 5 17 15", "output": "0\n46\n40\n"}, {"input": "3\n3 0\n3 5 0\n4 3\n13 10 11 12\n5 3\n3 2 2 17 15", "output": "0\n46\n37\n"}, {"input": "3\n3 0\n3 5 0\n4 3\n19 10 11 12\n5 3\n3 2 2 17 15", "output": "0\n23\n37\n"}, {"input": "3\n3 3\n7 5 8\n4 5\n8 13 13 12\n5 6\n7 2 ...
code_stdio
[ { "content": "Implement a function which behaves like the 'uniq -c' command in UNIX. \n\nIt takes as input a sequence and returns a sequence in which all duplicate elements following each other have been reduced to one instance together with the number of times a duplicate elements occurred in the original arra...
[{"input": "[\"a\", \"a\", \"b\", \"b\", \"c\", \"a\", \"b\", \"c\"]", "output": "[[[\"a\", 2], [\"b\", 2], [\"c\", 1], [\"a\", 1], [\"b\", 1], [\"c\", 1]]]", "fn_name": "uniq_c"}, {"input": "[\"a\", \"a\", \"a\", \"b\", \"b\", \"b\", \"c\", \"c\", \"c\"]", "output": "[[[\"a\", 3], [\"b\", 3], [\"c\", 3]]]", "fn_name":...
code_functional
[ { "content": "An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!).\n\nThe flying saucer, on which the brave pioneers set off, consists of three sections. These sections are connected by a chain: the 1-st section...
[{"input": "1050034174 1181487066\n", "output": "544888754\n"}, {"input": "880162386 1131317357\n", "output": "508228391\n"}, {"input": "1511923181 994962872\n", "output": "797030938\n"}, {"input": "596386879 1071021379\n", "output": "555054884\n"}, {"input": "94821338 1131317357\n", "output": "1003908236\n"}, {"input"...
code_stdio
[ { "content": "# Task\n\nYour task is to sort the characters in a string according to the following rules:\n```\n- Rule1: English alphabets are arranged from A to Z, case insensitive.\n ie. \"Type\" --> \"epTy\"\n- Rule2: If the uppercase and lowercase of an English alphabet exist\n at the same time, they are ...
[{"input": "\" MkWD{RB=//k-^ J@,xH Vfi uAz+$ kV _[ }a!}%pSBwn !kKB (b q PQF +}wS .kfU r wFNEs#NsR UVMdG\"", "output": "[\" AaBB{Bb=//D-^ d@,Ef FfF GHi+$ Jk _[ }k!}%kkKkM !MnN (N p PqQ +}Rr .RSS s suUUV#VVW wwwxz\"]", "fn_name": "sort_string"}, {"input": "\"-c--b--a-\"", "output": "[\"-a--b--c-\"]", "fn_name": "sort...
code_functional
[ { "content": "All space-time unified dimension sugoroku tournament. You are representing the Earth in the 21st century in the tournament, which decides only one Sugoroku absolute champion out of more than 500 trillion participants.\n\nThe challenge you are currently challenging is one-dimensional sugoroku with ...
[{"input": "12\n0\n-1\n7\n0\n2\n-1\n-1\n3\n-10\n-2\n1\n0", "output": "1\n"}, {"input": "12\n0\n-1\n7\n0\n2\n0\n-1\n3\n-10\n-2\n1\n0", "output": "1\n"}, {"input": "12\n0\n-1\n7\n0\n2\n0\n-2\n3\n-10\n-2\n1\n0", "output": "1\n"}, {"input": "12\n0\n-1\n7\n0\n1\n0\n-2\n3\n-10\n-2\n1\n0", "output": "1\n"}, {"input": "12\n0\n...
code_stdio
[ { "content": "# Task\n\n**_Given_** a **_Divisor and a Bound_** , *Find the largest integer N* , Such That , \n\n# Conditions :\n\n* **_N_** is *divisible by divisor*\n\n* **_N_** is *less than or equal to bound* \n\n* **_N_** is *greater than 0*.\n___\n\n# Notes \n\n* The **_parameters (divisor, bound)_** p...
[{"input": "37\n200", "output": "[185]", "fn_name": "max_multiple"}, {"input": "10\n50", "output": "[50]", "fn_name": "max_multiple"}, {"input": "7\n100", "output": "[98]", "fn_name": "max_multiple"}, {"input": "7\n17", "output": "[14]", "fn_name": "max_multiple"}, {"input": "3\n10", "output": "[9]", "fn_name": "max_mu...
code_functional
[ { "content": "Polycarp is flying in the airplane. Finally, it is his favorite time — the lunchtime. The BerAvia company stewardess is giving food consecutively to all the passengers from the 1-th one to the last one. Polycarp is sitting on seat m, that means, he will be the m-th person to get food.\n\nThe fligh...
[{"input": "5\n\n3 3\n1 1 1\n0 0\n0 1\n\n3 3\n1 1 1\n1 0\n2 1\n\n3 3\n1 1 1\n1 0\n0 1\n\n3 3\n1 1 1\n0 0\n1 0\n\n3 3\n1 1 1\n0 0\n1 1\n", "output": "YYY\nYYN\nYYY\nYYY\nYYY\n"}, {"input": "5\n\n3 3\n1 1 1\n0 0\n0 1\n\n3 3\n1 1 1\n1 0\n2 1\n\n3 3\n1 1 1\n1 0\n0 1\n\n3 3\n1 1 1\n0 0\n1 0\n\n3 3\n1 1 1\n0 0\n1 1\n", "outp...
code_stdio
[ { "content": "Today's morning was exceptionally snowy. Meshanya decided to go outside and noticed a huge snowball rolling down the mountain! Luckily, there are two stones on that mountain.\n\nInitially, snowball is at height $h$ and it has weight $w$. Each second the following sequence of events happens: snowba...
[{"input": "71 100\n56 44\n12 85\n", "output": "5053\n"}, {"input": "46 100\n36 81\n99 28\n", "output": "4961\n"}, {"input": "29 100\n30 51\n28 92\n", "output": "5021\n"}, {"input": "93 80\n13 49\n100 21\n", "output": "3220\n"}, {"input": "46 100\n36 81\n97 28\n", "output": "4963\n"}, {"input": "29 100\n30 51\n46 92\n"...
code_stdio