messages listlengths 1 1 | ground_truth stringlengths 88 726k | dataset stringclasses 2
values |
|---|---|---|
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHag is a very talented person. He has always had an artist inside him but his father forced him to study mechanical engineering.\n\nYesterday he spent all of his time cutting a giant piece of wood trying to make it look l... | [{"type": "stdin_stdout", "input": "10 10\n0 -100000000\n1 -100000000\n1566 -99999999\n2088 -99999997\n2610 -99999994\n3132 -99999990\n3654 -99999985\n4176 -99999979\n4698 -99999972\n5220 -99999964\n1 2 5\n2 1\n1 1 7\n2 5\n1 5 4\n1 4 2\n2 8\n1 7 9\n2 1\n1 2 10\n", "output": "0.0000000000 -100000000.0000000000\n-7.37265... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.\n\nRecently, she was presented with an array $a$ of the size of $10^9$ elements that is filled... | [{"type": "stdin_stdout", "input": "10\n449347852 741090797\n541919355 938202256\n442458747 465872502\n463474612 789217678\n146477812 390217056\n302933612 477640295\n180229640 877876778\n173202385 444484701\n78807265 428215825\n194590462 818327464\n", "output": "-145871473\n198141451\n11706878\n626346145\n268347434\n-8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers $a$ and $b$, and $q$ queries. The $i$-th query consists of two numbers $l_i$ and $r_i$, and the answer to it is the number of integers $x$ such that $l_i \\le x \\le r_i$, and $((x \\bmod a) \\b... | [{"type": "stdin_stdout", "input": "2\n4 6 5\n1 1\n1 3\n1 5\n1 7\n1 9\n7 10 2\n7 8\n100 200\n", "output": "0 0 0 2 4 \n0 91 \n"}, {"type": "stdin_stdout", "input": "1\n199 200 1\n1 1000000000000000000\n", "output": "994974874371859201 \n"}, {"type": "stdin_stdout", "input": "1\n200 200 1\n1 1000000000000000000\n", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBy the age of three Smart Beaver mastered all arithmetic operations and got this summer homework from the amazed teacher:\n\nYou are given a sequence of integers a_1, a_2, ..., a_{n}. Your task is to perform on it m conse... | [{"type": "stdin_stdout", "input": "12 26\n18 5 13 38 33 11 30 24 6 34 11 30\n2 1 12\n2 1 12\n2 1 11\n1 3 15\n1 11 5\n2 1 11\n2 2 10\n2 3 12\n2 2 11\n2 3 11\n2 3 10\n2 3 11\n1 9 37\n1 2 37\n2 1 11\n1 3 30\n2 2 12\n1 4 42\n2 3 10\n2 1 11\n1 11 26\n1 7 37\n2 3 11\n1 7 30\n1 6 40\n1 7 13\n", "output": "8683\n8683\n4363\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is the hard version of the problem. The difference between the versions is that in the easy version all prices $a_i$ are different. You can make hacks if and only if you solved both versions of the problem.\n\nToday ... | [{"type": "stdin_stdout", "input": "2\n1000000000 1000000000\n", "output": "0\n1000000000 1000000000 "}, {"type": "stdin_stdout", "input": "7\n1 3 2 2 4 5 4\n", "output": "3\n3 1 4 2 4 2 5 "}, {"type": "stdin_stdout", "input": "5\n1 2 2 4 5\n", "output": "2\n2 1 4 2 5 "}, {"type": "stdin_stdout", "input": "4\n1 1 2 4\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob is playing a game of Spaceship Solitaire. The goal of this game is to build a spaceship. In order to do this, he first needs to accumulate enough resources for the construction. There are $n$ types of resources, numbe... | [{"type": "stdin_stdout", "input": "2\n4 4\n9\n1 1 1\n1 2 1\n1 3 1\n2 1 2\n2 2 2\n2 3 2\n2 3 1\n2 2 1\n2 1 1\n", "output": "7\n6\n5\n4\n3\n2\n2\n3\n4\n"}, {"type": "stdin_stdout", "input": "3\n3 1 1\n6\n1 1 1\n1 2 1\n1 2 2\n1 1 2\n1 1 3\n1 2 3\n", "output": "4\n3\n3\n4\n3\n4\n"}, {"type": "stdin_stdout", "input": "2\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N people standing on the x-axis.\nLet the coordinate of Person i be x_i.\nFor every i, x_i is an integer between 0 and 10^9 (inclusive).\nIt is possible that more than one person is standing at the same coordina... | [{"type": "stdin_stdout", "input": "10 3\n8 7 100\n7 9 100\n9 8 100\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "3 3\n1 2 1\n2 3 1\n1 3 2\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "4 3\n2 1 1\n2 3 5\n3 4 2\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "3 3\n1 2 1\n2 3 1\n1 3 5\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i.\nAdditionally, each vertex is painted in a color, and the color of Vertex i is c_i. Here, the color of each vertex is... | [{"type": "stdin_stdout", "input": "8\n2 7 2 5 4 1 7 5\n3 1\n1 2\n2 7\n4 5\n5 6\n6 8\n7 8\n", "output": "18\n15\n0\n14\n23\n0\n23\n0\n"}, {"type": "stdin_stdout", "input": "5\n1 2 3 4 5\n1 2\n2 3\n3 4\n3 5\n", "output": "5\n8\n10\n5\n5\n"}, {"type": "stdin_stdout", "input": "3\n1 2 1\n1 2\n2 3\n", "output": "5\n4\n0\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the year 2168, AtCoder Inc., which is much larger than now, is starting a limited express train service called AtCoder Express.\nIn the plan developed by the president Takahashi, the trains will run as follows:\n - A t... | [{"type": "stdin_stdout", "input": "10\n64 55 27 35 76 119 7 18 49 100\n29 19 31 39 27 48 41 87 55 70\n", "output": "20291.000000000000\n"}, {"type": "stdin_stdout", "input": "2\n60 50\n34 38\n", "output": "2632.000000000000000\n"}, {"type": "stdin_stdout", "input": "3\n12 14 2\n6 2 7\n", "output": "76.000000000000000\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKattapa, as you all know was one of the greatest warriors of his time. The kingdom of Maahishmati had never lost a battle under him (as army-chief), and the reason for that was their really powerful army, also called as M... | [{"type": "stdin_stdout", "input": "3\n2 3 4\n\n\n", "output": "READY FOR BATTLE\n"}, {"type": "stdin_stdout", "input": "4\n11 12 13 14\n\n\n", "output": "NOT READY\n"}, {"type": "stdin_stdout", "input": "5\n1 2 3 4 5\n\n\n", "output": "NOT READY\n"}, {"type": "stdin_stdout", "input": "1\n2\n\n\n", "output": "READY FOR... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA tree is an undirected connected graph without cycles. The distance between two vertices is the number of edges in a simple path between them.\n\nLimak is a little polar bear. He lives in a tree that consists of n vertic... | [{"type": "stdin_stdout", "input": "15 1\n12 9\n13 7\n1 3\n10 4\n9 2\n2 15\n11 4\n2 14\n10 8\n6 7\n12 5\n8 7\n3 10\n10 2\n", "output": "346\n"}, {"type": "stdin_stdout", "input": "13 3\n1 2\n3 2\n4 2\n5 2\n3 6\n10 6\n6 7\n6 13\n5 8\n5 9\n9 11\n11 12\n", "output": "114\n"}, {"type": "stdin_stdout", "input": "12 3\n5 11\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n-----Input-----\n\nThe input consists of a single string of uppercase letters A-Z. The length of the string is between 1 and 10 characters, inclusive.\n\n\n-----Output-----\n\nOutput \"YES\" or \"NO\".\n\n\n-----Examples-... | [{"type": "stdin_stdout", "input": "SMARTPHONE\n", "output": ""}, {"type": "stdin_stdout", "input": "REVOLVER\n", "output": ""}, {"type": "stdin_stdout", "input": "GENIUS\n", "output": ""}, {"type": "stdin_stdout", "input": "DOCTOR\n", "output": ""}, {"type": "stdin_stdout", "input": "HOLMES\n", "output": ""}, {"type":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.\n\nTo ensure the security, you have to build some police checkposts... | [{"type": "stdin_stdout", "input": "100\n174 174 49 152 10 185 101 157 28 177 105 83 155 178 119 123 197 197 56 174 39 53 85 94 72 166 71 43 177 123 186 11 64 82 145 81 11 29 100 10 106 45 138 79 131 90 80 104 149 116 129 30 96 192 11 182 92 157 95 136 152 38 68 34 42 95 164 134 117 75 186 185 28 146 86 24 147 12 166 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.\n\nHe has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants t... | [{"type": "stdin_stdout", "input": "15\n2 6 9 4 8 9 10 10 3 8 8 4 4 8 7\n10 9 2 6 8 10 5 2 8 4 9 6 9 10 10\n3 1 5 1 6 5 1 6 4 4 3 3 9 8 10\n5 7 10 6 4 9 6 8 1 5 4 9 10 4 8\n9 6 10 5 8 6 9 9 3 4 4 7 6 2 4\n8 6 10 7 3 3 8 10 3 8 4 8 8 3 1\n7 3 6 8 8 5 5 8 3 7 2 6 3 9 7\n6 8 4 7 7 7 10 4 6 4 3 10 1 10 2\n1 6 7 8 3 4 2 8 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected graph that consists of n vertices and m edges. Initially, each edge is colored either red or blue. Each turn a player picks a single vertex and switches the color of all edges incident to it. T... | [{"type": "stdin_stdout", "input": "11 7\n1 2 B\n1 3 R\n3 2 R\n4 5 R\n6 7 R\n8 9 R\n10 11 R\n", "output": "5\n3 4 6 8 10 \n"}, {"type": "stdin_stdout", "input": "6 6\n1 2 R\n1 3 R\n2 3 R\n4 5 B\n4 6 B\n5 6 B\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "6 5\n1 3 R\n2 3 R\n3 4 B\n4 5 R\n4 6 R\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhile exploring the old caves, researchers found a book, or more precisely, a stash of mixed pages from a book. Luckily, all of the original pages are present and each page contains its number. Therefore, the researchers ... | [{"type": "stdin_stdout", "input": "5 5\n4\nacxxay\nasuuswzxyzwvxvwcbuvtxw\nasxyabczbusyscuatbuzczx\nazvwtyvxcsbcwuyvbzyubz\naayxsvybzvzbsaxccwxwzbcuwcuy\n0\ncctzttazzwytuxzttxwbvzbsvy\ncbwzsbsb\nca\nucwzvwv\nuatxuabttcxcysvuzywwxa\n1\nbvyyusbcuwactubtasbcbbcvwsawt\nwwbyzza\nwacsuvyaxvvvx\nwawccbzxcybzwbavcs\nwvbycwsxc... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $a$, $b$, and $c$. Now he needs to find out some possi... | [{"type": "stdin_stdout", "input": "2\n1 2 3\n12 34 56\n", "output": "1\n11\n"}, {"type": "stdin_stdout", "input": "1\n2434 2442 14\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1\n10 20 10\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1\n3 4 5\n", "output": "1\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected unweighted graph consisting of $n$ vertices and $m$ edges.\n\nYou have to write a number on each vertex of the graph. Each number should be $1$, $2$ or $3$. The graph becomes beautiful if for e... | [{"type": "stdin_stdout", "input": "12\n8 7\n2 3\n3 4\n4 5\n5 2\n6 7\n7 8\n8 6\n1 0\n2 1\n1 2\n3 3\n1 2\n2 3\n1 3\n3 2\n2 3\n3 1\n4 4\n1 2\n2 3\n3 4\n4 1\n4 4\n1 2\n2 3\n3 1\n4 1\n6 9\n1 4\n1 5\n1 6\n2 4\n2 5\n2 6\n3 4\n3 5\n3 6\n100000 0\n1000 5\n55 56\n56 57\n57 58\n58 59\n59 55\n11 11\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a sequence of length N consisting of non-negative integers. Consider performing the following operation on this sequence until the largest element in this sequence becomes N-1 or smaller.\n - Determine the largest... | [{"type": "stdin_stdout", "input": "1234567894848\n", "output": "10\n1000 193 256 777 0 1 1192 1234567891011 48 425\n"}, {"type": "stdin_stdout", "input": "3\n", "output": "7\n27 0 0 0 0 0 0\n"}, {"type": "stdin_stdout", "input": "0\n", "output": "4\n3 3 3 3\n"}, {"type": "stdin_stdout", "input": "1\n", "output": "3\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer $x$ of $n$ digits $a_1, a_2, \\ldots, a_n$, which make up its decimal notation in order from left to right.\n\nAlso, you are given a positive integer $k < n$.\n\nLet's call integer $b_1, b_2, \\ld... | [{"type": "stdin_stdout", "input": "20 10\n21474836472147483648\n", "output": "20\n21474836482147483648\n"}, {"type": "stdin_stdout", "input": "20 19\n19999999999999999999\n", "output": "20\n20000000000000000002\n"}, {"type": "stdin_stdout", "input": "12 2\n121212121216\n", "output": "12\n131313131313\n"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHave you ever tried to explain to the coordinator, why it is eight hours to the contest and not a single problem has been prepared yet? Misha had. And this time he has a really strong excuse: he faced a space-time paradox... | [{"type": "stdin_stdout", "input": "11 59 59 11 12\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "12 12 12 11 12\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "11 59 59 12 11\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10 22 59 6 10\n", "output": "YES\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTHE SxPLAY & KIVΛ - 漂流 KIVΛ & Nikki Simmons - Perspectives\n\nWith a new body, our idol Aroma White (or should we call her Kaori Minamiya?) begins to uncover her lost past through the OS space.\n\nThe space can be conside... | [{"type": "stdin_stdout", "input": "10000000000000000 10000000000000000 100 100 10000000000000000 10000000000000000\n10000000000000000 10000000000000000 10000000000000000\n", "output": "1"}, {"type": "stdin_stdout", "input": "3449558549195209 933961699330867 25 92 2448338832051825 8082390281981957\n7818990402072641 984... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFirecrackers scare Nian the monster, but they're wayyyyy too noisy! Maybe fireworks make a nice complement.\n\nLittle Tommy is watching a firework show. As circular shapes spread across the sky, a splendid view unfolds on... | [{"type": "stdin_stdout", "input": "3\n-10 4 10\n10 4 10\n0 -7 10\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "3\n1 -7 10\n-7 9 10\n-2 -1 4\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "3\n-3 -2 3\n-4 -6 3\n-6 -4 9\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "3\n-2 -5 4\n-5 -1 5\n-6 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two squares, one with sides parallel to the coordinate axes, and another one with sides at 45 degrees to the coordinate axes. Find whether the two squares intersect.\n\nThe interior of the square is consider... | [{"type": "stdin_stdout", "input": "-17 -91 -17 -27 -81 -27 -81 -91\n-48 -21 -12 -57 -48 -93 -84 -57\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "-100 -100 -100 -99 -99 -99 -99 -100\n-10 -10 -9 -9 -10 -8 -11 -9\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-100 -100 100 -100 100 100 -100 100\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTokitsukaze and CSL are playing a little game of stones.\n\nIn the beginning, there are $n$ piles of stones, the $i$-th pile of which has $a_i$ stones. The two players take turns making moves. Tokitsukaze moves first. On ... | [{"type": "stdin_stdout", "input": "14\n9 9 1000 2000 39999 48888 16 32 123456 959658 111 987584 125632 125468\n", "output": "sjfnb\n"}, {"type": "stdin_stdout", "input": "14\n9 9 1000 2000 39999 48888 16 32 123456 959658 111 987584 125632 125477\n", "output": "cslnb\n"}, {"type": "stdin_stdout", "input": "14\n6 66 89 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA new dog show on TV is starting next week. On the show dogs are required to demonstrate bottomless stomach, strategic thinking and self-preservation instinct. You and your dog are invited to compete with other participan... | [{"type": "stdin_stdout", "input": "100 154\n132 88 72 98 184 47 176 56 68 168 137 88 188 140 198 18 162 139 94 133 90 91 37 156 196 28 186 1 51 47 4 92 18 51 37 121 86 195 153 195 183 191 15 24 104 174 94 83 102 61 131 40 149 46 22 112 13 136 133 177 3 175 160 152 172 48 44 174 77 100 155 157 167 174 64 109 118 194 12... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSuppose you have two polynomials $A(x) = \\sum_{k = 0}^{n} a_{k} x^{k}$ and $B(x) = \\sum_{k = 0}^{m} b_{k} x^{k}$. Then polynomial $A(x)$ can be uniquely represented in the following way:$A(x) = B(x) \\cdot D(x) + R(x), ... | [{"type": "stdin_stdout", "input": "121\n", "output": "121\n0 -1 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 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 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 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1\n120\n-1 0 0 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe elections to Berland parliament are happening today. Voting is in full swing!\n\nTotally there are n candidates, they are numbered from 1 to n. Based on election results k (1 ≤ k ≤ n) top candidates will take seats in... | [{"type": "stdin_stdout", "input": "100 100 100 100\n71 22 92 3 19 90 1 16 88 56 62 37 56 84 52 46 4 64 21 19 37 54 21 81 56 33 71 57 86 75 62 42 79 67 14 8 66 30 13 38 20 71 36 66 46 55 4 99 18 37 7 24 72 46 32 86 87 7 90 93 96 94 21 23 62 53 16 11 11 83 21 81 68 50 85 9 94 60 47 41 34 82 11 12 95 81 61 81 86 85 64 36... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Travelling Salesman spends a lot of time travelling so he tends to get bored. To pass time, he likes to perform operations on numbers. One such operation is to take a positive integer x and reduce it to the number of ... | [{"type": "stdin_stdout", "input": "10011010111010010111111110001010001010001010110010110010010111101111000101110101010111100101001100011001001001111011111100011110101011011001101101001111111101010010110011111101110010001000111111100011000000111111111100011000000000110101111000001011101000110000111110110000010000010011... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin.\n\nWe can think Central Perk as coordinate plane. There a... | [{"type": "stdin_stdout", "input": "235810013 344493922 0 0 975204641 211157253\n18\n977686151 621301932\n408277582 166435161\n595105725 194278844\n967498841 705149530\n551735395 659209387\n492239556 317614998\n741520864 843275770\n585383143 903832112\n272581169 285871890\n339100580 134101148\n920610054 824829107\n6579... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTanechka is shopping in the toy shop. There are exactly $n$ toys in the shop for sale, the cost of the $i$-th toy is $i$ burles. She wants to choose two toys in such a way that their total cost is $k$ burles. How many way... | [{"type": "stdin_stdout", "input": "100000000000000 100000000000000\n", "output": "49999999999999\n"}, {"type": "stdin_stdout", "input": "100000000000000 99999999999999\n", "output": "49999999999999\n"}, {"type": "stdin_stdout", "input": "99999999999998 100000000000000\n", "output": "49999999999998\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've got a string $a_1, a_2, \\dots, a_n$, consisting of zeros and ones.\n\nLet's call a sequence of consecutive elements $a_i, a_{i + 1}, \\ldots, a_j$ ($1\\leq i\\leq j\\leq n$) a substring of string $a$. \n\nYou can ... | [{"type": "stdin_stdout", "input": "25 999999998 999999999\n1011001110101010100111001\n", "output": "7999999985\n"}, {"type": "stdin_stdout", "input": "4 477963686 636258459\n0101\n", "output": "1114222145\n"}, {"type": "stdin_stdout", "input": "4 927391856 637236921\n1010\n", "output": "1274473842\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe well-known Fibonacci sequence $F_0, F_1, F_2,\\ldots $ is defined as follows: $F_0 = 0, F_1 = 1$. For each $i \\geq 2$: $F_i = F_{i - 1} + F_{i - 2}$. \n\nGiven an increasing arithmetic sequence of positive integer... | [{"type": "stdin_stdout", "input": "1 123456 961946\n", "output": "11954016000000000001 3158031000000000000\n"}, {"type": "stdin_stdout", "input": "1 999999 999999\n", "output": "9082426500000000001 9082426500000000000\n"}, {"type": "stdin_stdout", "input": "1 999599 123123\n", "output": "6053026500000000001 4902040500... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBerkomnadzor — Federal Service for Supervision of Communications, Information Technology and Mass Media — is a Berland federal executive body that protects ordinary residents of Berland from the threats of modern internet... | [{"type": "stdin_stdout", "input": "35\n-0.0.0.47\n+0.0.0.39/32\n+0.0.0.23\n+0.0.0.6/31\n-0.0.0.2\n+0.0.0.8/32\n+0.0.0.54/32\n-0.0.0.43\n-0.0.0.31/32\n-0.0.0.0\n+0.0.0.26/32\n-0.0.0.42\n+0.0.0.52\n-0.0.0.10/31\n+0.0.0.53\n+0.0.0.28/32\n-0.0.0.19/32\n-0.0.0.12\n-0.0.0.16/31\n-0.0.0.35/32\n+0.0.0.51\n+0.0.0.24/31\n-0.0.0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn the way to school, Karen became fixated on the puzzle game on her phone! [Image] \n\nThe game is played as follows. In each level, you have a grid with n rows and m columns. Each cell originally contains the number 0.\... | [{"type": "stdin_stdout", "input": "10 10\n1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1\n0 0 0 0 0 0 0 0 0 0\n1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1\n", "output": "9\nrow 1\nrow 2\nrow 3\nrow 4\nrow 6\nrow 7\nrow 8\nr... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn some game by Playrix it takes t minutes for an oven to bake k carrot cakes, all cakes are ready at the same moment t minutes after they started baking. Arkady needs at least n cakes to complete a task, but he currently... | [{"type": "stdin_stdout", "input": "1000 1000 1000 1000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1000 1000 1 1000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1000 1000 1 400\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1000 1000 1 999\n", "output": "YES\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIahub got lost in a very big desert. The desert can be represented as a n × n square matrix, where each cell is a zone of the desert. The cell (i, j) represents the cell at row i and column j (1 ≤ i, j ≤ n). Iahub can go ... | [{"type": "stdin_stdout", "input": "999999989 38\n999999980 999999981\n10 8\n2 5\n999999978 999999981\n999999978 999999985\n7 9\n8 10\n9 10\n999999984 999999980\n6 6\n999999985 999999986\n999999982 999999978\n999999981 999999987\n8 5\n999999982 999999980\n999999989 999999980\n999999988 999999983\n999999982 999999984\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.\n\nk expe... | [{"type": "stdin_stdout", "input": "10 4\n1 0 1 0\n1 0 0 1\n1 1 0 1\n1 0 1 1\n1 1 0 1\n1 0 1 0\n0 0 0 0\n0 0 1 0\n1 0 1 0\n0 0 1 1\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10 4\n1 0 1 0\n1 0 1 0\n0 1 1 1\n1 0 1 1\n1 1 0 1\n1 0 0 1\n0 1 1 1\n0 0 0 1\n1 1 1 1\n1 0 1 0\n", "output": "YES\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday Pari and Arya are playing a game called Remainders.\n\nPari chooses two positive integer x and k, and tells Arya k but not x. Arya have to find the value $x \\text{mod} k$. There are n ancient numbers c_1, c_2, ...,... | [{"type": "stdin_stdout", "input": "61 531012\n698043 698043 698043 963349 698043 698043 698043 963349 698043 698043 698043 963349 698043 698043 698043 698043 966694 698043 698043 698043 698043 698043 698043 636247 698043 963349 698043 698043 698043 698043 697838 698043 963349 698043 698043 966694 698043 698043 698043 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA team of students from the city S is sent to the All-Berland Olympiad in Informatics. Traditionally, they go on the train. All students have bought tickets in one carriage, consisting of n compartments (each compartment ... | [{"type": "stdin_stdout", "input": "200\n2 1 1 2 2 2 2 1 1 2 2 2 1 1 2 2 2 2 1 1 1 2 2 2 2 2 2 1 2 2 1 1 1 1 2 1 2 2 1 2 2 2 2 1 2 2 1 1 1 1 2 2 1 1 1 1 1 2 2 2 2 1 2 1 2 2 2 2 1 1 1 2 1 2 2 2 2 1 1 1 1 1 1 2 2 2 1 2 2 2 1 2 2 2 1 1 1 2 2 1 1 1 1 2 2 1 2 1 1 1 2 2 1 1 2 2 2 1 2 2 0 1 2 1 1 2 2 2 1 2 2 1 1 1 2 2 2 1 2 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKevin has just recevied his disappointing results on the USA Identification of Cows Olympiad (USAICO) in the form of a binary string of length n. Each character of Kevin's string represents Kevin's score on one of the n q... | [{"type": "stdin_stdout", "input": "93\n010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010\n", "output": "93\n"}, {"type": "stdin_stdout", "input": "89\n01010101010101010101010101010101010101010101010101010101101010101010101010100101010101010\n", "output": "89\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs you have noticed, there are lovely girls in Arpa’s land.\n\nPeople in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th person's crush is person with the number crush_{i}. [Image] \n\nSomeday A... | [{"type": "stdin_stdout", "input": "100\n84 94 72 32 61 90 61 2 76 42 35 82 90 29 51 27 65 99 38 41 44 73 100 58 56 64 54 31 14 58 57 64 90 49 73 80 74 19 31 86 73 44 39 43 28 95 23 5 85 5 74 81 34 44 86 30 50 57 94 56 53 42 53 87 92 78 53 49 78 60 37 63 41 19 15 68 25 77 87 48 23 100 54 27 68 84 43 92 76 55 2 94 100 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSome days ago, I learned the concept of LCM (least common multiple). I've played with it for several times and I want to make a big number with it.\n\nBut I also don't want to use many numbers, so I'll choose three positi... | [{"type": "stdin_stdout", "input": "1000000\n", "output": "999996000003000000\n"}, {"type": "stdin_stdout", "input": "763116\n", "output": "444394078546562430\n"}, {"type": "stdin_stdout", "input": "756604\n", "output": "433115377058855412\n"}, {"type": "stdin_stdout", "input": "546924\n", "output": "163597318076822526... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given $n$ rectangles on a plane with coordinates of their bottom left and upper right points. Some $(n-1)$ of the given $n$ rectangles have some common point. A point belongs to a rectangle if this point is strict... | [{"type": "stdin_stdout", "input": "3\n-1000000000 -1000000000 -999999999 -999999999\n-1000000000 -1000000000 1000000000 1000000000\n-1000000000 -1000000000 -999999999 -999999999\n", "output": "-1000000000 -1000000000\n"}, {"type": "stdin_stdout", "input": "3\n999999999 -1000000000 1000000000 -999999999\n-1000000000 -1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLimak is a little polar bear. He has n balls, the i-th ball has size t_{i}.\n\nLimak wants to give one ball to each of his three friends. Giving gifts isn't easy — there are two rules Limak must obey to make friends happy... | [{"type": "stdin_stdout", "input": "50\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\n", "output": "NO\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya and Petya wrote down all integers from 1 to n to play the \"powers\" game (n can be quite large; however, Vasya and Petya are not confused by this fact).\n\nPlayers choose numbers in turn (Vasya chooses first). If s... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "Vasya\n"}, {"type": "stdin_stdout", "input": "999999998\n", "output": "Vasya\n"}, {"type": "stdin_stdout", "input": "999999999\n", "output": "Vasya\n"}, {"type": "stdin_stdout", "input": "951352334\n", "output": "Petya\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInnopolis University scientists continue to investigate the periodic table. There are n·m known elements and they form a periodic table: a rectangle with n rows and m columns. Each element can be described by its coordina... | [{"type": "stdin_stdout", "input": "20 20 80\n5 3\n13 13\n8 5\n2 9\n12 16\n1 11\n15 11\n3 20\n10 7\n5 4\n11 2\n5 20\n14 8\n5 1\n8 13\n11 5\n19 2\n15 12\n12 7\n16 5\n17 3\n12 2\n17 16\n12 3\n12 6\n18 20\n2 20\n9 1\n5 10\n9 18\n17 1\n17 10\n20 1\n12 12\n19 14\n7 8\n2 19\n6 14\n5 6\n15 2\n18 14\n5 7\n14 14\n17 2\n20 20\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are an integer N and four characters c_{\\mathrm{AA}}, c_{\\mathrm{AB}}, c_{\\mathrm{BA}}, and c_{\\mathrm{BB}}.\nHere, it is guaranteed that each of those four characters is A or B.\nSnuke has a string s, which is ... | [{"type": "stdin_stdout", "input": "1000\nB\nA\nA\nA\n", "output": "589888339\n"}, {"type": "stdin_stdout", "input": "1000\nA\nB\nA\nA\n", "output": "336052903\n"}, {"type": "stdin_stdout", "input": "1000\nB\nB\nA\nA\n", "output": "336052903\n"}, {"type": "stdin_stdout", "input": "1000\nB\nA\nB\nA\n", "output": "336052... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height of Xaniar is h_1 and height of Abol is h_2. Each second, Mike waters Abol and Xaniar.\n\n [Image] \n\nSo, i... | [{"type": "stdin_stdout", "input": "999983\n651224 992349\n803017 393514\n258455 402487\n888310 244420\n", "output": "126531\n"}, {"type": "stdin_stdout", "input": "1000000\n220036 846131\n698020 485511\n656298 242999\n766802 905433\n", "output": "5297\n"}, {"type": "stdin_stdout", "input": "1000000\n661647 690400\n864... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are infinitely many cards, numbered 1, 2, 3, ...\nInitially, Cards x_1, x_2, ..., x_N are face up, and the others are face down.\nSnuke can perform the following operation repeatedly:\n - Select a prime p greater th... | [{"type": "stdin_stdout", "input": "100\n1193226 1193227 1193228 1321766 2059359 2059360 2059361 2059362 3026992 3026993 3251387 3464481 3464482 3464483 3464484 3464485 3464486 3464487 3464488 3464489 3464490 3846512 3846513 3849100 3849101 3849102 3911410 3911411 3911412 4750647 5162888 5162889 5162890 5162891 5162892... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn integer sequence is called beautiful if the difference between any two consecutive numbers is equal to $1$. More formally, a sequence $s_1, s_2, \\ldots, s_{n}$ is beautiful if $|s_i - s_{i+1}| = 1$ for all $1 \\leq i ... | [{"type": "stdin_stdout", "input": "1 72 110 39\n", "output": "YES\n0 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a table consisting of n rows and m columns.\n\nNumbers in each row form a permutation of integers from 1 to m.\n\nYou are allowed to pick two elements in one row and swap them, but no more than once for each... | [{"type": "stdin_stdout", "input": "20 8\n4 3 2 1 5 6 7 8\n1 2 3 4 8 7 6 5\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSometimes Mister B has free evenings when he doesn't know what to do. Fortunately, Mister B found a new game, where the player can play against aliens.\n\nAll characters in this game are lowercase English letters. There a... | [{"type": "stdin_stdout", "input": "12 12 876543210 1000000000\n", "output": "13"}, {"type": "stdin_stdout", "input": "10 12 220000011 220000032\n", "output": "11"}, {"type": "stdin_stdout", "input": "5 6 1000000000 1000000000\n", "output": "1"}, {"type": "stdin_stdout", "input": "12 1 100000011 100000024\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of $n$ non... | [{"type": "stdin_stdout", "input": "50 20\n592183311 362557946 154127088 616872926 395353745 675069471 509655682 79915471 356656666 937992998 304422065 724106263 472338455 792258113 796069631 663370025 201799298 566151622 722278085 508905399 703159587 690854023 925377265 11010958 69791159 990158269 535460930 167415727 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given names of two days of the week.\n\nPlease, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day... | [{"type": "stdin_stdout", "input": "wednesday\nwednesday\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "wednesday\nsaturday\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "wednesday\nsaturday\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "wednesday\nthursday\n", "output": "NO\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a positive integer $n$.\n\nLet $S(x)$ be sum of digits in base 10 representation of $x$, for example, $S(123) = 1 + 2 + 3 = 6$, $S(0) = 0$.\n\nYour task is to find two integers $a, b$, such that $0 \\leq a, ... | [{"type": "stdin_stdout", "input": "1000000000000\n", "output": "109\n"}, {"type": "stdin_stdout", "input": "999999999992\n", "output": "200\n"}, {"type": "stdin_stdout", "input": "290687942106\n", "output": "153\n"}, {"type": "stdin_stdout", "input": "324278748889\n", "output": "160\n"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, a start up by two students of a state university of city F gained incredible popularity. Now it's time to start a new company. But what do we call it?\n\nThe market analysts came up with a very smart plan: the n... | [{"type": "stdin_stdout", "input": "OVWIHIWVYXMVAAAATOXWOIUUHYXHIHHVUIOOXWHOXTUUMUUVHVWWYUTIAUAITAOMHXWMTTOIVMIVOTHOVOIOHYHAOXWAUVWAVIVM\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "QDPINBMCRFWXPDBFGOZVVOCEMJRUCTOADEWEGTVBVBFWWRPGYEEYGPRWWFBVBVTGEWEDAOTCURJMECOVVZOGFBDPXWFRCMBNIPDQ\n", "output": "NO\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\"Night gathers, and now my watch begins. It shall not end until my death. I shall take no wife, hold no lands, father no children. I shall wear no crowns and win no glory. I shall live and die at my post. I am the sword ... | [{"type": "stdin_stdout", "input": "205\n5 5 3 3 6 2 9 3 8 9 6 6 10 8 1 5 3 3 1 2 9 9 9 3 9 10 3 9 8 3 5 6 6 4 6 9 2 9 10 9 5 6 6 7 4 2 6 3 4 1 10 1 7 2 7 7 3 2 6 5 5 2 9 3 8 8 7 6 6 4 2 2 6 2 3 5 7 2 2 10 1 4 6 9 2 3 7 2 2 7 4 4 9 10 7 5 8 6 5 3 6 10 2 7 5 6 6 8 3 3 9 4 3 5 7 9 3 2 1 1 3 2 1 9 3 1 4 4 10 2 5 5 8 1 4 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a positive integer n, let us define f(n) as the number of digits in base 10.\nYou are given an integer S.\nCount the number of the pairs of positive integers (l, r) (l \\leq r) such that f(l) + f(l + 1) + ... + f(r) =... | [{"type": "stdin_stdout", "input": "100000000\n", "output": "914705724\n"}, {"type": "stdin_stdout", "input": "91304885\n", "output": "555850206\n"}, {"type": "stdin_stdout", "input": "89317875\n", "output": "494668252\n"}, {"type": "stdin_stdout", "input": "78876118\n", "output": "915018436\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given $n$ integer numbers $a_1, a_2, \\dots, a_n$. Consider graph on $n$ nodes, in which nodes $i$, $j$ ($i\\neq j$) are connected if and only if, $a_i$ AND $a_j\\neq 0$, where AND denotes the bitwise AND operatio... | [{"type": "stdin_stdout", "input": "150\n0 0 0 0 0 0 0 2537672836907008 0 0 0 0 0 0 16384 0 0 0 0 34360787232 0 0 70871155232 0 0 0 0 0 0 0 0 0 0 0 2256197860262016 0 0 0 0 0 0 0 0 0 0 536872961 0 0 0 0 0 0 0 0 0 0 33619968 0 0 0 0 0 0 0 0 0 0 0 0 37189881297899520 0 18031990695526400 0 0 1099511627776 0 0 0 0 0 0 0 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n students at Berland State University. Every student has two skills, each measured as a number: a_{i} — the programming skill and b_{i} — the sports skill.\n\nIt is announced that an Olympiad in programming and... | [{"type": "stdin_stdout", "input": "20 1 7\n20 8 10 7 14 9 17 19 19 9 20 6 1 14 11 15 12 10 20 15\n10 3 20 1 16 7 8 19 3 17 9 2 20 14 20 2 20 9 2 4\n", "output": "152\n1 \n3 5 8 10 13 15 17 \n"}, {"type": "stdin_stdout", "input": "19 14 2\n5 3 4 10 5 7 10 9 2 5 4 3 2 3 10 10 6 4 1\n6 10 5 3 8 9 9 3 1 6 4 4 3 6 8 5 9 3 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day student Vasya was sitting on a lecture and mentioned a string s_1s_2... s_{n}, consisting of letters \"a\", \"b\" and \"c\" that was written on his desk. As the lecture was boring, Vasya decided to complete the pi... | [{"type": "stdin_stdout", "input": "15 84\n11 9\n3 11\n13 10\n2 12\n5 9\n1 7\n14 4\n14 2\n14 1\n11 8\n1 8\n14 10\n4 15\n10 5\n5 12\n13 11\n6 14\n5 7\n12 11\n9 1\n10 15\n2 6\n7 15\n14 9\n9 7\n11 14\n8 15\n12 7\n13 6\n2 9\n9 6\n15 3\n12 15\n6 15\n4 6\n4 1\n9 12\n10 7\n6 1\n11 10\n2 3\n5 2\n13 2\n13 3\n12 6\n4 3\n5 8\n12 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Tower of Hanoi is a well-known mathematical puzzle. It consists of three rods, and a number of disks of different sizes which can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending order... | [{"type": "stdin_stdout", "input": "0 10000 10000\n10000 0 10000\n10000 10000 0\n40\n", "output": "10995116277750000\n"}, {"type": "stdin_stdout", "input": "0 3003 1005\n4320 0 1463\n4961 5563 0\n40\n", "output": "3633519425831590\n"}, {"type": "stdin_stdout", "input": "0 9916 3929\n5389 0 6509\n2557 4099 0\n38\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBash wants to become a Pokemon master one day. Although he liked a lot of Pokemon, he has always been fascinated by Bulbasaur the most. Soon, things started getting serious and his fascination turned into an obsession. Si... | [{"type": "stdin_stdout", "input": "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBbbbbbbbbbbbbbbbbbbbbuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuullllllllllllllllllllssssssssssssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMisha and Vanya have played several table tennis sets. Each set consists of several serves, each serve is won by one of the players, he receives one point and the loser receives nothing. Once one of the players scores exa... | [{"type": "stdin_stdout", "input": "1 1000000000 1000000000\n", "output": "2000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 1000000000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "2 1000000000 1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKostya likes Codeforces contests very much. However, he is very disappointed that his solutions are frequently hacked. That's why he decided to obfuscate (intentionally make less readable) his code before upcoming contest... | [{"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJulia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after k minutes after turning on.\n\nDuring cooking, Julia goes to the kitchen every d min... | [{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 1000000000000000000\n", "output": "1000000000000000000.0\n"}, {"type": "stdin_stdout", "input": "999999999999999999 1000000000000000000 1000000000000000000\n", "output": "1000000000000000000.5\n"}, {"type": "stdin_stdout", "input": "57452097635... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAll of us love treasures, right? That's why young Vasya is heading for a Treasure Island.\n\nTreasure Island may be represented as a rectangular table $n \\times m$ which is surrounded by the ocean. Let us number rows of ... | [{"type": "stdin_stdout", "input": "2 250\n..........................................................................................................................................................................................................................................................\n............................ | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is about to assemble a character figure, consisting of N parts called Part 1, Part 2, ..., Part N and N-1 connecting components. Parts are distinguishable, but connecting components are not.\nPart i has d_i hole... | [{"type": "stdin_stdout", "input": "44242\n1 2 1 1 3 2 2 1 1 2 1 1 3 3 2 1 3 3 1 1 2 4 2 1 3 3 1 2 1 4 2 1 4 1 1 3 1 1 1 2 3 1 3 1 1 3 2 2 2 1 2 2 2 2 3 1 3 2 2 2 2 2 2 1 4 3 1 2 1 2 2 1 2 5 1 1 3 5 2 2 1 3 6 2 1 2 1 1 3 1 1 1 1 4 1 2 2 1 1 1 2 1 2 3 1 4 1 1 1 2 2 3 1 1 1 2 3 1 1 4 1 1 2 2 2 4 2 3 1 1 2 3 2 2 2 2 2 2 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have an integer sequence of length N: a_1, a_2, ..., a_N.\nYou repeatedly perform the following operation until the length of the sequence becomes 1:\n - First, choose an element of the sequence.\n - If that element i... | [{"type": "stdin_stdout", "input": "1000\n-192930591 -369019034 -827740421 -790441356 -636463250 -819858653 -190634159 -688053134 -931250418 -111365495 -669006097 -227918242 -451591748 -269188033 -541900126 -599182344 -561221849 -629956827 -480216666 -203942185 -574675488 -438214103 -294979780 -476124432 -688704865 -36... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEfim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he de... | [{"type": "stdin_stdout", "input": "320 142\n2704701300865535.432223312233434114130011113220102420131323010344144201124303144444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444447444444444444444444444444444444615444444482101673308979557675074444444444444446... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor each string s consisting of characters '0' and '1' one can define four integers a_00, a_01, a_10 and a_11, where a_{xy} is the number of subsequences of length 2 of the string s equal to the sequence {x, y}. \n\nIn th... | [{"type": "stdin_stdout", "input": "105 2 598 780\n", "output": "1111111111111111111111111111111111111101100000000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 1000000000 1000000000\n", "output": "Impossible\n"}, {"type": "stdin_stdout", "input": "499928010 601314341 398636540 499991253\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA game field is a strip of 1 × n square cells. In some cells there are Packmen, in some cells — asterisks, other cells are empty.\n\nPackman can move to neighboring cell in 1 time unit. If there is an asterisk in the targ... | [{"type": "stdin_stdout", "input": "100\n************************************************************P***************************************\n", "output": "138\n"}, {"type": "stdin_stdout", "input": "100\n........*P**...*.*.*.*..*.*.**...*.*.....*..............*..**.............*..........*.*..*..*.**...\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImagine you have an infinite 2D plane with Cartesian coordinate system. Some of the integral points are blocked, and others are not. Two integral points A and B on the plane are 4-connected if and only if: the Euclidean ... | [{"type": "stdin_stdout", "input": "30426905\n", "output": "172120564\n"}, {"type": "stdin_stdout", "input": "38450759\n", "output": "217510336\n"}, {"type": "stdin_stdout", "input": "19863843\n", "output": "112366864\n"}, {"type": "stdin_stdout", "input": "24562258\n", "output": "138945112\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rectangle grid. That grid's size is n × m. Let's denote the coordinate system on the grid. So, each point on the grid will have coordinates — a pair of integers (x, y) (0 ≤ x ≤ n, 0 ≤ y ≤ m).\n\nYour task ... | [{"type": "stdin_stdout", "input": "1000000000 1000000000 286536427 579261823 230782719 575570138\n", "output": "171145067 291476754 401927786 867046892\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 623214043 753726318 970868535 929707704\n", "output": "29131465 70292296 1000000000 1000000000\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMaxim has opened his own restaurant! The restaurant has got a huge table, the table's length is p meters.\n\nMaxim has got a dinner party tonight, n guests will come to him. Let's index the guests of Maxim's restaurant fr... | [{"type": "stdin_stdout", "input": "50\n15 28 34 29 17 21 20 34 37 17 10 20 37 10 18 25 31 25 16 1 37 27 39 3 5 18 2 32 10 35 20 17 29 20 3 29 3 25 9 32 37 5 25 23 25 33 35 8 31 29\n39\n", "output": "1.4997987526\n"}, {"type": "stdin_stdout", "input": "49\n46 42 3 1 42 37 25 21 47 22 49 50 19 35 32 35 4 50 19 39 1 39 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJon 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 wal... | [{"type": "stdin_stdout", "input": "119 12 653\n877 938 872 962 590 500 422 249 141 163 609 452 594 768 316 530 838 945 658 636 997 938 941 272 102 8 713 862 572 809 301 462 282 478 12 544 157 204 367 789 136 251 754 43 349 355 560 325 463 659 666 644 992 603 799 597 364 234 903 377 896 92 971 308 617 712 480 772 170 6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNick has n bottles of soda left after his birthday. Each bottle is described by two values: remaining amount of soda a_{i} and bottle volume b_{i} (a_{i} ≤ b_{i}).\n\nNick has decided to pour all remaining soda into minim... | [{"type": "stdin_stdout", "input": "90\n4 2 21 69 53 39 2 2 8 58 7 5 2 82 7 9 13 10 2 44 1 7 2 1 50 42 36 17 14 46 19 1 50 20 51 46 9 59 73 61 76 4 19 22 1 43 53 2 5 5 32 7 5 42 30 14 32 6 6 15 20 24 13 8 5 19 9 9 7 20 7 2 55 36 5 33 64 20 22 22 9 30 67 38 68 2 13 19 2 9\n48 4 39 85 69 70 11 42 65 77 61 6 60 84 67 15 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob decided to eat some fruit. In the kitchen they found a large bag of oranges and apples. Alice immediately took an orange for herself, Bob took an apple. To make the process of sharing the remaining fruit mor... | [{"type": "stdin_stdout", "input": "420196140727489673 679891637638612258\n", "output": "1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B\n"}, {"type": "stdin_stdout", "input": "498454011879264 8065... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMad scientist Mike is building a time machine in his spare time. To finish the work, he needs a resistor with a certain resistance value.\n\nHowever, all Mike has is lots of identical resistors with unit resistance R_0 = ... | [{"type": "stdin_stdout", "input": "999999999999999999 1000000000000000000\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "999999999999999991 1000000000000000000\n", "output": "111111111111111120\n"}, {"type": "stdin_stdout", "input": "999999999999999993 999999999999999991\n", "output": "4999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi and Aoki are playing a stone-taking game. Initially, there are N piles of stones, and the i-th pile contains A_i stones and has an associated integer K_i.\nStarting from Takahashi, Takahashi and Aoki take altern... | [{"type": "stdin_stdout", "input": "200\n48018902 1000000000\n671608134 1000000000\n821230959 1000000000\n839046240 1000000000\n871451860 1000000000\n201326387 1000000000\n95653264 1000000000\n118998199 1000000000\n661381768 1000000000\n265950246 1000000000\n443323091 1000000000\n621558889 1000000000\n486583499 1000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo participants are each given a pair of distinct numbers from 1 to 9 such that there's exactly one number that is present in both pairs. They want to figure out the number that matches by using a communication channel y... | [{"type": "stdin_stdout", "input": "12 12\n7 6 3 8 8 4 4 7 1 9 9 5 7 5 4 9 8 6 2 7 7 3 3 6\n9 1 2 4 9 8 5 3 6 7 3 8 2 7 5 9 6 4 3 1 2 6 1 4\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "12 12\n1 6 2 6 8 3 6 4 4 8 7 2 7 5 9 4 2 4 9 5 8 5 3 6\n2 8 6 9 2 6 7 4 6 5 6 3 5 8 7 8 7 1 1 9 9 7 7 3\n", "output": "-1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a broken clock. You know, that it is supposed to show time in 12- or 24-hours HH:MM format. In 12-hours format hours change from 1 to 12, while in 24-hours it changes from 0 to 23. In both formats minutes ch... | [{"type": "stdin_stdout", "input": "24\n17:30\n", "output": "17:30\n"}, {"type": "stdin_stdout", "input": "12\n17:30\n", "output": "07:30\n"}, {"type": "stdin_stdout", "input": "24\n99:99\n", "output": "09:09\n"}, {"type": "stdin_stdout", "input": "12\n05:54\n", "output": "05:54\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have an undirected weighted graph with N vertices and M edges.\nThe i-th edge in the graph connects Vertex U_i and Vertex V_i, and has a weight of W_i.\nAdditionally, you are given an integer X.\nFind the number of way... | [{"type": "stdin_stdout", "input": "1000 2000\n501595328391\n685 363 621930471\n271 301 997970019\n502 556 984052191\n139 71 698618010\n184 956 806848809\n34 192 970227157\n632 755 658607560\n457 495 998339340\n861 689 187827317\n626 629 901887806\n578 388 973419851\n719 961 867860866\n392 148 606586530\n457 861 990309... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTo improve the boomerang throwing skills of the animals, Zookeeper has set up an $n \\times n$ grid with some targets, where each row and each column has at most $2$ targets each. The rows are numbered from $1$ to $n$ fro... | [{"type": "stdin_stdout", "input": "4\n3 3 3 1\n", "output": "7\n1 1\n1 2\n2 2\n2 3\n3 3\n3 4\n4 4\n"}, {"type": "stdin_stdout", "input": "6\n2 0 3 0 1 1\n", "output": "5\n1 1\n1 6\n2 3\n2 5\n3 5\n"}, {"type": "stdin_stdout", "input": "4\n3 3 2 1\n", "output": "6\n1 1\n1 2\n2 2\n2 3\n3 3\n3 4\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAstronaut Natasha arrived on Mars. She knows that the Martians are very poor aliens. To ensure a better life for the Mars citizens, their emperor decided to take tax from every tourist who visited the planet. Natasha is t... | [{"type": "stdin_stdout", "input": "100 30\n30 30 30 90 30 30 90 90 30 90 30 90 90 30 30 30 60 60 60 30 30 60 90 90 90 60 30 90 60 60 90 60 60 60 30 60 60 60 60 90 60 30 60 90 90 90 60 60 90 60 60 60 60 30 30 60 30 60 60 90 30 60 60 60 90 60 90 30 30 60 30 90 90 90 90 60 90 30 30 60 60 30 60 60 60 30 90 60 60 60 90 60 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA team of furry rescue rangers was sitting idle in their hollow tree when suddenly they received a signal of distress. In a few moments they were ready, and the dirigible of the rescue chipmunks hit the road.\n\nWe assume... | [{"type": "stdin_stdout", "input": "-10000 -10000 10000 10000\n1000 1000\n-454 -891\n-454 -891\n", "output": "17933348.203209973872\n"}, {"type": "stdin_stdout", "input": "-10000 10000 10000 -10000\n1000 1000\n-891 454\n-891 454\n", "output": "17933348.203209973872\n"}, {"type": "stdin_stdout", "input": "-10000 -10000 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer sequence A of length N and an integer K.\nYou will perform the following operation on this sequence Q times:\n - Choose a contiguous subsequence of length K, then remove the smallest element among... | [{"type": "stdin_stdout", "input": "2000 1161 195\n120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a team of N people. For a particular task, you can pick any non-empty subset of people. The cost of having x people for the task is x^{k}. \n\nOutput the sum of costs over all non-empty subsets of people.\n\n\n--... | [{"type": "stdin_stdout", "input": "1000000000 5000\n", "output": "642932262\n"}, {"type": "stdin_stdout", "input": "158260522 4575\n", "output": "875142289\n"}, {"type": "stdin_stdout", "input": "602436426 4445\n", "output": "582490088\n"}, {"type": "stdin_stdout", "input": "262703497 2202\n", "output": "813734619\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA never-ending, fast-changing and dream-like world unfolds, as the secret door opens.\n\nA world is an unordered graph G, in whose vertex set V(G) there are two special vertices s(G) and t(G). An initial world has vertex ... | [{"type": "stdin_stdout", "input": "33 22\n", "output": "804201731\n"}, {"type": "stdin_stdout", "input": "45 19\n", "output": "486112971\n"}, {"type": "stdin_stdout", "input": "48 20\n", "output": "804531912\n"}, {"type": "stdin_stdout", "input": "50 33\n", "output": "805999139\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side.\n\nPavel drew a grid m... | [{"type": "stdin_stdout", "input": "19 20 196\n###.....##.#..#..##.\n####............##..\n###....#..#.#....#.#\n##....###......#...#\n.####...#.....#.##..\n.###......#...#.#.#.\n...##.#...#..#..#...\n.....#.....#..#....#\n.#.....##..#........\n.##....#......#....#\n....#.......#.......\n......##..#........#\n......#.#... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there are n inflorescences, numbered from 1 to n. Inflorescence number 1 is situated n... | [{"type": "stdin_stdout", "input": "100\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDetermine if there exists a sequence obtained by permuting 1,2,...,N that satisfies the following conditions:\n - The length of its longest increasing subsequence is A.\n - The length of its longest decreasing subsequence... | [{"type": "stdin_stdout", "input": "273409 100000 100000\n", "output": "273409 100000 100000\n"}, {"type": "stdin_stdout", "input": "300000 150000 150001\n", "output": "300000 150000 150001\n"}, {"type": "stdin_stdout", "input": "253009 100000 100000\n", "output": "253009 100000 100000\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDima the hamster enjoys nibbling different things: cages, sticks, bad problemsetters and even trees!\n\nRecently he found a binary search tree and instinctively nibbled all of its edges, hence messing up the vertices. Dim... | [{"type": "stdin_stdout", "input": "36\n3 41 82 123 174 216 432 864 1080 1228 2149 4298 8596 11052 22104 33156 35919 71838 179595 359190 431028 862056 994680 1315440 1753920 3507840 7015680 10523520 21047040 26500200 53000400 106000800 132501000 176668000 353336000 530004000\n", "output": "Yes\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of positive integers a_1, a_2, ..., a_{n} × T of length n × T. We know that for any i > n it is true that a_{i} = a_{i} - n. Find the length of the longest non-decreasing sequence of the given array... | [{"type": "stdin_stdout", "input": "100 10000000\n300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 30... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSome time ago Mister B detected a strange signal from the space, which he started to study.\n\nAfter some transformation the signal turned out to be a permutation p of length n or its cyclic shift. For the further investi... | [{"type": "stdin_stdout", "input": "108\n1 102 33 99 6 83 4 20 61 100 76 71 44 9 24 87 57 2 81 82 90 85 12 30 66 53 47 36 43 29 31 64 96 84 77 23 93 78 58 68 42 55 13 70 62 19 92 14 10 65 63 75 91 48 11 105 37 50 32 94 18 26 52 89 104 106 86 97 80 95 17 72 40 22 79 103 25 101 35 51 15 98 67 5 34 69 54 27 45 88 56 16 46... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, the Fair Nut has written $k$ strings of length $n$, consisting of letters \"a\" and \"b\". He calculated $c$ — the number of strings that are prefixes of at least one of the written strings. Every string was cou... | [{"type": "stdin_stdout", "input": "100 1000000000\nbbabbaabbbaaaaabbabbbaaabbbbabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbaabbbbabaabbbabbaaaaabbbbaab\nbbabbaabbbaaaaabbabbbaaabbbbabbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaababbbabbbbaaaaabbaaaaaaaab\n", "output": "41073741883\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPeter had a cube with non-zero length of a side. He put the cube into three-dimensional space in such a way that its vertices lay at integer points (it is possible that the cube's sides are not parallel to the coordinate ... | [{"type": "stdin_stdout", "input": "-1000000 1000000 1000000\n-1000000 -1000000 -1000000\n-1000000 1000000 -1000000\n1000000 1000000 1000000\n1000000 -1000000 -1000000\n-1000000 1000000 1000000\n-1000000 -1000000 1000000\n1000000 1000000 -1000000\n", "output": "YES\n-1000000 1000000 1000000\n-1000000 -1000000 -1000000\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of $n$ integers. You need to split all integers into two groups so that the GCD of all integers in the first group is equal to one and the GCD of all integers in the second group is equal to one.\n\... | [{"type": "stdin_stdout", "input": "40\n299996490 299992830 49999865 299990010 299989770 299998110 19999942 299981910 299982990 299997210 299996670 299995890 299987790 299988030 299980110 299984430 299997870 299992170 299979510 299991390 299989110 299982030 299978670 299983890 299994690 299989590 149999865 299982570 29... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrew was very excited to participate in Olympiad of Metropolises. Days flew by quickly, and Andrew is already at the airport, ready to go home. He has $n$ rubles left, and would like to exchange them to euro and dollar ... | [{"type": "stdin_stdout", "input": "100000000\n30\n30\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "100000000\n31\n33\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "23456789\n66\n100\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "99999999\n90\n100\n", "output": "9\n"}, {"type": "stdin_st... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.