problem_id
stringlengths
16
16
statement
stringlengths
29
9.15k
tests_json
stringlengths
70
5.27M
time_limit_s
float64
1
10
origin_json
stringlengths
82
233
1e05be4a6dc8dad4
You and your friend are participating in a TV show "Run For Your Prize". At the start of the show n prizes are located on a straight line. i-th prize is located at position a_{i}. Positions of all prizes are distinct. You start at position 1, your friend — at position 10^6 (and there is no prize in any of these two po...
[["3\n2 3 9\n", "8\n"], ["2\n2 999995\n", "5\n"], ["1\n20\n", "19\n"], ["6\n2 3 500000 999997 999998 999999\n", "499999\n"], ["1\n999999\n", "1\n"], ["1\n510000\n", "490000\n"], ["3\n2 5 27\n", "26\n"], ["2\n600000 800000\n", "400000\n"], ["5\n2 5 6 27 29\n", "28\n"], ["1\n500001\n", "499999\n"], ["10\n3934 38497 42729...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#455"}
1e18daf94b71e4ee
Kolya got an integer array $a_1, a_2, \dots, a_n$. The array can contain both positive and negative integers, but Kolya doesn't like $0$, so the array doesn't contain any zeros. Kolya doesn't like that the sum of some subsegments of his array can be $0$. The subsegment is some consecutive segment of elements of the ar...
[["4\n1 -5 3 2\n", "1\n"], ["5\n4 -2 3 -9 2\n", "0\n"], ["9\n-1 1 -1 1 -1 1 1 -1 -1\n", "6\n"], ["8\n16 -5 -11 -15 10 5 4 -4\n", "3\n"], ["2\n1000000000 1000000000\n", "0\n"], ["2\n-1000000000 -1000000000\n", "0\n"], ["2\n1000000000 -1000000000\n", "1\n"], ["2\n-1000000000 1000000000\n", "1\n"], ["3\n1000000000 1000000...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#347"}
1e1cf39747df30b5
Create a program that reads the sales unit price and sales quantity and outputs the total sales amount and the average sales quantity. Input The input is given in the following format: Sales unit price, sales quantity Sales unit price, sales quantity :: :: A comma-separated pair of unit price and quantity is gi...
[["100,20\n50,10\n80,35", "5300\n22\n"], ["100,20\n01,05\n80,35", "4805\n20\n"], ["100,20\n01,05\n80,36", "4885\n20\n"], ["100,20\n01,05\n81,35", "4840\n20\n"], ["000,20\n01,05\n80,36", "2885\n20\n"], ["100,20\n50,10\n81,35", "5335\n22\n"], ["000,10\n01,05\n80,36", "2885\n17\n"], ["100,20\n50,01\n81,35", "4885\n19\n"],...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#686"}
1e24c8f39dec46ca
For a given weighted graph $G = (V, E)$, find the shortest path from a source to each vertex. For each vertex $u$, print the total weight of edges on the shortest path from vertex $0$ to $u$. Constraints * $1 \leq n \leq 10,000$ * $0 \leq c_i \leq 100,000$ * $|E| < 500,000$ * All vertices are reachable from vertex $0...
[["5\n0 3 2 3 3 1 1 1\n1 2 0 2 3 4\n2 3 0 3 3 1 4 1\n3 4 2 1 0 1 1 4 4 3\n4 2 2 1 3 3", "0 0\n1 1\n2 2\n3 1\n4 3\n"], ["5\n0 3 2 3 3 1 1 2\n1 2 0 2 3 4\n2 3 0 3 3 1 4 1\n3 4 2 1 0 1 1 1 4 3\n4 2 2 1 3 3", "0 0\n1 2\n2 2\n3 1\n4 3\n"], ["5\n0 3 2 3 3 2 1 1\n1 2 0 2 4 4\n2 3 0 3 0 2 4 1\n3 4 2 1 0 0 1 4 4 3\n4 2 2 1 3 3"...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1736"}
1e2829fe4ad0c0be
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 ni vertices in the graph representing level i, and the edges have to be bidirectional. When c...
[["3\n3\n4\n6\n", "2\n3\n6\n"], ["1\n508427854\n", "1016791932\n"], ["1\n827388716\n", "1654696074\n"], ["1\n596007358\n", "1191945664\n"], ["10\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", "0\n1\n2\n3\n4\n6\n7\n8\n10\n12\n"], ["1\n322647200\n", "645243594\n"], ["1\n398561321\n", "797066176\n"], ["1\n212055293\n", "424069398\n"]...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#407"}
1e29b202f13b4680
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world. Consider a hexagonal tiling of the plane as on the picture below. [Image] Nicks wishes to go from the cell marked $(0, 0)$ to a certain cell given by the coordi...
[["2\n-3 1\n1 3 5 7 9 11\n1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n", "18\n1000000000000000000\n"], ["1\n0 0\n1 2 3 4 5 6\n", "0\n"], ["1\n-1000000000 -1000000000\n10000 20000 30000 40000 50000 60000\n", "40000000000000\n"], ["1\n-1000000000 -1000000000\n10000 20000 3000...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#273"}
1e3b0e50ab5b2f02
Problem Beans are popular at Otsu University. N beans are lined up in a straight line. Each is numbered from 0 to N-1, and the hardness of the i-th bean is ai. Cyan considers the ideal bean hardness to be D. However, Cyan doesn't want to go get the beans that are too far away because he is troublesome. Therefore, Cya...
[["3\n1 2 3\n3\n0 2 3\n0 2 4\n0 0 2", "0\n1\n1\n"], ["10\n4 5 0 21 9 100 12 9 0 8\n5\n0 3 20\n2 5 101\n8 9 9\n5 5 10\n0 9 20", "1\n1\n1\n90\n1\n"], ["10\n4 5 0 21 9 100 12 9 0 6\n5\n0 3 20\n2 5 101\n8 9 9\n5 5 10\n0 9 20", "1\n1\n3\n90\n1\n"], ["10\n4 5 0 21 9 000 12 9 0 6\n5\n0 3 20\n2 5 101\n8 9 9\n5 5 10\n0 9 20", "...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#677"}
1e4bc9a5272f8b5d
The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city. For this reason, he made the n prisoners to stand in a line, with a number written on their chests. The number is the severity of the crim...
[["4 3 3\n2 3 1 1\n", "2\n"], ["1 1 1\n2\n", "0\n"], ["11 4 2\n2 2 0 7 3 2 2 4 9 1 4\n", "6\n"], ["57 2 10\n7 5 2 7 4 1 0 5 2 9 2 9 8 6 6 5 9 6 8 1 0 1 0 3 2 6 5 2 8 8 8 8 0 9 4 3 6 6 2 4 5 1 2 0 1 7 1 1 5 4 5 0 7 5 1 9 6\n", "0\n"], ["2 228885628 1\n90897004 258427916\n", "1\n"], ["3 1 1\n1 2 1\n", "2\n"], ["3 3 3\n3 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#143"}
1e54c6368f0692bc
The trafic on the Internet is increasing these days due to smartphones. The wireless carriers have to enhance their network infrastructure. The network of a wireless carrier consists of a number of base stations and lines. Each line connects two base stations bi-directionally. The bandwidth of a line increases every y...
[["3 3\n1 2 x+2\n2 2 2x+1\n3 1 x+1\n2 0\n3 2\n1 2 x\n2 3 2\n4 3\n1 2 x^3+2x^2+3x+4\n2 3 x^2+2x+3\n3 4 x+2\n0 0", "x+1\n0\n2\nx+2\n"], ["3 3\n1 2 x+2\n2 2 2x+1\n3 1 x+1\n2 0\n3 2\n1 2 x\n2 3 1\n4 3\n1 2 x^3+2x^2+3x+4\n2 3 x^2+2x+3\n3 4 x+2\n0 0", "x+1\n0\n1\nx+2\n"], ["3 3\n1 2 x+2\n2 2 2x+1\n3 1 x+1\n2 0\n3 2\n1 2 x\n2...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1408"}
1e5f077fd68b2b5f
Little Petya loves looking for numbers' divisors. One day Petya came across the following problem: You are given n queries in the form "xi yi". For each query Petya should count how many divisors of number xi divide none of the numbers xi - yi, xi - yi + 1, ..., xi - 1. Help him. Input The first line contains an int...
[["10\n54972 0\n48015 1\n7114 1\n68273 2\n53650 4\n1716 1\n16165 2\n96062 5\n57750 1\n21071 5\n", "24\n21\n3\n3\n21\n22\n6\n6\n62\n3\n"], ["20\n68260 0\n819 1\n54174 1\n20460 1\n25696 2\n81647 4\n17736 4\n91307 5\n5210 4\n87730 2\n4653 8\n11044 6\n15776 4\n17068 7\n73738 7\n36004 12\n83183 7\n75700 12\n84270 14\n16120 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1602"}
1e69d5492bd4a314
You are given a string s of length n consisting of lowercase English letters. For two given strings s and t, say S is the set of distinct characters of s and T is the set of distinct characters of t. The strings s and t are isomorphic if their lengths are equal and there is a one-to-one mapping (bijection) f between S...
[["7 4\nabacaba\n1 1 1\n1 4 2\n2 1 3\n2 4 3\n", "YES\nYES\nNO\nYES\n"], ["64 1\naabbaabababbaababababbabbabaaabbbbbaaaababbaaabbbaabbaaaabbaaaba\n1 33 32\n", "NO\n"], ["40 1\nbabbaaaabaabbbaabbaaabbbabbbbbaaaabaaaab\n1 21 20\n", "NO\n"], ["36 4\naababcbbcbczaaawwwwwaaaabbbbtestbest\n1 7 6\n13 18 5\n23 26 3\n29 33 4\n",...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#2253"}
1e6c21e68c6ad192
3D Printing We are designing an installation art piece consisting of a number of cubes with 3D printing technology for submitting one to Installation art Contest with Printed Cubes (ICPC). At this time, we are trying to model a piece consisting of exactly k cubes of the same size facing the same direction. First, usi...
[["1 1 100\n100 100 100\n6 4 10\n100 100 100\n106 102 102\n112 110 104\n104 116 102\n100 114 104\n92 107 100\n10 4 10\n-100 101 100\n-108 102 120\n-116 103 100\n-124 100 100\n-132 99 100\n-92 98 100\n-84 100 140\n-76 103 100\n-68 102 100\n-60 101 100\n10 4 10\n100 100 100\n108 101 100\n116 102 100\n124 100 100\n132 102...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#149"}
1e6c90feb4367924
While swimming at the beach, Mike has accidentally dropped his cellphone into the water. There was no worry as he bought a cheap replacement phone with an old-fashioned keyboard. The keyboard has only ten digital equal-sized keys, located in the following way: [Image] Together with his old phone, he lost all his cont...
[["3\n586\n", "NO\n"], ["2\n09\n", "NO\n"], ["9\n123456789\n", "YES\n"], ["3\n911\n", "YES\n"], ["3\n089\n", "NO\n"], ["3\n159\n", "YES\n"], ["9\n000000000\n", "NO\n"], ["4\n0874\n", "NO\n"], ["6\n235689\n", "NO\n"], ["2\n10\n", "YES\n"], ["3\n358\n", "NO\n"], ["6\n123456\n", "NO\n"], ["1\n0\n", "NO\n"], ["6\n021149\n"...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#644"}
1e7589e78cfa1bc3
Dasha logged into the system and began to solve problems. One of them is as follows: Given two sequences a and b of length n each you need to write a sequence c of length n, the i-th element of which is calculated as follows: ci = bi - ai. About sequences a and b we know that their elements are in the range from l to...
[["4 2 9\n3 4 8 9\n3 2 1 4\n", "2 2 2 9 "], ["6 1 5\n1 1 1 1 1 1\n2 3 5 4 1 6\n", "-1"], ["5 1 5\n1 1 1 1 1\n3 1 5 4 2\n", "3 1 5 4 2 "], ["6 3 7\n6 7 5 5 5 5\n2 1 4 3 5 6\n", "3 3 4 3 5 6 "], ["5 1 5\n1 1 1 1 1\n1 2 3 4 5\n", "1 2 3 4 5 "], ["2 1 1000000000\n1000000000 1\n2 1\n", "-1"], ["50 10 15\n13 14 12 14 12 15 1...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#943"}
1e81d23ddd90a095
There is a puzzle to complete by combining 14 numbers from 1 to 9. Complete by adding another number to the given 13 numbers. The conditions for completing the puzzle are * You must have one combination of the same numbers. * The remaining 12 numbers are 4 combinations of 3 numbers. The combination of three numbers i...
[["3649596966777\n4672433573317\n9118992346175\n9643871425498\n7755542764533\n1133557799246", "2 3 5 8\n1 2 4 5 7\n1 2 3 4 5 6 7 8 9\n7 8 9\n1 2 3 4 6 7 8\n0\n"], ["3649596966777\n7685559208632\n9118992346175\n9643871425498\n7755542764533\n1133557799246", "2 3 5 8\n0\n1 2 3 4 5 6 7 8 9\n7 8 9\n1 2 3 4 6 7 8\n0\n"], ["3...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#567"}
1e83f3dd1fa1811c
A monster is attacking the Cyberland! Master Yang, a braver, is going to beat the monster. Yang and the monster each have 3 attributes: hitpoints (HP), offensive power (ATK) and defensive power (DEF). During the battle, every second the monster's HP decrease by max(0, ATK_{Y} - DEF_{M}), while Yang's HP decreases by ...
[["1 2 1\n1 100 1\n1 100 100\n", "99\n"], ["100 100 100\n1 1 1\n1 1 1\n", "0\n"], ["50 80 92\n41 51 56\n75 93 12\n", "0\n"], ["76 63 14\n89 87 35\n20 15 56\n", "915\n"], ["12 59 66\n43 15 16\n12 18 66\n", "0\n"], ["51 89 97\n18 25 63\n22 91 74\n", "0\n"], ["72 16 49\n5 21 84\n48 51 88\n", "3519\n"], ["74 89 5\n32 76 99...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1650"}
1e96d88549a68e4a
Recently Luba bought a very interesting book. She knows that it will take t seconds to read the book. Luba wants to finish reading as fast as she can. But she has some work to do in each of n next days. The number of seconds that Luba has to spend working during i-th day is ai. If some free time remains, she can spend...
[["2 2\n86400 86398\n", "2\n"], ["2 86400\n0 86400\n", "1\n"], ["6 1200\n86400 86400 86000 86000 86000 86400\n", "5\n"], ["4 172799\n1 1 86400 0\n", "4\n"], ["6 1\n1 1 86400 1 86399 1\n", "1\n"], ["100 1000000\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...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#3012"}
1ea161c8c3467e85
Mad scientist Mike is building a time machine in his spare time. To finish the work, he needs a resistor with a certain resistance value. However, all Mike has is lots of identical resistors with unit resistance R0 = 1. Elements with other resistance can be constructed from these resistors. In this problem, we will co...
[["36 316049483082136289\n", "8779152307837131\n"], ["1 923438\n", "923438\n"], ["999999999999999999 2\n", "500000000000000001\n"], ["2 999999999999999999\n", "500000000000000001\n"], ["3 1000000000000000000\n", "333333333333333336\n"], ["60236007668635342 110624799949034113\n", "179\n"], ["4 5\n", "5\n"], ["2885654750...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1308"}
1eb7902196972e2c
New Year is coming, and Jaehyun decided to read many books during 2015, unlike this year. He has n books numbered by integers from 1 to n. The weight of the i-th (1 ≤ i ≤ n) book is w_{i}. As Jaehyun's house is not large enough to have a bookshelf, he keeps the n books by stacking them vertically. When he wants to rea...
[["3 5\n1 2 3\n1 3 2 3 1\n", "12\n"], ["3 3\n10 20 30\n1 2 3\n", "40\n"], ["2 2\n10 12\n2 1\n", "12\n"], ["10 10\n61 59 97 16 2 94 57 48 91 93\n2 8 6 5 3 1 3 4 9 10\n", "2137\n"], ["50 50\n75 71 23 37 28 23 69 75 5 62 3 11 96 100 13 50 57 51 8 90 4 6 84 27 11 89 95 81 10 62 48 52 69 87 97 95 30 74 21 42 36 64 31 80 81 ...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00000-of-00005.parquet#1685"}
1ec9eaa5ca61fc26
There are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line has a one-dimensional coordinate, and a point that is farther east has a greater coordinate value. The coordinate of town i is X_i. You are now at town 1, and you want to visit all the ...
[["7 1 100\n40 43 45 3 108 115 124", "79\n"], ["7 1 2\n24 35 40 26 72 99 103", "-4\n"], ["7 1 100\n40 43 45 3 108 196 37", "-8\n"], ["7 1 100\n40 67 45 3 146 196 37", "-46\n"], ["7 1 101\n40 67 45 3 146 196 37", "-45\n"], ["7 2 101\n40 67 45 3 146 196 37", "-191\n"], ["7 2 101\n40 67 30 4 146 147 37", "-189\n"], ["7 2 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#875"}
1ecf56bdd9f431eb
Vasya likes everything infinite. Now he is studying the properties of a sequence s, such that its first element is equal to a (s1 = a), and the difference between any two neighbouring elements is equal to c (si - si - 1 = c). In particular, Vasya wonders if his favourite integer b appears in this sequence, that is, the...
[["1 -4 5\n", "NO\n"], ["1 7 3\n", "YES\n"], ["0 60 50\n", "NO\n"], ["10 10 0\n", "YES\n"], ["1 6 1\n", "YES\n"], ["-2 -2 0\n", "YES\n"], ["0 -2 -2\n", "YES\n"], ["0 -1 -1\n", "YES\n"], ["-2 0 1\n", "YES\n"], ["1 -2 0\n", "NO\n"], ["0 2 -2\n", "NO\n"], ["3 2 1\n", "NO\n"], ["0 2 -1\n", "NO\n"], ["1000000000 0 -10000000...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#181"}
1ee9a12cfb9149f7
Sometimes it is hard to prepare tests for programming problems. Now Bob is preparing tests to new problem about strings — input data to his problem is one string. Bob has 3 wrong solutions to this problem. The first gives the wrong answer if the input data contains the substring s1, the second enters an infinite loop i...
[["syvncqmfhautvxudqdhggz\nhrpxzeghsocjpicuixskfuzupytsgjsdiyb\nybcmnmnbpndbxlxbzhbfnqvwcffvrdhtickyqhupmcehls\n", "100\n"], ["iefouqzxoyuieqdzalfktehtvdbvjmeubju\nocotspetkkhvwfgaqynhovjwjhciefouqzxoyuieqdzalfktehtvdbvjmeubjubcmnvpwgdpnchqhzjrchyrfpvigubp\nycnhjwgbocotspetkkhvwfgaqynhovjwjhcief\n", "100\n"], ["ujgquqx...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#70"}
1eed21a8d19be869
In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we will call them Island 1, Island 2, ..., Island N. There are M kinds of regular boat services between these islands. Each service connects two islands. The i-th service connects Island a_i and Island b_i. Cat Snuk...
[["5 5\n1 1\n4 5\n2 3\n2 4\n1 4", "POSSIBLE\n"], ["100000 1\n0 99999", "IMPOSSIBLE\n"], ["4 3\n1 3\n2 3\n3 4", "POSSIBLE\n"], ["5 5\n1 1\n4 5\n1 3\n2 4\n1 4", "POSSIBLE\n"], ["100100 1\n0 99999", "IMPOSSIBLE\n"], ["4 3\n1 3\n3 3\n3 4", "POSSIBLE\n"], ["5 5\n2 3\n4 5\n2 3\n2 4\n1 4", "POSSIBLE\n"], ["100000 1\n1 69651",...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#501"}
1eef939a4bd02e47
[3R2 as DJ Mashiro - Happiness Breeze](https://open.spotify.com/track/2qGqK8GRS65Wlf20qUBEak) [Ice - DJ Mashiro is dead or alive](https://soundcloud.com/iceloki/dj-mashiro-is-dead-or-alive) NEKO#ΦωΦ has just got a new maze game on her PC! The game's main puzzle is a maze, in the forms of a 2 × n rectangle grid. NEKO...
[["5 5\n2 3\n1 4\n2 4\n2 3\n1 4\n", "Yes\nNo\nNo\nNo\nYes\n"], ["73034 53\n2 21523\n1 21522\n2 21523\n2 21521\n2 37146\n2 21521\n2 21521\n2 21521\n1 37145\n2 37146\n1 54737\n2 66924\n2 21521\n2 28767\n2 21521\n2 21521\n2 21521\n1 28766\n2 28767\n2 54736\n2 54736\n2 31558\n2 37144\n2 41201\n1 60566\n2 15970\n2 37144\n2 ...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#3102"}
1ef3f01a734fcf87
Once upon a time in the galaxy of far, far away... Darth Wader found out the location of a rebels' base. Now he is going to destroy the base (and the whole planet that the base is located at), using the Death Star. When the rebels learnt that the Death Star was coming, they decided to use their new secret weapon — sp...
[["30 30 2 1 2 1 20\n3\n0 0 40 5 1\n1 4 4\n-10 -40 -5 7 0\n100 200 95 8 1\n-10 0 0\n", "74.6757620881\n"], ["8 8 4 4 4 2 6\n1\n-2 -2 -1 3 0\n", "-1\n"], ["0 0 0 1 0 0 5\n2\n10 8 0 2 2\n0 -3 0\n2 2 0\n20 0 0 4 3\n2 4 0\n-4 3 0\n1 -5 0\n", "9.9999999270\n"], ["-10000 0 0 1 0 0 3\n1\n10000 6 0 2 1\n-3 0 0\n", "-1\n"], ["1...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#2895"}
1ef800071a584ce2
Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. Chef likes problems involving arrays. Unfortunately, the last one he tried to solve didn't quite get solved. Chef has an array A of N positive numbers. He wants to find the number of subarrays for which the sum and product of elements are ...
[["3\n3\n1 3 2\n4\n4 1 2 1\n6\n1 2 2 2 2 1", "4\n5\n9"], ["3\n3\n1 3 2\n4\n4 1 3 1\n6\n1 2 2 2 2 1", "4\n4\n9\n"], ["3\n3\n1 3 2\n4\n4 1 3 1\n6\n1 2 2 0 2 1", "4\n4\n7\n"], ["3\n3\n1 3 2\n4\n4 1 3 1\n6\n1 1 2 0 2 1", "4\n4\n6\n"], ["3\n3\n1 3 2\n4\n4 2 3 1\n6\n1 2 2 2 2 1", "4\n5\n9\n"], ["3\n3\n1 5 2\n4\n4 2 3 1\n6\n1...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#769"}
1f0bde78eb51c8a6
In 2020, AtCoder Inc. with an annual sales of more than one billion yen (the currency of Japan) has started a business in programming education. One day, there was an exam where a one-year-old child must write a program that prints `Hello World`, and a two-year-old child must write a program that receives integers A, B...
[["1", "Hello World"], ["2\n3\n5", "8"], ["2\n4\n5", "9\n"], ["2\n4\n9", "13\n"], ["2\n2\n9", "11\n"], ["2\n3\n11", "14\n"], ["2\n0\n21", "21\n"], ["2\n1\n21", "22\n"], ["2\n2\n21", "23\n"], ["2\n4\n21", "25\n"], ["2\n4\n13", "17\n"], ["2\n4\n23", "27\n"], ["2\n4\n32", "36\n"], ["2\n5\n32", "37\n"], ["2\n5\n53", "58\n"...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#2261"}
1f0dcde2bde48057
There are N mountains ranging from east to west, and an ocean to the west. At the top of each mountain, there is an inn. You have decided to choose where to stay from these inns. The height of the i-th mountain from the west is H_i. You can certainly see the ocean from the inn at the top of the westmost mountain. For t...
[["4\n6 5 6 8\n", "3\n"], ["5\n4 5 3 5 4\n", "3\n"], ["5\n9 5 6 8 4\n", "1\n"], ["2\n75 26\n", "1\n"], ["20\n45 72 81 47 29 97 2 75 25 82 84 17 56 32 2 28 37 57 39 18\n", "4\n"], ["11\n79 54 53 96 95 16 16 52 51 49 49\n", "2\n"], ["20\n54 53 68 68 35 35 62 61 74 73 94 94 94 94 86 85 65 64 68 68\n", "8\n"], ["20\n8 12 1...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#659"}
1f0f81e965745945
The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this: There are space-separated non-empty words of lowercase and uppercase Latin letters. There are hyphen characters '-' in some words, their positions set word wrapping points. Word can include more th...
[["4\ngarage for sa-le\n", "7\n"], ["4\nEdu-ca-tion-al Ro-unds are so fun\n", "10\n"], ["1\nj\n", "1\n"], ["10\nb\n", "1\n"], ["1\nQGVsfZevMD\n", "10\n"], ["1\nqUOYCytbKgoGRgaqhjrohVRxKTKjjOUPPnEjiXJWlvpCyqiRzbnpyNqDylWverSTrcgZpEoDKhJCrOOvsuXHzkPtbXeKCKMwUTVk\n", "100\n"], ["100000\nBGRHXGrqgjMxCBCdQTCpQyHNMkraTRxhyZB...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#146"}
1f239b7a319fd1c2
N players will participate in a tennis tournament. We will call them Player 1, Player 2, \ldots, Player N. The tournament is round-robin format, and there will be N(N-1)/2 matches in total. Is it possible to schedule these matches so that all of the following conditions are satisfied? If the answer is yes, also find th...
[["3\n2 3\n1 3\n1 2\n", "3\n"], ["4\n2 3 4\n1 3 4\n4 1 2\n3 1 2\n", "4\n"], ["3\n2 3\n3 1\n1 2\n", "-1\n"], ["3\n3 2\n1 3\n1 2\n", "3\n"], ["4\n2 3 4\n3 1 4\n2 1 4\n2 3 1\n", "5\n"], ["4\n2 3 4\n3 1 4\n2 1 4\n3 1 2\n", "6\n"], ["4\n2 3 4\n4 1 3\n2 1 4\n3 1 2\n", "-1\n"], ["340\n146 244 229 96 308 245 112 226 333 318 33...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#903"}
1f3756ea03c342c2
There are $n + 1$ cities, numbered from $0$ to $n$. $n$ roads connect these cities, the $i$-th road connects cities $i - 1$ and $i$ ($i \in [1, n]$). Each road has a direction. The directions are given by a string of $n$ characters such that each character is either L or R. If the $i$-th character is L, it means that ...
[["2\n6\nLRRRLL\n3\nLRL\n", "1 3 2 3 1 3 2\n1 4 1 4\n"], ["2\n6\nLLRRRL\n3\nLRL\n", "1 2 3 2 3 1 3\n1 4 1 4\n"], ["2\n6\nLLRRRL\n3\nRLL\n", "1 2 3 2 3 1 3\n3 1 3 2\n"], ["2\n6\nLRRRLL\n3\nRLL\n", "1 3 2 3 1 3 2\n3 1 3 2\n"], ["2\n6\nLLRRRL\n3\nLLR\n", "1 2 3 2 3 1 3\n1 2 3 1\n"], ["2\n6\nLRRRLL\n3\nLLR\n", "1 3 2 3 1 3...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#780"}
1f38eb51a36c3eec
You are given a tree with N vertices. Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices. The i-th edge (1≤i≤N-1) connects Vertices a_i and b_i, and has a length of c_i. You are also given Q queries and an integer K. In the j-th qu...
[["5\n1 2 1\n1 3 1\n2 4 1\n3 5 1\n3 1\n2 4\n2 3\n4 5", "3\n2\n4"], ["7\n1 2 1\n1 3 3\n1 4 5\n1 5 7\n1 6 9\n1 7 11\n3 2\n1 3\n4 5\n6 7", "5\n14\n22"], ["10\n1 2 1000000000\n2 3 1000000000\n3 4 1000000000\n4 5 1000000000\n5 6 1000000000\n6 7 1000000000\n7 8 1000000000\n8 9 1000000000\n9 10 1000000000\n1 1\n9 10", "170000...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#143"}
1f40e4cd00e5a74c
You are given a string $s$. You have to reverse it — that is, the first letter should become equal to the last letter before the reversal, the second letter should become equal to the second-to-last letter before the reversal — and so on. For example, if your goal is to reverse the string "abddea", you should get the s...
[["5\naaaza\n", "2\n"], ["6\ncbaabc\n", "0\n"], ["9\nicpcsguru\n", "30\n"], ["50\nfhakqhdhrgfjruxndgfhdvcxhsrjfgdhsyrhfjcbfgdvrtdysf\n", "482\n"], ["100\nzzzzzxxxyyyytttttssssssggggdddddjjjjjkkksssssjjjjrdddzzzzxxxxaaaaarrryjjjjddderehhhqazzzzzgdgseryydr\n", "1995\n"], ["2\ngg\n", "0\n"], ["2\nzg\n", "1\n"], ["5\nababa...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1033"}
1f5fc5ddc9d429e1
We have a sequence of N integers: x=(x_0,x_1,\cdots,x_{N-1}). Initially, x_i=0 for each i (0 \leq i \leq N-1). Snuke will perform the following operation exactly M times: * Choose two distinct indices i, j (0 \leq i,j \leq N-1,\ i \neq j). Then, replace x_i with x_i+2 and x_j with x_j+1. Find the number of differe...
[["0 2", "0\n"], ["100001 27098", "949668337\n"], ["101001 27098", "74153970\n"], ["3 7", "169\n"], ["101000 14296", "338861381\n"], ["101001 3325", "897970791\n"], ["101001 365", "364723785\n"], ["101011 172", "769291260\n"], ["101111 145", "35101305\n"], ["101001 204", "229329085\n"], ["101001 29", "395751643\n"], ["...
2.21
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#538"}
1f6fa01929f812ac
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland). ...
[["1\n12\n", "0\n"], ["5\n0 1 2 3 4\n", "10\n"], ["3\n1 3 1\n", "4\n"], ["5\n1 1 0 1 1\n", "1\n"], ["45\n908719 394261 815134 419990 926993 383792 772842 277695 527137 655356 684956 695716 273062 550324 106247 399133 442382 33076 462920 294674 846052 817752 421365 474141 290471 358990 109812 74492 543281 169434 919692 ...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#1379"}
1f79ecc157c0881b
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya calls a number almost lucky if it could be evenly divided by some lucky number. Help him find ...
[["42\n", "YES\n"], ["49\n", "YES\n"], ["70\n", "YES\n"], ["56\n", "YES\n"], ["298\n", "NO\n"], ["4\n", "YES\n"], ["25\n", "NO\n"], ["477\n", "YES\n"], ["48\n", "YES\n"], ["124\n", "YES\n"], ["480\n", "YES\n"], ["77\n", "YES\n"], ["94\n", "YES\n"], ["3\n", "NO\n"], ["1000\n", "YES\n"], ["141\n", "YES\n"], ["998\n", "NO...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1094"}
1f7e6fac5328a5c7
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large). Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu...
[["3\n2 69\n68 70\n6 4\n4 4 4 4 4 4\n9 38\n-21 83 50 -59 -77 15 -71 -78 20\n", "1\n0\n2\n"], ["1\n4 4\n3 6 6 2\n", "2\n"], ["1\n4 4\n3 3 5 6\n", "2\n"], ["1\n3 3\n4 2 3\n", "1\n"], ["1\n3 4\n5 5 5\n", "2\n"], ["1\n4 2\n1 1 3 4\n", "2\n"], ["1\n2 2\n0 5\n", "2\n"], ["1\n2 1\n-10 13\n", "2\n"], ["7\n2 7\n7 1313\n2 8\n8 1...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#664"}
1f8a2220e2689bde
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: 1. Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. 2. Increase each array element by yi....
[["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9\n", "2\n9\n11\n20\n30\n40\n39\n"], ["5 5\n286163265 724763447 761775891 215352371 491215007\n1 4 780579549\n1 2 638546757\n3 4\n1 3 38072627\n2 6119\n", "780579549\n"], ["5 4\n293170637 715384768 756975575 129004053 875201151\...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#1460"}
1f8ef66a6aee4fb1
B: Periodic Sequence- problem Dr. Period, a professor at H University, is studying a property called the cycle that is supposed to be hidden in all things. As a generally known basic cycle, a cycle hidden in a sequence may be considered. That is, if the sequence S = S_1, S_2, ..., S_N of length N satisfies the follow...
[["6\n1 2 3 1 1 3", "1\n"], ["6\n1 2 3 1 0 3", "1\n"], ["6\n2 2 3 1 0 3", "1\n"], ["6\n2 2 3 2 0 3", "1\n"], ["6\n4 2 3 2 0 3", "1\n"], ["6\n4 2 3 2 0 4", "1\n"], ["6\n4 4 3 2 0 4", "1\n"], ["6\n7 4 3 2 0 4", "1\n"], ["6\n7 4 3 2 1 4", "1\n"], ["6\n7 4 3 2 2 4", "1\n"], ["6\n7 0 3 2 2 4", "1\n"], ["6\n7 -1 3 2 2 4", "1...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1103"}
1f967575bb7b2afd
The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforces. In the task he was given a set of n lines defined by the equations y = ki·x + bi. It was necessary to determine whether there is at least one point of intersection of two of these lines,...
[["4\n1 2\n1 2\n1 0\n0 1\n0 2\n", "NO"], ["2\n1 3\n1 0\n0 2\n", "YES\n"], ["2\n1 3\n1 0\n-1 3\n", "YES"], ["2\n1 3\n1 0\n0 3\n", "NO"], ["2\n0 1000000\n1000000 1000000\n0 3\n", "NO\n"], ["2\n0 1\n1 0\n2 0\n", "NO"], ["2\n900000 1000000\n900000 1000000\n1000000 900000\n", "NO"], ["2\n0 1000000\n0 0\n1000000 1000000\n", ...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#1087"}
1f9afe911345d518
You are given a [directed graph](https://en.wikipedia.org/wiki/Directed_graph) consisting of n vertices and m edges (each edge is directed, so it can be traversed in only one direction). You are allowed to remove at most one edge from it. Can you make this graph [acyclic](https://en.wikipedia.org/wiki/Directed_acyclic...
[["3 4\n1 2\n2 3\n3 2\n3 1\n", "YES\n"], ["5 6\n1 2\n2 3\n3 2\n3 1\n2 1\n4 5\n", "NO\n"], ["3 4\n1 2\n2 1\n1 3\n3 1\n", "NO\n"], ["4 6\n1 2\n2 4\n2 3\n3 1\n4 3\n3 2\n", "NO\n"], ["4 5\n1 2\n2 4\n2 3\n3 1\n4 3\n", "YES\n"], ["9 12\n1 2\n2 3\n2 4\n4 5\n3 5\n5 6\n6 7\n6 8\n7 9\n8 9\n9 1\n3 6\n", "YES\n"], ["4 5\n1 2\n2 3\...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#1713"}
1fb6ee23563d65c7
After making bad dives into swimming pools, Wilbur wants to build a swimming pool in the shape of a rectangle in his backyard. He has set up coordinate axes, and he wants the sides of the rectangle to be parallel to them. Of course, the area of the rectangle must be positive. Wilbur had all four vertices of the planned...
[["1\n1 1\n", "-1\n"], ["1\n-188 17\n", "-1\n"], ["1\n71 -740\n", "-1\n"], ["2\n14 153\n566 -13\n", "91632\n"], ["1\n-227 -825\n", "-1\n"], ["2\n-187 583\n25 13\n", "120840\n"], ["2\n-337 451\n32 -395\n", "312174\n"], ["4\n-64 -509\n-64 960\n634 -509\n634 960\n", "1025362\n"], ["2\n-922 -505\n712 -683\n", "290852\n"], ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#515"}
1fb89cc0a2abd3d5
You are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S. Here, a ACGT string is a string that contains no characters other than A, C, G and T. -----Notes----- A substring of a string T is a string obtained by removing zero or mor...
[["ATCODER\n", "3\n"], ["HATAGAYA\n", "5\n"], ["SHINJUKU\n", "0\n"], ["A\n", "1\n"], ["Z\n", "0\n"], ["TTTTTTTTTT\n", "10\n"], ["BBBBBBBBBB\n", "0\n"], ["CG\n", "2\n"], ["ABC\n", "1\n"], ["ABTTGTTTC\n", "7\n"], ["GACGCTCCAV\n", "9\n"], ["CTTAHTGACT\n", "5\n"], ["TGMJCTTDAA\n", "3\n"], ["SHINJUKV", "0\n"], ["ATCPDER", "...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#912"}
1fd1855c6dea47dc
A restaurant received n orders for the rental. Each rental order reserve the restaurant for a continuous period of time, the i-th order is characterized by two time values — the start time l_{i} and the finish time r_{i} (l_{i} ≤ r_{i}). Restaurant management can accept and reject orders. What is the maximal number of...
[["2\n7 11\n4 7\n", "1\n"], ["5\n1 2\n2 3\n3 4\n4 5\n5 6\n", "3\n"], ["6\n4 8\n1 5\n4 7\n2 5\n1 3\n6 8\n", "2\n"], ["1\n1 1\n", "1\n"], ["2\n4 6\n4 8\n", "1\n"], ["3\n22 22\n14 21\n9 25\n", "2\n"], ["4\n20 59\n30 62\n29 45\n29 32\n", "1\n"], ["5\n40 124\n40 117\n67 106\n36 121\n38 102\n", "1\n"], ["6\n124 155\n50 93\n4...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1536"}
1fd86005f5e556a4
E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with `?`. One more t...
[["?tc????\ncoder", "atcoder"], ["??p??d??\nabc", "UNRESTORABLE"], ["?tc??@?\ncoder", "UNRESTORABLE\n"], [">q???d?>\n_ba", ">q_bada>\n"], ["d>>>???q\na`a", "d>>>a`aq\n"], ["d>>>???q\naaa", "d>>>aaaq\n"], ["??p??d??\nabb", "UNRESTORABLE\n"], ["?tc??@?\ncnder", "UNRESTORABLE\n"], ["??p??d??\n`bb", "UNRESTORABLE\n"], ["?t...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#781"}
1fdf3717ad5fde72
Two integer sequences existed initially, one of them was strictly increasing, and another one — strictly decreasing. Strictly increasing sequence is a sequence of integers $[x_1 < x_2 < \dots < x_k]$. And strictly decreasing sequence is a sequence of integers $[y_1 > y_2 > \dots > y_l]$. Note that the empty sequence a...
[["9\n5 1 3 6 8 2 9 0 10\n", "YES\n1 0 0 0 0 1 0 1 0 \n"], ["5\n1 2 4 0 2\n", "NO\n"], ["8\n3 2 0 1 0 1 2 3\n", "YES\n1 1 0 1 1 0 0 0 \n"], ["7\n3 2 0 1 0 1 2\n", "YES\n1 1 0 1 1 0 0 \n"], ["1\n1337\n", "YES\n1 \n"], ["5\n1 4 2 5 3\n", "YES\n0 1 0 0 1 \n"], ["6\n5 1 4 2 6 3\n", "YES\n1 0 1 0 0 1 \n"], ["6\n1 2 100 3 10...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#658"}
20024b1dff22324b
A popular reality show is recruiting a new cast for the third season! $n$ candidates numbered from $1$ to $n$ have been interviewed. The candidate $i$ has aggressiveness level $l_i$, and recruiting this candidate will cost the show $s_i$ roubles. The show host reviewes applications of all candidates from $i=1$ to $i=n...
[["5 4\n4 3 1 2 1\n1 2 1 2 1\n1 2 3 4 5 6 7 8 9\n", "6\n"], ["2 2\n1 2\n0 0\n2 1 -100 -100\n", "2\n"], ["5 4\n4 3 2 1 1\n0 2 6 7 4\n12 12 12 6 -3 -5 3 10 -4\n", "62\n"], ["7 5\n4 3 2 3 2 1 1\n6 8 9 1 2 0 5\n14 6 0 14 -12 -2 -13 10 -14 -3 10 -9\n", "46\n"], ["7 4\n1 4 3 2 1 3 1\n8 2 2 1 4 3 2\n-6 14 8 13 -8 -6 -23 1 -17...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#969"}
2008db1b4145e7ec
This is a story in a depopulated area. In this area, houses are sparsely built along a straight road called Country Road. Until now, there was no electricity in this area, but this time the government will give us some generators. You can install the generators wherever you like, but in order for electricity to be supp...
[["6\n5 2\n10 30 40 70 100\n7 3\n3 4 10 17 21 26 28\n1 1\n100\n2 1\n0 1000000\n3 5\n30 70 150\n6 4\n0 10 20 30 40 50", "60\n12\n0\n1000000\n0\n20\n"], ["6\n5 2\n10 30 40 70 100\n7 3\n3 5 10 17 21 26 28\n1 1\n100\n2 1\n0 1000000\n3 5\n30 70 211\n6 4\n0 10 20 30 40 50", "60\n13\n0\n1000000\n0\n20\n"], ["6\n5 2\n10 30 40 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1541"}
200d73e17484e03d
ICPC Calculator In mathematics, we usually specify the order of operations by using parentheses. For example, 7 × (3 + 2) always means multiplying 7 by the result of 3 + 2 and never means adding 2 to the result of 7 × 3. However, there are people who do not like parentheses. International Counter of Parentheses Counci...
[["1\n9\n4\n+\n.1\n.2\n.3\n9\n+\n.0\n.+\n..*\n...1\n...+\n....1\n....2\n..0\n10\n+\n.+\n..6\n..2\n.+\n..1\n..*\n...7\n...6\n.3\n0", "9\n6\n3\n54\n"], ["1\n9\n4\n+\n.1\n.2\n.3\n9\n+\n.0\n.*\n..*\n...1\n...+\n....1\n....2\n..0\n10\n+\n.+\n..6\n..2\n.+\n..1\n..*\n...7\n...6\n.3\n0", "9\n6\n0\n54\n"], ["1\n9\n4\n+\n.1\n.2\...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1518"}
200e99e6c6ea6dc6
I decided to plant vegetables in the vegetable garden. There were n seeds, so I sown n seeds one by one a day over n days. All seeds sprout and grow quickly. I can't wait for the harvest time. One day, when I was watering the seedlings as usual, I noticed something strange. There should be n vegetable seedlings, but o...
[["5\n1 2 3 6 4 5\n6\n1 3 6 9 12 15 18\n4\n5 7 9 11 6\n0", "6\n1\n6\n"], ["5\n1 2 3 2 4 5\n6\n1 3 6 9 12 15 18\n4\n5 7 9 11 6\n0", "2\n1\n6\n"], ["5\n1 2 3 2 4 5\n6\n1 3 6 9 12 15 18\n4\n5 7 9 11 7\n0", "2\n1\n7\n"], ["5\n1 2 3 6 4 5\n6\n1 3 6 9 12 15 18\n4\n5 7 9 11 8\n0", "6\n1\n8\n"], ["5\n1 2 3 6 4 5\n6\n1 3 6 9 12...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#145"}
20234913494c08b0
[THE SxPLAY & KIVΛ - 漂流](https://soundcloud.com/kivawu/hyouryu) [KIVΛ & Nikki Simmons - Perspectives](https://soundcloud.com/kivawu/perspectives) With a new body, our idol Aroma White (or should we call her Kaori Minamiya?) begins to uncover her lost past through the OS space. The space can be considered a 2D plane,...
[["1 1 2 3 1 0\n2 2 1\n", "0\n"], ["1 1 2 3 1 0\n15 27 26\n", "2\n"], ["1 1 2 3 1 0\n2 4 20\n", "3\n"], ["1953417899042943 1 2 2 31 86\n1953417899042940 5 5860253697129194\n", "3\n"], ["9678412710617879 5501638861371579 2 2 95 12\n4209774865484088 2296505519592538 6040008676069765\n", "0\n"], ["923 247 2 2 1 1\n1000000...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#1685"}
202b3a1b801ca883
You are given two arithmetic progressions: a1k + b1 and a2l + b2. Find the number of integers x such that L ≤ x ≤ R and x = a1k' + b1 = a2l' + b2, for some integers k', l' ≥ 0. Input The only line contains six integers a1, b1, a2, b2, L, R (0 < a1, a2 ≤ 2·109, - 2·109 ≤ b1, b2, L, R ≤ 2·109, L ≤ R). Output Print th...
[["2 0 3 3 5 21\n", "3\n"], ["2 4 3 0 6 17\n", "2\n"], ["1 -3078 36929 51253687 -754589746 -53412627\n", "0\n"], ["81427 -688 1720 -221771 -77602716 1593447723\n", "11\n"], ["1000000000 0 1 0 0 2000000000\n", "3\n"], ["1 -1074 271 17741 -2062230 1866217\n", "6821\n"], ["9 -1 8 -1 -711474975 237571596\n", "3299606\n"], ...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#2719"}
203c77d667552e4a
We have caught N sardines. The deliciousness and fragrantness of the i-th sardine is A_i and B_i, respectively. We will choose one or more of these sardines and put them into a cooler. However, two sardines on bad terms cannot be chosen at the same time. The i-th and j-th sardines (i \neq j) are on bad terms if and o...
[["3\n1 2\n-1 1\n2 -1", "5"], ["10\n3 2\n3 2\n-1 1\n2 -1\n-3 -9\n-8 12\n7 7\n8 1\n8 2\n8 4", "479"], ["3\n1 4\n-1 1\n2 -1", "7\n"], ["10\n3 2\n3 2\n-1 1\n2 -1\n-3 -6\n-8 12\n7 7\n8 1\n8 2\n8 4", "359\n"], ["3\n2 4\n-1 1\n2 -1", "5\n"], ["10\n3 2\n3 2\n-1 1\n2 -1\n-3 -6\n-8 12\n7 1\n8 1\n8 2\n8 4", "479\n"], ["3\n2 4\n-...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00000-of-00005.parquet#2990"}
2048a6dc42123f88
A: A-Z- problem There is a circular board of 26 squares, each square with one capital letter of the alphabet written clockwise in alphabetical order. That is, the clockwise side of the'A'square is the'B' square, the next side of the'B'square is the'C'square, and ..., the clockwise side of the'Z'square is the'A'. It's...
[["AIZV", "2\n"], ["W\\AG", "1\n"], ["[VIA", "3\n"], ["BEW]", "0\n"], ["VZIA", "2\n"], ["V[IA", "2\n"], ["W[IA", "2\n"], ["AI[W", "2\n"], ["AH[W", "2\n"], ["HA[W", "2\n"], ["HA[V", "2\n"], ["GA[V", "2\n"], ["GA\\V", "2\n"], ["GA\\W", "2\n"], ["W\\BG", "1\n"], ["W\\BF", "1\n"], ["FB\\W", "2\n"], ["GB\\W", "2\n"], ["WFB\...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#562"}
204f70e23b5fab7a
Vus the Cossack has a field with dimensions n × m, which consists of "0" and "1". He is building an infinite field from this field. He is doing this in this way: 1. He takes the current field and finds a new inverted field. In other words, the new field will contain "1" only there, where "0" was in the current field...
[["1 2 10\n01\n4 1 5 2\n1 2 1 4\n3 4 3 5\n1 3 1 5\n4 3 5 5\n1 1 3 3\n1 3 4 5\n3 2 3 4\n3 1 5 2\n3 1 3 5\n", "2\n2\n1\n2\n3\n4\n6\n1\n3\n2\n"], ["1 2 10\n01\n4 1 5 1\n1 2 1 4\n3 4 3 5\n1 3 1 5\n4 3 5 5\n1 1 3 3\n1 3 4 5\n3 2 3 4\n3 1 5 2\n3 1 3 5\n", "1\n2\n1\n2\n3\n4\n6\n1\n3\n2\n"], ["2 2 5\n10\n11\n1 1 8 8\n2 4 5 6\n...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#16"}
2052bf6f5d12ebf6
The Tower of Hanoi is a well-known mathematical puzzle. It consists of three rods, and a number of disks of different sizes which can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending order of size on one rod, the smallest at the top, thus making a conical shape. The objective of the pu...
[["0 2 1\n1 0 100\n1 2 0\n5\n", "87\n"], ["0 2 2\n1 0 100\n1 2 0\n3\n", "19\n"], ["0 1 1\n1 0 1\n1 1 0\n3\n", "7\n"], ["0 9628 4599\n6755 0 5302\n5753 1995 0\n39\n", "2894220024221629\n"], ["0 4449 3122\n6816 0 8986\n1048 1468 0\n4\n", "73486\n"], ["0 2986 6350\n59 0 9863\n8674 1704 0\n40\n", "4350584259212361\n"], ["0...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#584"}
20664159e0d6db36
According to Berland laws it is only allowed to sell alcohol to people not younger than 18 years. Vasya's job is to monitor the law's enforcement. Tonight he entered a bar and saw n people sitting there. For every one of them Vasya happened to determine either the age or the drink the person is having. Vasya can check ...
[["4\n813\nIORBQITQXMPTFAEMEQDQIKFGKGOTNKTOSZCBRPXJLUKVLVHJYNRUJXK\nRUM\nRHVRWGODYWWTYZFLFYKCVUFFRTQDINKNWPKFHZBFWBHWINWJW\n", "1\n"], ["1\n0\n", "1\n"], ["3\nWHISKEY\n3\nGIN\n", "3\n"], ["4\nSAKE\nSAKE\n13\n2\n", "4\n"], ["2\n0\n17\n", "2\n"], ["2\n2\nGIN\n", "2\n"], ["4\n813\nIORBQITQXMPTFAEMEQDQIKFGKGOTNKTOSZCBRPXJL...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#853"}
206b183ae8802cc8
Vasya is very upset that many people on the Net mix uppercase and lowercase letters in one word. That's why he decided to invent an extension for his favorite browser that would change the letters' register in every word so that it either only consisted of lowercase letters or, vice versa, only of uppercase ones. At th...
[["AORNNDKTRLRVGDPXJKXFTPFpopuzrlqumrxssskvbm\n", "AORNNDKTRLRVGDPXJKXFTPFPOPUZRLQUMRXSSSKVBM"], ["ERPZGrodyu\n", "erpzgrodyu"], ["EBWOVSNLYTWWXrnovgugogtjahnmatomubebyxakas\n", "ebwovsnlytwwxrnovgugogtjahnmatomubebyxakas"], ["Ur\n", "ur"], ["XHRPXZEGHSOCJPICUIXSKFUZUPYTSGJSDIYBCMNMNBPNDBXLXBzhbfnqvwcffvrdhtickyqhupmce...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1401"}
206cc1094cfc2007
Example Input 3 2 R1 Output 3 1 2 4 5 6 7 8 9
[["2 2\nR1", "2 1\n3 4\n"], ["1 2\nR1", "1\n"], ["5 2\nR1", "5 1 2 3 4\n6 7 8 9 10\n11 12 13 14 15\n16 17 18 19 20\n21 22 23 24 25\n"], ["4 2\nR1", "4 1 2 3\n5 6 7 8\n9 10 11 12\n13 14 15 16\n"], ["8 2\nR1", "8 1 2 3 4 5 6 7\n9 10 11 12 13 14 15 16\n17 18 19 20 21 22 23 24\n25 26 27 28 29 30 31 32\n33 34 35 36 37 38 39...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#742"}
2070089bc333497e
A ball will bounce along a number line, making N + 1 bounces. It will make the first bounce at coordinate D_1 = 0, and the i-th bounce (2 \leq i \leq N+1) at coordinate D_i = D_{i-1} + L_{i-1}. How many times will the ball make a bounce where the coordinate is at most X? -----Constraints----- - 1 \leq N \leq 100 - 1...
[["3 6\n3 4 5\n", "2\n"], ["4 9\n3 3 3 3\n", "4\n"], ["90 2575\n69 34 43 51 96 65 22 57 26 27 85 62 92 99 90 52 43 63 17 97 93 35 1 53 95 34 98 9 62 37 39 97 49 71 100 78 22 45 87 61 44 18 64 10 48 34 87 57 39 32 46 83 29 16 27 54 42 32 6 64 11 5 25 76 69 93 15 32 59 79 94 76 32 32 26 9 37 28 92 12 65 86 14 36 44 78 47...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1602"}
207873bcf6192b52
Jett is tired after destroying the town and she wants to have a rest. She likes high places, that's why for having a rest she wants to get high and she decided to craft staircases. A staircase is a squared figure that consists of square cells. Each staircase consists of an arbitrary number of stairs. If a staircase ha...
[["4\n1\n8\n6\n1000000000000000000\n", "1\n2\n1\n30\n"], ["4\n1\n8\n1\n1000000000000000000\n", "1\n2\n1\n30\n"], ["4\n1\n3\n1\n1000000100000000000\n", "1\n1\n1\n30\n"], ["4\n1\n8\n10\n1100000000000000100\n", "1\n2\n2\n30\n"], ["4\n1\n4\n10\n1110000000000000100\n", "1\n1\n2\n30\n"], ["4\n1\n4\n10\n0111000000000000100\n"...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1626"}
207d1af42eb6c531
The only difference between easy and hard versions is the size of the input. You are given a string $s$ consisting of $n$ characters, each character is 'R', 'G' or 'B'. You are also given an integer $k$. Your task is to change the minimum number of characters in the initial string $s$ so that after the changes there ...
[["3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR\n", "1\n0\n3\n"], ["3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBRBR\n", "1\n0\n2\n"], ["3\n5 3\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR\n", "1\n0\n3\n"], ["3\n5 2\nBGGGG\n5 4\nRBRGR\n5 5\nBBRBR\n", "1\n1\n2\n"], ["3\n5 3\nBGGGG\n5 3\nRBRGR\n5 2\nBBBRR\n", "1\n0\n0\n"], ["3\n5 2\nBGGGG\n5 4\nRBRGR\n...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1600"}
2081b66a3ee05999
Find the largest square number not exceeding N. Here, a square number is an integer that can be represented as the square of an integer. -----Constraints----- - 1 \leq N \leq 10^9 - N is an integer. -----Input----- Input is given from Standard Input in the following format: N -----Output----- Print the largest squ...
[["10\n", "9\n"], ["81\n", "81\n"], ["271828182\n", "271821169\n"], ["70", "64\n"], ["12", "9\n"], ["115087508", "115068529\n"], ["135", "121\n"], ["167542739", "167521249\n"], ["7", "4\n"], ["16", "16\n"], ["317532200", "317516761\n"], ["315132601", "315098001\n"], ["2", "1\n"], ["262957414", "262926225\n"], ["3857533...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#531"}
2084499a54d88d01
You are policeman and you are playing a game with Slavik. The game is turn-based and each turn consists of two phases. During the first phase you make your move and during the second phase Slavik makes his move. There are $n$ doors, the $i$-th door initially has durability equal to $a_i$. During your move you can try...
[["6 3 2\n2 3 1 3 4 2\n", "6\n"], ["5 3 3\n1 2 4 2 3\n", "2\n"], ["5 5 6\n1 2 6 10 3\n", "2\n"], ["100 2 1\n2 1 2 2 2 2 1 1 2 1 2 2 2 1 2 2 1 1 2 1 1 1 1 1 2 1 1 2 2 2 2 1 1 2 1 1 1 1 2 2 1 1 2 1 1 1 1 1 2 1 1 2 1 1 1 1 1 2 1 1 2 2 2 1 2 1 2 1 2 1 2 1 1 2 1 1 1 2 2 2 2 2 1 1 1 2 1 2 1 1 2 2 1 1 2 1 1 2 2 2\n", "100\n"]...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1087"}
20960a08ea9540a5
We have a sequence of length N consisting of non-negative integers. Consider performing the following operation on this sequence until the largest element in this sequence becomes N-1 or smaller. (The operation is the same as the one in Problem D.) * Determine the largest element in the sequence (if there is more than...
[["2\n2 4", "5\n"], ["4\n3 3 3 2", "0\n"], ["10\n1000 193 256 777 0 2 1192 1234567891011 48 425", "1234567894848\n"], ["2\n2 7", "8\n"], ["10\n1000 193 256 777 0 2 1192 2138223215855 48 425", "2138223219695\n"], ["2\n0 7", "6\n"], ["10\n1000 193 256 777 0 2 2173 2138223215855 48 425", "2138223220674\n"], ["4\n1 6 3 4",...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#1232"}
20ab46e5f2914aa1
Takahashi is going to buy N items one by one. The price of the i-th item he buys is A_i yen (the currency of Japan). He has M discount tickets, and he can use any number of them when buying an item. If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the neares...
[["3 3\n2 13 8\n", "9\n"], ["4 4\n1 9 3 5\n", "6\n"], ["1 100000\n1000000000\n", "0\n"], ["10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n", "9500000000\n"], ["7955 99805\n280223699 243184364 149210358 462114945 880243783 898930650 89064311 63969626 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#227"}
20b5e5d0330eb8fe
In Berland, $n$ different types of banknotes are used. Banknotes of the $i$-th type have denomination $10^{a_i}$ burles (burles are the currency used in Berland); the denomination of banknotes of the first type is exactly $1$. Let's denote $f(s)$ as the minimum number of banknotes required to represent exactly $s$ bur...
[["4\n3 13\n0 1 2\n2 777\n0 4\n3 255\n0 1 3\n10 1000000000\n0 1 2 3 4 5 6 7 8 9\n", "59\n778\n148999\n999999920999999999\n"], ["4\n3 13\n0 1 2\n2 777\n0 2\n3 255\n0 1 3\n10 1000000000\n0 1 2 3 4 5 6 7 8 9\n", "59\n67999\n148999\n999999920999999999\n"], ["4\n3 14\n0 1 2\n2 777\n0 2\n3 255\n0 1 3\n10 1000000000\n0 1 2 3 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1207"}
20baf4c1a3905061
Some number of chocolate pieces were prepared for a training camp. The camp had N participants and lasted for D days. The i-th participant (1 \leq i \leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on. As a result, there were X ...
[["3\n7 1\n2\n5\n10\n", "8\n"], ["2\n8 20\n1\n10\n", "29\n"], ["5\n30 44\n26\n18\n81\n18\n6\n", "56\n"], ["5\n30 44\n26\n18\n81\n27\n6", "56\n"], ["3\n7 1\n1\n5\n10", "11\n"], ["2\n8 20\n1\n19", "29\n"], ["3\n7 1\n2\n5\n19", "8\n"], ["2\n8 23\n1\n19", "32\n"], ["5\n1 44\n26\n18\n76\n27\n6", "49\n"], ["3\n1 1\n2\n5\n19"...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1099"}
20cd69684cdf0f31
I: Ravage Santa Claus was caught in the illuminations of the city and broke it. There are N light bulbs in the illumination, and the $ i $ th light bulb only comes on when the voltage is above $ A_i $ and below $ B_i $. The voltage should be the same everywhere in the illumination. Find out how many light bulbs can...
[["4\n0 4\n3 6\n2 7\n5 8", "3\n"], ["4\n0 4\n3 6\n2 9\n0 8", "4\n"], ["4\n-1 2\n3 2\n3 7\n-1 8", "2\n"], ["4\n-1 0\n1 2\n3 0\n1 12", "1\n"], ["4\n0 4\n3 6\n2 9\n5 8", "3\n"], ["4\n0 4\n3 6\n2 9\n1 8", "4\n"], ["4\n0 4\n3 6\n2 7\n1 8", "4\n"], ["4\n0 4\n3 6\n3 7\n1 8", "4\n"], ["4\n0 4\n3 6\n3 7\n0 8", "4\n"], ["4\n0 2\...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#868"}
20ed7f6a4d91316a
Devu is a dumb guy, his learning curve is very slow. You are supposed to teach him n subjects, the i^{th} subject has c_{i} chapters. When you teach him, you are supposed to teach all the chapters of a subject continuously. Let us say that his initial per chapter learning power of a subject is x hours. In other words ...
[["2 3\n4 1\n", "11\n"], ["4 2\n5 1 2 1\n", "10\n"], ["3 3\n1 1 1\n", "6\n"], ["20 4\n1 1 3 5 5 1 3 4 2 5 2 4 3 1 3 3 3 3 4 3\n", "65\n"], ["20 10\n6 6 1 2 6 4 5 3 6 5 4 5 6 5 4 6 6 2 3 3\n", "196\n"], ["1 1\n9273\n", "9273\n"], ["1 1\n1\n", "1\n"], ["1 2\n1\n", "2\n"], ["1 2\n2\n", "4\n"], ["2 1\n1 2\n", "3\n"], ["1 1...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#284"}
20f80a3635deeb0a
Bob is decorating his kitchen, more precisely, the floor. He has found a prime candidate for the tiles he will use. They come in a simple form factor — a square tile that is diagonally split into white and black part as depicted in the figure below. [Image] The dimension of this tile is perfect for this kitchen, as h...
[["2 2\n", "16\n"], ["2 4\n", "64\n"], ["20 10\n", "75497471\n"], ["1000 1000\n", "708964705\n"], ["1 1000\n", "46452554\n"], ["1000 122\n", "712990290\n"], ["1 2\n", "8\n"], ["1 1\n", "4\n"], ["2 1\n", "8\n"], ["15 22\n", "679477111\n"], ["2 3\n", "32\n"], ["2 5\n", "128\n"], ["432 333\n", "726933080\n"], ["17 23\n", ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#583"}
2110bc66231a9408
Tsuruga Castle, a symbol of Aizuwakamatsu City, was named "Tsuruga Castle" after Gamo Ujisato built a full-scale castle tower. You can overlook the Aizu basin from the castle tower. On a clear day, you can see Tsuruga Castle from the summit of Mt. Iimori, which is famous for Byakkotai. <image> We decided to conduct...
[["8\n71\n34\n65\n11\n41\n39\n3\n5\n4\n67\n81\n78\n65\n0", "2\n1\n0\n2\n1\n0\n2\n0\n0\n0\n0\n0\n0\n4\n"], ["8\n71\n34\n65\n11\n12\n39\n6\n5\n4\n67\n81\n78\n65\n0", "2\n2\n0\n2\n0\n0\n2\n0\n0\n0\n0\n0\n0\n4\n"], ["8\n71\n34\n65\n0\n41\n39\n3\n5\n4\n67\n81\n78\n65\n0", "3\n0\n0\n2\n1\n0\n2\n0\n0\n0\n0\n0\n0\n4\n"], ["8\n...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1533"}
211f5e80a1393920
Vasya wrote down two strings s of length n and t of length m consisting of small English letters 'a' and 'b'. What is more, he knows that string t has a form "abab...", namely there are letters 'a' on odd positions and letters 'b' on even positions. Suddenly in the morning, Vasya found that somebody spoiled his string...
[["5\nbb?a?\n1\n", "2\n"], ["9\nab??ab???\n3\n", "2\n"], ["6\nab??ab\n4\n", "2\n"], ["14\n?abaa?abb?b?a?\n3\n", "3\n"], ["17\nb??a?abbbaaababba\n4\n", "1\n"], ["1\nb\n1\n", "0\n"], ["3\nb?a\n1\n", "1\n"], ["12\naba?bbaaabbb\n1\n", "1\n"], ["43\n????aabaababa?aaaa?abbbabbb?ab??baabbbbbabb\n5\n", "4\n"], ["36\nbbaa??aab?...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1279"}
212ea0c084561dfe
Given an array $a_1, a_2, \dots, a_n$, you need to handle a total of $q$ updates and queries of two types: $1$ $l$ $r$ — for each index $i$ with $l \leq i \leq r$, update the value of $a_i$ to the sum of the digits of $a_i$. $2$ $x$ — output $a_x$. -----Input----- The first line of the input contains an integer $t...
[["3\n5 8\n1 420 69 1434 2023\n1 2 3\n2 2\n2 3\n2 4\n1 2 5\n2 1\n2 3\n2 5\n2 3\n9999 1000\n1 1 2\n2 1\n2 2\n1 1\n1\n2 1\n", "6\n15\n1434\n1\n6\n7\n36\n1\n1\n"], ["1\n2 2\n10 10\n1 1 2\n2 1\n", "1\n"], ["1\n1 2\n10\n1 1 1\n2 1\n", "1\n"], ["1\n3 26\n10 10 10\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#518"}
212fc45edb2d62a8
You've got a string $S$ consisting of $n$ lowercase English letters from your friend. It turned out that this is a number written in poman numerals. The poman numeral system is long forgotten. All that's left is the algorithm to transform number from poman numerals to the numeral system familiar to us. Characters of $S...
[["2 -1\nba\n", "Yes\n"], ["3 -7\nabc\n", "No\n"], ["7 -475391\nqohshra\n", "Yes\n"], ["3 -3\nabc\n", "No\n"], ["3 -1\nabc\n", "No\n"], ["3 1\nabc\n", "Yes\n"], ["3 3\nabc\n", "Yes\n"], ["3 5\nabc\n", "No\n"], ["3 7\nabc\n", "No\n"], ["2 393216\nrt\n", "Yes\n"], ["3 1536\nljm\n", "Yes\n"], ["4 -16777248\nfyyy\n", "Yes\...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#728"}
2130b0c51277a6af
A team of students from the city S is sent to the All-Berland Olympiad in Informatics. Traditionally, they go on the train. All students have bought tickets in one carriage, consisting of n compartments (each compartment has exactly four people). We know that if one compartment contain one or two students, then they ge...
[["5\n1 2 2 4 3\n", "2\n"], ["3\n4 1 1\n", "2\n"], ["4\n0 3 0 4\n", "0\n"], ["5\n4 4 3 3 1\n", "1\n"], ["5\n4 3 4 2 4\n", "1\n"], ["10\n2 1 2 3 4 1 3 4 4 4\n", "2\n"], ["10\n2 3 3 1 3 1 3 2 2 4\n", "3\n"], ["120\n1 1 1 1 1 1 1 4 4 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 4 1 1 4 1 1 1 1 3 1...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1312"}
21316d8575af8624
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 ...
[["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", "25\n41\n7\n3000010000\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", "25\n41\n9\n3000000000\n"], ["4\n5 1\n1 2 3 4 5\n9 3\...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1798"}
2150769b800c7c5d
A boy Valera registered on site Codeforces as Valera, and wrote his first Codeforces Round #300. He boasted to a friend Arkady about winning as much as x points for his first contest. But Arkady did not believe his friend's words and decided to check whether Valera could have shown such a result. He knows that the con...
[["16 73 92 72 1 1\n", "YES\n"], ["50 10 30 20 1 2\n", "YES\n"], ["375 6 133 267 19 36\n", "NO\n"], ["5 3 135 12 21 6\n", "NO\n"], ["49 2 50 20 2 1\n", "NO\n"], ["0 11 67 82 6 4\n", "YES\n"], ["46 7 18 6 3 1\n", "NO\n"], ["10 2 27 4 11 1\n", "NO\n"], ["35 8 20 20 1 2\n", "YES\n"], ["3 18 272 17 6 1\n", "YES\n"], ["30 9...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#889"}
2150af1bb3c89d55
The Resistance is trying to take control over all planets in a particular solar system. This solar system is shaped like a tree. More precisely, some planets are connected by bidirectional hyperspace tunnels in such a way that there is a path between every pair of the planets, but removing any tunnel would disconnect s...
[["5\n4 1\n4 2\n1 3\n1 5\n", "3\n"], ["4\n1 2\n4 3\n1 4\n", "2\n"], ["10\n4 3\n2 6\n10 1\n5 7\n5 8\n10 6\n5 9\n9 3\n2 9\n", "4\n"], ["10\n4 3\n2 6\n10 1\n5 7\n5 8\n10 6\n5 9\n9 3\n2 9\n", "4\n"], ["10\n4 1\n2 6\n10 1\n5 7\n5 8\n10 6\n5 9\n9 3\n2 9\n", "4\n"], ["10\n4 1\n2 6\n5 1\n5 7\n5 8\n10 6\n5 9\n9 3\n2 9\n", "5\n"...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1573"}
215a8e28afb1ce60
Amidakuji is a traditional method of lottery in Japan. To make an amidakuji, we first draw W parallel vertical lines, and then draw horizontal lines that connect them. The length of each vertical line is H+1 [cm], and the endpoints of the horizontal lines must be at 1, 2, 3, ..., or H [cm] from the top of a vertical l...
[["2 3 1", "5"], ["1 3 2", "1"], ["1 3 1", "2"], ["7 1 1", "1"], ["2 3 3", "1"], ["15 8 5", "437760187"], ["4 3 1", "35\n"], ["1 2 2", "1\n"], ["1 5 1", "5\n"], ["16 8 5", "698231265\n"], ["4 6 1", "12371\n"], ["1 9 1", "34\n"], ["16 8 3", "59172019\n"], ["8 6 1", "276953291\n"], ["1 9 2", "21\n"], ["15 8 3", "97828349...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#255"}
216154ad4c17d362
A-Aun's breathing Problem Statement Maeda-san and Goto-san, who will both turn 70 years old in 2060, are long-time friends and friends who fought together at the ACM-ICPC in college. The two are still excited about competitive programming, drinking tea together. When the two of us drank tea together, Mr. Maeda said...
[["4\nA\nUn\nB\nUn", "NO\n"], ["4\n@\nUn\nB\nUn", "NO\n"], ["4\n@\nUn\nB\nnU", "NO\n"], ["4\n@\nUn\nB\noU", "NO\n"], ["4\n@\nUn\nA\noU", "NO\n"], ["4\n@\nUn\nA\nUo", "NO\n"], ["4\n@\nTn\nA\nUo", "NO\n"], ["4\n@\nTn\nA\nVo", "NO\n"], ["4\n@\nTo\nA\nVo", "NO\n"], ["4\n@\nUo\nA\nVo", "NO\n"], ["4\n@\noU\nA\nVo", "NO\n"], ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1852"}
217e2d195b6f268f
Let's call a positive integer extremely round if it has only one non-zero digit. For example, $5000$, $4$, $1$, $10$, $200$ are extremely round integers; $42$, $13$, $666$, $77$, $101$ are not. You are given an integer $n$. You have to calculate the number of extremely round integers $x$ such that $1 \le x \le n$. -...
[["5\n9\n42\n13\n100\n111\n", "9\n13\n10\n19\n19\n"], ["1\n707951\n", "52\n"], ["1\n69\n", "15\n"], ["1\n9123\n", "36\n"], ["1\n912\n", "27\n"], ["1\n9999\n", "36\n"], ["1\n9998\n", "36\n"], ["1\n9997\n", "36\n"], ["1\n9996\n", "36\n"], ["1\n9995\n", "36\n"], ["1\n9991\n", "36\n"], ["1\n9990\n", "36\n"], ["1\n9988\n", ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#128"}
21949a5640c1975c
You are given a text consisting of n lines. Each line contains some space-separated words, consisting of lowercase English letters. We define a syllable as a string that contains exactly one vowel and any arbitrary number (possibly none) of consonants. In English alphabet following letters are considered to be vowels:...
[["3\n2 2 3\nintel\ncode\nch allenge\n", "YES\n"], ["4\n1 2 3 1\na\nbcdefghi\njklmnopqrstu\nvwxyz\n", "NO\n"], ["4\n13 11 15 15\nto be or not to be that is the question\nwhether tis nobler in the mind to suffer\nthe slings and arrows of outrageous fortune\nor to take arms against a sea of troubles\n", "YES\n"], ["5\n2 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#800"}
219c42a796a040d4
The Patisserie AtCoder sells cakes with number-shaped candles. There are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively. Each cake has an integer value called deliciousness, as follows: * The deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X. * The deliciousn...
[["2 2 2 8\n4 6\n1 5\n3 8", "19\n17\n15\n14\n13\n12\n10\n8"], ["10 10 10 20\n7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488\n1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338\n4975681328 8974383988 28...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#1432"}
219e832033dfa2ae
Cengiz recently learned Fibonacci numbers and now he is studying different algorithms to find them. After getting bored of reading them, he came with his own new type of numbers that he named XORinacci numbers. He defined them as follows: $f(0) = a$; $f(1) = b$; $f(n) = f(n-1) \oplus f(n-2)$ when $n > 1$, where $\o...
[["3\n3 4 2\n4 5 0\n325 265 1231232\n", "7\n4\n76\n"], ["10\n0 0 1000000000\n1002 2003 36523\n233 5656 898989\n0 2352 0\n21132 23256 2323256\n12313 454878 11000\n1213 0 21\n11 1 1\n1 1 98532\n1000000000 1000000000 1000000000\n", "0\n2003\n233\n0\n2132\n442567\n1213\n1\n1\n1000000000\n"], ["1\n25369 85223 58963241\n", "...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#252"}
21a9c85aee1f6526
Santa Claus likes palindromes very much. There was his birthday recently. k of his friends came to him to congratulate him, and each of them presented to him a string s_{i} having the same length n. We denote the beauty of the i-th string by a_{i}. It can happen that a_{i} is negative — that means that Santa doesn't fi...
[["7 3\nabb 2\naaa -3\nbba -1\nzyz -4\nabb 5\naaa 7\nxyx 4\n", "12\n"], ["3 1\na 1\na 2\na 3\n", "6\n"], ["2 5\nabcde 10000\nabcde 10000\n", "0\n"], ["10 10\nnjxbzflaka -1\nfelbvvtkja 6\ngxiuztqkcw 5\naomvscmtti 6\njsqmkoyuca -2\nwckqtzuixg 5\najktvvblef -5\nittmcsvmoa -1\nakalfzbxjn 10\nacuyokmqsj 8\n", "31\n"], ["10 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1274"}
21b4dc1b101e0444
Родители Васи хотят, чтобы он как можно лучше учился. Поэтому если он получает подряд три положительные оценки («четвёрки» или «пятёрки»), они дарят ему подарок. Соответственно, оценки «единица», «двойка» и «тройка» родители Васи считают плохими. Когда Вася получает подряд три хорошие оценки, ему сразу вручают подарок,...
[["6\n4 5 4 5 4 4\n", "2\n"], ["14\n1 5 4 5 2 4 4 5 5 4 3 4 5 5\n", "3\n"], ["3\n4 5 4\n", "1\n"], ["3\n4 5 1\n", "0\n"], ["4\n5 4 3 5\n", "0\n"], ["10\n4 4 5 4 4 5 5 5 4 4\n", "3\n"], ["20\n5 5 5 4 5 4 5 5 5 5 5 4 4 5 3 4 4 4 5 4\n", "5\n"], ["30\n4 4 5 5 5 4 5 5 4 5 4 4 5 4 4 4 5 4 4 4 5 5 5 5 4 5 5 5 4 4\n", "10\n"]...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1833"}
21b641b320e3eea4
Ivar the Boneless is a great leader. He is trying to capture Kattegat from Lagertha. The war has begun and wave after wave Ivar's warriors are falling in battle. Ivar has $n$ warriors, he places them on a straight line in front of the main gate, in a way that the $i$-th warrior stands right after $(i-1)$-th warrior. T...
[["5 5\n1 2 1 2 1\n3 10 1 1 1\n", "3\n5\n4\n4\n3\n"], ["4 4\n1 2 3 4\n9 1 10 6\n", "1\n4\n4\n1\n"], ["10 3\n1 1 1 1 1 1 1 1 1 1\n10 10 5\n", "10\n10\n5\n"], ["1 1\n56563128\n897699770\n", "1\n"], ["100 55\n1 2 4 4 3 5 5 2 3 4 2 1 1 2 3 5 1 5 4 2 5 4 4 3 3 5 3 4 4 5 5 2 3 3 4 4 3 4 5 5 5 5 3 5 1 2 4 3 4 5 3 3 2 1 4 5 3 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#555"}
21bacea0a8466fd8
There are N children standing in a line from left to right. The activeness of the i-th child from the left is A_i. You can rearrange these children just one time in any order you like. When a child who originally occupies the x-th position from the left in the line moves to the y-th position from the left, that child...
[["4\n1 3 4 2", "20"], ["6\n8 6 9 1 2 1", "85"], ["6\n5 5 6 1 1 1", "58"], ["4\n1 4 4 2", "22\n"], ["6\n8 6 11 1 2 1", "90\n"], ["6\n5 5 6 0 1 1", "58\n"], ["4\n1 8 4 2", "30\n"], ["6\n8 6 22 1 2 1", "123\n"], ["6\n5 5 9 0 1 1", "65\n"], ["4\n2 8 4 2", "32\n"], ["6\n8 6 22 1 1 1", "119\n"], ["6\n5 0 9 0 1 1", "55\n"], ...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00000-of-00005.parquet#3165"}
21c8812bdbfbdaf9
You are given an array $a$ consisting of $n$ positive integers. Initially, you have an integer $x = 0$. During one move, you can do one of the following two operations: Choose exactly one $i$ from $1$ to $n$ and increase $a_i$ by $x$ ($a_i := a_i + x$), then increase $x$ by $1$ ($x := x + 1$). Just increase $x$ by $...
[["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8\n", "6\n18\n0\n227\n8\n"], ["1\n1 1000000000\n99999999\n", "900000002\n"], ["1\n5 3\n20 100 50 20 1005002\n", "11\n"], ["1\n1 1000000000\n99999999\n", "900000002\n"], ["1\n5 3\n20 100 50...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#112"}
21ca240b18b6d3a2
Snuke is giving cookies to his three goats. He has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins). Your task is to determine whether Snuke can give cookies to his three goats so that each of them can ...
[["4 5\n", "Possible\n"], ["1 1\n", "Impossible\n"], ["4 0", "Possible\n"], ["-1 2", "Impossible\n"], ["1 2", "Possible\n"], ["7 0", "Possible\n"], ["0 2", "Possible\n"], ["7 -1", "Possible\n"], ["7 -2", "Impossible\n"], ["-1 4", "Possible\n"], ["7 -4", "Possible\n"], ["-1 8", "Impossible\n"], ["5 -4", "Impossible\n"],...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1450"}
21cc55d12c793804
Amugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by n sectors, and the outer area is equally divided by m sectors. A wall exists between each pair of sectors of same area (inner or outer), but there is no wall between the inner area and the outer area. A wa...
[["4 6 3\n1 1 2 3\n2 6 1 2\n2 6 2 4\n", "YES\nNO\nYES\n"], ["999999937 999999874000003969 1\n1 979917353 2 983249032983207370\n", "NO\n"], ["1 1 10\n1 1 1 1\n1 1 1 1\n1 1 2 1\n1 1 1 1\n2 1 2 1\n2 1 1 1\n1 1 2 1\n1 1 2 1\n2 1 1 1\n2 1 1 1\n", "YES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\n"], ["3 9 1\n1 1 2 4\n", "N...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#1574"}
21db3a9e19f51cd1
XXI Berland Annual Fair is coming really soon! Traditionally fair consists of $n$ booths, arranged in a circle. The booths are numbered $1$ through $n$ clockwise with $n$ being adjacent to $1$. The $i$-th booths sells some candies for the price of $a_i$ burles per item. Each booth has an unlimited supply of candies. P...
[["3 38\n5 2 5\n", "10\n"], ["5 21\n2 4 100 2 6\n", "6\n"], ["1 53\n1\n", "53\n"], ["2 50\n40 15\n", "1\n"], ["5 17\n2 4 2 4 4\n", "5\n"], ["10 25\n2 2 5 1 5 4 5 5 5 1\n", "8\n"], ["1 192608170\n1\n", "192608170\n"], ["78 74\n20194 1621 21498 13827 31277 19791 6583 13579 11160 20419 26490 160 3450 12925 9073 10381 2700...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1588"}
21ddc616e5ea5027
Let w be a string consisting of lowercase letters. We will call w beautiful if the following condition is satisfied: - Each lowercase letter of the English alphabet occurs even number of times in w. You are given the string w. Determine if w is beautiful. -----Constraints----- - 1 \leq |w| \leq 100 - w consists of ...
[["abaccaba\n", "Yes\n"], ["hthth\n", "No\n"], ["ab`ccaba", "No\n"], ["ab`cc`ba", "Yes\n"], ["hthtg", "No\n"], ["hghtt", "No\n"], ["`b`cc`ba", "No\n"], ["hgtth", "No\n"], ["ab`cc`b`", "No\n"], ["hgtuh", "No\n"], ["`b`cc`ca", "No\n"], ["hgsth", "No\n"], ["`b_cc`ca", "No\n"], ["hfsth", "No\n"], ["`b_dc`ca", "No\n"], ["hf...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#676"}
21e8dec29a09964e
-----Problem description----- As a holiday gift, Tojo received a probability problem. The problem read as follows Consider an N by M grid. Rows are numbered 1 to N, from top to bottom. Columns are numbered 1 to M, from left to right. You are initially at cell (1, 1) and want to go to cell (N, M). From any cell you can ...
[["2\n2 2\n1 6\n", "3.000000\n6.000000\n"], ["2\n1 2\n1 6", "2.0\n6.0\n"], ["2\n0 2\n1 6", "1.0\n6.0\n"], ["2\n0 1\n1 6", "0.0\n6.0\n"], ["2\n0 1\n2 6", "0.0\n7.0\n"], ["2\n0 1\n4 6", "0.0\n9.0\n"], ["2\n0 1\n4 11", "0.0\n14.0\n"], ["2\n0 1\n8 11", "0.0\n18.0\n"], ["2\n0 1\n8 19", "0.0\n26.0\n"], ["2\n0 1\n8 33", "0.0\...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00003-of-00005.parquet#213"}
21ef63e338849b60
There is a n × n grid D where each cell contains either 1 or 0. Your task is to create a program that takes the gird data as input and computes the greatest number of consecutive 1s in either vertical, horizontal, or diagonal direction. For example, the consecutive 1s with greatest number in the figure below is circl...
[["5\n00011\n00101\n01000\n10101\n00010\n8\n11000001\n10110111\n01100111\n01111010\n11111111\n01001010\n10100010\n10000001\n2\n01\n00\n3\n000\n000\n000\n0", "4\n8\n1\n0\n"], ["5\n01011\n00101\n01000\n10101\n00010\n8\n11000001\n10110111\n01100111\n01111010\n11111111\n01001010\n10100000\n10000001\n0\n01\n00\n3\n000\n000\...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#111"}
21fc5ea348eabdd0
problem There are $ N $ propositions, named $ 1, 2, \ cdots, N $, respectively. Also, $ M $ information about the propositions is given. The $ i $ th information is "$ a_i $$". Given in the form "b_i $", which means that $ a_i $ is $ b_i $. ("If" is a logical conditional and the transition law holds.) $ For each propo...
[["5 2\n1 2\n2 2", "1\n2\n3\n4\n5\n"], ["3 2\n1 2\n2 1", "1 2\n1 2\n3\n"], ["3 2\n1 2\n3 1", "1\n2\n3\n"], ["6 2\n1 2\n2 1", "1 2\n1 2\n3\n4\n5\n6\n"], ["9 2\n1 2\n2 4", "1\n2\n3\n4\n5\n6\n7\n8\n9\n"], ["6 2\n1 1\n2 1", "1\n2\n3\n4\n5\n6\n"], ["17 2\n1 2\n2 4", "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1858"}
21ff5aff31ba49f6
Gildong was hiking a mountain, walking by millions of trees. Inspired by them, he suddenly came up with an interesting idea for trees in data structures: What if we add another edge in a tree? Then he found that such tree-like graphs are called 1-trees. Since Gildong was bored of solving too many tree problems, he wan...
[["5\n1 2\n2 3\n3 4\n4 5\n5\n1 3 1 2 2\n1 4 1 3 2\n1 4 1 3 3\n4 2 3 3 9\n5 2 3 3 9\n", "YES\nYES\nNO\nYES\nNO\n"], ["9\n3 9\n3 4\n7 2\n6 9\n5 3\n6 2\n8 3\n1 9\n10\n8 4 8 2 5\n9 2 7 4 4\n8 5 7 3 3\n1 2 3 8 4\n2 9 2 4 3\n6 4 3 4 5\n6 7 6 6 4\n7 5 3 1 4\n5 4 7 8 3\n4 5 1 5 2\n", "YES\nYES\nNO\nNO\nYES\nYES\nYES\nYES\nNO\n...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1030"}
2200f847a58d36f1
One day you wanted to read something, so you went to your bookshelf to grab some book. But when you saw how messy the bookshelf was you decided to clean it up first. There are $n$ books standing in a row on the shelf, the $i$-th book has color $a_i$. You'd like to rearrange the books to make the shelf look beautiful....
[["5\n1 2 2 1 3\n", "2\n"], ["5\n1 2 2 1 1\n", "1\n"], ["100\n7 4 5 5 10 10 5 8 5 7 4 5 4 6 8 8 2 6 3 3 10 7 10 8 6 2 7 3 9 7 7 2 4 5 2 4 9 5 10 1 10 5 10 4 1 3 4 2 6 9 9 9 10 6 2 5 6 1 8 10 4 10 3 4 10 5 5 4 10 4 5 3 7 10 2 7 3 6 9 6 1 6 5 5 4 6 6 4 4 1 5 1 6 6 6 8 8 6 2 6\n", "77\n"], ["100\n82 51 81 14 37 17 78 92 6...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#44"}
220b575364f580aa
The only difference between easy and hard versions is the length of the string. You are given a string $s$ and a string $t$, both consisting only of lowercase Latin letters. It is guaranteed that $t$ can be obtained from $s$ by removing some (possibly, zero) number of characters (not necessary contiguous) from $s$ wit...
[["bbaba\nbb\n", "3\n"], ["baaba\nab\n", "2\n"], ["abcde\nabcde\n", "0\n"], ["asdfasdf\nfasd\n", "3\n"], ["zywmerhahxlqsjekpqsdqxnjiduyjrytswiweohctztgpiorwimhjmdfofqynyggcrtzslbyvkuvqrsgwyacyvcuathplliwwshusluiqwuhutnzwvuchfedhwwfdzizltdxibtsaocpnqezstblgkfdcvfsjjyzwalkksumsaljqljmmkcyejwwdkolmcgmodoiclte\nzywmehahxlq...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#356"}