info stringlengths 120 50k | question stringlengths 504 10.4k | avg@8_qwen3_4b_instruct_2507 float64 0 0.88 |
|---|---|---|
{"tests": "{\"inputs\": [[0], [9], [99], [999], [9999], [99999], [-5], [-54], [-543], [-5432], [-54321], [0.5], [0.25], [0.125], [0.0625], [0.03125], [10], [14], [18], [20], [24], [50], [100], [110], [111], [-10], [-14], [-18], [-20], [-100], [-110], [-111], [1000], [10000], [10306], [10006], [10006.005], [-10306.005],... | Create a function that takes a Number as its argument and returns a Chinese numeral string. You don't need to validate the input argument, it will always be a Number in the range `[-99999.999, 99999.999]`, rounded to 8 decimal places.
Simplified Chinese numerals have characters representing each number from 0 to 9 and... | 0 |
{"tests": "{\"inputs\": [\"3 5\\n12 8 25 19 44\\n9 13 16 0 17\\n20 14 16 10 22\\n17 27 18 16\\n9 7 0\\n19 5\\n21\\n0 0\", \"3 5\\n12 15 70 19 44\\n9 13 16 0 17\\n20 14 16 10 22\\n17 27 18 16\\n9 7 0\\n19 5\\n21\\n0 0\", \"3 5\\n12 8 25 19 23\\n9 13 16 0 17\\n20 9 16 10 22\\n17 27 18 16\\n1 7 0\\n19 5\\n21\\n0 0\", \"3 ... | The Aizu Wakamatsu city office decided to lay a hot water pipeline covering the whole area of the city to heat houses. The pipeline starts from some hot springs and connects every district in the city. The pipeline can fork at a hot spring or a district, but no cycle is allowed. The city office wants to minimize the le... | 0 |
{"tests": "{\"inputs\": [[\"red 1 yellow 2 black 3 white 4\"], [\"1 red 2 white 3 violet 4 green\"], [\"1 1 2 2 3 3 4 4\"], [\"#@&fhds 123F3f 2vn2# 2%y6D @%fd3 @!#4fs W@R^g WE56h%\"], [\"\"]], \"outputs\": [[\"[{name : 'red', id : '1'}, {name : 'yellow', id : '2'}, {name : 'black', id : '3'}, {name : 'white', id : '4'}... | You're given a string containing a sequence of words separated with whitespaces. Let's say it is a sequence of patterns: a name and a corresponding number - like this:
```"red 1 yellow 2 black 3 white 4"```
You want to turn it into a different **string** of objects you plan to work with later on - like this:
```"[{n... | 0 |
{"tests": "{\"inputs\": [[\"0\"], [\"3/4\"], [\"12/4\"], [\"4/5\"], [\"0.66\"], [\"22/23\"], [\"1001/3456\"], [\"16/17\"], [\"30/45\"], [\"1.25\"], [\"75/3\"], [\"2/8\"], [\"0.9\"]], \"outputs\": [[[]], [[\"1/2\", \"1/4\"]], [[\"3\"]], [[\"1/2\", \"1/4\", \"1/20\"]], [[\"1/2\", \"1/7\", \"1/59\", \"1/5163\", \"1/533079... | Given a rational number n
``` n >= 0, with denominator strictly positive```
- as a string (example: "2/3" in Ruby, Python, Clojure, JS, CS, Go)
- or as two strings (example: "2" "3" in Haskell, Java, CSharp, C++, Swift)
- or as a rational or decimal number (example: 3/4, 0.67 in R)
- or two integers (Fortran)
d... | 0 |
{"tests": "{\"inputs\": [\"3\\n000\\n000\\n000\\n\", \"10\\n1111100000\\n0010100000\\n0110111000\\n0000001000\\n1011001010\\n0010100001\\n0010111000\\n0011001010\\n0000110010\\n0000001100\\n\", \"10\\n1101010101\\n1110101010\\n0111010101\\n1011101010\\n0101110101\\n1010111010\\n0101011101\\n1010101110\\n0101010111\\n10... | After years of hard work scientists invented an absolutely new e-reader display. The new display has a larger resolution, consumes less energy and its production is cheaper. And besides, one can bend it. The only inconvenience is highly unusual management. For that very reason the developers decided to leave the e-read... | 0 |
{"tests": "{\"inputs\": [[\"Codewars@codewars123.com\"], [\"bgA5<1d-tOwUZTS8yQ\"], [\"P*K4%>mQUDaG$h=cx2?.Czt7!Zn16p@5H\"], [\"RYT'>s&gO-.CM9AKeH?,5317tWGpS<*x2ukXZD\"], [\"$Cnl)Sr<7bBW-&qLHI!mY41ODe\"], [\"@mw>0=QD-iAx!rp9TaG?o&M%l$34L.nbft\"]], \"outputs\": [[[1, 18, 3, 2]], [[7, 6, 3, 2]], [[9, 9, 6, 9]], [[15, 8, 6... | In this Kata, you will be given a string and your task will be to return a list of ints detailing the count of uppercase letters, lowercase, numbers and special characters, as follows.
```Haskell
Solve("*'&ABCDabcde12345") = [4,5,5,3].
--the order is: uppercase letters, lowercase, numbers and special characters.
```
... | 0 |
{"tests": "{\"inputs\": [\"4\\n3 13\\n0 1 2\\n2 777\\n0 4\\n3 255\\n0 1 3\\n10 1000000000\\n0 1 2 3 4 5 6 7 8 9\\n\", \"4\\n3 13\\n0 1 2\\n2 777\\n0 2\\n3 255\\n0 1 3\\n10 1000000000\\n0 1 2 3 4 5 6 7 8 9\\n\", \"4\\n3 14\\n0 1 2\\n2 777\\n0 2\\n3 255\\n0 1 3\\n10 1000000000\\n0 1 2 3 4 5 6 7 8 9\\n\", \"4\\n3 13\\n0 1... | In Berland, $n$ different types of banknotes are used. Banknotes of the $i$-th type have denomination $10^{a_i}$ burles (burles are the currency used in Berland); the denomination of banknotes of the first type is exactly $1$.
Let's denote $f(s)$ as the minimum number of banknotes required to represent exactly $s$ bur... | 0 |
{"tests": "{\"inputs\": [[\"\"], [\"Codewars\"], [\"Codewars \"], [\"Codewars Is Nice\"], [\"codewars is nice\"], [\"CodeWars is nice\"], [\"c i n\"], [\"codewars is nice\"], [\"Loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo... | The marketing team is spending way too much time typing in hashtags.
Let's help them with our own Hashtag Generator!
Here's the deal:
- It must start with a hashtag (`#`).
- All words must have their first letter capitalized.
- If the final result is longer than 140 chars it must return `false`.
- If the input or ... | 0 |
{"tests": "{\"inputs\": [[[50, 2, 1, 9]], [[3655, 89]], [[8]], [[12, 13, 89, 155, 8, 26, 0]], [[76, 4, 3, 81, 514, 6, 716]], [[817, 6879, 163, 348, 8, 22, 47]], [[411, 742, 89, 691, 284]], [[587, 625, 638, 898, 122]], [[797, 535, 210, 87]], [[5, 2, 1, 9, 50, 56]], [[197, 853, 819]], [[23044, 2, 7626, 914, 7800]], [[451... | Create a function that takes a list of one or more non-negative integers, and arranges them such that they form the largest possible number.
Examples:
`largestArrangement([4, 50, 8, 145])` returns 8504145 (8-50-4-145)
`largestArrangement([4, 40, 7])` returns 7440 (7-4-40)
`largestArrangement([4, 46, 7])` returns 74... | 0 |
{"tests": "{\"inputs\": [[\" l f l k djmi k\", \"___\\\\_____//_____/_\"], [\" ikm il h llmmc a i\", \"__\\\\_______________________\"], [\" h c \", \"__/____\"], [\"q h\", \"_/_\"], [\" cg dg em lfh cdam\", \"_______/____\\\\_____/_/\"]], \"outputs\": [[false], [true], [true], [true], [false]]}", "sourc... | The sports centre needs repair. Vandals have been kicking balls so hard into the roof that some of the tiles have started sticking up. The roof is represented by r.
As a quick fix, the committee have decided to place another old roof over the top, if they can find one that fits. This is your job.
A 'new' roof (f) wil... | 0 |
{"tests": "{\"inputs\": [\"3\\n3\\n1 2\\n1 3\\n4\\n1 2\\n2 3\\n3 4\\n8\\n1 2\\n2 3\\n3 4\\n1 5\\n5 6\\n6 7\\n5 8\\n\", \"3\\n3\\n1 2\\n2 3\\n4\\n1 2\\n2 3\\n3 4\\n8\\n1 2\\n2 3\\n3 4\\n1 5\\n5 6\\n6 7\\n5 8\\n\", \"3\\n3\\n1 2\\n2 3\\n4\\n1 2\\n2 3\\n3 4\\n8\\n1 2\\n2 3\\n3 4\\n1 7\\n5 6\\n6 7\\n5 8\\n\", \"3\\n3\\n1 2... | Gildong is playing with his dog, Badugi. They're at a park that has $n$ intersections and $n-1$ bidirectional roads, each $1$ meter in length and connecting two intersections with each other. The intersections are numbered from $1$ to $n$, and for every $a$ and $b$ ($1 \le a, b \le n$), it is possible to get to the $b$... | 0 |
{"tests": "{\"inputs\": [\"3\\n2 5\\n4 2\\n6 3\", \"6\\n19 92\\n64 64\\n78 48\\n57 33\\n142 6\\n95 73\", \"4\\n1 5\\n2 6\\n0 7\\n4 8\", \"3\\n1 5\\n4 4\\n6 3\", \"6\\n19 92\\n64 64\\n29 48\\n57 33\\n142 6\\n95 73\", \"4\\n1 5\\n0 6\\n0 7\\n4 8\", \"6\\n19 92\\n64 64\\n29 48\\n57 33\\n142 6\\n95 15\", \"4\\n1 3\\n0 6\\n... | We have a directed weighted graph with N vertices. Each vertex has two integers written on it, and the integers written on Vertex i are A_i and B_i.
In this graph, there is an edge from Vertex x to Vertex y for all pairs 1 \leq x,y \leq N, and its weight is {\rm min}(A_x,B_y).
We will consider a directed cycle in thi... | 0 |
{"tests": "{\"inputs\": [[\"12:30 am\"], [\"12:02 pm\"], [\"01:00 pm\"], [\"11:12 am\"], [\"05:20 pm\"], [\"04:20 am\"]], \"outputs\": [[[false, false, true]], [[false, true, false]], [[true, false, false]], [[false, false, true]], [[false, false, true]], [[false, true, false]]]}", "source": "primeintellect"} | # Task
You are given a `moment` in time and space. What you must do is break it down into time and space, to determine if that moment is from the past, present or future.
`Time` is the sum of characters that increase time (i.e. numbers in range ['1'..'9'].
`Space` in the number of characters which do not increase... | 0 |
{"tests": "{\"inputs\": [\"5 4\\n1 2\\n2 3\\n3 4\\n4 5\\n4 6\\n1 2\\n1 3\\n1 4\\n2 4\\n2 4\\n3 4\\n5 0\\n0 0\", \"5 4\\n1 2\\n2 3\\n3 4\\n5 5\\n4 6\\n1 2\\n1 3\\n1 4\\n2 4\\n2 4\\n3 4\\n5 0\\n0 0\", \"5 4\\n2 2\\n2 3\\n3 4\\n5 5\\n4 6\\n1 2\\n1 3\\n1 4\\n1 4\\n1 4\\n3 4\\n0 0\\n0 0\", \"5 4\\n2 1\\n2 3\\n3 4\\n4 5\\n4 ... | A witch named Marie lived deep in a remote forest. Since she is a witch, she magically covers everything she needs to live, such as food, water, and fuel.
Her magic is activated by drawing a magic circle using some magical stones and strings. This magic circle is drawn by placing stones and tying several pairs of ston... | 0.375 |
{"tests": "{\"inputs\": [\"9\\nBEWPVCRWH\\nZQNZYIJX\\nBAVREA\\nPA\\nHJMYITEOX\\nBCJHMRMNK\\nBP\\nQVFABZ\\nPRGKSPUNA\", \"7\\nEBBYBAR\\nJOZ\\nBMHQUVA\\nBPA\\nISU\\nMCMABAOBHZ\\nSZMEHMA\", \"3\\nABCA\\nXBAZ\\nBAE\", \"3\\nACBA\\nZABX\\nAEB\", \"3\\n@DBA\\nZAAX\\nAEB\", \"9\\nBEWPVCRWH\\nZQNZYIJX\\nAERVAB\\nPA\\nHJMYITEOX... | Snuke has N strings. The i-th string is s_i.
Let us concatenate these strings into one string after arranging them in some order. Find the maximum possible number of occurrences of `AB` in the resulting string.
Constraints
* 1 \leq N \leq 10^{4}
* 2 \leq |s_i| \leq 10
* s_i consists of uppercase English letters.
In... | 0.875 |
{"tests": "{\"inputs\": [[\"the sky is blue\"], [\" hello world \"], [\"a good example\"], [\" Bob Loves Alice \"], [\"Alice does not even like bob\"]], \"outputs\": [\"blue is sky the\", \"world hello\", \"example good a\", \"Alice Loves Bob\", \"bob like even not does Alice\"]}", "source": "primeintellect"... | Given an input string s, reverse the order of the words.
A word is defined as a sequence of non-space characters. The words in s will be separated by at least one space.
Return a string of the words in reverse order concatenated by a single space.
Note that s may contain leading or trailing spaces or multiple spaces... | 0 |
{"tests": "{\"inputs\": [[\"Hello World\"], [\"I am your father\"], [\"I do not know what else I can test. Be cool. Good luck\"], [\"IlRzEeAaSsGbTtBgOo\"], [\"\"]], \"outputs\": [[\"H3110 W0r1d\"], [\"1 4m y0ur f47h3r\"], [\"1 d0 n07 kn0w wh47 3153 1 c4n 7357. 83 c001. 600d 1uck\"], [\"112233445566778900\"], [\"\"]]}",... | # Number encrypting: cypher
## Part I of Number encrypting Katas
***
## Introduction
Back then when the internet was coming up, most search functionalities simply looked for keywords in text to show relevant documents. Hackers weren't very keen on having their information displayed on websites, bulletin boards, newsgr... | 0 |
{"tests": "{\"inputs\": [[0], [5], [10], [15], [25]], \"outputs\": [[1], [3], [6], [9], [16]]}", "source": "primeintellect"} | Mutual Recursion allows us to take the fun of regular recursion (where a function calls itself until a terminating condition) and apply it to multiple functions calling each other!
Let's use the Hofstadter Female and Male sequences to demonstrate this technique. You'll want to create two functions `F` and `M` such th... | 0.125 |
{"tests": "{\"inputs\": [\"3 4 4\\n1101\\n0110\\n1101\\n1 1 3 4\\n1 1 3 1\\n2 2 3 4\\n1 2 3 4\", \"5 5 6\\n11010\\n01110\\n10101\\n11101\\n01010\\n1 1 5 5\\n1 2 4 5\\n2 3 3 5\\n3 3 3 3\\n3 1 3 5\\n1 1 3 4\", \"5 5 6\\n11010\\n01110\\n10101\\n11101\\n01010\\n1 1 5 5\\n1 2 4 5\\n2 3 3 5\\n5 3 3 3\\n3 1 3 5\\n1 1 3 4\", \... | Nuske has a grid with N rows and M columns of squares. The rows are numbered 1 through N from top to bottom, and the columns are numbered 1 through M from left to right. Each square in the grid is painted in either blue or white. If S_{i,j} is 1, the square at the i-th row and j-th column is blue; if S_{i,j} is 0, the ... | 0 |
{"tests": "{\"inputs\": [[[1, 2, 7], 3], [[1, 2, 7, 0, 5], 2], [[1, 1, 1, 1, 7, 0, 5], 2], [[1, 2, 7, 0, 5], 0.6], [[1, 2, 7, 0, 5], 0]], \"outputs\": [[16], [12], [12], [4.24], [5.0]]}", "source": "primeintellect"} | The Binomial Form of a polynomial has many uses, just as the standard form does. For comparison, if p(x) is in Binomial Form and q(x) is in standard form, we might write
p(x) := a0 \* xC0 + a1 \* xC1 + a2 \* xC2 + ... + aN \* xCN
q(x) := b0 + b1 \* x + b2 \* x^(2) + ... + bN \* x^(N)
Both forms have tricks for eval... | 0 |
{"tests": "{\"inputs\": [\"13 1\\n761.044449428\\n\", \"35 8\\n984227318.2031144444444444494637612\\n\", \"31 15\\n2707786.24030444444444444724166\\n\", \"3 1\\n0.1\\n\", \"9 2\\n23999.448\\n\", \"12 5\\n872.04488525\\n\", \"320 142\\n2704701300865535.43222331223343411413001111322010242013132301034414420112430314444444... | Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he developed a tricky plan. Each second, he can ask his teacher to round the grade at any place after th... | 0 |
{"tests": "{\"inputs\": [[7], [1], [4], [0], [-25]], \"outputs\": [[\" 1 \\n 121 \\n 12321 \\n 1234321 \\n 123454321 \\n 12345654321 \\n1234567654321\"], [\"1\"], [\" 1 \\n 121 \\n 12321 \\n1234321\"], [\"\"], [\"\"]]}", "source": "primeintellect"} | ###Task:
You have to write a function **pattern** which creates the following Pattern(See Examples) upto n(parameter) number of rows.
####Rules/Note:
* If the Argument is 0 or a Negative Integer then it should return "" i.e. empty string.
* All the lines in the pattern have same length i.e equal to the number of char... | 0 |
{"tests": "{\"inputs\": [[1], [10], [11], [22], [23], [47], [50], [52], [60], [61]], \"outputs\": [[[1]], [[2, 8]], [[2, 8, 1]], [[2, 8, 12]], [[2, 8, 13]], [[2, 8, 18, 19]], [[2, 8, 18, 22]], [[2, 8, 18, 24]], [[2, 8, 18, 32]], [[2, 8, 18, 32, 1]]]}", "source": "primeintellect"} | You are a *khm*mad*khm* scientist and you decided to play with electron distribution among atom's shells.
You know that basic idea of electron distribution is that electrons should fill a shell untill it's holding the maximum number of electrons.
---
Rules:
- Maximum number of electrons in a shell is distribute... | 0 |
{"tests": "{\"inputs\": [\"2\\nAAAA\\nBAB\", \"2\\nA@AA\\nBAB\", \"2\\nAA?A\\nBBB\", \"2\\n@AAA\\nABA\", \"2\\nABAA\\nBAA\", \"2\\nABAA\\nABB\", \"2\\nABAA\\n@BC\", \"2\\nBABB\\n?BB\", \"2\\nBABB\\nABA\", \"2\\nAA@A\\nBAB\", \"2\\nAAAA\\nABB\", \"2\\nAA?A\\nBAB\", \"2\\nAAAA\\nBBA\", \"2\\nAAAB\\nBBA\", \"2\\nBAAA\\nBB... | Read problems statements in Mandarin Chinese , Russian and Vietnamese as well.
You are given a uniformly randomly generated string S, consisting of letters from the set {"A", "B"}. Your task is to find a string T that appears in S as a subsequence exactly twice.
In other words, you need to find such a string T, tha... | 0 |
{"tests": "{\"inputs\": [[[1, 2, 3], [1, 2, 3, 4, 5]], [[1, 2, 3, 4], [1, 2, 3, 5]], [[1, 2, 3, 4, 5], []], [[1, 2, 3], [1, 2, 3]], [[6, 6, 6, 6, 6, 6], [6, null, null, 6, 6, null]], [[6], [6, 6, 6, 6, 6, 6]], [[], []], [[null], [null]]], \"outputs\": [[0.6], [0.75], [0.0], [1.0], [0.5], [0.16666666666666666], [1.0], [... | Calculate the number of items in a vector that appear at the same index in each vector, with the same value.
```python
vector_affinity([1, 2, 3, 4, 5], [1, 2, 2, 4, 3]) # => 0.6
vector_affinity([1, 2, 3], [1, 2, 3]) # => 1.0
```
Affinity value should be realized on a scale of 0.0 to 1.0, with 1.0 being absolut... | 0 |
{"tests": "{\"inputs\": [\"15\\n3.13979,8.51743\\n2.39506,3.84915\\n2.68432,5.39095\\n5.61904,9.16332\\n7.85653,4.75593\\n2.84021,5.41511\\n1.79500,8.59211\\n7.55389,8.17604\\n4.70665,4.66125\\n1.63470,4.42538\\n7.34959,4.61981\\n5.09003,8.11122\\n5.24373,1.30066\\n0.13517,1.83659\\n7.57313,1.58150\\n0\", \"15\\n3.1397... | Stick n circular stickers with a radius of 1 on a square origami paper with a side length of 10. The stickers can be stacked. Create a program that reads the coordinates of the position where the stickers are to be attached and outputs the number of stickers at the place where the stickers overlap most on the origami p... | 0.25 |
{"tests": "{\"inputs\": [\"1\\n1\", \"3\\n1 2 1\", \"3\\n2 2 1\", \"2\\n1 3\", \"1\\n2\", \"3\\n2 3 1\", \"2\\n1 1\", \"10\\n1 3 2 2 3 2 3 2 1 3\", \"2\\n2 1\", \"3\\n2 2 2\", \"3\\n2 2 3\", \"3\\n3 2 3\", \"3\\n3 1 3\", \"10\\n1 3 3 3 3 2 3 2 1 3\", \"3\\n1 3 1\", \"10\\n1 3 1 2 3 2 3 2 1 3\", \"10\\n1 3 3 3 3 2 3 2 2... | There are N dishes, numbered 1, 2, \ldots, N. Initially, for each i (1 \leq i \leq N), Dish i has a_i (1 \leq a_i \leq 3) pieces of sushi on it.
Taro will perform the following operation repeatedly until all the pieces of sushi are eaten:
* Roll a die that shows the numbers 1, 2, \ldots, N with equal probabilities, a... | 0.125 |
{"tests": "{\"inputs\": [\"1 1\\n3 1\\n3 3\\n3 2\\n3\\n3 12\\n9 3\\n11 12\\n8 7\\n5\\n15 3\\n17 7\\n22 5\\n7 6\\n5\\n6 11\\n8 2\\n16 9\\n10 8\\n2\\n0 0\", \"2 1\\n3 1\\n3 3\\n3 2\\n3\\n3 12\\n9 3\\n11 12\\n8 7\\n5\\n15 3\\n17 7\\n22 5\\n7 6\\n5\\n6 11\\n8 2\\n16 9\\n15 8\\n0\\n0 0\", \"2 1\\n3 1\\n3 3\\n3 2\\n3\\n3 12\... | Create a program to determine the positional relationship between a triangle and a circle on a plane. All target figures shall include boundaries. The triangle is given the position of three vertices, and the circle is given the position of the center and the radius. The position is given by a set of two integers in a ... | 0 |
{"tests": "{\"inputs\": [\"1\\n100 26\\ns................PPPP.CCCCC..UUUUUU.........YYYQQQQQQQ...GGGGG............MMM.....JJJJ..............\\n.OOOOOO....EEE....................................................SSSSSS........LLLLLL......NNNIIII.\\n......FFFFFF...VVVV..ZZZBBB...KKKKK..WWWWWWWXXX..RRRRRRR......AAAAADDDDDDD... | The mobile application store has a new game called "Subway Roller".
The protagonist of the game Philip is located in one end of the tunnel and wants to get out of the other one. The tunnel is a rectangular field consisting of three rows and n columns. At the beginning of the game the hero is in some cell of the leftmo... | 0 |
{"tests": "{\"inputs\": [\"8 4\\n2 1 3 1 1 5 1 3\\n2 3 2 4 1 0 2 1\\n0 3 0 2 1 1 4 2\\n1 2 3 2 1 1 5 4\\n0 2 0 1 1 3 2 1\\n1 3 1 2 2 4 3 2\\n5 1 2 1 4 1 1 5\\n4 1 1 0 1 2 2 1\\n2 -1 -1 -1\\n0 3 -1 -1\\n-1 2 2 4\\n-1 1 -1 1\\n5 3\\n1 0 2 3 5\\n2 3 7 2 1\\n2 5 4 2 2\\n8 9 0 3 3\\n3 6 0 4 7\\n-1 -1 2\\n-1 3 5\\n0 4 -1\\n... | Mr. A came to Aizu for sightseeing. You can overlook the Aizu Basin from the window of the hotel where you stayed. As I was looking at the scenery, I noticed a piece of the photo on the floor. Apparently I took the outside view from the window. "Which area did you take?" A asked, holding the photo so that the view outs... | 0 |
{"tests": "{\"inputs\": [\"2\\n1 1\\n3 3\\n4\\n1.0 0.5\\n1.0 2.5\\n3.0 1.5\\n3.0 3.589169796022375\\n1\\n2.0 2.0\\n0\", \"2\\n1 1\\n3 3\\n4\\n1.1278569475953018 0.5\\n1.0 2.5\\n3.0 1.5\\n3.0 3.5\\n1\\n2.0 2.0\\n0\", \"2\\n1 1\\n5 3\\n4\\n1.0 0.5\\n1.0 2.5\\n3.0 1.5\\n3.0 3.589169796022375\\n1\\n2.0 2.0\\n0\", \"2\\n1 1... | Brave Ponta has finally arrived at the final dungeon. This is a dark wilderness in front of the fort of the evil emperor Boromos, with fairly strong monsters guarding their territories.
<image>
Figure 1: Wilderness
As shown in Fig. 1, the wilderness is represented by a 4 × 4 square region with the southwest as the ... | 0 |
{"tests": "{\"inputs\": [[[1], [1]], [[1, 2], [1]], [[1, 2, 3, 4], [4, 3, 2, 1]], [[], []], [[1, 2, 3, 4, 5, 6], []], [[], [1, 2, 3, 4, 5, 6]]], \"outputs\": [[[2]], [[2, 2]], [[5, 5, 5, 5]], [[]], [[1, 2, 3, 4, 5, 6]], [[1, 2, 3, 4, 5, 6]]]}", "source": "primeintellect"} | ## Nova polynomial add
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/571a2e2df24bdfd4e20001f5) )
... | 0 |
{"tests": "{\"inputs\": [[\"abab\", \"apple banana apple banana\"], [\"abba\", \"car truck truck car\"], [\"abab\", \"apple banana banana apple\"], [\"aaaa\", \"cat cat cat cat\"], [\"aaaa\", \"cat cat dog cat\"], [\"bbbabcb\", \"c# c# c# javascript c# python c#\"], [\"abcdef\", \"apple banana cat donkey elephant flowe... | Write
```python
word_pattern(pattern, string)
```
that given a ```pattern``` and a string ```str```, find if ```str``` follows the same sequence as ```pattern```.
For example:
```python
word_pattern('abab', 'truck car truck car') == True
word_pattern('aaaa', 'dog dog dog dog') == True
word_pattern('abab', 'apple bana... | 0 |
{"tests": "{\"inputs\": [\"6 1 654321100 654321115\\n\", \"10 7 987654339 987654340\\n\", \"7 8 305686738 573739036\\n\", \"10 1 100 1000000000\\n\", \"3 12 987654345 987654347\\n\", \"1 1 1 1000000000\\n\", \"2 2 987654333 987654335\\n\", \"3 3 240953737 404170887\\n\", \"11 4 987654330 987654343\\n\", \"2 1 1 1000000... | Sometimes Mister B has free evenings when he doesn't know what to do. Fortunately, Mister B found a new game, where the player can play against aliens.
All characters in this game are lowercase English letters. There are two players: Mister B and his competitor.
Initially the players have a string s consisting of the... | 0 |
{"tests": "{\"inputs\": [\"5\\n5\\n11010\\n11010\\n2\\n01\\n11\\n3\\n000\\n101\\n9\\n100010111\\n101101100\\n9\\n001011011\\n011010101\\n\", \"5\\n5\\n11000\\n11010\\n2\\n01\\n11\\n3\\n000\\n101\\n9\\n100010111\\n101101100\\n9\\n001011011\\n011010101\\n\", \"5\\n5\\n11010\\n11010\\n2\\n01\\n11\\n3\\n100\\n101\\n9\\n100... | There are $n$ candles on a Hanukkah menorah, and some of its candles are initially lit. We can describe which candles are lit with a binary string $s$, where the $i$-th candle is lit if and only if $s_i=1$.
Initially, the candle lights are described by a string $a$. In an operation, you select a candle that is current... | 0 |
{"tests": "{\"inputs\": [\"20 20\\n1 1\\n9 9\\n7\\n2 0 1 1\\n5 1 1 3\\n2 1 3 3\\n1 1 5 2\\n5 1 7 3\\n2 0 2 7\\n2 0 6 8\\n20 20\\n9 9\\n1 1\\n6\\n2 0 1 1\\n1 0 5 1\\n2 1 1 3\\n5 0 1 7\\n3 1 6 5\\n4 1 8 5\\n0 0\", \"20 20\\n1 1\\n9 9\\n7\\n2 0 1 1\\n5 1 1 3\\n2 1 3 3\\n1 1 5 2\\n5 1 7 3\\n2 0 4 7\\n2 -1 6 8\\n20 20\\n9 9... | Relative B came to Mr. A's house. He is 3 years old and loves blocks. The block he has is shaped like Figure 1.
<image>
Figure 1
Mr. B is laying blocks on the board. When I asked him, "What are you making?", He replied cheerfully, "Maze !!". The maze he says is the arrangement of blocks that are in contact with each... | 0.125 |
{"tests": "{\"inputs\": [[[\"O\", \"X\", \"X\", \"O\"], 2], [[\"O\", \"X\", \" \", \" \", \"X\", \" \", \"X\", \"O\", \" \"], 3], [[\"O\", \"X\", \" \", \" \", \"X\", \" \", \"X\", \"O\", \" \", \"O\"], 5], [[\"O\", \"X\", \" \", \" \", \"X\", \" \", \"X\", \"O\", \" \", \"O\"], 2], [[\"1\", \"2\", \"3\", \"4\", \"5\",... | Do you have in mind the good old TicTacToe?
Assuming that you get all the data in one array, you put a space around each value, `|` as a columns separator and multiple `-` as rows separator, with something like `["O", "X", " ", " ", "X", " ", "X", "O", " "]` you should be returning this structure (inclusive of new lin... | 0 |
{"tests": "{\"inputs\": [\"2 1 100\\n100 100 10\\n0 100 0\", \"2 2 50\\n30 0 1\\n30 50 1\", \"1 2 50\\n30 50 1\\n30 50 2\", \"3 1 100\\n50 1 2\\n50 1 1\\n50 1 1\", \"3 1 000\\n7 2 2\\n50 0 1\\n50 1 1\", \"3 1 000\\n0 2 2\\n50 0 1\\n50 1 1\", \"2 1 19\\n21 50 1\\n45 50 4\", \"2 1 19\\n21 50 0\\n45 50 4\", \"3 3 010\\n0 ... | N people run a marathon. There are M resting places on the way. For each resting place, the i-th runner takes a break with probability P_i percent. When the i-th runner takes a break, he gets rest for T_i time.
The i-th runner runs at constant speed V_i, and the distance of the marathon is L.
You are requested to com... | 0 |
{"tests": "{\"inputs\": [\"6\\n1 2 1 4 2\\n\", \"2\\n1\\n\", \"15\\n1 1 2 2 3 4 4 5 6 7 7 8 9 10\\n\", \"7\\n1 1 3 3 5 5\\n\", \"8\\n1 1 3 3 5 5 7\\n\"], \"outputs\": [\"4\\n\", \"2\\n\", \"11\\n\", \"4\\n\", \"5\\n\"]}", "source": "primeintellect"} | Pak Chanek has $n$ blank heart-shaped cards. Card $1$ is attached directly to the wall while each of the other cards is hanging onto exactly one other card by a piece of string. Specifically, card $i$ ($i > 1$) is hanging onto card $p_i$ ($p_i < i$).
In the very beginning, Pak Chanek must write one integer number on e... | 0.25 |
{"tests": "{\"inputs\": [[0], [2], [5], [25], [131], [1], [100], [179424691], [179424693]], \"outputs\": [[[false, true, true]], [[true, true, false]], [[true, false, false]], [[false, false, false]], [[true, false, false]], [[false, false, false]], [[false, true, true]], [[true, false, false]], [[false, false, false]]... | Create a function which checks a number for three different properties.
- is the number prime?
- is the number even?
- is the number a multiple of 10?
Each should return either true or false, which should be given as an array. Remark: The Haskell variant uses `data Property`.
### Examples
```python
number_property(7... | 0 |
{"tests": "{\"inputs\": [\"2\\n1 1\\n-1 -1\\n\", \"3\\n5 0\\n0 5\\n1 0\\n\", \"1\\n-277226476 314722425\\n\", \"2\\n-404192496 -968658337\\n556071553 -256244640\\n\", \"1\\n-277226476 314722425\\n\", \"24\\n-2 -2\\n-1 1\\n0 1\\n1 1\\n0 2\\n1 -1\\n2 -2\\n1 -2\\n-1 0\\n0 -2\\n0 -1\\n-2 0\\n-2 -1\\n2 -1\\n2 2\\n-1 -2\\n-2... | You've got a robot, its task is destroying bombs on a square plane. Specifically, the square plane contains n bombs, the i-th bomb is at point with coordinates (x_{i}, y_{i}). We know that no two bombs are at the same point and that no bomb is at point with coordinates (0, 0). Initially, the robot is at point with coor... | 0 |
{"tests": "{\"inputs\": [\"7\\n1 0\\n1 1\\n42 7\\n13 7\\n99 1\\n99 0\\n99 2\\n\", \"2\\n13 9\\n17 9\\n\", \"2\\n13 9\\n17 9\\n\", \"2\\n13 9\\n27 9\\n\", \"7\\n1 0\\n1 1\\n42 7\\n13 7\\n64 1\\n99 0\\n99 2\\n\", \"2\\n17 9\\n47 9\\n\", \"7\\n1 0\\n1 1\\n42 7\\n1 9\\n64 0\\n99 0\\n99 2\\n\", \"7\\n1 0\\n2 1\\n42 7\\n1 9\... | Let $f(x)$ be the sum of digits of a decimal number $x$.
Find the smallest non-negative integer $x$ such that $f(x) + f(x + 1) + \dots + f(x + k) = n$.
-----Input-----
The first line contains one integer $t$ ($1 \le t \le 150$) — the number of test cases.
Each test case consists of one line containing two integers... | 0 |
{"tests": "{\"inputs\": [[0], [1], [3], [6], [7]], \"outputs\": [[1], [2], [3], [4], [5]]}", "source": "primeintellect"} | Johnny is a farmer and he annually holds a beet farmers convention "Drop the beet".
Every year he takes photos of farmers handshaking. Johnny knows that no two farmers handshake more than once. He also knows that some of the possible handshake combinations may not happen.
However, Johnny would like to know the minima... | 0 |
{"tests": "{\"inputs\": [[4, 2, 3], [3, -29, 4], [5, -28, 0], [7, 2], [10, -2999], [5], [4, 2, 3, 5, 7, -8], [-3, -5, 0], [-11, 1, 3], [-25, 5, -9], [-25, -11, 9], [-3, -5], [-11, 3], [-9999999], [-25, 5, -9, 55, -8, -7, 8], [0, 1, 2], [0, -1, 0], [0, -1, 2], [0, 1, -2], [0, 1], [0, -1], [0], [0, -5, 8, -7, 10]], \"out... | < PREVIOUS KATA
NEXT KATA >
## Task:
You have to write a function `pattern` which returns the following Pattern(See Examples) upto desired number of rows.
* Note:```Returning``` the pattern is not the same as ```Printing``` the pattern.
### Parameters:
pattern( n , x , y... | 0 |
{"tests": "{\"inputs\": [\"3\\n7\\n1 4 2 2 2 2 2\\n2\\n2 3\\n5\\n1 1 1 1 1\\n\", \"1\\n1\\n69\\n\", \"1\\n1\\n69\\n\", \"1\\n1\\n67\\n\", \"3\\n7\\n2 4 2 2 2 2 2\\n2\\n2 3\\n5\\n1 1 1 1 1\\n\", \"1\\n1\\n12\\n\", \"3\\n7\\n2 4 2 2 2 2 2\\n2\\n2 3\\n5\\n1 1 1 2 1\\n\", \"1\\n1\\n9\\n\", \"1\\n1\\n14\\n\", \"1\\n1\\n26\\... | There is a trampoline park with $n$ trampolines in a line. The $i$-th of which has strength $S_i$.
Pekora can jump on trampolines in multiple passes. She starts the pass by jumping on any trampoline of her choice.
If at the moment Pekora jumps on trampoline $i$, the trampoline will launch her to position $i + S_i$, a... | 0 |
{"tests": "{\"inputs\": [[[1, 2, 3, 4, 5]], [[1, -2, 3, 4, 5]], [[-1, 2, 3, 4, -5]], [[]], [[-1, -2, -3, -4, -5]]], \"outputs\": [[15], [13], [9], [0], [0]]}", "source": "primeintellect"} | You get an array of numbers, return the sum of all of the positives ones.
Example `[1,-4,7,12]` => `1 + 7 + 12 = 20`
Note: if there is nothing to sum, the sum is default to `0`.
Write your solution by modifying this code:
```python
def positive_sum(arr):
```
Your solution should implemented in the function "posi... | 0 |
{"tests": "{\"inputs\": [[10, 15, 15, 10], [15, 10, 15, 10], [10, 10, 10, 10], [15, 10, 15, 9], [10, 5, 5, 10], [1, 10, 10, 0], [10, 5, 11, 4]], \"outputs\": [[true], [true], [true], [false], [true], [false], [false]]}", "source": "primeintellect"} | # Task
Call two arms equally strong if the heaviest weights they each are able to lift are equal.
Call two people equally strong if their strongest arms are equally strong (the strongest arm can be both the right and the left), and so are their weakest arms.
Given your and your friend's arms' lifting capabilities ... | 0 |
{"tests": "{\"inputs\": [\"3 3\\n1 3\\n1 2\\n1 2 3\\n\", \"3 1\\n3 1\\n3 2\\n1 2 3\\n\", \"4 3\\n1 2\\n1 3\\n3 4\\n1000000000 999999999 0 1\\n\", \"3 20\\n1 2\\n1 3\\n1 2 3\\n\", \"6 1\\n1 2\\n1 3\\n3 4\\n2 5\\n5 6\\n1 3 3 4 5 0\\n\", \"3 3\\n1 3\\n1 2\\n1 3 3\\n\", \"6 1\\n1 2\\n1 3\\n3 4\\n2 5\\n5 6\\n1 3 3 0 5 0\\n\... | Alice and Bob are going to celebrate Christmas by playing a game with a tree of presents. The tree has n nodes (numbered 1 to n, with some node r as its root). There are a_i presents are hanging from the i-th node.
Before beginning the game, a special integer k is chosen. The game proceeds as follows:
* Alice begin... | 0 |
{"tests": "{\"inputs\": [\"10\\n31181 6 72281 7\\n65255 10 17867 2\\n96212 8 32852 10\\n69668 6 37236 1\\n6031 7 61541 0\\n12286 4 40227 2\\n30573 9 36317 3\\n97429 6 35399 9\\n20907 5 19251 8\\n86446 8 56301 10\\n\", \"10\\n1000000000 0 1000000000 0\\n1000000000 0 1000000000 0\\n1000000000 0 1000000000 0\\n1000000000 ... | Alice and Bonnie are sisters, but they don't like each other very much. So when some old family photos were found in the attic, they started to argue about who should receive which photos. In the end, they decided that they would take turns picking photos. Alice goes first.
There are n stacks of photos. Each stack con... | 0 |
{"tests": "{\"inputs\": [[\"K\", 200, 10], [\"M\", 0, 10], [\"M\", -5, 10], [\"F\", 160, 0], [\"F\", 160, -10], [\",\", 0, 1100], [\"??\", -10, -10], [\"llama\", 1, -10], [\"F\", -461.9, 0.0], [\"M\", 250, 5], [\"F\", 190, 8], [\"M\", 405, 12], [\"F\", 130, 7]], \"outputs\": [[\"Invalid gender\"], [\"Invalid weight\"],... | ###BACKGROUND:
Jacob recently decided to get healthy and lose some weight. He did a lot of reading and research and after focusing on steady exercise and a healthy diet for several months, was able to shed over 50 pounds! Now he wants to share his success, and has decided to tell his friends and family how much weight ... | 0 |
{"tests": "{\"inputs\": [\"20\\n21\\n22\\n23\\n24\\n25\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\", \"20\\n27955\\n637815\\n90575\\n561777\\n622205\\n466162\\n379336\\n195938\\n91560\\n894581\\n799253\\n948756\\n448870\\n26762\\n507653\\n176200\\n175215\\n499651\\n82441\\n354697\", \"20... | You need to find if a number can be expressed as sum of two perfect powers. That is, given x find if there exists non negative integers a, b, m, n such that am + bn = x.
Input
First line of the input contains number of test cases T. It is followed by T lines, each line contains a sinle number x.
Output
For each tes... | 0 |
{"tests": "{\"inputs\": [[[]], [[\"e3\", \"e6\", \"d3\", \"g6\"]], [[\"d3\", \"e5\", \"d4\", \"f5\"]], [[\"d3\", \"e5\", \"d4\", \"f5\", \"dxe5\", \"f4\"]], [[\"d4\", \"f6\", \"d5\", \"f6\", \"dxe5\", \"f4\"]], [[\"d4\", \"a5\", \"d5\", \"f6\", \"dxe7\", \"f4\"]], [[\"a4\", \"a5\", \"b4\", \"b5\", \"c4\", \"b4\"]], [[\... | A chess board is normally played with 16 pawns and 16 other pieces, for this kata a variant will be played with only the pawns. All other pieces will not be on the board.
For information on how pawns move, refer [here](http://www.chesscorner.com/tutorial/basic/pawn/pawn.htm)
Write a function that can turn a li... | 0 |
{"tests": "{\"inputs\": [\"5 30\\n13 51 32 9 2 1 10 2 5 10\", \"1 10\\n1 2 3 4 7 6 7 8 9 10\", \"5 100\\n101 101 101 101 101 101 101 101 100 101\", \"5 10\\n8 4 5 3 5 6 9 10 11 2\", \"5 35\\n13 51 32 14 2 1 10 2 5 10\", \"7 35\\n13 51 32 14 2 1 10 2 5 10\", \"7 35\\n13 51 1 14 2 1 10 2 5 10\", \"5 30\\n25 51 32 9 2 1 1... | Hint
In solving this problem, the following may be referred to. Shows how to convert an integer value to a string. Assign value as a string to str.
For C
include <stdio.h>
int main () {
int value = 123; // Convert this value to a string
char str [6]; // This variable contains a string of value
sprintf (str, "% d",... | 0.375 |
{"tests": "{\"inputs\": [\"25 2\\n1 23\\n3 1\\n\", \"1000000000 3\\n30490 19232\\n45250 999980767\\n264372930 1\\n\", \"999999999 1\\n999999999 999999999\\n\", \"1000000000 1\\n1 1000000000\\n\", \"1 1\\n1 1\\n\", \"1001 1\\n60 10001\\n\", \"999999999 1\\n100 1000000000\\n\", \"300 4\\n1 200\\n2 200\\n50 100\\n70 100\\... | A famous gang of pirates, Sea Dogs, has come back to their hideout from one of their extravagant plunders. They want to split their treasure fairly amongst themselves, that is why You, their trusted financial advisor, devised a game to help them:
All of them take a sit at their round table, some of them with the golde... | 0 |
{"tests": "{\"inputs\": [\"10\\n38\\n14464\\n6341\\n24497\\n14166\\n15421\\n11475\\n29455\\n26459\\n24441\", \"40\\n29\\n1179\\n152\\n574\\n647\\n904\\n360\\n964\\n1036\\n1006\\n757\\n985\\n1057\\n773\\n77\\n479\\n515\\n824\\n1113\\n488\\n295\\n1018\\n188\\n141\\n280\\n30\\n133\\n194\\n1196\\n139\\n499\\n736\\n1185\\n4... | Joy is a short and lazy guy, he uses elevator to reach his flat. But unfortunately elevator is not working today and he became sad. Suddenly God came and made the stairs magical, such that he can jump on it in a magical way. Initially he can take 1 or 2 steps. If he jumps x steps at a time then in the next step he can... | 0 |
{"tests": "{\"inputs\": [[12], [102], [9672], [2789], [2335]], \"outputs\": [[true], [false], [false], [true], [true]]}", "source": "primeintellect"} | # Definition
A **_Tidy number_** *is a number whose* **_digits are in non-decreasing order_**.
___
# Task
**_Given_** a number, **_Find if it is Tidy or not_** .
____
# Warm-up (Highly recommended)
# [Playing With Numbers Series](https://www.codewars.com/collections/playing-with-numbers)
___
# Notes
* **_Num... | 0 |
{"tests": "{\"inputs\": [\"4\\n2\\n1 7\\n3\\n1 5 4\\n4\\n12345678 87654321 20211218 23571113\\n9\\n1 2 3 4 18 19 5 6 7\\n\", \"8\\n2\\n2 3\\n3\\n3 4 5\\n1\\n1\\n1\\n2\\n1\\n3\\n1\\n4\\n1\\n12071207\\n5\\n5 5 5 9 14\\n\", \"8\\n2\\n2 3\\n3\\n3 4 5\\n1\\n1\\n1\\n2\\n1\\n3\\n1\\n4\\n1\\n12071207\\n5\\n5 5 5 9 14\\n\", \"8... | Paprika loves permutations. She has an array $a_1, a_2, \dots, a_n$. She wants to make the array a permutation of integers $1$ to $n$.
In order to achieve this goal, she can perform operations on the array. In each operation she can choose two integers $i$ ($1 \le i \le n$) and $x$ ($x > 0$), then perform $a_i := a_i ... | 0 |
{"tests": "{\"inputs\": [\"17\\n0 0\\n0 8\\n1 8\\n36 39\\n3 4\\n3 7\\n2 17\\n8 12\\n9 12\\n10 12\\n10 15\\n6 14\\n8 15\\n9 15\\n15 15\\n100000000000000000 1000000000000000000\\n99999999999999999 1000000000000000000\\n\", \"55\\n1 1\\n1 2\\n1 3\\n1 4\\n1 5\\n1 6\\n1 7\\n1 8\\n1 9\\n1 10\\n2 2\\n2 3\\n2 4\\n2 5\\n2 6\\n2... | Let's denote as <image> the number of bits set ('1' bits) in the binary representation of the non-negative integer x.
You are given multiple queries consisting of pairs of integers l and r. For each query, find the x, such that l ≤ x ≤ r, and <image> is maximum possible. If there are multiple such numbers find the sma... | 0 |
{"tests": "{\"inputs\": [\"4\\n1 2 3 4\\n1 2 3 4\\n1 2 3 4\\n2 2 3 4\\n1 2 3 4\\n1 2 3 4\\n1 2 3 4\\n1 2 3 4\\noooo\\noooo\\noooo\\noooo\", \"3\\n1 1 1\\n1 1 1\\n1 1 1\\n1 1 1\\n1 0 1\\n1 1 1\\no..\\n.o.\\n..o\", \"3\\n1 1 1\\n1 1 1\\n1 1 1\\n0 1 1\\n1 1 1\\n1 1 1\\no.o\\n...\\n.o.\", \"3\\n1 0 1\\n1 2 1\\n1 0 1\\n-1 2... | Taro is an elementary school student and has graffiti on the back of the leaflet. At one point, Taro came up with the next game.
* Write n × n grid-like squares.
* The initial state of each square is either marked or unmarked.
* Erase or write these circles so that there is always exactly one circle no matter which co... | 0 |
{"tests": "{\"inputs\": [[384000000], [5e-05], [1e-07], [0], [-1]], \"outputs\": [[42], [0], [0], [0], [null]]}", "source": "primeintellect"} | Have you heard about the myth that [if you fold a paper enough times, you can reach the moon with it](http://scienceblogs.com/startswithabang/2009/08/31/paper-folding-to-the-moon/)? Sure you have, but exactly how many? Maybe it's time to write a program to figure it out.
You know that a piece of paper has a thickness ... | 0 |
{"tests": "{\"inputs\": [\"4\\n5\\n00100\\n8\\n00000000\\n5\\n11111\\n3\\n110\\n\", \"14\\n1\\n0\\n1\\n1\\n2\\n00\\n2\\n01\\n2\\n10\\n2\\n11\\n3\\n000\\n3\\n001\\n3\\n010\\n3\\n011\\n3\\n100\\n3\\n101\\n3\\n110\\n3\\n111\\n\", \"1\\n100\\n000000000000000000000000000000000000000000000000000000000000000000000000000000000... | Nikolay lives in a two-storied house. There are $n$ rooms on each floor, arranged in a row and numbered from one from left to right. So each room can be represented by the number of the floor and the number of the room on this floor (room number is an integer between $1$ and $n$).
If Nikolay is currently in some room... | 0 |
{"tests": "{\"inputs\": [\"2 1 1 1\\n1 1\\n0 0\\n1 3 2 1\\n2 1\\n2 1\\n0 0\\n10 8 3 2\\n2 2\\n1 2\\n1 1\\n0 1\\n3 4\\n3 3 3 2\\n1 2\\n2 1\\n1 1\\n0 1\\n0 0\\n0 0 0 0\", \"2 1 1 1\\n1 1\\n0 0\\n1 3 2 1\\n2 1\\n2 1\\n0 0\\n10 8 3 2\\n2 2\\n1 3\\n1 1\\n0 1\\n3 4\\n3 3 3 2\\n1 2\\n1 1\\n1 1\\n0 1\\n0 0\\n0 0 0 0\", \"2 1 1... | Origami, or the art of folding paper
Master Grus is a famous origami (paper folding) artist, who is enthusiastic about exploring the possibility of origami art. For future creation, he is now planning fundamental experiments to establish the general theory of origami.
One rectangular piece of paper is used in each of... | 0 |
{"tests": "{\"inputs\": [[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -11, -12, -13, -14, -15]], [[0, 2, 3, 0, 5, 6, 7, 8, 9, 10, -11, -12, -13, -14]], [[1]], [[-1]], [[0, 0, 0, 0, 0, 0, 0, 0, 0]], [[]]], \"outputs\": [[[10, -65]], [[8, -50]], [[1, 0]], [[0, -1]], [[0, 0]], [[]]]}", "source": "primeintellect"} | Given an array of integers.
Return an array, where the first element is the count of positives numbers and the second element is sum of negative numbers.
If the input array is empty or null, return an empty array.
# Example
For input `[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -11, -12, -13, -14, -15]`, you should return `[10... | 0 |
{"tests": "{\"inputs\": [[[7, 11]], [[1, 7, 15]], [[2, 10]], [[687, 829, 998]], [[]], [[1]]], \"outputs\": [[59], [0], [-1], [45664], [-1], [0]]}", "source": "primeintellect"} | Story:
In the realm of numbers, the apocalypse has arrived. Hordes of zombie numbers have infiltrated and are ready to turn everything into undead. The properties of zombies are truly apocalyptic: they reproduce themselves unlimitedly and freely interact with each other. Anyone who equals them is doomed. Out of an infi... | 0 |
{"tests": "{\"inputs\": [\"5R3D\", \"5D2R\", \"5T2D\", \"5D3R\", \"5U2D\", \"4D2R\", \"6T2D\", \"3R5D\", \"4R2D\", \"6D2T\", \"4R5D\", \"4R3D\", \"5D2T\", \"5U1D\", \"7T2D\", \"4D3R\", \"4R6D\", \"3R3D\", \"3D3R\", \"5R4D\", \"6R3D\", \"6U2D\", \"5D1T\", \"8T2D\", \"3R4D\", \"5T1D\", \"4U2D\", \"6D1T\", \"5U0D\", \"7D2... | A: Flick input
A college student who loves 2D, commonly known as 2D, replaced his long-used Galapagos mobile phone with a smartphone. 2D, who operated the smartphone for the first time, noticed that the character input method was a little different from that of old mobile phones. On smartphones, a method called flick ... | 0 |
{"tests": "{\"inputs\": [\"6\\n17236 1106911\\n1 5\\n108 112\\n12345 1023412\\n1 11\\n1 20\\n\", \"1\\n12 1034\\n\", \"1\\n1078 1112\\n\", \"1\\n12 1034\\n\", \"1\\n1078 1112\\n\", \"1\\n23 1034\\n\", \"1\\n1078 1547\\n\", \"6\\n17236 1106911\\n1 5\\n108 112\\n12345 799289\\n1 11\\n1 20\\n\", \"6\\n17236 1106911\\n1 5\... | Tanya is learning how to add numbers, but so far she is not doing it correctly. She is adding two numbers $a$ and $b$ using the following algorithm:
If one of the numbers is shorter than the other, Tanya adds leading zeros so that the numbers are the same length.
The numbers are processed from right to left (that is,... | 0 |
{"tests": "{\"inputs\": [[[4, 4, 4, 3, 3], 12], [[4, 4, 4, 3, 3], 11], [[4, 8, 15, 16, 23, 42], 108], [[13], 13], [[1, 2, 3, 4], 250], [[100], 500], [[11, 13, 15, 17, 19], 8], [[45], 12]], \"outputs\": [[3], [2], [6], [1], [4], [1], [0], [0]]}", "source": "primeintellect"} | Your task is to determine how many files of the copy queue you will be able to save into your Hard Disk Drive. The files must be saved in the order they appear in the queue.
### Input:
* Array of file sizes `(0 <= s <= 100)`
* Capacity of the HD `(0 <= c <= 500)`
### Output:
* Number of files that can be fully sav... | 0 |
{"tests": "{\"inputs\": [\"4\\n0 0 0 0 2\", \"3\\n0 1 1 1\", \"10\\n0 0 1 0 2 3 5 8 13 21 34\", \"2\\n0 3 2\", \"10\\n0 0 1 0 2 3 5 8 13 23 34\", \"10\\n0 0 1 0 3 3 5 8 13 23 34\", \"2\\n-1 3 2\", \"10\\n0 0 1 1 3 3 5 8 13 23 34\", \"2\\n-2 3 2\", \"4\\n0 1 0 1 2\", \"10\\n0 0 1 1 3 3 4 8 13 23 34\", \"4\\n0 1 0 1 3\",... | Given is an integer sequence of length N+1: A_0, A_1, A_2, \ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print the maximum possible number of vertices in such a tree; otherwise, print -1.
Constraints
* 0 \leq N \... | 0 |
{"tests": "{\"inputs\": [[[[2, -2], [5, 3]], [[-1, 4], [7, -6]]], [[[1]], [[3]]], [[[1, 2], [3, 4]], [[1, 2, 3], [4, 5, 6], [7, 8, 9]]], [[[7, 3], [2, 5], [6, 8], [9, 0]], [[7, 4, 9], [8, 1, 5]]], [[[1, 0.5], [-0.5, 1]], [[5, 0.25], [2, 0.5]]]], \"outputs\": [[[[-16, 20], [16, 2]]], [[[3]]], [-1], [[[73, 31, 78], [54, ... | In mathematics, a matrix (plural matrices) is a rectangular array of numbers. Matrices have many applications in programming, from performing transformations in 2D space to machine learning.
One of the most useful operations to perform on matrices is matrix multiplication, which takes a pair of matrices and produces ... | 0 |
{"tests": "{\"inputs\": [\"2\\n33 15 51 7 101\\n41 80 40 13 46\\n\", \"2\\n0 0 0 0 1\\n0 0 0 1 0\\n\", \"4\\n66 55 95 78 114\\n70 98 8 95 95\\n17 47 88 71 18\\n23 22 9 104 38\\n\", \"17\\n66 15 -1 42 90\\n67 108 104 16 110\\n76 -1 -1 -1 96\\n108 32 100 91 17\\n87 -1 85 10 -1\\n70 55 102 15 23\\n-1 33 111 105 63\\n-1 56... | Vasya and Petya take part in a Codeforces round. The round lasts for two hours and contains five problems.
For this round the dynamic problem scoring is used. If you were lucky not to participate in any Codeforces round with dynamic problem scoring, here is what it means. The maximum point value of the problem depends... | 0 |
{"tests": "{\"inputs\": [[121], [625], [319225], [15241383936], [155], [342786627]], \"outputs\": [[144], [676], [320356], [15241630849], [-1], [-1]]}", "source": "primeintellect"} | You might know some pretty large perfect squares. But what about the NEXT one?
Complete the `findNextSquare` method that finds the next integral perfect square after the one passed as a parameter. Recall that an integral perfect square is an integer n such that sqrt(n) is also an integer.
If the parameter is itse... | 0 |
{"tests": "{\"inputs\": [\"1\\n12 12\\n#000#0#0##00\\n0##########0\\n0#0##0#0###0\\n00#0##000###\\n#0######0###\\n#0####0####0\\n#######000##\\n0##0#00#00##\\n##000##0####\\n0########00#\\n###000#000##\\n####00####0#\\n\", \"1\\n10 10\\n0####0###0\\n00#000##00\\n##0#0###00\\n0#0##00#00\\n####0###00\\n###00#0#0#\\n###00... | Omkar's most recent follower, Ajit, has entered the Holy Forest. Ajit realizes that Omkar's forest is an n by m grid (1 ≤ n, m ≤ 2000) of some non-negative integers. Since the forest is blessed by Omkar, it satisfies some special conditions:
1. For any two adjacent (sharing a side) cells, the absolute value of the d... | 0 |
{"tests": "{\"inputs\": [\"5\\n20 10 30 10 20\\n\", \"3\\n1 8 1\\n\", \"6\\n7 6 6 8 5 8\\n\", \"6\\n14 3 8 10 15 4\\n\", \"4\\n1 100 100 1\\n\", \"3\\n40 10 10\\n\", \"2\\n1000000 1000000\\n\", \"5\\n9 6 7 9 7\\n\", \"6\\n6 7 7 7 7 7\\n\", \"7\\n7 6 9 10 8 10 6\\n\", \"5\\n7 9 6 7 7\\n\", \"7\\n7 6 7 7 8 7 6\\n\", \"5\... | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.
The wall consists of $n$ sections, aligned in a row. The $i$-th section initi... | 0 |
{"tests": "{\"inputs\": [\"195 468\\n\", \"629 865\\n\", \"5 205\\n\", \"455 470\\n\", \"600 175\\n\", \"395 55\\n\", \"111 111\\n\", \"5 1000\\n\", \"15 20\\n\", \"130 312\\n\", \"999 1000\\n\", \"5 11\\n\", \"30 40\\n\", \"60 80\\n\", \"440 330\\n\", \"385 505\\n\", \"105 140\\n\", \"661 175\\n\", \"120 90\\n\", \"94... | There is a right triangle with legs of length a and b. Your task is to determine whether it is possible to locate the triangle on the plane in such a way that none of its sides is parallel to the coordinate axes. All the vertices must have integer coordinates. If there exists such a location, you have to output the app... | 0 |
{"tests": "{\"inputs\": [[4, 5], [10, 7], [\"eight\", [3]], [12, -4], [0, 9], [123, 987]], \"outputs\": [[\"■|■■|■■|■■|■■|■\\n■■|■■|■■|■■|■■\\n■|■■|■■|■■|■■|■\\n■■|■■|■■|■■|■■\"], [\"■|■■|■■|■■|■■|■■|■■|■\\n■■|■■|■■|■■|■■|■■|■■\\n■|■■|■■|■■|■■|■■|■■|■\\n■■|■■|■■|■■|■■|■■|■■\\n■|■■|■■|■■|■■|■■|■■|■\\n■■|■■|■■|■■|■■|■■|■... | In this Kata you are a builder and you are assigned a job of building a wall with a specific size (God knows why...).
Create a function called `build_a_wall` (or `buildAWall` in JavaScript) that takes `x` and `y` as integer arguments (which represent the number of rows of bricks for the wall and the number of bricks i... | 0 |
{"tests": "{\"inputs\": [[5, 10], [7, 11], [7, 14], [8, 16], [10, 20]], \"outputs\": [[[true, 10]], [[false, -1]], [[true, 13]], [[true, 15]], [[true, 17]]]}", "source": "primeintellect"} | # Task:
We define the "self reversed power sequence" as one shown below:
Implement a function that takes 2 arguments (`ord max` and `num dig`), and finds the smallest term of the sequence whose index is less than or equal to `ord max`, and has exactly `num dig` number of digits.
If there is a number with correct a... | 0 |
{"tests": "{\"inputs\": [[[1, 2, 10, 3, 4, 5, 8, 6, 7]], [[1, 2, 3, 4, 50, 5, 6, 7, 51, 8, 40, 9]], [[1, 2, 3000, 3, 4, 5, 8, 6, 7, 8, 100, 9, 40, 10, 11, 13]], [[1, 2, 3, 4, 50, 5, 6, 7, 51, 8, 9]], [[4, 1, 2, 3, 3, 4, 26, 5, 6, 2, 7]]], \"outputs\": [[[10, 8]], [[50, 51, 40]], [[3000, 8, 100, 40, 13]], [[50, 51]], [[... | You're given an ancient book that unfortunately has a few pages in the wrong position, fortunately your computer has a list of every page number in order from ``1`` to ``n``.
You're supplied with an array of numbers, and should return an array with each page number that is out of place. Incorrect page numbers will not... | 0 |
{"tests": "{\"inputs\": [\"11 3\\n1 1\\n1 1\\n1 1\\n1 1\\n2 2\\n2 2\\n2 2\\n3 3\\n3 3\\n3 3\\n3 3\\n\", \"43 1319\\n750 1030\\n857 946\\n941 1203\\n407 1034\\n947 1290\\n546 585\\n630 1201\\n72 342\\n693 1315\\n34 719\\n176 1097\\n36 931\\n198 973\\n5 1025\\n892 1054\\n461 1287\\n195 1273\\n832 1039\\n308 955\\n642 866... | Young Teodor enjoys drawing. His favourite hobby is drawing segments with integer borders inside his huge [1;m] segment. One day Teodor noticed that picture he just drawn has one interesting feature: there doesn't exist an integer point, that belongs each of segments in the picture. Having discovered this fact, Teodor ... | 0 |
{"tests": "{\"inputs\": [\"5\\n3\\n0 1 3\\n7\\n0 1 2 3 4 3 2\\n4\\n3 0 0 0\\n7\\n4 6 2 3 5 0 5\\n5\\n4 0 1 0 4\\n\", \"5\\n3\\n0 1 3\\n7\\n0 1 2 3 4 3 2\\n4\\n3 0 0 0\\n7\\n4 6 2 3 6 0 5\\n5\\n4 0 1 0 4\\n\", \"5\\n3\\n0 1 3\\n7\\n0 1 2 3 4 3 2\\n4\\n3 0 0 0\\n7\\n4 0 2 3 5 0 5\\n5\\n4 0 1 0 4\\n\", \"5\\n3\\n0 1 3\\n7... | Dmitry has an array of $n$ non-negative integers $a_1, a_2, \dots, a_n$.
In one operation, Dmitry can choose any index $j$ ($1 \le j \le n$) and increase the value of the element $a_j$ by $1$. He can choose the same index $j$ multiple times.
For each $i$ from $0$ to $n$, determine whether Dmitry can make the $\mathrm... | 0 |
{"tests": "{\"inputs\": [\"25 6\\n1 10 5\\n1 8 4\\n1 8 2\\n4 8 9\\n3 2 8\\n1 9 5\\n2 10 10\\n3 9 6\\n3 5 4\\n2 7 8\\n2 3 2\\n2 6 8\\n3 7 8\\n4 3 7\\n1 8 1\\n3 6 4\\n3 2 8\\n2 2 1\\n4 8 8\\n4 8 4\\n3 10 2\\n3 6 6\\n2 2 5\\n1 6 2\\n4 1 5\\n\", \"3 5\\n6 4 5\\n6 5 5\\n8 7 5\\n\", \"2 9\\n6 1 7\\n6 7 1\\n\", \"2 10\\n7 2 1... | It's another Start[c]up finals, and that means there is pizza to order for the onsite contestants. There are only 2 types of pizza (obviously not, but let's just pretend for the sake of the problem), and all pizzas contain exactly S slices.
It is known that the i-th contestant will eat si slices of pizza, and gain ai ... | 0.25 |
{"tests": "{\"inputs\": [[\"man i need a taxi up to ubud\"], [\"what time are we climbing up the volcano\"], [\"take me to semynak\"], [\"massage yes massage yes massage\"], [\"take bintang and a dance please\"]], \"outputs\": [[[\"a\", \"need\", \"ubud\", \"i\", \"taxi\", \"man\", \"to\", \"up\"]], [[\"time\", \"are\"... | Given a string of words (x), you need to return an array of the words, sorted alphabetically by the final character in each.
If two words have the same last letter, they returned array should show them in the order they appeared in the given string.
All inputs will be valid.
Write your solution by modifying this cod... | 0 |
{"tests": "{\"inputs\": [\"1\\n6\\n1\\n2 3\\n\", \"9\\n9999991 9999943 9999883 4658161 4657997 2315407 2315263 1000003 1000033\\n13\\n9999991 9999991\\n9999943 9999943\\n9999883 9999883\\n4658161 4658161\\n4657997 4657997\\n2315407 2315407\\n2315263 2315263\\n1000003 1000003\\n1000033 1000033\\n2 2000000000\\n200000000... | Recently, the bear started studying data structures and faced the following problem.
You are given a sequence of integers x1, x2, ..., xn of length n and m queries, each of them is characterized by two integers li, ri. Let's introduce f(p) to represent the number of such indexes k, that xk is divisible by p. The answe... | 0.75 |
{"tests": "{\"inputs\": [\"5\\n\\n3 2 2\\n2 0\\n0 5\\n\\n4 3 2\\n2 0 5\\n0 6\\n\\n0 2 2\\n1 0\\n2 3\\n\\n5 4 4\\n6 0 8 0\\n0 7 0 9\\n\\n5 4 1\\n8 7 8 0\\n0\\n\", \"5\\n\\n3 2 2\\n2 0\\n0 5\\n\\n4 3 2\\n2 0 5\\n0 6\\n\\n0 2 2\\n1 0\\n2 3\\n\\n5 4 4\\n6 0 8 0\\n0 7 0 9\\n\\n5 4 1\\n8 7 8 0\\n0\\n\", \"5\\n\\n3 2 2\\n2 0\... | Monocarp and Polycarp are learning new programming techniques. Now they decided to try pair programming.
It's known that they have worked together on the same file for $n + m$ minutes. Every minute exactly one of them made one change to the file. Before they started, there were already $k$ lines written in the file.
... | 0 |
{"tests": "{\"inputs\": [[12, 4, 3, 2], [9, 4, 2, 7], [13, 4, 3, 1], [13, 4, 3, 50], [36, 4, 3, 2], [15, 4, 3, 12], [100000, 99999, 100000, 100000], [100000, 100000, 100000, 100000], [100000, 1, 50000, 49999], [100000, 1, 1000, 999], [17, 4, 4, 16], [23, 4, 4, 13], [1, 4, 4, 15], [22, 4, 4, 13], [16, 4, 4, 16], [20, 4,... | Have you heard about Megamind? Megamind and Metro Man are two aliens who came to earth. Megamind wanted to destroy the earth, while Metro Man wanted to stop him and protect mankind. After a lot of fighting, Megamind finally threw Metro Man up into the sky. Metro Man was defeated and was never seen again. Megamind wante... | 0 |
{"tests": "{\"inputs\": [\"3\\n0\\n5\\n1\\n1\\n1\\n-1\", \"3\\n0\\n9\\n1\\n1\\n0\\n-1\", \"3\\n0\\n5\\n1\\n1\\n2\\n-1\", \"3\\n1\\n9\\n1\\n1\\n0\\n-1\", \"3\\n0\\n6\\n1\\n1\\n2\\n-1\", \"3\\n1\\n9\\n0\\n1\\n0\\n-1\", \"3\\n0\\n5\\n0\\n1\\n0\\n-1\", \"3\\n1\\n5\\n1\\n1\\n0\\n-1\", \"3\\n0\\n6\\n1\\n1\\n1\\n-1\", \"3\\n0... | The screen that displays digital numbers that you often see on calculators is called a "7-segment display" because the digital numbers consist of seven parts (segments).
The new product to be launched by Wakamatsu will incorporate a 7-segment display into the product, and as an employee, you will create a program to d... | 0 |
{"tests": "{\"inputs\": [\"??????????????????????????????????????????????????????????????????????????????????????0\\n\", \"1011110101010001110000110111011011101011010100001001101?101010101110010110001101110111110100001100010000111001010111000111111001001001100111001010000111101110100110110101101111110100000000010101001... | Little Petya very much likes playing with little Masha. Recently he has received a game called "Zero-One" as a gift from his mother. Petya immediately offered Masha to play the game with him.
Before the very beginning of the game several cards are lain out on a table in one line from the left to the right. Each card c... | 0 |
{"tests": "{\"inputs\": [[[-52, 56, 30, 29, -54, 0, -110]], [[42, 54, 65, 87, 0]], [[1, 2, 3, 4, 5, 10]], [[-1, -2, -3, -4, -5, -10]], [[9]]], \"outputs\": [[-110], [0], [1], [-10], [9]]}", "source": "primeintellect"} | Your task is to make two functions, ```max``` and ```min``` (`maximum` and `minimum` in PHP and Python) that take a(n) array/vector of integers ```list``` as input and outputs, respectively, the largest and lowest number in that array/vector.
#Examples
```python
maximun([4,6,2,1,9,63,-134,566]) returns 566
minimun([-5... | 0 |
{"tests": "{\"inputs\": [\"1000000 1000000 1000000 1000000000\\n\", \"1000 988 1000000 3000\\n\", \"418223 118667 573175 776998\\n\", \"2 2 2 0\\n\", \"2 1000 1000000 1000000000\\n\", \"500000 1000000 750000 100000\\n\", \"797745 854005 98703 735186\\n\", \"100500 5000 500 100000000\\n\", \"781081 414037 495753 892089\... | Vasya plays The Elder Trolls IV: Oblivon. Oh, those creators of computer games! What they do not come up with! Absolutely unique monsters have been added to the The Elder Trolls IV: Oblivon. One of these monsters is Unkillable Slug. Why it is "Unkillable"? Firstly, because it can be killed with cutting weapon only, so ... | 0 |
{"tests": "{\"inputs\": [[\"hamster\", \"hamster\"], [\"hamster\", \"helpme\"], [\"hmster\", \"hamster\"], [\"hhhhammmstteree\", \"hamster\"], [\"f\", \"abcdefghijklmnopqrstuvwxyz\"]], \"outputs\": [[\"h1a1m1s1t1e1r1\"], [\"h1e1h5m4m1e1\"], [\"h1t8m1s1t1e1r1\"], [\"h1a1m1s1t1e1r1\"], [\"f22f23f24f25f26f1f2f3f4f5f6f7f8f... | # Introduction
Hamsters are rodents belonging to the subfamily Cricetinae. The subfamily contains about 25 species, classified in six or seven genera. They have become established as popular small house pets, and, partly because they are easy to breed in captivity, hamsters are often used as laboratory animals.
# T... | 0 |
{"tests": "{\"inputs\": [\"6\\n3 2 1 3 2 1\\n4 5\\n3 4\\n1 4\\n2 1\\n6 1\\n\", \"4\\n2 1 1 1\\n1 2\\n1 3\\n1 4\\n\", \"5\\n2 2 2 2 2\\n1 2\\n2 3\\n3 4\\n4 5\\n\", \"1\\n25\\n\", \"10\\n7 4 6 7 6 6 7 5 7 5\\n8 7\\n4 5\\n9 6\\n2 5\\n4 8\\n9 10\\n4 3\\n9 4\\n1 8\\n\", \"20\\n4 1 3 4 7 3 8 7 7 3 1 1 7 1 9 5 1 10 6 3\\n6 15... | You are given a tree consisting of $n$ vertices. A number is written on each vertex; the number on vertex $i$ is equal to $a_i$.
Recall that a simple path is a path that visits each vertex at most once. Let the weight of the path be the bitwise XOR of the values written on vertices it consists of. Let's say that a tre... | 0 |
{"tests": "{\"inputs\": [[1, 3], [60, 12], [2672, 5678], [10927782, 6902514], [1590771464, 1590771620]], \"outputs\": [[1], [12], [334], [846], [4]]}", "source": "primeintellect"} | Find the greatest common divisor of two positive integers. The integers can be large, so you need to find a clever solution.
The inputs `x` and `y` are always greater or equal to 1, so the greatest common divisor will always be an integer that is also greater or equal to 1.
Write your solution by modifying this code... | 0 |
{"tests": "{\"inputs\": [\"3\\n3\\n-2\\n1\\n0\\n2\\n4\\n2\\n1\\n-1\\n-2\\n2\\n2\\n-2\\n-2\\n0\", \"3\\n3\\n-2\\n1\\n0\\n2\\n4\\n2\\n1\\n-1\\n-3\\n2\\n2\\n-2\\n-2\\n0\", \"3\\n3\\n-2\\n1\\n0\\n2\\n4\\n2\\n1\\n-1\\n-3\\n4\\n2\\n-2\\n-2\\n0\", \"3\\n3\\n0\\n1\\n0\\n2\\n4\\n2\\n1\\n-1\\n-2\\n4\\n2\\n-2\\n-4\\n0\", \"3\\n3\... | Taro made a sugoroku so that everyone can play at the children's association event. In order to make the game interesting, I wrote instructions such as "advance 6" and "back 5" in some of the sugoroku squares other than "Furidashi" and "Agari". Turn the roulette wheel to advance as many times as you can, and if an inst... | 0 |
{"tests": "{\"inputs\": [\"1\\n)(((((()((())(((((((\\n\", \"1\\n)()())((()))((()((()\\n\", \"10\\n((((((((((((((((()))))))))))))))))\\n(((((((((((((((())))))))))))))))\\n((((((((((((((((((((()))))))))))))))))))))\\n(((((((((((((((((((((())))))))))))))))))))))\\n()()()()()()()()()()()()()()()()()()()()\\n()()()()()()()(... | A bracket sequence is a string containing only characters "(" and ")". A regular bracket sequence (or, shortly, an RBS) is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original characters of the sequence. For example:
* bracket sequen... | 0 |
{"tests": "{\"inputs\": [\"4\\n1\\n8\\n6\\n1000000000000000000\\n\", \"4\\n1\\n8\\n1\\n1000000000000000000\\n\", \"4\\n1\\n3\\n1\\n1000000100000000000\\n\", \"4\\n1\\n8\\n10\\n1100000000000000100\\n\", \"4\\n1\\n4\\n10\\n1110000000000000100\\n\", \"4\\n1\\n4\\n10\\n0111000000000000100\\n\", \"4\\n1\\n8\\n10\\n011110000... | Jett is tired after destroying the town and she wants to have a rest. She likes high places, that's why for having a rest she wants to get high and she decided to craft staircases.
A staircase is a squared figure that consists of square cells. Each staircase consists of an arbitrary number of stairs. If a staircase ha... | 0.125 |
{"tests": "{\"inputs\": [[12, 15, 5], [12, -15, 6], [-14, -5, 5], [23, 16, 5], [0, 0, 7], [12, 0, 10], [0, 15, 17], [-24, 0, 10], [0, -18, 14], [32, -14, 14]], \"outputs\": [[\"60.00\"], [\"6.67\"], [\"7.78\"], [\"52.57\"], [\"0.00\"], [\"12.00\"], [\"15.00\"], [\"24.00\"], [\"18.00\"], [\"9.74\"]]}", "source": "primei... | Two moving objects A and B are moving accross the same orbit (those can be anything: two planets, two satellites, two spaceships,two flying saucers, or spiderman with batman if you prefer).
If the two objects start to move from the same point and the orbit is circular, write a function that gives the time the two objec... | 0 |
{"tests": "{\"inputs\": [[3], [4], [5], [8], [9]], \"outputs\": [[30], [210], [2310], [9699690], [223092870]]}", "source": "primeintellect"} | # Definition (Primorial Of a Number)
*Is similar to factorial of a number*, **_In primorial_**, not all the natural numbers get multiplied, **_only prime numbers are multiplied to calculate the primorial of a number_**. It's denoted with **_P_****_#_** and it is the product of the first n prime numbers.
___
# Task
... | 0 |
{"tests": "{\"inputs\": [\"5\\napple 1 1 1 1 1 1 1 10 1\\nbanana 1 2 2 2 2 2 1 10 1\\ncarrot 1 2 2 2 2 2 1 10 2\\ndurian 1 3 0 3 3 3 1 10 1\\neggplant 1 3 3 3 3 3 1 100 1\\n4\\nenoki 1 3 3 3 3 3 1 10 1\\ntomato 1 3 3 3 3 3 1 10 1\\npotato 1 3 3 3 3 3 1 10 1\\nonion 1 3 3 3 3 3 1 10 1\\n3\\na 10 1 1 1 1 1 1 10 1\\nb 10 ... | You are enthusiastic about the popular web game "Moonlight Ranch". The purpose of this game is to grow crops in the fields, sell them to earn income, and use that income to grow the ranch.
You wanted to grow the field quickly. Therefore, we decided to arrange the crops that can be grown in the game based on the income... | 0 |
{"tests": "{\"inputs\": [\"4 3\\n1 2 4 5 6 7 8 9\\n1 2 8 9 3 1\\n\", \"4 12\\n2 8 3 1 2 1 9 4\\n9 5 5 3 1 6 3 7 7 1 8 5 6 5 4 6 1 9 1 4 2 5 9 8\\n\", \"12 12\\n1 6 2 6 8 3 6 4 4 8 7 2 7 5 9 4 2 4 9 5 8 5 3 6\\n2 8 6 9 2 6 7 4 6 5 6 3 5 8 7 8 7 1 1 9 9 7 7 3\\n\", \"3 8\\n8 9 8 5 9 2\\n8 4 8 3 2 6 4 2 4 3 3 7 3 6 1 6\\n... | Two participants are each given a pair of distinct numbers from 1 to 9 such that there's exactly one number that is present in both pairs. They want to figure out the number that matches by using a communication channel you have access to without revealing it to you.
Both participants communicated to each other a set ... | 0 |
{"tests": "{\"inputs\": [[3], [4], [5], [7], [10], [33], [101], [1], [2], [11213], [8191], [8192]], \"outputs\": [[true], [false], [true], [true], [false], [false], [true], [false], [true], [true], [true], [false]]}", "source": "primeintellect"} | The AKS algorithm for testing whether a number is prime is a polynomial-time test based on the following theorem:
A number p is prime if and only if all the coefficients of the polynomial expansion of `(x − 1)^p − (x^p − 1)` are divisible by `p`.
For example, trying `p = 3`:
(x − 1)^3 − (x^3 − 1) = (x^3 − 3x^2... | 0 |
{"tests": "{\"inputs\": [\"2\\n4 6\\n1 2\\n1 3\\n2 3\\n2 4\\n3 4\\n3 4\\n7 6\\n1 2\\n1 3\\n2 4\\n2 5\\n3 6\\n3 7\\n\", \"2\\n4 6\\n1 2\\n1 3\\n2 3\\n2 4\\n1 4\\n3 4\\n7 6\\n1 2\\n1 3\\n2 4\\n2 5\\n3 6\\n3 7\\n\", \"2\\n4 6\\n1 2\\n1 3\\n2 3\\n3 4\\n1 4\\n3 4\\n7 6\\n1 2\\n1 3\\n2 4\\n2 5\\n3 6\\n3 7\\n\", \"2\\n4 6\\n1... | Arthur owns a ski resort on a mountain. There are $n$ landing spots on the mountain numbered from $1$ to $n$ from the top to the foot of the mountain. The spots are connected with one-directional ski tracks. All tracks go towards the foot of the mountain, so there are no directed cycles formed by the tracks. There are ... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.