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\nРодители Васи хотят, чтобы он как можно лучше учился. Поэтому если он получает подряд три положительные оценки («четвёрки» или «пятёрки»), они дарят ему подарок. Соответственно, оценки «единица», «двойка» и «тройка» родит...
[{"type": "stdin_stdout", "input": "250\n4 4 2 5 1 5 5 4 5 4 4 4 4 4 4 5 5 4 4 5 4 5 1 5 5 4 1 5 5 4 5 5 4 4 4 4 5 4 4 5 5 5 5 5 4 5 4 5 5 4 5 4 4 4 4 4 4 5 5 4 5 5 1 4 4 4 5 1 5 3 4 5 4 4 4 4 4 5 5 4 4 4 4 4 5 4 5 5 5 4 4 5 4 4 4 5 5 5 5 4 5 4 5 4 5 5 5 5 4 4 4 4 5 5 5 5 5 5 4 4 3 4 4 5 5 3 5 4 4 4 4 4 4 5 5 5 4 5 4 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nValera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have ...
[{"type": "stdin_stdout", "input": "15\nrxeeeeeeeeeeeer\nereeeeeeeeeeere\needeeeeeeeeeoee\neeereeeeeeeewee\neeeereeeeebeeee\nqeeeereeejedyee\neeeeeerereeeeee\neeeeeeereeeeeee\neeeeeerereeeeze\neeeeereeereeeee\neeeereeeeegeeee\neeereeeeeeereee\neereeeeeeqeeved\ncreeeeeeceeeere\nreeerneeeeeeeer\n", "output": "NO\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice got an array of length $n$ as a birthday present once again! This is the third year in a row! \n\nAnd what is more disappointing, it is overwhelmengly boring, filled entirely with zeros. Bob decided to apply some ch...
[{"type": "stdin_stdout", "input": "5 12\n634 895\n143 730\n901 245\n386 486\n395 -111\n-469 -104\n-681 -623\n-900 843\n889 -883\n476 -304\n777 986\n206 -491\n", "output": "8107.800000000000182\n"}, {"type": "stdin_stdout", "input": "85 10\n-223 435\n-771 455\n72 -940\n490 -178\n400 -117\n169 -527\n836 610\n849 944\n57...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDevu being a small kid, likes to play a lot, but he only likes to play with arrays. While playing he came up with an interesting question which he could not solve, can you please solve it for him?\n\nGiven an array consis...
[{"type": "stdin_stdout", "input": "30 24 12\n459253071 24156 64054 270713791 734796619 379920883 429646748 332144982 20929 27685 53253 82047732 172442017 34241 880121331 890223629 974692 954036632 68638567 972921811 421106382 64615 819330514 179630214 608594496 802986133 231010377 184513476 73143 93045\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya is studying in the last class of school and soon he will take exams. He decided to study polynomials. Polynomial is a function P(x) = a_0 + a_1x^1 + ... + a_{n}x^{n}. Numbers a_{i} are called coefficients of a polyn...
[{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 1000000000000000000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1000000000000 1000000000000000 1000000000000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1 1000000000000000000 1000000000000000000\n", "output": "1\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter several latest reforms many tourists are planning to visit Berland, and Berland people understood that it's an opportunity to earn money and changed their jobs to attract tourists. Petya, for example, left the IT co...
[{"type": "stdin_stdout", "input": "70 203\n1 105\n1 105\n1 105\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 300\n3 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke has an integer sequence A of length N.\nHe will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E.\nThe positions of the cuts can be freely chosen.\nLet P,Q,R,S be the su...
[{"type": "stdin_stdout", "input": "5574\n150872158 2 6 1 3 8 10 4 9 3 5 2 10 2 8 4 2 3 10 8 4 3 1 8 3 5 8 3 7 3 10 7 4 6 1 1 8 10 1 1 10 9 7 9 1 3 7 7 8 6 7 8 6 10 5 2 1 2 2 2 6 10 3 6 6 2 8 1 9 3 6 8 10 10 5 1 8 4 5 1 6 2 7 7 5 3 6 10 6 9 2 9 9 10 1 10 9 10 5 3 10 8 6 10 2 3 1 7 2 7 2 5 8 7 10 3 10 4 1 2 2 1 2 9 2 3 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKsenia has ordinary pan scales and several weights of an equal mass. Ksenia has already put some weights on the scales, while other weights are untouched. Ksenia is now wondering whether it is possible to put all the rema...
[{"type": "stdin_stdout", "input": "CKQHRUZMISGE|FBVWPXDLTJYN\nOA\n", "output": "CKQHRUZMISGEA|FBVWPXDLTJYNO\n"}, {"type": "stdin_stdout", "input": "V|CMOEUTAXBFWSK\nDLRZJGIYNQHP\n", "output": "VDLRZJGIYNQHP|CMOEUTAXBFWSK\n"}, {"type": "stdin_stdout", "input": "QWHNMALDGKTJ|\nPBRYVXZUESCOIF\n", "output": "QWHNMALDGKTJF...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSoon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called \"chizhik\". One has to pay in chizhiks to buy a coco...
[{"type": "stdin_stdout", "input": "500000000000000000 500000000000000000 1000000000000000000\n", "output": "1 500000000000000000\n"}, {"type": "stdin_stdout", "input": "582426543750017 789023129080207 4395672028302\n", "output": "312 2197836014149\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 10000000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLong time ago Alex created an interesting problem about parallelogram. The input data for this problem contained four integer points on the Cartesian plane, that defined the set of vertices of some non-degenerate (positiv...
[{"type": "stdin_stdout", "input": "1000 1000\n-1000 -1000\n-1000 1000\n", "output": "3\n1000 -1000\n1000 3000\n-3000 -1000\n"}, {"type": "stdin_stdout", "input": "-1000 1000\n1000 -1000\n-1000 -1000\n", "output": "3\n1000 1000\n-3000 1000\n1000 -3000\n"}, {"type": "stdin_stdout", "input": "1000 1000\n999 1000\n-1000 -...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarpus has been working in the analytic department of the \"F.R.A.U.D.\" company for as much as n days. Right now his task is to make a series of reports about the company's performance for the last n days. We know th...
[{"type": "stdin_stdout", "input": "12\n1 -12 -5 -8 0 -8 -1 -1 -6 12 -9 12\n", "output": "4\n3 3 2 4 "}, {"type": "stdin_stdout", "input": "10\n-2 -4 -1 -6 -5 -5 -7 0 -7 -8\n", "output": "5\n1 2 2 2 3 "}, {"type": "stdin_stdout", "input": "10\n6 5 -10 -4 -3 -7 5 -2 -6 -10\n", "output": "4\n3 2 3 2 "}, {"type": "stdin_s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFriends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a_1 percent and second one is charged at a_2 percent. You can connect charger to a joystick ...
[{"type": "stdin_stdout", "input": "100 100\n", "output": "197\n"}, {"type": "stdin_stdout", "input": "100 25\n", "output": "122\n"}, {"type": "stdin_stdout", "input": "59 45\n", "output": "102\n"}, {"type": "stdin_stdout", "input": "85 73\n", "output": "155\n"}, {"type": "stdin_stdout", "input": "1 100\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEvery superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.\n\nInitially, there are $n$ ...
[{"type": "stdin_stdout", "input": "9 48096 5475634\n28248 27808 75072 58867 37890 95515 26685 68307 40390\n", "output": "143611.00000000000000000000\n"}, {"type": "stdin_stdout", "input": "9 29221 2106895\n82089 18673 2890 99009 89855 30685 39232 82330 30021\n", "output": "128230.00000000000000000000\n"}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a positive integer n let's define a function f:\n\nf(n) = - 1 + 2 - 3 + .. + ( - 1)^{n}n \n\nYour task is to calculate f(n) for a given integer n.\n\n\n-----Input-----\n\nThe single line contains the positive integer...
[{"type": "stdin_stdout", "input": "1000000000000000\n", "output": "500000000000000\n"}, {"type": "stdin_stdout", "input": "999999999999999\n", "output": "-500000000000000\n"}, {"type": "stdin_stdout", "input": "208170109961052\n", "output": "104085054980526\n"}, {"type": "stdin_stdout", "input": "99999999999999\n", "o...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $s$ consisting of $n$ lowercase Latin letters.\n\nYou have to remove at most one (i.e. zero or one) character of this string in such a way that the string you obtain will be lexicographically smalle...
[{"type": "stdin_stdout", "input": "26\nlolthisiscoolfreehackforya\n", "output": "llthisiscoolfreehackforya\n"}, {"type": "stdin_stdout", "input": "18\nfjwhrwehrjwhjewhrr\n", "output": "fjhrwehrjwhjewhrr\n"}, {"type": "stdin_stdout", "input": "10\naaaaaaaaab\n", "output": "aaaaaaaaa\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMr Keks is a typical white-collar in Byteland.\n\nHe has a bookshelf in his office with some books on it, each book has an integer positive price.\n\nMr Keks defines the value of a shelf as the sum of books prices on it. ...
[{"type": "stdin_stdout", "input": "30 4\n893642632982367 772277951746295 510759449350295 826812150840579 1060893142351815 525992742241552 154832018679993 645715002371268 27232975419720 475004229372388 200177708355593 810661468479466 49618609534806 301608930846726 97042172725806 441637617418914 594900693592862 62651070...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA 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.\n\nThe to...
[{"type": "stdin_stdout", "input": "50\n31 80 40 85 12 38 30 97 51 18 45 81 56 82 91 94 95 13 26 93 98 35 44 69 98 39 83 77 38 68 13 71 80 41 21 80 81 17 88 46 61 67 65 49 29 55 37 74 88\n71 8 42 74 14 70 100 96 25 56 95 38 41 88 45 43 46 16 55 77 100 68 51 30 73 51 25 88 64 26 22 50 4 57 88 85 45 32 11 96 94 19 9 12 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are times you recall a good old friend and everything you've come through together. Luckily there are social networks — they store all your message history making it easy to know what you argued over 10 years ago.\n...
[{"type": "stdin_stdout", "input": "100 5\n0 1 1 1 0 5 6 6 8 8 9 11 12 11 8 0 0 14 6 16 7 21 15 23 15 24 0 0 0 28 0 29 26 27 19 0 0 21 37 32 40 30 37 34 39 38 34 38 0 0 41 24 45 47 0 33 46 26 31 0 21 57 57 31 63 63 25 59 65 56 68 0 30 55 55 0 70 43 59 49 59 79 66 74 0 11 65 0 80 63 0 84 73 49 73 81 0 86 76 98\n", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a given array $a$ consisting of $n$ integers and a given integer $m$ find if it is possible to reorder elements of the array $a$ in such a way that $\\sum_{i=1}^{n}{\\sum_{j=i}^{n}{\\frac{a_j}{j}}}$ equals $m$? It is ...
[{"type": "stdin_stdout", "input": "5\n4 10\n5 5 5 5\n3 5\n5 5 5\n3 4\n10 1 1\n4 5\n5 5 5 5\n5 5\n5 5 5 5 5\n", "output": "NO\nNO\nNO\nNO\nNO\n"}, {"type": "stdin_stdout", "input": "2\n4 5\n5 5 5 5\n6 3\n3 3 3 3 3 3\n", "output": "NO\nNO\n"}, {"type": "stdin_stdout", "input": "2\n3 18\n3 3 3\n4 26\n10 10 2 4\n", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOrac is studying number theory, and he is interested in the properties of divisors.\n\nFor two positive integers $a$ and $b$, $a$ is a divisor of $b$ if and only if there exists an integer $c$, such that $a\\cdot c=b$.\n\...
[{"type": "stdin_stdout", "input": "5\n497347 19283\n2568 1000000000\n499979 123987\n93 19\n13 5\n", "output": "536584\n2000002568\n1247930\n132\n34\n"}, {"type": "stdin_stdout", "input": "1\n999995 1000000000\n", "output": "2000999998\n"}, {"type": "stdin_stdout", "input": "1\n999991 999999999\n", "output": "200100000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's call an undirected graph $G = (V, E)$ relatively prime if and only if for each edge $(v, u) \\in E$  $GCD(v, u) = 1$ (the greatest common divisor of $v$ and $u$ is $1$). If there is no edge between some pair of vert...
[{"type": "stdin_stdout", "input": "10 31\n", "output": "Possible\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 8\n8 9\n9 10\n1 3\n1 4\n1 5\n2 5\n3 5\n1 6\n1 7\n2 7\n3 7\n4 7\n5 7\n1 8\n3 8\n5 8\n1 9\n2 9\n4 9\n5 9\n7 9\n1 10\n3 10\n7 10\n"}, {"type": "stdin_stdout", "input": "5 6\n", "output": "Possible\n1 2\n2 3\n3 4\n4 5\n1 3\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn a far away land, there are two cities near a river. One day, the cities decide that they have too little space and would like to reclaim some of the river area into land.\n\nThe river area can be represented by a grid ...
[{"type": "stdin_stdout", "input": "100 44\n41 1\n13 1\n52 1\n83 1\n64 2\n86 2\n12 1\n77 1\n100 2\n97 2\n58 1\n33 2\n8 1\n72 2\n2 1\n88 1\n50 2\n4 1\n18 1\n36 2\n46 2\n57 1\n29 2\n22 1\n75 2\n44 2\n80 2\n84 1\n62 1\n42 1\n94 1\n96 2\n31 2\n45 2\n10 2\n17 1\n5 1\n53 1\n98 2\n21 1\n82 1\n15 1\n68 2\n91 1\n", "output": "W...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice 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.\n\nIn the city in which Alice and Bob live, the first metro line is being built. This metro ...
[{"type": "stdin_stdout", "input": "10 10\n1 0 0 0 0 0 0 0 0 1\n0 0 0 0 0 0 0 0 0 0\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10 2\n1 0 0 1 0 1 1 0 1 1\n1 1 1 0 1 0 0 1 0 1\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10 3\n1 0 0 1 0 0 0 1 1 0\n1 1 1 1 0 0 1 0 0 1\n", "output": "YES\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a ...
[{"type": "stdin_stdout", "input": "100\n1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "50\n0 0 0 0 0 1 1 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is constraints.\n\nA session has begun at Beland State University. Many students are taking exams.\n\nPolygraph Poligrafovich is going to examine a group of $n$ students....
[{"type": "stdin_stdout", "input": "100 100\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go.\n\nDr. Evil is interested in sets, He has ...
[{"type": "stdin_stdout", "input": "100 100\n58 88 12 71 22 1 40 19 73 20 67 48 57 17 69 36 100 35 33 37 72 55 52 8 89 85 47 42 78 70 81 86 11 9 68 99 6 16 21 61 53 98 23 62 32 59 51 0 87 24 50 30 65 10 80 95 7 92 25 74 60 79 91 5 13 31 75 38 90 94 46 66 93 34 14 41 28 2 76 84 43 96 3 56 49 82 27 77 64 63 4 45 18 29 54...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo players are playing a game. First each of them writes an integer from 1 to 6, and then a dice is thrown. The player whose written number got closer to the number on the dice wins. If both payers have the same differen...
[{"type": "stdin_stdout", "input": "2 5\n", "output": "3 0 3\n"}, {"type": "stdin_stdout", "input": "2 4\n", "output": "2 1 3\n"}, {"type": "stdin_stdout", "input": "5 3\n", "output": "2 1 3\n"}, {"type": "stdin_stdout", "input": "1 6\n", "output": "3 0 3\n"}, {"type": "stdin_stdout", "input": "5 1\n", "output": "3 1 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday is Wednesday, the third day of the week. What's more interesting is that tomorrow is the last day of the year 2015.\n\nLimak is a little polar bear. He enjoyed this year a lot. Now, he is so eager to the coming year...
[{"type": "stdin_stdout", "input": "30 of month\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "17 of month\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "10 of month\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "11 of month\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "12 o...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one...
[{"type": "stdin_stdout", "input": "500 50\n72 474 467 241 442 437 336 234 410 120 438 164 405 177 142 114 27 20 445 235 46 176 88 488 242 391 28 414 145 92 206 334 152 343 367 254 100 243 155 348 148 450 461 483 97 34 471 69 416 362\n", "output": "NO"}, {"type": "stdin_stdout", "input": "50 40\n14 27 19 30 31 20 28 11...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x have been successful. Thus, your current success rate on Codeforces is equal ...
[{"type": "stdin_stdout", "input": "5\n99999997 999999998 999999998 999999999\n99999996 999999997 999999997 999999999\n99999997 999999998 999999998 999999999\n99999996 999999997 999999997 999999999\n99999997 999999998 999999998 999999999\n", "output": "899999999100000001\n449999999550000002\n899999999100000001\n4499999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a function $f$ written in some basic language. The function accepts an integer value, which is immediately written into some variable $x$. $x$ is an integer variable and can be assigned values from $0$ to $2...
[{"type": "stdin_stdout", "input": "83\nadd\nfor 58\nend\nadd\nadd\nfor 36\nfor 84\nadd\nadd\nfor 86\nadd\nadd\nend\nend\nadd\nadd\nadd\nadd\nfor 23\nadd\nadd\nadd\nfor 70\nadd\nadd\nend\nfor 24\nfor 58\nend\nadd\nend\nend\nend\nfor 41\nfor 51\nend\nfor 22\nfor 39\nend\nfor 94\nfor 47\nadd\nfor 57\nend\nadd\nend\nfor 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour friend has n cards.\n\nYou know that each card has a lowercase English letter on one side and a digit on the other.\n\nCurrently, your friend has laid out the cards on a table so only one side of each card is visible...
[{"type": "stdin_stdout", "input": "01234567890123456789012345678901234567890123456789\n", "output": "25\n"}, {"type": "stdin_stdout", "input": "qwertyuioplkjhgfdsazxcvbnmqwertyuioplkjhgfdsazxcvb\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "kaq7jyialrfp4ilkni90eq8v3amcbygon7py0hb8z26fbl8ss1\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ detachments on the surface, numbered from $1$ to $n$, the $i$-th detachment is placed in a point with coordinates $(x_i, y_i)$. All detachments are placed in different points.\n\nBrimstone should visit each ...
[{"type": "stdin_stdout", "input": "23\n-1000000000 -964752353\n-967012509 -1000000000\n34021744 1000000000\n-931956512 -34021744\n-1034253 967204159\n-1034253 -34021744\n-1034253 -1000000000\n-931956512 -1000000000\n-967012509 1000000000\n964944003 1225903\n1000000000 1225903\n-967012509 1225903\n-1034253 -964752353\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne fine October day a mathematics teacher Vasily Petrov went to a class and saw there n pupils who sat at the $\\frac{n}{2}$ desks, two people at each desk. Vasily quickly realized that number n is even. Like all true ma...
[{"type": "stdin_stdout", "input": "74\nRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\n", "output": "1 38\n2 39\n3 40\n4 41\n5 42\n6 43\n7 44\n8 45\n9 46\n10 47\n11 48\n12 49\n13 50\n14 51\n15 52\n16 53\n17 54\n18 55\n19 56\n20 57\n21 58\n22 59\n23 60\n24 61\n25 62\n26 63\n27 64\n28 65\n29 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOkabe needs bananas for one of his experiments for some strange reason. So he decides to go to the forest and cut banana trees.\n\nConsider the point (x, y) in the 2D plane such that x and y are integers and 0 ≤ x, y. The...
[{"type": "stdin_stdout", "input": "1000 10000\n", "output": "74133360011484445\n"}, {"type": "stdin_stdout", "input": "859 8096\n", "output": "29032056230649780\n"}, {"type": "stdin_stdout", "input": "539 9221\n", "output": "16893595018603386\n"}, {"type": "stdin_stdout", "input": "918 7704\n", "output": "285697273391...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne tradition of welcoming the New Year is launching fireworks into the sky. Usually a launched firework flies vertically upward for some period of time, then explodes, splitting into several parts flying in different dir...
[{"type": "stdin_stdout", "input": "30\n1 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\n", "output": "43348\n"}, {"type": "stdin_stdout", "input": "30\n5 5 1 1 4 4 3 1 5 3 5 5 1 2 2 3 4 5 2 1 4 3 1 1 4 5 4 4 2 2\n", "output": "24339\n"}, {"type": "stdin_stdout", "input": "30\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
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": "ALKALINITY\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "UNSCRAMBLE\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "APRILFOOL\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "SOURPUSS\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "VITALIZE\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given n points on a plane. All the points are distinct and no three of them lie on the same line. Find the number of parallelograms with the vertices at the given points.\n\n\n-----Input-----\n\nThe first line of ...
[{"type": "stdin_stdout", "input": "20\n0 17\n1 8\n1 9\n2 5\n2 11\n3 0\n5 10\n5 13\n6 7\n7 3\n12 13\n13 7\n14 16\n15 10\n15 18\n17 2\n17 12\n18 14\n19 18\n20 17\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "10\n2 14\n5 9\n10 16\n12 5\n16 19\n26 23\n30 37\n32 26\n37 33\n40 28\n", "output": "10\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAmugae has a hotel consisting of $10$ rooms. The rooms are numbered from $0$ to $9$ from left to right.\n\nThe hotel has two entrances — one from the left end, and another from the right end. When a customer arrives to th...
[{"type": "stdin_stdout", "input": "100\nR9L0L0R9R9L0R9R9L0R9R9R9L0R9R9R9L0L0R9L0R9L0L0L0R9R9L0R9L0R9R9L0R9R9L0R9L0L0R9R9R9L0L0L0L0R9L0L0L0L0\n", "output": "0000000000"}, {"type": "stdin_stdout", "input": "100\nRRLRRLRRLR2L0R6R2L1L3R4L0L6L2L2R5R6R1R3L6R6R8L6L4L3L6R9L6L9L8L7R7L8R1R1R7R7L2L8L2L1R8R2R8L76RR9R4R3R\n", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNeko is playing with his toys on the backyard of Aki's house. Aki decided to play a prank on him, by secretly putting catnip into Neko's toys. Unfortunately, he went overboard and put an entire bag of catnip into the toys...
[{"type": "stdin_stdout", "input": "1000\n", "output": "143886430\n"}, {"type": "stdin_stdout", "input": "450\n", "output": "690479399\n"}, {"type": "stdin_stdout", "input": "999\n", "output": "742390865\n"}, {"type": "stdin_stdout", "input": "900\n", "output": "454329300\n"}, {"type": "stdin_stdout", "input": "500\n",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn a chessboard with a width of $n$ and a height of $n$, rows are numbered from bottom to top from $1$ to $n$, columns are numbered from left to right from $1$ to $n$. Therefore, for each cell of the chessboard, you can a...
[{"type": "stdin_stdout", "input": "1000000000000000000\n1000000000000000000 1000000000000000000\n", "output": "Black"}, {"type": "stdin_stdout", "input": "1000000000000000000\n500000000000000001 500000000000000001\n", "output": "Black"}, {"type": "stdin_stdout", "input": "839105509657869903\n591153401407154876 2587549...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe winter in Berland lasts n days. For each day we know the forecast for the average air temperature that day. \n\nVasya has a new set of winter tires which allows him to drive safely no more than k days at any average a...
[{"type": "stdin_stdout", "input": "100 50\n-7 -3 9 2 16 -19 0 -10 3 -11 17 7 -7 -10 -14 -14 -7 -15 -15 -8 8 -18 -17 -5 -19 -15 -14 0 8 -3 -19 -13 -3 11 -3 -16 16 -16 -12 -2 -17 7 -16 -14 -10 0 -10 -18 -16 -11 -2 -12 -15 -8 -1 -11 -3 -17 -14 -6 -9 -15 -14 -11 -20 -20 -4 -20 -8 -2 0 -2 -20 17 -17 2 0 1 2 6 -5 -13 -16 -5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDuring the winter holidays, the demand for Christmas balls is exceptionally high. Since it's already 2018, the advances in alchemy allow easy and efficient ball creation by utilizing magic crystals.\n\nGrisha needs to obt...
[{"type": "stdin_stdout", "input": "1000000000 1000000000\n1000000000 1000000000 1000000000\n", "output": "5000000000\n"}, {"type": "stdin_stdout", "input": "626115781 966381948\n395190569 820194184 229233367\n", "output": "1525971878\n"}, {"type": "stdin_stdout", "input": "803372962 103701834\n394260597 837711458 6231...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAnd while Mishka is enjoying her trip...\n\nChris is a little brown bear. No one knows, where and when he met Mishka, but for a long time they are together (excluding her current trip). However, best friends are important...
[{"type": "stdin_stdout", "input": "10 1000 505 223\n1564 401\n1689 158\n2078 1\n2428 168\n2477 767\n2424 836\n1929 984\n1906 978\n1764 907\n1723 875\n", "output": "8.5946721130"}, {"type": "stdin_stdout", "input": "10 1000 10 2\n2731 286\n3154 1\n3590 210\n3674 406\n3667 625\n3546 844\n3275 991\n3154 999\n2771 783\n27...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the arr...
[{"type": "stdin_stdout", "input": "4\n562617869 961148050 596819899 951133776\n", "output": "1 2\n"}, {"type": "stdin_stdout", "input": "4\n562617869 596819899 951133776 961148050\n", "output": "1 2\n"}, {"type": "stdin_stdout", "input": "4\n961148050 951133776 596819899 562617869\n", "output": "1 2\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConstruct a sequence a = {a_1,\\ a_2,\\ ...,\\ a_{2^{M + 1}}} of length 2^{M + 1} that satisfies the following conditions, if such a sequence exists.\n - Each integer between 0 and 2^M - 1 (inclusive) occurs twice in a.\n...
[{"type": "stdin_stdout", "input": "17 1000000000\n", "output": ""}, {"type": "stdin_stdout", "input": "0 1000000000\n", "output": ""}, {"type": "stdin_stdout", "input": "1 1000000000\n", "output": ""}, {"type": "stdin_stdout", "input": "2 1000000000\n", "output": ""}, {"type": "stdin_stdout", "input": "14 894437032\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlex, Bob and Carl will soon participate in a team chess tournament. Since they are all in the same team, they have decided to practise really hard before the tournament. But it's a bit difficult for them because chess is...
[{"type": "stdin_stdout", "input": "100\n2\n3\n1\n2\n3\n3\n3\n1\n1\n1\n1\n3\n3\n3\n3\n1\n2\n3\n3\n3\n3\n3\n3\n3\n1\n2\n2\n2\n3\n1\n1\n3\n3\n3\n3\n3\n3\n3\n3\n1\n2\n3\n3\n3\n1\n1\n1\n1\n3\n3\n3\n3\n1\n2\n3\n1\n2\n2\n2\n3\n3\n2\n1\n3\n3\n1\n2\n3\n1\n1\n1\n2\n2\n2\n3\n1\n1\n1\n1\n1\n1\n3\n2\n2\n2\n2\n2\n2\n3\n1\n2\n2\n2\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAmr loves Geometry. One day he came up with a very interesting problem.\n\nAmr has a circle of radius r and center in point (x, y). He wants the circle center to be in new position (x', y').\n\nIn one step Amr can put a p...
[{"type": "stdin_stdout", "input": "100000 -100000 -100000 100000 100000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1 100000 100000 100000 -100000\n", "output": "100000\n"}, {"type": "stdin_stdout", "input": "249 -54242 -30537 -45023 -89682\n", "output": "121\n"}, {"type": "stdin_stdout", "input": "67377 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNew Year is coming! Vasya has prepared a New Year's verse and wants to recite it in front of Santa Claus.\n\nVasya's verse contains $n$ parts. It takes $a_i$ seconds to recite the $i$-th part. Vasya can't change the order...
[{"type": "stdin_stdout", "input": "1\n50 1\n2 1 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider the infinite sequence of integers: 1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5.... The sequence is built in the following way: at first the number 1 is written out, then the numbers from 1 to 2, then the numbers ...
[{"type": "stdin_stdout", "input": "100000000000000\n", "output": "1749820\n"}, {"type": "stdin_stdout", "input": "99999998250180\n", "output": "14142135\n"}, {"type": "stdin_stdout", "input": "999999911791\n", "output": "1414213\n"}, {"type": "stdin_stdout", "input": "1000000000000\n", "output": "88209\n"}, {"type": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a complete undirected graph. For each pair of vertices you are given the length of the edge that connects them. Find the shortest paths between each pair of vertices in the graph and return the length of the...
[{"type": "stdin_stdout", "input": "10\n0 1 100 100 100 100 100 100 100 100\n1 0 1 100 100 100 100 100 100 100\n100 1 0 1 100 100 100 100 100 100\n100 100 1 0 1 100 100 100 100 100\n100 100 100 1 0 1 100 100 100 100\n100 100 100 100 1 0 1 100 100 100\n100 100 100 100 100 1 0 1 100 100\n100 100 100 100 100 100 1 0 1 100...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp studies at the university in the group which consists of n students (including himself). All they are registrated in the social net \"TheContacnt!\".\n\nNot all students are equally sociable. About each student y...
[{"type": "stdin_stdout", "input": "65\n3 0 0 0 0 3 0 0 0 0 0 4 2 0 0 0 0 0 0 0 0 8 0 0 0 0 0 6 7 0 3 0 0 0 0 4 0 3 0 0 0 0 1 0 0 5 0 0 0 0 3 0 0 4 0 0 0 0 0 1 0 0 0 0 7\n", "output": "64\n1 22\n1 29\n1 65\n22 28\n22 46\n22 12\n22 36\n22 54\n22 6\n22 31\n22 38\n29 51\n29 13\n29 43\n29 60\n29 2\n29 3\n29 4\n65 5\n65 7\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a consisting of n integers, and additionally an integer m. You have to choose some sequence of indices b_1, b_2, ..., b_{k} (1 ≤ b_1 < b_2 < ... < b_{k} ≤ n) in such a way that the value of $\\sum_{...
[{"type": "stdin_stdout", "input": "35 1000000000\n723631245 190720106 931659134 503095294 874181352 712517040 800614682 904895364 256863800 39366772 763190862 770183843 774794919 55669976 329106527 513566505 207828535 258356470 816288168 657823769 5223226 865258331 655737365 278677545 880429272 718852999 810522025 229...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem we consider a very simplified model of Barcelona city.\n\nBarcelona can be represented as a plane with streets of kind $x = c$ and $y = c$ for every integer $c$ (that is, the rectangular grid). However, th...
[{"type": "stdin_stdout", "input": "664808710 -309024147 997224520\n-417682067 -256154660 -762795849 -292925742\n", "output": "381884864.0000000000\n"}, {"type": "stdin_stdout", "input": "912738218 530309782 -939253776\n592805323 -930297022 -567581994 -829432319\n", "output": "1218437463.3854324267\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEvery year, hundreds of people come to summer camps, they learn new algorithms and solve hard problems.\n\nThis is your first year at summer camp, and you are asked to solve the following problem. All integers starting wi...
[{"type": "stdin_stdout", "input": "1000\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "999\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "100\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "123\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "157\n", "output": "3\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLast week, Hamed learned about a new type of equations in his math class called Modular Equations. Lets define i modulo j as the remainder of division of i by j and denote it by $i \\operatorname{mod} j$. A Modular Equati...
[{"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "infinity\n"}, {"type": "stdin_stdout", "input": "1000000000 333333300\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "772930485 686893955\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "295138437 589952171\n", "output": "0\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJohny likes numbers n and k very much. Now Johny wants to find the smallest integer x greater than n, so it is divisible by the number k.\n\n\n-----Input-----\n\nThe only line contains two integers n and k (1 ≤ n, k ≤ 10^...
[{"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "2000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 999999999\n", "output": "1999999998\n"}, {"type": "stdin_stdout", "input": "999999999 1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 999999997\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA substring of some string is called the most frequent, if the number of its occurrences is not less than number of occurrences of any other substring.\n\nYou are given a set of strings. A string (not necessarily from thi...
[{"type": "stdin_stdout", "input": "76\namnctposz\nmnctpos\nos\nu\ne\nam\namnc\neamnctpo\nl\nx\nq\nposzq\neamnc\nctposzq\nctpos\nmnc\ntpos\namnctposzql\ntposzq\nmnctposz\nnctpos\nctposzql\namnctpos\nmnct\np\nux\nposzql\ntpo\nmnctposzql\nmnctp\neamnctpos\namnct\ntposzql\nposz\nz\nct\namnctpo\noszq\neamnct\ntposz\ns\nmn\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAnya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for exactly t seconds. It takes...
[{"type": "stdin_stdout", "input": "138 245 30\n3 5 6 8 9 13 15 16 19 20 24 25 27 29 30 32 33 34 35 36 37 38 40 42 47 51 52 53 55 56 58 59 63 66 67 68 69 72 73 74 75 77 78 80 81 82 85 86 87 89 91 93 95 96 99 100 102 104 105 108 110 111 112 117 122 124 125 128 129 131 133 136 139 144 145 146 147 148 149 151 153 155 156 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is an old tradition of keeping 4 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By definition, for a set {x_1, x_...
[{"type": "stdin_stdout", "input": "1\n500\n", "output": "YES\n500\n1500\n1500\n"}, {"type": "stdin_stdout", "input": "2\n500\n497\n", "output": "YES\n1491\n1488\n"}, {"type": "stdin_stdout", "input": "1\n125\n", "output": "YES\n125\n375\n375\n"}, {"type": "stdin_stdout", "input": "1\n190\n", "output": "YES\n190\n570\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given $q$ queries in the following form:\n\nGiven three integers $l_i$, $r_i$ and $d_i$, find minimum positive integer $x_i$ such that it is divisible by $d_i$ and it does not belong to the segment $[l_i, r_i]$.\n...
[{"type": "stdin_stdout", "input": "30\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 100000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHAI\n\nI HAS A TUX\n\nGIMMEH TUX\n\nI HAS A FOO ITS 0\n\nI HAS A BAR ITS 0\n\nI HAS A BAZ ITS 0\n\nI HAS A QUZ ITS 1\n\nTUX IS NOW A NUMBR\n\nIM IN YR LOOP NERFIN YR TUX TIL BOTH SAEM TUX AN 0\n\nI HAS A PUR\n\nGIMMEH PUR...
[{"type": "stdin_stdout", "input": "9\n0\n0\n0\n0\n0\n0\n0\n0\n1\n", "output": "0.111111\n"}, {"type": "stdin_stdout", "input": "9\n0\n0\n1\n0\n0\n0\n0\n0\n1\n", "output": "0.333333\n"}, {"type": "stdin_stdout", "input": "8\n0\n1\n1\n1\n1\n1\n0\n0\n", "output": "0.833333\n"}, {"type": "stdin_stdout", "input": "9\n0\n1\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen the curtains are opened, a canvas unfolds outside. Kanno marvels at all the blonde colours along the riverside — not tangerines, but blossoms instead.\n\n\"What a pity it's already late spring,\" sighs Mino with regr...
[{"type": "stdin_stdout", "input": ".CAACCBBA.CBB.AC..BABCCBCCB..B.BC..CBC.CA.CC.C.CC.B.A.CC.BBCCBB..ACAACAC.CBCCB.AABAAC.CBCC.BA..CCBC.\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "CC.AAAC.BA.BBB.AABABBCCAA.A.CBCCB.B.BC.ABCBCBBAA.CACA.CCCA.CB.CCB.A.BCCCB...C.A.BCCBC..B.ABABB.C.BCB\n", "output": "Yes\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Squareland national forest is divided into equal $1 \\times 1$ square plots aligned with north-south and east-west directions. Each plot can be uniquely described by integer Cartesian coordinates $(x, y)$ of its south...
[{"type": "stdin_stdout", "input": "1 0\n0 1\n10 10\n", "output": "21\n0 1\n1 0\n1 1\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n1 9\n1 10\n2 10\n3 10\n4 10\n5 10\n6 10\n7 10\n8 10\n9 10\n10 10\n"}, {"type": "stdin_stdout", "input": "0 0\n5 0\n0 6\n", "output": "12\n0 0\n0 1\n0 2\n0 3\n0 4\n0 5\n0 6\n1 0\n2 0\n3 0\n4 0\n5 0\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organized into an 8 × 8 table. A...
[{"type": "stdin_stdout", "input": "4 3 1 6\n", "output": "2 1 3\n"}, {"type": "stdin_stdout", "input": "5 5 5 6\n", "output": "1 0 1\n"}, {"type": "stdin_stdout", "input": "1 1 8 8\n", "output": "2 1 7\n"}, {"type": "stdin_stdout", "input": "1 1 8 1\n", "output": "1 0 7\n"}, {"type": "stdin_stdout", "input": "1 1 1 8\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n-----Input-----\n\nThe input contains a single integer a (0 ≤ a ≤ 35).\n\n\n-----Output-----\n\nOutput a single integer.\n\n\n-----Examples-----\nInput\n3\n\nOutput\n8\n\nInput\n10\n\nOutput\n1024\n\nThe input will be std...
[{"type": "stdin_stdout", "input": "35\n", "output": "33940307968\n"}, {"type": "stdin_stdout", "input": "34\n", "output": "16970153984\n"}, {"type": "stdin_stdout", "input": "30\n", "output": "1060634624\n"}, {"type": "stdin_stdout", "input": "31\n", "output": "2121269248\n"}, {"type": "stdin_stdout", "input": "32\n",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIchihime is the current priestess of the Mahjong Soul Temple. She claims to be human, despite her cat ears.\n\nThese days the temple is holding a math contest. Usually, Ichihime lacks interest in these things, but this ti...
[{"type": "stdin_stdout", "input": "14\n2374453 2374454 8591131 23094546\n5813291 5813292 9709163 35032815\n4280399 23049698 23049701 34728360\n15184184 18688462 22400847 22400849\n24397371 31462070 33936330 33936331\n21376685 28241116 38909200 38909202\n29491847 31628480 31628482 45225214\n15144763 15414479 36902879 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA plane is flying at a constant height of $h$ meters above the ground surface. Let's consider that it is flying from the point $(-10^9, h)$ to the point $(10^9, h)$ parallel with $Ox$ axis.\n\nA glider is inside the plane...
[{"type": "stdin_stdout", "input": "2 1000000000\n226784468 315989706\n496707105 621587047\n", "output": "1214085180\n"}, {"type": "stdin_stdout", "input": "2 1000000000\n227369287 404867892\n744314358 920400305\n", "output": "1353584552\n"}, {"type": "stdin_stdout", "input": "2 1000000000\n317863203 547966061\n5829513...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers $x$ and $y$ (it is guaranteed that $x > y$). You may choose any prime integer $p$ and subtract it any number of times from $x$. Is it possible to make $x$ equal to $y$?\n\nRecall that a prime nu...
[{"type": "stdin_stdout", "input": "69\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKolya is very absent-minded. Today his math teacher asked him to solve a simple problem with the equation $a + 1 = b$ with positive integers $a$ and $b$, but Kolya forgot the numbers $a$ and $b$. He does, however, remembe...
[{"type": "stdin_stdout", "input": "4 4\n", "output": "40 41\n"}, {"type": "stdin_stdout", "input": "1 1\n", "output": "10 11\n"}, {"type": "stdin_stdout", "input": "9 9\n", "output": "90 91\n"}, {"type": "stdin_stdout", "input": "3 3\n", "output": "30 31\n"}, {"type": "stdin_stdout", "input": "8 8\n", "output": "80 81...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDo you remember how Kai constructed the word \"eternity\" using pieces of ice as components?\n\nLittle Sheldon plays with pieces of ice, each piece has exactly one digit between 0 and 9. He wants to construct his favourit...
[{"type": "stdin_stdout", "input": "2569\n09629965966225566262579565696595696954525955599926383255926955906666526913925296256629966292216925259225261263256229509529259756291959568892569599592218262625256926619266669279659295979299556965525222\n", "output": "44\n"}, {"type": "stdin_stdout", "input": "2559\n5255599526926...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given $n$ strings $s_1, s_2, \\ldots, s_n$ consisting of lowercase Latin letters.\n\nIn one operation you can remove a character from a string $s_i$ and insert it to an arbitrary position in a string $s_j$ ($j$ ma...
[{"type": "stdin_stdout", "input": "4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc\n", "output": "YES\nNO\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "1\n3\nabc\nabc\nabcdddd\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1\n3\ncaac\ncbbb\naaac\n", "output": "NO\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count using a Soroban — an abacus d...
[{"type": "stdin_stdout", "input": "123456789\n", "output": "-O|OOOO-\n-O|OOO-O\n-O|OO-OO\n-O|O-OOO\n-O|-OOOO\nO-|OOOO-\nO-|OOO-O\nO-|OO-OO\nO-|O-OOO\n"}, {"type": "stdin_stdout", "input": "234567890\n", "output": "O-|-OOOO\n-O|OOOO-\n-O|OOO-O\n-O|OO-OO\n-O|O-OOO\n-O|-OOOO\nO-|OOOO-\nO-|OOO-O\nO-|OO-OO\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMahmoud and Ehab are on the third stage of their adventures now. As you know, Dr. Evil likes sets. This time he won't show them any set from his large collection, but will ask them to create a new set to replenish his bea...
[{"type": "stdin_stdout", "input": "32 32\n", "output": "YES\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 131072 131105 0 \n"}, {"type": "stdin_stdout", "input": "32 31\n", "output": "YES\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 131072 131102 0 \n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBtoh yuo adn yuor roomatme lhoate wianshg disehs, btu stlil sdmoeboy msut peorrfm tihs cohre dialy. Oen dya yuo decdie to idourtcne smoe syestm. Yuor rmmotaoe sstgegus teh fooniwllg dael. Yuo argee on tow arayrs of ientgr...
[{"type": "stdin_stdout", "input": "16\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16\n0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\n", "output": "1.000000\n"}, {"type": "stdin_stdout", "input": "16\n5 6 9 13 13 15 9 10 2 6 10 11 12 7 4 8\n4 3 3 5 8 3 6 5 1 4 2 6 7 4 0 1\n", "output": "0.959707\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is unrest in the Galactic Senate. Several thousand solar systems have declared their intentions to leave the Republic. Master Heidi needs to select the Jedi Knights who will go on peacekeeping missions throughout th...
[{"type": "stdin_stdout", "input": "6 6\n4 3 5 4 5 2\n0 1 0 1 2 0\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "6 6\n1 1 3 2 2 2\n1 0 0 0 0 0\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "6 6\n4 3 5 6 5 5\n0 0 1 1 0 0\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "6 6\n6 2 6 2 5 4\n0 1 0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarpus participates in a competition for hacking into a new secure messenger. He's almost won.\n\nHaving carefully studied the interaction protocol, Polycarpus came to the conclusion that the secret key can be obtaine...
[{"type": "stdin_stdout", "input": "284254589153928171911281811000\n1009 1000\n", "output": "YES\n2842545891539\n28171911281811000\n"}, {"type": "stdin_stdout", "input": "4802711808015050898224\n8381696 51544172\n", "output": "YES\n48027118080\n15050898224\n"}, {"type": "stdin_stdout", "input": "6450225349035040017740\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n[Image] \n\n\n-----Input-----\n\nThe input contains two integers a_1, a_2 (0 ≤ a_{i} ≤ 32), separated by a single space.\n\n\n-----Output-----\n\nOutput a single integer.\n\n\n-----Examples-----\nInput\n1 1\n\nOutput\n0\n...
[{"type": "stdin_stdout", "input": "13 10\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "14 14\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "19 14\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "21 18\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "29 18\n", "output": "0\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe cows have just learned what a primitive root is! Given a prime p, a primitive root $\\operatorname{mod} p$ is an integer x (1 ≤ x < p) such that none of integers x - 1, x^2 - 1, ..., x^{p} - 2 - 1 are divisible by p, ...
[{"type": "stdin_stdout", "input": "1583\n", "output": "672\n"}, {"type": "stdin_stdout", "input": "1987\n", "output": "660\n"}, {"type": "stdin_stdout", "input": "1993\n", "output": "656\n"}, {"type": "stdin_stdout", "input": "1997\n", "output": "996\n"}, {"type": "stdin_stdout", "input": "1999\n", "output": "648\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNatasha's favourite numbers are $n$ and $1$, and Sasha's favourite numbers are $m$ and $-1$. One day Natasha and Sasha met and wrote down every possible array of length $n+m$ such that some $n$ of its elements are equal t...
[{"type": "stdin_stdout", "input": "2000 2000\n", "output": "674532367\n"}, {"type": "stdin_stdout", "input": "1134 1092\n", "output": "134680101\n"}, {"type": "stdin_stdout", "input": "1087 1050\n", "output": "973930225\n"}, {"type": "stdin_stdout", "input": "1994 1981\n", "output": "596939902\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSereja is a coder and he likes to take part in Codesorfes rounds. However, Uzhland doesn't have good internet connection, so Sereja sometimes skips rounds.\n\nCodesorfes has rounds of two types: Div1 (for advanced coders)...
[{"type": "stdin_stdout", "input": "1122 54\n2 1031\n1 363 364\n1 14 15\n1 902 903\n1 1052 1053\n2 170\n2 36\n2 194\n1 340 341\n1 1018 1019\n1 670 671\n1 558 559\n2 431\n2 351\n2 201\n1 1104 1105\n2 1056\n2 823\n1 274 275\n2 980\n1 542 543\n1 807 808\n2 157\n2 895\n1 505 506\n2 658\n1 484 485\n1 533 534\n1 384 385\n2 7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe stardate is 1977 and the science and art of detecting Death Stars is in its infancy. Princess Heidi has received information about the stars in the nearby solar system from the Rebel spies and now, to help her identif...
[{"type": "stdin_stdout", "input": "10\nXXXOOOOXOX\nOOOXXXOXXO\nXOXXXXOOXX\nXOOOXXOXOO\nOOXOOOOOOX\nXXXXOXOOOO\nXXXOOXOXOX\nOOOOXOXOXX\nXOXXOXOOXO\nOOOOOXOOOO\nXXXOOOOXOX\nOOOXXXOXXO\nXOXXXXOOXX\nXOOOXXOXOO\nOOXOOOOOOX\nXXXXOXOOOO\nXXXOOXOXOX\nOOOOXOXOXX\nXOXXOXOOXO\nOOOOOXOOOO\n", "output": "Yes\n"}, {"type": "stdin_s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBizon the Champion isn't just a bison. He also is a favorite of the \"Bizons\" team.\n\nAt a competition the \"Bizons\" got the following problem: \"You are given two distinct words (strings of English letters), s and t. ...
[{"type": "stdin_stdout", "input": "itwtyhhsdjjffmmoqkkhxjouypznewstyorotxhozlytndehmaxogrohccnqcgkrjrdmnuaogiwmnmsbdaizqkxnkqxxiihbwepc\nsnixfywvcntitcefsgqxjcodwtumurcglfmnamnowzbjzmfzspbfuldraiepeeiyasmrsneekydsbvazoqszyjxkjiotushsddet\n", "output": "need tree\n"}, {"type": "stdin_stdout", "input": "yyyyxxxxyxyyxxxy...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day Alice was cleaning up her basement when she noticed something very curious: an infinite set of wooden pieces! Each piece was made of five square tiles, with four tiles adjacent to the fifth center tile: [Image] ...
[{"type": "stdin_stdout", "input": "21\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\nVasya is pressing the keys on the keyboard reluctantly, squeezing out his ideas on the classical epos depicted in Homer's Odysseus... How can he explain to his literature teacher that he isn't going to become a writer? In...
[{"type": "stdin_stdout", "input": "100\n1622 320 1261 282 1604 57 1427 1382 904 911 1719 1682 984 1727 1301 1799 1110 1057 248 764 1642 1325 1172 1677 182 32 665 397 1146 73 412 554 973 874 774 1948 1676 1959 518 280 1467 568 613 760 594 252 224 1359 876 253 760 1566 929 1614 940 1079 288 245 1432 1647 1534 1768 1947 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRock... Paper!\n\nAfter Karen have found the deterministic winning (losing?) strategy for rock-paper-scissors, her brother, Koyomi, comes up with a new game as a substitute. The game works as follows.\n\nA positive intege...
[{"type": "stdin_stdout", "input": "30\n1143673 436496 1214486 1315862 148404 724601 1430740 1433008 1654610 1635673 614673 1713408 1270999 1697 1463796 50027 525482 1659078 688200 842647 518551 877506 1017082 1807856 3280 759698 1208220 470180 829800 1960886\n1312613 1965095 967255 1289012 1950383 582960 856825 49684 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider a linear function f(x) = Ax + B. Let's define g^{(0)}(x) = x and g^{(}n)(x) = f(g^{(}n - 1)(x)) for n > 0. For the given integer values A, B, n and x find the value of g^{(}n)(x) modulo 10^9 + 7.\n\n\n-----Input-...
[{"type": "stdin_stdout", "input": "978837295 606974665 846646545585165081 745145208\n", "output": "154788991\n"}, {"type": "stdin_stdout", "input": "1 1000000000 1000000000000000000 1000000000\n", "output": "999999657\n"}, {"type": "stdin_stdout", "input": "1 1000000000 100000000000000000 1000000000\n", "output": "899...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIvan is going to sleep now and wants to set his alarm clock. There will be many necessary events tomorrow, the $i$-th of them will start during the $x_i$-th minute. Ivan doesn't want to skip any of the events, so he has t...
[{"type": "stdin_stdout", "input": "2 2\n1 1000000000000000000\n1000000000000000000 1000000000000000000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "2 1\n10000000000 20000000000\n10000000000\n", "output": "YES\n10000000000 1\n"}, {"type": "stdin_stdout", "input": "2 1\n500000000000000000 100000000000000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBearland has n cities, numbered 1 through n. Cities are connected via bidirectional roads. Each road connects two distinct cities. No two roads connect the same pair of cities.\n\nBear Limak was once in a city a and he wa...
[{"type": "stdin_stdout", "input": "57 88\n54 30 5 43\n", "output": "54 5 1 2 3 4 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 31 32 33 34 35 36 37 38 39 40 41 42 44 45 46 47 48 49 50 51 52 53 55 56 57 43 30\n5 54 1 2 3 4 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 31 32 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday in the scientific lyceum of the Kingdom of Kremland, there was a biology lesson. The topic of the lesson was the genomes. Let's call the genome the string \"ACTG\".\n\nMaxim was very boring to sit in class, so the t...
[{"type": "stdin_stdout", "input": "50\nALWLSFLXYPQYMIWXMYMXFYMIVFYJDTJAIGVOAUDAIIAHKNNVTX\n", "output": "13"}, {"type": "stdin_stdout", "input": "50\nVKRGXLUWYURTRNGAODFLYCKAPHGPHGDLWIGXEYVOAVYYXVDRAB\n", "output": "12"}, {"type": "stdin_stdout", "input": "50\nROWGGKNUITVHOBMKZXOZNBZMQGSFERNCZDFKLRBCFVVDXJEFLP\n", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIlya got tired of sports programming, left university and got a job in the subway. He was given the task to determine the escalator load factor. \n\nLet's assume that n people stand in the queue for the escalator. At each...
[{"type": "stdin_stdout", "input": "2000 0.61 2000\n", "output": "1219.999999999999545\n"}, {"type": "stdin_stdout", "input": "2000 1.00 2000\n", "output": "2000.000000000000000\n"}, {"type": "stdin_stdout", "input": "2000 0.99 2000\n", "output": "1980.000000000000000\n"}, {"type": "stdin_stdout", "input": "1000 0.90 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n cards (n is even) in the deck. Each card has a positive integer written on it. n / 2 people will play new card game. At the beginning of the game each player gets two cards, each card is given to exactly one p...
[{"type": "stdin_stdout", "input": "100\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOnce upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the...
[{"type": "stdin_stdout", "input": "A.He_nan_de_yang_guang_zhao_yao_zhe_wo_men_mei_guo_ren_lian_shang_dou_xiao_kai_yan_wahaaaaaaaaaaaaaaaa\nB.Li_bai_li_bai_fei_liu_zhi_xia_san_qian_chi_yi_si_yin_he_luo_jiu_tian_li_bai_li_bai_li_bai_li_bai_shi\nC.Peng_yu_xiang_shi_zai_tai_shen_le_jian_zhi_jiu_shi_ye_jie_du_liu_a_si_mi_d...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVladik is a competitive programmer. This year he is going to win the International Olympiad in Informatics. But it is not as easy as it sounds: the question Vladik face now is to find the cheapest way to get to the olympi...
[{"type": "stdin_stdout", "input": "16 4 12\n0000000011111111\n", "output": "1"}, {"type": "stdin_stdout", "input": "10 1 10\n0000011111\n", "output": "1"}, {"type": "stdin_stdout", "input": "10 10 1\n0000011111\n", "output": "1"}, {"type": "stdin_stdout", "input": "10 2 10\n0000011111\n", "output": "1"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt seems that Borya is seriously sick. He is going visit n doctors to find out the exact diagnosis. Each of the doctors needs the information about all previous visits, so Borya has to visit them in the prescribed order (...
[{"type": "stdin_stdout", "input": "42\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n", "output": "83\n"}, {"type": "stdin_stdout", "input": "15\n1000 1000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiga Tower is the tallest and deepest building in Cyberland. There are 17 777 777 777 floors, numbered from - 8 888 888 888 to 8 888 888 888. In particular, there is floor 0 between floor - 1 and floor 1. Every day, tho...
[{"type": "stdin_stdout", "input": "-1000000000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "-410058385\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "-586825624\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "-408490162\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1000000000\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe consider a positive integer perfect, if and only if the sum of its digits is exactly $10$. Given a positive integer $k$, your task is to find the $k$-th smallest perfect positive integer.\n\n\n-----Input-----\n\nA sing...
[{"type": "stdin_stdout", "input": "10000\n", "output": "10800100\n"}, {"type": "stdin_stdout", "input": "9999\n", "output": "10800010\n"}, {"type": "stdin_stdout", "input": "9139\n", "output": "10134010\n"}, {"type": "stdin_stdout", "input": "9859\n", "output": "10422001\n"}, {"type": "stdin_stdout", "input": "8888\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou still have partial information about the score during the historic football match. You are given a set of pairs $(a_i, b_i)$, indicating that at some point during the match the score was \"$a_i$: $b_i$\". It is known ...
[{"type": "stdin_stdout", "input": "11\n0 100000000\n200000000 100000000\n200000000 300000000\n400000000 300000000\n400000000 500000000\n600000000 500000000\n600000000 700000000\n800000000 700000000\n800000000 900000000\n1000000000 900000000\n1000000000 1000000000\n", "output": "11\n"}, {"type": "stdin_stdout", "input"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInternational Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last digits of the current year. ...
[{"type": "stdin_stdout", "input": "9\nIAO'0\nIAO'00\nIAO'000\nIAO'0000\nIAO'00000\nIAO'000000\nIAO'0000000\nIAO'00000000\nIAO'000000000\n", "output": "1990\n2000\n3000\n10000\n100000\n1000000\n10000000\n100000000\n1000000000\n"}, {"type": "stdin_stdout", "input": "5\nIAO'15\nIAO'2015\nIAO'1\nIAO'9\nIAO'0\n", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nПрошло много лет, и на вечеринке снова встретились n друзей. С момента последней встречи техника шагнула далеко вперёд, появились фотоаппараты с автоспуском, и теперь не требуется, чтобы один из друзей стоял с фотоаппарат...
[{"type": "stdin_stdout", "input": "42\n13 62\n114 242\n265 839\n756 349\n298 476\n533 704\n348 277\n554 573\n654 112\n429 836\n574 766\n909 415\n163 891\n532 983\n873 457\n719 117\n1 302\n170 634\n166 585\n721 231\n208 609\n128 246\n845 726\n604 119\n859 110\n568 515\n656 913\n113 166\n794 566\n834 860\n983 596\n545 8...
code_stdio