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\nYou are given N real values A_1, A_2, \\ldots, A_N. Compute the number of pairs of indices (i, j) such that i < j and the product A_i \\cdot A_j is integer.\n\nConstraints\n\n* 2 \\leq N \\leq 200\\,000\n* 0 < A_i < 10^4\... | [{"type": "stdin_stdout", "input": "11\n0.9\n1\n1\n1.25\n2.7527267588296525\n5\n70\n0.000000001\n9999.999999999\n0.999999999\n1.7676771981771382", "output": "7\n"}, {"type": "stdin_stdout", "input": "11\n0.9\n1\n1\n1.25\n2.30000\n5\n70\n0.000000001\n9999.999999999\n0.999999999\n1.7676771981771382", "output": "8\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCounting sort can be used for sorting elements in an array which each of the n input elements is an integer in the range 0 to k. The idea of counting sort is to determine, for each input element x, the number of elements ... | [{"type": "stdin_stdout", "input": "7\n4 11 2 3 4 3 1", "output": "1 2 3 3 4 4 11\n"}, {"type": "stdin_stdout", "input": "7\n8 9 2 0 12 3 3", "output": "0 2 3 3 8 9 12\n"}, {"type": "stdin_stdout", "input": "7\n10 9 3 0 6 3 3", "output": "0 3 3 3 6 9 10\n"}, {"type": "stdin_stdout", "input": "7\n6 5 3 0 12 3 3", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInternational Women's Day is coming soon! Polycarp is preparing for the holiday.\n\nThere are $n$ candy boxes in the shop for sale. The $i$-th box contains $d_i$ candies.\n\nPolycarp wants to prepare the maximum number of... | [{"type": "stdin_stdout", "input": "8 2\n1 2 2 3 2 4 6 10\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "8 2\n2 2 2 2 2 4 6 10\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "8 2\n1 2 2 2 2 4 6 10\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "8 2\n2 2 2 2 2 4 7 10\n", "output": "6\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nGiven the strings $ s $, $ t $.\nFirst, let the string set $ A = $ {$ s $}, $ B = \\ phi $.\nAt this time, I want to perform the following operations as much as possible.\n\noperation\n\nstep1\n\nPerform the fo... | [{"type": "stdin_stdout", "input": "abaabbabaab`abbabbabaabbab\nab", "output": "2\n"}, {"type": "stdin_stdout", "input": "abaabbbbaab`abbabbabaabaab\nab", "output": "2\n"}, {"type": "stdin_stdout", "input": "abaabbbbaab`abbabbabaabaab\n`b", "output": "1\n"}, {"type": "stdin_stdout", "input": "abaabbbbaaa`abbabbabbabaab... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've gotten an n × m sheet of squared paper. Some of its squares are painted. Let's mark the set of all painted squares as A. Set A is connected. Your task is to find the minimum number of squares that we can delete fro... | [{"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\nThere are $n$ persons who initially don't know each other. On each morning, two of them, who were not friends before, become friends.\n\nWe want to plan a trip for every evening of $m$ days. On each trip, you have to sele... | [{"type": "stdin_stdout", "input": "16 20 2\n10 4\n5 3\n10 5\n12 7\n7 6\n9 12\n9 6\n1 10\n11 16\n11 1\n16 3\n10 2\n14 4\n15 14\n4 13\n13 15\n1 8\n7 15\n1 7\n8 15\n", "output": "0\n0\n0\n0\n0\n0\n4\n4\n4\n4\n10\n10\n10\n10\n10\n14\n14\n14\n14\n15\n"}, {"type": "stdin_stdout", "input": "16 20 2\n10 4\n5 3\n10 5\n12 7\n7 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhen Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to ne... | [{"type": "stdin_stdout", "input": "100 100\n75 92 18 7 81 67 7 92 100 65 57 32 50 131 85 31 80 91 84 63 39 52 92 81 1 98 24 12 84 48 17 86 51 72 48 95 81 50 12 66 19 79 49 89 34 1 193 75 20 33 96 27 42 23 133 71 93 1 85 19 66 14 13 13 20 39 36 33 42 61 56 64 23 91 37 99 40 74 13 18 98 85 74 39 62 84 46 74 50 23 38 11 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOm Nom is the main character of a game \"Cut the Rope\". He is a bright little monster who likes visiting friends living at the other side of the park. However the dark old parks can scare even somebody as fearless as Om ... | [{"type": "stdin_stdout", "input": "6\n87 62 58 32 81 92 12 50 23 27 38 39 64 74 16 35 84 59 91 87 14 48 90 47 44 95 64 45 31 11 67 5 80 60 36 15 91 3 21 2 40 24 37 69 5 50 23 37 49 19 68 21 49 9 100 94 45 41 22 31 31 48 25 70 25 25 95 88 82 1 37 53 49 31 57 74 94 45 55 93 43 37 13 85 59 72 15 68 3 90 96 55 100 64 63 6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVlad enjoys listening to music. He lives in Sam's Town. A few days ago he had a birthday, so his parents gave him a gift: MP3-player! Vlad was the happiest man in the world! Now he can listen his favorite songs whenever h... | [{"type": "stdin_stdout", "input": "3\n4\n-1 16 14 1\n2\n5\n1 4 0 17 8\n3\n5\n-1 1 -1 18 4 \n0", "output": "4\n1\n4\n"}, {"type": "stdin_stdout", "input": "3\n4\n0 4 5 2\n-1\n5\n1 1 5 11 4\n-1\n5\n1 2 3 9 -1 \n2", "output": "4\n5\n3\n"}, {"type": "stdin_stdout", "input": "3\n4\n1 3 4 2\n2\n5\n1 2 3 9 4\n5\n5\n1 2 3 9 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between.\nPrint the acronym formed from the uppercased initial letters of the words.\n\n-----Constraints-----\n - s_1,... | [{"type": "stdin_stdout", "input": "atcoder beginner contest\n", "output": "ABC\n"}, {"type": "stdin_stdout", "input": "resident register number\n", "output": "RRN\n"}, {"type": "stdin_stdout", "input": "resident retsiger number", "output": "RRN\n"}, {"type": "stdin_stdout", "input": "atcoder beginner contdst", "output... | 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": "24000\nN.Y. BANK DISCOUNT BORROWINGS 169 MLN DLRS\nNEW YORK, April 9 - The eight major New York City banks had\ndaily average borrowings of 169 mln dlrs from the Federal\nReserve in the week ended April 8, a Fed spokesman said.\nA Fed spokesman said that all of the borrowings were ma... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHow to make a cake you'll never eat.\n\nIngredients. \n\n * 2 carrots\n * 0 calories\n * 100 g chocolate spread\n * 1 pack of flour\n * 1 egg\n\n\n\nMethod. \n\n 1. Put calories into the mixing bowl.\n 2. Take carr... | [{"type": "stdin_stdout", "input": "100 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 1010 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\nSereja showed an interesting game to his friends. The game goes like that. Initially, there is a table with an empty cup and n water mugs on it. Then all players take turns to move. During a move, a player takes a non-emp... | [{"type": "stdin_stdout", "input": "100 1000\n10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBeing stuck at home, Ray became extremely bored. To pass time, he asks Lord Omkar to use his time bending power: Infinity Clock! However, Lord Omkar will only listen to mortals who can solve the following problem:\n\nYou ... | [{"type": "stdin_stdout", "input": "5\n20 809014\n289 -254 1 -109 -167 93 23 -37 -31 -109 204 59 296 49 132 0 -28 35 -197 -266\n20 458494\n113 218 -292 -298 179 258 -257 -20 296 76 -145 93 -282 -261 -159 -45 255 -107 171 63\n14 876161\n69 74 12 2 177 -113 103 93 38 -48 282 169 205 145\n26 731742\n76 190 -227 -81 -293 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a chessboard of size $n \\times n$. It is filled with numbers from $1$ to $n^2$ in the following way: the first $\\lceil \\frac{n^2}{2} \\rceil$ numbers from $1$ to $\\lceil \\frac{n^2}{2} \\rceil$ are writt... | [{"type": "stdin_stdout", "input": "4 5\n2 1\n1 4\n5 3\n3 2\n2 4\n", "output": "11\n10\n10\n13\n4\n"}, {"type": "stdin_stdout", "input": "4 5\n2 1\n1 4\n5 3\n6 2\n2 4\n", "output": "11\n10\n10\n11\n4\n"}, {"type": "stdin_stdout", "input": "8 5\n2 1\n4 4\n4 3\n3 2\n2 4\n", "output": "37\n14\n46\n41\n6\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is an integer sequence of length 2^N: A_0, A_1, ..., A_{2^N-1}. (Note that the sequence is 0-indexed.)\nFor every integer K satisfying 1 \\leq K \\leq 2^N-1, solve the following problem:\n - Let i and j be integers.... | [{"type": "stdin_stdout", "input": "4\n75 26 45 72 81 47 97 97 2 2 25 82 84 17 56 32\n", "output": "101\n120\n147\n156\n156\n178\n194\n194\n194\n194\n194\n194\n194\n194\n194\n"}, {"type": "stdin_stdout", "input": "4\n75 26 45 112 81 47 97 97 2 2 25 95 84 17 56 32", "output": "101\n120\n187\n187\n187\n187\n209\n209\n209... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem. In the output section below you will see the information about flushing the output.\n\nBear Limak thinks of some hidden number — an integer from interval [2, 100]. Your task is to say if th... | [{"type": "stdin_stdout", "input": "no\nyes\nno\nnn\nno\n", "output": "2\n3\n5\n7\n11\n13\n17\n19\n23\n29\n31\n37\n41\n43\n47\n4\n9\n25\n49\nprime\n"}, {"type": "stdin_stdout", "input": "no\nyes\nno\nno\nno\n", "output": "2\n3\n5\n7\n11\n13\n17\n19\n23\n29\n31\n37\n41\n43\n47\n4\n9\n25\n49\nprime\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given $n$ segments on a coordinate axis $OX$. The $i$-th segment has borders $[l_i; r_i]$. All points $x$, for which $l_i \\le x \\le r_i$ holds, belong to the $i$-th segment.\n\nYour task is to choose the maximum... | [{"type": "stdin_stdout", "input": "4\n4\n1 5\n2 4\n2 3\n3 4\n5\n1 5\n2 3\n2 5\n3 5\n2 2\n3\n1 3\n2 4\n2 3\n7\n1 10\n2 8\n2 5\n3 4\n4 4\n6 8\n7 7\n", "output": "3\n4\n2\n7\n"}, {"type": "stdin_stdout", "input": "4\n4\n1 5\n2 4\n2 3\n3 4\n5\n1 5\n2 3\n2 5\n3 5\n2 2\n3\n1 3\n2 4\n2 3\n7\n1 10\n2 8\n0 5\n3 4\n4 4\n6 8\n7 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a string $s$ of length $3$, consisting of uppercase and lowercase English letters. Check if it is equal to \"YES\" (without quotes), where each letter can be in any case. For example, \"yES\", \"Yes\", \"yes\" ar... | [{"type": "stdin_stdout", "input": "10\nYES\nyES\nyes\nYes\nYeS\nNoo\norZ\nyEz\nYas\nXES\n", "output": "YES\nYES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\n"}, {"type": "stdin_stdout", "input": "2\nyes\nlll\n", "output": "YES\nNO\n"}, {"type": "stdin_stdout", "input": "1\nvop\n", "output": "NO\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have $n$ chains, the $i$-th chain consists of $c_i$ vertices. Vertices in each chain are numbered independently from $1$ to $c_i$ along the chain. In other words, the $i$-th chain is the undirected graph with $c_i$ ve... | [{"type": "stdin_stdout", "input": "3\n4\n3 4 3 6\n-1 1 2 2\n-2 2 2 3\n2\n5 10\n-2 5\n-1 1\n3\n10 5 2\n-1 1 2\n-1 10 5\n", "output": "10\n15\n15\n"}, {"type": "stdin_stdout", "input": "3\n4\n3 4 3 6\n-1 1 2 2\n-1 2 2 3\n2\n5 10\n-1 5\n-1 1\n3\n6 5 2\n-1 1 2\n-1 5 5\n", "output": "10\n15\n10\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce upon a time in the Kingdom of Far Far Away lived Sir Lancelot, the chief Royal General. He was very proud of his men and he liked to invite the King to come and watch drill exercises which demonstrated the fighting t... | [{"type": "stdin_stdout", "input": "1000 1000\n", "output": "500000\n"}, {"type": "stdin_stdout", "input": "997 1000\n", "output": "498500\n"}, {"type": "stdin_stdout", "input": "999 1000\n", "output": "499500\n"}, {"type": "stdin_stdout", "input": "1000 999\n", "output": "499500\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPaw the Spider is making a web. Web-making is a real art, Paw has been learning to do it his whole life. Let's consider the structure of the web.\n\n<image>\n\nThere are n main threads going from the center of the web. Al... | [{"type": "stdin_stdout", "input": "20\n5 15 40 35 68 22\n6 70 19 28 69 63 1\n4 37 154 41 90\n7 11 148 35 94 55 59 64\n7 46 28 22 90 97 37 13\n5 62 45 34 50 94\n6 85 83 37 72 27 53\n6 46 56 116 71 49 33\n7 17 35 91 24 50 30 38\n2 75 12\n2 46 38\n1 61\n11 15 79 14 89 20 96 84 26 93 132 18\n1 75\n6 4 100 55 59 62 83\n5 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe polar bears are going fishing. They plan to sail from (s_{x}, s_{y}) to (e_{x}, e_{y}). However, the boat can only sail by wind. At each second, the wind blows in one of these directions: east, south, west or north. A... | [{"type": "stdin_stdout", "input": "39 -1000000000 -1000000000 -999999997 -1000000000\nENEENWSWSSWESNSSEESNSESWSWNSWESNENWNWEE\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "39 -1000000000 -1000000000 -999999997 -1000000000\nENEENWSWSSWESNSSEESNSESWSWNSWESNENWNWEE\n", "output": "4\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe time is 2020. There is data that saves the qualifying results of PC Koshien 2020. This data stores the reference number and the number of correct answers assigned to each team. Here, the ranking is determined by the n... | [{"type": "stdin_stdout", "input": "1,20\n2,20\n3,30\n4,10\n5,10\n6,20\n0,0\n1\n2\n4\n1", "output": "2\n2\n3\n2\n"}, {"type": "stdin_stdout", "input": "1,20\n2,20\n3,30\n4,10\n5,10\n0,26\n0,0\n1\n2\n4\n1", "output": "3\n3\n4\n3\n"}, {"type": "stdin_stdout", "input": "1,20\n2,20\n3,30\n4,10\n5,10\n0,26\n0,0\n0\n2\n4\n1"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.\n\nThe country where Sonya lives is an endless line. There is a city in each integer co... | [{"type": "stdin_stdout", "input": "100 10\n-489 -476 -445 -432 -430 -421 -420 -418 -412 -411 -404 -383 -356 -300 -295 -293 -287 -276 -265 -263 -258 -251 -249 -246 -220 -219 -205 -186 -166 -157 -143 -137 -136 -130 -103 -86 -80 -69 -67 -55 -43 -41 -40 -26 -19 -9 16 29 41 42 54 76 84 97 98 99 101 115 134 151 157 167 169 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet S be the concatenation of 10^{10} copies of the string 110. (For reference, the concatenation of 3 copies of 110 is 110110110.)\nWe have a string T of length N.\nFind the number of times T occurs in S as a contiguous ... | [{"type": "stdin_stdout", "input": "62089\n1101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\"Fukusekiken\" is a popular ramen shop where you can line up. But recently, I've heard some customers say, \"I can't afford to have vacant seats when I enter the store, even though I have a long waiting time.\" I'd like ... | [{"type": "stdin_stdout", "input": "5\n41\n27\n26", "output": "0\n28\n18\n23\n"}, {"type": "stdin_stdout", "input": "5\n24\n18\n13", "output": "0\n11\n15\n2\n"}, {"type": "stdin_stdout", "input": "5\n24\n27\n13", "output": "0\n11\n18\n2\n"}, {"type": "stdin_stdout", "input": "5\n29\n27\n26", "output": "0\n8\n18\n23\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, the Fair Nut has written $k$ strings of length $n$, consisting of letters \"a\" and \"b\". He calculated $c$ — the number of strings that are prefixes of at least one of the written strings. Every string was cou... | [{"type": "stdin_stdout", "input": "100 1000000000\nbbabbaabbbaaaaabbabbbaaabbbbabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbaabbbbabaabbbabbaaaaabbbbaab\nbbabbaabbbaaaaabbabbbaaabbbbabbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaababbbabbbbaaaaabbaaaaaaaab\n", "output": "41073741883\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's a walking tour day in SIS.Winter, so $t$ groups of students are visiting Torzhok. Streets of Torzhok are so narrow that students have to go in a row one after another.\n\nInitially, some students are angry. Let's des... | [{"type": "stdin_stdout", "input": "16\n4\nPPPP\n4\nAPPP\n4\nPAPP\n4\nAAPP\n4\nPPAP\n4\nAPAP\n4\nPAAP\n4\nAAAP\n4\nPPPA\n4\nAPPA\n4\nPAPA\n4\nAAPA\n4\nPPAA\n4\nAPAA\n4\nPAAA\n4\nAAAA\n", "output": "0\n3\n2\n2\n1\n1\n1\n1\n0\n2\n1\n1\n0\n1\n0\n0\n"}, {"type": "stdin_stdout", "input": "16\n4\nPPPP\n4\nAPPP\n4\nPAPP\n4\nA... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in yyyy/mm/dd format. For example, January 23, 2018 should be written as 2018/01/23.\nAfter finishing ... | [{"type": "stdin_stdout", "input": "2017/01/07\n", "output": "2018/01/07\n"}, {"type": "stdin_stdout", "input": "2017/01/31\n", "output": "2018/01/31\n"}, {"type": "stdin_stdout", "input": "2017/01/06", "output": "2018/01/06\n"}, {"type": "stdin_stdout", "input": "2017/01/32", "output": "2018/01/32\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nElections in Berland are coming. There are only two candidates — Alice and Bob.\n\nThe main Berland TV channel plans to show political debates. There are $n$ people who want to take part in the debate as a spectator. Each... | [{"type": "stdin_stdout", "input": "54\n10 13\n10 45\n10 51\n01 44\n10 24\n10 26\n10 39\n10 38\n10 41\n10 33\n10 18\n10 12\n10 38\n10 30\n11 31\n10 46\n11 50\n00 26\n00 29\n00 50\n10 16\n10 40\n10 50\n00 43\n10 48\n10 32\n10 18\n10 8\n10 24\n10 32\n10 52\n00 41\n10 37\n10 38\n10 49\n00 35\n10 52\n00 44\n10 41\n10 36\n0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAssume that you have $k$ one-dimensional segments $s_1, s_2, \\dots s_k$ (each segment is denoted by two integers — its endpoints). Then you can build the following graph on these segments. The graph consists of $k$ verte... | [{"type": "stdin_stdout", "input": "1\n10\n1 2\n1 3\n2 4\n2 5\n2 6\n3 7\n3 8\n4 9\n4 10\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "1\n10\n1 2\n2 3\n1 4\n2 5\n4 6\n6 7\n3 8\n4 9\n4 10\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "1\n10\n1 2\n1 3\n1 4\n2 5\n2 6\n6 7\n1 8\n4 9\n4 10\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is on constraints. In this version constraints are lower. You can make hacks only if all versions of the problem are solved.\n\nKoa the Koala is at the beach!\n\nThe beac... | [{"type": "stdin_stdout", "input": "32\n3 1 3\n2 2 1\n3 1 3\n2 2 2\n3 1 3\n2 2 3\n3 1 3\n2 3 1\n3 1 3\n2 3 2\n3 1 3\n2 3 3\n3 1 3\n3 1 1\n3 1 3\n3 1 2\n3 1 3\n3 1 3\n3 1 3\n3 2 1\n3 1 3\n3 2 2\n3 1 3\n3 2 3\n3 1 3\n3 3 1\n3 1 3\n3 3 2\n3 1 3\n3 3 3\n3 2 1\n1 1 1\n3 2 1\n1 1 2\n3 2 1\n1 1 3\n3 2 1\n1 2 1\n3 2 1\n1 2 2\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $n$. Let's cal... | [{"type": "stdin_stdout", "input": "20\n9 15 11 8 10 5 19 13 12 18 3 20 17 14 2 16 7 4 1 6\n12 6 7 5 4 20 15 14 1 18 10 17 9 19 16 3 13 11 2 8\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "20\n9 15 11 8 10 5 19 13 12 18 3 20 17 14 2 16 7 4 1 6\n12 6 7 5 4 20 15 14 1 18 10 17 9 19 16 3 13 11 2 8\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant likes permutations. This time he has a permutation A[1], A[2], ..., A[N] of numbers 1, 2, ..., N.\n\nHe calls a permutation A good, if the number of its inversions is equal to the number of its local i... | [{"type": "stdin_stdout", "input": "4\n0\n1\n2\n0 1\n3\n0 1 2\n4\n1 3 2 4", "output": "YES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\n0\n1\n2\n0 1\n3\n11 1 1\n4\n1 3 2 -1", "output": "YES\nYES\nNO\nNO\n"}, {"type": "stdin_stdout", "input": "4\n-1\n1\n1\n0 1\n3\n3 0 1\n4\n1 3 2 4", "output": "YES\nYES\nNO... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nShinya watched a program on TV called \"Maya's Great Prophecy! Will the World End in 2012?\" After all, I wasn't sure if the world would end, but I was interested in Maya's \"long-term calendar,\" which was introduced in ... | [{"type": "stdin_stdout", "input": "2012.12.31\n2.11.16.14.14\n7138.4.03\n10.5.5.1.2\n10000000.12.31\n#", "output": "0.0.0.0.10\n3034.11.28\n12.19.19.16.10\n6059.2.10\n8.19.3.13.2\n"}, {"type": "stdin_stdout", "input": "2312.02.12\n2.12.16.14.14\n7128.5.13\n5.1.5.2.01\n10020000.10.31\n#", "output": "0.15.3.8.19\n3054.8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is a complicated version of problem F1. The difference between them is the constraints (F1: $k \\le 2$, F2: $k \\le 10$).\n\nYou are given an integer $n$. Find the minimum integer $x$ such that $x \\ge n$ and the numbe... | [{"type": "stdin_stdout", "input": "6\n2021 3\n177890 2\n34512 3\n724533 4\n998244353 1\n12345678 10\n", "output": "2021\n181111\n34533\n724542\n999999999\n12345678\n"}, {"type": "stdin_stdout", "input": "6\n2021 3\n177890 2\n34512 3\n724533 4\n998244353 1\n12345678 10\n", "output": "2021\n181111\n34533\n724542\n999999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a toy building consisting of $n$ towers. Each tower consists of several cubes standing on each other. The $i$-th tower consists of $h_i$ cubes, so it has height $h_i$.\n\nLet's define operation slice on some heig... | [{"type": "stdin_stdout", "input": "10 10\n1 1 1 1 1 1 1 1 1 1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10 10\n3 3 3 3 3 3 3 3 3 3\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10 10\n1 1 1 1 1 1 1 1 1 1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10 10\n3 3 3 3 3 3 3 3 3 3\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnton's favourite geometric figures are regular polyhedrons. Note that there are five kinds of regular polyhedrons: \n\n Tetrahedron. Tetrahedron has 4 triangular faces. Cube. Cube has 6 square faces. Octahedron. Octah... | [{"type": "stdin_stdout", "input": "28\nOctahedron\nDodecahedron\nOctahedron\nOctahedron\nDodecahedron\nIcosahedron\nIcosahedron\nDodecahedron\nDodecahedron\nDodecahedron\nCube\nDodecahedron\nCube\nTetrahedron\nCube\nCube\nTetrahedron\nDodecahedron\nDodecahedron\nDodecahedron\nIcosahedron\nIcosahedron\nDodecahedron\nIc... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEvil organizations that attempt to conquer the world are everywhere, regardless of age, east or west fiction, non-fiction, but what on earth did they try to conquer the world? I suddenly thought about that because I was a... | [{"type": "stdin_stdout", "input": "4\n0.200 3 1.3409251190635834\n0.38744720010760914 0 0.400\n0.900 1 1.000\n0.400 2 0.902270275623373\n2\n1.4849846876484776 1 1.1947768336367894\n0.500 0 1.000\n9\n0.200 7 0.600\n0.400 0 0.500\n1.540928395286643 8 1.727681009880635\n0.100 4 0.400\n0.200 2 0.600\n0.100 6 1.20624050513... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe problem was inspired by Pied Piper story. After a challenge from Hooli's compression competitor Nucleus, Richard pulled an all-nighter to invent a new approach to compression: middle-out.\n\nYou are given two strings ... | [{"type": "stdin_stdout", "input": "6\n7\ncontest\nntecost\n7\ncontest\nnsttdco\n7\ncontest\ntnsteco\n7\ncontess\ncotestn\n7\ncontest\ncontest\n7\nontestc\ncontest\n", "output": "3\n-1\n4\n-1\n0\n1\n"}, {"type": "stdin_stdout", "input": "6\n7\ncontest\nntecost\n7\ncontest\nnstteco\n7\ncontest\ntnsteco\n7\ncontess\ncote... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Beroil corporation structure is hierarchical, that is it can be represented as a tree. Let's examine the presentation of this structure as follows:\n\n * employee ::= name. | name:employee1,employee2, ... ,employeek.... | [{"type": "stdin_stdout", "input": "ZLWSYH:WNMTNAI:FTCKPGZBJ.,UZSCFZVXXK.,LNGCU.,TCT.,LNGCU.,U.,NEHYSET..,FBLI:NEHYSET:IFY..,VN.,VN.,IFY.,FBLI.,YH.,FBLI.,DTXG.,NEHYSET.,WNMTNAI.,VN.,SVXN.,NEHYSET.,TCT.,DTXG..,UZSCFZVXXK:KZQRJFST.,FTCKPGZBJ.,WNMTNAI.,SVXN:DHONBXRZAL..,NEHYSET.,IFY..,MPOEEMVOP:DHONBXRZAL.,DTXG.,FTCKPGZBJ... | 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\nRunning with barriers on the circle track is very popular in the country where Dasha lives, so no wonder that on her way to classes she saw the following situation:\n\nThe track is the circle with length L, in distinct po... | [{"type": "stdin_stdout", "input": "50 100\n0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98\n1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\ncoastline\n\nWaves rush to the beach every second. There is data that observes and records how many meters the wave rushed beyond the reference point P every second for only T seconds. The data consists of T integers x1, ... | [{"type": "stdin_stdout", "input": "5 2 3\n3\n2\n1\n2\n6\n3 100 100\n5\n3\n4\n20 2 8\n3\n2\n10\n1\n14\n1\n1\n4\n2\n2\n16\n1\n8\n8\n2\n6\n3\n8\n3\n8\n7 2 2\n0\n2\n5\n2\n5\n2\n-1\n0 0 0", "output": "2\n0\n11\n5\n"}, {"type": "stdin_stdout", "input": "5 2 3\n3\n2\n1\n2\n6\n3 110 100\n5\n3\n4\n20 2 3\n3\n2\n10\n1\n14\n1\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the... | [{"type": "stdin_stdout", "input": "100\n901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday on a lecture about strings Gerald learned a new definition of string equivalency. Two strings a and b of equal length are called equivalent in one of the two cases: They are equal. If we split string a into two h... | [{"type": "stdin_stdout", "input": "yhwepqwyhwepqwyhwepqweahnqtueahnqtueahnqtuyhwepqwyhwepqwyhwepqwyhwepqweahnqtueahnqtuyhwepqweahnqtueahnqtueahnqtueahnqtueahnqtueahnqtu\neahnqtueahnqtueahnqtuyhwepqweahnqtuyhwepqwyhwepqweahnqtuyhwepqweahnqtuyhwepqweahnqtueahnqtuyhwepqweahnqtueahnqtuyhwepqwyhwepqwyhwepqw\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n[Image] \n\n\n-----Input-----\n\nThe input contains a single integer $a$ ($0 \\le a \\le 15$).\n\n\n-----Output-----\n\nOutput a single integer.\n\n\n-----Example-----\nInput\n3\n\nOutput\n13\n\nThe input will be stdin an... | [{"type": "stdin_stdout", "input": "000\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "3\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "0\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "1\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "2\n", "output": "12\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSmart Beaver recently got interested in a new word game. The point is as follows: count the number of distinct good substrings of some string s. To determine if a string is good or not the game uses rules. Overall there a... | [{"type": "stdin_stdout", "input": "hrsszhjvrbsszvqesessiqbzeqijjerqirhhjsehiehezvzihzssivhvihrivrhizeqvvhejvibhqrbbqjrjsessvrhijzsrqirvsqqbibzhrzseijesszsrzhjjbqsrjrsrizivvhsjvqz\n3\nrzzevhiibziqiirhsebebrvrvvjihsjhvjjrejvqezireqevqeszrrseriijijijveqzbsbrezqhrrhbshqrhzshjervqjjzveeqsisrbevvjvjhbzvbjrrvizh 0 122\niqqqj... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSkier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to $1$ meter movement in the south, north, west or east direction respectively).\n\nIt is known t... | [{"type": "stdin_stdout", "input": "1\nENNNNNNNNNNNSSSSSSSSSSSEEEEEEEEEEN\n", "output": "126\n"}, {"type": "stdin_stdout", "input": "1\nNEEEEEEEEEEEWWWWWWWWWWWNNNNNNNNNNE\n", "output": "126\n"}, {"type": "stdin_stdout", "input": "1\nENNNNNNNNNNNSSSSSSSNSSSEEEEEEEEEES\n", "output": "126\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBalph is learning to play a game called Buma. In this game, he is given a row of colored balls. He has to choose the color of one new ball and the place to insert it (between two balls, or to the left of all the balls, or... | [{"type": "stdin_stdout", "input": "WWWOONOOOWWW\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "WWWOONOOOVWW\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "WVWOONOOOVWW\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "WOWOONVOOVWW\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "WOWO... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEvery day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i.\n\nEvery passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Natural... | [{"type": "stdin_stdout", "input": "6 4 3\n11\n6\n2\n13\n17\n5", "output": "4\n"}, {"type": "stdin_stdout", "input": "6 4 3\n11\n9\n2\n13\n17\n5", "output": "4\n"}, {"type": "stdin_stdout", "input": "6 3 3\n7\n6\n2\n13\n17\n5", "output": "4\n"}, {"type": "stdin_stdout", "input": "6 3 3\n7\n6\n2\n13\n10\n6", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWilliam really likes the cellular automaton called \"Game of Life\" so he decided to make his own version. For simplicity, William decided to define his cellular automaton on an array containing $n$ cells, with each cell ... | [{"type": "stdin_stdout", "input": "4\n10 1\n1111111111\n9 4\n000000000\n9 4\n000000000\n9 4\n000000000\n", "output": "1111111111\n000000000\n000000000\n000000000\n"}, {"type": "stdin_stdout", "input": "4\n10 1\n1111111111\n9 4\n000000000\n9 4\n000000000\n9 4\n000000000\n", "output": "1111111111\n000000000\n000000000\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the Jambo Amusement Garden (JAG), you sell colorful drinks consisting of multiple color layers. This colorful drink can be made by pouring multiple colored liquids of different density from the bottom in order.\n\nYou ... | [{"type": "stdin_stdout", "input": "4\nred 3444\nred 3018\nred 3098\nred 3319\n4\nred\nred\nrec\nred", "output": "No\n"}, {"type": "stdin_stdout", "input": "4\nred 3444\nder 3018\nred 3098\nred 3319\n4\nred\nred\nrec\nred", "output": "No\n"}, {"type": "stdin_stdout", "input": "4\nred 2133\nder 3018\nred 3098\nred 3319\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKattapa, as you all know was one of the greatest warriors of his time. The kingdom of Maahishmati had never lost a battle under him (as army-chief), and the reason for that was their really powerful army, also called as M... | [{"type": "stdin_stdout", "input": "3\n2 3 4\n\n\n", "output": "READY FOR BATTLE\n"}, {"type": "stdin_stdout", "input": "4\n11 12 13 14\n\n\n", "output": "NOT READY\n"}, {"type": "stdin_stdout", "input": "5\n1 2 3 4 5\n\n\n", "output": "NOT READY\n"}, {"type": "stdin_stdout", "input": "1\n2\n\n\n", "output": "READY FOR... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChef loves to play games. Now he plays very interesting game called \"Segment\". At the beginning Chef has segment [0, X] and no points on it. On each step Chef chooses the subsegment of maximal length possible such as it... | [{"type": "stdin_stdout", "input": "4\n-1 3\n16 2\n13 1\n1001000000 3092440", "output": "-0.7500000000000000\n4.0000000000000000\n6.5000000000000000\n475065130.4721832275390625\n"}, {"type": "stdin_stdout", "input": "4\n3 2\n23 1\n22 3\n1000000001 3153660", "output": "0.7500000000000000\n11.5000000000000000\n16.5000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs Sherlock Holmes was investigating another crime, he found a certain number of clues. Also, he has already found direct links between some of those clues. The direct links between the clues are mutual. That is, the dire... | [{"type": "stdin_stdout", "input": "30 70 288262020\n27 18\n5 19\n23 17\n16 17\n29 17\n1 22\n23 5\n10 13\n22 26\n14 3\n8 3\n29 9\n9 1\n3 9\n16 4\n9 22\n10 22\n20 1\n3 7\n23 19\n26 8\n24 1\n5 7\n28 29\n20 11\n16 12\n6 9\n24 29\n30 4\n5 26\n18 21\n5 21\n30 6\n12 13\n16 23\n28 14\n30 1\n7 27\n7 19\n27 17\n5 30\n30 27\n28 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given the current time in 24-hour format hh:mm. Find and print the time after a minutes.\n\nNote that you should find only the time after a minutes, see the examples to clarify the problem statement.\n\nYou can re... | [{"type": "stdin_stdout", "input": "12:34\n10000\n", "output": "11:14\n"}, {"type": "stdin_stdout", "input": "00:00\n10000\n", "output": "22:40\n"}, {"type": "stdin_stdout", "input": "00:00\n10000\n", "output": "22:40\n"}, {"type": "stdin_stdout", "input": "12:34\n10000\n", "output": "11:14\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nThere is a positive integer sequence $ a_1, a_2, \\ ldots, a_N $ of length $ N $.\n\nConsider the following game, which uses this sequence and is played by $ 2 $ players on the play and the play.\n\n*... | [{"type": "stdin_stdout", "input": "2\n10 -2", "output": "Second\n"}, {"type": "stdin_stdout", "input": "2\n-1 10", "output": "First\n"}, {"type": "stdin_stdout", "input": "2\n-2 2", "output": "Second\n"}, {"type": "stdin_stdout", "input": "2\n-2 4", "output": "Second\n"}, {"type": "stdin_stdout", "input": "2\n-2 8", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a positive integer $k$, two arrays are called $k$-similar if:\n\nthey are strictly increasing;\n\nthey have the same length;\n\nall their elements are positive integers between $1$ and $k$ (inclusive);\n\nthey diffe... | [{"type": "stdin_stdout", "input": "6 5 15\n2 5 6 7 8 15\n1 2\n1 1\n5 5\n5 6\n4 5\n", "output": "15\n14\n14\n19\n13\n"}, {"type": "stdin_stdout", "input": "6 5 15\n2 5 6 4 8 15\n1 2\n1 1\n5 5\n5 6\n4 5\n", "output": "15\n14\n14\n19\n16\n"}, {"type": "stdin_stdout", "input": "6 5 13\n2 4 6 7 8 12\n1 4\n1 3\n3 5\n2 2\n5 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA convex polygon consisting of N vertices is given. The coordinates of each vertex are represented counterclockwise by (X1, Y1), (X2, Y2), ……, (XN, YN). No matter what straight line passes through the point P, find the co... | [{"type": "stdin_stdout", "input": "4\n100 100\n0 100\n0 0\n100 0", "output": "50.00000 50.00000"}, {"type": "stdin_stdout", "input": "4\n111 100\n-2 110\n0 -2\n110 -1", "output": "NA\n"}, {"type": "stdin_stdout", "input": "4\n111 110\n-2 110\n0 -2\n110 -1", "output": "NA\n"}, {"type": "stdin_stdout", "input": "4\n111 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row num... | [{"type": "stdin_stdout", "input": "5 5 30\n0 1 1 1 0\n1 1 0 1 1\n0 1 1 1 1\n0 0 1 1 0\n0 0 0 0 0\n3 2\n2 2\n2 2\n4 3\n1 4\n3 2\n4 1\n2 4\n1 4\n2 1\n5 2\n4 1\n4 1\n5 1\n2 4\n2 4\n4 4\n1 2\n3 1\n4 5\n1 2\n2 3\n1 1\n5 1\n3 4\n1 1\n5 4\n1 5\n5 4\n2 2\n", "output": "3\n3\n3\n3\n3\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n5\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya is very upset that many people on the Net mix uppercase and lowercase letters in one word. That's why he decided to invent an extension for his favorite browser that would change the letters' register in every word ... | [{"type": "stdin_stdout", "input": "XHRPXZEGHSOCJPICUIXSKFrZUPYTSGJSDIYBCMNMNBPNDBXLXBzhbfnqvwcffvUdhtickyqhupmcehlsyvncqmfhautvxudqdhgg\n", "output": "xhrpxzeghsocjpicuixskfrzupytsgjsdiybcmnmnbpndbxlxbzhbfnqvwcffvudhtickyqhupmcehlsyvncqmfhautvxudqdhgg\n"}, {"type": "stdin_stdout", "input": "RJIQZMJzIMSNDBOHBRAWIENODSA... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\n-----Constraints-----\n - 1 \\leq K \\leq 100\n - 1 \\leq X \\leq 10^5\n\n-----Inp... | [{"type": "stdin_stdout", "input": "100 100000\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "84 42001\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "13 6498\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "4 2000\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "13 1282", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPupils Alice and Ibragim are best friends. It's Ibragim's birthday soon, so Alice decided to gift him a new puzzle. The puzzle can be represented as a matrix with $2$ rows and $n$ columns, every element of which is either... | [{"type": "stdin_stdout", "input": "50\n0 1 1 1 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0\n0 0 0 1 0 1 0 0 0 1 0 1 1 1 0 0 0 0 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1\n0 0 0 0 1 1 0 0 1 0 0 0 1 0 0 0 1 1 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (... | [{"type": "stdin_stdout", "input": "1000000000000000000 100000000000000000\n", "output": "899999999999999991\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 200000000000000000\n", "output": "799999999999999991\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 100000000000000000\n", "output": "8999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nQuite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called \"Black Square\" on his super cool touchscreen phone.\n\nIn this game, the phone's screen is divided into fo... | [{"type": "stdin_stdout", "input": "1809 1302 7164 6122\n3144121413113111223311232232114144321414421243443243422322144324121433444342231344234443332241322442\n", "output": "420780\n"}, {"type": "stdin_stdout", "input": "1809 1302 7164 6122\n3144121413113111223311232232114144321414421243443243422322144324121433444342231... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.\n\nNow he wonders what is an averag... | [{"type": "stdin_stdout", "input": "1209\n", "output": "263450/1207\n"}, {"type": "stdin_stdout", "input": "1869\n", "output": "627063/1867\n"}, {"type": "stdin_stdout", "input": "1865\n", "output": "623876/1863\n"}, {"type": "stdin_stdout", "input": "1343\n", "output": "325366/1341\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnia has a large integer $S$. Its decimal representation has length $n$ and doesn't contain any leading zeroes. Ania is allowed to change at most $k$ digits of $S$. She wants to do it in such a way that $S$ still won't co... | [{"type": "stdin_stdout", "input": "400 224\n34034718296316650556302576767095880542740697596682657060609028712014739414658241556774411582749368771597248873201583574900424227251655547840887764275893533353440635216728376201808545879398359535670372855472971530695051695650262058940466340529417646357776899296790403916961389... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDifference of Big Integers\n\nGiven two integers $A$ and $B$, compute the difference, $A - B$.\n\nInput\n\nTwo integers $A$ and $B$ separated by a space character are given in a line.\n\nOutput\n\nPrint the difference in ... | [{"type": "stdin_stdout", "input": "-2 -1280", "output": "1278\n"}, {"type": "stdin_stdout", "input": "-2 -1243", "output": "1241\n"}, {"type": "stdin_stdout", "input": "-2 -2265", "output": "2263\n"}, {"type": "stdin_stdout", "input": "-1 -2265", "output": "2264\n"}, {"type": "stdin_stdout", "input": "-1 -2368", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe weight of a sequence is defined as the number of unordered pairs of indexes $(i,j)$ (here $i \\lt j$) with same value ($a_{i} = a_{j}$). For example, the weight of sequence $a = [1, 1, 2, 2, 1]$ is $4$. The set of uno... | [{"type": "stdin_stdout", "input": "2\n4\n2 2 2 2\n4\n1 3 3 4\n", "output": "15\n4\n"}, {"type": "stdin_stdout", "input": "2\n4\n2 2 2 2\n4\n1 4 3 4\n", "output": "15\n2\n"}, {"type": "stdin_stdout", "input": "2\n4\n2 2 2 2\n4\n1 2 3 4\n", "output": "15\n0\n"}, {"type": "stdin_stdout", "input": "2\n4\n1 2 3 1\n4\n1 4 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a permutation P[1... N] of integers from 1 to N, function f is defined as follows:\n\n $f(i, j) = \\left\\{\\begin{array}{ll}{P [ i ]} & {\\text{if} j = 1} \\\\{f(P [ i ], j - 1)} & {\\text{otherwise}} \\end{array} \\... | [{"type": "stdin_stdout", "input": "10 7 5\n", "output": "2 3 4 5 1 7 8 9 10 6 "}, {"type": "stdin_stdout", "input": "10 7 5\n", "output": "2 3 4 5 1 7 8 9 10 6 "}, {"type": "stdin_stdout", "input": "9 2 5\n", "output": "2 1 4 3 6 7 8 9 5 "}, {"type": "stdin_stdout", "input": "9 7 9\n", "output": "2 3 4 5 6 7 8 9 1 "},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are two bus stops denoted A and B, and there n buses that go from A to B every day. The shortest path from A to B takes t units of time but some buses might take longer paths. Moreover, buses are allowed to overtake... | [{"type": "stdin_stdout", "input": "2 1000000000\n1 1000000000\n2 2\n", "output": "Yes\n 2000000000 2000000001"}, {"type": "stdin_stdout", "input": "2 10\n4 5\n2 2\n", "output": "Yes\n ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day, Taro received a strange email with only the number \"519345213244\" in the text. The email was from my cousin, who was 10 years older than me, so when I called and asked, \"Oh, I sent it with a pocket bell becaus... | [{"type": "stdin_stdout", "input": "341143514535\n158\n143565553551655311343411652235654535651124615163\n551544654451431564\n4\n3411\n6363636363\n153414", "output": "naruto\nNA\ndo you wanna go to aizu?\nyes sure!\nNA\nna\n?????\nend\n"}, {"type": "stdin_stdout", "input": "341143514535\n158\n143565553551655311343411652... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is that you should complete all the projects in easy version but this is not necessary in hard version.\n\nPolycarp is a very famous freelancer. His current rating is $r$... | [{"type": "stdin_stdout", "input": "50 15000\n142 -300\n20 -298\n560 -300\n1815 -292\n282 -297\n92 -293\n34 -284\n555 -299\n408 -293\n504 -284\n278 -284\n139 -291\n64 -298\n311 -293\n130 -293\n89 -298\n129 -294\n385 -295\n136 -288\n41 -293\n112 -290\n416 -295\n178 -294\n154 -300\n110 -300\n346 -299\n209 -294\n1394 -295... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n[3R2 as DJ Mashiro - Happiness Breeze](https://open.spotify.com/track/2qGqK8GRS65Wlf20qUBEak)\n\n[Ice - DJ Mashiro is dead or alive](https://soundcloud.com/iceloki/dj-mashiro-is-dead-or-alive)\n\nNEKO#ΦωΦ has just got a n... | [{"type": "stdin_stdout", "input": "10 83\n1 3\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n1 4\n2 2\n2 3\n2 3\n2 3\n2 3\n2 3\n2 3\n1 4\n1 5\n1 7\n2 2\n2 2\n1 5\n2 2\n1 3\n2 1\n2 6\n1 5\n2 6\n2 9\n1 2\n2 5\n1 2\n2 5\n2 4\n2 4\n1 2\n1 2\n1 4\n2 6\n2 6\n2 4\n2 4\n1 2\n1 2\n2 4\n2 4\n2 3\n2 3\n1 2\n2 9\n1 2\n1 2\n1 2\n2 6\n2 6\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA newspaper is published in Walrusland. Its heading is s1, it consists of lowercase Latin letters. Fangy the little walrus wants to buy several such newspapers, cut out their headings, glue them one to another in order to... | [{"type": "stdin_stdout", "input": "ehfjaabjfedhddejjfcfijagefhkeahjcddhchahjbagi\nfbfdjbjhibjgjgaaajgdbcfdbhjcajcbbieijhcjgajhgaa\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "ehfjaabjfedhddejjfcfijagefhkeahjcddhchahjbagi\naaghjagjchjieibbcjacjhbdfcbdgjaaagjgjbihjbjdfbf\n", "output": "10\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKsenia has ordinary pan scales and several weights of an equal mass. Ksenia has already put some weights on the scales, while other weights are untouched. Ksenia is now wondering whether it is possible to put all the rema... | [{"type": "stdin_stdout", "input": "CKQHRUZMISGE|FBVWPXDLTJYN\nOA\n", "output": "CKQHRUZMISGEA|FBVWPXDLTJYNO\n"}, {"type": "stdin_stdout", "input": "V|CMOEUTAXBFWSK\nDLRZJGIYNQHP\n", "output": "VDLRZJGIYNQHP|CMOEUTAXBFWSK\n"}, {"type": "stdin_stdout", "input": "QWHNMALDGKTJ|\nPBRYVXZUESCOIF\n", "output": "QWHNMALDGKTJF... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMancala is a game famous in the Middle East. It is played on a board that consists of 14 holes. [Image] \n\nInitially, each hole has $a_i$ stones. When a player makes a move, he chooses a hole which contains a positive n... | [{"type": "stdin_stdout", "input": "297857621 238127103 749085829 139033277 597985489 202617713 1366784327 117968155 278551059 297781685 330124279 338959601 682874531 259895291\n", "output": "5305874892\n"}, {"type": "stdin_stdout", "input": "404418821 993626161 346204297 122439813 461187221 628048227 625919459 6286117... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRoman and Denis are on the trip to the programming competition. Since the trip was long, they soon got bored, and hence decided to came up with something. Roman invented a pizza's recipe, while Denis invented a string mul... | [{"type": "stdin_stdout", "input": "4\nqe\nnd\niqryhukieskfvaeettersinksrmazelxtgvartuz\nvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSeveral ages ago Berland was a kingdom. The King of Berland adored math. That's why, when he first visited one of his many palaces, he first of all paid attention to the floor in one hall. The floor was tiled with hexagon... | [{"type": "stdin_stdout", "input": "1000 1100 1000\n", "output": "3196901\n"}, {"type": "stdin_stdout", "input": "1000 0100 1000\n", "output": "1197901\n"}, {"type": "stdin_stdout", "input": "1000 1000 1000\n", "output": "2997001"}, {"type": "stdin_stdout", "input": "998 999 1001\n", "output": "2993002\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n$n$ people gathered to hold a jury meeting of the upcoming competition, the $i$-th member of the jury came up with $a_i$ tasks, which they want to share with each other.\n\nFirst, the jury decides on the order which they ... | [{"type": "stdin_stdout", "input": "1\n74\n15 4 1 8 1 4 -1 5 9 1 6 3 1 16 2 1 3 6 7 4 1 6 8 9 21 4 0 6 6 4 22 1 8 7 0 1 6 6 4 1 8 9 16 4 10 5 9 2 20 10 0 5 3 8 1 7 7 0 2 10 2 4 8 4 6 9 2 4 9 8 1 11 3 0\n", "output": "210389544\n"}, {"type": "stdin_stdout", "input": "1\n74\n15 4 1 8 1 4 0 5 9 1 6 3 1 16 2 1 3 6 7 4 1 6 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are a paparazzi working in Manhattan.\n\nManhattan has r south-to-north streets, denoted by numbers 1, 2,…, r in order from west to east, and r west-to-east streets, denoted by numbers 1,2,…,r in order from south to n... | [{"type": "stdin_stdout", "input": "500 10\n69 477 122\n73 186 235\n341 101 145\n372 77 497\n404 117 440\n494 471 37\n522 300 498\n682 149 379\n821 486 359\n855 157 386\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "500 10\n69 477 111\n73 186 235\n341 101 145\n372 77 497\n404 117 440\n494 471 37\n522 300 498\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a permutation $p$ of length $n$, find its subsequence $s_1$, $s_2$, $\\ldots$, $s_k$ of length at least $2$ such that: $|s_1-s_2|+|s_2-s_3|+\\ldots+|s_{k-1}-s_k|$ is as big as possible over all subsequences of $p$ ... | [{"type": "stdin_stdout", "input": "2\n3\n3 4 1\n4\n1 12 4 6\n", "output": "3\n3 4 1\n4\n1 12 4 6\n"}, {"type": "stdin_stdout", "input": "2\n3\n3 4 1\n4\n1 12 3 6\n", "output": "3\n3 4 1\n4\n1 12 3 6\n"}, {"type": "stdin_stdout", "input": "2\n3\n5 14 1\n4\n1 5 16 2\n", "output": "3\n5 14 1\n3\n1 16 2\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nF... | [{"type": "stdin_stdout", "input": "10\n1 1 2 -3 2 8 1 218 -1 8", "output": "16\n"}, {"type": "stdin_stdout", "input": "10\n0 1 0 -2 4 34 1 34 0 4", "output": "136\n"}, {"type": "stdin_stdout", "input": "10\n-1 2 12 15 3 1 0 18 1 1", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n-2 2 12 1 4 2 1 41 -1 1", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGalois is one of the strongest chess players of Byteforces. He has even invented a new variant of chess, which he named «PawnChess».\n\nThis new game is played on a board consisting of 8 rows and 8 columns. At the beginni... | [{"type": "stdin_stdout", "input": "........\n........\n.B....B.\n....W...\n........\n..W.....\n........\n........\n", "output": "A\n"}, {"type": "stdin_stdout", "input": "..B.....\n..W.....\n......B.\n........\n.....W..\n......B.\n........\n........\n", "output": "B\n"}, {"type": "stdin_stdout", "input": ".BB.B.B.\nB.... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which finds a pattern $p$ in a ring shaped text $s$.\n\n\n<image>\n\nConstraints\n\n* $1 \\leq $ length of $p \\leq $ length of $s \\leq 100$\n* $s$ and $p$ consists of lower-case letters\n\nInput\n\nIn th... | [{"type": "stdin_stdout", "input": "vanceknowledgetoad\nbdvanced", "output": "No\n"}, {"type": "stdin_stdout", "input": "vanceknowledgetoad\ncdvanced", "output": "No\n"}, {"type": "stdin_stdout", "input": "vanceknowmedgetoad\ncdvanced", "output": "No\n"}, {"type": "stdin_stdout", "input": "vbnceknowmedgetoad\ncdvanced"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet $f(i)$ denote the minimum positive integer $x$ such that $x$ is not a divisor of $i$.\n\nCompute $\\sum_{i=1}^n f(i)$ modulo $10^9+7$. In other words, compute $f(1)+f(2)+\\dots+f(n)$ modulo $10^9+7$.\n\n\n-----Input--... | [{"type": "stdin_stdout", "input": "6\n1\n4\n3\n4\n10\n10000000000000000\n", "output": "2\n10\n7\n10\n26\n366580019\n"}, {"type": "stdin_stdout", "input": "6\n1\n2\n3\n4\n10\n10000000000000000\n", "output": "2\n5\n7\n10\n26\n366580019\n"}, {"type": "stdin_stdout", "input": "6\n1\n2\n3\n4\n10\n10000000000000000\n", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Third Doctor Who once correctly said that travel between parallel universes is \"like travelling sideways\". However, he incorrectly thought that there were infinite parallel universes, whereas in fact, as we now all ... | [{"type": "stdin_stdout", "input": "18 16 20 4\n0 0\n0 1\n1 7\n1 7\n", "output": "18 16\n17 15\n18 16\n19 17\n"}, {"type": "stdin_stdout", "input": "18 16 20 4\n0 0\n0 1\n1 7\n1 6\n", "output": "18 16\n17 15\n18 16\n19 17\n"}, {"type": "stdin_stdout", "input": "18 8 20 4\n1 1\n0 1\n1 7\n1 7\n", "output": "19 9\n18 8\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNotes\n\nTemplate in C\n\nConstraints\n\n2 ≤ the number of operands in the expression ≤ 100\n1 ≤ the number of operators in the expression ≤ 99\n-1 × 109 ≤ values in the stack ≤ 109\n\nInput\n\nAn expression is given in a... | [{"type": "stdin_stdout", "input": "1 1 + 5 11 - *", "output": "-12\n"}, {"type": "stdin_stdout", "input": "0 0 + 6 21 - +", "output": "-15\n"}, {"type": "stdin_stdout", "input": "1 12 + 3 8 - *", "output": "-65\n"}, {"type": "stdin_stdout", "input": "1 0 + 6 21 - +", "output": "-14\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSanta Claus decided to disassemble his keyboard to clean it. After he returned all the keys back, he suddenly realized that some pairs of keys took each other's place! That is, Santa suspects that each key is either on it... | [{"type": "stdin_stdout", "input": "dofbgdppdvmwjwtdyphhmqliydxyjfxoopxiscevowleccmhwybrxitvujkfliamvqinlrpytyaqdlbywccprukoisyaseibuqbfqjcabkieimsggsakpnqliwhehnemewhychqrfiuyaecoydnromrh\ndofbgdppdvmwjwtdyphhmqliydxyjfxoopxiscevowleccmhwybsxitvujkfliamvqinlrpytyaqdlbywccprukoisyaseibuqbfqjcabkieimsggsakpnqliwhehnemew... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya works as a PR manager for a successful Berland company BerSoft. He needs to prepare a presentation on the company income growth since 2001 (the year of its founding) till now. Petya knows that in 2001 the company in... | [{"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\nProblem Statement\n\nMr. Takatsuki, who is planning to participate in the Aizu training camp, is enthusiastic about studying and has been studying English recently. She tries to learn as many English words as possible by ... | [{"type": "stdin_stdout", "input": "6\nZI?U -1\nLINFR 14\nKNGE -1\nLCL -1\n@S 2\nKFHD 15\nBSKA\nILIC\nPZRH\nEDLU\n1", "output": "0\n"}, {"type": "stdin_stdout", "input": "6\n[I?U -1\nLINFR 14\nKNGE -1\nLCL -1\n@S 2\nKFHD 15\nBSKA\nILIC\nPZRH\nEDLU\n1", "output": "0\n"}, {"type": "stdin_stdout", "input": "6\n[I?U -1\nRF... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a robot that can move along a number line. At time moment $0$ it stands at point $0$.\n\nYou give $n$ commands to the robot: at time $t_i$ seconds you command the robot to go to point $x_i$. Whenever the robot re... | [{"type": "stdin_stdout", "input": "8\n3\n1 5\n3 0\n6 4\n3\n1 5\n2 4\n10 -5\n5\n2 -5\n3 1\n4 1\n5 1\n6 1\n4\n3 3\n5 -3\n9 2\n12 0\n8\n1 1\n2 -6\n7 2\n8 3\n12 -9\n14 2\n18 -1\n23 9\n5\n1 -4\n4 -7\n6 -1\n7 -3\n8 -7\n2\n1 2\n2 -2\n6\n3 10\n5 5\n8 0\n12 -4\n14 -7\n19 -5\n", "output": "\n1\n2\n0\n2\n1\n1\n0\n2\n"}, {"type":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArkadiy has lots square photos with size a × a. He wants to put some of them on a rectangular wall with size h × w. \n\nThe photos which Arkadiy will put on the wall must form a rectangular grid and the distances between ... | [{"type": "stdin_stdout", "input": "452081307 790635695 790635695\n", "output": "169277194.00000000000000000000\n"}, {"type": "stdin_stdout", "input": "469568633 681052815 681052815\n", "output": "105742091.00000000000000000000\n"}, {"type": "stdin_stdout", "input": "338084774 564168943 564168943\n", "output": "1130420... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMisha was interested in water delivery from childhood. That's why his mother sent him to the annual Innovative Olympiad in Irrigation (IOI). Pupils from all Berland compete there demonstrating their skills in watering. It... | [{"type": "stdin_stdout", "input": "100 74 20\n9 15 16 18 55 41 64 44 5 1 27 31 36 25 71 28 71 35 47 40 21 53 31 11 24 1 69 67 58 16 19 52 33 17 63 1 49 28 17 52 46 60 53 21 21 60 19 63 11 61 10 27 3 22 38 31 45 69 61 18 58 22 8 71 17 1 64 70 56 10 66 47 70 1 45 8 66 8 66 25 39 45 47 7 41 24 41 72 16 42 28 7 15 10 38 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence $a=[a_1,a_2,\\dots,a_n]$ consisting of $n$ positive integers.\n\nLet's call a group of consecutive elements a segment. Each segment is characterized by two indices: the index of its left end and t... | [{"type": "stdin_stdout", "input": "4\n6\n55 45 30 30 40 100\n4\n10 23 7 13\n5\n10 55 35 30 65\n6\n4 1 1 1 1 4\n", "output": "3\n4\n2\n3\n"}, {"type": "stdin_stdout", "input": "5\n4\n18 6 6 6\n5\n5 5 5 5 5\n3\n12 6 6\n2\n1 1\n1\n1\n", "output": "3\n1\n2\n1\n1\n"}, {"type": "stdin_stdout", "input": "4\n3\n6 6 12\n4\n18 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n - the dogs numbere... | [{"type": "stdin_stdout", "input": "1000000000000001\n", "output": "gbdpxgrzxjm\n"}, {"type": "stdin_stdout", "input": "530000050000000\n", "output": "csoypdctwnh\n"}, {"type": "stdin_stdout", "input": "95678123450002\n", "output": "qpdjiixlxb\n"}, {"type": "stdin_stdout", "input": "1000000000\n", "output": "cfdgsxl\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Bolek has found a picture with n mountain peaks painted on it. The n painted peaks are represented by a non-closed polyline, consisting of 2n segments. The segments go through 2n + 1 points with coordinates (1, y1)... | [{"type": "stdin_stdout", "input": "100 20\n2 3 0 4 0 1 0 6 3 4 3 6 4 6 0 9 0 6 2 7 3 8 7 10 2 9 3 9 5 6 5 10 3 7 1 5 2 8 3 7 2 3 1 6 0 8 3 8 0 4 1 8 3 7 1 9 5 9 5 8 7 8 5 6 5 8 1 9 8 9 8 10 7 10 5 8 6 10 2 6 3 9 2 6 3 10 5 9 3 10 1 3 2 11 8 9 8 10 1 8 7 11 0 9 5 8 4 5 0 7 3 7 5 9 5 10 1 7 1 9 1 6 3 8 2 4 1 4 2 6 0 4 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs it's the first of April, Heidi is suspecting that the news she reads today are fake, and she does not want to look silly in front of all the contestants. She knows that a newspiece is fake if it contains heidi as a sub... | [{"type": "stdin_stdout", "input": "sjvmovplbrnakthytvanvvbscgdcdkdkbgginnbiyczyrkywcuvbgolznifdyiilonvqblbywxzgjnntldeuhhlecubshirsdxugezholvufotprjovwqiitypvaghlcxlrajrtufmysbpegjfvdboewogamnunalynjvwiopqfhndupfqxfatbpklpzdsdmzwvtitvdxkefremodmlferuxyisxmvjydjthekokldjkwoiffmhlquulcbogdnnzqaisoxqpgztuzvbleiitrqbzljbb... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.