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\nMaria participates in a bicycle race.\n\nThe speedway takes place on the shores of Lake Lucerne, just repeating its contour. As you know, the lake shore consists only of straight sections, directed to the north, south, ea... | [{"type": "stdin_stdout", "input": "24\n-10000 -10000\n-10000 9998\n9998 9998\n9998 -10000\n-6364 -10000\n-6364 6362\n6362 6362\n6362 -6364\n-2728 -6364\n-2728 2726\n2726 2726\n2726 -910\n908 -910\n908 908\n-910 908\n-910 -4546\n4544 -4546\n4544 4544\n-4546 4544\n-4546 -8182\n8180 -8182\n8180 8180\n-8182 8180\n-8182 -1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolandBall is playing a game with EnemyBall. The rules are simple. Players have to say words in turns. You cannot say a word which was already said. PolandBall starts. The Ball which can't say a new word loses.\n\nYou're ... | [{"type": "stdin_stdout", "input": "2 2\nkremowka\nwadowicka\nkremowka\nwiedenska\n", "output": "YES"}, {"type": "stdin_stdout", "input": "5 1\npolandball\nis\na\ncool\ncharacter\nnope\n", "output": "YES"}, {"type": "stdin_stdout", "input": "6 5\na\nb\nc\nd\ne\nf\nf\ne\nd\nz\ny\n", "output": "YES"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.\n\nThe cell of the field is under rook's attack, if there... | [{"type": "stdin_stdout", "input": "500 43\n176 85\n460 171\n233 260\n73 397\n474 35\n290 422\n309 318\n280 415\n485 169\n106 22\n355 129\n180 301\n205 347\n197 93\n263 318\n336 382\n314 350\n476 214\n367 277\n333 166\n500 376\n236 17\n94 73\n116 204\n166 50\n168 218\n144 369\n340 91\n274 360\n171 360\n41 251\n262 478\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne particularly well-known fact about zombies is that they move and think terribly slowly. While we still don't know why their movements are so sluggish, the problem of laggy thinking has been recently resolved. It turns... | [{"type": "stdin_stdout", "input": "10 9\n2 3\n6 8\n10 1\n1 8\n6 7\n8 7\n10 5\n7 10\n2 5\n", "output": "no\n"}, {"type": "stdin_stdout", "input": "200 5\n93 101\n199 164\n14 94\n115 61\n106 156\n", "output": "no\n"}, {"type": "stdin_stdout", "input": "10 9\n6 5\n9 2\n4 7\n2 3\n7 3\n3 4\n10 6\n1 2\n5 8\n", "output": "no... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe length of the longest common prefix of two strings $s = s_1 s_2 \\ldots s_n$ and $t = t_1 t_2 \\ldots t_m$ is defined as the maximum integer $k$ ($0 \\le k \\le min(n,m)$) such that $s_1 s_2 \\ldots s_k$ equals $t_1 t... | [{"type": "stdin_stdout", "input": "1\n100\n2 2 3 3 2 1 2 1 1 3 2 2 1 1 1 3 1 3 1 2 2 3 3 3 1 2 2 1 1 1 3 1 2 1 2 2 3 2 1 2 1 3 1 1 2 1 3 1 2 1 3 2 1 2 3 3 2 1 1 3 1 1 2 3 2 2 2 2 2 3 2 3 3 3 3 1 3 1 1 1 1 3 1 2 3 3 1 3 2 3 3 2 3 3 3 1 1 3 3 3\n", "output": "aaa\naab\naaa\naaa\naaa\naab\nabb\naba\naaa\nabb\nabb\naba\na... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer array $a_1, a_2, \\ldots, a_n$.\n\nThe array $b$ is called to be a subsequence of $a$ if it is possible to remove some elements from $a$ to get $b$.\n\nArray $b_1, b_2, \\ldots, b_k$ is called to ... | [{"type": "stdin_stdout", "input": "50\n170081 797965 40736 224325 102476 20832 954026 923972 391400 247099 95141 927386 79799 749285 104039 200818 623552 872203 355273 838168 352783 850365 389351 930945 847154 608047 727586 549184 520573 608953 338849 536466 345479 589848 882827 771475 874283 787115 992590 128903 9780... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA student of z-school found a kind of sorting called z-sort. The array a with n elements are z-sorted if two conditions hold:\n\n a_{i} ≥ a_{i} - 1 for all even i, a_{i} ≤ a_{i} - 1 for all odd i > 1. \n\nFor example th... | [{"type": "stdin_stdout", "input": "100\n82 51 81 14 37 17 78 92 64 15 8 86 89 8 87 77 66 10 15 12 100 25 92 47 21 78 20 63 13 49 41 36 41 79 16 87 87 69 3 76 80 60 100 49 70 59 72 8 38 71 45 97 71 14 76 54 81 4 59 46 39 29 92 3 49 22 53 99 59 52 74 31 92 43 42 23 44 9 82 47 7 40 12 9 3 55 37 85 46 22 84 52 98 41 21 77... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA palindrome is a string $t$ which reads the same backward as forward (formally, $t[i] = t[|t| + 1 - i]$ for all $i \\in [1, |t|]$). Here $|t|$ denotes the length of a string $t$. For example, the strings 010, 1001 and 0 ... | [{"type": "stdin_stdout", "input": "11\n4\n0\n1\n1\n0\n2\n0001000\n0000000000000\n2\n1\n0\n1\n1\n1\n0\n2\n11\n00\n2\n111\n000\n2\n111\n00\n2\n00\n111\n2\n11111\n00\n2\n00000100000\n000\n", "output": "4\n2\n2\n1\n1\n2\n2\n2\n2\n2\n2\n"}, {"type": "stdin_stdout", "input": "1\n4\n110101\n0\n1011001011010101001110010111110... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis Christmas Santa gave Masha a magic picture and a pencil. The picture consists of n points connected by m segments (they might cross in any way, that doesn't matter). No two segments connect the same pair of points, a... | [{"type": "stdin_stdout", "input": "100 50\n66 3\n92 79\n9 44\n84 45\n30 63\n30 20\n33 86\n8 83\n40 75\n7 36\n91 4\n76 88\n77 76\n28 27\n6 52\n41 57\n8 23\n34 75\n50 15\n86 68\n36 98\n30 84\n37 62\n22 4\n6 45\n72 80\n98 74\n78 84\n1 54\n99 27\n84 91\n78 7\n80 61\n67 48\n51 52\n36 72\n97 87\n25 17\n20 80\n20 39\n72 5\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA permutation of length n is an integer sequence such that each integer from 0 to (n - 1) appears exactly once in it. For example, sequence [0, 2, 1] is a permutation of length 3 while both [0, 2, 2] and [1, 2, 3] are not... | [{"type": "stdin_stdout", "input": "100\n99 5 40 32 4 31 38 57 94 47 26 16 89 72 9 80 55 86 78 90 42 41 46 74 56 97 21 48 66 27 93 85 88 59 64 95 10 45 12 22 84 60 8 98 62 51 14 65 39 30 11 71 92 19 76 43 87 54 15 53 37 6 25 18 96 35 13 91 2 3 0 23 1 7 49 75 81 33 50 52 63 44 69 36 17 61 24 20 68 34 73 29 70 83 58 79 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMahmoud wants to write a new dictionary that contains n words and relations between them. There are two types of relations: synonymy (i. e. the two words mean the same) and antonymy (i. e. the two words mean the opposite)... | [{"type": "stdin_stdout", "input": "8 4 12\nhello hi welcome goaway hateyou mmmm momo mana\n1 hello hi\n1 hi welcome\n2 goaway welcome\n2 hateyou hi\nhateyou goaway\nhateyou hi\nhateyou hi\nhateyou welcome\nmmmm momo\nwelcome hi\nwelcome hateyou\nhateyou goaway\nhello goaway\nhello goaway\nhello hateyou\ngoaway mmmm\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCity X consists of n vertical and n horizontal infinite roads, forming n × n intersections. Roads (both vertical and horizontal) are numbered from 1 to n, and the intersections are indicated by the numbers of the roads th... | [{"type": "stdin_stdout", "input": "9\n4 5\n2 3\n8 3\n5 6\n9 3\n4 4\n5 4\n4 7\n1 7\n8 4\n1 4\n1 5\n5 7\n7 8\n7 1\n9 9\n8 7\n7 5\n3 7\n6 6\n7 3\n5 2\n3 6\n7 4\n9 6\n5 8\n9 7\n6 3\n7 9\n1 2\n1 1\n6 2\n5 3\n7 2\n1 6\n4 1\n6 1\n8 9\n2 2\n3 9\n2 9\n7 7\n2 8\n9 4\n2 5\n8 6\n3 4\n2 1\n2 7\n6 5\n9 1\n3 3\n3 8\n5 5\n4 3\n3 1\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHeidi and Doctor Who hopped out of the TARDIS and found themselves at EPFL in 2018. They were surrounded by stormtroopers and Darth Vader was approaching. Miraculously, they managed to escape to a nearby rebel base but th... | [{"type": "stdin_stdout", "input": "1 2\n824625204\n309211451 5643\n115368061 3866\n", "output": "9509\n"}, {"type": "stdin_stdout", "input": "1 2\n754725914\n561572949 6885\n312543334 2667\n", "output": "9552\n"}, {"type": "stdin_stdout", "input": "1 2\n458828651\n579090223 7592\n208642144 8751\n", "output": "8751\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSereja has an array a, consisting of n integers a_1, a_2, ..., a_{n}. The boy cannot sit and do nothing, he decided to study an array. Sereja took a piece of paper and wrote out m integers l_1, l_2, ..., l_{m} (1 ≤ l_{i} ... | [{"type": "stdin_stdout", "input": "10 10\n1 2 3 4 1 2 3 4 100000 99999\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", "output": "6\n6\n6\n6\n6\n5\n4\n3\n2\n1\n"}, {"type": "stdin_stdout", "input": "7 10\n1 3 8 6 2 2 7\n4\n2\n6\n3\n4\n4\n6\n2\n7\n4\n", "output": "3\n5\n2\n4\n3\n3\n2\n5\n1\n3\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Department of economic development of IT City created a model of city development till year 2100.\n\nTo prepare report about growth perspectives it is required to get growth estimates from the model.\n\nTo get the gro... | [{"type": "stdin_stdout", "input": "1000 1000 -999\n", "output": "0.617586685675881\n-1.617586685675881"}, {"type": "stdin_stdout", "input": "-181 -227 368\n", "output": "0.930608581348335\n-2.184752227757175"}, {"type": "stdin_stdout", "input": "-779 -814 321\n", "output": "0.305204386055057\n-1.350133782717445"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this problem you are to calculate the sum of all integers from 1 to n, but you should take all powers of two with minus in the sum.\n\nFor example, for n = 4 the sum is equal to - 1 - 2 + 3 - 4 = - 4, because 1, 2 an... | [{"type": "stdin_stdout", "input": "16\n100100\n100100\n100100\n100100\n100100\n100100\n100100\n100100\n100100\n100100\n100100\n100100\n100100\n100100\n100100\n100100\n", "output": "5009792908\n5009792908\n5009792908\n5009792908\n5009792908\n5009792908\n5009792908\n5009792908\n5009792908\n5009792908\n5009792908\n500979... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJanusz is a businessman. He owns a company \"Januszex\", which produces games for teenagers. Last hit of Januszex was a cool one-person game \"Make it one\". The player is given a sequence of $n$ integers $a_i$.\n\nIt is ... | [{"type": "stdin_stdout", "input": "30\n13469 121221 107752 94283 107752 296318 67345 296318 161628 215504 121221 215504 296318 134690 282849 161628 148159 202035 242442 107752 80814 80814 107752 255911 67345 53876 255911 215504 202035 175097\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "25\n32942 232281 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Sasha visited the farmer 2D and his famous magnetic farm. On this farm, the crop grows due to the influence of a special magnetic field. Maintaining of the magnetic field is provided by $n$ machines, and the power... | [{"type": "stdin_stdout", "input": "166\n61 19 19 67 11 11 73 89 73 11 47 2 59 43 61 31 19 83 71 19 29 97 89 97 2 11 5 73 19 2 19 7 41 53 5 23 11 89 2 23 47 47 83 71 17 71 67 67 43 3 29 97 17 83 11 19 67 17 97 7 19 29 29 41 13 71 29 19 19 43 47 17 71 3 13 71 41 19 47 7 29 43 29 97 31 11 43 17 23 83 37 61 79 31 17 5 59 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe black king is standing on a chess field consisting of 10^9 rows and 10^9 columns. We will consider the rows of the field numbered with integers from 1 to 10^9 from top to bottom. The columns are similarly numbered wit... | [{"type": "stdin_stdout", "input": "30 14 39 19\n31\n35 7 11\n37 11 12\n32 13 13\n37 5 6\n46 13 13\n37 14 14\n31 13 13\n43 13 19\n45 15 19\n46 13 13\n32 17 17\n41 14 19\n30 14 14\n43 13 17\n34 16 18\n44 11 19\n38 13 13\n40 12 20\n37 16 18\n46 16 18\n34 10 14\n36 9 10\n36 15 19\n38 15 19\n42 13 19\n33 14 15\n35 15 19\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou wrote down all integers from $0$ to $10^n - 1$, padding them with leading zeroes so their lengths are exactly $n$. For example, if $n = 3$ then you wrote out 000, 001, ..., 998, 999.\n\nA block in an integer $x$ is a ... | [{"type": "stdin_stdout", "input": "10\n", "output": "943963054 482289529 666000000 58500000 5040000 423000 34200 2610 180 10\n"}, {"type": "stdin_stdout", "input": "9\n", "output": "482289529 666000000 58500000 5040000 423000 34200 2610 180 10\n"}, {"type": "stdin_stdout", "input": "8\n", "output": "666000000 58500000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $i$-th page contains some mystery that will be explained ... | [{"type": "stdin_stdout", "input": "17\n9 4 3 6 7 6 8 8 9 10 11 12 13 14 15 16 17\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "15\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "13\n1 2 3 4 5 6 7 8 9 10 11 12 13\n", "output": "13\n"}, {"type": "stdin_stdout", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have an integer $n$. Let's define following tree generation as McDic's generation: Make a complete and full binary tree of $2^{n} - 1$ vertices. Complete and full binary tree means a tree that exactly one vertex is a... | [{"type": "stdin_stdout", "input": "6\n53 61\n35 53\n35 39\n34 53\n34 54\n34 62\n43 54\n23 43\n12 43\n1 54\n1 7\n1 57\n40 62\n30 40\n28 40\n4 62\n4 60\n4 45\n19 61\n19 36\n36 42\n36 52\n10 19\n10 48\n10 46\n2 61\n2 51\n2 27\n5 51\n3 51\n15 27\n22 27\n39 47\n6 47\n6 59\n6 24\n9 47\n9 49\n9 21\n20 39\n14 20\n14 18\n13 14... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya had an array of $n$ integers, each element of the array was from $1$ to $n$. He chose $m$ pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, an... | [{"type": "stdin_stdout", "input": "10 40\n8 3\n6 8\n7 1\n9 10\n1 3\n2 8\n3 7\n1 8\n8 10\n4 5\n5 1\n10 3\n9 7\n4 6\n5 3\n2 3\n3 9\n9 8\n7 8\n4 1\n1 6\n4 7\n7 6\n6 10\n6 9\n2 6\n5 10\n10 4\n7 2\n5 9\n2 4\n3 6\n9 2\n1 10\n5 8\n5 7\n4 8\n1 9\n6 5\n5 2\n", "output": "YES\n1 2 3 4 5 6 7 8 9 10 \n1 1 3 4 5 6 7 8 9 10 \n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGraph constructive problems are back! This time the graph you are asked to build should match the following properties.\n\nThe graph is connected if and only if there exists a path between every pair of vertices.\n\nThe d... | [{"type": "stdin_stdout", "input": "100\n1 5 1 1 1 2 3 2 1 4 2 2 1 2 1 2 2 2 2 1 1 2 2 2 2 2 2 1 2 2 2 1 1 1 2 2 1 1 2 3 2 2 3 1 2 4 2 1 2 1 2 4 2 1 2 3 1 3 1 2 2 1 2 2 3 1 1 1 5 2 2 2 3 3 1 3 1 2 2 4 1 2 1 3 1 5 3 3 1 1 2 1 3 2 1 2 2 2 3 2\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "17\n1 2 3 4 5 6 7 8 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a permutation $p_1, p_2, \\ldots, p_n$ of integers from $1$ to $n$ and an integer $k$, such that $1 \\leq k \\leq n$. A permutation means that every number from $1$ to $n$ is contained in $p$ exactly once.\n... | [{"type": "stdin_stdout", "input": "100 77\n59 92 18 16 45 82 63 43 50 68 19 13 53 79 48 28 94 49 25 77 54 8 61 66 40 100 99 20 35 14 52 56 22 17 57 36 23 90 4 65 84 42 30 27 3 15 87 32 93 74 46 91 41 9 34 12 11 7 10 86 78 72 81 73 51 55 58 97 39 31 5 24 29 88 95 6 44 37 60 62 83 33 47 21 2 38 26 98 71 75 96 70 76 69 6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of... | [{"type": "stdin_stdout", "input": "10\ngzjzzjjjzjzgjgzzgzjjjzzzggjjggggjjzzgzz\nyyyyyyyyyyyyyy\nuuuuuuuuuuuuuuuuuuuuuuuu\nssssssssssssssssssssss\nuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu\ngzjgjzzzjgjzggjjjjjzjzzgjgjzgjgjzzjjggzgjzgjgj\ny\nsssssssssss\ngzjzgjjjzggjgzjzgzzz\nsssssssssssssssssssssssssssssss\n",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe city park of IT City contains n east to west paths and n north to south paths. Each east to west path crosses each north to south path, so there are n^2 intersections.\n\nThe city funded purchase of five benches. To m... | [{"type": "stdin_stdout", "input": "100\n", "output": "680185280130048000"}, {"type": "stdin_stdout", "input": "83\n", "output": "101159538130177920"}, {"type": "stdin_stdout", "input": "95\n", "output": "402852449038723320"}, {"type": "stdin_stdout", "input": "99\n", "output": "613867215317368320"}, {"type": "stdin_st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind out if it is possible to partition the first $n$ positive integers into two non-empty disjoint sets $S_1$ and $S_2$ such that:$\\mathrm{gcd}(\\mathrm{sum}(S_1), \\mathrm{sum}(S_2)) > 1$ \n\nHere $\\mathrm{sum}(S)$ de... | [{"type": "stdin_stdout", "input": "37\n", "output": "Yes\n1 19\n36 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 \n"}, {"type": "stdin_stdout", "input": "22\n", "output": "Yes\n1 11\n21 1 2 3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 21 22 \n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer number $n$. The following algorithm is applied to it:\n\n if $n = 0$, then end algorithm; find the smallest prime divisor $d$ of $n$; subtract $d$ from $n$ and go to step $1$. \n\nDetermine the... | [{"type": "stdin_stdout", "input": "10000000000\n", "output": "5000000000\n"}, {"type": "stdin_stdout", "input": "9999999999\n", "output": "4999999999\n"}, {"type": "stdin_stdout", "input": "9998200081\n", "output": "4999050046\n"}, {"type": "stdin_stdout", "input": "3000000021\n", "output": "1500000010\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe numbers of all offices in the new building of the Tax Office of IT City will have lucky numbers.\n\nLucky number is a number that consists of digits 7 and 8 only. Find the maximum number of offices in the new building... | [{"type": "stdin_stdout", "input": "54\n", "output": "36028797018963966"}, {"type": "stdin_stdout", "input": "55\n", "output": "72057594037927934"}, {"type": "stdin_stdout", "input": "49\n", "output": "1125899906842622"}, {"type": "stdin_stdout", "input": "43\n", "output": "17592186044414"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBees Alice and Alesya gave beekeeper Polina famous card game \"Set\" as a Christmas present. The deck consists of cards that vary in four features across three options for each kind of feature: number of shapes, shape, sh... | [{"type": "stdin_stdout", "input": "24 4\nSETS\nETES\nSSST\nESTE\nTSES\nSSES\nTESS\nSEEE\nETEE\nETSS\nSSEE\nESTT\nSTSS\nTTTT\nTEEE\nTSEE\nESET\nTTTE\nETTT\nSTEE\nSTTE\nESSS\nTEET\nTETE\n", "output": "31"}, {"type": "stdin_stdout", "input": "10 3\nTSS\nSEE\nESS\nSES\nSTS\nTET\nTEE\nSSE\nETS\nTSE\n", "output": "2"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndryusha is an orderly boy and likes to keep things in their place.\n\nToday he faced a problem to put his socks in the wardrobe. He has n distinct pairs of socks which are initially in a bag. The pairs are numbered from... | [{"type": "stdin_stdout", "input": "50\n30 47 31 38 37 50 36 43 9 23 2 2 15 31 14 49 9 16 6 44 27 14 5 6 3 47 25 26 1 35 3 15 24 19 8 46 49 41 4 26 40 28 42 11 34 35 46 18 7 28 18 40 19 42 4 41 38 48 50 12 29 39 33 17 25 22 22 21 36 45 27 30 20 7 13 29 39 44 21 8 37 45 34 1 20 10 11 17 33 12 43 13 10 16 48 24 32 5 23 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Bitlandians are quite weird people. They have very peculiar customs.\n\nAs is customary, Uncle J. wants to have n eggs painted for Bitruz (an ancient Bitland festival). He has asked G. and A. to do the work.\n\nThe ki... | [{"type": "stdin_stdout", "input": "10\n1 999\n1 999\n1 999\n1 999\n1 999\n1 999\n1 999\n1 999\n1 999\n1 999\n", "output": "AAAAAAAAAA\n"}, {"type": "stdin_stdout", "input": "3\n400 600\n400 600\n400 600\n", "output": "AGA\n"}, {"type": "stdin_stdout", "input": "3\n500 500\n1 999\n400 600\n", "output": "AGA\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a ce... | [{"type": "stdin_stdout", "input": "50\n474421 421097 217233 156339 27075 733996 281778 863492 184707 956857 288561 70997 393786 337382 663642 131184 637 273801 799870 295017 392338 842567 161819 297705 102013 930684 375703 838048 154915 138503 629056 256591 893619 19263 787927 684541 320265 841090 421423 490879 394582... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence of swaps that makes the array sorted in the non-descending order. Swaps are performed consec... | [{"type": "stdin_stdout", "input": "5\n1000000000 -10000000 0 8888888 7777777\n", "output": "3\n0 1\n2 1\n4 2\n"}, {"type": "stdin_stdout", "input": "3\n100000000 100000002 100000001\n", "output": "1\n1 2\n"}, {"type": "stdin_stdout", "input": "8\n5 2 6 8 3 1 6 8\n", "output": "4\n0 5\n4 2\n5 3\n6 5\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer $n$.\n\nYou should find a list of pairs $(x_1, y_1)$, $(x_2, y_2)$, ..., $(x_q, y_q)$ ($1 \\leq x_i, y_i \\leq n$) satisfying the following condition.\n\nLet's consider some function $f: \\mathbb{... | [{"type": "stdin_stdout", "input": "10\n", "output": "24\n1 2\n3 4\n1 3\n2 4\n5 6\n7 8\n5 7\n6 8\n1 5\n2 6\n3 7\n4 8\n3 4\n5 6\n3 5\n4 6\n7 8\n9 10\n7 9\n8 10\n3 7\n4 8\n5 9\n6 10\n"}, {"type": "stdin_stdout", "input": "8\n", "output": "24\n1 2\n3 4\n1 3\n2 4\n5 6\n7 8\n5 7\n6 8\n1 5\n2 6\n3 7\n4 8\n1 2\n3 4\n1 3\n2 4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAmr has got a large array of size n. Amr doesn't like large arrays so he intends to make it smaller.\n\nAmr doesn't care about anything in the array except the beauty of it. The beauty of the array is defined to be the ma... | [{"type": "stdin_stdout", "input": "10\n1 10 100 1000 10000 1 10 100 1000 10000\n", "output": "1 6"}, {"type": "stdin_stdout", "input": "10\n1 1000000 2 1000000 3 2 1000000 1 2 1\n", "output": "2 7"}, {"type": "stdin_stdout", "input": "10\n1 11 111 1111 1 11 11 1 1111 1111\n", "output": "2 7"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider some set of distinct characters $A$ and some string $S$, consisting of exactly $n$ characters, where each character is present in $A$.\n\nYou are given an array of $m$ integers $b$ ($b_1 < b_2 < \\dots < b_m$). \... | [{"type": "stdin_stdout", "input": "1000000000 2 2\n1 500000000\n", "output": "933660593\n"}, {"type": "stdin_stdout", "input": "2 1 1000000000\n1\n", "output": "858035449\n"}, {"type": "stdin_stdout", "input": "9 2 26\n2 3\n", "output": "150352234\n"}, {"type": "stdin_stdout", "input": "1000000000 1 1\n1\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a multiset containing several integers. Initially, it contains $a_1$ elements equal to $1$, $a_2$ elements equal to $2$, ..., $a_n$ elements equal to $n$.\n\nYou may apply two types of operations: choose two int... | [{"type": "stdin_stdout", "input": "20\n1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "16\n1 1 2 3 3 4 5 6 6 6 4 3 2 1 1 1\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "1\n1000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n1 0 1 0 1\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! \n\nMore formally, if you typed a word at second a and then the next word at second b, t... | [{"type": "stdin_stdout", "input": "2 1000000000\n1 1000000000\n", "output": "2"}, {"type": "stdin_stdout", "input": "6 5\n1 3 8 14 19 20\n", "output": "3"}, {"type": "stdin_stdout", "input": "6 1\n1 3 5 7 9 10\n", "output": "2"}, {"type": "stdin_stdout", "input": "5 5\n1 7 12 13 14\n", "output": "4"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDevu is a dumb guy, his learning curve is very slow. You are supposed to teach him n subjects, the i^{th} subject has c_{i} chapters. When you teach him, you are supposed to teach all the chapters of a subject continuousl... | [{"type": "stdin_stdout", "input": "20 10\n6 6 1 2 6 4 5 3 6 5 4 5 6 5 4 6 6 2 3 3\n", "output": "196\n"}, {"type": "stdin_stdout", "input": "20 4\n1 1 3 5 5 1 3 4 2 5 2 4 3 1 3 3 3 3 4 3\n", "output": "65\n"}, {"type": "stdin_stdout", "input": "4 2\n5 1 2 1\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt was decided in IT City to distinguish successes of local IT companies by awards in the form of stars covered with gold from one side. To order the stars it is necessary to estimate order cost that depends on the area o... | [{"type": "stdin_stdout", "input": "999999929 1000000000\n", "output": "1047197551196597556.500000000000"}, {"type": "stdin_stdout", "input": "11 1000000000\n", "output": "1061689977712182980.125000000000"}, {"type": "stdin_stdout", "input": "7369339 31415926\n", "output": "1033542520749354.968872070312"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIT City administration has no rest because of the fame of the Pyramids in Egypt. There is a project of construction of pyramid complex near the city in the place called Emerald Walley. The distinction of the complex is th... | [{"type": "stdin_stdout", "input": "1000 1000 1000\n", "output": "655056222.989098310000"}, {"type": "stdin_stdout", "input": "999 997 998\n", "output": "650782658.915145640000"}, {"type": "stdin_stdout", "input": "709 328 709\n", "output": "157775455.683012100000"}, {"type": "stdin_stdout", "input": "982 948 879\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIahub has drawn a set of n points in the cartesian plane which he calls \"special points\". A quadrilateral is a simple polygon without self-intersections with four sides (also called edges) and four vertices (also called... | [{"type": "stdin_stdout", "input": "50\n-768 -243\n-741 -984\n-370 213\n-808 571\n-726 442\n234 452\n-105 -990\n-876 -278\n987 473\n-968 -531\n-274 -842\n259 -655\n-59 -555\n976 -396\n878 -85\n551 213\n675 599\n-990 -507\n1 48\n-147 919\n-218 798\n-191 928\n916 263\n-975 169\n567 -967\n394 16\n-224 915\n280 -613\n804 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree (a connected undirected graph without cycles) of $n$ vertices. Each of the $n - 1$ edges of the tree is colored in either black or red.\n\nYou are also given an integer $k$. Consider sequences of $k$ ... | [{"type": "stdin_stdout", "input": "19 20\n8 10 1\n17 15 1\n14 5 0\n6 14 0\n7 15 0\n19 8 1\n12 14 0\n2 18 0\n13 3 0\n17 1 1\n4 2 1\n11 3 0\n4 6 0\n6 9 0\n7 11 1\n16 4 1\n5 13 1\n16 19 0\n", "output": "928042611"}, {"type": "stdin_stdout", "input": "13 3\n9 13 1\n8 3 1\n11 9 0\n8 13 0\n10 9 0\n2 7 0\n4 8 1\n11 5 0\n10 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo neighboring kingdoms decided to build a wall between them with some gates to enable the citizens to go from one kingdom to another. Each time a citizen passes through a gate, he has to pay one silver coin.\n\nThe worl... | [{"type": "stdin_stdout", "input": "100\nRUURUURRUURUUUUURRUUURRRRUURRURRURRRRUUUUUURRUURRRRURUUURUURURRRRRURUURRUURUURRUUURUUUUUURRUUUURUUUR\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "15\nRUURRRRURRUUUUU\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "7\nURRRUUU\n", "output": "2\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVanya has a table consisting of 100 rows, each row contains 100 cells. The rows are numbered by integers from 1 to 100 from bottom to top, the columns are numbered from 1 to 100 from left to right. \n\nIn this table, Vany... | [{"type": "stdin_stdout", "input": "5\n4 11 20 20\n6 11 20 16\n5 2 19 15\n11 3 18 15\n3 2 14 11\n", "output": "694\n"}, {"type": "stdin_stdout", "input": "5\n4 11 20 15\n7 5 12 20\n10 8 16 12\n7 5 12 15\n2 2 20 13\n", "output": "510\n"}, {"type": "stdin_stdout", "input": "5\n1 1 1 100\n1 1 1 100\n1 1 1 100\n1 1 1 100\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe polar bears are going fishing. They plan to sail from (s_{x}, s_{y}) to (e_{x}, e_{y}). However, the boat can only sail by wind. At each second, the wind blows in one of these directions: east, south, west or north. A... | [{"type": "stdin_stdout", "input": "39 -1000000000 -1000000000 -999999997 -1000000000\nENEENWSWSSWESNSSEESNSESWSWNSWESNENWNWEE\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "41 -264908123 -86993764 -264908123 -86993723\nNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN\n", "output": "41\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to a particular phone number. ... | [{"type": "stdin_stdout", "input": "12345\n", "output": "71232"}, {"type": "stdin_stdout", "input": "13542\n", "output": "84443"}, {"type": "stdin_stdout", "input": "71232\n", "output": "10151"}, {"type": "stdin_stdout", "input": "11111\n", "output": "36551"}, {"type": "stdin_stdout", "input": "10000\n", "output": "000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProfessor Ibrahim has prepared the final homework for his algorithm’s class. He asked his students to implement the Posterization Image Filter.\n\nTheir algorithm will be tested on an array of integers, where the $i$-th i... | [{"type": "stdin_stdout", "input": "100 7\n39 242 238 155 95 30 129 132 72 59 22 61 133 113 99 81 253 204 160 109 92 187 11 227 145 148 100 42 78 14 113 91 140 197 123 182 4 185 208 27 182 207 63 146 102 79 159 195 26 100 72 127 157 159 152 53 0 117 111 125 19 188 179 145 240 50 205 207 113 246 42 56 181 13 188 244 159... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are preparing for an exam on scheduling theory. The exam will last for exactly T milliseconds and will consist of n problems. You can either solve problem i in exactly t_{i} milliseconds or ignore it and spend no time... | [{"type": "stdin_stdout", "input": "10 481\n4 25\n3 85\n6 96\n6 13\n1 9\n4 27\n2 7\n3 42\n9 66\n9 70\n", "output": "4\n4\n4 1 6 9\n"}, {"type": "stdin_stdout", "input": "5 300\n3 100\n4 150\n4 80\n2 90\n2 300\n", "output": "2\n2\n3 4\n"}, {"type": "stdin_stdout", "input": "5 100\n1 10\n1 10\n1 10\n1 10\n1 10\n", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nValera's finally decided to go on holiday! He packed up and headed for a ski resort.\n\nValera's fancied a ski trip but he soon realized that he could get lost in this new place. Somebody gave him a useful hint: the resor... | [{"type": "stdin_stdout", "input": "100\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 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 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n38 2 49 55 6 42 12 100 25 69 85 76 13 22 78 73 37 64 5 21 0 23 61 87 4 16 44 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne department of some software company has $n$ servers of different specifications. Servers are indexed with consecutive integers from $1$ to $n$. Suppose that the specifications of the $j$-th server may be expressed wit... | [{"type": "stdin_stdout", "input": "15 250 200\n71 2 77 69 100 53 54 40 73 32 82 58 24 82 41\n", "output": "Yes\n11 3\n13 10 8 15 6 7 12 4 1 9 3\n11 14 5\n"}, {"type": "stdin_stdout", "input": "2 1 1\n1000000000 1000000000\n", "output": "Yes\n1 1\n1\n2\n"}, {"type": "stdin_stdout", "input": "6 8 16\n3 5 2 9 8 7\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne company of IT City decided to create a group of innovative developments consisting from 5 to 7 people and hire new employees for it. After placing an advertisment the company received n resumes. Now the HR department ... | [{"type": "stdin_stdout", "input": "666\n", "output": "11292070960994226"}, {"type": "stdin_stdout", "input": "700\n", "output": "16017044425409540"}, {"type": "stdin_stdout", "input": "776\n", "output": "33019955679376860"}, {"type": "stdin_stdout", "input": "777\n", "output": "33319741730082870"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCapitalization is writing a word with its first letter as a capital letter. Your task is to capitalize the given word.\n\nNote, that during capitalization all the letters except the first one remains unchanged.\n\n\n-----... | [{"type": "stdin_stdout", "input": "ABACABA\n", "output": "ABACABA\n"}, {"type": "stdin_stdout", "input": "konjac\n", "output": "Konjac\n"}, {"type": "stdin_stdout", "input": "ApPLe\n", "output": "ApPLe\n"}, {"type": "stdin_stdout", "input": "Xyzzy\n", "output": "Xyzzy\n"}, {"type": "stdin_stdout", "input": "Zzz\n", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFinally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $2 \\cdot n$ students have come to Demid's exercise session, and he lined up them into two rows of the same s... | [{"type": "stdin_stdout", "input": "100\n4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1\n1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImagine that there is a group of three friends: A, B and С. A owes B 20 rubles and B owes C 20 rubles. The total sum of the debts is 40 rubles. You can see that the debts are not organized in a very optimal manner. Let's ... | [{"type": "stdin_stdout", "input": "100 48\n1 56 6\n2 42 3\n3 52 1\n9 50 8\n10 96 8\n11 39 2\n12 51 6\n12 68 7\n13 40 5\n14 18 10\n14 70 6\n15 37 4\n15 38 8\n15 82 6\n15 85 5\n16 48 4\n16 50 9\n16 71 9\n17 18 3\n17 100 10\n20 73 3\n22 32 9\n22 89 9\n23 53 3\n24 53 1\n27 78 10\n30 50 5\n33 94 8\n34 87 9\n35 73 3\n36 51 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row num... | [{"type": "stdin_stdout", "input": "5 5 30\n0 1 1 1 0\n1 1 0 1 1\n0 1 1 1 1\n0 0 1 1 0\n0 0 0 0 0\n3 2\n2 2\n2 2\n4 3\n1 4\n3 2\n4 1\n2 4\n1 4\n2 1\n5 2\n4 1\n4 1\n5 1\n2 4\n2 4\n4 4\n1 2\n3 1\n4 5\n1 2\n2 3\n1 1\n5 1\n3 4\n1 1\n5 4\n1 5\n5 4\n2 2\n", "output": "3\n3\n3\n3\n3\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n5\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.\n\nLet we represent their base with an array, where each position can be occupied by many avengers, but one avenger ca... | [{"type": "stdin_stdout", "input": "5 3 10000 3241\n5 12 2\n", "output": "58892\n"}, {"type": "stdin_stdout", "input": "5 3 3521 10000\n5 12 2\n", "output": "58168\n"}, {"type": "stdin_stdout", "input": "3 3 5 10000\n1 4 5\n", "output": "30020\n"}, {"type": "stdin_stdout", "input": "3 3 10000 5\n1 4 5\n", "output": "40... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe city administration of IT City decided to fix up a symbol of scientific and technical progress in the city's main square, namely an indicator board that shows the effect of Moore's law in real time.\n\nMoore's law is ... | [{"type": "stdin_stdout", "input": "10000 2000000000\n", "output": "35849124123571.66604124267909180280\n"}, {"type": "stdin_stdout", "input": "1587 1941728048\n", "output": "2996928752532.893524588882808611548\n"}, {"type": "stdin_stdout", "input": "4907 244618708\n", "output": "72346.60521729832602747499118899866\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJoe has been hurt on the Internet. Now he is storming around the house, destroying everything in his path.\n\nJoe's house has n floors, each floor is a segment of m cells. Each cell either contains nothing (it is an empty... | [{"type": "stdin_stdout", "input": "20 20\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\nHiasat registered a new account in NeckoForces and when his friends found out about that, each one of them asked to use his name as Hiasat's handle.\n\nLuckily for Hiasat, he can change his handle in some points in time. ... | [{"type": "stdin_stdout", "input": "64 2\n1\n1\n2 csxom\n1\n2 csxom\n1\n1\n1\n1\n1\n2 yl\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "61 1\n1\n2 wrlc... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter a probationary period in the game development company of IT City Petya was included in a group of the programmers that develops a new turn-based strategy game resembling the well known \"Heroes of Might & Magic\". A... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "3000000003000000001"}, {"type": "stdin_stdout", "input": "748629743\n", "output": "1681339478558627377"}, {"type": "stdin_stdout", "input": "945234000\n", "output": "2680401947103702001"}, {"type": "stdin_stdout", "input": "900000000\n", "output": "243000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhen Sasha was studying in the seventh grade, he started listening to music a lot. In order to evaluate which songs he likes more, he introduced the notion of the song's prettiness. The title of the song is a word consist... | [{"type": "stdin_stdout", "input": "ZUBQNDCHHKWNWRVSDSRRRTGZDDPNTVJFKTCNGWND\n", "output": "7.5320861\n"}, {"type": "stdin_stdout", "input": "MTOESEPRFEIWAIWLAFJMGBIQB\n", "output": "127.2203685\n"}, {"type": "stdin_stdout", "input": "EZYYOIYUZXEVRTOUYXIQ\n", "output": "124.0168163\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.\n\nHulk likes the Inception s... | [{"type": "stdin_stdout", "input": "34\n", "output": "I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis time the Berland Team Olympiad in Informatics is held in a remote city that can only be reached by one small bus. Bus has n passenger seats, seat i can be occupied only by a participant from the city a_{i}.\n\nToday ... | [{"type": "stdin_stdout", "input": "10 5 1000000000\n1 1 1 2 2 1 2 2 2 2\n", "output": "10000000000\n"}, {"type": "stdin_stdout", "input": "1 1000000000 1000000000\n100000\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "5 3 2\n1 1 2 1 1\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "5 3 3\n1 2 2 1 1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVova promised himself that he would never play computer games... But recently Firestorm — a well-known game developing company — published their newest game, World of Farcraft, and it became really popular. Of course, Vov... | [{"type": "stdin_stdout", "input": "10 5\n1 6 2 7 3 8 4 9 5 10\n1 2\n3 4\n5 6\n7 8\n9 10\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "2 0\n1000000000 1000000000\n", "output": "2000000000\n"}, {"type": "stdin_stdout", "input": "10 0\n1 2 3 4 5 6 7 8 9 10\n", "output": "55\n"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArcady is a copywriter. His today's task is to type up an already well-designed story using his favorite text editor.\n\nArcady types words, punctuation signs and spaces one after another. Each letter and each sign (inclu... | [{"type": "stdin_stdout", "input": "thun-thun-thunder, thunder, thunder\nthunder, thun-, thunder\nthun-thun-thunder, thunder\nthunder, feel the thunder\nlightning then the thunder\nthunder, feel the thunder\nlightning then the thunder\nthunder, thunder\n", "output": "183\n"}, {"type": "stdin_stdout", "input": "snow aff... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya is preparing a contest, and now he has written a statement for an easy problem. The statement is a string of length $n$ consisting of lowercase Latin latters. Vasya thinks that the statement can be considered hard i... | [{"type": "stdin_stdout", "input": "25\ndadddhrdhradrdzzzahazaddr\n582987584 956970393 414785252 587245865 701672370 65936511 563890835 69653917 387506178 123924921 989335244 647820709 445085282 809768866 105799145 196558041 783108504 134067229 875977231 488184174 41982468 225574390 702881847 472688490 185455403\n", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store recently and Artem immediat... | [{"type": "stdin_stdout", "input": "3 10 2\n1 2\n3 2 7 5\n", "output": "0 0 0 0 0 0 0 0 0 0 \n0 0 0 0 0 0 0 5 0 0 \n0 0 0 0 0 0 0 0 0 0 \n"}, {"type": "stdin_stdout", "input": "5 5 1\n1 5\n", "output": "0 0 0 0 0 \n0 0 0 0 0 \n0 0 0 0 0 \n0 0 0 0 0 \n0 0 0 0 0 \n"}, {"type": "stdin_stdout", "input": "2 2 6\n2 1\n2 2\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIT City company developing computer games decided to upgrade its way to reward its employees. Now it looks the following way. After a new game release users start buying it actively, and the company tracks the number of s... | [{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "228571428571428571"}, {"type": "stdin_stdout", "input": "718281828459045235\n", "output": "164178703647781768"}, {"type": "stdin_stdout", "input": "987654321234567890\n", "output": "225749559139329804"}, {"type": "stdin_stdout", "input": "5040000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe crowdedness of the discotheque would never stop our friends from having fun, but a bit more spaciousness won't hurt, will it?\n\nThe discotheque can be seen as an infinite xy-plane, in which there are a total of n dan... | [{"type": "stdin_stdout", "input": "20\n-961747 0 961747\n-957138 0 957138\n-921232 0 921232\n-887450 0 887450\n-859109 0 859109\n-686787 0 686787\n-664613 0 664613\n-625553 0 625553\n-464803 0 464803\n-422784 0 422784\n-49107 0 49107\n-37424 0 37424\n134718 0 134718\n178903 0 178903\n304415 0 304415\n335362 0 335362\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLee bought some food for dinner time, but Lee's friends eat dinner in a deadly way. Lee is so scared, he doesn't want to die, at least not before seeing Online IOI 2020...\n\nThere are $n$ different types of food and $m$ ... | [{"type": "stdin_stdout", "input": "50 50\n1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n25 30\n7 47\n42 15\n19 38\n16 10\n8 6\n26 50\n3 44\n41 26\n32 17\n48 23\n15 50\n39 12\n24 2\n11 13\n21 20\n44 19\n16 35\n43 45\n35 41\n38 34\n42 4\n40 9\n30 5\n24 21\n14 28\n7 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou helped Dima to have a great weekend, but it's time to work. Naturally, Dima, as all other men who have girlfriends, does everything wrong.\n\nInna and Dima are now in one room. Inna tells Dima off for everything he do... | [{"type": "stdin_stdout", "input": "50 10\n1 2 3 4 5 6 7 8 9 10 10 1 1 1 1 1 1 1 1 1 10 1 1 1 1 1 1 1 1 1 10 1 1 1 1 1 1 1 1 1 10 1 1 1 1 1 1 1 1 1\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "20 10\n3 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 6 4\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "20 4\n1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTo quickly hire highly skilled specialists one of the new IT City companies made an unprecedented move. Every employee was granted a car, and an employee can choose one of four different car makes.\n\nThe parking lot befo... | [{"type": "stdin_stdout", "input": "29\n", "output": "1161928703861587968"}, {"type": "stdin_stdout", "input": "30\n", "output": "4809844402031689728"}, {"type": "stdin_stdout", "input": "28\n", "output": "280349076803813376"}, {"type": "stdin_stdout", "input": "15\n", "output": "2214592512"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a sorted array $a_1, a_2, \\dots, a_n$ (for each index $i > 1$ condition $a_i \\ge a_{i-1}$ holds) and an integer $k$.\n\nYou are asked to divide this array into $k$ non-empty consecutive subarrays. Every el... | [{"type": "stdin_stdout", "input": "8 1\n1 1 2 3 5 8 13 21\n", "output": "20\n"}, {"type": "stdin_stdout", "input": "5 3\n99 101 103 105 107\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "6 3\n4 8 15 16 23 42\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "5 2\n3 3 4 5 6\n", "output": "2\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBoboniu gives you\n\n $r$ red balls, $g$ green balls, $b$ blue balls, $w$ white balls. \n\nHe allows you to do the following operation as many times as you want: \n\n Pick a red ball, a green ball, and a blue ball an... | [{"type": "stdin_stdout", "input": "4\n0 1 1 1\n8 1 9 3\n0 0 0 0\n1000000000 1000000000 1000000000 1000000000\n", "output": "No\nYes\nYes\nYes\n"}, {"type": "stdin_stdout", "input": "1\n1 1 0 101\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "1\n2 0 0 0\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's the year 4527 and the tanks game that we all know and love still exists. There also exists Great Gena's code, written in 2016. The problem this code solves is: given the number of tanks that go into the battle from e... | [{"type": "stdin_stdout", "input": "6\n1000000000000000000000000000000000000 6643573784 1000000000000000000000000000000000000 1000000000000000000000000000000000000 1000000000000000000000000000000000000 1000000000000000000000000000000000000\n", "output": "66435737840000000000000000000000000000000000000000000000000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $t$ and $n$ strings $s_1, s_2, \\dots, s_n$. All strings consist of lowercase Latin letters.\n\nLet $f(t, s)$ be the number of occurences of string $s$ in string $t$. For example, $f('\\text{aaabaca... | [{"type": "stdin_stdout", "input": "abacabadabacaba\n22\na\nb\nc\nd\naba\naca\nabacabadabacaba\naa\ndab\nac\nca\nba\nab\nad\nda\nabacaba\nabacaba\nabacabad\nabacabad\ndabacaba\ndabacaba\nabacabadabacabaa\n", "output": "108\n"}, {"type": "stdin_stdout", "input": "aa\n7\na\naa\naaa\naaaa\naaaaa\naaaaaa\naaaaaaa\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn n × n table a is defined as follows:\n\n The first row and the first column contain ones, that is: a_{i}, 1 = a_{1, }i = 1 for all i = 1, 2, ..., n. Each of the remaining numbers in the table is equal to the sum of t... | [{"type": "stdin_stdout", "input": "10\n", "output": "48620"}, {"type": "stdin_stdout", "input": "9\n", "output": "12870"}, {"type": "stdin_stdout", "input": "8\n", "output": "3432"}, {"type": "stdin_stdout", "input": "6\n", "output": "252"}, {"type": "stdin_stdout", "input": "7\n", "output": "924"}, {"type": "stdin_st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBoboniu likes bit operations. He wants to play a game with you.\n\nBoboniu gives you two sequences of non-negative integers $a_1,a_2,\\ldots,a_n$ and $b_1,b_2,\\ldots,b_m$.\n\nFor each $i$ ($1\\le i\\le n$), you're asked ... | [{"type": "stdin_stdout", "input": "30 55\n194 478 207 22 344 507 374 462 107 506 317 299 326 308 459 396 330 317 138 342 126 473 423 180 41 165 435 72 53 71\n44 229 106 350 420 462 412 115 452 364 452 294 280 171 325 250 94 266 33 329 197 384 50 36 495 464 67 283 83 3 335 62 101 307 474 296 484 388 315 444 203 304 110... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nUh oh! Applications to tech companies are due soon, and you've been procrastinating by doing contests instead! (Let's pretend for now that it is actually possible to get a job in these uncertain times.)\n\nYou have comple... | [{"type": "stdin_stdout", "input": "100 89826\n1076 402 6 202 1196 687 966 243 1715 847 608 1446 1901 106 1622 222 865 204 1700 1001 1834 726 1158 1497 1928 1787 254 275 1788 1972 687 611 1983 1085 1876 311 1979 1845 1706 1360 528 1842 1041 1636 657 443 895 158 725 1884 13 1916 326 406 216 1040 677 620 785 1424 596 454... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob are playing a game. The game involves splitting up game pieces into two teams. There are n pieces, and the i-th piece has a strength p_{i}.\n\nThe way to split up game pieces is split into several steps:\n\n... | [{"type": "stdin_stdout", "input": "100\n591 417 888 251 792 847 685 3 182 461 102 348 555 956 771 901 712 878 580 631 342 333 285 899 525 725 537 718 929 653 84 788 104 355 624 803 253 853 201 995 536 184 65 205 540 652 549 777 248 405 677 950 431 580 600 846 328 429 134 983 526 103 500 963 400 23 276 704 570 757 410 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a legend in the IT City college. A student that failed to answer all questions on the game theory exam is given one more chance by his professor. The student has to play a game with the professor.\n\nThe game is ... | [{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "2"}, {"type": "stdin_stdout", "input": "999999999999999999\n", "output": "1"}, {"type": "stdin_stdout", "input": "321392715309062180\n", "output": "2"}, {"type": "stdin_stdout", "input": "95451113283177888\n", "output": "2"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYura has been walking for some time already and is planning to return home. He needs to get home as fast as possible. To do this, Yura can use the instant-movement locations around the city.\n\nLet's represent the city as... | [{"type": "stdin_stdout", "input": "995078784 16\n623812784 347467913 233267735 582455459\n306396207 277980472\n78770458 786182235\n815219022 611815511\n786044046 363376661\n290398527 925153345\n846155104 388600335\n91118406 155695413\n287078777 918827034\n432395923 126620751\n52941102 329010981\n237509699 743843421\n5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke is standing on a two-dimensional plane. In one operation, he can move by 1 in the positive x-direction, or move by 1 in the positive y-direction.\nLet us define a function f(r, c) as follows:\n - f(r,c) := (The num... | [{"type": "stdin_stdout", "input": "1000000 1000000 1000000 1000000\n", "output": "192151600\n"}, {"type": "stdin_stdout", "input": "799999 789898 979797 999999\n", "output": "50188529\n"}, {"type": "stdin_stdout", "input": "53245 34234 643323 948342\n", "output": "574642047\n"}, {"type": "stdin_stdout", "input": "3340... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are integers A, B, and N.\nFind the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N.\nHere floor(t) denotes the greatest integer not greater than the real numbe... | [{"type": "stdin_stdout", "input": "1000000 1000000000000 1000000000000\n", "output": "999999\n"}, {"type": "stdin_stdout", "input": "1000000 948240928204 329810943092\n", "output": "347813\n"}, {"type": "stdin_stdout", "input": "133333 329230329032 493028310923\n", "output": "133332\n"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrew skipped lessons on the subject 'Algorithms and Data Structures' for the entire term. When he came to the final test, the teacher decided to give him a difficult task as a punishment.\n\nThe teacher gave Andrew an a... | [{"type": "stdin_stdout", "input": "100\n0 1 1 1 0 0 0 2 1 2 2 1 2 2 2 0 0 2 1 2 0 1 1 0 2 0 1 2 2 0 2 0 1 0 1 2 0 2 1 1 0 1 0 1 0 0 1 2 2 2 2 1 1 1 0 2 1 0 0 0 0 0 1 0 2 0 1 0 0 2 0 2 2 1 0 2 2 0 2 0 2 1 2 1 1 1 0 2 1 0 2 1 1 2 1 2 0 1 2 2\n", "output": "36 29 38 33 35 33 34 31 28 21 21 21 17 14 17 18 21 22 23 24 24 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp is a frequent user of the very popular messenger. He's chatting with his friends all the time. He has $n$ friends, numbered from $1$ to $n$.\n\nRecall that a permutation of size $n$ is an array of size $n$ such t... | [{"type": "stdin_stdout", "input": "10 20\n10 1 5 7 1 2 5 3 6 3 9 4 3 4 9 6 8 4 9 6\n", "output": "1 8\n1 7\n1 6\n1 9\n1 6\n1 8\n1 9\n1 10\n1 10\n1 10\n"}, {"type": "stdin_stdout", "input": "5 5\n1 1 4 2 2\n", "output": "1 3\n1 3\n3 4\n1 4\n5 5\n"}, {"type": "stdin_stdout", "input": "5 4\n3 5 1 4\n", "output": "1 3\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInna loves sweets very much. That's why she decided to play a game called \"Sweet Matrix\".\n\nInna sees an n × m matrix and k candies. We'll index the matrix rows from 1 to n and the matrix columns from 1 to m. We'll rep... | [{"type": "stdin_stdout", "input": "10 10 10\n", "output": "30\n(1,1) (1,2) (1,3) (1,4)\n(1,1) (1,2) (1,3) (2,3)\n(1,1) (1,2) (2,2) (3,2)\n(1,1) (2,1) (3,1) (4,1)\n(1,1) (1,2) (1,3)\n(1,1) (1,2) (2,2)\n(1,1) (2,1) (3,1)\n(1,1) (1,2)\n(1,1) (2,1)\n(1,1)\n"}, {"type": "stdin_stdout", "input": "50 50 10\n", "output": "30\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.\n\nFor this reason, he made the n prison... | [{"type": "stdin_stdout", "input": "57 2 10\n7 5 2 7 4 1 0 5 2 9 2 9 8 6 6 5 9 6 8 1 0 1 0 3 2 6 5 2 8 8 8 8 0 9 4 3 6 6 2 4 5 1 2 0 1 7 1 1 5 4 5 0 7 5 1 9 6\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "2 228885628 1\n90897004 258427916\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "11 4 2\n2 2 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA permutation of size $n$ is an array of size $n$ such that each integer from $1$ to $n$ occurs exactly once in this array. An inversion in a permutation $p$ is a pair of indices $(i, j)$ such that $i > j$ and $a_i < a_j$... | [{"type": "stdin_stdout", "input": "69\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n", "output": "1173\n"}, {"type": "stdin_stdout", "input": "5\n-1 -1 5 -1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA card pyramid of height $1$ is constructed by resting two cards against each other. For $h>1$, a card pyramid of height $h$ is constructed by placing a card pyramid of height $h-1$ onto a base. A base consists of $h$ pyr... | [{"type": "stdin_stdout", "input": "50\n11833308\n5211498\n64660\n9077929\n2699416\n2432035\n234901\n1337830\n8457191\n10523566\n5722429\n5452712\n5511654\n8587879\n348160\n3141182\n2661936\n395300\n6950223\n2119926\n4407089\n3559060\n10228325\n5752720\n1607500\n647047\n8904557\n1954681\n698061\n9852830\n1972893\n13760... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnton's favourite geometric figures are regular polyhedrons. Note that there are five kinds of regular polyhedrons: \n\n Tetrahedron. Tetrahedron has 4 triangular faces. Cube. Cube has 6 square faces. Octahedron. Octah... | [{"type": "stdin_stdout", "input": "28\nOctahedron\nDodecahedron\nOctahedron\nOctahedron\nDodecahedron\nIcosahedron\nIcosahedron\nDodecahedron\nDodecahedron\nDodecahedron\nCube\nDodecahedron\nCube\nTetrahedron\nCube\nCube\nTetrahedron\nDodecahedron\nDodecahedron\nDodecahedron\nIcosahedron\nIcosahedron\nDodecahedron\nIc... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given sequence a_1, a_2, ..., a_{n} and m queries l_{j}, r_{j} (1 ≤ l_{j} ≤ r_{j} ≤ n). For each query you need to print the minimum distance between such pair of elements a_{x} and a_{y} (x ≠ y), that: both inde... | [{"type": "stdin_stdout", "input": "10 6\n2 2 1 5 6 4 9 8 5 4\n1 2\n1 10\n2 10\n2 9\n5 5\n2 8\n", "output": "1\n1\n4\n5\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "6 5\n1 2 1 3 2 3\n4 6\n1 3\n2 5\n2 4\n1 6\n", "output": "2\n2\n3\n-1\n2\n"}, {"type": "stdin_stdout", "input": "2 5\n1 1\n1 1\n1 2\n2 2\n1 2\n1 1\n", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIf the girl doesn't go to Denis, then Denis will go to the girl. Using this rule, the young man left home, bought flowers and went to Nastya. \n\nOn the way from Denis's house to the girl's house is a road of $n$ lines. T... | [{"type": "stdin_stdout", "input": "30 8\n0 1 9 10 23 24 26 30\n40 7\n", "output": "30"}, {"type": "stdin_stdout", "input": "100 5\n3 100 7 13 0\n99 5\n", "output": "191"}, {"type": "stdin_stdout", "input": "15 5\n0 3 7 14 15\n11 11\n", "output": "45"}, {"type": "stdin_stdout", "input": "15 5\n15 3 7 0 14\n11 11\n", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet $LCM(x, y)$ be the minimum positive integer that is divisible by both $x$ and $y$. For example, $LCM(13, 37) = 481$, $LCM(9, 6) = 18$.\n\nYou are given two integers $l$ and $r$. Find two integers $x$ and $y$ such that... | [{"type": "stdin_stdout", "input": "69\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\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... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.\n\nThere were $n$ c... | [{"type": "stdin_stdout", "input": "200\n0 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 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\n", "output": "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 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (... | [{"type": "stdin_stdout", "input": "9 6\n-44 -29\n-11 85\n11 84\n-63 1\n75 89\n-37 61\n14 73\n78 88\n-22 -18\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "2 2\n26 99\n-56 40\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "2 2\n-93 -22\n12 72\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnastasia loves going for a walk in Central Uzhlyandian Park. But she became uninterested in simple walking, so she began to collect Uzhlyandian pebbles. At first, she decided to collect all the pebbles she could find in ... | [{"type": "stdin_stdout", "input": "9 13\n132 87 200 62 168 51 185 192 118\n", "output": "48\n"}, {"type": "stdin_stdout", "input": "10 1\n1 1 1 1 1 1 1 1 1 1\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "5 72\n74 10 146 189 184\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "3 57\n78 165 54\n", "ou... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.