problem_id stringlengths 16 16 | statement stringlengths 29 9.15k | tests_json stringlengths 70 1.3M | time_limit_s float64 1 4 | origin_json stringlengths 82 105 |
|---|---|---|---|---|
000324c85302dad4 | Yaroslav, Andrey and Roman can play cubes for hours and hours. But the game is for three, so when Roman doesn't show up, Yaroslav and Andrey play another game.
Roman leaves a word for each of them. Each word consists of 2·n binary characters "0" or "1". After that the players start moving in turns. Yaroslav moves fir... | [["2\n0111\n0001\n", "First\n"], ["3\n110110\n001001\n", "First\n"], ["3\n111000\n000111\n", "Draw\n"], ["4\n01010110\n00101101\n", "First\n"], ["4\n01100000\n10010011\n", "Second\n"], ["4\n10001001\n10101101\n", "Draw\n"], ["3\n000000\n000100\n", "Draw\n"], ["2\n0000\n1110\n", "Second\n"], ["4\n11111111\n10100110\n", ... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00000-of-00005.parquet#643"} |
000d58490fe3b933 | Alyona decided to go on a diet and went to the forest to get some apples. There she unexpectedly found a magic rooted tree with root in the vertex 1, every vertex and every edge of which has a number written on.
The girl noticed that some of the tree's vertices are sad, so she decided to play with them. Let's call ver... | [["9\n88 22 83 14 95 91 98 53 11\n3 24\n7 -8\n1 67\n1 64\n9 65\n5 12\n6 -80\n3 8\n", "5"], ["6\n60 89 33 64 92 75\n4 50\n1 32\n5 21\n3 77\n1 86\n", "4"], ["9\n59 48 48 14 51 51 86 53 58\n1 -47\n5 10\n8 -6\n9 46\n2 -69\n8 -79\n9 92\n6 12\n", "5"], ["8\n2 19 83 95 9 87 15 6\n6 16\n7 98\n5 32\n7 90\n8 37\n2 -34\n1 -83\n",... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#782"} |
00115d26ec66cca7 | The statement of this problem shares a lot with problem A. The differences are that in this problem, the probability is introduced, and the constraint is different.
A robot cleaner is placed on the floor of a rectangle room, surrounded by walls. The floor consists of n rows and m columns. The rows of the floor are num... | [["10\n8 5279 1 1543 6 1521 6\n25276 2 25276 2 1365 1 36\n49526 2 1 1 9796 2 29\n374 73 225 73 291 27 26\n4786 11 3871 11 2870 7 36\n39 811 14 811 32 455 31\n712 103 659 103 82 50 25\n112 419 1 105 99 285 9\n59 983 59 722 9 791 82\n2 6521 2 467 1 6424 77\n", "256169361\n555555564\n724137942\n57523121\n6513776\n90332295... | 2.87 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#623"} |
00125251a44159ba | Today on a lecture about strings Gerald learned a new definition of string equivalency. Two strings a and b of equal length are called equivalent in one of the two cases:
1. They are equal.
2. If we split string a into two halves of the same size a1 and a2, and string b into two halves of the same size b1 and b2... | [["aabb\nabab\n", "NO\n"], ["aaba\nabaa\n", "YES\n"], ["ab\nab\n", "YES\n"], ["abc\nabc\n", "YES\n"], ["hagnzomowtledfdotnll\nledfdotnllomowthagnz\n", "YES\n"], ["baaaaa\nabaaaa\n", "NO\n"], ["aabbaaaa\naaaaabab\n", "NO\n"], ["aab\naba\n", "NO\n"], ["a\na\n", "YES\n"], ["qgiufelsfhanx\naaaaaaaaaaaaa\n", "NO\n"], ["snya... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#1590"} |
0013e5f1fdfb118d | 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 = k_{i}·x + b_{i}. It was necessary to determine whether there is at least one point of intersection of two of these ... | [["4\n1 2\n1 2\n1 0\n0 1\n0 2\n", "NO"], ["2\n1 3\n1 0\n-1 3\n", "YES"], ["2\n1 3\n1 0\n0 2\n", "YES"], ["2\n1 3\n1 0\n0 3\n", "NO"], ["2\n0 1\n-1000000 1000000\n1000000 -1000000\n", "NO"], ["2\n-1337 1888\n-1000000 1000000\n1000000 -1000000\n", "YES"], ["2\n-1337 1888\n-1000000 1000000\n-999999 -1000000\n", "NO"], ["1... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1459"} |
0018d7680635ed0f | Polycarp is sad — New Year is coming in few days but there is still no snow in his city. To bring himself New Year mood, he decided to decorate his house with some garlands.
The local store introduced a new service this year, called "Build your own garland". So you can buy some red, green and blue lamps, provide them ... | [["3\n3 3 3\n1 10 2\n2 1 1\n", "Yes\nNo\nYes\n"], ["1\n109 107 7856743\n", "No\n"], ["1\n249342 9240924 10319492\n", "No\n"], ["1\n10123 1854 1\n", "No\n"], ["6\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n", "Yes\nYes\nYes\nYes\nYes\nYes\n"], ["11\n1000000000 500000000 500000000\n1000000000 500000000 499999999\n10000000... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#2760"} |
00192a40107e0bb7 | We have N points in a two-dimensional plane.
The coordinates of the i-th point (1 \leq i \leq N) are (x_i,y_i).
Let us consider a rectangle whose sides are parallel to the coordinate axes that contains K or more of the N points in its interior.
Here, points on the sides of the rectangle are considered to be in the inte... | [["4 3\n-1000000000 -1000000000\n1000000000 1000000000\n-999999999 999999999\n999999999 -999999999", "3999999996000000001"], ["4 2\n0 0\n1 1\n2 2\n3 3", "1"], ["4 4\n1 4\n3 3\n6 2\n8 1", "21"], ["4 3\n-1000000000 -1000000000\n1000000000 1001000000\n-999999999 999999999\n999999999 -999999999", "3999999996000000001\n"], ... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#1231"} |
00240bd9cf7bbf8d | Molly Hooper has n different kinds of chemicals arranged in a line. Each of the chemicals has an affection value, The i-th of them has affection value a_{i}.
Molly wants Sherlock to fall in love with her. She intends to do this by mixing a contiguous segment of chemicals together to make a love potion with total affec... | [["4 2\n2 2 2 2\n", "8\n"], ["4 -3\n3 -6 -3 12\n", "3\n"], ["14 -9\n-2 -4 62 53 90 41 35 21 85 74 85 57 10 39\n", "0\n"], ["20 9\n90 21 -6 -61 14 -21 -17 -65 -84 -75 -48 56 67 -50 16 65 -79 -61 92 85\n", "1\n"], ["89 -7\n5972 4011 3914 670 3727 2913 6935 6927 2118 6645 7141 3585 9811 2859 459 8870 6578 8667 468 5152 32... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00000-of-00005.parquet#2311"} |
00280cdd3a8f40b5 | A sequence of non-negative integers $a_1, a_2, \dots, a_n$ is called growing if for all $i$ from $1$ to $n - 1$ all ones (of binary representation) in $a_i$ are in the places of ones (of binary representation) in $a_{i + 1}$ (in other words, $a_i \:\&\: a_{i + 1} = a_i$, where $\&$ denotes bitwise AND ). If $n = 1$ the... | [["5\n4\n1 3 7 15\n4\n1 2 4 8\n5\n1 2 3 4 5\n4\n11 13 15 1\n1\n0\n", "0 0 0 0 \n0 1 3 7 \n0 1 0 3 2 \n0 2 0 14 \n0 \n"], ["5\n4\n1 3 7 15\n4\n1 2 4 5\n5\n1 2 3 4 5\n4\n11 13 15 1\n1\n0\n", "0 0 0 0\n0 1 3 2\n0 1 0 3 2\n0 2 0 14\n0\n"], ["5\n4\n1 3 7 15\n4\n1 2 4 5\n5\n1 2 0 4 5\n4\n11 13 15 1\n1\n0\n", "0 0 0 0\n0 1 3 ... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#2990"} |
002a3bdab520fb10 | There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of the i-th vessel is ai liters.
<image>
Initially, all the vessels are empty. In some vessels water is poured. All the wa... | [["3\n5 10 8\n6\n1 1 12\n2 2\n1 1 6\n1 3 2\n2 2\n2 3\n", "7\n10\n5\n"], ["2\n5 10\n6\n1 1 4\n2 1\n1 2 5\n1 1 4\n2 1\n2 2\n", "4\n5\n8\n"], ["10\n71 59 88 55 18 98 38 73 53 58\n20\n1 5 93\n1 7 69\n2 3\n1 1 20\n2 10\n1 6 74\n1 7 100\n1 9 14\n2 3\n2 4\n2 7\n1 3 31\n2 4\n1 6 64\n2 2\n2 2\n1 3 54\n2 9\n2 1\n1 6 86\n", "0\n0... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#2992"} |
0038e0be09d1f086 | Hilbert's Hotel is a very unusual hotel since the number of rooms is infinite! In fact, there is exactly one room for every integer, including zero and negative integers. Even stranger, the hotel is currently at full capacity, meaning there is exactly one guest in every room. The hotel's manager, David Hilbert himself,... | [["6\n1\n14\n2\n1 -1\n4\n5 5 5 1\n3\n3 2 1\n2\n0 1\n5\n-239 -2 -100 -3 -11\n", "YES\nYES\nYES\nNO\nNO\nYES\n"], ["10\n1\n1000000000\n1\n-1000000000\n2\n1000000000 0\n2\n0 1000000000\n2\n1000000000 1\n2\n1 1000000000\n2\n-1000000000 0\n2\n0 -1000000000\n2\n-1000000000 1\n2\n1 -1000000000\n", "YES\nYES\nYES\nYES\nNO\nNO\... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1763"} |
00469bfb20ab0ace | There is an infinitely large pond, which we consider as a number line.
In this pond, there are N lotuses floating at coordinates 0, 1, 2, ..., N-2 and N-1.
On the lotus at coordinate i, an integer s_i is written.
You are standing on the lotus at coordinate 0. You will play a game that proceeds as follows:
- 1. Choose ... | [["5\n0 2 5 1 0\n", "3\n"], ["6\n0 10 -7 -4 -13 0\n", "0\n"], ["11\n0 -4 0 -99 31 14 -15 -39 43 18 0\n", "59\n"], ["6\n0 10 -7 -4 -5 0", "5\n"], ["5\n0 2 5 0 0", "2\n"], ["11\n0 -4 0 -99 31 14 -15 -39 43 24 0", "63\n"], ["6\n0 2 -7 -1 -5 0", "0\n"], ["11\n0 -4 0 -99 31 13 -15 -39 64 24 0", "84\n"], ["6\n0 4 -7 -1 -3 0"... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#634"} |
006909719740ac51 | There are two main kinds of events in the life of top-model: fashion shows and photo shoots. Participating in any of these events affects the rating of appropriate top-model. After each photo shoot model's rating increases by a and after each fashion show decreases by b (designers do too many experiments nowadays). Mor... | [["10 1 1 1 2 0 10\n1 1\n2 1\n3 0\n4 0\n5 1\n6 1\n7 1\n8 1\n9 1\n10 1\n", "5\n"], ["10 1 1 1 2 0 10\n1 1\n2 1\n3 0\n4 0\n5 1\n6 1\n14 1\n8 1\n9 1\n10 1\n", "5\n"], ["5 1 1 1 4 0 5\n1 0\n2 1\n3 1\n4 0\n5 0\n", "-1\n"], ["1 1 2 1 2 1 2\n1 1\n", "0\n"], ["5 1 1 0 4 0 5\n1 0\n2 1\n3 1\n4 0\n5 0\n", "-1\n"], ["1 1 2 0 2 1 2... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#563"} |
0069bbe3002f443f | We arrange the numbers between 1 and N (1 <= N <= 10000) in increasing order and decreasing order like this:
1 2 3 4 5 6 7 8 9 . . . N
N . . . 9 8 7 6 5 4 3 2 1
Two numbers faced each other form a pair. Your task is to compute the number of pairs P such that both numbers in the pairs are prime.
Input
Input cont... | [["1\n8\n7\n51", "0\n2\n2\n6\n"], ["1\n10\n7\n51", "0\n0\n2\n6\n"], ["1\n10\n7\n65", "0\n0\n2\n12\n"], ["1\n12\n7\n115", "0\n2\n2\n12\n"], ["1\n12\n9\n115", "0\n2\n3\n12\n"], ["1\n12\n9\n15", "0\n2\n3\n4\n"], ["1\n26\n9\n15", "0\n0\n3\n4\n"], ["1\n26\n11\n15", "0\n0\n2\n4\n"], ["1\n26\n11\n20", "0\n0\n2\n2\n"], ["1\n27... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1351"} |
0074ac2eeb4f1b98 | [Sakuzyo - Imprinting](https://www.youtube.com/watch?v=55Ca6av1kAY)
A.R.C. Markland-N is a tall building with n floors numbered from 1 to n. Between each two adjacent floors in the building, there is a staircase connecting them.
It's lunchtime for our sensei Colin "ConneR" Neumann Jr, and he's planning for a location... | [["5\n5 2 3\n1 2 3\n4 3 3\n4 1 2\n10 2 6\n1 2 3 4 5 7\n2 1 1\n2\n100 76 8\n76 75 36 67 41 74 10 77\n", "2\n0\n4\n0\n2\n"], ["1\n10 8 6\n4 8 7 9 6 10\n", "3\n"], ["1\n10 6 9\n8 3 6 10 9 5 2 4 7\n", "5\n"], ["1\n10 8 8\n7 10 8 9 6 3 4 5\n", "6\n"], ["1\n100 1 41\n15 19 26 17 6 16 40 31 39 13 7 33 25 9 21 20 41 23 32 27 3... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#3042"} |
007f812a4ce198be | Petya studies in a school and he adores Maths. His class has been studying arithmetic expressions. On the last class the teacher wrote three positive integers a, b, c on the blackboard. The task was to insert signs of operations '+' and '*', and probably brackets between the numbers so that the value of the resulting e... | [["1\n2\n3\n", "9\n"], ["2\n10\n3\n", "60\n"], ["1\n1\n1\n", "3\n"], ["1\n2\n1\n", "4\n"], ["10\n10\n10\n", "1000\n"], ["5\n1\n3\n", "20\n"], ["3\n1\n5\n", "20\n"], ["6\n7\n1\n", "48\n"], ["1\n8\n3\n", "27\n"], ["9\n7\n2\n", "126\n"], ["1\n1\n10\n", "20\n"], ["9\n1\n1\n", "18\n"], ["10\n5\n6\n", "300\n"], ["8\n9\n7\n",... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1120"} |
009732c43ad67407 | Once upon a time in the Kingdom of Far Far Away lived Sam the Farmer. Sam had a cow named Dawn and he was deeply attached to her. Sam would spend the whole summer stocking hay to feed Dawn in winter. Sam scythed hay and put it into haystack. As Sam was a bright farmer, he tried to make the process of storing hay simple... | [["573308928\n", "3301020 4586471433\n"], ["311933803\n", "1559669027 2495470433\n"], ["778377600\n", "4036708 6227020809\n"], ["15\n", "55 129\n"], ["99264891\n", "15587889 794119137\n"], ["864864000\n", "4331048 6918912009\n"], ["905969664\n", "4529412 7247757321\n"], ["14\n", "58 121\n"], ["999905161\n", "1000161721... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#83"} |
009e8913da3c15d2 | You are given N non-negative integers A_1, A_2, ..., A_N and another non-negative integer K.
For a integer X between 0 and K (inclusive), let f(X) = (X XOR A_1) + (X XOR A_2) + ... + (X XOR A_N).
Here, for non-negative integers a and b, a XOR b denotes the bitwise exclusive OR of a and b.
Find the maximum value of f.
W... | [["3 7\n1 6 3\n", "14\n"], ["4 9\n7 4 0 3\n", "46\n"], ["1 0\n1000000000000\n", "1000000000000\n"], ["7955 831342842227\n773279391655 268237595563 155144822866 584454660887 140872371407 705890950740 54081885806 612061280401 686025959070 55273797747 33335829647 243638189922 956408398664 998430588409 302426564401 5747846... | 1.02 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1221"} |
009fb50ee4a833d5 | Petya and Vasya decided to play a little. They found n red cubes and m blue cubes. The game goes like that: the players take turns to choose a cube of some color (red or blue) and put it in a line from left to right (overall the line will have n + m cubes). Petya moves first. Petya's task is to get as many pairs of nei... | [["3 1\n", "2 1\n"], ["2 4\n", "3 2\n"], ["1 1\n", "0 1\n"], ["2 1\n", "1 1\n"], ["4 4\n", "3 4\n"], ["10 7\n", "9 7\n"], ["5 13\n", "12 5\n"], ["7 11\n", "10 7\n"], ["1 2\n", "1 1\n"], ["10 10\n", "9 10\n"], ["50 30\n", "49 30\n"], ["80 120\n", "119 80\n"], ["304 122\n", "303 122\n"], ["500 800\n", "799 500\n"], ["900... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1036"} |
00a7441e571c7676 | Neko is playing with his toys on the backyard of Aki's house. Aki decided to play a prank on him, by secretly putting catnip into Neko's toys. Unfortunately, he went overboard and put an entire bag of catnip into the toys...
It took Neko an entire day to turn back to normal. Neko reported to Aki that he saw a lot of w... | [["1\n", "1\n"], ["2\n", "3\n"], ["3\n", "9\n"], ["4\n", "27\n"], ["5\n", "84\n"], ["6\n", "270\n"], ["7\n", "892\n"], ["8\n", "3012\n"], ["9\n", "10350\n"], ["10\n", "36074\n"], ["11\n", "127218\n"], ["12\n", "453096\n"], ["13\n", "1627377\n"], ["14\n", "5887659\n"], ["15\n", "21436353\n"], ["450\n", "690479399\n"], [... | 1.86 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1670"} |
00ab32a690701a66 | Polycarp was dismantling his attic and found an old floppy drive on it. A round disc was inserted into the drive with $n$ integers written on it.
Polycarp wrote the numbers from the disk into the $a$ array. It turned out that the drive works according to the following algorithm:
the drive takes one positive number $x... | [["3\n3 3\n1 -3 4\n1 5 2\n2 2\n-2 0\n1 2\n2 2\n0 1\n1 2\n", "0 6 2 \n-1 -1 \n1 3 \n"], ["3\n3 3\n1 -3 4\n1 5 2\n2 2\n-4 0\n1 2\n2 2\n0 1\n1 2\n", "0 6 2\n-1 -1\n1 3\n"], ["3\n3 3\n1 -3 4\n1 5 2\n2 2\n-2 0\n1 2\n2 2\n0 2\n1 2\n", "0 6 2\n-1 -1\n1 1\n"], ["3\n3 3\n2 -3 4\n1 5 2\n2 2\n-4 0\n1 2\n2 2\n0 1\n1 2\n", "0 3 0\n... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#2617"} |
00b51ede2c1da0da | Yakko, Wakko and Dot, world-famous animaniacs, decided to rest from acting in cartoons, and take a leave to travel a bit. Yakko dreamt to go to Pennsylvania, his Motherland and the Motherland of his ancestors. Wakko thought about Tasmania, its beaches, sun and sea. Dot chose Transylvania as the most mysterious and unpr... | [["6 6\n", "1/6\n"], ["1 4\n", "1/2\n"], ["4 4\n", "1/2\n"], ["3 3\n", "2/3\n"], ["6 4\n", "1/6\n"], ["6 3\n", "1/6\n"], ["5 4\n", "1/3\n"], ["5 6\n", "1/6\n"], ["3 4\n", "1/2\n"], ["1 3\n", "2/3\n"], ["3 2\n", "2/3\n"], ["5 5\n", "1/3\n"], ["1 1\n", "1/1\n"], ["2 1\n", "5/6\n"], ["3 1\n", "2/3\n"], ["3 5\n", "1/3\n"],... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#931"} |
00bae7c2ad3d1d96 | After you had helped George and Alex to move in the dorm, they went to help their friend Fedor play a new computer game «Call of Soldiers 3».
The game has (m + 1) players and n types of soldiers in total. Players «Call of Soldiers 3» are numbered form 1 to (m + 1). Types of soldiers are numbered from 0 to n - 1. Each ... | [["7 3 1\n8\n5\n111\n17\n", "0\n"], ["3 3 3\n1\n2\n3\n4\n", "3\n"], ["4 2 2\n5\n6\n7\n", "2\n"], ["4 7 4\n9\n10\n5\n12\n4\n12\n7\n10\n", "7\n"], ["2 7 2\n1\n1\n1\n1\n1\n1\n1\n1\n", "7\n"], ["6 8 2\n46\n59\n38\n5\n13\n54\n26\n62\n18\n", "2\n"], ["5 6 3\n16\n9\n24\n5\n17\n27\n20\n", "4\n"], ["7 9 1\n27\n7\n12\n29\n51\n67... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#962"} |
00c021f4508b6c56 | The only difference between easy and hard versions is constraints.
A session has begun at Beland State University. Many students are taking exams.
Polygraph Poligrafovich is going to examine a group of $n$ students. Students will take the exam one-by-one in order from $1$-th to $n$-th. Rules of the exam are following... | [["7 15\n1 2 3 4 5 6 7\n", "0 0 0 0 0 2 3 "], ["5 100\n80 40 40 40 60\n", "0 1 1 2 3 "], ["1 1\n1\n", "0 "], ["1 100\n99\n", "0 "], ["1 100\n100\n", "0 "], ["2 100\n100 100\n", "0 1 "], ["2 100\n1 100\n", "0 1 "], ["2 100\n1 99\n", "0 0 "], ["3 100\n34 34 34\n", "0 0 1 "], ["10 50\n9 9 9 9 9 9 9 9 9 9\n", "0 0 0 0 0 1 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1583"} |
00c379cb4c9cf7a8 | You are given a string s, consisting of small Latin letters. Let's denote the length of the string as |s|. The characters in the string are numbered starting from 1.
Your task is to find out if it is possible to rearrange characters in string s so that for any prime number p ≤ |s| and for any integer i ranging from 1... | [["wtwwttwttwwwwwwwwtwtwwwwwtwwtwwtwwwwwtwtwtwtwwtwwwtwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwtwwwwwwwwwwwtwwwwwtwttwwwwtwwwwwwwwwwwwwwwwwtwwwwtwwwwwwwwwwwwwttwtwwwwwtwwtwwwwwwwtwwttttwwwwwwwwwwwwwwwwwwwtwwwttwtwwtwwtwwtwwwwtwwtwtwwtwwwwwwwwwwtwwww\n", "NO\n"], ["rrrvjurvrrsukrsrvxskrrrrbrapyrmrmvprmrseuakrmrnvokshwoawhnrb... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#976"} |
00de2cdb443af4d8 | Alice and Bob are playing a fun game of tree tag.
The game is played on a tree of n vertices numbered from 1 to n. Recall that a tree on n vertices is an undirected, connected graph with n-1 edges.
Initially, Alice is located at vertex a, and Bob at vertex b. They take turns alternately, and Alice makes the first mov... | [["1\n5 5 4 3 4\n1 2\n4 1\n5 1\n5 3\n", "Alice\n"], ["1\n9 1 5 3 7\n1 2\n2 3\n3 4\n4 5\n3 6\n7 8\n8 9\n6 7\n", "Alice\n"], ["10\n10 9 10 6 6\n6 1\n7 6\n4 2\n4 10\n5 1\n9 5\n6 8\n3 4\n4 5\n2 1 2 1 1\n2 1\n9 7 4 2 3\n5 1\n2 4\n4 8\n8 6\n8 9\n7 8\n1 8\n1 3\n11 2 11 6 8\n1 10\n6 11\n8 2\n11 3\n1 7\n11 4\n5 8\n11 7\n1 9\n1 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#873"} |
00e3194cb17092a4 | The kingdom of Lazyland is the home to $n$ idlers. These idlers are incredibly lazy and create many problems to their ruler, the mighty King of Lazyland.
Today $k$ important jobs for the kingdom ($k \le n$) should be performed. Every job should be done by one person and every person can do at most one job. The King a... | [["8 7\n1 1 3 1 5 3 7 1\n5 7 4 8 1 3 5 2\n", "10\n"], ["3 3\n3 1 2\n5 3 4\n", "0\n"], ["14 6\n2 3 6 6 6 2 5 3 5 5 5 6 5 5\n56 41 19 81 19 32 99 37 97 20 90 44 19 79\n", "38\n"], ["12 9\n6 8 2 6 8 2 6 6 6 5 1 1\n59 27 78 92 31 26 59 12 80 77 94 31\n", "96\n"], ["13 3\n3 1 3 1 1 1 3 3 1 3 3 3 3\n38 75 29 50 99 5 44 33 45... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1334"} |
01062a90fea8345b | As it has been found out recently, all the Berland's current economical state can be described using a simple table n × m in size. n — the number of days in each Berland month, m — the number of months. Thus, a table cell corresponds to a day and a month of the Berland's year. Each cell will contain either 1, or -1, wh... | [["2 2\n0\n100\n", "2\n"], ["2 2\n1\n1 1 -1\n100\n", "1\n"], ["3 5\n4\n1 1 -1\n2 1 1\n3 1 -1\n1 2 1\n1000000007\n", "0\n"], ["4 4\n1\n3 3 -1\n852367357\n", "256\n"], ["4 11\n6\n3 10 1\n2 10 -1\n2 6 -1\n2 3 -1\n4 4 -1\n2 2 1\n841447432\n", "0\n"], ["3 10\n6\n1 6 -1\n1 3 1\n1 7 -1\n3 2 1\n2 1 1\n2 10 -1\n483723090\n", "0... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#1319"} |
0115b3064e4507bb | Naturally, the magical girl is very good at performing magic. She recently met her master wizard Devu, who gifted her R potions of red liquid,
B potions of blue liquid, and G potions of green liquid.
-
The red liquid potions have liquid amounts given by r[1], ..., r[R] liters.
-
The green liquid potions have liqu... | [["3\n1 1 1 1\n1\n2\n3\n1 1 1 1\n2\n4\n6\n3 2 2 2\n1 2 3\n2 4\n6 8\n", "2\n4\n4\n"], ["3\n1 1 1 1\n1\n2\n3\n1 1 1 1\n3\n4\n6\n3 2 2 2\n1 2 3\n2 4\n6 8", "2\n4\n4\n"], ["3\n1 1 1 1\n1\n4\n5\n1 1 1 1\n3\n4\n6\n3 2 2 2\n2 2 3\n2 7\n6 8", "4\n4\n4\n"], ["3\n1 1 1 1\n1\n4\n5\n1 1 1 2\n3\n4\n6\n3 2 2 2\n2 2 3\n2 7\n6 8", "4\... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00003-of-00005.parquet#600"} |
011847e6f576170a | The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. [Image]
One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of h_{i} centimeter... | [["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5\n", "4\n"], ["5 2\n1 15 2\n1 11 2\n0 17 2\n0 16 1\n1 18 2\n", "0\n"], ["6 2\n1 17 3\n1 6 1\n0 4 2\n1 10 1\n1 7 3\n1 5 1\n", "0\n"], ["7 2\n1 14 1\n1 9 2\n0 6 3\n0 20 2\n0 4 2\n0 3 1\n0 9 2\n", "0\n"], ["8 2\n0 20 3\n1 5 2\n1 4 1\n1 7 1\n0 1 3\n1 5 3\n1 7 2\n1 3 1\n", "2\n"], ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#746"} |
01186f7ec7dfaf9a | Ania has a large integer $S$. Its decimal representation has length $n$ and doesn't contain any leading zeroes. Ania is allowed to change at most $k$ digits of $S$. She wants to do it in such a way that $S$ still won't contain any leading zeroes and it'll be minimal possible. What integer will Ania finish with?
-----... | [["5 3\n51528\n", "10028\n"], ["3 2\n102\n", "100\n"], ["1 1\n1\n", "0\n"], ["8 3\n76185080\n", "10085080\n"], ["10 9\n6605076924\n", "1000000000\n"], ["17 14\n70419129275429261\n", "10000000000000061\n"], ["1 0\n1\n", "1\n"], ["1 1\n0\n", "0\n"], ["2 1\n16\n", "10\n"], ["1 0\n0\n", "0\n"], ["400 224\n34034718296316650... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1410"} |
0121899df57d50a8 | You are given an undirected connected weighted graph with N vertices and M edges that contains neither self-loops nor double edges.
The i-th (1≤i≤M) edge connects vertex a_i and vertex b_i with a distance of c_i.
Here, a self-loop is an edge where a_i = b_i (1≤i≤M), and double edges are two edges where (a_i,b_i)=(a_j... | [["3 3\n1 2 1\n1 3 1\n2 3 3\n", "1\n"], ["3 2\n1 2 1\n2 3 1\n", "0\n"], ["15 14\n1 2 522\n2 3 575\n3 4 426\n4 5 445\n5 6 772\n6 7 81\n7 8 447\n8 9 629\n9 10 497\n10 11 202\n11 12 775\n12 13 325\n13 14 982\n14 15 784\n", "0\n"], ["53 53\n1 2 980\n2 3 221\n3 4 895\n4 5 501\n5 6 152\n6 7 325\n7 8 731\n8 9 302\n9 10 153\n1... | 1.36 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#390"} |
0127d3ac142cccf0 | Since Grisha behaved well last year, at New Year's Eve he was visited by Ded Moroz who brought an enormous bag of gifts with him! The bag contains n sweet candies from the good ol' bakery, each labeled from 1 to n corresponding to its tastiness. No two candies have the same tastiness.
The choice of candies has a direc... | [["4 3\n", "7\n"], ["6 6\n", "7\n"], ["2 2\n", "3\n"], ["1022 10\n", "1023\n"], ["415853337373441 52\n", "562949953421311\n"], ["75 12\n", "127\n"], ["1000000000000000000 1000000000000000000\n", "1152921504606846975\n"], ["1 1\n", "1\n"], ["1000000000000000000 2\n", "1152921504606846975\n"], ["49194939 22\n", "67108863... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#256"} |
012beed29f2595ac | There are $n$ players sitting at the card table. Each player has a favorite number. The favorite number of the $j$-th player is $f_j$.
There are $k \cdot n$ cards on the table. Each card contains a single integer: the $i$-th card contains number $c_i$. Also, you are given a sequence $h_1, h_2, \dots, h_k$. Its meaning... | [["4 3\n1 3 2 8 5 5 8 2 2 8 5 2\n1 2 2 5\n2 6 7\n", "21\n"], ["3 3\n9 9 9 9 9 9 9 9 9\n1 2 3\n1 2 3\n", "0\n"], ["1 1\n1\n2\n1\n", "0\n"], ["1 1\n1\n1\n1\n", "1\n"], ["1 1\n1\n1\n100000\n", "100000\n"], ["50 1\n52 96 99 37 143 148 10 140 131 29 82 134 56 73 121 57 98 101 134 4 103 10 86 70 4 98 102 35 149 47 136 87 4 1... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1507"} |
0133421dd8ebf8f5 | Snuke signed up for a new website which holds programming competitions.
He worried that he might forget his password, and he took notes of it.
Since directly recording his password would cause him trouble if stolen,
he took two notes: one contains the characters at the odd-numbered positions, and the other contains the... | [["xyz\nabc\n", "xaybzc\n"], ["atcoderbeginnercontest\natcoderregularcontest\n", "aattccooddeerrbreeggiunlnaerrccoonntteesstt\n"], ["atcoderbeeinnercontgst\natcoderregularcontest", "aattccooddeerrbreeegiunlnaerrccoonnttegsstt\n"], ["xyz\nacc", "xayczc\n"], ["atcoderbeeinnercontgst\natcoaerreguldrcontest", "aattccoodaee... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1336"} |
013585c41d63f672 | In some country live wizards. They love to ride trolleybuses.
A city in this country has a trolleybus depot with n trolleybuses. Every day the trolleybuses leave the depot, one by one and go to the final station. The final station is at a distance of d meters from the depot. We know for the i-th trolleybus that it lea... | [["1 2 7\n20 13\n", "22.645751311\n"], ["8 4 13\n0 18\n6 24\n10 25\n11 5\n12 18\n20 22\n21 8\n22 12\n", "2.549509757\n8.549509757\n12.549509757\n14.225000000\n14.549509757\n22.549509757\n23.625000000\n24.549509757\n"], ["3 6 19\n12 3\n20 24\n30 2\n", "18.583333333\n22.516611478\n39.666666667\n"], ["4 5 14\n11 1\n16 20\... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00003-of-00005.parquet#1513"} |
01360ddbc3323adf | Takahashi, Nakahashi and Hikuhashi have integers A, B and C, respectively. After repeating the following operation K times, find the integer Takahashi will get minus the integer Nakahashi will get:
* Each of them simultaneously calculate the sum of the integers that the other two people have, then replace his own inte... | [["2 2 3 1", "0\n"], ["0 3 2 0", "-3\n"], ["1000000000 1000000010 1000000000 1000000000000000000", "-10\n"], ["2 3 3 1", "1\n"], ["4 3 3 1", "-1\n"], ["0 3 2 -1", "3.0\n"], ["-1 3 4 -1", "4.0\n"], ["1000000000 0000000010 1000000010 1000010100000000000", "999999990\n"], ["-2 3 8 -1", "5.0\n"], ["1000010000 0000000010 11... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1496"} |
014f5d5af2bc709e | Sean is trying to save a large file to a USB flash drive. He has n USB flash drives with capacities equal to a_1, a_2, ..., a_{n} megabytes. The file size is equal to m megabytes.
Find the minimum number of USB flash drives needed to write Sean's file, if he can split the file between drives.
-----Input-----
The f... | [["3\n5\n2\n1\n3\n", "2\n"], ["3\n6\n2\n3\n2\n", "3\n"], ["2\n5\n5\n10\n", "1\n"], ["5\n16\n8\n1\n3\n4\n9\n", "2\n"], ["10\n121\n10\n37\n74\n56\n42\n39\n6\n68\n8\n100\n", "2\n"], ["12\n4773\n325\n377\n192\n780\n881\n816\n839\n223\n215\n125\n952\n8\n", "7\n"], ["15\n7758\n182\n272\n763\n910\n24\n359\n583\n890\n735\n819\... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1185"} |
015b841eb0ef14e4 | Recently you've discovered a new shooter. They say it has realistic game mechanics.
Your character has a gun with magazine size equal to $k$ and should exterminate $n$ waves of monsters. The $i$-th wave consists of $a_i$ monsters and happens from the $l_i$-th moment of time up to the $r_i$-th moments of time. All $a_i... | [["2 3\n2 3 6\n3 4 3\n", "9\n"], ["2 5\n3 7 11\n10 12 15\n", "30\n"], ["5 42\n42 42 42\n42 43 42\n43 44 42\n44 45 42\n45 45 1\n", "-1\n"], ["1 10\n100 111 1\n", "1\n"], ["1 1000000000\n1 1 1000000000\n", "1000000000\n"], ["10 89\n1 2 82\n2 2 31\n3 4 63\n6 7 18\n9 9 44\n10 11 95\n13 13 52\n13 15 39\n15 16 70\n17 18 54\n... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#562"} |
015cd9c96b1931ef | You are given a sequence of numbers a_1, a_2, ..., a_{n}, and a number m.
Check if it is possible to choose a non-empty subsequence a_{i}_{j} such that the sum of numbers in this subsequence is divisible by m.
-----Input-----
The first line contains two numbers, n and m (1 ≤ n ≤ 10^6, 2 ≤ m ≤ 10^3) — the size of th... | [["3 5\n1 2 3\n", "YES\n"], ["1 6\n5\n", "NO\n"], ["4 6\n3 1 1 3\n", "YES\n"], ["6 6\n5 5 5 5 5 5\n", "YES\n"], ["4 5\n1 1 1 1\n", "NO\n"], ["5 5\n1 1 1 1 1\n", "YES\n"], ["4 7\n1 2 3 3\n", "YES\n"], ["1 47\n0\n", "YES\n"], ["2 47\n1 0\n", "YES\n"], ["9 11\n8 8 8 8 8 8 8 8 5\n", "NO\n"], ["10 11\n8 8 8 8 8 8 8 8 7 8\n"... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1518"} |
01610315b8157ef5 | You are organizing a boxing tournament, where $n$ boxers will participate ($n$ is a power of $2$), and your friend is one of them. All boxers have different strength from $1$ to $n$, and boxer $i$ wins in the match against boxer $j$ if and only if $i$ is stronger than $j$.
The tournament will be organized as follows: ... | [["4\n3 9 1 -1\n", "0"], ["8\n11 -1 13 19 24 7 17 5\n", "12"], ["8\n-1 1 10 10 10 5 6 1\n", "7"], ["2\n-1 1000000000\n", "1000000000"], ["2\n1000000000 -1\n", "0"], ["8\n-1 8 8 8 1 1 1 1\n", "3"], ["16\n-1 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2\n", "14"], ["4\n1 -1 1 1\n", "1"], ["8\n-1 2 2 2 2 1 1 1\n", "3"], ["32\n8 4 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#72"} |
0166e604edd8f2b0 | There are $n$ seats in the train's car and there is exactly one passenger occupying every seat. The seats are numbered from $1$ to $n$ from left to right. The trip is long, so each passenger will become hungry at some moment of time and will go to take boiled water for his noodles. The person at seat $i$ ($1 \leq i \le... | [["5 314\n0 310 942 628 0\n", "314 628 1256 942 1570 \n"], ["1 1\n1\n", "2 \n"], ["1 1000000000\n999999999\n", "1999999999 \n"], ["1 1\n1\n", "2 "], ["1 1000000000\n999999999\n", "1999999999 "], ["100 1000000000\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 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 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#488"} |
017bbfdef5368e6b | Morning desert sun horizon
Rise above the sands of time...
Fates Warning, "Exodus"
After crossing the Windswept Wastes, Ori has finally reached the Windtorn Ruins to find the Heart of the Forest! However, the ancient repository containing this priceless Willow light did not want to open!
Ori was taken aback, but th... | [["1\n10\ngepardotop\n", "27\n"], ["7\n1\na\n2\naa\n2\nab\n2\nba\n2\nbb\n26\nabcdefghijklmnopqrstuvwxyz\n26\nzyxwvutsrqponmlkjihgfedcba\n", "1\n2\n3\n2\n2\n351\n26\n"], ["1\n10\ngepardotpp\n", "27\n"], ["7\n1\na\n2\naa\n2\nab\n2\nba\n2\nbc\n26\nabcdefghijklmnopqrstuvwxyz\n26\nzyxwvutsrqponmlkjihgfedcba\n", "1\n2\n3\n2\... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#20"} |
01820459c8b81491 | Let's suppose you have an array a, a stack s (initially empty) and an array b (also initially empty).
You may perform the following operations until both a and s are empty:
* Take the first element of a, push it into s and remove it from a (if a is not empty);
* Take the top element from s, append it to the end ... | [["5 3\n2 3 1\n", "-1"], ["5 3\n3 2 1\n", "3 2 1 5 4 "], ["5 2\n3 4\n", "-1"], ["5 1\n3\n", "3 2 1 5 4 "], ["10 7\n10 8 5 1 2 7 3\n", "-1"], ["4 3\n3 4 2\n", "-1"], ["10 4\n2 1 3 4\n", "2 1 3 4 10 9 8 7 6 5 "], ["10 4\n2 1 7 3\n", "2 1 7 3 6 5 4 10 9 8 "], ["20 5\n11 19 6 2 12\n", "-1"], ["2 1\n1\n", "1 2 "], ["10 3\n2... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#1047"} |
0189ce7b9c227027 | Problem
Alice and Bob are competing in the 50m dash.
However, in this world, the higher the AOJ rate is, the better, so the higher the AOJ rate wins.
If there is no AOJ rate on either side, there is no comparison, so there is no choice but to compete in the 50m sprint time. In this case, the one with the shorter time ... | [["9 8 1000 1674", "Bob\n"], ["9 9 2849 -1", "Draw\n"], ["9 9 2849 0", "Alice\n"], ["9 8 1000 1100", "Bob\n"], ["9 8 1000 3269", "Bob\n"], ["9 8 1000 1101", "Bob\n"], ["9 8 1000 5146", "Bob\n"], ["10 9 2849 0", "Alice\n"], ["9 11 1000 1101", "Bob\n"], ["9 8 1000 9934", "Bob\n"], ["10 9 2232 0", "Alice\n"], ["9 11 1000 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#790"} |
018affe38c764e01 | You are at the top left cell $(1, 1)$ of an $n \times m$ labyrinth. Your goal is to get to the bottom right cell $(n, m)$. You can only move right or down, one cell per step. Moving right from a cell $(x, y)$ takes you to the cell $(x, y + 1)$, while moving down takes you to the cell $(x + 1, y)$.
Some cells of the la... | [["1 1\n.\n", "1\n"], ["2 3\n...\n..R\n", "0\n"], ["4 4\n...R\n.RR.\n.RR.\nR...\n", "4\n"], ["1 3\n.R.\n", "0\n"], ["2 2\n.R\nR.\n", "0\n"], ["10 10\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n", "48620\n"], ["1 3\n.R.\n", "0\n"], ["2 2\n.R\nR... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1594"} |
0193d8cbd6bc3e89 | Takahashi and Aoki will take N exams numbered 1 to N. They have decided to compete in these exams. The winner will be determined as follows:
* For each exam i, Takahashi decides its importance c_i, which must be an integer between l_i and u_i (inclusive).
* Let A be \sum_{i=1}^{N} c_i \times (Takahashi's score on Exa... | [["2 100\n85 2 6\n60 1 1", "95\n"], ["10 1000\n451 4593 6263\n324 310 9662\n378 1431 7068\n71 1757 9218\n204 3676 4328\n840 6221 9080\n684 1545 8511\n709 5467 8674\n862 6504 9835\n283 4965 9980", "2540\n"], ["1 100000\n31415 2718 1443", "31415\n"], ["2 100\n85 2 11\n60 1 1", "91\n"], ["10 1000\n451 4593 6263\n324 310 9... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#464"} |
01a6ef616d77a37f | One Big Software Company has n employees numbered from 1 to n. The director is assigned number 1. Every employee of the company except the director has exactly one immediate superior. The director, of course, doesn't have a superior.
We will call person a a subordinates of another person b, if either b is an immediate... | [["7\n-1 3\n1 2\n1 1\n1 4\n4 5\n4 3\n5 2\n", "17\n"], ["20\n-1 100\n1 35\n1 22\n1 28\n1 2\n1 8\n1 17\n1 50\n5 37\n1 25\n1 29\n5 21\n4 16\n2 39\n1 41\n3 28\n3 30\n2 36\n2 26\n14 17\n", "548\n"], ["2\n-1 1\n1 2\n", "2\n"], ["3\n-1 1\n1 2\n1 3\n", "6\n"], ["4\n-1 1\n1 100\n1 100\n1 100\n", "300\n"], ["3\n-1 1\n1 2\n2 3\n"... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#455"} |
01b6750402c3293f | Yaroslav thinks that two strings s and w, consisting of digits and having length n are non-comparable if there are two numbers, i and j (1 ≤ i, j ≤ n), such that s_{i} > w_{i} and s_{j} < w_{j}. Here sign s_{i} represents the i-th digit of string s, similarly, w_{j} represents the j-th digit of string w.
A string's te... | [["2\n90\n09\n", "1\n"], ["2\n11\n55\n", "0\n"], ["5\n?????\n?????\n", "993531194\n"], ["10\n104?3?1??3\n?1755?1??7\n", "91015750\n"], ["10\n6276405116\n6787?352?9\n", "46\n"], ["10\n0844033584\n0031021311\n", "0\n"], ["10\n???0?19?01\n957461????\n", "983368000\n"], ["10\n8703870339\n994987934?\n", "9\n"], ["10\n?8?528... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1490"} |
01bdd6f9fea15538 | You are given a complete undirected graph. For each pair of vertices you are given the length of the edge that connects them. Find the shortest paths between each pair of vertices in the graph and return the length of the longest of them.
Input
The first line of the input contains a single integer N (3 ≤ N ≤ 10).
Th... | [["3\n0 1 1\n1 0 4\n1 4 0\n", "2"], ["4\n0 1 2 3\n1 0 4 5\n2 4 0 6\n3 5 6 0\n", "5"], ["6\n0 41 48 86 94 14\n41 0 1 30 59 39\n48 1 0 9 31 49\n86 30 9 0 48 30\n94 59 31 48 0 33\n14 39 49 30 33 0\n", "47"], ["6\n0 92 9 24 50 94\n92 0 70 73 57 87\n9 70 0 31 14 100\n24 73 31 0 66 25\n50 57 14 66 0 81\n94 87 100 25 81 0\n",... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00000-of-00005.parquet#2925"} |
01c2fe1aefd32b63 | Initially Ildar has an empty array. He performs $n$ steps. On each step he takes a subset of integers already added to the array and appends the mex of this subset to the array.
The mex of an multiset of integers is the smallest non-negative integer not presented in the multiset. For example, the mex of the multiset ... | [["4\n0 1 2 1\n", "-1"], ["3\n1 0 1\n", "1"], ["4\n0 1 2 239\n", "4"], ["1\n0\n", "-1"], ["1\n1\n", "1"], ["1\n1000000000\n", "1"], ["2\n0 0\n", "-1"], ["2\n0 1\n", "-1"], ["2\n0 1000000000\n", "2"], ["2\n0 2\n", "2"], ["2\n1 1\n", "1"], ["2\n1 2\n", "1"], ["2\n0 2\n", "2"], ["2\n1 1\n", "1"], ["5\n0 0 0 0 0\n", "-1"],... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#70"} |
01c5375793b4350f | Nothing is eternal in the world, Kostya understood it on the 7-th of January when he saw partially dead four-color garland.
Now he has a goal to replace dead light bulbs, however he doesn't know how many light bulbs for each color are required. It is guaranteed that for each of four colors at least one light is workin... | [["!RGYB\n", "0 1 0 0\n"], ["!!!!YGRB\n", "1 1 1 1\n"], ["RYBGRYBGR\n", "0 0 0 0\n"], ["!GB!RG!Y!\n", "2 1 1 0\n"], ["G!!!!Y!!!!R!!!!B\n", "3 3 3 3\n"], ["GBYRG\n", "0 0 0 0\n"], ["RBYGR\n", "0 0 0 0\n"], ["GY!!!!R!!Y!B\n", "2 2 1 2\n"], ["!!GYRBGY!BGY!BGY!BGYR!G!RBGYRBGYR!G!RBGY!BGY!!GY!BGY!BGYRBGYR!GYRBGYR!G!!BGY!!GY... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#1766"} |
01ca01b02f204fe4 | Example
Input
6 3
1 0 0 1 0 1
1 3 2
Output
1 | [["1 3\n1 0 0 1 0 1\n1 3 2", "0\n"], ["6 3\n1 0 1 0 0 1\n1 3 2", "2\n"], ["6 3\n1 0 0 1 0 1\n0 3 3", "4\n"], ["6 3\n0 1 0 1 0 1\n0 3 3", "3\n"], ["6 3\n1 0 1 1 0 0\n1 3 2", "1\n"], ["1 3\n1 0 0 1 0 1\n2 3 2", "0\n"], ["1 3\n1 0 0 1 0 1\n2 3 1", "0\n"], ["1 3\n1 0 0 1 0 1\n2 0 1", "0\n"], ["1 3\n1 0 0 1 0 1\n1 3 1", "0\... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#496"} |
01cec3ccb1be4923 | Bessie has way too many friends because she is everyone's favorite cow! Her new friend Rabbit is trying to hop over so they can play!
More specifically, he wants to get from (0,0) to (x,0) by making multiple hops. He is only willing to hop from one point to another point on the 2D plane if the Euclidean distance betw... | [["4\n2 4\n1 3\n3 12\n3 4 5\n1 5\n5\n2 10\n15 4\n", "2\n3\n1\n2\n"], ["1\n10 999999733\n25 68 91 55 36 29 96 4 63 3\n", "10416664\n"], ["1\n1 11\n5\n", "3\n"], ["1\n2 9\n2 4\n", "3\n"], ["1\n19 1000000000\n15 8 22 12 10 16 2 17 14 7 20 23 9 18 3 19 21 11 1\n", "43478261\n"], ["1\n1 5\n2\n", "3\n"], ["1\n10 999999733\n2... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#3161"} |
01e6eedbf0e9bbb2 | One day Misha and Andrew were playing a very simple game. First, each player chooses an integer in the range from 1 to n. Let's assume that Misha chose number m, and Andrew chose number a.
Then, by using a random generator they choose a random integer c in the range between 1 and n (any integer from 1 to n is chosen w... | [["3 1\n", "2"], ["4 3\n", "2"], ["5 5\n", "4"], ["10 5\n", "6"], ["20 13\n", "12"], ["51 1\n", "2"], ["100 50\n", "51"], ["100 51\n", "50"], ["100 49\n", "50"], ["1000000000 1000000000\n", "999999999"], ["1000000000 1\n", "2"], ["1000000000 100000000\n", "100000001"], ["1000000000 500000000\n", "500000001"], ["1000000... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1631"} |
01efd3c4c72a26e6 | One day Jeff got hold of an integer sequence a_1, a_2, ..., a_{n} of length n. The boy immediately decided to analyze the sequence. For that, he needs to find all values of x, for which these conditions hold:
x occurs in sequence a. Consider all positions of numbers x in the sequence a (such i, that a_{i} = x). The... | [["1\n2\n", "1\n2 0\n"], ["8\n1 2 1 3 1 2 1 5\n", "4\n1 2\n2 4\n3 0\n5 0\n"], ["3\n1 10 5\n", "3\n1 0\n5 0\n10 0\n"], ["4\n9 9 3 5\n", "3\n3 0\n5 0\n9 1\n"], ["6\n1 2 2 1 1 2\n", "0\n"], ["6\n2 6 3 8 7 2\n", "5\n2 5\n3 0\n6 0\n7 0\n8 0\n"], ["7\n2 1 2 1 2 1 2\n", "2\n1 2\n2 2\n"], ["8\n1 1 1 1 1 1 1 1\n", "1\n1 1\n"], ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1157"} |
01f28dca4d2b30dc | There are 3N participants in AtCoder Group Contest. The strength of the i-th participant is represented by an integer a_i. They will form N teams, each consisting of three participants. No participant may belong to multiple teams.
The strength of a team is defined as the second largest strength among its members. For ... | [["2\n2 2 8 5 1 5", "7\n"], ["10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1100000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#266"} |
01f4610f7ca48331 | Vlad enjoys listening to music. He lives in Sam's Town. A few days ago he had a birthday, so his parents gave him a gift: MP3-player! Vlad was the happiest man in the world! Now he can listen his favorite songs whenever he wants!
Vlad built up his own playlist. The playlist consists of N songs, each has a unique positi... | [["3\n4\n1 3 4 2\n2\n5\n1 2 3 9 4\n5\n5\n1 2 3 9 4 \n1\n\n\n", "3\n4\n1\n"], ["3\n4\n1 3 4 2\n2\n5\n1 2 3 9 4\n5\n5\n1 2 3 9 4 \n2", "3\n4\n2\n"], ["3\n4\n1 3 7 2\n1\n5\n1 2 0 9 4\n5\n5\n1 2 3 9 4 \n2", "1\n4\n2\n"], ["3\n4\n1 3 4 2\n1\n5\n1 2 0 2 4\n5\n5\n1 2 3 9 4 \n2", "1\n5\n2\n"], ["3\n4\n1 3 4 2\n2\n5\n1 2 3 9 8\... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#430"} |
01f5e1242b1a7718 | This is the easy version of the problem. The only difference between the easy version and the hard version is the constraints on n. You can only make hacks if both versions are solved.
A permutation of 1, 2, …, n is a sequence of n integers, where each integer from 1 to n appears exactly once. For example, [2,3,1,4] i... | [["29 170254369\n", "126180810\n"], ["7 941492387\n", "2725016\n"], ["11 685146646\n", "534097912\n"], ["4 1\n", "0\n"], ["13 41313494\n", "32605755\n"], ["6 58376259\n", "45926\n"], ["1 1\n", "0\n"], ["5 585325539\n", "904\n"], ["41 221687094\n", "4087910\n"], ["47 700253046\n", "485612847\n"], ["50 134170081\n", "214... | 2.29 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#2"} |
020442763ad7cc28 | Problem A Secret of Chocolate Poles
Wendy, the master of a chocolate shop, is thinking of displaying poles of chocolate disks in the showcase. She can use three kinds of chocolate disks: white thin disks, dark thin disks, and dark thick disks. The thin disks are $1$ cm thick, and the thick disks are $k$ cm thick. Disk... | [["5 4", "4\n"], ["2 4", "1\n"], ["4 4", "3\n"], ["7 4", "7\n"], ["7 3", "11\n"], ["11 3", "32\n"], ["7 2", "14\n"], ["17 3", "142\n"], ["31 3", "4179\n"], ["25 3", "985\n"], ["25 2", "2511\n"], ["25 4", "427\n"], ["6 2", "10\n"], ["6 3", "6\n"], ["10 3", "19\n"], ["4 5", "2\n"], ["12 8", "12\n"], ["24 3", "608\n"], ["... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00003-of-00005.parquet#942"} |
02070c6b37bf586b | There is a house with $n$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $n$ integer numbers $a_1, a_2, \dots, a_n$, where $a_i = 1$ if in the $i$-th flat the light is on and $a_i = 0$ otherwise.
Vova thinks that people in the $i$-th ... | [["10\n1 1 0 1 1 0 1 0 1 0\n", "2\n"], ["5\n1 1 0 0 0\n", "0\n"], ["4\n1 1 1 1\n", "0\n"], ["3\n0 0 0\n", "0\n"], ["5\n0 0 0 0 0\n", "0\n"], ["10\n1 1 0 0 0 1 0 0 1 1\n", "0\n"], ["50\n0 0 1 0 1 1 1 1 1 0 0 1 0 0 0 1 1 0 0 1 0 0 0 0 1 0 1 1 0 0 0 1 0 1 0 0 0 0 1 0 1 1 1 1 0 1 0 1 1 0\n", "5\n"], ["55\n0 0 1 0 1 1 1 1 0... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1764"} |
0209eaa029d3b13d | Vasya works as a watchman in the gallery. Unfortunately, one of the most expensive paintings was stolen while he was on duty. He doesn't want to be fired, so he has to quickly restore the painting. He remembers some facts about it. The painting is a square 3 × 3, each cell contains a single integer from 1 to n, and di... | [["2 1 1 1 2\n", "2\n"], ["3 3 1 2 3\n", "6\n"], ["1 1 1 1 1\n", "1\n"], ["1000 522 575 426 445\n", "774000\n"], ["99000 52853 14347 64237 88869\n", "1296306000\n"], ["100000 2 2 2 2\n", "10000000000\n"], ["2 1 1 2 2\n", "0\n"], ["10 9 10 8 10\n", "70\n"], ["10000 1816 3333 6908 7766\n", "4750000\n"], ["100000 80015 84... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1178"} |
020d0f013b8663a3 | Problem statement
Cards with ranks of $ 2 $ and $ 8 $ are powerful in card game millionaires. Therefore, we call an integer consisting of only the numbers $ 2 $ and $ 8 $ in $ 10 $ decimal notation a good integer. The best integers are listed from the smallest to $ 2, 8, 22, 28, 82, 88, \ cdots $.
Let $ n $ be a posi... | [["-1", "-1\n"], ["2", "1\n"], ["4", "2\n"], ["8", "3\n"], ["32", "5\n"], ["16", "4\n"], ["64", "6\n"], ["128", "7\n"], ["256", "8\n"], ["-2", "-1\n"], ["-4", "-1\n"], ["-5", "-1\n"], ["-8", "-1\n"], ["-7", "-1\n"], ["-10", "-1\n"], ["-11", "-1\n"], ["-15", "-1\n"], ["-26", "-1\n"], ["-49", "-1\n"], ["-36", "-1\n"], ["... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#500"} |
0227874d9b4474df | Several drivers had lined up for the Drag Racing Competition at the Tokyo Drift Street. Dom had organized the competition, but he was not available during all the races and hence he did not know their results. In the drag race match, 2 drivers race against each other and one of them is the winner, and the loser gets el... | [["2\na b\na c\nc d\n\nSAMPLE", "a\n"], ["12\nlzcosnwtjk xcjunvtpwu\ncvjkwwlkyj jyjzvkopkt\nhqxxxvxvsm oaettnnxsn\nyltleijpii taddtwjkhq\nowyayplryk gamjhfquwe\nsfwqtseczr clpbsurgox\nnngbinrstc beuwpgazlm\ndmdbzrvooe sodttxayqp\ntkjafxrpth yugxdvihim\nsfavfdbiec fimvhmtjte\nktpgrbmmqb pqstnzulvo\ntacldiqwmo qywspwioip... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#3167"} |
0232d9fcf891e666 | At Akabe High School, which is a programmer training school, the roles of competition programmers in team battles are divided into the following three types.
C: | Coder | I am familiar with the language and code.
--- | --- | ---
A: | Algorithm | I am good at logical thinking and think about algorithms.
N: | Navigator |... | [["4\n3 0 0\n1 1 1\n9 4 2\n0 1 2", "1\n1\n5\n0\n"], ["4\n2 0 0\n1 1 1\n9 4 2\n0 1 2", "0\n1\n5\n0\n"], ["4\n3 0 1\n1 1 1\n9 4 1\n0 1 2", "1\n1\n4\n0\n"], ["4\n3 0 0\n1 2 1\n0 4 2\n0 1 2", "1\n1\n0\n0\n"], ["4\n0 0 0\n1 2 1\n0 4 2\n0 1 3", "0\n1\n0\n0\n"], ["4\n2 1 0\n2 2 2\n9 8 2\n0 1 3", "1\n2\n5\n0\n"], ["4\n0 1 2\n3... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#237"} |
0236e1da6c3ce027 | Consider a simplified penalty phase at the end of a football match.
A penalty phase consists of at most $10$ kicks, the first team takes the first kick, the second team takes the second kick, then the first team takes the third kick, and so on. The team that scores more goals wins; if both teams score the same number ... | [["4\n1?0???1001\n1111111111\n??????????\n0100000000\n", "7\n10\n6\n9\n"], ["4\n1001???0?1\n1111111111\n??????????\n0100000000\n", "8\n10\n6\n9\n"], ["4\n1001???0?1\n1111101111\n??????????\n0100000000\n", "8\n9\n6\n9\n"], ["4\n1001???0?1\n1111111111\n??????????\n0100001000\n", "8\n10\n6\n10\n"], ["4\n1001???0?1\n111011... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#297"} |
023b66f83e0cbcce | Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:
<image>
Find the sum modulo 1073741824 (230).
Input
The first line contains three space-separated integers a, b and c (1 ≤ a, b, c ≤ 100).
Output
Print a singl... | [["2 2 2\n", "20\n"], ["21 16 9\n", "45449\n"], ["100 9 88\n", "2334910\n"], ["4 21 45\n", "58045\n"], ["63 90 23\n", "4384553\n"], ["64 12 36\n", "687986\n"], ["82 29 45\n", "3504808\n"], ["13 31 33\n", "274773\n"], ["76 58 25\n", "3635209\n"], ["4 12 8\n", "3347\n"], ["21 22 100\n", "1274891\n"], ["31 96 7\n", "45812... | 4 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#1693"} |
02414d0480d59ae2 | Enough is enough. Too many times it happened that Vasya forgot to dispose of garbage and his apartment stank afterwards. Now he wants to create a garbage disposal plan and stick to it.
For each of next n days Vasya knows a_i — number of units of garbage he will produce on the i-th day. Each unit of garbage must be dis... | [["3 2\n1 0 1\n", "2\n"], ["4 4\n2 8 4 1\n", "4\n"], ["3 2\n3 2 1\n", "3\n"], ["5 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n", "5000000000\n"], ["3 10\n5 5 0\n", "1\n"], ["1 1\n1\n", "1\n"], ["4 4\n3 6 2 3\n", "4\n"], ["1 10\n1\n", "1\n"], ["185 2\n0 14 2 11 5 17 9 11 8 12 8 17 17 0 4 15 4 17 8 1 2 10 ... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#41"} |
025b7d3aebc187ec | You are given two very long integers a, b (leading zeroes are allowed). You should check what number a or b is greater or determine that they are equal.
The input size is very large so don't use the reading of symbols one by one. Instead of that use the reading of a whole line or token.
As input/output can reach huge... | [["9\n10\n", "<\n"], ["11\n10\n", ">\n"], ["00012345\n12345\n", "=\n"], ["0123\n9\n", ">\n"], ["0123\n111\n", ">\n"], ["9\n9\n", "=\n"], ["1213121\n1213121\n", "=\n"], ["8631749422082281871941140403034638286979613893271246118706788645620907151504874585597378422393911017\n146017563370120161528504797580620647099370814387... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#146"} |
025f087138504ff5 | A permutation is a sequence of integers from $1$ to $n$ of length $n$ containing each number exactly once. For example, $[1]$, $[4, 3, 5, 1, 2]$, $[3, 2, 1]$ — are permutations, and $[1, 1]$, $[4, 3, 1]$, $[2, 3, 4]$ — no.
Permutation $a$ is lexicographically smaller than permutation $b$ (they have the same length $n$... | [["4 4\n1 2 4\n2 3\n1 1 2\n1 3 4\n", "9\n4\n6\n"], ["2 3\n1 1 2\n2 1\n1 2 2\n", "3\n1\n"], ["2 3\n1 1 2\n2 1\n1 2 2\n", "3\n1\n"], ["2 3\n1 2 2\n2 1\n1 2 2\n", "2\n1\n"], ["2 3\n1 2 2\n2 1\n1 2 1\n", "2\n0\n"], ["4 3\n1 1 2\n2 1\n1 2 2\n", "3\n2\n"], ["5 4\n1 2 4\n2 3\n1 1 2\n1 3 4\n", "9\n3\n9\n"], ["4 3\n1 1 2\n2 1\n... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#215"} |
026429cbc4f71e38 | Alice and Bob are playing One Card Poker.
One Card Poker is a two-player game using playing cards.
Each card in this game shows an integer between `1` and `13`, inclusive.
The strength of a card is determined by the number written on it, as follows:
Weak `2` < `3` < `4` < `5` < `6` < `7` < `8` < `9` < `10` < `11` < `... | [["8 6", "Alice"], ["1 1", "Draw"], ["13 1", "Bob"], ["8 7", "Alice\n"], ["2 1", "Bob\n"], ["0 0", "Draw\n"], ["8 3", "Alice\n"], ["3 1", "Bob\n"], ["7 3", "Alice\n"], ["4 1", "Bob\n"], ["7 1", "Bob\n"], ["7 2", "Alice\n"], ["5 6", "Bob\n"], ["1 0", "Alice\n"], ["0 1", "Bob\n"], ["12 3", "Alice\n"], ["1 3", "Alice\n"],... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#2851"} |
026d31dfd127bff2 | The king's birthday dinner was attended by $k$ guests. The dinner was quite a success: every person has eaten several dishes (though the number of dishes was the same for every person) and every dish was served alongside with a new set of kitchen utensils.
All types of utensils in the kingdom are numbered from $1$ to ... | [["5 2\n1 2 2 1 3\n", "1\n"], ["10 3\n1 3 3 1 3 5 5 5 5 100\n", "14\n"], ["10 5\n63 63 63 63 63 63 63 63 63 63\n", "0\n"], ["10 6\n91 51 91 51 51 91 51 91 91 91\n", "2\n"], ["100 1\n84 85 2 96 83 57 9 95 34 14 21 6 10 26 32 1 29 77 39 91 42 87 74 65 73 58 66 23 37 13 100 90 30 46 92 4 80 61 47 53 44 75 76 3 7 79 93 24 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#550"} |
026ecbbdff818ff3 | Ringo Mart, a convenience store, sells apple juice.
On the opening day of Ringo Mart, there were A cans of juice in stock in the morning. Snuke buys B cans of juice here every day in the daytime. Then, the manager checks the number of cans of juice remaining in stock every night. If there are C or less cans, D new can... | [["24\n1 2 3 4\n1 2 4 3\n1 3 2 4\n1 3 4 2\n1 4 1 3\n1 4 3 2\n2 1 3 4\n2 1 4 3\n2 3 1 4\n2 3 4 1\n2 4 1 3\n2 4 3 1\n3 1 2 4\n3 1 4 2\n3 2 1 4\n3 2 4 1\n3 4 1 2\n3 4 2 1\n4 1 2 3\n4 1 3 2\n4 2 1 3\n4 2 3 1\n4 3 1 2\n4 3 2 1", "No\nNo\nNo\nNo\nNo\nNo\nYes\nYes\nNo\nNo\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\nYes\nYes\nYes\nNo\... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1003"} |
0277f7d2d82f0403 | Fangy collects cookies. Once he decided to take a box and put cookies into it in some way. If we take a square k × k in size, divided into blocks 1 × 1 in size and paint there the main diagonal together with cells, which lie above it, then the painted area will be equal to the area occupied by one cookie k in size. Fan... | [["696\n", "695035\n"], ["6\n", "243\n"], ["928\n", "794863\n"], ["589\n", "889192\n"], ["657\n", "874011\n"], ["617\n", "247876\n"], ["11\n", "59049\n"], ["14\n", "594320\n"], ["1000\n", "691074\n"], ["1\n", "1\n"], ["2\n", "3\n"], ["298\n", "999535\n"], ["823\n", "858672\n"], ["262\n", "946384\n"], ["69\n", "327984\n... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#850"} |
0279c08597cf6b85 | For given two sides of a triangle a and b and the angle C between them, calculate the following properties:
* S: Area of the triangle
* L: The length of the circumference of the triangle
* h: The height of the triangle with side a as a bottom edge
Input
The length of a, the length of b and the angle C are given in... | [["4 3 130", "4.59626665871\n13.3582153654\n2.29813332936\n"], ["4 3 11", "1.14485397226\n8.20039476726\n0.57242698613\n"], ["2 3 90", "3.0\n8.60555127546\n3.0\n"], ["3 3 130", "3.44719999404\n11.4378467222\n2.29813332936\n"], ["4 5 11", "1.90808995377\n10.3171608338\n0.954044976883\n"], ["2 4 90", "4.0\n10.472135955\n... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#1917"} |
027c0df39dfa99ea | Lord Omkar has permitted you to enter the Holy Church of Omkar! To test your worthiness, Omkar gives you a password which you must interpret!
A password is an array $a$ of $n$ positive integers. You apply the following operation to the array: pick any two adjacent numbers that are not equal to each other and replace t... | [["2\n4\n2 1 3 1\n2\n420 420\n", "1\n2\n"], ["8\n6\n1 7 7 1 7 1\n2\n3 3\n8\n1 1000000000 1000000000 2 2 1 2 2\n2\n420 69\n10\n1 3 5 7 9 2 4 6 8 10\n5\n6 16 7 6 1\n3\n16 16 16\n5\n1 2 9 8 4\n", "1\n2\n1\n1\n1\n1\n3\n1\n"], ["1\n7\n529035968 529035968 529035968 529035968 529035968 529035968 529035968\n", "7\n"], ["1\n3\n... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1631"} |
027fd4cb4994f2e3 | Sasha and Ira are two best friends. But they aren’t just friends, they are software engineers and experts in artificial intelligence. They are developing an algorithm for two bots playing a two-player game. The game is cooperative and turn based. In each turn, one of the players makes a move (it doesn’t matter which pl... | [["2\n", "19\n"], ["1\n", "5\n"], ["3\n", "69\n"], ["4\n", "251\n"], ["5\n", "923\n"], ["6\n", "3431\n"], ["7\n", "12869\n"], ["8\n", "48619\n"], ["9\n", "184755\n"], ["10\n", "705431\n"], ["99\n", "407336794\n"], ["999\n", "72475737\n"], ["9999\n", "703593269\n"], ["99999\n", "879467332\n"], ["999999\n", "192151599\n"... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#433"} |
02856f3d65e525b3 | After passing a test, Vasya got himself a box of $n$ candies. He decided to eat an equal amount of candies each morning until there are no more candies. However, Petya also noticed the box and decided to get some candies for himself.
This means the process of eating candies is the following: in the beginning Vasya cho... | [["68\n", "3\n"], ["1\n", "1\n"], ["2\n", "1\n"], ["42\n", "1\n"], ["43\n", "2\n"], ["756\n", "29\n"], ["999999972\n", "39259423\n"], ["999999973\n", "39259424\n"], ["1000000000000000000\n", "39259424579862572\n"], ["6\n", "1\n"], ["3\n", "1\n"], ["4\n", "1\n"], ["5\n", "1\n"], ["66\n", "2\n"], ["67\n", "3\n"], ["1000\... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1220"} |
02864ce4a977fc83 | Valerian was captured by Shapur. The victory was such a great one that Shapur decided to carve a scene of Valerian's defeat on a mountain. So he had to find the best place to make his victory eternal!
He decided to visit all n cities of Persia to find the best available mountain, but after the recent war he was too ti... | [["1\n", "0"], ["6\n1 2 3\n1 3 1\n3 4 1\n4 5 1\n5 6 1\n", "10"], ["3\n1 2 0\n2 3 0\n", "0"], ["2\n2 1 89\n", "89"], ["12\n3 2 52\n4 1 2\n5 2 68\n6 1 93\n8 5 60\n2 1 88\n9 8 44\n7 5 48\n11 2 31\n10 4 45\n12 7 58\n", "916"], ["13\n8 2 58\n2 1 49\n13 10 41\n11 9 67\n6 4 18\n7 1 79\n3 2 58\n9 7 92\n10 6 62\n4 3 5\n12 4 87\... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#155"} |
02864d10876d26ac | A binary heap which satisfies max-heap property is called max-heap. In a max-heap, for every node $i$ other than the root, $A[i] \leq A[parent(i)]$, that is, the value of a node is at most the value of its parent. The largest element in a max-heap is stored at the root, and the subtree rooted at a node contains values ... | [["10\n4 1 3 2 16 9 10 2 8 7", " 16 8 10 4 7 9 3 2 2 1\n"], ["10\n4 1 3 2 23 9 10 2 8 7", " 23 8 10 4 7 9 3 2 2 1\n"], ["10\n7 1 3 2 23 9 10 2 8 7", " 23 8 10 7 7 9 3 2 2 1\n"], ["10\n7 1 3 2 23 9 10 2 8 9", " 23 9 10 8 7 9 3 2 2 1\n"], ["10\n0 1 3 2 23 9 10 2 8 9", " 23 9 10 8 1 9 3 2 2 0\n"], ["10\n0 1 3 2 23 9 10 2 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1600"} |
028934ee4597ee8d | Well, here is another math class task. In mathematics, GCD is the greatest common divisor, and it's an easy task to calculate the GCD between two positive integers.
A common divisor for two positive numbers is a number which both numbers are divisible by.
But your teacher wants to give you a harder task, in this task... | [["90 100\n8\n55 75\n46 68\n44 60\n32 71\n43 75\n23 79\n47 86\n11 57\n", "-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n"], ["48 72\n2\n8 29\n29 37\n", "24\n-1\n"], ["84 100\n16\n10 64\n3 61\n19 51\n42 67\n51 68\n12 40\n10 47\n52 53\n37 67\n2 26\n23 47\n17 75\n49 52\n3 83\n63 81\n8 43\n", "-1\n4\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n4\n-1\n-... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#551"} |
0294d3b65dcf36c3 | Today, Chef woke up to find that he had no clean socks. Doing laundry is such a turn-off for Chef, that in such a situation, he always buys new socks instead of cleaning the old dirty ones. He arrived at the fashion store with money rupees in his pocket and started looking for socks. Everything looked good, but then Ch... | [["1 2 3\n\n\n", "Unlucky Chef\n"], ["1 2 6\n\n\n", "Lucky Chef\n"], ["0 2 3", "Unlucky Chef\n"], ["1 2 9", "Lucky Chef\n"], ["1 1 9", "Lucky Chef\n"], ["1 2 7", "Unlucky Chef\n"], ["0 2 6", "Unlucky Chef\n"], ["2 2 9", "Unlucky Chef\n"], ["2 1 9", "Unlucky Chef\n"], ["1 2 5", "Lucky Chef\n"], ["0 4 6", "Unlucky Chef\n... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00003-of-00005.parquet#2935"} |
029d137723545730 | Snuke has N dogs and M monkeys. He wants them to line up in a row.
As a Japanese saying goes, these dogs and monkeys are on bad terms. ("ken'en no naka", literally "the relationship of dogs and monkeys", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there a... | [["100010 100000", "0\n"], ["3 4", "144\n"], ["1 2", "2\n"], ["4 4", "1152\n"], ["2 3", "12\n"], ["000011 000010", "82826050\n"], ["001010 001011", "931093537\n"], ["000101 000101", "414723868\n"], ["000110 000111", "399920258\n"], ["001111 001110", "292820538\n"], ["9 8", "631321502\n"], ["4 5", "2880\n"], ["010010 01... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1025"} |
02a209873bb399eb | 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 \leq L_i ... | [["4 9\n3 3 3 3", "4"], ["3 6\n3 4 5", "2"], ["4 9\n3 6 3 3", "3\n"], ["4 9\n5 6 2 6", "2\n"], ["4 9\n3 2 3 3", "4\n"], ["4 9\n3 2 0 3", "5\n"], ["3 9\n16 5 1 12", "1\n"], ["4 9\n3 6 2 3", "3\n"], ["4 9\n3 6 2 6", "3\n"], ["1 9\n5 6 2 6", "2\n"], ["1 9\n4 6 2 6", "2\n"], ["4 6\n3 3 3 3", "3\n"], ["3 6\n3 1 5", "3\n"], ... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#2898"} |
02af9a2bf8d710dd | There exists an island called Arpa’s land, some beautiful girls live there, as ugly ones do.
Mehrdad wants to become minister of Arpa’s land. Arpa has prepared an exam. Exam has only one question, given n, print the last digit of 1378^{n}.
[Image]
Mehrdad has become quite confused and wants you to help him. Pleas... | [["1\n", "8"], ["2\n", "4"], ["1000\n", "6"], ["3\n", "2"], ["4\n", "6"], ["1000000000\n", "6"], ["5\n", "8"], ["6\n", "4"], ["999999999\n", "2"], ["1378\n", "4"], ["13781378\n", "4"], ["51202278\n", "4"], ["999999998\n", "4"], ["999999997\n", "8"], ["12193721\n", "8"], ["0\n", "1"], ["989898989\n", "8"], ["7\n", "2"],... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#816"} |
02bd84a4c58f4a95 | You are given a permutation p of length n. Remove one element from permutation to make the number of records the maximum possible.
We remind that in a sequence of numbers a_1, a_2, ..., a_{k} the element a_{i} is a record if for every integer j (1 ≤ j < i) the following holds: a_{j} < a_{i}.
-----Input-----
The fi... | [["1\n1\n", "1\n"], ["5\n5 1 2 3 4\n", "5\n"], ["5\n4 3 5 1 2\n", "1\n"], ["9\n9 5 8 6 3 2 4 1 7\n", "9\n"], ["3\n3 2 1\n", "1\n"], ["7\n1 6 7 4 2 5 3\n", "2\n"], ["48\n38 6 31 19 45 28 27 43 11 35 36 20 9 16 42 48 14 22 39 18 12 10 34 25 13 26 40 29 17 8 33 46 24 30 37 44 1 15 2 21 3 5 4 47 32 23 41 7\n", "38\n"], ["2... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#205"} |
02c7c412f36d6ccf | Tattah is asleep if and only if Tattah is attending a lecture. This is a well-known formula among Tattah's colleagues.
On a Wednesday afternoon, Tattah was attending Professor HH's lecture. At 12:21, right before falling asleep, he was staring at the digital watch around Saher's wrist. He noticed that the digits on th... | [["04:50\n", "05:50\n"], ["02:17\n", "02:20\n"], ["12:14\n", "12:21\n"], ["03:44\n", "04:40\n"], ["00:17\n", "01:10\n"], ["15:51\n", "20:02\n"], ["23:31\n", "23:32\n"], ["07:56\n", "10:01\n"], ["06:59\n", "10:01\n"], ["17:50\n", "20:02\n"], ["16:50\n", "20:02\n"], ["10:44\n", "11:11\n"], ["23:52\n", "00:00\n"], ["07:15... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#925"} |
02cbd2ec4cbe0402 | You are given an integer m.
Let M = 2^{m} - 1.
You are also given a set of n integers denoted as the set T. The integers will be provided in base 2 as n binary strings of length m.
A set of integers S is called "good" if the following hold. If $a \in S$, then [Image]. If $a, b \in S$, then $a \text{AND} b \in S$ ... | [["5 3\n11010\n00101\n11000\n", "4\n"], ["30 10\n001000000011000111000010010000\n000001100001010000000000000100\n000110100010100000000000101000\n110000010000000001000000000000\n100001000000000010010101000101\n001001000000000100000000110000\n000000010000100000001000000000\n001000010001000000001000000010\n000000110000000... | 1.56 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1638"} |
02cf27ae8f53a289 | You are given a rectangular board of M × N squares. Also you are given an unlimited number of standard domino pieces of 2 × 1 squares. You are allowed to rotate the pieces. You are asked to place as many dominoes as possible on the board so as to meet the following conditions:
1. Each domino completely covers two squa... | [["2 6\n", "6\n"], ["1 5\n", "2\n"], ["3 6\n", "9\n"], ["2 5\n", "5\n"], ["3 16\n", "24\n"], ["2 7\n", "7\n"], ["3 10\n", "15\n"], ["14 16\n", "112\n"], ["1 16\n", "8\n"], ["5 16\n", "40\n"], ["4 4\n", "8\n"], ["15 16\n", "120\n"], ["5 7\n", "17\n"], ["2 16\n", "16\n"], ["2 2\n", "2\n"], ["1 6\n", "3\n"], ["1 1\n", "0\... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1002"} |
02d5a527ec62969b | In the $2022$ year, Mike found two binary integers $a$ and $b$ of length $n$ (both of them are written only by digits $0$ and $1$) that can have leading zeroes. In order not to forget them, he wanted to construct integer $d$ in the following way:
he creates an integer $c$ as a result of bitwise summing of $a$ and $b$ ... | [["5\n1\n0\n3\n011\n3\n110\n6\n111000\n6\n001011\n", "1\n110\n100\n101101\n101110\n"], ["5\n1\n0\n3\n011\n3\n110\n6\n111100\n6\n001011\n", "1\n110\n100\n101001\n101110\n"], ["5\n1\n0\n3\n011\n3\n111\n6\n111100\n6\n001011\n", "1\n110\n101\n101001\n101110\n"], ["5\n1\n0\n3\n011\n3\n110\n6\n011000\n6\n001011\n", "1\n110\n... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#296"} |
02dd02ca8b879260 | 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... | [["5 10\n1 3 3 2 3", "2 3\n"], ["6 1000000000000\n1 2 2 2 3 3", "1 2\n"], ["6 1000000000000\n1 2 2 4 3 3", "1 4\n"], ["11 97\n3 2 4 1 5 9 2 6 5 3 5", "5\n"], ["6 1000000000000\n1 1 2 4 3 3", "2 4\n"], ["11 97\n0 2 4 1 5 9 2 6 2 3 5", "0 6 2 3 5\n"], ["11 97\n0 2 4 2 5 4 2 6 2 3 5", "0\n"], ["11 97\n0 2 0 2 5 4 2 6 2 3 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1357"} |
02de47039713755e | Omkar and Akmar are playing a game on a circular board with n (2 ≤ n ≤ 10^6) cells. The cells are numbered from 1 to n so that for each i (1 ≤ i ≤ n-1) cell i is adjacent to cell i+1 and cell 1 is adjacent to cell n. Initially, each cell is empty.
Omkar and Akmar take turns placing either an A or a B on the board, wit... | [["999993\n", "111654003\n"], ["46\n", "716816138\n"], ["999972\n", "305611803\n"], ["5\n", "240\n"], ["19\n", "775844941\n"], ["23\n", "132914806\n"], ["18\n", "852308225\n"], ["42\n", "739858643\n"], ["999991\n", "107776898\n"], ["999999\n", "791711076\n"], ["999983\n", "557546394\n"], ["1000000\n", "948343669\n"], [... | 3.27 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1491"} |
02e5aff0a98d697f | For the given integer $n$ ($n > 2$) let's write down all the strings of length $n$ which contain $n-2$ letters 'a' and two letters 'b' in lexicographical (alphabetical) order.
Recall that the string $s$ of length $n$ is lexicographically less than string $t$ of length $n$, if there exists such $i$ ($1 \le i \le n$), t... | [["7\n5 1\n5 2\n5 8\n5 10\n3 1\n3 2\n20 100\n", "aaabb\naabab\nbaaba\nbbaaa\nabb\nbab\naaaaabaaaaabaaaaaaaa\n"], ["7\n8 18\n19 11\n20 5\n15 19\n19 15\n20 6\n10 28\n", "abaaabaa\naaaaaaaaaaaaabaaaab\naaaaaaaaaaaaaaaababa\naaaaaaaabaabaaa\naaaaaaaaaaaaabbaaaa\naaaaaaaaaaaaaaaabbaa\naabbaaaaaa\n"], ["7\n8 18\n19 11\n20 5\... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1550"} |
02f596db4b160357 | The $\text{$gcdSum$}$ of a positive integer is the $gcd$ of that integer with its sum of digits. Formally, $\text{$gcdSum$}(x) = gcd(x, \text{ sum of digits of } x)$ for a positive integer $x$. $gcd(a, b)$ denotes the greatest common divisor of $a$ and $b$ — the largest integer $d$ such that both integers $a$ and $b$ a... | [["3\n11\n31\n75\n", "12\n33\n75\n"], ["3\n11\n38\n75\n", "12\n39\n75\n"], ["3\n16\n38\n75\n", "18\n39\n75\n"], ["3\n16\n76\n75\n", "18\n77\n75\n"], ["3\n22\n76\n75\n", "22\n77\n75\n"], ["3\n11\n76\n75\n", "12\n77\n75\n"], ["3\n11\n76\n107\n", "12\n77\n108\n"], ["3\n11\n76\n92\n", "12\n77\n93\n"], ["3\n11\n134\n92\n", ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1823"} |
02f79875bc92ded8 | n people came to a party. Then those, who had no friends among people at the party, left. Then those, who had exactly 1 friend among those who stayed, left as well. Then those, who had exactly 2, 3, ..., n - 1 friends among those who stayed by the moment of their leaving, did the same.
What is the maximum amount of pe... | [["1\n4\n", "2\n"], ["1\n2\n", "0\n"], ["1\n7\n", "5\n"], ["1\n5\n", "3\n"], ["1\n6\n", "4\n"], ["1\n9\n", "7\n"], ["1\n11\n", "9\n"], ["1\n12\n", "10\n"], ["1\n13\n", "11\n"], ["1\n18\n", "16\n"], ["1\n24\n", "22\n"], ["1\n23\n", "21\n"], ["1\n31\n", "29\n"], ["1\n27\n", "25\n"], ["1\n39\n", "37\n"], ["1\n54\n", "52\n... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#661"} |
02fe905ac38a2d7f | Robbers, who attacked the Gerda's cab, are very successful in covering from the kingdom police. To make the goal of catching them even harder, they use their own watches.
First, as they know that kingdom police is bad at math, robbers use the positional numeral system with base 7. Second, they divide one day in n hour... | [["2 3\n", "4\n"], ["8 2\n", "5\n"], ["1 1\n", "0\n"], ["1 2\n", "1\n"], ["8 8\n", "0\n"], ["50 50\n", "0\n"], ["344 344\n", "0\n"], ["282475250 282475250\n", "0\n"], ["8 282475250\n", "0\n"], ["1000000000 1000000000\n", "0\n"], ["16808 7\n", "720\n"], ["2402 50\n", "0\n"], ["343 2401\n", "5040\n"], ["1582 301\n", "287... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1501"} |
0300ce914e2ab56b | Vasya lives in a strange world. The year has n months and the i-th month has ai days. Vasya got a New Year present — the clock that shows not only the time, but also the date.
The clock's face can display any number from 1 to d. It is guaranteed that ai ≤ d for all i from 1 to n. The clock does not keep information ab... | [["102\n100\n31 22 59 16 11 56 81 4 19 31 8 72 4 92 18 7 13 12 62 40 34 67 40 23 96 4 90 28 3 18 54 49 10 71 73 79 69 7 41 75 59 13 2 78 72 6 95 33 52 97 7 86 57 94 12 93 19 94 59 28 5 96 46 102 2 101 57 85 53 69 72 39 14 75 8 16 10 57 26 4 85 18 89 84 48 93 54 21 78 6 67 35 11 78 91 91 97 15 8 32\n", "5447"], ["10\n4\... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#742"} |
0308b880916763e4 | You decide to develop a game with your friends. The title of the game is "Battle Town". This is a game with the theme of urban warfare with tanks. As the first step in game development, we decided to develop the following prototype.
In this prototype, the only tanks that appear are the player's tanks, not the enemy ta... | [["4\n4 6\n*.*..*\n*.....\n...-..\n^.*#..\n10\nSRSSRRUSSR\n2 2\n<.\n..\n12\nDDSRRSUUSLLS\n3 5\n>-#**\n.-*#*\n.-**#\n15\nSSSDRSSSDRSSSUU\n5 5\nv****\n*****\n*****\n*****\n*****\n44\nSSSSDDRSDRSRDSULUURSSSSRRRRDSSSSDDLSDLSDLSSD", "*....*\n......\n..>-..\n...#..\n\n<.\n..\n\n^-#**\n.-.#*\n.-..#\n\n.....\n.***.\n..*..\n..*... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#201"} |
030a64e068efa152 | How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December?
Constraints
* 1≤M≤23
* M is an integer.
Input
Input is given from Standard Input in the following format:
M
Output
If we have x hours until New Year at M o'clock on 30th, December, print x.
Examples
Input
21
Output... | [["12", "36"], ["21", "27"], ["9", "39\n"], ["34", "14\n"], ["8", "40\n"], ["25", "23\n"], ["14", "34\n"], ["49", "-1\n"], ["0", "48\n"], ["4", "44\n"], ["-1", "49\n"], ["1", "47\n"], ["-2", "50\n"], ["2", "46\n"], ["-4", "52\n"], ["3", "45\n"], ["-5", "53\n"], ["5", "43\n"], ["-3", "51\n"], ["-8", "56\n"], ["-6", "54\... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#1767"} |
030aa6a3697ae903 | You are given array a with n integers and m queries. The i-th query is given with three integers l_{i}, r_{i}, x_{i}.
For the i-th query find any position p_{i} (l_{i} ≤ p_{i} ≤ r_{i}) so that a_{p}_{i} ≠ x_{i}.
-----Input-----
The first line contains two integers n, m (1 ≤ n, m ≤ 2·10^5) — the number of elements i... | [["6 4\n1 2 1 1 3 5\n1 4 1\n2 6 2\n3 4 1\n3 4 2\n", "2\n6\n-1\n4\n"], ["1 1\n1\n1 1 1\n", "-1\n"], ["1 1\n2\n1 1 2\n", "-1\n"], ["1 1\n569888\n1 1 967368\n", "1\n"], ["10 10\n1 1 1 1 1 1 1 1 1 1\n3 10 1\n3 6 1\n1 8 1\n1 7 1\n1 5 1\n3 7 1\n4 7 1\n9 9 1\n6 7 1\n3 4 1\n", "-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n"], ["10 ... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00000-of-00005.parquet#1150"} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.