messages listlengths 1 1 | ground_truth stringlengths 88 726k | dataset stringclasses 1
value |
|---|---|---|
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are some websites that are accessible through several different addresses. For example, for a long time Codeforces was accessible with two hostnames codeforces.com and codeforces.ru.\n\nYou are given a list of page ... | [{"type": "stdin_stdout", "input": "15\nhttp://w.hhjvdn.mmu/.ca.p\nhttp://m.p.p.lar/\nhttp://lgmjun.r.kogpr.ijn/./t\nhttp://bapchpl.mcw.a.lob/d/ym/./g.q\nhttp://uxnjfnjp.kxr.ss.e.uu/jwo./hjl/\nhttp://fd.ezw.ykbb.xhl.t/\nhttp://i.xcb.kr/.ca.p\nhttp://jofec.ry.fht.gt\nhttp://qeo.gghwe.lcr/d/ym/./g.q\nhttp://gt\nhttp://gj... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDreamoon loves summing up something for no reason. One day he obtains two integers a and b occasionally. He wants to calculate the sum of all nice integers. Positive integer x is called nice if $\\operatorname{mod}(x, b) ... | [{"type": "stdin_stdout", "input": "10000000 10000000\n", "output": "425362313\n"}, {"type": "stdin_stdout", "input": "10000000 9999999\n", "output": "930564389\n"}, {"type": "stdin_stdout", "input": "9999999 9999999\n", "output": "957764103\n"}, {"type": "stdin_stdout", "input": "6407688 3000816\n", "output": "8953996... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path.\n\nYou are given l and r. For all integers from l to r, inclusive, we wrote down all of the... | [{"type": "stdin_stdout", "input": "519002744 519002744\n", "output": "519002744\n"}, {"type": "stdin_stdout", "input": "331900277 331900277\n", "output": "331900277\n"}, {"type": "stdin_stdout", "input": "349533413 349533413\n", "output": "349533413\n"}, {"type": "stdin_stdout", "input": "568814539 568814539\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\"QAQ\" is a word to denote an expression of crying. Imagine \"Q\" as eyes with tears and \"A\" as a mouth.\n\nNow Diamond has given Bort a string consisting of only uppercase English letters of length n. There is a great... | [{"type": "stdin_stdout", "input": "QCQAQAGAWAQQQAQAVQAQQQQAQAQQQAQAAATQAAVAAAQQQQAAAUUQAQQNQQWQQWAQAAQQKQYAQAAQQQAAQRAQQQWBQQQQAPBAQGQA\n", "output": "13174\n"}, {"type": "stdin_stdout", "input": "QQAQQAKQFAQLQAAWAMQAZQAJQAAQQOACQQAAAYANAQAQQAQAAQQAOBQQJQAQAQAQQQAAAAABQQQAVNZAQQQQAMQQAFAAEAQAQHQT\n", "output": "10420\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCodefortia is a small island country located somewhere in the West Pacific. It consists of $n$ settlements connected by $m$ bidirectional gravel roads. Curiously enough, the beliefs of the inhabitants require the time nee... | [{"type": "stdin_stdout", "input": "6 7 13 22\n1 2 13\n2 3 13\n1 4 22\n3 4 13\n4 5 13\n5 6 13\n6 1 13\n", "output": "0 13 26 39 26 13\n"}, {"type": "stdin_stdout", "input": "3 3 2770628 3912422\n1 2 2770628\n2 3 2770628\n1 3 3912422\n", "output": "0 2770628 5541256\n"}, {"type": "stdin_stdout", "input": "3 3 2566490 51... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPikachu had an array with him. He wrote down all the non-empty subsequences of the array on paper. Note that an array of size n has 2^{n} - 1 non-empty subsequences in it. \n\nPikachu being mischievous as he always is, re... | [{"type": "stdin_stdout", "input": "1000000 1\n", "output": "106\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 11 11 11 11 11 11 11 11 13 13 13 13 13 13 15 17 19 21 23 25 27 "}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. ... | [{"type": "stdin_stdout", "input": "jkeaagakbifeaechkifkdghcjcgighidcgdccfbdbcackfgaebkddabgijkhjkaffkabacekdkjekeccegbecbkecbgbgcacgdackcdfjefaifgbigahkbedidfhjbikejdhejcgideaeejdcegeeccaefbddejkbdkfagfcdjbikbidfggkidcdcic\n", "output": "0.438502673796791\n"}, {"type": "stdin_stdout", "input": "ibledofnibedebifmnjdoai... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the evenings Donkey would join Shrek to look at the stars. They would sit on a log, sipping tea and they would watch the starry sky. The sky hung above the roof, right behind the chimney. Shrek's stars were to the righ... | [{"type": "stdin_stdout", "input": "5\n27/18 27/17\n27746 42830\n22071 47985\n44242 62799\n16038 48367\n85158 21622\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n27/18 27/17\n91659 76441\n96317 38081\n99805 94867\n79758 84753\n96445 53616\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "15\n1/3 2/... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.\n\nTo make sure that the number a fits on the piece of paper, the Little Elephant ought to delete ex... | [{"type": "stdin_stdout", "input": "11100010010010000110101101101100111111001010001101101001001111010110010111001011010000001100110101000101111000001111101111110010000010101110011110101101010110001100011101111011100010011101100111110010111111100110101000000111101000000000110100100101111101000110101010101101001110001110... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following mo... | [{"type": "stdin_stdout", "input": "10\n100000000 200000000 300000000 400000000 500000000 600000000 700000000 800000000 900000000 1000000000\n", "output": "Bob\n"}, {"type": "stdin_stdout", "input": "10\n1 999999999 999999998 999999997 999999996 999999995 999999994 999999993 999999992 999999991\n", "output": "Alice\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMad scientist Mike does not use slow hard disks. His modification of a hard drive has not one, but n different heads that can read data in parallel.\n\nWhen viewed from the side, Mike's hard drive is an endless array of t... | [{"type": "stdin_stdout", "input": "10 11\n1 909090909 1818181817 2727272725 3636363633 4545454541 5454545449 6363636357 7272727265 8181818173\n454545455 1363636363 2272727271 3181818179 4090909087 4999999995 5909090903 6818181811 7727272719 8636363627 9545454535\n", "output": "1363636362\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA schoolboy named Vasya loves reading books on programming and mathematics. He has recently read an encyclopedia article that described the method of median smoothing (or median filter) and its many applications in scienc... | [{"type": "stdin_stdout", "input": "168\n0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a vector $\\vec{v} = (x, y)$, define $|v| = \\sqrt{x^2 + y^2}$.\n\nAllen had a bit too much to drink at the bar, which is at the origin. There are $n$ vectors $\\vec{v_1}, \\vec{v_2}, \\cdots, \\vec{v_n}$. Allen will ... | [{"type": "stdin_stdout", "input": "9\n1000000 0\n0 -999999\n600000 600000\n600000 600000\n600000 600000\n-600000 -600000\n600000 600000\n600000 600000\n-700000 710000\n", "output": "1 1 1 -1 1 1 1 -1 1 \n"}, {"type": "stdin_stdout", "input": "8\n-411248 143802\n300365 629658\n363219 343742\n396148 -94037\n-722124 4677... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLimak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of h_{i} identical blocks. For clarification see picture for the first sample.\n... | [{"type": "stdin_stdout", "input": "170\n1 2 1 2 1 1 1 1 2 3 2 1 1 2 2 1 2 1 2 1 1 2 3 3 2 1 1 1 1 1 1 1 1 2 1 2 3 3 2 1 2 2 1 2 3 2 1 1 2 3 2 1 2 1 1 1 2 3 3 2 1 2 1 2 1 1 1 2 1 2 1 1 2 2 1 1 2 1 2 2 1 2 1 2 2 1 2 1 2 3 2 1 1 2 3 4 4 3 2 1 2 1 2 1 2 3 3 2 1 2 1 1 1 1 1 1 1 2 2 1 1 2 1 1 1 1 2 1 1 2 3 2 1 2 2 1 2 1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEighth-grader Vova is on duty today in the class. After classes, he went into the office to wash the board, and found on it the number n. He asked what is this number and the teacher of mathematics Inna Petrovna answered ... | [{"type": "stdin_stdout", "input": "999999979\n", "output": "2\n999999899\n999999908\n"}, {"type": "stdin_stdout", "input": "100000001\n", "output": "2\n99999937\n100000000\n"}, {"type": "stdin_stdout", "input": "1000000000\n", "output": "1\n999999932\n"}, {"type": "stdin_stdout", "input": "2014\n", "output": "2\n1988\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a non-empty string s consisting of lowercase English letters. You have to pick exactly one non-empty substring of s and shift all its letters 'z' $\\rightarrow$ 'y' $\\rightarrow$ 'x' $\\rightarrow \\ldots \... | [{"type": "stdin_stdout", "input": "abbbbbbbabbbbbbbbbbbbbbbbbbbbbbbabbabbbbbabbbbbbbbbbbabbbbbbbbabbabbbbbbbbbbbbbbabbabbbaababbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbabbbbbbbbbbbbbbbbabbbbabbbbbbbbbbbbbbbabbbbbbbbbaababbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbabbabbbbbbbbbbbbbbbbabbbabbbbbaabbabbbbbbbbb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter a wonderful evening in the restaurant the time to go home came. Leha as a true gentlemen suggested Noora to give her a lift. Certainly the girl agreed with pleasure. Suddenly one problem appeared: Leha cannot find h... | [{"type": "stdin_stdout", "input": "10\n63468235 40219768 326916221 835104676 1952530008\n297013188 212688608 432392437 887776079 1462376999\n153855395 41506149 261808021 778766232 291194343\n238640217 22153210 642972954 719331789 371665652\n528859722 494055455 831993741 924681396 251221747\n19429387 475067059 56744688... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.\n\nAll children love to cry loudly at the reception at the dentist. We enumerate th... | [{"type": "stdin_stdout", "input": "10\n9 8 8\n2 9 33\n10 7 42\n7 2 18\n3 5 82\n9 9 25\n3 2 86\n3 5 49\n5 3 72\n4 4 71\n", "output": "10\n1 2 3 4 5 6 7 8 9 10 "}, {"type": "stdin_stdout", "input": "10\n4 9 1\n8 2 14\n7 10 20\n6 9 18\n5 3 19\n2 9 7\n6 8 30\n8 7 38\n6 5 5\n6 9 37\n", "output": "8\n1 2 3 4 5 7 8 10 "}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem is the most boring one you've ever seen. \n\nGiven a sequence of integers a_1, a_2, ..., a_{n} and a non-negative integer h, our goal is to partition the sequence into two subsequences (not necessarily consis... | [{"type": "stdin_stdout", "input": "20 10\n12986238 12986234 12986240 12986238 12986234 12986238 12986234 12986234 12986236 12986236 12986232 12986238 12986232 12986239 12986233 12986238 12986237 12986232 12986231 12986235\n", "output": "16\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 \n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan wants to make a necklace as a present to his beloved girl. A necklace is a cyclic sequence of beads of different colors. Ivan says that necklace is beautiful relative to the cut point between two adjacent beads, if t... | [{"type": "stdin_stdout", "input": "2\n95 50\n", "output": "5\nbbbbbaaaaaaaaaaaaaaaaaaabbbbbbbbbbaaaaaaaaaaaaaaaaaaabbbbbbbbbbaaaaaaaaaaaaaaaaaaabbbbbbbbbbaaaaaaaaaaaaaaaaaaabbbbbbbbbbaaaaaaaaaaaaaaaaaaabbbbb\n"}, {"type": "stdin_stdout", "input": "3\n1 50 70\n", "output": "1\nbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccc... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, Pari and Arya did some research about NP-Hard problems and they found the minimum vertex cover problem very interesting.\n\nSuppose the graph G is given. Subset A of its vertices is called a vertex cover of this... | [{"type": "stdin_stdout", "input": "20 22\n20 8\n1 3\n3 18\n14 7\n19 6\n7 20\n14 8\n8 10\n2 5\n11 2\n4 19\n14 2\n7 11\n15 1\n12 15\n7 6\n11 13\n1 16\n9 12\n1 19\n17 3\n11 20\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "20 22\n3 18\n9 19\n6 15\n7 1\n16 8\n18 7\n12 3\n18 4\n9 15\n20 1\n4 2\n6 7\n14 2\n7 15\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nStudents went into a class to write a test and sat in some way. The teacher thought: \"Probably they sat in this order to copy works of each other. I need to rearrange them in such a way that students that were neighbors ... | [{"type": "stdin_stdout", "input": "101 1\n", "output": "YES\n1\n3\n5\n7\n9\n11\n13\n15\n17\n19\n21\n23\n25\n27\n29\n31\n33\n35\n37\n39\n41\n43\n45\n47\n49\n51\n53\n55\n57\n59\n61\n63\n65\n67\n69\n71\n73\n75\n77\n79\n81\n83\n85\n87\n89\n91\n93\n95\n97\n99\n101\n2\n4\n6\n8\n10\n12\n14\n16\n18\n20\n22\n24\n26\n28\n30\n32... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!\n\nThe only thing Mrs. Smith remembered was that any permutation of $n$ can be a secret phone number. Only those permutation... | [{"type": "stdin_stdout", "input": "108\n", "output": "99 100 101 102 103 104 105 106 107 108 89 90 91 92 93 94 95 96 97 98 79 80 81 82 83 84 85 86 87 88 69 70 71 72 73 74 75 76 77 78 59 60 61 62 63 64 65 66 67 68 49 50 51 52 53 54 55 56 57 58 39 40 41 42 43 44 45 46 47 48 29 30 31 32 33 34 35 36 37 38 19 20 21 22 23 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou're playing a game called Osu! Here's a simplified version of it. There are n clicks in a game. For each click there are two outcomes: correct or bad. Let us denote correct as \"O\", bad as \"X\", then the whole play c... | [{"type": "stdin_stdout", "input": "30\n0.999453 0.998210 0.999812 0.998309 0.999333 0.999463 0.999490 0.998975 0.999248 0.999782 0.999233 0.999062 0.999530 0.998674 0.999608 0.999654 0.998426 0.998941 0.998104 0.999541 0.999467 0.999961 0.999180 0.998842 0.998022 0.998345 0.998064 0.999984 0.998017 0.998843\n", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYaroslav is playing a game called \"Time\". The game has a timer showing the lifespan he's got left. As soon as the timer shows 0, Yaroslav's character dies and the game ends. Also, the game has n clock stations, station ... | [{"type": "stdin_stdout", "input": "12 1542\n389 356 290 648 182 94 585 988 762 494\n-46 96\n1 88\n0 95\n-91 -100\n-42 -29\n45 -27\n-52 -34\n-62 27\n-19 46\n-100 95\n5 -55\n-36 -65\n", "output": "263034\n"}, {"type": "stdin_stdout", "input": "12 1609\n196 486 94 344 524 588 315 504 449 201\n86 -22\n-2 25\n-95 -8\n-5 -3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSquirrel Liss lived in a forest peacefully, but unexpected trouble happens. Stones fall from a mountain. Initially Squirrel Liss occupies an interval [0, 1]. Next, n stones will fall and Liss will escape from the stones. ... | [{"type": "stdin_stdout", "input": "rrlllrrrlrrlrrrlllrlrlrrrlllrllrrllrllrrlrlrrllllrlrrrrlrlllrlrrrlrlrllrlrlrrlrrllrrrlrlrlllrrllllrl\n", "output": "1\n2\n6\n7\n8\n10\n11\n13\n14\n15\n19\n21\n23\n24\n25\n29\n32\n33\n36\n39\n40\n42\n44\n45\n50\n52\n53\n54\n55\n57\n61\n63\n64\n65\n67\n69\n72\n74\n76\n77\n79\n80\n83\n8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nReading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: \"Many are my names in many countries. Mithrandir a... | [{"type": "stdin_stdout", "input": "tttdddssstttssstttdddddddddttttttdddsssdddtttsssdddsssssstttddddddtttdddssstttsssttttttdddtttsssssstttssssssssstttsssssstttssstttdddddddddsssdddssssssdddssstttsssdddssstttdddttttttdddddddddsssssstttdddtttssssssdddddddddttttttdddtttsssdddssstttsssdddssssssdddsssdddddddddtttssstttsssss... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA group of n cities is connected by a network of roads. There is an undirected road between every pair of cities, so there are $\\frac{n \\cdot(n - 1)}{2}$ roads in total. It takes exactly y seconds to traverse any single... | [{"type": "stdin_stdout", "input": "50 23129 410924\n18 28\n17 23\n21 15\n18 50\n50 11\n32 3\n44 41\n50 31\n50 34\n5 14\n36 13\n22 40\n20 9\n9 43\n19 47\n48 40\n20 22\n33 45\n35 22\n33 24\n9 6\n13 1\n13 24\n49 20\n1 20\n29 38\n10 35\n25 23\n49 30\n42 8\n20 18\n32 15\n32 1\n27 10\n20 47\n41 7\n20 14\n18 26\n4 20\n20 2\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDreamoon likes coloring cells very much.\n\nThere is a row of $n$ cells. Initially, all cells are empty (don't contain any color). Cells are numbered from $1$ to $n$.\n\nYou are given an integer $m$ and $m$ integers $l_1,... | [{"type": "stdin_stdout", "input": "2000 100\n5 128 1368 1679 1265 313 1854 1512 1924 338 38 1971 238 1262 1834 1878 1749 784 770 1617 191 395 303 214 1910 1300 741 1966 1367 24 268 403 1828 1033 1424 218 1146 925 1501 1760 1164 1881 1628 1596 1358 1360 29 1343 922 618 1537 1839 1114 1381 704 464 692 1450 1590 1121 670... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVanya wants to minimize a tree. He can perform the following operation multiple times: choose a vertex v, and two disjoint (except for v) paths of equal length a_0 = v, a_1, ..., a_{k}, and b_0 = v, b_1, ..., b_{k}. Addit... | [{"type": "stdin_stdout", "input": "12\n12 6\n6 7\n8 11\n4 8\n10 4\n12 3\n2 10\n6 2\n12 9\n4 1\n9 5\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "11\n11 9\n6 7\n7 1\n8 11\n5 6\n3 5\n9 3\n10 8\n2 4\n4 10\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "11\n8 9\n2 7\n1 11\n3 2\n9 1\n8 5\n8 6\n5 4\n4 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSasha is taking part in a programming competition. In one of the problems she should check if some rooted trees are isomorphic or not. She has never seen this problem before, but, being an experienced participant, she gue... | [{"type": "stdin_stdout", "input": "123\n1 1 1 3714 1 3739 1 3720 1 1 3741 1 1 3726 1 3836 1 3777 1 1 3727 1 1 3866 1 3799 1 3785 1 3693 1 1 3667 1 3930 1 3849 1 1 3767 1 3792 1 3792 1 3808 1 3680 1 3798 1 3817 1 3636 1 3833 1 1 3765 1 3774 1 3747 1 1 3897 1 3773 1 3814 1 3739 1 1 3852 1 3759 1 3783 1 1 3836 1 3787 1 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given $n$ points on the plane. The polygon formed from all the $n$ points is strictly convex, that is, the polygon is convex, and there are no three collinear points (i.e. lying in the same straight line). The poi... | [{"type": "stdin_stdout", "input": "20\n-2967010 48581504\n-2967318 48581765\n-2967443 48581988\n-2967541 48582265\n-2967443 48582542\n-2967318 48582765\n-2967010 48583026\n-2966691 48583154\n-2966252 48583234\n-2965813 48583154\n-2965494 48583026\n-2965186 48582765\n-2965061 48582542\n-2964963 48582265\n-2965061 48581... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe biggest event of the year – Cota 2 world championship \"The Innernational\" is right around the corner. $2^n$ teams will compete in a double-elimination format (please, carefully read problem statement even if you kno... | [{"type": "stdin_stdout", "input": "16 50\n57794 44224 38309 41637 11732 44974 655 27143 11324 49584 3371 17159 26557 38800 33033 18231 26264 14765 33584 30879 46988 60703 52973 47349 22720 51251 54716 29642 7041 54896 12197 38530 51481 43063 55463 2057 48064 41953 16250 21272 34003 51464 50389 30417 45901 38895 25949 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou work in a big office. It is a 9 floor building with an elevator that can accommodate up to 4 people. It is your responsibility to manage this elevator.\n\nToday you are late, so there are queues on some floors already... | [{"type": "stdin_stdout", "input": "50\n9 5\n2 6\n5 4\n7 5\n3 6\n5 8\n1 2\n6 1\n9 7\n8 1\n9 5\n6 8\n6 8\n2 8\n4 9\n6 7\n7 8\n5 8\n1 2\n9 2\n5 9\n6 7\n3 2\n9 8\n7 8\n7 4\n6 5\n1 7\n6 5\n2 6\n3 1\n6 5\n3 7\n9 3\n8 1\n8 3\n8 2\n1 9\n9 2\n3 2\n8 7\n5 1\n6 2\n2 1\n6 1\n3 4\n4 1\n2 3\n2 6\n2 9\n", "output": "278"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLogical quantifiers are very useful tools for expressing claims about a set. For this problem, let's focus on the set of real numbers specifically. The set of real numbers includes zero and negatives. There are two kinds ... | [{"type": "stdin_stdout", "input": "100 50\n55 13\n84 2\n22 63\n100 91\n2 18\n98 64\n1 86\n93 11\n17 6\n24 97\n14 35\n24 74\n22 3\n42 5\n63 79\n31 89\n81 22\n86 88\n77 51\n81 34\n19 55\n41 54\n34 57\n45 9\n55 72\n67 61\n41 84\n39 32\n51 89\n58 74\n32 79\n65 6\n86 64\n63 42\n100 57\n46 39\n100 9\n23 58\n26 81\n61 49\n71... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToad Zitz has an array of integers, each integer is between $0$ and $m-1$ inclusive. The integers are $a_1, a_2, \\ldots, a_n$.\n\nIn one operation Zitz can choose an integer $k$ and $k$ indices $i_1, i_2, \\ldots, i_k$ s... | [{"type": "stdin_stdout", "input": "100 1000\n980 755 745 448 424 691 210 545 942 979 555 783 425 942 495 741 487 514 752 434 187 874 372 617 414 505 659 445 81 397 243 986 441 587 31 350 831 801 194 103 723 166 108 182 252 846 328 905 639 690 738 638 986 340 559 626 572 808 442 410 179 549 880 153 449 99 434 945 163 6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIgor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally, and thus he wants to cut t... | [{"type": "stdin_stdout", "input": "20 17\n", "output": "3.801315561750 5.375872022286 6.584071688553 7.602631123499 8.500000000000 9.311283477588 10.057335631269 10.751744044572 11.403946685249 12.020815280171 12.607537428063 13.168143377105 13.705838172108 14.223220451079 14.722431864335 15.205262246999 15.6732255773... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe life goes up and down, just like nice sequences. Sequence t_1, t_2, ..., t_{n} is called nice if the following two conditions are satisfied: t_{i} < t_{i} + 1 for each odd i < n; t_{i} > t_{i} + 1 for each even i <... | [{"type": "stdin_stdout", "input": "50\n11836 28308 72527 92281 139289 93797 134555 148444 40866 111317 21564 87813 65466 20541 99238 2287 74647 128071 18163 61672 39766 55589 138385 147443 138100 142683 60703 15444 52566 72976 147412 116006 115986 110545 79993 100440 9876 71470 75209 62443 64906 88987 72232 2246 63160... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent photo by swiping finger over the screen. If you swipe left from the first photo, y... | [{"type": "stdin_stdout", "input": "100 20 100 10202\nwwwwhhwhhwhhwhhhhhwwwhhhwwwhwwhwhhwwhhwwwhwwhwwwhwhwhwwhhhwhwhhwhwwhhwhwhwwwhwwwwhwhwwwwhwhhhwhwhwww\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "20 10 10 1\nhwhwhwhwhwhwhwhwhhhw\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "16 1 1000 2100\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDoubly linked list is one of the fundamental data structures. A doubly linked list is a sequence of elements, each containing information about the previous and the next elements of the list. In this problem all lists hav... | [{"type": "stdin_stdout", "input": "10\n7 5\n5 0\n4 7\n10 3\n1 2\n0 9\n3 1\n9 10\n6 8\n8 4\n", "output": "7 5\n5 0\n4 7\n10 3\n1 2\n0 9\n3 1\n9 10\n6 8\n8 4\n"}, {"type": "stdin_stdout", "input": "10\n6 2\n1 0\n9 4\n3 6\n10 8\n4 1\n0 10\n5 0\n0 3\n7 5\n", "output": "6 2\n1 0\n9 4\n3 6\n10 8\n4 1\n0 10\n5 9\n8 3\n7 5\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHooray! Berl II, the king of Berland is making a knight tournament. The king has already sent the message to all knights in the kingdom and they in turn agreed to participate in this grand event.\n\nAs for you, you're jus... | [{"type": "stdin_stdout", "input": "11 8\n3 5 5\n8 9 9\n4 6 6\n8 10 10\n5 7 7\n2 7 2\n10 11 11\n1 11 1\n", "output": "0 1 5 5 6 7 2 9 10 11 1 "}, {"type": "stdin_stdout", "input": "11 7\n7 8 8\n5 6 5\n1 3 3\n7 9 9\n5 10 10\n10 11 11\n1 11 4\n", "output": "3 3 4 0 10 5 8 9 10 11 4 "}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAllen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how... | [{"type": "stdin_stdout", "input": "50 1\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 1 0 0 0 0 0 0 0 0\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\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 1 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\nWe all know the impressive story of Robin Hood. Robin Hood uses his archery skills and his wits to steal the money from rich, and return it to the poor.\n\nThere are n citizens in Kekoland, each person has c_{i} coins. Ea... | [{"type": "stdin_stdout", "input": "123 54564\n38 44 41 42 59 3 95 15 45 32 44 69 35 83 94 57 65 85 64 47 24 20 34 86 26 91 98 12 36 96 80 4 70 40 95 38 70 22 58 50 34 84 80 45 14 60 61 43 11 56 19 59 50 63 21 15 97 98 27 13 9 71 32 18 90 10 2 99 75 87 74 83 79 37 89 3 49 27 92 95 49 1 26 50 72 75 81 37 60 98 28 28 10 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game.\n\nInitially, Bob chooses integer m, bit depth of the game, which means that all num... | [{"type": "stdin_stdout", "input": "17 15\na := 010000111111110\nb := 101100110000100\nc := 100101100100111\nd := 010110101110110\ne := 111111000010110\nf := 011001110111110\ng := 110011010100101\nh := 000001010010001\ni := 110000111001011\nj := 000010000010111\nk := 110110111110110\nl := 010000110000100\nm := 00011110... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHelen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.\n\nMetropolis airpo... | [{"type": "stdin_stdout", "input": "10 6\n2226 89307 11261 28772 23196 30298 10832 43119 74662 24028\n", "output": "1246672\n16 7 14 11 13 10 15 8 9 12 \n"}, {"type": "stdin_stdout", "input": "10 5\n66220 81797 38439 54881 86879 94346 8802 59094 57095 41949\n", "output": "2484818\n9 8 14 12 7 6 15 10 11 13 \n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board cells. Then for n - 1 minut... | [{"type": "stdin_stdout", "input": "5 5\n3 2\n5 4\n3 3\n2 3\n1 2\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5 5\n3 2\n1 4\n5 1\n4 5\n3 1\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "5 5\n2 2\n5 3\n2 3\n5 1\n4 4\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "6 5\n2 6\n6 5\n3 1\n2 2\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n$n$ boys and $m$ girls came to the party. Each boy presented each girl some integer number of sweets (possibly zero). All boys are numbered with integers from $1$ to $n$ and all girls are numbered with integers from $1$ t... | [{"type": "stdin_stdout", "input": "2 2\n100000000 100000000\n100000000 100000000\n", "output": "400000000"}, {"type": "stdin_stdout", "input": "2 2\n14419485 34715515\n45193875 34715515\n", "output": "108748360"}, {"type": "stdin_stdout", "input": "2 2\n89164828 36174769\n90570286 89164829\n", "output": "305074712"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEach New Year Timofey and his friends cut down a tree of n vertices and bring it home. After that they paint all the n its vertices, so that the i-th vertex gets color c_{i}.\n\nNow it's time for Timofey birthday, and his... | [{"type": "stdin_stdout", "input": "10\n5 7\n4 5\n10 2\n3 6\n1 2\n3 4\n8 5\n4 9\n2 3\n15 15 15 15 5 15 26 18 15 15\n", "output": "YES\n5"}, {"type": "stdin_stdout", "input": "9\n1 2\n2 3\n3 4\n4 5\n2 7\n7 6\n2 8\n8 9\n1 1 2 2 2 3 3 4 4\n", "output": "YES\n2"}, {"type": "stdin_stdout", "input": "8\n1 2\n1 3\n3 5\n3 6\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrew and Eugene are playing a game. Initially, Andrew has string s, consisting of digits. Eugene sends Andrew multiple queries of type \"d_{i} → t_{i}\", that means \"replace all digits d_{i} in string s with substrings... | [{"type": "stdin_stdout", "input": "19693141406182378241404307417907800263629336520110\n49\n2->\n0->\n3->\n9->\n6->\n5->\n1->\n4->\n8->\n7->0649713852\n0->\n4->\n5->\n3->\n1->\n8->\n7->\n9->\n6->\n2->2563194780\n0->\n8->\n1->\n3->\n5->\n4->\n7->\n2->\n6->\n9->8360512479\n0->\n3->\n6->\n4->\n2->\n9->\n7->\n1->\n8->\n5->... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two binary strings $a$ and $b$ of the same length. You can perform the following two operations on the string $a$:\n\n Swap any two bits at indices $i$ and $j$ respectively ($1 \\le i, j \\le n$), the cost ... | [{"type": "stdin_stdout", "input": "91\n0010010000110001001011011011111001000110001000100111110010010001100110010111100111011111100\n1101110110000100110000100011010110111101100000011011100111111000110000001101101111100100101\n", "output": "43\n"}, {"type": "stdin_stdout", "input": "19\n1111010011111010100\n101000011010... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a string of letters 'a' and 'b'. We want to perform some operations on it. On each step we choose one of substrings \"ab\" in the string and replace it with the string \"bba\". If we have no \"ab\" as a substring,... | [{"type": "stdin_stdout", "input": "abaaaaaabaaaabbabbaaabbbbabababaaaaabbaabbaaaaabbbaababaaaaaaabbbbbaaaaabaababbabababbabbbbaabbaabbabbbabaabbaabbaaaaaab\n", "output": "235606597\n"}, {"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbaaaaaaaaabaabaaababaabaababaaabababaabbbbb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSonya was unable to think of a story for this problem, so here comes the formal description.\n\nYou are given the array containing n positive integers. At one turn you can pick any element and increase or decrease it by 1... | [{"type": "stdin_stdout", "input": "75\n392 593 98 533 515 448 220 310 386 79 539 294 208 828 75 534 875 493 94 205 656 105 546 493 60 188 222 108 788 504 809 621 934 455 307 212 630 298 938 62 850 421 839 134 950 256 934 817 209 559 866 67 990 835 534 672 468 768 757 516 959 893 275 315 692 927 321 554 801 805 885 12 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEvlampiy has found one more cool application to process photos. However the application has certain limitations.\n\nEach photo i has a contrast v_{i}. In order for the processing to be truly of high quality, the applicati... | [{"type": "stdin_stdout", "input": "101 9\n3 2 2 1 4 1 3 2 3 4 3 2 3 1 4 4 1 1 4 1 3 3 4 1 2 1 1 3 1 2 2 4 3 1 4 3 1 1 4 4 1 2 1 1 4 2 3 4 1 2 1 4 4 1 4 3 1 4 2 1 2 1 4 3 4 3 4 2 2 4 3 2 1 3 4 3 2 2 4 3 3 2 4 1 3 2 2 4 1 3 4 2 1 3 3 2 2 1 1 3 1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "100 28\n1 2 3 5 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe \"BerCorp\" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of... | [{"type": "stdin_stdout", "input": "10 10\n5 7 5 2 8 1\n7 10 6 9 5 8 2 4\n2 2 7\n5 8 6 9 10 1\n2 9 5\n3 6 5 2\n6 5 8 7 9 10 4\n0\n1 1\n2 8 6\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "7 3\n3 1 3 2\n3 2 1 3\n2 2 3\n1 1\n2 2 3\n3 3 2 1\n3 2 3 1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "8 4\n0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n3R2 as DJ Mashiro - Happiness Breeze Ice - DJ Mashiro is dead or alive\n\nNEKO#ΦωΦ has just got a new maze game on her PC!\n\nThe game's main puzzle is a maze, in the forms of a $2 \\times n$ rectangle grid. NEKO's task i... | [{"type": "stdin_stdout", "input": "10 83\n1 3\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n1 4\n2 2\n2 3\n2 3\n2 3\n2 3\n2 3\n2 3\n1 4\n1 5\n1 7\n2 2\n2 2\n1 5\n2 2\n1 3\n2 1\n2 6\n1 5\n2 6\n2 9\n1 2\n2 5\n1 2\n2 5\n2 4\n2 4\n1 2\n1 2\n1 4\n2 6\n2 6\n2 4\n2 4\n1 2\n1 2\n2 4\n2 4\n2 3\n2 3\n1 2\n2 9\n1 2\n1 2\n1 2\n2 6\n2 6\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrewid the Android is a galaxy-famous detective. He is now investigating the case of vandalism at the exhibition of contemporary art.\n\nThe main exhibit is a construction of n matryoshka dolls that can be nested one in... | [{"type": "stdin_stdout", "input": "100 19\n6 62 72 83 91 94 97\n3 61 84 99\n1 63\n5 46 53 56 69 78\n5 41 43 49 74 89\n5 55 57 79 85 87\n3 47 59 98\n3 64 76 82\n3 48 66 75\n2 60 88\n2 67 77\n4 40 51 73 95\n41 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 44 71 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the official contest this problem has a different statement, for which jury's solution was working incorrectly, and for this reason it was excluded from the contest. This mistake have been fixed and the current given p... | [{"type": "stdin_stdout", "input": "20\n713900269 192811911 592111899 609607891 585084800 601258511 223103775 876894656 751583891 230837577 971499807 312977833 344314550 397998873 558637732 216574673 913028292 762852863 464376621 61315042\n", "output": "384683838\n"}, {"type": "stdin_stdout", "input": "20\n54 50000046 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne Big Software Company has n employees numbered from 1 to n. The director is assigned number 1. Every employee of the company except the director has exactly one immediate superior. The director, of course, doesn't have... | [{"type": "stdin_stdout", "input": "20\n-1 100\n1 35\n2 22\n3 28\n3 2\n4 8\n3 17\n2 50\n5 37\n5 25\n4 29\n9 21\n10 16\n10 39\n11 41\n9 28\n9 30\n12 36\n13 26\n19 17\n", "output": "459\n"}, {"type": "stdin_stdout", "input": "20\n-1 100\n1 10\n2 26\n2 33\n3 31\n2 28\n1 47\n6 18\n6 25\n9 2\n4 17\n6 18\n6 2\n6 30\n13 7\n5 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Fair Nut is going to travel to the Tree Country, in which there are $n$ cities. Most of the land of this country is covered by forest. Furthermore, the local road system forms a tree (connected graph without cycles). ... | [{"type": "stdin_stdout", "input": "10\n81 34 31 38 69 62 54 18 72 29\n4 8 12\n2 9 25\n4 5 17\n5 7 35\n10 1 13\n9 3 53\n7 6 22\n1 6 82\n3 10 42\n", "output": "187\n"}, {"type": "stdin_stdout", "input": "10\n80 63 78 18 65 77 24 83 79 48\n5 3 67\n1 8 4\n1 2 83\n7 4 16\n6 7 50\n3 9 27\n10 7 74\n2 3 21\n10 2 47\n", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ of $n$ integers.\n\nYou want to make all elements of $a$ equal to zero by doing the following operation exactly three times: Select a segment, for each number in this segment we can add a multi... | [{"type": "stdin_stdout", "input": "19\n-482097330 -201346367 -19865188 742768969 -113444726 -736593719 -223932141 474661760 -517960081 -808531390 -667493854 90097774 -45779385 200613819 -132533405 -931316230 -69997546 -623661790 -4421275\n", "output": "1 19\n9159849270 3825580973 377438572 -14112610411 2155449794 1399... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKaren has just arrived at school, and she has a math test today! [Image] \n\nThe test is about basic addition and subtraction. Unfortunately, the teachers were too busy writing tasks for Codeforces rounds, and had no time... | [{"type": "stdin_stdout", "input": "19\n519879446 764655030 680293934 914539062 744988123 317088317 653721289 239862203 605157354 943428394 261437390 821695238 312192823 432992892 547139308 408916833 829654733 223751525 672158759\n", "output": "265109293\n"}, {"type": "stdin_stdout", "input": "18\n341796022 486073481 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWatchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (x_{i}, y_{i}).\n\nThey n... | [{"type": "stdin_stdout", "input": "10\n46 -55\n46 45\n46 45\n83 -55\n46 45\n83 -55\n46 45\n83 45\n83 45\n46 -55\n", "output": "33\n"}, {"type": "stdin_stdout", "input": "3\n8911 7861\n-6888 7861\n8911 7861\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "2\n1 1000000000\n2 -1000000000\n", "output": "0\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEdo has got a collection of n refrigerator magnets!\n\nHe decided to buy a refrigerator and hang the magnets on the door. The shop can make the refrigerator with any size of the door that meets the following restrictions:... | [{"type": "stdin_stdout", "input": "20 5\n1 12 21 22\n9 10 15 20\n10 12 12 20\n1 1 25 29\n5 10 21 22\n4 9 16 25\n12 10 14 24\n3 3 19 27\n3 4 23 28\n9 1 11 31\n9 14 17 18\n8 12 14 20\n8 11 18 19\n12 3 14 29\n7 8 13 22\n6 4 16 30\n11 3 13 27\n9 16 15 18\n6 13 14 21\n9 12 15 22\n", "output": "4\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x_1, x_2, ..., x_{k} (k > 1) is such maximum element x_{j}, that the following inequality h... | [{"type": "stdin_stdout", "input": "10\n30301275 19973434 63004643 54007648 93722492 91677384 58694045 41546981 15552151 5811338\n", "output": "112066588\n"}, {"type": "stdin_stdout", "input": "10\n82942694 74816699 72957520 1634864 60842992 60103606 61079517 41624114 13932450 24035648\n", "output": "133874061\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-th type of fish be w_{i}, th... | [{"type": "stdin_stdout", "input": "25 25 10\n10 6 2 1 9 7 2 5 6 9 2 3 2 8 5 8 2 9 10 8 9 7 7 4 8\n6 2 10 4 7 9 3 2 4 5 1 8 6 9 8 6 9 8 4 8 7 9 10 2 8\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "15 15 10\n4 5 9 1 4 6 4 1 4 3 7 9 9 2 6\n6 6 7 7 2 9 1 6 10 9 7 10 7 10 9\n", "output": "NO\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.\n\nWe will call point a bad if there are different points b and c, not equal to a, from the given set such ... | [{"type": "stdin_stdout", "input": "11\n358 -724 -232 53 -520\n486 -554 -328 53 -220\n358 -554 -232 -372 -520\n358 -554 -232 308 -520\n868 -554 448 53 -520\n478 -554 -322 53 -600\n358 296 -232 53 -520\n256 -554 -368 53 -520\n230 -554 -136 53 -820\n-182 -554 173 53 -160\n358 -554 -232 53 -520\n", "output": "1\n11\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle X has n distinct integers: p_1, p_2, ..., p_{n}. He wants to divide all of them into two sets A and B. The following two conditions must be satisfied: If number x belongs to set A, then number a - x must also belo... | [{"type": "stdin_stdout", "input": "70 416035 416023\n70034 70322 345689 345965 345701 70046 345737 345713 70166 345821 70010 345749 345677 345725 69962 345869 70178 70310 345785 69998 70070 69974 70058 346001 70106 345953 70226 70154 345929 69950 70298 346049 70346 345989 70286 69986 345893 70082 70238 345797 70250 34... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBarney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1. There exists a bidirectional road between intersections i and 2i and another road between i and 2i + 1 for eve... | [{"type": "stdin_stdout", "input": "10\n2 37526406560905229 37526426361107171\n2 37526424114740747 18763396439955441\n2 300485276957081578 301492476099962199\n1 75035386466351570 441803674395985082 642312512\n2 300197522144700185 220954108245114486\n1 150105696341181576 559187296 100113944\n1 300197522135707767 1502426... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMaxim always goes to the supermarket on Sundays. Today the supermarket has a special offer of discount systems.\n\nThere are m types of discounts. We assume that the discounts are indexed from 1 to m. To use the discount ... | [{"type": "stdin_stdout", "input": "48\n14 2 5 3 10 10 5 6 14 8 19 13 4 4 3 13 18 19 9 16 3 1 14 9 13 10 13 4 12 11 8 2 18 20 14 11 3 11 18 11 4 2 7 2 18 19 2 8\n70\n9497 5103 1001 2399 5701 4053 3557 8481 1736 4139 5829 1107 6461 4089 5936 7961 6017 1416 1191 4635 4288 5605 8857 1822 71 1435 2837 5523 6993 2404 2840 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNikita likes tasks on order statistics, for example, he can easily find the $k$-th number in increasing order on a segment of an array. But now Nikita wonders how many segments of an array there are such that a given numb... | [{"type": "stdin_stdout", "input": "10 29\n88 57 -3 -9 16 48 -84 80 -73 -46\n", "output": "5 13 11 11 8 4 3 0 0 0 0 "}, {"type": "stdin_stdout", "input": "10 5\n-3 2 1 -5 -3 6 -5 10 -10 -10\n", "output": "2 13 11 9 7 6 4 2 1 0 0 "}, {"type": "stdin_stdout", "input": "10 -8\n7 -1 0 -8 8 -1 -10 -7 4 0\n", "output": "27 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSlime and his $n$ friends are at a party. Slime has designed a game for his friends to play.\n\nAt the beginning of the game, the $i$-th player has $a_i$ biscuits. At each second, Slime will choose a biscuit randomly unif... | [{"type": "stdin_stdout", "input": "100\n4364 698 1003 1128 1513 39 4339 969 7452 3415 1154 1635 6649 136 1442 50 834 1680 107 978 983 3176 4017 1692 1113 1504 1118 396 1975 2053 2366 3022 3007 167 610 4649 14659 2331 4565 318 7232 204 7131 6122 2885 5748 1998 3833 6799 4219 8454 8698 4964 1736 1554 1665 2425 4227 1967... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLevko loves array a_1, a_2, ... , a_{n}, consisting of integers, very much. That is why Levko is playing with array a, performing all sorts of operations with it. Each operation Levko performs is of one of two types:\n\n ... | [{"type": "stdin_stdout", "input": "4 5\n1 2 3 1\n2 1 2 8\n2 3 4 7\n1 1 3 3\n2 3 4 8\n", "output": "YES\n8 7 4 7 \n"}, {"type": "stdin_stdout", "input": "4 5\n1 2 3 1\n2 1 2 8\n2 3 4 7\n1 1 3 3\n2 3 4 13\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1 4\n1 1 1 2\n2 1 1 6\n1 1 1 1\n2 1 1 7\n", "output": "YES... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce Vasya and Petya assembled a figure of m cubes, each of them is associated with a number between 0 and m - 1 (inclusive, each number appeared exactly once). Let's consider a coordinate system such that the OX is the g... | [{"type": "stdin_stdout", "input": "25\n-611859852 0\n-611859842 0\n-611859837 0\n-611859843 0\n-611859863 0\n-611859851 0\n-611859857 0\n-611859858 0\n-611859845 0\n-611859865 0\n-611859836 0\n-611859839 0\n-611859850 0\n-611859854 0\n-611859838 0\n-611859840 0\n-611859860 0\n-611859853 0\n-611859848 0\n-611859844 0\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, on the course of algorithms and data structures, Valeriy learned how to use a deque. He built a deque filled with $n$ elements. The $i$-th element is $a_i$ ($i$ = $1, 2, \\ldots, n$). He gradually takes the firs... | [{"type": "stdin_stdout", "input": "71 57\n9 26 80 10 65 60 63 1 15 85 71 1 58 27 41 97 42 15 42 56 87 22 10 28 34 90 13 70 71 56 65 21 0 78 47 96 56 77 32 83 28 16 10 41 0 18 78 12 27 58 4 67 21 41 99 20 21 52 74 10 83 45 43 65 2 15 1 63 46 97 72\n81\n21\n81\n81\n5\n9\n41\n76\n81\n92\n95\n94\n78\n93\n47\n30\n92\n3\n45... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has n items lying in a line. The items are consecutively numbered by numbers from 1 to n in such a way that the leftmost item has number 1, the rightmost item has number n. Each item has a weight, the i-th item weig... | [{"type": "stdin_stdout", "input": "2 100 100 10000 10000\n100 100\n", "output": "20000\n"}, {"type": "stdin_stdout", "input": "6 32 47 965 897\n7 4 1 3 5 4\n", "output": "948\n"}, {"type": "stdin_stdout", "input": "7 3 13 30 978\n1 2 3 4 5 1 7\n", "output": "199\n"}, {"type": "stdin_stdout", "input": "7 13 3 978 30\n7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGenos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of which has color c_{i}. The goal of the game is to destroy all the gemstones in the line as quickly as possible.\... | [{"type": "stdin_stdout", "input": "50\n22 19 14 22 20 11 16 28 23 15 3 23 6 16 30 15 15 10 24 28 19 19 22 30 28 1 27 12 12 14 17 30 17 26 21 26 27 1 11 23 9 30 18 19 17 29 11 20 29 24\n", "output": "25\n"}, {"type": "stdin_stdout", "input": "50\n19 25 46 17 1 41 50 19 7 1 43 8 19 38 42 32 38 22 8 5 5 31 29 35 43 12 23... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya learned a new programming language CALPAS. A program in this language always takes one non-negative integer and returns one non-negative integer as well.\n\nIn the language, there are only three commands: apply a bi... | [{"type": "stdin_stdout", "input": "10\n^ 160\n& 1021\n& 510\n^ 470\n& 1022\n& 251\n& 760\n& 1016\n| 772\n| 515\n", "output": "2\n| 775\n^ 112\n"}, {"type": "stdin_stdout", "input": "10\n^ 218\n& 150\n| 935\n& 61\n| 588\n& 897\n| 411\n| 584\n^ 800\n| 704\n", "output": "2\n| 1023\n^ 260\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn some country there are exactly n cities and m bidirectional roads connecting the cities. Cities are numbered with integers from 1 to n. If cities a and b are connected by a road, then in an hour you can go along this r... | [{"type": "stdin_stdout", "input": "10 11\n1 3\n2 3\n3 4\n4 5\n4 6\n3 7\n3 8\n4 9\n4 10\n7 9\n8 10\n1 5 3\n6 2 3\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "9 9\n1 2\n2 3\n2 4\n4 5\n5 7\n5 6\n3 8\n8 9\n9 6\n1 7 4\n3 6 3\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "9 9\n1 2\n2 3\n2 4\n4 5\n5 7\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSereja has a bracket sequence s_1, s_2, ..., s_{n}, or, in other words, a string s of length n, consisting of characters \"(\" and \")\".\n\nSereja needs to answer m queries, each of them is described by two integers l_{i... | [{"type": "stdin_stdout", "input": "(()((((()(())((((((((()((((((()((((\n71\n15 29\n17 18\n5 26\n7 10\n16 31\n26 35\n2 30\n16 24\n2 24\n7 12\n15 18\n12 13\n25 30\n1 30\n12 13\n16 20\n6 35\n20 28\n18 23\n9 31\n12 35\n14 17\n8 16\n3 10\n12 33\n7 19\n2 33\n7 17\n21 27\n10 30\n29 32\n9 28\n18 32\n28 31\n31 33\n4 26\n15 27\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are literally dozens of snooker competitions held each year, and team Jinotega tries to attend them all (for some reason they prefer name \"snookah\")! When a competition takes place somewhere far from their hometow... | [{"type": "stdin_stdout", "input": "50\nPFH\nJFV->PFH\nBVP->PFH\nPFH->BVP\nPFH->JFV\nPFH->ETQ\nPFH->LQJ\nZTO->PFH\nPFH->BVP\nPFH->RXO\nPFH->ZTO\nHWL->PFH\nPFH->HIV\nPFH->AFP\nPFH->HWL\nOBB->PFH\nHIV->PFH\nPFH->LSR\nAFP->PFH\nLQJ->PFH\nHWL->PFH\nETQ->PFH\nPFH->HWL\nLSR->PFH\nWBR->PFH\nBNZ->PFH\nHQR->PFH\nZTO->PFH\nPFH->... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan has an array consisting of n different integers. He decided to reorder all elements in increasing order. Ivan loves merge sort so he decided to represent his array with one or several increasing sequences which he th... | [{"type": "stdin_stdout", "input": "10\n71550121 446173607 640274071 402690754 802030518 598196518 796619138 96204862 983359971 799843967\n", "output": "71550121 446173607 640274071 802030518 983359971 \n402690754 598196518 796619138 799843967 \n96204862 \n"}, {"type": "stdin_stdout", "input": "3\n1000000000 100 1\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhen Serezha was three years old, he was given a set of cards with letters for his birthday. They were arranged into words in the way which formed the boy's mother favorite number in binary notation. Serezha started playi... | [{"type": "stdin_stdout", "input": "400\nzzzerrzrzzrozrezooreroeoeezerrzeerooereezeeererrezrororoorrzezoeerrorzrezzrzoerrzorrooerzrzeozrrorzzzzeoeereeroeozezeozoozooereoeorrzoroeoezooeerorreeorezeozeroerezoerooooeerozrrorzozeroereerozeozeoerroroereeeerzzrzeeozrezzozeoooeerzzzorozrzezrrorozezoorzzerzroeeeerorreeoezoeroe... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDZY loves planting, and he enjoys solving tree problems.\n\nDZY has a weighted tree (connected undirected graph without cycles) containing n nodes (they are numbered from 1 to n). He defines the function g(x, y) (1 ≤ x, y... | [{"type": "stdin_stdout", "input": "10\n2 1 8760\n3 1 3705\n4 1 1862\n5 2 7332\n6 3 7015\n7 5 4866\n8 3 4465\n9 7 8886\n10 3 9362\n2\n5\n5\n4\n4\n5\n4\n5\n1\n2\n", "output": "8760\n"}, {"type": "stdin_stdout", "input": "10\n2 1 5297\n3 2 7674\n4 1 1935\n5 2 1941\n6 3 1470\n7 1 3823\n8 2 4959\n9 4 6866\n10 9 2054\n1\n1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs you know, majority of students and teachers of Summer Informatics School live in Berland for the most part of the year. Since corruption there is quite widespread, the following story is not uncommon.\n\nElections are ... | [{"type": "stdin_stdout", "input": "10 10\n7 29\n10 31\n9 40\n5 17\n5 30\n6 85\n2 53\n7 23\n4 57\n10 9\n", "output": "49\n"}, {"type": "stdin_stdout", "input": "10 10\n5 81\n7 68\n7 48\n1 10\n5 37\n7 97\n8 54\n7 41\n7 56\n5 21\n", "output": "110\n"}, {"type": "stdin_stdout", "input": "10 10\n1 73\n2 8\n3 88\n1 5\n2 100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPermutation p is an ordered set of integers p_1, p_2, ..., p_{n}, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p_1, p_2, ..., p_{n}.\n\nYour task is... | [{"type": "stdin_stdout", "input": "10 4\n", "output": "1 10 2 9 8 7 6 5 4 3\n"}, {"type": "stdin_stdout", "input": "10 3\n", "output": "1 10 2 3 4 5 6 7 8 9\n"}, {"type": "stdin_stdout", "input": "10 9\n", "output": "1 10 2 9 3 8 4 7 5 6\n"}, {"type": "stdin_stdout", "input": "9 8\n", "output": "1 9 2 8 3 7 4 6 5\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ water tanks in a row, $i$-th of them contains $a_i$ liters of water. The tanks are numbered from $1$ to $n$ from left to right.\n\nYou can perform the following operation: choose some subsegment $[l, r]$ ($1... | [{"type": "stdin_stdout", "input": "13\n987069 989619 960831 976342 972924 961800 954209 956033 998067 984513 977987 963504 985482\n", "output": "969853.375000000\n969853.375000000\n969853.375000000\n969853.375000000\n969853.375000000\n969853.375000000\n969853.375000000\n969853.375000000\n981017.750000000\n981017.75000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nUjan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a description of a graph.\n\nIt ... | [{"type": "stdin_stdout", "input": "15 10\n2 3\n5 4\n5 6\n5 7\n3 8\n3 10\n11 12\n12 13\n13 14\n14 15\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "6 11\n1 3\n1 4\n1 5\n1 6\n2 3\n2 4\n2 5\n2 6\n3 4\n3 5\n3 6\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "10 10\n1 5\n1 8\n1 9\n5 8\n8 9\n4 7\n2 3\n3 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.\n\nStrictly speaking, it makes a photo of a... | [{"type": "stdin_stdout", "input": "2\n229872385 40870434 490042790 160550871\n", "output": "31137307764866984"}, {"type": "stdin_stdout", "input": "2\n186213023 151398020 526707498 169652181\n", "output": "6215440966260475"}, {"type": "stdin_stdout", "input": "2\n95988141 53257147 119443802 199984654\n", "output": "34... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs Will is stuck in the Upside Down, he can still communicate with his mom, Joyce, through the Christmas lights (he can turn them on and off with his mind). He can't directly tell his mom where he is, because the monster ... | [{"type": "stdin_stdout", "input": ")?(??((???????()?(?????????)??(????????((?)?????)????)??????(?????)?)?????)??????(??()??????)????????)?)()??????????????())????????(???)??)????????????????????(?????)??)???)??(???????????????)???)??)?\n", "output": "8314\n"}, {"type": "stdin_stdout", "input": "???????????????????????... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOur beloved detective, Sherlock is currently trying to catch a serial killer who kills a person each day. Using his powers of deduction, he came to know that the killer has a strategy for selecting his next victim.\n\nThe... | [{"type": "stdin_stdout", "input": "bwyplnjn zkms\n26\nzkms nzmcsytxh\nnzmcsytxh yujsb\nbwyplnjn gtbzhudpb\ngtbzhudpb hpk\nyujsb xvy\nhpk wrwnfokml\nwrwnfokml ndouuikw\nndouuikw ucgrja\nucgrja tgfmpldz\nxvy nycrfphn\nnycrfphn quvs\nquvs htdy\nhtdy k\ntgfmpldz xtdpkxm\nxtdpkxm suwqxs\nk fv\nsuwqxs qckllwy\nqckllwy diun\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, Duff has been practicing weight lifting. As a hard practice, Malek gave her a task. He gave her a sequence of weights. Weight of i-th of them is 2^{w}_{i} pounds. In each step, Duff can lift some of the remainin... | [{"type": "stdin_stdout", "input": "100\n196 1681 196 0 61 93 196 196 196 196 196 0 0 96 18 1576 0 93 666463 18 93 1 1278 8939 93 196 196 1278 3 0 67416 869956 10 56489 196 745 39 783 196 8939 196 81 69634 4552 39 3 14 20 25 8 10 4 7302 0 19579 20 1140 15990 7302 0 19579 4142 11 1354 75252 93 311 1278 0 79475 10 75252 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLesha plays the recently published new version of the legendary game hacknet. In this version character skill mechanism was introduced. Now, each player character has exactly n skills. Each skill is represented by a non-n... | [{"type": "stdin_stdout", "input": "1 1000000000 1000 1000 1000000000000000\n1000000000\n", "output": "1000000001000\n1000000000 \n"}, {"type": "stdin_stdout", "input": "1 1000000000 1000 1000 1000000000000000\n0\n", "output": "1000000001000\n1000000000 \n"}, {"type": "stdin_stdout", "input": "5 5 10 20 50\n0 0 0 0 0\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ consisting of $n$ non-negative integers. You have to choose a non-negative integer $x$ and form a new array $b$ of size $n$ according to the following rule: for all $i$ from $1$ to $n$, $b_i = a... | [{"type": "stdin_stdout", "input": "100\n74 88 64 8 9 27 63 64 79 97 92 38 26 1 4 4 2 64 53 62 24 82 76 40 48 58 40 59 3 56 35 37 0 30 93 71 14 97 49 37 96 59 56 55 70 88 77 99 51 55 71 25 10 31 26 50 61 18 35 55 49 33 86 25 65 74 89 99 5 27 2 9 67 29 76 68 66 22 68 59 63 16 62 25 35 57 63 35 41 68 86 22 91 67 61 3 92 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJeff has become friends with Furik. Now these two are going to play one quite amusing game.\n\nAt the beginning of the game Jeff takes a piece of paper and writes down a permutation consisting of n numbers: p_1, p_2, ...,... | [{"type": "stdin_stdout", "input": "95\n68 56 24 89 79 20 74 69 49 59 85 67 95 66 15 34 2 13 92 25 84 77 70 71 17 93 62 81 1 87 76 38 75 31 63 51 35 33 37 11 36 52 23 10 27 90 12 6 45 32 86 26 60 47 91 65 58 80 78 88 50 9 44 4 28 29 22 8 48 7 19 57 14 54 55 83 5 30 72 18 82 94 43 46 41 3 61 53 73 39 40 16 64 42 21\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDZY loves Physics, and he enjoys calculating density.\n\nAlmost everything has density, even a graph. We define the density of a non-directed graph (nodes and edges of the graph have some values) as follows: $\\left\\{\\b... | [{"type": "stdin_stdout", "input": "20 20\n265918 744212 196368 74731 293587 679367 460805 632939 453630 565881 835276 606327 181087 721045 219431 849838 370939 582350 335676 32244\n2 16 989\n14 19 628\n1 6 483\n5 8 733\n13 19 556\n10 17 911\n2 7 599\n13 17 390\n10 20 965\n9 11 449\n3 15 310\n3 6 557\n14 18 225\n1 18 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Petya likes points a lot. Recently his mom has presented him n points lying on the line OX. Now Petya is wondering in how many ways he can choose three distinct points so that the distance between the two farthest ... | [{"type": "stdin_stdout", "input": "100 100\n-98 -97 -96 -93 -92 -91 -90 -87 -86 -84 -81 -80 -79 -78 -76 -75 -73 -71 -69 -67 -65 -64 -63 -62 -61 -54 -51 -50 -49 -48 -46 -45 -44 -37 -36 -33 -30 -28 -27 -16 -15 -13 -12 -10 -9 -7 -6 -5 -4 2 3 5 8 9 10 11 13 14 15 16 17 19 22 24 25 26 27 28 30 31 32 36 40 43 45 46 47 50 51... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMike is the president of country What-The-Fatherland. There are n bears living in this country besides Mike. All of them are standing in a line and they are numbered from 1 to n from left to right. i-th bear is exactly a_... | [{"type": "stdin_stdout", "input": "20\n452405440 586588704 509061481 552472140 16115810 148658854 66743034 628305150 677780684 519361360 208050516 401554301 954478790 346543678 387546138 832279893 641889899 80960260 717802881 588066499\n", "output": "954478790 641889899 519361360 452405440 346543678 346543678 20805051... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSam has been teaching Jon the Game of Stones to sharpen his mind and help him devise a strategy to fight the white walkers. The rules of this game are quite simple: The game starts with n piles of stones indexed from 1 t... | [{"type": "stdin_stdout", "input": "124\n34\n44\n21\n55\n1\n36\n53\n31\n58\n59\n11\n40\n20\n32\n43\n48\n16\n5\n35\n20\n21\n36\n15\n2\n11\n56\n58\n2\n40\n47\n29\n21\n4\n21\n1\n25\n51\n55\n17\n40\n56\n35\n51\n1\n34\n18\n54\n44\n1\n43\n16\n28\n21\n14\n57\n53\n29\n44\n59\n54\n47\n21\n43\n41\n11\n37\n30\n4\n39\n47\n40\n50\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array consisting of n non-negative integers a_1, a_2, ..., a_{n}.\n\nYou are going to destroy integers in the array one by one. Thus, you are given the permutation of integers from 1 to n defining the ord... | [{"type": "stdin_stdout", "input": "7\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n1 2 3 4 5 6 7\n", "output": "6000000000\n5000000000\n4000000000\n3000000000\n2000000000\n1000000000\n0\n"}, {"type": "stdin_stdout", "input": "17\n10 10 3 9 8 0 10 13 11 8 11 1 6 9 2 10 5\n9 4 13 2 6 15 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp starts his own business. Tomorrow will be the first working day of his car repair shop. For now the car repair shop is very small and only one car can be repaired at a given time.\n\nPolycarp is good at marketing... | [{"type": "stdin_stdout", "input": "20\n360 26\n475 17\n826 12\n815 23\n567 28\n897 26\n707 20\n1000 9\n576 5\n16 5\n714 16\n630 17\n426 26\n406 23\n899 25\n102 22\n896 8\n320 27\n964 25\n932 18\n", "output": "360 385\n475 491\n826 837\n1 23\n567 594\n897 922\n707 726\n1000 1008\n24 28\n29 33\n34 49\n630 646\n426 451\n... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.