info stringlengths 120 50k | question stringlengths 504 10.4k | avg@8_qwen3_4b_instruct_2507 float64 0 0.88 |
|---|---|---|
{"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\": [\"4\\n1 3 4 2\\n\", \"8\\n6 8 3 4 7 2 1 5\\n\", \"1\\n1\\n\", \"11\\n10 8 9 4 6 3 5 1 11 7 2\\n\", \"11\\n10 8 9 4 3 5 1 11 7 2 6\\n\", \"100\\n1 72 43 50 58 87 10 94 29 51 99 86 92 80 36 31 9 100 85 59 66 30 3 78 17 73 93 37 57 71 45 15 24 2 64 44 65 22 38 79 23 8 16 52 98 97 96 95 91 90 89 88... | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 0 |
{"tests": "{\"inputs\": [[\"Welcome home\"], [\"hello\"], [\"goodbye\"], [\"ngmlsoor\"], [\"gsrh rh z hvxivg\"], [\"Welcome home\", \"w\"], [\"hello\", \"abcdefgh\"], [\"goodbye\", \"\"], [\"CodeWars\", \"+-*/=\"], [\"this is a secret\", \" *\"]], \"outputs\": [[\"dvoxlnv slnv\"], [\"svool\"], [\"tllwybv\"], [\"mtnohll... | Your back at your newly acquired decrypting job for the secret organization when a new assignment comes in. Apparently the enemy has been communicating using a device they call "The Mirror".
It is a rudimentary device with encrypts the message by switching its letter with its mirror opposite (A => Z), (B => Y), (C ... | 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\": [\"1\\nVBox abcdefghij\\n\", \"1\\nWidget a(0,0)\\n\", \"6\\nHBox hb\\nVBox vb\\nhb.pack(vb)\\nWidget wi(47,13)\\nhb.pack(wi)\\nvb.pack(wi)\\n\", \"5\\nWidget one(10,20)\\nWidget two(20,30)\\nWidget three(30,40)\\nWidget four(40,50)\\nWidget five(50,60)\\n\", \"3\\nHBox ox\\nWidget idget(5,5)\\n... | Vasya writes his own library for building graphical user interface. Vasya called his creation VTK (VasyaToolKit). One of the interesting aspects of this library is that widgets are packed in each other.
A widget is some element of graphical interface. Each widget has width and height, and occupies some rectangle on t... | 0 |
{"tests": "{\"inputs\": [\"4 1 2\\n\", \"123 42 24\\n\", \"1 1 0\\n\", \"1000 501 501\\n\", \"1000 999 799\\n\", \"2 1 1\\n\", \"2 2 0\\n\", \"3 1 2\\n\", \"3 2 2\\n\", \"3 3 1\\n\", \"4 2 0\\n\", \"4 3 2\\n\", \"4 4 3\\n\", \"7 1 1\\n\", \"7 7 6\\n\", \"7 2 4\\n\", \"7 4 4\\n\", \"8 4 1\\n\", \"8 1 5\\n\", \"8 8 7\\n\... | Andrey thinks he is truly a successful developer, but in reality he didn't know about the binary search algorithm until recently. After reading some literature Andrey understood that this algorithm allows to quickly find a certain number $x$ in an array. For an array $a$ indexed from zero, and an integer $x$ the pseudo... | 0 |
{"tests": "{\"inputs\": [\"3\\n1 2 3\\n\", \"4\\n1 1 2 2\\n\", \"1\\n2359\\n\", \"10\\n5957 94 8220 2463 9623 7028 9656 677 8373 1126\\n\", \"10\\n9381 6234 2965 9236 4685 3101 5832 7369 5233 5308\\n\", \"10\\n9961 9927 9980 9941 9992 9910 9968 9956 9925 9975\\n\", \"10\\n9906 9903 10000 9998 9936 9952 9924 9939 9917 9... | Gardener Alexey teaches competitive programming to high school students. To congratulate Alexey on the Teacher's Day, the students have gifted him a collection of wooden sticks, where every stick has an integer length. Now Alexey wants to grow a tree from them.
The tree looks like a polyline on the plane, consisting o... | 0.125 |
{"tests": "{\"inputs\": [\"3\\n1000\\n342\\n0\\n5\\n2\\n2\\n9\\n11\\n932\\n5\\n300\\n1000\\n0\\n200\\n400\\n8\\n353\\n242\\n708\\n274\\n283\\n132\\n402\\n523\\n0\", \"3\\n1000\\n342\\n0\\n5\\n0\\n2\\n9\\n11\\n932\\n5\\n300\\n1000\\n0\\n200\\n400\\n8\\n353\\n242\\n402\\n274\\n283\\n132\\n402\\n523\\n0\", \"3\\n1000\\n34... | <image>
The International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events on earth in the show business.
One of the unique features of this contest is the great number of judges that sometimes counts up to one hundred. The number of judges may differ from one co... | 0.875 |
{"tests": "{\"inputs\": [\"2\\n2\\n1\\n\", \"1\\n1000000000\\n\", \"1\\n1000000000\\n\", \"1\\n0000000000\\n\", \"2\\n2\\n2\\n\", \"1\\n0010000000\\n\", \"2\\n2\\n4\\n\", \"1\\n0001000000\\n\", \"2\\n4\\n4\\n\", \"1\\n0001000001\\n\", \"2\\n4\\n1\\n\", \"1\\n0001000011\\n\", \"2\\n3\\n1\\n\", \"1\\n0001001011\\n\", \"2... | You have integer $n$. Calculate how many ways are there to fully cover belt-like area of $4n-2$ triangles with diamond shapes.
Diamond shape consists of two triangles. You can move, rotate or flip the shape, but you cannot scale it.
$2$ coverings are different if some $2$ triangles are covered by the same diamond s... | 0.875 |
{"tests": "{\"inputs\": [\"3\\n1 9 3\\n8 6 7\\n4 2 5\\n\", \"3\\n1 5 8\\n9 2 4\\n3 6 7\\n\", \"4\\n5 4 1 13\\n8 3 6 16\\n15 9 14 12\\n11 2 7 10\\n\", \"5\\n21 14 2 3 12\\n19 8 16 18 7\\n9 17 10 15 4\\n24 5 1 23 11\\n25 13 22 6 20\\n\", \"6\\n8 3 15 14 29 17\\n27 11 16 21 18 28\\n34 23 36 12 10 5\\n30 31 25 6 9 2\\n7 24... | You stumbled upon a new kind of chess puzzles. The chessboard you are given is not necesserily $8 \times 8$, but it still is $N \times N$. Each square has some number written on it, all the numbers are from $1$ to $N^2$ and all the numbers are pairwise distinct. The $j$-th square in the $i$-th row has a number $A_{ij}$... | 0 |
{"tests": "{\"inputs\": [[[60, 20]], [[80, 120]], [[4, 2]], [[45, 120]], [[1000, 1]], [[1, 1]], [[10956590, 13611876]], [[35884747, 5576447]], [[24622321, 24473455]], [[4255316, 11425973]]], \"outputs\": [[[3, 1]], [[2, 3]], [[2, 1]], [[3, 8]], [[1000, 1]], [[1, 1]], [[30605, 38022]], [[76841, 11941]], [[42673, 42415]]... | Write a function which reduces fractions to their simplest form! Fractions will be presented as an array/tuple (depending on the language), and the reduced fraction must be returned as an array/tuple:
```
input: [numerator, denominator]
output: [newNumerator, newDenominator]
example: [45, 120] --> [3, 8]
```
All n... | 0 |
{"tests": "{\"inputs\": [\"3 2\\n0 1 0\\n\", \"5 1\\n1 1 1 0 0\\n\", \"6 4\\n1 0 0 1 1 0\\n\", \"3 2\\n1 1 1\\n\", \"5 2\\n1 1 1 0 0\\n\", \"6 4\\n0 0 1 1 1 1\\n\", \"100 1000000000\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... | A girl named Sonya is studying in the scientific lyceum of the Kingdom of Kremland. The teacher of computer science (Sonya's favorite subject!) invented a task for her.
Given an array $a$ of length $n$, consisting only of the numbers $0$ and $1$, and the number $k$. Exactly $k$ times the following happens: Two numbe... | 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\": [\"6 3\\n2 1\\n2 3\\n4 1\\n4 2\\n6 1\\n2 6\\n3 6\\n6 5\", \"6 3\\n2 1\\n2 3\\n4 1\\n4 2\\n6 1\\n2 6\\n3 6\\n4 5\", \"6 3\\n3 1\\n4 3\\n4 1\\n4 2\\n6 1\\n4 6\\n3 6\\n4 5\", \"6 3\\n2 1\\n2 3\\n4 1\\n4 2\\n6 1\\n2 6\\n3 6\\n1 5\", \"6 3\\n2 1\\n2 3\\n4 1\\n4 2\\n6 1\\n2 6\\n3 6\\n3 5\", \"6 3\\n3 ... | There is a rooted tree (see Notes) with N vertices numbered 1 to N. Each of the vertices, except the root, has a directed edge coming from its parent. Note that the root may not be Vertex 1.
Takahashi has added M new directed edges to this graph. Each of these M edges, u \rightarrow v, extends from some vertex u to it... | 0 |
{"tests": "{\"inputs\": [[\"2\", \"3\", \"2 4 8\", \"3\", \"4 7 5\", \"\", \"\"], \"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... | 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.875 |
{"tests": "{\"inputs\": [\"4 3\\n1 2 1 3\\n1 3\\n2 4\\n3 3\\n\", \"10 10\\n2 5 6 5 2 1 7 9 7 2\\n5 5\\n2 4\\n6 7\\n2 2\\n7 8\\n7 9\\n1 8\\n6 9\\n8 10\\n6 8\\n\", \"10 10\\n4 5 6 5 2 1 7 9 7 2\\n5 5\\n2 4\\n6 7\\n2 2\\n7 8\\n7 9\\n1 8\\n6 9\\n8 10\\n6 8\", \"4 1\\n1 2 1 3\\n1 3\\n2 4\\n3 3\", \"4 2\\n1 2 1 3\\n1 3\\n2 4... | We have N colored balls arranged in a row from left to right; the color of the i-th ball from the left is c_i.
You are given Q queries. The i-th query is as follows: how many different colors do the l_i-th through r_i-th balls from the left have?
-----Constraints-----
- 1\leq N,Q \leq 5 \times 10^5
- 1\leq c_i \leq ... | 0.875 |
{"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 |
{"tests": "{\"inputs\": [[[0, 0, 0, 0, 2, 1, 0], 2, 0, 1], [[0, 1, 0, 0, 2, 1, 0, 2, 2, 1], 3, -1, 2], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 5, -1, 2], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 2, 0, 0, 0, 0, 1, 1, 2, 2, 2, 2, 0], 6, 0, 1.5], [[0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 0, 2, 1, 2, 0, 2, 1], 10, -5, 10], [[0,... | A new school year is approaching, which also means students will be taking tests.
The tests in this kata are to be graded in different ways. A certain number of points will be given for each correct answer and a certain number of points will be deducted for each incorrect answer. For ommitted answers, points will eit... | 0 |
{"tests": "{\"inputs\": [\"atcoderregularcontest\\n\", \"abcdefghijklmnopqrstuvwxyz\\n\", \"frqnvhydscshfcgdemurlfrutcpzhopfotpifgepnqjxupnskapziurswqazdwnwbgdhyktfyhqqxpoidfhjdakoxraiedxskywuepzfniuyskxiyjpjlxuqnfgmnjcvtlpnclfkpervxmdbvrbrdn\\n\", \"frqnvhydscshfcgdemurlfrutcpzhopfotpifgepnqjxupnskapziurswqazdwnwbgdhz... | A subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters.
For example, arc, artistic and (an empty string) are all subsequences of artistic; abc and ci are not.
You are given a string A consisting of lowercase English ... | 0 |
{"tests": "{\"inputs\": [\"4\\n2 5 3 1\\n\", \"2\\n1 5\\n\", \"1\\n8\\n\", \"6\\n1 1 1 3 2 9\\n\", \"5\\n8 9 3 1 9\\n\", \"6\\n1 5 2 1 7 11\\n\", \"8\\n1 6 11 8 5 10 7 8\\n\", \"3\\n4 9 6\\n\", \"2\\n4 8\\n\", \"3\\n1 1 5\\n\", \"5\\n4 5 5 2 11\\n\", \"6\\n1 7 2 8 8 2\\n\", \"5\\n3 9 3 2 3\\n\", \"7\\n6 6 1 1 1 2 3\\n\... | DO YOU EXPECT ME TO FIND THIS OUT?
WHAT BASE AND/XOR LANGUAGE INCLUDES string?
DON'T BYTE OF MORE THAN YOU CAN CHEW
YOU CAN ONLY DISTORT THE LARGEST OF MATHEMATICS SO FAR
SAYING "ABRACADABRA" WITHOUT A MAGIC AND WON'T DO YOU ANY GOOD
THE LAST STACK RUPTURES. ALL DIE. OH, THE EMBARRASSMENT!
I HAVE NO ARRAY AND I M... | 0 |
{"tests": "{\"inputs\": [[[30, 100, 1000, 150, 60, 250, 10, 120, 20], 3], [[30, 100, 1000, 150, 60, 250, 10, 120, 20], 5], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2], 10], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2], 9], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 10], [[1, 1, -1], 2], [[1, 1], 2... | We define the "unfairness" of a list/array as the *minimal* difference between max(x1,x2,...xk) and min(x1,x2,...xk), for all possible combinations of k elements you can take from the list/array; both minimum and maximum of an empty list/array are considered to be 0.
**More info and constraints:**
* lists/arrays can ... | 0 |
{"tests": "{\"inputs\": [\"5\\n1 3\\n1 2\\n1 8\\n1 1\\n1 4\\n\", \"2\\n2 200 1\\n3 1 100 2\\n\", \"4\\n3 1 5 100\\n3 1 5 100\\n3 100 1 1\\n3 100 1 1\\n\", \"1\\n1 1\\n\", \"5\\n5 1 1 1 1 1\\n4 1 1 1 1\\n3 1 1 1\\n2 1 1\\n1 1\\n\", \"2\\n3 1 1000 2\\n3 2 1 1\\n\", \"6\\n2 1 1\\n2 2 2\\n2 3 3\\n2 4 4\\n2 5 5\\n2 6 6\\n\"... | Fox Ciel is playing a card game with her friend Fox Jiro. There are n piles of cards on the table. And there is a positive integer on each card.
The players take turns and Ciel takes the first turn. In Ciel's turn she takes a card from the top of any non-empty pile, and in Jiro's turn he takes a card from the bottom o... | 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\": [\"6 2\\n1 2\\n2 3\", \"4 4\\n1 2\\n2 3\\n4 1\\n3 0\", \"6 2\\n1 0\\n2 6\", \"6 2\\n1 2\\n2 6\", \"6 2\\n2 0\\n2 6\", \"3 2\\n1 0\\n2 3\", \"4 4\\n2 2\\n2 3\\n4 1\\n3 4\", \"4 4\\n1 2\\n2 3\\n4 1\\n1 0\", \"6 2\\n1 2\\n4 6\", \"3 2\\n2 0\\n2 3\", \"6 4\\n1 2\\n2 3\\n4 1\\n1 0\", \"6 2\\n0 2\\n4 ... | We have N boxes, numbered 1 through N. At first, box 1 contains one red ball, and each of the other boxes contains one white ball.
Snuke will perform the following M operations, one by one. In the i-th operation, he randomly picks one ball from box x_i, then he puts it into box y_i.
Find the number of boxes that may ... | 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\": [\"8\\n9 4 1 7 10 1 6 5\\n1 2\\n2 3\\n1 4\\n1 5\\n5 6\\n5 7\\n5 8\\n\", \"1\\n1337\\n\", \"2\\n12345 65432\\n2 1\\n\", \"2\\n12345 65432\\n2 1\\n\", \"1\\n617\\n\", \"8\\n9 4 1 7 10 1 1 5\\n1 2\\n2 3\\n1 4\\n1 5\\n5 6\\n5 7\\n5 8\\n\", \"8\\n9 4 1 7 10 1 1 10\\n1 2\\n2 3\\n1 4\\n1 5\\n5 6\\n5 7\... | You are given a tree consisting exactly of $n$ vertices. Tree is a connected undirected graph with $n-1$ edges. Each vertex $v$ of this tree has a value $a_v$ assigned to it.
Let $dist(x, y)$ be the distance between the vertices $x$ and $y$. The distance between the vertices is the number of edges on the simple path b... | 0 |
{"tests": "{\"inputs\": [\"1 2\\n1 1 10\\n1 1 5\\n\", \"3 2\\n1 2 536870912\\n2 3 536870911\\n\", \"1 1\\n1 1 10\\n\", \"1 2\\n1 1 1\\n1 1 3\\n\", \"3 2\\n1 2 536870912\\n2 3 942984520\\n\", \"2 2\\n1 1 1\\n1 1 3\\n\", \"6 1\\n1 3 3\\n\", \"6 1\\n1 6 3\\n\", \"6 1\\n1 6 6\\n\", \"6 1\\n1 6 1\\n\", \"3 2\\n1 2 840355017... | We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≤ li ≤ ri ≤ n) meaning that value <image> should be equal to qi.
Your task is to find any interesting array of n elements or state that su... | 0.125 |
{"tests": "{\"inputs\": [[\"jabrOni\"], [\"scHOOl counselor\"], [\"prOgramMer\"], [\"bike ganG member\"], [\"poLiTiCian\"], [\"rapper\"], [\"pundit\"], [\"Pug\"], [\"jabrOnI\"], [\"scHOOl COUnselor\"], [\"prOgramMeR\"], [\"bike GanG member\"], [\"poLiTiCiAN\"], [\"RAPPer\"], [\"punDIT\"], [\"pUg\"]], \"outputs\": [[\"P... | Write a function `getDrinkByProfession`/`get_drink_by_profession()` that receives as input parameter a string, and produces outputs according to the following table:
Input
Output
"Jabroni"
"Patron Tequila"
"School Counselor"
"Anything with Alcohol"
"Programmer"
"Hipster Craft Beer"
"Bike Gang Member"
"Mo... | 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\": [[\"1 + 3\"], [\"2 - 10\"], [\"6 ** 9\"], [\"5 = 5\"], [\"7 * 4\"], [\"2 / 2\"], [\"8 != 5\"]], \"outputs\": [[\"One Plus Three\"], [\"Two Minus Ten\"], [\"Six To The Power Of Nine\"], [\"Five Equals Five\"], [\"Seven Times Four\"], [\"Two Divided By Two\"], [\"Eight Does Not Equal Five\"]]}", "... | Math hasn't always been your best subject, and these programming symbols always trip you up!
I mean, does `**` mean *"Times, Times"* or *"To the power of"*?
Luckily, you can create the function `expression_out()` to write out the expressions for you!
The operators you'll need to use are:
```python
{ '+': 'Plus ',... | 0.25 |
{"tests": "{\"inputs\": [\"60 3\\n2012-03-16 16:15:25: Disk size is\\n2012-03-16 16:15:25: Network failute\\n2012-03-16 16:16:29: Cant write varlog\\n2012-03-16 16:16:42: Unable to start process\\n2012-03-16 16:16:43: Disk size is too small\\n2012-03-16 16:16:53: Timeout detected\\n\", \"1 2\\n2012-03-16 23:59:59:Disk ... | You've got a list of program warning logs. Each record of a log stream is a string in this format: "2012-MM-DD HH:MM:SS:MESSAGE" (without the quotes).
String "MESSAGE" consists of spaces, uppercase and lowercase English letters and characters "!", ".", ",", "?". String "2012-MM-DD" determines a correct date in the y... | 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\\n4 2\\n1 1\\n0 1\\n2 3\\n\", \"1023\\n1 2\\n1 0\\n1 2\\n1 1\\n\", \"1023\\n1 2\\n1 2\\n1 2\\n1 2\\n\", \"2\\n0 1\\n1 0\\n1 0\\n0 1\\n\", \"17\\n15 12\\n15 12\\n12 14\\n1 11\\n\", \"29\\n4 0\\n1 1\\n25 20\\n16 0\\n\", \"91\\n9 64\\n75 32\\n60 81\\n35 46\\n\", \"91\\n38 74\\n66 10\\n40 76\\n... | Mike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height of Xaniar is h_1 and height of Abol is h_2. Each second, Mike waters Abol and Xaniar.
[Image]
So, if height of Xaniar is h_1 and height of Abol is h_2, after one second height of Xaniar will become $(x_... | 0 |
{"tests": "{\"inputs\": [\"5\\n<main>10,10,190,150<menu>20,20,70,140</menu><primary>80,20,180,140</primary></main>\\n10 10\\n15 15\\n40 60\\n1 3\\n130 80\\n0\", \"5\\n<main>10,10,190,150<menu>20,20,70,140</menu><primary>80,20,180,140</primary></main>\\n9 10\\n15 15\\n40 60\\n1 3\\n130 80\\n0\", \"5\\n<main>10,10,190,15... | Advanced Creative Mobile (ACM) has decided to develop a GUI application to be installed in a new portable computer.
As shown in the figure below, the GUI has a nested structure in which it has one main panel, several panels are arranged on it, and some panels are arranged on top of those panels. .. All panels are rect... | 0 |
{"tests": "{\"inputs\": [\"4\\n5 1\\n1 2 3 4 5\\n9 3\\n-5 -10 -15 6 5 8 3 7 4\\n5 3\\n2 2 3 3 3\\n4 2\\n1000000000 1000000000 1000000000 1000010000\\n\", \"4\\n5 1\\n1 2 3 4 5\\n9 3\\n-5 -10 -15 6 5 8 3 7 4\\n5 3\\n2 2 5 3 3\\n4 2\\n1000000000 1000000000 1000000000 1000000000\\n\", \"4\\n5 1\\n1 2 3 4 5\\n9 3\\n-5 -10 ... | A total of n depots are located on a number line. Depot i lies at the point x_i for 1 ≤ i ≤ n.
You are a salesman with n bags of goods, attempting to deliver one bag to each of the n depots. You and the n bags are initially at the origin 0. You can carry up to k bags at a time. You must collect the required number of ... | 0 |
{"tests": "{\"inputs\": [\"10 10\\n9 10 1000000000\\n10 2 1000000000\\n6 3 1000000000\\n8 6 1000000000\\n4 8 1000000000\\n7 5 1000000000\\n9 7 1000000000\\n1 3 1000000000\\n1 5 1000000000\\n4 2 1000000000\\n\", \"10 21\\n10 2 500000000\\n8 7 500000000\\n9 1 0\\n9 8 1000000000\\n3 4 1000000000\\n2 4 1000000000\\n5 4 500... | Heidi found out that the Daleks have created a network of bidirectional Time Corridors connecting different destinations (at different times!). She suspects that they are planning another invasion on the entire Space and Time. In order to counter the invasion, she plans to deploy a trap in the Time Vortex, along a care... | 0 |
{"tests": "{\"inputs\": [\"8 4 9 371687114\\n1 7 22 31 35 38 62 84\\n\", \"2 1000000000 1000000000000 10000\\n1 2\\n\", \"1 1 1 2\\n0\\n\", \"4 0 8 414790855\\n1 88 97 99\\n\", \"1 1 1 2\\n1000000000\\n\", \"1 1 1 2\\n2\\n\", \"1 0 1 1000000000\\n1000000000\\n\", \"11 10 6 560689961\\n2 17 20 24 32 37 38 39 40 61 86\\n... | Once upon a time in the thicket of the mushroom forest lived mushroom gnomes. They were famous among their neighbors for their magic mushrooms. Their magic nature made it possible that between every two neighboring mushrooms every minute grew another mushroom with the weight equal to the sum of weights of two neighbori... | 0 |
{"tests": "{\"inputs\": [\"1 10\\n3 5\\n\", \"2 10\\n3 5\\n2 6\\n\", \"4 1000000000\\n1 1\\n1 10000000\\n1 30000000\\n1 99999999\\n\", \"5 500\\n35 44\\n28 83\\n46 62\\n31 79\\n40 43\\n\", \"4 1000000000\\n1 1\\n1 00000000\\n1 30000000\\n1 99999999\", \"1 10\\n4 5\", \"2 10\\n2 5\\n2 6\", \"5 500\\n35 44\\n28 83\\n46 6... | You are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:
- Wield one of the katana you have. When you wield Katana i (1 ≤ i ≤ N), the monster receives a_i points of dam... | 0 |
{"tests": "{\"inputs\": [\"4 3\\n1 2\\n2 3\\n2 4\\n\", \"5 2\\n1 2\\n2 3\\n3 4\\n2 5\\n\", \"2 2\\n2 1\\n\", \"3 3\\n2 1\\n3 1\\n\", \"3 3\\n1 2\\n3 2\\n\", \"10 4\\n5 4\\n8 3\\n4 6\\n5 3\\n7 9\\n1 3\\n5 10\\n2 9\\n9 8\\n\", \"10 7\\n8 7\\n2 8\\n2 3\\n10 6\\n4 6\\n4 1\\n10 5\\n7 5\\n9 8\\n\", \"8 3\\n2 1\\n3 1\\n4 3\\n... | Alice got tired of playing the tag game by the usual rules so she offered Bob a little modification to it. Now the game should be played on an undirected rooted tree of n vertices. Vertex 1 is the root of the tree.
Alice starts at vertex 1 and Bob starts at vertex x (x ≠ 1). The moves are made in turns, Bob goes first... | 0.375 |
{"tests": "{\"inputs\": [\"5\\n8 5\\n6 4\\n4 3\\n7 10\\n0 10\\n10\\n10 5\\n2 7\\n10 7\\n8 10\\n10 2\\n1 2\\n8 1\\n6 7\\n6 0\\n0 9\\n5\\n904207 809784\\n845370 244806\\n499091 59863\\n638406 182509\\n435076 362268\\n10\\n757559 866424\\n114810 239537\\n519926 989458\\n461089 424480\\n674361 448440\\n81851 150384\\n45910... | problem
You are looking for a constellation in a picture of the starry sky. The photo always contains exactly one figure with the same shape, orientation, and size as the constellation you are looking for. However, there is a possibility that extra stars are shown in the photograph other than the stars that make up th... | 0.375 |
{"tests": "{\"inputs\": [\"2\\n0 3\\n1 5\\n\", \"1\\n0 4\\n\", \"2\\n1 10\\n2 2\\n\", \"1\\n0 1\\n\", \"1\\n1000000000 1000000000\\n\", \"1\\n0 16\\n\", \"1\\n0 17\\n\", \"2\\n0 16\\n1 4\\n\", \"3\\n0 20\\n1 18\\n2 4\\n\", \"3\\n0 64\\n1 16\\n2 4\\n\", \"5\\n1 1000000\\n100 100\\n101 9\\n102 4\\n103 8\\n\", \"10\\n11 6... | Emuskald is a well-known illusionist. One of his trademark tricks involves a set of magical boxes. The essence of the trick is in packing the boxes inside other boxes.
From the top view each magical box looks like a square with side length equal to 2^{k} (k is an integer, k ≥ 0) units. A magical box v can be put insid... | 0 |
{"tests": "{\"inputs\": [\"4 6 0\\n0 1 3\\n0 2 2\\n2 0 1\\n2 3 2\\n3 0 1\\n3 1 5\", \"6 10 0\\n0 2 7\\n0 1 1\\n0 3 5\\n1 4 9\\n2 1 6\\n1 3 2\\n3 4 3\\n4 2 2\\n1 5 8\\n3 5 3\", \"4 6 0\\n0 1 1\\n0 2 2\\n2 0 1\\n2 3 2\\n3 0 1\\n3 1 5\", \"4 6 0\\n0 1 1\\n0 2 2\\n3 1 1\\n2 3 3\\n3 0 0\\n0 1 7\", \"6 10 0\\n0 2 7\\n0 1 1\\... | Find the sum of the weights of edges of the Minimum-Cost Arborescence with the root r for a given weighted directed graph G = (V, E).
Constraints
* 1 ≤ |V| ≤ 100
* 0 ≤ |E| ≤ 1,000
* 0 ≤ wi ≤ 10,000
* G has arborescence(s) with the root r
Input
|V| |E| r
s0 t0 w0
s1 t1 w1
:
s|E|-1 t|E|-1 w|E|-1
, where |V| is the... | 0 |
{"tests": "{\"inputs\": [\"10 1000000\\n1 2 3 4 84 5 6 7 8 9\\n\", \"1 1\\n3\\n\", \"13 666\\n84 89 29 103 128 233 190 122 117 208 119 97 200\\n\", \"1 0\\n0\\n\", \"42 42\\n42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42\\n\", \"4 1\\n3 20 3... | You've got an array a, consisting of n integers. The array elements are indexed from 1 to n. Let's determine a two step operation like that:
1. First we build by the array a an array s of partial sums, consisting of n elements. Element number i (1 ≤ i ≤ n) of array s equals <image>. The operation x mod y means that ... | 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.25 |
{"tests": "{\"inputs\": [\"3\\n7 3\\n4 4\\n6 2\\n\", \"66\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 1\\n1 ... | You are given two integers $n$ and $k$.
Your task is to construct such a string $s$ of length $n$ that for each $i$ from $1$ to $k$ there is at least one $i$-th letter of the Latin alphabet in this string (the first letter is 'a', the second is 'b' and so on) and there are no other letters except these. You have to ma... | 0.625 |
{"tests": "{\"inputs\": [\"50 20\\n45 33\\n44 7\\n31 41\\n45 12\\n3 13\\n18 17\\n3 39\\n31 11\\n31 1\\n44 7\\n44 23\\n18 46\\n44 1\\n45 6\\n31 22\\n18 13\\n31 22\\n45 8\\n45 17\\n18 43\\n\", \"3 2\\n3 1\\n1 3\\n\", \"3 1\\n1 2\\n\", \"3 3\\n1 2\\n3 2\\n2 3\\n\", \"20 5\\n3 12\\n5 20\\n16 4\\n13 3\\n9 14\\n\", \"10 10\\... | This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.
Alice received a set of Toy Train™ from Bob. It consists of one train and a connected railway network of n stations, enumerated from 1 through n. The train occupies one station at... | 0 |
{"tests": "{\"inputs\": [[\"a\"], [\"aa\"], [\"baa\"], [\"aab\"], [\"baabcd\"], [\"baablkj12345432133d\"], [\"I like racecars that go fast\"], [\"abcdefghba\"], [\"\"], [\"FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNo... | ### Longest Palindrome
Find the length of the longest substring in the given string `s` that is the same in reverse.
As an example, if the input was “I like racecars that go fast”, the substring (`racecar`) length would be `7`.
If the length of the input string is `0`, the return value must be `0`.
### Ex... | 0 |
{"tests": "{\"inputs\": [\"7 9\\n8 6 9 1 2\", \"7 9\\n8 6 12 1 2\", \"7 9\\n8 6 12 2 0\", \"7 1\\n2 8 -1 1 1\", \"7 9\\n8 6 12 1 0\", \"7 9\\n8 6 23 2 0\", \"7 9\\n13 6 23 2 0\", \"7 9\\n21 6 23 2 0\", \"7 9\\n18 6 23 2 0\", \"7 9\\n18 6 39 2 0\", \"7 9\\n18 6 62 2 0\", \"7 9\\n18 6 37 2 0\", \"10 9\\n18 6 37 2 0\", \"... | Does the card fit in a snack? (Are Cards Snacks?)
square1001 You have $ N $ cards.
Each of these cards has an integer written on it, and the integer on the $ i $ th card is $ A_i $.
square1001 Your random number today is $ K $. square1001 You want to choose some of these $ N $ cards so that they add up to $ K $.
E8... | 0 |
{"tests": "{\"inputs\": [\"5\\n1 2 4 3 2\\n\", \"7\\n1 3 5 6 5 4 2\\n\", \"3\\n2 2 2\\n\", \"4\\n1 2 4 3\\n\", \"15\\n37504 79054 80071 95721 135743 164345 189260 190810 191657 196168 200000 200000 190810 190018 185437\\n\", \"4\\n1 2 3 4\\n\", \"6\\n1 2 3 4 2 3\\n\", \"4\\n2 2 2 3\\n\", \"4\\n1 3 2 2\\n\", \"12\\n2 3 ... | The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).
You are given a sequence $a$ consisting of $n$ integers.
You are making a sequence of moves. During each move you must take either the leftmost element of the sequence or... | 0 |
{"tests": "{\"inputs\": [\"7\\n4 1\\n4 2\\n4 2\\n2 1\\n5 4\\n6 4\\n3 2\\n\", \"1\\n2 1\\n\", \"1\\n1000000000 999999999\\n\", \"10\\n17 15\\n5 4\\n18 16\\n13 12\\n19 17\\n3 1\\n12 10\\n5 3\\n18 16\\n11 10\\n\", \"10\\n19 17\\n15 14\\n10 7\\n15 14\\n5 2\\n13 10\\n20 18\\n13 10\\n6 4\\n16 15\\n\", \"10\\n12 11\\n14 13\\n... | There are famous Russian nesting dolls named matryoshkas sold in one of the souvenir stores nearby, and you'd like to buy several of them. The store has $n$ different matryoshkas. Any matryoshka is a figure of volume $out_i$ with an empty space inside of volume $in_i$ (of course, $out_i > in_i$).
You don't have much f... | 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\": [[[1, 2, 3, 4, 6, 7, 8]], [[1, 2, 3, 4, 5, 6, 7, 8]], [[4, 6, 7, 8, 9, 11]], [[4, 5, 6, 7, 8, 9, 11]], [[31, 32]], [[-3, -2, 0, 1]], [[-5, -4, -3, -1]]], \"outputs\": [[6], [null], [6], [11], [null], [0], [-1]]}", "source": "taco"} | Your task is to find the first element of an array that is not consecutive.
By not consecutive we mean not exactly 1 larger than the previous element of the array.
E.g. If we have an array `[1,2,3,4,6,7,8]` then `1` then `2` then `3` then `4` are all consecutive but `6` is not, so that's the first non-consecutive num... | 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.125 |
{"tests": "{\"inputs\": [[10, 3, 2], [10, 3, 0], [10, 4, 1], [10, 5, 3], [15, 5, 3], [15, 5, 4], [15, 3, 3]], \"outputs\": [[4], [8], [2], [4], [15], [19], [13]]}", "source": "taco"} | We need a function (for commercial purposes) that may perform integer partitions with some constraints.
The function should select how many elements each partition should have.
The function should discard some "forbidden" values in each partition.
So, create ```part_const()```, that receives three arguments.
```part_co... | 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 |
{"tests": "{\"inputs\": [[10], [100], [1000], [1000001], [0], [1], [2], [\"a\"], [1.1], [-1]], \"outputs\": [[[2, 5]], [[2, 2, 5, 5]], [[2, 2, 2, 5, 5, 5]], [[101, 9901]], [[]], [[1]], [[2]], [[]], [[]], [[]]]}", "source": "taco"} | ~~~if-not:java
You have to code a function **getAllPrimeFactors** wich take an integer as parameter and return an array containing its prime decomposition by ascending factors, if a factors appears multiple time in the decomposition it should appear as many time in the array.
exemple: `getAllPrimeFactors(100)` return... | 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.375 |
{"tests": "{\"inputs\": [\"1 0\\n\", \"2 1\\n\", \"3 2\\n\", \"4 1\\n\", \"7 4\\n\", \"7 7\\n\", \"8 4\\n\", \"8 5\\n\", \"10 3\\n\", \"20 0\\n\", \"100 99\\n\", \"13 13\\n\", \"100 100\\n\", \"1000 0\\n\", \"1000 1\\n\", \"1000 2\\n\", \"1000 10\\n\", \"1000 99\\n\", \"1000 500\\n\", \"1000 700\\n\", \"1000 900\\n\", ... | Permutation p is an ordered set of integers p_1, p_2, ..., p_{n}, consisting of n distinct positive integers, each of them doesn't exceed n. We'll denote the i-th element of permutation p as p_{i}. We'll call number n the size or the length of permutation p_1, p_2, ..., p_{n}.
We'll call position i (1 ≤ i ≤ n) i... | 0 |
{"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\": [\"8 4\\n3 8 7 9 9 4 6 8\\n2 5 9 4 3 8 9 1\\n\", \"10 6\\n60 8 63 72 1 100 23 59 71 59\\n81 27 66 53 46 64 86 27 41 82\\n\", \"13 13\\n93 19 58 34 96 7 35 46 60 5 36 40 41\\n57 3 42 68 26 85 25 45 50 21 60 23 79\\n\", \"12 1\\n49 49 4 16 79 20 86 94 43 55 45 17\\n15 36 51 20 83 6 83 80 72 22 66 ... | The marmots need to prepare k problems for HC^2 over n days. Each problem, once prepared, also has to be printed.
The preparation of a problem on day i (at most one per day) costs a_{i} CHF, and the printing of a problem on day i (also at most one per day) costs b_{i} CHF. Of course, a problem cannot be printed before... | 0 |
{"tests": "{\"inputs\": [\"3\\n10\\n20\\n30\\n\", \"3\\n10\\n10\\n10\\n\", \"3\\n120\\n120\\n120\\n\", \"10\\n151\\n172\\n68\\n9\\n8\\n1\\n18\\n116\\n59\\n117\\n\", \"11\\n121\\n62\\n66\\n177\\n5\\n173\\n16\\n31\\n80\\n31\\n54\\n\", \"12\\n16\\n27\\n65\\n54\\n154\\n90\\n23\\n135\\n102\\n42\\n17\\n173\\n\", \"15\\n68\\n... | Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! The lock has a scale of $360$ degrees and a pointer which initially points at zero:
[Image]
Petr called his car dealer, wh... | 0.5 |
{"tests": "{\"inputs\": [\"4 11\\n11 3 7 10\", \"3 5\\n6 9 6\", \"5 19\\n10 2 8 6 4\", \"3 7\\n18 3 4\", \"3 11\\n11 3 7 10\", \"3 5\\n6 16 6\", \"5 19\\n10 2 8 6 1\", \"3 7\\n18 0 4\", \"2 5\\n6 16 6\", \"5 19\\n10 2 7 6 1\", \"3 7\\n16 0 4\", \"2 0\\n6 16 6\", \"5 11\\n10 2 7 6 1\", \"3 7\\n16 1 4\", \"2 0\\n6 16 9\"... | There is a box containing N balls. The i-th ball has the integer A_i written on it. Snuke can perform the following operation any number of times:
* Take out two balls from the box. Then, return them to the box along with a new ball, on which the absolute difference of the integers written on the two balls is written.... | 0.5 |
{"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\": [\"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.375 |
{"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\": [\"00\\n00\\n\", \"00X00X0XXX0\\n0XXX0X00X00\\n\", \"0X0X0\\n0X0X0\\n\", \"0XXX0\\n00000\\n\", \"0\\n0\\n\", \"0\\nX\\n\", \"X\\n0\\n\", \"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX... | Bishwock is a chess figure that consists of three squares resembling an "L-bar". This figure can be rotated by 90, 180 and 270 degrees so it can have four possible states:
XX XX .X X.
X. .X XX XX
Bishwocks don't attack any squares and can even occupy on the adjacent squares as long as they don't oc... | 0.125 |
{"tests": "{\"inputs\": [\"3\\n4 8 5\\n\", \"5\\n3 10 2 1 5\\n\", \"4\\n0 5 15 10\\n\", \"1\\n1\\n\", \"3\\n0 0 17\\n\", \"3\\n0 0 1\\n\", \"1\\n2103\\n\", \"10\\n3 3 3 5 6 9 3 1 7 3\\n\", \"100\\n61 28 67 53 13 6 70 5 79 82 60 60 84 17 80 25 82 82 69 76 81 43 58 86 18 78 4 25 8 30 33 87 91 18 90 26 62 11 28 66 9 33 58... | This is the harder version of the problem. In this version, $1 \le n \le 10^6$ and $0 \leq a_i \leq 10^6$. You can hack this problem if you locked it. But you can hack the previous problem only if you locked both problems
Christmas is coming, and our protagonist, Bob, is preparing a spectacular present for his long-ti... | 0 |
{"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.75 |
{"tests": "{\"inputs\": [\"11\\n0 0 0 1 1 0 1 0 0 1 1\\n1 2\\n1 3\\n2 4\\n2 5\\n5 6\\n5 7\\n3 8\\n3 9\\n3 10\\n9 11\\n\", \"4\\n0 0 0 0\\n1 2\\n2 3\\n3 4\\n\", \"15\\n0 1 0 0 1 1 0 1 1 1 1 1 0 1 0\\n10 7\\n10 3\\n10 8\\n5 7\\n13 14\\n8 13\\n15 4\\n15 13\\n5 2\\n9 3\\n11 15\\n13 6\\n1 12\\n9 1\\n\", \"42\\n1 0 0 1 0 1 1... | Anton is growing a tree in his garden. In case you forgot, the tree is a connected acyclic undirected graph.
There are n vertices in the tree, each of them is painted black or white. Anton doesn't like multicolored trees, so he wants to change the tree such that all vertices have the same color (black or white).
To c... | 0 |
{"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\": [\"2 -1 0 5 3\\n0 2\\n5 2\\n\", \"4 0 0 5 0\\n9 4\\n8 3\\n-1 0\\n1 4\\n\", \"5 -6 -4 0 10\\n-7 6\\n-9 7\\n-5 -1\\n-2 1\\n-8 10\\n\", \"10 -68 10 87 22\\n30 89\\n82 -97\\n-52 25\\n76 -22\\n-20 95\\n21 25\\n2 -3\\n45 -7\\n-98 -56\\n-15 16\\n\", \"1 -10000000 -10000000 -10000000 -9999999\\n10000000... | A flowerbed has many flowers and two fountains.
You can adjust the water pressure and set any values r_1(r_1 ≥ 0) and r_2(r_2 ≥ 0), giving the distances at which the water is spread from the first and second fountain respectively. You have to set such r_1 and r_2 that all the flowers are watered, that is, for each flo... | 0.5 |
{"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.125 |
{"tests": "{\"inputs\": [\"3\\napple\\norange\\napple\\n1\\ngrape\\n\", \"3\\napple\\norange\\napple\\n5\\napple\\napple\\napple\\napple\\napple\\n\", \"1\\nvoldemort\\n10\\nvoldemort\\nvoldemort\\nvoldemort\\nvoldemort\\nvoldemort\\nvoldemort\\nvoldemort\\nvoldemort\\nvoldemort\\nvoldemort\\n\", \"6\\nred\\nred\\nblue... | Takahashi has N blue cards and M red cards.
A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i.
Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ear... | 0.875 |
{"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\": [\"1\\n18 1\", \"2\\n5 1\\n10 1\", \"3\\n25 52AI\\n43 3BI0\\n62 pn6\", \"1\\n28 1\", \"3\\n25 52AI\\n45 3BI0\\n62 pn6\", \"1\\n54 1\", \"3\\n25 52AI\\n45 3AI0\\n62 pn6\", \"3\\n25 52AI\\n45 3AI0\\n55 pn6\", \"3\\n25 52AI\\n45 3AI0\\n55 pm6\", \"3\\n25 52AI\\n42 3AI0\\n55 pm6\", \"3\\n25 52@I\\n4... | Problem
You decide to play a weird game with your friend A, who loves gathering.
Given a set S of non-negative integers consisting of n elements that can be duplicated. Each element contained in the set S is a non-negative pi-ary number. With Steps 1 to 3 below as one turn for the set S, you and your opponent repeat ... | 0.625 |
{"tests": "{\"inputs\": [\"10 8\\n5 2\\n6 5\\n3 8\\n9 10\\n4 3\\n9 5\\n2 6\\n9 10\\n\", \"10 20\\n6 10\\n2 3\\n10 7\\n8 10\\n4 7\\n6 2\\n7 10\\n7 4\\n10 3\\n9 3\\n4 8\\n1 7\\n2 10\\n6 9\\n3 6\\n6 3\\n10 2\\n10 7\\n10 5\\n4 5\\n\", \"5000 1\\n4008 1126\\n\", \"10 4\\n8 6\\n1 7\\n6 1\\n5 1\\n\", \"10 10\\n6 5\\n1 10\\n6 ... | Alice received a set of Toy Train™ from Bob. It consists of one train and a connected railway network of n stations, enumerated from 1 through n. The train occupies one station at a time and travels around the network of stations in a circular manner. More precisely, the immediate station that the train will visit afte... | 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\": [[\"2\", \"2\", \"3 4\", \"3\", \"4 2 5\"], \"2\\n2\\n3 4\\n3\\n4 2 9\", \"2\\n2\\n3 4\\n3\\n0 2 5\", \"2\\n2\\n0 4\\n3\\n4 0 9\", \"2\\n2\\n0 4\\n3\\n7 2 9\", \"2\\n2\\n3 4\\n3\\n-1 1 5\", \"2\\n2\\n0 4\\n3\\n4 1 9\", \"2\\n2\\n1 4\\n3\\n4 2 9\", \"2\\n2\\n-1 4\\n3\\n4 1 4\", \"2\\n2\\n1 4\\n3\... | Chef loves to play with arrays by himself. Today, he has an array A consisting of N distinct integers. He wants to perform the following operation on his array A.
- Select a pair of adjacent integers and remove the larger one of these two. This decreases the array size by 1. Cost of this operation will be equal to the... | 0.875 |
{"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\": [\"5 2 3\\n1 2\\n1 3\\n3 4\\n5 3\\n\", \"5 3 2\\n1 2\\n1 3\\n3 4\\n5 3\\n\", \"50 23129 410924\\n18 28\\n17 23\\n21 15\\n18 50\\n50 11\\n32 3\\n44 41\\n50 31\\n50 34\\n5 14\\n36 13\\n22 40\\n20 9\\n9 43\\n19 47\\n48 40\\n20 22\\n33 45\\n35 22\\n33 24\\n9 6\\n13 1\\n13 24\\n49 20\\n1 20\\n29 38\\... | A group of n cities is connected by a network of roads. There is an undirected road between every pair of cities, so there are $\frac{n \cdot(n - 1)}{2}$ roads in total. It takes exactly y seconds to traverse any single road.
A spanning tree is a set of roads containing exactly n - 1 roads such that it's possible to t... | 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.75 |
{"tests": "{\"inputs\": [\"5 8\\n1 1 1 1 1\\n2 3 4 -1 -1 -1 -1 -1\\n\", \"6 2\\n1 1 1 2 3 4\\n5 6\\n\", \"2 2\\n1 2\\n1 -1\\n\", \"5 8\\n1 1 2 1 1\\n2 3 4 -1 -1 -1 -1 -1\\n\", \"6 2\\n1 1 1 1 3 4\\n5 6\\n\", \"5 4\\n1 2 3 4 5\\n-5 -2 -3 -1\\n\", \"5 4\\n1 2 3 4 5\\n-5 -1 -1 -1\\n\", \"5 5\\n1 2 3 4 5\\n-1 -1 -2 -1 -1\\... | Note that the memory limit is unusual.
You are given a multiset consisting of n integers. You have to process queries of two types:
* add integer k into the multiset;
* find the k-th order statistics in the multiset and remove it.
k-th order statistics in the multiset is the k-th element in the sorted list o... | 0.625 |
{"tests": "{\"inputs\": [\"3\\n2 6 8\\n\", \"5\\n2 3 4 9 12\\n\", \"4\\n5 7 2 9\\n\", \"7\\n7 10 9 4 8 5 6\\n\", \"10\\n3 17 8 5 7 9 2 11 13 12\\n\", \"20\\n13 7 23 19 2 28 5 29 20 6 9 8 30 26 24 21 25 15 27 17\\n\", \"20\\n19 13 7 22 21 31 26 28 20 4 11 10 9 39 25 3 16 27 33 29\\n\", \"20\\n10 50 39 6 47 35 37 26 12 1... | SIHanatsuka - EMber SIHanatsuka - ATONEMENT
Back in time, the seven-year-old Nora used to play lots of games with her creation ROBO_Head-02, both to have fun and enhance his abilities.
One day, Nora's adoptive father, Phoenix Wyle, brought Nora $n$ boxes of toys. Before unpacking, Nora decided to make a fun game for ... | 0 |
{"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\": [\"2\\n2 5\\n-6 4\\n7 -2\\n-1 -3\\n\", \"4\\n2 2\\n8 2\\n-7 0\\n-2 6\\n1 -14\\n16 -12\\n11 -18\\n7 -14\\n\", \"5\\n20 -17\\n19 3\\n10 5\\n6 -19\\n2 -17\\n-34 7\\n-33 -13\\n-20 9\\n-24 -15\\n-16 7\\n\", \"1\\n7 -8\\n-2 5\\n\", \"1\\n0 0\\n0 0\\n\", \"10\\n-52 25\\n21 25\\n76 -22\\n-98 -56\\n87 22... | Bob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point $T$, which coordinates to be found out.
Bob travelled around the world and collected clues of the treasure location at $n$ obelisks. These clues were in an ancient language, and he has only decrypted them at... | 0.625 |
{"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.25 |
{"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\": [\"2 0 3 4\", \"54 41 59 265\", \"1 0 2 2\", \"2 0 3 0\", \"54 41 59 202\", \"1 0 2 3\", \"2 0 3 1\", \"41 41 59 202\", \"2 0 3 2\", \"50 41 59 202\", \"1 0 2 1\", \"2 0 6 2\", \"4 0 6 2\", \"4 0 6 4\", \"4 0 6 7\", \"3 0 6 7\", \"2 0 3 3\", \"31 41 59 430\", \"2 0 3 8\", \"54 55 59 265\", \"1 -... | We have a grid with A horizontal rows and B vertical columns, with the squares painted white. On this grid, we will repeatedly apply the following operation:
* Assume that the grid currently has a horizontal rows and b vertical columns. Choose "vertical" or "horizontal".
* If we choose "vertical", insert one row at th... | 0 |
{"tests": "{\"inputs\": [\"3\\n3\\n4\\n6\\n\", \"10\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n\", \"1\\n212055293\\n\", \"1\\n508427854\\n\", \"1\\n398561321\\n\", \"1\\n322647200\\n\", \"1\\n827388716\\n\", \"1\\n596007358\\n\", \"1\\n508427854\\n\", \"1\\n827388716\\n\", \"1\\n596007358\\n\", \"10\\n1\\n2\\n3\\n4\\n... | Ivan is developing his own computer game. Now he tries to create some levels for his game. But firstly for each level he needs to draw a graph representing the structure of the level.
Ivan decided that there should be exactly n_{i} vertices in the graph representing level i, and the edges have to be bidirectional. Whe... | 0 |
{"tests": "{\"inputs\": [\"10\\n4547989 39261040 94929326 38131456 26174500 7152864 71295827 77784626 89898294 68006331\\n\", \"10\\n3106954 3413954 3854371 85952704 17834583 20954227 58810981 7460648 97908613 97965110\\n\", \"10\\n73622246 45316865 2066146 61168230 1258786 69603039 64470479 72811017 72683016 97992629\... | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1, x2, ..., xk (k > 1) is such maximum element xj, that the following inequality holds: <image>.
The lucky number of the sequence of distinct positive integers x1, x2, ..., xk (k > 1) is t... | 0.625 |
{"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\": [\"4\\n30\\n125\\n75\\n4\\n30\\n125\\n75\\n5\\n30\\n125\\n75\\n65\\n4\\n30\\n125\\n75\\n4\\n30\\n125\\n75\\n6\\n30\\n50\\n50\\n29\\n75\\n0\", \"4\\n30\\n125\\n75\\n4\\n30\\n125\\n75\\n5\\n30\\n125\\n75\\n65\\n4\\n30\\n125\\n75\\n4\\n30\\n125\\n75\\n6\\n30\\n50\\n6\\n29\\n75\\n0\", \"4\\n30\\n84\... | Create a program that inputs the vertex information of two polygons inscribed in one circle and outputs the magnitude relationship of their areas.
Assume that each vertex of the X-side is numbered counterclockwise from 1 to X (the figure shows an example when X = 4). However, the given polygon assumes that the center ... | 0.125 |
{"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.875 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.