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 n students living in the campus. Every morning all students wake up at the same time and go to wash. There are m rooms with wash basins. The i-th of these rooms contains ai wash basins. Every student independent...
[{"type": "stdin_stdout", "input": "50 50\n50 48 38 45 50 48 38 48 49 49 50 50 49 50 38 48 45 40 43 49 48 43 50 50 50 42 47 50 49 34 48 47 48 50 50 50 49 47 48 49 48 48 50 39 45 47 48 47 45 50\n", "output": "1.000000000000001\n"}, {"type": "stdin_stdout", "input": "50 50\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDo the following for a four-digit number N consisting of numbers 0-9.\n\n1. Let L be the number obtained as a result of arranging the numerical values ​​of each of the N digits in descending order.\n2. Let S be the number...
[{"type": "stdin_stdout", "input": "6174\n3985\n3333\n0000", "output": "0\n3\nNA\n"}, {"type": "stdin_stdout", "input": "6174\n1779\n3333\n0000", "output": "0\n6\nNA\n"}, {"type": "stdin_stdout", "input": "6174\n1794\n3333\n0000", "output": "0\n5\nNA\n"}, {"type": "stdin_stdout", "input": "6174\n1542\n3333\n0000", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGena loves sequences of numbers. Recently, he has discovered a new type of sequences which he called an almost arithmetical progression. A sequence is an almost arithmetical progression, if its elements can be represented...
[{"type": "stdin_stdout", "input": "73\n531 626 701 57 708 511 54 441 297 697 411 253 397 652 21 59 851 561 539 461 629 894 275 417 127 960 433 243 963 247 5 368 969 541 408 485 319 117 441 131 265 357 1 659 267 983 643 285 913 782 813 569 99 781 297 636 645 341 6 17 601 129 509 197 226 105 241 737 86 128 762 647 849\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIlya is working for the company that constructs robots. Ilya writes programs for entertainment robots, and his current project is \"Bob\", a new-generation game robot. Ilya's boss wants to know his progress so far. Especi...
[{"type": "stdin_stdout", "input": "129341234876124184 1 2\n1 3 3\n1 1 2\n1 2 3\n3 1 1\n3 1 3\n3 2 3\n", "output": "64670617438062091 64670617438062093\n"}, {"type": "stdin_stdout", "input": "129341234876124184 1 2\n1 3 3\n1 1 2\n1 2 3\n3 1 1\n3 1 3\n3 2 3\n", "output": "64670617438062091 64670617438062093\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe map of Bertown can be represented as a set of n intersections, numbered from 1 to n and connected by m one-way roads. It is possible to move along the roads from any intersection to any other intersection. The length ...
[{"type": "stdin_stdout", "input": "20 50\n20 3\n5 16\n1 3\n10 11\n10 15\n15 9\n20 9\n14 6\n16 5\n13 4\n11 5\n3 20\n13 17\n11 8\n11 6\n12 14\n16 18\n17 13\n18 7\n3 1\n8 10\n17 15\n7 2\n9 13\n5 11\n6 1\n2 16\n8 18\n10 8\n4 13\n9 15\n14 12\n1 6\n9 20\n7 18\n6 14\n7 6\n18 16\n2 7\n3 11\n15 17\n3 12\n14 10\n4 14\n19 4\n11 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation o...
[{"type": "stdin_stdout", "input": "10000000000\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "9999999967\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "53937807463", "output": "10\n"}, {"type": "stdin_stdout", "input": "9876543210\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "6983776800...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the International System of Units (SI), various physical quantities are expressed in the form of \"numerical value + prefix + unit\" using prefixes such as kilo, mega, and giga. For example, \"3.5 kilometers\", \"5.1 m...
[{"type": "stdin_stdout", "input": "7\n12.729479136172973 kilo metfrt\n0.45 mega sttaw\n0.000000000000000000000001 yotta mrags\n1000000000000000000000000 yocto seconds\n42 amperes\n0.951642419825234 joulfs\n1234.56789012345678901234567890 hecto pascals", "output": "1.2729479136172973 * 10^4 metfrt\n4.5 * 10^5 sttaw\n1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe call a positive integer number fair if it is divisible by each of its nonzero digits. For example, $102$ is fair (because it is divisible by $1$ and $2$), but $282$ is not, because it isn't divisible by $8$. Given a po...
[{"type": "stdin_stdout", "input": "100\n95\n94\n31\n65\n35\n95\n70\n78\n81\n36\n69\n97\n39\n28\n89\n62\n36\n23\n35\n21\n36\n11\n65\n39\n13\n34\n79\n87\n91\n70\n43\n82\n24\n97\n6\n87\n49\n81\n60\n92\n63\n9\n16\n6\n31\n90\n6\n5\n70\n48\n27\n86\n65\n66\n45\n8\n67\n17\n24\n44\n34\n93\n26\n32\n82\n54\n72\n83\n94\n81\n79\n7...
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 2\n9 7\n3 7\n15 9\n1 3\n11 12\n18 7\n17 18\n20 1\n4 11\n2 11\n12 18\n8 18\n13 2\n19 2\n10 11\n6 13\n5 8\n14 1\n16 13\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "20 7\n9 7\n3 13\n15 9\n1 3\n11 9\n18 7\n17 18\n20 1\n4 11\n2 11\n12 18\n8 18\n13 2\n19 1\n10 14\n6 13\n5 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are playing a game and your goal is to maximize your expected gain. At the beginning of the game, a pawn is put, uniformly at random, at a position p\\in\\\\{1,2,\\dots, N\\\\}. The N positions are arranged on a circl...
[{"type": "stdin_stdout", "input": "10\n710714906537 801526060256 134858704333 970632701383 344124734627 780768757320 1205627779029 145838269002 9231169966 485814502387\n31 83 57 11 001 30 10 91 15 28", "output": "1205627778393.899999976158\n"}, {"type": "stdin_stdout", "input": "10\n710714906537 223115971783 134858704...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nValera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.\n\nValera has written n correct solutions. For each correct solution, he knows its running time (in se...
[{"type": "stdin_stdout", "input": "68 85\n43 55 2 4 72 45 19 56 53 81 18 90 11 87 47 8 94 88 24 4 67 9 21 70 25 66 65 27 46 13 8 51 65 99 37 77 71 59 71 79 22 56 49 43 57 85 95 81 40 28 60 36 72 81 60 40 16 78 61 37 29 26 15 95 70 27 50 97\n6 6 48 72 54 31 1 50 29 64 93 9 29 93 66 63 25 90 52 1 66 13 70 44 24 87 32 90...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nImp is watching a documentary about cave painting. [Image] \n\nSome numbers, carved in chaotic order, immediately attracted his attention. Imp rapidly proposed a guess that they are the remainders of division of a number ...
[{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000000100000\n", "output": "No\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a graph with $n$ nodes and $m$ directed edges. One lowercase letter is assigned to each node. We define a path's value as the number of the most frequently occurring letter. For example, if letters on a path...
[{"type": "stdin_stdout", "input": "10 50\nebibwbjihv\n1 10\n1 2\n5 4\n1 8\n9 7\n5 6\n1 8\n8 7\n2 6\n5 4\n1 9\n3 2\n3 3\n5 6\n5 9\n2 4\n2 7\n3 9\n1 2\n1 7\n1 10\n3 7\n1 8\n3 10\n8 6\n1 7\n10 6\n1 6\n10 8\n1 5\n2 10\n3 9\n1 8\n8 3\n3 7\n5 2\n1 10\n1 4\n5 3\n3 2\n1 2\n5 8\n10 4\n2 10\n8 2\n1 9\n1 8\n1 2\n3 4\n1 8\n", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWilliam has two arrays $a$ and $b$, each consisting of $n$ items.\n\nFor some segments $l..r$ of these arrays William wants to know if it is possible to equalize the values of items in these segments using a balancing ope...
[{"type": "stdin_stdout", "input": "10 10\n894887111 146743785 109114345 815955099 968902979 475266442 919978438 174336213 986559256 952162378\n894887111 146743785 820647914 104421530 968902979 475266442 919978438 908881640 252013829 952162378\n7 10\n6 9\n5 9\n1 7\n2 9\n1 3\n3 10\n1 10\n3 7\n2 4\n", "output": "73454542...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBaby Ehab is known for his love for a certain operation. He has an array $a$ of length $n$, and he decided to keep doing the following operation on it:\n\nhe picks $2$ adjacent elements; he then removes them and places a ...
[{"type": "stdin_stdout", "input": "15\n2\n660632533 660632533\n2\n774306959 774306959\n2\n971739496 784083784\n2\n775353256 672614891\n2\n403290217 403290217\n2\n651261320 651261320\n2\n894672621 894672621\n2\n46281693 620415865\n2\n92929999 409128591\n2\n26890011 630323358\n2\n443724284 443724284\n2\n308822599 308822...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have an array $a_1, a_2, \\dots, a_n$. All $a_i$ are positive integers.\n\nIn one step you can choose three distinct indices $i$, $j$, and $k$ ($i \\neq j$; $i \\neq k$; $j \\neq k$) and assign the sum of $a_j$ and $a...
[{"type": "stdin_stdout", "input": "15\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nDo you know Just Odd Inventions? The business of this company is to \"just odd inventions\". Here we call it JOI for short.\n\nJOI has two offices, each of which has square rooms of the same size arranged in a ...
[{"type": "stdin_stdout", "input": "5\n2 2 1 2\n6 5\n1 17\n3 2 2 1\n11 1 20\n10 18 3\n8\n5 4 1 3\n5 5 4 5 2\n8 2 1 9 7\n1 1 3 5 1\n7 2 7 1 3\n6 5 6 2\n2 3 5 8 2 7\n1 6 9 4 5 1\n2 5 1 4 2 2\n5 4 2 5 3 3\n12 1 5 1 5 6\n6\n3 3 2 2\n2 17 2\n9 1 9\n2 9 2\n2 2 1 1\n1 3\n5 7\n0", "output": "17\n4\n9\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is data of up to 100 characters per line, consisting of half-width alphabetic character strings. Some lines are symmetric (same whether read from the left edge or the right edge). Create a program that reads this da...
[{"type": "stdin_stdout", "input": "abcba\nsx\nabcddcba\nrstrd", "output": "2\n"}, {"type": "stdin_stdout", "input": "abcca\nsw\nabcddcba\nrstrd", "output": "1\n"}, {"type": "stdin_stdout", "input": "abcca\nxt\nadcbdcba\nrdsrt", "output": "0\n"}, {"type": "stdin_stdout", "input": "abcba\nsw\nabcddcba\nrstrd", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAyrat is looking for the perfect code. He decided to start his search from an infinite field tiled by hexagons. For convenience the coordinate system is introduced, take a look at the picture to see how the coordinates of...
[{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": " -418284973 -1154700538\n"}, {"type": "stdin_stdout", "input": "533568904697339792\n", "output": " ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string s, consisting of characters \"x\" and \"y\", and uses two following operations at runtime:...
[{"type": "stdin_stdout", "input": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n", "output": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"}, {"type": "stdin_stdout", "input": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\n", "output": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\n"}, {"type": "stdin_stdout", "input": "yy...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the...
[{"type": "stdin_stdout", "input": "20 20\n-1012 625 39 -1747 -1626 898 -1261 180 -876 -1417 -1853 -1510 -1499 -561 -1824 442 -895 13 1857 1860\n-1269013 -1270956 -1264151 -1266004 -1268121 -1258341 -1269574 -1271851 -1258302 -1271838 -1260049 -1258966 -1271398 -1267514 -1269981 -1262038 -1261675 -1262734 -1260777 -126...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMountaineers Mr. Takahashi and Mr. Aoki recently trekked across a certain famous mountain range. The mountain range consists of N mountains, extending from west to east in a straight line as Mt. 1, Mt. 2, ..., Mt. N. Mr. ...
[{"type": "stdin_stdout", "input": "10\n1 3776 3776 8848 8848 8848 8848 8848 8848 8848\n8848 8848 8848 8848 8848 8848 8848 8848 3776 5", "output": "884111967"}, {"type": "stdin_stdout", "input": "5\n16 0 4 -1 2\n19 24 -3 0 -11", "output": "0\n"}, {"type": "stdin_stdout", "input": "5\n16 0 1 -1 2\n19 24 -3 0 -11", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor given two sides of a triangle a and b and the angle C between them, calculate the following properties:\n\n* S: Area of the triangle\n* L: The length of the circumference of the triangle\n* h: The height of the triang...
[{"type": "stdin_stdout", "input": "1 2 -1", "output": "-0.0174524064373\n4.00030456331\n-0.0349048128746\n"}, {"type": "stdin_stdout", "input": "2 1 -2", "output": "-0.0348994967025\n4.00121760468\n-0.0348994967025\n"}, {"type": "stdin_stdout", "input": "1 1 -2", "output": "-0.0174497483513\n2.03490481287\n-0.03489949...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAt a break Vanya came to the class and saw an array of $n$ $k$-bit integers $a_1, a_2, \\ldots, a_n$ on the board. An integer $x$ is called a $k$-bit integer if $0 \\leq x \\leq 2^k - 1$. \n\nOf course, Vanya was not able...
[{"type": "stdin_stdout", "input": "20 30\n30095551 418501267 319405832 181290086 651729244 244371014 1160853882 491522284 582219539 1510068105 512276151 438340777 293617992 759003208 759003208 1 1043646272 1073741823 1431280338 1073741823\n", "output": "210\n"}, {"type": "stdin_stdout", "input": "20 30\n30095551 41850...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem we assume the Earth to be a completely round ball and its surface a perfect sphere. The length of the equator and any meridian is considered to be exactly 40 000 kilometers. Thus, travelling from North Pol...
[{"type": "stdin_stdout", "input": "10\n20000 South\n20000 North\n20000 South\n20000 North\n20000 South\n20000 North\n20000 South\n20000 North\n20000 South\n20000 North\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10\n20000 South\n20000 North\n20000 South\n20000 North\n20000 South\n20000 North\n20000 Sout...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDoes \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n* 1 \\leq a, b, c \\leq 10^9\n* All values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\n\na \\ b \\ c\n\n...
[{"type": "stdin_stdout", "input": "-10 -1 1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-10 -1 0", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-16 -1 0", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "110 -1 -3", "output": "No\n"}, {"type": "stdin_stdout", "input": "-1 -14 2", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou want to perform the combo on your opponent in one popular fighting game. The combo is the string $s$ consisting of $n$ lowercase Latin letters. To perform the combo, you have to press all buttons in the order they app...
[{"type": "stdin_stdout", "input": "3\n4 2\nabca\n1 3\n10 5\ncodeforces\n2 8 3 2 9\n26 10\nqwertyuioplkjhgfdsazxcvbnm\n20 10 1 2 3 5 10 5 9 4\n", "output": "4 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \n\n0 0 9 4 5 3 0 0 0 0 0 0 0 0 9 0 0 3 1 0 0 0 0 0 0 0 \n\n2 1 1 2 9 2 2 2 5 2 2 2 1 1 5 4 11 8 2 7 5 1 10 1 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have a Petri dish with bacteria and you are preparing to dive into the harsh micro-world. But, unfortunately, you don't have any microscope nearby, so you can't watch them.\n\nYou know that you have $n$ bacteria in th...
[{"type": "stdin_stdout", "input": "8 1000000\n1 1 5 1000000 1000000 2 2 2\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "8 1000000\n1 1 5 1000000 1000000 2 2 2\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "8 1000000\n2 1 5 1000000 1000000 2 2 2\n", "output": "2\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are responsible for installing a gas pipeline along a road. Let's consider the road (for simplicity) as a segment $[0, n]$ on $OX$ axis. The road can have several crossroads, but for simplicity, we'll denote each cros...
[{"type": "stdin_stdout", "input": "4\n8 2 5\n00110010\n8 1 1\n00110010\n9 100000000 100000000\n010101010\n2 5 1\n00\n", "output": "94\n25\n2900000000\n13\n"}, {"type": "stdin_stdout", "input": "4\n8 2 5\n00110010\n8 1 1\n01110010\n9 100000000 100000000\n010101010\n2 5 1\n00\n", "output": "94\n26\n2900000000\n13\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp has recently created a new level in this cool new game Berlio Maker 85 and uploaded it online. Now players from all over the world can try his level.\n\nAll levels in this game have two stats to them: the number ...
[{"type": "stdin_stdout", "input": "1\n99\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 ...
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": "100\n0 0\n0 0\n0 0\n97 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 29\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n12 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's call the following process a transformation of a sequence of length $n$.\n\nIf the sequence is empty, the process ends. Otherwise, append the greatest common divisor (GCD) of all the elements of the sequence to the ...
[{"type": "stdin_stdout", "input": "40471\n", "output": "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 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...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a point $A$ with coordinate $x = n$ on $OX$-axis. We'd like to find an integer point $B$ (also on $OX$-axis), such that the absolute difference between the distance from $O$ to $B$ and the distance from $A$ to $B$...
[{"type": "stdin_stdout", "input": "6\n0 0\n5 8\n0 1000000\n1 0\n2 0\n0000000 1000000\n", "output": "0\n3\n1000000\n1\n0\n1000000\n"}, {"type": "stdin_stdout", "input": "6\n6 0\n0 8\n0 1000000\n0 0\n1 0\n0000000 1000000\n", "output": "0\n8\n1000000\n0\n1\n1000000\n"}, {"type": "stdin_stdout", "input": "6\n0 0\n5 8\n1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEveryone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision to change some World Cup reg...
[{"type": "stdin_stdout", "input": "4\nTeMnHVvWKpwlpubwyhzqvc\nAWJwc\nbhbxErlydiwtoxy\nEVASMeLpfqwjkke\nAWJwc-TeMnHVvWKpwlpubwyhzqvc 43:73\nbhbxErlydiwtoxy-TeMnHVvWKpwlpubwyhzqvc 38:99\nbhbxErlydiwtoxy-AWJwc 33:84\nEVASMeLpfqwjkke-TeMnHVvWKpwlpubwyhzqvc 79:34\nEVASMeLpfqwjkke-AWJwc 243:7\nEVASMeLpfqwjkke-bhbxErlydiwtox...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Group C of the 3rd year, we decided to use the \"class flag\" used at the sports festival on November 10, 2007 at future class reunions. So, in order to decide which students to keep the \"class flag\", I decided to pl...
[{"type": "stdin_stdout", "input": "50\n5576\n6063\n5578", "output": "3C11\n3C38\n3C18\n3C01\n"}, {"type": "stdin_stdout", "input": "50\n5576\n6063\n515", "output": "3C11\n3C38\n3C18\n3C08\n"}, {"type": "stdin_stdout", "input": "50\n1864\n13193\n39", "output": "3C11\n3C31\n3C11\n3C39\n"}, {"type": "stdin_stdout", "inpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nE869120's and square1001's 16-th birthday is coming soon.\n\nTakahashi from AtCoder Kingdom gave them a round cake cut into 16 equal fan-shaped pieces.\nE869120 and square1001 were just about to eat A and B of those piece...
[{"type": "stdin_stdout", "input": "-2 -1", "output": "Yay!\n"}, {"type": "stdin_stdout", "input": "-3 -1", "output": "Yay!\n"}, {"type": "stdin_stdout", "input": "-6 -1", "output": "Yay!\n"}, {"type": "stdin_stdout", "input": "-4 -1", "output": "Yay!\n"}, {"type": "stdin_stdout", "input": "5 4\n", "output": "Yay!\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDo you remember how Kai constructed the word \"eternity\" using pieces of ice as components?\n\nLittle Sheldon plays with pieces of ice, each piece has exactly one digit between 0 and 9. He wants to construct his favourit...
[{"type": "stdin_stdout", "input": "2569\n09629965966225566262579565696595696954525955599926383255926955906666526913925296256629966292216925259225261263256229509529259756291959568892569599592218262625256926619266669279659295979299556965525222\n", "output": "44\n"}, {"type": "stdin_stdout", "input": "2559\n5255599526926...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N people standing in a queue from west to east.\nGiven is a string S of length N representing the directions of the people.\nThe i-th person from the west is facing west if the i-th character of S is L, and east...
[{"type": "stdin_stdout", "input": "95617 23923\nRRRLRRRLLRRLRRLRLRRLLLRLLLRRRRRRRLLRRRRLRRRLLRLLRLLLRLLRLRLRRRRRLRRLRRRLRRRLRRLLRLLRLLRLRLRRLRRRLRLRLRLRLLLLRRLRLRRRRLRLLLLLLRLRRRLRLRRLRLLRLLRRLRRRRRRLRRRLRLRLRRRLLLRLRLRLLLLLRRRLRLLLLRLLRRLLLLRRLRLRLRLLRLLLLLLRRLRRRRLLLRLLLRLRRRRLRRRRLLRLRRRRRLRLRRLLRLLLRLRLRRLLLRRRRRR...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFrom beginning till end, this message has been waiting to be conveyed.\n\nFor a given unordered multiset of n lowercase English letters (\"multi\" means that a letter may appear more than once), we treat all letters as st...
[{"type": "stdin_stdout", "input": "100101\n", "output": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLiLand is a country, consisting of n cities. The cities are numbered from 1 to n. The country is well known because it has a very strange transportation system. There are many one-way flights that make it possible to trav...
[{"type": "stdin_stdout", "input": "5 6\n1 2\n2 3\n3 5\n1 4\n4 5\n1 3\n", "output": "Yes\n1\n1\n2\n2\n2\n2\n"}, {"type": "stdin_stdout", "input": "4 4\n1 2\n2 3\n3 4\n1 3\n", "output": "Yes\n1\n1\n2\n2\n"}, {"type": "stdin_stdout", "input": "4 3\n1 2\n2 3\n3 4\n-1 -2\n", "output": "Yes\n2\n2\n2\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe citizens of Byteland regularly play a game. They have blocks each denoting some integer from 0 to 9. These are arranged together in a random manner without seeing to form different numbers keeping in mind that the fir...
[{"type": "stdin_stdout", "input": "3\n2240\n162\n1224", "output": "losses\nlosses\nlosses\n"}, {"type": "stdin_stdout", "input": "3\n1450\n135\n1756", "output": "losses\nlosses\nlosses\n"}, {"type": "stdin_stdout", "input": "3\n3546\n155\n1157", "output": "losses\nlosses\nlosses\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elde...
[{"type": "stdin_stdout", "input": "50 1\n.\n*\n*\n*\n.\n.\n*\n.\n*\n*\n*\n*\n*\n*\n*\n.\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n.\n.\n.\n.\n*\n*\n.\n*\n*\n.\n.\n.\n.\n*\n*\n.\n.\n.\n.\n.\n.\n", "output": "*\n*\n*\n.\n.\n*\n.\n*\n*\n*\n*\n*\n*\n*\n.\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\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\nQwerty the Ranger took up a government job and arrived on planet Mars. He should stay in the secret lab and conduct some experiments on bacteria that have funny and abnormal properties. The job isn't difficult, but the sa...
[{"type": "stdin_stdout", "input": "1000000 1000000 1000000 1000000\n", "output": "1000000\n"}, {"type": "stdin_stdout", "input": "1000000 1000000 1000000 1010000\n", "output": "1000000\n"}, {"type": "stdin_stdout", "input": "100000 100000 1000000 1000000\n", "output": "999999\n"}, {"type": "stdin_stdout", "input": "12...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter learning about polynomial hashing, Heidi decided to learn about shift-xor hashing. In particular, she came across this interesting problem.\n\nGiven a bitstring $y \\in \\{0,1\\}^n$ find out the number of different ...
[{"type": "stdin_stdout", "input": "111\n011101111010100111111000010101011110011000010101010001001011000111100101111000010110010011110100000111000100101\n", "output": "108\n"}, {"type": "stdin_stdout", "input": "111\n0011011110001001111110000101010111100110000101010100010010110001111001011111010001100000111101101001110...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Chelyabinsk lives a much respected businessman Nikita with a strange nickname \"Boss\". Once Nikita decided to go with his friend Alex to the Summer Biathlon World Cup. Nikita, as a very important person, received a to...
[{"type": "stdin_stdout", "input": "20 30\n4 13 78 11\n13 19 56 41\n15 15 46 83\n4 9 74 72\n17 20 97 7\n15 20 29 64\n8 17 44 85\n4 18 26 46\n16 17 13 90\n16 16 39 89\n13 14 46 125\n14 18 67 18\n12 20 84 48\n10 20 49 32\n10 14 14 11\n6 18 80 84\n3 20 13 97\n12 20 62 42\n7 14 64 71\n5 19 38 17\n17 18 99 18\n11 15 83 22\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \n\nGrapes of Coderpur are very famous. Devu went to the market and saw that there were N people selling grapes. He didn’t like it because things were not very st...
[{"type": "stdin_stdout", "input": "2\n2 19\n5 10\n3 10\n10 3 17", "output": "23\n10\n"}, {"type": "stdin_stdout", "input": "2\n2 19\n5 10\n3 18\n10 3 17", "output": "23\n24\n"}, {"type": "stdin_stdout", "input": "2\n2 19\n5 10\n3 18\n10 3 11", "output": "23\n30\n"}, {"type": "stdin_stdout", "input": "2\n2 19\n8 10\n3 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers $a$ and $b$. You can perform a sequence of operations: during the first operation you choose one of these numbers and increase it by $1$; during the second operation you choose one of these numb...
[{"type": "stdin_stdout", "input": "3\n1 3\n11 11\n30 20\n", "output": "3\n0\n4\n"}, {"type": "stdin_stdout", "input": "3\n0 3\n11 11\n30 20\n", "output": "2\n0\n4\n"}, {"type": "stdin_stdout", "input": "3\n1 3\n11 11\n30 20\n", "output": "3\n0\n4\n"}, {"type": "stdin_stdout", "input": "3\n1 3\n11 1\n30 20\n", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nShe is an apprentice wizard. She first learned the magic of manipulating time. And she decided to open a liquor store to earn a living. It has to do with the fact that all the inhabitants of the country where she lives lo...
[{"type": "stdin_stdout", "input": "12 3\n2 3 6\n12 4\n1 2 3 6\n0 0", "output": "6.0000000000\n0.0000000000"}, {"type": "stdin_stdout", "input": "21 3\n2 3 19\n13 4\n1 2 4 6\n0 0", "output": "10.5\n0.0\n"}, {"type": "stdin_stdout", "input": "21 3\n2 5 19\n13 4\n2 2 4 3\n0 0", "output": "10.5\n6.5\n"}, {"type": "stdin_s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn a certain video game, the player controls a hero characterized by a single integer value: power. The hero will have to beat monsters that are also characterized by a single integer value: armor.\n\nOn the current level...
[{"type": "stdin_stdout", "input": "2\n1\n1 127\n2\n3 19 13 0\n2 12 11\n", "output": "128\n18\n"}, {"type": "stdin_stdout", "input": "2\n1\n1 146\n2\n3 19 16 0\n2 21 2\n", "output": "147\n20\n"}, {"type": "stdin_stdout", "input": "2\n1\n1 204\n2\n3 19 16 0\n2 21 2\n", "output": "205\n20\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's assume that we have a pair of numbers (a, b). We can get a new pair (a + b, b) or (a, a + b) from the given pair in a single step.\n\nLet the initial pair of numbers be (1,1). Your task is to find number k, that is,...
[{"type": "stdin_stdout", "input": "1000000\n", "output": "30\n"}, {"type": "stdin_stdout", "input": "999998\n", "output": "30\n"}, {"type": "stdin_stdout", "input": "123455\n", "output": "26\n"}, {"type": "stdin_stdout", "input": "998756\n", "output": "30\n"}, {"type": "stdin_stdout", "input": "999879\n", "output": "3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there...
[{"type": "stdin_stdout", "input": "25 100\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "50 100\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "25 98\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "51 100\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "32 96\n", "output": "Y...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn the way to Dandi March, Gandhijee carried a mirror with himself. When he reached Dandi, he decided to play a game with the tired people to give them some strength. At each turn of the game he pointed out a person and t...
[{"type": "stdin_stdout", "input": "100\n1740948824551711527614232216857618927954312334113883114332134597298167586122324167251171554288490471\n1427793198650286024865090061389344606618496378829119288736948166064439831600905684206820568913977241\n159840763615420973726016575412001460717777335998188189953377771706410021457...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA flea is sitting at one of the n hassocks, arranged in a circle, at the moment. After minute number k the flea jumps through k - 1 hassoсks (clockwise). For example, after the first minute the flea jumps to the neighbori...
[{"type": "stdin_stdout", "input": "1000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "512\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "256\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "512\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1000\n", "output": "NO\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nD: Is greed the best?\n\nstory\n\nIn Japan, where there are 1, 5, 10, 50, 100, 500 yen coins, it is known that the number of coins can be minimized by using as many coins as possible when paying a certain amount. ..\n\nIf...
[{"type": "stdin_stdout", "input": "42 1010", "output": "1050\n"}, {"type": "stdin_stdout", "input": "133 178", "output": "266\n"}, {"type": "stdin_stdout", "input": "16 102", "output": "112\n"}, {"type": "stdin_stdout", "input": "24 128", "output": "144\n"}, {"type": "stdin_stdout", "input": "18 102", "output": "108\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJohnny has a younger sister Anne, who is very clever and smart. As she came home from the kindergarten, she told his brother about the task that her kindergartener asked her to solve. The task was just to construct a tria...
[{"type": "stdin_stdout", "input": "100 21 30 65\n", "output": "IMPOSSIBLE\n"}, {"type": "stdin_stdout", "input": "52 10 19 139\n", "output": "IMPOSSIBLE\n"}, {"type": "stdin_stdout", "input": "110 21 30 65\n", "output": "IMPOSSIBLE\n"}, {"type": "stdin_stdout", "input": "11 30 79 43\n", "output": "IMPOSSIBLE\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPaul is at the orchestra. The string section is arranged in an r × c rectangular grid and is filled with violinists with the exception of n violists. Paul really likes violas, so he would like to take a picture including ...
[{"type": "stdin_stdout", "input": "10 10 10 1\n8 10\n2 9\n1 10\n3 1\n8 5\n10 1\n4 10\n10 2\n5 3\n9 3\n", "output": "1787\n"}, {"type": "stdin_stdout", "input": "14 10 10 1\n8 10\n2 9\n1 10\n3 1\n8 5\n10 1\n4 10\n10 2\n5 3\n9 3\n", "output": "3411\n"}, {"type": "stdin_stdout", "input": "10 10 10 1\n1 10\n10 8\n7 4\n7 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou came to the exhibition and one exhibit has drawn your attention. It consists of $n$ stacks of blocks, where the $i$-th stack consists of $a_i$ blocks resting on the surface.\n\nThe height of the exhibit is equal to $m...
[{"type": "stdin_stdout", "input": "50 1000000000\n824428839 821375880 831521735 868908015 86990853 248293447 886713846 425716910 443947914 504402098 40124673 774093026 271211165 873482658 592754073 490097471 947930201 69692739 145291746 418475785 80274059 696889747 854947829 231642778 141525047 57563878 92067934 38750...
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\nThe stardate is 1983, and Princess Heidi is getting better at detecting the Death Stars. This time, two Rebel spies have yet again given Heidi two maps with the possible locations of the Death Star. Since she got rid of a...
[{"type": "stdin_stdout", "input": "10 5\nsomer\nandom\nnoise\nmayth\neforc\nebewi\nthyou\nhctwo\nagain\nnoise\nsomermayth\nandomeforc\nnoiseebewi\nagainthyou\nnoisehctwo\n", "output": "4 6\n"}, {"type": "stdin_stdout", "input": "10 5\nsomer\nandom\nnoise\nmayth\neforc\nebewi\nthyou\nhctwo\nagain\nooise\nsomermayth\nan...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWelcome to Rockport City!\n\nIt is time for your first ever race in the game against Ronnie. To make the race interesting, you have bet $a$ dollars and Ronnie has bet $b$ dollars. But the fans seem to be disappointed. The...
[{"type": "stdin_stdout", "input": "4\n1 11\n1 2\n4 0\n20 10\n", "output": "10 1\n1 0\n4 0\n10 0\n"}, {"type": "stdin_stdout", "input": "4\n1 11\n1 2\n4 0\n22 10\n", "output": "10 1\n1 0\n4 0\n12 2\n"}, {"type": "stdin_stdout", "input": "4\n1 11\n1 2\n2 0\n22 10\n", "output": "10 1\n1 0\n2 0\n12 2\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWelcome to PC Koshien, players. This year marks the 10th anniversary of Computer Koshien, but the number of questions and the total score will vary from year to year. Scores are set for each question according to the diff...
[{"type": "stdin_stdout", "input": "1\n2\n-1\n-9\n-1\n2\n-1\n-32\n-1\n1", "output": "-39\n"}, {"type": "stdin_stdout", "input": "1\n2\n0\n-38\n-1\n1\n-1\n-17\n0\n1", "output": "-52\n"}, {"type": "stdin_stdout", "input": "1\n2\n0\n-38\n-1\n1\n-1\n-32\n0\n1", "output": "-67\n"}, {"type": "stdin_stdout", "input": "1\n2\n-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGildong has bought a famous painting software cfpaint. The working screen of cfpaint is square-shaped consisting of $n$ rows and $n$ columns of square cells. The rows are numbered from $1$ to $n$, from top to bottom, and ...
[{"type": "stdin_stdout", "input": "9 9\nBWBBWWWXW\nBWAWWWWWW\nWBWBBBBBB\nWWBBBWWWB\nWWBWBXBWW\nWBWWBBWWB\nWWWBWBWBW\nBBWBBBWWW\nWBWBBWWWW\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "9 9\nBWBBWWWXW\nBWAWWWWWW\nWBWBBBBBB\nWWBBBWWWB\nWWBWBXBWW\nWBWWBBWWB\nWWWBWBWBW\nWWWBBBWBB\nWBWBBWWWW\n", "output": "18\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a positive integer N.\nFind the minimum positive integer divisible by both 2 and N.\n\n-----Constraints-----\n - 1 \\leq N \\leq 10^9\n - All values in input are integers.\n\n-----Input-----\nInput is given ...
[{"type": "stdin_stdout", "input": "15607691432", "output": "15607691432\n"}, {"type": "stdin_stdout", "input": "1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "8325199727", "output": "16650399454\n"}, {"type": "stdin_stdout", "input": "999999999\n", "output": "1999999998\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $s$. You can build new string $p$ from $s$ using the following operation no more than two times: choose any subsequence $s_{i_1}, s_{i_2}, \\dots, s_{i_k}$ where $1 \\le i_1 < i_2 < \\dots < i_k \...
[{"type": "stdin_stdout", "input": "1\nbbbaaaaabbabaabbbbaabbbbabbaabbaababbbbbbababbababbbaaaaaaabaababbbaababbbbababbbabbbbbabaabbaaaabaa\nbbbababbaabbbbbaabaaabaababaaaabaabbbabbababaaabba\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1\nbbbaaaaabbabaabbbbaabbbbabbaabbaababbbbbbababbababbbaaaaaaabaababb...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVadim is really keen on travelling. Recently he heard about kayaking activity near his town and became very excited about it, so he joined a party of kayakers.\n\nNow the party is ready to start its journey, but firstly t...
[{"type": "stdin_stdout", "input": "50\n297 787 34 268 439 629 600 398 425 833 721 908 830 636 64 509 420 647 499 675 427 599 396 119 798 742 577 355 22 847 389 574 766 453 196 772 225 261 106 844 726 975 173 992 874 89 775 616 678 52 69 591 181 573 258 381 665 301 589 379 362 146 790 842 765 100 229 916 938 97 340 793...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z writte...
[{"type": "stdin_stdout", "input": "1 1 1\n1010000000", "output": "1009999999\n"}, {"type": "stdin_stdout", "input": "1 1 1\n1010100000", "output": "1010099999\n"}, {"type": "stdin_stdout", "input": "3 100 100\n10 1001 000", "output": "1001\n"}, {"type": "stdin_stdout", "input": "3 100 1001\n10 100 100", "output": "901...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSkyscraper \"MinatoHarukas\"\n\nMr. Port plans to start a new business renting one or more floors of the new skyscraper with one giga floors, MinatoHarukas. He wants to rent as many vertically adjacent floors as possible,...
[{"type": "stdin_stdout", "input": "15\n27\n3\n5\n14453855\n142729211\n251672118\n560550970\n979553853\n999999999\n0", "output": "1 5\n2 6\n1 2\n2 2\n111119 130\n801761 178\n11923 13484\n4003866 140\n7523 37374\n163837 5994\n"}, {"type": "stdin_stdout", "input": "15\n16\n3\n3\n9699690\n237086004\n847288609\n900660121\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBimokh is Mashmokh's boss. For the following n days he decided to pay to his workers in a new way. At the beginning of each day he will give each worker a certain amount of tokens. Then at the end of each day each worker ...
[{"type": "stdin_stdout", "input": "10 1 100000000\n999999999 1634812359 999999999 999999999 129546129 999999999 999999999 999999999 1815265208 999999999\n", "output": "99999999 34812359 99999999 99999999 29546129 99999999 99999999 99999999 15265208 99999999\n"}, {"type": "stdin_stdout", "input": "10 1 100000000\n99999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA map of some object is a rectangular field consisting of n rows and n columns. Each cell is initially occupied by the sea but you can cover some some cells of the map with sand so that exactly k islands appear on the map...
[{"type": "stdin_stdout", "input": "100 5000\n", "output": "YES\nLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLS\nSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSL\nLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSL...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nStellar history 2005.11.5. You are about to engage an enemy spacecraft as the captain of the UAZ Advance spacecraft. Fortunately, the enemy spaceship is still unnoticed. In addition, the space coordinates of the enemy are...
[{"type": "stdin_stdout", "input": "-10 6 6\n20 2 5\n1 10 0\n-1 10 10\n0 0 10", "output": "MISS\n"}, {"type": "stdin_stdout", "input": "-10 6 6\n20 2 5\n0 10 0\n-1 10 10\n0 0 10", "output": "MISS\n"}, {"type": "stdin_stdout", "input": "-10 6 6\n20 2 5\n0 10 0\n-1 10 14\n0 0 10", "output": "MISS\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nArcady is a copywriter. His today's task is to type up an already well-designed story using his favorite text editor.\n\nArcady types words, punctuation signs and spaces one after another. Each letter and each sign (inclu...
[{"type": "stdin_stdout", "input": "thun-thun-thunder, thunder, thunder\nthunder, thun-, thunder\nthun-thun-thunder, thunder\nthunder, feel the thunder\nlightning then the thunder\nthunder, feel the thunder\nlightning then the thunder\nthunder, thunder\n", "output": "183\n"}, {"type": "stdin_stdout", "input": "thun-thu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHaiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.\nIroha is looking for X,Y,Z-Haiku (defined below) in integer sequences.\nConsider all integer sequences...
[{"type": "stdin_stdout", "input": "37 4 2 3\n", "output": "863912418\n"}, {"type": "stdin_stdout", "input": "40 5 7 5\n", "output": "562805100\n"}, {"type": "stdin_stdout", "input": "15 10 2 3", "output": "138603924\n"}, {"type": "stdin_stdout", "input": "37 4 3 3", "output": "180978943\n"}, {"type": "stdin_stdout", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have held a popularity poll for N items on sale. Item i received A_i votes.\nFrom these N items, we will select M as popular items. However, we cannot select an item with less than \\dfrac{1}{4M} of the total number of...
[{"type": "stdin_stdout", "input": "100 100\n1000 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 93...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N integers a_1, a_2, ..., a_N not less than 1. The values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \\times a_2 \\times ... \\times a_N = P.\n\nFind the maximum possible greatest common divis...
[{"type": "stdin_stdout", "input": "1 1431379180228", "output": "1431379180228\n"}, {"type": "stdin_stdout", "input": "1 1472895801034", "output": "1472895801034\n"}, {"type": "stdin_stdout", "input": "1 1365467213485", "output": "1365467213485\n"}, {"type": "stdin_stdout", "input": "1 2203800626104", "output": "220380...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nArthur and Alexander are number busters. Today they've got a competition. \n\nArthur took a group of four integers a, b, w, x (0 ≤ b < w, 0 < x < w) and Alexander took integer с. Arthur and Alexander use distinct approach...
[{"type": "stdin_stdout", "input": "200000000 794 1000 117 2000000000\n", "output": "2038505096\n"}, {"type": "stdin_stdout", "input": "200000000 794 1000 117 2000000000\n", "output": "2038505096\n"}, {"type": "stdin_stdout", "input": "20000000 280 1000 25 2000000000\n", "output": "2030769231\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDuff is in love with lovely numbers! A positive integer x is called lovely if and only if there is no such positive integer a > 1 such that a^2 is a divisor of x. [Image] \n\nMalek has a number store! In his store, he has...
[{"type": "stdin_stdout", "input": "817634153013\n", "output": "817634153013\n"}, {"type": "stdin_stdout", "input": "734337660466\n", "output": "734337660466\n"}, {"type": "stdin_stdout", "input": "808453785117\n", "output": "808453785117\n"}, {"type": "stdin_stdout", "input": "294809951965\n", "output": "294809951965\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ of length $n$, which initially is a permutation of numbers from $1$ to $n$. In one operation, you can choose an index $i$ ($1 \\leq i < n$) such that $a_i < a_{i + 1}$, and remove either $a_i$ o...
[{"type": "stdin_stdout", "input": "4\n3\n1 2 3\n4\n3 1 2 4\n3\n2 3 1\n6\n2 4 12 1 3 10\n", "output": "YES\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "4\n3\n1 2 3\n4\n3 1 2 4\n3\n2 3 1\n6\n2 4 19 1 3 10\n", "output": "YES\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "4\n3\n1 2 3\n4\n3 1 2 4\n3\n2 3 1\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. H...
[{"type": "stdin_stdout", "input": "25\n1 1 1 2 2 2 1 2 1 2 2 2 2 2 1 2 2 2 1 2 2 2 2 1 2\n", "output": "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 "}, {"type": "stdin_stdout", "input": "4\n1011110011 158379 10597860 181988389\n", "output": "1 158379 10597860 181988389\n"}, {"type": "stdin_stdout", "input": "4\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is the word heuristics. It's a relatively simple approach that usually works, although there is no guarantee that it will work. The world is full of heuristics because it is simple and powerful.\n\nSome examples of ...
[{"type": "stdin_stdout", "input": "4 1 3 4\nyskwcnt 16\nakzakr 7\ntsnukk 12\nfnmyi 13\nakzakr\n4 1 3 8\nakzakr 7\ntsnukk 4\nfnmyi 13\nyskwcnt 16\nakzakr\n4 2 2 1\nakzakr 4\ntsnukk 6\nyskwcnt 12\nfnmyi 12\nakzakr\nfnmyi\n5 2 3 28\nknmmdk 6\nskrkyk 14\ntmemm 14\nakmhmr 15\nmksyk 25\nknmmdk\nskrkyk\n5 2 3 11\ntmemm 12\ns...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nI am a pipe tie craftsman. As long as you get the joints and pipes that connect the pipes, you can connect any pipe. Every day, my master gives me pipes and joints, which I connect and give to my master. But if you have t...
[{"type": "stdin_stdout", "input": "3\n0 1 1\n3 3\n4\n4 1 2 3\n1 1 1\n5\n1 1 3 4 5\n3 12 2 2\n0", "output": "10\n40\n104\n"}, {"type": "stdin_stdout", "input": "3\n0 1 1\n3 3\n4\n3 1 5 3\n1 1 1\n5\n2 4 6 4 5\n0 3 2 1\n0", "output": "10\n48\n105\n"}, {"type": "stdin_stdout", "input": "3\n0 1 1\n3 3\n4\n3 1 5 3\n1 1 1\n5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Smart Beaver from ABBYY came up with another splendid problem for the ABBYY Cup participants! This time the Beaver invites the contest participants to check out a problem on sorting documents by their subjects. Let's ...
[{"type": "stdin_stdout", "input": "21000\nSWISS OT LAHNCU NEW SERIES OF MONEY MARKET PEPAR\nZURICH, April 9 - The Svirs Federal tndmnrevoG lliw launch\na ndw series fo three mhnto mondx market setatificrec totallhng\nauornd 150 mln iwSss fraocs, dht National Bank said.\nSubscriptions close lirpA 14 and paynent date hs...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe New Year is coming! That's why many people today are busy preparing New Year presents. Vasily the Programmer is no exception.\n\nVasily knows that the best present is (no, it's not a contest) money. He's put n empty w...
[{"type": "stdin_stdout", "input": "10\n2 1 8 0 0 1 0 4 4 3\n", "output": "PRLPRLRPRLRPRLPRLPRLPRLPRLPRLPRLPRLRRRPRLRRPRLPRLPRLPRLRPRLPRLPRLPRLRPLRPLRPLR"}, {"type": "stdin_stdout", "input": "10\n2 0 8 0 0 1 0 4 4 3\n", "output": "PRLPRLRRPRLPRLPRLPRLPRLPRLPRLPRLRRRPRLRRPRLPRLPRLPRLRPRLPRLPRLPRLRPLRPLRPLR"}, {"type": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe main server of Gomble company received a log of one top-secret process, the name of which can't be revealed. The log was written in the following format: «[date:time]: message», where for each «[date:time]» value exis...
[{"type": "stdin_stdout", "input": "14\n[12:07 p.m.]: mamaa\n[12:36 a.m.]: amaamppa\n[01:31 a.m.]: pmpp\n[05:47 a.m.]: paapappapaaampm\n[12:07 a.m.]: ppamammm\n[01:03 a.m.]: aapapmpampamamaaa\n[07:55 a.m.]: mpappmmapmpa\n[02:49 a.m.]: papmppppmpamppa\n[03:12 a.m.]: aaaaaaamam\n[04:40 a.m.]: paap\n[01:13 a.m.]: ap\n[03:...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA median in an array with the length of n is an element which occupies position number <image> after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array...
[{"type": "stdin_stdout", "input": "100 813\n285 143 378 188 972 950 222 557 170 755 470 164 1433 553 146 820 842 62 496 1893 746 944 677 828 465 577 791 277 303 218 561 653 925 692 871 424 626 795 813 343 418 280 123 364 496 447 435 452 645 36 311 315 830 289 450 675 23 212 421 661 7 217 468 877 172 141 475 409 178 71...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe kingdom of Lazyland is the home to $n$ idlers. These idlers are incredibly lazy and create many problems to their ruler, the mighty King of Lazyland. \n\nToday $k$ important jobs for the kingdom ($k \\le n$) should be...
[{"type": "stdin_stdout", "input": "18 12\n6 3 6 6 6 6 6 6 6 12 1 3 6 6 10 6 6 6\n47 4 41 56 75 24 29 10 100 112 53 48 79 30 87 135 60 87\n", "output": "185\n"}, {"type": "stdin_stdout", "input": "18 12\n6 3 6 6 6 6 6 6 6 12 1 3 6 6 10 6 6 6\n47 4 41 56 75 24 29 10 100 112 53 48 79 30 87 135 10 87\n", "output": "148\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke signed up for a new website which holds programming competitions.\nHe worried that he might forget his password, and he took notes of it.\nSince directly recording his password would cause him trouble if stolen,\nhe...
[{"type": "stdin_stdout", "input": "atcoderbeginnercontest\natcoderregularcontest\n", "output": "aattccooddeerrbreeggiunlnaerrccoonntteesstt\n"}, {"type": "stdin_stdout", "input": "atcoderbeeinnercontgst\natcoderregularcontest", "output": "aattccooddeerrbreeegiunlnaerrccoonnttegsstt\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a tree with N vertices numbered 1 to N, and N-1 edges numbered 1 to N-1.\nEdge i connects Vertex a_i and b_i bidirectionally and has a length of 1.\nSnuke will paint each vertex white or black.\nThe niceness of a...
[{"type": "stdin_stdout", "input": "10104\n5741 6080\n3408 7811\n5930 5446\n2841 6030\n7143 6678\n5930 3686\n3091 5609\n9185 6802\n8673 6440\n593 5930\n4271 5808\n3292 3568\n2712 5673\n10008 5082\n421 4874\n5930 7228\n5005 6587\n2254 9793\n8397 7976\n8682 4699\n8396 5930\n7253 1069\n1980 6577\n8066 4032\n2303 3724\n370...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTraining is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well.\n\nToday's training is to gain dexterity that never mistypes by carefully stacking blocks...
[{"type": "stdin_stdout", "input": "3\n10 40\n15 40\n20 30", "output": "110\n"}, {"type": "stdin_stdout", "input": "3\n10 40\n15 40\n40 30", "output": "120\n"}, {"type": "stdin_stdout", "input": "3\n10 40\n15 40\n20 32", "output": "112\n"}, {"type": "stdin_stdout", "input": "3\n10 36\n15 40\n20 32", "output": "108\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n\"What are your shoe sizes?\"\n\nSuddenly, the doctor asked me when I met him for the first time.\n\n\"It's 23.5\"\n\"Oh, that's a really nice number. It's 2 to the 4th power plus 2 to the 2nd power, 2 to the 1st power, 2...
[{"type": "stdin_stdout", "input": "27.100228165013633\n158.95452966627283\n-0.21569613349567962", "output": "NA\nNA\n"}, {"type": "stdin_stdout", "input": "27.432484603703674\n158.95452966627283\n-0.21569613349567962", "output": "NA\nNA\n"}, {"type": "stdin_stdout", "input": "27.932276079901406\n158.95452966627283\n-0...
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\nПоликарп мечтает стать программистом и фанатеет от степеней двойки. Среди двух чисел ему больше нравится то, которое делится на большую степень числа 2. \n\nПо заданной последовательности целых положительных чисел a_1, a_...
[{"type": "stdin_stdout", "input": "100\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\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": "7816\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\nPetya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\n\...
[{"type": "stdin_stdout", "input": "544958\n", "output": "4477777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDr. A of the Aizu Institute of Biological Research discovered a mysterious insect on a certain southern island. The shape is elongated like a hornworm, but since one segment is shaped like a ball, it looks like a beaded b...
[{"type": "stdin_stdout", "input": "rbgrg\nbbbrbgr\nrbg\nrgbbrgrb\nrrgbgrggb\nggrgbrbggr\nrrrrr\nbgbr\n0", "output": "5\n7\n1\n6\nNA\n11\n0\n4\n"}, {"type": "stdin_stdout", "input": "grgbr\nrbbgbbr\nbgr\nbgbrrgbr\nbggrgbgrr\ngggbrggrbr\nrrrrr\nbgbr\n0", "output": "5\n7\n1\n9\nNA\n11\n0\n4\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian as well. \n\nAfter IOI Ilya decided to make a business. He found a social network called \"TheScorpyBook.com\". It currently has N registered users. As in any soci...
[{"type": "stdin_stdout", "input": "4\n1111\n1000\n1000\n1000", "output": "6\n"}, {"type": "stdin_stdout", "input": "4\n0111\n1100\n0000\n1001", "output": "2\n"}, {"type": "stdin_stdout", "input": "4\n1111\n1010\n1000\n1010", "output": "4\n"}, {"type": "stdin_stdout", "input": "4\n0011\n0000\n0000\n1001", "output": "0\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetr stands in line of n people, but he doesn't know exactly which position he occupies. He can say that there are no less than a people standing in front of him and no more than b people standing behind him. Find the num...
[{"type": "stdin_stdout", "input": "100 81 58\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "100 81 54\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "100 81 91\n", "output": "19"}, {"type": "stdin_stdout", "input": "100 11 88\n", "output": "89"}, {"type": "stdin_stdout", "input": "59 12 33\n", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a sequence of N \\times K integers: X=(X_0,X_1,\\cdots,X_{N \\times K-1}). Its elements are represented by another sequence of N integers: A=(A_0,A_1,\\cdots,A_{N-1}). For each pair i, j (0 \\leq i \\leq K-1,\\ 0 ...
[{"type": "stdin_stdout", "input": "11 97\n0 1 8 2 5 4 2 6 2 3 5", "output": "0 1 8 6 2 3 5\n"}, {"type": "stdin_stdout", "input": "11 47\n0 1 0 3 10 5 1 36 2 2 0", "output": "10 5 1 36 0\n"}, {"type": "stdin_stdout", "input": "11 101\n0 2 4 1 5 4 4 6 0 3 5", "output": "2 4 6 0 3 5\n"}, {"type": "stdin_stdout", "input"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The consumption coefficient of Membe...
[{"type": "stdin_stdout", "input": "11 14\n3 1 4 1 0 9 0 20 1 2 10\n15 6 7 26 3 2 3 8 4 8 2", "output": "20\n"}, {"type": "stdin_stdout", "input": "11 14\n3 1 4 1 0 9 0 20 1 2 10\n15 6 7 26 3 4 3 8 4 8 2", "output": "22\n"}, {"type": "stdin_stdout", "input": "11 14\n3 1 4 1 2 9 2 11 1 3 10\n15 9 7 26 3 2 3 8 4 8 2", "o...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers $n$ and $m$ ($m < n$). Consider a convex regular polygon of $n$ vertices. Recall that a regular polygon is a polygon that is equiangular (all angles are equal in measure) and equilateral (all si...
[{"type": "stdin_stdout", "input": "2\n69 120\n11 9\n", "output": "NO\nNO\n"}, {"type": "stdin_stdout", "input": "2\n34 230\n4 15\n", "output": "NO\nNO\n"}, {"type": "stdin_stdout", "input": "2\n34 230\n4 27\n", "output": "NO\nNO\n"}, {"type": "stdin_stdout", "input": "2\n11 101\n13 4\n", "output": "NO\nNO\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nArkady decided to buy roses for his girlfriend.\n\nA flower shop has white, orange and red roses, and the total amount of them is n. Arkady thinks that red roses are not good together with white roses, so he won't buy a b...
[{"type": "stdin_stdout", "input": "30 15\n7926 577 5009 7237 4395 3239 8994 4429 8126 2925 139 320 4442 3397 1292 2800 9505 6043 5946 8058 4031 6871 4689 1977 73 440 5320 5290 4707 387\nOOWOWWORRWOWORWRRRRWORROOWWROW\n", "output": "91633\n"}, {"type": "stdin_stdout", "input": "30 15\n7926 577 5009 7237 4395 3239 8994 ...
code_stdio