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
1a17fa94fdc19c9e
We'll define S(n) for positive integer n as follows: the number of the n's digits in the decimal base. For example, S(893) = 3, S(114514) = 6. You want to make a consecutive integer sequence starting from number m (m, m + 1, ...). But you need to pay S(n)·k to add the number n to the sequence. You can spend a cost up...
[["9 1 1\n", "9\n"], ["77 7 7\n", "7\n"], ["114 5 14\n", "6\n"], ["1 1 2\n", "0\n"], ["462 183 8\n", "19\n"], ["462 183 8\n", "19\n"], ["462 183 8\n", "19\n"], ["462 183 8\n", "19\n"], ["462 183 8\n", "19\n"], ["462 183 8\n", "19\n"], ["462 183 8\n", "19\n"], ["10000000000000000 1 1\n", "674074074074073\n"], ["21559900...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#649"}
1a1b56aafa4eac3e
You have N items that you want to put them into a knapsack. Item i has value vi and weight wi. You want to find a subset of items to put such that: * The total value of the items is as large as possible. * The items have combined weight at most W, that is capacity of the knapsack. Find the maximum total value of i...
[["4 5\n0 2\n5 2\n2 1\n8 3", "13\n"], ["2 20\n5 9\n3 10", "8\n"], ["4 2\n0 2\n5 2\n2 1\n8 3", "5\n"], ["2 20\n5 9\n2 10", "7\n"], ["2 20\n5 9\n1 8", "6\n"], ["2 20\n4 5\n0 4", "4\n"], ["4 5\n4 2\n5 2\n2 0\n8 3", "15\n"], ["2 20\n5 9\n7 10", "12\n"], ["4 7\n4 2\n5 2\n2 0\n8 3", "19\n"], ["2 20\n9 14\n2 10", "9\n"], ["0 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#752"}
1a1e5590f4136e21
Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists. - Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i chara...
[["contest\nson\n", "10\n"], ["contest\nprogramming\n", "-1\n"], ["contest\nsentence\n", "33\n"], ["d\nd\n", "1\n"], ["j\nw\n", "-1\n"], ["zv\nz\n", "1\n"], ["jh\nh\n", "2\n"], ["l\nll\n", "2\n"], ["s\nsv\n", "-1\n"], ["ajrtrcfagwyormuchsmsueudzdgrinkvcbxdtufrznmqsfhoixxpypvyixnfwurkbfwkpfuixqvwhjdfxawskijusrajlrktipfm...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1626"}
1a1f1d54c01c90ae
We call a string good, if after merging all the consecutive equal characters, the resulting string is palindrome. For example, "aabba" is good, because after the merging step it will become "aba". Given a string, you have to find two values: 1. the number of good substrings of even length; 2. the number of good ...
[["babaa\n", "2 7\n"], ["bb\n", "1 2\n"], ["baab\n", "2 4\n"], ["babb\n", "2 5\n"], ["bbabaaabaaaabaabbababbbabababaabaaaaabbaabbbbbaababaabbbaabaabaaaababaabaabbabaaabaabbbabbaaaaaaabaabababaaabaaabbbabbabbaabaaabaabbbbbabbababbbbbbbababbababbbabbbbbababaaaababaabbabaaabbaaabaabbbbabbaaababbbbbbaaabbaaabbaaabaaaaaabab...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00000-of-00005.parquet#3083"}
1a2bf7d93a7d58ec
Recently Petya walked in the forest and found a magic stick. Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $a$ is even, then the spell will turn it into $\frac{3a}{2}$; If...
[["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234\n", "YES\nYES\nNO\nYES\nNO\nYES\nYES\n"], ["1\n2 3\n", "YES\n"], ["1\n5 1000000000\n", "YES\n"], ["1\n4 1000000000\n", "YES\n"], ["1\n98989876 98989877\n", "YES\n"], ["1\n858993461 1000000000\n", "YES\n"], ["1\n1000 23222\n", "YES\n"], ["1\n1000 23222\n", "Yes\n"], ["1\...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#309"}
1a3e7e57cb65c1b7
We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it means it was rainy on that day. Find the maximum number of consecutive rainy days in this period. ----...
[["RRS\n", "2\n"], ["SSS\n", "0\n"], ["RSR\n", "1\n"], ["SRS\n", "1\n"], ["SSR\n", "1\n"], ["RRR\n", "3\n"], ["RSS\n", "1\n"], ["SRR\n", "2\n"], ["SRR", "2\n"], ["RRR", "3\n"], ["RSS", "1\n"], ["SSR", "1\n"], ["RST", "1\n"], ["SRS", "1\n"], ["TSR", "1\n"], ["USR", "1\n"], ["RSQ", "1\n"], ["QSR", "1\n"], ["RSU", "1\n"],...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#975"}
1a43da366c16850f
Iroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K. She is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change). However, as mentioned before, she is very ...
[["67 1\n0", "67\n"], ["34 1\n0", "34\n"], ["3 1\n0", "3\n"], ["6 1\n0", "6\n"], ["10 1\n0", "11\n"], ["5 1\n0", "5\n"], ["39 1\n0", "39\n"], ["10 1\n1", "20\n"], ["4 1\n1", "4\n"], ["56 1\n0", "56\n"], ["12 1\n0", "12\n"], ["8 1\n0", "8\n"], ["2 1\n0", "2\n"], ["0 1\n-1", "0\n"], ["1001 8\n1 3 4 5 6 7 8 9", "2000\n"],...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#622"}
1a5627e50b8da286
For two sequences S and T of length N consisting of 0 and 1, let us define f(S, T) as follows: - Consider repeating the following operation on S so that S will be equal to T. f(S, T) is the minimum possible total cost of those operations. - Change S_i (from 0 to 1 or vice versa). The cost of this operation is D \time...
[["1\n1000000000\n", "999999993\n"], ["2\n5 8\n", "124\n"], ["5\n52 67 72 25 79\n", "269312\n"], ["2\n8 8", "160\n"], ["1\n1000010000", "19986\n"], ["5\n20 67 72 25 79", "227072\n"], ["2\n8 6", "136\n"], ["1\n1000000010", "6\n"], ["5\n2 67 72 25 79", "199424\n"], ["1\n1000000110", "206\n"], ["5\n2 67 72 25 55", "179712...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#411"}
1a71d6163acea294
problem You love pasta, and you make and eat pasta for dinner every day. You can make three types of pasta: tomato sauce, cream sauce, and basil sauce. I decided to plan a dinner for N days. Choose one of the three types of pasta each day. However, if the same pasta continues, you will get bored, so do not choose the...
[["5 3\n3 1\n1 1\n4 1", "4\n"], ["5 3\n5 1\n1 1\n4 1", "6\n"], ["5 3\n3 2\n1 1\n4 1", "9\n"], ["5 2\n3 1\n1 1\n4 1", "16\n"], ["9 3\n5 1\n1 1\n4 1", "264\n"], ["5 1\n3 1\n1 1\n4 1", "60\n"], ["9 3\n5 1\n1 1\n4 2", "420\n"], ["5 3\n4 1\n1 1\n4 1", "22\n"], ["9 3\n5 1\n1 2\n4 2", "480\n"], ["5 3\n5 2\n1 1\n4 2", "5\n"], ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#873"}
1a7c20a4c8f7fd41
On the Literature lesson Sergei noticed an awful injustice, it seems that some students are asked more often than others. Seating in the class looks like a rectangle, where n rows with m pupils in each. The teacher asks pupils in the following order: at first, she asks all pupils from the first row in the order of t...
[["100 100 1000000000000000000 100 100\n", "101010101010101 50505050505051 50505050505051\n"], ["4 2 9 4 2\n", "2 1 1\n"], ["1 3 8 1 1\n", "3 2 3\n"], ["5 5 25 4 3\n", "1 1 1\n"], ["33 2 1 8 2\n", "1 0 0\n"], ["100 1 1000000000000 100 1\n", "10101010101 5050505051 5050505051\n"], ["1 17 523664480 1 4\n", "30803793 3080...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#2833"}
1a7df5c3a3730deb
You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question: * Find the maximum value among the N-1 elements other than A_i in the sequence. Constraints * 2 \leq N \leq 200000 * 1 \leq A_i \leq 200000 * All values in input are integers. Inp...
[["2\n5\n5", "5\n5"], ["3\n1\n4\n3", "4\n3\n4"], ["2\n5\n4", "4\n5\n"], ["3\n1\n0\n3", "3\n3\n1\n"], ["2\n3\n4", "4\n3\n"], ["3\n1\n0\n2", "2\n2\n1\n"], ["2\n4\n4", "4\n4\n"], ["3\n1\n0\n1", "1\n1\n1\n"], ["2\n4\n0", "0\n4\n"], ["3\n1\n2\n1", "2\n1\n2\n"], ["3\n1\n3\n1", "3\n1\n3\n"], ["3\n1\n3\n2", "3\n2\n3\n"], ["3\n...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00000-of-00005.parquet#2938"}
1a7f3e8babe6bffd
Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. Constraints...
[["7?4", "0"], ["??2??5", "768"], ["?6?42???8??2??06243????9??3???7258??5??7???????774????4?1??17???9?5?70???76???", "153716888"], ["?44", "1"], ["74?", "1\n"], ["??1??5", "768\n"], ["?6?42???8??29?06243????9??3???7258??5??7???????774????4?1??17?????5?70???76???", "153716829\n"], ["??1??6", "772\n"], ["???67???07?5????...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#2627"}
1a80d04bca61adeb
Jamie loves sleeping. One day, he decides that he needs to wake up at exactly hh: mm. However, he hates waking up, so he wants to make waking up less painful by setting the alarm at a lucky time. He will then press the snooze button every x minutes until hh: mm is reached, and only then he will wake up. He wants to kno...
[["34\n09 24\n", "3\n"], ["2\n14 37\n", "0\n"], ["14\n19 54\n", "9\n"], ["42\n15 44\n", "12\n"], ["46\n02 43\n", "1\n"], ["54\n16 47\n", "0\n"], ["38\n20 01\n", "3\n"], ["23\n23 14\n", "9\n"], ["51\n03 27\n", "0\n"], ["35\n15 25\n", "13\n"], ["3\n12 15\n", "6\n"], ["47\n00 28\n", "3\n"], ["50\n01 59\n", "10\n"], ["34\n...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#854"}
1a8946637757b909
You are given an integer $n$ and an integer $k$. In one step you can do one of the following moves: decrease $n$ by $1$; divide $n$ by $k$ if $n$ is divisible by $k$. For example, if $n = 27$ and $k = 3$ you can do the following steps: $27 \rightarrow 26 \rightarrow 25 \rightarrow 24 \rightarrow 8 \rightarrow 7 \...
[["2\n59 3\n1000000000000000000 10\n", "8\n19\n"], ["93\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1278"}
1a94e50dbd87cf12
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th...
[["100 5", "608000"], ["10 2", "18400"], ["1 1", "3800"], ["100 1", "23600\n"], ["10 4", "131200\n"], ["1 0", "100\n"], ["110 1", "25600\n"], ["10 7", "1740800\n"], ["0 0", "0\n"], ["111 1", "25800\n"], ["10 3", "51200\n"], ["-1 0", "-100\n"], ["101 1", "23800\n"], ["10 5", "320000\n"], ["111 2", "58800\n"], ["8 5", "3...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#2308"}
1a9a042bb186736c
There are n armchairs, numbered from 1 to n from left to right. Some armchairs are occupied by people (at most one person per armchair), others are not. The number of occupied armchairs is not greater than n/2. For some reason, you would like to tell people to move from their armchairs to some other ones. If the i-th ...
[["6\n1 1 1 0 0 0\n", "\n9\n"], ["5\n0 0 0 0 0\n", "\n0\n"], ["7\n1 0 0 1 0 0 1\n", "\n3\n"], ["100\n0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0\n", "10\n"], ["2\n1...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00000-of-00005.parquet#2964"}
1aa9d6fc64fca7cf
problem You are in charge of quality control at a machine manufacturing plant. This machine requires a power supply, a motor, and a cable as parts. The manufacturing plant has a power supply, b motors, and c cables, numbered from 1 to a, a + 1 to a + b, and a + b + 1 to a + b + c, respectively. attached. The trouble i...
[["2 2 2\n4\n2 4 5 0\n2 3 6 0\n1 4 5 0\n2 3 2 1\n0 0 0", "2\n1\n1\n2\n2\n0\n"], ["2 2 2\n4\n2 4 5 0\n2 3 6 0\n1 4 5 0\n2 3 2 0\n0 0 0", "2\n2\n2\n2\n2\n2\n"], ["3 2 2\n4\n2 4 5 0\n2 3 6 0\n1 4 5 0\n2 3 5 1\n0 0 0", "2\n1\n1\n0\n1\n0\n2\n"], ["2 2 2\n4\n3 4 5 0\n2 3 6 0\n1 4 4 1\n2 3 2 0\n0 0 0", "1\n2\n2\n1\n2\n2\n"], ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1128"}
1ab1ec1c0027b75f
There are n pictures delivered for the new exhibition. The i-th painting has beauty a_{i}. We know that a visitor becomes happy every time he passes from a painting to a more beautiful one. We are allowed to arranged pictures in any order. What is the maximum possible number of times the visitor may become happy while...
[["5\n20 30 10 50 40\n", "4\n"], ["4\n200 100 100 200\n", "2\n"], ["10\n2 2 2 2 2 2 2 2 2 2\n", "0\n"], ["1\n1000\n", "0\n"], ["2\n444 333\n", "1\n"], ["100\n9 9 72 55 14 8 55 58 35 67 3 18 73 92 41 49 15 60 18 66 9 26 97 47 43 88 71 97 19 34 48 96 79 53 8 24 69 49 12 23 77 12 21 88 66 9 29 13 61 69 54 77 41 13 4 68 37...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#521"}
1aca687b95f05b43
Polycarp takes part in a quadcopter competition. According to the rules a flying robot should: start the race from some point of a field, go around the flag, close cycle returning back to the starting point. Polycarp knows the coordinates of the starting point (x_1, y_1) and the coordinates of the point where th...
[["1 5\n5 2\n", "18\n"], ["0 1\n0 0\n", "8\n"], ["-100 -100\n100 100\n", "804\n"], ["-100 -100\n-100 100\n", "406\n"], ["-100 -100\n100 -100\n", "406\n"], ["100 -100\n-100 -100\n", "406\n"], ["100 -100\n-100 100\n", "804\n"], ["100 -100\n100 100\n", "406\n"], ["-100 100\n-100 -100\n", "406\n"], ["-100 100\n100 -100\n",...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1297"}
1ad047195d4689c2
You are given a sequence of n integers a1, a2, ..., an. Determine a real number x such that the weakness of the sequence a1 - x, a2 - x, ..., an - x is as small as possible. The weakness of a sequence is defined as the maximum value of the poorness over all segments (contiguous subsequences) of a sequence. The poor...
[["10\n1 10 2 9 3 8 4 7 5 6\n", "4.500000000000024\n"], ["4\n1 2 3 4\n", "2.000000000000003\n"], ["3\n1 2 3\n", "1.000000000000000\n"], ["10\n-405 -230 252 -393 -390 -259 97 163 81 -129\n", "702.333333333333712\n"], ["3\n10000 -10000 10000\n", "10000.000000000016371\n"], ["1\n-10000\n", "0.000000000000000\n"], ["20\n-1...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00000-of-00005.parquet#2818"}
1ae8eb802cc069bb
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar...
[["3\n30 10 20\n41 15 30\n18 13 18\n", "2\n7\n1\n"], ["1\n114515 114514 114514\n", "2\n"], ["1\n999855 999262 999557\n", "2\n"], ["1\n1138 4 643\n", "7\n"], ["1\n999855 999262 999557\n", "2\n"], ["1\n114515 114514 114514\n", "2\n"], ["1\n1138 4 643\n", "7\n"], ["1\n159385 114514 114514\n", "2\n"], ["3\n30 10 20\n41 15 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1058"}
1af331bcc137bd3a
Professor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows. There is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first side and exit from the holes of the other side of the box. Exactly one ray can enter or exit from each...
[["3\n1 2 3\n1 3 2\n", "2\n"], ["5\n1 2 4 5 3\n1 5 4 2 3\n", "3\n"], ["5\n1 2 4 5 3\n1 2 5 4 3\n", "2\n"], ["5\n1 5 2 4 3\n4 3 2 5 1\n", "4\n"], ["3\n1 2 3\n2 3 1\n", "2\n"], ["10\n4 7 8 1 2 3 5 9 6 10\n6 3 8 7 10 2 1 4 5 9\n", "5\n"], ["5\n5 3 2 4 1\n2 4 5 1 3\n", "2\n"], ["5\n1 3 5 4 2\n1 4 5 3 2\n", "3\n"], ["2\n1 2...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#670"}
1b03dc0b013b1d81
Highway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divided into $n$ sub-tracks. You are given an array $a$ where $a_i$ represents the number of traffic cars in the $i$-th sub-track....
[["3\n3\n1 2 3\n4\n0 1 1 0\n10\n8 3 6 11 5 2 1 7 10 4\n", "0\n4\n21\n"], ["3\n3\n1 2 3\n4\n0 1 1 0\n10\n8 3 6 11 4 2 1 7 10 4\n", "0\n4\n24\n"], ["3\n3\n1 2 3\n4\n1 1 1 0\n10\n8 3 6 11 4 2 1 7 10 4\n", "0\n3\n24\n"], ["3\n3\n1 1 3\n4\n1 1 1 0\n10\n8 3 6 11 4 2 1 7 10 4\n", "2\n3\n24\n"], ["3\n3\n1 1 3\n4\n1 1 1 0\n10\n...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#132"}
1b101318749188b7
Read problems statements in Mandarin Chinese and Russian as well. Given an array of N numbers, a pair of numbers is called good if difference between the two numbers is strictly less than D. Find out maximum possible sum of all good disjoint pairs that can be made from these numbers. Sum of X pairs is the sum of all ...
[["3\n3 3\n3 5 8\n4 3\n5 8 10 12\n5 3\n3 2 8 17 15", "8\n22\n37"], ["3\n3 3\n3 5 8\n4 3\n5 8 11 12\n5 3\n3 2 8 17 15", "8\n23\n37\n"], ["3\n3 3\n3 5 8\n4 3\n5 8 11 12\n5 6\n3 2 8 17 15", "8\n23\n43\n"], ["3\n3 3\n3 4 8\n4 3\n5 8 11 12\n5 6\n3 2 8 17 15", "7\n23\n43\n"], ["3\n3 3\n3 5 8\n4 3\n3 8 10 12\n5 3\n3 2 8 17 15...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#333"}
1b2bf701450c242e
Little penguin Polo loves his home village. The village has n houses, indexed by integers from 1 to n. Each house has a plaque containing an integer, the i-th house has a plaque containing integer pi (1 ≤ pi ≤ n). Little penguin Polo loves walking around this village. The walk looks like that. First he stands by a hou...
[["7 4\n", "1728\n"], ["5 2\n", "54\n"], ["8 5\n", "16875\n"], ["975 8\n", "531455228\n"], ["50 2\n", "628702797\n"], ["999 7\n", "490075342\n"], ["2 2\n", "2\n"], ["876 8\n", "703293724\n"], ["1000 2\n", "675678679\n"], ["12 8\n", "536870912\n"], ["227 6\n", "407444135\n"], ["3 3\n", "9\n"], ["2 1\n", "1\n"], ["1 1\n"...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#2658"}
1b33e85c3cdd928c
Makes solves problems on Decoforces and lots of other different online judges. Each problem is denoted by its difficulty — a positive integer number. Difficulties are measured the same across all the judges (the problem with difficulty d on Decoforces is as hard as the problem with difficulty d on any other judge). M...
[["3 3\n2 1 9\n", "1\n"], ["4 20\n10 3 6 3\n", "0\n"], ["1 1000000000\n1\n", "0\n"], ["1 1\n3\n", "1\n"], ["50 100\n74 55 33 5 83 24 75 59 30 36 13 4 62 28 96 17 6 35 45 53 33 11 37 93 34 79 61 72 13 31 44 75 7 3 63 46 18 16 44 89 62 25 32 12 38 55 75 56 61 82\n", "0\n"], ["100 10\n246 286 693 607 87 612 909 312 621 37...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#158"}
1b36f90b539ff187
You are given two positive integers $n$ and $k$. Print the $k$-th positive integer that is not divisible by $n$. For example, if $n=3$, and $k=7$, then all numbers that are not divisible by $3$ are: $1, 2, 4, 5, 7, 8, 10, 11, 13 \dots$. The $7$-th number among them is $10$. -----Input----- The first line contains a...
[["6\n3 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1\n", "10\n15\n1999999999\n113\n1000000001\n1\n"], ["7\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n", "1\n1\n1\n1\n1\n1\n1\n"], ["1\n841 4832526\n", "4838279\n"], ["7\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n", "1\n1\n1\n1\n1\n1\n1\n"], ["1\n841 4832526\n", "4838279\n"],...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#2771"}
1b373706e5d79851
It's another Start[c]up finals, and that means there is pizza to order for the onsite contestants. There are only 2 types of pizza (obviously not, but let's just pretend for the sake of the problem), and all pizzas contain exactly S slices. It is known that the i-th contestant will eat s_{i} slices of pizza, and gain ...
[["3 12\n3 5 7\n4 6 7\n5 9 5\n", "84\n"], ["6 10\n7 4 7\n5 8 8\n12 5 8\n6 11 6\n3 3 7\n5 9 6\n", "314\n"], ["1 100\n97065 97644 98402\n", "9551390130\n"], ["1 100000\n1 82372 5587\n", "82372\n"], ["25 6\n1 10 5\n1 8 4\n1 8 2\n4 8 9\n3 2 8\n1 9 5\n2 10 10\n3 9 6\n3 5 4\n2 7 8\n2 3 2\n2 6 8\n3 7 8\n4 3 7\n1 8 1\n3 6 4\n3...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#980"}
1b38340851e7c145
William really likes the cellular automaton called "Game of Life" so he decided to make his own version. For simplicity, William decided to define his cellular automaton on an array containing $n$ cells, with each cell either being alive or dead. Evolution of the array in William's cellular automaton occurs iterativel...
[["4\n11 3\n01000000001\n10 2\n0110100101\n5 2\n10101\n3 100\n000\n", "11111001111\n1110111101\n10101\n000\n"], ["1\n11 1\n10000100001\n", "11001110011\n"], ["1\n4 1000000000\n1010\n", "1011\n"], ["1\n5 42069\n11011\n", "11011\n"], ["1\n3 1000000000\n101\n", "101\n"], ["1\n5 1000000000\n11011\n", "11011\n"], ["1\n11 10...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1389"}
1b594c1989c54ac1
Vasya plays the LionAge II. He was bored of playing with a stupid computer, so he installed this popular MMORPG, to fight with his friends. Vasya came up with the name of his character — non-empty string s, consisting of a lowercase Latin letters. However, in order not to put up a front of friends, Vasya has decided to...
[["owhgcafpz 2\n40\nn n 951\nr n -857\ny o -228\nl c 369\nq g -735\nm g 723\nv y -445\ng z -853\nk f -549\ny h -591\ns h -918\nl p -899\ng t -849\nb y -29\nx l -555\ne x -435\nz w -780\nw k -267\ne n -453\nb f -338\nr y -146\ng b 544\nq q 720\nw c 817\nx n 797\nr m 134\nz a 847\nh o 208\nt s 362\nw t 316\nk u 475\nt k ...
3.98
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#927"}
1b65ee54f1bdf1df
Madoka wants to enter to "Novosibirsk State University", but in the entrance exam she came across a very difficult task: Given an integer $n$, it is required to calculate $\sum{\operatorname{lcm}(c, \gcd(a, b))}$, for all triples of positive integers $(a, b, c)$, where $a + b + c = n$. In this problem $\gcd(x, y)$ de...
[["3\n", "1\n"], ["5\n", "11\n"], ["69228\n", "778304278\n"], ["228\n", "3369368\n"], ["47\n", "32596\n"], ["13\n", "405\n"], ["1337\n", "425608851\n"], ["100000\n", "454535891\n"], ["94874\n", "584783437\n"], ["99413\n", "461761995\n"], ["99913\n", "550761256\n"], ["4\n", "4\n"], ["6\n", "20\n"], ["7\n", "42\n"], ["8\...
1.03
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1204"}
1b68d6805c8e127b
In the school computer room there are n servers which are responsible for processing several computing tasks. You know the number of scheduled tasks for each server: there are mi tasks assigned to the i-th server. In order to balance the load for each server, you want to reassign some tasks to make the difference betw...
[["2\n1 6\n", "2\n"], ["7\n10 11 10 11 10 11 11\n", "0\n"], ["5\n1 2 3 4 5\n", "3\n"], ["2\n10 3\n", "3\n"], ["5\n2 10 20 30 50\n", "34\n"], ["1\n0\n", "0\n"], ["10\n19999 19999 20000 20000 19999 20000 20000 20000 19999 19999\n", "0\n"], ["1\n20000\n", "0\n"], ["5\n6 5 9 7 6\n", "2\n"], ["7\n2 2 2 2 2 3 4\n", "1\n"], [...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#295"}
1b6e7ac2860bc76d
In one of the games Arkady is fond of the game process happens on a rectangular field. In the game process Arkady can buy extensions for his field, each extension enlarges one of the field sizes in a particular number of times. Formally, there are n extensions, the i-th of them multiplies the width or the length (by Ar...
[["3 3 2 4 4\n2 5 4 10\n", "1\n"], ["3 3 3 3 5\n2 3 5 4 2\n", "0\n"], ["5 5 1 2 3\n2 2 3\n", "-1\n"], ["3 4 1 1 3\n2 3 2\n", "3\n"], ["572 540 6 2 12\n2 3 2 2 2 3 3 3 2 2 2 2\n", "-1\n"], ["375 905 1 1 17\n2 2 3 3 3 3 3 3 2 2 2 2 3 2 2 2 3\n", "14\n"], ["37 23 4 1 16\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\n", "9\n"], ["20 19...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#857"}
1b73918ccf7bc8ba
Snuke is conducting an optical experiment using mirrors and his new invention, the rifle of Mysterious Light. Three mirrors of length N are set so that they form an equilateral triangle. Let the vertices of the triangle be a, b and c. Inside the triangle, the rifle is placed at the point p on segment ab such that ap ...
[["5 4", "12\n"], ["7 4", "18\n"], ["6 1", "15\n"], ["9 4", "24\n"], ["6 3", "9\n"], ["14 4", "36\n"], ["8 1", "21\n"], ["28 4", "72\n"], ["15 2", "42\n"], ["28 3", "81\n"], ["19 2", "54\n"], ["32 2", "90\n"], ["29 5", "84\n"], ["26 3", "75\n"], ["46 1", "135\n"], ["46 2", "132\n"], ["81 3", "234\n"], ["85 3", "252\n"]...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#674"}
1b79e945a9c67fc8
Inaka has a disc, the circumference of which is $n$ units. The circumference is equally divided by $n$ points numbered clockwise from $1$ to $n$, such that points $i$ and $i + 1$ ($1 \leq i < n$) are adjacent, and so are points $n$ and $1$. There are $m$ straight segments on the disc, the endpoints of which are all am...
[["12 6\n1 3\n3 7\n5 7\n7 11\n9 11\n11 3\n", "Yes\n"], ["9 6\n4 5\n5 6\n7 8\n8 9\n1 2\n2 3\n", "Yes\n"], ["10 3\n1 2\n3 2\n7 2\n", "No\n"], ["10 2\n1 6\n2 7\n", "Yes\n"], ["2 1\n2 1\n", "Yes\n"], ["7 16\n7 1\n7 3\n4 1\n7 5\n5 6\n4 7\n5 1\n4 5\n6 1\n2 4\n4 3\n6 4\n3 2\n6 2\n2 1\n6 7\n", "No\n"], ["50 25\n12 14\n28 30\n1...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#494"}
1ba135abcec64f13
This time Baby Ehab will only cut and not stick. He starts with a piece of paper with an array a of length n written on it, and then he does the following: * he picks a range (l, r) and cuts the subsegment a_l, a_{l + 1}, …, a_r out, removing the rest of the array. * he then cuts this range into multiple subrange...
[["1 1\n100000\n1 1\n", "1\n"], ["6 3\n1 1 3 10 2 14\n1 6\n4 6\n3 6\n", "3\n3\n3\n"], ["6 3\n1 5 10 6 10 14\n1 6\n2 4\n3 5\n", "5\n3\n3\n"], ["6 3\n1 5 10 6 10 14\n1 6\n3 4\n3 5\n", "5\n2\n3\n"], ["6 2\n2 3 10 6 5 22\n1 3\n2 4\n3 4\n", "2\n2\n"], ["6 3\n1 5 10 6 10 14\n1 3\n2 4\n3 5\n", "2\n3\n3\n"], ["6 3\n1 4 5 5 4 3...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1249"}
1ba585ceb844c6d4
D: Is greed the best? story In Japan, where there are 1, 5, 10, 50, 100, 500 yen coins, it is known that the number of coins can be minimized by using as many coins as possible when paying a certain amount. .. If the amount of coins is different from that of Japan, it is not always possible to minimize it by paying ...
[["2 6", "-1\n"], ["6 7", "12\n"], ["5 7", "10\n"], ["10 11", "20\n"], ["4 5", "8\n"], ["9 64", "72\n"], ["8 11", "16\n"], ["7 9", "14\n"], ["7 16", "21\n"], ["10 31", "40\n"], ["14 61", "70\n"], ["23 64", "69\n"], ["17 31", "34\n"], ["23 70", "92\n"], ["12 49", "60\n"], ["24 78", "96\n"], ["45 78", "90\n"], ["68 78", ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1268"}
1bacc1e26305df16
You are given an array a_1, a_2, ..., a_n and an array b_1, b_2, ..., b_n. For one operation you can sort in non-decreasing order any subarray a[l ... r] of the array a. For example, if a = [4, 2, 2, 1, 3, 1] and you choose subbarray a[2 ... 5], then the array turns into [4, 1, 2, 2, 3, 1]. You are asked to determi...
[["1\n5\n4 4 4 4 4\n5 5 5 5 5\n", "NO\n"], ["1\n8\n7 8 6 4 6 4 2 3\n2 4 7 6 4 8 3 6\n", "YES\n"], ["1\n9\n5 4 3 2 1 3 2 2 1\n1 2 3 4 1 2 2 3 5\n", "YES\n"], ["1\n5\n3 1 2 4 5\n2 5 4 3 1\n", "NO\n"], ["1\n10\n10 9 8 7 6 5 4 3 2 1\n9 8 7 6 5 4 3 2 1 10\n", "YES\n"], ["1\n4\n4 3 2 1\n3 4 1 2\n", "YES\n"], ["1\n6\n6 4 4 2 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#305"}
1bb0de8baf2934e3
We will play a one-player game using a number line and N pieces. First, we place each of these pieces at some integer coordinate. Here, multiple pieces can be placed at the same coordinate. Our objective is to visit all of the M coordinates X_1, X_2, ..., X_M with these pieces, by repeating the following move: Move: Ch...
[["2 5\n10 12 1 2 14\n", "5\n"], ["3 7\n-10 -3 0 9 -100 2 17\n", "19\n"], ["100 1\n-100000\n", "0\n"], ["22 75\n41869 33836 -55981 48202 73097 25228 68204 -36409 53282 -18112 27557 -90146 -51410 94032 -19631 84572 -17401 -96923 93364 57340 651 -2401 -1461 51373 53199 -47225 -49093 -23113 -65826 43632 -51039 32479 -1779...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#893"}
1bbbf7d89ca1631e
A magic number is a number formed by concatenation of numbers 1, 14 and 144. We can use each of these numbers any number of times. Therefore 14144, 141414 and 1411 are magic numbers but 1444, 514 and 414 are not. You're given a number. Determine if it is a magic number or not. -----Input----- The first line of inpu...
[["114114\n", "YES\n"], ["1111\n", "YES\n"], ["441231\n", "NO\n"], ["1\n", "YES\n"], ["14\n", "YES\n"], ["114\n", "YES\n"], ["9\n", "NO\n"], ["414\n", "NO\n"], ["1000000000\n", "NO\n"], ["144144144\n", "YES\n"], ["1444\n", "NO\n"], ["11\n", "YES\n"], ["141414141\n", "YES\n"], ["11110111\n", "NO\n"], ["114114144\n", "YE...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1170"}
1bc8fe5ddddd5556
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them. -----Input----- The first line con...
[["3\nRRG\n", "1\n"], ["5\nRRRRR\n", "4\n"], ["4\nBRBG\n", "0\n"], ["1\nB\n", "0\n"], ["2\nBG\n", "0\n"], ["3\nBGB\n", "0\n"], ["4\nRBBR\n", "1\n"], ["5\nRGGBG\n", "1\n"], ["10\nGGBRBRGGRB\n", "2\n"], ["50\nGRBGGRBRGRBGGBBBBBGGGBBBBRBRGBRRBRGBBBRBBRRGBGGGRB\n", "18\n"], ["15\nBRRBRGGBBRRRRGR\n", "6\n"], ["20\nRRGBBRBRG...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#888"}
1bca015ebb24dc37
Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles beautiful if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. -----Constraints----- - 1 \leq a,b,...
[["2 4 6\n", "YES\n"], ["2 5 6\n", "NO\n"], ["3 2 1\n", "YES\n"], ["2 8 6", "NO\n"], ["2 2 2", "YES\n"], ["2 2 1", "NO\n"], ["2 0 6", "NO\n"], ["1 8 6", "NO\n"], ["2 0 2", "NO\n"], ["1 8 1", "NO\n"], ["2 4 2", "NO\n"], ["2 0 3", "NO\n"], ["1 10 1", "NO\n"], ["2 4 1", "NO\n"], ["0 0 3", "NO\n"], ["1 1 1", "YES\n"], ["2 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1091"}
1bd061895afed412
Eighth-grader Vova is on duty today in the class. After classes, he went into the office to wash the board, and found on it the number n. He asked what is this number and the teacher of mathematics Inna Petrovna answered Vova that n is the answer to the arithmetic task for first-graders. In the textbook, a certain posi...
[["10\n", "1\n5 "], ["66\n", "1\n60 "], ["39\n", "1\n33 "], ["2\n", "1\n1 "], ["100\n", "1\n86 "], ["2014\n", "2\n1988 2006 "], ["101\n", "2\n91 100 "], ["999999994\n", "0\n"], ["1000000000\n", "1\n999999932 "], ["9\n", "0\n"], ["999999979\n", "2\n999999899 999999908 "], ["3\n", "0\n"], ["11\n", "1\n10 "], ["100000001\...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1532"}
1bd6916b7fca7a95
As a big fan of Formula One, Charlie is really happy with the fact that he has to organize ticket sells for the next Grand Prix race in his own city. Unfortunately, the finacial crisis is striking everywhere and all the banknotes left in his country are valued either 10 euros or 20 euros. The price of all tickets for t...
[["100000 90000 0\n", "0.10000899991\n"], ["100000 100000 10\n", "0.00120926220494\n"], ["44133 52876 8\n", "0\n"], ["25902 30390 2\n", "0\n"], ["0 0 0\n", "1\n"], ["90000 100000 0\n", "0\n"], ["91756 73882 2\n", "0.478004837164\n"], ["84273 98526 10\n", "0\n"], ["49672 75296 0\n", "0\n"], ["1 0 0\n", "1\n"], ["18874 2...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00003-of-00005.parquet#623"}
1bdae36fcc78b647
During the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food court, too, has a lunch break and it temporarily stopped working. Standing in a queue that isn't being served is so boring! So, each of the students wrote down the number of the student ID of...
[["4\n92 31\n0 7\n31 0\n7 141\n", "92 7 31 141 \n"], ["2\n0 1\n2 0\n", "2 1 \n"], ["3\n0 2\n1 3\n2 0\n", "1 2 3 \n"], ["4\n101 0\n0 102\n102 100\n103 101\n", "103 102 101 100 \n"], ["5\n0 1\n1 4\n4 0\n3 2\n5 3\n", "5 1 3 4 2 \n"], ["6\n10001 0\n0 10005\n10003 10001\n10002 10000\n10005 10002\n10004 10003\n", "10004 1000...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1548"}
1bddec7d1e1524df
Peter likes to travel by train. He likes it so much that on the train he falls asleep. Once in summer Peter was going by train from city A to city B, and as usual, was sleeping. Then he woke up, started to look through the window and noticed that every railway station has a flag of a particular colour. The boy start...
[["babaabababaaaababaabababaabababababababbababbbabbaabababaababbaabbababaababaaabababaabbaababaaababaa\nabaabababaa\nabaabbaa\n", "forward\n"], ["abacaba\naca\nba\n", "both\n"], ["aabaab\naba\nab\n", "forward\n"], ["bbabbbbababbaabaabaa\nabb\nbaab\n", "forward\n"], ["aababaaababaabbaabababaaababaabababbaabbabaabababaa...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#578"}
1bfe47084af36641
Monocarp wants to draw four line segments on a sheet of paper. He wants the $i$-th segment to have its length equal to $a_i$ ($1 \le i \le 4$). These segments can intersect with each other, and each segment should be either horizontal or vertical. Monocarp wants to draw the segments in such a way that they enclose a r...
[["4\n1 2 3 4\n5 5 5 5\n3 1 4 1\n100 20 20 100\n", "3\n25\n3\n2000\n"], ["4\n1 0 3 4\n5 5 5 5\n3 1 4 1\n100 20 20 100\n", "0\n25\n3\n2000\n"], ["4\n1 1 3 4\n5 5 5 5\n3 1 4 1\n100 20 20 100\n", "3\n25\n3\n2000\n"], ["4\n1 1 3 4\n5 5 3 5\n3 1 4 1\n100 20 20 100\n", "3\n15\n3\n2000\n"], ["4\n1 1 3 4\n5 5 3 5\n1 1 4 1\n100...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1730"}
1c01c2a78f265a8f
Polycarpus has recently got interested in sequences of pseudorandom numbers. He learned that many programming languages generate such sequences in a similar way: <image> (for i ≥ 1). Here a, b, m are constants, fixed for the given realization of the pseudorandom numbers generator, r0 is the so-called randseed (this val...
[["2 6 12 11\n", "2\n"], ["3 6 81 9\n", "1\n"], ["2 3 5 1\n", "4\n"], ["397 24 21491 18004\n", "21490\n"], ["65 101 43738 16242\n", "3450\n"], ["550 5 88379 9433\n", "44189\n"], ["0 0 16709 12233\n", "1\n"], ["0 0 23896 0\n", "1\n"], ["239 695 50503 18287\n", "25251\n"], ["452 53 51476 50033\n", "3024\n"], ["3 0 42953 ...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#2132"}
1c12a1a4277f354c
You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. -----Constraints----- - All values in input are integers. - 1 \leq N \leq 10^5 - N \leq M \leq ...
[["3 14\n", "2\n"], ["10 123\n", "3\n"], ["100000 1000000000\n", "10000\n"], ["22 743\n", "1\n"], ["26 695\n", "5\n"], ["72 135\n", "1\n"], ["33447 846767407\n", "1\n"], ["3497 637445234\n", "178\n"], ["7775 812998265\n", "79201\n"], ["63982 169552300\n", "2650\n"], ["68417 341263996\n", "4988\n"], ["100000 73900000\n"...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#493"}
1c2643aa45fdbe23
Vanya has a table consisting of 100 rows, each row contains 100 cells. The rows are numbered by integers from 1 to 100 from bottom to top, the columns are numbered from 1 to 100 from left to right. In this table, Vanya chose n rectangles with sides that go along borders of squares (some rectangles probably occur mult...
[["2\n1 1 3 3\n1 1 3 3\n", "18"], ["2\n1 1 2 3\n2 2 3 3\n", "10"], ["5\n4 11 20 20\n6 11 20 16\n5 2 19 15\n11 3 18 15\n3 2 14 11\n", "694"], ["1\n100 100 100 100\n", "1"], ["1\n1 1 1 1\n", "1"], ["5\n1 1 1 100\n1 1 1 100\n1 1 1 100\n1 1 1 100\n1 1 1 100\n", "500"], ["1\n1 1 1 100\n", "100"], ["3\n1 1 1 1\n1 2 1 2\n1 3 ...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#937"}
1c3233805994c81e
Write a program which manipulates a sequence A = {a1, a2, . . . , an} with the following operations: * add(i, x): add x to ai. * getSum(s, t): print the sum of as, as+1,...,at. Note that the initial values of ai (i = 1, 2, . . . , n) are 0. Constraints * 1 ≤ n ≤ 100000 * 1 ≤ q ≤ 100000 * If comi is 0, then 1 ≤ xi...
[["4 5\n0 1 1\n0 2 2\n0 3 3\n1 1 2\n1 2 2", "3\n2\n"], ["4 5\n0 1 1\n0 2 2\n0 1 5\n1 1 2\n1 2 2", "8\n2\n"], ["4 5\n0 1 0\n0 2 2\n0 1 5\n1 1 2\n1 2 2", "7\n2\n"], ["4 5\n0 1 1\n0 2 4\n0 3 3\n1 1 2\n1 2 2", "5\n4\n"], ["4 5\n0 1 1\n0 4 4\n0 3 3\n1 1 2\n1 2 2", "1\n0\n"], ["4 5\n0 1 1\n0 2 2\n0 3 9\n1 1 2\n0 2 2", "3\n"]...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#818"}
1c387ebf3d19b56b
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only. Waking up in the ...
[["3 1\n2 1 4\n11 3 16\n", "4\n"], ["4 3\n4 3 5 6\n11 12 14 20\n", "3\n"], ["10 926\n5 6 8 1 2 5 1 8 4 4\n351 739 998 725 953 970 906 691 707 1000\n", "137\n"], ["20 925\n7 3 1 2 1 3 1 3 1 2 3 1 5 8 1 3 7 3 4 2\n837 898 965 807 786 670 626 873 968 745 878 359 760 781 829 882 777 740 907 779\n", "150\n"], ["30 300\n1 4 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1848"}
1c47739539e512ec
Consider the infinite sequence s of positive integers, created by repeating the following steps: 1. Find the lexicographically smallest triple of positive integers (a, b, c) such that * a ⊕ b ⊕ c = 0, where ⊕ denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR). * a, b, ...
[["9\n1\n2\n3\n4\n5\n6\n7\n8\n9\n", "1\n2\n3\n4\n8\n12\n5\n10\n15\n"], ["9\n1\n3\n3\n4\n5\n6\n7\n8\n9\n", "1\n3\n3\n4\n8\n12\n5\n10\n15\n"], ["9\n1\n5\n3\n4\n5\n6\n7\n8\n9\n", "1\n8\n3\n4\n8\n12\n5\n10\n15\n"], ["9\n1\n5\n3\n4\n5\n6\n7\n8\n12\n", "1\n8\n3\n4\n8\n12\n5\n10\n13\n"], ["9\n1\n2\n3\n4\n5\n6\n11\n8\n9\n", "1...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#1965"}
1c4e922e569f2946
You are given a string $s$ consisting only of characters + and -. You perform some process with this string. This process can be described by the following pseudocode: res = 0 for init = 0 to inf cur = init ok = true for i = 1 to |s| res = res + 1 if s[i] == '+' cur = cur ...
[["3\n--+-\n---\n++--+-\n", "7\n9\n6\n"], ["15\n-\n--\n+\n+-\n-\n+\n-\n+\n-\n-+\n-+\n-+\n-+\n-+\n-+\n", "2\n5\n1\n2\n2\n1\n2\n1\n2\n3\n3\n3\n3\n3\n3\n"], ["15\n-\n--\n+\n+-\n-\n+\n-\n+\n-\n-+\n-+\n-+\n-+\n-+\n-+\n", "2\n5\n1\n2\n2\n1\n2\n1\n2\n3\n3\n3\n3\n3\n3\n"], ["15\n-\n--\n+\n+-\n-\n+\n-\n+\n-\n-+\n-+\n-+\n-+\n+-\...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1126"}
1c562350a72799e1
Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. 3:33 It's possible for all the digits displayed on a digital clock in the hours:minutes format to be identical. The time shown above (3:33) is an example of such a situation. Other examples are 2:2 and 1:11. Note that the digits of 33:33 are...
[["6\n24 60\n34 50\n10 11\n10 12\n11 11\n1 1", "19\n20\n10\n11\n10\n1"], ["6\n24 60\n34 50\n10 11\n10 12\n11 11\n1 2", "19\n20\n10\n11\n10\n1\n"], ["6\n24 60\n34 50\n1 11\n10 12\n11 10\n1 2", "19\n20\n1\n11\n10\n1\n"], ["6\n24 60\n34 5\n1 11\n10 12\n11 10\n1 2", "19\n8\n1\n11\n10\n1\n"], ["6\n24 60\n7 50\n10 11\n10 12\...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#650"}
1c570167b77a4cdd
You are given an integer a that consists of n digits. You are also given a sequence of digits s of length m. The digit in position j (1 ≤ j ≤ m) of sequence s means that you can choose an arbitrary position i (1 ≤ i ≤ n) in a and replace the digit in the chosen position i with sj. Each element in the sequence s can par...
[["111\n2222222299999999\n", "999\n"], ["786796787566545376\n00101\n", "786796787566545376\n"], ["3666566898\n3001\n", "3666566898\n"], ["123456789012345678905764345\n00001\n", "123456789112345678905764345\n"], ["87\n9\n", "97\n"], ["909090\n000111\n", "919191\n"], ["504\n91111\n", "914\n"], ["1099\n9\n", "9099\n"], ["...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#133"}
1c6fb9a629e65df0
After learning a lot about space exploration, a little girl named Ana wants to change the subject. Ana is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tired of this problem, so s...
[["20\niw\nix\nudb\nbg\noi\nuo\njsm\num\ns\nquy\nqo\nbxct\nng\nrmr\nnu\nps\nio\nkh\nw\nk\n", "5\n"], ["17\npo\nuej\ndtc\nj\ncnj\ncn\nbt\nnrj\nyye\nkol\nz\ntm\narb\ne\nzq\nj\nk\n", "4\n"], ["20\niw\nix\nudb\nbg\noi\nuo\njsm\nmu\ns\nquy\nqo\nbxct\nng\nrmr\nnu\nps\nio\nkh\nw\nk\n", "5\n"], ["17\npo\nuej\ndtc\nj\ncoj\ncn\n...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#938"}
1c7a6e7b1616692e
Given are an integer N and four characters c_{\mathrm{AA}}, c_{\mathrm{AB}}, c_{\mathrm{BA}}, and c_{\mathrm{BB}}. Here, it is guaranteed that each of those four characters is A or B. Snuke has a string s, which is initially AB. Let |s| denote the length of s. Snuke can do the four kinds of operations below zero or mor...
[["4\nA\nB\nB\nA\n", "2\n"], ["1000\nB\nB\nB\nB\n", "1\n"], ["2\nB\nA\nA\nA\n", "1\n"], ["2\nA\nB\nA\nA\n", "1\n"], ["2\nB\nB\nA\nA\n", "1\n"], ["2\nA\nA\nB\nA\n", "1\n"], ["2\nB\nA\nB\nA\n", "1\n"], ["2\nA\nB\nB\nA\n", "1\n"], ["2\nB\nB\nB\nA\n", "1\n"], ["2\nA\nA\nA\nB\n", "1\n"], ["2\nB\nA\nA\nB\n", "1\n"], ["2\nA\n...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#752"}
1c800d510d04cc80
There are N apple trees in a row. People say that one of them will bear golden apples. We want to deploy some number of inspectors so that each of these trees will be inspected. Each inspector will be deployed under one of the trees. For convenience, we will assign numbers from 1 through N to the trees. An inspector ...
[["20 4", "3"], ["14 3", "2"], ["6 2", "2"], ["20 7", "2\n"], ["0 3", "0\n"], ["6 4", "1\n"], ["14 2", "3\n"], ["4 0", "4\n"], ["28 2", "6\n"], ["28 0", "28\n"], ["14 1", "5\n"], ["12 0", "12\n"], ["23 1", "8\n"], ["14 0", "14\n"], ["22 0", "22\n"], ["19 1", "7\n"], ["11 0", "11\n"], ["21 0", "21\n"], ["18 0", "18\n"],...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#1707"}
1c8cf118d4d62012
You are given an array $a$ of length $n$ that has a special condition: every element in this array has at most 7 divisors. Find the length of the shortest non-empty subsequence of this array product of whose elements is a perfect square. A sequence $a$ is a subsequence of an array $b$ if $a$ can be obtained from $b$ b...
[["4\n2 3 6 6\n", "2"], ["3\n6 15 10\n", "3"], ["1\n1\n", "1"], ["2\n8 32\n", "2"], ["1\n97969\n", "1"], ["3\n2 2 2\n", "2"], ["1\n1\n", "1"], ["8\n6 15 35 129 143 221 34 26\n", "3\n"], ["2\n2 1\n", "1\n"], ["3\n12 15 10\n", "-1\n"], ["8\n6 15 35 129 143 221 3 26\n", "-1\n"], ["4\n2 3 6 12\n", "2\n"], ["2\n1 2\n", "1\n...
2.06
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#776"}
1c98ea17e61064d5
Polycarp wants to cook a soup. To do it, he needs to buy exactly $n$ liters of water. There are only two types of water bottles in the nearby shop — $1$-liter bottles and $2$-liter bottles. There are infinitely many bottles of these two types in the shop. The bottle of the first type costs $a$ burles and the bottle o...
[["4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88\n", "10\n9\n1000\n42000000000000\n"], ["1\n25 4 8\n", "100\n"], ["1\n26 5 9\n", "117\n"], ["1\n27 4 9\n", "108\n"], ["1\n28 23 53\n", "644\n"], ["1\n29 5 8\n", "117\n"], ["1\n30 1 3\n", "30\n"], ["1\n31 1 6\n", "31\n"], ["1\n32 4 7\n", "112\n"], ["1\n33 1 56\n", "33\n"...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1066"}
1c9c7812b1ec7ff7
You got a job as a marketer in a pet shop, and your current task is to boost sales of cat food. One of the strategies is to sell cans of food in packs with discounts. Suppose you decided to sell packs with $a$ cans in a pack with a discount and some customer wants to buy $x$ cans of cat food. Then he follows a greedy...
[["3\n3 4\n1 2\n120 150\n", "YES\nNO\nYES\n"], ["1\n500000000 1000000000\n", "NO\n"], ["1\n100000001 200000002\n", "NO\n"], ["1\n1000000000 1000000000\n", "YES\n"], ["1\n100000000 199999999\n", "YES\n"], ["5\n500000000 1000000000\n500000000 999999999\n499999998 999999996\n499999998 999999995\n499999998 999999997\n", "N...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#31"}
1c9d8957bbb3444c
A monopole magnet is a magnet that only has one pole, either north or south. They don't actually exist since real magnets have two poles, but this is a programming contest problem, so we don't care. There is an n× m grid. Initially, you may place some north magnets and some south magnets into the cells. You are allowe...
[["3 3\n.#.\n###\n##.\n", "1\n"], ["4 5\n....#\n####.\n.###.\n.#...\n", "2\n"], ["4 2\n##\n.#\n.#\n##\n", "-1\n"], ["3 5\n.....\n.....\n.....\n", "0\n"], ["2 1\n.\n#\n", "-1\n"], ["19 19\n##############.....\n.#############.....\n.###########.......\n.###########.......\n.....#######.......\n.....###...........\n.........
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#49"}
1ca5de06d81c6fae
Little Petya learns how to write. The teacher gave pupils the task to write the letter A on the sheet of paper. It is required to check whether Petya really had written the letter A. You are given three segments on the plane. They form the letter A if the following conditions hold: * Two segments have common endpoi...
[["3\n4 4 6 0\n4 1 5 2\n4 0 4 4\n0 0 0 6\n0 6 2 -4\n1 1 0 1\n0 0 0 5\n0 5 2 -1\n1 2 0 1\n", "YES\nNO\nYES\n"], ["3\n4 4 6 0\n4 1 5 2\n4 0 4 4\n0 0 0 6\n0 6 2 -4\n1 1 0 1\n0 0 0 5\n0 2 2 -1\n1 2 0 1\n", "YES\nNO\nNO\n"], ["3\n4 4 6 -1\n4 1 5 2\n4 0 4 4\n0 0 0 6\n0 6 2 -4\n1 1 0 1\n0 0 0 5\n0 2 2 -1\n1 2 0 1\n", "NO\nNO\...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#2650"}
1cabdc941e40a19f
Vasya is sitting on an extremely boring math class. To have fun, he took a piece of paper and wrote out n numbers on a single line. After that, Vasya began to write out different ways to put pluses ("+") in the line between certain digits in the line so that the result was a correct arithmetic expression; formally, no ...
[["3 1\n108\n", "27"], ["3 2\n108\n", "9"], ["1 0\n5\n", "5"], ["5 2\n39923\n", "2667"], ["6 3\n967181\n", "3506"], ["7 1\n2178766\n", "509217"], ["10 0\n3448688665\n", "448688644"], ["14 6\n00000000000001\n", "1716"], ["16 15\n8086179429588546\n", "90"], ["18 15\n703140050361297985\n", "24010"], ["20 9\n34540451546587...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#726"}
1cbfe03969cbd149
As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (x, y) coordinate system. We are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into surrounding cells as sho...
[["2,5,3\n3,6,1\n3,4,2\n4,5,2\n3,6,3\n1,4,1", "75\n5\n"], ["2,5,3\n1,6,3\n3,4,2\n4,5,2\n3,6,3\n2,4,1", "73\n5\n"], ["2,5,3\n3,6,1\n2,4,2\n4,5,2\n3,6,3\n1,4,1", "76\n5\n"], ["2,5,3\n3,6,1\n3,4,2\n5,5,2\n3,6,3\n1,4,1", "72\n4\n"], ["2,5,3\n3,6,1\n2,4,2\n4,6,2\n3,6,3\n1,4,1", "77\n5\n"], ["2,5,3\n3,6,1\n3,4,2\n4,5,2\n3,6,...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1824"}
1cc05396b8eca9c7
Professor Dumbledore is helping Harry destroy the Horcruxes. He went to Gaunt Shack as he suspected a Horcrux to be present there. He saw Marvolo Gaunt's Ring and identified it as a Horcrux. Although he destroyed it, he is still affected by its curse. Professor Snape is helping Dumbledore remove the curse. For this, he...
[["5 1 2 3\n1 2 3 4 5\n", "30\n"], ["5 1 2 -3\n-1 -2 -3 -4 -5\n", "12\n"], ["5 886327859 82309257 -68295239\n-731225382 354766539 -48222231 -474691998 360965777\n", "376059240645059046\n"], ["4 -96405765 -495906217 625385006\n-509961652 392159235 -577128498 -744548876\n", "547306902373544674\n"], ["43 959134961 -868367...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#964"}
1cd1b3577981c720
As you might know, cooking is the process of taking a food item and subjecting it to various processes(like heating, roasting, baking etc). A food item gets prepared after it has been subjected to exactly N processes. The order in which the processes are applied matters(heating and then baking is different from baking ...
[["3\n2 2\n2 3\n1 3", "2\n18\n6"], ["3\n0 2\n2 3\n1 3", "2\n18\n6\n"], ["3\n0 2\n2 3\n1 5", "2\n18\n20\n"], ["3\n0 2\n2 5\n1 5", "2\n260\n20\n"], ["3\n0 2\n2 10\n1 5", "2\n6570\n20\n"], ["3\n0 2\n2 10\n1 7", "2\n6570\n42\n"], ["3\n2 2\n2 3\n2 3", "2\n18\n18\n"], ["3\n0 2\n2 4\n1 5", "2\n84\n20\n"], ["3\n0 1\n2 5\n1 5",...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1305"}
1cd8962495699647
Let N be an even number. There is a tree with N vertices. The vertices are numbered 1, 2, ..., N. For each i (1 \leq i \leq N - 1), the i-th edge connects Vertex x_i and y_i. Snuke would like to decorate the tree with ribbons, as follows. First, he will divide the N vertices into N / 2 pairs. Here, each vertex must bel...
[["4\n1 2\n2 3\n3 4\n", "2\n"], ["4\n1 2\n1 3\n1 4\n", "3\n"], ["6\n1 2\n1 3\n3 4\n1 5\n5 6\n", "10\n"], ["10\n8 5\n10 8\n6 5\n1 5\n4 8\n2 10\n3 6\n9 2\n1 7\n", "672\n"], ["2\n1 2\n", "1\n"], ["5000\n1950 509\n3098 1999\n173 121\n3626 2063\n674 4386\n55 4437\n1882 3756\n105 2200\n2597 96\n121 4347\n2063 1179\n4729 1816...
4
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00000-of-00005.parquet#2263"}
1cd9f1553d1fced6
Young Timofey has a birthday today! He got kit of n cubes as a birthday present from his parents. Every cube has a number ai, which is written on it. Timofey put all the cubes in a row and went to unpack other presents. In this time, Timofey's elder brother, Dima reordered the cubes using the following rule. Suppose t...
[["8\n6 1 4 2 5 6 9 2\n", "2 1 6 2 5 4 9 6\n"], ["7\n4 3 7 6 9 1 2\n", "2 3 9 6 7 1 4\n"], ["5\n241218936 -825949895 -84926813 491336344 -872198236\n", "-872198236 -825949895 -84926813 491336344 241218936\n"], ["2\n1 2\n", "2 1\n"], ["9\n-7 9 -4 9 -6 11 15 2 -10\n", "-10 9 15 9 -6 11 -4 2 -7\n"], ["1\n1424\n", "1424\n"...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#982"}
1cdd2aa7d6d8ec00
Let us remind you part of the rules of Codeforces. The given rules slightly simplified, use the problem statement as a formal document. In the beginning of the round the contestants are divided into rooms. Each room contains exactly n participants. During the contest the participants are suggested to solve five proble...
[["10\nW22kb1L1 0 39 0 465 0 1961 865\n1MCXiVYmu5ys0afl 0 38 0 0 0 1982 1241\nCxg706kUJtQ 0 23 211 0 0 1785 1056\nmzEY 0 16 0 0 0 1988 1404\nv8JUjmam5SFP 0 48 0 788 1199 1426 0\n7giq 0 21 0 780 1437 1363 1930\nsXsUGbAulj6Lbiq 0 32 205 0 0 603 0\nRepIrY1Er4PgK 0 13 381 872 927 1488 0\nleKBdKHLnLFz 0 29 220 0 0 1006 889\...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#880"}
1ce49f53b9d12acc
New Year is coming in Tree World! In this world, as the name implies, there are n cities connected by n - 1 roads, and for any two distinct cities there always exists a path between them. The cities are numbered by integers from 1 to n, and the roads are numbered by integers from 1 to n - 1. Let's define d(u, v) as tot...
[["3\n2 3 5\n1 3 3\n5\n1 4\n2 2\n1 2\n2 1\n1 1\n", "14.0000000000\n12.0000000000\n8.0000000000\n6.0000000000\n4.0000000000\n"], ["6\n1 5 3\n5 3 2\n6 1 7\n1 4 4\n5 2 3\n5\n1 2\n2 1\n3 5\n4 1\n5 2\n", "19.6000000000\n18.6000000000\n16.6000000000\n13.6000000000\n12.6000000000\n"], ["4\n1 2 66\n1 3 565\n3 4 469\n4\n2 186\n...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#2115"}
1cec49b0dcae2d12
Takahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The consumption coefficient of Member i is A_i. In the contest, N foods numbered 1 through N will be presented, and the difficulty of F...
[["3 5\n4 2 1\n2 3 1\n", "2\n"], ["3 8\n4 2 1\n2 3 1\n", "0\n"], ["11 14\n3 1 4 1 5 9 2 6 5 3 5\n8 9 7 9 3 2 3 8 4 6 2\n", "12\n"], ["3 1\n4 2 1\n2 3 1", "4\n"], ["3 6\n4 2 1\n2 3 1", "1\n"], ["11 14\n3 1 4 1 5 9 2 6 5 3 5\n8 9 7 9 3 1 3 8 4 6 2", "12\n"], ["3 1\n8 2 1\n2 3 1", "7\n"], ["11 14\n3 1 4 1 2 9 2 6 5 3 5\n8...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1358"}
1cf3e1afa54c5a44
There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i. For each square, you will perform either of the following operations once: * Decrease the height of the square by 1. * Do nothing. Determine if it is possible to perform the operations so that the heights ...
[["1\n1000000000", "Yes"], ["4\n1 3 2 1", "No"], ["5\n1 2 3 4 5", "Yes"], ["5\n1 2 1 1 3", "Yes"], ["1\n1000010000", "Yes\n"], ["4\n1 5 2 1", "No\n"], ["5\n1 2 3 6 5", "Yes\n"], ["5\n1 2 0 1 3", "No\n"], ["1\n1000011000", "Yes\n"], ["4\n1 5 2 2", "No\n"], ["5\n1 2 0 6 5", "No\n"], ["5\n0 2 0 1 3", "No\n"], ["1\n1000011...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#2304"}
1cf9a76d74132a60
There is a grid with N rows and N columns of squares. Let (i,j) be the square at the i-th row from the top and the j-th column from the left. These squares have to be painted in one of the C colors from Color 1 to Color C. Initially, (i,j) is painted in Color c_{i,j}. We say the grid is a good grid when the following...
[["4 3\n0 12 71\n81 0 53\n14 92 0\n1 1 2 1\n2 1 1 2\n2 2 1 3\n1 1 2 2", "428"], ["2 3\n0 1 1\n1 0 1\n1 4 0\n1 2\n3 3", "3"], ["2 3\n0 1 1\n1 1 1\n1 4 0\n1 2\n3 3", "3\n"], ["2 3\n0 1 1\n1 1 1\n2 4 0\n1 2\n3 3", "4\n"], ["2 3\n0 1 1\n1 0 1\n1 4 0\n1 2\n1 3", "1\n"], ["2 3\n0 2 1\n1 1 1\n2 4 0\n1 2\n3 3", "5\n"], ["2 3\n...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#665"}
1cfe55e0dfdc5d2e
We start with a permutation $a_1, a_2, \ldots, a_n$ and with an empty array $b$. We apply the following operation $k$ times. On the $i$-th iteration, we select an index $t_i$ ($1 \le t_i \le n-i+1$), remove $a_{t_i}$ from the array, and append one of the numbers $a_{t_i-1}$ or $a_{t_i+1}$ (if $t_i-1$ or $t_i+1$ are wi...
[["3\n5 3\n1 2 3 4 5\n3 2 5\n4 3\n4 3 2 1\n4 3 1\n7 4\n1 4 7 3 6 2 5\n3 2 4 5\n", "2\n0\n4\n"], ["6\n2 1\n2 1\n1\n3 2\n1 3 2\n1 3\n4 2\n4 1 3 2\n1 2\n5 3\n4 3 2 5 1\n1 4 5\n6 3\n2 4 5 6 1 3\n2 4 5\n7 3\n7 6 4 3 2 1 5\n1 2 6\n", "1\n0\n2\n0\n0\n4\n"], ["6\n2 1\n2 1\n1\n3 2\n1 3 2\n1 3\n4 2\n4 1 3 2\n1 2\n5 3\n4 3 2 5 1\...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#463"}
1d0308d87e452615
You are planning to buy an apartment in a $n$-floor building. The floors are numbered from $1$ to $n$ from the bottom to the top. At first for each floor you want to know the minimum total time to reach it from the first (the bottom) floor. Let: $a_i$ for all $i$ from $1$ to $n-1$ be the time required to go from the ...
[["10 2\n7 6 18 6 16 18 1 17 17\n6 9 3 10 9 1 10 1 5\n", "0 7 13 18 24 35 36 37 40 45 \n"], ["10 1\n3 2 3 1 3 3 1 4 1\n1 2 3 4 4 1 2 1 3\n", "0 2 4 7 8 11 13 14 16 17 \n"], ["10 2\n7 6 18 6 16 18 1 17 17\n6 17 3 10 9 1 10 1 5\n", "0 7 13 18 24 35 36 37 40 45\n"], ["10 1\n3 0 3 1 3 3 1 4 1\n1 2 3 4 4 1 2 1 3\n", "0 2 2 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#223"}
1d039aa05350a243
You are given $4n$ sticks, the length of the $i$-th stick is $a_i$. You have to create $n$ rectangles, each rectangle will consist of exactly $4$ sticks from the given set. The rectangle consists of four sides, opposite sides should have equal length and all angles in it should be right. Note that each stick can be us...
[["5\n1\n1 1 10 10\n2\n10 5 2 10 1 1 2 5\n2\n10 5 1 10 5 1 1 1\n2\n1 1 1 1 1 1 1 1\n1\n10000 10000 10000 10000\n", "YES\nYES\nNO\nYES\nYES\n"], ["1\n2\n11 1 11 1 5 2 5 2\n", "NO\n"], ["1\n2\n1 1 3 3 5 5 10 10\n", "NO\n"], ["1\n2\n1 11 1 11 5 2 5 2\n", "NO\n"], ["1\n2\n3 3 4 4 4 4 6 6\n", "NO\n"], ["1\n2\n3 3 4 4 4 4 6 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#832"}
1d05266d9c20755c
Let's write a program related to an unsolved math problem called "Happy End Problem". Create a program to find the smallest convex polygon formed by connecting exactly k points from the N points given on the plane. However, after being given the coordinates of N points, the question is given the number k of the angles ...
[["5\n0 0\n3 -1\n5 2\n1 4\n0 3\n3\n3\n4\n5", "1 4 5\n2 4 5 1\n2 3 4 5 1\n"], ["5\n1 0\n3 -1\n5 2\n1 1\n0 3\n3\n3\n4\n5", "1 4 5\n2 3 4 1\nNA\n"], ["5\n0 0\n2 0\n5 2\n1 4\n0 3\n3\n3\n4\n5", "1 4 5\n1 2 4 5\n1 2 3 4 5\n"], ["5\n1 0\n3 -1\n5 2\n1 1\n0 3\n3\n3\n4\n4", "1 4 5\n2 3 4 1\n2 3 4 1\n"], ["5\n0 0\n2 0\n5 1\n1 4\n...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#422"}
1d094ec175ead4c3
A nearby pie shop is having a special sale. For each pie you pay full price for, you may select one pie of a strictly lesser value to get for free. Given the prices of all the pies you wish to acquire, determine the minimum total amount you must pay for all of the pies. Input Input will begin with an integer n (1 ≤ n...
[["30\n3 6 3 8 6 4 4 2 4 10 8 5 9 6 7 7 9 4 7 4 10 1 9 10 4 7 7 4 2 3\n", "96\n"], ["1\n1\n", "1\n"], ["50\n4 2 6 7 2 6 3 8 8 2 4 8 4 4 1 4 5 2 2 5 6 4 3 3 3 6 8 2 1 3 1 8 2 3 7 4 7 5 4 8 3 5 7 8 6 7 5 8 7 1\n", "130\n"], ["40\n2 6 5 5 6 6 7 8 6 5 3 9 9 1 8 3 7 3 7 2 3 1 3 1 5 8 1 3 8 2 3 2 2 1 4 4 4 3 5 5\n", "100\n"]...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#2429"}
1d1debd84e5e6b51
One day, little Vasya found himself in a maze consisting of (n + 1) rooms, numbered from 1 to (n + 1). Initially, Vasya is at the first room and to get out of the maze, he needs to get to the (n + 1)-th one. The maze is organized as follows. Each room of the maze has two one-way portals. Let's consider room number i (...
[["3\n1 1 3\n", "8\n"], ["102\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 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", "810970229\n"], ["10\n1 1 3 2 2 1 3 4 7 5\n", "858\n"], ["31\n1 1 1 1 1 1 1 1 1 1...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1236"}
1d3d86d85a5d51a0
In this problem, we only consider strings consisting of lowercase English letters. Strings s and t are said to be isomorphic when the following conditions are satisfied: * |s| = |t| holds. * For every pair i, j, one of the following holds: * s_i = s_j and t_i = t_j. * s_i \neq s_j and t_i \neq t_j. For example, `a...
[["4", "aaaa\naaab\naaba\naabb\naabc\nabaa\nabab\nabac\nabba\nabbb\nabbc\nabca\nabcb\nabcc\nabcd\n"], ["6", "aaaaaa\naaaaab\naaaaba\naaaabb\naaaabc\naaabaa\naaabab\naaabac\naaabba\naaabbb\naaabbc\naaabca\naaabcb\naaabcc\naaabcd\naabaaa\naabaab\naabaac\naababa\naababb\naababc\naabaca\naabacb\naabacc\naabacd\naabbaa\naab...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1772"}
1d4b58fac630d9db
In a world, a mysterious snake made of only letters lives. Two types of snakes are currently identified, type A and type B, but there may be other types as well. For class A, after ">'" is followed by one or more "=", "#" comes, and after the same number of "=" as before, "~" (half-width tilde) finish. Class B ends w...
[["3\n>'======#======~\n>^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#===>~", "A\nB\nNA\n"], ["3\n>'======#======~\n>QQ=^=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#===>~", "A\nNA\nNA\n"], ["3\n>(======#======~\n~~=Q=Q=Q=Q=Q=Q=Q=^=QQ>\n>'===#==~>=", "NA\nNA\nNA\n"], ["3\n>'======#======~\n>QQ=^=Q=Q=Q=Q=Q=Q=Q=~~\n>'===#==~>=", "A\nNA\nNA\n"], ["3\n>'====...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1472"}
1d5e997a526272e7
Igor is in 11th grade. Tomorrow he will have to write an informatics test by the strictest teacher in the school, Pavel Denisovich. Igor knows how the test will be conducted: first of all, the teacher will give each student two positive integers $a$ and $b$ ($a < b$). After that, the student can apply any of the follo...
[["5\n1 3\n5 8\n2 5\n3 19\n56678 164422\n", "1\n3\n2\n1\n23329\n"], ["6\n1 4\n1 4\n4 5\n631059 999974\n1 2\n1 2\n", "2\n2\n1\n24302\n1\n1\n"], ["17\n1 3\n2 4\n3 5\n2 3\n1 2\n2 5\n3 5\n1 2\n1 5\n1 2\n3 4\n281794 563452\n1 3\n1 3\n1 2\n218235 436471\n1 5\n", "1\n2\n2\n1\n1\n2\n2\n1\n1\n1\n1\n242495\n1\n1\n1\n43909\n1\n"]...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#353"}
1d66953f56ca5d30
Compute A \times B. Constraints * 1 \leq A \leq 100 * 1 \leq B \leq 100 * All values in input are integers. Input Input is given from Standard Input in the following format: A B Output Print the value A \times B as an integer. Examples Input 2 5 Output 10 Input 100 100 Output 10000
[["2 5", "10"], ["100 100", "10000"], ["4 5", "20\n"], ["100 000", "0\n"], ["4 -1", "-4\n"], ["001 100", "100\n"], ["2 -1", "-2\n"], ["001 110", "110\n"], ["1 -1", "-1\n"], ["101 110", "11110\n"], ["101 111", "11211\n"], ["1 1", "1\n"], ["101 101", "10201\n"], ["101 001", "101\n"], ["1 2", "2\n"], ["1 3", "3\n"], ["111...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#1650"}
1d8142a966e31f32
After years of hard work scientists invented an absolutely new e-reader display. The new display has a larger resolution, consumes less energy and its production is cheaper. And besides, one can bend it. The only inconvenience is highly unusual management. For that very reason the developers decided to leave the e-read...
[["3\n000\n000\n000\n", "0\n"], ["10\n1111100000\n0010100000\n0110111000\n0000001000\n1011001010\n0010100001\n0010111000\n0011001010\n0000110010\n0000001100\n", "20\n"], ["10\n1101010101\n1110101010\n0111010101\n1011101010\n0101110101\n1010111010\n0101011101\n1010101110\n0101010111\n1010101011\n", "100\n"], ["2\n11\n11...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1203"}
1d84aeafefbd02fe
Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them is at most d meters. Determine if A and C can communicate, either ...
[["1 100 2 10", "Yes"], ["100 10 1 2", "No"], ["10 10 10 1", "Yes"], ["4 7 9 3", "Yes"], ["1 000 2 10", "Yes\n"], ["100 10 0 2", "No\n"], ["4 7 2 3", "Yes\n"], ["1 000 1 10", "Yes\n"], ["100 10 0 4", "No\n"], ["4 5 2 3", "Yes\n"], ["0 000 1 10", "Yes\n"], ["000 10 0 4", "Yes\n"], ["0 000 1 15", "Yes\n"], ["0 000 0 15",...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#1883"}
1d86499cd087d815
Generalized leap year Normally, whether or not the year x is a leap year is defined as follows. 1. If x is a multiple of 400, it is a leap year. 2. Otherwise, if x is a multiple of 100, it is not a leap year. 3. Otherwise, if x is a multiple of 4, it is a leap year. 4. If not, it is not a leap year. This can be ge...
[["3 1988 2014\n400\n100\n4\n1 1000 1999\n1\n2 1111 3333\n2\n2\n6 2000 3000\n5\n7\n21\n9\n3\n13\n0 0 0", "7\n1000\n2223\n776\n"], ["3 1988 2014\n400\n100\n4\n1 1000 1999\n1\n2 1111 4526\n2\n2\n6 2000 3000\n5\n7\n21\n9\n3\n13\n0 0 0", "7\n1000\n3416\n776\n"], ["3 1988 2014\n400\n100\n4\n1 1000 1999\n1\n2 0111 4526\n2\n2...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#522"}
1d9405f78203a4fc
Dreamoon likes sequences very much. So he created a problem about the sequence that you can't find in OEIS: You are given two integers d, m, find the number of arrays a, satisfying the following constraints: * The length of a is n, n ≥ 1 * 1 ≤ a_1 < a_2 < ... < a_n ≤ d * Define an array b of length n as foll...
[["10\n1 1000000000\n2 999999999\n3 99999998\n4 9999997\n5 999996\n10 99995\n7 9994\n8 993\n9 92\n10 1\n", "1\n3\n5\n11\n17\n119\n29\n59\n89\n0\n"], ["10\n1 1000000000\n2 999999999\n3 99999998\n4 9999997\n5 999996\n10 99995\n7 9994\n8 993\n12 92\n19 1\n", "1\n3\n5\n11\n17\n119\n29\n59\n87\n0\n"], ["10\n1 1000000000\n2 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#369"}
1d97021edcb0a7f4
There are N sightseeing spots on the x-axis, numbered 1, 2, ..., N. Spot i is at the point with coordinate A_i. It costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis. You planned a trip along the axis. In this plan, you first depart from...
[["6\n-679 -3431 -3258 3095 -3291 -4462", "21976\n21630\n21976\n9270\n21976\n19634\n"], ["5\n1 1 0 2 0", "6\n6\n4\n2\n6\n"], ["3\n2 5 -1", "12\n6\n10\n"], ["6\n-679 -3431 -3258 3095 -3291 -2101", "19634\n19288\n19634\n6928\n17254\n19634\n"], ["5\n1 0 0 2 0", "4\n6\n6\n2\n6\n"], ["3\n2 5 -2", "14\n8\n10\n"], ["6\n-679 -...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#686"}
1da2acc5f75cc1ee
Recently Max has got himself into popular CCG "BrainStone". As "BrainStone" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them: Max owns n creatures, i-th of them can be described with two numbers — its health hpi and its damage dmgi. Max also has two types ...
[["2 1 1\n10 15\n6 1\n", "27\n"], ["3 0 3\n10 8\n7 11\n5 2\n", "26\n"], ["1 0 0\n2 1\n", "1\n"], ["2 11 1\n1 4\n1 5\n", "2053\n"], ["4 8 1\n9 9\n7 6\n2 4\n6 10\n", "2324\n"], ["2 13 2\n208637 682633\n393097 724045\n", "3220933257\n"], ["2 1 2\n20 1\n22 23\n", "64\n"], ["1 0 200000\n1 42\n", "42\n"], ["2 3 14\n28 5\n32 ...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#2775"}
1da3b0945498a148
YouKn0wWho has an integer sequence $a_1, a_2, \ldots a_n$. Now he will split the sequence $a$ into one or more consecutive subarrays so that each element of $a$ belongs to exactly one subarray. Let $k$ be the number of resulting subarrays, and $h_1, h_2, \ldots, h_k$ be the lengths of the longest increasing subsequence...
[["4\n7\n1 3 4 2 2 1 5\n3\n1 3 4\n5\n1 3 2 4 2\n4\n4 3 2 1\n", "YES\nNO\nYES\nYES\n"], ["4\n7\n1 4 4 2 2 1 5\n3\n1 3 4\n5\n1 3 2 4 2\n4\n4 3 2 1\n", "YES\nNO\nYES\nYES\n"], ["4\n7\n1 4 3 2 2 1 5\n3\n1 4 4\n5\n1 3 2 4 2\n4\n4 5 1 1\n", "YES\nYES\nYES\nYES\n"], ["4\n7\n1 4 3 2 2 1 5\n3\n1 3 4\n5\n1 3 2 4 2\n4\n4 3 2 1\n"...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#977"}
1dadee03f5d1bacf
Kicker (table football) is a board game based on football, in which players control the footballers' figures mounted on rods by using bars to get the ball into the opponent's goal. When playing two on two, one player of each team controls the goalkeeper and the full-backs (plays defence), the other player controls the ...
[["1 100\n100 1\n99 99\n99 99\n", "Team 1\n"], ["1 1\n2 2\n3 3\n2 2\n", "Team 2\n"], ["3 3\n2 2\n1 1\n2 2\n", "Draw\n"], ["80 79\n79 30\n80 81\n40 80\n", "Team 2\n"], ["10 10\n4 9\n8 9\n7 6\n", "Team 1\n"], ["10 2\n9 3\n3 1\n9 4\n", "Draw\n"], ["6 3\n6 10\n2 5\n4 4\n", "Team 1\n"], ["8 7\n1 5\n7 4\n8 8\n", "Draw\n"], [...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#405"}
1db8c9b2a5c7a831
Problem "Ritsumeikan University Competitive Programming Camp" will be held this year as well. I am very much looking forward to this annual training camp. However, I couldn't stand my desires and splurged before the training camp, so I couldn't afford it. So I decided to use the cheapest Seishun 18 Ticket to get to Mi...
[["2015 3 2 2015 3 13", "1\n"], ["1045 2 14 2015 3 15", "1669\n"], ["1234 5 4 789012345678901234 5 6", "1357101234567708000\n"], ["2015 3 3 2015 2 13", "0\n"], ["2015 3 6 3448 2 13", "2465\n"], ["2015 2 6 3448 3 13", "2466\n"], ["2015 2 6 3516 3 13", "2583\n"], ["3203 2 2 3516 3 13", "539\n"], ["1045 2 14 2015 3 5", "1...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1193"}
1dbcce2e674bc914
We have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}. Let B be a sequence of K \times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2. Find the inversion number of B, modulo 10^9 + 7. Here the inversion number of B is defined as the number of o...
[["2 2\n2 2", "0\n"], ["10 998244353\n10 9 8 7 5 6 3 4 4 1", "27457649\n"], ["3 5\n1 1 0", "30\n"], ["2 2\n0 2", "1\n"], ["10 998244353\n10 9 8 7 5 5 3 4 4 1", "866106758\n"], ["3 5\n1 2 0", "40\n"], ["10 998244353\n10 9 8 7 5 5 0 4 4 1", "867862412\n"], ["2 -4\n2 -1", "6\n"], ["2 2\n2 0", "3\n"], ["3 5\n0 1 1", "20\n"...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#494"}
1dcb03f27d45466e
John Doe has a list of all Fibonacci numbers modulo 1013. This list is infinite, it starts with numbers 0 and 1. Each number in the list, apart from the first two, is a sum of previous two modulo 1013. That is, John's list is made from the Fibonacci numbers' list by replacing each number there by the remainder when div...
[["10\n", "-1\n"], ["9999999999945\n", "719336987555\n"], ["3153355924376\n", "2500000030002\n"], ["9137820308201\n", "7153729197299\n"], ["4917874132879\n", "10929066223558\n"], ["9\n", "327828114109\n"], ["1\n", "1\n"], ["5\n", "5\n"], ["3408709136249\n", "9998\n"], ["7\n", "9366795780274\n"], ["9999999999979\n", "14...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#527"}
1ddc3daba9e7b2f0
The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness". The test consists of n questions; the questions are to be answered strictly in the order in which they are given, from question 1 to ...
[["100\n1 3 2 1 1 2 1 3 2 2 3 1 1 1 2 2 1 3 3 1 1 2 2 3 2 1 3 1 3 2 1 1 3 3 2 1 2 2 2 3 2 2 3 2 2 3 2 1 3 1 1 2 1 3 2 2 1 1 1 1 1 1 3 1 2 3 1 1 1 1 1 2 3 3 1 1 1 1 2 3 3 1 3 2 2 3 2 1 3 2 2 3 1 1 3 2 3 2 3 1\n", "4667"], ["1\n84355694\n", "84355694"], ["3\n2 4 1\n", "10"], ["50\n515844718 503470143 928669067 209884122 ...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1429"}
1df54bd58430f709
Pasha has recently bought a new phone jPager and started adding his friends' phone numbers there. Each phone number consists of exactly n digits. Also Pasha has a number k and two sequences of length n / k (n is divisible by k) a1, a2, ..., an / k and b1, b2, ..., bn / k. Let's split the phone number into blocks of le...
[["8 2\n1 22 3 44\n5 4 3 2\n", "32400\n"], ["6 2\n38 56 49\n7 3 4\n", "8\n"], ["100 4\n388 2056 122 1525 2912 1465 3066 257 5708 3604 3039 6183 3035 626 1389 5393 3321 3175 2922 2024 3837 437 5836 2376 1599\n6 5 5 2 9 6 8 3 5 0 6 0 1 8 5 3 5 2 3 0 5 6 6 7 3\n", "652599557\n"], ["2 1\n9 9\n9 9\n", "1\n"], ["10 1\n3 1 1 ...
1
{"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#2938"}
1df9ccdb09de3a0b
A famous gang of pirates, Sea Dogs, has come back to their hideout from one of their extravagant plunders. They want to split their treasure fairly amongst themselves, that is why You, their trusted financial advisor, devised a game to help them: All of them take a sit at their round table, some of them with the golde...
[["4 2\n1 2\n2 2\n", "1"], ["6 2\n2 3\n4 1\n", "1"], ["3 2\n1 1\n2 2\n", "-1"], ["1 1\n1 1\n", "1"], ["25 2\n1 23\n3 1\n", "1"], ["300 4\n1 200\n2 200\n50 100\n70 100\n", "-1"], ["1000 1\n1 1000\n", "-1"], ["1001 1\n60 10001\n", "-1"], ["999999999 1\n100 1000000000\n", "-1"], ["1000000000 1\n1 1000000000\n", "-1"], ["9...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#330"}
1dfe00d1f7c79a57
You are given N points in the xy-plane. You have a circle of radius one and move it on the xy-plane, so as to enclose as many of the points as possible. Find how many points can be simultaneously enclosed at the maximum. A point is considered enclosed by a circle when it is inside or on the circle. <image> Fig 1. Cir...
[["3\n6.47634 7.69628\n5.16828 4.79915\n6.69533 6.20378\n6\n7.15296 4.08328\n6.50827 2.69466\n5.91219 3.86661\n5.29853 4.16097\n6.10838 3.46039\n6.34060 2.41599\n8\n7.90650 4.01746\n4.10998 4.18354\n4.67289 4.01887\n6.33885 4.28388\n4.98106 3.82728\n5.12379 5.16473\n7.84664 4.67693\n4.02776 3.87990\n20\n6.65128 5.47490...
1
{"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1795"}