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
06a7074e1e6dc991
It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells with positive numbers from 1 to n from the left to the right. Unfortunately, Joe ...
[["5 10 7\n98765 78654 25669 45126 98745\n", " 21"], ["2 7597 8545\n74807 22362\n", "0"], ["1 1 1000000000\n100\n", "100\n"], ["5 2 9494412\n5484 254 1838 18184 9421\n", " 0"], ["95 97575868 5\n461...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1615"}
06ada74839f76910
Polycarpus is an amateur businessman. Recently he was surprised to find out that the market for paper scissors is completely free! Without further ado, Polycarpus decided to start producing and selling such scissors. Polycaprus calculated that the optimal celling price for such scissors would be p bourles. However, he...
[["393776794010351632 4138311260892\n", "393775999999999999\n"], ["559198116944738707 0\n", "559198116944738707\n"], ["159171676706847083 28512592184962\n", "159169999999999999\n"], ["199 198\n", "199\n"], ["20 1\n", "19\n"], ["621306590487786841 47851896849379\n", "621299999999999999\n"], ["925835698451819219 23282710...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#672"}
06b3c7d5f8fcaa1e
Alice and Bob play a game. There is a paper strip which is divided into n + 1 cells numbered from left to right starting from 0. There is a chip placed in the n-th cell (the last one). Players take turns, Alice is first. Each player during his or her turn has to move the chip 1, 2 or k cells to the left (so, if the ch...
[["4\n0 3\n3 3\n3 4\n4 4\n", "Bob\nAlice\nBob\nAlice\n"], ["1\n73 18\n", "Alice\n"], ["1\n25 6\n", "Alice\n"], ["24\n19 9\n20 9\n21 9\n22 9\n23 9\n24 9\n25 9\n26 9\n27 9\n28 9\n29 9\n30 9\n31 9\n32 9\n1000000000 999999999\n999999996 999999999\n999999997 999999999\n1000000000 6\n1000000000 3\n1000000000 9\n999999999 6\n...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#41"}
06b6f5404bb87334
Anchored Balloon A balloon placed on the ground is connected to one or more anchors on the ground with ropes. Each rope is long enough to connect the balloon and the anchor. No two ropes cross each other. Figure E-1 shows such a situation. <image> Figure E-1: A balloon and ropes on the ground Now the balloon takes o...
[["3\n10 10 20\n10 -10 20\n-10 10 120\n1\n10 10 16\n2\n10 10 20\n10 -10 20\n2\n100 0 101\n-90 0 91\n2\n0 0 53\n30 40 102\n3\n10 10 20\n10 -10 20\n-10 -10 20\n3\n1 5 13\n5 -3 13\n-3 -2 13\n3\n98 97 168\n-82 -80 193\n-99 -96 211\n4\n90 -100 160\n-80 -80 150\n90 80 150\n80 80 245\n4\n85 -90 290\n-80 -80 220\n-85 90 145\n8...
1.53
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#3050"}
06c64f587c67b9e3
We have A balls with the string S written on each of them and B balls with the string T written on each of them. From these balls, Takahashi chooses one with the string U written on it and throws it away. Find the number of balls with the string S and balls with the string T that we have now. Constraints * S, T, and ...
[["red blue\n3 4\nred", "2 4"], ["red blue\n5 5\nblue", "5 4"], ["red blue\n3 2\nred", "2 2\n"], ["red blte\n3 0\nred", "2 0\n"], ["red blue\n5 0\nred", "4 0\n"], ["red blue\n7 0\nred", "6 0\n"], ["red blue\n5 1\nred", "4 1\n"], ["red blue\n0 0\nred", "-1 0\n"], ["red blte\n3 4\nred", "2 4\n"], ["red blue\n1 0\nred", "...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#1210"}
06cd9e0778eba94d
Snuke has a blackboard and a set S consisting of N integers. The i-th element in S is S_i. He wrote an integer X on the blackboard, then performed the following operation N times: * Choose one element from S and remove it. * Let x be the number written on the blackboard now, and y be the integer removed from S. Repla...
[["5 82\n22 11 6 7 13", "516\n"], ["10 100000\n13715 50001 50002 50003 50004 50005 50006 50007 50008 50009", "353097390\n"], ["2 19\n3 11", "3\n"], ["5 134\n22 11 6 7 13", "264\n"], ["10 100000\n13715 50001 50002 50003 50004 50005 50006 50532 50008 50009", "162585390\n"], ["10 000000\n13715 50001 50002 50003 50004 5000...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1315"}
06db46446d93efe7
There is a right triangle ABC with ∠ABC=90°. Given the lengths of the three sides, |AB|,|BC| and |CA|, find the area of the right triangle ABC. It is guaranteed that the area of the triangle ABC is an integer. -----Constraints----- - 1 \leq |AB|,|BC|,|CA| \leq 100 - All values in input are integers. - The area of t...
[["3 4 5\n", "6\n"], ["5 12 13\n", "30\n"], ["45 28 53\n", "630\n"], ["12 16 20\n", "96\n"], ["24 10 26\n", "120\n"], ["6 8 10\n", "24\n"], ["35 84 91\n", "1470\n"], ["24 7 25\n", "84\n"], ["28 96 100\n", "1344\n"], ["13 84 85\n", "546\n"], ["8 15 17\n", "60\n"], ["28 45 53\n", "630\n"], ["77 36 85\n", "1386\n"], ["3 3...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#42"}
06e47baf1f74cb07
Alice and Bob are fighting over who is a superior debater. However they wish to decide this in a dignified manner. So they decide to fight in the Battle of Words. In each game both get to speak a sentence. Because this is a dignified battle, they do not fight physically, the alphabets in their words do so for them. ...
[["3\ni will win\nwill i\ntoday or tomorrow\ntoday or tomorrow and yesterday\ni dare you\nbad day\n\nSAMPLE", "You win some.\nYou lose some.\nYou draw some.\n"], ["3\ni will win\nwill i\ntoday or tomorrow\nyadot or tomorrow and yesterday\ni dare you\nbad day\n\nSAMPLE", "You win some.\nYou lose some.\nYou draw some.\n"...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#399"}
06e63b9bad0e68cc
Find the minimum prime number greater than or equal to X. Constraints * 2 \le X \le 10^5 * All values in input are integers. Input Input is given from Standard Input in the following format: X Output Print the minimum prime number greater than or equal to X. Examples Input 20 Output 23 Input 2 Outpu...
[["99992", "100003"], ["20", "23"], ["2", "2"], ["40", "41\n"], ["3", "3\n"], ["73", "73\n"], ["28", "29\n"], ["97", "97\n"], ["37", "37\n"], ["11", "11\n"], ["18", "19\n"], ["17", "17\n"], ["22", "23\n"], ["5", "5\n"], ["62", "67\n"], ["6", "7\n"], ["82", "83\n"], ["101", "101\n"], ["106", "107\n"], ["122", "127\n"], ...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#634"}
06e94013595c7f88
Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). -----Constraints----- - 2 \leq N \leq 2\times 10^5 - 0 \leq A_i \leq 10^9 - All values in input are integers. -----Input----- Input is given from Standard Input in the following f...
[["3\n1 2 3\n", "11\n"], ["4\n141421356 17320508 22360679 244949\n", "437235829\n"], ["3\n0 2 3", "6\n"], ["4\n141421356 17320508 22360679 176612", "432841470\n"], ["3\n0 2 0", "0\n"], ["4\n141421356 17320508 44188846 176612", "442072669\n"], ["4\n141421356 15438004 44188846 176612", "24018621\n"], ["4\n141421356 15438...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#245"}
06e9dc403d985693
We say that a odd number N is similar to 2017 when both N and (N+1)/2 are prime. You are given Q queries. In the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i. Constraints * 1≤Q≤10^5 * 1≤l_i≤r_i≤10^5 * l_i and r_i are odd. * All input values ...
[["1\n3 7", "2"], ["4\n13 13\n7 11\n7 11\n2017 2017", "1\n0\n0\n1"], ["4\n13 13\n7 0\n7 11\n2017 2017", "1\n-2\n0\n1\n"], ["6\n1 53\n7 91\n37 55\n19 51\n73 91\n13 49", "4\n4\n1\n1\n1\n2\n"], ["4\n11 13\n7 1\n7 13\n2017 2017", "1\n-2\n1\n1\n"], ["6\n1 53\n7 91\n37 55\n19 51\n73 169\n13 49", "4\n4\n1\n1\n2\n2\n"], ["6\n1...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#741"}
06ff4b10d70ede2a
In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i). Takahashi the king is interested in the following Q matters: - The ...
[["2 3 1\n1 1\n1 2\n2 2\n1 2\n", "3\n"], ["10 3 2\n1 5\n2 8\n7 10\n1 7\n3 10\n", "1\n1\n"], ["10 10 10\n1 6\n2 9\n4 5\n4 7\n4 7\n5 8\n6 6\n6 7\n7 9\n10 10\n1 8\n1 9\n1 10\n2 8\n2 9\n2 10\n3 8\n3 9\n3 10\n1 10\n", "7\n9\n10\n6\n8\n9\n6\n7\n8\n10\n"], ["5 10 5\n4 4\n1 2\n2 3\n1 3\n3 4\n3 4\n2 5\n1 5\n1 3\n1 4\n3 4\n4 4\n...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1204"}
0703e6f9bb617c16
You are given an array a of size n, and q queries to it. There are queries of two types: * 1 li ri — perform a cyclic shift of the segment [li, ri] to the right. That is, for every x such that li ≤ x < ri new value of ax + 1 becomes equal to old value of ax, and new value of ali becomes equal to old value of ari; ...
[["6 3 5\n1 2 3 4 5 6\n2 1 3\n2 3 6\n1 1 6\n2 2 1 5 3\n", "3 3 1 5 2 "], ["1 1 1\n474812122\n2 1 1\n1\n", "474812122 "], ["5 2 5\n64 3 4 665 2\n1 1 3\n2 1 5\n1 2 3 4 5\n", "2 665 3 64 4 "], ["6 3 5\n1 2 3 4 5 6\n2 1 3\n2 3 6\n1 1 6\n2 2 1 5 4\n", "3 3 1 5 6\n"], ["6 3 5\n1 2 3 4 5 6\n2 1 1\n2 3 6\n1 1 6\n2 2 1 5 4\n", ...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#2570"}
0706436b21a4ef70
Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and...
[["1 999 1000", "A"], ["5 2 7", "B"], ["1 999 0000", "B\n"], ["1 381 1110", "A\n"], ["5 1 7", "B\n"], ["1 999 0100", "B\n"], ["10 1 7", "B\n"], ["1 999 0101", "B\n"], ["10 2 7", "B\n"], ["1 999 0001", "B\n"], ["10 1 9", "B\n"], ["1 381 0001", "B\n"], ["10 2 9", "B\n"], ["1 381 0101", "B\n"], ["17 2 9", "B\n"], ["1 381 ...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#941"}
07158e680155660f
Two people play the following string game. Initially the players have got some string s. The players move in turns, the player who cannot make a move loses. Before the game began, the string is written on a piece of paper, one letter per cell. <image> An example of the initial situation at s = "abacaba" A player's ...
[["abbabbaaababbbbbbabbbbaabbabaababaababbbabbbaaaaaabbabbabbaabbbbaaaabbabaababbbabbaabaabbbaabaaaabbbbbabbbbbaababbabaabaababbbbbbbaaaababbabbaababbabaabbbbbabbbbaabaaabbbababaaabbbbabaaaabbbbbbbbbabbbbababababbbbaabbababaaabbabbaaaabaaabbbbabbbaaaabbabbaabaaaabaaaaabaaabbbbaaabababaaabbbaabbababbaaabbbbaabaabbbaaaaa...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1125"}
071e366aef41a622
During their New Year holidays, Alice and Bob play the following game using an array $a$ of $n$ integers: Players take turns, Alice moves first. Each turn a player chooses any element and removes it from the array. If Alice chooses even value, then she adds it to her score. If the chosen value is odd, Alice's score ...
[["4\n4\n5 2 7 3\n3\n3 2 1\n4\n2 2 2 2\n2\n7 8\n", "Bob\nTie\nAlice\nAlice\n"], ["2\n3\n1 1 234872\n4\n5 2 7 3\n", "Alice\nBob\n"], ["2\n3\n1 1 234872\n4\n5 2 7 3\n", "Alice\nBob\n"], ["2\n3\n1 1 234872\n4\n5 2 7 2\n", "Alice\nBob\n"], ["4\n4\n5 2 7 3\n3\n3 2 1\n4\n2 2 2 2\n2\n7 2\n", "Bob\nTie\nAlice\nTie\n"], ["4\n4\...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#874"}
07248584704a4176
Polycarpus has n markers and m marker caps. Each marker is described by two numbers: xi is the color and yi is the diameter. Correspondingly, each cap is described by two numbers: aj is the color and bj is the diameter. Cap (aj, bj) can close marker (xi, yi) only if their diameters match, that is, bj = yi. Besides, a m...
[["1 1\n1 1\n1 1\n", "1 1\n"], ["1 1\n1 1\n2 2\n", "0 0\n"], ["6 7\n2 1\n1 1\n2 2\n1 2\n1 1\n1 2\n2 1\n1 1\n1 1\n1 1\n1 2\n2 2\n1 1\n", "5 5\n"], ["6 7\n1 1\n1 1\n1 2\n1 2\n2 2\n1 2\n2 1\n2 1\n2 1\n2 1\n1 1\n1 1\n1 2\n", "3 3\n"], ["6 7\n2 1\n2 2\n2 1\n1 1\n2 1\n1 2\n2 2\n2 2\n2 2\n1 2\n2 2\n1 1\n1 2\n", "3 3\n"], ["1 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1015"}
0726aba5105122c2
Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them wi...
[["482 842 982 902\n+ * +\n", "407728\n"], ["243 386 431 35\n* + *\n", "3298015\n"], ["105 238 316 265\n+ + +\n", "924\n"], ["631 149 496 892\n* * +\n", "445884\n"], ["622 919 896 120\n* * +\n", "667592\n"], ["7 17 3 25\n+ * +\n", "63\n"], ["922 145 883 357\n+ + *\n", "313490\n"], ["666 884 772 54\n* + +\n", "37620\n"]...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1571"}
0746e5c0d502303a
You are locked in a room with a door that has a keypad with 10 keys corresponding to digits from 0 to 9. To escape from the room, you need to enter a correct code. You also have a sequence of digits. Some keys on the keypad have fingerprints. You believe the correct code is the longest not necessarily contiguous subse...
[["7 3\n3 5 7 1 6 2 8\n1 2 7\n", "7 1 2\n"], ["4 4\n3 4 1 0\n0 1 7 9\n", "1 0\n"], ["9 4\n9 8 7 6 5 4 3 2 1\n2 4 6 8\n", "8 6 4 2\n"], ["10 5\n3 7 1 2 4 6 9 0 5 8\n4 3 0 7 9\n", "3 7 4 9 0\n"], ["5 5\n1 2 3 4 5\n6 7 8 9 0\n", "\n"], ["10 10\n1 2 3 4 5 6 7 8 9 0\n4 5 6 7 1 2 3 0 9 8\n", "1 2 3 4 5 6 7 8 9 0\n"], ["1 1\n...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1055"}
0749f00b5ab4eadb
How many infinite sequences a_1, a_2, ... consisting of {{1, ... ,n}} satisfy the following conditions? - The n-th and subsequent elements are all equal. That is, if n \leq i,j, a_i = a_j. - For every integer i, the a_i elements immediately following the i-th element are all equal. That is, if i < j < k\leq i+a_i, a_...
[["2\n", "4\n"], ["1000000\n", "267909856\n"], ["999745\n", "371558098\n"], ["999999\n", "373070711\n"], ["22\n", "35072458\n"], ["25002\n", "261919868\n"], ["2956\n", "531167668\n"], ["3\n", "15\n"], ["380467\n", "858853071\n"], ["407774\n", "308265835\n"], ["52228\n", "418193562\n"], ["68\n", "594239438\n"], ["804783...
2.34
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#274"}
0749f679e3f7ccb0
Sereja has got an array, consisting of n integers, a_1, a_2, ..., a_{n}. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make v_{i}-th array element equal to x_{i}. In other words, perform the assignment a_{v}_{i} = x_{i}. Increase each array elem...
[["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"], ["1 3\n1\n1 1 2\n2 1\n3 1\n", "3\n"], ["1 1\n1\n3 1\n", "1\n"], ["6 6\n202714501 613423725 367325359 862808465 182588146 745008828\n2 492\n2 1943\n1 3 173984392\n1 3 9356383\n3 4\n1 5 4726835...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1683"}
074df75f09aa4bdb
Some positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representations does a given positive integer have? For example, the integer 53 has two representations 5 + 7 + 11 + 13 + 17 and 53. The integer 41 has three representations 2 + 3 + 5 + 7 + 11 + 13, 11 + 13 + 17, ...
[["2\n3\n17\n41\n20\n666\n24\n53\n0", "1\n1\n2\n3\n0\n0\n1\n2\n"], ["2\n3\n17\n41\n20\n666\n24\n56\n0", "1\n1\n2\n3\n0\n0\n1\n1\n"], ["2\n3\n17\n41\n20\n666\n24\n20\n0", "1\n1\n2\n3\n0\n0\n1\n0\n"], ["2\n3\n17\n41\n20\n666\n46\n53\n0", "1\n1\n2\n3\n0\n0\n0\n2\n"], ["2\n3\n17\n70\n20\n666\n24\n56\n0", "1\n1\n2\n0\n0\n0\...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#807"}
075187e7fa2200a8
Lena is the most economical girl in Moscow. So, when her dad asks her to buy some food for a trip to the country, she goes to the best store — "PriceFixed". Here are some rules of that store: The store has an infinite number of items of every product. All products have the same price: $2$ rubles per item. For every...
[["3\n3 4\n1 3\n1 5\n", "8\n"], ["5\n2 7\n2 8\n1 2\n2 4\n1 8\n", "12\n"], ["1\n8 2\n", "10\n"], ["8\n1 8\n1 6\n1 5\n1 3\n1 3\n1 8\n1 7\n1 3\n", "11\n"], ["4\n4 1\n2 2\n1 6\n1 2\n", "9\n"], ["8\n1 63658803333197\n1 26806908300107\n1 37622010993115\n1 8932487734606\n1 55358687683237\n1 44940811911137\n1 29009786659098\n1...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1131"}
07522e15937a6a49
Mr. Chanek has an integer represented by a string $s$. Zero or more digits have been erased and are denoted by the character _. There are also zero or more digits marked by the character X, meaning they're the same digit. Mr. Chanek wants to count the number of possible integer $s$, where $s$ is divisible by $25$. Of ...
[["25\n", "1\n"], ["_00\n", "9\n"], ["_XX\n", "9\n"], ["0\n", "1\n"], ["5\n", "0\n"], ["_\n", "1\n"], ["X\n", "1\n"], ["__\n", "3\n"], ["X5\n", "2\n"], ["___X_X25\n", "90000\n"], ["_X8__725\n", "9000\n"], ["85X1X525\n", "10\n"], ["_7XX16X_\n", "36\n"], ["1_07XXX_\n", "40\n"], ["X2XXX9X_\n", "3\n"], ["XX9_X_X_\n", "300\...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#443"}
0759b5f56697da1c
The Little Elephant loves sortings. He has an array a consisting of n integers. Let's number the array elements from 1 to n, then the i-th element will be denoted as ai. The Little Elephant can make one move to choose an arbitrary pair of integers l and r (1 ≤ l ≤ r ≤ n) and increase ai by 1 for all i such that l ≤ i ...
[["3\n39740000 928596641 251625421\n", "676971220\n"], ["47\n479793446 951468508 89486286 338446715 32648506 624498057 608503040 669251062 922459299 753303599 15471514 633954104 726178809 25774434 239818174 886000554 86565563 340322990 233160987 244152140 400122002 267331289 113220645 554372347 628491411 141545764 7247...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#101"}
075fd67435e87ea0
Given is a positive integer L. Find the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L. Constraints * 1 ≤ L ≤ 1000 * L is an integer. Input Input is given from Standard Input in the following format: L Output Print the maximum possible volume of a re...
[["999", "36926037.000000000000"], ["3", "1.000000000000"], ["5", "4.62962962963\n"], ["8", "18.962962963\n"], ["0", "0.0\n"], ["1", "0.037037037037\n"], ["2", "0.296296296296\n"], ["4", "2.37037037037\n"], ["7", "12.7037037037\n"], ["13", "81.3703703704\n"], ["6", "8.0\n"], ["11", "49.2962962963\n"], ["-1", "-0.037037...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#2457"}
076ea1f2b53b1c28
Takahashi wants to be a member of some web service. He tried to register himself with the ID S, which turned out to be already used by another user. Thus, he decides to register using a string obtained by appending one character at the end of S as his ID. He is now trying to register with the ID T. Determine whether...
[["snuke\nsnekee", "No"], ["a\naa", "Yes"], ["chokudai\nchokudaiz", "Yes"], ["snuke\nsnelee", "No\n"], ["b\nba", "Yes\n"], ["a\nba", "No\n"], ["choktdai\nchokudaiz", "No\n"], ["nsuke\nsnelee", "No\n"], ["choktdai\nbhokudaiz", "No\n"], ["nuske\nsnelee", "No\n"], ["b\nab", "No\n"], ["iadtkohc\nbhokudaiz", "No\n"], ["nurk...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#2211"}
07790d111bac7d92
You are given an array $a_1, a_2, \dots, a_n$ where all $a_i$ are integers and greater than $0$. In one operation, you can choose two different indices $i$ and $j$ ($1 \le i, j \le n$). If $gcd(a_i, a_j)$ is equal to the minimum element of the whole array $a$, you can swap $a_i$ and $a_j$. $gcd(x, y)$ denotes the gre...
[["4\n1\n8\n6\n4 3 6 6 2 9\n4\n4 5 6 7\n5\n7 5 2 2 4\n", "YES\nYES\nYES\nNO\n"], ["1\n5\n2 6 2 4 5\n", "NO\n"], ["1\n5\n2 6 2 4 5\n", "NO\n"], ["1\n5\n2 6 2 4 1\n", "YES\n"], ["4\n1\n8\n6\n4 6 6 6 2 9\n4\n4 5 6 7\n5\n7 5 2 2 4\n", "YES\nYES\nYES\nNO\n"], ["4\n1\n9\n6\n4 5 6 6 2 9\n4\n4 5 6 7\n5\n11 5 2 2 4\n", "YES\nNO...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#722"}
077f638547c2f12b
Calculate the minimum number of characters you need to change in the string s, so that it contains at least k different letters, or print that it is impossible. String s consists only of lowercase Latin letters, and it is allowed to change characters only to lowercase Latin letters too. -----Input----- First line o...
[["yandex\n6\n", "0\n"], ["yahoo\n5\n", "1\n"], ["google\n7\n", "impossible\n"], ["a\n1\n", "0\n"], ["z\n2\n", "impossible\n"], ["fwgfrwgkuwghfiruhewgirueguhergiqrbvgrgf\n26\n", "14\n"], ["nfevghreuoghrueighoqghbnebvnejbvnbgneluqe\n26\n", "12\n"], ["a\n3\n", "impossible\n"], ["smaxpqplaqqbxuqxalqmbmmgubbpspxhawbxsuqhhe...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1853"}
0783848e5b47083b
Today Patrick waits for a visit from his friend Spongebob. To prepare for the visit, Patrick needs to buy some goodies in two stores located near his house. There is a d_1 meter long road between his house and the first shop and a d_2 meter long road between his house and the second shop. Also, there is a road of lengt...
[["10 20 30\n", "60\n"], ["1 1 5\n", "4\n"], ["100 33 34\n", "134\n"], ["777 777 777\n", "2331\n"], ["2 2 8\n", "8\n"], ["12 34 56\n", "92\n"], ["789 101112 131415\n", "203802\n"], ["27485716 99999999 35182\n", "55041796\n"], ["1 293548 5\n", "12\n"], ["12059 259855 5874875\n", "543828\n"], ["46981 105809 585858\n", "3...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#239"}
078f3570125c190f
One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete the p-th occurrence of character c from the name. After the user changed his name, he can't undo th...
[["2\nbac\n3\n2 a\n1 b\n2 c\n", "acb\n"], ["1\nabacaba\n4\n1 a\n1 a\n1 c\n2 b\n", "baa\n"], ["10\nccbcabbaca\n40\n2 c\n8 b\n26 b\n12 b\n24 a\n29 a\n20 c\n17 b\n32 c\n9 c\n16 b\n13 b\n19 a\n3 c\n2 b\n18 c\n4 a\n13 c\n8 c\n5 c\n13 a\n19 c\n26 c\n13 c\n6 c\n3 c\n4 a\n5 a\n9 c\n8 b\n9 c\n2 c\n19 a\n5 a\n12 c\n10 c\n2 b\n19...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#2236"}
07a5fb7085ed1c1c
One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got access to the memory of his not less mean sister Hexadecimal. He loaded there a huge amount of n different natural numbers from 1 to n to obtain total control over her energy. But his plan failed. The reason for this w...
[["100\n", "4\n"], ["1010011\n", "83\n"], ["1\n", "1\n"], ["999999999\n", "511\n"], ["112\n", "7\n"], ["101\n", "5\n"], ["121212121\n", "511\n"], ["99\n", "3\n"], ["101010101\n", "341\n"], ["901556123\n", "511\n"], ["2\n", "1\n"], ["312410141\n", "511\n"], ["1000000000\n", "512\n"], ["100100\n", "36\n"], ["111111111\n"...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#342"}
07a9dd5a24d025d4
You are given an array a consisting of n positive integers. You pick two integer numbers l and r from 1 to n, inclusive (numbers are picked randomly, equiprobably and independently). If l > r, then you swap values of l and r. You have to calculate the expected value of the number of unique elements in segment of the ar...
[["2\n1 2\n", "1.500000\n"], ["2\n2 2\n", "1.000000\n"], ["10\n9 6 8 5 5 2 8 9 2 2\n", "3.100000\n"], ["20\n49 33 9 8 50 21 12 44 23 39 24 10 17 4 17 40 24 19 27 21\n", "7.010000\n"], ["1\n1000000\n", "1.000000\n"], ["10\n9 6 8 5 5 2 8 9 2 2\n", "3.1000"], ["20\n49 33 9 8 50 21 12 44 23 39 24 10 17 4 17 40 24 19 27 21\...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#3242"}
07ab7f9054cc32cd
Print all combinations which can be made by $k$ different elements from $0, 1, ..., n-1$. Note that we represent $0, 1, ... n-1$ as 00...0001, 00...0010, 00...0100, ..., 10...0000 in binary respectively and the integer representation of a combination is calculated by bitwise OR of the selected elements. Constraints *...
[["5 1", "1: 0\n2: 1\n4: 2\n8: 3\n16: 4\n"], ["5 0", "0:\n"], ["1 1", "1: 0\n"], ["2 1", "1: 0\n2: 1\n"], ["4 1", "1: 0\n2: 1\n4: 2\n8: 3\n"], ["4 2", "3: 0 1\n5: 0 2\n6: 1 2\n9: 0 3\n10: 1 3\n12: 2 3\n"], ["5 2", "3: 0 1\n5: 0 2\n6: 1 2\n9: 0 3\n10: 1 3\n12: 2 3\n17: 0 4\n18: 1 4\n20: 2 4\n24: 3 4\n"], ["2 2", "3: 0 1...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#1137"}
07b41dd863af25f1
During the archaeological research in the Middle East you found the traces of three ancient religions: First religion, Second religion and Third religion. You compiled the information on the evolution of each of these beliefs, and you now wonder if the followers of each religion could coexist in peace. The Word of Uni...
[["6 8\nabdabc\n+ 1 a\n+ 1 d\n+ 2 b\n+ 2 c\n+ 3 a\n+ 3 b\n+ 1 c\n- 2\n", "YES\nYES\nYES\nYES\nYES\nYES\nNO\nYES\n"], ["6 8\nabbaab\n+ 1 a\n+ 2 a\n+ 3 a\n+ 1 b\n+ 2 b\n+ 3 b\n- 1\n+ 2 z\n", "YES\nYES\nYES\nYES\nYES\nNO\nYES\nNO\n"], ["1 1\nz\n+ 3 z\n", "YES\n"], ["1 1\nt\n+ 2 p\n", "NO\n"], ["2 12\naa\n+ 1 a\n+ 2 a\n+ 3...
1.18
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1072"}
07b5df642589706f
The R2 company has n employees working for it. The work involves constant exchange of ideas, sharing the stories of success and upcoming challenging. For that, R2 uses a famous instant messaging program Spyke. R2 has m Spyke chats just to discuss all sorts of issues. In each chat, some group of employees exchanges mes...
[["3 4 5\n1 1 1 1\n1 0 1 1\n1 1 0 0\n1 1\n3 1\n1 3\n2 4\n3 2\n", "3 3 1 "], ["4 3 4\n0 1 1\n1 0 1\n1 1 1\n0 0 0\n1 2\n2 1\n3 1\n1 3\n", "0 2 3 0 "], ["2 1 1\n1\n1\n1 1\n", "0 1 "], ["3 3 1\n1 1 1\n1 1 1\n1 1 1\n3 1\n", "1 1 0 "], ["3 2 1\n0 1\n1 0\n1 1\n1 2\n", "0 0 1 "], ["5 5 5\n0 1 1 1 0\n1 1 0 1 1\n1 1 1 1 1\n0 1 1...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#456"}
07cb2428e30bdf49
A tree is a graph with n vertices and exactly n - 1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices. A subtree of a tree T is a tree with both vertices and edges as subsets of vertices and edges of T. You're given a tr...
[["3\n1 2\n1 3\n1 -1 1\n", "3\n"], ["5\n2 3\n4 5\n2 5\n1 3\n0 2 1 4 3\n", "8\n"], ["10\n5 6\n8 2\n9 3\n4 1\n6 10\n9 8\n7 10\n7 4\n5 2\n0 -6 -9 -1 -5 -4 -2 -7 -8 -3\n", "18\n"], ["5\n3 1\n2 4\n3 4\n2 5\n0 -3 -1 2 4\n", "20\n"], ["12\n1 6\n10 1\n4 1\n7 1\n1 2\n5 1\n1 8\n1 11\n3 1\n12 1\n9 1\n580660007 861441526 -26492859...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1556"}
07dbbae38eb11af1
As we all know, F.C. Barcelona is the best soccer team of our era! Their entangling and mesmerizing game style usually translates into very high ball possession, consecutive counter-attack plays and goals. Lots of goals, thanks to the natural talent of their attacker and best player in history, Lionel Andres Messi. How...
[["2\n2 4\n4 2\n", "4\n6\n"], ["2\n3 4\n4 2", "12\n6\n"], ["2\n3 4\n4 3", "12\n21\n"], ["2\n3 1\n4 2", "0\n6\n"], ["2\n3 1\n4 3", "0\n21\n"], ["2\n6 1\n4 3", "1\n21\n"], ["2\n6 2\n4 3", "22\n21\n"], ["2\n6 2\n4 1", "22\n1\n"], ["2\n5 2\n4 1", "10\n1\n"], ["2\n5 2\n4 2", "10\n6\n"], ["2\n3 2\n4 2", "2\n6\n"], ["2\n3 4\n...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#3227"}
07ecf03dd6ca7842
The Romans have attacked again. This time they are much more than the Persians but Shapur is ready to defeat them. He says: "A lion is never afraid of a hundred sheep". Nevertheless Shapur has to find weaknesses in the Roman army to defeat them. So he gives the army a weakness number. In Shapur's opinion the weaknes...
[["97\n800 771 66 126 231 306 981 96 196 229 253 35 903 739 461 962 979 347 152 424 934 586 225 838 103 178 524 400 156 149 560 629 697 417 717 738 181 430 611 513 754 595 847 464 356 640 24 854 138 481 98 371 142 460 194 288 605 41 999 581 441 407 301 651 271 226 457 393 980 166 272 250 900 337 358 359 80 904 53 39 55...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1298"}
07fbb4f665b02e18
Dr. Asimov, a robotics researcher, released cleaning robots he developed (see Problem B). His robots soon became very popular and he got much income. Now he is pretty rich. Wonderful. First, he renovated his house. Once his house had 9 rooms that were arranged in a square, but now his house has N × N rooms arranged in...
[["3 1\n2 3\n6 4\n0 0", "No\n\nNo\n\n..EEEE\n..E..E\nEEE..E\nE..EEE\nE..E..\nEEEE..\n\n"], ["4 1\n2 3\n6 4\n0 0", "....\n.EE.\n.EE.\n....\n\nNo\n\n..EEEE\n..E..E\nEEE..E\nE..EEE\nE..E..\nEEEE..\n\n"], ["3 1\n4 3\n6 4\n0 0", "No\n\nEE..\nEE..\n..EE\n..EE\n\n..EEEE\n..E..E\nEEE..E\nE..EEE\nE..E..\nEEEE..\n\n"], ["4 1\n1 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#384"}
080622d51a4c95ea
Alperen is standing at the point $(0,0)$. He is given a string $s$ of length $n$ and performs $n$ moves. The $i$-th move is as follows: if $s_i = {L}$, then move one unit left; if $s_i = {R}$, then move one unit right; if $s_i = {U}$, then move one unit up; if $s_i = {D}$, then move one unit down. If Alperen start...
[["7\n7\nUUURDDL\n2\nUR\n8\nRRRUUDDD\n3\nLLL\n4\nDUUR\n5\nRUDLL\n11\nLLLLDDRUDRD\n", "YES\nYES\nNO\nNO\nYES\nYES\nNO\n"], ["1\n7\nUUURDDL\n", "YES\n"], ["9\n7\nUUURDDL\n2\nUR\n8\nRRRUUDDD\n3\nLLL\n4\nDUUR\n5\nRUDLL\n11\nLLLLDDRUDRD\n10\nLLLLDDRUDR\n5\nRUDLL\n", "YES\nYES\nNO\nNO\nYES\nYES\nNO\nNO\nYES\n"], ["1\n12\nDDD...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00003-of-00005.parquet#1882"}
08088fef579c6cda
Taro is playing with a puzzle that places numbers 1-9 in 9x9 squares. In this puzzle, you have to arrange the numbers according to the following rules. * One number appears exactly once in the same column * A number appears exactly once on the same line * In each of the 3x3 ranges separated by double lines, a number a...
[["2\n2 1 3 4 5 6 7 8 9\n4 5 6 7 8 9 1 2 3\n7 8 9 1 2 3 4 5 6\n2 3 4 5 6 7 8 9 1\n5 6 7 8 9 0 2 3 4\n8 9 1 2 3 4 5 6 7\n3 4 5 6 7 8 9 1 2\n6 7 8 9 1 2 3 4 5\n9 1 2 3 4 5 6 7 8\n2 1 3 4 5 6 7 8 9\n4 5 6 7 8 9 1 2 3\n7 8 9 1 2 3 4 5 6\n2 3 4 5 6 7 8 9 1\n5 6 7 8 9 1 2 3 4\n8 9 1 2 3 4 5 6 7\n3 4 5 6 7 8 9 1 2\n6 7 8 9 1 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1609"}
081cb114d14e11ae
We have a sequence of length N, a = (a_1, a_2, ..., a_N). Each a_i is a positive integer. Snuke's objective is to permute the element in a so that the following condition is satisfied: * For each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4. Determine whether Snuke can achieve his objective. ...
[["6\n2 7 1 8 2 8", "Yes"], ["3\n1 4 1", "Yes"], ["3\n1 10 100", "Yes"], ["2\n1 1", "No"], ["4\n1 2 3 4", "No"], ["6\n2 7 2 8 2 8", "Yes\n"], ["3\n-1 1 1", "No\n"], ["3\n0 4 1", "Yes\n"], ["3\n2 10 100", "Yes\n"], ["4\n2 2 3 4", "Yes\n"], ["6\n4 7 2 8 2 8", "Yes\n"], ["3\n0 1 1", "Yes\n"], ["3\n0 10 100", "Yes\n"], ["4...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00000-of-00005.parquet#3108"}
0824bb4ee14f5090
Sereja owns a restaurant for n people. The restaurant hall has a coat rack with n hooks. Each restaurant visitor can use a hook to hang his clothes on it. Using the i-th hook costs a_{i} rubles. Only one person can hang clothes on one hook. Tonight Sereja expects m guests in the restaurant. Naturally, each guest wants...
[["2 1\n2 1\n2\n", "3\n"], ["2 1\n2 1\n10\n", "-5\n"], ["1 1\n1\n2\n", "0\n"], ["3 96\n83 22 17\n19\n", "-1414\n"], ["8 4\n27 72 39 70 13 68 100 36\n95\n", "77\n"], ["2 65\n23 34\n74\n", "-4623\n"], ["2 48\n12 54\n69\n", "-3150\n"], ["5 30\n63 58 38 60 24\n42\n", "-867\n"], ["9 47\n17 36 91 43 89 7 41 43 65\n49\n", "-1...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1719"}
0834f9e0782a593c
Recently Anton found a box with digits in his room. There are k2 digits 2, k3 digits 3, k5 digits 5 and k6 digits 6. Anton's favorite integers are 32 and 256. He decided to compose this integers from digits he has. He wants to make the sum of these integers as large as possible. Help him solve this task! Each digit c...
[["1 1 1 1\n", "256\n"], ["5 1 3 4\n", "800\n"], ["9557 5242 1190 7734\n", "472384\n"], ["4759823 3520376 4743363 4743363\n", "1214827648\n"], ["4494839 1140434 3336818 4921605\n", "890719296\n"], ["407729 4510137 3425929 3425929\n", "104378624\n"], ["2073144 2073145 0 0\n", "66340608\n"], ["2092196 2406694 3664886 856...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#1765"}
0838e2cc86c582f0
There are n stone quarries in Petrograd. Each quarry owns mi dumpers (1 ≤ i ≤ n). It is known that the first dumper of the i-th quarry has xi stones in it, the second dumper has xi + 1 stones in it, the third has xi + 2, and the mi-th dumper (the last for the i-th quarry) has xi + mi - 1 stones in it. Two oligarchs p...
[["30\n53 12\n13 98\n21 60\n76 58\n39 5\n62 58\n73 80\n13 75\n37 45\n44 86\n1 85\n13 33\n17 50\n12 26\n97 48\n52 40\n2 71\n95 79\n38 76\n24 54\n91 39\n97 92\n94 80\n50 61\n33 56\n22 91\n39 94\n31 56\n28 16\n20 44\n", "tolik\n"], ["10\n2 3\n1 4\n5 8\n4 10\n10 8\n7 2\n1 2\n1 7\n4 10\n5 3\n", "tolik\n"], ["20\n8 6\n6 3\n2...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1277"}
083c8334275037ff
For given integer n, count the totatives of n, that is, the positive integers less than or equal to n that are relatively prime to n. Input n An integer n (1 ≤ n ≤ 1000000000). Output The number of totatives in a line. Examples Input 6 Output 2 Input 1000000 Output 400000
[["1000100", "391680\n"], ["5", "4\n"], ["1000101", "666732\n"], ["1000001", "990000\n"], ["1000011", "666672\n"], ["16", "8\n"], ["1010011", "976500\n"], ["31", "30\n"], ["61", "60\n"], ["59", "58\n"], ["106", "52\n"], ["41", "40\n"], ["57", "36\n"], ["21", "12\n"], ["2", "1\n"], ["1100000", "400000\n"], ["3", "2\n"],...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1171"}
084d50a70d5a1f52
The Fair Nut found a string $s$. The string consists of lowercase Latin letters. The Nut is a curious guy, so he wants to find the number of strictly increasing sequences $p_1, p_2, \ldots, p_k$, such that: For each $i$ ($1 \leq i \leq k$), $s_{p_i} =$ 'a'. For each $i$ ($1 \leq i < k$), there is such $j$ that $p_i ...
[["abbaa\n", "5"], ["baaaa\n", "4"], ["agaa\n", "3"], ["aaaaabb\n", "5"], ["aabaaaa\n", "14"], ["krflnzhter\n", "0"], ["baaahbbbba\n", "7"], ["abnxabbaab\n", "11"], ["babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab\n", "813881762"], ["amaabbbbxaabbbabaabaabbaaabaaaaa...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#413"}
0855d7d67d4ff97a
Problem Satake doesn't like being bent. For example, I don't like pencils, chopsticks, and bent-shaped houses, and I don't like taking actions such as turning right or left. By the way, Satake who lives on the XY plane is $ N $ shops $ (X_ {1}, Y_ {1}), (X_ {2}, Y_ {2}), \ ldots, (X_ {N} , Y_ {N}) I was asked to shop...
[["3\n1 0\n0 1\n-2 -2", "405.0000000000\n"], ["2\n0 1\n-1 -2", "423.4349488229\n"], ["2\n0 1\n-1 -3", "431.5650511771\n"], ["2\n0 1\n-1 -4", "435.9637565321\n"], ["3\n1 1\n0 1\n-2 -1", "386.5650511771\n"], ["2\n0 2\n0 -1", "450.0000000000\n"], ["2\n1 1\n-1 -3", "378.4349488229\n"], ["3\n1 0\n0 1\n-2 0", "360.0000000000...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#876"}
0856074d12605c3e
While Farmer John rebuilds his farm in an unfamiliar portion of Bovinia, Bessie is out trying some alternative jobs. In her new gig as a reporter, Bessie needs to know about programming competition results as quickly as possible. When she covers the 2016 Robot Rap Battle Tournament, she notices that all of the robots o...
[["3 2\n1 2\n3 2\n", "-1"], ["4 5\n2 1\n1 3\n2 3\n4 2\n4 3\n", "4"], ["5 10\n4 3\n4 1\n2 1\n1 3\n5 1\n5 3\n5 4\n2 5\n2 3\n2 4\n", "8"], ["2 1\n2 1\n", "1"], ["4 6\n1 4\n4 2\n2 3\n1 2\n1 3\n4 3\n", "3"], ["5 10\n1 2\n1 3\n1 4\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5\n", "10"], ["5 10\n2 1\n5 2\n3 2\n3 1\n5 4\n3 4\n4 2\n5 1\n4...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#187"}
085c5374f876fce7
Four players participate in the playoff tournament. The tournament is held according to the following scheme: the first player will play with the second, and the third player with the fourth, then the winners of the pairs will play in the finals of the tournament. It is known that in a match between two players, the o...
[["4\n3 7 9 5\n4 5 6 9\n5 3 8 1\n6 5 3 2\n", "\nYES\nNO\nYES\nNO\n"], ["1\n8 6 2 7\n", "YES\n"], ["1\n8 6 0 7\n", "YES\n"], ["4\n3 7 9 5\n4 5 6 9\n5 3 8 1\n2 5 3 2\n", "YES\nNO\nYES\nYES\n"], ["1\n2 4 -1 1\n", "NO\n"], ["4\n3 7 9 6\n4 5 6 9\n5 3 8 1\n6 5 3 2\n", "YES\nNO\nYES\nNO\n"], ["4\n3 7 9 5\n4 5 6 1\n5 3 8 1\n2 ...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#2598"}
08684fcd23045c95
Lee is used to finish his stories in a stylish way, this time he barely failed it, but Ice Bear came and helped him. Lee is so grateful for it, so he decided to show Ice Bear his new game called "Critic"... The game is a one versus one game. It has t rounds, each round has two integers s_i and e_i (which are determine...
[["3\n5 8\n1 4\n3 10\n", "1 1\n"], ["6\n216986951114298167 235031205335543871\n148302405431848579 455670351549314242\n506251128322958430 575521452907339082\n1 768614336404564650\n189336074809158272 622104412002885672\n588320087414024192 662540324268197150\n", "1 0\n"], ["2\n1 9\n4 5\n", "0 0\n"], ["1\n1 1\n", "0 1\n"],...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#2982"}
0873f28af664203e
You are given an array $a$ of $n$ integers and an integer $s$. It is guaranteed that $n$ is odd. In one operation you can either increase or decrease any single element by one. Calculate the minimum number of operations required to make the median of the array being equal to $s$. The median of the array with odd leng...
[["3 8\n6 5 8\n", "2"], ["7 20\n21 15 12 11 20 19 12\n", "6"], ["3 1\n1 2 5\n", "1"], ["1 100\n105\n", "5"], ["5 1\n2 2 4 6 1\n", "2"], ["1 100\n88\n", "12"], ["1 1\n100000\n", "99999"], ["3 4\n1 2 5\n", "2"], ["1 1\n1\n", "0"], ["3 10\n5 5 10\n", "5"], ["3 1\n1 2 5\n", "1\n"], ["1 1\n100000\n", "99999\n"], ["5 1\n2 2 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1735"}
08784808b13bb85e
Fox Ciel is playing a card game with her friend Jiro. Jiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attributes too. It's known that position of all Ciel's cards is Attack. Now is Ciel's battle phase, Ciel can do the following ope...
[["2 3\nATK 2000\nDEF 1700\n2500\n2500\n2500\n", "3000\n"], ["3 4\nATK 10\nATK 100\nATK 1000\n1\n11\n101\n1001\n", "992\n"], ["2 4\nDEF 0\nATK 0\n0\n0\n1\n1\n", "1\n"], ["34 9\nDEF 7295\nDEF 7017\nDEF 7483\nDEF 7509\nDEF 7458\nDEF 7434\nDEF 6981\nDEF 7090\nDEF 7298\nDEF 7134\nATK 737\nDEF 7320\nDEF 7228\nDEF 7323\nATK ...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#2396"}
088bcc35dfb695ed
You are given an array of integers $a$ of length $n$. The elements of the array can be either different or the same. Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step: either you ...
[["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n3 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\nBR\n4\n-2 -1 4 0\nRRRR\n", "YES\nNO\nYES\nYES\nNO\nYES\nYES\nYES\n"], ["8\n4\n1 2 5 2\nBRBR\n2\n1 1\nBB\n5\n3 1 4 2 5\nRBRRB\n5\n4 1 3 1 3\nRBRRB\n5\n5 1 5 1 5\nRBRRB\n4\n2 2 2 2\nBRBR\n2\n1 -2\...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1278"}
0895c31f6e1c2c9e
Claire is a man-eater. She's a real man-eater. She's going around with dozens of guys. She's dating all the time. And one day she found some conflicts in her date schedule. D'oh! So she needs to pick some dates and give the others up. The dates are set by hours like 13:00 to 15:00. She may have more than one date with...
[["2\n2 100\n10 12\n14 16\n2 200\n12 13\n18 20\n4\n1 100\n6 22\n1 1000\n6 22\n1 10000\n6 22\n1 100000\n6 22\n16\n1 100000000\n6 7\n1 100000000\n7 8\n1 100000000\n8 9\n1 110000000\n9 10\n1 100000000\n10 11\n1 100000000\n11 12\n1 100000000\n12 13\n1 100000000\n13 14\n1 100000000\n14 15\n1 100000000\n15 16\n1 100000000\n1...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1630"}
08b58f2c5c760d27
A permutation of size $n$ is an array of size $n$ such that each integer from $1$ to $n$ occurs exactly once in this array. An inversion in a permutation $p$ is a pair of indices $(i, j)$ such that $i > j$ and $a_i < a_j$. For example, a permutation $[4, 1, 3, 2]$ contains $4$ inversions: $(2, 1)$, $(3, 1)$, $(4, 1)$, ...
[["2\n-1 -1\n", "499122177\n"], ["1\n1\n", "0\n"], ["1\n-1\n", "0\n"], ["4\n-1 -1 -1 -1\n", "3\n"], ["69\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n", "11...
1.25
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#46"}
08baa84360c9e05f
Recently Luba bought a monitor. Monitor is a rectangular matrix of size n × m. But then she started to notice that some pixels cease to work properly. Luba thinks that the monitor will become broken the first moment when it contains a square k × k consisting entirely of broken pixels. She knows that q pixels are alread...
[["2 3 2 5\n2 1 8\n2 2 8\n1 2 1\n1 3 4\n2 3 2\n", "8\n"], ["3 3 2 5\n1 2 2\n2 2 1\n2 3 5\n3 2 10\n2 1 100\n", "-1\n"], ["29 50 5 29\n21 42 1565821\n21 43 53275635\n21 44 2717830\n21 45 9579585\n21 46 20725775\n22 42 2568372\n22 43 9584662\n22 44 31411635\n22 45 5089311\n22 46 4960702\n23 42 11362237\n23 43 42200296\n23...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#2"}
08c5e1c970ac0e4c
In this problem, we will deal with binary strings. Each character of a binary string is either a 0 or a 1. We will also deal with substrings; recall that a substring is a contiguous subsequence of a string. We denote the substring of string $s$ starting from the $l$-th character and ending with the $r$-th character as ...
[["5\n11011\n3\n1 3 3\n1 4 2\n1 2 3\n", "Yes\nYes\nNo\n"], ["1\n0\n1\n1 1 1\n", "Yes\n"], ["3\n010\n3\n1 3 1\n1 3 1\n3 2 1\n", "Yes\nYes\nNo\n"], ["10\n0100001001\n10\n2 5 4\n10 2 1\n5 3 5\n2 9 2\n5 3 1\n3 3 3\n9 8 1\n5 3 1\n9 5 2\n2 3 6\n", "No\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nNo\nNo\n"], ["5\n00010\n5\n5 3 1\n2 1 2\...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1553"}
08cada710e419881
-----Input----- The input contains a single integer a (1 ≤ a ≤ 64). -----Output----- Output a single integer. -----Examples----- Input 2 Output 1 Input 4 Output 2 Input 27 Output 5 Input 42 Output 6
[["2\n", "1\n"], ["4\n", "2\n"], ["27\n", "5\n"], ["42\n", "6\n"], ["1\n", "1\n"], ["3\n", "1\n"], ["64\n", "267\n"], ["5\n", "1\n"], ["6\n", "2\n"], ["7\n", "1\n"], ["8\n", "5\n"], ["9\n", "2\n"], ["10\n", "2\n"], ["11\n", "1\n"], ["12\n", "5\n"], ["13\n", "1\n"], ["14\n", "2\n"], ["15\n", "1\n"], ["16\n", "14\n"], ["...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#292"}
08d4608ef6b83514
Read problems statements in Mandarin Chinese and Russian. Vidhi went to a magic show last week where she was astounded by a magic trick performed by the great Mandwarf, the brown. His trick was as follows : Ask a volunteer from the audience to write down a list L of N integers. Ask another volunteer from the a...
[["2\n3\n1 1 1\n2 3 1000\nARM\n4\n1 2 3 4\n0 1 1000\nAMAM", "3 3 9\n1 2 3 4"], ["2\n3\n1 1 1\n2 3 1000\nARM\n4\n1 2 3 4\n0 1 1010\nAMAM", "3 3 9\n1 2 3 4\n"], ["2\n3\n1 0 1\n2 3 1000\nARM\n4\n1 2 3 4\n0 1 1010\nAMAM", "3 3 6\n1 2 3 4\n"], ["2\n3\n2 0 1\n2 3 1000\nARM\n4\n1 2 3 4\n0 1 1010\nAMAM", "4 3 6\n1 2 3 4\n"], [...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00003-of-00005.parquet#82"}
08dd1cf4990ee93d
Takahashi is solving quizzes. He has easily solved all but the last one. The last quiz has three choices: 1, 2, and 3. With his supernatural power, Takahashi has found out that the choices A and B are both wrong. Print the correct choice for this problem. -----Constraints----- - Each of the numbers A and B is 1, 2, o...
[["3\n1\n", "2\n"], ["1\n2\n", "3\n"], ["1\n3\n", "2\n"], ["3\n2\n", "1\n"], ["2\n1\n", "3\n"], ["2\n3\n", "1\n"], ["3\n2", "1\n"], ["1\n3", "2\n"], ["3\n001", "2\n"], ["3\n2", "1\n"], ["1\n3", "2\n"], ["3\n001", "2\n"], ["1\n2", "3"], ["3\n1", "2"]]
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#770"}
09038883e04c93ae
Pashmak decided to give Parmida a pair of flowers from the garden. There are n flowers in the garden and the i-th of them has a beauty number b_{i}. Parmida is a very strange girl so she doesn't want to have the two most beautiful flowers necessarily. She wants to have those pairs of flowers that their beauty differenc...
[["2\n1 2\n", "1 1"], ["3\n1 4 5\n", "4 1"], ["5\n3 1 2 3 1\n", "2 4"], ["2\n1 1\n", "0 1"], ["3\n1 1 1\n", "0 3"], ["4\n1 1 1 1\n", "0 6"], ["5\n1 1 1 1 1\n", "0 10"], ["5\n2 2 2 2 2\n", "0 10"], ["10\n2 2 2 2 2 2 2 2 2 2\n", "0 45"], ["3\n2 2 2\n", "0 3"], ["3\n3 3 3\n", "0 3"], ["2\n10000000 100000000\n", "90000000 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1393"}
090561ef25ff314f
Not so long ago company R2 bought company R1 and consequently, all its developments in the field of multicore processors. Now the R2 laboratory is testing one of the R1 processors. The testing goes in n steps, at each step the processor gets some instructions, and then its temperature is measured. The head engineer in...
[["2 1 1 2\n1\n", "Correct\n"], ["3 1 1 3\n2\n", "Correct\n"], ["2 1 1 3\n2\n", "Incorrect\n"], ["3 1 1 5\n3\n", "Correct\n"], ["3 2 1 5\n1 5\n", "Correct\n"], ["3 2 1 5\n1 1\n", "Correct\n"], ["3 2 1 5\n5 5\n", "Correct\n"], ["3 2 1 5\n1 6\n", "Incorrect\n"], ["3 2 5 10\n1 10\n", "Incorrect\n"], ["6 5 3 6\n4 4 4 4 4\n...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1191"}
09149cb2305ff130
Students Vasya and Petya are studying at the BSU (Byteland State University). At one of the breaks they decided to order a pizza. In this problem pizza is a circle of some radius. The pizza was delivered already cut into n pieces. The i-th piece is a sector of angle equal to a_{i}. Vasya and Petya want to divide all pi...
[["4\n90 90 90 90\n", "0\n"], ["3\n100 100 160\n", "40\n"], ["1\n360\n", "360\n"], ["4\n170 30 150 10\n", "0\n"], ["5\n10 10 10 10 320\n", "280\n"], ["8\n45 45 45 45 45 45 45 45\n", "0\n"], ["3\n120 120 120\n", "120\n"], ["5\n110 90 70 50 40\n", "40\n"], ["2\n170 190\n", "20\n"], ["15\n25 25 25 25 25 25 25 25 25 25 25 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#813"}
091fe98547385638
Kevin and Nicky Sun have invented a new game called Lieges of Legendre. In this game, two players take turns modifying the game state with Kevin moving first. Initially, the game is set up so that there are n piles of cows, with the i-th pile containing ai cows. During each player's turn, that player calls upon the pow...
[["2 1\n24 1\n", "Kevin\n"], ["1 1\n1\n", "Kevin\n"], ["5 1\n1 7 7 6 6\n", "Kevin\n"], ["2 3\n12345678 23456789\n", "Kevin\n"], ["2 1\n160 150\n", "Nicky\n"], ["2 3\n7 7\n", "Nicky\n"], ["2 2\n2 5\n", "Kevin\n"], ["9 2\n8 2 9 4 7 5 2 4 9\n", "Kevin\n"], ["6 2\n5 3 5 6 2 2\n", "Kevin\n"], ["7 2\n9 1 7 6 10 3 5\n", "Kevi...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#787"}
092e4fe09acb046f
You want to perform the combo on your opponent in one popular fighting game. The combo is the string $s$ consisting of $n$ lowercase Latin letters. To perform the combo, you have to press all buttons in the order they appear in $s$. I.e. if $s=$"abca" then you have to press 'a', then 'b', 'c' and 'a' again. You know t...
[["3\n4 2\nabca\n1 3\n10 5\ncodeforces\n2 8 3 2 9\n26 10\nqwertyuioplkjhgfdsazxcvbnm\n20 10 1 2 3 5 10 5 9 4\n", "4 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \n0 0 9 4 5 3 0 0 0 0 0 0 0 0 9 0 0 3 1 0 0 0 0 0 0 0 \n2 1 1 2 9 2 2 2 5 2 2 2 1 1 5 4 11 8 2 7 5 1 10 1 5 2 \n"], ["1\n11 2\nthisisatest\n3 5\n", "1 0 0...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#1923"}
09356aad7043e24d
It is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts. There are N houses along TopCoDeer street. The i-th house is located at coordinate a_i. He has decided to deliver gifts to all these houses. Find the minimum distance to be traveled when AtCoDeer can start an...
[["4\n2 3 7 9\n", "7\n"], ["8\n3 1 4 1 5 9 2 6\n", "8\n"], ["4\n2 3 9 9", "7\n"], ["8\n3 1 4 1 5 18 2 6", "17\n"], ["4\n2 3 13 9", "11\n"], ["4\n4 4 13 9", "9\n"], ["8\n3 1 1 1 5 15 1 6", "14\n"], ["4\n4 4 8 9", "5\n"], ["4\n0 4 8 18", "18\n"], ["8\n1 1 1 2 5 14 1 6", "13\n"], ["4\n-1 2 4 18", "19\n"], ["4\n-1 2 4 31",...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1508"}
0958322faf5147af
Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!). Let us remind you the rules of this game. Rock-paper-scissors is played by two players. In each round the players choose one of three items independently from each other. They show the items with their hands: a rock, scisso...
[["554858576\nP\nP\n", "0 0"], ["1\nRPSSPSRSPRSRSRRPPSRPRPSSRRRRRPPSPR\nS\n", "0 1"], ["1\nPSSSRPSRPRSPRP\nRRPSSPPSPRSSSSPPRSPSSRSSSRRPPSPPPSSPSRRRSRRSSRRPPRSSRRRPPSPRRPRRRPPSPSPPPPRSPPRPRRSRSSSSSPSRSSRPPRRPRRPRPRRRPPSSPPSRRSRPRPSSRSSSRPRPRP\n", "0 1"], ["1958778499\nSPSSSRPSPPRRSSRSRRSSSSRSR\nPPSSRSPSPRRSRSSRSSRPRPSSS...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#822"}
095df9a3388ebabf
Shichi-Go-San (literally "Seven-Five-Three") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children. Takahashi is now X years old. Will his growth be celebrated in Shichi-Go-San this time? -----Constraints----- - 1 ≤ X ≤ 9 - X is an integer. -----Input----- ...
[["5\n", "YES\n"], ["6\n", "NO\n"], ["1\n", "NO\n"], ["2\n", "NO\n"], ["3\n", "YES\n"], ["4\n", "NO\n"], ["7\n", "YES\n"], ["8\n", "NO\n"], ["9\n", "NO\n"], ["11", "NO\n"], ["7", "YES\n"], ["16", "NO\n"], ["3", "YES\n"], ["19", "NO\n"], ["4", "NO\n"], ["12", "NO\n"], ["0", "NO\n"], ["9", "NO\n"], ["1", "NO\n"], ["13", ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#540"}
09669dc33ed6d123
Four players participate in the playoff tournament. The tournament is held according to the following scheme: the first player will play with the second, and the third player with the fourth, then the winners of the pairs will play in the finals of the tournament. It is known that in a match between two players, the o...
[["4\n3 7 9 5\n4 5 6 9\n5 3 8 1\n6 5 3 2\n", "YES\nNO\nYES\nNO\n"], ["1\n8 6 2 7\n", "YES\n"], ["1\n8 6 2 7\n", "YES\n"], ["1\n8 6 0 7\n", "YES\n"], ["4\n3 7 9 5\n4 5 6 9\n5 3 8 1\n2 5 3 2\n", "YES\nNO\nYES\nYES\n"], ["1\n2 4 -1 1\n", "NO\n"], ["4\n3 7 9 6\n4 5 6 9\n5 3 8 1\n6 5 3 2\n", "YES\nNO\nYES\nNO\n"], ["4\n3 7 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#835"}
0968d73cc72391ec
Tetris is a game in which falling blocks are lined up on the board and erased. Here, let's consider a game that arranges it a little. The size of the board of this game is 5 frames wide, and it is high enough to accommodate all the blocks that appear. The falling blocks are straight and come in two types, landscape an...
[["4\n1 4 1\n1 3 2\n2 2 4\n2 3 5\n1\n1 5 1\n7\n2 2 2\n1 4 1\n2 1 3\n1 4 1\n1 1 1\n2 5 5\n1 4 2\n0", "7\n0\n6\n"], ["4\n1 4 1\n1 3 2\n1 2 4\n2 3 5\n1\n1 5 1\n7\n2 2 2\n1 4 1\n2 1 3\n1 4 1\n1 1 1\n2 5 5\n1 4 2\n0", "12\n0\n6\n"], ["4\n1 4 1\n1 3 1\n2 2 4\n2 3 5\n1\n1 5 1\n7\n2 2 2\n1 1 1\n2 1 3\n1 4 1\n1 1 1\n2 5 5\n1 4 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1420"}
097c346a9864a47e
You are given a sequence $a=[a_1,a_2,\dots,a_n]$ consisting of $n$ positive integers. Let's call a group of consecutive elements a segment. Each segment is characterized by two indices: the index of its left end and the index of its right end. Denote by $a[l,r]$ a segment of the sequence $a$ with the left end in $l$ a...
[["4\n6\n55 45 30 30 40 100\n4\n10 23 7 13\n5\n10 55 35 30 65\n6\n4 1 1 1 1 4\n", "3\n4\n2\n3\n"], ["4\n3\n6 6 12\n4\n18 6 6 6\n5\n1 1 1 1 1\n3\n12 6 6\n", "2\n3\n1\n2\n"], ["3\n4\n18 6 6 6\n5\n1 1 1 1 1\n3\n12 6 6\n", "3\n1\n2\n"], ["1\n2\n1 1\n", "1\n"], ["1\n3\n1 1 1\n", "1\n"], ["1\n7\n1 1 1 1 1 1 1\n", "1\n"], ["3...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1449"}
097d9b45bf7ab637
Since you are the best Wraith King, Nizhniy Magazin «Mir» at the centre of Vinnytsia is offering you a discount. You are given an array a of length n and an integer c. The value of some array b of length k is the sum of its elements except for the $\lfloor \frac{k}{c} \rfloor$ smallest. For example, the value of the...
[["3 5\n1 2 3\n", "6\n"], ["12 10\n1 1 10 10 10 10 10 10 9 10 10 10\n", "92\n"], ["7 2\n2 3 6 4 5 7 1\n", "17\n"], ["8 4\n1 3 4 5 5 3 4 1\n", "23\n"], ["15 5\n11 15 16 24 24 28 36 40 49 49 53 55 66 73 100\n", "547\n"], ["11 10\n58 97 93 74 59 59 76 59 59 59 30\n", "665\n"], ["1 1\n1\n", "0\n"], ["15 5\n1 1 1 1 1 1 1 1 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1773"}
098b408bb8619ab2
Nadeko's birthday is approaching! As she decorated the room for the party, a long garland of Dianthus-shaped paper pieces was placed on a prominent part of the wall. Brother Koyomi will like it! Still unsatisfied with the garland, Nadeko decided to polish it again. The garland has n pieces numbered from 1 to n from le...
[["6\nkoyomi\n3\n1 o\n4 o\n4 m\n", "3\n6\n5\n"], ["15\nyamatonadeshiko\n10\n1 a\n2 a\n3 a\n4 a\n5 a\n1 b\n2 b\n3 b\n4 b\n5 b\n", "3\n4\n5\n7\n8\n1\n2\n3\n4\n5\n"], ["10\naaaaaaaaaa\n2\n10 b\n10 z\n", "10\n10\n"], ["1\nc\n4\n1 x\n1 a\n1 e\n1 t\n", "1\n1\n1\n1\n"], ["20\naaaaaaaaaaaaaaaaaaaa\n1\n11 a\n", "20\n"], ["4\ncb...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1513"}
098c64eab958352d
Bandits appeared in the city! One of them is trying to catch as many citizens as he can. The city consists of $n$ squares connected by $n-1$ roads in such a way that it is possible to reach any square from any other square. The square number $1$ is the main square. After Sunday walk all the roads were changed to one-...
[["3\n1 1\n3 1 2\n", "3\n"], ["3\n1 1\n3 1 3\n", "4\n"], ["3\n1 1\n2 0 0\n", "1\n"], ["2\n1\n487981126 805590708\n", "1293571834\n"], ["5\n1 1 1 4\n28 0 0 0 0\n", "10\n"], ["2\n1\n91 0\n", "91\n"], ["10\n1 1 1 1 1 1 1 1 1\n64 0 0 0 0 0 0 0 0 0\n", "8\n"], ["50\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
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1739"}
0990a2fb8ac8a566
Hacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information. Zhorik knows that each of the messages is an archive containing one or more files. Zhorik knows how each of these archives was transferred...
[["7 6\n2 5 3 1 11 4 4\n7 8 2 4 1 8\n", "3\n"], ["3 3\n1 10 100\n1 100 10\n", "2\n"], ["1 4\n4\n1 1 1 1\n", "1\n"], ["1 1\n1000000\n1000000\n", "1\n"], ["3 5\n2 2 9\n2 1 4 2 4\n", "2\n"], ["5 3\n1 1 4 1 2\n1 4 4\n", "2\n"], ["30 50\n3 3 1 3 1 2 4 3 4 1 3 2 3 3 2 3 2 1 3 4 2 1 1 3 2 2 1 3 1 60\n4 4 1 2 2 2 3 1 3 2 1 2 4...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#303"}
0999565f8f61767e
Shell Sort Shell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$. 1 insertionSort(A, n, g) 2 for i = g to n-1 3 v = A[i] 4 j = i - g 5 while j >= 0 && A[j] > v 6 A[j+g] = A[j] 7 j = j - g 8 cnt++ 9 A[j+g...
[["5\n5\n1\n4\n5\n2", "2\n4 1\n2\n1\n2\n4\n5\n5\n"], ["3\n6\n2\n1", "1\n1\n3\n1\n2\n6\n"], ["5\n6\n1\n4\n5\n2", "2\n4 1\n2\n1\n2\n4\n5\n6\n"], ["3\n0\n2\n1", "1\n1\n1\n0\n1\n2\n"], ["5\n6\n1\n4\n9\n2", "2\n4 1\n3\n1\n2\n4\n6\n9\n"], ["3\n-1\n2\n1", "1\n1\n1\n-1\n1\n2\n"], ["5\n6\n1\n4\n6\n2", "2\n4 1\n2\n1\n2\n4\n6\n6\...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#318"}
099b470aec7164e2
The girl Taylor has a beautiful calendar for the year y. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday. The calendar is so beautiful that she wants to know what is the next year after y when the calendar will be exactly the same. Help Tayl...
[["2016\n", "2044\n"], ["2000\n", "2028\n"], ["50501\n", "50507\n"], ["1000\n", "1006\n"], ["1900\n", "1906\n"], ["1899\n", "1905\n"], ["99999\n", "100010\n"], ["50000\n", "50028\n"], ["99900\n", "99906\n"], ["12345\n", "12351\n"], ["1004\n", "1032\n"], ["2100\n", "2106\n"], ["1313\n", "1319\n"], ["1872\n", "1912\n"], ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1388"}
099ce71332f4f68f
Two friends are on the coordinate axis Ox in points with integer coordinates. One of them is in the point x_1 = a, another one is in the point x_2 = b. Each of the friends can move by one along the line in any direction unlimited number of times. When a friend moves, the tiredness of a friend changes according to the...
[["3\n4\n", "1\n"], ["101\n99\n", "2\n"], ["5\n10\n", "9\n"], ["1\n2\n", "1\n"], ["1\n1000\n", "250000\n"], ["999\n1000\n", "1\n"], ["1000\n999\n", "1\n"], ["1000\n1\n", "250000\n"], ["2\n1\n", "1\n"], ["2\n999\n", "249001\n"], ["2\n998\n", "248502\n"], ["999\n2\n", "249001\n"], ["998\n2\n", "248502\n"], ["2\n1000\n", ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#457"}
09a190709f696667
Facetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority factor (it will be described). This priority factor will be affected by three types of actions: * 1. "X posted on Y's wall" (...
[["post\n9\npost posted on wall's wall\non commented on post's post\npost likes likes's post\ncommented posted on post's wall\npost commented on likes's post\nlikes likes post's post\npost posted on posted's wall\non commented on post's post\npost likes commented's post\n", "commented\nlikes\non\nposted\nwall\n"], ["li...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1794"}
09a80c7cd9f68bfb
Vanya wants to minimize a tree. He can perform the following operation multiple times: choose a vertex v, and two disjoint (except for v) paths of equal length a_0 = v, a_1, ..., a_{k}, and b_0 = v, b_1, ..., b_{k}. Additionally, vertices a_1, ..., a_{k}, b_1, ..., b_{k} must not have any neighbours in the tree other t...
[["6\n1 2\n2 3\n2 4\n4 5\n1 6\n", "3\n"], ["7\n1 2\n1 3\n3 4\n1 5\n5 6\n6 7\n", "-1\n"], ["2\n1 2\n", "1\n"], ["3\n3 1\n1 2\n", "1\n"], ["10\n5 10\n7 8\n8 3\n2 6\n3 2\n9 7\n4 5\n10 1\n6 4\n", "9\n"], ["11\n11 9\n6 7\n7 1\n8 11\n5 6\n3 5\n9 3\n10 8\n2 4\n4 10\n", "5\n"], ["10\n4 2\n7 4\n2 6\n2 5\n4 8\n10 3\n2 9\n9 1\n5 ...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00000-of-00005.parquet#29"}
09aea1807778c4e9
Ashish has a tree consisting of $n$ nodes numbered $1$ to $n$ rooted at node $1$. The $i$-th node in the tree has a cost $a_i$, and binary digit $b_i$ is written in it. He wants to have binary digit $c_i$ written in the $i$-th node in the end. To achieve this, he can perform the following operation any number of times...
[["5\n1 0 1\n20 1 0\n300 0 1\n4000 0 0\n50000 1 0\n1 2\n2 3\n2 4\n1 5\n", "4"], ["5\n10000 0 1\n2000 1 0\n300 0 1\n40 0 0\n1 1 0\n1 2\n2 3\n2 4\n1 5\n", "24000"], ["2\n109 0 1\n205 0 1\n1 2\n", "-1"], ["8\n82 0 0\n3 1 1\n53 0 0\n5 0 0\n81 0 1\n56 1 0\n99 1 0\n87 0 1\n5 7\n2 8\n4 7\n4 1\n3 2\n2 5\n8 6\n", "16"], ["10\n6...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1684"}
09aed619eb64ff9f
There is the word heuristics. It's a relatively simple approach that usually works, although there is no guarantee that it will work. The world is full of heuristics because it is simple and powerful. Some examples of heuristics include: In an anime program, the popularity of a character is proportional to the total a...
[["4 1 3 4\nyskwcnt 16\nakzakr 7\ntsnukk 12\nfnmyi 13\nakzakr\n4 1 3 5\nakzakr 7\ntsnukk 12\nfnmyi 13\nyskwcnt 16\nakzakr\n4 2 2 1\nakzakr 4\ntsnukk 6\nyskwcnt 6\nfnmyi 12\nakzakr\nfnmyi\n5 2 3 28\nknmmdk 6\nskrkyk 14\ntmemm 14\nakmhmr 15\nmksyk 25\nknmmdk\nskrkyk\n5 2 3 11\ntmemm 12\nskrkyk 18\nknmmdk 21\nmksyk 23\nak...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1308"}
09b091acfba4583f
You have an initially empty cauldron, and you want to brew a potion in it. The potion consists of two ingredients: magic essence and water. The potion you want to brew should contain exactly $k\ \%$ magic essence and $(100 - k)\ \%$ water. In one step, you can pour either one liter of magic essence or one liter of wat...
[["3\n3\n100\n25\n", "100\n1\n4\n"], ["100\n2\n36\n43\n19\n99\n100\n98\n9\n79\n57\n1\n78\n56\n14\n66\n93\n62\n50\n76\n33\n25\n41\n15\n61\n97\n68\n51\n91\n95\n96\n83\n53\n12\n77\n75\n85\n37\n72\n82\n70\n44\n69\n58\n52\n48\n73\n21\n24\n20\n8\n31\n32\n45\n55\n29\n13\n28\n49\n60\n54\n90\n86\n94\n10\n71\n47\n40\n74\n80\n23\...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#257"}
09bcfea9b995f207
You are given a sorted array $a_1, a_2, \dots, a_n$ (for each index $i > 1$ condition $a_i \ge a_{i-1}$ holds) and an integer $k$. You are asked to divide this array into $k$ non-empty consecutive subarrays. Every element in the array should be included in exactly one subarray. Let $max(i)$ be equal to the maximum i...
[["6 3\n4 8 15 16 23 42\n", "12\n"], ["4 4\n1 3 3 7\n", "0\n"], ["8 1\n1 1 2 3 5 8 13 21\n", "20\n"], ["1 1\n1\n", "0\n"], ["5 2\n3 3 4 5 6\n", "2\n"], ["1 1\n20\n", "0\n"], ["1 1\n56\n", "0\n"], ["1 1\n4\n", "0\n"], ["5 3\n99 101 103 105 107\n", "4\n"], ["1 1\n2\n", "0\n"], ["1 1\n1\n", "0\n"], ["5 2\n-1 -2 5 -4 8\n",...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#694"}
09c391bc8f0bc88c
Vlad went into his appartment house entrance, now he is on the $1$-th floor. He was going to call the elevator to go up to his apartment. There are only two elevators in his house. Vlad knows for sure that: the first elevator is currently on the floor $a$ (it is currently motionless), the second elevator is located ...
[["3\n1 2 3\n3 1 2\n3 2 1\n", "1\n3\n2\n"], ["1\n1902 3 5\n", "2\n"], ["1\n2001 1 2\n", "2\n"], ["1\n2001 1 3\n", "2\n"], ["1\n5086 5607 4560\n", "1\n"], ["1\n5086 1 2\n", "2\n"], ["4\n1 2 3\n3 1 2\n3 2 1\n5080 1000 500\n", "1\n3\n2\n2\n"], ["1\n2002 1 2\n", "2\n"], ["1\n2003 3 2\n", "2\n"], ["69\n1 2 3\n3 1 2\n3 2 1\n...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1680"}
09d6f4123579421d
Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem. You are given a weighted directed graph with n vertices and m edges. You need to find a path (perh...
[["6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4\n", "6\n"], ["3 3\n1 2 1\n2 3 1\n3 1 1\n", "1\n"], ["3 3\n1 2 1\n2 3 2\n3 1 3\n", "3\n"], ["6 7\n1 2 1\n1 5 1\n5 2 3\n2 3 3\n3 4 4\n1 6 1\n6 2 3\n", "3\n"], ["3 6\n1 2 1\n2 3 1\n3 1 1\n2 1 2\n3 2 4\n1 3 3\n", "4\n"], ["2 2\n1 2 1\n2 1 2\n", "2\n"], ["4 3\n1 2 1\n2...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00000-of-00005.parquet#3196"}
09d9a94d4677de83
When Darth Vader gets bored, he sits down on the sofa, closes his eyes and thinks of an infinite rooted tree where each node has exactly n sons, at that for each node, the distance between it an its i-th left child equals to d_{i}. The Sith Lord loves counting the number of nodes in the tree that are at a distance at m...
[["3 3\n1 2 3\n", "8\n"], ["10 100000\n1 2 3 4 5 6 7 8 9 10\n", "334171350\n"], ["2 100\n1 2\n", "252403355\n"], ["10 100000\n1 1 2 2 3 3 4 4 5 5\n", "475936186\n"], ["5 100000\n1 1 1 1 1\n", "943217271\n"], ["1 0\n1\n", "1\n"], ["2 1\n1 1\n", "3\n"], ["2 1\n2 2\n", "1\n"], ["86 95031\n1 1 2 1 1 2 1 1 1 1 2 2 2 1 1 1 2...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#415"}
09e735a444a31f64
Simon has a prime number x and an array of non-negative integers a_1, a_2, ..., a_{n}. Simon loves fractions very much. Today he wrote out number $\frac{1}{x^{a} 1} + \frac{1}{x^{a_{2}}} + \ldots + \frac{1}{x^{a_{n}}}$ on a piece of paper. After Simon led all fractions to a common denominator and summed them up, he go...
[["2 2\n2 2\n", "8\n"], ["3 3\n1 2 3\n", "27\n"], ["2 2\n29 29\n", "73741817\n"], ["4 5\n0 0 0 0\n", "1\n"], ["1 2\n1000000000\n", "1\n"], ["26 2\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2\n", "8\n"], ["26 7\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2\n", "49\n"], ["3 2\n0 1 1\n", "4\n"], ["1 127\n10...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1673"}
09f7f5cf2118c1e8
Dima the hamster enjoys nibbling different things: cages, sticks, bad problemsetters and even trees! Recently he found a binary search tree and instinctively nibbled all of its edges, hence messing up the vertices. Dima knows that if Andrew, who has been thoroughly assembling the tree for a long time, comes home and s...
[["6\n3 6 9 18 36 108\n", "Yes\n"], ["2\n7 17\n", "No\n"], ["9\n4 8 10 12 15 18 33 44 81\n", "Yes\n"], ["22\n2 4 8 16 32 96 288 576 1728 3456 10368 20736 62208 186624 559872 1119744 3359232 10077696 30233088 90699264 181398528 544195584\n", "Yes\n"], ["14\n122501 245002 367503 735006 1225010 4287535 8575070 21437675 42...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#66"}
0a06a9e4688c6f82
Determine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1. Constraints * 1\leq N,K\leq 100 * N and K are integers. Input Input is given from Standard Input in the following format: N K Output If we can choose K integers as above, print `YES`; otherwise, prin...
[["10 131", "NO\n"], ["43 10", "YES\n"], ["5 2", "YES\n"], ["5 8", "NO\n"], ["10 178", "NO\n"], ["43 19", "YES\n"], ["2 2", "NO\n"], ["5 1", "YES\n"], ["10 43", "NO\n"], ["51 19", "YES\n"], ["6 2", "YES\n"], ["10 69", "NO\n"], ["51 27", "NO\n"], ["10 2", "YES\n"], ["10 81", "NO\n"], ["77 27", "YES\n"], ["9 2", "YES\n"]...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1404"}
0a3cfb7325dd69d4
Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition. Embosser is a special devise that allows to "print" the text of a plastic tape. Text is printed sequentially, character by character...
[["zeus\n", "18\n"], ["map\n", "35\n"], ["ares\n", "34\n"], ["l\n", "11\n"], ["abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv\n", "99\n"], ["gngvi\n", "44\n"], ["aaaaa\n", "0\n"], ["a\n", "0\n"], ["z\n", "1\n"], ["vyadeehhikklnoqrs\n", "28\n"], ["jjiihhhhgggfedcccba...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#461"}
0a4227c25e130b53
Even if the world is full of counterfeits, I still regard it as wonderful. Pile up herbs and incense, and arise again from the flames and ashes of its predecessor — as is known to many, the phoenix does it like this. The phoenix has a rather long lifespan, and reincarnates itself once every a! years. Here a! denotes ...
[["2 4\n", "2\n"], ["0 10\n", "0\n"], ["107 109\n", "2\n"], ["10 13\n", "6\n"], ["998244355 998244359\n", "4\n"], ["999999999000000000 1000000000000000000\n", "0\n"], ["2 3\n", "3\n"], ["3 15\n", "0\n"], ["24 26\n", "0\n"], ["14 60\n", "0\n"], ["11 79\n", "0\n"], ["1230 1232\n", "2\n"], ["2633 2634\n", "4\n"], ["535 53...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1652"}
0a4de402cb19baba
Seryozha conducts a course dedicated to building a map of heights of Stepanovo recreation center. He laid a rectangle grid of size $n \times m$ cells on a map (rows of grid are numbered from $1$ to $n$ from north to south, and columns are numbered from $1$ to $m$ from west to east). After that he measured the average h...
[["3 4 2 1\n1 2 3 59\n", "111\n"], ["3 4 3 3\n4 4 0 5\n", "2\n"], ["1 1 1 1\n1 3 4 7\n", "1\n"], ["1 10 1 4\n11 12 17 29\n", "28\n"], ["3 3 1 2\n23 8 4 37\n", "59\n"], ["10 10 5 5\n478741118 470168785 859734009 999999937\n", "1976744826\n"], ["10 15 7 3\n680853366 753941356 522057812 999999937\n", "2838211080\n"], ["30...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1641"}
0a64301ed3aeabba
A + B is often used as an example of the easiest problem possible to show some contest platform. However, some scientists have observed that sometimes this problem is not so easy to get accepted. Want to try? -----Input----- The input contains two integers a and b (0 ≤ a, b ≤ 10^3), separated by a single space. --...
[["5 14\n", "19\n"], ["381 492\n", "873\n"], ["536 298\n", "834\n"], ["143 522\n", "665\n"], ["433 126\n", "559\n"], ["723 350\n", "1073\n"], ["632 264\n", "896\n"], ["923 488\n", "1411\n"], ["522 92\n", "614\n"], ["953 553\n", "1506\n"], ["242 86\n", "328\n"], ["151 691\n", "842\n"], ["441 915\n", "1356\n"], ["740 519...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#266"}
0a74f5e5e388e357
In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can leap to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies fo...
[["1 100", "0.0100000000"], ["99 1", "99.0000000000"], ["8 3", "2.6666666667"], ["8 2", "4.0\n"], ["8 4", "2.0\n"], ["8 6", "1.33333333333\n"], ["8 9", "0.888888888889\n"], ["14 9", "1.55555555556\n"], ["14 4", "3.5\n"], ["14 5", "2.8\n"], ["13 5", "2.6\n"], ["13 9", "1.44444444444\n"], ["13 18", "0.722222222222\n"], [...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#1258"}
0a7a358e23e425e3
A witch named Marie lived deep in a remote forest. Since she is a witch, she magically covers everything she needs to live, such as food, water, and fuel. Her magic is activated by drawing a magic circle using some magical stones and strings. This magic circle is drawn by placing stones and tying several pairs of ston...
[["5 4\n1 2\n2 3\n3 4\n4 5\n4 6\n1 2\n1 3\n1 4\n2 4\n2 4\n3 4\n5 0\n0 0", "yes\nno\nyes\n"], ["5 4\n1 2\n2 3\n3 4\n5 5\n4 6\n1 2\n1 3\n1 4\n2 4\n2 4\n3 4\n5 0\n0 0", "no\nno\nyes\n"], ["5 4\n2 2\n2 3\n3 4\n5 5\n4 6\n1 2\n1 3\n1 4\n1 4\n1 4\n3 4\n0 0\n0 0", "no\nno\n"], ["5 4\n2 1\n2 3\n3 4\n4 5\n4 6\n1 2\n1 3\n1 4\n2 4...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1235"}
0a86d4345abecc32
We have sticks numbered 1, \cdots, N. The length of Stick i (1 \leq i \leq N) is L_i. In how many ways can we choose three of the sticks with different lengths that can form a triangle? That is, find the number of triples of integers (i, j, k) (1 \leq i < j < k \leq N) that satisfy both of the following conditions: - ...
[["5\n4 4 9 7 5\n", "5\n"], ["6\n4 5 4 3 3 5\n", "8\n"], ["10\n9 4 6 1 9 6 10 6 6 8\n", "39\n"], ["2\n1 1\n", "0\n"], ["10\n7 5 4 9 7 9 5 10 4 4\n", "56\n"], ["7\n6 10 8 3 7 1 9\n", "17\n"], ["7\n5 5 10 4 6 5 3\n", "13\n"], ["8\n3 3 2 2 7 1 3 10\n", "0\n"], ["8\n3 2 10 6 6 8 3 10\n", "12\n"], ["99\n811689453 25332000 2...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1614"}
0a87f7e881b2b874
Kolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle. More formally, there are 3n gnomes sitting in a circle. Each gnome can have from 1 to 3 coins. Let's number the places in the order they occur in the ci...
[["2\n", "680"], ["1\n", "20"], ["68841\n", "371243141"], ["5984\n", "546302050"], ["10\n", "848178170"], ["74\n", "972015869"], ["15\n", "83420839"], ["22\n", "695178405"], ["10868\n", "118127713"], ["2091\n", "982683445"], ["58000\n", "66667472"], ["9877\n", "915063121"], ["9\n", "557078005"], ["4\n", "529040"], ["6\...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#617"}