info stringlengths 120 50k | question stringlengths 504 10.4k | avg@8_qwen3_4b_instruct_2507 float64 0 0.88 |
|---|---|---|
{"tests": "{\"inputs\": [\"3\\nA sample input\\n9\\nforward word\\ndelete char\\nforward word\\ndelete char\\nforward word\\ndelete char\\nbackward word\\nbackward word\\nforward word\\nHallow, Word.\\n7\\nforward char\\ndelete word\\ninsert \\\"ello, \\\"\\nforward word\\nbackward char\\nbackward char\\ninsert \\\"l\\... | A text editor is a useful software tool that can help people in various situations including writing and programming. Your job in this problem is to construct an offline text editor, i.e., to write a program that first reads a given text and a sequence of editing commands and finally reports the text obtained by perfor... | 0 |
{"tests": "{\"inputs\": [\"25\\n\", \"_00\\n\", \"_XX\\n\", \"0\\n\", \"0_25\\n\", \"5\\n\", \"_\\n\", \"X\\n\", \"__\\n\", \"_X\\n\", \"_5\\n\", \"X5\\n\", \"XX\\n\", \"___X_X25\\n\", \"_X8__725\\n\", \"85X1X525\\n\", \"79XX_925\\n\", \"_7XX16X_\\n\", \"1_07XXX_\\n\", \"X2XXX9X_\\n\", \"XX9_X_X_\\n\", \"2___2__X\\n\",... | Mr. Chanek has an integer represented by a string $s$. Zero or more digits have been erased and are denoted by the character _. There are also zero or more digits marked by the character X, meaning they're the same digit.
Mr. Chanek wants to count the number of possible integer $s$, where $s$ is divisible by $25$. Of ... | 0.125 |
{"tests": "{\"inputs\": [\"2\\n1\\n1 2\\n2\\n1 2 1\", \"2\\n1\\n1 2\\n2\\n2 2 1\", \"2\\n1\\n1 2\\n2\\n2 2 0\", \"2\\n1\\n1 0\\n2\\n2 2 0\", \"2\\n1\\n1 0\\n2\\n3 2 0\", \"2\\n1\\n1 0\\n2\\n3 2 -1\", \"2\\n1\\n1 0\\n2\\n3 4 -1\", \"2\\n1\\n1 2\\n2\\n1 2 2\", \"2\\n1\\n1 2\\n2\\n2 3 1\", \"2\\n1\\n1 2\\n2\\n2 1 0\", \"2... | Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.
Princess Rupsa saw one of her friends playing a special game. The game goes as follows:
N+1 numbers occur sequentially (one at a time) from A_{0} to A_{N}.
You must write the numbers on a sheet of paper, such that A_{0} is written first. T... | 0 |
{"tests": "{\"inputs\": [\"6\\n2\\n8 12 8 12\\n2\\n7 7 9 11\\n2\\n7 11 7 11\\n1\\n1 1\\n4\\n40 56 48 40 80 56 80 48\\n6\\n240 154 210 162 174 154 186 240 174 186 162 210\\n\", \"1\\n2\\n8 12 12 12\\n\", \"1\\n2\\n8 12 12 12\\n\", \"1\\n2\\n10 12 12 12\\n\", \"6\\n2\\n3 12 8 12\\n2\\n7 7 9 11\\n2\\n7 11 7 11\\n1\\n1 1\\... | Long time ago there was a symmetric array $a_1,a_2,\ldots,a_{2n}$ consisting of $2n$ distinct integers. Array $a_1,a_2,\ldots,a_{2n}$ is called symmetric if for each integer $1 \le i \le 2n$, there exists an integer $1 \le j \le 2n$ such that $a_i = -a_j$.
For each integer $1 \le i \le 2n$, Nezzar wrote down an intege... | 0 |
{"tests": "{\"inputs\": [[[1, 2], [3, 4]], [[1, 3, 2], [5, 2, 1, 4], [2, 1]], [[4, 3, 2, 2]], [[4, \"a\", 2], []], [[], [4, \"a\", 2]], [[], [4, \"a\", 2], []], [[]], [[], []], [[], [1, 2]], [[], [1, 2, 1, 2], [2, 1, 1, 2, 1]]], \"outputs\": [[[1, 2, 3, 4]], [[1, 3, 2, 5, 4]], [[4, 3, 2]], [[4, \"a\", 2]], [[4, \"a\", ... | Write a function that takes one or more arrays and returns a new array of unique values in the order of the original provided arrays.
In other words, all values present from all arrays should be included in their original order, but with no duplicates in the final array.
The unique numbers should be sorted by their o... | 0 |
{"tests": "{\"inputs\": [\"7\\n100 3 4\\n189 3 4\\n64 2 3\\n63 2 3\\n30 27 7\\n10 9 1\\n69117 21 2\\n\", \"5\\n1 30 0\\n1 0 0\\n100000 30 30\\n10 1 1\\n8 30 1\\n\", \"1\\n1 0 0\\n\", \"1\\n21 1 2\\n\", \"1\\n1 0 0\\n\", \"5\\n1 30 0\\n1 0 0\\n100000 30 30\\n10 1 1\\n8 30 1\\n\", \"1\\n21 1 2\\n\", \"1\\n1 0 1\\n\", \"5... | Kana was just an ordinary high school girl before a talent scout discovered her. Then, she became an idol. But different from the stereotype, she is also a gameholic.
One day Kana gets interested in a new adventure game called Dragon Quest. In this game, her quest is to beat a dragon.[Image]
The dragon has a hit po... | 0 |
{"tests": "{\"inputs\": [[[[15, 18], [4, 5], [12, 60]]], [[[1, 1], [0, 0], [13, 91]]], [[[15, 7], [4, 5], [19, 60]]], [[[20, 50], [10, 10], [50, 20]]], [[]]], \"outputs\": [[840], [1092], [0], [1890], [0]]}", "source": "primeintellect"} | In this kata you need to create a function that takes a 2D array/list of non-negative integer pairs and returns the sum of all the "saving" that you can have getting the [LCM](https://en.wikipedia.org/wiki/Least_common_multiple) of each couple of number compared to their simple product.
For example, if you are given:
... | 0 |
{"tests": "{\"inputs\": [\"???(?)??(??)?)(?(?????????(?()????)(????(?)????)???)??))(?(?????????))???(??)?????))???????(????????\\n9 10\\n6 3\\n8 2\\n9 10\\n9 3\\n6 2\\n8 5\\n6 7\\n2 6\\n7 8\\n6 10\\n1 7\\n1 7\\n10 7\\n10 7\\n8 4\\n5 9\\n9 3\\n3 10\\n1 10\\n8 2\\n8 8\\n4 8\\n6 6\\n4 10\\n4 5\\n5 2\\n5 6\\n7 7\\n7 3\\n10... | This is yet another problem on regular bracket sequences.
A bracket sequence is called regular, if by inserting "+" and "1" into it we get a correct mathematical expression. For example, sequences "(())()", "()" and "(()(()))" are regular, while ")(", "(()" and "(()))(" are not. You have a pattern of a bracket sequenc... | 0 |
{"tests": "{\"inputs\": [[100, 3], [200, 4], [300, 5], [500, 7], [717, 7], [1611, 3]], \"outputs\": [[162], [260], [846], [717], [861], [1989]]}", "source": "primeintellect"} | If we multiply the integer `717 (n)` by `7 (k)`, the result will be equal to `5019`.
Consider all the possible ways that this last number may be split as a string and calculate their corresponding sum obtained by adding the substrings as integers. When we add all of them up,... surprise, we got the original numbe... | 0 |
{"tests": "{\"inputs\": [\"5 5 5\\nRRGGB\\nRRGGY\\nYYBBG\\nYYBBR\\nRBBRG\\n1 1 5 5\\n2 2 5 5\\n2 2 3 3\\n1 1 3 5\\n4 4 5 5\\n\", \"6 10 5\\nRRRGGGRRGG\\nRRRGGGRRGG\\nRRRGGGYYBB\\nYYYBBBYYBB\\nYYYBBBRGRG\\nYYYBBBYBYB\\n1 1 6 10\\n1 3 3 10\\n2 2 6 6\\n1 7 6 10\\n2 1 5 10\\n\", \"8 8 8\\nRRRRGGGG\\nRRRRGGGG\\nRRRRGGGG\\nR... | Warawreh created a great company called Nanosoft. The only thing that Warawreh still has to do is to place a large picture containing its logo on top of the company's building.
The logo of Nanosoft can be described as four squares of the same size merged together into one large square. The top left square is colored w... | 0 |
{"tests": "{\"inputs\": [\"5856 500 2000\", \"4000 2000 312\", \"1000000000000000000 2 0\", \"1100000000000000000 2 0\", \"5856 883 583\", \"1100000000000000000 4 0\", \"6439 2000 572\", \"1100000000100000000 4 0\", \"6439 987 572\", \"1101000000100000000 4 0\", \"6439 1177 572\", \"1101000010100000000 4 0\", \"6439 22... | ButCoder Inc. runs a programming competition site called ButCoder. In this site, a user is given an integer value called rating that represents his/her skill, which changes each time he/she participates in a contest. The initial value of a new user's rating is 0, and a user whose rating reaches K or higher is called Ka... | 0.125 |
{"tests": "{\"inputs\": [\"5\\n7\\n1 2\\n1 3\\n1 4\\n2 5\\n2 6\\n4 7\\n6\\n1 2\\n1 3\\n2 4\\n2 5\\n3 6\\n2\\n1 2\\n7\\n7 3\\n1 5\\n1 3\\n4 6\\n4 7\\n2 1\\n6\\n2 1\\n2 3\\n4 5\\n3 4\\n3 6\\n\", \"5\\n7\\n1 2\\n1 3\\n1 4\\n2 5\\n2 6\\n4 7\\n6\\n1 2\\n1 3\\n2 4\\n2 5\\n3 6\\n2\\n1 2\\n7\\n6 3\\n1 5\\n1 3\\n4 6\\n4 7\\n2 1... | A tree is a connected graph without cycles. A rooted tree has a special vertex called the root. The parent of a vertex $v$ (different from root) is the previous to $v$ vertex on the shortest path from the root to the vertex $v$. Children of the vertex $v$ are all vertices for which $v$ is the parent.
A vertex is a lea... | 0 |
{"tests": "{\"inputs\": [[[\"hello\", \"world\"]], [[\"Quick\", \"brown\", \"fox\", \"jumped\", \"over\", \"the\", \"lazy\", \"dog\"]], [[\"hello\", \",\", \"my\", \"dear\"]], [[\"one\", \",\", \"two\", \",\", \"three\"]], [[\"One\", \",\", \"two\", \"two\", \",\", \"three\", \"three\", \"three\", \",\", \"4\", \"4\", ... | Implement a function, so it will produce a sentence out of the given parts.
Array of parts could contain:
- words;
- commas in the middle;
- multiple periods at the end.
Sentence making rules:
- there must always be a space between words;
- there must not be a space between a comma and word on the left;
- there must ... | 0 |
{"tests": "{\"inputs\": [\"3\\n1 2\\n1 3\\n2 3\\n1\\n1 2\", \"3\\n1 2\\n1 3\\n3 3\\n1\\n1 2\", \"3\\n2 2\\n1 3\\n2 1\\n2\\n2 3\", \"3\\n1 2\\n1 3\\n2 3\\n2\\n2 3\", \"3\\n2 2\\n1 3\\n3 3\\n1\\n1 2\", \"3\\n2 2\\n1 3\\n3 3\\n1\\n1 4\", \"3\\n2 2\\n1 3\\n2 3\\n1\\n1 4\", \"3\\n1 2\\n1 1\\n2 3\\n1\\n1 3\", \"3\\n2 2\\n1 3... | C: Namo .. Cut
problem
-Defeat the mysterious giant jellyfish, codenamed "Nari"-
"Nari" has a very strong vitality, so if you don't keep cutting quickly, it will be revived in a blink of an eye. We are making trial and error every day to find out how to cut "Nari" efficiently. In the process, you needed the help of ... | 0 |
{"tests": "{\"inputs\": [\"28 5 4 26\\n\", \"4 3 3 4\\n\", \"14 8 2 12\\n\", \"7 3 2 6\\n\", \"79 8 41 64\\n\", \"63 11 23 48\\n\", \"51474721 867363452 12231088 43489285\\n\", \"7 3 1 3\\n\", \"8 3 6 6\\n\", \"9 2 4 7\\n\", \"7 3 5 7\\n\", \"149 49 92 129\\n\", \"192293793 2864 5278163 190776899\\n\", \"7 3 1 7\\n\", ... | Throughout Igor K.'s life he has had many situations worthy of attention. We remember the story with the virus, the story of his mathematical career and of course, his famous programming achievements. However, one does not always adopt new hobbies, one can quit something as well.
This time Igor K. got disappointed in ... | 0 |
{"tests": "{\"inputs\": [\"2\\n)\\n(()\\n\", \"2\\n)(\\n()\\n\", \"4\\n((()))\\n((((((\\n))))))\\n()()()\\n\", \"3\\n(((\\n)\\n)\\n\", \"3\\n()(\\n)\\n)\", \"2\\n)\\n()(\", \"4\\n((()))\\n((((()\\n))))))\\n()()()\", \"2\\n)(\\n)(\", \"3\\n()(\\n)\\n(\", \"2\\n((\\n)(\", \"3\\n())\\n)\\n(\", \"2\\n((\\n()\", \"3\\n(((\\... | A bracket sequence is a string that is one of the following:
- An empty string;
- The concatenation of (, A, and ) in this order, for some bracket sequence A ;
- The concatenation of A and B in this order, for some non-empty bracket sequences A and B /
Given are N strings S_i. Can a bracket sequence be formed by con... | 0.125 |
{"tests": "{\"inputs\": [[2, 0, 0], [3, 1, 2], [0, 3, 2], [13, 0, 0], [6, 2, 4], [6, 1, 3], [5, 3, 4]], \"outputs\": [[13], [14.5], [19], [39.5], [26], [19], [29]]}", "source": "primeintellect"} | The pizza store wants to know how long each order will take. They know:
- Prepping a pizza takes 3 mins
- Cook a pizza takes 10 mins
- Every salad takes 3 mins to make
- Every appetizer takes 5 mins to make
- There are 2 pizza ovens
- 5 pizzas can fit in a oven
- Prepping for a pizza must be done before it can be put ... | 0 |
{"tests": "{\"inputs\": [[\"4x+1\"], [\"-4x-1\"], [\"x^2+2x+1\"], [\"0\"], [\"-100\"], [\"-x^2+3x+4\"], [\"-x^5-x^4-x^3\"], [\"10x^9+10x^3+10x\"], [\"100x^5+12x^3-3x-3\"], [\"-1000x^7+200x^4+6x^2+x+1000\"]], \"outputs\": [[\"4\"], [\"-4\"], [\"2x+2\"], [\"0\"], [\"0\"], [\"-2x+3\"], [\"-5x^4-4x^3-3x^2\"], [\"90x^8+30x^... | Complete the function that calculates the derivative of a polynomial. A polynomial is an expression like: 3x^(4) - 2x^(2) + x - 10
### How to calculate the derivative:
* Take the exponent and multiply it with the coefficient
* Reduce the exponent by 1
For example: 3x^(4) --> (4*3)x^((4-1)) = 12x^(3)
### Good to kno... | 0 |
{"tests": "{\"inputs\": [\"110011\", \"11101111011111000000000110000001111100011111000000001101111110000000111111111\", \"0000\", \"110010\", \"11101111011101000000000110000001111100011111000000001101111110000000111111111\", \"0010\", \"110000\", \"11101111011100000000000110000001111100011111000000001101111110000000111... | Given is a string S consisting of `0` and `1`. Find the number of strings, modulo 998244353, that can result from applying the following operation on S zero or more times:
* Remove the two characters at the beginning of S, erase one of them, and reinsert the other somewhere in S. This operation can be applied only whe... | 0 |
{"tests": "{\"inputs\": [[1500, 5, 100, 5000], [1500000, 2.5, 10000, 2000000], [1500000, 0.25, 1000, 2000000], [1500000, 0.25, -1000, 2000000], [1500000, 0.25, 1, 2000000], [1500000, 0.0, 10000, 2000000]], \"outputs\": [[15], [10], [94], [151], [116], [50]]}", "source": "primeintellect"} | In a small town the population is `p0 = 1000` at the beginning of a year. The population
regularly increases by `2 percent` per year and moreover `50` new inhabitants per year
come to live in the town.
How many years does the town need to see its population
greater or equal to `p = 1200` inhabitants?
```
At the end o... | 0 |
{"tests": "{\"inputs\": [\"6 1\\n10\\n6 4 3 3 1 2 0 5 4 6 1 8 5 9 7 7 8 6 8 3\\n6 1\\n10\\n6 4 3 3 1 2 0 5 4 6 1 8 5 7 7 7 8 6 9 0\\n0 0\", \"6 1\\n10\\n6 4 3 3 1 2 0 5 4 6 1 8 5 9 7 7 8 6 3 3\\n6 1\\n10\\n6 4 3 3 1 2 0 5 4 6 1 8 5 7 7 7 8 6 9 0\\n0 0\", \"6 1\\n10\\n6 4 3 3 1 2 0 5 4 6 1 8 5 9 7 7 8 6 3 3\\n6 1\\n10\\... | The University of Aizu has a park covered with grass, and there are no trees or buildings that block the sunlight. On sunny summer days, sprinklers installed in the park operate to sprinkle water on the lawn. The frog Pyonkichi lives in this park. Pyonkichi is not good at hot weather, and on summer days when the sun is... | 0 |
{"tests": "{\"inputs\": [[5], [1], [[]], [11], [\"treasure\"], [\"5\"], [-1], [3], [2], [0.5]], \"outputs\": [[\"X X\\n X X\\n X\\n X X\\nX X\\n\"], [\"X\\n\"], [\"?\"], [\"X X\\n X X\\n X X\\n X X\\n X X\\n X\\n X ... | You've made it through the moat and up the steps of knowledge. You've won the temples games and now you're hunting for treasure in the final temple run. There's good news and bad news. You've found the treasure but you've triggered a nasty trap. You'll surely perish in the temple chamber.
With your last movements, you... | 0 |
{"tests": "{\"inputs\": [\"10 3 5\\n10 3 3\\n30\\n1\\n6\\n10\", \"10 3 1\\n10 3 3\\n30\\n1\\n6\\n10\", \"10 3 5\\n10 3 3\\n32\\n1\\n6\\n10\", \"10 3 1\\n10 3 3\\n30\\n1\\n8\\n10\", \"10 3 1\\n10 3 0\\n51\\n0\\n6\\n10\", \"10 3 5\\n10 3 6\\n32\\n2\\n6\\n10\", \"10 3 10\\n10 3 6\\n8\\n2\\n6\\n10\", \"10 3 10\\n10 3 3\\n8... | The JOI Railways is the only railway company in the Kingdom of JOI. There are $N$ stations numbered from $1$ to $N$ along a railway. Currently, two kinds of trains are operated; one is express and the other one is local.
A local train stops at every station. For each $i$ ($1 \leq i < N$), by a local train, it takes $A... | 0 |
{"tests": "{\"inputs\": [\"8\\nabababacababa\\naba\\nddddddd\\ndddd\\nxyzxyz\\nxyz\\nabc\\nabcd\\nabacaba\\nabaca\\nabc\\ndef\\naaaaaaaa\\na\\naaaaaaaa\\naa\\n\", \"1\\nabababacabababababababacababababacacababababababababacababababababacabacabababababababacabababababababababacabababacabababababababacababababababacabaca... | You are given two non-empty strings $s$ and $t$, consisting of Latin letters.
In one move, you can choose an occurrence of the string $t$ in the string $s$ and replace it with dots.
Your task is to remove all occurrences of the string $t$ in the string $s$ in the minimum number of moves, and also calculate how many d... | 0 |
{"tests": "{\"inputs\": [\"-744\\n672*a++-975*a++-394*a+++968*a+++222*a+++988*++a+504*++a-782*a++-321*++a+980*++a-483*a++-554*++a-347*++a-180*++a-390*a+++403*a++-617*a+++378*a+++544*++a-978*a+++952*a++-618*a++-516*++a-990*++a+540*++a-398*++a-187*++a+401*++a+829*a++-187*++a-185*a++-529*a++\\n\", \"1000\\n++a\\n\", \"7\\... | C*++ language is quite similar to C++. The similarity manifests itself in the fact that the programs written in C*++ sometimes behave unpredictably and lead to absolutely unexpected effects. For example, let's imagine an arithmetic expression in C*++ that looks like this (expression is the main term):
* expression :... | 0 |
{"tests": "{\"inputs\": [\"5\\n1 2 3 1 5\", \"4\\n2 0 4 6\", \"5\\n1 2 3 0 5\", \"4\\n1 0 4 6\", \"5\\n1 2 4 0 5\", \"4\\n1 0 2 6\", \"5\\n1 2 6 0 5\", \"4\\n1 0 2 2\", \"5\\n1 4 6 0 5\", \"4\\n2 0 2 2\", \"4\\n2 0 3 2\", \"4\\n2 0 6 2\", \"5\\n1 4 3 4 5\", \"4\\n2 3 4 1\", \"5\\n2 2 3 1 5\", \"4\\n2 0 3 6\", \"5\\n1 7... | There are N integers written on a blackboard. The i-th integer is A_i.
Takahashi and Aoki will arrange these integers in a row, as follows:
* First, Takahashi will arrange the integers as he wishes.
* Then, Aoki will repeatedly swap two adjacent integers that are coprime, as many times as he wishes.
We will assume... | 0 |
{"tests": "{\"inputs\": [[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 1], [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 2], [[\"C\", \"o\", \"d\", \"e\", \"W\", \"a\", \"r\", \"s\"], 4], [[\"C\", 0, \"d\", 3, \"W\", 4, \"r\", 5], 4], [[1, 2, 3, 4, 5, 6, 7], 3], [[], 3], [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,... | This problem takes its name by arguably the most important event in the life of the ancient historian Josephus: according to his tale, he and his 40 soldiers were trapped in a cave by the Romans during a siege.
Refusing to surrender to the enemy, they instead opted for mass suicide, with a twist: **they formed a circl... | 0 |
{"tests": "{\"inputs\": [\"4\\n4\\nabcd\\nabdc\\n5\\nababa\\nbaaba\\n4\\nasdf\\nasdg\\n4\\nabcd\\nbadc\\n\", \"4\\n4\\nabcd\\nabdc\\n5\\nababa\\nbaaba\\n4\\nasdf\\nasdg\\n4\\nabdd\\nbadc\\n\", \"4\\n4\\nabcd\\nabdc\\n5\\nababa\\nabaab\\n4\\nasdf\\nasdg\\n4\\nabcd\\nbadc\\n\", \"4\\n4\\nabcd\\nabdc\\n5\\naaabc\\nbabaa\\... | You are given two strings $s$ and $t$ both of length $n$ and both consisting of lowercase Latin letters.
In one move, you can choose any length $len$ from $1$ to $n$ and perform the following operation: Choose any contiguous substring of the string $s$ of length $len$ and reverse it; at the same time choose any con... | 0 |
{"tests": "{\"inputs\": [\"9\\n5 10 4\\n4 5 20\\n2 2 3\\n1 100000007 100000008\\n1 100000007 100000009\\n1 100000007 100000008\\n1 1000000000 1000000000\\n1 1000000000 999999999\\n3 4 12\\n\", \"3\\n1 999999999 1000000000\\n1 1000000000 1000000000\\n1 1000000000 999999999\\n\", \"1\\n1 1000000000 999999999\\n\", \"1\\n... | There are two rival donut shops.
The first shop sells donuts at retail: each donut costs a dollars.
The second shop sells donuts only in bulk: box of b donuts costs c dollars. So if you want to buy x donuts from this shop, then you have to buy the smallest number of boxes such that the total number of donuts in them ... | 0 |
{"tests": "{\"inputs\": [\"33340691714056185860211260984431382156326935244157\\n\", \"446490140549710812136081378174660462546524926277418604782585582063971131982328238598703638210071884764059516110693472996891702400239790481987117450115427742681790553110130540730751761227556434833802489996576492114599977662210723991035... | Let S(n) denote the number that represents the digits of n in sorted order. For example, S(1) = 1, S(5) = 5, S(50394) = 3459, S(353535) = 333555.
Given a number X, compute <image> modulo 109 + 7.
Input
The first line of input will contain the integer X (1 ≤ X ≤ 10700).
Output
Print a single integer, the answer to ... | 0 |
{"tests": "{\"inputs\": [[103115104105123101118119981001098], [103115104105123101118119981001098103115104105123101118119981001098103115104105123101118119981001098], [1091011161151121151071091261051061151181081151231191201211161091041201081091191111011201011091199810010981051221051141201081151211071081091201191021181091... | ## Welcome to my (amazing) kata!
You are given a gigantic number to decode. Each number is a code that alternates in a pattern between encoded text and a smaller, encoded number. The pattern's length varies with every test, but the alternation between encoded text and an encoded number will always be there. Followi... | 0 |
{"tests": "{\"inputs\": [\"fabbbhgedd\\n\", \"abbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaab\\n\", \"hcdhgcchbdhbeagdcfedgcbaffebgcbcccadeefacbhefgeadfgchabgeebegahfgegahbddedfhffeadcedadgfbeebhgfahhfb\\n\", \"khjcoijiicdkdianmdolmadobdkcmgifdnffddnjehhbldlkjffknficdcmokfaci... | Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i. e. creates a new string ... | 0 |
{"tests": "{\"inputs\": [\"1\\n0 z\\n1\\n1\\n\", \"10\\n0 i\\n1 q\\n2 g\\n0 k\\n1 e\\n5 r\\n4 m\\n5 h\\n3 o\\n3 e\\n5\\n8 9 1 10 6\\n\", \"10\\n0 i\\n1 q\\n2 g\\n0 k\\n1 e\\n5 r\\n4 m\\n4 g\\n3 o\\n3 e\\n5\\n8 9 1 10 6\\n\", \"10\\n0 i\\n1 q\\n2 g\\n1 k\\n1 e\\n5 r\\n4 m\\n4 g\\n3 o\\n3 e\\n5\\n8 9 1 10 6\\n\", \"10\\n... | You are given a set of strings S. Each string consists of lowercase Latin letters.
For each string in this set, you want to calculate the minimum number of seconds required to type this string. To type a string, you have to start with an empty string and transform it into the string you want to type using the followin... | 0 |
{"tests": "{\"inputs\": [\"2 1 1\\n1 2 no\\n2 1 no\\n3 2 1\\n1 1 sey\\n2 2 yes\\n3 3 yes\\n2 2 1\\n1 2 yes\\n2 3 no\\n5 4 3\\n1 2 yes\\n1 3 no\\n4 5 yes\\n5 6 yes\\n6 7 no\\n0 0 0\", \"2 1 1\\n1 2 no\\n2 1 no\\n3 2 1\\n1 1 yes\\n2 2 yes\\n3 1 yes\\n2 2 1\\n1 2 yes\\n2 3 no\\n5 4 3\\n1 2 yes\\n1 3 no\\n4 5 yes\\n5 6 yes... | After having drifted about in a small boat for a couple of days, Akira Crusoe Maeda was finally cast ashore on a foggy island. Though he was exhausted and despaired, he was still fortunate to remember a legend of the foggy island, which he had heard from patriarchs in his childhood. This must be the island in the legen... | 0.25 |
{"tests": "{\"inputs\": [\"3 2\\n1\\n3\\n11\", \"3 2\\n0\\n3\\n11\", \"3 3\\n1\\n3\\n14\", \"3 2\\n0\\n4\\n11\", \"2 2\\n0\\n3\\n20\", \"3 2\\n1\\n6\\n16\", \"3 2\\n0\\n4\\n1\", \"3 1\\n0\\n3\\n11\", \"3 2\\n-2\\n4\\n11\", \"3 2\\n0\\n6\\n1\", \"3 1\\n1\\n6\\n18\", \"3 1\\n-1\\n4\\n11\", \"2 1\\n1\\n0\\n20\", \"3 2\\n1... | JOI has a stove in your room. JOI himself is resistant to the cold, so he doesn't need to put on the stove when he is alone in the room, but he needs to put on the stove when there are visitors.
On this day, there are N guests under JOI. The ith (1 \ leq i \ leq N) visitor arrives at time T_i and leaves at time T_i + ... | 0 |
{"tests": "{\"inputs\": [\"1\\n4\\n\", \"1\\n87\\n\", \"3\\n1 2 1\\n\", \"9\\n72 49 39 50 68 35 75 94 56\\n\", \"2\\n93 51\\n\", \"2\\n3 1\\n\", \"8\\n77 84 26 34 17 56 76 3\\n\", \"5\\n2 6 2 1 2\\n\", \"10\\n4 2 2 4 1 2 2 4 2 1\\n\", \"7\\n2 1 2 2 2 2 2\\n\", \"6\\n1 7 3 1 6 2\\n\", \"6\\n46 30 38 9 65 23\\n\", \"9\\n... | Artem has an array of n positive integers. Artem decided to play with it. The game consists of n moves. Each move goes like this. Artem chooses some element of the array and removes it. For that, he gets min(a, b) points, where a and b are numbers that were adjacent with the removed number. If the number doesn't have a... | 0 |
{"tests": "{\"inputs\": [\"3 6 1\\n3 2\", \"100001 100000 0\", \"10 10 14\\n4 3\\n2 2\\n7 3\\n9 10\\n7 9\\n8 1\\n10 10\\n5 4\\n3 4\\n2 8\\n6 4\\n4 4\\n5 8\\n9 2\", \"100101 100000 0\", \"10 10 14\\n4 3\\n2 1\\n7 3\\n9 10\\n7 9\\n8 1\\n10 10\\n5 4\\n3 4\\n2 8\\n6 4\\n4 4\\n5 8\\n9 2\", \"110101 100000 0\", \"110111 1000... | Takahashi and Aoki will play a game using a grid with H rows and W columns of square cells. There are N obstacles on this grid; the i-th obstacle is at (X_i,Y_i). Here, we represent the cell at the i-th row and j-th column (1 \leq i \leq H, 1 \leq j \leq W) by (i,j). There is no obstacle at (1,1), and there is a piece ... | 0 |
{"tests": "{\"inputs\": [\"30 36 36 32 34 38\\n\", \"125 7 128 8 124 11\\n\", \"7 1 7 3 5 3\\n\", \"4 60 4 60 4 60\\n\", \"50 40 46 38 52 34\\n\", \"1 1000 1 1 1000 1\\n\", \"718 466 729 470 714 481\\n\", \"66 6 65 6 66 5\\n\", \"1 6 1 5 2 5\\n\", \"7 5 4 8 4 5\\n\", \"677 303 685 288 692 296\\n\", \"2 4 5 3 3 6\\n\", ... | Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to <image>. Then he measured the length of its sides, and found that each of them is equal to an integer number of centimeters. There the properties of the hexagon ended and Gerald decided to draw on it.
... | 0 |
{"tests": "{\"inputs\": [\"2\\n3 3\\n0 2 1\\n3 1 2 3\\n1 7\\n2 4 7\\n4 7\\n0 1 3 0 1 0 0\\n1 7\\n3 9 4 5\\n7 1 2 3 4 5 6 7\\n1 1\", \"2\\n3 3\\n0 2 1\\n3 1 2 3\\n1 7\\n2 4 7\\n4 7\\n0 1 2 0 1 0 0\\n1 7\\n3 9 4 5\\n7 1 2 3 4 5 6 7\\n1 1\", \"2\\n3 3\\n0 2 1\\n3 1 2 3\\n1 7\\n2 4 7\\n4 7\\n0 1 2 0 2 0 0\\n1 7\\n3 9 4 5\\... | Little Elephant likes lemonade.
When Little Elephant visits any room, he finds the bottle of the lemonade in that room that contains the greatest number of litres of lemonade and drinks it all.
There are n rooms (numbered from 0 to n-1), each contains C_{i} bottles. Each bottle has a volume (in litres). The first roo... | 0.75 |
{"tests": "{\"inputs\": [[\"1990-12-06\", \"2000-02-29\"], [\"2012-03-31\", \"1990-06-09\"], [\"1984-08-14\", \"1990-04-17\"], [\"2000-06-30\", \"1978-03-17\"], [\"1969-12-20\", \"2000-10-07\"]], \"outputs\": [[\"2009-05-24\"], [\"2034-01-21\"], [\"1995-12-19\"], [\"2022-10-14\"], [\"2031-07-26\"]]}", "source": "primei... | # Task
Given the birthdates of two people, find the date when the younger one is exactly half the age of the other.
# Notes
* The dates are given in the format YYYY-MM-DD and are not sorted in any particular order
* Round **down** to the nearest day
* Return the result as a string, like the input dates
Write your s... | 0 |
{"tests": "{\"inputs\": [[\"C E G\"], [\"Db F Ab\"], [\"D F# A\"], [\"Eb G Bb\"], [\"E G# B\"], [\"F A C\"], [\"F# A# C#\"], [\"Gb Bb Db\"], [\"G B D\"], [\"Ab C Eb\"], [\"A C# E\"], [\"Bb D F\"], [\"B D# F#\"], [\"C Eb G\"], [\"C# E G#\"], [\"D F A\"], [\"D# F# A#\"], [\"Eb Gb Bb\"], [\"E G B\"], [\"F Ab C\"], [\"F# A... | Check if given chord is minor or major.
_____________________________________________________________
Rules:
1. Basic minor/major chord have three elements.
2. Chord is minor when interval between first and second element equals 3 and between second and third -> 4.
3. Chord is major when interval between first and ... | 0 |
{"tests": "{\"inputs\": [\"10 100\\n0 100 1\\n1 -100 1\\n2 100 1\\n3 -100 1\\n4 100 1\\n5 -100 1\\n6 100 1\\n7 -100 1\\n8 100 1\\n9 -100 1\\n\", \"10 48\\n99 87 97\\n95 94 100\\n92 100 93\\n98 98 92\\n100 99 96\\n69 76 97\\n96 97 100\\n94 100 96\\n89 99 95\\n97 87 100\\n\", \"2 1\\n-61 -27 64\\n1 22 92\\n\", \"4 2\\n0 ... | On a number line there are n balls. At time moment 0 for each ball the following data is known: its coordinate xi, speed vi (possibly, negative) and weight mi. The radius of the balls can be ignored.
The balls collide elastically, i.e. if two balls weighing m1 and m2 and with speeds v1 and v2 collide, their new speeds... | 0 |
{"tests": "{\"inputs\": [\"972408\\n\", \"956022\\n\", \"54\\n\", \"448\\n\", \"68\\n\", \"941322\\n\", \"6\\n\", \"160\\n\", \"908550\\n\", \"635758\\n\", \"966\\n\", \"992164\\n\", \"924936\\n\", \"24\\n\", \"180\\n\", \"1000000\\n\", \"38\\n\", \"10\\n\", \"921566\\n\", \"999998\\n\", \"999994\\n\", \"726\\n\", \"16... | Last summer Peter was at his granny's in the country, when a wolf attacked sheep in the nearby forest. Now he fears to walk through the forest, to walk round the forest, even to get out of the house. He explains this not by the fear of the wolf, but by a strange, in his opinion, pattern of the forest that has n levels,... | 0 |
{"tests": "{\"inputs\": [\"2\\n1 2 3\\n5 4 100\\n\", \"16\\n1 1 1\\n3 4 7\\n4 5 13\\n456 123 7890123\\n1 1 1000000000\\n45 12 782595420\\n1 1000000000 1000000000\\n1 999999999 1000000000\\n1 99999 676497416\\n5 6 930234861\\n8 9 881919225\\n500000000 500000000 1000000000\\n1000000000 1000000000 1000000000\\n999999999 1... | Leo has developed a new programming language C+=. In C+=, integer variables can only be changed with a "+=" operation that adds the right-hand side value to the left-hand side variable. For example, performing "a += b" when a = $2$, b = $3$ changes the value of a to $5$ (the value of b does not change).
In a prototype... | 0.625 |
{"tests": "{\"inputs\": [\"5\\n24 3 5\\n10 3 6\\n2345 1 4\\n19260817 394 485\\n19260817 233 264\\n\", \"5\\n24 3 5\\n10 5 6\\n2345 1 4\\n19260817 394 485\\n19260817 233 264\\n\", \"5\\n24 3 1\\n1 5 6\\n2345 1 4\\n35879228 394 859\\n19260817 233 264\\n\", \"5\\n24 3 5\\n10 3 6\\n2345 1 4\\n19260817 394 485\\n19260817 23... | There is an infinite set generated as follows:
$1$ is in this set.
If $x$ is in this set, $x \cdot a$ and $x+b$ both are in this set.
For example, when $a=3$ and $b=6$, the five smallest elements of the set are:
$1$,
$3$ ($1$ is in this set, so $1\cdot a=3$ is in this set),
$7$ ($1$ is in this set, so $1+b=7$ is ... | 0 |
{"tests": "{\"inputs\": [\"4 10\\n4 1 4 2 2 1 4 3 3 1\\n\", \"7 1\\n3\\n\", \"9 10\\n9 8 7 4 5 8 1 6 8 2\\n\", \"8 1\\n8\\n\", \"8 10\\n7 7 7 7 7 7 7 7 7 2\\n\", \"10 10\\n1 9 7 6 2 4 7 8 1 3\\n\", \"1000 100\\n343 745 296 856 507 192 780 459 9 193 753 28 334 871 589 105 612 751 708 129 32 628 974 641 323 596 604 759 9... | Alice is playing a game with her good friend, Marisa.
There are n boxes arranged in a line, numbered with integers from 1 to n from left to right. Marisa will hide a doll in one of the boxes. Then Alice will have m chances to guess where the doll is. If Alice will correctly guess the number of box, where doll is now, ... | 0 |
{"tests": "{\"inputs\": [\"CDBABC\\nADCABD\", \"AAAAAAAAAAAAAAAABBBB\\nABZZZZZZZZZZZZZZZZZZ\", \"MDSZWKDLGUIISYZKOGMGXOZKMTWHNCMZHGADQFOYZZITXHDNNRTNGSZULYBACPBJVBMNGDLICTBBDHQSAJFGDHCQFETHVUSRYEEGHSOLNSMQBCJBNQKSXMJCSCLOYDHWKNDTFTFTNTLQYUSLNCEKQPNJTAZREGOOTTJBOOUEKHUICMVPQBBJQQUJRTDXBTNWOWXCLTIXBDFFRAWKCZTUQNGHIJGLETH... | Anshal and his friends love watching TV series together,but Anshal has a habit of giving spoilers.In order to tackle this his friends anagrammed the list of the shows they were planning to watch.Somehow Anshal got hold of this list and started guessing the shows.Determine whether Anshal made a correct guess or not.
IN... | 0 |
{"tests": "{\"inputs\": [\"3 2\\n3 4\\n10 20\\n100 50\\n2 500000\\n0 0\", \"3 2\\n3 4\\n13 20\\n100 50\\n2 500000\\n0 0\", \"3 2\\n3 4\\n22 20\\n100 50\\n2 500000\\n0 0\", \"3 1\\n3 4\\n10 20\\n100 50\\n3 500000\\n0 0\", \"3 2\\n3 4\\n13 20\\n100 50\\n4 500000\\n0 0\", \"3 2\\n3 4\\n10 20\\n100 52\\n2 500000\\n0 0\", \... | Bamboo Blossoms
The bamboos live for decades, and at the end of their lives, they flower to make their seeds. Dr. ACM, a biologist, was fascinated by the bamboos in blossom in his travel to Tsukuba. He liked the flower so much that he was tempted to make a garden where the bamboos bloom annually. Dr. ACM started resea... | 0 |
{"tests": "{\"inputs\": [[[0, 1, 2, 3]], [[0, 1, 2, 3, \"a\", \"b\"]], [[0, 15, \"z\", 16, \"m\", 13, 14, \"c\", 9, 10, 13, \"u\", 4, 3]], [[13, 6, 8, 15, 4, 8, 13]], [[1, \"a\", 17, 8, \"e\", 3, \"i\", 12, 1]], [[5, 15, 16, 10, 6, 4, 16, \"t\", 13, \"n\", 14, \"k\", \"n\", 0, \"q\", \"d\", 7, 9]]], \"outputs\": [[0], ... | Given an array, return the difference between the count of even numbers and the count of odd numbers. `0` will be considered an even number.
```
For example:
solve([0,1,2,3]) = 0 because there are two even numbers and two odd numbers. Even - Odd = 2 - 2 = 0.
```
Let's now add two letters to the last example:
```
... | 0 |
{"tests": "{\"inputs\": [\"PDPD???\", \"?P?P\", \"DDPP???\", \"??PP\", \"DDPO???\", \"??OP\", \"DDPO?>?\", \"??OO\", \"?>?OPDD\", \"@?OP\", \"?>?PPDD\", \"@?PO\", \"DDPP?>?\", \"@?PN\", \"DDPP?>@\", \"NP?@\", \"DDPP??@\", \"@P?N\", \"@DPP??D\", \"@P@N\", \"D??PPD@\", \"?P@N\", \"D??PPC@\", \"NP@?\", \"D??CPP@\", \"N?@P... | For a string S consisting of the uppercase English letters `P` and `D`, let the doctoral and postdoctoral quotient of S be the total number of occurrences of `D` and `PD` in S as contiguous substrings. For example, if S = `PPDDP`, it contains two occurrences of `D` and one occurrence of `PD` as contiguous substrings, s... | 0 |
{"tests": "{\"inputs\": [[[\"A\", \"B\", \"A\"]], [[\"A\", \"B\", \"C\"]], [[\"A\", \"B\", \"B\", \"A\"]], [[\"A\", \"A\", \"A\", \"A\"]], [[\"A\"]], [[\"A\", \"A\", \"A\", \"BBBBBBBB\"]], [[\"A\", \"B\", \"C\", \"C\"]], [[]], [[\"B\", \"C\", \"\", \"\"]]], \"outputs\": [[\"A\"], [null], [null], [\"A\"], [\"A\"], [\"A\... | Goal
Given a list of elements [a1, a2, ..., an], with each ai being a string, write a function **majority** that returns the value that appears the most in the list.
If there's no winner, the function should return None, NULL, nil, etc, based on the programming language.
Example
majority(["A", "B", "A"]) returns "A"... | 0 |
{"tests": "{\"inputs\": [\"1\\n2 3 1\\n2 3 1\\n2\\n\", \"3\\n1 2 3 4 5 6 7 8 9\\n1 2 3\\n4 5 9\\n6 7 8\\n5\\n\", \"2\\n6 4 5 1 3 2\\n6 1 3\\n4 5 2\\n6\\n\", \"5\\n5 3 2 7 12 9 4 14 1 10 8 13 6 15 11\\n5 3 9\\n2 7 12\\n4 10 15\\n14 8 13\\n1 6 11\\n13\\n\", \"3\\n2 9 5 8 7 1 3 6 4\\n2 5 1\\n9 7 6\\n8 3 4\\n9\\n\", \"6\\n... | Recently personal training sessions have finished in the Berland State University Olympiad Programmer Training Centre. By the results of these training sessions teams are composed for the oncoming team contest season. Each team consists of three people. All the students of the Centre possess numbers from 1 to 3n, and a... | 0 |
{"tests": "{\"inputs\": [\"...\\n-..\\n.*.\\n...\\n...\\n.*.\\n...\\n...\\n...\\n...\\n...\\n.*.\\n...\\n...\\n.*.\\n...\\n...\\n...\\n\\n...\\n.*.\\n...\\n*..\\n...\\n..*\\n*.*\\n*.*\\n*.*\\n*.*\\n.*.\\n*.*\\n*..\\n.*.\\n..*\\n*.*\\n...\\n*.*\\n\\n...\\n.*.\\n.*.\\n...\\n.**\\n*..\\n...\\n...\\n.*.\\n.*.\\n...\\n*..\\... | You are playing a popular video game which is famous for its depthful story and interesting puzzles. In the game you were locked in a mysterious house alone and there is no way to call for help, so you have to escape on yours own. However, almost every room in the house has some kind of puzzles and you cannot move to n... | 0 |
{"tests": "{\"inputs\": [\"41 17 3\\n71 -86 10\\n\", \"826 4417 2901\\n833 -2286 3802\\n\", \"0 3278 2382\\n2312 1 1111\\n\", \"659 -674 277\\n-345 -556 127\\n\", \"2587 4850 3327\\n3278 -204 1774\\n\", \"-6 3 8\\n7 2 1\\n\", \"4763 2945 956\\n3591 9812 180\\n\", \"0 1 3\\n1 -1 1\\n\", \"83 -64 85\\n27 80 89\\n\", \"4 ... | So, the Berland is at war with its eternal enemy Flatland again, and Vasya, an accountant, was assigned to fulfil his duty to the nation.
Right now the situation in Berland is dismal — their both cities are surrounded! The armies of flatlanders stand on the borders of circles, the circles' centers are in the surround... | 0 |
{"tests": "{\"inputs\": [\"4\\n3 6 2 3\\n5\\n3 12\\n7 9\\n4 14\\n1 10\\n8 7\\n\", \"4\\n3 5 2 3\\n5\\n3 12\\n7 9\\n4 14\\n1 10\\n8 7\\n\", \"4\\n3 5 2 3\\n3\\n3 12\\n7 9\\n4 14\\n1 10\\n8 7\\n\", \"4\\n3 5 2 3\\n5\\n3 12\\n2 9\\n4 14\\n1 7\\n8 7\\n\", \"4\\n3 5 2 3\\n5\\n3 12\\n2 9\\n4 14\\n1 7\\n8 13\\n\", \"4\\n3 5 2... | Recently, Petya learned about a new game "Slay the Dragon". As the name suggests, the player will have to fight with dragons. To defeat a dragon, you have to kill it and defend your castle. To do this, the player has a squad of $n$ heroes, the strength of the $i$-th hero is equal to $a_i$.
According to the rules of th... | 0.25 |
{"tests": "{\"inputs\": [[0, 1], [18018018, 80000000000], [1, 1], [1, 2], [1, 3], [1554, 70]], \"outputs\": [[\"0.0\"], [\"0.(0)(2)5(2)5(2)5\"], [\"1.0\"], [\"0.5\"], [\"0.(3)\"], [\"22.2\"]]}", "source": "primeintellect"} | Write
```python
function repeating_fractions(numerator, denominator)
```
that given two numbers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part has repeated digits, replace those digits with a single digit in parentheses.
For example:
```python
re... | 0 |
{"tests": "{\"inputs\": [\"13 6\\n7 75\\n8 84\\n16 95\\n29 21\\n49 33\\n54 56\\n55 80\\n65 63\\n67 50\\n73 47\\n80 26\\n82 74\\n86 77\\n\", \"3 2\\n2 6\\n3 9\\n6 8\\n\", \"19 2\\n1 73\\n2 96\\n3 24\\n5 96\\n11 13\\n14 96\\n16 31\\n17 60\\n34 69\\n39 41\\n60 40\\n61 96\\n66 7\\n67 56\\n68 28\\n73 12\\n74 81\\n78 77\\n95... | A traveler is planning a water hike along the river. He noted the suitable rest points for the night and wrote out their distances from the starting point. Each of these locations is further characterized by its picturesqueness, so for the i-th rest point the distance from the start equals xi, and its picturesqueness e... | 0 |
{"tests": "{\"inputs\": [\"4\\n1 1\\n221 2\\n177890 2\\n998244353 1\\n\", \"1\\n88884444 1\\n\", \"1\\n9994444 1\\n\", \"1\\n9994444 1\\n\", \"1\\n88884444 1\\n\", \"1\\n9994444 2\\n\", \"1\\n88884444 2\\n\", \"1\\n10739757 1\\n\", \"4\\n1 1\\n221 2\\n177890 1\\n998244353 1\\n\", \"1\\n10862575 2\\n\", \"1\\n12678347 2... | It is a simplified version of problem F2. The difference between them is the constraints (F1: $k \le 2$, F2: $k \le 10$).
You are given an integer $n$. Find the minimum integer $x$ such that $x \ge n$ and the number $x$ is $k$-beautiful.
A number is called $k$-beautiful if its decimal representation having no leading... | 0 |
{"tests": "{\"inputs\": [[\"Hi everybody!\", [\" \", \"!\"]], [\"(1+2)*6-3^9\", [\"+\", \"-\", \"(\", \")\", \"^\", \"*\"]], [\"Solve_this|kata-very\\\\quickly!\", [\"!\", \"|\", \"\\\\\", \"_\", \"-\"]], [\"\", []], [\"\"], [\"some strange string\"], [\"1_2_3_huhuh_hahaha\", [\"_\"]], [\"((1+2))*(6-3)^9\", [\"+\", \"-... | Your task is to write function which takes string and list of delimiters as an input and returns list of strings/characters after splitting given string.
Example:
```python
multiple_split('Hi, how are you?', [' ']) => ['Hi,', 'how', 'are', 'you?']
multiple_split('1+2-3', ['+', '-']) => ['1', '2', '3']
```
List of del... | 0 |
{"tests": "{\"inputs\": [\"4\\n2 1 1 5\\n+*-\\n\", \"10\\n1 1 0 1 1 1 1 0 0 0\\n*-+\\n\", \"10\\n0 2 2 2 0 0 0 2 0 0\\n-*+\\n\", \"100\\n1 2 2 2 1 1 2 2 0 2 2 0 1 0 0 0 0 1 0 0 0 1 1 2 1 1 2 2 0 2 0 2 1 1 0 2 1 0 1 2 1 2 2 1 1 1 2 1 1 1 0 1 1 0 0 2 2 1 2 2 1 0 1 0 0 2 1 2 1 1 0 2 1 0 2 0 2 1 2 0 0 0 1 1 2 0 1 0 2 2 2 1... | Barbara was late for her math class so as a punishment the teacher made her solve the task on a sheet of paper. Barbara looked at the sheet of paper and only saw n numbers a_1, a_2, …, a_n without any mathematical symbols. The teacher explained to Barbara that she has to place the available symbols between the numbers ... | 0 |
{"tests": "{\"inputs\": [\"3\\n4 3\\n5 1 2 2\\n110\\n100\\n101\\n100\\n4 4\\n6 2 0 10\\n1001\\n0010\\n0110\\n0101\\n3 6\\n20 3 7\\n010110\\n000101\\n111111\\n\", \"3\\n4 3\\n5 1 2 2\\n110\\n100\\n101\\n100\\n4 4\\n6 2 0 10\\n1001\\n0010\\n0110\\n0101\\n3 1\\n20 3 7\\n010110\\n000101\\n111111\\n\", \"3\\n4 3\\n5 1 2 2\\... | Petya is a math teacher. n of his students has written a test consisting of m questions. For each student, it is known which questions he has answered correctly and which he has not.
If the student answers the j-th question correctly, he gets p_j points (otherwise, he gets 0 points). Moreover, the points for the quest... | 0 |
{"tests": "{\"inputs\": [\"545\\n\", \"2603340571199714716025114079373828413509944752618962350632892540710372640383149198328312562980217104434880337288055817064\\n\", \"670042\\n\", \"1099\\n\", \"8679647744\\n\", \"5057017252180797906185\\n\", \"404\\n\", \"4877\\n\", \"7665711\\n\", \"34676240957360936763594436365043... | Andrey's favourite number is n. Andrey's friends gave him two identical numbers n as a New Year present. He hung them on a wall and watched them adoringly.
Then Andrey got bored from looking at the same number and he started to swap digits first in one, then in the other number, then again in the first number and so o... | 0 |
{"tests": "{\"inputs\": [\"90081 33447 66380 6391049189\", \"2 5 6 1\", \"90081 33447 77758 6391049189\", \"2 9 7 0\", \"4 1 3 5\", \"90081 33447 77758 2284871002\", \"6 1 2 17\", \"121980 33447 90629 11295524182\", \"4 1 1 5\", \"111605 33447 77758 2284871002\", \"11 1 2 17\", \"4 1 1 7\", \"111605 33447 14069 2284871... | Takahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. He defines the beauty of the tower as follows:
* The beauty of the tower is the sum of the scores of the N layers, where the sco... | 0.125 |
{"tests": "{\"inputs\": [[[1, 5, 10, 25], 37], [[1, 3, 4], 6], [[25, 5, 10, 1, 21], 63], [[1, 4, 5, 10], 8], [[1, 2, 5, 10, 20, 50, 100, 200], 93]], \"outputs\": [[4], [2], [3], [2], [5]]}", "source": "primeintellect"} | A country has coins with denominations
```python
coins_list = d1 < d2 < · · · < dn.
```
You want to make change for n cents, using the smallest number of coins.
```python
# Example 1: U.S. coins
d1 = 1 d2 = 5 d3 = 10 d4 = 25
## Optimal change for 37 cents – 1 quarter, 1 dime, 2 pennies.
# Example 2: Alien Planet Z c... | 0 |
{"tests": "{\"inputs\": [\"3\\n1 2\\n\", \"10\\n1 2 2 2 5 4 6 5 6\\n\", \"85\\n1 1 2 2 4 6 1 3 6 3 3 11 9 14 12 5 8 11 16 19 12 17 2 19 1 24 6 2 6 6 24 3 20 1 1 1 17 8 4 25 31 32 39 12 35 23 31 26 46 9 37 7 5 23 41 41 39 9 11 54 36 54 28 15 25 58 56 18 23 70 68 18 3 48 57 70 15 65 22 35 25 13 49 34\\n\", \"8\\n1 1 2 2 ... | Barney lives in country USC (United States of Charzeh). USC has n cities numbered from 1 through n and n - 1 roads between them. Cities and roads of USC form a rooted tree (Barney's not sure why it is rooted). Root of the tree is the city number 1. Thus if one will start his journey from city 1, he can visit any city h... | 0 |
{"tests": "{\"inputs\": [\"2 2 1\\n2 3 1\\n3 2 3\\n1 3 5\", \"4 2 1\\n2 3 1\\n3 2 3\\n1 3 5\", \"2 2 1\\n2 3 1\\n3 2 5\\n1 3 5\", \"2 2 0\\n2 3 1\\n3 2 3\\n2 3 5\", \"2 2 1\\n2 3 1\\n1 2 3\\n1 3 5\", \"4 2 1\\n2 3 1\\n3 2 3\\n1 3 0\", \"2 2 1\\n2 3 1\\n1 2 5\\n1 3 5\", \"2 2 0\\n2 3 0\\n3 2 3\\n2 3 5\", \"3 2 1\\n2 3 1... | Problem
KND is a student programmer at the University of Aizu. His chest is known to be very sexy.
<image>
For simplicity, the part of the skin that can be seen from the chest is represented by the isosceles triangle ABC in the figure. However, due to the slack in the clothes, the two sides AC and BC (where these l... | 0 |
{"tests": "{\"inputs\": [\"10 5 100\\n64 90 3 94 96 97 52 54 82 31\\n796554 444893 214351 43810 684158 555762 686198 339093 383018 699152\\n6 8\\n8 3\\n3 9\\n2 3\\n10 3\\n\", \"10 5 100\\n48 73 30 46 95 19 98 73 94 24\\n501216 675859 843572 565104 879875 828759 80776 766980 213551 492652\\n1 2\\n6 5\\n7 6\\n10 3\\n8 1\... | Just to remind, girls in Arpa's land are really nice.
Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may have some friends. Hoses are divided in some friendship groups. Two Hoses x and y are in the same friendship group if and only if... | 0.375 |
{"tests": "{\"inputs\": [\"6\\n58376259 643910770 5887448 757703054 544067926 902981667\\n\", \"16\\n985629174 189232688 48695377 692426437 952164554 243460498 173956955 210310239 237322183 96515847 678847559 682240199 498792552 208770488 736004147 176573082\\n\", \"7\\n941492387 72235422 449924898 783332532 378192988 ... | Karen has just arrived at school, and she has a math test today!
<image>
The test is about basic addition and subtraction. Unfortunately, the teachers were too busy writing tasks for Codeforces rounds, and had no time to make an actual test. So, they just put one question in the test that is worth all the points.
Th... | 0 |
{"tests": "{\"inputs\": [\"2\\n0 0\\n1 0\", \"5\\n0 0\\n2 9\\n4 5\\n2 6\\n3 10\", \"5\\n0 0\\n3 9\\n4 5\\n2 6\\n3 10\", \"5\\n0 0\\n5 9\\n4 5\\n2 6\\n3 10\", \"5\\n0 0\\n5 9\\n4 8\\n2 6\\n3 10\", \"5\\n0 0\\n5 9\\n3 8\\n2 7\\n3 10\", \"5\\n-1 0\\n5 9\\n3 8\\n2 7\\n3 10\", \"5\\n-1 0\\n5 9\\n2 8\\n2 7\\n3 10\", \"5\\n-1... | There are N holes in a two-dimensional plane. The coordinates of the i-th hole are (x_i,y_i).
Let R=10^{10^{10^{10}}}. Ringo performs the following operation:
* Randomly choose a point from the interior of a circle of radius R centered at the origin, and put Snuke there. Snuke will move to the hole with the smallest ... | 0 |
{"tests": "{\"inputs\": [[637], [7468], [49632], [1425], [6250], [12674], [4735], [7345], [3850], [2394], [2068], [137], [1065], [6509], [3549], [5394], [56124], [968], [103247], [67935], [7415], [2687], [261], [8054], [942547]], \"outputs\": [[\"aid\"], [\"dean\"], [\"email\"], [\"belt\"], [\"alto\"], [\"blade\"], [\"... | Maya writes weekly articles to a well known magazine, but she is missing one word each time she is about to send the article to the editor. The article is not complete without this word. Maya has a friend, Dan, and he is very good with words, but he doesn't like to just give them away. He texts Maya a number and she ne... | 0 |
{"tests": "{\"inputs\": [\"2 3 3\\n2 2\\nRLR\\nLUD\", \"4 3 5\\n2 2\\nUDRRR\\nLLDTD\", \"2 6 11\\n2 1\\nRLDRRUDDLRL\\nURRDRLLDLRD\", \"2 6 3\\n2 2\\nRLR\\nLUD\", \"4 1 5\\n2 2\\nUDRRR\\nLLDTD\", \"4 1 5\\n0 2\\nUDRRR\\nLLDTD\", \"4 1 5\\n0 2\\nUDRRR\\nDTDLL\", \"1 1 5\\n0 2\\nUDRRR\\nDTDLL\", \"1 1 5\\n-1 2\\nUDRRR\\nD... | We have a rectangular grid of squares with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left. On this grid, there is a piece, which is initially placed at square (s_r,s_c).
Takahashi and Aoki will play a game, where each player has a st... | 0.125 |
{"tests": "{\"inputs\": [\"3\\n8 4 1\\n2\\n2 3\\n1 2\\n\", \"6\\n1 2 4 8 16 32\\n4\\n1 6\\n2 5\\n3 4\\n1 2\\n\", \"6\\n1 2 4 12 16 32\\n4\\n1 6\\n2 5\\n3 4\\n1 2\\n\", \"3\\n6 4 1\\n2\\n2 3\\n1 2\\n\", \"6\\n0 2 4 12 16 32\\n4\\n2 6\\n2 5\\n3 4\\n1 2\\n\", \"6\\n0 2 4 12 16 32\\n4\\n2 3\\n2 5\\n3 4\\n1 2\\n\", \"3\\n8 ... | For an array $b$ of length $m$ we define the function $f$ as $ f(b) = \begin{cases} b[1] & \quad \text{if } m = 1 \\ f(b[1] \oplus b[2],b[2] \oplus b[3],\dots,b[m-1] \oplus b[m]) & \quad \text{otherwise,} \end{cases} $
where $\oplus$ is bitwise exclusive OR.
For example, $f(1,2,4,8)=f(1\oplus2,2\oplus4,4\oplus8)=f(... | 0.25 |
{"tests": "{\"inputs\": [\"2\\n2\\n2\", \"4\\n0\\n4\\n2\\n8\", \"2\\n2\\n11\", \"2\\n2\\n0\", \"4\\n0\\n4\\n2\\n10\", \"2\\n2\\n22\", \"2\\n1\\n0\", \"4\\n1\\n4\\n2\\n10\", \"2\\n2\\n9\", \"4\\n1\\n4\\n0\\n10\", \"2\\n1\\n9\", \"4\\n1\\n4\\n0\\n12\", \"2\\n0\\n9\", \"2\\n0\\n15\", \"2\\n0\\n21\", \"4\\n0\\n4\\n4\\n8\",... | Now I have a card with n numbers on it. Consider arranging some or all of these appropriately to make numbers. Find the number obtained by adding all the numbers created at this time.
For example, if you have 1 and 2, you will get 4 numbers 1, 2, 12, 21 so the total number is 36. Even if the same numbers are produced ... | 0 |
{"tests": "{\"inputs\": [[1], [5], [25], [30], [50]], \"outputs\": [[1], [2], [3], [4], [5]]}", "source": "primeintellect"} | Assume that you started to store items in progressively expanding square location, like this for the first 9 numbers:
```
05 04 03
06 01 02
07 08 09
```
And like this for the expanding to include up to the first 25 numbers:
```
17 16 15 14 13
18 05 04 03 12
19 06 01 02 11
20 07 08 09 10
21 22 23 24 25
```
You might... | 0 |
{"tests": "{\"inputs\": [[0], [1], [5], [10], [20]], \"outputs\": [[{\"modifier\": 0, \"maximum_spell_level\": -1, \"extra_spells\": []}], [{\"modifier\": -5, \"maximum_spell_level\": -1, \"extra_spells\": []}], [{\"modifier\": -3, \"maximum_spell_level\": -1, \"extra_spells\": []}], [{\"modifier\": 0, \"maximum_spell_... | Taking into consideration the [3.5 edition rules](http://www.dandwiki.com/wiki/SRD:Ability_Scores#Table:_Ability_Modifiers_and_Bonus_Spells), your goal is to build a function that takes an ability score (worry not about validation: it is always going to be a non negative integer), will return:
* attribute modifier, as... | 0 |
{"tests": "{\"inputs\": [\"7\\n576460752303423487 2\\n82 9\\n101 104\\n10 21\\n31 10\\n0 1\\n10 30\\n\", \"1\\n128817972817282999 327672410994637530\\n\", \"66\\n7 0\\n5 7\\n1 3\\n3 2\\n3 5\\n0 6\\n1 2\\n0 7\\n4 5\\n4 7\\n5 1\\n2 0\\n4 0\\n0 5\\n3 6\\n7 3\\n6 0\\n5 2\\n6 6\\n1 7\\n5 6\\n2 2\\n3 4\\n2 1\\n5 3\\n4 6\\n6 ... | In some country live wizards. They love playing with numbers.
The blackboard has two numbers written on it — a and b. The order of the numbers is not important. Let's consider a ≤ b for the sake of definiteness. The players can cast one of the two spells in turns:
* Replace b with b - ak. Number k can be chosen by... | 0 |
{"tests": "{\"inputs\": [[{\"1\": [\"a\", \"b\"]}], [{\"1\": [\"a\", \"b\", \"c\", \"n\", \"o\"]}], [{\"1\": [\"a\", \"b\", \"c\"]}], [{\"2\": [\"a\"], \"1\": [\"b\", \"c\"]}], [{\"2\": [\"i\", \"a\"], \"1\": [\"z\", \"x\"]}]], \"outputs\": [[[\"ab\", \"ba\"]], [[\"abcno\", \"abcon\", \"abnco\", \"abnoc\", \"abocn\", \... | Given a hash of letters and the number of times they occur, recreate all of the possible anagram combinations that could be created using all of the letters, sorted alphabetically.
The inputs will never include numbers, spaces or any special characters, only lowercase letters a-z.
E.g. get_words({2=>["a"], 1=>["b", "... | 0 |
{"tests": "{\"inputs\": [\"0\\n\", \"-1\\n\", \"1\\n\", \"-2\\n\", \"-4\\n\", \"-3\\n\", \"-5\\n\", \"-7\\n\", \"-6\\n\", \"2\\n\", \"3\\n\", \"4\\n\", \"7\\n\", \"5\\n\", \"9\\n\", \"17\\n\", \"25\\n\", \"8\\n\", \"-10\\n\", \"-15\\n\", \"-9\\n\", \"10\\n\", \"6\\n\", \"12\\n\", \"16\\n\", \"11\\n\", \"13\\n\", \"-11\... | In this problem you have to solve a simple classification task: given an image, determine whether it depicts a Fourier doodle.
You are given a set of 50 images with ids 1 through 50. You are also given a text file labels.txt containing the labels for images with ids 1 through 20, which comprise the learning data set.... | 0 |
{"tests": "{\"inputs\": [\"4\\nab\\nbc\\nca\\nd\\n\", \"26\\nhw\\nwb\\nba\\nax\\nxl\\nle\\neo\\nod\\ndj\\njt\\ntm\\nmq\\nqf\\nfk\\nkn\\nny\\nyz\\nzr\\nrg\\ngv\\nvc\\ncs\\nsi\\niu\\nup\\nph\\n\", \"3\\nabcd\\nefg\\ncdefg\\n\", \"20\\nckdza\\nw\\ntvylck\\nbqtv\\ntvylckd\\nos\\nbqtvy\\nrpx\\nzaj\\nrpxebqtvylckdzajfmi\\nbq... | A substring of some string is called the most frequent, if the number of its occurrences is not less than number of occurrences of any other substring.
You are given a set of strings. A string (not necessarily from this set) is called good if all elements of the set are the most frequent substrings of this string. Res... | 0 |
{"tests": "{\"inputs\": [[\"len(list)\"], [\"string\"], [\"\"], [\"def f(x\"], [\")(\"], [\"(a(b)c()d)\"], [\"f(x[0])\"]], \"outputs\": [[{\"3\": 8}], [{}], [{}], [false], [false], [{\"0\": 9, \"2\": 4, \"6\": 7}], [{\"1\": 6}]]}", "source": "primeintellect"} | Write a function which outputs the positions of matching bracket pairs. The output should be a dictionary with keys the positions of the open brackets '(' and values the corresponding positions of the closing brackets ')'.
For example: input = "(first)and(second)" should return {0:6, 10:17}
If brackets cannot be pair... | 0 |
{"tests": "{\"inputs\": [\"6\\n0 1 80\\n1 2 20\\n0 2 60\\n2 3 50\\n3 4 66\\n1 4 90\\n2\\n0 1 1\\n1 2 1\\n0\", \"6\\n0 1 80\\n1 2 20\\n0 2 60\\n2 3 50\\n3 4 66\\n0 4 90\\n2\\n0 1 1\\n1 2 1\\n0\", \"6\\n0 1 80\\n1 2 20\\n0 2 60\\n2 2 50\\n3 4 66\\n0 4 90\\n2\\n0 1 1\\n1 2 1\\n0\", \"6\\n0 1 80\\n1 2 20\\n0 2 60\\n2 2 50\... | Mr. A, who will graduate next spring, decided to move when he got a job. The company that finds a job has offices in several towns, and the offices that go to work differ depending on the day. So Mr. A decided to live in a town where he had a short time to go to any office.
So you decided to find the most convenient t... | 0 |
{"tests": "{\"inputs\": [\"5 1\\nAAAAA\", \"4 87042533\\nAABB\", \"5 2\\nAAABA\", \"5 1\\nAAABA\", \"5 3\\nAAABA\", \"5 1\\nAAAAB\", \"5 2\\nAAAAA\", \"5 1\\nAAABB\", \"5 3\\nAAAAA\", \"5 2\\nAAAAB\", \"5 1\\nAABBB\", \"5 2\\nAABAA\", \"5 1\\nABAAB\", \"5 2\\nAAABB\", \"1 3623191\\nBAAA\", \"1 47200304\\nBABA\", \"5 1\... | Takahashi has a lot of peculiar devices. These cylindrical devices receive balls from left and right. Each device is in one of the two states A and B, and for each state, the device operates as follows:
* When a device in state A receives a ball from either side (left or right), the device throws out the ball from the... | 0 |
{"tests": "{\"inputs\": [\"8\\n1 4\\n10 5\\n3 3\\n4 11\\n8 9\\n22 40\\n8 36\\n314159265 358979323\\n\", \"99\\n207579013 207579013\\n376140463 376140463\\n186969586 186969586\\n326402540 326402540\\n158176573 158176573\\n127860890 127860890\\n570870045 570870045\\n178509023 178509023\\n61263305 61263305\\n558212775 558... | 10^{10^{10}} participants, including Takahashi, competed in two programming contests.
In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th.
The score of a participant is the product of his/her ranks in the two contests.
Process the following Q queries:
- In the i-th query, you are gi... | 0 |
{"tests": "{\"inputs\": [\"16677181699666569\\n\", \"52013157885656046\\n\", \"1129718145924\\n\", \"29442431889534807\\n\", \"3\\n\", \"58061299250691018\\n\", \"81\\n\", \"2\\n\", \"10\\n\", \"93886356235159944\\n\", \"72900000000000\\n\", \"243\\n\", \"70414767176369958\\n\", \"5559060566555523\\n\", \"9999999999999... | Gerald has been selling state secrets at leisure. All the secrets cost the same: n marks. The state which secrets Gerald is selling, has no paper money, only coins. But there are coins of all positive integer denominations that are powers of three: 1 mark, 3 marks, 9 marks, 27 marks and so on. There are no coins of oth... | 0 |
{"tests": "{\"inputs\": [\"1\\n1\\n1\\n1\\n1\\n1\\n1\\n\", \"1\\n3\\n2 3 1\\n1 2\\n2 3\\n1\\n1\\n1\\n2\\n\", \"2\\n6\\n5 3 2 4 1 6\\n1 2\\n1 3\\n1 4\\n4 5\\n4 6\\n4\\n1 3 4 5\\n3\\n3 5 2\\n6\\n5 3 2 4 1 6\\n1 2\\n1 3\\n1 4\\n4 5\\n4 6\\n3\\n1 2 3\\n3\\n4 1 6\\n\", \"1\\n3\\n1 3 1\\n1 2\\n2 3\\n1\\n1\\n1\\n2\\n\", \"1\\... | You are playing a strange game with Li Chen. You have a tree with n nodes drawn on a piece of paper. All nodes are unlabeled and distinguishable. Each of you independently labeled the vertices from 1 to n. Neither of you know the other's labelling of the tree.
You and Li Chen each chose a subtree (i.e., a connected su... | 0 |
{"tests": "{\"inputs\": [\"4\\n4 0 11 6\\n\", \"1\\n13\\n\", \"5\\n315479581 954336048 124252105 880492165 179952043\\n\", \"2\\n151282707 316934479\\n\", \"5\\n809571641 29322377 935888946 833709370 2457463\\n\", \"1\\n901418150\\n\", \"2\\n512483 512483\\n\", \"10\\n268439624 335544469 2491136 151142938 168395872 536... | Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | 0 |
{"tests": "{\"inputs\": [[[{\"name\": \"Linda\", \"results\": [\"XXO\", \"O\", \"XXO\", \"O\"]}, {\"name\": \"Vickie\", \"results\": [\"O\", \"X\", \"\", \"\"]}, {\"name\": \"Debbie\", \"results\": [\"XXO\", \"O\", \"XO\", \"XXX\"]}, {\"name\": \"Michelle\", \"results\": [\"XO\", \"XO\", \"XXX\", \"\"]}, {\"name\": \"C... | Your task is to determine the top 3 place finishes in a pole vault competition involving several different competitors. This is isn't always so simple, and it is often a source of confusion for people who don't know the actual rules.
Here's what you need to know:
As input, you will receive an array of objects. Each o... | 0 |
{"tests": "{\"inputs\": [[[1]], [[5]], [[1, 1]], [[5, 5]], [[5, 1]], [[5, 6]], [[1, 1, 1]], [[2, 2, 2]], [[3, 3, 3]], [[4, 4, 4]], [[5, 5, 5]], [[6, 6, 6]], [[1, 2, 1]], [[1, 1, 5]], [[5, 5, 6]], [[1, 5, 5]], [[1, 1, 1, 1]], [[2, 2, 2, 2]], [[3, 3, 3, 3]], [[4, 4, 4, 4]], [[5, 5, 5, 5]], [[6, 6, 6, 6]], [[1, 5, 5, 1]],... | Zonk is addictive dice game. In each round player rolls 6 dice. Then (s)he composes combinations from them. Each combination gives certain points.
Then player can take one or more dice combinations to his hand and re-roll remaining dice or save his score. Dice in player's hand won't be taken into account in subsequen... | 0 |
{"tests": "{\"inputs\": [\"0 55\\n0 1\\n0 2\\n0 3\\n10 1\\n10 2\\n10 3\\n10 4\\n10 5\\n10 6\\n11 1\\n11 2\\n11 3\\n100001 100\\n-1 -1\", \"0 55\\n0 1\\n0 2\\n0 3\\n10 1\\n10 2\\n10 3\\n10 4\\n10 5\\n10 1\\n11 1\\n11 2\\n11 3\\n100001 100\\n-1 -1\", \"0 55\\n0 1\\n0 2\\n0 3\\n10 1\\n10 2\\n10 3\\n10 4\\n10 5\\n19 6\\n11... | Professor Matsuzaki is a scientist studying the truth of the universe. Life, the universe, all the answers are said to be 42, but Professor Matsuzaki thinks that this alone is not enough to elucidate the truth of the universe. Professor Matsuzaki believes that the truth of the universe is represented by a function cons... | 0 |
{"tests": "{\"inputs\": [[\"great blue heron\", \"garlic naan\"], [\"chickadee\", \"chocolate cake\"], [\"brown bear\", \"bear claw\"], [\"marmot\", \"mulberry tart\"], [\"porcupine\", \"pie\"], [\"cat\", \"yogurt\"], [\"electric eel\", \"lasagna\"], [\"slow loris\", \"salsas\"], [\"ox\", \"orange lox\"], [\"blue-foote... | All of the animals are having a feast! Each animal is bringing one dish. There is just one rule: the dish must start and end with the same letters as the animal's name. For example, the great blue heron is bringing garlic naan and the chickadee is bringing chocolate cake.
Write a function `feast` that takes the animal... | 0 |
{"tests": "{\"inputs\": [\"5\\n100.1 90.1\\n0 0\\n0 10\\n7 5\\n10 0\\n10 10\", \"5\\n100.1 90.65666260699702\\n0 0\\n1 10\\n7 5\\n10 0\\n10 10\", \"5\\n100.1 90.1\\n0 0\\n0 10\\n5 5\\n10 0\\n10 4\", \"5\\n100.1 90.65666260699702\\n0 0\\n0 10\\n7 5\\n13 0\\n10 10\", \"5\\n100.1 90.65666260699702\\n1 0\\n1 10\\n8 10\\n10... | I'm traveling to a country with a rabbit. There are n cities in this country numbered from 1 to n, and the rabbit is now in city 1. City i is a point on the coordinate plane (xi, yi) ).
Rabbits travel to meet the following conditions.
* The travel path is a polygonal line, each part of which must be a line segment co... | 0.25 |
{"tests": "{\"inputs\": [\"10\\n3 5 1 3\\n0 0 1\\n2 1 4\\n2 5 2 3\\n1 0\\n3 2\\n1 20 2 4\\n0\\n16\\n6 20 2 5\\n1 1 0 1 0 0\\n0 8 2 9 11 6\\n4 16 3 6\\n1 0 1 1\\n8 3 5 6\\n6 20 3 6\\n0 1 0 0 1 0\\n20 11 3 20 16 17\\n7 17 1 6\\n1 1 0 1 0 0 0\\n1 7 0 11 10 15 10\\n6 17 2 6\\n0 0 1 0 0 1\\n7 6 3 7 10 12\\n5 17 2 5\\n1 1 1 ... | Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes.
The exam consists of $n$ problems that can be solved in $T$ minutes. Thus, the exam begins at time $0$ and ends at time $T$. Petya can leave the exam at any integer tim... | 0 |
{"tests": "{\"inputs\": [\"4\\n4\\n0011\\n6\\n111111\\n5\\n10101\\n8\\n01010000\\n\", \"4\\n4\\n0011\\n6\\n111111\\n5\\n10101\\n8\\n01000000\\n\", \"4\\n4\\n1011\\n6\\n111111\\n5\\n10101\\n8\\n01000000\\n\", \"4\\n4\\n1011\\n6\\n111111\\n5\\n10101\\n8\\n01010000\\n\", \"4\\n4\\n0001\\n6\\n111111\\n5\\n10101\\n8\\n01000... | You are given a binary string $s$ consisting of $n$ zeros and ones.
Your task is to divide the given string into the minimum number of subsequences in such a way that each character of the string belongs to exactly one subsequence and each subsequence looks like "010101 ..." or "101010 ..." (i.e. the subsequence shoul... | 0 |
{"tests": "{\"inputs\": [\"129630 805489 631548 761110 577559\\n\", \"7 9 481 961 9\\n\", \"581106 975502 703094 487920 637713\\n\", \"100 100 100 100 100\\n\", \"5 10 6361 6643 9\\n\", \"5 5 5 5 5\\n\", \"1 100000 1000 1 2\\n\", \"1 2 100 100 2\\n\", \"61097 812001 384947 188893 662044\\n\", \"1 3 100 100 3\\n\", \"10... | Bob is about to take a hot bath.
There are two taps to fill the bath: a hot water tap and a cold water tap. The cold water's temperature is t1, and the hot water's temperature is t2. The cold water tap can transmit any integer number of water units per second from 0 to x1, inclusive. Similarly, the hot water tap can ... | 0 |
{"tests": "{\"inputs\": [\"2\\n3 7\\n24 25 27\\n10 7\\n51 52 53 54 55 56 57 58 59 60\\n\", \"2\\n3 7\\n24 25 27\\n10 7\\n51 52 53 54 55 56 57 58 42 60\\n\", \"2\\n3 7\\n24 25 40\\n10 7\\n51 52 53 54 55 56 57 58 42 60\\n\", \"2\\n3 7\\n24 25 40\\n10 7\\n25 52 53 54 55 54 57 58 42 60\\n\", \"2\\n3 7\\n24 25 27\\n10 7\\n7... | Nezzar's favorite digit among $1,\ldots,9$ is $d$. He calls a positive integer lucky if $d$ occurs at least once in its decimal representation.
Given $q$ integers $a_1,a_2,\ldots,a_q$, for each $1 \le i \le q$ Nezzar would like to know if $a_i$ can be equal to a sum of several (one or more) lucky numbers.
-----Input... | 0.375 |
{"tests": "{\"inputs\": [\"773 467\\n\", \"50 372\\n\", \"329 31\\n\", \"155 534\\n\", \"267 270\\n\", \"459 487\\n\", \"377 720\\n\", \"0 1000\\n\", \"713 65\\n\", \"1000 483\\n\", \"100 1\\n\", \"67 420\\n\", \"1000 0\\n\", \"132 781\\n\", \"10 583\\n\", \"815 665\\n\", \"691 417\\n\", \"226 72\\n\", \"574 969\\n\", ... | The dragon and the princess are arguing about what to do on the New Year's Eve. The dragon suggests flying to the mountains to watch fairies dancing in the moonlight, while the princess thinks they should just go to bed early. They are desperate to come to an amicable agreement, so they decide to leave this up to chanc... | 0.375 |
{"tests": "{\"inputs\": [[[1, 3, 6, 8, 10, 12]], [[1, 3, 6, 8, 10, 12, 13, 15]], [[1, 6, 3]], [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]], [[1, 3, 5, 6, 8, 10, 12]], [[3, 5, 6, 8, 10, 12]], [[]], [[1]], [[-11, -9, -7, -6, -4, -2, 0, 1, 3, 6, 8, 10, 12, 13, 15]], [[-4, -2, 0, 1, 3, 6, 8, 10, 12, 13, 15]]], \"outputs\": [[... | Theory
This section does not need to be read and can be skipped, but it does provide some clarity into the inspiration behind the problem.
In music theory, a major scale consists of seven notes, or scale degrees, in order (with tonic listed twice for demonstrative purposes):
Tonic, the base of the scale and the note ... | 0 |
{"tests": "{\"inputs\": [\"1 2 2 1\\n4 1\\n-1 0\\n5 0\\n5 5\\n0 5\", \"1 2 2 1\\n4 1\\n0 0\\n1 0\\n2 2\\n0 2\", \"4 3 3 2\\n3 1\\n1 1\\n3 3\\n1 5\\n4 2\\n2 0\\n5 0\\n4 2\\n3 2\\n3 3\\n4 3\\n6 1\\n6 5\\n4 1\\n3 4\\n4 4\\n5 6\\n2 6\", \"1 2 3 1\\n4 1\\n0 0\\n1 0\\n2 2\\n0 2\", \"4 3 4 2\\n3 1\\n1 1\\n3 3\\n1 5\\n4 2\\n2 ... | Background
The kindergarten attached to the University of Aizu is a kindergarten where children who love programming gather. Yu, one of the kindergarten children, loves darts as much as programming. Yu-kun was addicted to darts recently, but he got tired of ordinary darts, so he decided to make his own darts board.
S... | 0 |
{"tests": "{\"inputs\": [\"3\\n1\\n1\\n5\\n1 4 5 9 10\\n2\\n3 4\\n\", \"3\\n1\\n1\\n5\\n1 4 5 9 10\\n2\\n1 4\\n\", \"3\\n1\\n1\\n5\\n1 4 5 9 10\\n2\\n2 4\\n\", \"3\\n1\\n1\\n5\\n1 4 5 7 10\\n2\\n1 4\\n\", \"3\\n1\\n1\\n5\\n1 4 5 8 10\\n2\\n2 4\\n\", \"3\\n1\\n1\\n5\\n1 2 5 9 10\\n2\\n2 4\\n\", \"3\\n1\\n1\\n5\\n1 2 5 9... | You have $2n$ integers $1, 2, \dots, 2n$. You have to redistribute these $2n$ elements into $n$ pairs. After that, you choose $x$ pairs and take minimum elements from them, and from the other $n - x$ pairs, you take maximum elements.
Your goal is to obtain the set of numbers $\{b_1, b_2, \dots, b_n\}$ as the result of... | 0 |
{"tests": "{\"inputs\": [\"16\\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\\n2 -7 ... | There are N rabbits, numbered 1, 2, \ldots, N.
For each i, j (1 \leq i, j \leq N), the compatibility of Rabbit i and j is described by an integer a_{i, j}. Here, a_{i, i} = 0 for each i (1 \leq i \leq N), and a_{i, j} = a_{j, i} for each i and j (1 \leq i, j \leq N).
Taro is dividing the N rabbits into some number of... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.