info stringlengths 120 50k | question stringlengths 504 10.4k | avg@8_qwen3_4b_instruct_2507 float64 0 0.88 |
|---|---|---|
{"tests": "{\"inputs\": [\"3\\n8\\n1 2 7 3 2 1 2 3\\n2\\n2 1\\n7\\n4 1 5 2 6 3 7\\n\", \"3\\n8\\n1 2 7 3 2 1 2 5\\n2\\n2 1\\n7\\n4 1 5 2 6 3 7\\n\", \"3\\n8\\n1 2 7 6 2 1 1 3\\n2\\n2 1\\n7\\n4 1 5 2 6 3 7\\n\", \"3\\n8\\n1 2 7 1 2 1 1 3\\n2\\n2 1\\n7\\n4 1 5 2 6 3 7\\n\", \"3\\n8\\n1 2 7 6 2 1 4 4\\n2\\n2 1\\n7\\n7 3 3... | Let's call a sequence $b_1, b_2, b_3 \dots, b_{k - 1}, b_k$ almost increasing if $$\min(b_1, b_2) \le \min(b_2, b_3) \le \dots \le \min(b_{k - 1}, b_k).$$ In particular, any sequence with no more than two elements is almost increasing.
You are given a sequence of integers $a_1, a_2, \dots, a_n$. Calculate the length o... | 0.125 |
{"tests": "{\"inputs\": [\"abcdadbcd\\nabcd\\n\", \"cctckkhatkgrhktihcgififfgfctctkrgiakrifazzggfzczfkkahhafhcfgacccfakkarcatkfiktczkficahgiriakccfiztkhkgrfkrimgamighhtamrhxftaadwxgfggytwjccgkdpyyatctfdygxggkyycpjyfxyfdwtgytcacawjddjdctyfgddkfkypyxftxxtaddcxxpgfgxgdfggfdggdcddtgpxpctpddcdcpc\\nctkhagrifaztmnxhmqztzibnm... | A subsequence of length |x| of string s = s1s2... s|s| (where |s| is the length of string s) is a string x = sk1sk2... sk|x| (1 ≤ k1 < k2 < ... < k|x| ≤ |s|).
You've got two strings — s and t. Let's consider all subsequences of string s, coinciding with string t. Is it true that each character of string s occurs in at... | 0.375 |
{"tests": "{\"inputs\": [\"ABBACCBACCBCAABCB\", \"B\", \"ACBAACBCCABCCBBBA\", \"ABCAACBCAABCCBBBC\", \"ACCAAABCAABCCBBBC\", \"CBAABC\", \"ABBBCCBACCBCAABCB\", \"D\", \"DBAABC\", \"ABBBCCBACCBCAABCA\", \"E\", \"DBAAAC\", \"F\", \"DAAAAC\", \"ACBAACBCAABCCBBBC\", \"A\", \"AAADAC\", \"ACCAACBCAABCCBBBC\", \"G\", \"AAADAD\... | You are given a string s consisting of `A`, `B` and `C`.
Snuke wants to perform the following operation on s as many times as possible:
* Choose a contiguous substring of s that reads `ABC` and replace it with `BCA`.
Find the maximum possible number of operations.
Constraints
* 1 \leq |s| \leq 200000
* Each char... | 0 |
{"tests": "{\"inputs\": [\"1\\n4 1\\n0011\\n0011\\n1 4\\n\", \"1\\n4 1\\n0011\\n0111\\n1 4\\n\", \"1\\n4 1\\n0011\\n0011\\n4 4\\n\", \"4\\n5 2\\n00000\\n00111\\n1 5\\n1 3\\n2 1\\n00\\n01\\n1 2\\n10 6\\n1111111111\\n0110000110\\n1 10\\n5 9\\n7 10\\n1 7\\n3 5\\n6 10\\n5 2\\n10000\\n11000\\n2 5\\n1 3\\n\", \"4\\n5 2\\n000... | Nezzar has a binary string s of length n that he wants to share with his best friend, Nanako. Nanako will spend q days inspecting the binary string. At the same time, Nezzar wants to change the string s into string f during these q days, because it looks better.
It is known that Nanako loves consistency so much. On th... | 0 |
{"tests": "{\"inputs\": [\"5 3 5\\n4 4\\n3 5\\n2 4\\n3 4\\n3 5\\n\", \"50 50 1\\n1 50\\n\", \"50 50 1\\n1 50\\n\", \"50 41 1\\n1 50\\n\", \"5 5 5\\n4 4\\n3 5\\n2 4\\n3 4\\n3 5\\n\", \"5 5 5\\n4 4\\n3 5\\n2 3\\n3 3\\n3 5\\n\", \"5 5 5\\n1 4\\n3 5\\n2 3\\n3 3\\n3 5\\n\", \"50 50 1\\n2 50\\n\", \"5 3 5\\n4 2\\n3 5\\n2 4\\... | You are given a chessboard consisting of $n$ rows and $n$ columns. Rows are numbered from bottom to top from $1$ to $n$. Columns are numbered from left to right from $1$ to $n$. The cell at the intersection of the $x$-th column and the $y$-th row is denoted as $(x, y)$. Furthermore, the $k$-th column is a special colum... | 0 |
{"tests": "{\"inputs\": [\"5\\n3 3\\n5 15\\n4 13\\n6 8\\n4 2\\n\", \"5\\n3 3\\n5 25\\n4 13\\n6 8\\n4 2\\n\", \"5\\n3 3\\n5 25\\n4 13\\n6 8\\n4 1\\n\", \"5\\n3 6\\n5 25\\n4 13\\n6 8\\n4 1\\n\", \"5\\n3 3\\n5 15\\n4 18\\n6 8\\n4 2\\n\", \"5\\n2 3\\n5 25\\n4 13\\n6 8\\n4 2\\n\", \"5\\n3 2\\n5 25\\n4 13\\n6 8\\n4 1\\n\", \... | Yeah, we failed to make up a New Year legend for this problem.
A permutation of length $n$ is an array of $n$ integers such that every integer from $1$ to $n$ appears in it exactly once.
An element $y$ of permutation $p$ is reachable from element $x$ if $x = y$, or $p_x = y$, or $p_{p_x} = y$, and so on.
The decom... | 0 |
{"tests": "{\"inputs\": [[0], [1], [2], [3], [4], [5], [6]], \"outputs\": [[1], [20], [400], [8000], [160000], [3200000], [64000000]]}", "source": "primeintellect"} | The Menger Sponge is a three-dimensional fractal, first described by Karl Menger in 1926.

###### _An illustration of the iterative construction of a Menger sponge_
A method of constructing a Menger Sponge can be visualized as follows:
1. Start from a cube ... | 0 |
{"tests": "{\"inputs\": [\"3 3\\n3 8 1 1\\n2 1 5\\n2 3 3\\n3 3\\n3 2 3 1\\n2 1 5\\n2 3 3\\n0 0\", \"3 6\\n3 8 1 1\\n2 1 5\\n2 3 3\\n3 3\\n3 2 5 1\\n2 1 8\\n2 3 3\\n0 0\", \"3 3\\n3 4 1 1\\n2 1 5\\n2 3 3\\n3 6\\n3 2 5 1\\n2 1 5\\n2 3 3\\n0 0\", \"3 3\\n3 8 1 1\\n2 1 6\\n2 3 3\\n3 3\\n3 2 3 1\\n2 2 5\\n2 2 3\\n0 0\", \"3... | This is a story of a world somewhere far from the earth. In this world, the land is parted into a number of countries ruled by empires. This world is not very peaceful: they have been involved in army race.
They are competing in production of missiles in particular. Nevertheless, no countries have started wars for yea... | 0 |
{"tests": "{\"inputs\": [\"10\\n9 5\\n9 3\\n8 1\\n4 5\\n8 2\\n7 2\\n7 5\\n3 6\\n10 5\\n\", \"10\\n4 5\\n9 7\\n1 6\\n2 5\\n7 4\\n6 10\\n8 3\\n4 3\\n6 7\\n\", \"10\\n10 8\\n9 2\\n3 2\\n10 6\\n1 3\\n10 4\\n5 9\\n7 8\\n10 2\\n\", \"10\\n1 10\\n7 1\\n6 2\\n1 3\\n8 4\\n1 9\\n1 4\\n1 6\\n5 1\\n\", \"10\\n7 4\\n7 1\\n3 7\\n6 1... | [INSPION FullBand Master - INSPION](https://www.youtube.com/watch?v=kwsciXm_7sA)
[INSPION - IOLITE-SUNSTONE](https://www.youtube.com/watch?v=kwsciXm_7sA)
On another floor of the A.R.C. Markland-N, the young man Simon "Xenon" Jackson, takes a break after finishing his project early (as always). Having a lot of free ti... | 0 |
{"tests": "{\"inputs\": [\"12 12\\n9\\n11\\n5\\n3\\n7\\n2\\n8\\n6\\n4\\n10\\n12\\n1\\n\", \"3 3\\n3\\n2\\n1\\n\", \"2 2\\n1\\n2\\n\", \"1 1\\n1\\n\", \"12 12\\n9\\n10\\n5\\n3\\n7\\n2\\n8\\n6\\n4\\n10\\n12\\n1\\n\", \"2 2\\n2\\n2\\n\", \"4 3\\n2\\n2\\n4\\n\", \"15 12\\n9\\n10\\n5\\n3\\n7\\n2\\n8\\n6\\n4\\n10\\n12\\n1\\n... | Dima is a beginner programmer. During his working process, he regularly has to repeat the following operation again and again: to remove every second element from the array. One day he has been bored with easy solutions of this problem, and he has come up with the following extravagant algorithm.
Let's consider that i... | 0 |
{"tests": "{\"inputs\": [\"3 1\\nerase -1\\nerase 0\\nerase -2147483648\\n\", \"26 25\\ndefragment\\nerase 1\\nerase -1560200883\\nalloc 44\\ndefragment\\nalloc 75\\nalloc 22\\ndefragment\\nerase 4\\ndefragment\\nalloc 57\\nalloc 53\\nerase 4\\nerase -1639632026\\nerase -2121605039\\nerase 3\\nalloc 51\\nalloc 65\\ndef... | There is little time left before the release of the first national operating system BerlOS. Some of its components are not finished yet — the memory manager is among them. According to the developers' plan, in the first release the memory manager will be very simple and rectilinear. It will support three operations:
... | 0 |
{"tests": "{\"inputs\": [[1, 1, 1], [2, 2, 2], [2, 3, 3], [4, 5, 6], [3, 7, 11]], \"outputs\": [[1], [27], [108], [3150], [11088]]}", "source": "primeintellect"} | # Your Task
You have a cuboid with dimensions x,y,z ∈ ℕ. A subcuboid of this cuboid has dimensions length, width, height ∈ ℕ where 1≤length≤x, 1≤width≤y, 1≤height≤z. If two subcuboids have the same length, width, and height, but they are at different positions within the cuboid, they are distinct. Find the total number... | 0 |
{"tests": "{\"inputs\": [[\"kitten\", \"sitting\"], [\"book\", \"back\"], [\"book\", \"book\"], [\"qlzcfayxiz\", \"vezkvgejzb\"], [\"nayvyedosf\", \"sjxen\"], [\"sjxen\", \"sjxen\"], [\"peter\", \"peter\"]], \"outputs\": [[3], [2], [0], [9], [9], [0], [0]]}", "source": "primeintellect"} | > In information theory and computer science, the Levenshtein distance is a string metric for measuring the difference between two sequences. Informally, the Levenshtein distance between two words is the minimum number of single-character edits (i.e. insertions, deletions or substitutions) required to change one word i... | 0 |
{"tests": "{\"inputs\": [\"3\\n156 120\\n100 50\\n80 100\", \"3\\n52 5\\n100 85\\n37 000\", \"3\\n19 5\\n000 49\\n43 010\", \"3\\n156 120\\n100 50\\n80 000\", \"3\\n156 159\\n100 50\\n80 000\", \"3\\n156 11\\n100 50\\n80 000\", \"3\\n156 22\\n100 50\\n80 000\", \"3\\n156 22\\n100 50\\n152 000\", \"3\\n156 6\\n100 50\\n... | There was a powerful school where powerful people gathered. At the athletic meet of the powerful school, powerful people march in a formation.
While the powerhouses always want to show off their power, most of them don't want to walk on their own. So I thought that some of them would be at the bottom, and a lot of peo... | 0 |
{"tests": "{\"inputs\": [\"6\\nooxoox\\n\", \"3\\noox\\n\", \"10\\noxooxoxoox\\n\", \"3\\nxoo\", \"6\\nxooxoo\", \"10\\nxooxoxooxo\", \"10\\nxxooxoxooo\", \"10\\noxooooxxox\", \"10\\nxoxxooooxo\", \"10\\noooxoxooxx\", \"10\\noxooooxxxo\", \"10\\noxoooxxoox\", \"10\\noxooooxoxx\", \"10\\noxoooxooxx\", \"10\\nxxoxxooooo\... | Snuke, who loves animals, built a zoo.
There are N animals in this zoo. They are conveniently numbered 1 through N, and arranged in a circle.
The animal numbered i (2≤i≤N-1) is adjacent to the animals numbered i-1 and i+1. Also, the animal numbered 1 is adjacent to the animals numbered 2 and N, and the animal numbered ... | 0.375 |
{"tests": "{\"inputs\": [[[4]], [[0, 0, 0, 0]], [[1, 1, 1, 1]], [[-1, 1, 2, -2]], [[]]], \"outputs\": [[[-4, 1]], [[0, 0, 0, 0, 1]], [[1, -4, 6, -4, 1]], [[4, 0, -5, 0, 1]], [[1]]]}", "source": "primeintellect"} | *** Nova polynomial from roots***
This kata is from a series on polynomial handling. ( [#1](http://www.codewars.com/kata/nova-polynomial-1-add-1) [#2](http://www.codewars.com/kata/570eb07e127ad107270005fe) [#3](http://www.codewars.com/kata/5714041e8807940ff3001140 ) [#4](http://www.codewars.com/kata/571a2e2df24b... | 0 |
{"tests": "{\"inputs\": [\"17 3\\n\", \"5 3\\n\", \"27 10\\n\", \"24 6\\n\", \"54 11\\n\", \"32 7\\n\", \"42 9\\n\", \"58 1\\n\"], \"outputs\": [\"158105/1048576\\n\", \"440668919/4294967296\\n\", \"1541494189855/140737488355328\\n\", \"47591/65536\\n\", \"37241906121/1099511627776\\n\", \"288230376151711743/2882303761... | Ikshu's love for binary numbers
Ikshu recently learnt to generate random numbers. He is generating stream binary numbers. Uptil now he has generated N bits of the binary number. Now, he wants to know if there is a streak of contiguous 1's of length K.
Help him to find the probability of existence of such a streak in ... | 0 |
{"tests": "{\"inputs\": [\"19 2\\n1 3\\n2 3\\n0 1\\n1 1\\n2 1\\n3 1\\n4 4\\n5 4\\n6 4\\n7 4\\n8 4\\n8 1\\n8 2\\n8 1\\n8 0\\n7 0\\n6 0\\n5 0\\n4 0\", \"3 2\\n0 0\\n1 0\\n2 0\", \"1 4\\n0 0\\n2 1\\n2 0\", \"8 3\\n0 0\\n0 3\\n6 0\\n1 3\\n2 0\\n2 10\\n5 2\\n0 8\", \"17 2\\n0 5\\n2 3\\n1 0\\n1 2\\n3 1\\n3 1\\n3 5\\n5 1\\n5 ... | Niwango-kun, an employee of Dwango Co., Ltd., likes Niconico TV-chan, so he collected a lot of soft toys of her and spread them on the floor.
Niwango-kun has N black rare soft toys of Niconico TV-chan and they are spread together with ordinary ones. He wanted these black rare soft toys to be close together, so he deci... | 0 |
{"tests": "{\"inputs\": [\"3 1\\n139\\n2 1\\n\", \"2 3\\n14\\n2 4\\n2 1\\n1 1\\n\", \"2 3\\n11\\n2 4\\n2 1\\n1 0\\n\", \"2 3\\n11\\n1 4\\n2 1\\n1 0\\n\", \"2 3\\n14\\n2 4\\n2 1\\n2 0\\n\", \"2 3\\n11\\n1 4\\n2 2\\n1 0\\n\", \"2 3\\n11\\n1 5\\n2 2\\n1 0\\n\", \"3 1\\n139\\n3 1\\n\", \"2 3\\n11\\n1 5\\n2 4\\n1 0\\n\", \"... | Let a and b be some non-negative integers. Let's define strange addition of a and b as following:
1. write down the numbers one under another and align them by their least significant digit;
2. add them up digit by digit and concatenate the respective sums together.
Assume that both numbers have an infinite n... | 0 |
{"tests": "{\"inputs\": [\"6 6\\n6\\n1 1\\n6 1\\n3 2\\n3 5\\n1 6\\n5 6\\n2\\n1 3\\n5 3\\n6 6\\n6\\n3 2\\n3 5\\n6 1\\n1 1\\n1 6\\n5 6\\n2\\n2 3\\n6 3\\n0 0\", \"6 6\\n6\\n1 1\\n6 1\\n3 2\\n3 5\\n0 6\\n5 6\\n2\\n1 3\\n2 3\\n6 6\\n6\\n3 2\\n3 5\\n6 1\\n1 1\\n1 6\\n5 6\\n2\\n1 3\\n6 3\\n0 0\", \"6 6\\n6\\n1 1\\n4 1\\n3 2\\... | Convenience store Deven Eleven is planning to open its first store in Aizuwakamatsu City to expand its business. There are already many other convenience stores in Aizuwakamatsu, so the place to open a new store is likely to be the key to success. Under the premise that "customers use the convenience store closest to t... | 0 |
{"tests": "{\"inputs\": [\"5\\n1 1\\n1 2\\n3 3\\n6 5\\n3 4\\n\", \"1\\n60 576460752303423489\\n\", \"1\\n60 1047975756539535859\\n\", \"5\\n1 1\\n1 2\\n3 3\\n6 5\\n3 1\\n\", \"5\\n1 1\\n1 2\\n3 4\\n6 5\\n3 1\\n\", \"5\\n1 1\\n1 2\\n3 4\\n6 5\\n4 1\\n\", \"5\\n1 1\\n1 2\\n3 4\\n6 3\\n4 1\\n\", \"5\\n1 1\\n1 2\\n3 2\\n6 ... | Seiji Maki doesn't only like to observe relationships being unfolded, he also likes to observe sequences of numbers, especially permutations. Today, he has his eyes on almost sorted permutations.
A permutation $a_1, a_2, \dots, a_n$ of $1, 2, \dots, n$ is said to be almost sorted if the condition $a_{i + 1} \ge a_i - ... | 0 |
{"tests": "{\"inputs\": [\"700 300 200\\n500 200 300\\n500 200 500\\n275 110 330\\n275 010 385\\n648 375 4002\\n3 1 10000\\n0 0 0\", \"700 300 200\\n500 200 300\\n500 200 500\\n275 110 330\\n275 010 385\\n1067 375 4002\\n3 1 10000\\n0 0 0\", \"700 300 200\\n993 200 300\\n500 200 500\\n275 110 330\\n275 010 385\\n1067 3... | Ms. Iyo Kiffa-Australis has a balance and only two kinds of weights to measure a dose of medicine.
For example, to measure 200mg of aspirin using 300mg weights and 700mg weights, she can put one 700mg weight on the side of the medicine and three 300mg weights on the opposite side (Figure 1). Although she could put fou... | 0.125 |
{"tests": "{\"inputs\": [\"2 2 1\\n24 25\\n18 23\\n\", \"5 9 5\\n25 27\\n23 24\\n9 29\\n25 30\\n20 20\\n\", \"11 4 3\\n26 29\\n5 28\\n20 27\\n12 16\\n27 27\\n25 28\\n20 25\\n9 15\\n18 21\\n9 20\\n6 10\\n\", \"20 10 2\\n11 30\\n20 27\\n24 25\\n24 29\\n16 21\\n30 30\\n28 29\\n29 30\\n21 29\\n20 26\\n29 29\\n29 30\\n25 28... | There are n TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The i-th of the shows is going from l_i-th to r_i-th minute, both ends inclusive.
You need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same TV, so it is possible you... | 0 |
{"tests": "{\"inputs\": [\"9293 -6547\\n4895 -9479\\n2738 -1395 8489 -8324\\n3540 -4860 -8555 1675\\n\", \"-8193 -8833\\n4353 -8260\\n2214 683 -8074 -8978\\n5548 -850 -1486 -8372\\n\", \"0 0\\n2 0\\n1 1 1 -1\\n-10 2 -12 2\\n\", \"0 0\\n10 0\\n0 1 10 1\\n1 0 9 0\\n\", \"3680 2196\\n8736 8904\\n7532 2465 3709 -8961\\n643... | Victor and Peter are playing hide-and-seek. Peter has hidden, and Victor is to find him. In the room where they are playing, there is only one non-transparent wall and one double-sided mirror. Victor and Peter are points with coordinates (xv, yv) and (xp, yp) respectively. The wall is a segment joining points with coor... | 0 |
{"tests": "{\"inputs\": [\"5\\n1 2 3 2 1\\n\", \"28\\n415546599 415546599 415546599 415546599 415546599 415546599 415546599 415546599 415546599 2 802811737 802811737 802811737 802811737 802811737 802811737 802811737 802811737 1 550595901 550595901 550595901 550595901 550595901 550595901 550595901 550595901 550595901\\n... | Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.
Limak will repeat the following operation till everything is destroyed.
Block is called internal if i... | 0 |
{"tests": "{\"inputs\": [[[1, 2, 3, 4, 5], [1, 2]], [[1, 2, 3, 4, 5], [1, 2], [3, 4]], [[1, 2, 3, 4, 5], [1, 2], [3, 4], [2, 3]], [[1, 2, 3, 4, 5], [4, 4]], [[1, 2, 3, 4, 5]]], \"outputs\": [[[1, 3, 2, 4, 5]], [[1, 3, 2, 5, 4]], [[1, 3, 5, 2, 4]], [[1, 2, 3, 4, 5]], [[1, 2, 3, 4, 5]]]}", "source": "primeintellect"} | OK, my warriors! Now that you beat the big BOSS, you can unlock three new skills. (Does it sound like we're playing an RPG? ;-)
## The Arrow Function (JS only)
The first skill is the arrow function. Let's look at some examples to see how it works:
```python
#ignore this part, it is just for JS
```
As you can see, it... | 0 |
{"tests": "{\"inputs\": [\"5 10\\n2 5 2 2 3 5 3 2 1 3\\n\", \"1000 10\\n1 1 1 1 1 1000 1000 1000 1000 1000\\n\", \"10 20\\n6 3 9 6 1 9 1 9 8 2 7 6 9 8 4 7 1 2 4 2\\n\", \"100000 1\\n14542\\n\", \"100000 50\\n43104 45692 17950 43454 99127 33540 80887 7990 116 79790 66870 61322 5479 24876 7182 99165 81535 3498 54340 7460... | Ryouko is an extremely forgetful girl, she could even forget something that has just happened. So in order to remember, she takes a notebook with her, called Ryouko's Memory Note. She writes what she sees and what she hears on the notebook, and the notebook became her memory.
Though Ryouko is forgetful, she is also bo... | 0 |
{"tests": "{\"inputs\": [\"2,5,3\\n3,6,1\\n3,4,2\\n4,5,2\\n3,6,3\\n1,4,1\", \"2,5,3\\n1,6,3\\n3,4,2\\n4,5,2\\n3,6,3\\n2,4,1\", \"2,5,3\\n3,6,1\\n2,4,2\\n4,5,2\\n3,6,3\\n1,4,1\", \"2,5,3\\n3,6,1\\n3,4,2\\n5,5,2\\n3,6,3\\n1,4,1\", \"2,5,3\\n3,6,1\\n2,4,2\\n4,6,2\\n3,6,3\\n1,4,1\", \"2,5,3\\n3,6,1\\n3,4,2\\n4,5,2\\n3,6,3\... | As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (x, y) coordinate system.
We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as sho... | 0 |
{"tests": "{\"inputs\": [\"2\\n3\\n1 1 1\\nRPS\\n3\\n3 0 0\\nRPS\\n\", \"7\\n2\\n1 1 0\\nRR\\n2\\n2 0 0\\nSS\\n2\\n2 0 0\\nRR\\n3\\n1 2 0\\nRRR\\n3\\n2 1 0\\nRRR\\n1\\n1 0 0\\nP\\n1\\n1 0 0\\nS\\n\", \"1\\n19\\n2 8 9\\nRRPPPPPPPPSSSSSSSSS\\n\", \"1\\n19\\n2 8 9\\nRRPPPPPPPPSSSSSSSSS\\n\", \"7\\n2\\n1 1 0\\nRR\\n2\\n2 0... | Let $n$ be a positive integer. Let $a, b, c$ be nonnegative integers such that $a + b + c = n$.
Alice and Bob are gonna play rock-paper-scissors $n$ times. Alice knows the sequences of hands that Bob will play. However, Alice has to play rock $a$ times, paper $b$ times, and scissors $c$ times.
Alice wins if she beats... | 0.375 |
{"tests": "{\"inputs\": [[1, 2, 3], [2, 3, 4], [5, 6, 1], [7, 1, 1], [0, 1, 0], [-20, 2, 2], [10000000000, 2, 2]], \"outputs\": [[[[1, 2, 3], [4, 5, 6]]], [[[2, 3, 4, 5], [6, 7, 8, 9], [10, 11, 12, 13]]], [[[5], [6], [7], [8], [9], [10]]], [[[7]]], [[[]]], [[[-20, -19], [-18, -17]]], [[[10000000000, 10000000001], [1000... | Make the 2D list by the sequential integers started by the ```head``` number.
See the example test cases for the expected output.
```
Note:
-10**20 < the head number <10**20
1 <= the number of rows <= 1000
0 <= the number of columms <= 1000
```
Write your solution by modifying this code:
```python
def make_2d_l... | 0 |
{"tests": "{\"inputs\": [\"2\\n1.0\\n4.0\\n12.0\\n16.0\\n25.0\\n1\\n-30.5893962764\\n5.76397083962\\n39.3853798058\\n74.3727663177\\n0\\n42.4715310246\\n79.5420238202\\n28.0282396675\\n-30.3627807522\\n-49.8363481393\\n-25.5101480106\\n7.58575761381\\n5\\n-21.9161699038\\n-48.469304271\\n-24.3188578417\\n-2.35085940324... | Professor Abacus has just built a new computing engine for making numerical tables. It was designed to calculate the values of a polynomial function in one variable at several points at a time. With the polynomial function f(x) = x2 + 2x + 1, for instance, a possible expected calculation result is 1 (= f(0)), 4 (= f(1)... | 0 |
{"tests": "{\"inputs\": [\"15\\n3\\n1\\n4\\n1\\n5\\n9\\n2\\n6\\n5\\n3\\n5\\n8\\n9\\n6\\n9\", \"3\\n3\\n2\\n10\", \"3\\n6\\n2\\n10\", \"3\\n6\\n3\\n10\", \"3\\n7\\n3\\n10\", \"3\\n7\\n5\\n10\", \"3\\n7\\n9\\n10\", \"3\\n7\\n13\\n10\", \"15\\n3\\n1\\n4\\n1\\n5\\n9\\n2\\n11\\n5\\n3\\n5\\n8\\n9\\n7\\n9\", \"15\\n3\\n1\\n1\... | N people are waiting in a single line in front of the Takahashi Store. The cash on hand of the i-th person from the front of the line is a positive integer A_i.
Mr. Takahashi, the shop owner, has decided on the following scheme: He picks a product, sets a positive integer P indicating its price, and shows this product... | 0 |
{"tests": "{\"inputs\": [\"9 530792195 6\\n\", \"0 0 10\\n\", \"1944219055 454183506 1369298327\\n\", \"914835 2742837 9234739\\n\", \"10 10 0\\n\", \"2 2 0\\n\", \"0 0 1\\n\", \"3 10 1007169359\\n\", \"0 1 0\\n\", \"1016450951 2 9\\n\", \"0 2 10\\n\", \"2147483648 0 2147483647\\n\", \"92134834 23742837 92374738\\n\", ... | Flatland is inhabited by pixels of three colors: red, green and blue. We know that if two pixels of different colors meet in a violent fight, only one of them survives the fight (that is, the total number of pixels decreases by one). Besides, if pixels of colors x and y (x ≠ y) meet in a violent fight, then the pixel t... | 0 |
{"tests": "{\"inputs\": [\"3\\n......\\n......\\n......\\n......\\n......\\n......\\n......\\n......\\n.RGB..\\nRGOP..\\nRGBPB.\\nRGBPP.\\nGBRGYP\\nGBRRYP\\nBGGRBB\\nBPRGYY\\nGGPRRY\\nBYPPRB\\nYGGGPB\\nRPYYYG\\nYRBRBR\\nYBRBRB\\nBRBRBR\\nBRBRBR\\n......\\n......\\n......\\n......\\n......\\n......\\n......\\n......\\n.... | Masa Kita, who entered the University of Tokyo, joined a circle called TSG (University of Tokyo Super Gamers).
This circle exhibits games at the Komaba Festival every year, and Masa Kita decided to create and display the games as well.
The game created by Kitamasa is a common falling block puzzle game such as the fol... | 0 |
{"tests": "{\"inputs\": [[\"\"], [\"abc\"], [\"aab\"], [\"hello world!\"], [\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbb\"]], \"outputs\": [[[]], [[[1, \"a\"], [1, \"b\"], [1, \"c\"]]], [[[2, \"a\"], [1, \"b\"]]], [[[1, \"h\"], [1, \"e\"], [2, \"l\"], [1, \"o\"], [1, \" \"], [1, \"w\"], [1, \"o\"], [1, \"r\"], [1, \"l\"], [... | > [Run-length encoding](https://en.wikipedia.org/w/index.php?title=Run-length_encoding) (RLE) is a very simple form of data compression in which runs of data (that is, sequences in which the same data value occurs in many consecutive data elements) are stored as a single data value and count, rather than as the origina... | 0 |
{"tests": "{\"inputs\": [\"36 17\", \"4 2\", \"36 18\", \"4 3\", \"36 22\", \"59 22\", \"3 2\", \"49 17\", \"4 0\", \"36 9\", \"4 1\", \"29 22\", \"59 35\", \"6 1\", \"62 9\", \"8 1\", \"72 35\", \"12 1\", \"88 9\", \"72 32\", \"5 1\", \"3 3\", \"41 17\", \"2 1\", \"36 12\", \"13 1\", \"59 39\", \"3 1\", \"49 7\", \"26... | Consider the following game:
* The game is played using a row of N squares and many stones.
* First, a_i stones are put in Square i\ (1 \leq i \leq N).
* A player can perform the following operation as many time as desired: "Select an integer i such that Square i contains exactly i stones. Remove all the stones from S... | 0 |
{"tests": "{\"inputs\": [\"1 30 2\\n1 1 32443264\\n1 1 1337\\n\", \"20 10 20\\n9 12 48\\n13 14 527\\n6 6 343\\n13 15 5\\n12 14 515\\n8 11 0\\n10 14 0\\n6 9 256\\n16 16 767\\n8 12 0\\n12 14 515\\n16 17 630\\n6 8 324\\n15 15 101\\n8 9 904\\n5 6 85\\n19 20 22\\n17 17 886\\n1 5 0\\n18 18 1019\\n\", \"20 4 10\\n11 16 0\\n4 ... | You are given three integers n, k, m and m conditions (l_1, r_1, x_1), (l_2, r_2, x_2), ..., (l_m, r_m, x_m).
Calculate the number of distinct arrays a, consisting of n integers such that:
* 0 ≤ a_i < 2^k for each 1 ≤ i ≤ n;
* bitwise AND of numbers a[l_i] \& a[l_i + 1] \& ... \& a[r_i] = x_i for each 1 ≤ i ≤ m... | 0 |
{"tests": "{\"inputs\": [\"3 2 30 3 26 226\\n9 0 18 3 20 118\\n5 5 12 0 15 203\\n7 4 19 2 22 197\\n7 4 24 4 17 209\\n0 0 0 0 0 0\", \"3 2 30 3 41 226\\n9 0 18 3 20 118\\n5 5 12 0 15 203\\n7 4 19 2 22 197\\n7 4 24 4 17 209\\n0 0 0 0 0 0\", \"3 2 30 3 41 226\\n9 0 18 4 20 118\\n5 5 12 0 15 203\\n7 4 19 2 22 197\\n7 4 24 ... | Ataru Oafoot of Aizu Gakuen University High School decided to play with a slot machine.
When you insert a medal on this machine, three reels will start spinning and each reel will stop automatically. In a normal game (normal game), 3 medals are inserted, and when the symbols are aligned, the following medals are obtai... | 0 |
{"tests": "{\"inputs\": [\"10 8 3\", \"1000000000000000000 1000000000000000000 1001\", \"5 2 3\", \"10 8 6\", \"2 2 2\", \"1 10 1\", \"10 6 6\", \"2 3 2\", \"2 10 2\", \"2 11 2\", \"3 5 3\", \"6 5 3\", \"6 5 2\", \"6 8 2\", \"12 8 2\", \"9 8 2\", \"9 15 2\", \"9 16 2\", \"9 20 2\", \"9 20 0\", \"7 20 0\", \"5 12 3\", \... | Problem
There are $ M $ type characters. Use them to create a string of length $ N $. How many strings are used that have $ K $ or more? Find too much divided by $ 998244353 $.
Here, the difference between two strings of length $ N $ is defined as follows.
* If the two strings are $ S = S_1S_2 \ ldots S_N $, $ T = T... | 0.125 |
{"tests": "{\"inputs\": [\"4\\n+\\n- 1\\n+\\n+\\n- 4\\n+\\n- 2\\n- 3\\n\", \"4\\n+\\n+\\n+\\n- 3\\n- 4\\n+\\n- 1\\n- 2\\n\", \"10\\n+\\n- 3\\n+\\n+\\n+\\n+\\n- 1\\n- 7\\n- 9\\n- 10\\n+\\n+\\n+\\n- 4\\n- 5\\n- 8\\n+\\n+\\n- 6\\n- 2\\n\", \"5\\n+\\n+\\n+\\n- 3\\n- 4\\n+\\n- 1\\n- 2\\n+\\n- 5\\n\", \"5\\n+\\n- 5\\n+\\n+\\... | Tenten runs a weapon shop for ninjas. Today she is willing to sell n shurikens which cost 1, 2, ..., n ryo (local currency). During a day, Tenten will place the shurikens onto the showcase, which is empty at the beginning of the day. Her job is fairly simple: sometimes Tenten places another shuriken (from the available... | 0.25 |
{"tests": "{\"inputs\": [[[4, 0], 1, false, [2, 2, 2, 2, 2]], [[4, 2], 1, true, [2, 2, 2, 2, 2]], [[4, 4], 2, false, [2, 2, 2, 2, 2]], [[4, 6], 2, true, [2, 2, 2, 2, 2]], [[7, 2], 1, false, [1, 2, 2, 2, 2]], [[7, 4], 1, true, [1, 2, 2, 2, 2]], [[7, 6], 2, false, [1, 2, 2, 2, 2]], [[7, 7], 2, true, [1, 2, 2, 2, 2]], [[5... | You are playing euchre and you want to know the new score after finishing a hand. There are two teams and each hand consists of 5 tricks. The team who wins the majority of the tricks will win points but the number of points varies. To determine the number of points, you must know which team called trump, how many trick... | 0 |
{"tests": "{\"inputs\": [[\"Ryan\"], [2.3], [26], [true], [\"True\"], [false], [1.98528462]], \"outputs\": [[\"Who ate the last cookie? It was Zach!\"], [\"Who ate the last cookie? It was Monica!\"], [\"Who ate the last cookie? It was Monica!\"], [\"Who ate the last cookie? It was the dog!\"], [\"Who ate the last cooki... | For this problem you must create a program that says who ate the last cookie. If the input is a string then "Zach" ate the cookie. If the input is a float or an int then "Monica" ate the cookie. If the input is anything else "the dog" ate the cookie. The way to return the statement is:
"Who ate the last cookie? It was ... | 0 |
{"tests": "{\"inputs\": [\"3 2\\n0 2 1\\n\", \"5 1\\n0 1 2 3 4\\n\", \"6 200000\\n0 1 2 3 4 5\\n\", \"7 6\\n3 2 4 1 0 5 6\\n\", \"1 1\\n0\\n\", \"1 200000\\n0\\n\", \"73 95\\n4 53 37 9 45 54 16 34 12 10 13 24 2 36 33 48 50 43 15 11 47 42 46 30 27 52 67 72 66 19 56 61 69 21 68 1 70 49 64 62 3 51 44 65 29 25 38 28 8 5 39... | Once upon a time, Oolimry saw a suffix array. He wondered how many strings can produce this suffix array.
More formally, given a suffix array of length $n$ and having an alphabet size $k$, count the number of strings that produce such a suffix array.
Let $s$ be a string of length $n$. Then the $i$-th suffix of $s$ is... | 0 |
{"tests": "{\"inputs\": [\"3 20\\n5\\n11\\n3\", \"3 20\\n5\\n11\\n6\", \"3 20\\n1\\n11\\n6\", \"3 20\\n1\\n3\\n6\", \"3 20\\n1\\n3\\n3\", \"3 25\\n1\\n3\\n3\", \"3 35\\n1\\n3\\n3\", \"3 35\\n1\\n3\\n4\", \"3 55\\n1\\n3\\n4\", \"3 55\\n1\\n3\\n0\", \"3 55\\n1\\n4\\n0\", \"3 55\\n2\\n4\\n0\", \"3 20\\n7\\n7\\n3\", \"3 20... | Problem C Medical Checkup
Students of the university have to go for a medical checkup, consisting of lots of checkup items, numbered 1, 2, 3, and so on.
Students are now forming a long queue, waiting for the checkup to start. Students are also numbered 1, 2, 3, and so on, from the top of the queue. They have to under... | 0 |
{"tests": "{\"inputs\": [[10, 2], [63, 7], [2450, 5], [24612, 3], [9, 2], [653, 7], [2453, 5], [24617, 3]], \"outputs\": [[true], [true], [true], [true], [false], [false], [false], [false]]}", "source": "primeintellect"} | This function should test if the `factor` is a factor of `base`.
Return `true` if it is a factor or `false` if it is not.
## About factors
Factors are numbers you can multiply together to get another number.
2 and 3 are factors of 6 because: `2 * 3 = 6`
- You can find a factor by dividing numbers. If the remainder ... | 0 |
{"tests": "{\"inputs\": [\"5\\n72\\n72\\n30\\n75\\n11\\n\", \"5\\n79\\n149\\n136\\n194\\n124\\n\", \"6\\n885\\n419\\n821\\n635\\n63\\n480\\n\", \"1\\n1000000000\\n\", \"5\\n3\\n6\\n9\\n10\\n5\\n\", \"5\\n5\\n8\\n18\\n17\\n17\\n\", \"1\\n649580447\\n\", \"5\\n7\\n40\\n37\\n25\\n4\\n\", \"5\\n80\\n72\\n30\\n75\\n11\\n\",... | Let's assume that
* v(n) is the largest prime number, that does not exceed n;
* u(n) is the smallest prime number strictly greater than n.
Find <image>.
Input
The first line contains integer t (1 ≤ t ≤ 500) — the number of testscases.
Each of the following t lines of the input contains integer n (2 ≤ n ≤ ... | 0 |
{"tests": "{\"inputs\": [\"1000 1000 1 1 10\\n1\\n2\\n1\\n1 900 1 1000\\n\", \"2 4 1 1 1\\n1\\n4\\n1\\n1 2 1 3\\n\", \"10 10 1 8 4\\n10\\n2 3 4 5 6 7 8 9\\n10\\n1 1 3 1\\n2 1 7 1\\n1 1 9 1\\n7 1 4 1\\n10 1 7 1\\n2 1 7 1\\n3 1 2 1\\n5 1 2 1\\n10 1 5 1\\n6 1 9 1\\n\", \"2 10 1 1 1\\n1\\n10\\n1\\n1 5 1 8\\n\", \"4 4 1 0 1... | In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on different floors are l... | 0 |
{"tests": "{\"inputs\": [\"4\\n800\\n700\\n1600\\n600\\n4\\n300\\n700\\n1600\\n30\\n4\\n300\\n700\\n1600\\n650\\n3\\n1000\\n2000\\n500\\n3\\n250\\n250\\n1000\\n4\\n1251\\n667\\n876\\n299\\n0\", \"4\\n800\\n700\\n1600\\n600\\n4\\n300\\n700\\n1600\\n30\\n4\\n300\\n700\\n1600\\n650\\n3\\n1000\\n2000\\n500\\n3\\n250\\n250\... | 500-yen Saving
"500-yen Saving" is one of Japanese famous methods to save money. The method is quite simple; whenever you receive a 500-yen coin in your change of shopping, put the coin to your 500-yen saving box. Typically, you will find more than one million yen in your saving box in ten years.
Some Japanese people... | 0 |
{"tests": "{\"inputs\": [\"4\\n5 5\\n1 2 3 4 5\\n7 4\\n-6 -5 -3 0\\n3 3\\n2 3 4\\n3 2\\n3 4\\n\", \"1\\n2 2\\n0 -1\\n\", \"1\\n7 4\\n-6 -7 -8 -9\\n\", \"1\\n3 2\\n-4 -6\\n\", \"1\\n4 2\\n-7 -9\\n\", \"1\\n3 2\\n-10 -12\\n\", \"1\\n3 2\\n-8 -12\\n\", \"1\\n5 1\\n-10\\n\", \"1\\n4 3\\n-3 -4 -4\\n\", \"1\\n5 1\\n-4\\n\", ... | Suppose $a_1, a_2, \dots, a_n$ is a sorted integer sequence of length $n$ such that $a_1 \leq a_2 \leq \dots \leq a_n$.
For every $1 \leq i \leq n$, the prefix sum $s_i$ of the first $i$ terms $a_1, a_2, \dots, a_i$ is defined by $$ s_i = \sum_{k=1}^i a_k = a_1 + a_2 + \dots + a_i. $$
Now you are given the last $k$ t... | 0 |
{"tests": "{\"inputs\": [[\"GTCTTAGTGTAGCTATGCATGC\", \"GCATGCATAGCTACACTACGAC\"], [\"ATGCTACG\", \"CGTAGCAT\"], [\"AGTCTGTATGCATCGTACCC\", \"GGGTACGATGCATACAGACT\"], [\"TGCTACGTACGATCGACGATCCACGAC\", \"GTCGTGGATCGTCGATCGTACGTAGCA\"], [\"ATGCCTACGGCCATATATATTTAG\", \"CTAAATATGTATGGCCGTAGGCAT\"], [\"GTCACCGA\", \"TCGGCT... | DNA is a biomolecule that carries genetic information. It is composed of four different building blocks, called nucleotides: adenine (A), thymine (T), cytosine (C) and guanine (G). Two DNA strands join to form a double helix, whereby the nucleotides of one strand bond to the nucleotides of the other strand at the corre... | 0 |
{"tests": "{\"inputs\": [[12], [6], [50], [44], [625], [5], [7100], [123456], [1234567], [7654321], [4], [7654322]], \"outputs\": [[[1, 2, 3, 7, 9]], [null], [[1, 3, 5, 8, 49]], [[2, 3, 5, 7, 43]], [[2, 5, 8, 34, 624]], [[3, 4]], [[2, 3, 5, 119, 7099]], [[1, 2, 7, 29, 496, 123455]], [[2, 8, 32, 1571, 1234566]], [[6, 10... | My little sister came back home from school with the following task:
given a squared sheet of paper she has to cut it in pieces
which, when assembled, give squares the sides of which form
an increasing sequence of numbers.
At the beginning it was lot of fun but little by little we were tired of seeing the pile of torn ... | 0 |
{"tests": "{\"inputs\": [\"2 10\\n1 2 9\\n1 2 9\\n2 1 9\\n1 2 8\\n2 1 9\\n1 2 9\\n1 2 9\\n1 2 11\\n1 2 9\\n1 2 9\\n\", \"4 4\\n1 3 1953\\n3 2 2844\\n1 3 2377\\n3 2 2037\\n\", \"2 1\\n2 2 44\\n\", \"4 8\\n1 2 4824\\n3 1 436\\n2 2 3087\\n2 4 2955\\n2 4 2676\\n4 3 2971\\n3 4 3185\\n3 1 3671\\n\", \"15 14\\n1 2 1\\n2 3 1\\... | You are given undirected weighted graph. Find the length of the shortest cycle which starts from the vertex 1 and passes throught all the edges at least once. Graph may contain multiply edges between a pair of vertices and loops (edges from the vertex to itself).
Input
The first line of the input contains two integer... | 0 |
{"tests": "{\"inputs\": [\"2\\n3 2\\n1 3 5\\n4 1\\n5 2 3 5\\n\", \"1\\n3 1383\\n1 2 3\\n\", \"1\\n3 3\\n1 2 3\\n\", \"1\\n3 1383\\n1 2 3\\n\", \"1\\n3 3\\n1 2 3\\n\", \"1\\n2 1383\\n1 2 3\\n\", \"2\\n3 2\\n1 3 5\\n4 1\\n5 4 3 5\\n\", \"2\\n3 2\\n1 1 5\\n4 1\\n5 4 3 5\\n\", \"2\\n3 2\\n0 1 5\\n4 1\\n5 2 3 5\\n\", \"1\\n... | Ivan plays an old action game called Heretic. He's stuck on one of the final levels of this game, so he needs some help with killing the monsters.
The main part of the level is a large corridor (so large and narrow that it can be represented as an infinite coordinate line). The corridor is divided into two parts; let'... | 0.25 |
{"tests": "{\"inputs\": [\"666660666\\n62238520449600706121638\\n20202202000333003330333\", \"666660666\\n62238520449600706121638\\n20470251257982382367886\", \"666660666\\n79768964391256325078385\\n20470251257982382367886\", \"666660666\\n79768964391256325078385\\n25978567800744130697792\", \"666660666\\n5599997477344... | She loves e-mail so much! She sends e-mails by her cellular phone to her friends when she has breakfast, she talks with other friends, and even when she works in the library! Her cellular phone has somewhat simple layout (Figure 1). Pushing button 1 once displays a character (’), pushing
<image>
it twice in series di... | 0 |
{"tests": "{\"inputs\": [[\"1F-RUDYARD K1PL1NG\"], [\"R0BERT MERLE - THE DAY 0F THE D0LPH1N\"], [\"R1CHARD P. FEYNMAN - THE FEYNMAN LECTURE5 0N PHY51C5\"], [\"R1CHARD P. FEYNMAN - 5TAT15T1CAL MECHAN1C5\"], [\"5TEPHEN HAWK1NG - A BR1EF H15T0RY 0F T1ME\"], [\"5TEPHEN HAWK1NG - THE UN1VER5E 1N A NUT5HELL\"], [\"ERNE5T HEM... | Character recognition software is widely used to digitise printed texts. Thus the texts can be edited, searched and stored on a computer.
When documents (especially pretty old ones written with a typewriter), are digitised character recognition softwares often make mistakes.
Your task is correct the errors in the dig... | 0 |
{"tests": "{\"inputs\": [\"4\\n4\\n1 2 3\\n1 2 3\\n5\\n1 2 3 4\\n1 1 1 1\\n6\\n1 2 1 1 2\\n1 2 1 2 2\\n7\\n1 1 3 4 4 5\\n1 2 1 4 2 5\\n\", \"4\\n4\\n1 2 3\\n1 2 3\\n5\\n1 2 3 4\\n1 1 1 1\\n6\\n1 2 1 1 2\\n1 2 1 2 2\\n7\\n1 1 3 4 4 5\\n1 2 1 4 4 5\\n\", \"4\\n4\\n1 2 3\\n1 2 3\\n5\\n1 4 3 4\\n1 1 1 1\\n6\\n1 1 1 1 2\\n1... | Soroush and Keshi each have a labeled and rooted tree on n vertices. Both of their trees are rooted from vertex 1.
Soroush and Keshi used to be at war. After endless decades of fighting, they finally became allies to prepare a Codeforces round. To celebrate this fortunate event, they decided to make a memorial graph o... | 0 |
{"tests": "{\"inputs\": [[1], [8], [22], [100], [213]], \"outputs\": [[1], [36], [253], [5050], [22791]]}", "source": "primeintellect"} | # Summation
Write a program that finds the summation of every number from 1 to num. The number will always be a positive integer greater than 0.
For example:
```if-not:racket
~~~
summation(2) -> 3
1 + 2
summation(8) -> 36
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8
~~~
```
```if:racket
~~~racket
(summation 2) ; 3 (+ 1 2)
(summat... | 0 |
{"tests": "{\"inputs\": [\"7\\nShijo-Kawaramachi\\nKbrasuma-Imadegawa\\nKawaramachi-Imadegawa\\nNishioji-Shijo\\nKarasuma-Gojo\\nTorimaru-Rokujo\\nRokujo-Karasuma\\n6\\nShijo-Karasuma\\nImadegawa-Nishioji\\nNishioji-Gojo\\nShijo-Torimaru\\nTorimaru-Gojo\\nShijo-Kawabata\\n4\\n1jo-Midosuji\\nMidosuji-2jo\\n2jo-Omotesand... | The city of Kyoto is well-known for its Chinese plan: streets are either North-South or East-West. Some streets are numbered, but most of them have real names.
Crossings are named after the two streets crossing there, e.g. Kawaramachi-Sanjo is the crossing of Kawaramachi street and Sanjo street. But there is a problem:... | 0 |
{"tests": "{\"inputs\": [\"1\\n1\\n\", \"7\\n766 766 1477 766 107 1774 990\\n\", \"6\\n3 8 3 9 3 10\\n\", \"11\\n1552 1010 1552 1248 1550 388 1541 1010 613 1821 388\\n\", \"6\\n5 1 2 5 2 4\\n\", \"19\\n895 1302 724 952 340 952 939 1302 724 952 939 340 340 1844 770 976 435 1302 1302\\n\", \"3\\n1282 101 420\\n\", \"10\\... | It's time polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got down to business. In total, there are n tasks for the day and each animal should do each of these tasks. For each task, they have evaluated its difficulty. Also animals decided to do the tasks in order... | 0 |
{"tests": "{\"inputs\": [[[[\"apple\", \"orange\"], [\"orange\", \"pear\"], [\"apple\", \"pear\"]], \"apple\"], [[[\"orange\", \"apple\"], [\"orange\", \"pear\"], [\"pear\", \"apple\"]], \"apple\"], [[[\"apple\", \"orange\"], [\"pear\", \"orange\"], [\"apple\", \"pear\"]], \"apple\"], [[[\"orange\", \"apple\"], [\"pear... | You will be given a fruit which a farmer has harvested, your job is to see if you should buy or sell.
You will be given 3 pairs of fruit. Your task is to trade your harvested fruit back into your harvested fruit via the intermediate pair, you should return a string of 3 actions.
if you have harvested apples, you woul... | 0 |
{"tests": "{\"inputs\": [\"4\\n1 1\\n4 1\\n4 3\\n1 3\\n2\\n2 0 2 5\\n2 4 2 0\", \"4\\n1 1\\n4 1\\n4 3\\n0 3\\n2\\n2 0 2 5\\n2 4 2 0\", \"4\\n1 1\\n4 2\\n4 3\\n0 3\\n2\\n2 0 2 5\\n2 4 2 0\", \"4\\n1 1\\n4 2\\n4 3\\n0 3\\n2\\n2 0 2 5\\n0 4 2 0\", \"4\\n1 1\\n4 2\\n4 3\\n0 3\\n2\\n2 0 2 0\\n0 4 2 0\", \"4\\n1 1\\n4 2\\n4 ... | <image>
As shown in the figure above, cut a convex polygon g by a line p1p2 and print the area of the cut polygon which is on the left-hand side of the line.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n−1) are sides of the convex polygon. The line segm... | 0 |
{"tests": "{\"inputs\": [\"abb\", \"aaa\", \"baa\", \"bacba\", \"bba\", \"badba\", \"aa`\", \"aab\", \"cadba\", \"`aa\", \"bca\", \"dadba\", \"`ab\", \"acb\", \"ddaba\", \"``b\", \"aca\", \"dd`ba\", \"`_b\", \"bb`\", \"dd`b`\", \"b_`\", \"`bb\", \"ddb``\", \"c_`\", \"`cb\", \"ddba`\", \"`_c\", \"`bc\", \"ddaa`\", \"_`c... | There is a string s of length 3 or greater. No two neighboring characters in s are equal.
Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first:
* Remove one of the characters in s, excluding both ends. However, a character cannot b... | 0 |
{"tests": "{\"inputs\": [[12, 34, 56, 78], [2015, 8, 26], [276, 575], [643], [864, 896, 744], [364, 500, 715, 730], [93, 10, 11, 40], [1, 11, 111, 1111, 11111], [9, 87, 654, 3210]], \"outputs\": [[\"09\"], [\"3479\"], [\"013489\"], [\"0125789\"], [\"01235\"], [\"289\"], [\"25678\"], [\"023456789\"], [\"\"]]}", "source"... | Given few numbers, you need to print out the digits that are not being used.
Example:
```python
unused_digits(12, 34, 56, 78) # "09"
unused_digits(2015, 8, 26) # "3479"
```
Note:
- Result string should be sorted
- The test case won't pass Integer with leading zero
Write your solution by modifying this code:
```py... | 0 |
{"tests": "{\"inputs\": [[\"This is a string exemplification!\", 0], [\"String for test: incommensurability\", 1], [\"Ohh Man God Damn\", 7], [\"Ohh Man God Damnn\", 19], [\"I like it!\", 1234], [\"codingisfornerdsyounerd\", 10101010], [\"this_test_will_hurt_you\", 12345678987654321]], \"outputs\": [[\"This is a string... | This kata is blatantly copied from inspired by This Kata
Welcome
this is the second in the series of the string iterations kata!
Here we go!
---------------------------------------------------------------------------------
We have a string s
Let's say you start with this: "String"
The first thing you do is reve... | 0 |
{"tests": "{\"inputs\": [\"1 2000000000 10007\\n\", \"19431 20000000 17\\n\", \"1570000 800000000 30011\\n\", \"1000 2000000000 211\\n\", \"1999999000 2000000000 23\\n\", \"1 2000000000 23\\n\", \"44711 44711 44711\\n\", \"1 2000000000 44711\\n\", \"300303 600000 503\\n\", \"1000000000 2000000000 4001\\n\", \"5002230 1... | One quite ordinary day Valera went to school (there's nowhere else he should go on a week day). In a maths lesson his favorite teacher Ms. Evans told students about divisors. Despite the fact that Valera loved math, he didn't find this particular topic interesting. Even more, it seemed so boring that he fell asleep in ... | 0 |
{"tests": "{\"inputs\": [[388, 2, 3], [1750, 3, 5], [1728, 3, 4], [600000000, 2, 5], [900000000, 2, 5]], \"outputs\": [[[[23, 529], [24, 576], [25, 625]]], [[[13, 2197], [17, 4913], [18, 5832], [19, 6859], [21, 9261]]], [[[13, 2197], [17, 4913], [18, 5832], [19, 6859]]], [[25941, 672935481]], [[]]]}", "source": "primei... | A **pandigital number** is one that has its digits from ```1``` to ```9``` occuring only once (they do not have the digit 0).
The number ```169```, is the first pandigital square, higher than ```100```, having its square root, ```13```, pandigital too.
The number ```1728``` is the first pandigital cubic, higher than ... | 0 |
{"tests": "{\"inputs\": [\"3\\n1 1\\n2 1\\n1 7\\n\", \"12\\n1 1\\n2 1\\n1 7\\n1 1\\n2 1\\n1 7\\n1 1\\n2 1\\n1 7\\n1 1\\n2 1\\n1 7\\n\", \"1\\n99999 100000\\n\", \"1\\n99899 100000\\n\", \"1\\n99899 99899\\n\", \"3\\n1 1\\n2 1\\n96342 7\\n\", \"1\\n8627 2007\\n\", \"1\\n1000000 1000000\\n\", \"1\\n1000000 1\\n\", \"2\\n... | Alice and Bob play ping-pong with simplified rules.
During the game, the player serving the ball commences a play. The server strikes the ball then the receiver makes a return by hitting the ball back. Thereafter, the server and receiver must alternately make a return until one of them doesn't make a return.
The one ... | 0 |
{"tests": "{\"inputs\": [\"3\\n1 1 3\", \"5\\n3 4 3 4 3\", \"5\\n3 4 3 3 3\", \"3\\n0 2 2\", \"4\\n2 4 2 2\", \"3\\n4 2 2\", \"3\\n1 0 3\", \"3\\n0 2 4\", \"4\\n2 4 4 2\", \"3\\n4 0 2\", \"3\\n1 -1 3\", \"3\\n0 2 8\", \"4\\n2 4 3 2\", \"3\\n0 0 2\", \"3\\n2 -1 3\", \"3\\n0 1 8\", \"4\\n3 4 3 2\", \"3\\n2 -1 2\", \"3\\n... | There are N cats. We number them from 1 through N.
Each of the cats wears a hat. Cat i says: "there are exactly a_i different colors among the N - 1 hats worn by the cats except me."
Determine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.
Constraints
* 2 ≤ N ... | 0 |
{"tests": "{\"inputs\": [[\"I want to punch someone in the face\"], [\"uh!\"], [\"What the hell am I doing here? And where is my wallet? PETE SMASH!\"], [\"I want to punch someone in the face\", [\"someone\", \"face\"]], [\"I want to punch someone in the face\", [\"drink\", \"job\", \"girls\"]]], \"outputs\": [[\"I w**... | Our friendly friend Pete is really a nice person, but he tends to be rather... Inappropriate.
And possibly loud, if given enough ethanol and free rein, so we ask you to write a function that should take its not always "clean" speech and cover as much as possible of it, in order not to offend some more sensible spirits... | 0 |
{"tests": "{\"inputs\": [\"12\\n12 3\\nzazasqzqsasq\\n1 1\\nz\\n1 1\\na\\n15 4\\nabccbaabccbazaa\\n16 8\\ncadjfdsljfdkljds\\n6 2\\nbaazaa\\n6 3\\nbosszb\\n6 1\\nqwerty\\n7 7\\ndaaaaaa\\n14 2\\nacabcbdeffewzd\\n18 6\\nzzzzzzzzzzzzyyyyyz\\n9 4\\naabaabbbc\\n\", \"12\\n12 3\\nzazasqzqsasq\\n1 1\\nz\\n1 1\\na\\n15 6\\nabcc... | You are given a string s consisting of lowercase English letters and a number k. Let's call a string consisting of lowercase English letters beautiful if the number of occurrences of each letter in that string is divisible by k. You are asked to find the lexicographically smallest beautiful string of length n, which is... | 0 |
{"tests": "{\"inputs\": [\"10\\n77 16 42 68 100 38 40 99 75 67\\n0 1 0 2 1 1 0 0 0\\n1\\n43\\n\", \"30\\n45 63 41 0 9 11 50 83 33 74 62 85 42 29 17 26 4 0 33 85 16 11 46 98 87 81 70 50 0 22\\n1 3 0 1 2 2 0 1 2 1 3 2 0 1 1 2 0 0 2 1 0 2 0 1 3 1 0 3 1\\n1\\n19\\n\", \"20\\n79 33 19 90 72 83 79 78 81 59 33 91 13 76 81 28 ... | This is the easy version of the problem. The only difference is that in this version q = 1. You can make hacks only if both versions of the problem are solved.
There is a process that takes place on arrays a and b of length n and length n-1 respectively.
The process is an infinite sequence of operations. Each operat... | 0 |
{"tests": "{\"inputs\": [\"25 16\\n..............#.\\n................\\n...#...#........\\n........#.#.....\\n..............##\\n..............#.\\n.......#........\\n......#.........\\n............#...\\n.........#.....#\\n..............#.\\n.......#........\\n#...........#...\\n...#.#..........\\n.#..............\\n... | There is a rectangular grid of n rows of m initially-white cells each.
Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and... | 0 |
{"tests": "{\"inputs\": [\"5 6\\n1 2 6 8 10\\n1 4\\n1 9\\n0 6\\n0 10\\n1 100\\n1 50\\n\", \"5 8\\n5 1 2 4 3\\n0 1\\n0 2\\n0 3\\n0 4\\n0 5\\n1 1000000000\\n1 1\\n1 500000000\\n\", \"5 6\\n1 2 6 8 10\\n1 4\\n1 9\\n0 6\\n0 10\\n1 100\\n1 5\\n\", \"5 6\\n1 2 6 5 10\\n1 4\\n1 9\\n0 6\\n0 10\\n1 100\\n1 50\\n\", \"5 4\\n5 1 ... | Vova decided to clean his room. The room can be represented as the coordinate axis $OX$. There are $n$ piles of trash in the room, coordinate of the $i$-th pile is the integer $p_i$. All piles have different coordinates.
Let's define a total cleanup as the following process. The goal of this process is to collect all ... | 0.125 |
{"tests": "{\"inputs\": [\"5\\n3\\n1 2 5\\n1 2 5\\n2\\n2 2\\n1 3\\n4\\n3 4 1 2\\n6 4 2 5\\n3\\n2 4 1\\n4 5 3\\n5\\n1 2 3 4 5\\n6 5 6 7 6\\n\", \"1\\n5\\n4 4 4 4 4\\n3 3 3 3 3\\n\", \"1\\n4\\n1 1 1 1\\n40000000 40000000 40000000 40000000\\n\", \"1\\n2\\n10 10\\n1000000 1000000\\n\", \"1\\n2\\n1 1\\n1000000000 1000000000... | Given an array of integer $a_1, a_2, \ldots, a_n$. In one operation you can make $a_i := a_i + 1$ if $i < n$ and $a_i \leq a_{i + 1}$, or $i = n$ and $a_i \leq a_1$.
You need to check whether the array $a_1, a_2, \ldots, a_n$ can become equal to the array $b_1, b_2, \ldots, b_n$ in some number of operations (possibly,... | 0 |
{"tests": "{\"inputs\": [[\"drake\"], [\"scholarstem\"], [\"codewars\"], [\"high fives!\"], [\"\"], [\"i\"], [\"b\"]], \"outputs\": [[\"drk\"], [\"schlrstm\"], [\"cdwrs\"], [\"hgh fvs!\"], [\"\"], [\"\"], [\"b\"]]}", "source": "primeintellect"} | **This Kata is intended as a small challenge for my students**
Create a function, called ``removeVowels`` (or ``remove_vowels``), that takes a string argument and returns that same string with all vowels removed (vowels are "a", "e", "i", "o", "u").
Write your solution by modifying this code:
```python
def remove_vo... | 0 |
{"tests": "{\"inputs\": [[\"Dermatoglyphics\"], [\"isogram\"], [\"moose\"], [\"isIsogram\"], [\"aba\"], [\"moOse\"], [\"thumbscrewjapingly\"], [\"abcdefghijklmnopqrstuvwxyz\"], [\"abcdefghijklmnopqrstuwwxyz\"], [\"\"]], \"outputs\": [[true], [true], [false], [false], [false], [false], [true], [true], [false], [true]]}"... | An isogram is a word that has no repeating letters, consecutive or non-consecutive. Implement a function that determines whether a string that contains only letters is an isogram. Assume the empty string is an isogram. Ignore letter case.
```python
is_isogram("Dermatoglyphics" ) == true
is_isogram("aba" ) == false
is_... | 0 |
{"tests": "{\"inputs\": [\"0 0 10\\n300 300 13\\n500 -500 16\\n\", \"0 0 10\\n300 300 12\\n500 -500 14\\n\", \"0 0 10\\n300 300 15\\n500 -500 20\\n\", \"0 0 10\\n300 300 11\\n500 -500 12\\n\", \"0 0 30\\n300 300 30\\n500 -500 20\\n\", \"0 0 10\\n300 300 21\\n500 -500 42\\n\", \"614 163 21\\n613 -468 18\\n-749 679 25\\n... | The Olympic Games in Bercouver are in full swing now. Here everyone has their own objectives: sportsmen compete for medals, and sport commentators compete for more convenient positions to give a running commentary. Today the main sport events take place at three round stadiums, and the commentator's objective is to cho... | 0 |
{"tests": "{\"inputs\": [[[1, 5, 27, 4]], [[64, 64, 27, 64]], [[75, 226, 113, 340]], [[340, 113, 226, 75]], [[75, 113, 226, 75]]], \"outputs\": [[27], [27], [75], [75], [75]]}", "source": "primeintellect"} | ##Background - the Collatz Conjecture:
Imagine you are given a positive integer, `n`, then:
* if `n` is even, calculate: `n / 2`
* if `n` is odd, calculate: `3 * n + 1`
Repeat until your answer is `1`. The Collatz conjecture states that performing this operation repeatedly, you will always eventually reach `1`.
You... | 0 |
{"tests": "{\"inputs\": [[\"Jeong-Ho Aristotelis\"], [\"Abishai Charalampos\"], [\"Idwal Augustin\"], [\"Hadufuns John\", 20], [\"Zoroaster Donnchadh\"], [\"Claude Miljenko\"], [\"Werner Vigi\", 15], [\"Anani Fridumar\"], [\"Paolo Oli\"], [\"Hjalmar Liupold\", 40], [\"Simon Eadwulf\"]], \"outputs\": [[600], [570], [420... | You can print your name on a billboard ad. Find out how much it will cost you. Each letter has a default price of £30, but that can be different if you are given 2 parameters instead of 1.
You can not use multiplier "*" operator.
If your name would be Jeong-Ho Aristotelis, ad would cost £600.
20 leters * 30 = 600 (Sp... | 0 |
{"tests": "{\"inputs\": [\"1 2\\n8 8\\n0 0\\n0 1\\n3 3\\n1 2 5\\n2 8 3\\n0 1 2\\n0 0\\n2 2\\n3 3\\n1 2 5\\n2 8 6\\n0 1 2\\n0 0\\n1 2\\n2 2\\n1 2\\n3 4\\n0 0\\n0 1\\n2 3\\n1 2 3\\n4 5 6\\n0 0\\n1 2\\n0 0\", \"1 2\\n8 8\\n0 0\\n0 1\\n3 3\\n1 3 5\\n2 13 1\\n0 1 2\\n0 0\\n2 2\\n3 3\\n1 2 4\\n2 8 6\\n0 1 2\\n0 0\\n1 2\\n2 2... | The north country is conquered by the great shogun-sama (which means king). Recently many beautiful dice which were made by order of the great shogun-sama were given to all citizens of the country. All citizens received the beautiful dice with a tear of delight. Now they are enthusiastically playing a game with the dic... | 0 |
{"tests": "{\"inputs\": [\"noon\\n5\\n\", \"lsdijfjisl\\n1\\n\", \"lsdijfjisl\\n209\\n\", \"nsngnnnnnnnnnnvnnnnnbe\\n948\\n\", \"squirrel\\n32\\n\", \"cnonnpbnpptppgntggtggtngpptppnbpnnonc\\n294295\\n\", \"k\\n46277432\\n\", \"nevceypryxidffdixyrpyecven\\n2916\\n\", \"yosupo\\n2\\n\", \"irrjoktogwxektwrfihfjtertgdhttkt... | Mr. Kitayuta has kindly given you a string s consisting of lowercase English letters. You are asked to insert exactly n lowercase English letters into s to make it a palindrome. (A palindrome is a string that reads the same forward and backward. For example, "noon", "testset" and "a" are all palindromes, while "test" a... | 0 |
{"tests": "{\"inputs\": [\"1\\nD A C\\n1\\nE B C\\n2\\nE A B\\n0\", \"1\\nD A C\\n1\\nE B C\\n2\\nF A B\\n0\", \"1\\nD A C\\n0\\nE B C\\n2\\nF A B\\n0\", \"1\\nC A C\\n0\\nE B C\\n2\\nF A B\\n0\", \"1\\nE A B\\n1\\nE B C\\n2\\nE A B\\n0\", \"1\\nD A C\\n1\\nE A D\\n2\\nF A B\\n0\", \"1\\nC A D\\n1\\nD B C\\n2\\nF A B\\... | Dr. Asimov, a robotics researcher, loves to research, but hates houseworks and his house were really dirty. So, he has developed a cleaning robot.
As shown in the following figure, his house has 9 rooms, where each room is identified by an alphabet:
<image>
The robot he developed operates as follows:
* If the bat... | 0 |
{"tests": "{\"inputs\": [[9, 7], [15, 15], [18, 21], [19, 17], [24, 24], [25, 25], [26, 26], [27, 27], [56, 64]], \"outputs\": [[[0, 0]], [[1, 1]], [[1, 1]], [[1, 1]], [[2, 2]], [[2, 2]], [[2, 2]], [[2, 2]], [[10, 10]]]}", "source": "primeintellect"} | This is related to my other Kata about cats and dogs.
# Kata Task
I have a cat and a dog which I got as kitten / puppy.
I forget when that was, but I do know their current ages as `catYears` and `dogYears`.
Find how long I have owned each of my pets and return as a list [`ownedCat`, `ownedDog`]
NOTES:
* Results ar... | 0 |
{"tests": "{\"inputs\": [\"4\\n2\\n1 1\\n3\\n1 31 12\\n3\\n12345 67 84\\n9\\n1 2 3 4 5 6 7 8 9\\n\", \"4\\n2\\n1 1\\n3\\n1 31 12\\n3\\n12345 67 98\\n9\\n1 2 3 4 5 6 7 8 9\\n\", \"4\\n2\\n1 1\\n3\\n1 31 12\\n3\\n12345 67 98\\n9\\n1 2 3 4 4 6 7 8 9\\n\", \"4\\n2\\n1 1\\n3\\n1 31 12\\n3\\n21646 67 98\\n9\\n1 2 3 4 4 6 7 8... | It is Borya's eleventh birthday, and he has got a great present: n cards with numbers. The i-th card has the number a_{i} written on it. Borya wants to put his cards in a row to get one greater number. For example, if Borya has cards with numbers 1, 31, and 12, and he puts them in a row in this order, he would get a nu... | 0 |
{"tests": "{\"inputs\": [\"7 0\", \"1001000000 1000000000\", \"6 5\", \"1001000000 1100000000\", \"3 5\", \"1001000010 1100000000\", \"3 6\", \"1001000010 1100100000\", \"1001000011 1100100000\", \"3 1\", \"9 -1\", \"1001000011 1000100000\", \"3 2\", \"1001000011 1000000000\", \"4 2\", \"1001000111 1000000000\", \"4 3\... | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements?
Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | 0 |
{"tests": "{\"inputs\": [\"3\\n6 2 4\\n\", \"5\\n9 8 7 3 1\\n\", \"2\\n1 1\\n\", \"10\\n648137704891 648137704891 648137704891 648137704891 648137704891 648137704891 648137704891 648137704891 648137704891 724560300002\\n\", \"2\\n999985999949 999981999937\\n\", \"5\\n169999847 169999847 169999847 300469729580 169999847... | Kuroni is very angry at the other setters for using him as a theme! As a punishment, he forced them to solve the following problem:
You have an array $a$ consisting of $n$ positive integers. An operation consists of choosing an element and either adding $1$ to it or subtracting $1$ from it, such that the element remai... | 0 |
{"tests": "{\"inputs\": [\"119107271329329921\", \"27\", \"5\", \"9\", \"7\", \"8\", \"11\", \"6\", \"10\", \"12\", \"20\", \"33213408621377322\", \"45\", \"26939847318901699\", \"12809773843701327\", \"15368855316243065\", \"15\", \"5452054052106793\", \"18\", \"4107947535538903\", \"14\", \"5955896644305351\", \"7789... | There are N people (with different names) and K clubs. For each club you know the list of members (so you have K unordered lists). Each person can be a member of many clubs (and also 0 clubs) and two different clubs might have exactly the same members. The value of the number K is the minimum possible such that the fol... | 0.875 |
{"tests": "{\"inputs\": [[[1, 2, 3], [1, 2, 3]], [[1, 2, 3], [4, 5, 6]], [[1, 2, 4, 6, 7], [2, 3, 4, 7]], [[1, 2, 6, 8, 9], [0, 1, 4, 5, 6, 8, 9]], [[0, 1, 3, 4, 5, 6, 9, 14, 15, 16, 17, 18, 19], [1, 4, 10, 12, 13, 14, 15, 16]]], \"outputs\": [[1], [0], [0.5], [0.5], [0.3125]]}", "source": "primeintellect"} | # Task
Your task is to find the similarity of given sorted arrays `a` and `b`, which is defined as follows:
you take the number of elements which are present in both arrays and divide it by the number of elements which are present in at least one array.
It also can be written as a formula `similarity(A, B) = #(A... | 0 |
{"tests": "{\"inputs\": [\"-1 0 1 2\", \"-2 -2 1 2\", \"-1 0 1 4\", \"-1 0 1 0\", \"-2 -2 0 4\", \"-2 0 1 0\", \"-4 -2 0 4\", \"0 0 1 0\", \"-4 -4 0 4\", \"-4 0 0 4\", \"-4 0 0 0\", \"0 0 0 2\", \"-2 -1 1 1\", \"-1 -1 1 2\", \"-2 -3 1 2\", \"-2 -2 -1 2\", \"-2 -2 0 5\", \"-4 -1 0 4\", \"0 0 0 0\", \"-4 -8 0 4\", \"-4 -... | Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis pointing right and the positive y-axis pointing up.
Currently, he is located at the point (sx,sy). In each second, he can move up, down, left or right by a distance of 1.
Here, both the x- and y-coordinates before and after each movement must ... | 0 |
{"tests": "{\"inputs\": [\"8\\n5 2\\nWLWLL\\n6 5\\nLLLWWL\\n7 1\\nLWLWLWL\\n15 5\\nWWWLLLWWWLLLWWW\\n40 7\\nLLWLWLWWWLWLLWLWWWLWLLWLLWLLLLWLLWWWLWWL\\n1 0\\nL\\n1 1\\nL\\n6 1\\nWLLWLW\\n\", \"8\\n5 2\\nWLWLL\\n6 5\\nLLLWWL\\n7 2\\nLWLWLWL\\n15 5\\nWWWLLLWWWLLLWWW\\n40 7\\nLLWLWLWWWLWLLWLWWWLWLLWLLWLLLLWLLWWWLWWL\\n1 0\... | You like playing chess tournaments online.
In your last tournament you played $n$ games. For the sake of this problem, each chess game is either won or lost (no draws). When you lose a game you get $0$ points. When you win you get $1$ or $2$ points: if you have won also the previous game you get $2$ points, otherwise ... | 0 |
{"tests": "{\"inputs\": [\"3 3 10\\n10 9 6\\n14 7 3\\n7 5 1\", \"3 3 10\\n10 8 13\\n14 3 4\\n5 5 1\", \"3 3 10\\n10 8 13\\n14 3 4\\n5 4 1\", \"1 2 5\\n4\\n10000\", \"2 3 5\\n4 5\\n6 3\\n8 6\", \"2 2 6\\n3 2\\n5 4\", \"3 3 10\\n10 9 6\\n11 7 3\\n7 5 1\", \"3 3 10\\n10 4 6\\n14 7 3\\n7 5 1\", \"3 3 10\\n10 8 11\\n1 7 3\\... | After many years of research, Ikta has acquired the ability to predict the future! The time and money he spent on this research was enormous, but it's finally time to be rewarded. To get the money back, Ikta decided to start investing in stocks.
Ikta does not currently own any shares, but owns x yen. He has invested i... | 0.125 |
{"tests": "{\"inputs\": [\"10 100000\\n1 49856 954208\\n98389 98970 222740\\n78151 99991 323776\\n63089 100000 263298\\n19955 99994 342017\\n27228 99998 310177\\n13398 98500 187599\\n95925 99993 643614\\n36475 99999 556166\\n1224 98485 55420\\n\", \"4 10\\n6 10 4\\n1 5 7\\n2 6 5\\n5 9 8\\n\", \"7 10\\n1 4 13\\n5 6 10\\... | You are given n segments on a number line, numbered from 1 to n. The i-th segments covers all integer points from l_i to r_i and has a value w_i.
You are asked to select a subset of these segments (possibly, all of them). Once the subset is selected, it's possible to travel between two integer points if there exists a... | 0.25 |
{"tests": "{\"inputs\": [[\"\"], [\"aaaaa\"], [\"helLo world\"], [\"h^$&^#$&^elLo world\"], [\"0123456789\"], [\"012345_Cb\"]], \"outputs\": [[0], [0], [7], [7], [0], [2]]}", "source": "primeintellect"} | Write a function `consonantCount`, `consonant_count` or `ConsonantCount` that takes a string of English-language text and returns the number of consonants in the string.
Consonants are all letters used to write English excluding the vowels `a, e, i, o, u`.
Write your solution by modifying this code:
```python
def co... | 0 |
{"tests": "{\"inputs\": [[\"a1\", \"g5\"], [\"a3\", \"e4\"], [\"f3\", \"f2\"], [\"b7\", \"a8\"], [\"f7\", \"d3\"], [\"g2\", \"c3\"], [\"f3\", \"c1\"], [\"d4\", \"h8\"], [\"h6\", \"a7\"], [\"a6\", \"g3\"], [\"e1\", \"b4\"], [\"f4\", \"c4\"], [\"c3\", \"e8\"], [\"b5\", \"e5\"], [\"c8\", \"g8\"], [\"a6\", \"b5\"], [\"b3\"... | # Task
An `amazon` (also known as a queen+knight compound) is an imaginary chess piece that can move like a `queen` or a `knight` (or, equivalently, like a `rook`, `bishop`, or `knight`). The diagram below shows all squares which the amazon attacks from e4 (circles represent knight-like moves while crosses correspond ... | 0 |
{"tests": "{\"inputs\": [[[6, 2, 3, 4, 5]], [[14, 32, 3, 5, 5]], [[1, 2, 3, 4, 5]], [[\"Banana\", \"Orange\", \"Apple\", \"Mango\", 0, 2, 2]], [[\"C\", \"W\", \"W\", \"W\", 1, 2, 0]], [[\"Hackathon\", \"Katathon\", \"Code\", \"CodeWars\", \"Laptop\", \"Macbook\", \"JavaScript\", 1, 5, 2]], [[66, \"t\", 101, 0, 1, 1]], ... | Simple enough this one - you will be given an array. The values in the array will either be numbers or strings, or a mix of both. You will not get an empty array, nor a sparse one.
Your job is to return a single array that has first the numbers sorted in ascending order, followed by the strings sorted in alphabetic or... | 0 |
{"tests": "{\"inputs\": [[\"codwars.com\"], [\"http://codwars.com\"], [\"http://kcodwars.com\"], [\"https://www.codwars.com\"], [\"https://www.codwars.com/kata\"], [\"codewars.com.codwars.com\"], [\"https://www.codwars.com/kata?this=is&a=querystring\"], [\"https://this.is.an.unneccesarily.long.subdomain.codwars.com/kat... | A marine themed rival site to Codewars has started. Codwars is advertising their website all over the internet using subdomains to hide or obfuscate their domain to trick people into clicking on their site.
Your task is to write a function that accepts a URL as a string and determines if it would result in an http req... | 0 |
{"tests": "{\"inputs\": [[\"\"], [\"password\"], [\"P1@p\"], [\"P1@pP1@p\"], [\"P1@pP1@pP1@pP1@pP1@pP1@p\"]], \"outputs\": [[\"not valid\"], [\"not valid\"], [\"not valid\"], [\"valid\"], [\"not valid\"]]}", "source": "primeintellect"} | Your users passwords were all stole in the Yahoo! hack, and it turns out they have been lax in creating secure passwords. Create a function that checks their new password (passed as a string) to make sure it meets the following requirements:
Between 8 - 20 characters
Contains only the following characters: (and at ... | 0 |
{"tests": "{\"inputs\": [[50, 1.8], [80, 1.8], [90, 1.8], [110, 1.8], [50, 1.5]], \"outputs\": [[\"Underweight\"], [\"Normal\"], [\"Overweight\"], [\"Obese\"], [\"Normal\"]]}", "source": "primeintellect"} | Write function bmi that calculates body mass index (bmi = weight / height ^ 2).
if bmi <= 18.5 return "Underweight"
if bmi <= 25.0 return "Normal"
if bmi <= 30.0 return "Overweight"
if bmi > 30 return "Obese"
Write your solution by modifying this code:
```python
def bmi(weight, height):
```
Your solution shou... | 0 |
{"tests": "{\"inputs\": [[[]], [[false, false, false, false, false, false]], [[false, false, false, false, false, true]], [[false, false, false, false, true, false]], [[false, false, false, false, true, true]], [[false, false, false, true, false, false]], [[false, false, false, true, false, true]], [[false, false, fals... | Create an OR function, without use of the 'or' keyword, that takes an list of boolean values and runs OR against all of them.
Assume there will be between 1 and 6 variables, and return None for an empty list.
Write your solution by modifying this code:
```python
def alt_or(lst):
```
Your solution should implement... | 0 |
{"tests": "{\"inputs\": [\"5\\n1 3\\n5 8\\n2 5\\n3 19\\n56678 164422\\n\", \"6\\n1 4\\n1 4\\n4 5\\n631059 999974\\n1 2\\n1 2\\n\", \"17\\n1 3\\n2 4\\n3 5\\n2 3\\n1 2\\n2 5\\n3 5\\n1 2\\n1 5\\n1 2\\n3 4\\n281794 563452\\n1 3\\n1 3\\n1 2\\n218235 436471\\n1 5\\n\", \"1\\n999999 1000000\\n\", \"14\\n1 2\\n51649 234369\\n3... | Igor is in 11th grade. Tomorrow he will have to write an informatics test by the strictest teacher in the school, Pavel Denisovich.
Igor knows how the test will be conducted: first of all, the teacher will give each student two positive integers $a$ and $b$ ($a < b$). After that, the student can apply any of the follo... | 0.125 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.