info stringlengths 120 50k | question stringlengths 504 10.4k | avg@8_qwen3_4b_instruct_2507 float64 0 0.88 |
|---|---|---|
{"tests": "{\"inputs\": [[\"XYZ\"], [\"ABC\"], [\"ABCD\"], [\"ZAZ\"], [\"XYZA\"]], \"outputs\": [[5], [16174], [402230], [25], [34480]]}", "source": "primeintellect"} | Given a string `s` of uppercase letters, your task is to determine how many strings `t` (also uppercase) with length equal to that of `s` satisfy the followng conditions:
* `t` is lexicographical larger than `s`, and
* when you write both `s` and `t` in reverse order, `t` is still lexicographical larger than `s`.
``... | 0 |
{"tests": "{\"inputs\": [\"nana 12\\nb a 7 8 9 1\\nn 1 7 7 7 6\\na 9 6 3 7 8\\nk 8 2 4 7 9\\na 7 8 9 1 3\\ns 7 1 1 2 7\\nd a 7 8 9 1\\nn 1 7 7 7 6\\na 9 6 3 7 8\\nn 8 2 4 7 9\\na 7 8 9 1 3\\ns 7 1 1 2 7\", \"newworld 8\\nf 1 w e h 9\\no 2 a u v e\\ng n c o o k\\nw 3 i e s z\\ne a 7 8 i 1\\nf 1 w e 7 9\\no 2 r u v e\\ng... | One day alice and bob were playing with their old toys , they had moved all the rakes and drawers to in the pursuit of their childhood toys.
Finally they found bunch of cubes ,with letters and digits written on it ,which they recalled they used to make words from.
They have already come up with a word they would li... | 0 |
{"tests": "{\"inputs\": [\"3\\n1 0 1\\n2 2\\n2 2\", \"5\\n0 1 3 6 17\\n3 10\\n2 3 4\", \"3\\n2 0 1\\n2 2\\n2 2\", \"5\\n0 1 3 6 17\\n3 10\\n3 3 4\", \"5\\n0 1 3 6 17\\n3 1\\n3 3 4\", \"3\\n1 -1 1\\n2 3\\n2 2\", \"3\\n0 0 2\\n1 1\\n2\", \"5\\n0 1 3 6 11\\n3 10\\n2 3 4\", \"5\\n0 1 3 6 9\\n3 10\\n2 3 4\", \"3\\n0 0 1\\n2... | There are N rabbits on a number line. The rabbits are conveniently numbered 1 through N. The coordinate of the initial position of rabbit i is x_i.
The rabbits will now take exercise on the number line, by performing sets described below. A set consists of M jumps. The j-th jump of a set is performed by rabbit a_j (2≤... | 0 |
{"tests": "{\"inputs\": [[\"1 2 3 5\"], [\"1 5\"], [\"\"], [\"1 2 3 4 5\"], [\"2 3 4 5\"], [\"2 6 4 5 3\"], [\"_______\"], [\"2 1 4 3 a\"], [\"1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 ... | You receive some random elements as a space-delimited string. Check if the elements are part of an ascending sequence of integers starting with 1, with an increment of 1 (e.g. 1, 2, 3, 4).
Return:
* `0` if the elements can form such a sequence, and no number is missing ("not broken", e.g. `"1 2 4 3"`)
* `1` if there ... | 0 |
{"tests": "{\"inputs\": [\"10 10\\n2 3 1 5 6 7 8 4 10 9\\n2 3 1 4 5 6 7 8 10 9\\n\", \"4 3\\n2 1 4 3\\n4 3 1 2\\n\", \"3 100\\n2 3 1\\n2 3 1\\n\", \"55 28\\n35 33 46 8 11 13 14 26 42 38 1 7 34 5 2 21 17 45 54 43 4 18 27 50 25 10 29 48 6 16 22 28 55 53 49 41 39 23 40 47 51 37 36 19 9 32 52 12 24 3 20 15 30 44 31\\n5 52 ... | Little Petya likes permutations a lot. Recently his mom has presented him permutation q1, q2, ..., qn of length n.
A permutation a of length n is a sequence of integers a1, a2, ..., an (1 ≤ ai ≤ n), all integers there are distinct.
There is only one thing Petya likes more than permutations: playing with little Masha... | 0 |
{"tests": "{\"inputs\": [\"8\\n5 6 2\\n2 4 3 5 7\\n5 11 2\\n2 4 3 5 7\\n3 2 3\\n4 2 6\\n5 2 3\\n10 1 3 9 2\\n2 10000 2\\n10000 10000\\n2 9999 2\\n10000 10000\\n4 6 4\\n3 2 3 2\\n5 5 3\\n1 2 2 1 2\\n\", \"2\\n2 1 2\\n1 1\\n2 2000000000 2\\n1 1\\n\", \"2\\n2 1 2\\n1 1\\n2 2000000000 2\\n1 1\\n\", \"8\\n5 6 2\\n2 4 3 5 7\... | This is the hard version of this problem. The only difference is the constraint on $k$ — the number of gifts in the offer. In this version: $2 \le k \le n$.
Vasya came to the store to buy goods for his friends for the New Year. It turned out that he was very lucky — today the offer "$k$ of goods for the price of one" ... | 0 |
{"tests": "{\"inputs\": [[\"foobar\"], [\"codewars\"], [\"jAvASCript\"], [\"brian\"], [\"jabberwock\"], [\"SCOTland\"], [\"WeLlDoNe\"]], \"outputs\": [[\"fooBAR\"], [\"codeWARS\"], [\"javasCRIPT\"], [\"briAN\"], [\"jabbeRWOCK\"], [\"scotLAND\"], [\"wellDONE\"]]}", "source": "primeintellect"} | Create a function that takes a string and returns that
string with the first half lowercased and the last half uppercased.
eg: foobar == fooBAR
If it is an odd number then 'round' it up to find which letters to uppercase. See example below.
sillycase("brian")
// --^-- midpoint
// bri ... | 0 |
{"tests": "{\"inputs\": [\"2\\n3\\n1 2\\n2 2\\n3 2\\n3\\n2 3\\n1 2\\n2 4\", \"2\\n3\\n1 2\\n2 2\\n3 2\\n3\\n2 3\\n1 2\\n2 8\", \"2\\n3\\n1 2\\n2 2\\n3 2\\n3\\n2 3\\n1 2\\n2 2\", \"2\\n3\\n1 1\\n2 2\\n3 2\\n3\\n2 3\\n1 2\\n2 2\", \"2\\n3\\n1 2\\n2 2\\n4 2\\n3\\n2 3\\n1 2\\n2 4\", \"2\\n3\\n1 1\\n2 2\\n3 2\\n3\\n2 3\\n1 ... | The Little Elephant from the Zoo of Lviv likes listening to music.
There are N songs, numbered from 1 to N, in his MP3-player. The song i is described by a pair of integers B_{i} and L_{i} - the band (represented as integer) that performed that song and the length of that song in seconds. The Little Elephant is going t... | 0 |
{"tests": "{\"inputs\": [\"2\\n2 1\\n\", \"3\\n2 4 2\\n\", \"2\\n1 1\\n\", \"3\\n1 1 1\\n\", \"20\\n1 6 8 9 10 10 11 11 10 10 9 6 6 6 6 4 3 2 1 0\\n\", \"3\\n0 2 1\\n\", \"3\\n2 2 1\\n\", \"2\\n2 4\\n\", \"2\\n1 3\\n\", \"1\\n1\\n\", \"5\\n1 0 2 1 0\\n\", \"20\\n2 2 4 5 5 6 7 6 5 5 7 6 4 3 3 3 3 3 3 1\\n\", \"5\\n1 1 0... | Polycarpus is an amateur programmer. Now he is analyzing a friend's program. He has already found there the function rangeIncrement(l, r), that adds 1 to each element of some array a for all indexes in the segment [l, r]. In other words, this function does the following:
function rangeIncrement(l,... | 0 |
{"tests": "{\"inputs\": [\"3\\n1 0 2\\n1 0\\n1\\n\", \"3\\n1 1 2\\n1 0\\n1\\n\", \"3\\n1 2 1\\n1 0\\n1\\n\", \"3\\n2 0 2\\n0 1\\n1\\n\", \"20\\n2 1 1 0 1 2 2 2 2 0 0 2 2 2 0 1 1 2 2 2\\n1 1 1 1 1 2 0 0 1 0 1 1 1 2 2 0 2 2 2\\n2 0 1 0 2 0 1 1 0 0 0 2 1 2 2 1 0 2\\n2 0 1 2 1 2 1 2 1 1 0 1 1 2 2 2 1\\n2 1 2 1 0 1 1 2 0 0 ... | You are given an integer $n$. You have to calculate the number of binary (consisting of characters 0 and/or 1) strings $s$ meeting the following constraints.
For every pair of integers $(i, j)$ such that $1 \le i \le j \le n$, an integer $a_{i,j}$ is given. It imposes the following constraint on the string $s_i s_{i+1... | 0 |
{"tests": "{\"inputs\": [\"3 3\\n2 0 1\\n1 0 0\\n0 0 0\\n1 1\\n\", \"13 8\\n5 7 7 7 9 1 10 7\\n2 10 5 4 5 4 9 1\\n8 6 10 8 10 9 9 5\\n7 10 9 8 6 7 5 8\\n1 6 4 2 4 9 3 10\\n10 4 4 6 5 6 6 4\\n7 5 3 9 8 5 1 3\\n9 6 1 9 10 5 3 7\\n6 3 7 6 9 9 1 6\\n8 6 5 9 1 9 2 1\\n1 8 2 8 9 7 3 3\\n7 2 2 4 4 6 7 10\\n7 8 6 10 2 6 10 9\\... | Vasya has got a magic matrix a of size n × m. The rows of the matrix are numbered from 1 to n from top to bottom, the columns are numbered from 1 to m from left to right. Let a_{ij} be the element in the intersection of the i-th row and the j-th column.
Vasya has also got a chip. Initially, the chip is in the intersec... | 0.5 |
{"tests": "{\"inputs\": [\"4\\n6 3 3\\n1 2 3 2 2 2\\n6 2 4\\n1 1 2 2 2 2\\n6 5 1\\n6 5 4 3 2 1\\n4 0 4\\n4 4 4 3\\n\", \"4\\n6 3 3\\n1 2 6 2 2 2\\n6 2 4\\n1 1 2 2 2 2\\n6 5 1\\n6 5 4 3 2 1\\n4 0 4\\n4 4 4 3\\n\", \"4\\n6 3 3\\n1 2 6 2 2 2\\n6 2 4\\n1 1 2 2 2 2\\n6 5 1\\n6 5 4 1 2 1\\n4 0 4\\n4 4 4 3\\n\", \"4\\n6 3 3\\... | To satisfy his love of matching socks, Phoenix has brought his $n$ socks ($n$ is even) to the sock store. Each of his socks has a color $c_i$ and is either a left sock or right sock.
Phoenix can pay one dollar to the sock store to either:
recolor a sock to any color $c'$ $(1 \le c' \le n)$
turn a left sock into a ri... | 0 |
{"tests": "{\"inputs\": [\"3 5\\n0W 1W\\n0W 2W\\n0W 2E\\n0E 1E\\n1E 2E\\naabbcdcee\\n-\\n-\\n-\\n-\\nbbaadeecc\\n3 3\\n0E 1W\\n1E 2W\\n2E 0W\\naabb\\nbbcc\\naa\\nbbbb\\ncc\\naaaa\\n3 4\\n0E 1W\\n0E 2E\\n1E 2W\\n2E 0W\\nababab\\n-\\n-\\naaabbb\\n-\\n-\\n0 0\", \"3 5\\n0W 1W\\n0W 2W\\n0W 2E\\n0E 1E\\n1E 2E\\naabbccdee\\n... | In the good old Hachioji railroad station located in the west of Tokyo, there are several parking lines, and lots of freight trains come and go every day.
All freight trains travel at night, so these trains containing various types of cars are settled in your parking lines early in the morning. Then, during the daytim... | 0 |
{"tests": "{\"inputs\": [\"10 3 30000\\n00:06:54\\n00:42:06\\n03:49:45\\n04:38:35\\n05:33:30\\n05:51:46\\n10:46:34\\n14:34:59\\n14:40:06\\n14:53:13\\n\", \"1 1 86400\\n00:00:00\\n\", \"5 2 40000\\n06:30:57\\n07:27:25\\n09:10:21\\n11:05:03\\n12:42:37\\n\", \"7 4 30000\\n05:08:54\\n05:35:53\\n06:03:20\\n06:17:50\\n09:29:... | Polycarpus got an internship in one well-known social network. His test task is to count the number of unique users who have visited a social network during the day. Polycarpus was provided with information on all user requests for this time period. For each query, we know its time... and nothing else, because Polycarp... | 0 |
{"tests": "{\"inputs\": [\"7\\n1 2\\n2 3\\n2 4\\n2 5\\n4 6\\n6 7\", \"7\\n1 4\\n2 3\\n2 4\\n4 5\\n4 6\\n6 7\", \"7\\n1 4\\n2 3\\n2 4\\n4 5\\n7 6\\n6 7\", \"7\\n1 4\\n2 3\\n2 4\\n1 5\\n7 6\\n6 7\", \"7\\n1 4\\n2 3\\n2 4\\n1 5\\n7 6\\n6 5\", \"7\\n1 4\\n2 3\\n2 4\\n4 5\\n7 3\\n6 3\", \"7\\n1 2\\n2 3\\n4 4\\n1 5\\n7 6\\n6... | Takahashi has decided to make a Christmas Tree for the Christmas party in AtCoder, Inc.
A Christmas Tree is a tree with N vertices numbered 1 through N and N-1 edges, whose i-th edge (1\leq i\leq N-1) connects Vertex a_i and b_i.
He would like to make one as follows:
* Specify two non-negative integers A and B.
* Pr... | 0 |
{"tests": "{\"inputs\": [[\"BRB I need to go into a KPI meeting before EOD\"], [\"I am IAM so will be OOO until EOD\"], [\"Going to WAH today. NRN. OOO\"], [\"We're looking at SMB on SM DMs today\"], [\"OOO\"], [\"KPI\"], [\"EOD\"], [\"TBD\"], [\"TBD by EOD\"], [\"BRB I am OOO\"], [\"WAH\"], [\"IAM\"], [\"NRN\"], [\"CT... | Laura really hates people using acronyms in her office and wants to force her colleagues to remove all acronyms before emailing her. She wants you to build a system that will edit out all known acronyms or else will notify the sender if unknown acronyms are present.
Any combination of three or more letters in upper ca... | 0 |
{"tests": "{\"inputs\": [[2, 5], [2, 3, 4], [9], [0], [0, 1], [1, 1, 1], [5, 6, 7, 9, 6, 9, 18, 4, 5, 15, 15, 10, 17, 7], [17, 20, 4, 15, 4, 18, 12, 14, 20, 19, 2, 14, 13, 7], [11, 13, 4, 5, 17, 4, 10, 13, 16, 13, 13], [20, 1, 6, 10, 3, 7, 8, 4], [3, 9, 9, 19, 18, 14, 18, 9], [3, 9, 9, 19, 18, 14, 18, 0]], \"outputs\":... | Write a function that calculates the *least common multiple* of its arguments; each argument is assumed to be a non-negative integer. In the case that there are no arguments (or the provided array in compiled languages is empty), return `1`.
~~~if:objc
NOTE: The first (and only named) argument of the function `n` spec... | 0 |
{"tests": "{\"inputs\": [\"8 5 5 3\", \"3 5 4 2\", \"7 9 20 32\", \"15 5 5 3\", \"3 9 4 2\", \"15 5 5 5\", \"3 9 4 3\", \"15 5 8 5\", \"5 9 4 3\", \"15 5 8 3\", \"5 9 7 3\", \"15 6 8 3\", \"10 9 7 3\", \"15 11 8 3\", \"10 6 7 3\", \"15 3 8 3\", \"13 6 7 3\", \"12 3 12 6\", \"13 6 13 3\", \"24 6 13 3\", \"23 6 13 3\", \... | Takahashi has an N \times M grid, with N horizontal rows and M vertical columns. Determine if we can place A 1 \times 2 tiles (1 vertical, 2 horizontal) and B 2 \times 1 tiles (2 vertical, 1 horizontal) satisfying the following conditions, and construct one arrangement of the tiles if it is possible:
* All the tiles m... | 0 |
{"tests": "{\"inputs\": [\"99\\nyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\\n\", \"4\\nabcd\\n\", \"100\\ntssttststtssttsssttsssttttttsttttssstssstsstssstststttssssstttsssttststststtttsssstsstsssssttttttsst\\n\", \"9\\nrnnnqnnrn\\n\", \"60\\ndaddddpppddapapdpaapa... | This problem is different with hard version only by constraints on total answers length
It is an interactive problem
Venya joined a tour to the madhouse, in which orderlies play with patients the following game. Orderlies pick a string s of length n, consisting only of lowercase English letters. The player can ask tw... | 0 |
{"tests": "{\"inputs\": [\"4 4\\n1 2 0\\n2 3 0\\n2 4 0\\n3 4 0\\n\", \"6 6\\n1 2 0\\n2 3 1\\n3 4 0\\n4 5 1\\n5 6 0\\n6 1 1\\n\", \"5 5\\n1 2 0\\n2 3 0\\n3 4 0\\n4 5 0\\n1 5 0\\n\", \"9 2\\n1 2 0\\n2 3 0\\n\", \"28567 13\\n28079 24675 1\\n18409 26720 1\\n980 10815 1\\n20794 16571 1\\n7376 19861 1\\n11146 706 1\\n4255 16... | There are many anime that are about "love triangles": Alice loves Bob, and Charlie loves Bob as well, but Alice hates Charlie. You are thinking about an anime which has n characters. The characters are labeled from 1 to n. Every pair of two characters can either mutually love each other or mutually hate each other (the... | 0 |
{"tests": "{\"inputs\": [\"15\\n94836 0\\n22780 1\\n48294 0\\n24834 3\\n37083 2\\n57862 0\\n37231 1\\n81795 7\\n32835 2\\n4696 8\\n95612 0\\n7536 6\\n70084 5\\n72956 10\\n41647 7\\n\", \"20\\n68260 0\\n819 1\\n54174 1\\n20460 1\\n25696 2\\n81647 4\\n17736 4\\n91307 5\\n5210 4\\n87730 2\\n4653 8\\n11044 6\\n15776 4\\n17... | Little Petya loves looking for numbers' divisors. One day Petya came across the following problem:
You are given n queries in the form "xi yi". For each query Petya should count how many divisors of number xi divide none of the numbers xi - yi, xi - yi + 1, ..., xi - 1. Help him.
Input
The first line contains an int... | 0 |
{"tests": "{\"inputs\": [[0], [1], [2], [3], [4], [5], [8], [10], [11], [12], [13], [14], [15], [16], [20], [21], [22], [28], [33], [44], [55], [98], [99]], \"outputs\": [[\"Woda mineralna poprosze\"], [\"Jedno piwo poprosze\"], [\"Dwa piwa poprosze\"], [\"Trzy piwa poprosze\"], [\"Cztery piwa poprosze\"], [\"Piec piw ... | ## Witamy!
You are in Poland and want to order a drink. You need to ask "One beer please": "Jedno piwo poprosze"
``` java
Translator.orderingBeers(1) = "Jedno piwo poprosze"
```
But let's say you are really thirsty and want several beers. Then you need to count in Polish. And more difficult, you need to understand t... | 0 |
{"tests": "{\"inputs\": [[\"A\", 111], [\"Abc\", 212], [\"Ball\", 134], [\"Ball\", 444], [\"This is a test.\", 348], [\"Do the kata Kobayashi Maru Test. Endless fun and excitement when finding a solution.\", 583]], \"outputs\": [[\"S\"], [\"Smb\"], [\">fdd\"], [\">gff\"], [\"Iaqh qh g iyhi,\"], [\"Sr pgi jlpl Jr,lqlage... | You have to write two methods to *encrypt* and *decrypt* strings.
Both methods have two parameters:
```
1. The string to encrypt/decrypt
2. The Qwerty-Encryption-Key (000-999)
```
The rules are very easy:
```
The crypting-regions are these 3 lines from your keyboard:
1. "qwertyuiop"
2. "asdfghjkl"
3. "zxcvbnm,."
If ... | 0 |
{"tests": "{\"inputs\": [\"DDUL\\n\", \"LLLLLLLLRRRRDDDDDDDUUUUUU\\n\", \"UULLDLUR\\n\", \"URRRLULUURURLRLLLLULLRLRURLULRLULLULRRUU\\n\", \"RDRLL\\n\", \"RRRRRRRRRRRDDDDDDDDDDDDDDDDDDDRRRRRRRRRRRRRRRRRRRUUUUUUUUUUUUUUUUUUULLLLLLLLLLLLLLLLLLUUUUUUUUUUU\\n\", \"DDDLLLLLLLDDDDDDDRRRRRRRUUUUUURRR\\n\", \"DDDDLLLDDDRRRUURRR... | The whole world got obsessed with robots,and to keep pace with the progress, great Berland's programmer Draude decided to build his own robot. He was working hard at the robot. He taught it to walk the shortest path from one point to another, to record all its movements, but like in many Draude's programs, there was a ... | 0 |
{"tests": "{\"inputs\": [\"4 6\\n0 1 1\\n0 2 5\\n1 2 2\\n1 3 8\\n2 3 1\\n3 2 -7\", \"4 6\\n0 1 1\\n0 3 -5\\n1 2 2\\n1 3 4\\n2 3 1\\n3 2 7\", \"4 6\\n0 1 1\\n0 2 5\\n1 2 3\\n1 3 4\\n2 3 1\\n3 2 7\", \"4 6\\n0 1 1\\n0 2 5\\n1 2 2\\n1 3 8\\n0 3 1\\n3 2 -7\", \"4 6\\n0 1 2\\n0 2 5\\n1 2 2\\n1 3 8\\n0 3 1\\n3 2 -7\", \"4 6\... | Constraints
* 1 ≤ |V| ≤ 100
* 0 ≤ |E| ≤ 9900
* -2 × 107 ≤ di ≤ 2 × 107
* There are no parallel edges
* There are no self-loops
Input
An edge-weighted graph G (V, E).
|V| |E|
s0 t0 d0
s1 t1 d1
:
s|E|-1 t|E|-1 d|E|-1
|V| is the number of vertices and |E| is the number of edges in G. The graph vertices are named wi... | 0.25 |
{"tests": "{\"inputs\": [\"2\\n3\\n2 4 8\\n3\\n4 7 5\\n\\n\\n\", \"2\\n3\\n2 4 8\\n3\\n4 10 5\", \"2\\n3\\n2 4 8\\n3\\n4 10 2\", \"2\\n2\\n7 2 8\\n3\\n0 8 5\", \"2\\n3\\n3 4 8\\n3\\n0 10 6\", \"2\\n2\\n2 2 8\\n3\\n0 10 5\", \"2\\n2\\n7 4 8\\n3\\n0 20 5\", \"2\\n2\\n2 0 8\\n3\\n0 0 9\", \"2\\n3\\n10 1 7\\n2\\n0 3 0\", \... | The Little Elephant from the Zoo of Lviv has an array A that consists of N positive integers. Let A[i] be the i-th number in this array (i = 1, 2, ..., N).
Find the minimal number x > 1 such that x is a divisor of all integers from array A. More formally, this x should satisfy the following relations:
A[1] mod x = 0,... | 0 |
{"tests": "{\"inputs\": [\"5\\n4 4 4 4 4 4 4 4 4 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1\\n\", \"4\\n1 1 1 1 1 1 1 1 1 1 1 1 3 3 3 3\\n\", \"5\\n27 675 1 1 347621274 5 2 13 189 738040275 5 1 189 13 1 959752125 770516962 769220855 5 5 2 675 1 1 27\\n\", \"3\\n484799 1 1 744137 1 1 909312183 1 1\\n\", \"2\\n54748096 1 641009859 ... | The GCD table G of size n × n for an array of positive integers a of length n is defined by formula
<image>
Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as <image>. For example, for array a = {4, 3, 6,... | 0.125 |
{"tests": "{\"inputs\": [[[1]], [[1, 3, 5, 7]], [[-1, 3, 5, -7]], [[5, 7, 3, 7]], [[]]], \"outputs\": [[1], [4], [0], [5.5], [0]]}", "source": "primeintellect"} | ## Find Mean
Find the mean (average) of a list of numbers in an array.
## Information
To find the mean (average) of a set of numbers add all of the numbers together and divide by the number of values in the list.
For an example list of `1, 3, 5, 7`
1. Add all of the numbers
```
1+3+5+7 = 16
```
2. Divide by the ... | 0 |
{"tests": "{\"inputs\": [\"5\\n7 3 5 3 4\\n2 1 3 3 3\\n\", \"7\\n4 6 5 8 8 2 6\\n2 1 2 1 1 1 2\\n\", \"7\\n4 12 5 8 8 2 6\\n2 1 2 1 1 1 2\\n\", \"7\\n4 12 5 8 8 2 5\\n2 1 2 1 1 1 2\\n\", \"7\\n4 12 5 8 8 2 5\\n2 1 2 1 1 1 1\\n\", \"7\\n4 12 5 8 8 2 5\\n2 1 2 0 1 1 1\\n\", \"7\\n4 12 5 8 8 2 5\\n2 1 2 0 1 1 0\\n\", \"7\... | Leha like all kinds of strange things. Recently he liked the function F(n, k). Consider all possible k-element subsets of the set [1, 2, ..., n]. For subset find minimal element in it. F(n, k) — mathematical expectation of the minimal element among all k-element subsets.
But only function does not interest him. He wan... | 0 |
{"tests": "{\"inputs\": [\"3 1\\n4 4\\n0 0\", \"3 1\\n6 4\\n0 0\", \"3 4\\n4 1\\n0 0\", \"3 1\\n4 2\\n0 0\", \"3 2\\n6 4\\n0 0\", \"3 7\\n4 1\\n0 0\", \"4 4\\n4 1\\n0 0\", \"4 1\\n4 2\\n0 0\", \"3 7\\n7 1\\n0 0\", \"4 1\\n6 4\\n0 0\", \"4 1\\n4 1\\n0 0\", \"4 1\\n10 4\\n0 0\", \"4 4\\n9 1\\n0 0\", \"8 4\\n2 1\\n0 0\", ... | A tatami mat, a Japanese traditional floor cover, has a rectangular form with aspect ratio 1:2. When spreading tatami mats on a floor, it is prohibited to make a cross with the border of the tatami mats, because it is believed to bring bad luck.
Your task is to write a program that reports how many possible ways to sp... | 0 |
{"tests": "{\"inputs\": [\"5\\n1 2 3 4 5\\n4\\n2 3 5 10\\n0\", \"5\\n1 2 3 4 5\\n4\\n1 3 5 10\\n0\", \"5\\n1 2 3 4 5\\n4\\n1 3 4 10\\n0\", \"5\\n1 3 3 4 5\\n4\\n2 3 5 7\\n0\", \"5\\n1 2 3 4 4\\n4\\n1 3 4 10\\n0\", \"5\\n1 3 3 4 5\\n4\\n2 3 5 10\\n0\", \"5\\n1 2 3 4 5\\n4\\n0 3 5 11\\n0\", \"5\\n1 4 3 4 20\\n19\\n1 3 4 ... | Brave Ponta and his best friend, Brave Gonta, have come to Luida's bar in search of friends to embark on an epic adventure. There are many warriors, monks and wizards in the tavern who are itching to go on an adventure.
Gonta, who is kind-hearted, cared for Ponta and said, "You can choose your friends first."
On the ... | 0.25 |
{"tests": "{\"inputs\": [\"10\\n5 1 6 2 8 3 4 10 9 7\\n3 1 10 6 8 5 2 7 9 4\\n2 9 1 4 10 6 8 7 3 5\\n10 1 7 8 3 2 4 6 5 9\\n3 2 10 4 7 8 5 6 1 9\\n5 6 3 10 8 7 2 9 4 1\\n6 5 1 3 2 7 9 10 8 4\\n1 10 9 3 7 8 4 2 6 5\\n6 8 4 5 9 1 2 10 7 3\\n9 6 8 5 10 3 1 7 2 4\\n5 7 4 8 9 6 1 10 3 2\\n\", \"5\\n1 4 2 3 5\\n5 1 3 4 2\\n3... | As meticulous Gerald sets the table, Alexander finished another post on Codeforces and begins to respond to New Year greetings from friends. Alexander has n friends, and each of them sends to Alexander exactly one e-card. Let us number his friends by numbers from 1 to n in the order in which they send the cards. Let's ... | 0 |
{"tests": "{\"inputs\": [\"3\\n1 9\\n2 1\\n4 1\\n\", \"6\\n4 2\\n8 4\\n3 0\\n2 3\\n7 1\\n0 1\\n\", \"7\\n569310119 79567967\\n449035799 396713817\\n394225976 502573394\\n525802264 768636555\\n620993905 708159609\\n983715981 484392815\\n460196326 336206040\\n\", \"2\\n4 0\\n5 0\\n\", \"2\\n743693950 521961538\\n46787449... | There are $n$ cities numbered from $1$ to $n$, and city $i$ has beauty $a_i$.
A salesman wants to start at city $1$, visit every city exactly once, and return to city $1$.
For all $i\ne j$, a flight from city $i$ to city $j$ costs $\max(c_i,a_j-a_i)$ dollars, where $c_i$ is the price floor enforced by city $i$. Note ... | 0 |
{"tests": "{\"inputs\": [\"...............\\n...............\\n...............\\n...............\\n...............\\n.........../...\\n...............\\n...............\\n...............\\n...............\\n...............\\n...............\\n...............\\n...............\\n...............\\n...............\\n........ | Ikta, who hates to lose, has recently been enthusiastic about playing games using the Go board. However, neither Go nor Gomoku can beat my friends at all, so I decided to give a special training to the lesser-known game Phutball.
This game is a difficult game, so I decided to give special training so that I could win ... | 0 |
{"tests": "{\"inputs\": [\"4 3 1\\n1 2 1\\n2 3 1\\n3 1 1\\n1\", \"4 3 1\\n1 2 1\\n2 3 2\\n1 1 1\\n1\", \"4 3 1\\n1 2 1\\n2 3 1\\n1 2 1\\n2\", \"4 3 1\\n1 2 1\\n2 3 4\\n1 1 1\\n1\", \"8 3 1\\n1 1 2\\n2 3 4\\n3 1 0\\n1\", \"4 3 1\\n1 2 2\\n2 4 4\\n1 1 1\\n1\", \"4 3 1\\n1 1 0\\n1 3 0\\n3 2 0\\n1\", \"10 3 1\\n1 2 5\\n3 3... | There are N towns in JOI, which are connected by M bidirectional roads. There are shopping malls in K towns, and the people go to one of those towns through the road to shop.
Depending on the location of your home, you may have to travel long distances to go shopping, which is very inconvenient. To understand this sit... | 0 |
{"tests": "{\"inputs\": [\"post\\n9\\npost posted on wall's wall\\non commented on post's post\\npost likes likes's post\\ncommented posted on post's wall\\npost commented on likes's post\\nlikes likes post's post\\npost posted on posted's wall\\non commented on post's post\\npost likes commented's post\\n\", \"likes\\... | Facetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority factor (it will be described).
This priority factor will be affected by three types of actions:
* 1. "X posted on Y's wall" (... | 0 |
{"tests": "{\"inputs\": [\"5 5 2\\n2 0 2\\n1 0 1 4\\n2 2 4\\n1 0 1 3\\n2 4 2\\n\", \"5 10 2\\n2 0 2\\n1 0 3 4\\n2 2 4\\n1 0 1 3\\n2 4 2\\n\", \"1 5 2\\n2 0 2\\n1 0 1 4\\n2 2 4\\n1 0 1 3\\n2 4 2\\n\", \"1 5 4\\n2 0 2\\n1 0 1 4\\n7 2 4\\n1 0 1 3\\n2 4 1\\n\", \"1 5 1\\n2 0 2\\n1 0 1 4\\n2 2 4\\n1 0 1 3\\n2 4 1\\n\", \"1 ... | You are given a rooted tree. Each vertex contains a_i tons of gold, which costs c_i per one ton. Initially, the tree consists only a root numbered 0 with a_0 tons of gold and price c_0 per ton.
There are q queries. Each query has one of two types:
1. Add vertex i (where i is an index of query) as a son to some ver... | 0 |
{"tests": "{\"inputs\": [\"ph..qlr.pt\\n\", \"aa.aa.aaaabbbbccc.ddd.ee\\n\", \"akymwh\\n\", \".abcde.cpp\\n\", \".abc.cpp\\n\", \".c.v.hpehh\\n\", \"double..dot\\n\", \"badabaca.mor\\n\", \"a.b.c\\n\", \"thisislongfilename\\n\", \"abc.abcde\\n\", \"xlq\\n\", \"one.one.one.one.one.one.one.one.one.one\\n\", \"a.txtaaaaaa... | Eudokimus, a system administrator is in trouble again. As a result of an error in some script, a list of names of very important files has been damaged. Since they were files in the BerFS file system, it is known that each file name has a form "name.ext", where:
* name is a string consisting of lowercase Latin lett... | 0 |
{"tests": "{\"inputs\": [[{\"user\": \"rwx\", \"group\": \"r-x\", \"other\": \"r-x\"}], [{\"user\": \"rwx\", \"group\": \"r--\", \"other\": \"r--\"}], [{\"user\": \"r-x\", \"group\": \"r-x\", \"other\": \"---\"}], [{\"group\": \"rwx\"}], [{}]], \"outputs\": [[\"755\"], [\"744\"], [\"550\"], [\"070\"], [\"000\"]]}", "so... | Lot of junior developer can be stuck when they need to change the access permission to a file or a directory in an Unix-like operating systems.
To do that they can use the `chmod` command and with some magic trick they can change the permissionof a file or a directory. For more information about the `chmod` command yo... | 0 |
{"tests": "{\"inputs\": [\"2\\n0\\n10\\n20\\n34\", \"3\\n3\\n10\\n8\\n7\\n0\\n10\", \"3\\n3\\n10\\n8\\n7\\n0\\n0\", \"3\\n3\\n10\\n8\\n7\\n2\\n5\", \"2\\n0\\n10\\n20\\n68\", \"3\\n3\\n10\\n8\\n7\\n1\\n5\", \"2\\n1\\n10\\n20\\n68\", \"3\\n3\\n10\\n8\\n7\\n0\\n5\", \"2\\n0\\n10\\n20\\n135\", \"2\\n0\\n10\\n20\\n231\", \"... | There are N computers and N sockets in a one-dimensional world. The coordinate of the i-th computer is a_i, and the coordinate of the i-th socket is b_i. It is guaranteed that these 2N coordinates are pairwise distinct.
Snuke wants to connect each computer to a socket using a cable. Each socket can be connected to onl... | 0 |
{"tests": "{\"inputs\": [[3, [6, 1, 2, 9, 2]], [14, [7, 3, 23, 9, 14, 20, 7]], [0, [6, 1, 2, 9, 2]], [10, []], [24, [24, 0, 100, 2, 5]], [24, [2.7, 0, 100.9, 1, 5.5]], [-1, [1, 2, 3, 4]], [-1, [-1, 0, 1, 2, 3, 4]], [14, [17, 33, 23, 19, 19, 20, 17]], [14, [13, 15, 14, 14, 15, 13]]], \"outputs\": [[\"1,2,2\"], [\"3,7,7,... | You love coffee and want to know what beans you can afford to buy it.
The first argument to your search function will be a number which represents your budget.
The second argument will be an array of coffee bean prices.
Your 'search' function should return the stores that sell coffee within your budget.
The search... | 0 |
{"tests": "{\"inputs\": [\"5 7\\nRRCABXT\\nAABMFAB\\nRROMJAC\\nAPTADAB\\nYABADAO\\n3 13\\nABCDEFGHIJKLM\\nXMADAMIMADAMY\\nACEGIKMOQSUWY\\n3 4\\nDEFG\\nACAB\\nHIJK\\n3 6\\nABCDEF\\nGHIAKL\\nMNOPQR\\n10 19\\nJFZODYDXMZZPEYTRNCW\\nXVGHPOKEYNZTQFZJKOD\\nEYEHHQKHFZOVNRGOOLP\\nQFZOIHRQMGHPNISHXOC\\nDRGILJHSQEHHQLYTILL\\nNCSH... | Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a beautiful day.
But last week, you overheard a magic spell that ... | 0 |
{"tests": "{\"inputs\": [\"4\\n4\\n0,1,1500\\n0,2,2000\\n1,2,600\\n2,3,500\\n0\", \"4\\n4\\n0,1,1500\\n0,2,2000\\n1,2,600\\n2,3,400\\n0\", \"4\\n4\\n0,1,0500\\n0,2,2000\\n0,2,600\\n2,3,400\\n0\", \"4\\n4\\n0,1,0400\\n0002,2,0\\n0,2,600\\n2,3,400\\n0\", \"4\\n4\\n0,1,1500\\n0,2,2000\\n1,2,600\\n2,3,600\\n0\", \"4\\n4\\n... | Aizuwakamatsu City is known as the "City of History". About 400 years ago, the skeleton of the castle town was created by Gamo Ujisato, but after that, it became the central city of the Aizu clan 230,000 stones, whose ancestor was Hoshina Masayuki, the half-brother of Tokugawa's third shogun Iemitsu. Developed. Many to... | 0 |
{"tests": "{\"inputs\": [\"4 4\\n4 2 3 1\", \"5 2\\n5 4 3 2 1\", \"4 1\\n4 2 3 1\", \"8 2\\n4 5 7 8 3 1 2 6\", \"4 2\\n4 3 2 1\", \"8 6\\n4 5 7 8 3 1 2 6\", \"8 5\\n4 5 7 8 3 1 2 6\", \"8 1\\n4 5 7 8 3 1 2 6\", \"8 4\\n4 5 7 8 3 1 2 6\", \"4 3\\n4 1 3 2\", \"5 4\\n4 5 3 2 1\", \"4 2\\n4 1 3 2\", \"4 3\\n3 2 4 1\", \"4 ... | You are given a permutation P_1 ... P_N of the set {1, 2, ..., N}.
You can apply the following operation to this permutation, any number of times (possibly zero):
* Choose two indices i,j (1 ≦ i < j ≦ N), such that j - i ≧ K and |P_i - P_j| = 1. Then, swap the values of P_i and P_j.
Among all permutations that can... | 0.375 |
{"tests": "{\"inputs\": [[10], [9.7], [\"Hello World!\"], [[1, 2, 3, 4]], [1023], [true], [\"True\"], [{\"name\": \"John\", \"age\": 32}], [null], [3.141], [false], [\"8.6\"], [\"*&^\"], [4.5]], \"outputs\": [[\"int\"], [\"float\"], [\"str\"], [\"list\"], [\"int\"], [\"bool\"], [\"str\"], [\"dict\"], [\"NoneType\"], [\... | Create a program that will return whether an input value is a str, int, float, or bool. Return the name of the value.
### Examples
- Input = 23 --> Output = int
- Input = 2.3 --> Output = float
- Input = "Hello" --> Output = str
- Input = True --> Output = bool
Write your solution by modifying this code:
```python
d... | 0 |
{"tests": "{\"inputs\": [\"2\\n35 7\\n6 8 35 9 28 25 10 41 33 39 19 24 5 12 30 40 18 2 4 11 32 13 31 21 14 27 3 34 37 16 17 29 1 42 36\\n20 23 38 15 26 7 22\\n\", \"3\\n36 28 14\\n46 15 35 60 41 65 73 33 18 20 68 22 28 23 67 44 2 24 21 51 37 3 48 69 12 50 32 72 45 53 17 47 56 52 29 57\\n8 62 10 19 26 64 7 49 6 25 34 63... | You've got table a, consisting of n rows, numbered from 1 to n. The i-th line of table a contains ci cells, at that for all i (1 < i ≤ n) holds ci ≤ ci - 1.
Let's denote s as the total number of cells of table a, that is, <image>. We know that each cell of the table contains a single integer from 1 to s, at that all ... | 0.25 |
{"tests": "{\"inputs\": [\"3\", \"001\", \"000\", \"6\", \"4\", \"10\", \"5\", \"7\", \"17\", \"11\", \"12\", \"18\", \"9\", \"35\", \"15\", \"8\", \"29\", \"14\", \"41\", \"27\", \"62\", \"30\", \"25\", \"42\", \"58\", \"21\", \"83\", \"98\", \"178\", \"209\", \"375\", \"51\", \"79\", \"65\", \"28\", \"16\", \"22\", \... | Ikta loves fast programs. Recently, I'm trying to speed up the division program. However, it doesn't get much faster, so I thought it would be better to make it faster only for "common sense and typical" inputs. The problem Ikta is trying to solve is as follows.
For a given non-negative integer n, divide p (n) − 1-dig... | 0 |
{"tests": "{\"inputs\": [[[1, 2, 3]], [{\"3\": 4}], [false], [23.45], [\"arc.tic.[circle]?[?]\"], [\"Big [L][e][B][r][o][n]!][[\"], [\"[][]]]][[[[[[][]\"], [\"logger?]?system...12.12.133333 at [12-32-1432-16]\"]], \"outputs\": [[\"Take a seat on the bench.\"], [\"Take a seat on the bench.\"], [\"Take a seat on the benc... | It's March and you just can't seem to get your mind off brackets. However, it is not due to basketball. You need to extract statements within strings that are contained within brackets.
You have to write a function that returns a list of statements that are contained within brackets given a string. If the value entere... | 0 |
{"tests": "{\"inputs\": [\"4\\n1 2\\n1 3\\n1 2\\n1 2\\n1 3\\n1 2\\n2 5\\n1 2\\n3 1\\n1 4\\n5 1\\n1 6\\n2 15\\n1 2\\n1 3\\n1 4\\n1 5\\n1 6\\n2 3\\n2 4\\n2 5\\n2 6\\n3 4\\n3 5\\n3 6\\n4 5\\n4 6\\n5 6\\n\", \"4\\n1 2\\n1 3\\n1 2\\n1 2\\n1 3\\n1 2\\n2 5\\n1 2\\n3 1\\n1 4\\n5 1\\n1 6\\n2 15\\n1 2\\n1 3\\n1 4\\n1 5\\n1 6\\n2... | You are given a graph with $3 \cdot n$ vertices and $m$ edges. You are to find a matching of $n$ edges, or an independent set of $n$ vertices.
A set of edges is called a matching if no two edges share an endpoint.
A set of vertices is called an independent set if no two vertices are connected with an edge.
-----Inp... | 0 |
{"tests": "{\"inputs\": [[6, 2, \"+\"], [4, 3, \"-\"], [5, 5, \"*\"], [5, 4, \"/\"], [6, \"$\", \"+\"], [6, 2, \"&\"], [4, 3, \"\\\\\"], [\"a\", 3, \"+\"], [6, 2, \"=\"], [6, 2, \"\\t\"], [\":\", \",\", \"+\"]], \"outputs\": [[8], [1], [25], [1.25], [\"unknown value\"], [\"unknown value\"], [\"unknown value\"], [\"unkn... | You are required to create a simple calculator that returns the result of addition, subtraction, multiplication or division of two numbers.
Your function will accept three arguments:
The first and second argument should be numbers.
The third argument should represent a sign indicating the operation to perform on these... | 0 |
{"tests": "{\"inputs\": [\"30\\n3 6 3 8 6 4 4 2 4 10 8 5 9 6 7 7 9 4 7 4 10 1 9 10 4 7 7 4 2 3\\n\", \"1\\n1\\n\", \"50\\n4 2 6 7 2 6 3 8 8 2 4 8 4 4 1 4 5 2 2 5 6 4 3 3 3 6 8 2 1 3 1 8 2 3 7 4 7 5 4 8 3 5 7 8 6 7 5 8 7 1\\n\", \"40\\n2 6 5 5 6 6 7 8 6 5 3 9 9 1 8 3 7 3 7 2 3 1 3 1 5 8 1 3 8 2 3 2 2 1 4 4 4 3 5 5\\n\",... | A nearby pie shop is having a special sale. For each pie you pay full price for, you may select one pie of a strictly lesser value to get for free. Given the prices of all the pies you wish to acquire, determine the minimum total amount you must pay for all of the pies.
Input
Input will begin with an integer n (1 ≤ n... | 0 |
{"tests": "{\"inputs\": [\"6\\n2 2 1 2\\n0 100 0 1\\n12 13 25 1\\n27 83 14 25\\n0 0 1 0\\n1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000\\n\", \"1\\n0 0 0 1\\n\", \"1\\n0 0 0 1\\n\", \"1\\n1 0 0 1\\n\", \"6\\n2 2 1 2\\n0 100 0 1\\n11 13 25 1\\n27 83 14 25\\n0 0 1 0\\n1000000000000000000... | Anna is a girl so brave that she is loved by everyone in the city and citizens love her cookies. She is planning to hold a party with cookies. Now she has $a$ vanilla cookies and $b$ chocolate cookies for the party.
She invited $n$ guests of the first type and $m$ guests of the second type to the party. They will come... | 0.625 |
{"tests": "{\"inputs\": [\"4 1 0\\n1 1 10\\n1 999 30\\n1 1000 40\\n1 2 20\\n\", \"1 1 0\\n1 1 10\\n\", \"20 17 0\\n1 964 972064\\n1 529 914335\\n1 926 994468\\n1 603 980092\\n1 545 946148\\n1 88 952185\\n1 979 918633\\n1 438 967889\\n1 871 926455\\n1 424 952048\\n1 892 911827\\n1 779 947360\\n1 800 977424\\n1 792 95820... | Mr. Chanek The Ninja is one day tasked with a mission to handle mad snakes that are attacking a site. Now, Mr. Chanek already arrived at the hills where the destination is right below these hills. The mission area can be divided into a grid of size 1000 × 1000 squares. There are N mad snakes on the site, the i'th mad s... | 0.375 |
{"tests": "{\"inputs\": [\"3\\n1 0\\n0 1\\n-1 0\\n1 0\\n0 5\\n-1 0\\n0 -1\\n5 0\\n0 1\\n0 -1\\n1 0\\n0 -4\\n-3 0\\n0 3\\n0 0\\n0 -2\\n-1 0\\n0 1\\n0 -1\\n1 0\\n0 2\\n-2 0\\n0 -3\\n3 0\\n0 4\\n-4 0\\n0 -5\\n-2 0\\n0 0\\n1 0\\n-1 0\\n0 0\\n2 0\\n0 1\\n-1 0\\n0 1\\n-1 0\\n0 -2\\n0 0\", \"3\\n1 0\\n0 1\\n-1 0\\n1 0\\n0 5\\... | There are many caves deep in mountains found in the countryside. In legend, each cave has a treasure hidden within the farthest room from the cave's entrance. The Shogun has ordered his Samurais to explore these caves with Karakuri dolls (robots) and to find all treasures. These robots move in the caves and log relativ... | 0.25 |
{"tests": "{\"inputs\": [\"5\\n2 2\\n10\\n11\\n3 3\\n011\\n101\\n110\\n4 4\\n1111\\n0110\\n0110\\n1111\\n5 5\\n01011\\n11001\\n00010\\n11011\\n10000\\n2 3\\n011\\n101\\n\", \"5\\n2 2\\n10\\n11\\n3 3\\n011\\n101\\n110\\n4 4\\n1111\\n0110\\n0110\\n1111\\n5 5\\n01011\\n11001\\n00010\\n01011\\n10000\\n2 3\\n011\\n101\\n\",... | This is the hard version of the problem. The difference between the versions is in the number of possible operations that can be made. You can make hacks if and only if you solved both versions of the problem.
You are given a binary table of size n × m. This table consists of symbols 0 and 1.
You can make such operat... | 0 |
{"tests": "{\"inputs\": [[\"r r r r r r r r\"], [\"THIS, is crazy!\"], [\"hI, hi. hI hi skY! sky? skY sky\"], [\"Hello, I am Mr Bob.\"], [\"This, is. another! test? case to check your beautiful code.\"], [\"Hello from the other siiiiideeee\"], [\"Punctuation? is, important! double space also\"]], \"outputs\": [[\"rerr... | Description
In English we often use "neutral vowel sounds" such as "umm", "err", "ahh" as fillers in conversations to help them run smoothly.
Bob always finds himself saying "err". Infact he adds an "err" to every single word he says that ends in a consonant! Because Bob is odd, he likes to stick to this habit even w... | 0 |
{"tests": "{\"inputs\": [\"5 4\\nA\\nC\\nC\\nD\\n5 4\\nD\\nC\\nB\\nA\\n0 0\", \"5 4\\nA\\nC\\nC\\nD\\n5 4\\nD\\nD\\nB\\nA\\n0 0\", \"5 4\\nA\\nC\\nC\\nD\\n4 4\\nD\\nC\\nB\\nA\\n0 0\", \"5 4\\nA\\nD\\nC\\nD\\n5 4\\nD\\nD\\nB\\nA\\n0 0\", \"5 4\\nA\\nC\\nC\\nD\\n4 4\\nD\\nC\\nC\\nA\\n0 0\", \"5 4\\nA\\nC\\nB\\nD\\n4 4\\n... | The neutral city of Eyes City, in the heart of the four countries, is home to the transcontinental train Bandai. The platform has a row of chairs for passengers waiting for the Bandai, and people who enter the platform can use the chairs freely.
The Bandai is cheap, fast and comfortable, so there are a constant number... | 0 |
{"tests": "{\"inputs\": [\"2\\n4 1\\n0 3\\n4 2\\n0 3\\n1 2\", \"2\\n4 1\\n0 3\\n4 1\\n0 3\\n1 2\", \"2\\n4 1\\n1 2\\n4 2\\n0 3\\n2 1\", \"2\\n4 2\\n0 3\\n4 2\\n0 0\\n1 -1\", \"2\\n4 1\\n0 3\\n4 2\\n0 3\\n2 2\", \"2\\n4 1\\n0 3\\n4 2\\n0 3\\n2 0\", \"2\\n4 1\\n0 3\\n4 1\\n0 3\\n1 0\", \"2\\n4 1\\n0 3\\n4 1\\n0 3\\n1 -1\... | Read problems statements in Mandarin Chinese , Russian and Vietnamese
Churu is taking the course called “Introduction to Data Structures”. Yesterday, he learned how to use a stack to check is a given parentheses expression is balanced or not. He finds it intriguing, and more importantly, he was given an assignment. ... | 0 |
{"tests": "{\"inputs\": [\"336 400\\nHSSHHSSHHS..S..SS..H.S.H..SSH.H.H.H.S.H.S.S.H.S..SS..H.SS.H.SS.SS..SS.H...H.H.H.HSS..H...SS..SS.H..H.S.S....S.H.SS..HS..S.S.S.H.H.S..S.H.SS.SS..SS.SS.HS.SS.HSSSSHSSSSSS.H.SS..HHH.H.H.S..H.SS.S.H..SS.HS.SS.S.H.H.H..H.SS.HS.HHHSS.SS.S.SSS.S.S.SS.HS.H.S.SS.H.SS.H.S.SS.HS.SS..SS.H.S.H.S... | For he knew every Who down in Whoville beneath, Was busy now, hanging a mistletoe wreath. "And they're hanging their stockings!" he snarled with a sneer, "Tomorrow is Christmas! It's practically here!"
Dr. Suess, How The Grinch Stole Christmas
Christmas celebrations are coming to Whoville. Cindy Lou Who and her paren... | 0 |
{"tests": "{\"inputs\": [\"2 3 1000000000\\n0 0 0\\n0 0 0\\n\", \"10 5 2\\n0 3 0 0 0\\n0 0 0 0 0\\n0 0 0 0 0\\n-1 0 0 0 0\\n0 0 0 6 0\\n0 0 0 0 8\\n0 0 5 6 0\\n0 0 0 5 -1\\n0 0 0 0 10\\n0 0 0 0 0\\n\", \"10 2 2\\n0 -1\\n0 10\\n8 4\\n0 0\\n0 0\\n-1 0\\n0 0\\n0 0\\n0 0\\n4 0\\n\", \"10 4 2\\n0 0 0 0\\n0 0 0 0\\n0 0 0 0\\... | Dima overslept the alarm clock, which was supposed to raise him to school.
Dima wonders if he will have time to come to the first lesson. To do this, he needs to know the minimum time it will take him to get from home to school.
The city where Dima lives is a rectangular field of n × m size. Each cell (i, j) on this ... | 0.625 |
{"tests": "{\"inputs\": [[\"4,5,6,7\"], [\"3,s,5,6\"], [\"11,13,14,15\"], [\"10,11,12,13,15\"], [\"10,11,12,13\"], [\"ad,d,q,tt,v\"], [\"//,;;,/,..,\"], [\"1,2,3,4\"], [\"1015,1016,1017,1018\"], [\"555,777,444,111\"], [\"20,21,22,24\"], [\"9,10,10,11\"], [\"11254,11255,11256,11258\"], [\"25000,25001,25002,25003\"], [\"... | While surfing in web I found interesting math problem called "Always perfect". That means if you add 1 to the product of four consecutive numbers the answer is ALWAYS a perfect square.
For example we have: 1,2,3,4 and the product will be 1X2X3X4=24. If we add 1 to the product that would become 25, since the result numb... | 0 |
{"tests": "{\"inputs\": [[9999999], [0], [658188], [168496141], [43135012110]], \"outputs\": [[\"96987F\"], [\"00\"], [\"0B0A0C\"], [\"0D0B0A0C\"], [\"0D0B0A0C0E\"]]}", "source": "primeintellect"} | While most devs know about [big/little-endianness](https://en.wikipedia.org/wiki/Endianness), only a selected few know the secret of real hard core coolness with mid-endians.
Your task is to take a number and return it in its mid-endian format, putting the most significant couple of bytes in the middle and all the oth... | 0 |
{"tests": "{\"inputs\": [\"4\\n1433 4680\\n6\\n777777 003330\\n0\", \"4\\n1357 4680\\n6\\n509138 003330\\n0\", \"4\\n1357 4680\\n6\\n297443 003330\\n0\", \"4\\n1357 5363\\n6\\n777777 003330\\n0\", \"4\\n1357 1908\\n6\\n509138 003330\\n0\", \"4\\n2443 5385\\n6\\n568742 003330\\n0\", \"4\\n1433 4680\\n6\\n211871 003330\\... | A dial lock is a kind of lock which has some dials with printed numbers. It has a special sequence of numbers, namely an unlocking sequence, to be opened.
You are working at a manufacturer of dial locks. Your job is to verify that every manufactured lock is unlocked by its unlocking sequence. In other words, you have ... | 0 |
{"tests": "{\"inputs\": [\"10\\nj 10\\ni 9\\nh 8\\ng 7\\nf 6\\ne 5\\nd 4\\nc 3\\nb 2\\na 1\\n\", \"5\\nvasya 1000\\nvasya 100\\nkolya 200\\npetya 300\\noleg 400\\n\", \"1\\nvasya 1000\\n\", \"1\\ntest 0\\n\", \"10\\na 1\\nb 2\\nc 3\\nd 4\\ne 5\\nf 6\\ng 7\\nh 8\\ni 9\\nj 10\\n\", \"10\\nj 10\\ni 9\\nh 8\\ng 6\\nf 6\\ne... | Vasya has been playing Plane of Tanks with his friends the whole year. Now it is time to divide the participants into several categories depending on their results.
A player is given a non-negative integer number of points in each round of the Plane of Tanks. Vasya wrote results for each round of the last year. He ha... | 0 |
{"tests": "{\"inputs\": [\"3\\n1 2\\n01\\nRL\\n3 3\\n001\\n101\\n110\\nRLL\\nDLD\\nULL\\n3 3\\n000\\n000\\n000\\nRRD\\nRLD\\nULL\\n\", \"3\\n1 2\\n01\\nRL\\n3 3\\n000\\n101\\n110\\nRLL\\nDLD\\nULL\\n3 3\\n000\\n000\\n000\\nRRD\\nRLD\\nULL\\n\", \"3\\n1 2\\n01\\nRL\\n3 3\\n011\\n101\\n110\\nRLL\\nDLD\\nULL\\n3 3\\n010\\... | There is a rectangular grid of size $n \times m$. Each cell of the grid is colored black ('0') or white ('1'). The color of the cell $(i, j)$ is $c_{i, j}$. You are also given a map of directions: for each cell, there is a direction $s_{i, j}$ which is one of the four characters 'U', 'R', 'D' and 'L'.
If $s_{i, j}$ ... | 0 |
{"tests": "{\"inputs\": [\"1000000000000000000000000000000000000000000000000000000000000000000000000000\\n2000000000000000000000000000000000000000000000000000000000000000000000000000\\n4000000000000000000000000000000000000000000000000000000000000000000000000000\", \"3000000000000000000000000000000\\n7000000000000000000... | You are given three numbers. Is there a way to replace variables A, B and C with these numbers so the equality A + B = C is correct?
Input:
There are three numbers X1, X2 and X3 (1 ≤ Xi ≤ 10^100), each on a separate line of input.
Output:
Output either "YES", if there is a way to substitute variables A, B and C wit... | 0 |
{"tests": "{\"inputs\": [\"6\\n2 5 2 6 2 1\", \"6\\n1 25 1 10 1 3\", \"6\\n0 5 0 11 2 2\", \"6\\n0 3 0 9 0 0\", \"6\\n2 5 0 6 2 1\", \"6\\n2 9 0 6 2 1\", \"6\\n2 9 1 6 2 1\", \"6\\n0 9 1 6 2 1\", \"6\\n0 9 1 6 2 2\", \"6\\n0 9 1 6 2 3\", \"6\\n0 9 1 5 2 3\", \"6\\n0 9 1 3 2 3\", \"6\\n0 10 1 3 2 3\", \"6\\n0 20 1 3 2 3... | C: Mod! Mod!
story
That's right! I'm looking for eyewitness testimony! A phantom thief has appeared in Aizu! Everyone's horse stick was stolen! Who is the culprit! ?? Unravel! Mod! Mod!
Problem statement
"Eyes" ... it's a miracle bud that swells in the hearts of the chosen ones ... You can steal anything with the s... | 0 |
{"tests": "{\"inputs\": [[\"00-1B-63-84-45-E6\"], [\"Z1-1B-63-84-45-E6\"], [\"not a MAC-48 address\"], [\"FF-FF-FF-FF-FF-FF\"], [\"00-00-00-00-00-00\"], [\"G0-00-00-00-00-00\"], [\"12-34-56-78-9A-BC\"], [\"02-03-04-05-06-07-\"], [\"02-03-04-05\"], [\"02-03-04-FF-00-F0\"]], \"outputs\": [[true], [false], [false], [true]... | # Task
A media access control address (MAC address) is a unique identifier assigned to network interfaces for communications on the physical network segment.
The standard (IEEE 802) format for printing MAC-48 addresses in human-friendly form is six groups of two hexadecimal digits (0 to 9 or A to F), separated by hy... | 0 |
{"tests": "{\"inputs\": [\"6 3\\n1\\n4\\n5\\n\", \"1 0\\n\", \"1000000000 0\\n\", \"1 1\\n1\\n\", \"2 2\\n1\\n2\\n\", \"3 3\\n1\\n2\\n3\\n\", \"4 4\\n1\\n2\\n3\\n4\\n\", \"5 5\\n1\\n2\\n3\\n4\\n5\\n\", \"6 6\\n1\\n2\\n3\\n4\\n5\\n6\\n\", \"7 7\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n\", \"8 8\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n\"... | Let's say Pak Chanek has an array $A$ consisting of $N$ positive integers. Pak Chanek will do a number of operations. In each operation, Pak Chanek will do the following:
Choose an index $p$ ($1 \leq p \leq N$).
Let $c$ be the number of operations that have been done on index $p$ before this operation.
Decrease the ... | 0 |
{"tests": "{\"inputs\": [\"3\\n0 -1\\n1 1\\n2 0\", \"5\\n-1 0\\n1 2\\n2 1\\n3 2\\n4 0\", \"4\\n0 1\\n1 2\\n3 0\\n3 1\", \"3\\n0 -1\\n1 2\\n2 0\", \"4\\n0 1\\n1 4\\n3 0\\n3 1\", \"3\\n0 -1\\n1 0\\n2 0\", \"4\\n0 0\\n1 4\\n3 0\\n3 1\", \"3\\n0 -1\\n1 0\\n0 0\", \"4\\n0 0\\n1 6\\n3 0\\n3 1\", \"3\\n0 0\\n1 0\\n0 0\", \"4\... | For given $N$ points in the 2D Euclidean plane, find the distance of the shortest tour that meets the following criteria:
* Visit the points according to the following steps:
1. It starts from the leftmost point (starting point), goes strictly from left to right, and then visits the rightmost point (turn-around point)... | 0 |
{"tests": "{\"inputs\": [\"3 3 4\\n1 1\\n1 2\\n2 1\\n2 2\\n\", \"3 4 6\\n1 1\\n2 1\\n1 2\\n2 2\\n1 3\\n2 3\\n\", \"7 4 5\\n1 3\\n2 2\\n5 1\\n5 3\\n4 3\\n\", \"10 10 10\\n3 8\\n1 7\\n2 3\\n4 2\\n4 8\\n3 3\\n2 8\\n5 5\\n6 3\\n3 1\\n\", \"10 10 10\\n3 8\\n1 7\\n2 3\\n4 2\\n4 8\\n3 3\\n2 8\\n5 5\\n6 3\\n3 1\\n\", \"3 3 4\\... | There are k sensors located in the rectangular room of size n × m meters. The i-th sensor is located at point (x_{i}, y_{i}). All sensors are located at distinct points strictly inside the rectangle.
Opposite corners of the room are located at points (0, 0) and (n, m). Walls of the room are parallel to coordinate axe... | 0 |
{"tests": "{\"inputs\": [\"2 3\\n\", \"4 2\\n\", \"4 6\\n\", \"1337 424242424242\\n\", \"300000 1000000000\\n\", \"300000 1\\n\", \"2 1\\n\", \"2 1000000000000\\n\", \"17957 2\\n\"], \"outputs\": [\"6\\n\", \"26\\n\", \"1494\\n\", \"119112628\\n\", \"590856313\\n\", \"299999\\n\", \"1\\n\", \"138131255\\n\", \"65364796... | Consider an array $a$ of length $n$ with elements numbered from $1$ to $n$. It is possible to remove the $i$-th element of $a$ if $gcd(a_i, i) = 1$, where $gcd$ denotes the greatest common divisor. After an element is removed, the elements to the right are shifted to the left by one position.
An array $b$ with $n$ int... | 0 |
{"tests": "{\"inputs\": [[\"http://google.com\"], [\"http://google.co.jp\"], [\"https://123.net\"], [\"https://hyphen-site.org\"], [\"http://codewars.com\"], [\"www.xakep.ru\"], [\"https://youtube.com\"], [\"http://www.codewars.com/kata/\"], [\"icann.org\"]], \"outputs\": [[\"google\"], [\"google\"], [\"123\"], [\"hyph... | Write a function that when given a URL as a string, parses out just the domain name and returns it as a string. For example:
```python
domain_name("http://github.com/carbonfive/raygun") == "github"
domain_name("http://www.zombie-bites.com") == "zombie-bites"
domain_name("https://www.cnet.com") == "cnet"
```
Write you... | 0 |
{"tests": "{\"inputs\": [\"5 2 2 1 8\\n1 1 2\\n1 5 3\\n1 2 1\\n2 2\\n1 4 2\\n1 3 2\\n2 1\\n2 3\\n\", \"5 4 10 1 6\\n1 1 5\\n1 5 5\\n1 3 2\\n1 5 2\\n2 1\\n2 2\\n\", \"1 1 2 1 1\\n2 1\\n\", \"1 1 2 1 1\\n2 1\\n\", \"5 4 2 1 6\\n1 1 5\\n1 5 5\\n1 3 2\\n1 5 2\\n2 1\\n2 2\\n\", \"5 2 2 1 8\\n1 1 2\\n1 5 3\\n1 2 1\\n2 2\\n1 ... | A factory produces thimbles in bulk. Typically, it can produce up to a thimbles a day. However, some of the machinery is defective, so it can currently only produce b thimbles each day. The factory intends to choose a k-day period to do maintenance and construction; it cannot produce any thimbles during this time, but ... | 0.25 |
{"tests": "{\"inputs\": [\"pkjlxzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\\npkjlyaaaaaaaaaaaaaaaaaaaaaaaaaaaahr\\n\", \"kexdbtpkjbwwyibjndbtmwqzolopqitgkomqggojevoankiepxirrcidxldlzsppehmoazdywltmjbxgsxgihwnwpmczjrcwpywl\\nkexdbtpkjbwwyibjndbtmwqzolopqitgkomqggojevoankiepxirrcidxldlzsppehmoazdywltmjbxgsxgihwnwpmczjrcwpywm\\n\", \... | Vitaly is a diligent student who never missed a lesson in his five years of studying in the university. He always does his homework on time and passes his exams in time.
During the last lesson the teacher has provided two strings s and t to Vitaly. The strings have the same length, they consist of lowercase English l... | 0 |
{"tests": "{\"inputs\": [[\"ThisIsAUnitTest\"], [\"ThisShouldBeSplittedCorrectIntoUnderscore\"], [\"Calculate1Plus1Equals2\"], [\"Calculate15Plus5Equals20\"], [\"Calculate500DividedBy5Equals100\"], [\"Adding_3To_3ShouldBe_6\"], [\"This_Is_Already_Splitted_Correct\"], [\"ThisIs_Not_SplittedCorrect\"], [\"_IfATestStartAn... | You wrote all your unit test names in camelCase.
But some of your colleagues have troubles reading these long test names.
So you make a compromise to switch to underscore separation.
To make these changes fast you wrote a class to translate a camelCase name
into an underscore separated name.
Implement the ToUnderscor... | 0 |
{"tests": "{\"inputs\": [\"1 5\\n2 0 8\", \"1 5\\n1 -1 8\", \"1 5\\n1 -1 6\", \"1 1\\n2 1 1\", \"1 0\\n2 1 1\", \"1 0\\n4 -2 5\", \"1 2\\n1 0 11\", \"1 0\\n0 -2 7\", \"1 1\\n1 0 13\", \"1 5\\n3 3 8\", \"0 5\\n1 0 6\", \"1 2\\n1 0 18\", \"1 0\\n0 -3 14\", \"1 1\\n2 0 4\", \"1 9\\n2 -1 13\", \"1 2\\n-1 0 3\", \"1 4\\n8 1... | D: Anipero 2012
Anipero Summer Live, commonly known as Anipero, is the largest anime song live event in Japan where various anime song artists gather. 2D, who loves anime songs, decided to go to Anipero this year as well as last year.
He has already purchased m of psyllium to enjoy Anipero. Psyllium is a stick that g... | 0.625 |
{"tests": "{\"inputs\": [[\"\"], [\"a\"], [\"ogl\"], [\"alel\"], [\"MaXwElL\"], [\"ggg\"], [\"Alex is Super Cool\"], [\"ydjkpwqrzto\"], [\"abtlcgs\"]], \"outputs\": [[[\"shell\", \"shell\"]], [[\"shell\", \"beef\", \"shell\"]], [[\"shell\", \"beef\", \"guacamole\", \"lettuce\", \"shell\"]], [[\"shell\", \"beef\", \"let... | If you like Taco Bell, you will be familiar with their signature doritos locos taco. They're very good.
Why can't everything be a taco? We're going to attempt that here, turning every word we find into the taco bell recipe with each ingredient.
We want to input a word as a string, and return a list representing tha... | 0 |
{"tests": "{\"inputs\": [\"3\\n8 8 18\\n32 32 32\\n57 2 57\\n5\\n49 3 49\\n7 30 44\\n27 21 21\\n33 56 56\\n21 46 4\\n3\\n45 52 28\\n36 26 36\\n40 55 50\\n10\\n33 8 39\\n50 57 43\\n35 21 12\\n21 17 11\\n16 21 58\\n45 40 53\\n45 30 53\\n39 1 8\\n55 48 30\\n7 48 15\\n0\", \"3\\n8 8 18\\n32 32 32\\n57 2 57\\n5\\n49 3 49\\n... | In the middle of Tyrrhenian Sea, there is a small volcanic island called Chronus. The island is now uninhabited but it used to be a civilized island. Some historical records imply that the island was annihilated by an eruption of a volcano about 800 years ago and that most of the people in the island were killed by pyr... | 0 |
{"tests": "{\"inputs\": [[\"Factor y\"], [\"O f fi ce\"], [\"BusStation\"], [\"Suite \"], [\"YourHouse\"], [\"H o t e l \"]], \"outputs\": [[\"Factory\"], [\"Office\"], [\"You just wanted my autograph didn't you?\"], [\"Suite\"], [\"You just wanted my autograph didn't you?\"], [\"Hotel\"]]}", "source": "primeintellect... | Oh no! Ghosts have reportedly swarmed the city. It's your job to get rid of them and save the day!
In this kata, strings represent buildings while whitespaces within those strings represent ghosts.
So what are you waiting for? Return the building(string) without any ghosts(whitespaces)!
Example:
Should return:
If ... | 0 |
{"tests": "{\"inputs\": [\"4\\n2 3\\n2 2\\n3 1\\n1 3\\n\", \"3\\n1 1\\n1 500\\n500 250\\n\", \"1\\n1000 1000\\n\", \"8\\n36 151\\n43 187\\n37 189\\n46 186\\n44 146\\n73 37\\n37 73\\n557 17\\n\", \"1\\n991 983\\n\", \"37\\n30 16\\n22 37\\n37 43\\n25 31\\n12 12\\n15 30\\n42 11\\n29 28\\n26 32\\n12 32\\n18 12\\n11 48\\n24... | Gaurang has grown up in a mystical universe. He is faced by $n$ consecutive 2D planes. He shoots a particle of decay age $k$ at the planes.
A particle can pass through a plane directly, however, every plane produces an identical copy of the particle going in the opposite direction with a decay age $k-1$. If a particle... | 0 |
{"tests": "{\"inputs\": [\"2 1\\n1 2 5\\n3 2\\n1 2 5\\n2 3 5\\n6 9\\n1 2 7\\n1 3 9\\n1 5 14\\n2 3 15\\n2 4 15\\n3 4 11\\n3 5 2\\n4 5 9\\n4 6 8\\n0 0\", \"2 1\\n1 2 5\\n3 2\\n1 2 5\\n2 3 5\\n6 9\\n1 2 7\\n1 3 9\\n1 5 4\\n2 3 10\\n2 4 15\\n3 4 11\\n3 5 2\\n4 5 9\\n4 6 8\\n0 0\", \"2 1\\n1 2 5\\n3 2\\n1 2 5\\n2 3 5\\n6 9\... | Takeshi, who loves hot springs, is planning a trip to a hot spring resort on his next long vacation. I would like to travel by connecting to a long-distance bus and reach my destination with as little money as possible. Takeshi, who has savings but is unwilling to pay, decided to consult with his grandfather. The grand... | 0 |
{"tests": "{\"inputs\": [\"2 0\\n1 2\\n5 4\\n1 5\\n1 2 1 1\\n2 3 2 2\\n3 4 2 2\\n4 5 1 1\\n6 6\\n1 6\\n1 2 2 1\\n2 3 2 1\\n3 6 2 1\\n1 4 2 30\\n4 5 3 30\\n5 6 2 30\\n6 7\\n1 6\\n1 2 1 30\\n2 4 1 30\\n3 1 1 30\\n3 4 100 30\\n4 5 1 30\\n5 6 1 30\\n6 4 1 30\\n0 0\", \"2 0\\n1 1\\n5 4\\n1 5\\n1 2 1 1\\n2 3 2 2\\n3 4 2 2\\n... | Consider car trips in a country where there is no friction. Cars in this country do not have engines. Once a car started to move at a speed, it keeps moving at the same speed. There are acceleration devices on some points on the road, where a car can increase or decrease its speed by 1. It can also keep its speed there... | 0 |
{"tests": "{\"inputs\": [\"06,04,1,1,1,1,1,1,1,1,1,1\\n1,1,1,1,1,3,3,3,3,3,50,50\\n10,10,10,10,10,10,10,10,10,10,50,49\", \"1,1,1,1,1,1,1,1,1,0,40,60\\n1,1,1,1,1,3,3,3,3,3,50,50\\n10,10,10,10,10,10,10,10,10,10,50,49\", \"06,04,1,1,0,1,1,1,1,1,1,1\\n1,1,1,1,1,3,3,3,3,3,50,50\\n94,05,01,01,01,01,01,01,01,01,01,01\", \"1,... | There is a double-track line (up and down are separate lines and pass each other everywhere). There are 11 stations on this line, including the terminal station, and each station is called by the section number shown in the figure.
<image>
Trains depart from both terminal stations on this line at the same time and r... | 0.125 |
{"tests": "{\"inputs\": [\"5\\noof\\n\", \"37564\\nwhydidyoudesertme\\n\", \"5\\nooe\", \"37564\\nwhydidzoudesertme\", \"5\\neoo\", \"37564\\nwhxdidzoudesertme\", \"5\\ndoo\", \"37564\\nwhxdidzoudesertne\", \"5\\ndop\", \"37564\\nwhxdiczoudesertne\", \"5\\nodp\", \"37564\\nwhxdiczovdesertne\", \"5\\npdo\", \"37564\\nen... | How many strings can be obtained by applying the following operation on a string S exactly K times: "choose one lowercase English letter and insert it somewhere"?
The answer can be enormous, so print it modulo (10^9+7).
-----Constraints-----
- K is an integer between 1 and 10^6 (inclusive).
- S is a string of length... | 0 |
{"tests": "{\"inputs\": [\"4\\n4 6\\n*.*..*\\n*.....\\n...-..\\n^.*#..\\n10\\nSRSSRRUSSR\\n2 2\\n<.\\n..\\n12\\nDDSRRSUUSLLS\\n3 5\\n>-#**\\n.-*#*\\n.-**#\\n15\\nSSSDRSSSDRSSSUU\\n5 5\\nv****\\n*****\\n*****\\n*****\\n*****\\n44\\nSSSSDDRSDRSRDSULUURSSSSRRRRDSSSSDDLSDLSDLSSD\", \"4\\n4 6\\n*.*..*\\n*.....\\n..-...\\n^.... | You decide to develop a game with your friends. The title of the game is "Battle Town". This is a game with the theme of urban warfare with tanks. As the first step in game development, we decided to develop the following prototype.
In this prototype, the only tanks that appear are the player's tanks, not the enemy ta... | 0 |
{"tests": "{\"inputs\": [\"10\\n44 22 14 9 93 81 52 64 3 99\\n43 23 13 10 92 82 51 65 2 100\\n\", \"1\\n1\\n1\\n\", \"10\\n1 5 4 3 2 1 5 8 2 3\\n1 1 1 1 5 5 5 5 5 5\\n\", \"1\\n1000000000\\n1000000000\\n\", \"20\\n31 16 20 30 19 35 8 11 20 45 10 26 21 39 29 52 8 10 37 49\\n16 33 41 32 43 24 35 48 19 37 28 26 7 10 23 48... | Little Vasya's uncle is a postman. The post offices are located on one circular road. Besides, each post office has its own gas station located next to it. Petya's uncle works as follows: in the morning he should leave the house and go to some post office. In the office he receives a portion of letters and a car. Then ... | 0 |
{"tests": "{\"inputs\": [\"5\\n6\\n111010\\n1\\n0\\n1\\n1\\n2\\n11\\n6\\n101010\\n\", \"5\\n6\\n111010\\n1\\n1\\n1\\n1\\n2\\n11\\n6\\n101010\\n\", \"5\\n6\\n111000\\n1\\n1\\n1\\n1\\n2\\n11\\n6\\n101010\\n\", \"5\\n6\\n011011\\n1\\n0\\n1\\n1\\n2\\n11\\n6\\n111000\\n\", \"5\\n6\\n111111\\n1\\n0\\n1\\n1\\n2\\n11\\n6\\n101... | You have a string $s$ consisting of $n$ characters. Each character is either 0 or 1.
You can perform operations on the string. Each operation consists of two steps: select an integer $i$ from $1$ to the length of the string $s$, then delete the character $s_i$ (the string length gets reduced by $1$, the indices of ch... | 0 |
{"tests": "{\"inputs\": [\"3 2\\n\", \"50 57129577186267\\n\", \"6 12\\n\", \"50 161245081749292\\n\", \"5 3\\n\", \"49 40394027154620\\n\", \"7 15\\n\", \"49 36309684494664\\n\", \"50 250144743882708\\n\", \"49 140149194635018\\n\", \"5 10\\n\", \"6 2\\n\", \"6 19\\n\", \"50 8840088596980\\n\", \"6 4\\n\", \"6 13\\n\"... | One Martian boy called Zorg wants to present a string of beads to his friend from the Earth — Masha. He knows that Masha likes two colours: blue and red, — and right in the shop where he has come, there is a variety of adornments with beads of these two colours. All the strings of beads have a small fastener, and if on... | 0 |
{"tests": "{\"inputs\": [[24, 10, \"Downstream 2\"], [24, 14, \"Upstream 2\"], [54, 28, \"Downstream 3\"], [60, 45, \"Upstream 15\"], [60, 45, \"Downstream 15\"]], \"outputs\": [[2], [2], [1.74], [2], [1]]}", "source": "primeintellect"} | Chingel is practicing for a rowing competition to be held on this saturday. He is trying his best to win this tournament for which he needs to figure out how much time it takes to cover a certain distance.
**Input**
You will be provided with the total distance of the journey, speed of the boat and whether he is goin... | 0 |
{"tests": "{\"inputs\": [\"100\\n4 29\\n11 89\\n16 150\\n14 125\\n18 192\\n5 30\\n8 47\\n5 18\\n20 17\\n14 127\\n11 80\\n10 71\\n12 6\\n6 31\\n13 112\\n4 10\\n8 45\\n7 40\\n7 50\\n2 13\\n6 49\\n1 17\\n8 54\\n13 107\\n20 228\\n4 37\\n16 163\\n19 5\\n16 147\\n10 68\\n12 92\\n5 1\\n5 15\\n7 47\\n16 7\\n2 28\\n2 27\\n10 59... | On the eve of Teddy Day Chotu decided to buy a teddy for his girlfriend Choti. He has N coins each having distinct value from 1 to N. Now after collecting all the coins he went to buy a Teddy.
Now the shopkeeper Motu told Chotu that there is only one Teddy in the shop of Value K. As Chotu is very bhondu(idiot) he won... | 0 |
{"tests": "{\"inputs\": [\"2\\n1 1 2 2 3 3\\n2 2 3 3 1 1\", \"100\\n514485 388976 839005 669007 -35746 820627\\n-22300 -496891 -440342 179934 -76598 -35916\\n-11644 21883 16840 463 113936 -85680\\n-603635 450048 -805597 -333898 -213708 -571090\\n-138484 -880640 520676 -793813 -794299 641302\\n-211207 300339 263771 -725... | Hannibal is on a mission. He has to shoot a criminal. Hannibal was on the point (0, 0) and the criminal is on the point (Xc, Yc). But there is a wall between the point (X1, Y1) and (X2, Y2).
You have to tell whether Hannibal can shoot criminal or not.
INPUT:
First line contains the total number of test cases T. For... | 0 |
{"tests": "{\"inputs\": [\"iNociNociN\", \"iNobiNociN\", \"iNoaiNociN\", \"iNoaiNochN\", \"NhcoNiaoNi\", \"NhcoNiNoai\", \"NhcoNjNoai\", \"NhboNjNoai\", \"NhbNNjooai\", \"NhbNOjooai\", \"jhbNONooai\", \"jhbOONooai\", \"jhbOOoNoai\", \"jibOOoNoai\", \"jibONoNoai\", \"iibONoNoai\", \"iNbOioNoai\", \"iNbOioNo`i\", \"iObOi... | F: Miko Mi String-
story
Mikko Mikkomi ~! Everyone's idol, Miko Miko Tazawa! Today ~, with Mikoto ~, practice the string algorithm, let's do it ☆
Miko's special ~~ character making ~~ The slogan "MikoMikomi" becomes "MikoMikoMi" in Roman letters! In other words, if A = “Mi” and B = “Ko”, you can write in the form of... | 0.625 |
{"tests": "{\"inputs\": [[[3, 7], [1, 2], [-1, 1], 13], [[1, 2], [0, 0], [1, 1], 6], [[2, 2], [1, 0], [1, 1], 12], [[1, 1], [0, 0], [1, -1], 1000000000], [[2, 3], [1, 2], [-1, -1], 41], [[17, 19], [14, 8], [1, -1], 239239], [[17, 19], [16, 18], [1, 1], 239239239]], \"outputs\": [[[0, 1]], [[0, 1]], [[1, 0]], [[0, 0]], ... | # Task
In ChessLand there is a small but proud chess bishop with a recurring dream.
In the dream the bishop finds itself on an `n × m` chessboard with mirrors along each edge, and it is not a bishop but a ray of light. This ray of light moves only along diagonals (the bishop can't imagine any other types of moves ... | 0 |
{"tests": "{\"inputs\": [\"3\\n3 3\\n1 -3 4\\n1 5 2\\n2 2\\n-2 0\\n1 2\\n2 2\\n0 1\\n1 2\\n\", \"3\\n3 3\\n1 -3 4\\n1 5 2\\n2 2\\n-4 0\\n1 2\\n2 2\\n0 1\\n1 2\\n\", \"3\\n3 3\\n1 -3 4\\n1 5 2\\n2 2\\n-2 0\\n1 2\\n2 2\\n0 2\\n1 2\\n\", \"3\\n3 3\\n2 -3 4\\n1 5 2\\n2 2\\n-4 0\\n1 2\\n2 2\\n0 1\\n1 2\\n\", \"3\\n3 3\\n0 -... | Polycarp was dismantling his attic and found an old floppy drive on it. A round disc was inserted into the drive with $n$ integers written on it.
Polycarp wrote the numbers from the disk into the $a$ array. It turned out that the drive works according to the following algorithm:
the drive takes one positive number $x... | 0.25 |
{"tests": "{\"inputs\": [\"4 4 6\\n2 2\\n3 2 \\n3 2 \\n4 3\\n4 4\\n4 3\", \"4 4 6\\n3 2\\n3 2 \\n3 2 \\n4 3\\n4 4\\n4 3\", \"4 4 6\\n3 2\\n3 2 \\n3 2 \\n4 3\\n4 4\\n4 1\", \"4 4 6\\n3 2\\n3 3 \\n3 2 \\n4 3\\n4 4\\n4 3\", \"4 6 6\\n3 2\\n2 3 \\n3 2 \\n4 3\\n4 4\\n4 3\", \"4 6 2\\n3 2\\n2 3 \\n3 2 \\n4 3\\n4 4\\n4 3\", \... | Read problems statements in Mandarin Chinese and Russian.
Spring is interesting season of year. Chef is thinking about different things, but last time he thinks about interesting game - "Strange Matrix".
Chef has a matrix that consists of n rows, each contains m elements. Initially, the element a_{i}_{j} of matrix e... | 0 |
{"tests": "{\"inputs\": [\"10264\\n\", \"217\\n\", \"7\\n\", \"777777\\n\", \"47248\\n\", \"13\\n\", \"301\\n\", \"1034\\n\", \"6\\n\", \"6486\\n\", \"225481\\n\", \"1\\n\", \"403\\n\", \"6726\\n\", \"43\\n\", \"9\\n\", \"21352\\n\", \"999811\\n\", \"10000\\n\", \"999998\\n\", \"51\\n\", \"498598\\n\", \"5832\\n\", \"2... | A breakthrough among computer games, "Civilization XIII", is striking in its scale and elaborate details. Let's take a closer look at one of them.
The playing area in the game is split into congruent cells that are regular hexagons. The side of each cell is equal to 1. Each unit occupies exactly one cell of the playin... | 0 |
{"tests": "{\"inputs\": [[10000, true], [25000, true], [10000, false], [60000, false], [2, true], [78, false], [67890, true]], \"outputs\": [[\"$100000\"], [\"$250000\"], [\"$10000\"], [\"$60000\"], [\"$20\"], [\"$78\"], [\"$678900\"]]}", "source": "primeintellect"} | It's bonus time in the big city! The fatcats are rubbing their paws in anticipation... but who is going to make the most money?
Build a function that takes in two arguments (salary, bonus). Salary will be an integer, and bonus a boolean.
If bonus is true, the salary should be multiplied by 10. If bonus is false, the... | 0 |
{"tests": "{\"inputs\": [\"7\\n0 0 1 0 0 0 0\\n\", \"6\\n0 0 1 0 0 0\\n\", \"6\\n0 0 0 1 0 0\\n\", \"5\\n0 1 0 0 0\\n\", \"8\\n0 0 0 1 1 1 1 1\\n\", \"6\\n1 0 0 0 0 0\\n\", \"7\\n0 0 0 0 1 0 0\\n\", \"10\\n0 0 1 1 1 1 1 0 1 1\\n\", \"8\\n0 0 0 1 1 0 0 0\\n\", \"11\\n1 1 0 0 0 0 0 0 0 1 1\\n\", \"7\\n0 0 0 0 0 0 1\\n\",... | You are given an array a of length n that consists of zeros and ones.
You can perform the following operation multiple times. The operation consists of two steps:
1. Choose three integers 1 ≤ x < y < z ≤ n, that form an arithmetic progression (y - x = z - y).
2. Flip the values a_x, a_y, a_z (i.e. change 1 to 0... | 0 |
{"tests": "{\"inputs\": [\"4\\n3 2 0\\n6 5 1\\n7 4 0\\n8 1 1\\n\", \"1\\n454971987 406874902 1\\n\", \"5\\n243385510 42245605 0\\n644426565 574769163 0\\n708622105 208990040 0\\n786625660 616437691 0\\n899754846 382774619 0\\n\", \"5\\n200000000 100000000 1\\n600000000 400000000 0\\n800000000 300000000 0\\n900000000 70... | An ant moves on the real line with constant speed of $1$ unit per second. It starts at $0$ and always moves to the right (so its position increases by $1$ each second).
There are $n$ portals, the $i$-th of which is located at position $x_i$ and teleports to position $y_i < x_i$. Each portal can be either active or ina... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.