info stringlengths 120 50k | question stringlengths 504 10.4k | avg@8_qwen3_4b_instruct_2507 float64 0 0.88 |
|---|---|---|
{"tests": "{\"inputs\": [\"0 1\", \"4 5\", \"6 5\", \"0 2\", \"4 1\", \"-1 1\", \"6 9\", \"0 8\", \"8 1\", \"6 3\", \"0 9\", \"1 8\", \"11 1\", \"8 3\", \"0 12\", \"1 10\", \"19 1\", \"8 2\", \"0 6\", \"2 8\", \"9 1\", \"0 11\", \"-1 11\", \"1 11\", \"-2 11\", \"0 4\", \"-3 11\", \"2 14\", \"-3 4\", \"-2 1\", \"-3 7\",... | Problem
There are n vertices that are not connected to any of the vertices.
An undirected side is stretched between each vertex.
Find out how many sides can be stretched when the diameter is set to d.
The diameter represents the largest of the shortest distances between two vertices.
Here, the shortest distance is the... | 0 |
{"tests": "{\"inputs\": [\"238 9996\\n\", \"9999 9999\\n\", \"620 35\\n\", \"9999 9998\\n\", \"6811 5416\\n\", \"10000 9999\\n\", \"42 1\\n\", \"10000 10000\\n\", \"241 10000\\n\", \"5858 674\\n\", \"1000 10000\\n\", \"1307 3420\\n\", \"4 9\\n\", \"10000 239\\n\", \"5 8\\n\", \"16 60\\n\", \"999 10000\\n\", \"7 11\\n\"... | Rikhail Mubinchik believes that the current definition of prime numbers is obsolete as they are too complex and unpredictable. A palindromic number is another matter. It is aesthetically pleasing, and it has a number of remarkable properties. Help Rikhail to convince the scientific community in this!
Let us remind you... | 0 |
{"tests": "{\"inputs\": [\"7 4\\n1 2 3 3 1 4 3\\n3 1\\n2 3\\n2 4\\n\", \"10 5\\n3 1 5 3 1 5 1 2 4 2\\n4 5\\n4 3\\n4 2\\n4 1\\n\", \"10 10\\n2 10 8 7 9 3 4 6 5 1\\n10 4\\n10 1\\n10 6\\n10 8\\n10 2\\n10 9\\n10 7\\n10 3\\n10 5\\n\", \"2 2\\n1 2\\n2 1\\n\", \"10 10\\n2 10 8 7 9 3 4 6 5 1\\n10 4\\n10 1\\n10 6\\n10 8\\n10 2\... | You have a set of $n$ discs, the $i$-th disc has radius $i$. Initially, these discs are split among $m$ towers: each tower contains at least one disc, and the discs in each tower are sorted in descending order of their radii from bottom to top.
You would like to assemble one tower containing all of those discs. To do ... | 0 |
{"tests": "{\"inputs\": [\"3 3\\n2 3 2\\n2 1 2\\n2 3 1\\n3 5\\n3 3 4 3 3\\n3 1 0 2 3\\n3 3 4 3 2\\n7 7\\n1 1 1 1 1 0 0\\n1 0 0 0 1 0 0\\n1 0 1 1 1 1 1\\n1 0 1 0 1 0 1\\n1 1 1 1 1 0 1\\n0 0 2 0 0 0 1\\n0 0 1 1 1 1 1\\n6 6\\n1 1 1 1 2 2\\n1 0 0 2 0 2\\n1 0 0 2 0 2\\n3 3 3 9 9 9\\n3 0 0 9 0 9\\n3 3 3 9 9 9\\n0 0\", \"3 3\... | A Garden with Ponds
Mr. Gardiner is a modern garden designer who is excellent at utilizing the terrain features. His design method is unique: he first decides the location of ponds and design them with the terrain features intact.
According to his unique design procedure, all of his ponds are rectangular with simple ... | 0.875 |
{"tests": "{\"inputs\": [\"and its\\n\", \"5 qwertyuiopasdfghjklzxcvbnm\\nPh\\nisscP\\nBpke_kdc_epclc_jcijsc_mihyo?\\nEpcf_kdc_liswhyo_EIED_hy_Vimcvpcn_Zkdvp_siyo_viyecle.\\nIpp!\", \"5 qwertyuiopasdfghjklzxcvbnm\\nPh\\nisscP\\nBpke_kdc_epclc_jcij?c_mihyos\\nEpcf_kdc_liswhyo_EIED_hy_Vimcvpcn_Zkdvp_siyo_viyecle.\\nIpp!\... | A tourist is visiting Byteland. The tourist knows English very well. The language of Byteland is rather different from English. To be exact it differs in following points:
- Bytelandian alphabet has the same letters as English one, but possibly different in meaning. Like 'A' in Bytelandian may be 'M' in English. Howev... | 0 |
{"tests": "{\"inputs\": [[\"abcdef\", 5], [\"\", 5], [\"abcd\", 1], [\"0abc\", 2], [\"ab\", 255], [\"ab\", 256], [\"abcde\", 32], [\"tcddoadepwweasresd\", 77098]], \"outputs\": [[\"df\"], [\"\"], [\"d\"], [\"b\"], [\"ab\"], [\"\"], [\"\"], [\"codewars\"]]}", "source": "primeintellect"} | # Introduction
A grille cipher was a technique for encrypting a plaintext by writing it onto a sheet of paper through a pierced sheet (of paper or cardboard or similar). The earliest known description is due to the polymath Girolamo Cardano in 1550. His proposal was for a rectangular stencil allowing single letters, ... | 0 |
{"tests": "{\"inputs\": [\"10\\nonetwonetwooneooonetwooo\\ntwo\\none\\ntwooooo\\nttttwo\\nttwwoo\\nooone\\nonnne\\noneeeee\\noneeeeeeetwooooo\\n\", \"4\\nonetwone\\ntestme\\noneoneone\\ntwotwo\\n\", \"1\\nzzzone\\n\", \"10\\nonetwonetwooneooonetwooo\\ntwo\\none\\ntwooooo\\nttttwo\\nttwwoo\\nooone\\nonnne\\nonedeee\\non... | You are given a non-empty string s=s_1s_2... s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one string "two" (or both at the same time) as a substring. In other words, Polycarp does not like the string s if there is an integer j ... | 0 |
{"tests": "{\"inputs\": [\"4 5\\n1 2 10\\n1 3 15\\n2 3 5\\n2 4 3\\n3 4 10\\n2\\n1 4 10 LoveLetter\\n2 3 13 Greetings\\n3 3\\n1 2 1\\n2 3 1\\n3 1 1\\n3\\n1 2 1 BusinessMailC\\n2 3 1 BusinessMailB\\n3 1 1 BusinessMailA\\n0 0\", \"4 5\\n1 2 10\\n2 3 15\\n2 3 5\\n2 4 3\\n3 4 10\\n2\\n1 4 10 LoveLetter\\n2 3 13 Greetings\\n... | The postal system in the area where Masa lives has changed a bit. In this area, each post office is numbered consecutively from 1 to a different number, and mail delivered to a post office is intended from that post office via several post offices. Delivered to the post office. Mail "forwarding" is only done between sp... | 0 |
{"tests": "{\"inputs\": [[[1, 2]], [[0, 3, 4, 5]], [[]], [[-1, -2]], [[-1, 0, 1]]], \"outputs\": [[5], [50], [0], [5], [2]]}", "source": "primeintellect"} | Complete the square sum function so that it squares each number passed into it and then sums the results together.
For example, for `[1, 2, 2]` it should return `9` because `1^2 + 2^2 + 2^2 = 9`.
```if:racket
In Racket, use a list instead of an array, so '(1 2 3) should return 9.
```
Write your solution by modifying... | 0 |
{"tests": "{\"inputs\": [[[20, 37, 20, 21], 1], [[1, 1, 3, 3, 7, 2, 2, 2, 2], 3], [[1, 2, 3, 1, 1, 2, 1, 2, 3, 3, 2, 4, 5, 3, 1], 3], [[1, 1, 1, 1, 1], 5], [[], 5]], \"outputs\": [[[20, 37, 21]], [[1, 1, 3, 3, 7, 2, 2, 2]], [[1, 2, 3, 1, 1, 2, 2, 3, 3, 4, 5]], [[1, 1, 1, 1, 1]], [[]]]}", "source": "primeintellect"} | ## Enough is enough!
Alice and Bob were on a holiday. Both of them took many pictures of the places they've been, and now they want to show Charlie their entire collection. However, Charlie doesn't like these sessions, since the motive usually repeats. He isn't fond of seeing the Eiffel tower 40 times. He tells them t... | 0 |
{"tests": "{\"inputs\": [\"10 4\\n8 4\\n9 8\\n2 8\\n8 1\\n\", \"9 10\\n6 4\\n7 5\\n9 3\\n7 6\\n4 8\\n4 2\\n9 8\\n1 3\\n5 1\\n4 7\\n\", \"10 10\\n10 6\\n9 4\\n7 8\\n1 5\\n3 10\\n2 1\\n4 9\\n5 2\\n10 3\\n6 3\\n\", \"8 12\\n6 1\\n7 5\\n2 5\\n4 1\\n6 3\\n4 3\\n5 7\\n1 3\\n5 2\\n2 7\\n4 6\\n7 2\\n\", \"3 6\\n1 2\\n1 3\\n2 1... | Shuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally, tha... | 0 |
{"tests": "{\"inputs\": [\"Z:1\\n\", \"123:A\\n\", \"N:7\\n\", \"00001:00001\\n\", \"1:11\\n\", \"000G6:000GD\\n\", \"0:1N\\n\", \"Z:2\\n\", \"0:Z\\n\", \"Z:00\\n\", \"0:1A\\n\", \"000Z:000Z\\n\", \"0Z:01\\n\", \"A:10\\n\", \"00Z:01\\n\", \"0033:00202\\n\", \"000B3:00098\\n\", \"00Z:03\\n\", \"01B:4A\\n\", \"0011:124\\... | Having stayed home alone, Petya decided to watch forbidden films on the Net in secret. "What ungentlemanly behavior!" — you can say that, of course, but don't be too harsh on the kid. In his country films about the Martians and other extraterrestrial civilizations are forbidden. It was very unfair to Petya as he adored... | 0.5 |
{"tests": "{\"inputs\": [\"1\\n11\\n111111\\n111111111111\\n12345\\n11111111119999999999\\n11111111113333333333\\n11111111118888888888\\n11111111112222222222111111111\\n11111111110000000000444444444\\n6395268301430\\n888888888888999999999999888888888888999999999999999999\\n666666666666666777333333333338888888888\\n1111... | My arm is stuck and I can't pull it out.
I tried to pick up something that had rolled over to the back of my desk, and I inserted my arm while illuminating it with the screen of my cell phone instead of a flashlight, but I accidentally got caught in something and couldn't pull it out. It hurts if you move it forcibly.... | 0 |
{"tests": "{\"inputs\": [\"10 15\\n752087443 1\\n537185872 1\\n439895449 1\\n494086747 1\\n718088132 1\\n93444012 0\\n670136349 1\\n545547453 0\\n718088132 0\\n853059674 0\\n853059674 1\\n762928724 1\\n762928724 0\\n853059674 0\\n156495293 1\\n\", \"3 3\\n4 1\\n5 1\\n7 0\\n\", \"3 2\\n8 1\\n9 1\\n\", \"5 10\\n1 1\\n1 1... | Student Vladislav came to his programming exam completely unprepared as usual. He got a question about some strange algorithm on a graph — something that will definitely never be useful in real life. He asked a girl sitting next to him to lend him some cheat papers for this questions and found there the following defin... | 0 |
{"tests": "{\"inputs\": [[\"Code Wars\"], [\"does\"], [\"your\"], [\"solution\"], [\"work\"], [\"for\"], [\"these\"], [\"words\"], [\"DOES\"], [\"YOUR\"], [\"SOLUTION\"], [\"WORK\"], [\"FOR\"], [\"THESE\"], [\"WORDS\"], [\"Does\"], [\"Your\"], [\"Solution\"], [\"Work\"], [\"For\"], [\"These\"], [\"Words\"], [\"A\"], [\... | # Background
My TV remote control has arrow buttons and an `OK` button.
I can use these to move a "cursor" on a logical screen keyboard to type words...
# Keyboard
The screen "keyboard" layout looks like this
#tvkb {
width : 400px;
border: 5px solid gray; border-collapse: collapse;
}
#tvkb td {
... | 0 |
{"tests": "{\"inputs\": [\"20 20\\n265918 744212 196368 74731 293587 679367 460805 632939 453630 565881 835276 606327 181087 721045 219431 849838 370939 582350 335676 32244\\n2 16 989\\n14 19 628\\n1 6 483\\n5 8 733\\n13 19 556\\n10 17 911\\n2 7 599\\n13 17 390\\n10 20 965\\n9 11 449\\n3 15 310\\n3 6 557\\n14 18 225\\n... | DZY loves Physics, and he enjoys calculating density.
Almost everything has density, even a graph. We define the density of a non-directed graph (nodes and edges of the graph have some values) as follows:
<image> where v is the sum of the values of the nodes, e is the sum of the values of the edges.
Once DZY got a ... | 0 |
{"tests": "{\"inputs\": [[\"(123) 456-7890\"], [\"(1111)555 2345\"], [\"(098) 123 4567\"], [\"(123)456-7890\"], [\"abc(123)456-7890\"], [\"(123)456-7890abc\"], [\"abc(123)456-7890abc\"], [\"abc(123) 456-7890\"], [\"(123) 456-7890abc\"], [\"abc(123) 456-7890abc\"]], \"outputs\": [[true], [false], [false], [false], [fals... | Write a function that accepts a string, and returns true if it is in the form of a phone number. Assume that any integer from 0-9 in any of the spots will produce a valid phone number.
Only worry about the following format:
(123) 456-7890 (don't forget the space after the close parentheses)
Examples:
```
validPho... | 0 |
{"tests": "{\"inputs\": [\"4\\n0 2\\n2 0\\n3 5\\n5 3\\n\", \"10\\n1 0\\n1 -3\\n1 5\\n1 -2\\n1 5\\n1 -2\\n1 -2\\n1 -2\\n1 -2\\n1 -2\\n\", \"60\\n-20 179\\n-68 0\\n-110 68\\n-22 177\\n47 140\\n-49 -4\\n-106 38\\n-23 22\\n20 193\\n47 173\\n-23 22\\n-100 32\\n-97 29\\n47 124\\n-49 -4\\n20 193\\n-20 179\\n-50 149\\n-59 -7\\... | The Happy Farm 5 creators decided to invent the mechanism of cow grazing. The cows in the game are very slow and they move very slowly, it can even be considered that they stand still. However, carnivores should always be chased off them.
For that a young player Vasya decided to make the shepherd run round the cows a... | 0 |
{"tests": "{\"inputs\": [[\"day\"], [\"apple\"], [\"peace\"], [\"maker\"], [\"programming\"], [\"javascript\"], [\"python\"], [\"ruby\"], [\"haskell\"], [\"clojure\"], [\"csharp\"]], \"outputs\": [[\"dya\"], [\"pplae\"], [\"pceae\"], [\"mkrae\"], [\"prgrmmngoai\"], [\"jvscrptaai\"], [\"pythno\"], [\"rbyu\"], [\"hskllae... | Given a string as input, move all of its vowels to the end of the string, in the same order as they were before.
Vowels are (in this kata): `a, e, i, o, u`
Note: all provided input strings are lowercase.
## Examples
```python
"day" ==> "dya"
"apple" ==> "pplae"
```
Write your solution by modifying this code:
... | 0 |
{"tests": "{\"inputs\": [\"5\\n5\\n2\\n1\\n4\\n3\\n\", \"4\\n3\\n2\\n4\\n1\\n\", \"7\\n3\\n2\\n1\\n6\\n5\\n4\\n7\\n\", \"6\\n5\\n3\\n4\\n1\\n2\\n6\\n\", \"6\\n5\\n3\\n8\\n1\\n2\\n6\", \"4\\n3\\n2\\n3\\n1\", \"6\\n5\\n3\\n8\\n1\\n2\\n3\", \"4\\n3\\n2\\n2\\n1\", \"6\\n4\\n3\\n8\\n1\\n2\\n3\", \"4\\n3\\n1\\n2\\n1\", \"4\\... | You are given a permutation of 1,2,...,N: p_1,p_2,...,p_N. Determine if the state where p_i=i for every i can be reached by performing the following operation any number of times:
- Choose three elements p_{i-1},p_{i},p_{i+1} (2\leq i\leq N-1) such that p_{i-1}>p_{i}>p_{i+1} and reverse the order of these three.
----... | 0 |
{"tests": "{\"inputs\": [\"4\\n4 3 2 1 2\\n1 2\\n1 3\\n1 4\\n6 6 1 2 5\\n1 2\\n6 5\\n2 3\\n3 4\\n4 5\\n9 3 9 2 5\\n1 2\\n1 6\\n1 9\\n1 3\\n9 5\\n7 9\\n4 8\\n4 3\\n11 8 11 3 3\\n1 2\\n11 9\\n4 9\\n6 5\\n2 10\\n3 2\\n5 9\\n8 3\\n7 4\\n7 10\\n\", \"1\\n5 5 4 3 4\\n1 2\\n4 1\\n5 1\\n5 3\\n\", \"10\\n10 9 10 6 6\\n6 1\\n7 6... | Alice and Bob are playing a fun game of tree tag.
The game is played on a tree of $n$ vertices numbered from $1$ to $n$. Recall that a tree on $n$ vertices is an undirected, connected graph with $n-1$ edges.
Initially, Alice is located at vertex $a$, and Bob at vertex $b$. They take turns alternately, and Alice makes... | 0 |
{"tests": "{\"inputs\": [\"BBBWW\\n\", \"WWWWWW\\n\", \"WBWBWBWBWB\\n\", \"WWWXWW\", \"WBWBWBBBWW\", \"BWBBW\", \"WXWXWW\", \"WWBBCWBWBV\", \"XWBBCWBWBV\", \"XWVBCWBWCB\", \"WWBBB\", \"XWVWVX\", \"WWBBBWBWBW\", \"WBBWB\", \"WXVXWW\", \"WWBBBWBWBV\", \"WBBXB\", \"WWXVXW\", \"BXBBW\", \"WWXUXW\", \"BXBWB\", \"WXUXWW\", \... | Two foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones b... | 0.375 |
{"tests": "{\"inputs\": [\"3\\n-3 1 1\\n2 -4 1\\n2 1 -1\\n3\\n-4 1 1\\n1 1 -6\\n1 -5 3\\n4\\n-8 6 -2 1\\n2 -7 -2 1\\n1 -1 1 1\\n1 1 1 -5\\n6\\n2 2 3 -7 3 2\\n1 -10 1 1 3 2\\n2 6 5 2 -6 0\\n3 4 -23 2 2 5\\n3 3 -6 2 3 7\\n-7 2 3 2 -5 -13\\n6\\n2 2 3 -7 3 2\\n1 -10 1 1 3 2\\n2 6 5 2 -6 1\\n3 4 -23 2 2 5\\n3 3 -6 2 3 7\\n-... | Let's solve the puzzle by programming.
The numbers n x n are arranged in a grid pattern. Some of the numbers are circled and we will call them the starting point. The rules of the puzzle are as follows:
* Draw one line that goes vertically and horizontally from each starting point (cannot be drawn diagonally).
* Exte... | 0 |
{"tests": "{\"inputs\": [[[\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"], 3, 2, \"c\"], [[\"c\", \"b\", \"c\", \"d\", \"e\", \"f\"], 3, 2, \"c\"], [[\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"], 3, 2, \"g\"], [[\"a\", \"b\", \"c\", \"c\", \"e\", \"c\"], 7, 1, \"c\"], [[\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"], 1, 2, \"b\"], ... | # Let's watch a parade!
## Brief
You're going to watch a parade, but you only care about one of the groups marching. The parade passes through the street where your house is. Your house is at number `location` of the street. Write a function `parade_time` that will tell you the times when you need to appear to see all ... | 0 |
{"tests": "{\"inputs\": [[[]], [[[1]]], [[[0, 1]]], [[[1, 2, 3], [4, 5, 6]]], [[[1, 2, 3, 4, 5, 6]]], [[[1], [2], [3], [4], [5], [6]]], [[[\"a\", \"b\", \"c\"], [\"d\", \"e\", \"f\"]]], [[[true, false, true], [false, true, false]]], [[[]]], [[[], [], [], [], [], []]]], \"outputs\": [[[]], [[[1]]], [[[0], [1]]], [[[1, 4... | Transpose means is to interchange rows and columns of a two-dimensional array matrix.
[A^(T)]ij=[A]ji
ie:
Formally, the i th row, j th column element of AT is the j th row, i th column element of A:
Example :
```
[[1,2,3],[4,5,6]].transpose() //should return [[1,4],[2,5],[3,6]]
```
Write a prototype transpose to... | 0 |
{"tests": "{\"inputs\": [\"8 4 1\\n3 3\", \"10 6 10\\n10 4\\n4 4\\n5 1\\n4 2\\n7 3\\n1 3\\n2 4\\n8 2\\n3 5\\n7 1\", \"10 6 10\\n10 4\\n4 4\\n5 1\\n6 2\\n7 3\\n1 3\\n2 4\\n8 2\\n7 5\\n7 1\", \"8 4 0\\n3 3\", \"3 4 0\\n5 3\", \"4 4 0\\n3 3\", \"8 2 0\\n3 3\", \"4 4 1\\n3 1\", \"10 6 10\\n10 4\\n4 2\\n5 1\\n4 2\\n7 3\\n1 ... | There is an Amidakuji that consists of w vertical bars and has a height (the number of steps to which horizontal bars can be added) of h. w is an even number. Of the candidates for the place to add the horizontal bar of this Amidakuji, the ath from the top and the bth from the left are called (a, b). (When a horizontal... | 0 |
{"tests": "{\"inputs\": [\"3\\n7\\n3 1 6 6 3 1 1\\n8\\n1 1 4 4 4 7 8 8\\n7\\n4 2 5 2 6 2 7\\n\", \"3\\n7\\n3 1 6 6 3 1 1\\n8\\n1 1 4 4 4 7 8 8\\n7\\n4 2 5 2 6 2 5\\n\", \"3\\n7\\n3 1 6 6 3 1 1\\n8\\n1 1 4 4 4 7 8 8\\n7\\n4 2 5 3 6 2 5\\n\", \"3\\n7\\n3 1 6 6 3 1 1\\n8\\n1 1 7 4 4 7 8 8\\n7\\n4 2 5 3 6 2 5\\n\", \"3\\n7... | You are given a sequence $a_1, a_2, \dots, a_n$, consisting of integers.
You can apply the following operation to this sequence: choose some integer $x$ and move all elements equal to $x$ either to the beginning, or to the end of $a$. Note that you have to move all these elements in one direction in one operation.
Fo... | 0.125 |
{"tests": "{\"inputs\": [\"7\\n2 1 1\\n3 2 0\\n4 2 1\\n5 2 0\\n6 7 1\\n7 2 1\\n\", \"2\\n1 2 1\\n\", \"2\\n1 2 0\\n\", \"2\\n1 2 1\\n\", \"2\\n1 2 0\\n\", \"7\\n2 1 1\\n3 2 0\\n4 2 1\\n5 4 0\\n6 7 1\\n7 2 1\\n\", \"7\\n2 1 1\\n3 2 1\\n4 2 1\\n5 2 0\\n6 7 1\\n7 2 1\\n\", \"7\\n2 1 1\\n3 2 0\\n4 2 1\\n5 2 0\\n6 7 0\\n7 2... | You are given a tree (an undirected connected acyclic graph) consisting of $n$ vertices and $n - 1$ edges. A number is written on each edge, each number is either $0$ (let's call such edges $0$-edges) or $1$ (those are $1$-edges).
Let's call an ordered pair of vertices $(x, y)$ ($x \ne y$) valid if, while traversing t... | 0 |
{"tests": "{\"inputs\": [\"2 3 1001 1000 1 1 1 2\", \"16 10 1 10 3 3 7 7\", \"2 3 1001 1000 1 2 1 2\", \"16 10 1 10 3 3 2 7\", \"2 3 1000 1000 1 2 1 2\", \"2 3 1000 1000 1 2 0 2\", \"2 3 1000 1010 1 2 0 2\", \"16 10 0 7 3 3 2 8\", \"2 2 1000 1000 1 1 1 2\", \"10 10 1 22 3 3 7 7\", \"10 10 1 10 3 3 7 3\", \"2 3 1001 100... | The fearless Ikta has finally hunted down the infamous Count Big Bridge! Count Bigbridge is now trapped in a rectangular room w meters wide and h meters deep, waiting for his end.
If you select a corner of the room and take the coordinate system so that the width direction is the x-axis and the depth direction is the ... | 0 |
{"tests": "{\"inputs\": [\"K3n5JwuWoJdFUVq8H5QldFqDD2B9yCUDFY1TTMN10\\n\", \"F646Pj3RlX5iZ9ei8oCh.IDjGCcvPQofAPCpNRwkBa6uido8w\\n\", \"uVVcZsrSe\\n\", \"rXoypUjrOofxvzuSUrNfhxn490ZBwQZ0mMHYFlY4DCNQW\\n\", \"F7\\n\", \"B9O9WWF\\n\", \"oZndfd2PbCT85u6081\\n\", \"A\\n\", \"D5LkqCdKJsy\\n\", \"XugVHXi3RqJWXaP9i6g.0fP\\n\",... | <image>
You can preview the image in better quality by the link: [http://assets.codeforces.com/files/656/without-text.png](//assets.codeforces.com/files/656/without-text.png)
Input
The only line of the input is a string (between 1 and 50 characters long, inclusive). Each character will be an alphanumeric character o... | 0 |
{"tests": "{\"inputs\": [[\"F3RF5LF7\"], [\"FFFR345F2LL\"], [\"RRRRRF45L3F2\"], [\"RRRRR(F45L3)F2\"], [\"FF(LF6(RF3)2)3\"]], \"outputs\": [[\"<span style=\\\"color: pink\\\">F</span><span style=\\\"color: orange\\\">3</span><span style=\\\"color: green\\\">R</span><span style=\\\"color: pink\\\">F</span><span style=\\\... | # RoboScript #1 - Implement Syntax Highlighting
## Disclaimer
The story presented in this Kata Series is purely fictional; any resemblance to actual programming languages, products, organisations or people should be treated as purely coincidental.
## About this Kata Series
This Kata Series is based on a fictional s... | 0 |
{"tests": "{\"inputs\": [[5, 5], [2, 10], [10, 2], [7, 9], [1, 1], [16777216, 14348907]], \"outputs\": [[3], [13], [10], [4], [1], [23951671]]}", "source": "primeintellect"} | This is the performance version of [this kata](https://www.codewars.com/kata/59afff65f1c8274f270020f5).
---
Imagine two rings with numbers on them. The inner ring spins clockwise and the outer ring spins anti-clockwise. We start with both rings aligned on 0 at the top, and on each move we spin each ring by 1. How man... | 0 |
{"tests": "{\"inputs\": [\"8\\n00000000\\n80000000\\n00000080\\n00000040\\n000000c0\\n00000100\\n15330257\\n80000f70\", \"8\\n00000000\\n80000000\\n00000080\\n00000040\\n000000c0\\n00000100\\n21251916\\n80000f70\", \"8\\n00000100\\n80000000\\n00000080\\n00000040\\n000000c0\\n00000100\\n21251916\\n80000f70\", \"8\\n0000... | Consider a 32-bit real type with 7 bits from the right as the decimal part, the following 24 bits as the integer part, and the leftmost 1 bit as the sign part as shown below (b1, ..., b32). Represents 0 or 1).
<image>
To translate this format into a decimal representation that is easy for humans to understand, inter... | 0 |
{"tests": "{\"inputs\": [\"5\\n-X--X\", \"20\\nX-X-X--X--X-X--X--X-\", \"5\\n-X-X-\", \"20\\n-X--X--X-X-----XXX-X\", \"100\\n-X-X-X--X-X--X--X-X--X-X-X--X-X-X--X--X-X-X-X--X--X-X-X-X-X-X-X-X-X-X-X-X-X-X-X--X-X-X-X-X-X-X-X-X-X\", \"5\\nX-X--\", \"20\\n-X.-X--X-X-----XXX-X\", \"20\\nX-XXX-----X-X--X-.X-\", \"20\\nX-XYX--... | There is a very long bench. The bench is divided into M sections, where M is a very large integer.
Initially, the bench is vacant. Then, M people come to the bench one by one, and perform the following action:
* We call a section comfortable if the section is currently unoccupied and is not adjacent to any occupied s... | 0.125 |
{"tests": "{\"inputs\": [[[4, 6, 3], 7], [[10, 9, 9, 8], 17], [[8, 9, 10, 4, 2], 23], [[19, 98, 69, 28, 75, 45, 17, 98, 67], 464], [[4, 6, 3], 2]], \"outputs\": [[1], [1], [3], [8], [0]]}", "source": "primeintellect"} | # Task
**_Given_** *an array of N integers, you have to find* **_how many times_** *you have to* **_add up the smallest numbers_** *in the array until* **_their Sum_** *becomes greater or equal to* **_K_**.
___
# Notes:
* **_List size_** is *at least 3*.
* **_All numbers_** *will be* **_positive_**.
* **_Num... | 0 |
{"tests": "{\"inputs\": [\"4\\n1 2\\n1 3\\n1 4\\n0 3 2 0\\n-3 4 5 -1\", \"4\\n1 2\\n2 3\\n1 4\\n0 3 2 0\\n-3 4 5 -1\", \"4\\n1 2\\n1 4\\n3 4\\n0 3 2 0\\n-3 4 5 -1\", \"4\\n1 2\\n1 3\\n1 4\\n0 4 2 0\\n-3 4 5 -1\", \"4\\n1 2\\n2 3\\n1 4\\n0 3 2 0\\n-3 2 5 -1\", \"4\\n1 2\\n1 3\\n3 4\\n0 3 2 0\\n-4 4 5 -1\", \"4\\n1 2\\n1... | Problem statement
There is a tree consisting of $ N $ vertices $ N-1 $ edges, and the $ i $ th edge connects the $ u_i $ and $ v_i $ vertices.
Each vertex has a button, and the button at the $ i $ th vertex is called the button $ i $.
First, the beauty of the button $ i $ is $ a_i $.
Each time you press the button ... | 0 |
{"tests": "{\"inputs\": [\"1 7\\n0000000\\n\", \"2 5\\n0010010\\n0010010\\n\", \"3 5\\n0100001\\n1001001\\n1010011\\n\", \"10 0\\n0111010\\n1101111\\n1111011\\n0111010\\n1101011\\n1101011\\n1110111\\n1010010\\n1111111\\n0010010\\n\", \"10 10\\n0101111\\n0000000\\n1111011\\n1011011\\n1011011\\n1111011\\n0010010\\n101001... | Denis, after buying flowers and sweets (you will learn about this story in the next task), went to a date with Nastya to ask her to become a couple. Now, they are sitting in the cafe and finally... Denis asks her to be together, but ... Nastya doesn't give any answer.
The poor boy was very upset because of that. He wa... | 0 |
{"tests": "{\"inputs\": [\"3\\n7 2 3 6\\n1 4\\n7 2 3 6\\n5 1\\n7 2 3 6\\n4 4\\n\", \"3\\n7 2 3 6\\n1 4\\n7 2 3 6\\n5 1\\n7 2 3 6\\n2 4\\n\", \"3\\n7 2 3 6\\n1 4\\n7 2 3 6\\n5 1\\n12 2 3 6\\n4 4\\n\", \"3\\n7 2 3 6\\n1 4\\n7 2 3 4\\n5 1\\n7 2 3 6\\n2 4\\n\", \"3\\n7 2 3 6\\n1 4\\n7 2 3 9\\n5 1\\n7 2 3 6\\n2 4\\n\", \"3\... | Consider a long corridor which can be divided into $n$ square cells of size $1 \times 1$. These cells are numbered from $1$ to $n$ from left to right.
There are two people in this corridor, a hooligan and a security guard. Initially, the hooligan is in the $a$-th cell, the guard is in the $b$-th cell ($a \ne b$).
One... | 0 |
{"tests": "{\"inputs\": [\"7 5\\n3 1 4 1 5 9 3\", \"15 10\\n1 5 6 10 11 11 11 20 21 25 25 26 99 83 99\", \"15 10\\n1 5 6 10 11 11 11 20 21 25 25 26 99 83 56\", \"15 10\\n1 5 6 10 11 11 11 20 21 25 25 26 99 124 99\", \"7 5\\n3 1 4 1 5 8 3\", \"15 10\\n1 5 6 10 11 11 11 20 21 1 25 26 99 124 99\", \"7 8\\n4 2 5 1 5 9 3\",... | Takahashi is playing with N cards.
The i-th card has an integer X_i on it.
Takahashi is trying to create as many pairs of cards as possible satisfying one of the following conditions:
* The integers on the two cards are the same.
* The sum of the integers on the two cards is a multiple of M.
Find the maximum numb... | 0 |
{"tests": "{\"inputs\": [\"5\\n2\\n3\\n3\\n5\\n6\", \"2\\n6\\n3\", \"2\\n6\\n2\", \"2\\n5\\n2\", \"2\\n1\\n2\", \"2\\n1\\n3\", \"5\\n2\\n3\\n5\\n5\\n6\", \"5\\n2\\n3\\n3\\n2\\n6\", \"2\\n8\\n3\", \"2\\n5\\n1\", \"2\\n14\\n2\", \"2\\n14\\n4\", \"2\\n3\\n2\", \"2\\n14\\n8\", \"2\\n15\\n2\", \"2\\n14\\n16\", \"2\\n11\\n2\... | There is a complete graph of m vertices. Initially, the edges of the complete graph are uncolored. Sunuke did the following for each i (1 ≤ i ≤ n): Select ai vertices from the complete graph and color all edges connecting the selected vertices with color i. None of the sides were painted in multiple colors. Find the mi... | 0 |
{"tests": "{\"inputs\": [\"2\\n2\\nYNNNNYYY\\n2\\nNYNNYYNNNYNYYNNN\", \"2\\n2\\nYYZNNNNY\\n2\\nYYNNYNNNNYNYYNNN\", \"2\\n2\\nYYZNNNNY\\n4\\nNYNNYYNNNYNYYNNN\", \"2\\n2\\nYYZNNNNY\\n4\\nNNNYYNYNNNYYONYN\", \"2\\n2\\nYYZNYNNN\\n4\\nNNNYYNYNNNYYNNYN\", \"2\\n2\\nYNNNNYYY\\n3\\nNYNNYYNNNYNYYNNN\", \"2\\n2\\nNNNYNZYY\\n0\\n... | She is an extraordinary girl. She works for a library. Since she is young and cute, she is forced to do a lot of laborious jobs. The most annoying job for her is to put returned books into shelves, carrying them by a cart. The cart is large enough to carry many books, but too heavy for her. Since she is delicate, she w... | 0 |
{"tests": "{\"inputs\": [[10, 5], [1.001, 2], [175, 18], [-2, 2], [2500, 123]], \"outputs\": [[50], [2.002], [3150], [-4], [307500]]}", "source": "primeintellect"} | The "Russian Peasant Method" is an old algorithm used by Russian peasants (and before them ancient Egyptians) to perform multiplication. Consider that X and Y are two numbers. X can be any number but Y must be a positive integer. To multiply X and Y:
1. Let the product = 0
2. If Y is odd, then the product = product ... | 0 |
{"tests": "{\"inputs\": [\"6 5\\n0 0 0 0 0\\n0 0 0 0 0\\n0 3 3 3 0\\n0 3 3 3 0\\n0 3 3 3 0\\n0 0 0 0 0\\n\", \"2 3\\n0 0 0\\n0 0 0\\n\", \"10 10\\n0 0 0 0 0 0 0 0 0 0\\n0 0 0 0 0 0 0 0 0 0\\n0 0 1585 1564 3603 1095 1364 1029 3189 1331\\n0 0 0 0 0 0 0 0 0 0\\n0 0 0 0 0 0 0 0 0 0\\n0 0 0 0 0 0 0 0 0 0\\n0 0 0 0 0 0 0 0 0... | A widely known among some people Belarusian sport programmer Yura possesses lots of information about cars. That is why he has been invited to participate in a game show called "Guess That Car!".
The game show takes place on a giant parking lot, which is 4n meters long from north to south and 4m meters wide from west ... | 0.125 |
{"tests": "{\"inputs\": [\"300 10 8 5\\n50 5 2 1\\n70 5 2 0\\n75 1 1 0\\n100 3 1 0\\n150 2 2 0\\n240 5 5 7\\n50 1 1 0\\n60 2 2 0\\n70 2 3 0\\n90 1 3 0\\n120 3 5 0\\n140 4 1 0\\n150 2 4 1\\n180 3 5 4\\n15 2 2 1\\n20 2 2 1\\n25 2 2 0\\n60 1 1 0\\n120 5 5 4\\n15 5 4 1\\n20 5 4 0\\n40 1 1 0\\n40 2 2 0\\n120 2 3 4\\n30 1 1 ... | ICPC Ranking
Your mission in this problem is to write a program which, given the submission log of an ICPC (International Collegiate Programming Contest), determines team rankings.
The log is a sequence of records of program submission in the order of submission. A record has four fields: elapsed time, team number, p... | 0.25 |
{"tests": "{\"inputs\": [[\"25abcd26\"], [\"18zyz14\"], [\"a1b2c3d4\"], [\"5a8p17\"], [\"w6aa4ct24m5\"], [\"17dh\"], [\"25gj8sk6r17\"], [\"18zzz14\"], [\"y17kg5et11\"], [\"abcdefghijklmnopqrstuvwxyz\"], [\"1a2b3c4d5e6f7g8h9i10j11k12l13m14n15o16p17q18r19s20t21u22v23w24x25y26z\"], [\"h15q4pc6yw23nmx19y\"], [\"p16k11o25x7... | In this Kata, you will create a function that converts a string with letters and numbers to the inverse of that string (with regards to Alpha and Numeric characters). So, e.g. the letter `a` will become `1` and number `1` will become `a`; `z` will become `26` and `26` will become `z`.
Example: `"a25bz"` would become `... | 0 |
{"tests": "{\"inputs\": [\"2\\n4\\n0 1\\n1 2\\n2 3\\n2\\n1 0\\n\", \"2\\n4\\n0 1\\n1 2\\n1 3\\n2\\n1 0\\n\", \"2\\n4\\n0 1\\n1 2\\n0 3\\n2\\n1 0\\n\", \"2\\n4\\n0 1\\n0 2\\n0 3\\n2\\n1 0\\n\", \"2\\n4\\n0 1\\n1 3\\n2 3\\n2\\n1 0\\n\", \"2\\n4\\n0 3\\n1 2\\n2 3\\n2\\n1 0\\n\", \"2\\n4\\n0 3\\n1 2\\n1 3\\n2\\n1 0\\n\", \... | You are given a tree with n nodes, numerated from 0 to n-1. For each k between 0 and n, inclusive, you have to count the number of unordered pairs (u,v), u ≠ v, such that the MEX of all the node labels in the shortest path from u to v (including end points) is k.
The MEX of a sequence of integers is the smallest non-n... | 0.25 |
{"tests": "{\"inputs\": [\"2\\n1 2\", \"2\\n2 -2\", \"2\\n2 -4\", \"2\\n2 -3\", \"2\\n2 -6\", \"2\\n2 -11\", \"2\\n2 -5\", \"2\\n2 -10\", \"2\\n2 -7\", \"2\\n2 -13\", \"2\\n2 -16\", \"2\\n2 -25\", \"2\\n2 -20\", \"2\\n2 -14\", \"2\\n2 -12\", \"2\\n2 -15\", \"2\\n2 -36\", \"2\\n2 -17\", \"2\\n2 -23\", \"2\\n2 -22\", \"2... | B: Parentheses Number
problem
Define the correct parenthesis string as follows:
* The empty string is the correct parenthesis string
* For the correct parenthesis string S, `(` S `)` is the correct parenthesis string
* For correct parentheses S, T ST is the correct parentheses
Here, the permutations are associate... | 0.25 |
{"tests": "{\"inputs\": [\"5 5\\n.....\\n.#.#.\\n.....\\n.#.#.\\n.../.\", \"7 13\\n.............\\n.###.###.###.\\n.#.#.#...#...\\n.###.#...#...\\n...#.#.#.#.#.\\n.#.#.###.###.\\n.............\", \"7 13\\n.............\\n.###.###.###.\\n.#.#.#...#...\\n...#...#.###.\\n...#.#.#.#.#.\\n.#.#.###.###.\\n.............\", \"... | Snuke and Ciel went to a strange stationery store. Each of them got a transparent graph paper with H rows and W columns.
Snuke painted some of the cells red in his paper. Here, the cells painted red were 4-connected, that is, it was possible to traverse from any red cell to any other red cell, by moving to vertically ... | 0 |
{"tests": "{\"inputs\": [[5, 12], [12, 5], [5, 17], [17, 5], [7, 12], [12, 7]], \"outputs\": [[5], [5], [5.666666666666667], [5.666666666666667], [6.0], [6.0]]}", "source": "primeintellect"} | Imagine that you are given two sticks. You want to end up with three sticks of equal length. You are allowed to cut either or both of the sticks to accomplish this, and can throw away leftover pieces.
Write a function, maxlen, that takes the lengths of the two sticks (L1 and L2, both positive values), that will return... | 0 |
{"tests": "{\"inputs\": [[[1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1]], [[1, 1, 0, 1, 1, 0, 1, 1]], [[1, 1, 1, 0, 1, 1, 0, 1, 1, 1]], [[0, 1, 1, 1]], [[1, 1, 1, 0]], [[1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1]], [[0, 0, 0, 0, 0, 1]], [[0, 0, 0, 0, 1, 0]], [[1, 0, 0, 0, 0, 0]], [[0, 1, 0, 0, 0, 0]]], \"outputs\"... | Given an array containing only zeros and ones, find the index of the zero that, if converted to one, will make the longest sequence of ones.
For instance, given the array:
```
[1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1]
```
replacing the zero at index 10 (counting from 0) forms a sequence of 9 ones:
`... | 0 |
{"tests": "{\"inputs\": [\"3\\n2 3 7 9 5 4 8 6 1\", \"3\\n1 3 7 9 5 8 4 6 2\", \"3\\n1 6 7 9 5 4 8 3 2\", \"3\\n2 4 7 9 5 3 8 6 1\", \"3\\n1 3 7 9 4 8 5 6 2\", \"3\\n2 3 7 9 5 4 8 6 1\", \"4\\n6 7 1 4 13 16 10 9 5 11 12 14 15 2 3 8\", \"6\\n11 21 35 22 7 36 27 34 8 20 15 13 16 1 24 3 2 17 26 9 18 32 31 23 19 14 4 25 10... | Tonight, in your favourite cinema they are giving the movie Joker and all seats are occupied. In the cinema there are N rows with N seats each, forming an N\times N square. We denote with 1, 2,\dots, N the viewers in the first row (from left to right); with N+1, \dots, 2N the viewers in the second row (from left to rig... | 0 |
{"tests": "{\"inputs\": [\"4\\n36\\n44\\n**\\n32\\n46\\n**\\n66\\n41\\n**\\n64\\n34\\n\", \"3\\n14\\n54\\n**\\n45\\n41\\n**\\n12\\n22\\n\", \"7\\n21\\n33\\n**\\n33\\n12\\n**\\n32\\n31\\n**\\n21\\n33\\n**\\n33\\n12\\n**\\n32\\n31\\n**\\n13\\n23\\n\", \"3\\n63\\n63\\n**\\n66\\n33\\n**\\n36\\n36\\n\", \"4\\n56\\n61\\n**\\... | Cheaterius is a famous in all the Berland astrologist, magician and wizard, and he also is a liar and a cheater. One of his latest inventions is Cheaterius' amulets! They bring luck and wealth, but are rather expensive. Cheaterius makes them himself. The technology of their making is kept secret. But we know that throu... | 0.125 |
{"tests": "{\"inputs\": [\"5 7\\n2 6 7\\n5 1 1 1 1 1\\n3 6 5 4\\n0\\n4 4 3 2 1\", \"3 3\\n1 1\\n1 2\\n1 1\", \"1 3\\n3 1 2 1\", \"5 6\\n3 1 2 6\\n3 1 2 6\\n1 1\\n2 3 4\\n3 1 5 6\", \"3 4\\n2 1 4\\n3 1 3 1\\n1 2\", \"2 4\\n3 2 3 4\\n1 1\", \"5 1\\n0\\n0\\n0\\n0\\n0\", \"100 100\\n100 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ... | Deadpool wants to decorate his girlfriend’s house with a series of bulbs. The number of bulbs is M. Initially, all the bulbs are switched off. Deadpool finds that there are K numbers of buttons, each of them is connected to a set of bulbs. Deadpool can press any of these buttons because he is DEADPOOL. When the button... | 0 |
{"tests": "{\"inputs\": [\"9\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n\", \"9\\n1\\n3\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n\", \"9\\n1\\n5\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n\", \"9\\n1\\n5\\n3\\n4\\n5\\n6\\n7\\n8\\n12\\n\", \"9\\n1\\n2\\n3\\n4\\n5\\n6\\n11\\n8\\n9\\n\", \"9\\n1\\n3\\n3\\n2\\n5\\n6\\n7\\n8\\n9\\n\", \"9\\n1\\n5\\n3\\... | Consider the infinite sequence $s$ of positive integers, created by repeating the following steps:
Find the lexicographically smallest triple of positive integers $(a, b, c)$ such that $a \oplus b \oplus c = 0$, where $\oplus$ denotes the bitwise XOR operation. $a$, $b$, $c$ are not in $s$. Here triple of intege... | 0 |
{"tests": "{\"inputs\": [[[1, 2, 3], 3], [[1, 2], 5], [[3, 5, 7], 2], [[1, 2, 3, 4, 5], 3], [[2, 7, 13, 17], 2], [[2, 5, 8], 3], [[2, 4, 6, 8], 6], [[5, 10, 15], 4], [[3, 6, 9, 12], 3]], \"outputs\": [[30], [30], [68], [210], [472], [630], [312940], [61220], [2670]]}", "source": "primeintellect"} | You are provided with array of positive non-zero ints and int n representing n-th power (n >= 2).
For the given array, calculate the sum of each value to the n-th power. Then subtract the sum of the original array.
Example 1: Input: {1, 2, 3}, 3 --> (1 ^ 3 + 2 ^ 3 + 3 ^ 3 ) - (1 + 2 + 3) --> 36 - 6 --> Output: 30
Ex... | 0 |
{"tests": "{\"inputs\": [\"4\\n54\\n50\\n2\\n178\\n\", \"1\\n179\\n\", \"69\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n1\... | You are given an angle $\text{ang}$.
The Jury asks You to find such regular $n$-gon (regular polygon with $n$ vertices) that it has three vertices $a$, $b$ and $c$ (they can be non-consecutive) with $\angle{abc} = \text{ang}$ or report that there is no such $n$-gon. [Image]
If there are several answers, print the m... | 0.25 |
{"tests": "{\"inputs\": [[3, 2], [12, 5], [20, 1], [40, 3], [90, 2]], \"outputs\": [[\"1x^3\"], [\"2x^6\"], [\"10x^2\"], [\"10x^4\"], [\"30x^3\"]]}", "source": "primeintellect"} | Create a function that finds the [integral](https://en.wikipedia.org/wiki/Integral) of the expression passed.
In order to find the integral all you need to do is add one to the `exponent` (the second argument), and divide the `coefficient` (the first argument) by that new number.
For example for `3x^2`, the integral ... | 0 |
{"tests": "{\"inputs\": [\"5 5005\\n5 53 65 52 99\\n21 49 9 3 66\\n\", \"14 3615\\n81 79 13 94 54 69 92 5 47 98 40 64 44 88\\n52 73 7 12 29 40 46 47 60 66 63 68 71 4\\n\", \"7 529\\n77 18 67 64 43 51 30\\n35 87 17 52 1 97 84\\n\", \"16 1718\\n42 68 96 52 47 31 89 5 87 70 25 69 35 86 86 11\\n35 37 51 15 33 94 18 48 91 2... | It's a very unfortunate day for Volodya today. He got bad mark in algebra and was therefore forced to do some work in the kitchen, namely to cook borscht (traditional Russian soup). This should also improve his algebra skills.
According to the borscht recipe it consists of n ingredients that have to be mixed in propor... | 0.5 |
{"tests": "{\"inputs\": [[2, 5], [3, 3], [5, 3], [10, 4], [2, 0], [2, -4]], \"outputs\": [[[2, 4, 16, 256, 65536]], [[3, 9, 81]], [[5, 25, 625]], [[10, 100, 10000, 100000000]], [[]], [[]]]}", "source": "primeintellect"} | Complete the function that returns an array of length `n`, starting with the given number `x` and the squares of the previous number. If `n` is negative or zero, return an empty array/list.
## Examples
```
2, 5 --> [2, 4, 16, 256, 65536]
3, 3 --> [3, 9, 81]
```
Write your solution by modifying this code:
```pyt... | 0 |
{"tests": "{\"inputs\": [\"3 3\\naaa\\naaa\\naaa\\n\", \"3 4\\nabab\\nbaba\\nabab\\n\", \"5 5\\nzbacg\\nbaaac\\naaaaa\\neaaad\\nweadd\\n\", \"1 1\\nn\\n\", \"1 1\\nn\\n\", \"3 4\\nabab\\nabab\\nabab\\n\", \"5 5\\nzbacg\\nbaaac\\naaaaa\\ndaaae\\nweadd\\n\", \"1 1\\nm\\n\", \"3 3\\naba\\naaa\\naaa\\n\", \"5 5\\nzbacf\\nb... | Carousel Boutique is busy again! Rarity has decided to visit the pony ball and she surely needs a new dress, because going out in the same dress several times is a sign of bad manners. First of all, she needs a dress pattern, which she is going to cut out from the rectangular piece of the multicolored fabric.
The piec... | 0.5 |
{"tests": "{\"inputs\": [[[25, 25, 50]], [[25, 25, 50, 100]], [[25, 100]], [[25, 25, 25, 25, 25, 25, 25, 25, 25, 25]], [[50, 50, 50, 50, 50, 50, 50, 50, 50, 50]], [[100, 100, 100, 100, 100, 100, 100, 100, 100, 100]], [[25, 25, 25, 25, 50, 100, 50]], [[50, 100, 100]], [[25, 25, 100]], [[25, 25, 25, 25, 25, 25, 25, 50, 5... | The new "Avengers" movie has just been released! There are a lot of people at the cinema box office standing in a huge line. Each of them has a single `100`, `50` or `25` dollar bill. An "Avengers" ticket costs `25 dollars`.
Vasya is currently working as a clerk. He wants to sell a ticket to every single person in thi... | 0 |
{"tests": "{\"inputs\": [[[\"3\", \"K\", \"5\", \"A\", \"5\", \"6\", \"7\", \"J\", \"7\", \"9\", \"10\", \"Q\", \"Q\", \"6\", \"8\", \"7\", \"4\", \"J\", \"8\", \"9\", \"K\", \"J\", \"10\", \"4\", \"K\", \"4\"], [\"2\", \"8\", \"9\", \"Q\", \"A\", \"K\", \"6\", \"3\", \"J\", \"2\", \"4\", \"3\", \"3\", \"8\", \"A\", \"... | Flash has invited his nemesis The Turtle (He actually was a real villain! ) to play his favourite card game, SNAP. In this game a 52 card deck is dealt out so both Flash and the Turtle get 26 random cards.
Each players cards will be represented by an array like below
Flash’s pile:
```[ 'A', '5', 'Q', 'Q', '6', '2', ... | 0 |
{"tests": "{\"inputs\": [\"3\\n4\\n1 2 3 4\\n1 2 3 4\\n4\\n11 12 20 21\\n44 22 11 30\\n1\\n1000000000\\n1000000000\\n\", \"1\\n10\\n617560334 911871372 379798020 844017253 852316352 439889133 601615010 818102467 260171475 662484047\\n148682006 868690703 149843110 878510105 587798634 40092006 292693207 256527822 1287947... | $n$ players are playing a game.
There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map.
You are the game master and want to org... | 0 |
{"tests": "{\"inputs\": [\"3\\n2118 2118 2118\\n\", \"5\\n763 763 763 763 763\\n\", \"10\\n5938 4836 5938 5938 4836 4836 2780 2780 1495 4836\\n\", \"10\\n4972 4972 4972 4858 4858 4972 4972 4972 4858 4972\\n\", \"5\\n3581 3581 305 305 3581\\n\", \"4\\n2440 2440 2440 2440\\n\", \"10\\n8097 8097 8097 8097 8097 8097 8097 8... | Everyone knows that long ago on the territory of present-day Berland there lived Bindian tribes. Their capital was surrounded by n hills, forming a circle. On each hill there was a watchman, who watched the neighbourhood day and night.
In case of any danger the watchman could make a fire on the hill. One watchman coul... | 0 |
{"tests": "{\"inputs\": [\"8\\n3\\n2\\n3\\n1\\n4\\n6\\n20\\n4\\n4\\n10\\n8\\n16\\n7\\n7\\n11\\n8\\n0\", \"8\\n3\\n2\\n3\\n1\\n4\\n6\\n20\\n4\\n4\\n12\\n8\\n16\\n7\\n7\\n4\\n8\\n0\", \"8\\n3\\n2\\n3\\n1\\n4\\n6\\n20\\n4\\n4\\n14\\n8\\n16\\n7\\n7\\n11\\n8\\n0\", \"8\\n3\\n2\\n3\\n1\\n7\\n7\\n12\\n4\\n4\\n12\\n8\\n16\\n7\... | problem
JOI Pizza sells pizza home delivery along the d-meter-long ring road that runs through the city center.
JOI Pizza has n stores S1, ..., Sn on the loop line. The head office is S1. The distance from S1 to Si when moving the loop line clockwise is set to di meters. D2 , ..., dn is an integer greater than or equ... | 0 |
{"tests": "{\"inputs\": [\"9\\n1 3 6 13 15 18 19 29 31\\n10\\n4\\n1 8\\n7 3\\n6 7\\n8 5\\n\", \"9\\n1 3 6 13 15 18 19 29 31\\n10\\n2\\n1 8\\n7 3\\n6 7\\n8 5\", \"9\\n1 6 6 13 23 18 19 29 31\\n10\\n3\\n1 8\\n7 3\\n6 7\\n8 10\", \"9\\n1 3 6 13 23 18 19 29 31\\n10\\n2\\n1 8\\n7 5\\n6 7\\n8 5\", \"9\\n1 3 6 13 23 18 19 29 ... | N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i.
Tak the traveler has the following two personal principles:
- He never travels a distance of more than L in a single day.
- He never sleeps in the open. That is, he must stay at a hotel at the end of a day.
You are giv... | 0.375 |
{"tests": "{\"inputs\": [[[8, 1], [3, 0]], [[2, 0], [8, 1]], [[4, 0], [4, 0]], [[6, 0], [8, 0]], [[8, 0], [6, 0]], [[4, 3], [6, 0]], [[1, 0], [5, 0]], [[3, 3], [5, 3]], [[1, 10], [1, 4]], [[3, 3], [6, 0]], [[7, 2], [6, 8]]], \"outputs\": [[\"Auto-win\"], [\"Auto-lose\"], [\"Random\"], [\"(1..3)\"], [\"(5..6)\"], [\"(6.... | In the board game Talisman, when two players enter combat the outcome is decided by a combat score, equal to the players power plus any modifiers plus the roll of a standard 1-6 dice. The player with the highest combat score wins and the opposing player loses a life. In the case of a tie combat ends with neither player... | 0 |
{"tests": "{\"inputs\": [[-1], [0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10]], \"outputs\": [[[]], [[]], [[1]], [[1]], [[1, 3]], [[1]], [[1, 5]], [[1, 3]], [[1, 7]], [[1]], [[1, 3, 9]], [[1, 5]]]}", "source": "primeintellect"} | No Story
No Description
Only by Thinking and Testing
Look at the results of the testcases, and guess the code!
---
## Series:
01. [A and B?](http://www.codewars.com/kata/56d904db9963e9cf5000037d)
02. [Incomplete string](http://www.codewars.com/kata/56d9292cc11bcc3629000533)
03. [True or False](http://www.codewars... | 0 |
{"tests": "{\"inputs\": [\"9\\n\", \"181\\n\", \"261\\n\", \"8\\n\", \"121\\n\", \"351\\n\", \"71\\n\", \"141\\n\", \"361\\n\", \"1\\n\", \"61\\n\", \"301\\n\", \"392\\n\", \"10\\n\", \"321\\n\", \"161\\n\", \"151\\n\", \"41\\n\", \"251\\n\", \"241\\n\", \"395\\n\", \"271\\n\", \"101\\n\", \"131\\n\", \"396\\n\", \"211... | It is known that passages in Singer house are complex and intertwined. Let's define a Singer k-house as a graph built by the following process: take complete binary tree of height k and add edges from each vertex to all its successors, if they are not yet present.
<image> Singer 4-house
Count the number of non-empty ... | 0 |
{"tests": "{\"inputs\": [\"9 4 4 2 3\\n2 1\\n7 3\", \"9 4 3 2 0\\n2 1\\n7 3\", \"9 4 4 2 3\\n1 1\\n7 2\", \"9 6 4 2 3\\n2 1\\n7 3\", \"9 4 4 2 3\\n1 1\\n9 3\", \"16 4 4 2 3\\n1 1\\n7 2\", \"9 6 4 2 3\\n3 1\\n7 3\", \"9 5 4 2 3\\n1 1\\n9 3\", \"16 6 4 2 3\\n1 1\\n7 2\", \"9 6 4 1 3\\n3 1\\n7 3\", \"9 5 4 2 3\\n2 1\\n9 3... | Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well.
Today's training is to use the Amidakuji to improve luck by gaining the ability to read the future. Of course, not only relying on intuition, but also detailed probability calculation is ... | 0 |
{"tests": "{\"inputs\": [\"4\\n4\\n6\\n15\\n1000000000\", \"4\\n2\\n6\\n15\\n1001000000\", \"4\\n0\\n0\\n15\\n1001000000\", \"4\\n0\\n0\\n24\\n1001000000\", \"4\\n0\\n0\\n24\\n1001000001\", \"4\\n4\\n6\\n10\\n1100000000\", \"4\\n4\\n6\\n30\\n1000000000\", \"4\\n2\\n10\\n15\\n1000000000\", \"4\\n2\\n6\\n1\\n1001000000\"... | Given is an integer N. Snuke will choose integers s_1, s_2, n_1, n_2, u_1, u_2, k_1, k_2, e_1, and e_2 so that all of the following six conditions will be satisfied:
* 0 \leq s_1 < s_2
* 0 \leq n_1 < n_2
* 0 \leq u_1 < u_2
* 0 \leq k_1 < k_2
* 0 \leq e_1 < e_2
* s_1 + s_2 + n_1 + n_2 + u_1 + u_2 + k_1 + k_2 + e_1 + e_... | 0 |
{"tests": "{\"inputs\": [[[750, 750, 750, 750, 600]], [[700, 750, 700, 750, 600]], [[574, 574, 574, 574, 574]], [[1, 1, 1, 1, 1]], [[0, 0, 0, 0, 0]]], \"outputs\": [[\"L1260\"], [\"L1225\"], [\"L1015\"], [\"L35\"], [\"L0\"]]}", "source": "primeintellect"} | Mr Leicester's cheese factory is the pride of the East Midlands, but he's feeling a little blue. It's the time of the year when **the taxman is coming round to take a slice of his cheddar** - and the final thing he has to work out is how much money he's spending on his staff. Poor Mr Leicester can barely sleep he's so ... | 0 |
{"tests": "{\"inputs\": [\"7\\n1 4 2 5 4 3\\n2 1 5\\n3 1 6\\n4 1 7\\n5 2 7 6\\n6 1 1\\n7 0\\n6\\n1 2 2\\n1 5 3\\n1 2 0\\n5 1 3\\n6 3 3\\n1 7 4\", \"7\\n1 4 2 5 4 6\\n2 1 5\\n3 1 6\\n4 1 7\\n5 2 7 6\\n6 1 1\\n7 0\\n6\\n1 2 2\\n1 3 3\\n1 2 0\\n5 1 3\\n6 3 3\\n1 7 4\", \"7\\n1 4 2 5 4 3\\n2 1 5\\n3 1 6\\n4 1 7\\n5 2 7 6\\... | On the Internet, data is divided into packets, and each packet is transferred to a destination via a relay device called a router. Each router determines the next router to forward from the destination described in the packet. In addition, a value called TTL (Time To Live) is added to the packet to prevent it from bein... | 0 |
{"tests": "{\"inputs\": [[\"01-09-2016 01:20\"], [\"01-09-2016 01;20\"], [\"01_09_2016 01:20\"], [\"14-10-1066 12:00\"], [\"Tenth of January\"], [\"20 Sep 1988\"], [\"19-12-2050 13:34\"], [\"Tue Sep 06 2016 01:46:38 GMT+0100\"], [\"01-09-2016 00:00\"], [\"01-09-2016 2:00\"]], \"outputs\": [[true], [false], [false], [tr... | Create a function that will return ```true``` if the input is in the following date time format ```01-09-2016 01:20``` and ```false``` if it is not.
This Kata has been inspired by the Regular Expressions chapter from the book Eloquent JavaScript.
Write your solution by modifying this code:
```python
def date_checker... | 0 |
{"tests": "{\"inputs\": [[[0, 1], 10], [[1, 1], 10], [[0, 0, 0, 0, 1], 10], [[1, 0, 0, 0, 0, 0, 1], 10], [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0], 20], [[0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0], 10], [[0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0], 20], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 20], [[1, 2, 3, 4, 5, 6, 7, 8, 9, 0], 9], [[1, 2, 3, 4, 5, 6, 7,... | If you have completed the Tribonacci sequence kata, you would know by now that mister Fibonacci has at least a bigger brother. If not, give it a quick look to get how things work.
Well, time to expand the family a little more: think of a Quadribonacci starting with a signature of 4 elements and each following element ... | 0 |
{"tests": "{\"inputs\": [\"6 1 2 3 4 7\", \"6 106 2 3 4 5\", \"6 2 2 3 4 7\", \"6 159 2 3 4 5\", \"6 200 2 3 8 8\", \"6 159 2 3 3 5\", \"6 3 1 3 4 8\", \"22 144 2 3 3 5\", \"17 144 2 3 6 5\", \"9 5 1 3 15 9\", \"17 22 2 3 6 7\", \"6 373 2 3 4 5\", \"6 200 2 4 8 5\", \"6 159 2 4 4 5\", \"9 4 2 3 8 7\", \"6 323 2 4 8 5\"... | I have n tickets for a train with a rabbit. Each ticket is numbered from 0 to n − 1, and you can use the k ticket to go to p⋅ak + q⋅bk station.
Rabbit wants to go to the all-you-can-eat carrot shop at the station m station ahead of the current station, but wants to walk as short as possible. The stations are lined up ... | 0 |
{"tests": "{\"inputs\": [\"1 1 1\", \"12 2 6\", \"10 4 15\", \"1 1 3\", \"12 2 6\", \"3 2 1\", \"10 4 13\"], \"outputs\": [\"1/1\", \"1/12\", \"79/80\", \"1/1\", \"5/12\", \"5/12\", \"1/2\"]}", "source": "primeintellect"} | Assume there is an Ideal Random Number Generator which generates any real number between 0 and given integer. Two numbers are generated from the above generator using integer A and B, let's assume the numbers generated are X1 and X2.
There is another integer C. What is the probability that summation of X1 and X2 is les... | 0 |
{"tests": "{\"inputs\": [\"3\\n4\\n1 2 4 8\\n3\\n2 3 3\\n5\\n3 3 3 3 3\", \"3\\n4\\n1 2 4 8\\n3\\n2 3 3\\n5\\n1 3 3 3 3\", \"3\\n4\\n1 2 4 2\\n3\\n3 3 3\\n5\\n1 3 2 3 3\", \"3\\n4\\n1 2 8 7\\n3\\n2 1 3\\n5\\n1 3 1 3 3\", \"3\\n4\\n1 2 15 7\\n3\\n2 1 3\\n5\\n1 3 1 3 0\", \"3\\n4\\n1 2 4 8\\n3\\n3 3 3\\n5\\n1 3 3 3 3\", ... | Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.
Nim is a well-known combinatorial game, based on removing stones from piles. In this problem, we'll deal with a similar game, which we'll call Dual Nim. The rules of this game are as follows:
Initially, there are N piles of stones, numbered... | 0 |
{"tests": "{\"inputs\": [\"2\\n3 3 3 3 -3 3 2 -5 3 2 -5 -3 0\\n3 5 3 -2 4 -3 -2 -2 -1 0\", \"2\\n3 3 3 3 -3 3 2 -5 3 2 -5 -3 0\\n3 5 4 -2 4 -1 -2 -2 -1 0\", \"2\\n3 3 3 3 -3 3 2 -5 3 2 -5 -3 0\\n3 2 4 -2 4 -3 -2 -2 -1 0\", \"2\\n3 3 3 3 -3 3 2 -5 3 2 -5 -3 0\\n3 2 4 -2 5 -3 -2 -2 -1 0\", \"2\\n3 3 3 3 -3 3 2 -5 3 2 -5 ... | An old document says that a Ninja House in Kanazawa City was in fact a defensive fortress, which was designed like a maze. Its rooms were connected by hidden doors in a complicated manner, so that any invader would become lost. Each room has at least two doors.
The Ninja House can be modeled by a graph, as shown in Fi... | 0 |
{"tests": "{\"inputs\": [\"3 -1 20 200\\n19 12\\n24 121\\n25 32\\n28 19\\n28 87\\n29 49\\n32 88\\n33 70\\n37 77\\n54 33\\n56 27\\n61 59\\n67 42\\n73 15\\n76 40\\n80 73\\n83 39\\n91 34\\n91 112\\n95 95\\n\", \"0 0 5 100\\n17 3\\n42 24\\n72 22\\n72 25\\n120 25\\n\", \"0 0 5 100\\n12 105\\n15 59\\n21 1\\n27 6\\n27 76\\n\"... | Anton and Dasha like to play different games during breaks on checkered paper. By the 11th grade they managed to play all the games of this type and asked Vova the programmer to come up with a new game. Vova suggested to them to play a game under the code name "dot" with the following rules:
* On the checkered pape... | 0 |
{"tests": "{\"inputs\": [[\"trisf\", [\"first\"]], [\"oob\", [\"bob\", \"baobab\"]], [\"ainstuomn\", [\"mountains\", \"hills\", \"mesa\"]], [\"oolp\", [\"donkey\", \"pool\", \"horse\", \"loop\"]], [\"ortsp\", [\"sport\", \"parrot\", \"ports\", \"matey\"]], [\"ourf\", [\"one\", \"two\", \"three\"]]], \"outputs\": [[[\"f... | Pirates have notorious difficulty with enunciating. They tend to blur all the letters together and scream at people.
At long last, we need a way to unscramble what these pirates are saying.
Write a function that will accept a jumble of letters as well as a dictionary, and output a list of words that the pirate might ... | 0 |
{"tests": "{\"inputs\": [[\"Today I played football.\"], [\"Today I didn't play football.\"], [\"Today I didn't attempt to hardcode this Kata.\"], [\"Today I cleaned the kitchen.\"], [\"Today I learned to code like a pro.\"]], \"outputs\": [[\"I don't think you played football today, I think you didn't play at all!\"],... | Alan's child can be annoying at times.
When Alan comes home and tells his kid what he has accomplished today, his kid never believes him.
Be that kid.
Your function 'AlanAnnoyingKid' takes as input a sentence spoken by Alan (a string). The sentence contains the following structure:
"Today I " + [action_verb] +... | 0 |
{"tests": "{\"inputs\": [\"CRWEYDMET BERLAND 6:2\\nJ CRWEYDMET 5:4\\nLYUTZZCGW BERLAND 8:4\\nLYUTZZCGW CRWEYDMET 3:4\\nLYUTZZCGW J 2:2\\n\", \"AERLAND DERLAND 1:0\\nDERLAND CERLAND 0:0\\nCERLAND AERLAND 1:0\\nAERLAND BERLAND 0:0\\nDERLAND BERLAND 1:0\\n\", \"QHA BERLAND 7:2\\nVROOBFARVCFK QHA 5:7\\nZLRZXLRDUKGQM BERLAN... | Any resemblance to any real championship and sport is accidental.
The Berland National team takes part in the local Football championship which now has a group stage. Let's describe the formal rules of the local championship:
* the team that kicked most balls in the enemy's goal area wins the game;
* the victor... | 0 |
{"tests": "{\"inputs\": [\"100 1500\\n3 3\\n3 2\\n1 3\\n3 1\\n2 3\\n3 2\\n3 2\\n2 1\\n3 1\\n2 3\\n3 3\\n3 1\\n1 1\\n3 1\\n3 3\\n2 2\\n2 2\\n1 2\\n1 1\\n3 1\\n2 2\\n2 3\\n2 3\\n2 2\\n3 3\\n3 2\\n1 1\\n3 3\\n2 2\\n1 3\\n3 3\\n3 1\\n1 2\\n3 3\\n3 3\\n2 2\\n1 1\\n3 3\\n1 3\\n2 1\\n1 2\\n2 1\\n1 3\\n1 3\\n1 3\\n1 1\\n1 3\\n... | Vasya has recently bought some land and decided to surround it with a wooden fence.
He went to a company called "Wooden board" that produces wooden boards for fences. Vasya read in the catalog of products that the company has at its disposal n different types of wood. The company uses the i-th type of wood to produce ... | 0 |
{"tests": "{\"inputs\": [\"15 7\\n8 8 U\\n6 10 L\\n9 7 L\\n3 13 L\\n15 1 L\\n13 3 U\\n1 15 L\\n\", \"1000000000 1\\n117117117 882882884 U\\n\", \"10 10\\n5 6 U\\n4 7 U\\n8 3 L\\n8 3 L\\n1 10 U\\n9 2 U\\n10 1 L\\n10 1 L\\n8 3 U\\n8 3 U\\n\", \"1 2\\n1 1 L\\n1 1 U\\n\", \"20 10\\n10 11 U\\n12 9 U\\n6 15 L\\n17 4 U\\n11 1... | Andrewid the Android is a galaxy-known detective. Now he does not investigate any case and is eating chocolate out of boredom.
A bar of chocolate can be presented as an n × n table, where each cell represents one piece of chocolate. The columns of the table are numbered from 1 to n from left to right and the rows are ... | 0 |
{"tests": "{\"inputs\": [\"4 4\\n\", \"1000 1000\\n\", \"10 19\\n\", \"3 3\\n\", \"8 8\\n\", \"2019 2018\\n\", \"4 1\\n\", \"3 1\\n\", \"1848 1937\\n\", \"2000 2000\\n\", \"2 1\\n\", \"4 2\\n\", \"2021 2\\n\", \"9 9\\n\", \"101 100\\n\", \"7 7\\n\", \"999 2013\\n\", \"598 319\\n\", \"1453 938\\n\", \"17 13\\n\", \"3 2\... | There is a grid with n rows and m columns. Every cell of the grid should be colored either blue or yellow.
A coloring of the grid is called stupid if every row has exactly one segment of blue cells and every column has exactly one segment of yellow cells.
In other words, every row must have at least one blue cell, an... | 0 |
{"tests": "{\"inputs\": [\"1\\n\", \"2\\n\", \"0\\n\", \"-1\\n\", \"-2\\n\", \"-3\\n\", \"-6\\n\", \"-8\\n\", \"-14\\n\", \"-17\\n\", \"-30\\n\", \"4\\n\", \"8\\n\", \"11\\n\", \"19\\n\", \"6\\n\", \"3\\n\", \"5\\n\", \"10\\n\", \"17\\n\", \"-4\\n\", \"-5\\n\", \"-9\\n\", \"-10\\n\", \"9\\n\", \"18\\n\", \"34\\n\", \"4... | You are given a mysterious language (codenamed "Secret") available in "Custom Invocation" tab. Figure out what this language is and write a program which prints its name. Note that the program must be written in this language.
Input
This program has only one test (your program doesn't have to read anything).
Output
... | 0 |
{"tests": "{\"inputs\": [\"-850 -1000\\n-475 -325\\n1025 800\\n-325 575\\n-325 -850\\n-1000 -475\\n-100 -775\\n1250 -550\\n\", \"360 300\\n210 240\\n240 90\\n180 210\\n150 390\\n300 450\\n0 120\\n60 0\\n\", \"427 -451\\n549 -573\\n122 -1000\\n0 -85\\n183 -512\\n427 98\\n610 -329\\n0 -878\\n\", \"270 225\\n297 387\\n315... | Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing 4 points so that the points from the first set lay at the vertexes of some square and the ... | 0.625 |
{"tests": "{\"inputs\": [\"5\\n2 2\\n1 1 2 2\\n1 1 2 2\\n3 4\\n2 2 3 2\\n3 1 4 3\\n1 5\\n1 1 5 1\\n3 1 5 1\\n4 4\\n1 1 4 2\\n1 3 4 4\\n3 4\\n1 2 4 2\\n2 1 3 3\\n\", \"1\\n3456 4567\\n1 234 678 1000\\n346 903 1005 2003\\n\", \"1\\n3456 4567\\n1 234 678 1000\\n346 903 1005 2003\\n\", \"5\\n2 2\\n1 1 2 2\\n1 1 2 2\\n3 5\\... | Recently, Masha was presented with a chessboard with a height of $n$ and a width of $m$.
The rows on the chessboard are numbered from $1$ to $n$ from bottom to top. The columns are numbered from $1$ to $m$ from left to right. Therefore, each cell can be specified with the coordinates $(x,y)$, where $x$ is the column n... | 0 |
{"tests": "{\"inputs\": [\"42 28\\n7 19\\n15 24\\n3 42\\n18 5\\n32 27\\n26 20\\n40 30\\n35 2\\n14 8\\n22 10\\n36 4\\n16 14\\n21 29\\n37 40\\n2 12\\n30 21\\n19 17\\n39 34\\n31 28\\n20 3\\n4 33\\n11 42\\n26 21\\n9 10\\n4 32\\n6 1\\n1 14\\n14 12\\n\", \"2 2\\n1 2\\n2 1\\n\", \"3 2\\n3 2\\n2 1\\n\", \"3 3\\n1 3\\n2 1\\n3 2... | Hexadecimal likes drawing. She has drawn many graphs already, both directed and not. Recently she has started to work on a still-life «interesting graph and apples». An undirected graph is called interesting, if each of its vertices belongs to one cycle only — a funny ring — and does not belong to any other cycles. A f... | 0 |
{"tests": "{\"inputs\": [\"3\\n2 4 6 8 10 12 14 16 18\\n\", \"4\\n1936924 6264932 1936924 -4555088 -8883096 -19703116 -8883096 1936924 12756944 -8883096 -8883096 -8883096 6264932 1936924 6264932 -8883096\\n\", \"3\\n399 -1025 -129 -497 927 -577 479 31 -49\\n\", \"4\\n3284309 -2011475 3284309 -23194611 -12603043 -730725... | The Smart Beaver from ABBYY loves puzzles. One of his favorite puzzles is the magic square. He has recently had an idea to automate the solution of this puzzle. The Beaver decided to offer this challenge to the ABBYY Cup contestants.
The magic square is a matrix of size n × n. The elements of this matrix are integers.... | 0 |
{"tests": "{\"inputs\": [\"1 1 1 1 1 1\\n1 1 1 0 0 0\\n1 0 0 0 1 0\\n3 0 0 3 0 0\\n3 1 0 1 3 1\\n1 2 0 2 0 1\\n0 0 1 1 0 3\\n1 0 0 1 1 0\\n0 0 0 0 0 0\", \"1 1 1 1 1 1\\n1 1 1 0 0 0\\n1 0 0 0 1 0\\n3 0 0 0 0 0\\n3 1 0 1 3 1\\n1 2 0 2 0 1\\n0 0 1 1 0 3\\n1 0 0 1 1 0\\n0 0 0 0 0 0\", \"1 1 1 1 1 1\\n1 1 1 0 0 0\\n1 0 0 0... | Currently, people's entertainment is limited to programming contests. The activity of the entertainment club of a junior high school to which she belongs is to plan and run a programming contest. Her job is not to create problems. It's a behind-the-scenes job of soliciting issues from many, organizing referees, and pro... | 0 |
{"tests": "{\"inputs\": [[1984], [2000], [2004], [8], [0], [1234], [1100], [1194]], \"outputs\": [[true], [true], [true], [true], [true], [false], [false], [false]]}", "source": "primeintellect"} | In this kata you should simply determine, whether a given year is a leap year or not. In case you don't know the rules, here they are:
* years divisible by 4 are leap years
* but years divisible by 100 are **not** leap years
* but years divisible by 400 are leap years
Additional Notes:
* Only valid years (positive i... | 0 |
{"tests": "{\"inputs\": [\"3\\n4 2\\n1 13 7 17\\n1 3\\n6 2\\n10 10 10 10 11 11\\n3 3\\n4 4\\n1000000000 1000000000 1000000000 1000000000\\n1 1 1 1\\n\", \"3\\n4 2\\n1 13 7 0\\n1 3\\n6 2\\n10 10 10 10 11 11\\n3 3\\n4 4\\n1000000000 1000000000 1000000000 1000000000\\n1 1 1 1\\n\", \"3\\n4 2\\n1 13 7 1\\n1 3\\n6 2\\n10 10... | Lee just became Master in Codeforces, and so, he went out to buy some gifts for his friends. He bought $n$ integers, now it's time to distribute them between his friends rationally...
Lee has $n$ integers $a_1, a_2, \ldots, a_n$ in his backpack and he has $k$ friends. Lee would like to distribute all integers in his b... | 0 |
{"tests": "{\"inputs\": [[100000, 1, 2000, 15, 1], [100000, 1, 9185, 12, 1], [100000000, 1, 100000, 50, 1], [100000000, 1.5, 10000000, 50, 1], [100000000, 5, 1000000, 50, 1], [9999, 61.8161, 10000.0, 3, 0], [9998.5, 61.8155, 10000.0, 3, 0], [10000.0, 0, 10000.0, 2, 0], [999.5, 61.87, 1000.0, 3, 0]], \"outputs\": [[true... | John has some amount of money of which he wants to deposit a part `f0` to the bank at the beginning
of year `1`. He wants to withdraw each year for his living an amount `c0`.
Here is his banker plan:
- deposit `f0` at beginning of year 1
- his bank account has an interest rate of `p` percent per year, constant over t... | 0 |
{"tests": "{\"inputs\": [\"203 30\\n-3 3\\n-3 10\\n-7 -6\\n1 8\\n-5 2\\n-9 10\\n-6 4\\n8 2\\n-2 -5\\n-3 2\\n1 6\\n-6 -9\\n10 9\\n-3 -9\\n-7 5\\n3 8\\n1 -4\\n-4 -5\\n-2 1\\n-6 -10\\n10 10\\n4 -1\\n0 -2\\n9 9\\n-5 6\\n-9 -5\\n7 -10\\n-6 3\\n-3 -4\\n9 -4\\n\", \"25965 53\\n-1 -2\\n1 5\\n0 3\\n4 4\\n-3 -2\\n5 4\\n-3 -4\\n-... | It has been noted that if some ants are put in the junctions of the graphene integer lattice then they will act in the following fashion: every minute at each junction (x, y) containing at least four ants a group of four ants will be formed, and these four ants will scatter to the neighbouring junctions (x + 1, y), (x ... | 0 |
{"tests": "{\"inputs\": [\"5 5\\n1 2\\n1 3\\n3 4\\n3 5\\n4 5\\n\", \"5 1\\n1 2\\n\", \"4 3\\n1 2\\n1 3\\n2 3\\n\", \"10 39\\n7 2\\n7 1\\n5 6\\n5 8\\n9 10\\n2 8\\n8 7\\n3 10\\n10 1\\n8 10\\n2 3\\n7 4\\n3 9\\n4 10\\n3 4\\n6 1\\n6 7\\n9 5\\n9 7\\n6 9\\n9 4\\n4 6\\n7 5\\n8 3\\n2 5\\n9 2\\n10 7\\n8 6\\n8 9\\n7 3\\n5 3\\n4 5... | In the State of Takahashi in AtCoderian Federation, there are N cities, numbered 1, 2, ..., N.
M bidirectional roads connect these cities.
The i-th road connects City A_i and City B_i.
Every road connects two distinct cities.
Also, for any two cities, there is at most one road that directly connects them.
One day, it w... | 0 |
{"tests": "{\"inputs\": [\"150346839\", \"73\", \"3704579452095997258280591217784156184311155893966777597430447796450532\", \"19664274\", \"22\", \"4271374355872521214646189206931447259915557225329718337053006899386612\", \"4636365955583185577236629139430025754175155260406833067161877454344706\", \"2584175\", \"4450684... | We will call a non-negative integer increasing if, for any two adjacent digits in its decimal representation, the digit to the right is greater than or equal to the digit to the left. For example, 1558, 11, 3 and 0 are all increasing; 10 and 20170312 are not.
Snuke has an integer N. Find the minimum number of increasi... | 0 |
{"tests": "{\"inputs\": [\"6\\n1 4 1 3 2 4\\n5\\n1 2 5 4 5\\n10\\n1 1 1 1 1 1 1 1 1 1\\n9\\n1 1 1 1 1 1 1 1 1\\n12\\n1 4 1 3 2 4 3 3 2 1 2 2\\n1\\n5050\\n3\\n10000 10000 100\\n0\", \"6\\n1 4 1 3 2 4\\n5\\n1 2 5 4 5\\n10\\n1 1 1 1 1 1 1 1 1 1\\n9\\n1 1 1 1 1 1 1 1 1\\n12\\n1 4 1 3 2 4 3 1 2 1 2 2\\n1\\n5050\\n3\\n10000 ... | The following sorting operation is repeated for the stacked blocks as shown in Fig. A.
1. Stack all the bottom blocks (white blocks in Figure a) on the right edge (the remaining blocks will automatically drop one step down, as shown in Figure b).
2. If there is a gap between the blocks, pack it to the left to eliminat... | 0 |
{"tests": "{\"inputs\": [\"10\\n4 9 1 9 5 9 2 3 2 1\\n8 7 6 5 10 5 4 4 7 6\\n5\\n4 3 2 5 1\\n4 4 4 4 4\\n4\\n4 1 3 2\\n4 3 2 1\\n0\", \"10\\n4 9 1 9 5 9 2 3 2 1\\n8 7 6 5 10 5 4 4 7 6\\n0\\n4 3 2 5 1\\n4 4 4 4 4\\n4\\n4 1 3 2\\n4 3 2 1\\n0\", \"10\\n4 9 1 9 5 9 2 3 2 1\\n8 7 6 5 10 5 4 4 7 9\\n0\\n4 3 2 5 1\\n4 4 4 4 4... | There is a game called Packet Monster. A game that catches, raises, fights and exchanges monsters, and is very popular all over Japan. Of course, in my class. That's why I also raise monsters so that I can play with everyone in this game, but sadly there is no opponent to play against. I'm not the type who is good at t... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.