messages
listlengths
1
1
ground_truth
stringlengths
156
726k
dataset
stringclasses
2 values
[ { "content": "A mischievous notice has arrived from the primitive slow-life organization \"Akaruda\". Akaruda is famous for mischief such as throwing a pie at the face of a VIP, but recently it has become more radical, such as using gunpowder to sprinkle rat fireworks at the reception venue. The notice is the f...
[{"input": "4\n03:05\n05:11\n11:54\n10:40", "output": "warning\nwarning\nwarning\nwarning\n"}, {"input": "4\n03:25\n10:61\n11:65\n10:41", "output": "warning\nwarning\nalert\nwarning\n"}, {"input": "4\n12:15\n10:50\n11:44\n10:40", "output": "warning\nalert\nwarning\nwarning\n"}, {"input": "4\n12:05\n00:50\n11:44\n10:40"...
code_stdio
[ { "content": "Alice and Bob are playing One Card Poker.\n\nOne Card Poker is a two-player game using playing cards. \nEach card in this game shows an integer between 1 and 13, inclusive.\n\nThe strength of a card is determined by the number written on it, as follows: \nWeak 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 ...
[{"input": "1 13\n", "output": "Alice\n"}, {"input": "11 11\n", "output": "Draw\n"}, {"input": "-1 -4", "output": "Alice\n"}, {"input": "-2 -3", "output": "Alice\n"}, {"input": "-2 -4", "output": "Alice\n"}, {"input": "-2 -6", "output": "Alice\n"}, {"input": "-2 -8", "output": "Alice\n"}, {"input": "8 6\n", "output": "...
code_stdio
[ { "content": "During a break in the buffet of the scientific lyceum of the Kingdom of Kremland, there was formed a queue of $n$ high school students numbered from $1$ to $n$. Initially, each student $i$ is on position $i$. Each student $i$ is characterized by two numbers — $a_i$ and $b_i$. Dissatisfaction of th...
[{"input": "30\n61 23\n30 93\n4 18\n34 97\n63 77\n45 95\n51 13\n41 8\n86 19\n38 24\n2 67\n20 61\n95 48\n95 1\n28 26\n92 110\n6 78\n64 28\n1 82\n61 37\n77 35\n152 21\n10 24\n52 12\n80 63\n64 61\n16 87\n118 19\n21 34\n54 49\n", "output": "29529\n"}, {"input": "30\n61 23\n30 93\n4 18\n34 97\n63 77\n45 95\n51 13\n41 8\n86 ...
code_stdio
[ { "content": "Write a function that returns a sequence (index begins with 1) of all the even characters from a string. If the string is smaller than two characters or longer than 100 characters, the function should return \"invalid string\". \n\nFor example:\n`````\n\"abcdefghijklm\" --> [\"b\", \"d\", \"f\", \...
[{"input": "\"aiqbuwbjqwbckjdwbwkqbefhglqhfjbwqejbcadn.bcaw.jbhwefjbwqkvbweevkj.bwvwbhvjk.dsvbajdv.hwuvghwuvfhgw.vjhwncv.wecnaw.ecnvw.kejvhnw.evjkhweqv.kjhwqeev.kjbhdjk.vbaewkjva\"", "output": "[\"invalid string\"]", "fn_name": "even_chars"}, {"input": "\"abcdefghijklm\"", "output": "[[\"b\", \"d\", \"f\", \"h\", \"j\"...
code_functional
[ { "content": "B: Parentheses Number\n\nproblem\n\nDefine the correct parenthesis string as follows:\n\n* The empty string is the correct parenthesis string\n* For the correct parenthesis string S, `(` S `)` is the correct parenthesis string\n* For correct parentheses S, T ST is the correct parentheses\n\n\n\nHe...
[{"input": "2\n2 -107", "output": ":(\n"}, {"input": "2\n2 -187", "output": ":(\n"}, {"input": "2\n2 -155", "output": ":(\n"}, {"input": "2\n2 -142", "output": ":(\n"}, {"input": "2\n2 -100", "output": ":(\n"}, {"input": "2\n2 -125", "output": ":(\n"}, {"input": "2\n2 -149", "output": ":(\n"}, {"input": "2\n2 -131", "o...
code_stdio
[ { "content": "Given an integer $n$, find the maximum value of integer $k$ such that the following condition holds:\n\n$n$ & ($n-1$) & ($n-2$) & ($n-3$) & ... ($k$) = $0$\n\nwhere & denotes the bitwise AND operation. \n-----Input-----\n\nThe first line contains a single integer $t$ ($1 \\le t \\le 3 \\cdot 10^4$...
[{"input": "1\n168457447\n", "output": "134217727\n"}, {"input": "1\n276490162\n", "output": "268435455\n"}, {"input": "1\n109011159\n", "output": "67108863\n"}, {"input": "1\n99888383\n", "output": "67108863\n"}, {"input": "1\n99888383\n", "output": "67108863\n"}, {"input": "1\n95529231\n", "output": "67108863\n"}, {"...
code_stdio
[ { "content": "Chef has just finished the construction of his new garden. He has sown the garden with patches of the most beautiful carpet grass he could find. He has filled it with patches of different color and now he wants to evaluate how elegant his garden is.\nChef's garden looks like a rectangular grid of ...
[{"input": "3\n2 1\naa\nA`\n3 -1\naba\nbab\naab\n-1 1\naabb\nbaba\nbcaa\nbbaa", "output": "0\n0\n0\n"}, {"input": "3\n2 1\n`a\nA`\n3 -1\naba\nbab\naab\n-1 1\naabb\nbaba\nbcaa\nbbaa", "output": "0\n0\n0\n"}, {"input": "3\n2 1\na`\nA`\n3 -1\naba\nbab\naab\n-1 1\naabb\nbaba\nbcaa\nbbaa", "output": "0\n0\n0\n"}, {"input": ...
code_stdio
[ { "content": "You are given the array $a$ consisting of $n$ positive (greater than zero) integers.\n\nIn one move, you can choose two indices $i$ and $j$ ($i \\ne j$) such that the absolute difference between $a_i$ and $a_j$ is no more than one ($|a_i - a_j| \\le 1$) and remove the smallest of these two element...
[{"input": "5\n2\n2 6\n4\n2 2 7 14\n3\n3 3 4\n4\n10 5 10 5\n4\n1 2 1 1\n", "output": "NO\nNO\nYES\nNO\nYES\n"}, {"input": "5\n2\n2 6\n4\n2 0 7 14\n3\n3 3 4\n4\n10 5 10 5\n4\n1 2 1 1\n", "output": "NO\nNO\nYES\nNO\nYES\n"}, {"input": "5\n2\n2 3\n4\n2 2 8 8\n3\n3 3 3\n4\n5 5 5 5\n4\n1 1 1 1\n", "output": "YES\nNO\nYES\nY...
code_stdio
[ { "content": "Imagine that you are given two sticks. You want to end up with three sticks of equal length. You are allowed to cut either or both of the sticks to accomplish this, and can throw away leftover pieces.\n\nWrite a function, maxlen, that takes the lengths of the two sticks (L1 and L2, both positive v...
[{"input": "5\n17", "output": "[5.666666666666667]", "fn_name": "maxlen"}, {"input": "17\n5", "output": "[5.666666666666667]", "fn_name": "maxlen"}, {"input": "7\n12", "output": "[6.0]", "fn_name": "maxlen"}, {"input": "12\n7", "output": "[6.0]", "fn_name": "maxlen"}, {"input": "5\n12", "output": "[5]", "fn_name": "max...
code_functional
[ { "content": "Problem Statement\n\nWe found a dictionary of the Ancient Civilization Mayo (ACM) during excavation of the ruins. After analysis of the dictionary, we revealed they used a language that had not more than 26 letters. So one of us mapped each letter to a different English alphabet and typed all the ...
[{"input": "4\ncba\ncab\nb\na\n3\nbca\nab\na\n5\nabc\nacb\nb\nc\nc\n5\nabc\nacc\nd\nb\nb\n0", "output": "yes\nno\nyes\nyes\n"}, {"input": "4\nbba\nbab\nc\na\n3\ncba\nba\na\n5\ncba\nacb\nb\nc\nc\n5\nabc\nacc\nd\nb\nb\n0", "output": "yes\nyes\nno\nyes\n"}, {"input": "4\naac\ncab\nb\na\n3\nbca\nca\na\n5\nabc\nacb\nb\nb\nc...
code_stdio
[ { "content": "You are given two huge binary integer numbers $a$ and $b$ of lengths $n$ and $m$ respectively. You will repeat the following process: if $b > 0$, then add to the answer the value $a~ \\&~ b$ and divide $b$ by $2$ rounding down (i.e. remove the last digit of $b$), and repeat the process again, othe...
[{"input": "5 5\n11111\n11111\n", "output": "57\n"}, {"input": "5 5\n11111\n11111\n", "output": "57\n"}, {"input": "5 5\n11111\n10111\n", "output": "42\n"}, {"input": "5 5\n11011\n11111\n", "output": "45\n"}, {"input": "5 5\n11001\n11111\n", "output": "37\n"}, {"input": "5 5\n11011\n11110\n", "output": "44\n"}, {"input...
code_stdio
[ { "content": "You are given an array $a$ consisting of $n$ integer numbers.\n\nYou have to color this array in $k$ colors in such a way that: Each element of the array should be colored in some color; For each $i$ from $1$ to $k$ there should be at least one element colored in the $i$-th color in the array; ...
[{"input": "50 20\n1 1 1 1 1 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\n", "output": "YES\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 \n"}, {"input": "...
code_stdio
[ { "content": "Given an array containing only zeros and ones, find the index of the zero that, if converted to one, will make the longest sequence of ones.\n\nFor instance, given the array:\n\n```\n[1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1]\n```\n\nreplacing the zero at index 10 (counting from 0) ...
[{"input": "[1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1]", "output": "[10]", "fn_name": "replace_zero"}, {"input": "[1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1]", "output": "[10]", "fn_name": "replace_zero"}, {"input": "[1, 1, 1, 0, 1, 1, 0, 1, 1, 1]", "output": "[6]", "fn_name": "replace_zero"}, {"input": "[1, 1,...
code_functional
[ { "content": "Tonight, in your favourite cinema they are giving the movie Joker and all seats are occupied. In the cinema there are N rows with N seats each, forming an N\\times N square. We denote with 1, 2,\\dots, N the viewers in the first row (from left to right); with N+1, \\dots, 2N the viewers in the sec...
[{"input": "6\n11 21 35 22 7 36 27 34 8 20 15 13 16 1 24 3 2 17 26 9 18 32 31 23 19 14 4 25 10 29 28 33 12 6 5 30", "output": "11"}, {"input": "4\n6 7 1 4 13 16 10 9 5 11 12 14 15 2 3 8", "output": "3"}, {"input": "3\n2 3 7 9 5 4 8 6 1", "output": "0\n"}, {"input": "3\n1 3 7 9 5 8 4 6 2", "output": "1\n"}, {"input": "3...
code_stdio
[ { "content": "Ivar the Boneless is a great leader. He is trying to capture Kattegat from Lagertha. The war has begun and wave after wave Ivar's warriors are falling in battle.\n\nIvar has $n$ warriors, he places them on a straight line in front of the main gate, in a way that the $i$-th warrior stands right aft...
[{"input": "100 55\n1 2 4 4 3 5 5 2 3 1 2 2 1 2 4 5 0 5 4 2 5 4 5 3 3 5 4 4 4 5 5 2 3 3 4 4 3 4 5 5 5 5 3 5 1 2 4 3 4 5 3 3 2 0 4 5 3 4 4 1 9 1 5 2 0 1 4 0 3 3 1 4 2 5 4 5 3 2 5 5 2 3 2 3 2 2 3 4 4 4 1 4 2 4 5 3 1 3 3 1\n5 2 1 4 3 4 3 1 4 4 1 2 0 2 1 5 5 4 5 4 2 5 2 1 5 1 4 0 1 5 4 5 1 4 4 2 5 3 0 5 4 4 0 3 3 10 4 2 4 ...
code_stdio
[ { "content": "Create your own mechanical dartboard that gives back your score based on the coordinates of your dart.\n\nTask:\n\nUse the scoring rules for a standard dartboard:\n\n\nFinish method:\n\n```python\ndef get_score(x,y):\n```\n\nThe coordinates are `(x, y)` are always relative to the center of the boa...
[{"input": "-133.69\n-147.38", "output": "[\"X\"]", "fn_name": "get_score"}, {"input": "-73.905\n-95.94", "output": "[\"7\"]", "fn_name": "get_score"}, {"input": "-145.19\n86.53", "output": "[\"D9\"]", "fn_name": "get_score"}, {"input": "-5.43\n117.95", "output": "[\"20\"]", "fn_name": "get_score"}, {"input": "55.53\n-...
code_functional
[ { "content": "Cheaterius is a famous in all the Berland astrologist, magician and wizard, and he also is a liar and a cheater. One of his latest inventions is Cheaterius' amulets! They bring luck and wealth, but are rather expensive. Cheaterius makes them himself. The technology of their making is kept secret. ...
[{"input": "7\n21\n33\n**\n33\n12\n**\n32\n31\n**\n21\n33\n**\n33\n12\n**\n32\n31\n**\n13\n23\n", "output": "1\n"}, {"input": "7\n21\n33\n**\n33\n12\n**\n32\n31\n**\n21\n38\n**\n33\n12\n**\n32\n31\n**\n13\n23\n", "output": "2\n"}, {"input": "7\n21\n33\n**\n33\n12\n**\n63\n31\n**\n25\n38\n**\n33\n12\n**\n32\n62\n**\n13\...
code_stdio
[ { "content": "Write a program of the Bubble Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:\n\n\nBubbleSort(A)\n1 for i = 0 to A.length-1\n2 for j = A.length-1 downto i+1\n3 if A[j] < A[j-1]\n4 swap A[j] and A[j-1]\n\...
[{"input": "6\n3 1 -1 2 -1 -1", "output": "-1 -1 -1 1 2 3\n10\n"}, {"input": "6\n2 1 -1 11 -1 0", "output": "-1 -1 0 1 2 11\n9\n"}, {"input": "6\n3 1 -1 4 -1 -1", "output": "-1 -1 -1 1 3 4\n9\n"}, {"input": "6\n3 2 -1 4 -1 -1", "output": "-1 -1 -1 2 3 4\n9\n"}, {"input": "6\n4 1 -1 2 -1 0", "output": "-1 -1 0 1 2 4\n10...
code_stdio
[ { "content": "It seems like the year of 2013 came only yesterday. Do you know a curious fact? The year of 2013 is the first year after the old 1987 with only distinct digits.\n\nNow you are suggested to solve the following problem: given a year number, find the minimum year number which is strictly larger than ...
[{"input": "1987\n", "output": "2013\n"}, {"input": "2013\n", "output": "2014\n"}, {"input": "1000\n", "output": "1023\n"}, {"input": "1001\n", "output": "1023\n"}, {"input": "1234\n", "output": "1235\n"}, {"input": "5555\n", "output": "5601\n"}, {"input": "9000\n", "output": "9012\n"}, {"input": "1111\n", "output": "1...
code_stdio
[ { "content": "problem\n\nIn one programming contest, it is customary to play a bingo game at a social gathering after the competition. However, the bingo card used in this bingo game is a little special and is created according to the following conditions.\n\n* The Bingo card is divided into squares of N rows a...
[{"input": "3 21 80\n3 100 60\n5 50 538\n0 0 0", "output": "3466\n157\n96557\n"}, {"input": "3 21 80\n3 100 60\n5 44 538\n0 0 0", "output": "3466\n157\n25088\n"}, {"input": "3 24 80\n3 000 69\n2 162 487\n0 1 1", "output": "4955\n0\n28431\n"}, {"input": "3 36 80\n3 000 69\n2 162 487\n0 1 1", "output": "6570\n0\n28431\n"...
code_stdio
[ { "content": "We have an analog clock whose three hands (the second hand, the minute hand and the hour hand) rotate quite smoothly. You can measure two angles between the second hand and two other hands.\n\nWrite a program to find the time at which \"No two hands overlap each other\" and \"Two angles between th...
[{"input": "12 0 0 0\n12 11 59 59\n12 1 56 0\n12 1 56 3\n12 1 56 34\n12 3 9 43\n12 3 10 14\n12 2 17 58\n12 7 18 0\n10 7 23 0\n12 7 23 31\n2 0 38 19\n2 0 39 0\n2 0 39 30\n2 1 6 14\n2 1 20 1\n2 1 20 31\n3 2 19 0\n3 2 59 30\n4 0 28 48\n5 1 5 37\n5 1 10 10\n5 1 7 41\n11 0 36 0\n0 0 0 0", "output": "0 0 43200 1427\n0 0 4320...
code_stdio
[ { "content": "Recently you've discovered a new shooter. They say it has realistic game mechanics.\n\nYour character has a gun with magazine size equal to $k$ and should exterminate $n$ waves of monsters. The $i$-th wave consists of $a_i$ monsters and happens from the $l_i$-th moment of time up to the $r_i$-th m...
[{"input": "10 79\n2 2 70\n2 10 35\n10 10 76\n11 11 66\n12 12 75\n12 14 88\n15 16 76\n17 18 97\n19 20 105\n20 20 46\n", "output": "862\n"}, {"input": "10 79\n2 2 70\n2 10 35\n10 10 76\n11 11 66\n12 12 75\n12 14 88\n15 16 76\n17 18 97\n19 20 105\n20 20 46\n", "output": "862\n"}, {"input": "10 79\n2 2 70\n2 10 35\n10 10 ...
code_stdio
[ { "content": "B: 階層的計算機 (Hierarchical Calculator)\n\nProblem\n\nEbi-chan has N formulae: y = a_i x for i =1, ..., N (inclusive). Now she considers a subsequence of indices with length k: s_1, s_2, ..., s_k. At first, let x_0 be 1 and evaluate s_1-th formulae with x = x_0. Next, let x_1 be the output of s_1 and ...
[{"input": "4\n-1 2 -2 2", "output": "4\n1\n2\n3\n4\n"}, {"input": "4\n2 -1 -2 -1", "output": "3\n1\n2\n3\n"}, {"input": "4\n2 -1 -2 1", "output": "3\n1\n2\n3\n"}, {"input": "4\n-1 -2 0 2", "output": "3\n1\n2\n4\n"}, {"input": "4\n1 2 -2 -1", "output": "3\n2\n3\n4\n"}, {"input": "4\n2 -1 -2 0", "output": "3\n1\n2\n3\n"...
code_stdio
[ { "content": "There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of t...
[{"input": "4\n7 1\n1 5 0 2 1 10 7\n1 3 6 7 2 5 4\n1 1\n1000000000\n1000001000\n5 10\n10 7 5 15 12\n38 199 192 219 1904\n10 10\n12 19 8 29 20 10 9 2 10 19\n12 4 0 17 1 15 7 18 14 3\n", "output": "4\n1\n5\n10\n"}, {"input": "4\n7 1\n1 5 0 2 1 10 7\n1 3 6 7 0 5 4\n1 1\n1000000000\n1000001000\n5 10\n10 7 5 15 12\n38 199 1...
code_stdio
[ { "content": "If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n - The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)\n - The s_i-th digit from th...
[{"input": "3 3\n1 7\n3 2\n1 7\n", "output": "702\n"}, {"input": "3 3\n3 1\n2 1\n1 4\n", "output": "411\n"}, {"input": "3 1\n1 7\n3 2\n0 28", "output": "700\n"}, {"input": "2 3\n2 0\n2 0\n2 0\n", "output": "10\n"}, {"input": "3 3\n1 14\n3 2\n1 7", "output": "-1\n"}, {"input": "3 3\n1 7\n3 4\n1 7", "output": "704\n"}, {...
code_stdio
[ { "content": "N problems are proposed for an upcoming contest. Problem i has an initial integer score of A_i points.\n\nM judges are about to vote for problems they like. Each judge will choose exactly V problems, independently from the other judges, and increase the score of each chosen problem by 1.\n\nAfter ...
[{"input": "10 14 8 5\n13 2 3 11 1 11 5 4 3 7", "output": "10\n"}, {"input": "10 14 8 5\n13 2 3 11 1 11 5 7 3 7", "output": "10\n"}, {"input": "10 14 8 5\n13 2 0 11 1 11 5 4 3 7", "output": "10\n"}, {"input": "10 14 8 9\n13 2 3 11 1 11 5 7 3 7", "output": "10\n"}, {"input": "10 14 8 5\n13 2 0 11 1 11 6 4 3 7", "output"...
code_stdio
[ { "content": "Shaass has n books. He wants to make a bookshelf for all his books. He wants the bookshelf's dimensions to be as small as possible. The thickness of the i-th book is t_{i} and its pages' width is equal to w_{i}. The thickness of each book is either 1 or 2. All books have the same page heights. $1$...
[{"input": "100\n2 2\n1 2\n1 1\n2 1\n1 2\n2 1\n2 2\n2 1\n2 1\n1 2\n1 2\n2 1\n1 2\n2 1\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 1\n2 2\n2 1\n1 1\n1 2\n2 2\n1 1\n2 2\n1 2\n2 1\n2 2\n1 2\n2 2\n1 2\n1 1\n2 2\n2 2\n1 1\n1 2\n2 2\n1 2\n1 1\n1 1\n1 1\n2 1\n2 1\n1 2\n1 2\n2 2\n1 2\n1 2\n1 1\n2 1\n2 1\n2 2\n1 2\n2 1\n1 1\n2 1\n1 2\n2 2...
code_stdio
[ { "content": "2N players are running a competitive table tennis training on N tables numbered from 1 to N.\n\nThe training consists of rounds. In each round, the players form N pairs, one pair per table. In each pair, competitors play a match against each other. As a result, one of them wins and the other one l...
[{"input": "2 -2 269", "output": "-131\n"}, {"input": "-1 2 189", "output": "-96\n"}, {"input": "11 -2 81", "output": "-28\n"}, {"input": "-1 4 189", "output": "-97\n"}, {"input": "0 4 249", "output": "-126\n"}, {"input": "0 -1 104", "output": "-51\n"}, {"input": "0 -1 172", "output": "-85\n"}, {"input": "0 0 459", "ou...
code_stdio
[ { "content": "Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≤ a ≤ b ≤ 6, there is exactly one domino with a dots on one half and b dots on the other half. The set contains exactly 21 dominoes. Here is an exact illustration of his set:\n\...
[{"input": "7 21\n3 5\n7 2\n2 3\n6 5\n5 2\n4 7\n2 6\n2 4\n6 7\n5 1\n1 4\n4 5\n5 7\n4 6\n3 1\n1 2\n3 4\n7 1\n3 7\n6 1\n3 6\n", "output": "16\n"}, {"input": "7 21\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n2 3\n2 4\n2 5\n2 6\n2 7\n3 4\n3 5\n3 6\n3 7\n4 5\n4 6\n4 7\n5 6\n5 7\n6 7\n", "output": "16\n"}, {"input": "7 20\n4 7\n1 4\n2 3\...
code_stdio
[ { "content": "Polycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example, if x = 4, and y = 7, then numbers 47, 744, 4 are lucky.\n\nLet's call a positive integer a undoubtedly...
[{"input": "1000000000\n", "output": "40744\n"}, {"input": "1000000000\n", "output": "40744\n"}, {"input": "999999999\n", "output": "40743\n"}, {"input": "999999998\n", "output": "40742\n"}, {"input": "999999997\n", "output": "40741\n"}, {"input": "909090901\n", "output": "38532\n"}, {"input": "142498040\n", "output": ...
code_stdio
[ { "content": "For a given array whose element values are randomly picked from single-digit integers `0` to `9`, return an array with the same digit order but all `0`'s paired. Paring two `0`'s generates one `0` at the location of the first.\n\nEx:\n```python\npair_zeros([0, 1, 0, 2])\n# paired: ^-----^ cull sec...
[{"input": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]", "output": "[[0, 0, 0, 0, 0, 0, 0]]", "fn_name": "pair_zeros"}, {"input": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]", "output": "[[0, 0, 0, 0, 0, 0]]", "fn_name": "pair_zeros"}, {"input": "[1, 0, 1, 0, 2, 0, 0, 3, 0]", "output": "[[1, 0, 1, 2, 0, 3, 0]]", "fn_name": "pai...
code_functional
[ { "content": "The aim of the kata is to decompose `n!` (factorial n) into its prime factors.\n\nExamples:\n```\nn = 12; decomp(12) -> \"2^10 * 3^5 * 5^2 * 7 * 11\"\nsince 12! is divisible by 2 ten times, by 3 five times, by 5 two times and by 7 and 11 only once.\n\nn = 22; decomp(22) -> \"2^19 * 3^9 * 5^4 * 7^3...
[{"input": "3989", "output": "[\"2^3981 * 3^1990 * 5^994 * 7^662 * 11^396 * 13^330 * 17^247 * 19^220 * 23^180 * 29^141 * 31^132 * 37^109 * 41^99 * 43^94 * 47^85 * 53^76 * 59^68 * 61^66 * 67^59 * 71^56 * 73^54 * 79^50 * 83^48 * 89^44 * 97^41 * 101^39 * 103^38 * 107^37 * 109^36 * 113^35 * 127^31 * 131^30 * 137^29 * 139^2...
code_functional
[ { "content": "After learning a lot about space exploration, a little girl named Ana wants to change the subject.\n\nAna is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to check for a given string whether it's a palindrome or not, but soon she grew tir...
[{"input": "20\niw\nix\nudb\nbg\noi\nuo\njsm\num\ns\nquy\nqo\nbxct\nng\nrmr\nnu\nps\nio\nkh\nw\nk\n", "output": "5\n"}, {"input": "20\niw\nix\nudb\nbg\noi\nuo\njsm\num\ns\nquy\nqo\nbxct\nng\nrmr\nnu\nps\nio\nkh\nw\nk\n", "output": "5\n"}, {"input": "20\nhw\nix\nudb\nbg\noi\nuo\njsm\num\ns\nquy\nqo\nbxct\nng\nrmr\nnu\np...
code_stdio
[ { "content": "In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 × 8): Anna is in the upper right corner, and Maria is in the lower left one. Apart from them, the board has several statues. Each statue occupies exactly one square. ...
[{"input": "S..SSS.A\nS.S.SSSS\nSSSSSSSS\n...SS...\nS.SSSSSS\nSS..SS.S\nSS..S.S.\nMSS..SSS\n", "output": "LOSE\n"}, {"input": ".SSSSSSA\n.SSSSSSS\n.SSSSSSS\n.SSSSSSS\n.SSSSSSS\n.SSSSSSS\nSSSSSSS.\nMSSSSSSS\n", "output": "LOSE\n"}, {"input": ".SSSS.SA\n.SS.SSS.\n..S.SS..\nSSSS.SS.\nS.S.....\nS.S.SSSS\nS..SS..S\nMS.SS.TS...
code_stdio
[ { "content": "++++++++[>+>++>+++>++++>+++++>++++++>+++++++>++++++++>+++++++++>++++++++++>+\n++++++++++>++++++++++++>+++++++++++++>++++++++++++++>+++++++++++++++>+++++++\n+++++++++<<<<<<<<<<<<<<<<-]>>>>>>>>>>.<<<<<<<<<<>>>>>>>>>>>>>>++.--<<<<<<<<<\n<<<<<>>>>>>>>>>>>>+.-<<<<<<<<<<<<<>>>>>>>>>>>>>>--.++<<<<<<<<<<<...
[{"input": "1000000\n", "output": "2\n"}, {"input": "1000000\n", "output": "2\n"}, {"input": "1000010\n", "output": "3\n"}, {"input": "1229030\n", "output": "0\n"}, {"input": "1000011\n", "output": "3\n"}, {"input": "1160745\n", "output": "1\n"}, {"input": "1100011\n", "output": "1\n"}, {"input": "1333299\n", "output":...
code_stdio
[ { "content": "Inna likes sweets and a game called the \"Candy Matrix\". Today, she came up with the new game \"Candy Matrix 2: Reload\".\n\nThe field for the new game is a rectangle table of size n × m. Each line of the table contains one cell with a dwarf figurine, one cell with a candy, the other cells of the...
[{"input": "10 10\nG********S\n*G*******S\n**G******S\n***G*****S\n****G****S\nS***G*****\n******G**S\n*******G*S\n********GS\nG********S\n", "output": "-1\n"}, {"input": "10 10\nG********S\n*G*******S\n**G******S\n***G*****S\n****S****G\nS***G*****\n******G**S\n*******G*S\n********GS\nG********S\n", "output": "-1\n"},...
code_stdio
[ { "content": "You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.\n\n\n-----Input-----\n\nThe ...
[{"input": "101 298\n", "output": "10000000000000000000000000000000000000000000000000000000000000000000999999999999999999999999999999999 99999999999999999999999999999999910000000000000000000000000000000000000000000000000000000000000000000\n"}, {"input": "101 299\n", "output": "100000000000000000000000000000000000000000...
code_stdio
[ { "content": "Vanya loves playing. He even has a special set of cards to play with. Each card has a single integer. The number on the card can be positive, negative and can even be equal to zero. The only limit is, the number on each card doesn't exceed x in the absolute value.\n\nNatasha doesn't like when Vany...
[{"input": "123 222\n44 -190 -188 -185 -55 17 190 176 157 176 -24 -113 -54 -61 -53 53 -77 68 -12 -114 -217 163 -122 37 -37 20 -108 17 -140 -210 218 19 -89 54 18 197 111 -150 -36 -131 -172 36 67 16 -202 72 169 -137 -34 -122 137 -72 196 -17 -104 180 -102 96 -69 -184 21 -15 217 -61 175 -221 62 173 -93 -106 122 -135 58 7 -...
code_stdio
[ { "content": "Consider the infinite sequence $s$ of positive integers, created by repeating the following steps:\n\n Find the lexicographically smallest triple of positive integers $(a, b, c)$ such that $a \\oplus b \\oplus c = 0$, where $\\oplus$ denotes the bitwise XOR operation. $a$, $b$, $c$ are not in ...
[{"input": "9\n2\n3\n3\n12\n13\n6\n7\n11\n9\n", "output": "2\n3\n3\n13\n7\n12\n5\n11\n15\n"}, {"input": "9\n2\n3\n3\n12\n10\n6\n3\n22\n6\n", "output": "2\n3\n3\n13\n6\n12\n3\n18\n12\n"}, {"input": "9\n1\n5\n3\n4\n18\n6\n12\n8\n9\n", "output": "1\n8\n3\n4\n48\n12\n13\n10\n15\n"}, {"input": "9\n1\n3\n3\n12\n10\n6\n3\n14\...
code_stdio
[ { "content": "Given is a permutation P of \\{1, 2, \\ldots, N\\}.\nFor a pair (L, R) (1 \\le L \\lt R \\le N), let X_{L, R} be the second largest value among P_L, P_{L+1}, \\ldots, P_R.\nFind \\displaystyle \\sum_{L=1}^{N-1} \\sum_{R=L+1}^{N} X_{L,R}.\n\n-----Constraints-----\n - 2 \\le N \\le 10^5 \n - 1 \\l...
[{"input": "95\n41 7 46 26 89 2 78 92 8 16 45 57 17 6 35 62 91 95 63 48 19 79 74 52 1 77 28 93 56 31 25 54 40 64 9 34 53 11 10 55 94 24 67 58 27 60 90 87 18 73 50 80 20 21 61 42 88 14 44 76 39 70 51 66 83 32 30 81 23 82 72 65 15 68 75 71 69 13 4 3 85 84 49 59 22 33 5 47 12 37 29 36 38 86 43\n", "output": "380173\n"}, {...
code_stdio
[ { "content": "You are provided with array of positive non-zero ints and int n representing n-th power (n >= 2).\n\nFor the given array, calculate the sum of each value to the n-th power. Then subtract the sum of the original array.\n\nExample 1: Input: {1, 2, 3}, 3 --> (1 ^ 3 + 2 ^ 3 + 3 ^ 3 ) - (1 + 2 + 3) -->...
[{"input": "[1, 2, 3, 4, 5]\n3", "output": "[210]", "fn_name": "modified_sum"}, {"input": "[2, 4, 6, 8]\n6", "output": "[312940]", "fn_name": "modified_sum"}, {"input": "[2, 7, 13, 17]\n2", "output": "[472]", "fn_name": "modified_sum"}, {"input": "[3, 6, 9, 12]\n3", "output": "[2670]", "fn_name": "modified_sum"}, {"inp...
code_functional
[ { "content": "Vadim loves decorating the Christmas tree, so he got a beautiful garland as a present. It consists of $n$ light bulbs in a single row. Each bulb has a number from $1$ to $n$ (in arbitrary order), such that all the numbers are distinct. While Vadim was solving problems, his home Carp removed some l...
[{"input": "100\n87 32 53 24 60 2 44 15 45 29 69 10 7 95 61 91 86 51 1 30 58 67 49 50 88 23 82 39 14 66 6 19 96 13 12 33 54 41 43 72 21 34 28 59 75 85 65 94 90 80 83 38 62 46 78 81 92 31 35 3 73 4 5 79 98 40 48 8 47 99 20 89 36 77 9 68 11 93 18 100 37 25 22 76 64 55 52 26 71 84 70 97 17 16 74 56 27 42 57 63\n", "output...
code_stdio
[ { "content": "Bob is decorating his kitchen, more precisely, the floor. He has found a prime candidate for the tiles he will use. They come in a simple form factor — a square tile that is diagonally split into white and black part as depicted in the figure below. [Image] \n\nThe dimension of this tile is perfec...
[{"input": "1000 1000\n", "output": "708964705\n"}, {"input": "1000 1000\n", "output": "708964705\n"}, {"input": "1000 1001\n", "output": "419685057\n"}, {"input": "1000 122\n", "output": "712990290\n"}, {"input": "1000 122\n", "output": "712990290\n"}, {"input": "1000 0001\n", "output": "46452554\n"}, {"input": "432 3...
code_stdio
[ { "content": "You are given an angle $\\text{ang}$. \n\nThe Jury asks You to find such regular $n$-gon (regular polygon with $n$ vertices) that it has three vertices $a$, $b$ and $c$ (they can be non-consecutive) with $\\angle{abc} = \\text{ang}$ or report that there is no such $n$-gon. [Image] \n\nIf there are...
[{"input": "69\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n", "output": "180\n180\n180\n180\n180\n180\n180\n180\n180\n180\n180\n180\n180\n180\n180\n180\n180...
code_stdio
[ { "content": "There are 2000001 stones placed on a number line. The coordinates of these stones are -1000000, -999999, -999998, \\ldots, 999999, 1000000.\nAmong them, some K consecutive stones are painted black, and the others are painted white.\nAdditionally, we know that the stone at coordinate X is painted b...
[{"input": "100 100\n", "output": "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 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 97 98 ...
code_stdio
[ { "content": "You are given a sequence of n integers S and a sequence of different q integers T. Write a program which outputs C, the number of integers in T which are also in the set S.\n\nNotes\n\nConstraints\n\n* Elements in S is sorted in ascending order\n* n ≤ 100000\n* q ≤ 50000\n* 0 ≤ an element in S ≤ 1...
[{"input": "5\n-1 -3 -1 4 0\n4\n1 2", "output": "0\n"}, {"input": "5\n-1 -3 -1 4 1\n4\n1 2", "output": "1\n"}, {"input": "5\n-1 -3 -1 4 0\n5\n1 2", "output": "0\n"}, {"input": "5\n-1 -3 -1 4 0\n5\n2 2", "output": "0\n"}, {"input": "5\n-2 -3 -1 4 0\n5\n2 2", "output": "0\n"}, {"input": "5\n1 2 3 4 1\n5\n2 4 1", "output"...
code_stdio
[ { "content": "Help a fruit packer sort out the bad apples. \n\nThere are 7 varieties of apples, all packaged as pairs and stacked in a fruit box. Some of the apples are spoiled. The fruit packer will have to make sure the spoiled apples are either removed from the fruit box or replaced. Below is the breakdown:\...
[{"input": "[[3, 1], [0, 0], [4, 3], [2, 5], [1, 7], [6, 3], [7, 4], [5, 7], [7, 1], [4, 4], [1, 3], [2, 2], [6, 7], [2, 1], [3, 3]]", "output": "[[[3, 1], [4, 3], [2, 5], [1, 7], [6, 3], [7, 4], [5, 7], [7, 1], [4, 4], [1, 3], [2, 2], [6, 7], [2, 1], [3, 3]]]", "fn_name": "bad_apples"}, {"input": "[[0, 1], [7, 7], [7,...
code_functional
[ { "content": "You are given a string $s$ of even length $n$. String $s$ is binary, in other words, consists only of 0's and 1's.\n\nString $s$ has exactly $\\frac{n}{2}$ zeroes and $\\frac{n}{2}$ ones ($n$ is even).\n\nIn one operation you can reverse any substring of $s$. A substring of a string is a contiguou...
[{"input": "3\n2\n10\n4\n0110\n8\n11101000\n", "output": "0\n1\n2\n"}, {"input": "3\n2\n10\n4\n0110\n8\n11100001\n", "output": "0\n1\n3\n"}, {"input": "3\n2\n10\n4\n1010\n8\n11101000\n", "output": "0\n0\n2\n"}, {"input": "3\n2\n10\n4\n0011\n8\n11101000\n", "output": "0\n1\n2\n"}, {"input": "3\n2\n10\n4\n0101\n8\n111000...
code_stdio
[ { "content": "You are given two positive integers A and B. Compare the magnitudes of these numbers.\n\n-----Constraints-----\n - 1 ≤ A, B ≤ 10^{100}\n - Neither A nor B begins with a 0.\n\n-----Input-----\nInput is given from Standard Input in the following format:\nA\nB\n\n-----Output-----\nPrint GREATER if A>...
[{"input": "123456789012345678901234567890\n54295952540662239241952312402", "output": "GREATER\n"}, {"input": "123456789012345678901234567890\n67478580391614097833417622355", "output": "GREATER\n"}, {"input": "123456789012345678901234567890\n12740860331988085550751547536", "output": "GREATER\n"}, {"input": "12345678901...
code_stdio
[ { "content": "Create a function that takes a number as an argument and returns a grade based on that number.\n\nScore | Grade\n-----------------------------------------|-----\nAnything greater than 1 or less than 0.6 | \"F\"\n0.9 or greater | \"A\"\n0...
[{"input": "1.01", "output": "[\"F\"]", "fn_name": "grader"}, {"input": "0.2", "output": "[\"F\"]", "fn_name": "grader"}, {"input": "0.7", "output": "[\"C\"]", "fn_name": "grader"}, {"input": "0.8", "output": "[\"B\"]", "fn_name": "grader"}, {"input": "0.9", "output": "[\"A\"]", "fn_name": "grader"}, {"input": "0.6", "...
code_functional
[ { "content": "Jeff got 2n real numbers a_1, a_2, ..., a_2n as a birthday present. The boy hates non-integer numbers, so he decided to slightly \"adjust\" the numbers he's got. Namely, Jeff consecutively executes n operations, each of them goes as follows: choose indexes i and j (i ≠ j) that haven't been chosen...
[{"input": "10\n8003.867 4368.000 2243.000 3340.287 5384.000 1036.456 3506.000 4463.000 1477.000 2420.314 9391.000 1696.000 5857.833 244.000 8220.000 5879.000 5424.482 2631.197 7111.000 9157.536\n", "output": "0.028\n"}, {"input": "10\n8003.867 4368.000 2243.298 3340.000 5384.489 1036.000 3506.115 4463.317 1477.000 242...
code_stdio
[ { "content": "We've got no test cases. A big olympiad is coming up. But the problemsetters' number one priority should be adding another problem to the round. \n\nThe diameter of a multiset of points on the line is the largest distance between two points from this set. For example, the diameter of the multiset ...
[{"input": "100 100\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100...
code_stdio
[ { "content": "\"The zombies are lurking outside. Waiting. Moaning. And when they come...\"\n\n\"When they come?\"\n\n\"I hope the Wall is high enough.\"\n\nZombie attacks have hit the Wall, our line of defense in the North. Its protection is failing, and cracks are showing. In places, gaps have appeared, splitt...
[{"input": "10 7\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n...B...\nB.BB.B.\n", "output": "3\n"}, {"input": "10 7\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n...-...\n...B...\nB.BB.B.\n", "output": "3\n"}, {"input": "10 7\n.......\n.......\n.......\n.......\n.......\n....
code_stdio
[ { "content": "Kevin and Nicky Sun have invented a new game called Lieges of Legendre. In this game, two players take turns modifying the game state with Kevin moving first. Initially, the game is set up so that there are n piles of cows, with the i-th pile containing a_{i} cows. During each player's turn, that ...
[{"input": "10 2\n3 10 10 8 11 10 9 9 5 7\n", "output": "Nicky\n"}, {"input": "10 2\n3 12 10 8 11 10 9 9 5 7\n", "output": "Nicky\n"}, {"input": "10 2\n3 10 10 8 6 10 9 9 5 7\n", "output": "Kevin\n"}, {"input": "10 2\n3 10 10 8 6 10 9 9 5 7\n", "output": "Kevin\n"}, {"input": "10 2\n3 12 10 8 11 2 9 9 5 7\n", "output":...
code_stdio
[ { "content": "Complete the function that returns an array of length `n`, starting with the given number `x` and the squares of the previous number. If `n` is negative or zero, return an empty array/list.\n\n## Examples\n\n```\n2, 5 --> [2, 4, 16, 256, 65536]\n3, 3 --> [3, 9, 81]\n```\n\nWrite Python code to...
[{"input": "10\n4", "output": "[[10, 100, 10000, 100000000]]", "fn_name": "squares"}, {"input": "2\n5", "output": "[[2, 4, 16, 256, 65536]]", "fn_name": "squares"}, {"input": "5\n3", "output": "[[5, 25, 625]]", "fn_name": "squares"}, {"input": "3\n3", "output": "[[3, 9, 81]]", "fn_name": "squares"}, {"input": "2\n-4", ...
code_functional
[ { "content": "Carousel Boutique is busy again! Rarity has decided to visit the pony ball and she surely needs a new dress, because going out in the same dress several times is a sign of bad manners. First of all, she needs a dress pattern, which she is going to cut out from the rectangular piece of the multicol...
[{"input": "5 5\nzbacg\nbaaac\naaaaa\neaaad\nweadd\n", "output": "31\n"}, {"input": "5 5\nzbacg\nbaaac\naaaaa\ndaaae\nweadd\n", "output": "31\n"}, {"input": "5 5\nzbacf\nbcaaa\naaaaa\neaaad\nveadd\n", "output": "28\n"}, {"input": "5 5\nabzcg\nbaaac\naaaaa\neaabd\nwdaed\n", "output": "27\n"}, {"input": "5 5\nzbcaf\nbcaa...
code_stdio
[ { "content": "Greg has a weighed directed graph, consisting of n vertices. In this graph any pair of distinct vertices has an edge between them in both directions. Greg loves playing with the graph and now he has invented a new game: The game consists of n steps. On the i-th step Greg removes vertex number x_...
[{"input": "9\n0 85236 27579 82251 69479 24737 87917 15149 52311\n59640 0 74687 34711 3685 30121 4961 7552 83399\n33376 68733 0 81357 18042 74297 15466 29476 5865\n7493 5601 3321 0 20263 55901 58229 55361 87633\n26751 17161 76681 58775 0 39745 50717 56887 90055\n18885 76353 47089 43601 21561 0 60571 33551 53753\n103347...
code_stdio
[ { "content": "Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that many seats there are already occupied. Today you and your friends went for class, and found out that some of the seats were occupied.\n\nThe classroom c...
[{"input": "5 5 3\n.....\n.....\n*...*\n*....\n.*...\n", "output": "18\n"}, {"input": "5 5 3\n.....\n.....\n*...*\n*....\n.*...\n", "output": "18\n"}, {"input": "5 5 3\n.....\n.....\n*...*\n*....\n...*.\n", "output": "18\n"}, {"input": "5 5 3\n.....\n.....\n*...*\n....*\n...*.\n", "output": "18\n"}, {"input": "5 5 3\n....
code_stdio
[ { "content": "The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.\n\nThe security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is de...
[{"input": "20\n384933 946658 407136 242739 -242739 -407136 -946658 -384933 384933 -384933 319281 407136 804861 -407136 415987 946658 -946658 -415987 -804861 -319281\n", "output": "3\n8 2 10 \n"}, {"input": "20\n384933 946658 407136 242739 -242739 -407136 -946658 -384933 384933 -384933 319281 407136 804861 -407136 4159...
code_stdio
[ { "content": "Books are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers.\n\nYou can assume that a word consists of at most 30 characters, and the page number is less than or equal to 1000. The number of pairs of a...
[{"input": "ntzsd 22\neevn 1\nnutrodnctioi -1\nse_z 1\nstyle 32\ntndmucod 2\nstyld 10\nmuee -2", "output": "eevn\n1\nmuee\n-2\nntzsd\n22\nnutrodnctioi\n-1\nse_z\n1\nstyld\n10\nstyle\n32\ntndmucod\n2\n"}, {"input": "ntzsd 10\neevn 1\nnutrodnctioi -1\nse_z 1\nstyle 32\ntndmucod 2\nstyld 10\nmuee -2", "output": "eevn\n1\n...
code_stdio
[ { "content": "A country has a budget of more than 81 trillion yen. We want to process such data, but conventional integer type which uses signed 32 bit can represent up to 2,147,483,647.\n\nYour task is to write a program which reads two integers (more than or equal to zero), and prints a sum of these integers....
[{"input": "6\n1001\n1277\n9999999999999999999999999999999999999999\n8\n406457296153147731569431812193957336633213953097465104312094248394524915238944551\n-2\n65979473807971894016634449726827689065678029413262970240066900026271391930713716\n5\n1010000000001000000000000000000000000000000000000000000000010000000000000000...
code_stdio
[ { "content": "Barney is standing in a bar and starring at a pretty girl. He wants to shoot her with his heart arrow but he needs to know the distance between him and the girl to make his shot accurate. [Image] \n\nBarney asked the bar tender Carl about this distance value, but Carl was so busy talking to the cu...
[{"input": "2.0629094807595491132306264747042243928486303384791951220362096240931158821630792563855724946791054152e85\n", "output": "20629094807595491132306264747042243928486303384791951220362096240931158821630792563855.724946791054152\n"}, {"input": "1.739019376653594888733439697327057664160248690309535536328717793279...
code_stdio
[ { "content": "There is a square of size $10^6 \\times 10^6$ on the coordinate plane with four points $(0, 0)$, $(0, 10^6)$, $(10^6, 0)$, and $(10^6, 10^6)$ as its vertices.\n\nYou are going to draw segments on the plane. All segments are either horizontal or vertical and intersect with at least one side of the ...
[{"input": "3 3\n2 3 1000000\n4 0 4\n3 0 1000000\n4 0 1\n2 0 5\n3 2 1000000\n", "output": "7\n"}, {"input": "3 3\n2 3 1000000\n7 0 4\n3 0 1000000\n4 0 1\n2 0 5\n3 2 1000000\n", "output": "6\n"}, {"input": "3 3\n2 3 1000000\n4 0 4\n3 0 1000000\n4 0 1\n2 0 5\n3 1 1000000\n", "output": "7\n"}, {"input": "3 3\n2 3 1000000\...
code_stdio
[ { "content": "Kurohashi has never participated in AtCoder Beginner Contest (ABC).\nThe next ABC to be held is ABC N (the N-th ABC ever held).\nKurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same.\nWhat is the earliest ABC where Kurohashi can make his debut?\n\n...
[{"input": "111\n", "output": "111\n"}, {"input": "112\n", "output": "222\n"}, {"input": "750\n", "output": "777\n"}, {"input": "234\n", "output": "333\n"}, {"input": "999\n", "output": "999\n"}, {"input": "626\n", "output": "666\n"}, {"input": "555\n", "output": "555\n"}, {"input": "554\n", "output": "555\n"}, {"input...
code_stdio
[ { "content": "You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.\n\nA subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this subarray strictly greater than previous.\n\n...
[{"input": "10\n32372808 517917901 640274071 1836610331 71867556 96204862 120140751 446173607 796619138 1156360703\n", "output": "6\n"}, {"input": "10\n32372808 517917901 156515250 1836610331 71867556 96204862 120140751 446173607 796619138 1156360703\n", "output": "6\n"}, {"input": "10\n802030518 598196518 640274071 98...
code_stdio
[ { "content": "You are given an array $a$ of length $2^n$. You should process $q$ queries on it. Each query has one of the following $4$ types: $Replace(x, k)$ — change $a_x$ to $k$; $Reverse(k)$ — reverse each subarray $[(i-1) \\cdot 2^k+1, i \\cdot 2^k]$ for all $i$ ($i \\ge 1$); $Swap(k)$ — swap subarrays...
[{"input": "3 8\n7 0 3 15 7 1 5 2\n4 3 7\n2 1\n3 2\n4 1 6\n2 3\n1 5 16\n4 8 8\n3 0\n", "output": "31\n22\n1\n"}, {"input": "3 8\n7 0 8 8 7 1 5 2\n4 3 7\n2 1\n3 2\n4 1 6\n2 3\n1 5 16\n4 8 8\n3 0\n", "output": "29\n22\n1\n"}, {"input": "3 8\n4 0 8 8 7 1 5 2\n4 3 7\n2 1\n3 2\n4 1 6\n2 3\n1 5 16\n4 8 8\n3 0\n", "output": "...
code_stdio
[ { "content": "Reforms continue entering Berland. For example, during yesterday sitting the Berland Parliament approved as much as n laws (each law has been assigned a unique number from 1 to n). Today all these laws were put on the table of the President of Berland, G.W. Boosch, to be signed.\n\nThis time mr. B...
[{"input": "98 24\n52 20 12 75 44 22 22 25 28 100 8 41 31 47 95 87 5 54 7 49 32 46 42 37 45 22 29 11 54 98 46 94 10 47 114 2 15 108 17 82 46 22 32 62 89 37 30 26 92 77 69 11 59 78 24 66 88 10 32 93 46 14 57 20 5 69 53 99 81 94 67 22 54 31 49 52 46 51 49 4 53 31 4 66 28 38 103 5 40 75 15 52 87 16 68 6 36 98\n", "output"...
code_stdio
[ { "content": "One tradition of welcoming the New Year is launching fireworks into the sky. Usually a launched firework flies vertically upward for some period of time, then explodes, splitting into several parts flying in different directions. Sometimes those parts also explode after some period of time, splitt...
[{"input": "30\n1 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\n", "output": "43348\n"}, {"input": "30\n5 5 1 1 4 4 3 1 5 3 5 5 1 2 2 3 4 5 2 1 4 3 1 1 4 5 4 4 2 2\n", "output": "24339\n"}, {"input": "30\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\n", "output": "10479\n"}, {"input": "30\n4...
code_stdio
[ { "content": "The new \"Avengers\" movie has just been released! There are a lot of people at the cinema box office standing in a huge line. Each of them has a single `100`, `50` or `25` dollar bill. An \"Avengers\" ticket costs `25 dollars`.\n\nVasya is currently working as a clerk. He wants to sell a ticket t...
[{"input": "[25, 50, 25, 100, 25, 25, 50, 100, 25, 25, 25, 100, 25, 25, 50, 100, 25, 50, 25, 100, 25, 50, 50, 50]", "output": "[\"NO\"]", "fn_name": "tickets"}, {"input": "[25, 25, 25, 100, 25, 25, 25, 100, 25, 25, 50, 100, 25, 25, 50, 100, 50, 50]", "output": "[\"NO\"]", "fn_name": "tickets"}, {"input": "[25, 25, 25, ...
code_functional
[ { "content": "You are given a non-empty string s consisting of lowercase letters. Find the number of pairs of non-overlapping palindromic substrings of this string.\n\nIn a more formal way, you have to find the quantity of tuples (a, b, x, y) such that 1 ≤ a ≤ b < x ≤ y ≤ |s| and substrings s[a... b], s[x... y]...
[{"input": "bababbababbabbababbababbabbababbabbababbababbabbababbababbabbababbabbababbababbabbababbabbababbababbabbababbababbabbababbabbababbababbabbababbababbabbababbabbababbababbabbababbabbababbababbabbababbababbabbababbabbababbababbabbababbabbababbababbabbababbababbabbababbabbababbababbabbababbababbabbababbabbababba...
code_stdio
[ { "content": "Coming up with a new problem isn't as easy as many people think. Sometimes it is hard enough to name it. We'll consider a title original if it doesn't occur as a substring in any titles of recent Codeforces problems. \n\nYou've got the titles of n last problems — the strings, consisting of lowerca...
[{"input": "30\nwaiphwcqrrinr\no\nqiqehzmgsjdoqd\nkjexeesevrlowxhghq\njudikhzkj\nz\nxo\nlsdzypkfqro\nsshgcxsky\ngecntpcmoojfwp\nsvmytmcfhc\njrsrvsvbaiumlmkptn\ns\nwpcsovfjlyspviflk\nktvyzvddgllht\nszahigtmklglrcocbo\nznligfxkgxzkcfeu\nliryvzmqwhr\nxgrxkgiehxztv\netrjxdczppafly\njrdgajschhwsci\ndoxnxbjwptnimjmsuijx\nzci...
code_stdio
[ { "content": "Flash has invited his nemesis The Turtle (He actually was a real villain! ) to play his favourite card game, SNAP. In this game a 52 card deck is dealt out so both Flash and the Turtle get 26 random cards. \n\nEach players cards will be represented by an array like below\n\nFlash’s pile:\n```[ 'A'...
[{"input": "[\"3\", \"K\", \"5\", \"A\", \"5\", \"6\", \"7\", \"J\", \"7\", \"9\", \"10\", \"Q\", \"Q\", \"6\", \"8\", \"7\", \"4\", \"J\", \"8\", \"9\", \"K\", \"J\", \"10\", \"4\", \"K\", \"4\"]\n[\"2\", \"8\", \"9\", \"Q\", \"A\", \"K\", \"6\", \"3\", \"J\", \"2\", \"4\", \"3\", \"3\", \"8\", \"A\", \"2\", \"6\", \"...
code_functional
[ { "content": "$n$ players are playing a game.\n\nThere are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map.\n\nYou are the g...
[{"input": "1\n10\n1109412863 911871372 379798020 844017253 852316352 439889133 601615010 999121621 343144247 662484047\n148682006 868690703 149843110 1652026160 587798634 40092006 292693207 256527822 128794711 765771574\n", "output": "1111111111\n"}, {"input": "1\n10\n617560334 1490885171 379798020 844017253 852316352...
code_stdio
[ { "content": "Snuke loves working out. He is now exercising N times.\nBefore he starts exercising, his power is 1. After he exercises for the i-th time, his power gets multiplied by i.\nFind Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7.\n\n-...
[{"input": "100000\n", "output": "457992974\n"}, {"input": "100001", "output": "755072381\n"}, {"input": "110001", "output": "817497558\n"}, {"input": "110011", "output": "422312314\n"}, {"input": "101001", "output": "249638241\n"}, {"input": "110000", "output": "559938709\n"}, {"input": "111011", "output": "864631379\...
code_stdio
[ { "content": "Masha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives on the floor $x$, Egor on the floor $y$ (not on the same floor with Masha).\n\nThe house has a staircase...
[{"input": "1000 999 1000 1000 1000 1000\n", "output": "NO\n"}, {"input": "1000 999 1100 1000 1000 1000\n", "output": "NO\n"}, {"input": "1000 999 1000 1000 1000 1000\n", "output": "NO"}, {"input": "188 288 112 595 331 414\n", "output": "YES\n"}, {"input": "837 544 703 808 549 694\n", "output": "YES\n"}, {"input": "723...
code_stdio
[ { "content": "Lunar New Year is approaching, and Bob is struggling with his homework – a number division problem.\n\nThere are $n$ positive integers $a_1, a_2, \\ldots, a_n$ on Bob's homework paper, where $n$ is always an even number. Bob is asked to divide those numbers into groups, where each group must conta...
[{"input": "100\n28 27 23 6 23 11 25 20 28 15 29 23 20 2 8 24 8 9 30 8 8 1 11 7 6 17 17 27 26 30 12 22 17 22 9 25 4 26 9 26 10 30 13 4 16 12 23 19 10 22 12 20 3 16 10 4 29 11 15 4 5 7 29 16 3 1 7 16 26 14 28 1 15 19 30 28 5 22 14 28 13 12 11 30 3 4 7 10 22 8 4 10 22 12 17 27 23 11 18 7\n", "output": "48573\n"}, {"input...
code_stdio
[ { "content": "Imagine you have an infinite 2D plane with Cartesian coordinate system. Some of the integral points are blocked, and others are not. Two integral points A and B on the plane are 4-connected if and only if: the Euclidean distance between A and B is one unit and neither A nor B is blocked; or ther...
[{"input": "30426905\n", "output": "172120564\n"}, {"input": "38450759\n", "output": "217510336\n"}, {"input": "19863843\n", "output": "112366864\n"}, {"input": "24562258\n", "output": "138945112\n"}, {"input": "24483528\n", "output": "138499748\n"}, {"input": "25329968\n", "output": "143287936\n"}, {"input": "31975828...
code_stdio
[ { "content": "You are given two strings $s$ and $t$ consisting of lowercase Latin letters. Also you have a string $z$ which is initially empty. You want string $z$ to be equal to string $t$. You can perform the following operation to achieve this: append any subsequence of $s$ at the end of string $z$. A subseq...
[{"input": "11\nb\naaaaaaaaaaa\ncba\nabcabcabcabcabcabcabc\nbvdhsdvlbelrivbhxbhie\ny\nabacabadabacaba\nabacabadabacaba\nabacabadabacaba\nbaabaabdaa\nabbab\nbabaabaabcbabaaa\nt\nz\nu\nt\nkiihgfedcba\nabccefghijk\nabcdefghijk\nkjihgfdecba\nbba\nabaabbbb\n", "output": "-1\n15\n-1\n1\n2\n-1\n-1\n-1\n-1\n10\n5\n"}, {"input"...
code_stdio
[ { "content": "Two bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules.\n\nThe game is played on the following field. [Image] \n\nPlayers are making moves by turns. At first move a player can put his ...
[{"input": "... ... ...\n... ... ...\n... ... ...\n\n... ... ...\n... ... ...\n... x.. ...\n\n... ... ...\n... ... ...\n... ... ...\n6 4\n", "output": "... ... ... \n... ... ... \n... ... ... \n\n... ... ... \n... ... ... \n... x.. ... \n\n!!! ... ... \n!!! ... ... \n!!! ... ... \n\n"}, {"input": "xoo x.. x..\nooo ... ...
code_stdio
[ { "content": "Given a string `S` and a character `C`, return an array of integers representing the shortest distance from the current character in `S` to `C`.\n\n### Notes\n\n* All letters will be lowercase.\n* If the string is empty, return an empty array.\n* If the character is not present, return an empty ar...
[{"input": "\"lovecodewars\"\n\"e\"", "output": "[[3, 2, 1, 0, 1, 2, 1, 0, 1, 2, 3, 4]]", "fn_name": "shortest_to_char"}, {"input": "\"aabbaabb\"\n\"a\"", "output": "[[0, 0, 1, 1, 0, 0, 1, 2]]", "fn_name": "shortest_to_char"}, {"input": "\"aaaabbbb\"\n\"b\"", "output": "[[4, 3, 2, 1, 0, 0, 0, 0]]", "fn_name": "shortest...
code_functional
[ { "content": "We have a bingo card with a 3\\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.\nThe MC will choose N numbers, b_1, b_2, \\cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet.\nDetermine w...
[{"input": "60 88 34\n92 41 43\n65 73 48\n10\n60\n43\n88\n11\n48\n73\n65\n41\n92\n34\n", "output": "Yes\n"}, {"input": "60 106 34\n92 41 43\n39 73 48\n10\n60\n43\n88\n11\n48\n73\n65\n41\n92\n34", "output": "Yes\n"}, {"input": "60 88 34\n92 41 43\n39 73 48\n10\n60\n43\n88\n11\n48\n73\n65\n41\n92\n34", "output": "Yes\n"}...
code_stdio
[ { "content": "Iroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K.\n\nShe is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change).\n\nHowever, as ment...
[{"input": "1001 8\n1 0 4 5 6 7 15 11", "output": "2222\n"}, {"input": "1001 8\n1 3 2 5 6 7 15 9", "output": "4000\n"}, {"input": "1001 8\n1 3 4 5 6 7 8 9", "output": "2000\n"}, {"input": "1000 8\n2 3 4 5 6 7 8 9", "output": "1000\n"}, {"input": "1001 8\n1 3 4 5 6 7 8 2", "output": "9000\n"}, {"input": "1000 8\n1 3 4 5...
code_stdio
[ { "content": "Everyone knows that long ago on the territory of present-day Berland there lived Bindian tribes. Their capital was surrounded by n hills, forming a circle. On each hill there was a watchman, who watched the neighbourhood day and night.\n\nIn case of any danger the watchman could make a fire on the...
[{"input": "10\n8097 8097 8097 14160 8097 8097 8097 8097 8097 8097\n", "output": "45\n"}, {"input": "10\n8097 8097 8097 14160 8097 8097 8097 8097 8097 4894\n", "output": "38\n"}, {"input": "10\n8097 8097 8097 14160 8097 8097 8097 8097 9062 4894\n", "output": "26\n"}, {"input": "10\n8097 8097 8097 14160 8097 5098 8097 8...
code_stdio
[ { "content": "Tanya wants to go on a journey across the cities of Berland. There are n cities situated along the main railroad line of Berland, and these cities are numbered from 1 to n. \n\nTanya plans her journey as follows. First of all, she will choose some city c_1 to start her journey. She will visit it, ...
[{"input": "10\n10 60 12 13 14 15 16 66 18 130\n", "output": "130\n"}, {"input": "10\n10 60 12 13 14 15 16 77 18 130\n", "output": "130\n"}, {"input": "9\n18 11 24 7 18 10 1 20 17\n", "output": "24\n"}, {"input": "9\n4 10 21 7 23 9 15 11 12\n", "output": "44\n"}, {"input": "9\n4 10 21 7 22 9 15 11 12\n", "output": "43\...
code_stdio
[ { "content": "Problem\n\nN idols, numbered from 1 to n in order, are lined up in a row.\nIdle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.\n\nAt time 0, m idols with numbers a1...
[{"input": "39 5\n0 6 10 8 10", "output": "29\n"}, {"input": "27 5\n4 6 6 8 10", "output": "17\n"}, {"input": "39 5\n0 6 7 4 13", "output": "26\n"}, {"input": "10 3\n4 5 6 13 10", "output": "4\n"}, {"input": "100001 1\n1", "output": "100000\n"}, {"input": "110001 1\n1", "output": "110000\n"}, {"input": "10 3\n2 5 6 8 1...
code_stdio
[ { "content": "problem\n\nJOI Pizza sells pizza home delivery along the d-meter-long ring road that runs through the city center.\n\nJOI Pizza has n stores S1, ..., Sn on the loop line. The head office is S1. The distance from S1 to Si when moving the loop line clockwise is set to di meters. D2 , ..., dn is an i...
[{"input": "8\n3\n2\n3\n2\n4\n6\n20\n4\n4\n33\n16\n15\n15\n12\n5\n8\n0", "output": "3\n15\n"}, {"input": "8\n3\n2\n3\n0\n4\n6\n20\n4\n4\n14\n14\n23\n7\n7\n11\n8\n0", "output": "3\n23\n"}, {"input": "8\n3\n2\n3\n0\n4\n6\n20\n4\n4\n17\n17\n23\n7\n7\n11\n8\n0", "output": "3\n28\n"}, {"input": "8\n3\n2\n4\n0\n4\n6\n20\n4\n...
code_stdio
[ { "content": "This task will exclusively concentrate only on the arrays where all elements equal 1 and/or 2.\n\nArray a is k-period if its length is divisible by k and there is such array b of length k, that a is represented by array b written exactly $\\frac{n}{k}$ times consecutively. In other words, array a ...
[{"input": "100 20\n2 2 2 1 1 2 1 2 1 2 1 1 2 2 2 2 2 1 2 1 2 2 2 2 1 2 1 2 1 1 1 1 2 2 2 2 1 2 1 1 2 2 2 2 1 2 1 2 1 2 1 1 2 1 2 2 2 1 2 2 2 2 2 2 2 2 1 2 1 1 1 1 2 2 2 2 2 1 1 2 2 1 2 2 1 2 1 2 1 2 1 1 2 2 1 2 2 1 1 1\n", "output": "13\n"}, {"input": "100 25\n2 2 1 2 2 2 2 2 1 2 2 1 2 1 1 2 1 2 1 2 2 2 1 2 2 2 1 1 2 ...
code_stdio
[ { "content": "N hotels are located on a straight line. The coordinate of the i-th hotel (1 \\leq i \\leq N) is x_i.\nTak the traveler has the following two personal principles:\n - He never travels a distance of more than L in a single day.\n - He never sleeps in the open. That is, he must stay at a hotel at th...
[{"input": "9\n1 3 6 13 15 18 19 29 31\n10\n4\n1 8\n7 3\n6 7\n8 5\n", "output": "4\n2\n1\n2\n"}, {"input": "9\n1 3 6 13 15 18 19 29 31\n10\n4\n1 8\n7 3\n6 7\n8 3", "output": "4\n2\n1\n3\n"}, {"input": "9\n1 3 6 13 23 18 19 29 31\n12\n4\n1 8\n1 5\n9 7\n8 7", "output": "3\n2\n1\n1\n"}, {"input": "9\n1 3 6 13 23 19 19 29 ...
code_stdio
[ { "content": "PizzaForces is Petya's favorite pizzeria. PizzaForces makes and sells pizzas of three sizes: small pizzas consist of $6$ slices, medium ones consist of $8$ slices, and large pizzas consist of $10$ slices each. Baking them takes $15$, $20$ and $25$ minutes, respectively.\n\nPetya's birthday is toda...
[{"input": "6\n40\n15\n300\n1\n9999999999999999\n2\n", "output": "100\n40\n750\n15\n25000000000000000\n15\n"}, {"input": "6\n12\n15\n300\n1\n9999999999999999\n3\n", "output": "30\n40\n750\n15\n25000000000000000\n15\n"}, {"input": "6\n20\n15\n300\n1\n9999999999999999\n3\n", "output": "50\n40\n750\n15\n25000000000000000\...
code_stdio
[ { "content": "Chef and his girlfriend are going to have a promenade. They are walking along the straight road which consists of segments placed one by one. Before walking Chef and his girlfriend stay at the beginning of the first segment, they want to achieve the end of the last segment. \nThere are few problem...
[{"input": "2\n5\n11 11 1 4 -1\n5\n6 4 15 0 1", "output": "12\n17\n"}, {"input": "2\n5\n6 15 1 4 -3\n5\n12 4 15 0 1", "output": "16\n17\n"}, {"input": "2\n5\n6 15 1 4 -4\n5\n12 4 28 0 1", "output": "16\n30\n"}, {"input": "2\n5\n6 11 1 4 -1\n5\n3 4 12 1 1", "output": "12\n14\n"}, {"input": "2\n5\n6 11 1 4 -1\n5\n3 4 10 ...
code_stdio
[ { "content": "Having watched the last Harry Potter film, little Gerald also decided to practice magic. He found in his father's magical book a spell that turns any number in the sum of its digits. At the moment Gerald learned that, he came across a number n. How many times can Gerald put a spell on it until the...
[{"input": "156161456146164104103460452045416165146141414651641564105461465156445621465146514562146145465165145145614561465145614561\n", "output": "3\n"}, {"input": "103558265279194540919999479104736998591144614354128226385356523500136575934047295164369877371826192807895143756308323575\n", "output": "3\n"}, {"input": "...
code_stdio
[ { "content": "There were n groups of students which came to write a training contest. A group is either one person who can write the contest with anyone else, or two people who want to write the contest in the same team.\n\nThe coach decided to form teams of exactly three people for this training. Determine the...
[{"input": "247\n2 2 1 2 1 2 2 2 2 2 2 1 1 2 2 1 2 1 1 1 2 1 1 1 1 2 1 1 2 2 1 2 1 1 1 2 2 2 1 1 2 1 1 2 1 1 1 2 1 2 1 2 2 1 1 2 1 2 2 1 2 1 2 1 1 2 1 1 1 2 2 1 1 2 2 1 1 2 1 1 1 2 2 2 2 1 2 2 2 2 2 2 1 2 2 2 2 1 1 1 1 1 1 1 1 1 2 1 2 2 1 2 1 2 2 2 1 2 2 2 1 1 2 2 1 1 1 2 1 1 1 1 2 2 1 2 2 1 1 1 2 1 2 2 1 2 1 1 1 2 2 2...
code_stdio
[ { "content": "You are given a list/array which contains only integers (positive and negative). Your job is to sum only the numbers that are the same and consecutive. The result should be one list.\n\nExtra credit if you solve it in one line. You can assume there is never an empty list/array and there will alway...
[{"input": "[2, 2, -4, 4, 5, 5, 6, 6, 6, 6, 6, 1]", "output": "[[4, -4, 4, 10, 30, 1]]", "fn_name": "sum_consecutives"}, {"input": "[1, -1, -2, 2, 3, -3, 4, -4]", "output": "[[1, -1, -2, 2, 3, -3, 4, -4]]", "fn_name": "sum_consecutives"}, {"input": "[1, 4, 4, 4, 0, 4, 3, 3, 1]", "output": "[[1, 12, 0, 4, 6, 1]]", "fn_n...
code_functional
[ { "content": "-----Input-----\n\nThe input contains a single integer a (10 ≤ a ≤ 999).\n\n\n-----Output-----\n\nOutput 0 or 1.\n\n\n-----Examples-----\nInput\n13\n\nOutput\n1\n\nInput\n927\n\nOutput\n1\n\nInput\n48\n\nOutput\n0\n\nWrite Python code to solve this problem. Your program should read the input from ...
[{"input": "927\n", "output": "1\n"}, {"input": "999\n", "output": "1\n"}, {"input": "142\n", "output": "0\n"}, {"input": "309\n", "output": "1\n"}, {"input": "572\n", "output": "0\n"}, {"input": "835\n", "output": "1\n"}, {"input": "990\n", "output": "0\n"}, {"input": "168\n", "output": "0\n"}, {"input": "431\n", "out...
code_stdio
[ { "content": "In the board game Talisman, when two players enter combat the outcome is decided by a combat score, equal to the players power plus any modifiers plus the roll of a standard 1-6 dice. The player with the highest combat score wins and the opposing player loses a life. In the case of a tie combat en...
[{"input": "[7, 2]\n[6, 8]", "output": "[\"Pray for a tie!\"]", "fn_name": "get_required"}, {"input": "[2, 0]\n[8, 1]", "output": "[\"Auto-lose\"]", "fn_name": "get_required"}, {"input": "[1, 10]\n[1, 4]", "output": "[\"Auto-win\"]", "fn_name": "get_required"}, {"input": "[8, 1]\n[3, 0]", "output": "[\"Auto-win\"]", "f...
code_functional
[ { "content": "Ignoring the air resistance, velocity of a freely falling object $v$ after $t$ seconds and its drop $y$ in $t$ seconds are represented by the following formulas:\n\n$ v = 9.8 t $\n$ y = 4.9 t^2 $\n\n\nA person is trying to drop down a glass ball and check whether it will crack. Your task is to wri...
[{"input": "30.680680649968536\n28.560601801329888", "output": "11\n10\n"}, {"input": "31.609624009789687\n28.560601801329888", "output": "12\n10\n"}, {"input": "37.215162984287666\n34.783659160997495", "output": "16\n14\n"}, {"input": "43.458654705246964\n43.015002690398575", "output": "21\n20\n"}, {"input": "50.86628...
code_stdio
[ { "content": "No Story\n\nNo Description\n\nOnly by Thinking and Testing\n\nLook at the results of the testcases, and guess the code!\n\n---\n\n## Series:\n\n01. [A and B?](http://www.codewars.com/kata/56d904db9963e9cf5000037d)\n02. [Incomplete string](http://www.codewars.com/kata/56d9292cc11bcc3629000533)\n03....
[{"input": "9", "output": "[[1, 3, 9]]", "fn_name": "mystery"}, {"input": "10", "output": "[[1, 5]]", "fn_name": "mystery"}, {"input": "3", "output": "[[1, 3]]", "fn_name": "mystery"}, {"input": "5", "output": "[[1, 5]]", "fn_name": "mystery"}, {"input": "6", "output": "[[1, 3]]", "fn_name": "mystery"}, {"input": "7", ...
code_functional
[ { "content": "Natasha travels around Mars in the Mars rover. But suddenly it broke down, namely — the logical scheme inside it. The scheme is an undirected tree (connected acyclic graph) with a root in the vertex $1$, in which every leaf (excluding root) is an input, and all other vertices are logical elements,...
[{"input": "60\nAND 20 4\nNOT 42\nAND 48 59\nOR 17 7\nIN 0\nAND 36 37\nIN 1\nIN 0\nIN 1\nNOT 47\nAND 52 49\nOR 44 35\nIN 0\nIN 1\nAND 33 56\nIN 0\nIN 0\nIN 0\nAND 31 41\nOR 15 3\nOR 43 46\nIN 1\nXOR 22 28\nIN 1\nIN 1\nIN 1\nAND 34 21\nIN 0\nIN 1\nIN 0\nXOR 51 23\nXOR 10 54\nOR 57 40\nIN 0\nNOT 18\nNOT 25\nIN 1\nAND 5 5...
code_stdio
[ { "content": "It is known that passages in Singer house are complex and intertwined. Let's define a Singer k-house as a graph built by the following process: take complete binary tree of height k and add edges from each vertex to all its successors, if they are not yet present.\n\n<image> Singer 4-house\n\nCoun...
[{"input": "181\n", "output": "421742777\n"}, {"input": "261\n", "output": "952127278\n"}, {"input": "121\n", "output": "631667314\n"}, {"input": "351\n", "output": "625447969\n"}, {"input": "141\n", "output": "551624811\n"}, {"input": "361\n", "output": "465138299\n"}, {"input": "301\n", "output": "484957644\n"}, {"in...
code_stdio
[ { "content": "This morning, Roman woke up and opened the browser with $n$ opened tabs numbered from $1$ to $n$. There are two kinds of tabs: those with the information required for the test and those with social network sites. Roman decided that there are too many tabs open so he wants to close some of them.\n\...
[{"input": "100 47\n-1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 1 1 1 1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 -1 1 -1 -1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 1 -1 1 1 1 1 1 1 -1 1 1 -1 1 -1 -1 -1 1 -1 -1 1 1 -1 -1 1 -1\n", "output": "19\n"}, {"input": "100 47\n...
code_stdio