info stringlengths 120 50k | question stringlengths 504 10.4k | avg@8_qwen3_4b_instruct_2507 float64 0 0.88 |
|---|---|---|
{"tests": "{\"inputs\": [\"3\\ncbabc\\n\", \"2\\nabcab\\n\", \"3\\nbcabcbaccba\\n\", \"5\\nimmaydobun\\n\", \"5\\nwjjdqawypvtgrncmqvcsergermprauyevcegjtcrrblkwiugrcjfpjyxngyryxntauxlouvwgjzpsuxyxvhavgezwtuzknetdibv\\n\", \"10\\nefispvmzuutsrpxzfrykhabznxiyquwvhwhrksrgzodtuepfvamilfdynapzhzyhncorhzuewrrkcduvuhwsrprjrmgc... | You are given a string s, consisting of lowercase English letters, and the integer m.
One should choose some symbols from the given string so that any contiguous subsegment of length m has at least one selected symbol. Note that here we choose positions of symbols, not the symbols themselves.
Then one uses the chosen... | 0 |
{"tests": "{\"inputs\": [\"1 1\\n\", \"2 3\\n\", \"49 1808\\n\", \"2 1\\n\", \"2 2\\n\", \"2 4\\n\", \"3 1\\n\", \"3 2\\n\", \"3 3\\n\", \"3 4\\n\", \"3 5\\n\", \"3 6\\n\", \"3 7\\n\", \"3 8\\n\", \"3 9\\n\", \"4 1\\n\", \"4 2\\n\", \"4 3\\n\", \"4 4\\n\", \"4 5\\n\", \"4 6\\n\", \"4 7\\n\", \"4 8\\n\", \"4 9\\n\", \"4... | You are given a square board, consisting of $n$ rows and $n$ columns. Each tile in it should be colored either white or black.
Let's call some coloring beautiful if each pair of adjacent rows are either the same or different in every position. The same condition should be held for the columns as well.
Let's call some... | 0 |
{"tests": "{\"inputs\": [\"8 53 4\\n------------------------------------G-------------R--\\n-----------G--R--------------------------------------\\n----------------------------------GR-----------------\\n----------------------R------------------G-----------\\n-------------R----------------G----------------------\\n----... | Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring card games and play with toy soldiers.
The rules of the game are as f... | 0 |
{"tests": "{\"inputs\": [\"4\\n1 3\\n1 3\\n3 6\\n3 9\", \"4\\n1 3\\n1 6\\n3 2\\n3 9\", \"4\\n2 2\\n1 11\\n10 2\\n3 9\", \"4\\n2 1\\n1 11\\n10 2\\n3 9\", \"4\\n3 1\\n1 7\\n10 2\\n9 3\", \"4\\n6 1\\n1 10\\n10 2\\n9 3\", \"4\\n1 3\\n1 11\\n0 2\\n3 9\", \"4\\n1 3\\n1 6\\n3 1\\n5 9\", \"4\\n4 1\\n1 11\\n10 2\\n6 1\", \"4\\n... | Problem I Starting a Scenic Railroad Service
Jim, working for a railroad company, is responsible for planning a new tourist train service. He is sure that the train route along a scenic valley will arise a big boom, but not quite sure how big the boom will be.
A market survey was ordered and Jim has just received an ... | 0 |
{"tests": "{\"inputs\": [\"4 3\\n10 20 30 40\\n2\\n34\\n20\", \"4 3\\n10 20 30 40\\n2\\n25\\n8\", \"4 3\\n26 20 30 55\\n2\\n25\\n8\", \"4 2\\n26 20 30 55\\n2\\n25\\n8\", \"5 5\\n3 5 7 11 13\\n1\\n7\\n9\\n10\\n13\", \"4 3\\n20 20 30 30\\n2\\n25\\n8\", \"5 5\\n3 5 7 11 13\\n1\\n14\\n9\\n10\\n13\", \"4 3\\n11 20 30 55\\n2... | There are N cards. The i-th card has an integer A_i written on it. For any two cards, the integers on those cards are different.
Using these cards, Takahashi and Aoki will play the following game:
* Aoki chooses an integer x.
* Starting from Takahashi, the two players alternately take a card. The card should be chose... | 0 |
{"tests": "{\"inputs\": [\"4 16 105\\n2 4 15\\n1 1 16\\n2 2 57\\n3 4 31\\n1 2 47\\n2 3 28\\n1 3 70\\n4 2 50\\n3 1 10\\n4 1 11\\n4 4 27\\n1 4 56\\n3 3 28\\n3 2 28\\n2 1 33\\n4 3 63\\n\", \"5 15 90\\n2 3 71\\n5 1 72\\n3 2 29\\n2 5 35\\n5 4 49\\n2 1 5\\n3 3 37\\n5 2 3\\n1 1 24\\n1 3 50\\n5 3 45\\n2 2 31\\n4 3 71\\n3 1 30\... | The Smart Beaver from ABBYY was offered a job of a screenwriter for the ongoing TV series. In particular, he needs to automate the hard decision: which main characters will get married by the end of the series.
There are n single men and n single women among the main characters. An opinion poll showed that viewers lik... | 0 |
{"tests": "{\"inputs\": [\"9 60 9\\n8 4 1\\n2 6 2\\n4 3 3\\n2 9 4\\n6 7 5\\n7 6 6\\n7 8 7\\n9 5 8\\n2 8 9\\n1 8 10\\n2 7 11\\n2 4 12\\n6 1 13\\n9 2 14\\n4 9 15\\n3 7 16\\n4 7 17\\n7 4 18\\n8 7 19\\n5 1 20\\n8 3 21\\n4 5 22\\n5 9 23\\n9 6 24\\n7 5 25\\n9 4 26\\n6 9 27\\n2 5 28\\n8 6 29\\n1 7 30\\n1 3 31\\n8 2 32\\n3 5 3... | Boboniu has a directed graph with n vertices and m edges.
The out-degree of each vertex is at most k.
Each edge has an integer weight between 1 and m. No two edges have equal weights.
Boboniu likes to walk on the graph with some specific rules, which is represented by a tuple (c_1,c_2,…,c_k). If he now stands on a v... | 0 |
{"tests": "{\"inputs\": [\"6\\n5 11 44\\n\", \"2\\n9900\\n\", \"6\\n314 1592 6535\\n\", \"10\\n44 23 65 17 48\\n\", \"10\\n493 92 485 262 157\\n\", \"4\\n35 15\\n\", \"4\\n27 59\\n\", \"4\\n65 15\\n\", \"6\\n26 10 70\\n\", \"6\\n90 93 28\\n\", \"6\\n81 75 87\\n\", \"6\\n73 64 66\\n\", \"2\\n1\\n\", \"50\\n3 7 11 15 19 ... | Chouti is working on a strange math problem.
There was a sequence of $n$ positive integers $x_1, x_2, \ldots, x_n$, where $n$ is even. The sequence was very special, namely for every integer $t$ from $1$ to $n$, $x_1+x_2+...+x_t$ is a square of some integer number (that is, a perfect square).
Somehow, the numbers wit... | 0 |
{"tests": "{\"inputs\": [\"4 3\\n1 2\\n2 3\\n3 4\\n\", \"4 4\\n1 2\\n2 3\\n3 4\\n4 1\\n\", \"4 3\\n1 2\\n1 3\\n1 4\\n\", \"4 4\\n1 2\\n2 3\\n3 1\\n1 4\\n\", \"5 4\\n1 2\\n3 5\\n1 4\\n5 4\\n\", \"5 5\\n3 4\\n5 2\\n2 1\\n5 4\\n3 1\\n\", \"5 4\\n4 2\\n5 2\\n1 2\\n2 3\\n\", \"5 9\\n5 3\\n4 5\\n3 1\\n3 2\\n2 1\\n2 5\\n1 5\\... | This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.
Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n computers, some of them a... | 0.25 |
{"tests": "{\"inputs\": [\"ABC 3\\nABC 1\\n2(4(AB)3(XY))10C 30\\n1000(1000(1000(1000(1000(1000(NM)))))) 999999\\n0 0\", \"ABC 3\\nABC 0\\n2(4(AB)3(XY))10C 3\\n1000(1000(1000(1000(1000(1000(NM)))))) 999999\\n0 0\", \"ABC 3\\nABC 2\\n2(4(AB)3(XY))10C 30\\n1000(1000(1000(1000(1000(1000(NM)))))) 999999\\n0 0\", \"ABC 3\\nA... | In 2300, the Life Science Division of Federal Republic of Space starts a very ambitious project to complete the genome sequencing of all living creatures in the entire universe and develop the genomic database of all space life. Thanks to scientific research over many years, it has been known that the genome of any spe... | 0 |
{"tests": "{\"inputs\": [\"24\\n\", \"38\\n\", \"999993\\n\", \"31\\n\", \"999989\\n\", \"27\\n\", \"46\\n\", \"999972\\n\", \"5\\n\", \"41\\n\", \"999996\\n\", \"999994\\n\", \"19\\n\", \"999975\\n\", \"35\\n\", \"4\\n\", \"33\\n\", \"23\\n\", \"45\\n\", \"37\\n\", \"18\\n\", \"32\\n\", \"999985\\n\", \"43\\n\", \"42\... | Omkar and Akmar are playing a game on a circular board with n (2 ≤ n ≤ 10^6) cells. The cells are numbered from 1 to n so that for each i (1 ≤ i ≤ n-1) cell i is adjacent to cell i+1 and cell 1 is adjacent to cell n. Initially, each cell is empty.
Omkar and Akmar take turns placing either an A or a B on the board, wit... | 0 |
{"tests": "{\"inputs\": [[8964631], [56], [999], [11], [991], [47], [234], [196587], [660], [600], [9090], [10104], [80008], [90000], [0]], \"outputs\": [[\"8*1000000+9*100000+6*10000+4*1000+6*100+3*10+1\"], [\"5*10+6\"], [\"9*100+9*10+9\"], [\"1*10+1\"], [\"9*100+9*10+1\"], [\"4*10+7\"], [\"2*100+3*10+4\"], [\"1*10000... | ## Task
Given a positive integer as input, return the output as a string in the following format:
Each element, corresponding to a digit of the number, multiplied by a power of 10 in such a way that with the sum of these elements you can obtain the original number.
## Examples
Input | Output
--- | ---
0 | ""... | 0 |
{"tests": "{\"inputs\": [\"6\\n+ 12001\\n- 12001\\n- 1\\n- 1200\\n+ 1\\n+ 7\\n\", \"2\\n- 1\\n- 2\\n\", \"2\\n+ 1\\n- 1\\n\", \"5\\n+ 1\\n- 1\\n+ 2\\n+ 3\\n- 4\\n\", \"3\\n- 1\\n- 2\\n- 3\\n\", \"4\\n+ 1\\n+ 2\\n- 1\\n+ 3\\n\", \"6\\n+ 1\\n+ 2\\n- 1\\n+ 3\\n- 2\\n+ 4\\n\", \"3\\n+ 1\\n+ 2\\n- 3\\n\", \"3\\n- 1\\n+ 2\\n... | Berland National Library has recently been built in the capital of Berland. In addition, in the library you can take any of the collected works of Berland leaders, the library has a reading room.
Today was the pilot launch of an automated reading room visitors' accounting system! The scanner of the system is installed... | 0 |
{"tests": "{\"inputs\": [\"5\\n5 2 1 3 4\\n\", \"3\\n1 2 3\\n\", \"4\\n4 3 2 1\\n\", \"5\\n1 2 5 3 4\\n\", \"1\\n1\\n\", \"2\\n1 2\\n\", \"2\\n2 1\\n\", \"3\\n2 1 3\\n\", \"6\\n4 5 6 1 2 3\\n\", \"10\\n10 5 9 4 1 8 3 7 2 6\\n\", \"3\\n1 3 2\\n\", \"3\\n3 1 2\\n\", \"4\\n1 2 3 4\\n\", \"4\\n2 3 1 4\\n\", \"6\\n3 2 1 6 4... | Emuskald is addicted to Codeforces, and keeps refreshing the main page not to miss any changes in the "recent actions" list. He likes to read thread conversations where each thread consists of multiple messages.
Recent actions shows a list of n different threads ordered by the time of the latest message in the thread.... | 0 |
{"tests": "{\"inputs\": [\"2 1 2 1\\n\", \"2 2 1 2\\n\", \"1 1 1 1\\n\", \"1 50 1 50\\n\", \"6 4 2 7\\n\", \"100000000 100000000 99999999 100000000\\n\", \"100000000 1 100000000 1\\n\", \"19661988 30021918 8795449 27534575\\n\", \"98948781 84140283 95485812 84557929\\n\", \"47 40 42 49\\n\", \"18 3 8 15\\n\", \"49 45 4... | In order to make the "Sea Battle" game more interesting, Boris decided to add a new ship type to it. The ship consists of two rectangles. The first rectangle has a width of $w_1$ and a height of $h_1$, while the second rectangle has a width of $w_2$ and a height of $h_2$, where $w_1 \ge w_2$. In this game, exactly one ... | 0 |
{"tests": "{\"inputs\": [[[], []], [[], [1]], [[\"a\"], []], [[\"a\", \"b\", \"c\"], [1, 2, 3]], [[\"a\", \"b\", \"c\", \"d\", \"e\"], [1, 2]], [[\"a\", \"b\"], [1, 2, 3, 4]]], \"outputs\": [[{}], [{}], [{\"a\": null}], [{\"a\": 1, \"b\": 2, \"c\": 3}], [{\"a\": 1, \"b\": 2, \"c\": null, \"d\": null, \"e\": null}], [{\... | There are two lists of different length. The first one consists of keys, the second one consists of values. Write a function ```createDict(keys, values)``` that returns a dictionary created from keys and values. If there are not enough values, the rest of keys should have a ```None``` value. If there not enough keys, j... | 0 |
{"tests": "{\"inputs\": [\"10 20\\n10 1 15\\n7 1 32\\n5 3 36\\n3 9 14\\n3 4 19\\n6 8 4\\n9 6 18\\n7 3 38\\n10 7 12\\n7 5 29\\n7 6 14\\n6 2 40\\n8 9 19\\n7 8 11\\n7 4 19\\n2 1 38\\n10 9 3\\n6 5 50\\n10 3 41\\n1 8 3\\n\", \"2 1\\n2 1 48\\n\", \"10 20\\n10 1 15\\n7 1 32\\n5 3 45\\n3 9 14\\n3 4 19\\n6 8 4\\n9 6 18\\n7 3 38... | There are n cities and m bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter w. You can travel through the roads, but the government made a new law: you can only go through two roads at a time (go f... | 0 |
{"tests": "{\"inputs\": [[\"2 tbsp of butter\"], [\"Add to the mixing bowl and coat well with 1 tbsp of olive oil & 1/2 tbsp of dried dill\"], [\"1/2 tsp of baking powder\"], [\"In another bowl, add 2 tsp of vanilla extract, 3 tsp of baking soda and 1/2 tsp of salt\"], [\"10 tbsp of cocoa powder\"], [\"1/8 tbsp of baki... | Mary wrote a recipe book and is about to publish it, but because of a new European law, she needs to update and include all measures in grams.
Given all the measures in tablespoon (`tbsp`) and in teaspoon (`tsp`), considering `1 tbsp = 15g` and `1 tsp = 5g`, append to the end of the measurement the biggest equivalent ... | 0 |
{"tests": "{\"inputs\": [\"acac\", \"bacaccbabab\", \"ccaa\", \"bacaacbcbab\", \"babcbcaacab\", \"bababccacab\", \"bacaccbabac\", \"bacaccbaaac\", \"caaabccacab\", \"caaaaccacab\", \"bacaccaaaac\", \"baa\", \"caba\", \"babacccbaab\", \"aacc\", \"bacabcbabab\", \"bacaacccbab\", \"babcbbaacab\", \"aacaccbabac\", \"caabac... | Snuke has a string S consisting of three kinds of letters: `a`, `b` and `c`.
He has a phobia for palindromes, and wants to permute the characters in S so that S will not contain a palindrome of length 2 or more as a substring. Determine whether this is possible.
Constraints
* 1 \leq |S| \leq 10^5
* S consists of `a`... | 0 |
{"tests": "{\"inputs\": [\"5 5 20 25\\n1 2 25\\n2 3 25\\n3 4 20\\n4 5 20\\n5 1 20\\n\", \"6 7 13 22\\n1 2 13\\n2 3 13\\n1 4 22\\n3 4 13\\n4 5 13\\n5 6 13\\n6 1 13\\n\", \"2 1 1 2\\n2 1 1\\n\", \"2 1 9999999 10000000\\n1 2 10000000\\n\", \"3 3 78422 6789101\\n3 1 6789101\\n2 1 78422\\n2 3 78422\\n\", \"3 3 2770628 39124... | Codefortia is a small island country located somewhere in the West Pacific. It consists of $n$ settlements connected by $m$ bidirectional gravel roads. Curiously enough, the beliefs of the inhabitants require the time needed to pass each road to be equal either to $a$ or $b$ seconds. It's guaranteed that one can go bet... | 0.125 |
{"tests": "{\"inputs\": [\"10\\n\", \"66\\n\", \"39\\n\", \"2\\n\", \"100\\n\", \"2014\\n\", \"101\\n\", \"999999994\\n\", \"1000000000\\n\", \"9\\n\", \"999999979\\n\", \"3\\n\", \"11\\n\", \"100000001\\n\", \"1\\n\", \"75\\n\", \"18\\n\", \"43\\n\", \"26\\n\", \"4\\n\", \"922\\n\", \"111\\n\", \"208758214\\n\", \"100... | Eighth-grader Vova is on duty today in the class. After classes, he went into the office to wash the board, and found on it the number n. He asked what is this number and the teacher of mathematics Inna Petrovna answered Vova that n is the answer to the arithmetic task for first-graders. In the textbook, a certain posi... | 0.625 |
{"tests": "{\"inputs\": [[0, 3, 4, 2], [0, 9, 16, 4], [-1, 3, 0, 2], [-1571, 4240, 9023, 4234], [-7855, 4240, 9023, 4234], [43, 5, 49, 3], [9023, 4240, 1571, 4234], [129, 15, 147, 9], [129, 15, 147, 90], [0, 2, 100000, 1], [72893, 11125, 24432, 4202], [13613, 299, 65130, 73]], \"outputs\": [[true], [false], [true], [fa... | Adapted from here, with less terrible instructions and a couple tweaks.
Two kangaroos are jumping on a line. They start out at different points on the line, and jump in the same direction at different speeds. Your task is to determine whether or not they'll ever land in the same spot at the same time (you'll just have... | 0 |
{"tests": "{\"inputs\": [\"3 3 2\\n1 0 1\\n1 1 1\\n\", \"3 5 4\\n1 1 1\\n1 1 1 1 1\\n\", \"1 1 1\\n1\\n1\\n\", \"50 50 6\\n1 0 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 1 0 1\\n1 1 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 1 0 0 1 1 1 1 0 0 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1... | You are given an array $a$ of length $n$ and array $b$ of length $m$ both consisting of only integers $0$ and $1$. Consider a matrix $c$ of size $n \times m$ formed by following rule: $c_{i, j} = a_i \cdot b_j$ (i.e. $a_i$ multiplied by $b_j$). It's easy to see that $c$ consists of only zeroes and ones too.
How many s... | 0.5 |
{"tests": "{\"inputs\": [\"12\\n3\\n4 4\\n12 1\\n3 4\\n\", \"1\\n1\\n1 1\\n\", \"288807105787200\\n4\\n46 482955026400\\n12556830686400 897\\n414 12556830686400\\n4443186242880 325\\n\", \"2\\n4\\n1 1\\n1 2\\n2 1\\n2 2\\n\", \"18\\n36\\n1 1\\n1 2\\n1 3\\n1 6\\n1 9\\n1 18\\n2 1\\n2 2\\n2 3\\n2 6\\n2 9\\n2 18\\n3 1\\n3 2... | You are given a positive integer $D$. Let's build the following graph from it: each vertex is a divisor of $D$ (not necessarily prime, $1$ and $D$ itself are also included); two vertices $x$ and $y$ ($x > y$) have an undirected edge between them if $x$ is divisible by $y$ and $\frac x y$ is a prime; the weight of a... | 0 |
{"tests": "{\"inputs\": [[1, 100], [1, 200], [1, 300], [200, 1000], [1, 1000], [100, 1000], [800, 2000]], \"outputs\": [[6], [36], [252], [1104], [2619], [2223], [2352]]}", "source": "taco"} | The sum of divisors of `6` is `12` and the sum of divisors of `28` is `56`. You will notice that `12/6 = 2` and `56/28 = 2`. We shall say that `(6,28)` is a pair with a ratio of `2`. Similarly, `(30,140)` is also a pair but with a ratio of `2.4`. These ratios are simply decimal representations of fractions.
`(6,28)` ... | 0 |
{"tests": "{\"inputs\": [\"4\\n8 3 2 1\", \"5\\n0 5 3 4 2\", \"5\\n0 5 3 1 2\", \"5\\n1 8 3 4 2\", \"5\\n0 9 3 1 2\", \"5\\n1 8 3 4 0\", \"5\\n0 15 3 1 2\", \"5\\n1 5 3 8 2\", \"5\\n0 5 6 4 2\", \"5\\n0 5 3 1 4\", \"5\\n0 19 3 1 2\", \"4\\n3 5 2 1\", \"5\\n0 5 6 4 3\", \"5\\n0 12 3 1 4\", \"5\\n0 17 3 1 4\", \"4\\n4 0 ... | You are given $n$ integers $w_i (i = 0, 1, ..., n-1)$ to be sorted in ascending order. You can swap two integers $w_i$ and $w_j$. Each swap operation has a cost, which is the sum of the two integers $w_i + w_j$. You can perform the operations any number of times.
Write a program which reports the minimal total cost to... | 0 |
{"tests": "{\"inputs\": [[1], [5], [7], [153], [370], [371], [1634]], \"outputs\": [[true], [true], [true], [true], [true], [true], [true]]}", "source": "taco"} | A [Narcissistic Number](https://en.wikipedia.org/wiki/Narcissistic_number) is a positive number which is the sum of its own digits, each raised to the power of the number of digits in a given base. In this Kata, we will restrict ourselves to decimal (base 10).
For example, take 153 (3 digits):
```
1^3 + 5^3 + 3^3 ... | 0 |
{"tests": "{\"inputs\": [\"728961319347 33282698448966372 52437 42819\\n\", \"461788563846 36692905412962338 93797 64701\\n\", \"567018385179 15765533940665693 35879 13819\\n\", \"21644595275 987577030498703 66473 35329\\n\", \"1000000000000 1000000000000 6 3\\n\", \"33 346 15 8\\n\", \"778 37556 115 38\\n\", \"4529304... | The football season has just ended in Berland. According to the rules of Berland football, each match is played between two teams. The result of each match is either a draw, or a victory of one of the playing teams. If a team wins the match, it gets w points, and the opposing team gets 0 points. If the game results in ... | 0.125 |
{"tests": "{\"inputs\": [[[1, 2, 3, 4], 2], [[38, 200, -18, 45], 1], [[1, 0, 0, 1], 5], [[0, 2, 0, 3], -2], [[-20, 1, -3, 14], -5], [[1, 2, 3, 5], 100], [[0, 4, 6, 13], 100]], \"outputs\": [[3], [200], [20], [-126], [-44402], [60560100487003612846322657690093088848428068520476594299], [335254562473098582210532865941148... | In an infinite array with two rows, the numbers in the top row are denoted
`. . . , A[−2], A[−1], A[0], A[1], A[2], . . .`
and the numbers in the bottom row are denoted
`. . . , B[−2], B[−1], B[0], B[1], B[2], . . .`
For each integer `k`, the entry `A[k]` is directly above
the entry `B[k]` in the array, as shown:
... | 0 |
{"tests": "{\"inputs\": [\"1\\n\", \"25\\n\", \"2\\n\", \"4115\\n\", \"9894\\n\", \"7969\\n\", \"6560\\n\", \"4\\n\", \"3\\n\", \"5\\n\", \"19\\n\", \"20\\n\", \"9880\\n\", \"9879\\n\", \"7770\\n\", \"7769\\n\", \"2925\\n\", \"220\\n\", \"219\\n\", \"3046\\n\", \"7590\\n\", \"1014\\n\", \"7142\\n\", \"9999\\n\", \"1000... | Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 + 2 = 3 cubes, the third level must have 1 + 2 + 3 = 6 cubes, and so on. Thus, the i-th level of the pyramid must have 1 + 2 + ... | 0.125 |
{"tests": "{\"inputs\": [[\"Example string\"], [\"Example Input\"], [\"To be OR not to be That is the Question\"], [\"\"], [\"You Know When THAT Hotline Bling\"], [\" A b C d E f G \"]], \"outputs\": [[\"STRING eXAMPLE\"], [\"iNPUT eXAMPLE\"], [\"qUESTION THE IS tHAT BE TO NOT or BE tO\"], [\"\"], [\"bLING hOTLINE t... | Given a string, return a new string that has transformed based on the input:
* Change case of every character, ie. lower case to upper case, upper case to lower case.
* Reverse the order of words from the input.
**Note:** You will have to handle multiple spaces, and leading/trailing spaces.
For example:
```
"Exampl... | 0.5 |
{"tests": "{\"inputs\": [\"1 0\\nz\\n\", \"1 1\\ng\\n\", \"1 0\\na\\n\", \"1 1\\nz\\n\", \"1 0\\ng\\n\", \"4 16\\ndfhs\\nvgca\\ndfgd\\nvscd\\n\", \"1 0\\ny\\n\", \"1 1\\nf\\n\", \"4 11\\ndfhs\\nvgca\\ndfgd\\nvscd\\n\", \"4 2\\nabcd\\nbcde\\nbcad\\nacde\\n\", \"7 6\\nypnxnnp\\npnxonpm\\nnxanpou\\nxnnpmud\\nnhtdudu\\nnpm... | You are given a matrix of size n × n filled with lowercase English letters. You can change no more than k letters in this matrix.
Consider all paths from the upper left corner to the lower right corner that move from a cell to its neighboring cell to the right or down. Each path is associated with the string that is f... | 0 |
{"tests": "{\"inputs\": [\"4\\n6\\n2 1 2 3 1 1\\n5\\n1 1 1 2 2\\n8\\n7 7 2 7 7 1 8 7\\n10\\n1 2 3 4 1 1 2 3 4 1\\n\", \"4\\n6\\n2 1 2 3 1 1\\n5\\n1 1 1 2 2\\n8\\n7 7 2 7 7 1 8 7\\n10\\n1 2 3 4 1 1 2 4 4 1\\n\", \"4\\n6\\n2 2 2 3 1 1\\n5\\n1 1 1 2 2\\n8\\n7 7 2 7 7 1 8 7\\n10\\n1 2 6 4 1 1 2 4 4 1\\n\", \"4\\n6\\n2 2 2 ... | To help those contestants who struggle a lot in contests, the headquarters of Codeforces are planning to introduce Division 5. In this new division, the tags of all problems will be announced prior to the round to help the contestants.
The contest consists of $n$ problems, where the tag of the $i$-th problem is denote... | 0 |
{"tests": "{\"inputs\": [\"4\\n5\\n01110\\n10 5 8 9 6\\n6\\n011011\\n20 10 9 30 20 19\\n4\\n0000\\n100 100 100 100\\n4\\n0111\\n5 4 5 1\\n\", \"7\\n3\\n101\\n1 1 1\\n3\\n101\\n1 1 1\\n3\\n101\\n1 1 1\\n3\\n101\\n1 1 1\\n3\\n101\\n1 1 1\\n3\\n101\\n1 1 1\\n3\\n101\\n1 1 1\\n\", \"7\\n6\\n011011\\n20 10 9 30 20 19\\n6\\n... | Monocarp has been collecting rare magazines for quite a while, and now he has decided to sell them. He distributed the magazines between $n$ boxes, arranged in a row. The $i$-th box contains $a_i$ magazines. Some of the boxes are covered with lids, others are not.
Suddenly it started to rain, and now Monocarp has to s... | 0.125 |
{"tests": "{\"inputs\": [\"7\\nreading\\ntrading\\n\", \"5\\nsweet\\nsheep\\n\", \"3\\ntoy\\ntry\\n\", \"5\\nspare\\nspars\\n\", \"1\\na\\nb\\n\", \"1\\nz\\ny\\n\", \"2\\nab\\nac\\n\", \"2\\nba\\nca\\n\", \"2\\nac\\ncb\\n\", \"100\\neebdeddddbecdbddaaecbbaccbecdeacedddcaddcdebedbabbceeeadecadbbeaecdaeabbceacbdbdbbdaceb... | Analyzing the mistakes people make while typing search queries is a complex and an interesting work. As there is no guaranteed way to determine what the user originally meant by typing some query, we have to use different sorts of heuristics.
Polycarp needed to write a code that could, given two words, check whether t... | 0 |
{"tests": "{\"inputs\": [\"2\\n2 2 4\\n0 1000000\\n0 1000000\\n1 0\\n1000000 1\\n999999 1000000\\n0 999999\\n5 4 9\\n0 1 2 6 1000000\\n0 4 8 1000000\\n4 4\\n2 5\\n2 2\\n6 3\\n1000000 1\\n3 8\\n5 8\\n8 8\\n6 8\\n\", \"1\\n2 2 2\\n0 1000000\\n0 1000000\\n1556 1000000\\n0 34\\n\", \"1\\n2 2 2\\n0 1000000\\n0 1000000\\n155... | There is a city that can be represented as a square grid with corner points in $(0, 0)$ and $(10^6, 10^6)$.
The city has $n$ vertical and $m$ horizontal streets that goes across the whole city, i. e. the $i$-th vertical streets goes from $(x_i, 0)$ to $(x_i, 10^6)$ and the $j$-th horizontal street goes from $(0, y_j)$... | 0 |
{"tests": "{\"inputs\": [\"17 7 4298580\", \"123 35 678901234\", \"9 0 702443618\", \"6 1 998244353\", \"4 3 998244353\", \"17 12 4298580\", \"12 1 998244353\", \"17 1 702443618\", \"1 1 702443618\", \"8 3 776418056\", \"8 5 776418056\", \"13 5 31717648\", \"13 4 9645713\", \"13 3 9645713\", \"11 3 9645713\", \"3 3 964... | There is a blackboard on which all integers from -10^{18} through 10^{18} are written, each of them appearing once. Takahashi will repeat the following sequence of operations any number of times he likes, possibly zero:
* Choose an integer between 1 and N (inclusive) that is written on the blackboard. Let x be the cho... | 0 |
{"tests": "{\"inputs\": [[[1, 2, 2, 3, 3]], [[11, 2, 3, 3, 3, 11, 2, 2]], [[234, 76, 45, 99, 99, 99, 99, 45, 234, 234, 45, 45, 76, 234, 76]], [[1, 1, 1, 1, 1, 1, 1, 22, 22, 22, 22, 22, 22, 22, 3, 3, 3, 3, 3, 3]], [[10, 205, 3000, 3000, 10]], [[50, 408, 50, 50, 50, 50, 408, 408, 408, 680, 408, 680, 50, 408, 680, 50, 50,... | # Task
After a long night (work, play, study) you find yourself sleeping on a bench in a park. As you wake up and try to figure out what happened you start counting trees.
You notice there are different tree sizes but there's always one size which is unbalanced. For example there are 2 size 2, 2 size 1 and 1 size 3. (... | 0 |
{"tests": "{\"inputs\": [\"5\\n0 10 2 3\\n0 10 3 3\\n900000000 1000000000 1 9999999\\n1 2 1 1\\n1 3 1 1\\n\", \"5\\n0 10 0 3\\n0 10 3 3\\n900000000 1000000000 1 9999999\\n1 2 1 1\\n1 3 1 1\\n\", \"5\\n0 10 -1 3\\n1 10 3 3\\n900000000 1000000000 1 9999999\\n1 2 1 1\\n1 3 1 1\\n\", \"5\\n0 10 -2 3\\n1 10 3 3\\n900000000 ... | Being tired of participating in too many Codeforces rounds, Gildong decided to take some rest in a park. He sat down on a bench, and soon he found two rabbits hopping around. One of the rabbits was taller than the other.
He noticed that the two rabbits were hopping towards each other. The positions of the two rabbits ... | 0.625 |
{"tests": "{\"inputs\": [\"3 6\\n5 3 1\\n\", \"1 4\\n19\\n\", \"1 3\\n1000000\\n\", \"1 1\\n1\\n\", \"10 23\\n343 984 238 758983 231 74 231 548 893 543\\n\", \"20 40\\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\\n\", \"29 99047\\n206580 305496 61753 908376 272137 803885 675070 665109 995787 667887 164508 634877 994427 270... | There are some rabbits in Singapore Zoo. To feed them, Zookeeper bought $n$ carrots with lengths $a_1, a_2, a_3, \ldots, a_n$. However, rabbits are very fertile and multiply very quickly. Zookeeper now has $k$ rabbits and does not have enough carrots to feed all of them. To solve this problem, Zookeeper decided to cut ... | 0 |
{"tests": "{\"inputs\": [\"3 4 240\\n60 90 120\\n80 150 80 150\\n\", \"3 4 730\\n60 90 120\\n80 150 80 150\\n\", \"5 4 1\\n1000000000 1000000000 1000000000 1000000000 1000000000\\n1000000000 1000000000 1000000000 1000000000\\n\", \"5 4 1\\n1000000000 1000000000 1000000000 1000000000 1000000000\\n1000000000 1000000000 1... | We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.
It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top on Desk B (1 \leq i \leq M).
Consider the following action:
- Choo... | 0 |
{"tests": "{\"inputs\": [\"25 28\\nATK 1267\\nDEF 1944\\nATK 1244\\nATK 1164\\nATK 1131\\nDEF 1589\\nDEF 1116\\nDEF 1903\\nATK 1162\\nATK 1058\\nDEF 1291\\nDEF 1199\\nDEF 754\\nDEF 1726\\nDEF 1621\\nATK 1210\\nDEF 939\\nDEF 919\\nDEF 978\\nDEF 1967\\nATK 1179\\nDEF 1981\\nATK 1088\\nDEF 404\\nATK 1250\\n2149\\n1969\\n2... | Fox Ciel is playing a card game with her friend Jiro.
Jiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attributes too. It's known that position of all Ciel's cards is Attack.
Now is Ciel's battle phase, Ciel can do the following ope... | 0 |
{"tests": "{\"inputs\": [[[]], [[12, 23, 45]], [[17]], [[10, 20, 30, 40]], [[10, 20, 30, 40, 58]], [[10, 20, 30, 40, 47, 60]], [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]], \"outputs\": [[60], [51], [57], [48], [48], [47], [30]]}", "source": "taco"} | # Task
Some children are playing rope skipping game. Children skip the rope at roughly the same speed: `once per second`. If the child fails during the jump, he needs to tidy up the rope and continue. This will take `3 seconds`.
You are given an array `failedCount`, where each element is the jump count at the failed. ... | 0 |
{"tests": "{\"inputs\": [[\"123321\"], [\"12341234\"], [\"100001\"], [\"100200\"], [\"912435\"], [\"12a12a\"], [\"999999\"], [\"1111\"], [\"000000\"], [\"\"]], \"outputs\": [[true], [false], [true], [false], [true], [false], [true], [false], [true], [false]]}", "source": "taco"} | In Russia regular bus tickets usually consist of 6 digits. The ticket is called lucky when the sum of the first three digits equals to the sum of the last three digits. Write a function to find out whether the ticket is lucky or not. Return true if so, otherwise return false. Consider that input is always a string. Wat... | 0 |
{"tests": "{\"inputs\": [\"1\\nabc\\n\", \"5\\n123\\n234\\n345\\n456\\n567\\n\", \"8\\nzHW\\ncwx\\nxmo\\nWcw\\nox1\\nwxm\\nmox\\nHWc\\n\", \"2\\nbba\\nabb\\n\", \"99\\naaJ\\nJx9\\naLL\\nrCx\\nllJ\\naja\\nxxr\\nLal\\nv9C\\njrL\\nLvL\\nJLl\\nxlJ\\nLja\\nLLC\\njvL\\n9CJ\\nvrJ\\nlJJ\\nlCC\\nlxC\\njxl\\nLaJ\\nLxJ\\nrjr\\nxv... | While dad was at work, a little girl Tanya decided to play with dad's password to his secret database. Dad's password is a string consisting of n + 2 characters. She has written all the possible n three-letter continuous substrings of the password on pieces of paper, one for each piece of paper, and threw the password ... | 0 |
{"tests": "{\"inputs\": [[\"LQTcQAP>pQBBTAI-PA-PPL+P<BVPAL+T+P>PL+PBLPBP<DLLLT+P\"], [\"LLQT+P >LLLc+QIT-P AAAP P\"], [\"LLQT>+WN+<P>E\"], [\"cW>LQQT+P<pE\"], [\"+W>LQQT+P<-E\"], [\"+LTQII>+WN<P>+E\"], [\"+LTQIITTIWP-E\"], [\"LILcABNBpYDYYYYLLL+P-+W-EQNW-ELLQUTTTT+P\"], [\"++W-NE\"], [\"W>UQLIPNPPP45vSDFJLLIPNPqwVMT<E\... | Create a function that interprets code in the esoteric language **Poohbear**
## The Language
Poohbear is a stack-based language largely inspired by Brainfuck. It has a maximum integer value of 255, and 30,000 cells. The original intention of Poohbear was to be able to send messages that would, to most, be completely ... | 0 |
{"tests": "{\"inputs\": [[[5, 2, 1]], [[84, 42, 21, 10, 2]], [[83, 47, 28, 16, 7]], [[101, 57, 29, 13, 6]], [[66, 39, 25, 15, 7]], [[45, 25, 14, 8, 6]], [[60, 32, 16, 7, 4]], [[84, 44, 21, 8, 2]], [[51, 26, 13, 6, 2]], [[78, 42, 22, 11, 6]]], \"outputs\": [[[2, 1, 1]], [[4, 7, 3, 8, 2]], [[6, 4, 3, 9, 7]], [[1, 3, 9, 7... | If this challenge is too easy for you, check out:
https://www.codewars.com/kata/5cc89c182777b00001b3e6a2
___
Upside-Down Pyramid Addition is the process of taking a list of numbers and consecutively adding them together until you reach one number.
When given the numbers `2, 1, 1` the following process occurs:
```
... | 0 |
{"tests": "{\"inputs\": [\"2\\n1 1\\n01000010\\n5 1\\n01101110\\n\", \"2\\n1 1\\n01000110\\n5 1\\n01101110\\n\", \"2\\n2 1\\n01000110\\n5 1\\n01101110\\n\", \"2\\n2 1\\n01000110\\n5 1\\n01101101\\n\", \"2\\n2 1\\n11000111\\n5 1\\n01101001\\n\", \"2\\n1 1\\n01000010\\n10 1\\n01101110\\n\", \"2\\n1 1\\n01000110\\n5 2\\n0... | Bertown is a city with $n$ buildings in a straight line.
The city's security service discovered that some buildings were mined. A map was compiled, which is a string of length $n$, where the $i$-th character is "1" if there is a mine under the building number $i$ and "0" otherwise.
Bertown's best sapper knows how to ... | 0 |
{"tests": "{\"inputs\": [\"0ig3hd12fz99\", \"0hg3hd12fz99\", \"833453334\", \"2336078995\", \"1437005866\", \"4037065\", \"15423151\", \"8181\", \"111\", \"0hg3hd13fz99\", \"90\", \"2\", \"1496009822\", \"0hf3hd12fz99\", \"1173329527\", \"99zf21dh3fh0\", \"0hfdh312fz99\", \"1810014501\", \"0gfdh312fz99\", \"2441147408\... | Problem
Given the string S, which consists of lowercase letters and numbers. Follow the steps below to compress the length of string S.
1. Change the order of the characters in the character string to any order.
Example: "0ig3he12fz99"-> "efghiz012399"
2. Perform the following operations any number of times.
* Sele... | 0 |
{"tests": "{\"inputs\": [[[\"A_R\", \"B_Y\", \"A_R\"], 2, 2], [[\"B_R\", \"A_Y\", \"A_R\", \"D_Y\", \"B_R\", \"D_Y\", \"B_R\", \"D_Y\", \"C_R\", \"D_Y\"], 4, 4], [[\"A_R\", \"C_Y\", \"C_R\", \"B_Y\", \"A_R\", \"C_Y\", \"B_R\", \"B_Y\", \"D_R\", \"A_Y\", \"D_R\", \"A_Y\"], 2, 4], [[\"H_R\", \"A_Y\", \"A_R\", \"C_Y\", \"... | Based on [this kata, Connect Four.](https://www.codewars.com/kata/connect-four-1)
In this kata we play a modified game of connect four. It's connect X, and there can be multiple players.
Write the function ```whoIsWinner(moves,connect,size)```.
```2 <= connect <= 10```
```2 <= size <= 52```
Each column is identifi... | 0 |
{"tests": "{\"inputs\": [\"1 2 2 1\\n\", \"1 1 1 2\\n\", \"2 12 3 1\\n\", \"4 6 2 1\\n\", \"4 6 2 2\\n\", \"6 4 2 2\\n\", \"10 1 3 3\\n\", \"5 3 1 1\\n\", \"50 22 5 5\\n\", \"6 20 1 1\\n\", \"42 42 2 3\\n\", \"42 42 3 2\\n\", \"45 54 4 5\\n\", \"6 5 4 3\\n\", \"42 42 42 42\\n\", \"1 100 42 42\\n\", \"1 100 1000 100\\n\... | Memory and his friend Lexa are competing to get higher score in one popular computer game. Memory starts with score a and Lexa starts with score b. In a single turn, both Memory and Lexa get some integer in the range [ - k;k] (i.e. one integer among - k, - k + 1, - k + 2, ..., - 2, - 1, 0, 1, 2, ..., k - 1, k) and... | 0 |
{"tests": "{\"inputs\": [\"abc\\n\", \"abbac\\n\", \"babacabac\\n\", \"ababacbcacbacacbcbbcbbacbaccacbacbacba\\n\", \"babacaabc\", \"bbaac\", \"bac\", \"ababacbcacbacacbcbbcbbbcbaccacbacbacba\", \"cac\", \"bdabdaaab\", \"babababac\", \"abcba\", \"cbaacabab\", \"bbbac\", \"cab\", \"abcabcabcaccabcbbbcbbcbcacabcacbcababa... | You are given a string S consisting of a,b and c. Find the number of strings that can be possibly obtained by repeatedly performing the following operation zero or more times, modulo 998244353:
- Choose an integer i such that 1\leq i\leq |S|-1 and the i-th and (i+1)-th characters in S are different. Replace each of th... | 0 |
{"tests": "{\"inputs\": [\"5\\n0 2 3 4 5\", \"5\\n1 2 1 4 5\", \"5\\n0 4 3 13 4\", \"5\\n0 2 3 4 8\", \"5\\n0 2 3 4 14\", \"5\\n0 1 3 4 5\", \"5\\n0 2 3 4 2\", \"5\\n0 2 3 8 2\", \"5\\n0 2 3 13 2\", \"5\\n0 2 3 13 4\", \"5\\n0 4 3 9 4\", \"5\\n0 4 3 12 4\", \"5\\n1 4 3 12 4\", \"5\\n2 4 3 12 4\", \"5\\n2 4 3 22 4\", \"... | problem
Given the sequence $ A $ of length $ N $. The $ i $ item in $ A $ is $ A_i $. You can do the following for this sequence:
* $ 1 \ leq i \ leq N --Choose the integer i that is 1 $. Swap the value of $ A_i $ with the value of $ A_ {i + 1} $.
Find the minimum number of operations required to make $ A $ a sequ... | 0 |
{"tests": "{\"inputs\": [\"1 2 1000\\n\", \"2 2 1000\\n\", \"5 3 1103\\n\", \"2 17 10000\\n\", \"3 9 10000\\n\", \"6 64 941761822\\n\", \"183 3 46847167\\n\", \"472 44 364550669\\n\", \"510 76 811693420\\n\", \"783 30 602209107\\n\", \"863 47 840397713\\n\", \"422 22 411212542\\n\", \"370 9 385481464\\n\", \"312 41 915... | Amr doesn't like Maths as he finds it really boring, so he usually sleeps in Maths lectures. But one day the teacher suspected that Amr is sleeping and asked him a question to make sure he wasn't.
First he gave Amr two positive integers n and k. Then he asked Amr, how many integer numbers x > 0 exist such that: Decim... | 0 |
{"tests": "{\"inputs\": [\"3 8 3\\n0 2\\n3 2\\n6 1\", \"4 20 18\\n7 2\\n9 1\\n12 1\\n18 1\", \"2 8 3\\n0 1\\n3 2\\n6 1\", \"3 8 3\\n1 2\\n3 2\\n6 1\", \"4 20 18\\n3 2\\n9 1\\n12 1\\n18 1\", \"1 8 3\\n1 2\\n3 2\\n6 1\", \"1 8 0\\n1 2\\n3 4\\n6 1\", \"1 8 1\\n1 2\\n3 4\\n6 1\", \"2 8 3\\n1 1\\n3 2\\n6 1\", \"1 5 3\\n1 2\... | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coor... | 0 |
{"tests": "{\"inputs\": [[\"aacb\", \"aabc\"], [\"aa\", \"bc\"], [\"aaxxaaz\", \"aazzaay\"], [\"aaxyaa\", \"aazzaa\"], [\"aazzaa\", \"aaxyaa\"], [\"jpeuizmi\", \"mxxcwriq\"]], \"outputs\": [[true], [false], [true], [false], [false], [false]]}", "source": "taco"} | # Task
A ciphertext alphabet is obtained from the plaintext alphabet by means of rearranging some characters. For example "bacdef...xyz" will be a simple ciphertext alphabet where a and b are rearranged.
A substitution cipher is a method of encoding where each letter of the plaintext alphabet is replaced with the co... | 0.125 |
{"tests": "{\"inputs\": [\"4\\n3\\n0 2 1\\n2\\n1 0\\n5\\n0 0 0 0 0\\n4\\n0 1 2 3\\n\", \"1\\n30\\n0 0 0 2 0 0 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\\n\", \"1\\n30\\n0 0 0 2 0 0 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\\n\", \"1\\n30\\n0 0 0 1 0 0 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\\n\", \"... | Let's call a sequence of integers $x_1, x_2, \dots, x_k$ MEX-correct if for all $i$ ($1 \le i \le k$) $|x_i - \operatorname{MEX}(x_1, x_2, \dots, x_i)| \le 1$ holds. Where $\operatorname{MEX}(x_1, \dots, x_k)$ is the minimum non-negative integer that doesn't belong to the set $x_1, \dots, x_k$. For example, $\operatorn... | 0 |
{"tests": "{\"inputs\": [\"5 3\\n11010\\n00101\\n11000\\n\", \"30 2\\n010101010101010010101010101010\\n110110110110110011011011011011\\n\", \"30 10\\n001000000011000111000010010000\\n000001100001010000000000000100\\n000110100010100000000000101000\\n110000010000000001000000000000\\n100001000000000010010101000101\\n00100... | You are given an integer m.
Let M = 2^{m} - 1.
You are also given a set of n integers denoted as the set T. The integers will be provided in base 2 as n binary strings of length m.
A set of integers S is called "good" if the following hold. If $a \in S$, then [Image]. If $a, b \in S$, then $a \text{AND} b \in S$ ... | 0 |
{"tests": "{\"inputs\": [\"3 2\\n100 50 200\\n\", \"5 8\\n50 30 40 10 20\\n\", \"10 100\\n7 10 4 5 9 3 6 8 2 1\\n\", \"5 8\\n21 30 40 10 20\", \"10 100\\n7 10 4 5 9 3 6 8 1 1\", \"3 2\\n100 78 200\", \"5 8\\n21 30 40 0 20\", \"3 3\\n100 78 200\", \"5 8\\n21 30 24 0 20\", \"3 3\\n100 38 200\", \"3 5\\n100 38 200\", \"3 ... | There are N towns located in a line, conveniently numbered 1 through N. Takahashi the merchant is going on a travel from town 1 to town N, buying and selling apples.
Takahashi will begin the travel at town 1, with no apple in his possession. The actions that can be performed during the travel are as follows:
- Move: W... | 0 |
{"tests": "{\"inputs\": [\"9\\n10 5 4 7 9 12 6 2 10\\n\", \"20\\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4\\n\", \"20\\n9 29 8 9 13 4 14 27 16 11 27 14 4 29 23 17 3 9 30 19\\n\", \"100\\n411 642 560 340 276 440 515 519 182 314 35 227 390 136 97 5 502 584 567 79 543 444 413 463 455 316 545 329 437 443 9 435 291 384 328 50... | You can perfectly predict the price of a certain stock for the next N days. You would like to profit on this knowledge, but only want to transact one share of stock per day. That is, each day you will either buy one share, sell one share, or do nothing. Initially you own zero shares, and you cannot sell shares when you... | 0 |
{"tests": "{\"inputs\": [\"2\\n)(\\n\", \"3\\n(()\\n\", \"2\\n()\\n\", \"10\\n)))))(((((\\n\", \"1\\n)\\n\", \"1\\n(\\n\", \"98\\n()()(((((((())))(((()))))(())(())()()(())())))))((()()()))()(((()))()()())((())(((()(((())))()))))\\n\", \"100\\n(()()((((())()()(()()())())))((((())(((()))()()()((()))(())))((()()(((()())))... | Petya's friends made him a birthday present — a bracket sequence. Petya was quite disappointed with his gift, because he dreamed of correct bracket sequence, yet he told his friends nothing about his dreams and decided to fix present himself.
To make everything right, Petya is going to move at most one bracket from i... | 0.625 |
{"tests": "{\"inputs\": [\"4 5\\n3 2\\n1 2\\n.....\\n.***.\\n...**\\n*....\\n\", \"4 4\\n2 2\\n0 1\\n....\\n..*.\\n....\\n....\\n\", \"1 1\\n1 1\\n0 0\\n.\\n\", \"1 1\\n1 1\\n31 42\\n.\\n\", \"10 10\\n10 4\\n10 9\\n...*******\\n.*.*******\\n.*.*******\\n.*.*******\\n.*.*******\\n.*.*......\\n.*.*.*****\\n.*........\\n.... | You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starting cell is in the row r and column c. In one step you can move one square up, left, down or right, if the target cell is not o... | 0.375 |
{"tests": "{\"inputs\": [\"7\\n5 2 4 3 6 7 1\\n0001001\\n0000000\\n0000010\\n1000001\\n0000000\\n0010000\\n1001000\\n\", \"5\\n4 2 1 5 3\\n00100\\n00011\\n10010\\n01101\\n01010\\n\", \"7\\n1 7 6 4 2 3 5\\n0000100\\n0000010\\n0000001\\n0000000\\n1000000\\n0100000\\n0010000\\n\", \"15\\n6 1 2 7 9 13 14 8 4 5 3 12 10 15 1... | User ainta has a permutation p_1, p_2, ..., p_{n}. As the New Year is coming, he wants to make his permutation as pretty as possible.
Permutation a_1, a_2, ..., a_{n} is prettier than permutation b_1, b_2, ..., b_{n}, if and only if there exists an integer k (1 ≤ k ≤ n) where a_1 = b_1, a_2 = b_2, ..., a_{k} - 1 = b_{... | 0 |
{"tests": "{\"inputs\": [\"4\\n4\\n3 5 4 6\\n2 1\\n3 1\\n4 3\\n2\\n21 32\\n2 1\\n6\\n20 13 17 13 13 11\\n2 1\\n3 1\\n4 1\\n5 1\\n6 1\\n4\\n10 6 6 6\\n1 2\\n2 3\\n4 1\\n\", \"4\\n4\\n3 5 4 6\\n2 1\\n3 1\\n4 3\\n2\\n21 32\\n2 1\\n6\\n13 13 17 13 13 11\\n2 1\\n3 1\\n4 1\\n5 1\\n6 1\\n4\\n10 6 6 6\\n1 2\\n2 3\\n4 1\\n\", \... | You've probably heard about the twelve labors of Heracles, but do you have any idea about the thirteenth? It is commonly assumed it took him a dozen years to complete the twelve feats, so on average, a year to accomplish every one of them. As time flows faster these days, you have minutes rather than months to solve th... | 0 |
{"tests": "{\"inputs\": [\"5 4 3\\n\", \"1 1 1\\n\", \"2 3 3\\n\", \"0 1 0\\n\", \"0 3 3\\n\", \"4 0 4\\n\", \"1000000000 1000000000 1000000000\\n\", \"100 99 56\\n\", \"1000 1000 1002\\n\", \"0 1 1000000000\\n\", \"500000000 1000000000 500000000\\n\", \"1000000000 2000000000 1000000000\\n\", \"2000000000 2000000000 20... | You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What maximum number t of tables can be decorated if we know number of balloons of each color?
Your task is to write a program tha... | 0.625 |
{"tests": "{\"inputs\": [\"2 2 3\\n\", \"2 20 37\\n\", \"500 500 250000\\n\", \"500 500 249995\\n\", \"1 1 1\\n\", \"2 1 1\\n\", \"32 71 297\\n\", \"20 20 8\\n\", \"6 14 23\\n\", \"2 78 117\\n\", \"500 500 9997\\n\", \"500 500 6913\\n\", \"2 1 2\\n\", \"3 3 5\\n\", \"5 1 3\\n\", \"5 10 25\\n\", \"74 99 5057\\n\", \"500... | There is a board with a grid consisting of n rows and m columns, the rows are numbered from 1 from top to bottom and the columns are numbered from 1 from left to right. In this grid we will denote the cell that lies on row number i and column number j as (i, j).
A group of six numbers (a, b, c, d, x0, y0), where 0 ≤ a... | 0 |
{"tests": "{\"inputs\": [\"1\\n\", \"2\\n\", \"3\\n\", \"4\\n\", \"5\\n\", \"6\\n\", \"7\\n\", \"8\\n\", \"9\\n\", \"10\\n\", \"11\\n\", \"12\\n\", \"13\\n\", \"14\\n\", \"15\\n\", \"450\\n\", \"999\\n\", \"1000\\n\", \"16\\n\", \"17\\n\", \"18\\n\", \"19\\n\", \"20\\n\", \"21\\n\", \"22\\n\", \"23\\n\", \"24\\n\", \"2... | Neko is playing with his toys on the backyard of Aki's house. Aki decided to play a prank on him, by secretly putting catnip into Neko's toys. Unfortunately, he went overboard and put an entire bag of catnip into the toys...
It took Neko an entire day to turn back to normal. Neko reported to Aki that he saw a lot of w... | 0 |
{"tests": "{\"inputs\": [[\"h(el)lo\"], [\"a ((d e) c b)\"], [\"one (two (three) four)\"], [\"one (ruof ((rht)ee) owt)\"], [\"\"], [\"many (parens) on (top)\"], [\"( ( ) (()) )\"]], \"outputs\": [[\"h(le)lo\"], [\"a (b c (d e))\"], [\"one (ruof (three) owt)\"], [\"one (two ((thr)ee) four)\"], [\"\"], [\"many (snerap) o... | In this kata, you will be given a string of text and valid parentheses, such as `"h(el)lo"`. You must return the string, with only the text inside parentheses reversed, so `"h(el)lo"` becomes `"h(le)lo"`. However, if said parenthesized text contains parenthesized text itself, then that too must reversed back, so it fac... | 0 |
{"tests": "{\"inputs\": [\"1 2 3 4\\n\", \"1 2 2 5\\n\", \"500000 500000 500000 500000\\n\", \"276 391 634 932\\n\", \"32 89 451 476\\n\", \"312 691 867 992\\n\", \"13754 30499 132047 401293\\n\", \"52918 172310 225167 298306\\n\", \"89222 306288 442497 458131\\n\", \"86565 229134 356183 486713\\n\", \"80020 194147 335... | Like any unknown mathematician, Yuri has favourite numbers: $A$, $B$, $C$, and $D$, where $A \leq B \leq C \leq D$. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sides $x$, $y$, and $z$ exist, such that $A \leq x \leq B \leq y \leq C \leq z \leq D$ holds?
Yuri is prepari... | 0 |
{"tests": "{\"inputs\": [\"7\\n21 12 1 16 13 6 7\\n20 11 2 20 14 5 8\\n19 10 3 18 15 4 9\", \"5\\n9 6 15 12 1\\n10 5 14 11 2\\n7 4 13 10 3\", \"6\\n15 10 3 4 9 5\\n14 11 2 5 8 17\\n13 12 1 6 7 18\", \"5\\n1 2 3 0 5\\n6 7 8 9 10\\n11 12 13 14 15\", \"7\\n21 12 1 16 14 6 7\\n20 11 2 20 14 5 8\\n19 10 3 18 15 4 9\", \"5\\... | We have a grid with 3 rows and N columns. The cell at the i-th row and j-th column is denoted (i, j). Initially, each cell (i, j) contains the integer i+3j-3.
<image>
A grid with N=5 columns
Snuke can perform the following operation any number of times:
* Choose a 3×3 subrectangle of the grid. The placement of inte... | 0.125 |
{"tests": "{\"inputs\": [[[1, 2], [3, 4], 15], [[3, 1, 2], [4, 5], 21], [[5, 1, 4], [5, 4], 29], [[11, 23, 3, 4, 15], [7, 14, 9, 21, 15], 300], [[2, 7, 13, 17], [23, 56, 44, 12, 1, 2, 1], 255], [[2, 5, 8], [11, 23, 3, 4, 15, 112, 12, 4], 355], [[1, 1, 1, 2, 1, 2], [2, 1, 2, 1, 2, 1], 30], [[5, 10, 15], [11, 23, 3, 4, 1... | Every Friday and Saturday night, farmer counts amount of sheep returned back to his farm (sheep returned on Friday stay and don't leave for a weekend).
Sheep return in groups each of the days -> you will be given two arrays with these numbers (one for Friday and one for Saturday night). Entries are always positive int... | 0 |
{"tests": "{\"inputs\": [\"2 1\\n1 1\\n0 0\\n\", \"1 1\\n1\\n0 0\\n\", \"30 10\\n1 1 3 3 5 2 1 8 2 6 11 5 2 6 12 11 8 5 11 3 14 8 16 13 14 25 16 2 8 17\\n6 3\\n0 15\\n1 0\\n9 2\\n12 16\\n1 0\\n17 3\\n14 13\\n0 22\\n3 10\\n\", \"13 5\\n2 2 3 9 5 4 6 5 7 8 3 11 13\\n3 1\\n0 0\\n2 6\\n5 0\\n0 12\\n\", \"5 2\\n1 6 1 2 4\\n... | Let a_1, …, a_n be an array of n positive integers. In one operation, you can choose an index i such that a_i = i, and remove a_i from the array (after the removal, the remaining parts are concatenated).
The weight of a is defined as the maximum number of elements you can remove.
You must answer q independent queries... | 0 |
{"tests": "{\"inputs\": [\"4\\n1 1 1 4\\n\", \"5\\n1 1 5 2 1\\n\", \"13\\n1 1 1 1 1 1 1 1 1 4 4 4 13\\n\", \"4\\n1 1 1 3\\n\", \"24\\n1 1 1 1 1 1 1 1 1 1 1 1 24 1 1 1 1 1 1 1 1 1 1 1\\n\", \"24\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24\\n\", \"10\\n1 1 1 1 7 1 1 1 4 10\\n\", \"24\\n1 1 3 1 1 10 2... | Iahub and Iahubina went to a picnic in a forest full of trees. Less than 5 minutes passed before Iahub remembered of trees from programming. Moreover, he invented a new problem and Iahubina has to solve it, otherwise Iahub won't give her the food.
Iahub asks Iahubina: can you build a rooted tree, such that
each in... | 0 |
{"tests": "{\"inputs\": [[95, 90, 93], [100, 85, 96], [92, 93, 94], [100, 100, 100], [70, 70, 100], [82, 85, 87], [84, 79, 85], [70, 70, 70], [75, 70, 79], [60, 82, 76], [65, 70, 59], [66, 62, 68], [58, 62, 70], [44, 55, 52], [48, 55, 52], [58, 59, 60], [0, 0, 0]], \"outputs\": [[\"A\"], [\"A\"], [\"A\"], [\"A\"], [\"B... | ## Grade book
Complete the function so that it finds the mean of the three scores passed to it and returns the letter value associated with that grade.
Numerical Score | Letter Grade
--- | ---
90 <= score <= 100 | 'A'
80 <= score < 90 | 'B'
70 <= score < 80 | 'C'
60 <= score < 70 | 'D'
0 <= s... | 0 |
{"tests": "{\"inputs\": [\"110401\\n\", \"1738464936\\n\", \"9009890098\\n\", \"189108\\n\", \"9012332098\\n\", \"3031371285404035821731303\\n\", \"643303246\\n\", \"230021\\n\", \"970068\\n\", \"10000000000\\n\", \"891297\\n\", \"4602332064\\n\", \"1094093901\\n\", \"6149019415\\n\", \"95948\\n\", \"999999\\n\", \"432... | Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovna gave him a new one, that is much harder.
Let's denote a flip operation of an integer as follows: number is considered... | 0 |
{"tests": "{\"inputs\": [\"2\\n1\\n8\", \"2\\n0\\n8\", \"2\\n0\\n6\", \"2\\n-1\\n1\", \"2\\n-4\\n0\", \"2\\n0\\n1\", \"2\\n0\\n0\", \"2\\n0\\n-1\", \"2\\n1\\n-1\", \"2\\n2\\n-1\", \"2\\n-1\\n-1\", \"2\\n-2\\n-1\", \"2\\n-4\\n-1\", \"2\\n-4\\n-2\", \"2\\n-4\\n1\", \"2\\n-3\\n1\", \"2\\n-3\\n2\", \"2\\n-4\\n2\", \"2\\n-6... | Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.
Chef is playing a game with his friend Misha. They have a pile containg N coins. Players take alternate turns, removing some coins from the pile. On each turn, a player can remove either one coin or coins equal to some prime power (i.e. p^{... | 0.125 |
{"tests": "{\"inputs\": [\"7\\n1 1\\n10 1\\n100 3\\n1024 14\\n998244353 1337\\n123 144\\n1234312817382646 13\\n\", \"7\\n1 1\\n10 2\\n100 3\\n1024 14\\n998244353 1337\\n123 144\\n1234312817382646 13\\n\", \"7\\n1 1\\n10 2\\n100 3\\n1024 14\\n998244353 1337\\n123 144\\n1234312817382646 16\\n\", \"7\\n1 1\\n10 2\\n100 3\... | Polycarp is reading a book consisting of $n$ pages numbered from $1$ to $n$. Every time he finishes the page with the number divisible by $m$, he writes down the last digit of this page number. For example, if $n=15$ and $m=5$, pages divisible by $m$ are $5, 10, 15$. Their last digits are $5, 0, 5$ correspondingly, the... | 0.5 |
{"tests": "{\"inputs\": [\"10 10 4\\n9 0 9 10\\n4 0 4 10\\n1 0 1 10\\n1 4 4 4\\n\", \"5 5 3\\n2 1 2 5\\n0 1 5 1\\n4 0 4 1\\n\", \"100 100 1\\n0 14 100 14\\n\", \"9 8 5\\n4 3 4 4\\n0 4 9 4\\n5 4 5 8\\n0 3 9 3\\n1 4 1 8\\n\", \"2 7 2\\n0 1 2 1\\n0 3 2 3\\n\", \"2 8 2\\n0 1 2 1\\n0 3 2 3\\n\", \"2 14 2\\n0 1 2 1\\n0 3 2 3... | Bob has a rectangular chocolate bar of the size W × H. He introduced a cartesian coordinate system so that the point (0, 0) corresponds to the lower-left corner of the bar, and the point (W, H) corresponds to the upper-right corner. Bob decided to split the bar into pieces by breaking it. Each break is a segment parall... | 0 |
{"tests": "{\"inputs\": [\"15 5\\n15 3 7 0 14\\n11 11\\n\", \"15 5\\n15 14 7 3 0\\n11 11\\n\", \"100 5\\n3 100 7 13 0\\n99 5\\n\", \"30 8\\n0 1 9 10 23 24 26 30\\n40 7\\n\", \"4 5\\n0 3 1 2 4\\n2 1\\n\", \"4 3\\n0 4 2\\n2 2\\n\", \"4 5\\n0 3 1 2 4\\n1 1\\n\", \"15 5\\n15 3 7 0 14\\n13 11\\n\", \"100 5\\n3 100 7 13 0\\n... | If the girl doesn't go to Denis, then Denis will go to the girl. Using this rule, the young man left home, bought flowers and went to Nastya.
On the way from Denis's house to the girl's house is a road of n lines. This road can't be always crossed in one green light. Foreseeing this, the good mayor decided to place s... | 0 |
{"tests": "{\"inputs\": [\"9 9 5 5 2 1\\n\", \"100 100 52 50 46 56\\n\", \"100 100 16 60 42 75\\n\", \"100 100 28 22 47 50\\n\", \"100 100 44 36 96 21\\n\", \"100 100 56 46 1 47\\n\", \"100 100 20 53 6 22\\n\", \"100 100 32 63 2 41\\n\", \"100 100 48 73 63 16\\n\", \"100 100 13 59 14 20\\n\", \"36830763 28058366 308273... | You are given a rectangle grid. That grid's size is n × m. Let's denote the coordinate system on the grid. So, each point on the grid will have coordinates — a pair of integers (x, y) (0 ≤ x ≤ n, 0 ≤ y ≤ m).
Your task is to find a maximum sub-rectangle on the grid (x_1, y_1, x_2, y_2) so that it contains the given poi... | 0 |
{"tests": "{\"inputs\": [[[\"abcd\", \"aaa\"]], [[\"trances\", \"nectar\"]], [[\"THE EYES\", \"they see\"]], [[\"assert\", \"staring\"]], [[\"arches\", \"later\"]], [[\"dale\", \"caller\"]], [[\"parses\", \"parsecs\"]], [[\"replays\", \"adam\"]], [[\"mastering\", \"streaming\"]], [[\"drapes\", \"compadres\"]], [[\"delt... | Write a function that checks if all the letters in the second string are present in the first one at least once, regardless of how many times they appear:
```
["ab", "aaa"] => true
["trances", "nectar"] => true
["compadres", "DRAPES"] => true
["parses", "parsecs"] => false
```
Function should not be cas... | 0.125 |
{"tests": "{\"inputs\": [\"10000000000000000 10000000000000000 100 100 10000000000000000 10000000000000000\\n10000000000000000 10000000000000000 10000000000000000\\n\", \"104297919 1 8 7 4511 8536\\n104297915 1 1749847629985887\\n\", \"1 1304652252823022 3 9 66 34\\n1 1304652252823018 8\\n\", \"7065361106930734 4266956... | [THE SxPLAY & KIVΛ - 漂流](https://soundcloud.com/kivawu/hyouryu)
[KIVΛ & Nikki Simmons - Perspectives](https://soundcloud.com/kivawu/perspectives)
With a new body, our idol Aroma White (or should we call her Kaori Minamiya?) begins to uncover her lost past through the OS space.
The space can be considered a 2D plane,... | 0 |
{"tests": "{\"inputs\": [\"3\\n10 50\\n2 100\\n5 30\\n3\\n4 6 9\\n\", \"1\\n1 1\\n1\\n1\\n\", \"1\\n2 1\\n1\\n1\\n\", \"2\\n10 10\\n5 5\\n1\\n5\\n\", \"2\\n10 10\\n5 5\\n1\\n10\\n\", \"2\\n2 100\\n10 10\\n1\\n10\\n\", \"2\\n10 100\\n5 90\\n2\\n15 20\\n\", \"3\\n10 10\\n3 5\\n5 8\\n3\\n3 4 10\\n\", \"10\\n739 307\\n523 ... | Innovation technologies are on a victorious march around the planet. They integrate into all spheres of human activity!
A restaurant called "Dijkstra's Place" has started thinking about optimizing the booking system.
There are n booking requests received by now. Each request is characterized by two numbers: c_{i} an... | 0 |
{"tests": "{\"inputs\": [\"6\\n4 5\\n2 6\\n3 2\\n1 2\\n2 4\\n\", \"4\\n2 4\\n4 1\\n3 4\\n\", \"3\\n2 1\\n3 2\\n\", \"5\\n1 2\\n2 3\\n3 4\\n4 5\\n\", \"5\\n1 2\\n5 2\\n2 4\\n2 3\\n\", \"5\\n1 2\\n3 2\\n2 4\\n2 5\\n\", \"15\\n2 5\\n12 6\\n2 14\\n3 6\\n15 6\\n3 2\\n2 11\\n9 2\\n4 2\\n8 2\\n2 13\\n1 2\\n10 2\\n2 7\\n\", \"... | You are given a tree with $n$ vertices. You are allowed to modify the structure of the tree through the following multi-step operation: Choose three vertices $a$, $b$, and $c$ such that $b$ is adjacent to both $a$ and $c$. For every vertex $d$ other than $b$ that is adjacent to $a$, remove the edge connecting $d$ and... | 0 |
{"tests": "{\"inputs\": [\"3\\n3 2 2\\n\", \"4\\n2 2 2 2\\n\", \"7\\n9 7 7 8 8 7 8\\n\", \"10\\n13 12 10 13 13 14 10 10 12 12\\n\", \"10\\n94 96 91 95 99 94 96 92 95 99\\n\", \"100\\n1 555 876 444 262 234 231 598 416 261 206 165 181 988 469 123 602 592 533 97 864 716 831 156 962 341 207 377 892 51 866 96 757 317 832 47... | One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part in the game. For each person we know in how many rounds he wants to be a player, not the supervisor: the i-th person wants to play a_{i} rounds. What is the minimum numb... | 0 |
{"tests": "{\"inputs\": [\"3\\n5\\nABCDE\\nEBCDA\\n0 10 20 30 40 50\\n4\\nCHEF\\nQUIZ\\n4 3 2 1 0\\n8\\nABBABAAB\\nABABABAB\\n100 100 100 100 100 100 100 100 100\", \"3\\n5\\nABCDE\\nEBCDA\\n0 8 20 30 40 50\\n4\\nCHEF\\nQUIZ\\n4 3 2 1 0\\n8\\nABBABAAB\\nABABABAB\\n100 100 100 100 100 100 100 100 100\", \"3\\n5\\nABCDE\... | Read problems statements in Mandarin Chinese and Russian
Chef is going to participate in a new quiz show: "Who dares to be a millionaire?"
According to the rules of the game, contestants must answer N questions. The quiz being famous for its difficulty, each question has 26 candidate answers, but only one of which ... | 0.125 |
{"tests": "{\"inputs\": [\"-[..[]+>>.>,]>.+]>.]>[.>+,>+\\n\", \".<>.+]>],>><\\n\", \"+,+><[>..,]-.[.++[>-<<-,-.>,.>]+,<,]]<[>,-+,.-[+,[.[<.-[].+>[,>-.>>]-[-][+,>>-,+<-,<.+-.+[.,\\n\", \"<.,+.><[,.+<[,.,<-,[>,\\n\", \"[-.].+<<]---+[+-+-[,[[[,]-<[-[[><>]\\n\", \",]+>.],,+->+>-[]][><,-]><]++<.,-[.>.<+.[.<,[-,,[<]+>]->>]>]... | Unary is a minimalistic Brainfuck dialect in which programs are written using only one token.
Brainfuck programs use 8 commands: "+", "-", "[", "]", "<", ">", "." and "," (their meaning is not important for the purposes of this problem). Unary programs are created from Brainfuck programs using the following algorithm... | 0 |
{"tests": "{\"inputs\": [\"3\\n2 3 1\\n\", \"4\\n2 1 1 1\\n\", \"5\\n2 4 2 5 3\\n\", \"4\\n2 1 4 3\\n\", \"7\\n2 3 4 1 6 5 4\\n\", \"20\\n2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1\\n\", \"2\\n2 1\\n\", \"84\\n2 50 67 79 71 45 43 40 57 20 25 8 60 47 52 10 37 23 1 28 22 26 3 42 11 63 61 68 49 32 55 18 5 24 31 70... | ZS the Coder and Chris the Baboon has explored Udayland for quite some time. They realize that it consists of n towns numbered from 1 to n.
There are n directed roads in the Udayland. i-th of them goes from town i to some other town a_{i} (a_{i} ≠ i). ZS the Coder can flip the direction of any road in Udayland, i.e. ... | 0.375 |
{"tests": "{\"inputs\": [\"5\\n2 2 1 2 1\\n\", \"2\\n2 2\\n\", \"1\\n5\\n\", \"5\\n2 2 1 2 2\\n\", \"5\\n2 2 1 5 1\\n\", \"1\\n1\\n\", \"1\\n1000000000\\n\", \"2\\n999635584 999595693\\n\", \"10\\n3 3 6 4 2 3 2 2 3 3\\n\", \"14\\n1 1 3 1 1 4 4 4 4 4 4 4 4 4\\n\", \"6\\n100 100 100 100 100 1\\n\", \"7\\n5 5 1 5 5 4 1\\n... | Bizon the Champion isn't just attentive, he also is very hardworking.
Bizon the Champion decided to paint his old fence his favorite color, orange. The fence is represented as n vertical planks, put in a row. Adjacent planks have no gap between them. The planks are numbered from the left to the right starting from one... | 0 |
{"tests": "{\"inputs\": [[\"SATORAREPOTENETOPERAROTAS\"], [\"NOTSQUARE\"], [\"BITICETEN\"], [\"CARDAREAREARDART\"], [\"CODEWARS\"], [\"AAAAACEEELLRRRTT\"], [\"AAACCEEEEHHHMMTT\"], [\"AAACCEEEEHHHMMTTXXX\"], [\"ABCD\"], [\"GHBEAEFGCIIDFHGG\"], [\"AAHHFDKIHHFCXZBFDERRRTXXAA\"], [\"AABBCCDDEEFFGGGG\"], [\"ABCABCABC\"], [\... | A [Word Square](https://en.wikipedia.org/wiki/Word_square) is a set of words written out in a square grid, such that the same words can be read both horizontally and vertically. The number of words, equal to the number of letters in each word, is known as the *order* of the square.
For example, this is an *order* `5` ... | 0.25 |
{"tests": "{\"inputs\": [[\"a\"], [\"aa\"], [\"baa\"], [\"aab\"], [\"baabcd\"], [\"racecars\"], [\"abcdefghba\"], [\"\"]], \"outputs\": [[true], [true], [true], [true], [false], [false], [false], [true]]}", "source": "taco"} | Write a function that will check whether the permutation of an input string is a palindrome. Bonus points for a solution that is efficient and/or that uses _only_ built-in language functions. Deem yourself **brilliant** if you can come up with a version that does not use _any_ function whatsoever.
# Example
`madam... | 0 |
{"tests": "{\"inputs\": [[2, \"+\", 4], [6, \"-\", 1.5], [-4, \"*\", 8], [49, \"/\", -7], [8, \"m\", 2], [4, \"/\", 0], [3.2, \"+\", 8], [3.2, \"-\", 8], [3.2, \"/\", 8], [3.2, \"*\", 8], [-3, \"+\", 0], [-3, \"-\", 0], [-3, \"/\", 0], [-2, \"/\", -2], [-2, \"codewars\", -2], [-3, \"*\", 0], [0, \"*\", 0], [0, \"**\", ... | **Debug** a function called calculate that takes 3 values. The first and third values are numbers. The second value is a character. If the character is "+" , "-", "\*", or "/", the function will return the result of the corresponding mathematical function on the two numbers. If the string is not one of the specified ch... | 0 |
{"tests": "{\"inputs\": [\"3 14\\n8 9\\n10 7\\n\", \"12 11\\n11 12\\n16 7\\n\", \"12 17\\n10 19\\n13 16\\n\", \"9 12\\n3 17\\n10 10\\n\", \"10 7\\n4 13\\n11 6\\n\", \"7 9\\n4 12\\n5 11\\n\", \"2 4\\n1 5\\n3 3\\n\", \"13 8\\n15 6\\n11 10\\n\", \"8 10\\n9 9\\n13 5\\n\", \"12 7\\n5 14\\n8 11\\n\", \"9 6\\n5 10\\n3 12\\n\"... | Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha... | 0.625 |
{"tests": "{\"inputs\": [\"-2 1 -1 1 1 1 1 2\\n1 0 2 1 2 2 0 3\\n5\", \"-4 1 -1 1 1 1 1 2\\n1 0 2 1 2 2 3 3\\n5\", \"-2 1 -2 1 1 1 1 2\\n1 0 2 1 2 2 0 3\\n5\", \"-4 1 -1 1 1 1 1 2\\n1 0 1 1 2 2 3 3\\n5\", \"-2 1 -2 1 1 0 1 2\\n1 0 2 1 2 2 0 3\\n5\", \"-2 1 -2 1 1 0 1 3\\n1 0 2 1 2 2 0 3\\n5\", \"0 1 -2 1 1 0 1 3\\n1 0 ... | You have to organize a wedding party. The program of the party will include a concentration game played by the bride and groom. The arrangement of the concentration game should be easy since this game will be played to make the party fun.
We have a 4x4 board and 8 pairs of cards (denoted by `A' to `H') for the concent... | 0 |
{"tests": "{\"inputs\": [\"7\\n8 13 19 21 25 30 32\\n3\\n5 4\\n6 5\\n1 2\\n\", \"3\\n1 6 8\\n5\\n3 4\\n3 9\\n3 3\\n1 2\\n1 6\\n\", \"2\\n1 6\\n5\\n2 6\\n1 2\\n1 1\\n1 2\\n1 7\\n\", \"1\\n9\\n8\\n1 4\\n1 10\\n1 9\\n1 9\\n1 7\\n1 1\\n1 9\\n1 2\\n\", \"1\\n1\\n1\\n1 1\\n\", \"5\\n1 2 3 6 6\\n25\\n1 1000000000\\n1 10000000... | Dima's got a staircase that consists of n stairs. The first stair is at height a1, the second one is at a2, the last one is at an (1 ≤ a1 ≤ a2 ≤ ... ≤ an).
Dima decided to play with the staircase, so he is throwing rectangular boxes at the staircase from above. The i-th box has width wi and height hi. Dima throws eac... | 0.125 |
{"tests": "{\"inputs\": [[\"Apple Banana\"], [\"Apple\"], [\"\"], [\"of\"], [\"Revelation of the contents outraged American public opinion, and helped generate\"], [\"more than one space between words\"], [\" leading spaces\"], [\"trailing spaces \"], [\"ALL CAPS CRAZINESS\"], [\"rAnDoM CaPs CrAzInEsS\"]], \"out... | DropCaps means that the first letter of the starting word of the paragraph should be in caps and the remaining lowercase, just like you see in the newspaper.
But for a change, let's do that for each and every word of the given String. Your task is to capitalize every word that has length greater than 2, leaving small... | 0.5 |
{"tests": "{\"inputs\": [[\"3\", \"2\", \"< 100 No\", \"> 100 No\", \"3\", \"< 2 Yes\", \"> 4 Yes\", \"= 3 No\", \"6\", \"< 2 Yes\", \"> 1 Yes\", \"= 1 Yes\", \"= 1 Yes\", \"> 1 Yes\", \"= 1 Yes\"], \"3\\n2\\n< 100 No\\n> 100 No\\n3\\n< 2 Yes\\n> 4 Yes\\n= 3 No\\n6\\n< 2 Yes\\n> 1 Yes\\n= 1 Yes\\n= 1 Yes\\n= 1 Yes\\n= ... | Alice and Johnny are playing a simple guessing game. Johnny picks an arbitrary positive integer n (1<=n<=109) and gives Alice exactly k hints about the value of n. It is Alice's task to guess n, based on the received hints.
Alice often has a serious problem guessing the value of n, and she's beginning to suspect that... | 0.25 |
{"tests": "{\"inputs\": [\"2 1 2 1\\n1 2 1 1\\n\", \"100 5 8 80\\n25 8 2 70\\n27 6 7 30\\n26 1 6 5\\n7 1 1 86\\n18 8 4 54\\n\", \"1000 3 67 88\\n90 86 66 17\\n97 38 63 17\\n55 78 39 51\\n\", \"1000 10 1 87\\n100 1 1 38\\n100 1 1 45\\n100 1 1 73\\n100 1 1 89\\n100 1 1 38\\n100 1 1 13\\n100 1 1 93\\n100 1 1 89\\n100 1 1 ... | Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has n grams of dough as well as m different stuffing types. The stuffing types are numerated from 1 to m. Lavrenty knows that he has ai grams left of the i-th stuffing. It takes exactly bi grams of stuffing i and ci grams of dough ... | 0.25 |
{"tests": "{\"inputs\": [\"2 1\\n2 1\\n2\\n\", \"2 1\\n2 1\\n10\\n\", \"1 1\\n1\\n2\\n\", \"3 96\\n83 22 17\\n19\\n\", \"8 4\\n27 72 39 70 13 68 100 36\\n95\\n\", \"2 65\\n23 34\\n74\\n\", \"2 48\\n12 54\\n69\\n\", \"5 30\\n63 58 38 60 24\\n42\\n\", \"9 47\\n17 36 91 43 89 7 41 43 65\\n49\\n\", \"6 49\\n91 30 71 51 7 2... | Sereja owns a restaurant for n people. The restaurant hall has a coat rack with n hooks. Each restaurant visitor can use a hook to hang his clothes on it. Using the i-th hook costs a_{i} rubles. Only one person can hang clothes on one hook.
Tonight Sereja expects m guests in the restaurant. Naturally, each guest wants... | 0.625 |
{"tests": "{\"inputs\": [\"2\\n4\\n9\\n\", \"10\\n4906361343\\n8985777485\\n1204265609\\n7088384855\\n4127287014\\n7904807820\\n3032139021\\n5999959109\\n6477458281\\n3244359368\\n\", \"10\\n15424\\n10953\\n19176\\n15514\\n16284\\n18680\\n19305\\n13816\\n16168\\n15924\\n\", \"5\\n4491183345\\n4491184811\\n4491162340\\n... | Polycarpus has n friends in Tarasov city. Polycarpus knows phone numbers of all his friends: they are strings s1, s2, ..., sn. All these strings consist only of digits and have the same length.
Once Polycarpus needed to figure out Tarasov city phone code. He assumed that the phone code of the city is the longest comm... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.