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 |
|---|---|---|---|---|
220c687f60d0e7a1 | You are playing a new computer game in which you have to fight monsters. In a dungeon you are trying to clear, you met three monsters; the first of them has $a$ health points, the second has $b$ health points, and the third has $c$.
To kill the monsters, you can use a cannon that, when fired, deals $1$ damage to the s... | [["3\n3 2 4\n1 1 1\n10 1 7\n", "YES\nNO\nNO\n"], ["1\n1111111 2222222 6666666\n", "YES\n"], ["1\n10 6 2\n", "YES\n"], ["1\n7999999 1000000 1000000\n", "NO\n"], ["1\n3 1 5\n", "YES\n"], ["1\n17 3 7\n", "YES\n"], ["1\n10 2 6\n", "YES\n"], ["1\n3 20 4\n", "YES\n"], ["1\n4 4 1\n", "YES\n"], ["1\n2 14 2\n", "YES\n"], ["1\n7... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1483"} |
2210577d14aa95b3 | We have a rectangular grid of squares with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left. On this grid, there is a piece, which is initially placed at square (s_r,s_c).
Takahashi and Aoki will play a game, where each player has a st... | [["2 3 3\n2 2\nRLR\nLUD", "YES\n"], ["4 3 5\n2 2\nUDRRR\nLLDTD", "NO\n"], ["2 6 11\n2 1\nRLDRRUDDLRL\nURRDRLLDLRD", "NO\n"], ["2 6 3\n2 2\nRLR\nLUD", "YES\n"], ["4 1 5\n2 2\nUDRRR\nLLDTD", "NO\n"], ["4 1 5\n0 2\nUDRRR\nLLDTD", "NO\n"], ["4 1 5\n0 2\nUDRRR\nDTDLL", "NO\n"], ["1 1 5\n0 2\nUDRRR\nDTDLL", "NO\n"], ["1 1 5\... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#826"} |
221287be97933020 | DZY loves chemistry, and he enjoys mixing chemicals.
DZY has n chemicals, and m pairs of them will react. He wants to pour these chemicals into a test tube, and he needs to pour them in one by one, in any order.
Let's consider the danger of a test tube. Danger of an empty test tube is 1. And every time when DZY pour... | [["3 2\n1 2\n2 3\n", "4\n"], ["2 1\n1 2\n", "2\n"], ["1 0\n", "1\n"], ["26 17\n1 2\n2 3\n1 6\n6 7\n7 8\n2 9\n4 10\n3 11\n11 12\n9 13\n6 14\n2 16\n5 18\n6 19\n11 22\n15 24\n6 26\n", "131072\n"], ["8 5\n1 2\n1 3\n1 4\n5 6\n7 8\n", "32\n"], ["10 10\n1 8\n4 10\n4 6\n5 10\n2 3\n1 7\n3 4\n3 6\n6 9\n3 7\n", "512\n"], ["40 28\... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#480"} |
221408f2ab2a7f81 | You are given several queries. Each query consists of three integers $p$, $q$ and $b$. You need to answer whether the result of $p/q$ in notation with base $b$ is a finite fraction.
A fraction in notation with base $b$ is finite if it contains finite number of numerals after the decimal point. It is also possible that... | [["2\n6 12 10\n4 3 10\n", "Finite\nInfinite\n"], ["4\n1 1 2\n9 36 2\n4 12 3\n3 5 4\n", "Finite\nFinite\nFinite\nInfinite\n"], ["10\n10 5 3\n1 7 10\n7 5 7\n4 4 9\n6 5 2\n6 7 5\n9 9 7\n7 5 5\n6 6 4\n10 8 2\n", "Finite\nInfinite\nInfinite\nFinite\nInfinite\nInfinite\nFinite\nFinite\nFinite\nFinite\n"], ["10\n1 3 10\n6 2 6... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#490"} |
222a7d01087b8d58 | Snuke built an online judge to hold a programming contest.
When a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. (The judge can return any two-character substring of S.)
Determine whether the judge can return the ... | [["CBBD", "No\n"], ["ACABA", "Yes\n"], ["B@CD", "No\n"], ["BBCD", "No\n"], ["XW", "No\n"], ["DBBD", "No\n"], ["B@BD", "No\n"], ["ACBAA", "Yes\n"], ["DCBB", "No\n"], ["XV", "No\n"], ["DBCD", "No\n"], ["DC@B", "No\n"], ["ACAAA", "Yes\n"], ["ECBB", "No\n"], ["VX", "No\n"], ["DCBD", "No\n"], ["DB@C", "No\n"], ["@CABA", "No... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#756"} |
222c8ca04446124f | A superhero fights with a monster. The battle consists of rounds, each of which lasts exactly $n$ minutes. After a round ends, the next round starts immediately. This is repeated over and over again.
Each round has the same scenario. It is described by a sequence of $n$ numbers: $d_1, d_2, \dots, d_n$ ($-10^6 \le d_i ... | [["1000 6\n-100 -200 -300 125 77 -4\n", "9\n"], ["1000000000000 5\n-1 0 0 0 0\n", "4999999999996\n"], ["10 4\n-3 -6 5 4\n", "-1\n"], ["1 1\n-1\n", "1\n"], ["1 1\n-1000000\n", "1\n"], ["1000000 2\n-7 4\n", "666663\n"], ["1 2\n1 -1\n", "-1\n"], ["1 2\n-1 1\n", "1\n"], ["1 3\n-1 -1 10\n", "1\n"], ["1000 13\n0 0 0 -3 -5 0 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1780"} |
224032316557c1f3 | Alice has a birthday today, so she invited home her best friend Bob. Now Bob needs to find a way to commute to the Alice's home.
In the city in which Alice and Bob live, the first metro line is being built. This metro line contains $n$ stations numbered from $1$ to $n$. Bob lives near the station with number $1$, whil... | [["5 3\n1 1 1 1 1\n1 1 1 1 1\n", "YES\n"], ["5 4\n1 0 0 0 1\n0 1 1 1 1\n", "YES\n"], ["5 2\n0 1 1 1 1\n1 1 1 1 1\n", "NO\n"], ["2 2\n1 1\n0 0\n", "YES\n"], ["10 3\n0 1 1 0 1 0 0 1 0 1\n1 1 1 1 0 0 1 1 1 1\n", "NO\n"], ["10 6\n1 0 0 1 1 0 1 1 1 1\n1 1 1 1 0 0 1 1 1 1\n", "NO\n"], ["10 10\n1 0 0 0 0 0 0 0 0 1\n0 0 0 0 0 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#206"} |
2246371b7fd8f163 | There are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i).
Thus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N.
In order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B.
Then, he placed the i-th type-A robot at coordinates (0, i), and the i-th ty... | [["1\n10\n2\n", "4\n"], ["2\n9\n3 6\n", "12\n"], ["5\n20\n11 12 9 17 12\n", "74\n"], ["1\n18\n2", "4\n"], ["2\n9\n2 6", "10\n"], ["5\n20\n11 12 9 17 15", "68\n"], ["1\n23\n1", "2\n"], ["1\n23\n0", "0\n"], ["1\n25\n-1", "-2\n"], ["1\n10\n3", "6\n"], ["5\n20\n11 12 9 17 1", "60\n"], ["2\n9\n1 6", "8\n"], ["5\n20\n8 12 9 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1718"} |
22480b37962892b4 | Sagheer is working at a kindergarten. There are n children and m different toys. These children use well-defined protocols for playing with the toys:
* Each child has a lovely set of toys that he loves to play with. He requests the toys one after another at distinct moments of time. A child starts playing if and onl... | [["13 18 27 13\n1 1\n1 2\n1 3\n1 4\n1 17\n2 5\n2 1\n3 6\n3 2\n5 14\n5 3\n4 4\n6 9\n6 3\n7 8\n7 3\n8 7\n8 9\n10 11\n10 18\n11 10\n11 15\n11 11\n9 12\n9 11\n12 10\n13 15\n6 8\n6 14\n6 1\n6 17\n6 18\n11 12\n11 18\n11 9\n11 17\n1 18\n1 12\n1 7\n1 14\n", "3\n0\n0\n0\n0\n4\n0\n0\n0\n0\n0\n8\n8\n"], ["2 1 1 1\n1 1\n2 1\n", "0... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#816"} |
225aff30fc986092 | In 2028 and after a continuous growth, AtCoder Inc. finally built an empire with six cities (City 1, 2, 3, 4, 5, 6)!
There are five means of transport in this empire:
- Train: travels from City 1 to 2 in one minute. A train can occupy at most A people.
- Bus: travels from City 2 to 3 in one minute. A bus can occupy a... | [["5\n3\n2\n4\n3\n5\n", "7\n"], ["10\n123\n123\n123\n123\n123\n", "5\n"], ["10000000007\n2\n3\n5\n7\n11\n", "5000000008\n"], ["802565984633806\n802252530129536\n544410837252078\n872045491508709\n274353138702170\n562308817245826\n", "7\n"], ["956131704220258\n897098524760050\n55734601880356\n155602009554546\n55989512482... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1491"} |
22685083cd312a4f | AND gates and OR gates are basic components used in building digital circuits. Both gates have two input lines and one output line. The output of an AND gate is 1 if both inputs are 1, otherwise the output is 0. The output of an OR gate is 1 if at least one input is 1, otherwise the output is 0.
You are given a digita... | [["4\n\n1\n0\n\n3\n0\n0\n1 1 2\n\n3\n0\n0\n2 1 2\n\n5\n0\n0\n0\n2 1 2\n1 3 4\n\n\n", "0.50000\n0.29289\n0.70711\n0.40303\n"], ["4\n\n1\n0\n\n3\n0\n0\n1 1 2\n\n3\n0\n0\n2 1 2\n\n5\n0\n0\n0\n2 2 2\n1 3 4", "0.50000\n0.29289\n0.70711\n0.40303\n"], ["4\n\n1\n0\n\n3\n0\n0\n1 1 2\n\n3\n0\n0\n2 1 2\n\n5\n0\n0\n0\n2 2 2\n1 3 3... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#809"} |
22751a6b9fa7896d | Jerry is a little mouse. He is trying to survive from the cat Tom. Jerry is carrying a parallelepiped-like piece of cheese of size A × B × C. It is necessary to trail this cheese to the Jerry's house. There are several entrances in the Jerry's house. Each entrance is a rounded hole having its own radius R. Could you he... | [["10 6 8\n5\n4\n1\n6\n2\n5\n0 0 0", "NA\nNA\nOK\nNA\nNA\n"], ["10 6 8\n5\n4\n0\n0\n2\n5\n0 0 0", "NA\nNA\nNA\nNA\nNA\n"], ["10 6 8\n5\n4\n0\n0\n2\n7\n0 0 0", "NA\nNA\nNA\nNA\nOK\n"], ["10 6 8\n5\n1\n8\n6\n2\n5\n0 0 0", "NA\nOK\nOK\nNA\nNA\n"], ["10 6 4\n5\n4\n0\n-1\n2\n7\n0 0 0", "OK\nNA\nNA\nNA\nOK\n"], ["10 6 4\n5\n... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#15"} |
2276ef8a394b8e47 | To help those contestants who struggle a lot in contests, the headquarters of Codeforces are planning to introduce Division 5. In this new division, the tags of all problems will be announced prior to the round to help the contestants.
The contest consists of $n$ problems, where the tag of the $i$-th problem is denote... | [["4\n6\n2 1 2 3 1 1\n5\n1 1 1 2 2\n8\n7 7 2 7 7 1 8 7\n10\n1 2 3 4 1 1 2 3 4 1\n", "1\n3\n-1\n2\n"], ["4\n6\n2 1 2 3 1 1\n5\n1 1 1 2 2\n8\n7 7 2 7 7 1 8 7\n10\n1 2 3 4 1 1 2 4 4 1\n", "1\n3\n-1\n2\n"], ["4\n6\n2 2 2 3 1 1\n5\n1 1 1 2 2\n8\n7 7 2 7 7 1 8 7\n10\n1 2 6 4 1 1 2 4 4 1\n", "3\n3\n-1\n2\n"], ["4\n6\n2 2 2 3 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1571"} |
22789255fbee07da | The Ohgas are a prestigious family based on Hachioji. The head of the family, Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune by depositing his money to an operation company. You are asked to help Mr. Ohga maximize his profit by operating the given money during a specified period.
From a given l... | [["4\n1000000\n5\n2\n0 0.03125 3000\n1 0.03125 3000\n6620000\n7\n2\n0 0.0732421875 42307\n0 0.0740966796875 40942\n39677000\n4\n4\n0 0.0709228515625 30754\n1 0.00634765625 26165\n0 0.03662109375 79468\n0 0.0679931640625 10932\n10585000\n6\n4\n1 0.0054931640625 59759\n1 0.12353515625 56464\n0 0.0496826171875 98193\n0 0.... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#1168"} |
22884fe77768572a | There are two standard ways to represent a graph $G = (V, E)$, where $V$ is a set of vertices and $E$ is a set of edges; Adjacency list representation and Adjacency matrix representation.
An adjacency-list representation consists of an array $Adj[|V|]$ of $|V|$ lists, one for each vertex in $V$. For each $u \in V$, th... | [["4\n1 2 2 4\n2 1 1\n3 0\n4 1 3", "0 1 0 1\n1 0 0 0\n0 0 0 0\n0 0 1 0\n"], ["4\n1 2 0 4\n2 1 1\n3 0\n4 1 3", "0 0 0 1\n1 0 0 0\n0 0 0 0\n0 0 1 0\n"], ["4\n1 2 1 4\n2 1 1\n3 0\n4 1 3", "1 0 0 1\n1 0 0 0\n0 0 0 0\n0 0 1 0\n"], ["4\n1 2 2 4\n2 1 4\n3 -1\n4 1 3", "0 1 0 1\n0 0 0 1\n0 0 0 0\n0 0 1 0\n"], ["4\n1 2 1 4\n2 1 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1393"} |
228dedfbf80b5a61 | You are standing on the $\mathit{OX}$-axis at point $0$ and you want to move to an integer point $x > 0$.
You can make several jumps. Suppose you're currently at point $y$ ($y$ may be negative) and jump for the $k$-th time. You can:
either jump to the point $y + k$
or jump to the point $y - 1$.
What is the minimum ... | [["5\n1\n2\n3\n4\n5\n", "1\n3\n2\n3\n4\n"], ["1\n10\n", "4\n"], ["12\n1\n2\n3\n4\n5\n1\n2\n3\n4\n5\n1\n2\n", "1\n3\n2\n3\n4\n1\n3\n2\n3\n4\n1\n3\n"], ["1\n8627\n", "131\n"], ["1\n8627\n", "131\n"], ["12\n1\n2\n3\n4\n5\n1\n2\n3\n4\n5\n1\n2\n", "1\n3\n2\n3\n4\n1\n3\n2\n3\n4\n1\n3\n"], ["1\n10\n", "4\n"], ["1\n8215\n", "1... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1660"} |
2293c5e3f5a00fec | You are given a three-digit positive integer N.
Determine whether N is a palindromic number.
Here, a palindromic number is an integer that reads the same backward as forward in decimal notation.
-----Constraints-----
- 100≤N≤999
- N is an integer.
-----Input-----
Input is given from Standard Input in the followin... | [["575\n", "Yes\n"], ["123\n", "No\n"], ["812\n", "No\n"], ["100\n", "No\n"], ["999\n", "Yes\n"], ["171\n", "Yes\n"], ["521\n", "No\n"], ["974\n", "No\n"], ["225\n", "No\n"], ["844\n", "No\n"], ["559", "No\n"], ["676", "Yes\n"], ["665", "No\n"], ["179", "No\n"], ["129", "No\n"], ["371", "No\n"], ["344", "No\n"], ["158"... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#914"} |
22a81c0b369d7d22 | In your garden, there is a long and narrow flowerbed that stretches infinitely to the east. You have decided to plant N kinds of flowers in this empty flowerbed. For convenience, we will call these N kinds of flowers Flower 1, 2, …, N. Also, we will call the position that is p centimeters from the west end of the flowe... | [["2 5\n20 10\n25 15", "40\n"], ["3 9\n16 10\n10 10\n10 10", "36\n"], ["2 5\n20 16\n25 15", "52\n"], ["2 5\n20 13\n25 15", "46\n"], ["2 6\n20 10\n43 15", "58\n"], ["3 9\n10 10\n7 10\n10 10", "30\n"], ["3 9\n10 10\n7 10\n10 18", "37\n"], ["2 5\n20 11\n25 10", "42\n"], ["3 9\n7 10\n13 10\n10 10", "33\n"], ["2 5\n38 9\n25... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1458"} |
22ace25e2869a64e | Mishka started participating in a programming contest. There are $n$ problems in the contest. Mishka's problem-solving skill is equal to $k$.
Mishka arranges all problems from the contest into a list. Because of his weird principles, Mishka only solves problems from one of the ends of the list. Every time, he chooses ... | [["8 4\n4 2 3 1 5 1 6 4\n", "5\n"], ["5 2\n3 1 2 1 3\n", "0\n"], ["5 100\n12 34 55 43 21\n", "5\n"], ["100 100\n44 47 36 83 76 94 86 69 31 2 22 77 37 51 10 19 25 78 53 25 1 29 48 95 35 53 22 72 49 86 60 38 13 91 89 18 54 19 71 2 25 33 65 49 53 5 95 90 100 68 25 5 87 48 45 72 34 14 100 44 94 75 80 26 25 7 57 82 49 73 55... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1143"} |
22b04432f16e6476 | Alex enjoys performing magic tricks. He has a trick that requires a deck of n cards. He has m identical decks of n different cards each, which have been mixed together. When Alex wishes to perform the trick, he grabs n cards at random and performs the trick with those. The resulting deck looks like a normal deck, but m... | [["2 2\n", "0.6666666666666666\n"], ["4 4\n", "0.4000000000000000\n"], ["1 2\n", "1.0000000000000000\n"], ["2 1\n", "0.5000000000000000\n"], ["10 10\n", "0.1818181818181818\n"], ["1000 1000\n", "0.0019980019980020\n"], ["1 1\n", "1\n"], ["987 123\n", "0.0020170953866492\n"], ["999 999\n", "0.0020000000000000\n"], ["1 9... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#85"} |
22b2c5ecf3d97a4b | There is a complete graph of m vertices. Initially, the edges of the complete graph are uncolored. Sunuke did the following for each i (1 ≤ i ≤ n): Select ai vertices from the complete graph and color all edges connecting the selected vertices with color i. None of the sides were painted in multiple colors. Find the mi... | [["5\n2\n3\n3\n5\n6", "11\n"], ["2\n6\n3", "8\n"], ["2\n6\n2", "7\n"], ["2\n5\n2", "6\n"], ["2\n1\n2", "2\n"], ["2\n1\n3", "3\n"], ["5\n2\n3\n5\n5\n6", "13\n"], ["5\n2\n3\n3\n2\n6", "9\n"], ["2\n8\n3", "10\n"], ["2\n5\n1", "5\n"], ["2\n14\n2", "15\n"], ["2\n14\n4", "17\n"], ["2\n3\n2", "4\n"], ["2\n14\n8", "21\n"], ["2... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#492"} |
22b5f3debf7289d3 | After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.
At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the q... | [["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20\n", "22 1\n"], ["5 17\n- 16\n- 2\n- 98\n+ 100\n- 98\n", "3 2\n"], ["6 1000000000\n+ 1000000000\n+ 1000000000\n+ 1000000000\n+ 1000000000\n+ 1000000000\n+ 1000000000\n", "7000000000 0\n"], ["11 1000\n- 100\n+ 100\n+ 100\n+ 100\n+ 100\n- 100\n- 100\n- 100\n- 100\n- 100\n- 100\n", "700 ... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#1365"} |
22b70c469e6e1a86 | In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets.
Write a program which reads an integer x and print it as is. Note that multiple datasets are give... | [["3\n5\n11\n3\n8\n19\n0", "Case 1: 3\nCase 2: 5\nCase 3: 11\nCase 4: 3\nCase 5: 8\nCase 6: 19\n"], ["3\n5\n11\n7\n8\n34\n0", "Case 1: 3\nCase 2: 5\nCase 3: 11\nCase 4: 7\nCase 5: 8\nCase 6: 34\n"], ["3\n5\n11\n4\n8\n19\n0", "Case 1: 3\nCase 2: 5\nCase 3: 11\nCase 4: 4\nCase 5: 8\nCase 6: 19\n"], ["3\n5\n11\n7\n14\n34\... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#899"} |
22b73b4f7f178678 | In an electric circuit, when two resistors R_1 and R_2 are connected in parallel, the equivalent resistance R_3 can be derived from the following formula:
* \frac{1}{R_1} + \frac{1}{R_2} = \frac{1}{R_3}
Given R_1 and R_2, find R_3.
Constraints
* 1 \leq R_1, R_2 \leq 100
* R_1 and R_2 are integers.
Input
The inp... | [["100 113", "53.0516431925\n"], ["4 3", "1.71428571429\n"], ["100 166", "62.4060150376\n"], ["7 3", "2.1\n"], ["110 166", "66.1594202899\n"], ["7 1", "0.875\n"], ["110 262", "77.4731182796\n"], ["14 1", "0.933333333333\n"], ["110 86", "48.2653061224\n"], ["110 11", "10.0\n"], ["110 6", "5.68965517241\n"], ["110 3", "2... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00003-of-00005.parquet#2283"} |
22c277d644c3bf0b | There are S sheep and W wolves.
If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.
If the wolves will attack the sheep, print unsafe; otherwise, print safe.
-----Constraints-----
- 1 \leq S \leq 100
- 1 \leq W \leq 100
-----Input-----
Input is given from Standard In... | [["4 5\n", "unsafe\n"], ["100 2\n", "safe\n"], ["10 10\n", "unsafe\n"], ["21 20\n", "safe\n"], ["90 89\n", "safe\n"], ["99 99\n", "unsafe\n"], ["74 74\n", "unsafe\n"], ["63 64\n", "unsafe\n"], ["8 9\n", "unsafe\n"], ["100 100\n", "unsafe\n"], ["1 100\n", "unsafe\n"], ["100 1\n", "safe\n"], ["1 1\n", "unsafe\n"], ["1 5"... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#903"} |
22c30249fba05658 | You are given two arrays $a$ and $b$, both of length $n$.
Let's define a function $f(l, r) = \sum\limits_{l \le i \le r} a_i \cdot b_i$.
Your task is to reorder the elements (choose an arbitrary order of elements) of the array $b$ to minimize the value of $\sum\limits_{1 \le l \le r \le n} f(l, r)$. Since the answer ... | [["5\n1 8 7 2 4\n9 7 2 9 3\n", "646\n"], ["1\n1000000\n1000000\n", "757402647\n"], ["2\n1 3\n4 2\n", "20\n"], ["1\n1000010\n1000000\n", "767402647\n"], ["5\n1 8 7 2 4\n9 11 2 9 3\n", "696\n"], ["2\n1 3\n4 1\n", "14\n"], ["1\n1000011\n1000000\n", "768402647\n"], ["5\n1 8 7 2 5\n9 11 2 9 3\n", "741\n"], ["2\n1 5\n4 1\n",... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#434"} |
22d03045ed616331 | A string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied:
* S is a palindrome.
* Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.
* The string consisting of the (N+3)/2-st through N-th charact... | [["akasaka", "Yes"], ["atcoder", "No"], ["level", "No"], ["akas`ka", "No\n"], ["redocta", "No\n"], ["llvee", "No\n"], ["akas`ja", "No\n"], ["rfdocta", "No\n"], ["elvle", "No\n"], ["ak`saja", "No\n"], ["redodta", "No\n"], ["elvld", "No\n"], ["`k`saja", "No\n"], ["derodta", "No\n"], ["elvdl", "No\n"], ["ajas`k`", "No\n"]... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#3228"} |
22d50d96dd1a6920 | For a positive integer n let's define a function f:
f(n) = - 1 + 2 - 3 + .. + ( - 1)^{n}n
Your task is to calculate f(n) for a given integer n.
-----Input-----
The single line contains the positive integer n (1 ≤ n ≤ 10^15).
-----Output-----
Print f(n) in a single line.
-----Examples-----
Input
4
Output
2
... | [["4\n", "2\n"], ["5\n", "-3\n"], ["1000000000\n", "500000000\n"], ["1000000001\n", "-500000001\n"], ["1000000000000000\n", "500000000000000\n"], ["100\n", "50\n"], ["101\n", "-51\n"], ["102\n", "51\n"], ["103\n", "-52\n"], ["104\n", "52\n"], ["105\n", "-53\n"], ["106\n", "53\n"], ["107\n", "-54\n"], ["108\n", "54\n"],... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#599"} |
22da13c5488d65b6 | 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_j... | [["654321", "968545283"], ["2", "4"], ["53707", "700929608\n"], ["3", "15\n"], ["42179", "477829788\n"], ["1", "1\n"], ["69890", "39294826\n"], ["4", "43\n"], ["68941", "825040611\n"], ["126548", "41353562\n"], ["138065", "144629245\n"], ["132361", "413027178\n"], ["219101", "267179376\n"], ["412635", "541957737\n"], [... | 2.16 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#1378"} |
22e1119f09ea9f07 | Snuke found a random number generator. It generates an integer between 0 and 2^N-1 (inclusive). An integer sequence A_0, A_1, \cdots, A_{2^N-1} represents the probability that each of these integers is generated. The integer i (0 \leq i \leq 2^N-1) is generated with probability A_i / S, where S = \sum_{i=0}^{2^N-1} A_i... | [["4\n337 780 799 10 796 875 331 223 941 67 268 483 390 565 116 355", "0\n674015595\n896398844\n723441612\n111757501\n387101531\n320322837\n911027328\n938195369\n659817401\n560701718\n374484089\n73966157\n948486904\n523921254\n102456316\n"], ["2\n1 1 1 2", "0\n166374063\n166374063\n332748121\n"], ["2\n1 2 1 3", "0\n532... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#17"} |
22f2fd48fd8985ad | You are given two set of points. The first set is determined by the equation A1x + B1y + C1 = 0, and the second one is determined by the equation A2x + B2y + C2 = 0.
Write the program which finds the number of points in the intersection of two given sets.
Input
The first line of the input contains three integer numb... | [["1 -1 1\n0 0 0\n", "-1"], ["-1 0 0\n-2 1 2\n", "1"], ["-1 -1 1\n1 1 0\n", "0"], ["2 2 1\n1 2 0\n", "1"], ["-1 1 1\n0 1 1\n", "1"], ["0 -1 -1\n-2 -2 -1\n", "1"], ["-2 -1 1\n-1 1 1\n", "1"], ["1 0 0\n0 1 0\n", "1"], ["1 1 -1\n-1 0 -1\n", "1"], ["1 1 -1\n0 1 0\n", "1"], ["0 2 -2\n-2 2 0\n", "1"], ["0 2 2\n0 0 -2\n", "0"... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#503"} |
22f7a8e7b44eb73c | Problem
If you bring an empty bottle of $ a $ milk, you can exchange it for a new bottle of $ b $ milk.
How many bottles of milk can Mr. Kawabayashi, who initially has a bottle of $ x $ milk, drink? Output the remainder after dividing by $ 1000000007 $.
Constraints
The input satisfies the following conditions.
* $ ... | [["82 69 103", "241\n"], ["3 2 1", "1\n"], ["82 69 114", "321\n"], ["3 2 0", "0\n"], ["98 69 114", "183\n"], ["560118409912468 316250877917599 681260158257385", "29192407\n"], ["5 1 5", "6\n"], ["82 69 30", "30\n"], ["82 69 73", "73\n"], ["82 78 114", "816\n"], ["98 69 148", "286\n"], ["560118409912468 316250877917599 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1050"} |
230adf9a165ce97b | Given is an integer sequence A_1, ..., A_N of length N.
We will choose exactly \left\lfloor \frac{N}{2} \right\rfloor elements from this sequence so that no two adjacent elements are chosen.
Find the maximum possible sum of the chosen elements.
Here \lfloor x \rfloor denotes the greatest integer not greater than x.
... | [["27\n18 -28 18 28 -45 90 -45 23 -53 60 28 -74 -71 35 -26 -62 49 -77 57 24 -70 -93 69 -99 59 57 -49", "295"], ["5\n-1000 -100 -10 0 10", "0"], ["6\n1 2 3 4 5 6", "12"], ["10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000", "5000000000"], ["27\n18 -28 18 2... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#2216"} |
230bddf0036c555a | String can be called correct if it consists of characters "0" and "1" and there are no redundant leading zeroes. Here are some examples: "0", "10", "1001".
You are given a correct string s.
You can perform two different operations on this string: swap any pair of adjacent characters (for example, "101" $\rightarrow... | [["4\n1001\n", "100\n"], ["1\n1\n", "1\n"], ["100\n1110111100001111011111111010110011111111011110000111101101011100110110001011000000101010110101011100\n", "1000000000000000000000000000000000000000\n"], ["100\n1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "1000... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1304"} |
230cd9f81dd46fee | Snuke, who loves animals, built a zoo.
There are N animals in this zoo. They are conveniently numbered 1 through N, and arranged in a circle. The animal numbered i (2≤i≤N-1) is adjacent to the animals numbered i-1 and i+1. Also, the animal numbered 1 is adjacent to the animals numbered 2 and N, and the animal numbered... | [["10\noxooxoxoox", "SSWWSSSWWS"], ["6\nooxoox", "SSSWWS"], ["3\noox", "-1"], ["3\nxoo", "-1\n"], ["6\nxooxoo", "SSSSWW\n"], ["10\nxooxoxooxo", "SWWSSSWWSS\n"], ["10\nxxooxoxooo", "SWSWWWSSSS\n"], ["10\noxooooxxox", "SSWWSWWWWS\n"], ["10\nxoxxooooxo", "SWWWWSWWSS\n"], ["10\noooxoxooxx", "SSSSWWWSWS\n"], ["10\noxooooxxx... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#742"} |
23134964fbefc55e | You are given an array $a$ consisting of $n$ integers $a_1, a_2, \dots, a_n$. You want to split it into exactly $k$ non-empty non-intersecting subsegments such that each subsegment has odd sum (i. e. for each subsegment, the sum of all elements that belong to this subsegment is odd). It is impossible to rearrange (shuf... | [["3\n5 3\n7 18 3 14 1\n5 4\n1 2 3 4 5\n6 2\n1 2 8 4 10 2\n", "YES\n1 3 5\nNO\nNO\n"], ["1\n1 1\n2\n", "NO\n"], ["1\n1 1\n2\n", "NO\n"], ["3\n5 3\n7 18 3 14 1\n5 4\n1 2 3 4 5\n6 2\n2 2 8 4 10 2\n", "YES\n1 3 5\nNO\nNO\n"], ["3\n5 3\n7 18 3 14 1\n5 4\n1 2 3 4 5\n6 2\n3 1 8 4 10 2\n", "YES\n1 3 5\nNO\nYES\n1 6\n"], ["3\n... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#587"} |
23153b413d064c83 | Mainak has an array $a_1, a_2, \ldots, a_n$ of $n$ positive integers. He will do the following operation to this array exactly once:
Pick a subsegment of this array and cyclically rotate it by any amount.
Formally, he can do the following exactly once:
Pick two integers $l$ and $r$, such that $1 \le l \le r \le n$, ... | [["5\n6\n1 3 9 11 5 7\n1\n20\n3\n9 99 999\n4\n2 1 8 1\n3\n2 1 5\n", "10\n0\n990\n7\n4\n"], ["50\n1\n111\n1\n322\n1\n196\n1\n312\n1\n47\n1\n638\n1\n486\n1\n664\n1\n836\n1\n590\n1\n343\n1\n741\n1\n42\n1\n832\n1\n165\n1\n474\n1\n610\n1\n710\n1\n785\n1\n932\n1\n831\n1\n240\n1\n792\n1\n572\n1\n547\n1\n436\n1\n173\n1\n838\n1... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#388"} |
2326b6f6ea0ee080 | You are given a string S consisting of a,b and c. Find the number of strings that can be possibly obtained by repeatedly performing the following operation zero or more times, modulo 998244353:
- Choose an integer i such that 1\leq i\leq |S|-1 and the i-th and (i+1)-th characters in S are different. Replace each of th... | [["abc\n", "3\n"], ["abbac\n", "65\n"], ["babacabac\n", "6310\n"], ["ababacbcacbacacbcbbcbbacbaccacbacbacba\n", "148010497\n"], ["babacaabc", "6309\n"], ["bbaac", "65\n"], ["bac", "3\n"], ["ababacbcacbacacbcbbcbbbcbaccacbacbacba", "148010497\n"], ["cac", "7\n"], ["bdabdaaab", "6297\n"], ["babababac", "6298\n"], ["abcba... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1624"} |
232d6c96df962a32 | Colonel has n badges. He wants to give one badge to every of his n soldiers. Each badge has a coolness factor, which shows how much it's owner reached. Coolness factor can be increased by one for the cost of one coin.
For every pair of soldiers one of them should get a badge with strictly higher factor than the secon... | [["4\n1 3 1 4\n", "1"], ["5\n1 2 3 2 5\n", "2"], ["5\n1 5 3 2 4\n", "0"], ["10\n1 1 2 3 4 5 6 7 8 9\n", "9"], ["11\n9 2 10 3 1 5 7 1 4 8 6\n", "10"], ["4\n4 3 2 2\n", "3"], ["1\n1\n", "0"], ["50\n49 37 30 2 18 48 14 48 50 27 1 43 46 5 21 28 44 2 24 17 41 38 25 18 43 28 25 21 28 23 26 27 4 31 50 18 23 11 13 28 44 47 1 2... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#566"} |
233cb3d34146c59c | There is a beautiful garden of stones in Innopolis.
Its most beautiful place is the $n$ piles with stones numbered from $1$ to $n$.
EJOI participants have visited this place twice.
When they first visited it, the number of stones in piles was $x_1, x_2, \ldots, x_n$, correspondingly. One of the participants wrote d... | [["5\n1 2 3 4 5\n2 1 4 3 5\n", "Yes\n"], ["5\n1 1 1 1 1\n1 0 1 0 1\n", "Yes\n"], ["3\n2 3 9\n1 7 9\n", "No\n"], ["40\n361 372 139 808 561 460 421 961 727 719 130 235 320 470 432 759 317 886 624 666 917 133 736 710 462 424 541 118 228 216 612 339 800 557 291 128 801 9 0 318\n364 689 60 773 340 571 627 932 581 856 131 15... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#447"} |
234da60b8b6bfdec | Read problems statements in Mandarin Chinese and Russian.
Chef has a box full of infinite number of identical coins. One day while playing, he made N piles each containing equal number of coins. Chef suddenly remembered an important task and left the room for sometime. While he was away, his newly hired assistant ca... | [["1\n4\n1 2 3 4", "3"], ["1\n4\n1 2 2 4", "2\n"], ["1\n4\n1 2 2 2", "1\n"], ["1\n4\n1 2 0 4", "3\n"], ["1\n4\n1 1 1 1", "0\n"], ["1\n4\n1 2 1 4", "2\n"], ["1\n4\n1 0 2 2", "2\n"], ["1\n4\n1 1 2 2", "2\n"], ["1\n4\n1 1 1 2", "1\n"], ["1\n4\n1 1 1 4", "1\n"], ["1\n4\n1 1 0 4", "2\n"], ["1\n4\n1 1 3 4", "2\n"], ["1\n4\n1... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#657"} |
23567bea93f63cc1 | Ilya plays a card game by the following rules.
A player has several cards. Each card contains two non-negative integers inscribed, one at the top of the card and one at the bottom. At the beginning of the round the player chooses one of his cards to play it. If the top of the card contains number ai, and the bottom co... | [["2\n0 10000\n1 0\n", "1\n"], ["1\n2 9999\n", "2\n"], ["1\n10 1\n", "10\n"], ["100\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 0\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#352"} |
235e983b371097a5 | Let f(A, B) be the exclusive OR of A, A+1, ..., B. Find f(A, B).
What is exclusive OR?
The bitwise exclusive OR of integers c_1, c_2, ..., c_n (let us call it y) is defined as follows:
- When y is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if, the number of integers among c_1, c_2, ...c_m whose ... | [["2 4\n", "5\n"], ["123 456\n", "435\n"], ["123456789012 123456789012\n", "123456789012\n"], ["250874886258 260155437540\n", "260155437541\n"], ["116600656878 540016401221\n", "0\n"], ["16469429916 70896110856\n", "70896110856\n"], ["62624746276 247590631209\n", "1\n"], ["449425032568 599872999674\n", "599872999675\n"... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1397"} |
235f59f3eaa765ed | There are N towns in a coordinate plane. Town i is located at coordinates (x_i, y_i). The distance between Town i and Town j is \sqrt{\left(x_i-x_j\right)^2+\left(y_i-y_j\right)^2}.
There are N! possible paths to visit all of these towns once. Let the length of a path be the distance covered when we start at the first ... | [["3\n0 0\n1 0\n0 1\n", "2.2761423749\n"], ["2\n-879 981\n-866 890\n", "91.9238815543\n"], ["8\n-406 10\n512 859\n494 362\n-955 -475\n128 553\n-986 -885\n763 77\n449 310\n", "7641.9817824387\n"], ["8\n0 -656\n0 -709\n0 76\n0 184\n0 -985\n0 -822\n0 418\n0 -247\n", "4403.7500000000\n"], ["8\n898 1000\n85 1000\n980 1000\n... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#970"} |
23692cc0bb68b8b3 | You are given an array $a$ of $n$ non-negative integers. In one operation you can change any number in the array to any other non-negative integer.
Let's define the cost of the array as $\operatorname{DIFF}(a) - \operatorname{MEX}(a)$, where $\operatorname{MEX}$ of a set of non-negative integers is the smallest non-ne... | [["4\n4 1\n3 0 1 2\n4 1\n0 2 4 5\n7 2\n4 13 0 0 13 1337 1000000000\n6 2\n1 2 8 0 0 0\n", "0\n1\n2\n0\n"], ["1\n5 1\n5 4 3 1 2\n", "0\n"], ["1\n5 1\n1 2 3 4 5\n", "0\n"], ["5\n5 1\n1 2 3 4 5\n5 1\n1 2 3 4 5\n5 1\n1 2 3 4 5\n5 1\n1 2 3 4 5\n5 1\n1 2 3 4 5\n", "0\n0\n0\n0\n0\n"], ["1\n10 5\n0 1 2 3 100 101 102 102 102 102... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#1315"} |
2399590b82964f4d | We will define the median of a sequence b of length M, as follows:
- Let b' be the sequence obtained by sorting b in non-decreasing order. Then, the value of the (M / 2 + 1)-th element of b' is the median of b. Here, / is integer division, rounding down.
For example, the median of (10, 30, 20) is 20; the median of (10... | [["3\n10 30 20\n", "30\n"], ["1\n10\n", "10\n"], ["10\n5 9 5 9 8 9 3 5 4 3\n", "8\n"], ["1\n1\n", "1\n"], ["1\n1000000000\n", "1000000000\n"], ["100000\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.29 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1652"} |
23b6c4caf18e94a0 | Floating-Point Numbers
In this problem, we consider floating-point number formats, data representation formats to approximate real numbers on computers.
Scientific notation is a method to express a number, frequently used for numbers too large or too small to be written tersely in usual decimal form. In scientific no... | [["1\n0000000000000000000000000000000000000000000000000000\n2\n0000000000000000000000000000000000000000000000000000\n3\n0000000000000000001000000000000000000000000000000000\n4\n0000000000000000000000000000000000000000000000000000\n7\n1101000000000000000000000000000000000000000000000000\n100\n110001101010000110011110010... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1206"} |
23c13f79e43f9aed | Anton's favourite geometric figures are regular polyhedrons. Note that there are five kinds of regular polyhedrons:
Tetrahedron. Tetrahedron has 4 triangular faces. Cube. Cube has 6 square faces. Octahedron. Octahedron has 8 triangular faces. Dodecahedron. Dodecahedron has 12 pentagonal faces. Icosahedron. Icos... | [["4\nIcosahedron\nCube\nTetrahedron\nDodecahedron\n", "42\n"], ["3\nDodecahedron\nOctahedron\nOctahedron\n", "28\n"], ["25\nIcosahedron\nOctahedron\nTetrahedron\nDodecahedron\nCube\nIcosahedron\nOctahedron\nCube\nTetrahedron\nIcosahedron\nIcosahedron\nTetrahedron\nOctahedron\nDodecahedron\nIcosahedron\nOctahedron\nIco... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1371"} |
23c25b38a39b3af8 | We have N integers. The i-th number is A_i.
\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\leq i < j \leq N.
\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\ldots,A_N)=1.
Determine if \\{A_i\\} is pairwise coprime, setw... | [["3\n6 10 16", "not coprime"], ["3\n6 10 15", "setwise coprime"], ["3\n3 4 5", "pairwise coprime"], ["3\n6 5 15", "setwise coprime\n"], ["3\n4 4 2", "not coprime\n"], ["3\n4 3 1", "pairwise coprime\n"], ["3\n4 4 5", "setwise coprime\n"], ["3\n4 8 2", "not coprime\n"], ["3\n8 8 2", "not coprime\n"], ["3\n4 4 1", "setwi... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00000-of-00005.parquet#2935"} |
23ccc1722b378b62 | We have N ID cards, and there are M gates.
We can pass the i-th gate if we have one of the following ID cards: the L_i-th, (L_i+1)-th, ..., and R_i-th ID cards.
How many of the ID cards allow us to pass all the gates alone?
Constraints
* All values in input are integers.
* 1 \leq N \leq 10^5
* 1 \leq M \leq 10^5
* ... | [["100000 1\n1 100000", "100000"], ["4 2\n1 3\n2 4", "2"], ["10 3\n3 6\n5 7\n6 9", "1"], ["101000 1\n1 100000", "100000\n"], ["4 2\n1 6\n2 4", "3\n"], ["10 3\n3 6\n7 7\n6 9", "0\n"], ["101000 1\n1 100100", "100100\n"], ["101000 1\n1 100110", "100110\n"], ["101000 1\n1 100010", "100010\n"], ["101100 1\n2 100110", "10010... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#2847"} |
23cccfecfd1c6dd2 | Read problems statements in Mandarin Chinese and Russian.
Grapes of Coderpur are very famous. Devu went to the market and saw that there were N people selling grapes. He didn’t like it because things were not very structured. So, he gave a task to Dhinwa to make things better. If Dhinwa successfully completes the ta... | [["2\n2 2\n3 5\n3 7\n10 16 18", "2\n8"], ["2\n2 2\n3 5\n3 7\n8 16 18", "2\n6\n"], ["2\n2 2\n3 8\n3 7\n8 16 18", "1\n6\n"], ["2\n2 2\n3 8\n3 7\n8 16 7", "1\n3\n"], ["2\n2 1\n5 8\n3 7\n8 16 7", "0\n3\n"], ["2\n2 2\n5 8\n2 7\n7 16 7", "1\n2\n"], ["2\n2 2\n3 5\n3 7\n10 1 18", "2\n12\n"], ["2\n2 2\n5 8\n3 7\n8 11 7", "1\n4\... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1249"} |
23cd48b78524a8e3 | C: Skewering
problem
One day, when Homura was playing with blocks, Tempura came. Homura decided to play with blocks with Tempura.
There is a rectangular parallelepiped of A \ times B \ times C, which is made by stacking A \ times B \ times C blocks of cubic blocks with a side length of 1 without any gaps. Each side ... | [["2 1 10", "Tem\n"], ["2 1 1", "Hom\n"], ["2 1 2", "Tem\n"], ["4 1 2", "Tem\n"], ["2 1 0", "Tem\n"], ["1 2 10", "Tem\n"], ["2 2 10", "Tem\n"], ["4 1 3", "Hom\n"], ["2 2 0", "Tem\n"], ["3 2 10", "Tem\n"], ["4 2 10", "Tem\n"], ["0 1 2", "Tem\n"], ["7 1 3", "Hom\n"], ["0 2 0", "Tem\n"], ["3 4 10", "Tem\n"], ["4 2 12", "T... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1661"} |
23d2c5dcd494179c | Alice, the president of club FCB, wants to build a team for the new volleyball tournament. The team should consist of p players playing in p different positions. She also recognizes the importance of audience support, so she wants to select k people as part of the audience.
There are n people in Byteland. Alice needs ... | [["2 1 1\n30 9\n46\n73\n", "103"], ["2 1 1\n76 91\n34\n77\n", "153"], ["4 1 2\n1 19 10 3\n18\n19\n13\n15\n", "47\n"], ["3 2 1\n500 498 564\n100002 3\n772286 2\n232323 1\n", "772853\n"], ["4 1 2\n2 4 10 3\n18\n19\n23\n3\n", "32\n"], ["2 1 1\n30 9\n46\n87\n", "117\n"], ["2 1 1\n76 146\n34\n77\n", "180\n"], ["4 1 2\n1 16 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1056"} |
23e5c12f869a0aa2 | Let T be arbitrary binary tree — tree, every vertex of which has no more than two children. Given tree is rooted, so there exists only one vertex which doesn't have a parent — it's the root of a tree. Every vertex has an integer number written on it. Following algorithm is run on every value from the tree T: Set point... | [["3\n15 -1 -1\n10 1 3\n5 -1 -1\n", "2\n"], ["8\n6 2 3\n3 4 5\n12 6 7\n1 -1 8\n4 -1 -1\n5 -1 -1\n14 -1 -1\n2 -1 -1\n", "1\n"], ["1\n493041212 -1 -1\n", "0\n"], ["10\n921294733 5 9\n341281094 -1 -1\n35060484 10 -1\n363363160 -1 -1\n771156014 6 8\n140806462 -1 -1\n118732846 4 2\n603229555 -1 -1\n359289513 3 7\n423237010 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#705"} |
23f38230573cd35a | A programming competition site AtCode regularly holds programming contests.
The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200.
The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800.
The contest after the ARC is called AG... | [["1199", "ABC"], ["1200", "ARC"], ["4208", "AGC"], ["91", "ABC\n"], ["2343", "ARC\n"], ["4178", "AGC\n"], ["256", "ABC\n"], ["17", "ABC\n"], ["120", "ABC\n"], ["23", "ABC\n"], ["29", "ABC\n"], ["46", "ABC\n"], ["10", "ABC\n"], ["51", "ABC\n"], ["11", "ABC\n"], ["57", "ABC\n"], ["26", "ABC\n"], ["69", "ABC\n"], ["42", ... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#2479"} |
23f6245901d27128 | We define $x \bmod y$ as the remainder of division of $x$ by $y$ ($\%$ operator in C++ or Java, mod operator in Pascal).
Let's call an array of positive integers $[a_1, a_2, \dots, a_k]$ stable if for every permutation $p$ of integers from $1$ to $k$, and for every non-negative integer $x$, the following condition is ... | [["7 3\n", "16\n"], ["3 7\n", "0\n"], ["1337 42\n", "95147305\n"], ["1 1\n", "1\n"], ["500000 1\n", "500000\n"], ["500000 500000\n", "1\n"], ["500000 250000\n", "803991687\n"], ["250000 500000\n", "0\n"], ["500 100\n", "337564072\n"], ["37 13\n", "253439535\n"], ["1 500000\n", "0\n"], ["500000 500\n", "882447093\n"], [... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#919"} |
2402583c5c81767c | The only difference between the easy and hard versions is that the given string s in the easy version is initially a palindrome, this condition is not always true for the hard version.
A palindrome is a string that reads the same left to right and right to left. For example, "101101" is a palindrome, while "0101" is n... | [["3\n3\n110\n2\n00\n4\n1010\n", "\nALICE\nBOB\nALICE\n"], ["3\n3\n110\n2\n00\n4\n1011\n", "ALICE\nBOB\nALICE\n"], ["3\n3\n010\n2\n00\n4\n0011\n", "BOB\nBOB\nALICE\n"], ["3\n3\n110\n2\n00\n4\n0110\n", "ALICE\nBOB\nBOB\n"], ["3\n3\n010\n2\n00\n4\n1001\n", "BOB\nBOB\nBOB\n"], ["3\n3\n110\n2\n00\n4\n0011\n", "ALICE\nBOB\n... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#1129"} |
24026ed3c6ade406 | A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage and some cheese.
The town where Laurenty lives in is not large. The houses in it are located in two rows, n houses in each r... | [["4\n1 2 3\n3 2 1\n3 2 2 3\n", "12\n"], ["3\n1 2\n3 3\n2 1 3\n", "11\n"], ["2\n1\n1\n1 1\n", "4\n"], ["2\n1\n1\n2 1\n", "5\n"], ["3\n1 100\n1 1\n100 100 100\n", "204\n"], ["4\n5 6 7\n8 9 10\n1 8 8 1\n", "47\n"], ["4\n1 2 3\n2 2 3\n2 3 4 3\n", "18\n"], ["48\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 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#504"} |
240f2665aa76e079 | We have N locked treasure boxes, numbered 1 to N.
A shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.
Find the minimum cost required to unlock all the treasure boxes. I... | [["2 3\n10 1\n1\n15 1\n2\n30 2\n1 2\n", "25\n"], ["12 1\n100000 1\n2\n", "-1\n"], ["4 6\n67786 3\n1 3 4\n3497 1\n2\n44908 3\n2 3 4\n2156 3\n2 3 4\n26230 1\n2\n86918 1\n3\n", "69942\n"], ["1 1000\n11147 1\n1\n11114 1\n1\n11080 1\n1\n11047 1\n1\n11014 1\n1\n10980 1\n1\n10947 1\n1\n10914 1\n1\n10880 1\n1\n10847 1\n1\n1081... | 4 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1071"} |
241519610a572b88 | In 2028 and after a continuous growth, AtCoder Inc. finally built an empire with six cities (City 1, 2, 3, 4, 5, 6)!
There are five means of transport in this empire:
* Train: travels from City 1 to 2 in one minute. A train can occupy at most A people.
* Bus: travels from City 2 to 3 in one minute. A bus can occupy a... | [["5\n3\n2\n4\n3\n5", "7"], ["10\n123\n123\n123\n123\n123", "5"], ["10000000007\n2\n3\n5\n7\n11", "5000000008"], ["5\n3\n2\n4\n3\n6", "7\n"], ["10\n123\n219\n123\n123\n123", "5\n"], ["10000000007\n2\n3\n5\n3\n11", "5000000008\n"], ["10000000007\n2\n3\n1\n3\n11", "10000000011\n"], ["10\n123\n633\n27\n9\n123", "6\n"], ["... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#1054"} |
2417262d39552de1 | Zane the wizard had never loved anyone before, until he fell in love with a girl, whose name remains unknown to us.
[Image]
The girl lives in house m of a village. There are n houses in that village, lining in a straight line from left to right: house 1, house 2, ..., house n. The village is also well-structured: h... | [["5 1 20\n0 27 32 21 19\n", "40"], ["7 3 50\n62 0 0 0 99 33 22\n", "30"], ["10 5 100\n1 0 1 0 0 0 0 0 1 1\n", "20"], ["5 3 1\n1 1 0 0 1\n", "10"], ["5 5 5\n1 0 5 6 0\n", "20"], ["15 10 50\n20 0 49 50 50 50 50 50 50 0 50 50 49 0 20\n", "10"], ["7 5 1\n0 100 2 2 0 2 1\n", "20"], ["100 50 100\n1 2 3 4 5 6 7 8 9 10 11 12 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1192"} |
241f0346b6bc91c3 | Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game.
Initially, Bob chooses integer m, bit depth of the game, which means that all numbers in the game will consist of m bits. Then he asks Peter to choose some m-bit number. After that, ... | [["3 3\na := 101\nb := 011\nc := ? XOR b\n", "011\n100\n"], ["5 1\na := 1\nbb := 0\ncx := ? OR a\nd := ? XOR ?\ne := d AND bb\n", "0\n0\n"], ["2 10\nb := 0100101101\na := ? XOR b\n", "0100101101\n1011010010\n"], ["1 10\na := 0110110011\n", "0000000000\n0000000000\n"], ["1 6\na := ? OR ?\n", "000000\n111111\n"], ["13 6\... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#109"} |
24214cae9dced043 | At 17:00, special agent Jack starts to escape from the enemy camp. There is a cliff in between the camp and the nearest safety zone. Jack has to climb the almost vertical cliff by stepping his feet on the blocks that cover the cliff. The cliff has slippery blocks where Jack has to spend time to take each step. He also ... | [["6 6\n4 4 X X T T\n4 7 8 2 X 7\n1 X X X 1 8\n1 2 X X X 6\n1 1 2 4 4 7\nS S 2 3 X X\n2 10\nT 1\n1 X\n1 X\n1 X\n1 1\n1 X\n1 X\n1 1\n1 X\nS S\n2 10\nT X\n1 X\n1 X\n1 X\n1 1\n1 X\n1 X\n1 1\n1 X\nS S\n10 10\nT T T T T T T T T T\nX 2 X X X X X 3 4 X\n9 8 9 X X X 2 9 X 9\n7 7 X 7 3 X X 8 9 X\n8 9 9 9 6 3 X 5 X 5\n8 9 9 9 6 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#797"} |
2421cb30d5bcd6ce | A median in an array with the length of n is an element which occupies position number <image> after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.
We define... | [["100 37\n20 20 3 35 36 14 30 9 33 36 32 46 43 22 43 50 34 6 13 25 1 34 10 6 21 30 19 17 1 23 9 23 38 21 7 43 49 28 33 42 4 19 39 23 12 42 31 13 26 23 1 26 24 48 10 6 12 48 40 18 10 26 9 5 22 45 46 23 46 34 34 45 3 7 16 39 14 29 48 1 12 37 4 20 29 26 35 38 20 47 39 29 12 35 4 32 26 1 50 33\n", "53\n"], ["1 1\n2\n", "1... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1333"} |
24303dc05d0feaf6 | There is a data which provides heights (in meter) of mountains. The data is only for ten mountains.
Write a program which prints heights of the top three mountains in descending order.
Constraints
0 ≤ height of mountain (integer) ≤ 10,000
Input
Height of mountain 1
Height of mountain 2
Height of mountain 3
.
.
He... | [["1819\n2003\n876\n2840\n1723\n1799\n3776\n2848\n1592\n922", "3776\n2848\n2840\n"], ["100\n200\n300\n568\n500\n600\n700\n800\n900\n900", "900\n900\n800\n"], ["1819\n2003\n876\n2840\n1723\n1799\n4419\n2848\n1592\n922", "4419\n2848\n2840\n"], ["100\n200\n300\n568\n500\n600\n700\n1096\n900\n900", "1096\n900\n900\n"], ["1... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1156"} |
24324c8eb2d635d6 | In this task Anna and Maria play the following game. Initially they have a checkered piece of paper with a painted n × m rectangle (only the border, no filling). Anna and Maria move in turns and Anna starts. During each move one should paint inside the last-painted rectangle a new lesser rectangle (along the grid lines... | [["307 190 52\n", "186536168\n"], ["456 876 1000\n", "0\n"], ["705 155 490\n", "0\n"], ["711 390 95\n", "187455436\n"], ["840 474 207\n", "895622621\n"], ["999 996 247\n", "729817056\n"], ["277 939 15\n", "934000455\n"], ["5 5 3\n", "0\n"], ["580 1000 203\n", "693824000\n"], ["340 124 41\n", "801948369\n"], ["351 286 6... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#644"} |
2439547b71364acc | A median of an array of integers of length $n$ is the number standing on the $\lceil {\frac{n}{2}} \rceil$ (rounding up) position in the non-decreasing ordering of its elements. Positions are numbered starting with $1$. For example, a median of the array $[2, 6, 4, 1, 3, 5]$ is equal to $3$. There exist some other defi... | [["6\n2 4\n0 24 34 58 62 64 69 78\n2 2\n27 61 81 91\n4 3\n2 4 16 18 21 27 36 53 82 91 92 95\n3 4\n3 11 12 22 33 35 38 67 69 71 94 99\n2 1\n11 41\n3 3\n1 1 1 1 1 1 1 1 1\n", "165\n108\n145\n234\n11\n3\n"], ["6\n2 4\n0 24 34 58 62 64 69 78\n2 2\n27 61 81 91\n4 3\n2 4 16 18 21 27 36 53 82 91 92 95\n3 4\n3 11 12 22 33 35 3... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#584"} |
243ea94c72ead78a | Joisino has a formula consisting of N terms: A_1 op_1 A_2 ... op_{N-1} A_N. Here, A_i is an integer, and op_i is an binary operator either `+` or `-`. Because Joisino loves large numbers, she wants to maximize the evaluated value of the formula by inserting an arbitrary number of pairs of parentheses (possibly zero) in... | [["5\n1 - 2 + 2 - 4 + 5", "6\n"], ["5\n1 - 38 - 13 + 14 - 5", "-5\n"], ["5\n1 - 45 - 13 + 14 - 5", "-12\n"], ["5\n2 - 45 - 13 + 14 - 5", "-11\n"], ["5\n2 - 80 - 13 + 14 - 5", "-46\n"], ["5\n2 - 57 - 13 + 14 - 5", "-23\n"], ["5\n2 - 39 - 13 + 9 - 5", "-10\n"], ["5\n1 - 2 + 0 - 4 + 5", "8\n"], ["5\n1 - 6 - 13 + 14 - 5", ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1533"} |
2443a9c3cb01f4d0 | C: Only one subsequence --Unique Subsequence-
problem
One day Ebi-chan noticed that a text string T of length n and a pattern string P (m \ leq n) of length m were placed on the desk. Ebi-chan loves the "only one subsequence" that appears in strings, so she immediately began investigating whether P was the only subse... | [["aizucamp\nuza", "no\n"], ["aziucamp\nazu", "yes\n"], ["azjucamp\nazu", "yes\n"], ["azjucamp\nazt", "no\n"], ["azjucamp\nzat", "no\n"], ["pmacujza\nzat", "no\n"], ["pmacuiza\nzat", "no\n"], ["pmicuaza\nzat", "no\n"], ["pmicvaza\nzat", "no\n"], ["pmicvaya\nzat", "no\n"], ["pnicvaya\nzat", "no\n"], ["pnicvaya\n{at", "n... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#787"} |
244e6ef1ca5ba7b0 | ACM countries have rivers that flow from east to west in the center. This river flows from the neighboring country in the west through the neighboring country in ACM to the neighboring country in the east, and the total length in ACM is K km. It is planned to install several locks on this river and use it as a canal.
... | [["1 1 100\n50 200 20 40 0\n1\n2 4 101\n7 4 1 4 1\n19 5 1 4 0\n5\n3\n7\n9\n1 2 3\n1 1 1 1 0\n1\n3\n1 2 10\n5 10 1 1 1\n2\n3\n0 0 0", "110.0000000000\n47.0000000000\n5.0000000000\n41.6666666667\n"], ["1 1 100\n50 200 20 40 0\n1\n2 4 101\n7 4 1 4 1\n19 5 1 4 0\n5\n3\n7\n9\n1 2 3\n2 1 1 1 0\n1\n3\n1 2 10\n5 10 1 1 1\n2\n3... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00003-of-00005.parquet#1163"} |
245269918009ddf5 | Compare given two sequence $A = \\{a_0, a_1, ..., a_{n-1}\\}$ and $B = \\{b_0, b_1, ..., b_{m-1}$ lexicographically.
Constraints
* $1 \leq n, m \leq 1,000$
* $0 \leq a_i, b_i \leq 1,000$
Input
The input is given in the following format.
$n$
$a_0 \; a_1, ..., \; a_{n-1}$
$m$
$b_0 \; b_1, ..., \; b_{m-1}$
The num... | [["3\n1 1 2\n4\n1 2 2 2", "1\n"], ["4\n1 4 3 1\n4\n0 4 5 4 2", "0\n"], ["3\n1 4 3\n2\n2 4", "1\n"], ["4\n0 4 7 0\n5\n1 2 3 4 5", "1\n"], ["3\n1 1 2\n4\n1 3 2 2", "1\n"], ["3\n1 4 3\n2\n2 2", "1\n"], ["4\n0 4 7 0\n5\n1 2 3 4 1", "1\n"], ["3\n1 1 2\n4\n1 3 3 2", "1\n"], ["3\n1 4 3\n3\n2 2", "1\n"], ["4\n0 4 7 0\n5\n1 2 5... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1730"} |
24554501c33b5666 | We have a board with H horizontal rows and W vertical columns of squares. There is a bishop at the top-left square on this board. How many squares can this bishop reach by zero or more movements?
Here the bishop can only move diagonally. More formally, the bishop can move from the square at the r_1-th row (from the to... | [["7 0", "0\n"], ["1001000000 1000000000", "500500000000000000\n"], ["6 5", "15\n"], ["1001000000 1100000000", "550550000000000000\n"], ["3 5", "8\n"], ["1001000010 1100000000", "550550005500000000\n"], ["3 6", "9\n"], ["1001000010 1100100000", "550600055500500000\n"], ["1001000011 1100100000", "550600056050550000\n"],... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#265"} |
24776c2a5195396a | The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following problem at the work.
Given a sequence of n integers p_1, p_2, ..., p_{n}. You are to choose k pairs of integers:
[l_1, r... | [["5 2 1\n1 2 3 4 5\n", "9\n"], ["7 1 3\n2 10 7 18 5 33 0\n", "61\n"], ["13 8 1\n73 7 47 91 54 74 99 11 67 35 84 18 19\n", "515\n"], ["8 3 1\n8 46 37 81 81 57 11 2\n", "219\n"], ["20 5 3\n96 46 67 36 59 95 88 43 92 58 1 31 69 35 36 77 56 27 3 23\n", "953\n"], ["16 2 2\n50 78 5 26 26 16 14 35 46 8 37 31 92 52 97 24\n", ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1538"} |
248839b2916e0c7a | As bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable prices.
One day, a group of three good friends living in the Matsunaga housing complex bloomed with a... | [["4 2\n50 40 100 80\n7 3\n400 300 100 700 200 600 57\n0 0", "150\n1857\n"], ["4 2\n50 40 100 80\n7 3\n400 300 100 700 352 600 57\n0 0", "150\n2009\n"], ["4 3\n50 40 100 80\n7 3\n400 300 100 700 352 600 57\n0 0", "220\n2009\n"], ["4 3\n50 40 100 80\n7 3\n400 290 100 700 352 600 57\n0 0", "220\n1999\n"], ["4 3\n50 40 10... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1045"} |
248d9c3e0e2fdfa7 | Given are 1-digit positive integers a and b. Consider these two strings: the concatenation of b copies of the digit a, and the concatenation of a copies of the digit b. Which of these is lexicographically smaller?
-----Constraints-----
- 1 \leq a \leq 9
- 1 \leq b \leq 9
- a and b are integers.
-----Input-----
Inp... | [["4 3\n", "3333\n"], ["7 7\n", "7777777\n"], ["1 1\n", "1\n"], ["9 1\n", "111111111\n"], ["6 8\n", "66666666\n"], ["5 4\n", "44444\n"], ["7 2", "2222222\n"], ["4 6", "444444\n"], ["7 4", "4444444\n"], ["7 8", "77777777\n"], ["5 7", "5555555\n"], ["1 3", "111\n"], ["5 2", "22222\n"], ["6 6", "666666\n"], ["6 7", "66666... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#262"} |
2492040183f75c96 | You are given an array a of length n and array b of length m both consisting of only integers 0 and 1. Consider a matrix c of size n × m formed by following rule: c_{i, j} = a_i ⋅ b_j (i.e. a_i multiplied by b_j). It's easy to see that c consists of only zeroes and ones too.
How many subrectangles of size (area) k con... | [["3 5 4\n1 1 1\n1 1 1 1 1\n", "14\n"], ["3 3 2\n1 0 1\n1 1 1\n", "4\n"], ["50 50 6\n1 0 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 1 0 1\n1 1 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 1 0 0 1 1 1 1 0 0 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0\n", "2153\n"], ["1 1 1\n1\n1\n", "... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#800"} |
249f5a57cc17abd2 | Brothers Fred and George Weasley once got into the sporting goods store and opened a box of Quidditch balls. After long and painful experiments they found out that the Golden Snitch is not enchanted at all. It is simply a programmed device. It always moves along the same trajectory, which is a polyline with vertices at... | [["1\n1 2 3\n4 5 6\n20 10\n1 2 3\n", "YES\n0.000000000000000\n1.000000000000000 2.000000000000000 3.000000000000000\n"], ["4\n0 0 0\n0 10 0\n10 10 0\n10 0 0\n0 0 0\n1 1\n5 5 50\n", "NO\n"], ["4\n0 0 0\n0 10 0\n10 10 0\n10 0 0\n0 0 0\n1 1\n5 5 25\n", "YES\n25.500000000000000\n10.000000000000000 4.500000000000000 0.00000... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#1931"} |
24ae787304b09a56 | Andryusha is an orderly boy and likes to keep things in their place.
Today he faced a problem to put his socks in the wardrobe. He has n distinct pairs of socks which are initially in a bag. The pairs are numbered from 1 to n. Andryusha wants to put paired socks together and put them in the wardrobe. He takes the sock... | [["1\n1 1\n", "1\n"], ["3\n2 1 1 3 2 3\n", "2\n"], ["5\n5 1 3 2 4 3 1 2 4 5\n", "5\n"], ["10\n4 2 6 3 4 8 7 1 1 5 2 10 6 8 3 5 10 9 9 7\n", "6\n"], ["50\n30 47 31 38 37 50 36 43 9 23 2 2 15 31 14 49 9 16 6 44 27 14 5 6 3 47 25 26 1 35 3 15 24 19 8 46 49 41 4 26 40 28 42 11 34 35 46 18 7 28 18 40 19 42 4 41 38 48 50 12 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1408"} |
24c3ff2088eb234d | Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. Jon now t... | [["2 100000 569\n605 986\n", "986 605\n"], ["5 1 2\n9 7 11 15 5\n", "13 7\n"], ["11 1003 9\n12 5 10 8 0 6 8 10 12 14 4\n", "13 1\n"], ["5 4 6\n0 2 2 2 3\n", "4 0\n"], ["31 3 4\n7 18 16 14 16 7 13 10 2 3 8 11 20 4 7 1 7 13 17 12 9 8 10 3 11 3 4 8 16 10 3\n", "20 0\n"], ["10 3 5\n1 2 3 4 5 6 7 8 9 10\n", "15 0\n"], ["1 1... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#2618"} |
24c9c757a2a74e2e | -----Problem Statement-----
Write a program that accepts a number, n, and outputs the same.
-----Input-----
The only line contains a single integer.
-----Output-----
Output the answer in a single line.
-----Constraints-----
- 0 ≤ n ≤ 105
-----Sample Input-----
123
-----Sample Output-----
123 | [["123\n", "123\n"], ["191", "191\n"], ["97", "97\n"], ["162", "162\n"], ["107", "107\n"], ["190", "190\n"], ["227", "227\n"], ["357", "357\n"], ["429", "429\n"], ["404", "404\n"], ["627", "627\n"], ["889", "889\n"], ["1047", "1047\n"], ["1652", "1652\n"], ["3133", "3133\n"], ["1313", "1313\n"], ["1107", "1107\n"], ["2... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00003-of-00005.parquet#2670"} |
24d79a58e2658355 | Recently, Mike was very busy with studying for exams and contests. Now he is going to chill a bit by doing some sight seeing in the city.
City consists of n intersections numbered from 1 to n. Mike starts walking from his house located at the intersection number 1 and goes along some sequence of intersections. Walking... | [["3\n2 2 3\n", "0 1 2 \n"], ["5\n1 2 3 4 5\n", "0 1 2 3 4 \n"], ["7\n4 4 4 4 7 7 7\n", "0 1 2 1 2 3 3 \n"], ["98\n17 17 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 90 90 90 90 90 90 90 90 90 90 90 92 92 92 92 9... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00000-of-00005.parquet#1970"} |
24e94b74eaf8dcb2 | Berland crossword is a puzzle that is solved on a square grid with n rows and n columns. Initially all the cells are white.
To solve the puzzle one has to color some cells on the border of the grid black in such a way that:
* exactly U cells in the top row are black;
* exactly R cells in the rightmost column ar... | [["4\n5 2 5 3 1\n3 0 0 0 0\n4 4 1 4 0\n2 1 1 1 1\n", "\nYES\nYES\nNO\nYES\n"], ["5\n5 2 5 3 1\n3 0 0 0 0\n4 4 1 4 0\n2 1 1 1 1\n4 4 1 4 0\n", "YES\nYES\nNO\nYES\nNO\n"], ["1\n63 62 0 62 0\n", "NO\n"], ["3\n5 2 5 3 1\n4 4 1 4 0\n2 1 1 1 1\n", "YES\nNO\nYES\n"], ["17\n5 0 0 0 4\n2 1 2 1 1\n2 0 0 1 1\n2 1 0 1 0\n5 0 1 0 4... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#1363"} |
24e95321c4bdc357 | Akaki, a patissier, can make N kinds of doughnut using only a certain powder called "Okashi no Moto" (literally "material of pastry", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams o... | [["3 1000\n120\n100\n140", "9"], ["5 3000\n150\n130\n150\n130\n110", "26"], ["4 360\n90\n90\n90\n90", "4"], ["3 1001\n120\n100\n140", "9\n"], ["5 3000\n150\n130\n150\n130\n100", "28\n"], ["3 1001\n120\n110\n140", "8\n"], ["4 360\n90\n13\n126\n90", "7\n"], ["4 293\n90\n13\n126\n90", "2\n"], ["4 293\n144\n13\n126\n90", "... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00001-of-00005.parquet#256"} |
24fd0f8d7fc070e5 | While Vasya finished eating his piece of pizza, the lesson has already started. For being late for the lesson, the teacher suggested Vasya to solve one interesting problem. Vasya has an array a and integer x. He should find the number of different ordered pairs of indexes (i, j) such that ai ≤ aj and there are exactly ... | [["4 2 1\n1 3 5 7\n", "3"], ["5 3 1\n3 3 3 3 3\n", "25"], ["4 2 0\n5 3 1 7\n", "4"], ["3 5 0\n4 4 4\n", "9"], ["5 3 4\n24 13 1 24 24\n", "4"], ["1 13 1\n13\n", "1"], ["1 1 1\n1\n", "1"], ["2 1 1000000000\n1 1000000000\n", "1"], ["100 2 1\n1 2 2 2 1 2 1 2 2 2 2 1 2 1 1 2 1 2 2 1 1 2 1 1 2 2 1 1 2 1 2 2 2 2 2 1 1 1 2 1 2... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#2948"} |
2504cebf3d3e1424 | You are given an undirected unweighted graph consisting of $n$ vertices and $m$ edges (which represents the map of Bertown) and the array of prices $p$ of length $m$. It is guaranteed that there is a path between each pair of vertices (districts).
Mike has planned a trip from the vertex (district) $a$ to the vertex (d... | [["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 7\n6 7\n", "7\n12\n"], ["2\n4 3 2 3 4\n1 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 4\n6 7\n", "7\n12\n"], ["2\n4 3 2 3 4\n2 2 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1162"} |
251b0b47cc276dfe | You are given a rectangular cake, represented as an r × c grid. Each cell either has an evil strawberry, or is empty. For example, a 3 × 4 cake may look as follows: [Image]
The cakeminator is going to eat the cake! Each time he eats, he chooses a row or a column that does not contain any evil strawberries and contain... | [["3 4\nS...\n....\n..S.\n", "8\n"], ["2 2\n..\n..\n", "4\n"], ["2 2\nSS\nSS\n", "0\n"], ["7 3\nS..\nS..\nS..\nS..\nS..\nS..\nS..\n", "14\n"], ["3 5\n..S..\nSSSSS\n..S..\n", "0\n"], ["10 10\nSSSSSSSSSS\nSSSSSSSSSS\nSSSSSSSSSS\nSSSSSSSSSS\nSSSSSSSSSS\nSSSSSSSSSS\nSSSSSSSSSS\nSSSSSSSSSS\nSSSSSSSSSS\nSSSSSSSSSS\n", "0\n"]... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1516"} |
2528cd07dd30d4f3 | There are N+1 towns. The i-th town is being attacked by A_i monsters.
We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters.
What is the maximum total number of monsters the heroes can cooperate to defeat?
-----Constraints-----
- All values in inp... | [["2\n3 5 2\n4 5\n", "9\n"], ["3\n5 6 3 8\n5 100 8\n", "22\n"], ["2\n100 1 1\n1 100\n", "3\n"], ["25633\n33571927 12868 8762035 3 9 49494236 20 21 402 82474463 24513339 181 59400515 202 5 664298487 18244 64350629 129890120 330756423 1489 90 479581925 169802894 219527 62973 2 101449 568192650 353 499 2090701 2447 53161 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#390"} |
252f28ff638fe774 | In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks and an instrument. Each stick is characterized by its length l_{i}.
Ilya decided to make a rectangle from the sticks. And due to his whim, he decided to make rectangles in such a way that m... | [["4\n2 4 4 2\n", "8\n"], ["4\n2 2 3 5\n", "0\n"], ["4\n100003 100004 100005 100006\n", "10000800015\n"], ["8\n5 3 3 3 3 4 4 4\n", "25\n"], ["10\n123 124 123 124 2 2 2 2 9 9\n", "15270\n"], ["8\n10 10 10 10 11 10 11 10\n", "210\n"], ["1\n1000000\n", "0\n"], ["10\n10519 10519 10520 10520 10520 10521 10521 10521 10522 10... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#93"} |
25367b66bc1c587f | Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters.
Let A be a set of positions in the string. Let's call it pretty if following conditions are met: letters on positions from A in the string are all distinct and lowercase; the... | [["11\naaaaBaabAbA\n", "2\n"], ["12\nzACaAbbaazzC\n", "3\n"], ["3\nABC\n", "0\n"], ["1\na\n", "1\n"], ["2\naz\n", "2\n"], ["200\nXbTJZqcbpYuZQEoUrbxlPXAPCtVLrRExpQzxzqzcqsqzsiisswqitswzCtJQxOavicSdBIodideVRKHPojCNHmbnrLgwJlwOpyrJJIhrUePszxSjJGeUgTtOfewPQnPVWhZAtogRPrJLwyShNQaeNsvrJwjuuBOMPCeSckBMISQzGngfOmeyfDObncyeNsi... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1354"} |
253833b261451956 | Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multiplies the displayed number by two. After clicking the blue button, device subtracts one from the number on the display. If at so... | [["4 6\n", "2\n"], ["10 1\n", "9\n"], ["1 2\n", "1\n"], ["2 1\n", "1\n"], ["1 3\n", "3\n"], ["3 1\n", "2\n"], ["2 10\n", "5\n"], ["100 99\n", "1\n"], ["99 100\n", "50\n"], ["10 17\n", "3\n"], ["666 6666\n", "255\n"], ["6666 666\n", "6000\n"], ["1 8192\n", "13\n"], ["1 8193\n", "27\n"], ["9999 10000\n", "5000\n"], ["100... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00004-of-00005.parquet#1231"} |
253988270199a74c | "You must lift the dam. With a lever. I will give it to you.
You must block the canal. With a rock. I will not give the rock to you."
Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.
Hermit Lizard agreed to give Danik the lever. But to get a stone... | [["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1\n", "1\n3\n2\n0\n0\n"], ["1\n1\n1000000000\n", "0\n"], ["1\n1\n1000000000\n", "0\n"], ["1\n1\n1000000001\n", "0\n"], ["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 8 3\n2\n2 4\n1\n1\n", "1\n3\n1\n0\n0\n"], ["5\n5\n1 5 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1\n", "1\n3\n2\... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1463"} |
253da9e4650454b0 | The ICPC committee would like to have its meeting as soon as possible to address every little issue of the next contest. However, members of the committee are so busy maniacally developing (possibly useless) programs that it is very difficult to arrange their schedules for the meeting. So, in order to settle the meetin... | [["3 2\n2 1 2\n0\n3 3 4 8\n3 2\n4 1 5 8 9\n3 2 5 9\n5 2 4 5 7 9\n3 3\n2 1 4\n3 2 5 9\n2 2 4\n3 3\n2 1 2\n3 1 2 9\n2 2 4\n0 0", "0\n5\n0\n2\n"], ["3 2\n2 1 4\n0\n3 3 4 8\n3 2\n4 1 5 8 9\n3 2 5 9\n5 1 4 5 7 9\n3 3\n2 1 4\n3 2 5 9\n2 2 4\n3 3\n2 1 2\n3 1 2 9\n2 2 4\n0 0", "4\n5\n0\n2\n"], ["3 2\n2 1 2\n0\n3 3 4 8\n3 2\n4 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00003-of-00004.parquet#1431"} |
254bea8b73394c77 | Little walrus Fangy loves math very much. That's why when he is bored he plays with a number performing some operations.
Fangy takes some positive integer x and wants to get a number one from it. While x is not equal to 1, Fangy repeats the following action: if x is odd, then he adds 1 to it, otherwise he divides x by... | [["11100000110100011110101001101111100000011001111000011110000000111110111\n", "106\n"], ["1000101100110000000001111010110000000010001001111110011011000011101011001001010010111\n", "133\n"], ["10000100000\n", "16\n"], ["1010101001001111000111110011111000010101011111101010\n", "74\n"], ["11000111111110110110100110110101... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#1186"} |
255f197bbc7da871 | You are given two positive integers $n$ and $s$. Find the maximum possible median of an array of $n$ non-negative integers (not necessarily distinct), such that the sum of its elements is equal to $s$.
A median of an array of integers of length $m$ is the number standing on the $\lceil {\frac{m}{2}} \rceil$-th (roundi... | [["8\n1 5\n2 5\n3 5\n2 1\n7 17\n4 14\n1 1000000000\n1000000000 1\n", "5\n2\n2\n0\n4\n4\n1000000000\n0\n"], ["8\n1 5\n2 5\n3 5\n2 1\n14 17\n4 14\n1 1000000000\n1000000000 1\n", "5\n2\n2\n0\n2\n4\n1000000000\n0\n"], ["8\n1 5\n2 5\n3 5\n2 1\n14 17\n4 14\n1 1010000000\n1000000000 1\n", "5\n2\n2\n0\n2\n4\n1010000000\n0\n"],... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#656"} |
256123e4e1135d87 | Two deer, AtCoDeer and TopCoDeer, are playing a game called Honest or Dishonest. In this game, an honest player always tells the truth, and an dishonest player always tell lies. You are given two characters a and b as the input. Each of them is either `H` or `D`, and carries the following information:
If a=`H`, AtCoDe... | [["D D", "H"], ["H H", "H"], ["D H", "D"], ["H I", "D\n"], ["E H", "D\n"], ["I H", "D\n"], ["F H", "D\n"], ["G H", "D\n"], ["J H", "D\n"], ["H J", "D\n"], ["H G", "D\n"], ["H K", "D\n"], ["H F", "D\n"], ["H L", "D\n"], ["H E", "D\n"], ["K H", "D\n"], ["H D", "D\n"], ["C H", "D\n"], ["H M", "D\n"], ["L H", "D\n"], ["H C... | 1 | {"source": "deepcoder/primeintellect", "upstream_id": "primeintellect/train-00002-of-00005.parquet#1724"} |
25691926c14ad159 | Chef Shifu and Chef Po are participating in the Greatest Dumpling Fight of 2012.
Of course, Masterchef Oogway has formed the rules of the fight.
There is a long horizontal rope of infinite length with a center point P.
Initially both Chef Shifu and Chef Po will stand on the center P of the rope facing each other.
Don'... | [["3\n2 4 3 6 7\n1 2 4 5 1\n10 12 3 9 16", "3\n3\n5"], ["3\n2 4 3 11 7\n1 2 4 5 1\n10 12 3 9 16", "7\n3\n5\n"], ["3\n2 4 0 10 7\n1 4 4 5 1\n10 12 3 9 16", "1\n3\n5\n"], ["3\n2 4 0 10 0\n1 4 4 5 1\n10 12 3 5 16", "1\n3\n17\n"], ["3\n2 4 0 10 0\n0 4 4 5 1\n10 12 3 5 16", "1\n1\n17\n"], ["3\n2 4 0 10 0\n0 4 4 5 1\n1 12 3 ... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#398"} |
257d12c9d183d0b0 | Вася купил стол, у которого n ножек. Каждая ножка состоит из двух частей, которые соединяются друг с другом. Каждая часть может быть произвольной положительной длины, но гарантируется, что из всех 2n частей возможно составить n ножек одинаковой длины. При составлении ножки любые две части могут быть соединены друг с др... | [["3\n1 3 2 4 5 3\n", "1 5\n2 4\n3 3\n"], ["3\n1 1 1 2 2 2\n", "1 2\n1 2\n1 2\n"], ["1\n3 7\n", "3 7\n"], ["10\n9 13 18 7 18 13 2 2 5 16 3 17 5 4 18 2 15 11 7 15\n", "2 18\n2 18\n2 18\n3 17\n4 16\n5 15\n5 15\n7 13\n7 13\n9 11\n"], ["10\n759 82 475 841 46 461 288 525 918 241 789 847 58 954 712 159 942 211 153 539\n", "4... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#159"} |
258f16d24c8b37c0 | Snuke has N integers: 1,2,\ldots,N. He will choose K of them and give those to Takahashi.
How many ways are there to choose K consecutive integers?
Constraints
* All values in input are integers.
* 1 \leq K \leq N \leq 50
Input
Input is given from Standard Input in the following format:
N K
Output
Print the a... | [["13 6", "8\n"], ["6 2", "5\n"], ["13 1", "13\n"], ["13 0", "14\n"], ["23 1", "23\n"], ["19 1", "19\n"], ["2 1", "2\n"], ["2 0", "3\n"], ["2 -1", "4\n"], ["0 0", "1\n"], ["0 1", "0\n"], ["15 1", "15\n"], ["13 2", "12\n"], ["6 1", "6\n"], ["19 2", "18\n"], ["30 1", "30\n"], ["11 1", "11\n"], ["9 0", "10\n"], ["6 0", "7... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00001-of-00004.parquet#268"} |
2597f50106aefaab | Hakone Ekiden is one of the Japanese New Year's traditions. In Hakone Ekiden, 10 runners from each team aim for the goal while connecting the sashes at each relay station. In the TV broadcast, the ranking change from the previous relay station is displayed along with the passing order of each team at the relay station.... | [["2\nD\nT", "0\n"], ["2\nE\nU", "0\n"], ["2\nF\nU", "0\n"], ["2\nD\nS", "0\n"], ["2\nC\nU", "0\n"], ["2\nB\nU", "0\n"], ["2\nD\nV", "0\n"], ["2\nD\nR", "0\n"], ["2\nA\nU", "0\n"], ["2\nD\nW", "0\n"], ["2\nG\nU", "0\n"], ["2\nD\nX", "0\n"], ["2\nD\nY", "0\n"], ["2\nD\nZ", "0\n"], ["2\nD\nQ", "0\n"], ["2\nD\nP", "0\n"],... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00002-of-00004.parquet#1542"} |
259b494f59d92175 | Kurt reaches nirvana when he finds the product of all the digits of some positive integer. Greater value of the product makes the nirvana deeper.
Help Kurt find the maximum possible product of digits among all integers from $1$ to $n$.
-----Input-----
The only input line contains the integer $n$ ($1 \le n \le 2\cdo... | [["390\n", "216\n"], ["7\n", "7\n"], ["1000000000\n", "387420489\n"], ["1\n", "1\n"], ["9\n", "9\n"], ["2000000000\n", "387420489\n"], ["4876\n", "2268\n"], ["889878787\n", "301327047\n"], ["1382011913\n", "387420489\n"], ["999999999\n", "387420489\n"], ["396579088\n", "114791256\n"], ["890133136\n", "306110016\n"], ["... | 1 | {"source": "deepcoder/taco", "upstream_id": "taco/train-00000-of-00004.parquet#1222"} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.