info stringlengths 120 50k | question stringlengths 504 10.4k | avg@8_qwen3_4b_instruct_2507 float64 0 0.88 |
|---|---|---|
{"tests": "{\"inputs\": [[\"sr\"], [\"svool\"], [\"r slkv mlylwb wvxlwvh gsrh nvhhztv\"], [\"qzezxirkg rh z srts ovevo wbmznrx fmgbkvw zmw rmgvikivgvw kiltiznnrmt ozmtfztv rg szh yvvm hgzmwziwravw rm gsv vxnzxirkg ozmtfztv hkvxrurxzgrlm zolmthrwv sgno zmw xhh rg rh lmv lu gsv gsivv vhhvmgrzo gvxsmloltrvh lu dliow drwv ... | You have managed to intercept an important message and you are trying to read it.
You realise that the message has been encoded and can be decoded by switching each letter with a corresponding letter.
You also notice that each letter is paired with the letter that it coincides with when the alphabet is reversed.
For... | 0 |
{"tests": "{\"inputs\": [\"4 6\\n1 2\\n2 3\\n3 4\\n4 1\\n1 3\\n2 4\\n\", \"4 5\\n1 2\\n2 3\\n3 4\\n4 1\\n1 3\\n\", \"4 4\\n1 2\\n2 3\\n3 1\\n1 4\\n\", \"10 9\\n2 1\\n3 1\\n4 2\\n5 4\\n6 2\\n7 4\\n8 1\\n9 8\\n10 8\\n\", \"7 6\\n2 1\\n3 2\\n4 3\\n5 4\\n6 5\\n7 6\\n\", \"9 8\\n1 9\\n2 9\\n3 9\\n4 9\\n5 9\\n6 9\\n7 9\\n8 9... | Little Chris is participating in a graph cutting contest. He's a pro. The time has come to test his skills to the fullest.
Chris is given a simple undirected connected graph with n vertices (numbered from 1 to n) and m edges. The problem is to cut it into edge-distinct paths of length 2. Formally, Chris has to partiti... | 0 |
{"tests": "{\"inputs\": [\"10 4 8\\n2 8 -10 9\\n\", \"3 0 -324925900\\n-97093162 612988987 134443035 599513203\\n\", \"0 2 -866705865\\n394485460 465723932 89788653 -50040527\\n\", \"3 0 407398974\\n-665920261 551867422 -837723488 503663817\\n\", \"664808710 -309024147 997224520\\n-417682067 -256154660 -762795849 -2929... | In this problem we consider a very simplified model of Barcelona city.
Barcelona can be represented as a plane with streets of kind x = c and y = c for every integer c (that is, the rectangular grid). However, there is a detail which makes Barcelona different from Manhattan. There is an avenue called Avinguda Diagonal... | 0 |
{"tests": "{\"inputs\": [\"10 45 9\\n2 1 428\\n3 1 610\\n3 2 357\\n4 1 855\\n4 2 528\\n4 3 508\\n5 1 425\\n5 2 185\\n5 3 349\\n5 4 845\\n6 1 206\\n6 2 969\\n6 3 153\\n6 4 854\\n6 5 640\\n7 1 87\\n7 2 250\\n7 3 953\\n7 4 456\\n7 5 742\\n7 6 588\\n8 1 641\\n8 2 898\\n8 3 396\\n8 4 960\\n8 5 654\\n8 6 410\\n8 7 640\\n9 1 ... | A country called Berland consists of n cities, numbered with integer numbers from 1 to n. Some of them are connected by bidirectional roads. Each road has some length. There is a path from each city to any other one by these roads. According to some Super Duper Documents, Berland is protected by the Super Duper Missile... | 0 |
{"tests": "{\"inputs\": [\"7\\n1 2 1 2 7 4 7\\n\", \"13\\n1 2 3 2 1 3 3 4 5 5 5 4 7\\n\", \"3\\n1 1 2\\n\", \"3\\n1 1 1\\n\", \"3\\n1 2 1\\n\", \"3\\n1 2 2\\n\", \"3\\n1 2 3\\n\"], \"outputs\": [\"2\\n\", \"7\\n\", \"0\\n\", \"1\\n\", \"1\\n\", \"0\\n\", \"0\\n\"]}", "source": "primeintellect"} | You are given $n$ elements numbered from $1$ to $n$, the element $i$ has value $a_i$ and color $c_i$, initially, $c_i = 0$ for all $i$.
The following operation can be applied:
Select three elements $i$, $j$ and $k$ ($1 \leq i < j < k \leq n$), such that $c_i$, $c_j$ and $c_k$ are all equal to $0$ and $a_i = a_k$, the... | 0 |
{"tests": "{\"inputs\": [\"3\\n2\\n5 orange\\n2 white\\n\", \"2\\n2\\n1 white\\n2 white\\n\", \"10\\n3\\n1 blue\\n4 red\\n5 orange\\n\", \"1\\n1\\n1 white\\n\", \"3\\n1\\n7 yellow\\n\", \"1\\n1\\n1 yellow\\n\", \"2\\n2\\n1 green\\n3 red\\n\", \"5\\n9\\n31 yellow\\n30 green\\n26 yellow\\n13 red\\n2 red\\n22 white\\n12 r... | It is the hard version of the problem. The difference is that in this version, there are nodes with already chosen colors.
Theofanis is starving, and he wants to eat his favorite food, sheftalia. However, he should first finish his homework. Can you help him with this problem?
You have a perfect binary tree of $2^k -... | 0 |
{"tests": "{\"inputs\": [\"0 1\\n1 999999999 1\\n\", \"0 5\\n1 96762320 50510976\\n243235878 312125306 50510976\\n326016273 338641867 50510976\\n385105810 445224816 50510976\\n456157384 569789185 50510976\\n\", \"4 7\\n1\\n2\\n3\\n4\\n1 1000000000 1\\n1 1000000000 2\\n1 1000000000 3\\n1 1000000000 4\\n1 1000000000 5\\n... | On a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to 10^9, and the columns are numbered from left to right from 1 to 10^9. Therefore, for each cell of the chessboard you can assign the coordinates (x,y), where x is the column number and y is the row number.
Ever... | 0 |
{"tests": "{\"inputs\": [[\"Grae\", \"Practice makes perfect\"], [\"Dan\", \"Get back to work, Grae\"], [\"Alex\", \"Python is great fun\"], [\"Bethany\", \"Yes, way more fun than R\"], [\"Darrell\", \"What the heck is this thing?\"]], \"outputs\": [[\"Grae said: \\\"Practice makes perfect\\\"\"], [\"Dan said: \\\"Get ... | This function should take two string parameters: a person's name (`name`) and a quote of theirs (`quote`), and return a string attributing the quote to the person in the following format:
```python
'[name] said: "[quote]"'
```
For example, if `name` is `'Grae'` and `'quote'` is `'Practice makes perfect'` then your fu... | 0 |
{"tests": "{\"inputs\": [\"2\\n4\\n1.000 31.000\\n12 3\\n20 6\\n30 1\\n5 1\\n3\\n1.000 30.000\\n1 10\\n10 10\\n20 8\\n\", \"2\\n4\\n1.000 31.000\\n12 3\\n20 6\\n30 1\\n5 1\\n3\\n1.000 30.000\\n1 10\\n10 8\\n20 8\\n\", \"2\\n4\\n1.000 31.000\\n12 0\\n20 6\\n31 0\\n5 0\\n3\\n1.000 30.000\\n1 10\\n10 8\\n20 5\\n\", \"2\\n... | Polycarp, Arkady's friend, prepares to the programming competition and decides to write a contest. The contest consists of $n$ problems and lasts for $T$ minutes. Each of the problems is defined by two positive integers $a_i$ and $p_i$ — its difficulty and the score awarded by its solution.
Polycarp's experience sugge... | 0.25 |
{"tests": "{\"inputs\": [\"4 6\\n0 0\\n2 4\\n7 5\\n10 0\\n\", \"5 2\\n1 3\\n4 4\\n5 7\\n7 5\\n10 4\\n\", \"5 2\\n1 3\\n4 4\\n5 1\\n7 5\\n10 4\\n\", \"4 6\\n0 0\\n4 4\\n7 5\\n10 0\\n\", \"5 1\\n1 5\\n4 4\\n6 7\\n7 3\\n10 1\\n\", \"4 1\\n0 0\\n1 4\\n7 2\\n10 0\\n\", \"4 6\\n0 0\\n2 1\\n7 5\\n10 0\\n\", \"2 1\\n0 0\\n1 0\... | The hobbits Frodo and Sam are carrying the One Ring to Mordor. In order not to be spotted by orcs, they decided to go through the mountains.
The mountain relief can be represented as a polyline with n points (x_i, y_i), numbered from 1 to n (x_i < x_{i + 1} for 1 ≤ i ≤ n - 1). Hobbits start their journey at the point ... | 0 |
{"tests": "{\"inputs\": [\"5 3 3\\n0 3 8 5 12\\n1 2\\n1 3\\n2 5\\n\", \"5 3 3\\n0 3 8 5 12\\n1 2\\n1 3\\n1 5\", \"5 3 3\\n0 3 8 8 12\\n1 3\\n1 3\\n2 5\", \"5 3 3\\n0 3 8 8 12\\n1 2\\n1 3\\n2 5\", \"5 6 3\\n0 3 8 8 12\\n1 2\\n1 3\\n2 5\", \"5 3 1\\n0 3 8 8 12\\n1 3\\n1 3\\n2 5\", \"5 3 3\\n0 3 15 8 12\\n1 2\\n1 3\\n3 5\... | Nobody knows, but $N$ frogs live in Chef's garden.
Now they are siting on the X-axis and want to speak to each other. One frog can send a message to another one if the distance between them is less or equal to $K$.
Chef knows all $P$ pairs of frogs, which want to send messages. Help him to define can they or not!
Note ... | 0.125 |
{"tests": "{\"inputs\": [\"23\\n1 1 1\\n2 2 1\", \"23\\n1 2 1\\n2 1 1\", \"23\\n1 2 1\\n2 0 1\", \"23\\n0 2 1\\n2 0 1\", \"23\\n1 1 2\\n1 1 0\", \"23\\n1 1 1\\n2 0 1\", \"23\\n1 4 1\\n2 1 1\", \"23\\n1 1 2\\n2 3 0\", \"23\\n0 2 1\\n4 0 1\", \"23\\n1 8 1\\n2 1 1\", \"23\\n0 2 1\\n1 0 1\", \"23\\n1 1 2\\n2 0 0\", \"23\\n... | The squirrel Chokudai has N acorns. One day, he decides to do some trades in multiple precious metal exchanges to make more acorns.
His plan is as follows:
1. Get out of the nest with N acorns in his hands.
2. Go to Exchange A and do some trades.
3. Go to Exchange B and do some trades.
4. Go to Exchange A and do some... | 0 |
{"tests": "{\"inputs\": [\"5 6\\n1 2 3 4 5\\n\", \"5 5\\n1 2 3 4 5\\n\", \"4 3\\n1 3 2 3\\n\", \"5 1000000000\\n500000000 500000000 500000000 500000000 500000000\\n\", \"5 999999999\\n500000000 500000000 500000000 500000000 500000000\\n\", \"6 1000000000\\n999999995 999999996 999999997 999999998 999999999 1000000000\\n... | Monocarp wants to watch $n$ videos. Each video is only one minute long, but its size may be arbitrary. The $i$-th video has the size $a_i$ megabytes. All videos are published on the Internet. A video should be downloaded before it can be watched. Monocarp has poor Internet connection — it takes exactly $1$ minute to do... | 0 |
{"tests": "{\"inputs\": [\"1\\n5\\n0 0\\n0 1\\n0 2\\n0 3\\n12\\n0 0\\n1 1\\n2 0\\n3 1\\n4 1\\n5 1\\n6 2\\n7 2\\n8 2\\n9 3\\n10 3\\n10\\n0 2\\n1 2\\n2 2\\n3 2\\n2 1\\n5 1\\n6 1\\n7 1\\n8 1\\n0\", \"1\\n5\\n0 0\\n0 1\\n0 2\\n0 3\\n12\\n0 0\\n1 0\\n2 0\\n3 1\\n4 1\\n5 1\\n6 2\\n7 2\\n8 2\\n9 3\\n10 3\\n10\\n0 2\\n1 3\\n2 ... | Pablo Squarson is a well-known cubism artist. This year's theme for Pablo Squarson is "Squares". Today we are visiting his studio to see how his masterpieces are given birth.
At the center of his studio, there is a huuuuuge table and beside it are many, many squares of the same size. Pablo Squarson puts one of the squ... | 0.875 |
{"tests": "{\"inputs\": [\"3\\n0\\n\", \"300\\n1100100\\n\", \"5000\\n01000001011101000100001101101111011001000110010101110010000\\n\", \"5000\\n01000001011101010100001101101111011001000110010101110010000\", \"3\\n-1\", \"300\\n1100000\", \"3\\n-122\", \"3\\n1\", \"5000\\n01000001011001010100001101101111011001000110010... | Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the 0 key, the 1 key and the backspace key.
To begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this string is... | 0 |
{"tests": "{\"inputs\": [\"4\\n1 1 1\\n1 1 2\\n100 50 200\\n56220 47258 14497\\n\", \"1\\n1000000000000000000 500000000000000000 2\\n\", \"1\\n1000000000000000000 483271866988016482 2\\n\", \"4\\n1 1 1\\n1 0 2\\n100 50 200\\n56220 47258 14497\\n\", \"1\\n1000000000000000000 639232692548497767 2\\n\", \"4\\n1 1 1\\n0 0 ... | Theofanis decided to visit his uncle's farm. There are $s$ animals and $n$ animal pens on the farm. For utility purpose, animal pens are constructed in one row.
Uncle told Theofanis that a farm is lucky if you can distribute all animals in all pens in such a way that there are no empty pens and there is at least one c... | 0 |
{"tests": "{\"inputs\": [\"3 3 2\\n2\\n2\\n1\\n\", \"4 4 2\\n1\\n2\\n1\\n2\\n\", \"3 3 2\\n1\\n2\\n1\\n\", \"3 6 3\\n2\\n2\\n3\\n3\\n1\\n1\\n\", \"4 8 3\\n2\\n1\\n2\\n1\\n2\\n1\\n1\\n1\\n\", \"4 8 4\\n4\\n4\\n4\\n4\\n4\\n4\\n4\\n4\\n\", \"4 8 4\\n2\\n3\\n2\\n3\\n2\\n3\\n2\\n3\\n\", \"10 120 15\\n6\\n11\\n9\\n11\\n3\\n1... | This is an interactive problem. Refer to the Interaction section below for better understanding.
Ithea and Chtholly want to play a game in order to determine who can use the kitchen tonight.
<image>
Initially, Ithea puts n clear sheets of paper in a line. They are numbered from 1 to n from left to right.
This game ... | 0 |
{"tests": "{\"inputs\": [\"100\\nkqrminhwirfjvnliauxbnltmdxexqgocagqkwahhrnqqddyfayhnkdaoegowpfbpmtaluksoxkhdpiiphresxgjcpabffdwtwyftjbljnsmdcvulnbenkppaprhxwertfaopbayquotykqlasrodkgfcamawsstxuknxmpohekjqbuqvohyyqeeqseqlykktwarjpisvscmwygsopupgbtaubsgafswctqllaeiujwrifnwvipejlggmynpeiogeftqhbbdkawsgkscskifvpllobbvkpeo... | Sherlock and Watson are playing swapping game. Watson gives to Sherlock a string S on which he has performed K swaps. You need to help Sherlock in finding the original string.
One swap on a string is performed in this way:
Assuming 1 indexing, the i'th letter from the end is inserted
between i'th and (i+1)'th l... | 0 |
{"tests": "{\"inputs\": [[{\"freezing temps\": 10, \"clear skies\": -2}], [{\"happiness\": -5, \"clear skies\": -2}], [{}], [{\"dragons\": 100, \"evil wizards\": 110, \"trolls\": 50}], [{\"white magic\": -250}]], \"outputs\": [[\"It took 260 licks to get to the tootsie roll center of a tootsie pop. The toughest challen... | How many licks does it take to get to the tootsie roll center of a tootsie pop?
A group of engineering students from Purdue University reported that its licking machine, modeled after a human tongue, took an average of 364 licks to get to the center of a Tootsie Pop. Twenty of the group's volunteers assumed the lickin... | 0 |
{"tests": "{\"inputs\": [\"()))()))))())(()))))))))()()()(()))()((()()()(()))()()()()((((())))))()))))(((())(()))())(())((()(((\\n)\\n\", \")(()(((((()))(()))((()((((((()(())))((()()))()(())))(()))))()(()((((()(())))((()((((())(()))((())))))()()()(()()(()(())()(())()((()()())())()()))()())()((((())((()()))(())((())()()... | You are given two bracket sequences (not necessarily regular) s and t consisting only of characters '(' and ')'. You want to construct the shortest regular bracket sequence that contains both given bracket sequences as subsequences (not necessarily contiguous).
Recall what is the regular bracket sequence:
* () is t... | 0 |
{"tests": "{\"inputs\": [\"1 3\\n\", \"2 4\\n\", \"2 8\", \"1 10\", \"1 4\", \"2 3\", \"2 10\", \"4 3\", \"7 3\", \"7 6\", \"7 4\", \"7 5\", \"4 5\", \"1 5\", \"1 2\", \"0 2\", \"-1 2\", \"2 1\", \"1 1\", \"2 0\", \"2 6\", \"3 3\", \"7 1\", \"5 4\", \"7 10\", \"5 5\", \"2 5\", \"2 9\", \"3 6\", \"5 3\", \"7 12\", \"5 8... | Based on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below.
Given two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group.
-----Constraints-----
- x and y are integers.
- 1 ≤ x < y ≤ 12
-----Input-----
Input is given from Stand... | 0 |
{"tests": "{\"inputs\": [\"3 2\\n2 3\", \"5 1\\n2 3\", \"3 2\\n1 2\", \"3 2\\n1 3\", \"4 2\\n1 3\", \"2 2\\n2 2\", \"5 2\\n2 3\", \"3 1\\n1 2\", \"3 3\\n1 3\", \"4 3\\n1 3\", \"2 2\\n4 2\", \"3 1\\n1 0\", \"3 2\\n1 5\", \"2 2\\n4 1\", \"2 1\\n2 3\", \"3 2\\n2 5\", \"0 2\\n4 2\", \"2 0\\n2 3\", \"3 2\\n3 5\", \"1 2\\n4 ... | B: Nakajima, let's do that! --Match Peas War -
problem
Nakajima "Uhh ..."
Isono "Nakajima, are you okay?"
Nakajima "... I feel like I was having an unpleasant dream."
Isono "What kind of dream do you have?"
Nakajima "Dream to play infinitely"
Isono "I don't know what it means. Well, Nakajima, let's do that!"
Na... | 0 |
{"tests": "{\"inputs\": [\"6\\nW 0 2\\nW 1 2\\nD 0\\nW 2 4\\nR 3\\nR 2\\n1\\nR 1000000000\\n0\", \"6\\nW 0 2\\nW 0 2\\nD 0\\nW 2 4\\nR 3\\nR 2\\n1\\nR 1000000000\\n0\", \"6\\nW 0 2\\nW 0 2\\nD -1\\nW 2 4\\nR 2\\nR 2\\n1\\nR 0000000000\\n0\", \"6\\nW 0 2\\nW 1 2\\nD 0\\nW 2 4\\nR 5\\nR 2\\n1\\nR 1000000000\\n0\", \"6\\n... | You are a programmer on the development team for new recording media. This recording medium can be randomly accessed for reading and erasing data. On the other hand, when writing data, access is always performed in order from the beginning, and only the first free space found can be written.
You have begun to build a ... | 0 |
{"tests": "{\"inputs\": [[\"test case\"], [\"camel case method\"], [\"say hello \"], [\" camel case word\"], [\"\"]], \"outputs\": [[\"TestCase\"], [\"CamelCaseMethod\"], [\"SayHello\"], [\"CamelCaseWord\"], [\"\"]]}", "source": "primeintellect"} | ```if-not:swift
Write simple .camelCase method (`camel_case` function in PHP, `CamelCase` in C# or `camelCase` in Java) for strings. All words must have their first letter capitalized without spaces.
```
```if:swift
Write a simple `camelCase` function for strings. All words must have their first letter capitalized and ... | 0 |
{"tests": "{\"inputs\": [[[1, 1], [0, 1], 2], [[1, 1], [0, 1], 3], [[1, 1], [0, 1], 4], [[3, 5, 2], [0, 1, 2], 4], [[7, 3, 4, 1], [1, 1], 6]], \"outputs\": [[2], [3], [5], [17], [2]]}", "source": "primeintellect"} | Leonardo Fibonacci in a rare portrait of his younger days
I assume you are all familiar with the famous Fibonacci sequence, having to get each number as the sum of the previous two (and typically starting with either `[0,1]` or `[1,1]` as the first numbers).
While there are plenty of variation on it ([including](http... | 0 |
{"tests": "{\"inputs\": [\"2 3\\n\", \"3 2\\n\", \"4 2\\n\", \"2 200\\n\", \"3 200\\n\"], \"outputs\": [\"1 1 1 \\n\", \"3 3 \\n\", \"6 12 \\n\", \"1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... | This time around, Baby Ehab will play with permutations. He has $n$ cubes arranged in a row, with numbers from $1$ to $n$ written on them. He'll make exactly $j$ operations. In each operation, he'll pick up $2$ cubes and switch their positions.
He's wondering: how many different sequences of cubes can I have at the en... | 0 |
{"tests": "{\"inputs\": [\"2\\n10 100\\n100 270\\n2\\n10 100\\n100 280\\n3\\n100 150\\n10 360\\n40 450\\n3\\n100 150\\n9 360\\n40 440\\n2\\n100 10\\n50 200\\n2\\n100 100\\n50 110\\n1\\n15 10\\n4\\n1 10\\n2 20\\n3 100\\n90 200\\n0\", \"2\\n10 100\\n100 270\\n2\\n10 100\\n110 280\\n3\\n100 150\\n10 360\\n40 450\\n3\\n100... | "Balloons should be captured efficiently", the game designer says. He is designing an oldfashioned game with two dimensional graphics. In the game, balloons fall onto the ground one after another, and the player manipulates a robot vehicle on the ground to capture the balloons. The player can control the vehicle to mov... | 0 |
{"tests": "{\"inputs\": [\"3 2\\n10 50 0 50 70 100\\n10 20 20 70 90 60\\n40 60 20 90 90 70\", \"3 2\\n10 50 0 50 70 100\\n10 20 20 70 90 60\\n40 60 20 90 90 98\", \"3 2\\n10 50 0 50 70 000\\n10 20 20 70 90 60\\n40 60 20 90 90 98\", \"3 2\\n20 50 0 50 70 000\\n10 35 20 70 90 60\\n40 111 20 102 90 131\", \"3 2\\n30 50 0 ... | problem
To the west of the Australian continent is the wide Indian Ocean. Marine researcher JOI is studying the properties of N species of fish in the Indian Ocean.
For each type of fish, a rectangular parallelepiped habitat range is determined in the sea. Fish can move anywhere in their habitat, including boundaries... | 0.75 |
{"tests": "{\"inputs\": [\"3\\n20 90 100\\n\", \"13\\n987069 989619 960831 976342 972924 961800 954209 956033 998067 984513 977987 963504 985482\\n\", \"3\\n20 100 50\\n\", \"2\\n100 20\\n\", \"5\\n742710 834126 850058 703320 972844\\n\", \"7\\n765898 894083 551320 290139 300748 299067 592728\\n\", \"12\\n8 10 4 6 6 4 ... | There are n water tanks in a row, i-th of them contains a_i liters of water. The tanks are numbered from 1 to n from left to right.
You can perform the following operation: choose some subsegment [l, r] (1≤ l ≤ r ≤ n), and redistribute water in tanks l, l+1, ..., r evenly. In other words, replace each of a_l, a_{l+1},... | 0 |
{"tests": "{\"inputs\": [[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]], [[9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9]], [[10, 10, 10, 10, 10, 10, 10, 10, 10... | # Task
Your task is to write a function for calculating the score of a 10 pin bowling game. The input for the function is a list of pins knocked down per roll for one player. Output is the player's total score.
# Rules
## General rules
Rules of bowling in a nutshell:
* A game consists of 10 frames. In each frame th... | 0 |
{"tests": "{\"inputs\": [[0], [360], [90], [180], [270], [30], [40], [45], [50], [60]], \"outputs\": [[\"12:00\"], [\"12:00\"], [\"03:00\"], [\"06:00\"], [\"09:00\"], [\"01:00\"], [\"01:20\"], [\"01:30\"], [\"01:40\"], [\"02:00\"]]}", "source": "primeintellect"} | # Story
Due to lack of maintenance the minute-hand has fallen off Town Hall clock face.
And because the local council has lost most of our tax money to a Nigerian email scam there are no funds to fix the clock properly.
Instead, they are asking for volunteer programmers to write some code that tell the time by only... | 0 |
{"tests": "{\"inputs\": [\"23\\n1 1 3 1\\n3 1 3 3\\n3 3 1 3\\n1 3 1 5\\n1 5 3 5\\n5 2 7 2\\n7 2 7 4\\n7 4 5 4\\n5 4 5 6\\n5 6 7 6\\n11 4 13 4\\n13 0 15 0\\n15 0 15 4\\n18 2 18 2\\n21 5 23 5\\n21 5 21 7\\n21 7 23 7\\n23 7 23 8\\n23 9 21 9\\n24 0 26 0\\n24 0 24 4\\n24 4 26 4\\n26 0 26 4\", \"23\\n1 1 3 1\\n3 1 3 3\\n3 3 ... | Hint
* One grid may be filled more than once
* Even if it can be represented by one line segment such as '1', it may be represented by two or more line segments.
Sample Input 1
Formula for Sample Input 1.
Sample Input 2
Sample Input 2 formula. Another character may get inside the smallest rectangle that covers one... | 0 |
{"tests": "{\"inputs\": [\"7\\n0 1\\n1 2\\n2 3\\n0 4\\n0 5\\n0 6\", \"7\\n0 1\\n1 2\\n0 3\\n3 4\\n0 5\\n0 6\", \"3\\n0 2\\n0 1\", \"7\\n0 1\\n1 2\\n0 3\\n3 4\\n0 5\\n1 6\", \"3\\n1 2\\n0 1\", \"7\\n0 1\\n1 2\\n2 3\\n2 4\\n0 5\\n0 6\", \"7\\n0 1\\n0 2\\n2 3\\n0 4\\n0 5\\n0 6\", \"7\\n0 1\\n1 2\\n1 3\\n3 4\\n0 5\\n1 6\",... | There are N towers in the town where Ikta lives. Each tower is given a different number from 0 to N-1, and the tower with number i is called tower i. Curious Ikta was interested in the height of the N towers and decided to make a table T showing the magnitude relationship between them. T has N × N elements, and each el... | 0 |
{"tests": "{\"inputs\": [[100], [40], [39], [5], [0]], \"outputs\": [[\"Your plant has had more than enough water for today!\"], [\"Your plant has had more than enough water for today!\"], [\"You need to give your plant 1mm of water\"], [\"You need to give your plant 35mm of water\"], [\"You need to give your plant 40m... | You have an award-winning garden and everyday the plants need exactly 40mm of water. You created a great piece of JavaScript to calculate the amount of water your plants will need when you have taken into consideration the amount of rain water that is forecast for the day. Your jealous neighbour hacked your computer an... | 0 |
{"tests": "{\"inputs\": [[[\"hello\", \"world\"], \"43556\"], [[\"good\", \"home\", \"new\"], \"4663\"], [[\"gone\", \"hood\", \"good\", \"old\"], \"4663\"], [[\"Hello\", \"world\"], \"43556\"], [[\"gOOD\", \"hOmE\", \"NeW\"], \"4663\"], [[\"goNe\", \"hood\", \"GOOD\", \"old\"], \"4663\"], [[], \"43556\"], [[\"gold\"],... | The T9 typing predictor helps with suggestions for possible word combinations on an old-style numeric keypad phone. Each digit in the keypad (2-9) represents a group of 3-4 letters. To type a letter, press once the key which corresponds to the letter group that contains the required letter. Typing words is done by typi... | 0 |
{"tests": "{\"inputs\": [\"3 2\\n1 2\\n1 3\\n\", \"3 1\\n1 2\\n2 3\\n\", \"20 7\\n9 7\\n3 7\\n15 9\\n1 3\\n11 9\\n18 7\\n17 18\\n20 1\\n4 11\\n2 11\\n12 18\\n8 18\\n13 2\\n19 2\\n10 9\\n6 13\\n5 8\\n14 1\\n16 13\\n\", \"2 1\\n1 2\\n\", \"3 1\\n1 2\\n1 3\\n\", \"3 0\\n1 2\\n2 3\\n\", \"20 7\\n9 7\\n3 7\\n15 9\\n1 4\\n11... | Writing light novels is the most important thing in Linova's life. Last night, Linova dreamed about a fantastic kingdom. She began to write a light novel for the kingdom as soon as she woke up, and of course, she is the queen of it.
<image>
There are n cities and n-1 two-way roads connecting pairs of cities in the ki... | 0 |
{"tests": "{\"inputs\": [\"10\\n470606482521 533212137322 116718867454 746976621474 457112271419 815899162072 641324977314 88281100571 9231169966 455007126951\\n26 83 30 59 000 88 84 91 54 61\", \"14\\n2094 5400 6231 5800 6001 5200 6350 7133 7986 8012 7537 7013 6477 5912\\n34 54 61 32 52 61 21 43 65 12 45 21 1 4\", \"5... | You are playing a game and your goal is to maximize your expected gain. At the beginning of the game, a pawn is put, uniformly at random, at a position p\in\\{1,2,\dots, N\\}. The N positions are arranged on a circle (so that 1 is between N and 2).
The game consists of turns. At each turn you can either end the game, ... | 0 |
{"tests": "{\"inputs\": [[[0, 0, 17], 1], [[1, 1, 15], 2], [[34, 32, 35], 0], [[34, 32, 35], 1], [[33, 0, 35], 2], [[673905669, 673905681, 174867657], 2], [[74356, 0, 0], 0], [[1, 2147483646, 1], 1], [[0, 1, 0], 2], [[0, 1, 0], 1], [[0, 333, 0], 0]], \"outputs\": [[-1], [1], [35], [-1], [33], [673905681], [0], [1], [-1... | **Story**
On some island lives a chameleon population. Chameleons here can be of only one of three colors - red, green and blue. Whenever two chameleons of different colors meet, they can change their colors to a third one (i.e. when red and blue chameleons meet, they can both become green). There is no other way for... | 0 |
{"tests": "{\"inputs\": [\"2\\n3\\n0 2 2\\n4\\n2 3 1 10\\n\", \"15\\n2\\n660632533 660632533\\n2\\n774306959 774306959\\n2\\n971739496 784083784\\n2\\n775353256 672614891\\n2\\n403290217 403290217\\n2\\n651261320 651261320\\n2\\n894672621 894672621\\n2\\n46281693 620415865\\n2\\n92929999 409128591\\n2\\n26890011 630323... | Baby Ehab is known for his love for a certain operation. He has an array $a$ of length $n$, and he decided to keep doing the following operation on it:
he picks $2$ adjacent elements; he then removes them and places a single integer in their place: their bitwise XOR . Note that the length of the array decreases by one... | 0.5 |
{"tests": "{\"inputs\": [\"5\\n2 2 1 2\\n9 5\\n1 17\\n3 2 2 1\\n6 1 20\\n8 18 3\\n8\\n5 4 1 3\\n5 5 4 5 5\\n8 2 1 9 7\\n1 1 3 5 1\\n7 2 7 1 3\\n6 5 6 2\\n2 3 5 8 2 7\\n1 6 9 4 5 1\\n2 5 5 4 2 2\\n5 4 2 5 3 3\\n7 1 5 1 5 6\\n6\\n3 3 2 2\\n2 9 2\\n9 1 9\\n2 9 2\\n2 2 1 1\\n1 3\\n5 7\\n0\", \"5\\n2 2 1 2\\n6 5\\n1 17\\n3 ... | problem
Do you know Just Odd Inventions? The business of this company is to "just odd inventions". Here we call it JOI for short.
JOI has two offices, each of which has square rooms of the same size arranged in a grid pattern. All the rooms that are in contact with each other have an ID card authentication function. ... | 0 |
{"tests": "{\"inputs\": [\"3\\n4 2\\nabca\\n1 3\\n10 5\\ncodeforces\\n2 8 3 2 9\\n26 10\\nqwertyuioplkjhgfdsazxcvbnm\\n20 10 1 2 3 5 10 5 9 4\\n\", \"1\\n11 2\\nthisisatest\\n3 5\\n\", \"2\\n2 2\\nyz\\n1 1\\n2 2\\nyz\\n1 1\\n\", \"1\\n11 2\\nthisisatest\\n3 5\\n\", \"2\\n2 2\\nyz\\n1 1\\n2 2\\nzy\\n1 1\\n\", \"1\\n11 2... | You want to perform the combo on your opponent in one popular fighting game. The combo is the string $s$ consisting of $n$ lowercase Latin letters. To perform the combo, you have to press all buttons in the order they appear in $s$. I.e. if $s=$"abca" then you have to press 'a', then 'b', 'c' and 'a' again.
You know t... | 0.875 |
{"tests": "{\"inputs\": [[26], [8], [14], [80], [100], [50], [10], [101]], \"outputs\": [[\"More than a handful!\"], [\"Hardly any\"], [\"More than a handful!\"], [\"Woah that's a lot of dogs!\"], [\"Woah that's a lot of dogs!\"], [\"More than a handful!\"], [\"Hardly any\"], [\"101 DALMATIONS!!!\"]]}", "source": "prim... | Your friend has been out shopping for puppies (what a time to be alive!)... He arrives back with multiple dogs, and you simply do not know how to respond!
By repairing the function provided, you will find out exactly how you should respond, depending on the number of dogs he has.
The number of dogs will always be a n... | 0 |
{"tests": "{\"inputs\": [\"4\\n8 2 5\\n00110010\\n8 1 1\\n00110010\\n9 100000000 100000000\\n010101010\\n2 5 1\\n00\\n\", \"2\\n2 3 5\\n00\\n12 4 7\\n011101011100\\n\", \"2\\n2 3 5\\n00\\n12 4 7\\n011101011100\\n\", \"2\\n8 2 5\\n01111110\\n6 2 5\\n001010\\n\", \"2\\n2 3 8\\n00\\n12 4 7\\n011101011100\\n\", \"2\\n8 2 5... | You are responsible for installing a gas pipeline along a road. Let's consider the road (for simplicity) as a segment $[0, n]$ on $OX$ axis. The road can have several crossroads, but for simplicity, we'll denote each crossroad as an interval $(x, x + 1)$ with integer $x$. So we can represent the road as a binary string... | 0 |
{"tests": "{\"inputs\": [\"99681\\n\", \"8\\n\", \"831\\n\", \"9\\n\", \"233\\n\", \"1926\\n\", \"7\\n\", \"39393\\n\", \"4\\n\", \"2\\n\", \"5\\n\", \"1\\n\", \"14514\\n\", \"99998\\n\", \"418\\n\", \"82944\\n\", \"11\\n\", \"100000\\n\", \"1317\\n\", \"6\\n\", \"10\\n\", \"0\\n\", \"25252\\n\", \"34907\\n\", \"240\\n... | From beginning till end, this message has been waiting to be conveyed.
For a given unordered multiset of n lowercase English letters ("multi" means that a letter may appear more than once), we treat all letters as strings of length 1, and repeat the following operation n - 1 times:
* Remove any two elements s and t... | 0 |
{"tests": "{\"inputs\": [\"4 3\\n1 2\\n2 3\\n3 4\\n1 4\\n\", \"4 4\\n1 2\\n2 3\\n3 4\\n1 3\\n\", \"4 2\\n1 2\\n2 4\\n3 4\\n1 4\\n\", \"4 3\\n1 2\\n2 3\\n3 4\\n1 3\\n\", \"4 3\\n1 2\\n2 3\\n3 4\\n2 3\\n\", \"4 3\\n1 2\\n2 3\\n3 4\\n1 5\\n\", \"4 3\\n1 2\\n2 3\\n3 4\\n0 3\\n\", \"4 3\\n1 2\\n2 3\\n3 4\\n0 5\\n\", \"4 3\\... | LiLand is a country, consisting of n cities. The cities are numbered from 1 to n. The country is well known because it has a very strange transportation system. There are many one-way flights that make it possible to travel between the cities, but the flights are arranged in a way that once you leave a city you will ne... | 0 |
{"tests": "{\"inputs\": [\"3\\n331\\n666\\n343\", \"3\\n331\\n699\\n343\", \"3\\n494\\n95\\n343\", \"3\\n816\\n95\\n625\", \"3\\n2240\\n1\\n1224\", \"3\\n540\\n666\\n343\", \"3\\n595\\n172\\n931\", \"3\\n353\\n0\\n5640\", \"3\\n3\\n1\\n1\", \"3\\n331\\n95\\n343\", \"3\\n816\\n95\\n343\", \"3\\n816\\n95\\n931\", \"3\\n1... | The citizens of Byteland regularly play a game. They have blocks each denoting some integer from 0 to 9. These are arranged together in a random manner without seeing to form different numbers keeping in mind that the first block is never a 0. Once they form a number they read in the reverse order to check if the numbe... | 0 |
{"tests": "{\"inputs\": [\"2\\n2 2\\n3 5\\n3 7\\n10 16 18\", \"2\\n2 2\\n3 5\\n3 7\\n8 16 18\", \"2\\n2 2\\n3 8\\n3 7\\n8 16 18\", \"2\\n2 2\\n3 8\\n3 7\\n8 16 7\", \"2\\n2 1\\n5 8\\n3 7\\n8 16 7\", \"2\\n2 2\\n5 8\\n2 7\\n7 16 7\", \"2\\n2 2\\n3 5\\n3 7\\n10 1 18\", \"2\\n2 2\\n5 8\\n3 7\\n8 11 7\", \"2\\n2 1\\n5 8\\n... | Read problems statements in Mandarin Chinese and Russian.
Grapes of Coderpur are very famous. Devu went to the market and saw that there were N people selling grapes. He didn’t like it because things were not very structured. So, he gave a task to Dhinwa to make things better. If Dhinwa successfully completes the ta... | 0.625 |
{"tests": "{\"inputs\": [\"12 3\\n2 3 6\\n13 4\\n1 2 3 6\\n0 0\", \"12 3\\n2 3 6\\n12 4\\n2 2 3 6\\n0 0\", \"12 3\\n1 4 11\\n13 4\\n1 2 3 6\\n0 0\", \"7 3\\n4 1 29\\n13 4\\n2 2 6 6\\n0 0\", \"17 3\\n2 4 11\\n13 4\\n1 2 3 6\\n0 0\", \"15 3\\n2 6 11\\n13 4\\n1 2 3 6\\n0 0\", \"21 3\\n2 3 19\\n13 4\\n1 2 4 6\\n0 0\", \"7 ... | She is an apprentice wizard. She first learned the magic of manipulating time. And she decided to open a liquor store to earn a living. It has to do with the fact that all the inhabitants of the country where she lives love alcohol. Residents especially like sake that has been aged for many years, and its value increas... | 0 |
{"tests": "{\"inputs\": [\"999998\\n\", \"4\\n\", \"123455\\n\", \"10000\\n\", \"998756\\n\", \"1000000\\n\", \"999879\\n\", \"345612\\n\", \"6\\n\", \"999997\\n\", \"990001\\n\", \"8\\n\", \"623423\\n\", \"2\\n\", \"345634\\n\", \"777777\\n\", \"9009\\n\", \"100000\\n\", \"2009\\n\", \"976438\\n\", \"3\\n\", \"434563\... | Let's assume that we have a pair of numbers (a, b). We can get a new pair (a + b, b) or (a, a + b) from the given pair in a single step.
Let the initial pair of numbers be (1,1). Your task is to find number k, that is, the least number of steps needed to transform (1,1) into the pair where at least one number equals n... | 0 |
{"tests": "{\"inputs\": [[\"Timmy\", \"password\"], [\"Timmy\", \"h4x0r\"], [\"Alice\", \"alice\"], [\"Timmy\", \"password\\\"||\\\"\\\"==\\\"\"], [\"Admin\", \"gs5bw\\\"||1==1//\"]], \"outputs\": [[\"Successfully Logged in!\"], [\"Wrong username or password!\"], [\"Successfully Logged in!\"], [\"Wrong username or pass... | # Invalid Login - Bug Fixing #11
Oh NO! Timmy has moved divisions... but now he's in the field of security. Timmy, being the top coder he is, has allowed some bad code through. You must help Timmy and filter out any injected code!
## Task
Your task is simple, search the password string for any injected code (Injecte... | 0 |
{"tests": "{\"inputs\": [\"4\\nababcd\\nabcba\\na\\nb\\ndefi\\nfed\\nxyz\\nx\\n\", \"3\\nababc\\nabcba\\nfeded\\ndefed\\nababcfeded\\nabcdebafed\\n\", \"1\\nbbbaaaaabbabaabbbbaabbbbabbaabbaababbbbbbababbababbbaaaaaaabaababbbaababbbbababbbabbbbbabaabbaaaabaa\\nbbbababbaabbbbbaabaaabaababaaaabaabbbabbababaaabba\\n\", \"3... | You are given a string $s$. You can build new string $p$ from $s$ using the following operation no more than two times: choose any subsequence $s_{i_1}, s_{i_2}, \dots, s_{i_k}$ where $1 \le i_1 < i_2 < \dots < i_k \le |s|$; erase the chosen subsequence from $s$ ($s$ can become empty); concatenate chosen subsequenc... | 0 |
{"tests": "{\"inputs\": [[[1, 2, 3], 3], [[1, 2, 3], 6], [[1, 2, 3], 7], [[1, 2, 3, 6], 6], [[1, 2, 3, 4, 5, 6], 15], [[0, 0, 2], 4], [[0, 0, 2, 2], 4], [[-3, -2, -2, -1, 0, 1, 2, 3, 4], 4], [[-3, -2, -2, -1, 0, 1, 2, 3, 4], 0], [[-3, -2, -1, 0, 1, 2, 3, 4], 4]], \"outputs\": [[[1, 3]], [[2, 3]], [null], [[1, 6]], [[3,... | This is the simple version of Fastest Code series. If you need some challenges, please try the [Performance version](http://www.codewars.com/kata/5714594d2817ff681c000783)
## Task:
Give you a number array ```numbers``` and a number ```c```.
Find out a pair of numbers(we called them number a and number b) from t... | 0 |
{"tests": "{\"inputs\": [\"3 5 7 5\\n\", \"4 5 7 5\\n\", \"37 4 2 3\\n\", \"40 5 7 5\\n\", \"37 4 3 3\", \"5 4 3 3\", \"5 4 2 3\", \"0 4 2 3\", \"8 5 7 5\", \"3 3 7 5\", \"7 4 2 3\", \"37 3 3 3\", \"5 8 3 3\", \"8 4 2 3\", \"8 5 7 3\", \"7 4 1 3\", \"37 3 2 3\", \"7 8 3 3\", \"8 5 2 3\", \"8 4 7 3\", \"7 5 1 3\", \"7 3... | Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.
Iroha is looking for X,Y,Z-Haiku (defined below) in integer sequences.
Consider all integer sequences of length N whose elements are between 1 and 10, inclusive. Out of those 10^N sequences, how many co... | 0 |
{"tests": "{\"inputs\": [[\"abcdeXghi\", [\"\", \"\", \"CCCCC\", \"\", \"EEEEEEEEEE\", \"FFFFFF\", \"\", \"\", \"IIIIII\"]], [\"abcdefX\", []], [\"abcXdef\", []], [\"Xabcdef\", []], [\"abcdefghijklmX\", [\"\", \"\", \"\", \"BBBBBB\", \"\", \"\", \"\", \"\", \"CCCCC\"]], [\"abcdefghijkX\", [\"\", \"AAAAAAAAAA\", \"\", \... | # Story
Well, here I am stuck in another traffic jam.
*Damn all those courteous people!*
Cars are trying to enter the main road from side-streets somewhere ahead of me and people keep letting them cut in.
Each time somebody is let in the effect ripples back down the road, so pretty soon I am not moving at all.
(S... | 0 |
{"tests": "{\"inputs\": [\"4\\n3\\n1 2 3\\n4\\n3 1 2 4\\n3\\n2 3 1\\n6\\n2 4 6 1 3 5\\n\", \"4\\n3\\n1 2 3\\n4\\n3 1 2 4\\n3\\n2 3 1\\n6\\n2 4 12 1 3 5\\n\", \"4\\n3\\n1 2 3\\n4\\n3 1 2 2\\n3\\n2 1 1\\n6\\n2 4 7 1 6 10\\n\", \"4\\n3\\n1 0 4\\n4\\n3 1 2 4\\n3\\n2 3 1\\n6\\n2 4 6 1 5 1\\n\", \"4\\n3\\n1 2 3\\n4\\n3 1 2 4... | You are given an array $a$ of length $n$, which initially is a permutation of numbers from $1$ to $n$. In one operation, you can choose an index $i$ ($1 \leq i < n$) such that $a_i < a_{i + 1}$, and remove either $a_i$ or $a_{i + 1}$ from the array (after the removal, the remaining parts are concatenated).
For exampl... | 0 |
{"tests": "{\"inputs\": [\"10\\n2 3 4 0 0 1 1 3 4 2\\n\", \"2\\n6 0\\n\", \"10\\n0 0 0 0 0 0 0 0 1 0\\n\", \"5\\n2 2 2 2 2\\n\", \"10\\n2 3 4 0 0 1 1 3 4 3\\n\", \"2\\n6 1\\n\", \"5\\n2 2 2 1 2\\n\", \"2\\n1 0\\n\", \"10\\n2 1 4 0 0 1 1 3 4 3\\n\", \"2\\n6 2\\n\", \"5\\n2 1 2 1 2\\n\", \"2\\n0 0\\n\", \"10\\n2 1 4 0 0 ... | The New Year is coming! That's why many people today are busy preparing New Year presents. Vasily the Programmer is no exception.
Vasily knows that the best present is (no, it's not a contest) money. He's put n empty wallets from left to right in a row and decided how much money to put in what wallet. Vasily decided t... | 0 |
{"tests": "{\"inputs\": [\"100 37\\n20 20 3 35 36 14 30 9 33 36 32 46 43 22 43 50 34 6 13 25 1 34 10 6 21 30 19 17 1 23 9 23 38 21 7 43 49 28 33 42 4 19 39 23 12 42 31 13 26 23 1 26 24 48 10 6 12 48 40 18 10 26 9 5 22 45 46 23 46 34 34 45 3 7 16 39 14 29 48 1 12 37 4 20 29 26 35 38 20 47 39 29 12 35 4 32 26 1 50 33\\n\... | A median in an array with the length of n is an element which occupies position number <image> after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.
We define... | 0.125 |
{"tests": "{\"inputs\": [[1], [2], [3], [4], [5], [6], [10], [10000000]], \"outputs\": [[4], [10], [20], [35], [56], [83], [244], [489999753]]}", "source": "primeintellect"} | Many years ago, Roman numbers were defined by only `4` digits: `I, V, X, L`, which represented `1, 5, 10, 50`. These were the only digits used. The value of a sequence was simply the sum of digits in it. For instance:
```
IV = VI = 6
IX = XI = 11
XXL = LXX = XLX = 70
```
It is easy to see that this system is ambiguous,... | 0 |
{"tests": "{\"inputs\": [\"3\\n10 40\\n15 40\\n20 30\", \"4\\n1 2\\n3 3\\n3 4\\n4 1\", \"3\\n10 40\\n15 40\\n40 30\", \"4\\n1 2\\n3 3\\n3 7\\n4 1\", \"4\\n2 2\\n3 3\\n3 7\\n4 1\", \"3\\n10 40\\n15 40\\n20 32\", \"4\\n2 4\\n3 3\\n3 7\\n4 1\", \"3\\n10 36\\n15 40\\n20 32\", \"3\\n10 42\\n6 40\\n20 32\", \"4\\n1 4\\n1 3\\... | Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well.
Today's training is to gain dexterity that never mistypes by carefully stacking blocks. Since there are many building blocks, let's build a tall tower.
There are N blocks, and the i-th (... | 0 |
{"tests": "{\"inputs\": [\"5 10\\n1 3 3 2 3\", \"6 1000000000000\\n1 2 2 2 3 3\", \"6 1000000000000\\n1 2 2 4 3 3\", \"11 97\\n3 2 4 1 5 9 2 6 5 3 5\", \"6 1000000000000\\n1 1 2 4 3 3\", \"11 97\\n0 2 4 1 5 9 2 6 2 3 5\", \"11 97\\n0 2 4 2 5 4 2 6 2 3 5\", \"11 97\\n0 2 0 2 5 4 2 6 2 3 5\", \"11 97\\n0 0 0 2 5 4 2 6 2 ... | We have a sequence of N \times K integers: X=(X_0,X_1,\cdots,X_{N \times K-1}). Its elements are represented by another sequence of N integers: A=(A_0,A_1,\cdots,A_{N-1}). For each pair i, j (0 \leq i \leq K-1,\ 0 \leq j \leq N-1), X_{i \times N + j}=A_j holds.
Snuke has an integer sequence s, which is initially empty... | 0 |
{"tests": "{\"inputs\": [\"3 5\\n4 2 1\\n2 3 1\\n\", \"3 8\\n4 2 1\\n2 3 1\\n\", \"11 14\\n3 1 4 1 5 9 2 6 5 3 5\\n8 9 7 9 3 2 3 8 4 6 2\\n\", \"3 1\\n4 2 1\\n2 3 1\", \"3 6\\n4 2 1\\n2 3 1\", \"11 14\\n3 1 4 1 5 9 2 6 5 3 5\\n8 9 7 9 3 1 3 8 4 6 2\", \"3 1\\n8 2 1\\n2 3 1\", \"11 14\\n3 1 4 1 2 9 2 6 5 3 5\\n8 9 7 26 ... | Takahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The consumption coefficient of Member i is A_i.
In the contest, N foods numbered 1 through N will be presented, and the difficulty of F... | 0 |
{"tests": "{\"inputs\": [\"1 2\\n1\\n1\\n2\\n\", \"2 4\\n1 3\\n1\\n2\\n3\\n4\\n\", \"2 4\\n1 3\\n1\\n4\\n3\\n4\", \"2 4\\n1 3\\n1\\n2\\n3\\n3\", \"1 2\\n1 3\\n1\\n4\\n3\\n4\", \"2 4\\n1 3\\n1\\n2\\n3\\n5\", \"2 4\\n1 3\\n1\\n2\\n5\\n4\", \"1 2\\n2 3\\n1\\n4\\n3\\n4\", \"2 4\\n1 3\\n1\\n0\\n3\\n2\", \"1 1\\n1\\n0\\n0\",... | Devu has an array A consisting of N positive integers. He would like to perform following operation on array.
- Pick some two elements a, b in the array (a could be same as b, but their corresponding indices in the array should not be same).
Remove both the elements a and b and instead add a number x such that x lies ... | 0.625 |
{"tests": "{\"inputs\": [\"3\\n4\\n1 2 1 2\\n3\\n2 4 2\\n5\\n1 2 3 4 5\\n\", \"1\\n30\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\n\", \"1\\n13\\n1 2 3 4 5 6 7 8 9 10 11 12 13\\n\", \"2\\n3\\n1 2 1\\n4\\n1 1 1 1\\n\", \"1\\n4\\n1 2 3 34\\n\", \"1\\n43\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1... | Monocarp is playing a computer game. He's going to kill $n$ monsters, the $i$-th of them has $h_i$ health.
Monocarp's character has two spells, either of which he can cast an arbitrary number of times (possibly, zero) and in an arbitrary order:
choose exactly two alive monsters and decrease their health by $1$;
choo... | 0 |
{"tests": "{\"inputs\": [\"-+-\\n\", \"+---++--++\\n\", \"-+-++--+++-++++---+--+----+--+-+-+++-+++-+---++-++++-+--+--+--+-+-++-+-+-++++++---++--+++++-+--++--+-+--++-----+--+-++---+++---++----+++-++++--++-++-\\n\", \"++--++\\n\", \"-+--+-\\n\", \"-+-++-+-\\n\", \"-+-----++++--++-+-++\\n\", \"+++---+++---\\n\", \"+---+\\... | Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u... | 0 |
{"tests": "{\"inputs\": [\"3\\n5\\n6\\n1\", \"6\\n6\\n1\\n4\\n1\\n5\\n9\", \"5\\n6\\n8\\n1\\n1\\n3\", \"3\\n5\\n3\\n1\", \"6\\n6\\n1\\n4\\n1\\n1\\n9\", \"5\\n6\\n4\\n1\\n1\\n3\", \"3\\n0\\n3\\n1\", \"6\\n6\\n1\\n7\\n1\\n1\\n9\", \"5\\n6\\n4\\n1\\n2\\n3\", \"3\\n0\\n0\\n1\", \"6\\n6\\n1\\n7\\n0\\n1\\n9\", \"5\\n6\\n4\\n... | You are given N integers; the i-th of them is A_i. Find the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.
Constraints
* 2 \leq N \leq 10^5
* 1 \leq A_i \leq 10^9
* All values in input are integers.
Input
Input is given f... | 0 |
{"tests": "{\"inputs\": [\"2\\n1 2\\n\", \"10\\n1 2 1 3 2 4 2 5 8 1\\n\", \"10\\n1 2 2 3 2 4 2 5 8 1\", \"10\\n1 3 2 3 2 4 2 5 8 1\", \"10\\n1 3 2 3 2 4 4 5 8 1\", \"2\\n1 0\", \"10\\n1 2 1 3 2 4 1 5 8 1\", \"10\\n1 2 1 3 2 4 2 5 8 0\", \"10\\n1 3 2 4 2 4 2 5 8 1\", \"10\\n1 3 2 6 2 4 4 5 8 1\", \"2\\n1 1\", \"10\\n1 2... | Snuke loves constructing integer sequences.
There are N piles of stones, numbered 1 through N.
The pile numbered i consists of a_i stones.
Snuke will construct an integer sequence s of length Σa_i, as follows:
- Among the piles with the largest number of stones remaining, let x be the index of the pile with the smalle... | 0 |
{"tests": "{\"inputs\": [\"6\\nLRU\\nDURLDRUDRULRDURDDL\\nLRUDDLRUDRUL\\nLLLLRRRR\\nURDUR\\nLLL\\n\", \"6\\nLRU\\nDURLDRUDRULRDURDDL\\nLRUDDLRUDRUL\\nLLLLRRRR\\nURDUR\\nLLL\\n\", \"6\\nLRU\\nDURLDRUDRULRDURDDL\\nLURDURLDDURL\\nLLLLRRRR\\nURDUR\\nLLL\\n\", \"6\\nLRU\\nLDDRUDRLURDURDLRUD\\nLURDURLDDURL\\nLLLLRRRR\\nURDUR... | Recently you have bought a snow walking robot and brought it home. Suppose your home is a cell $(0, 0)$ on an infinite grid.
You also have the sequence of instructions of this robot. It is written as the string $s$ consisting of characters 'L', 'R', 'U' and 'D'. If the robot is in the cell $(x, y)$ right now, he can m... | 0 |
{"tests": "{\"inputs\": [[[1, 2, 3], [1, 2, 3]], [[1, 2, 3], [4, 5, 6]], [[1, 2, 3], [1, 2]], [[1, 0], [1, 2, 3]], [[1, 0, 3], [1, 2, 3], 3]], \"outputs\": [[[1, 2, 3]], [[5, 7, 7]], [[1, 2, 3]], [[1, 2, 3]], [[1, 2, 3]]]}", "source": "primeintellect"} | It started as a discussion with a friend, who didn't fully grasp some way of setting defaults, but I thought the idea was cool enough for a beginner kata: binary `OR` each matching element of two given arrays (or lists, if you do it in Python; vectors in c++) of integers and give the resulting ORed array [starts to sou... | 0 |
{"tests": "{\"inputs\": [\"12\\n161735902 211047202 430302156 450968417 628894325 707723857 731963982 822804784 880895728 923078537 971407775 1765707086\", \"3\\n1 2 5\", \"12\\n161735902 394362112 430302156 450968417 628894325 707723857 731963982 822804784 880895728 923078537 971407775 1765707086\", \"3\\n1 3 5\", \"1... | There are N slimes standing on a number line. The i-th slime from the left is at position x_i.
It is guaruanteed that 1 \leq x_1 < x_2 < \ldots < x_N \leq 10^{9}.
Niwango will perform N-1 operations. The i-th operation consists of the following procedures:
* Choose an integer k between 1 and N-i (inclusive) with equ... | 0 |
{"tests": "{\"inputs\": [\"33 57\\n\", \"99 55\\n\", \"37 19\\n\", \"31 32\\n\", \"99 20\\n\", \"37 39\\n\", \"7 10\\n\", \"57 15\\n\", \"99 177\\n\", \"99 193\\n\", \"19 12\\n\", \"13 21\\n\", \"57 67\\n\", \"23 39\\n\", \"97 100\\n\", \"99 99\\n\", \"69 17\\n\", \"55 55\\n\", \"39 73\\n\", \"7 7\\n\", \"9 5\\n\", \"9... | The city of Fishtopia can be imagined as a grid of 4 rows and an odd number of columns. It has two main villages; the first is located at the top-left cell (1,1), people who stay there love fishing at the Tuna pond at the bottom-right cell (4, n). The second village is located at (4, 1) and its people love the Salmon p... | 0 |
{"tests": "{\"inputs\": [\"10 6\\n100 100 100 100 100 100 100 100 100 100\\n6\\n4\\n10\\n2\\n4\\n7\\n5\\n\", \"90 15\\n78 78 57 46 96 3 2 79 26 58 95 79 33 33 54 60 26 93 85 74 51 100 68 40 51 14 78 0 73 61 17 59 8 40 87 93 57 72 38 92 20 15 77 74 97 59 33 45 69 71 71 32 25 58 86 26 13 36 6 73 56 36 30 43 38 26 58 6 74... | Vasya is about to take his first university exam in about several minutes. And it's not just some ordinary exam, it's on mathematical analysis. Of course, right now Vasya can only think of one thing: what the result of his talk with the examiner will be...
To prepare for the exam, one has to study proofs of n theorems... | 0 |
{"tests": "{\"inputs\": [[[1, 2], [1]], [[1, 2, 2], [1]], [[1, 2, 2], [2]], [[1, 2, 2], []], [[], [1, 2]]], \"outputs\": [[[2]], [[2, 2]], [[1]], [[1, 2, 2]], [[]]]}", "source": "primeintellect"} | Your goal in this kata is to implement a difference function, which subtracts one list from another and returns the result.
It should remove all values from list `a`, which are present in list `b`.
```python
array_diff([1,2],[1]) == [2]
```
If a value is present in `b`, all of its occurrences must be removed from th... | 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\\n0100\\n1111\\n5 5\\n01011\\n11001\\n00010\\n11011\\n10000\\n2 3\\n011\\n101\\n\",... | This is the easy 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\": [\"4\\n 0 2 2 2\\n 2 0 2 2\\n 2 2 0 2\\n 2 2 2 0\\n4\\n 0 2 4 4\\n 2 0 4 4\\n 4 4 0 2\\n 4 4 2 1\\n2\\n 0 12\\n 12 0\\n0\", \"4\\n 0 2 2 2\\n 2 0 2 2\\n 2 2 -1 2\\n 2 2 2 0\\n4\\n 0 2 4 4\\n 2 0 4 4\\n 4 4 0 2\\n 4 ... | Gilbert is the network admin of Ginkgo company. His boss is mad about the messy network cables on the floor. He finally walked up to Gilbert and asked the lazy network admin to illustrate how computers and switches are connected. Since he is a programmer, he is very reluctant to move throughout the office and examine c... | 0.125 |
{"tests": "{\"inputs\": [\"1 1\\nq\\n\", \"1 500\\nwljexjwjwsxhascgpyezfotqyieywzyzpnjzxqebroginhlpsvtbgmbckgqixkdveraxlgleieeagubywaacncxoouibbhwyxhjiczlymscsqlttecvundzjqtuizqwsjalmizgeekugacatlwhiiyaamjuiafmyzxadbxsgwhfawotawfxkpyzyoceiqfppituvaqmgfjinulkbkgpnibaefqaqiptctoqhcnnfihmzijnwpxdikwefpxicbspdkppznpiqrpkyv... | According to a new ISO standard, a flag of every country should have, strangely enough, a chequered field n × m, each square should be wholly painted one of 26 colours. The following restrictions are set:
* In each row at most two different colours can be used.
* No two adjacent squares can be painted the same c... | 0 |
{"tests": "{\"inputs\": [\"70 92 20 40\\n99 92 9 49\\n\", \"0 73 20 40\\n59 73 39 100\\n\", \"39 90 20 40\\n47 90 28 31\\n\", \"-46 55 20 40\\n-17 55 7 11\\n\", \"31 40 37 76\\n48 65 66 98\\n\", \"-81 -55 20 40\\n19 20 83 85\\n\", \"-27 -68 20 40\\n2 -68 9 48\\n\", \"48 30 20 40\\n77 37 10 99\\n\", \"-64 -47 20 40\\n-5... | A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine.
Let us remind you that a ring is a region located between two... | 0 |
{"tests": "{\"inputs\": [\"7\\n3 6\\n1 2\\n3 1\\n7 4\\n5 7\\n1 4\\n\", \"4\\n1 4\\n4 2\\n2 3\\n\", \"4\\n1 4\\n4 3\\n2 3\", \"7\\n3 6\\n2 2\\n3 1\\n7 4\\n5 7\\n1 4\", \"7\\n3 6\\n2 2\\n3 1\\n7 4\\n4 7\\n1 4\", \"7\\n3 6\\n1 2\\n3 2\\n7 4\\n5 7\\n1 4\", \"7\\n3 6\\n2 2\\n3 1\\n5 4\\n4 7\\n1 4\", \"4\\n1 2\\n4 2\\n2 3\",... | Fennec and Snuke are playing a board game.
On the board, there are N cells numbered 1 through N, and N-1 roads, each connecting two cells. Cell a_i is adjacent to Cell b_i through the i-th road. Every cell can be reached from every other cell by repeatedly traveling to an adjacent cell. In terms of graph theory, the gr... | 0.125 |
{"tests": "{\"inputs\": [\"14\\n\", \"38\\n\", \"25\\n\", \"22\\n\", \"26\\n\", \"20\\n\", \"34\\n\", \"8\\n\", \"32\\n\", \"16\\n\", \"30\\n\", \"28\\n\", \"18\\n\", \"37\\n\", \"10\\n\", \"39\\n\", \"35\\n\", \"15\\n\", \"27\\n\", \"12\\n\", \"31\\n\", \"24\\n\", \"5\\n\", \"19\\n\", \"6\\n\", \"21\\n\", \"23\\n\", \... | Consider the following equation:
<image> where sign [a] represents the integer part of number a.
Let's find all integer z (z > 0), for which this equation is unsolvable in positive integers. The phrase "unsolvable in positive integers" means that there are no such positive integers x and y (x, y > 0), for which the ... | 0 |
{"tests": "{\"inputs\": [\"9\\n1000000000 0 0 1000000000 1000000000 0 0 1000000000 1000000000\\n\", \"4\\n1 0 1 0\\n\", \"3\\n0 0 0\\n\", \"17\\n1000000000 0 0 1000000000 1000000000 0 0 1000000000 1000000000 0 0 1000000000 1000000000 0 0 1000000000 1000000000\\n\", \"5\\n1000000000 0 0 1000000000 -1000000000\\n\", \"50... | Something happened in Uzhlyandia again... There are riots on the streets... Famous Uzhlyandian superheroes Shean the Sheep and Stas the Giraffe were called in order to save the situation. Upon the arriving, they found that citizens are worried about maximum values of the Main Uzhlyandian Function f, which is defined as... | 0 |
{"tests": "{\"inputs\": [\"15 12\\n2 77\\n8 79\\n5 70\\n0 1\\n0 4\\n6 10\\n4 38\\n3 36\\n9 1\\n2 9\\n0 72\\n10 17\\n5 93\\n7 10\\n3 49\\n\", \"15 3\\n2 39237\\n6 42209\\n8 99074\\n2 140949\\n3 33788\\n15 7090\\n13 29599\\n1 183967\\n6 20161\\n7 157097\\n10 173220\\n9 167385\\n15 123904\\n12 30799\\n5 47324\\n\", \"10 2... | This problem consists of three subproblems: for solving subproblem C1 you will receive 4 points, for solving subproblem C2 you will receive 4 points, and for solving subproblem C3 you will receive 8 points.
Manao decided to pursue a fighter's career. He decided to begin with an ongoing tournament. Before Manao joined,... | 0 |
{"tests": "{\"inputs\": [\"-3 -2 9 6\\n3 -2 7 6\\n-1 0 5 0\\n2 2 0 -1\\n0 1 2 1\\n-3 -1 3 1\\n0 0 0 0\", \"-1 -2 8 12\\n3 -2 7 6\\n0 0 9 0\\n2 2 0 -1\\n1 1 2 1\\n-3 -1 3 1\\n0 0 0 0\", \"-1 -2 9 6\\n3 -2 7 6\\n-1 0 9 0\\n2 2 0 -1\\n1 2 2 0\\n-3 -1 3 1\\n0 0 0 0\", \"-3 -2 9 0\\n3 -2 4 6\\n-1 0 8 0\\n1 2 0 0\\n-1 1 2 1\... | With the motto "Creating your own path," a shrine created a fortune-telling fortune with its own hands. Ask the person who draws the lottery to throw six stones first, then the line segment connecting the first and second of the thrown stones, the line segment connecting the third and fourth, the fifth and six The fort... | 0 |
{"tests": "{\"inputs\": [\"10\\n2 4\\n2 5\\n1 3\\n10 7\\n1 6\\n2 8\\n9 5\\n8 6\\n10 6\", \"4\\n1 2\\n1 3\\n2 4\", \"10\\n2 4\\n2 5\\n1 3\\n3 7\\n1 6\\n2 8\\n9 5\\n8 6\\n10 6\", \"10\\n2 4\\n2 5\\n8 3\\n10 7\\n1 6\\n2 8\\n9 7\\n8 6\\n10 6\", \"10\\n2 4\\n2 5\\n1 3\\n10 7\\n1 6\\n2 8\\n9 5\\n8 6\\n10 2\", \"10\\n2 4\\n2 ... | There is a tree T with N vertices, numbered 1 through N. For each 1 ≤ i ≤ N - 1, the i-th edge connects vertices a_i and b_i.
Snuke is constructing a directed graph T' by arbitrarily assigning direction to each edge in T. (There are 2^{N - 1} different ways to construct T'.)
For a fixed T', we will define d(s,\ t) fo... | 0 |
{"tests": "{\"inputs\": [[[100, \"yes\"], [100, \"no\"]], [[350, \"no\"], [250, \"yes\"]], [[100, \"yes\"], [250, \"no\"]], [[0, \"yes\"], [150, \"no\"]], [[150, \"no\"], [0, \"yes\"]]], \"outputs\": [[\"Gryffindor wins!\"], [\"Slytherin wins!\"], [\"It's a draw!\"], [\"It's a draw!\"], [\"It's a draw!\"]]}", "source":... | It's the most hotly anticipated game of the school year - Gryffindor vs Slytherin! Write a function which returns the winning team.
You will be given two arrays with two values.
The first given value is the number of points scored by the team's Chasers and the second a string with a 'yes' or 'no' value if the team ... | 0 |
{"tests": "{\"inputs\": [\"1000\\n1 0 1\\n\", \"1\\n1000 1000 1000\\n\", \"3\\n0 0 0\\n\", \"10\\n0 0 0\\n\", \"173\\n0 0 374\\n\", \"492\\n971 305 807\\n\", \"239\\n995 385 267\\n\", \"624\\n553 828 109\\n\", \"814\\n711 408 545\\n\", \"9\\n8 2 0\\n\", \"1000\\n999 998 997\\n\", \"422\\n215 779 900\\n\", \"413\\n517 0... | As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this coordinate system, the distance between the center of the Universe and the point is calculated by the following formula: <ima... | 0.125 |
{"tests": "{\"inputs\": [\"3\\n4\\n1 5 5 5\\n4\\n1 1 1 5\\n3\\n5 5 2\\n\\n\", \"3\\n4\\n1 5 5 5\\n3\\n1 1 1 5\\n3\\n5 5 2\", \"3\\n4\\n1 5 5 5\\n3\\n1 2 1 5\\n3\\n5 5 2\", \"3\\n4\\n1 10 5 5\\n3\\n1 2 1 5\\n3\\n1 1 3\", \"3\\n4\\n1 5 5 6\\n4\\n1 1 1 5\\n3\\n5 5 2\", \"3\\n4\\n1 5 5 5\\n3\\n1 2 1 5\\n3\\n5 5 3\", \"3\\n... | Chef's new hobby is painting, but he learned the fact that it's not easy to paint 2D pictures in a hard way, after wasting a lot of canvas paper, paint and of course time. From now on, he decided to paint 1D pictures only.
Chef's canvas is N millimeters long and is initially all white. For simplicity, colors will be re... | 0 |
{"tests": "{\"inputs\": [\"codefestival\\n101\", \"xyz\\n1\", \"zyx\\n1\", \"cdoeffstival\\n101\", \"zyx\\n2\", \"cdoeffstival\\n111\", \"zyx\\n3\", \"lavitsffeodc\\n111\", \"xyz\\n2\", \"caoeffstivdl\\n111\", \"xyz\\n3\", \"xyz\\n5\", \"xyz\\n8\", \"zyx\\n0\", \"zyx\\n4\", \"b\\n25\", \"yxz\\n1\", \"cdoefestival\\n001... | Mr. Takahashi has a string s consisting of lowercase English letters. He repeats the following operation on s exactly K times.
* Choose an arbitrary letter on s and change that letter to the next alphabet. Note that the next letter of `z` is `a`.
For example, if you perform an operation for the second letter on `aa... | 0 |
{"tests": "{\"inputs\": [\"1 1\\n180 90 2\\n1 1\\n180 180 20\\n2 10\\n360 -360 5\\n-9 360 8\\n3 2\\n100 60 9\\n-72 -72 10\\n-45 -225 5\\n0 0\", \"1 1\\n180 90 2\\n1 1\\n180 180 20\\n2 13\\n360 -360 5\\n-9 360 8\\n3 2\\n100 60 9\\n-72 -72 10\\n-45 -225 5\\n0 0\", \"1 1\\n180 90 2\\n1 1\\n180 180 20\\n2 13\\n143 -360 5\\... | International Car Production Company (ICPC), one of the largest automobile manufacturers in the world, is now developing a new vehicle called "Two-Wheel Buggy". As its name suggests, the vehicle has only two wheels. Quite simply, "Two-Wheel Buggy" is made up of two wheels (the left wheel and the right wheel) and a axle... | 0 |
{"tests": "{\"inputs\": [\"3\\n2 5 7\\n5 1 7\\n7 7 4\\n\", \"5\\n1 27 28 28 12\\n27 2 28 28 27\\n28 28 3 26 28\\n28 28 26 4 28\\n12 27 28 28 5\\n\", \"6\\n17 20 20 20 19 20\\n20 17 18 18 20 18\\n20 18 14 16 20 16\\n20 18 16 14 20 16\\n19 20 20 20 17 20\\n20 18 16 16 20 15\\n\", \"4\\n97 99 100 99\\n99 98 100 99\\n100 1... | The Dogeforces company has $k$ employees. Each employee, except for lower-level employees, has at least $2$ subordinates. Lower-level employees have no subordinates. Each employee, except for the head of the company, has exactly one direct supervisor. The head of the company is a direct or indirect supervisor of all em... | 0 |
{"tests": "{\"inputs\": [\"2 5\\n\", \"6 5\\n\", \"5 1\\n\", \"8 5\\n\", \"9 6\\n\", \"7 1\\n\", \"3 9\\n\", \"7 3\\n\", \"4 2\\n\", \"5 2\\n\", \"8 3\\n\", \"7 4\\n\", \"4 8\\n\", \"3 5\\n\", \"1 1\\n\", \"6 4\\n\", \"2 1\\n\", \"2 8\\n\", \"2 9\\n\", \"4 5\\n\", \"9 7\\n\", \"2 4\\n\", \"6 3\\n\", \"9 4\\n\", \"6 7\\... | Autumn came late to the kingdom of Far Far Away. The harvest was exuberant and it is now time to get ready for the winter. As most people celebrate the Harvest festival, Simon the Caretaker tries to solve a very non-trivial task of how to find place for the agricultural equipment in the warehouse.
He's got problems wi... | 0 |
{"tests": "{\"inputs\": [\"3 11\\n+ 1 2 a\\n+ 2 3 b\\n+ 3 2 a\\n+ 2 1 b\\n? 3\\n? 2\\n- 2 1\\n- 3 2\\n+ 2 1 c\\n+ 3 2 d\\n? 5\\n\", \"3 11\\n+ 1 2 a\\n+ 2 3 c\\n+ 3 2 a\\n+ 2 1 b\\n? 3\\n? 2\\n- 2 1\\n- 3 2\\n+ 2 1 c\\n+ 3 2 d\\n? 5\\n\", \"3 11\\n+ 1 2 a\\n+ 1 3 c\\n+ 3 2 a\\n+ 2 1 b\\n? 6\\n? 4\\n- 2 1\\n- 3 2\\n+ 2 ... | You are given a directed graph consisting of $n$ vertices. Each directed edge (or arc) labeled with a single character. Initially, the graph is empty.
You should process $m$ queries with it. Each query is one of three types:
"$+$ $u$ $v$ $c$" — add arc from $u$ to $v$ with label $c$. It's guaranteed that there is no ... | 0 |
{"tests": "{\"inputs\": [\"7\\n1\\n?\\n2\\n?0\\n10\\n79259?087\\n2\\n??\\n3\\n0?1\\n4\\n?????\\n3\\n012\", \"7\\n1\\n?\\n2\\n?0\\n10\\n79259?087\\n2\\n??\\n3\\n0?1\\n4\\n?????\\n3\\n13\", \"7\\n1\\n?\\n2\\n?0\\n10\\n79259?087\\n2\\n??\\n3\\n0?1\\n4\\n?????\\n3\\n0\", \"7\\n1\\n?\\n2\\n?0\\n10\\n79259?087\\n2\\n??\\n2\\... | From the FAQ:
What am I allowed to post as a comment for a problem?
Do NOT post code.
Do NOT post a comment asking why your solution is wrong.
Do NOT post a comment asking if you can be given the test case your program fails on.
Do NOT post a comment asking how your solution can be improved.
Do NOT post a comment gi... | 0 |
{"tests": "{\"inputs\": [\"2\\nD\\nT\", \"2\\nE\\nU\", \"2\\nF\\nU\", \"2\\nD\\nS\", \"2\\nC\\nU\", \"2\\nB\\nU\", \"2\\nD\\nV\", \"2\\nD\\nR\", \"2\\nA\\nU\", \"2\\nD\\nW\", \"2\\nG\\nU\", \"2\\nD\\nX\", \"2\\nD\\nY\", \"2\\nD\\nZ\", \"2\\nD\\nQ\", \"2\\nD\\nP\", \"2\\n@\\nU\", \"2\\nH\\nU\", \"2\\nI\\nU\", \"2\\nD\\n... | Hakone Ekiden is one of the Japanese New Year's traditions. In Hakone Ekiden, 10 runners from each team aim for the goal while connecting the sashes at each relay station. In the TV broadcast, the ranking change from the previous relay station is displayed along with the passing order of each team at the relay station.... | 0 |
{"tests": "{\"inputs\": [\"10\\n6 6 4 4 1 1\\n7 8 8 5 1 2\\n4 8 5 4 1 1\\n4 5 5 6 6 7\\n7 11 10 4 1 0\\n4 12 12 4 1 3\\n3 6 8 8 1 3\\n3 4 8 6 1 2\\n9 5 8 10 1 1\\n10 12 14 16 2 4\", \"10\\n-5 -12 -10 19 -3 48\\n-26 -25 -24 -23 -4 -3\\n-8 -8 17 -2 21 11\\n3 2 -20 -21 15 14\\n45 -6 -8 18 -14 22\\n-38 -7 14 8 15 17\\n-39 ... | In a coordinate system,There are 3 chocolate which will be placed at three random position (x1,y1),(x2,y2) and (x3,y3).Ramesh loves Chocolates. Ramesh always moves along a straight line. your task is to find out whether he can have all the chocolates.
Input Format :-
The first line of the input contains an integer T d... | 0 |
{"tests": "{\"inputs\": [\"65\\n110\", \"271828182845904523\\n328419650112448238\", \"271828182845904523\\n491516385100905315\", \"65\\n158\", \"7\\n8\", \"65\\n181\", \"271828182845904523\\n636593337042278053\", \"271828182845904523\\n1128816364578546661\", \"7\\n15\", \"271828182845904523\\n294375876077939712\", \"65... | Nukes has an integer that can be represented as the bitwise OR of one or more integers between A and B (inclusive). How many possible candidates of the value of Nukes's integer there are?
Constraints
* 1 ≤ A ≤ B < 2^{60}
* A and B are integers.
Input
The input is given from Standard Input in the following format:
... | 0 |
{"tests": "{\"inputs\": [\"2 872207251\\n\", \"182550 383331199\\n\", \"47 318786553\\n\", \"363 418169771\\n\", \"3912472 178711691\\n\", \"69420 998244353\\n\", \"16 879902963\\n\", \"15260 936347479\\n\", \"2924225 234660347\\n\", \"103537 463252301\\n\", \"1851 248535541\\n\", \"3205208 612881327\\n\", \"4 53942492... | Note that the memory limit in this problem is lower than in others.
You have a vertical strip with n cells, numbered consecutively from 1 to n from top to bottom.
You also have a token that is initially placed in cell n. You will move the token up until it arrives at cell 1.
Let the token be in cell x > 1 at some mo... | 0 |
{"tests": "{\"inputs\": [\"5\\n12\\n5 4 4 3 2 2 1 1 1 1 1 1\\n4\\n4 3 2 1\\n1\\n1000000\\n20\\n20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\\n32\\n64 64 63 58 58 58 58 58 37 37 37 37 34 34 28 28 28 28 28 28 24 24 19 17 17 17 17 16 16 16 16 11\\n\", \"5\\n12\\n5 4 4 3 2 2 1 1 1 1 1 1\\n4\\n4 3 2 1\\n1\\n1000000\\n... | So the Beautiful Regional Contest (BeRC) has come to an end! n students took part in the contest. The final standings are already known: the participant in the i-th place solved p_i problems. Since the participants are primarily sorted by the number of solved problems, then p_1 ≥ p_2 ≥ ... ≥ p_n.
Help the jury distrib... | 0 |
{"tests": "{\"inputs\": [\"5\\na b c d e\\n10\\n5 a d b c e\\n5 e a b c d\\n5 b a c e d\\n5 b e d c a\\n5 a e d c b\\n5 b c e a d\\n5 d b c a e\\n5 a e c d b\\n5 e d b a c\\n5 e d a b c\\n\", \"15\\na b c d e f g h i j k l m n o\\n1\\n221 n g m h n f d a b a m d o n e e c c i a f f f i h m b o l j b d f m f i j c g d k... | A widely known among some people Belarusian sport programmer Lesha decided to make some money to buy a one square meter larger flat. To do this, he wants to make and carry out a Super Rated Match (SRM) on the site Torcoder.com. But there's a problem — a severe torcoder coordinator Ivan does not accept any Lesha's probl... | 0 |
{"tests": "{\"inputs\": [\"2\\n3 3\\n3 4\", \"2\\n3 3\\n3 0\", \"2\\n5 3\\n3 0\", \"2\\n5 3\\n6 0\", \"2\\n5 3\\n6 1\", \"2\\n5 2\\n6 1\", \"2\\n3 2\\n6 1\", \"2\\n1 2\\n6 1\", \"2\\n1 3\\n6 1\", \"2\\n0 3\\n6 1\", \"2\\n0 3\\n8 1\", \"2\\n-1 3\\n8 1\", \"2\\n-1 0\\n8 1\", \"2\\n-1 0\\n2 1\", \"2\\n0 0\\n2 1\", \"2\\n0... | Read problems statements in Mandarin Chinese and Russian.
Recently Chef bought a bunch of robot-waiters. And now he needs to know how much to pay for the electricity that robots use for their work. All waiters serve food from the kitchen (which is in the point (0, 0)) and carry it to some table (which is in some poi... | 0 |
{"tests": "{\"inputs\": [\"100 20 100 10202\\nwwwwhhwhhwhhwhhhhhwwwhhhwwwhwwhwhhwwhhwwwhwwhwwwhwhwhwwhhhwhwhhwhwwhhwhwhwwwhwwwwhwhwwwwhwhhhwhwhwww\\n\", \"7 1 100 8\\nhhhwwwh\\n\", \"5 2 4 12\\nhhhwh\\n\", \"12 10 10 1\\nwhwhwhwhwhwh\\n\", \"16 1 1000 2100\\nhhhwwwhhhwhhhwww\\n\", \"20 10 10 1\\nhwhwhwhwhwhwhwhwhhhw\\n... | Vasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent photo by swiping finger over the screen. If you swipe left from the first photo, you reach photo n. Similarly, by swiping right from the last photo you reach photo 1. It takes a sec... | 0 |
{"tests": "{\"inputs\": [\"5\\n0 x 2 4 x\\n2\\nx x\\n2\\n1 2\\n2\\n2 1\\n2\\n1000000000 x\\n4\\nx 2 1 x\\n0\", \"5\\n1 x 2 0 x\\n2\\nx x\\n2\\n1 2\\n2\\n2 1\\n2\\n1000000000 x\\n4\\nx 2 1 x\\n0\", \"5\\n0 x 2 4 x\\n2\\nx x\\n2\\n1 2\\n2\\n0 1\\n2\\n1000000000 x\\n4\\nx 2 1 x\\n0\", \"5\\n0 x 3 4 x\\n2\\nx x\\n2\\n1 2\\... | Problem Statement
Nathan O. Davis is a student at the department of integrated systems.
Today's agenda in the class is audio signal processing. Nathan was given a lot of homework out. One of the homework was to write a program to process an audio signal. He copied the given audio signal to his USB memory and brought ... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.