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\nAlice and Brown loves games. Today, they will play the following game.\n\nIn this game, there are two piles initially consisting of X and Y stones, respectively. Alice and Bob alternately perform the following operation, ...
[{"type": "stdin_stdout", "input": "13 -1", "output": "Alice\n"}, {"type": "stdin_stdout", "input": "-1 10", "output": "Alice\n"}, {"type": "stdin_stdout", "input": "18 -1", "output": "Alice\n"}, {"type": "stdin_stdout", "input": "-1 14", "output": "Alice\n"}, {"type": "stdin_stdout", "input": "14 -1", "output": "Alice...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi is a magician. He can cast a spell on an integer sequence (a_1,a_2,...,a_M) with M terms, to turn it into another sequence (s_1,s_2,...,s_M), where s_i is the sum of the first i terms in the original sequence.\n...
[{"type": "stdin_stdout", "input": "10 5\n2 14 5 6 9\n3 6 3 9 10\n2 6 8 6 7\n0 1 1 3 14\n2 1 3 8 4", "output": "-1\n"}, {"type": "stdin_stdout", "input": "10 5\n2 14 5 6 9\n3 6 3 9 11\n2 6 8 6 7\n0 1 1 3 14\n2 1 3 8 4", "output": "-1\n"}, {"type": "stdin_stdout", "input": "10 5\n2 14 5 6 9\n3 6 3 9 11\n2 6 8 6 7\n0 1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 ≀ a, b, c, d ≀ 9) which meet the following equality:\n\na + b + c + d = n\n\nFor example, for n = 35, we have 4 differ...
[{"type": "stdin_stdout", "input": "35\n011", "output": "4\n348\n"}, {"type": "stdin_stdout", "input": "35\n010", "output": "4\n282\n"}, {"type": "stdin_stdout", "input": "35\n15", "output": "4\n592\n"}, {"type": "stdin_stdout", "input": "35\n26", "output": "4\n282\n"}, {"type": "stdin_stdout", "input": "35\n13", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a bus route as shown in Figure 1. There are 10 stops, each numbered 0-9. The bus turns back at stop 0, but the other side is a circulation route, which circulates in the order of 5 β†’ 6 β†’ 7 β†’ 8 β†’ 9 β†’ 5 as shown in...
[{"type": "stdin_stdout", "input": "2\n1 8\n8 0", "output": "1 2 3 4 5 6 7 8\n8 9 5 4 3 2 1 0\n"}, {"type": "stdin_stdout", "input": "2\n1 9\n8 1", "output": "1 2 3 4 5 6 7 8 9\n8 9 5 4 3 2 1\n"}, {"type": "stdin_stdout", "input": "2\n2 8\n6 2", "output": "2 3 4 5 6 7 8\n6 7 8 9 5 4 3 2\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAiz Onsen has a bathhouse and a pool. To use the bathhouse, you need to buy a bathing ticket, and to use the pool, you need to buy a pool ticket. Prices for these tickets may vary from day to day. In addition, Aiz Onsen h...
[{"type": "stdin_stdout", "input": "2\n111 101 -1 -2\n1001 722 131 -3", "output": "-313\n106060\n"}, {"type": "stdin_stdout", "input": "2\n111 001 -1 -2\n1001 722 131 -3", "output": "-113\n106060\n"}, {"type": "stdin_stdout", "input": "2\n111 000 -1 -2\n1001 722 131 -3", "output": "-111\n106060\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nFor the integer n (1 ≀ n), let Pn be a string of n + 1 I's and n O's starting with I and alternating, where I and O are the uppercase Ai and O, respectively. is there.\n\n\nP1 | IOI\n--- | ---\nP2 | IOIOI\nP3 |...
[{"type": "stdin_stdout", "input": "1\n119\nOOJOIOIOIIOII\n1\n14\nKIOIIOIOIOJOO\n0", "output": "3\n3\n"}, {"type": "stdin_stdout", "input": "1\n13\nOIIOIOIOIIOIO\n2\n13\nOOIOIOIOIIOII\n0", "output": "4\n2\n"}, {"type": "stdin_stdout", "input": "1\n13\nOOIOIOIOIIOII\n3\n13\nOOIOIOIOIIOII\n0", "output": "4\n1\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nUniqlo Uzuki and Rin Meguro are coming to SEARIGHT LIVE FES for sale. As shown in the figure below, the product sales line consists of two lines, with W people in the horizontal direction and H people in the ve...
[{"type": "stdin_stdout", "input": "0 19\n0\n0 0 -1 1 -1", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 19\n0\n0 0 -1 2 -1", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 19\n0\n0 1 -1 2 -1", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 19\n0\n0 2 -1 2 -1", "output": "0\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA browser-based puzzle game called \"Bubble Puzzle\" is now popular on the Internet.\n\nThe puzzle is played on a 4 Γ— 4 grid, and initially there are several bubbles in the grid squares. Each bubble has a state expressed ...
[{"type": "stdin_stdout", "input": "2 4 3 4\n2 1 2 4\n3 3 2 2\n0 3 3 3", "output": "-1\n"}, {"type": "stdin_stdout", "input": "2 4 3 4\n2 1 2 0\n3 3 2 2\n0 3 3 3", "output": "-1\n"}, {"type": "stdin_stdout", "input": "2 1 4 1\n2 2 4 2\n2 4 4 1\n0 4 4 1", "output": "-1\n"}, {"type": "stdin_stdout", "input": "2 4 3 3\n2 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $S$, which is balanced parentheses with a star symbol '*' inserted.\n\nAny balanced parentheses can be constructed using the following rules:\n\n* An empty string is balanced.\n* Concatenation of tw...
[{"type": "stdin_stdout", "input": "((((((((((*))))))()))", "output": "10\n"}, {"type": "stdin_stdout", "input": "((((((((((*))))))))))", "output": "10"}, {"type": "stdin_stdout", "input": "(((((((()(*))))))()))", "output": "8\n"}, {"type": "stdin_stdout", "input": "(((((((()()*)))))()()", "output": "7\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA bipartite graph G = (V, E) is a graph in which the vertex set V can be divided into two disjoint subsets X and Y such that every edge e ∈ E has one end point in X and the other end point in Y.\n\nA matching M is a subse...
[{"type": "stdin_stdout", "input": "5 17 10\n1 2\n0 0\n0 1\n1 0\n0 0\n2 5", "output": "3\n"}, {"type": "stdin_stdout", "input": "5 17 10\n1 2\n0 0\n0 1\n1 0\n0 0\n3 5", "output": "3\n"}, {"type": "stdin_stdout", "input": "2 10 2\n1 0\n0 0\n-1 3\n0 1\n1 1\n2 3", "output": "1\n"}, {"type": "stdin_stdout", "input": "3 3 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n houses in a row. They are numbered from 1 to n in order from left to right. Initially you are in the house 1.\n\nYou have to perform k moves to other house. In one move you go from your current house to some o...
[{"type": "stdin_stdout", "input": "21989 30630 32548\n", "output": "YES\n3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem.\n\nIn the Wonderful Metropolis of the Future, there is no need in subway train drivers. Due to the technological progress, they were replaced by the Artificial Intelligence (AI). Unfortunat...
[{"type": "stdin_stdout", "input": "1 4\n\nseY\n\npN\n\nYes\n\nsdY\n", "output": "1 1\n1 1\n1 1\n"}, {"type": "stdin_stdout", "input": "1 4\n\nXes\n\noN\n\nYes\n\nseY\n", "output": "1 1\n1 1\n1 1\n"}, {"type": "stdin_stdout", "input": "1 2\n\nseY\n\npN\n\nYes\n\nsdY\n", "output": "1 1\n1 1\n1 1\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n TV shows you want to watch. Suppose the whole time is split into equal parts called \"minutes\". The i-th of the shows is going from l_i-th to r_i-th minute, both ends inclusive.\n\nYou need a TV to watch a TV...
[{"type": "stdin_stdout", "input": "10 798547896 459313948\n40312491 40315265\n40299842 40315264\n40296035 40315263\n40282844 40315262\n40304824 40315261\n40280414 40315260\n40299203 40315259\n40301967 40315258\n40276169 40315257\n40286575 40315256\n", "output": "236433977\n"}, {"type": "stdin_stdout", "input": "4 2882...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a consisting of n integers. Let's denote monotonic renumeration of array a as an array b consisting of n integers such that all of the following conditions are met:\n\n * b_1 = 0; \n * for every p...
[{"type": "stdin_stdout", "input": "200\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday in the scientific lyceum of the Kingdom of Kremland, there was a biology lesson. The topic of the lesson was the genomes. Let's call the genome the string \"ACTG\".\n\nMaxim was very boring to sit in class, so the t...
[{"type": "stdin_stdout", "input": "50\nROWGGKNUITVHOBMKZXOZNBZMQGSFERNCZDFKLRBCFVVDXJEFLP\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "50\nALWLSFLXYPQYMIWXMYMXFYMIVFYJDTJAIGVOAUDAIIAHKNNVTX\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "50\nHKKUWHLYYKBLLEHKVNIRYAPVFTAPRIFUZELKGRDXZNCNWHSAFG\n",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n\"Duel!\"\n\nBetting on the lovely princess Claris, the duel between Tokitsukaze and Quailty has started.\n\nThere are n cards in a row. Each card has two sides, one of which has color. At first, some of these cards are w...
[{"type": "stdin_stdout", "input": "30 27\n000000000010110000101111111111\n", "output": "tokitsukaze\n"}, {"type": "stdin_stdout", "input": "30 27\n100000000010110000101111111111\n", "output": "tokitsukaze\n"}, {"type": "stdin_stdout", "input": "30 16\n100000000010110000101111111111\n", "output": "once again\n"}, {"typ...
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:\n\n 1. Make a complete and full binary tree of 2^{n} - 1 vertices. Complete and full binary tree means a tree that exactly one vertex i...
[{"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\n[THE SxPLAY & KIVΞ› - 漂桁](https://soundcloud.com/kivawu/hyouryu)\n\n[KIVΞ› & Nikki Simmons - Perspectives](https://soundcloud.com/kivawu/perspectives)\n\nWith a new body, our idol Aroma White (or should we call her Kaori Mi...
[{"type": "stdin_stdout", "input": "10000000000000000 10000000000000000 100 100 10000000000000000 10000000000000000\n10000000000000000 10000000000000000 10000000000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "10000000000000000 10000000000000000 100 100 10000000000000000 10000000000000000\n10000000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is a harder version of the problem. In this version n ≀ 500 000\n\nThe outskirts of the capital are being actively built up in Berland. The company \"Kernel Panic\" manages the construction of a residential complex o...
[{"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\nWriting light novels is the most important thing in Linova's life. Last night, Linova dreamed about a fantastic kingdom. She began to write a light novel for the kingdom as soon as she woke up, and of course, she is the q...
[{"type": "stdin_stdout", "input": "20 7\n9 7\n3 11\n15 5\n1 3\n11 9\n18 7\n17 18\n20 1\n4 11\n2 11\n12 18\n8 18\n13 2\n19 2\n10 16\n6 13\n5 8\n14 1\n16 13\n", "output": "41\n"}, {"type": "stdin_stdout", "input": "20 7\n9 7\n3 11\n15 5\n1 6\n11 9\n18 7\n17 18\n20 1\n4 11\n2 11\n12 18\n8 18\n13 2\n19 2\n10 16\n6 13\n5 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. \n\nYou immediately decided to take a vac...
[{"type": "stdin_stdout", "input": "48 14\n1 1 1 1 1 6 1 1 1 1 1 1 3 3 1 1 1 1 1 2 2 2 1 1 1 1 1 1 2 1 4 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 5\n", "output": "42\n"}, {"type": "stdin_stdout", "input": "48 14\n1 1 1 1 1 6 1 1 1 1 1 1 3 3 1 1 2 1 1 2 2 2 1 1 1 1 1 1 2 1 4 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 5\n", "output": "42\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEasy and hard versions are actually different problems, so we advise you to read both statements carefully.\n\nYou are given a weighted rooted tree, vertex 1 is the root of this tree.\n\nA tree is a connected graph withou...
[{"type": "stdin_stdout", "input": "4\n4 18\n2 1 9 2\n3 2 4 1\n4 1 1 2\n3 20\n2 1 8 1\n3 1 7 2\n5 50\n1 3 100 1\n1 5 10 2\n2 3 123 2\n5 4 55 1\n2 100\n1 2 409 2\n", "output": "0\n0\n11\n6\n"}, {"type": "stdin_stdout", "input": "4\n4 22\n2 1 9 2\n3 2 4 1\n4 1 1 2\n3 20\n2 1 8 1\n3 1 7 2\n5 50\n1 3 100 1\n1 5 10 2\n2 3 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe pandemic is upon us, and the world is in shortage of the most important resource: toilet paper. As one of the best prepared nations for this crisis, BubbleLand promised to help all other world nations with this valuab...
[{"type": "stdin_stdout", "input": "7 29\n6 2 627\n7 6 580\n6 6 624\n2 7 381\n4 6 1263\n7 7 776\n3 5 929\n1 4 313\n7 5 699\n4 4 977\n3 2 586\n5 5 456\n4 5 13\n4 3 935\n3 7 946\n1 5 950\n2 1 597\n1 3 338\n3 4 844\n6 5 523\n7 1 152\n6 7 981\n1 6 947\n5 3 49\n4 2 948\n5 6 734\n1 1 214\n4 7 747\n6 1 533\n", "output": "586\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a of n positive integers.\n\nYou can use the following operation as many times as you like: select any integer 1 ≀ k ≀ n and do one of two things: \n\n * decrement by one k of the first elements of...
[{"type": "stdin_stdout", "input": "4\n3\n1 2 -1\n5\n40 9 13 6 13\n5\n1 1 0 1 1\n4\n7 2 1 10\n", "output": "NO\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\n3\n1 2 2\n5\n20 9 15 6 9\n5\n1 1 0 1 1\n4\n5 2 1 10\n", "output": "YES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\n3\n1 2 1\n5\n20 9 15 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMonocarp and Polycarp are working as waiters in Berpizza, a pizzeria located near the center of Bertown. Since they are waiters, their job is to serve the customers, but they choose whom they serve first differently.\n\nA...
[{"type": "stdin_stdout", "input": "8\n1 103913\n3\n1 103913\n1 103913\n3\n1 103913\n1 103913\n2\n", "output": "\n1 2 3 "}, {"type": "stdin_stdout", "input": "8\n1 183978\n3\n1 103913\n1 103913\n3\n1 103913\n1 103913\n2\n", "output": "1 2 3\n"}, {"type": "stdin_stdout", "input": "8\n1 227408\n3\n1 103913\n1 103913\n3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is an infinite set generated as follows:\n\n * 1 is in this set. \n * If x is in this set, x β‹… a and x+b both are in this set. \n\n\n\nFor example, when a=3 and b=6, the five smallest elements of the set are:\n\n ...
[{"type": "stdin_stdout", "input": "5\n24 3 5\n10 5 11\n2097 1 4\n19260817 394 623\n19260817 233 264\n", "output": "YES\nNO\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "5\n24 3 5\n10 5 11\n2097 1 4\n19260817 394 227\n19260817 233 264\n", "output": "YES\nNO\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAccording to a new ISO standard, a flag of every country should have, strangely enough, a chequered field n Γ— m, each square should be wholly painted one of 26 colours. The following restrictions are set: \n\n * In each ...
[{"type": "stdin_stdout", "input": "1 500\nwljexjwjwsxhascgpyezfotqyieywzyzpnjzxqebroginhlpsvtbgmbckgqixkdveraxlgleieeagubywaacncxoouibbhwyxhjiczlymscsqlttecvundzjqtuizqwsjalmizgeekugacatlwhiiyaamjuiafmyzxadbxsgwhfawotawfxkpyzyoceiqfppituvaqmgfjinulkbkgpnibaefqaqiptctoqhcnnfihmzijnwpxdikwefpxicbspdkppznpiqrpkyvcxapoaof...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. Each ...
[{"type": "stdin_stdout", "input": "tkwkxtvwvtekejkwlwmtxvjxexlxlkmtjxklvjlekljxwleewmxekwtwexvjjwmwjmvjwmeetwjvw\n33\njmwexm 9\nmlvl 11\nltkmvjlvkmtxl 1\njwe 4\nllmkxewtkxkk 2\nveeewmjjlw 0\nexmtwwxkw 8\nexjklmvkkejwx 13\nmmjwkmemwwm 0\ntxetttxe 9\ne 9\nmw 7\nmkmt 3\nwk 0\nmvltketkvww 6\nj 5\nmjmemtjew 11\nvwmmvvlvljv...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDima took up the biology of bacteria, as a result of his experiments, he invented k types of bacteria. Overall, there are n bacteria at his laboratory right now, and the number of bacteria of type i equals ci. For conveni...
[{"type": "stdin_stdout", "input": "73 29 73\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n67 70 761\n60 34 641\n33 22 689\n67 35 556\n16 21 192\n1 62 75\n37 5 657\n8 7 606\n37 1 54\n53 1 805\n2 68 652\n20 39 701\n44 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nImagine that your city is an infinite 2D plane with Cartesian coordinate system. The only crime-affected road of your city is the x-axis. Currently, there are n criminals along the road. No police station has been built o...
[{"type": "stdin_stdout", "input": "44 37298\n-100 -100 -98 -93 -92 -91 -91 -89 -87 -86 -84 -80 -79 -76 -71 -70 -58 -53 -52 -52 -49 -48 -45 -45 -40 -39 -37 -35 -31 -30 -30 -29 -29 -28 -22 -22 -21 -11 -8 -7 -7 -6 -1 0\n", "output": "200\n"}, {"type": "stdin_stdout", "input": "45 45\n-95 -94 -92 -83 -83 -76 -75 -74 -71 -...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multiplies the displayed number by...
[{"type": "stdin_stdout", "input": "9998 10000\n", "output": "4999\n"}, {"type": "stdin_stdout", "input": "9999 10000\n", "output": "5000\n"}, {"type": "stdin_stdout", "input": "6919 10000\n", "output": "1920\n"}, {"type": "stdin_stdout", "input": "6565 10000\n", "output": "1566\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs everyone knows, bears love fish. But Mike is a strange bear; He hates fish! The even more strange thing about him is he has an infinite number of blue and red fish. \n\n<image>\n\nHe has marked n distinct points in the...
[{"type": "stdin_stdout", "input": "15\n44249 54630\n165741 91307\n49455 83026\n52521 88269\n39286 65158\n38282 73821\n96608 30032\n155832 122920\n22021 13546\n161556 192797\n168062 8224\n161221 155335\n5670 180269\n89163 128733\n151226 75254\n", "output": "bbbbbbbbbbbbbbb\n"}, {"type": "stdin_stdout", "input": "15\n44...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLimak is a grizzly bear who desires power and adoration. He wants to win in upcoming elections and rule over the Bearland.\n\nThere are n candidates, including Limak. We know how many citizens are going to vote for each c...
[{"type": "stdin_stdout", "input": "100\n901 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor months Maxim has been coming to work on his favorite bicycle. And quite recently he decided that he is ready to take part in a cyclists' competitions.\n\nHe knows that this year n competitions will take place. During ...
[{"type": "stdin_stdout", "input": "3 1000000000 1\n0 4\n1 1001000000\n256516843 1000000101\n", "output": "1.9999999514\n503145235.6844568849\n372819332.8913071752\n"}, {"type": "stdin_stdout", "input": "3 1000000000 1000000000\n1 2\n0 1000000000\n999999999 1000000000\n", "output": "0.0000000005\n0.5026372490\n0.000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAn elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coordinate line. In one step the elephant can move 1, 2, 3,...
[{"type": "stdin_stdout", "input": "6972384\n", "output": "1394477\n"}, {"type": "stdin_stdout", "input": "5118712\n", "output": "1023743\n"}, {"type": "stdin_stdout", "input": "1000000\n", "output": "200000\n"}, {"type": "stdin_stdout", "input": "1925720\n", "output": "385144\n"}, {"type": "stdin_stdout", "input": "10...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his friend's chat rises to the very top of the page. The r...
[{"type": "stdin_stdout", "input": "50\njcg\nvle\njopb\nepdb\nnkef\nfv\nxj\nufe\nfuy\noqta\ngbc\nyuz\nec\nyji\nkuux\ncwm\ntq\nnno\nhp\nzry\nxxpp\ntjvo\ngyz\nkwo\nvwqz\nyaqc\njnj\nwoav\nqcv\ndcu\ngc\nhovn\nop\nevy\ndc\ntrpu\nyb\nuzfa\npca\noq\nnhxy\nsiqu\nde\nhphy\nc\nwovu\nf\nbvv\ndsik\nlwyg\n", "output": "lwyg\ndsik\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAyush is a cashier at the shopping center. Recently his department has started a ''click and collect\" service which allows users to shop online. \n\nThe store contains k items. n customers have already used the above ser...
[{"type": "stdin_stdout", "input": "10 1 100\n1 55 67 75 40 86 24 84 82 26 81 23 70 79 51 54 21 78 31 98 68 93 66 88 99 65 20 52 35 85 16 12 94 100 59 56 18 33 47 46 71 8 38 57 2 92 3 95 6 4 87 22 48 80 15 29 11 45 72 76 44 60 91 90 39 74 41 36 13 27 53 83 32 10 30 63 89 64 49 17 9 97 69 14 50 77 37 96 10 42 28 34 61 1...
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\n-93 -22\n12 72\n", "output": " ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nZS the Coder and Chris the Baboon has arrived at Udayland! They walked in the park where n trees grow. They decided to be naughty and color the trees in the park. The trees are numbered with integers from 1 to n from left...
[{"type": "stdin_stdout", "input": "8 6 6\n0 0 0 0 0 0 0 0\n709812879 751993522 552838834 932579085 381597201 889756688\n77223016 35398130 932703875 852137134 124534767 472656085\n828677108 158247840 540181954 573979204 389860841 490718346\n666733838 404533406 50010075 311518758 460372535 69832342\n591244215 400838850 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasiliy spent his vacation in a sanatorium, came back and found that he completely forgot details of his vacation! \n\nEvery day there was a breakfast, a dinner and a supper in a dining room of the sanatorium (of course, ...
[{"type": "stdin_stdout", "input": "718167999978848233 1000000000000000000 1000000000000000000\n", "output": "281832000021151766\n"}, {"type": "stdin_stdout", "input": "338654687020656675 999999999999999999 1000000000000000000\n", "output": "661345312979343324\n"}, {"type": "stdin_stdout", "input": "643704740517968615 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOf course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory producing the rings for this wonderful game? Once upon a time, the ruler of the ancient Egypt ordered the worke...
[{"type": "stdin_stdout", "input": "15\n1 30 1409523818\n12 13 463027806\n9 14 846985104\n20 21 770345346\n17 22 514758030\n2 15 438137019\n18 19 331182033\n16 29 613043570\n10 19 765879041\n6 7 960155075\n13 27 323764310\n24 25 724736351\n4 9 107208241\n3 8 992951987\n23 28 125300818\n", "output": "6581903942\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nk people want to split n candies between them. Each candy should be given to exactly one of them or be thrown away.\n\nThe people are numbered from 1 to k, and Arkady is the first of them. To split the candies, Arkady wil...
[{"type": "stdin_stdout", "input": "1815995848677761959 576460752303423488 202657637814241276 1000\n", "output": "202657637814241276\n"}, {"type": "stdin_stdout", "input": "576460752303423488 576460752303423488 351082447248993993 1000\n", "output": "351082447248993993\n"}, {"type": "stdin_stdout", "input": "57646075230...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nView Russian Translation\n\nA wild chemist wants to prepare his mysterious mixture. \n\nThe recipe is very simple, he has already mixed all the necessary powders and the only remaining thing is to add exactly m nanoliters...
[{"type": "stdin_stdout", "input": "10\n705 14 10\n19 9950 3597 154 23871 1241 4973 19902 76 620 39805 308 2 7 17\n89106 68592 25244 2303 148289 23315 98081 57627 61203 18311\n347 15 4\n28 3253 58562 3811 236 13 950 58 15244 2 118 60977 267 7458 9\n14460 68371 99081 52092 51087 77895 83406 16776 35842 96786\n790 22 10\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOmar loves problem solving very much and today he faces the following problem. \n\nGiven a multiset A of N integers {a_1, a_2, \\ldots, a_N} and an integer L, his task is to perform L operations indexed from 1 to L in the...
[{"type": "stdin_stdout", "input": "39 525\n23810 349 3784 3087 911 29520 10451 7776 5854 28101 1740 316 20538 6629 1129 26286 5114 55 44537 4716 21656 147 6685 93 17953 224 9726 32279 2447 591 345 18588 24193 9492 34469 12618 2596 19 29534", "output": "10\n2707 23810 24193 26286 28101 29520 29534 32279 34469 202285220...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n\"Not every love story has a happy ending!\"- Little Jhool was certainly a con man, fooling people by telling them about their future, [The first problem!] but he loved his girl - truly! But, Big Jhool, his girlfriend, wa...
[{"type": "stdin_stdout", "input": "1\n159\n\nAKMQDT", "output": "159\n"}, {"type": "stdin_stdout", "input": "1\n115\n\nTDRKMA", "output": "115\n"}, {"type": "stdin_stdout", "input": "1\n135\n\nTDQMKA", "output": "135\n"}, {"type": "stdin_stdout", "input": "1\n195\n\nAKMQDT", "output": "195\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a positive integer X, let f(X) be the number of positive divisors of X.\n\nGiven a positive integer N, find \\sum_{K=1}^N K\\times f(K).\n\nConstraints\n\n* 1 \\leq N \\leq 10^7\n\nInput\n\nInput is given from Standar...
[{"type": "stdin_stdout", "input": "11001000", "output": "1020696029789074\n"}, {"type": "stdin_stdout", "input": "11000000", "output": "1020504841032058\n"}, {"type": "stdin_stdout", "input": "11001001", "output": "1020696117797082\n"}, {"type": "stdin_stdout", "input": "11001101", "output": "1020713851493884\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFind the price of a product before tax such that, when the consumption tax rate is 8 percent and 10 percent, the amount of consumption tax levied on it is A yen and B yen, respectively. (Yen is the currency of Japan.)\n\n...
[{"type": "stdin_stdout", "input": "134 106", "output": "-1\n"}, {"type": "stdin_stdout", "input": "134 157", "output": "-1\n"}, {"type": "stdin_stdout", "input": "10 12", "output": "125\n"}, {"type": "stdin_stdout", "input": "10 13", "output": "130\n"}, {"type": "stdin_stdout", "input": "12 15", "output": "150\n"}, {"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi has N cards. The i-th of these cards has an integer A_i written on it.\n\nTakahashi will choose an integer K, and then repeat the following operation some number of times:\n\n* Choose exactly K cards such that t...
[{"type": "stdin_stdout", "input": "5\n1 2 3 3 5", "output": "5\n2\n1\n1\n0\n"}, {"type": "stdin_stdout", "input": "5\n2 2 3 3 5", "output": "5\n2\n1\n0\n0\n"}, {"type": "stdin_stdout", "input": "5\n4 2 2 4 4", "output": "5\n2\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "5\n4 4 5 4 4", "output": "5\n1\n0\n0\n0\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi has a lot of peculiar devices. These cylindrical devices receive balls from left and right. Each device is in one of the two states A and B, and for each state, the device operates as follows:\n\n* When a device...
[{"type": "stdin_stdout", "input": "4 123456789\nAABA", "output": "BABA\n"}, {"type": "stdin_stdout", "input": "4 110986646\nAABB", "output": "BABA\n"}, {"type": "stdin_stdout", "input": "4 123456789\nAAAA", "output": "BABA\n"}, {"type": "stdin_stdout", "input": "4 110986646\nBABA", "output": "BABA\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is data that records the altitude of mountains that have been climbed so far. Create a program that reads this data and outputs the elevation difference between the highest and lowest mountains.\n\n\n\nInput\n\nThe ...
[{"type": "stdin_stdout", "input": "3783.6109384455353\n1821.5992049377405\n649.3237125101873\n2008.8147615323267\n1214.1371939030753", "output": "3134.28722594\n"}, {"type": "stdin_stdout", "input": "3784.5476877206565\n1821.5992049377405\n649.3237125101873\n2008.8147615323267\n1214.1371939030753", "output": "3135.223...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTetris is a game in which falling blocks are lined up on the board and erased. Here, let's consider a game that arranges it a little.\n\nThe size of the board of this game is 5 frames wide, and it is high enough to accomm...
[{"type": "stdin_stdout", "input": "4\n2 4 1\n1 3 1\n2 2 4\n2 3 5\n1\n1 5 1\n7\n2 2 2\n1 1 1\n2 1 3\n1 4 1\n1 1 1\n2 5 5\n1 4 2\n0", "output": "12\n0\n13\n"}, {"type": "stdin_stdout", "input": "4\n2 4 1\n1 3 1\n2 2 4\n2 3 5\n1\n1 5 1\n7\n2 2 2\n1 1 1\n2 0 3\n1 4 1\n1 1 1\n2 5 5\n1 4 2\n0", "output": "12\n0\n12\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nComputer graphics uses polygon models as a way to represent three-dimensional shapes. A polygon model is a model that creates a surface by giving the coordinates of vertices and how to connect those vertices.\n\nA general...
[{"type": "stdin_stdout", "input": "6\n3 3 1\n1 2 4\n1 4 3\n-1 3 4\n5 -1 1\n2 3 1", "output": "0\n"}, {"type": "stdin_stdout", "input": "6\n3 3 1\n1 2 4\n1 4 3\n-1 4 4\n10 0 1\n2 3 1", "output": "0\n"}, {"type": "stdin_stdout", "input": "6\n3 1 1\n2 0 4\n0 4 1\n-1 4 4\n9 -1 2\n2 3 1", "output": "0\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nThe IOI country consists of N towns from town 1 to town N, and the towns are connected by roads. The IOI country has K roads, all of which connect two different towns. Cars can move freely in both directions on...
[{"type": "stdin_stdout", "input": "6 6\n400 2\n200 1\n600 3\n1000 1\n300 5\n700 4\n1 2\n2 3\n3 6\n4 6\n1 5\n2 4", "output": "700"}, {"type": "stdin_stdout", "input": "None", "output": "None"}, {"type": "stdin_stdout", "input": "enoN", "output": "0\n"}, {"type": "stdin_stdout", "input": "eooN", "output": "0\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs the proverb says,\n\n> \"Patience is bitter, but its fruit is sweet.\"\n\nWriting programs within the limited time may impose some patience on you, but you enjoy it and win the contest, we hope.\n\nThe word \"patience\...
[{"type": "stdin_stdout", "input": "4\n1 4 5 2\n3 1 4 3\n5 4 2 2\n4 5 2 3\n1 1 3 5\n5 1 5 1\n4 10 3 2\n3 2 1 4\n1 4 5 3\n2 3 4 2\n1 2 1 2\n5 7 5 4\n2 1 2 1\n3 5 3 4\n3 3 5 4\n4 2 3 1\n2 5 3 1\n3 5 4 2\n1 0 4 1\n4 5 3 2", "output": "0\n18\n12\n2\n"}, {"type": "stdin_stdout", "input": "4\n1 4 5 2\n3 1 4 3\n5 4 2 2\n4 5 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou were lucky enough to get a map just before entering the legendary magical mystery world. The map shows the whole area of your planned exploration, including several countries with complicated borders. The map is clear...
[{"type": "stdin_stdout", "input": "6\nBlizid\n0 0\n60 -1\n60 60\n0 60\n0 50\n50 50\n50 10\n0 10\n-1\nBlizid\n0 10\n10 10\n10 50\n0 50\n-1\nWindom\n10 10\n50 10\n40 20\n20 20\n20 40\n10 50\n-1\nAccent\n50 10\n50 50\n35 50\n35 25\n-1\nPilot\n35 25\n35 50\n19 50\n-1\nBlizid\n20 20\n40 20\n20 40\n-1\n4\nA12345678901234567...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem I Starting a Scenic Railroad Service\n\nJim, working for a railroad company, is responsible for planning a new tourist train service. He is sure that the train route along a scenic valley will arise a big boom, bu...
[{"type": "stdin_stdout", "input": "4\n1 3\n1 11\n10 2\n3 12", "output": "4 2\n"}, {"type": "stdin_stdout", "input": "4\n2 1\n1 11\n10 2\n16 3", "output": "2 0\n"}, {"type": "stdin_stdout", "input": "4\n1 3\n1 11\n10 2\n4 12", "output": "4 2\n"}, {"type": "stdin_stdout", "input": "4\n2 2\n1 11\n10 1\n3 10", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n3D Printing\n\nWe are designing an installation art piece consisting of a number of cubes with 3D printing technology for submitting one to Installation art Contest with Printed Cubes (ICPC). At this time, we are trying t...
[{"type": "stdin_stdout", "input": "1 1 100\n100 100 100\n6 4 10\n100 100 100\n106 102 102\n112 110 104\n104 116 102\n100 114 104\n92 107 100\n10 1 10\n-100 101 100\n-108 102 120\n-116 103 100\n-124 100 100\n-132 99 100\n-92 98 100\n-84 100 140\n-76 103 100\n-68 146 100\n-60 101 100\n10 4 10\n100 100 100\n108 101 100\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe customer telephone support center of the computer sales company called JAG is now in- credibly confused. There are too many customers who request the support, and they call the support center all the time. So, the com...
[{"type": "stdin_stdout", "input": "3 300\n100 46 150\n100 50 150\n101 50 148\n3 300\n110 50 150\n100 50 150\n200 50 150\n9 18\n5 1 1\n3 1 1\n3 1 1\n4 100 1\n5 100 1\n5 100 1\n10 5 5\n10 5 5\n2 7 1000\n10 18\n1 2 6\n2 3 1\n3 4 5\n4 5 6\n5 6 7\n6 7 8\n7 8 9\n12 9 10\n9 10 11\n18 11 12\n0 0", "output": "2\n3\n5\n10\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem Statement\n\nCircles Island is known for its mysterious shape: it is a completely flat island with its shape being a union of circles whose centers are on the $x$-axis and their inside regions.\n\nThe King of Circ...
[{"type": "stdin_stdout", "input": "2\n0 8\n10 8\n2\n0 7\n10 7\n0", "output": "12.489995996796796\n9.899494936611665"}, {"type": "stdin_stdout", "input": "2\n0 8\n10 10\n2\n0 14\n10 14\n0", "output": "14.664242\n24.157244\n"}, {"type": "stdin_stdout", "input": "2\n0 8\n10 8\n2\n0 14\n10 14\n0", "output": "12.489996\n24...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMy futon\n\nYou bought N futons in preparation for your new life. The i-th futon has the warmth supply capacity of si. From the temperature forecast for the next M days, the warmth demand of dj is expected on the jth day....
[{"type": "stdin_stdout", "input": "1 1\n5\n5\n1 1\n5\n4\n1 1\n20\n5\n4 0\n2 4 5 9\n8\n4 3\n3 5 2 1\n10 4 7\n10 5\n2 3 4 2 2\n2 1 5 7 9\n2 5\n1 10\n2 5 2 6 2\n0 0", "output": "0\n1\n5\n0\n1\n0\n12\n"}, {"type": "stdin_stdout", "input": "1 1\n1\n3\n1 1\n5\n2\n1 1\n20\n10\n8 1\n2 4 2 2\n5\n4 3\n3 2 2 1\n10 4 1\n5 5\n2 2 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDivide and rule\n\nTaro, Hanako, and Jiro rule the JAG Kingdom together. There are N cities in the JAG Kingdom, some of which are connected by two-way roads. You can always reach all the other cities from any city via one...
[{"type": "stdin_stdout", "input": "6 7\n1 2\n1 4\n2 3\n2 5\n3 4\n4 5\n4 6\n2 1\n1 2\n3 3\n1 2\n2 3\n2 3\n4 3\n1 2\n2 3\n3 4\n5 4\n1 2\n2 3\n3 4\n4 5\n0 0", "output": "2\n1\n2\n0\n1\n1\n1\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "6 7\n1 2\n1 4\n2 3\n2 6\n3 4\n4 5\n4 6\n2 1\n1 2\n3 3\n1 2\n2 3\n2 3\n4 3\n1 2\n2 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads a word W and a text T, and prints the number of word W which appears in text T\n\nT consists of string Ti separated by space characters and newlines. Count the number of Ti which equals to W. T...
[{"type": "stdin_stdout", "input": "computer\nNurtures computer scientists and highly-skilled computer engineers\nwho will create and exploit \"knowledge\" for the enw era.\nProvides an outstanding computer environment.\nEND_OF_TEXT", "output": "3\n"}, {"type": "stdin_stdout", "input": "comquter\nNurtures computer scie...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOur Chef is catering for a big corporate office party and is busy preparing different mouth watering dishes. The host has insisted that he serves his delicious cupcakes for dessert. \n On the day of the party, the Chef wa...
[{"type": "stdin_stdout", "input": "4\n38\n13\n31\n2", "output": "17\n12\n30\n1\n"}, {"type": "stdin_stdout", "input": "4\n38\n13\n16\n2", "output": "17\n12\n0\n1\n"}, {"type": "stdin_stdout", "input": "4\n131\n14\n1\n4", "output": "130\n5\n0\n0\n"}, {"type": "stdin_stdout", "input": "4\n19\n13\n16\n2", "output": "18\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree (an undirected connected graph without cycles) and an integer s.\n\nVanya wants to put weights on all edges of the tree so that all weights are non-negative real numbers and their sum is s. At the sam...
[{"type": "stdin_stdout", "input": "3 1000000000\n3 2\n2 1\n", "output": "1000000000.0000000000\n"}, {"type": "stdin_stdout", "input": "2 1000000000\n2 1\n", "output": "1000000000.0000000000\n"}, {"type": "stdin_stdout", "input": "6 1\n2 1\n2 3\n2 5\n5 4\n5 6\n", "output": "0.5000000000\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLunar New Year is approaching, and Bob is planning to go for a famous restaurant β€” \"Alice's\".\n\nThe restaurant \"Alice's\" serves n kinds of food. The cost for the i-th kind is always c_i. Initially, the restaurant has...
[{"type": "stdin_stdout", "input": "10 15\n132 138 38 75 14 115 129 68 119 118\n728344 513371 120930 757031 137753 453796 348671 185533 966778 521678\n4 58\n1 8\n8 22\n3 98\n2 111\n6 158\n2 82\n1 170\n1 26\n1 4\n4 76\n10 106\n5 100\n4 116\n7 62\n", "output": "43907798\n5826752\n4081726\n15058400\n56984181\n67179393\n33...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given n integers. You need to choose a subset and put the chosen numbers in a beautiful rectangle (rectangular matrix). Each chosen number should occupy one of its rectangle cells, each cell must be filled with ex...
[{"type": "stdin_stdout", "input": "15\n6 7 11 8 13 11 4 20 17 12 9 15 18 13 18\n", "output": "15\n3 5\n18 13 20 12 7 \n6 18 11 17 9 \n8 4 13 11 15 \n"}, {"type": "stdin_stdout", "input": "15\n6 7 11 8 13 11 4 20 17 12 9 15 18 13 9\n", "output": "15\n3 5\n13 11 20 15 7 \n6 13 9 18 12 \n8 4 11 9 17 \n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n monsters standing in a row numbered from 1 to n. The i-th monster has h_i health points (hp). You have your attack power equal to a hp and your opponent has his attack power equal to b hp.\n\nYou and your oppo...
[{"type": "stdin_stdout", "input": "6 2 3 3\n7 10 50 12 1 8\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "6 2 3 2\n7 10 50 12 1 8\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "6 2 3 2\n5 10 50 12 1 8\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "6 2 2 2\n5 10 50 12 1 8\n", "output": "6\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA subway scheme, classic for all Berland cities is represented by a set of n stations connected by n passages, each of which connects exactly two stations and does not pass through any others. Besides, in the classic sche...
[{"type": "stdin_stdout", "input": "10\n10 2\n10 5\n9 5\n3 9\n4 7\n3 1\n7 2\n10 6\n7 8\n1 4\n", "output": "0 0 0 0 0 1 0 1 0 0\n"}, {"type": "stdin_stdout", "input": "10\n10 7\n1 5\n2 1\n4 1\n1 10\n3 1\n9 7\n1 8\n7 6\n7 1\n", "output": "0 1 1 1 1 1 0 1 1 0 "}, {"type": "stdin_stdout", "input": "10\n8 2\n10 5\n9 5\n3 9\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have integer n. Calculate how many ways are there to fully cover belt-like area of 4n-2 triangles with diamond shapes. \n\nDiamond shape consists of two triangles. You can move, rotate or flip the shape, but you canno...
[{"type": "stdin_stdout", "input": "1\n1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "1\n1111011001\n", "output": "1111011001\n"}, {"type": "stdin_stdout", "input": "1\n1011011001\n", "output": "1011011001\n"}, {"type": "stdin_stdout", "input": "1\n1011001001\n", "output": "1011001001\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolygon is not only the best platform for developing problems but also a square matrix with side n, initially filled with the character 0.\n\nOn the polygon, military training was held. The soldiers placed a cannon above ...
[{"type": "stdin_stdout", "input": "5\n4\n0110\n0011\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1111\n0101\n0111\n", "output": "YES\nNO\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "5\n4\n0010\n0111\n0000\n0000\n2\n10\n01\n2\n00\n00\n4\n0101\n1111\n0101\n0111\n4\n0100\n1100\n0101\n0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet a and b be some non-negative integers. Let's define strange addition of a and b as following:\n\n 1. write down the numbers one under another and align them by their least significant digit; \n 2. add them up digit ...
[{"type": "stdin_stdout", "input": "2 3\n14\n2 4\n2 1\n1 1\n", "output": "15\n12\n12\n"}, {"type": "stdin_stdout", "input": "2 3\n14\n2 4\n2 1\n2 0\n", "output": "15\n12\n11\n"}, {"type": "stdin_stdout", "input": "2 3\n11\n2 8\n2 2\n2 0\n", "output": "19\n13\n11\n"}, {"type": "stdin_stdout", "input": "2 3\n11\n2 8\n2 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA famous gang of pirates, Sea Dogs, has come back to their hideout from one of their extravagant plunders. They want to split their treasure fairly amongst themselves, that is why You, their trusted financial advisor, dev...
[{"type": "stdin_stdout", "input": "1000010000 3\n44431 10822\n45250 1096927361\n264372930 1\n", "output": "-1"}, {"type": "stdin_stdout", "input": "1000010001 3\n44431 10822\n45250 1096927361\n264372930 1\n", "output": "-1"}, {"type": "stdin_stdout", "input": "1000000000 3\n30490 19232\n45250 999980767\n264372930 1\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a famous olympiad, which has more than a hundred participants. The Olympiad consists of two stages: the elimination stage, and the final stage. At least a hundred participants will advance to the final stage. The...
[{"type": "stdin_stdout", "input": "2\n1 2 2 1\n4 8 12 4\n", "output": "3\n16\n"}, {"type": "stdin_stdout", "input": "2\n1 2 3 1\n4 8 12 4\n", "output": "4\n16\n"}, {"type": "stdin_stdout", "input": "2\n1 2 2 1\n4 8 9 2\n", "output": "3\n12\n"}, {"type": "stdin_stdout", "input": "2\n1 2 2 1\n4 8 9 4\n", "output": "3\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\...
[{"type": "stdin_stdout", "input": "100000 77777\n", "output": "177777\n"}, {"type": "stdin_stdout", "input": "150234 77777\n", "output": "177777\n"}, {"type": "stdin_stdout", "input": "77777 77777\n", "output": "177777\n"}, {"type": "stdin_stdout", "input": "47774 47774\n", "output": "147774\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have r red and b blue beans. You'd like to distribute them among several (maybe, one) packets in such a way that each packet: \n\n * has at least one red bean (or the number of red beans r_i β‰₯ 1); \n * has at least ...
[{"type": "stdin_stdout", "input": "10\n1000000000 1 1000000000\n1000000000 1 1000000000\n1000000000 1 1000000000\n1000000000 1 1000000000\n1000000000 1 1000000000\n1000000000 1 1000000000\n1000000000 1 1000000000\n1000000000 1 1000000000\n1000000000 1 1000000000\n1000000000 1 1000000000\n", "output": "YES\nYES\nYES\nY...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAquaMoon and Cirno are playing an interesting game with arrays. Cirno has prepared two arrays a and b, both consist of n non-negative integers. AquaMoon can perform the following operation an arbitrary number of times (po...
[{"type": "stdin_stdout", "input": "4\n25\n0 0 0 0 0 8 1 0 9 0 8 8 0 0 11 0 0 0 9 3 10 4 10 4 0\n2 0 0 1 10 0 10 6 0 4 0 2 0 3 11 1 2 11 0 7 6 0 0 9 0\n25\n0 0 6 0 6 2 0 0 4 1 0 0 8 1 0 9 6 6 7 0 5 4 3 0 6\n8 0 0 2 0 9 0 6 5 0 4 9 9 0 0 3 0 6 0 6 7 0 0 0 0\n25\n4 0 7 0 5 0 0 0 0 0 5 2 1 5 5 9 7 0 0 0 0 0 0 2 1\n5 0 0 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n\"The Chamber of Secrets has been opened again\" β€” this news has spread all around Hogwarts and some of the students have been petrified due to seeing the basilisk. Dumbledore got fired and now Harry is trying to enter th...
[{"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\nHamming distance between strings a and b of equal length (denoted by h(a, b)) is equal to the number of distinct integers i (1 ≀ i ≀ |a|), such that ai β‰  bi, where ai is the i-th symbol of string a, bi is the i-th symbol ...
[{"type": "stdin_stdout", "input": "5728 5729 5750\n5631 5768\n9209\n", "output": "10344\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are cons...
[{"type": "stdin_stdout", "input": "50\nRBGBGGRRGGRGGBGBGRRBGGBGBRRBBGBBGBBBGBBRBBRBRBRGRG\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "50\nRBGGBGGRBGRBBBGBBGRBBBGGGRBBBGBBBGRGGBGGBRBGBGRRGG\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "50\nGRBGGRBRGRBGGBBBBBGGGBBBBRBRGBRRBRGBBBRBBRRGBGGGRB\n",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRobot Bender decided to make Fray a birthday present. He drove n nails and numbered them from 1 to n in some order. Bender decided to make a picture using metal rods. The picture is a closed polyline, which vertices shoul...
[{"type": "stdin_stdout", "input": "4 4\n-8423 7689\n6902 7689\n6902 2402\n-8423 2402\n20612 20612 91529 35617\n", "output": "YES\n1 -1 2 -1 \n"}, {"type": "stdin_stdout", "input": "4 4\n-8423 7689\n6902 7689\n6902 2402\n-8423 2402\n20612 20612 123030 35617\n", "output": "YES\n1 -1 2 -1 "}, {"type": "stdin_stdout", "in...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSereja and his friends went to a picnic. The guys had n soda bottles just for it. Sereja forgot the bottle opener as usual, so the guys had to come up with another way to open bottles.\n\nSereja knows that the i-th bottle...
[{"type": "stdin_stdout", "input": "50\n507 31\n31 250\n414 763\n169 304\n901 9\n592 610\n763 414\n656 789\n411 422\n360 468\n625 504\n538 201\n549 619\n484 797\n596 282\n42 310\n603 656\n351 623\n292 293\n837 180\n375 658\n21 192\n597 729\n22 512\n349 635\n200 56\n669 647\n485 887\n282 939\n735 808\n54 417\n1000 310\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIahub likes trees very much. Recently he discovered an interesting tree named propagating tree. The tree consists of n nodes numbered from 1 to n, each node i having an initial value ai. The root of the tree is node 1.\n\...
[{"type": "stdin_stdout", "input": "10 10\n418 45 865 869 745 901 177 773 854 462\n4 8\n1 4\n3 6\n1 5\n1 10\n5 9\n1 2\n4 7\n1 3\n2 2\n1 6 246\n1 4 296\n1 2 378\n1 8 648\n2 6\n1 5 288\n1 6 981\n1 2 868\n2 7\n", "output": "45\n1147\n-119\n"}, {"type": "stdin_stdout", "input": "10 10\n418 31 865 869 745 901 177 773 854 46...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nValera takes part in the Berland Marathon. The marathon race starts at the stadium that can be represented on the plane as a square whose lower left corner is located at point with coordinates (0, 0) and the length of the...
[{"type": "stdin_stdout", "input": "70092.4982 95833.7741\n1000\n", "output": "70092.4982000000 25741.2759000000\n18609.9464000000 70092.4982000000\n7131.3295000000 0.0000000000\n70092.4982000000 32872.6054000000\n11478.6169000001 70092.4982000000\n14262.6590000000 0.0000000000\n70092.4982000000 40003.9348999999\n4347....
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nQuite recently a creative student Lesha had a lecture on trees. After the lecture Lesha was inspired and came up with the tree of his own which he called a k-tree.\n\nA k-tree is an infinite rooted tree where:\n\n * each...
[{"type": "stdin_stdout", "input": "100 50 50\n", "output": "661237556\n"}, {"type": "stdin_stdout", "input": "100 100 1\n", "output": "988185646\n"}, {"type": "stdin_stdout", "input": "90 100 30\n", "output": "697322870\n"}, {"type": "stdin_stdout", "input": "100 13 11\n", "output": "883875774\n"}, {"type": "stdin_std...
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 <image> and <image>, where ...
[{"type": "stdin_stdout", "input": "10000000 10000000\n", "output": "425362313\n"}, {"type": "stdin_stdout", "input": "10000000 11383836\n", "output": "113242098\n"}, {"type": "stdin_stdout", "input": "10000100 10000000\n", "output": "778965806\n"}, {"type": "stdin_stdout", "input": "12520154 17573427\n", "output": "52...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya and Petya have invented a new game. Vasya takes a stripe consisting of 1 Γ— n square and paints the squares black and white. After that Petya can start moves β€” during a move he may choose any two neighboring squares ...
[{"type": "stdin_stdout", "input": "337\n000000000000000000000000000000000000001000000000000000000000000000000001000000000000100000000010010000000000000000000000000000000000000000000000000000000010000000000100001000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarpus got an internship in one well-known social network. His test task is to count the number of unique users who have visited a social network during the day. Polycarpus was provided with information on all user re...
[{"type": "stdin_stdout", "input": "10 3 30000\n00:06:54\n00:42:06\n03:49:45\n04:38:35\n05:33:30\n05:51:46\n10:46:34\n14:34:59\n14:40:06\n14:53:13\n", "output": "6\n1\n2\n3\n3\n3\n3\n4\n5\n6\n6\n"}, {"type": "stdin_stdout", "input": "10 3 30000\n00:06:54\n00:42:06\n03:49:45\n04:38:35\n05:33:30\n05:51:46\n10:46:34\n14:3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day Squidward, Spongebob and Patrick decided to go to the beach. Unfortunately, the weather was bad, so the friends were unable to ride waves. However, they decided to spent their time building sand castles.\n\nAt the...
[{"type": "stdin_stdout", "input": "101\n1 50 170 269 214 153 132 234 181 188 180 225 226 200 197 122 181 168 160 220 223 160 235 94 257 145 199 235 102 146 119 60 109 134 209 260 210 191 180 271 236 195 155 169 166 143 106 102 208 137 278 269 156 251 198 165 111 198 151 213 256 121 276 163 179 285 104 99 139 122 188 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOnce Max found an electronic calculator from his grandfather Dovlet's chest. He noticed that the numbers were written with seven-segment indicators (<https://en.wikipedia.org/wiki/Seven-segment_display>).\n\n<image>\n\nMa...
[{"type": "stdin_stdout", "input": "222145 353252\n", "output": "3860750\n"}, {"type": "stdin_stdout", "input": "188883 353252\n", "output": "4803878\n"}, {"type": "stdin_stdout", "input": "188883 240204\n", "output": "1479377\n"}, {"type": "stdin_stdout", "input": "443 390308\n", "output": "10631342\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Artem found a grasshopper. He brought it to his house and constructed a jumping area for him.\n\nThe area looks like a strip of cells 1 Γ— n. Each cell contains the direction for the next jump and the length of that...
[{"type": "stdin_stdout", "input": "10\n>>>>>>>>>>\n1 1 1 1 1 1 1 1 1 100\n", "output": "FINITE\n"}, {"type": "stdin_stdout", "input": "10\n>>>>>>>>><\n1 1 1 1 1 1 1 1 1 5\n", "output": "INFINITE\n"}, {"type": "stdin_stdout", "input": "10\n>>>>>>>>><\n1 1 1 1 1 1 1 1 1 1\n", "output": "INFINITE\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Artem is fond of dancing. Most of all dances Artem likes rueda β€” Cuban dance that is danced by pairs of boys and girls forming a circle and dancing together.\n\nMore detailed, there are n pairs of boys and girls st...
[{"type": "stdin_stdout", "input": "364 57\n1 -101\n1 110\n1 -76\n1 329\n2\n2\n2\n1 -191\n1 97\n1 189\n1 305\n1 -313\n1 312\n1 -148\n2\n1 -104\n1 85\n1 -55\n1 -79\n1 230\n1 -94\n1 58\n1 -72\n2\n2\n2\n1 -104\n1 -351\n1 23\n2\n1 215\n2\n2\n2\n1 58\n1 -237\n2\n2\n2\n1 198\n2\n1 83\n2\n1 -205\n2\n2\n2\n2\n1 -110\n2\n2\n2\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nZS the Coder is playing a game. There is a number displayed on the screen and there are two buttons, ' + ' (plus) and '<image>' (square root). Initially, the number 2 is displayed on the screen. There are n + 1 levels in ...
[{"type": "stdin_stdout", "input": "6723\n", "output": "2\n17\n46\n97\n176\n289\n442\n641\n892\n1201\n1574\n2017\n2536\n3137\n3826\n4609\n5492\n6481\n7582\n8801\n10144\n11617\n13226\n14977\n16876\n18929\n21142\n23521\n26072\n28801\n31714\n34817\n38116\n41617\n45326\n49249\n53392\n57761\n62362\n67201\n72284\n77617\n8320...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's call a non-empty sequence of positive integers a1, a2... ak coprime if the greatest common divisor of all elements of this sequence is equal to 1.\n\nGiven an array a consisting of n positive integers, find the numb...
[{"type": "stdin_stdout", "input": "100\n881 479 355 759 257 497 690 598 275 446 439 787 257 326 584 713 322 5 253 781 434 307 164 154 241 381 38 942 680 906 240 11 431 478 628 959 346 74 493 964 455 746 950 41 585 549 892 687 264 41 487 676 63 453 861 980 477 901 80 907 285 506 619 748 773 743 56 925 651 685 845 313 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou already know that Valery's favorite sport is biathlon. Due to your help, he learned to shoot without missing, and his skills are unmatched at the shooting range. But now a smaller task is to be performed, he should le...
[{"type": "stdin_stdout", "input": "20 20 2\nbaaaaaaaaaaaaaaaaaaa\nbfffffffacfffffffffa\nbgggggggaccgggggggga\nbhhhhhhhaccchhhhhhha\nbiiiiiiiacccciiiiiia\nbjjjjjjjacccccjjjjja\nbkkkkkkkacccccckkkka\nblllllllacccccccllla\nbbbbbbbbSccccccccmma\nbddddddddddcccccccna\nbodddddddcccccccccca\nbppddddddddTaaaaaaaa\nbqqqddddddd...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s consisting only of characters 0 and 1. A substring [l, r] of s is a string slsl + 1sl + 2... sr, and its length equals to r - l + 1. A substring is called balanced if the number of zeroes (0) equa...
[{"type": "stdin_stdout", "input": "65\n11001000110001001011011110111100000000101001001010101111000100010\n", "output": "48\n"}, {"type": "stdin_stdout", "input": "65\n11001000110101001011011110111100000000101001001010101111000100010\n", "output": "56\n"}, {"type": "stdin_stdout", "input": "65\n110010011101010010110111...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere were n groups of students which came to write a training contest. A group is either one person who can write the contest with anyone else, or two people who want to write the contest in the same team.\n\nThe coach d...
[{"type": "stdin_stdout", "input": "247\n2 2 1 2 1 2 2 2 2 2 2 1 1 2 2 1 2 1 1 1 2 1 1 1 1 2 1 1 2 2 1 2 1 1 1 2 2 2 1 1 2 1 1 2 1 1 1 2 1 2 1 2 2 1 1 2 1 2 2 1 2 1 2 1 1 2 1 1 1 2 2 1 1 2 2 1 1 2 1 1 1 2 2 2 2 1 2 2 1 2 2 2 1 2 2 2 2 1 1 1 1 1 1 1 1 1 2 1 2 2 1 2 1 2 2 2 1 2 2 2 1 1 2 2 1 1 1 2 1 1 1 1 2 2 1 2 2 1 1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th w...
[{"type": "stdin_stdout", "input": "15\n18 6 33 21 14 20 13 9 18 20 28 13 19 25 21\n", "output": "10 -1 11 8 6 6 0 -1 2 2 3 -1 -1 0 -1 "}, {"type": "stdin_stdout", "input": "15\n18 6 33 21 14 20 20 9 18 20 28 13 19 25 21\n", "output": "10 -1 11 8 6 6 5 -1 2 2 3 -1 -1 0 -1 "}, {"type": "stdin_stdout", "input": "15\n18 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAllen and Bessie are playing a simple number game. They both know a function f: \\{0, 1\\}^n β†’ R, i. e. the function takes n binary arguments and returns a real value. At the start of the game, the variables x_1, x_2, ......
[{"type": "stdin_stdout", "input": "2 2\n0 1 2 3\n2 5\n0 4\n", "output": "1.5000000000\n2.2500000000\n3.2500000000\n"}, {"type": "stdin_stdout", "input": "2 2\n0 1 2 3\n2 3\n1 11\n", "output": "1.5\n1.75\n4.25\n"}, {"type": "stdin_stdout", "input": "2 2\n0 1 2 2\n2 3\n1 4\n", "output": "1.25\n1.5\n2.25\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAniruddha and Andrew are playing a Game on Christmas Eve named \"Christmas-Gamecon\". In this they are given a list of numbers.\nIn each turn alternatively one will select any one number from the list and decrease it by 1...
[{"type": "stdin_stdout", "input": "2\n2\n-1 1\n2\n1 2\n\nSAMOLE", "output": "Aniruddha\nAniruddha\n"}, {"type": "stdin_stdout", "input": "2\n2\n-1 2\n2\n1 2\n\nSAMOLE", "output": "Aniruddha\nAniruddha\n"}, {"type": "stdin_stdout", "input": "2\n2\n-1 2\n2\n1 4\n\nRAMOLE", "output": "Aniruddha\nAniruddha\n"}, {"type": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nView Russian Translation\n\nIn this problem the goal is to implement a program managing an elevator designed especially for mathematicians.\n\nThe elevator can go to any of N floors numbered from 1 to N and it can carry a...
[{"type": "stdin_stdout", "input": "47 1\n1 4 13\n-1 2 0\n\nSMAMPE", "output": "3 13\n"}, {"type": "stdin_stdout", "input": "210 1\n1 3 14\n2 2 6\n\nRAMPLE", "output": "2 14\n"}, {"type": "stdin_stdout", "input": "11 1\n1 2 17\n1 2 -2\n\nTAMPLE", "output": "1 17\n"}, {"type": "stdin_stdout", "input": "27 1\n1 6 11\n1 2...
code_stdio