messages listlengths 1 1 | ground_truth stringlengths 88 726k | dataset stringclasses 2
values |
|---|---|---|
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLunar New Year is approaching, and Bob is planning to go for a famous restaurant — \"Alice's\".\n\nThe restaurant \"Alice's\" serves $n$ kinds of food. The cost for the $i$-th kind is always $c_i$. Initially, the restaura... | [{"type": "stdin_stdout", "input": "10 15\n132 138 38 75 14 115 129 68 119 118\n728344 513371 120930 757031 137753 453796 348671 185533 966778 521678\n4 58\n1 8\n8 22\n3 98\n2 111\n6 158\n2 82\n1 170\n1 26\n1 4\n4 76\n10 106\n5 100\n4 116\n7 62\n", "output": "43907798\n5826752\n4081726\n15058400\n56984181\n67179393\n33... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nZS the Coder and Chris the Baboon has arrived at Udayland! They walked in the park where n trees grow. They decided to be naughty and color the trees in the park. The trees are numbered with integers from 1 to n from left... | [{"type": "stdin_stdout", "input": "8 6 6\n0 0 0 0 0 0 0 0\n709812879 751993522 552838834 932579085 381597201 889756688\n77223016 35398130 932703875 852137134 124534767 472656085\n828677108 158247840 540181954 573979204 389860841 490718346\n666733838 404533406 50010075 311518758 460372535 69832342\n591244215 400838850 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNastya received one more array on her birthday, this array can be used to play a traditional Byteland game on it. However, to play the game the players should first select such a subsegment of the array that $\\frac{p}{s}... | [{"type": "stdin_stdout", "input": "94 58\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 29 58 1 1 1 29 58 58 1 1 29 1 1 1 1 2 1 58 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 29 1 1 1 1 1 58 1 29 1 1 1 1 1 1 1 1 1 1 1 1 58 1 1 1 1 1 2 1 1 1\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "90 45\n15 1 1 1 1 3 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour task is to calculate the number of arrays such that: each array contains $n$ elements; each element is an integer from $1$ to $m$; for each array, there is exactly one pair of equal elements; for each array $a$, ... | [{"type": "stdin_stdout", "input": "100000 200000\n", "output": "707899035\n"}, {"type": "stdin_stdout", "input": "150000 200000\n", "output": "270223789\n"}, {"type": "stdin_stdout", "input": "200000 200000\n", "output": "668956439\n"}, {"type": "stdin_stdout", "input": "1000 200000\n", "output": "664520775\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVanya and his friend Vova play a computer game where they need to destroy n monsters to pass a level. Vanya's character performs attack with frequency x hits per second and Vova's character performs attack with frequency ... | [{"type": "stdin_stdout", "input": "20 5 15\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n", "output": "Both\nVova\nVova\nBoth\nBoth\nVova\nVova\nBoth\nBoth\nVova\nVova\nBoth\nBoth\nVova\nVova\nBoth\nBoth\nVova\nVova\nBoth\n"}, {"type": "stdin_stdout", "input": "11 22 33\n55\n56\n57\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA permutation p is an ordered group of numbers p_1, p_2, ..., p_{n}, consisting of n distinct positive integers, each is no more than n. We'll define number n as the length of permutation p_1, p_2, ..., p_{n}.... | [{"type": "stdin_stdout", "input": "55 0\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 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlong a road running in an east-west direction, there are A shrines and B temples.\nThe i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is ... | [{"type": "stdin_stdout", "input": "1 1 3\n1\n10000000000\n2\n9999999999\n5000000000\n", "output": "10000000000\n10000000000\n14999999998\n"}, {"type": "stdin_stdout", "input": "2 3 4\n100\n600\n400\n900\n1000\n150\n2000\n899\n799\n", "output": "350\n1400\n301\n399\n"}, {"type": "stdin_stdout", "input": "1 1 1\n1\n2\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east.\nA company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (... | [{"type": "stdin_stdout", "input": "10 10 10\n1 6\n2 9\n4 5\n4 7\n4 7\n5 8\n6 6\n6 7\n7 9\n10 10\n1 8\n1 9\n1 10\n2 8\n2 9\n2 10\n3 8\n3 9\n3 10\n1 10\n", "output": "7\n9\n10\n6\n8\n9\n6\n7\n8\n10\n"}, {"type": "stdin_stdout", "input": "5 10 5\n3 4\n1 4\n1 2\n1 1\n2 5\n2 5\n1 2\n1 3\n3 5\n3 4\n1 2\n1 1\n5 5\n1 5\n2 4\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have an integer N.\nPrint an integer x between N and 10^{13} (inclusive) such that, for every integer y between 2 and N (inclusive), the remainder when x is divided by y is 1.\nUnder the constraints of this problem, th... | [{"type": "stdin_stdout", "input": "29\n", "output": "2329089562801\n"}, {"type": "stdin_stdout", "input": "30\n", "output": "2329089562801\n"}, {"type": "stdin_stdout", "input": "28\n", "output": "80313433201\n"}, {"type": "stdin_stdout", "input": "23\n", "output": "5354228881\n"}, {"type": "stdin_stdout", "input": "2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOlya loves energy drinks. She loves them so much that her room is full of empty cans from energy drinks.\n\nFormally, her room can be represented as a field of n × m cells, each cell of which is empty or littered with can... | [{"type": "stdin_stdout", "input": "10 10 1000\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n7 6 1 3\n", "output": "2"}, {"type": "stdin_stdout", "input": "10 10 1000\n..........\n..........\n..........\n..........\n..........\n..........\n........ | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two distinct students whose name s... | [{"type": "stdin_stdout", "input": "20\ngrkbifiedubnohaektjo\nizxghhzkwfpbsmfsrvzr\njjkvyqppaqotfnqkogvs\ngphjvgjewixdzonunipv\nilfwfngxaiwutzafueot\nirbntjytnvppbgyyllmk\njotpbafckwsufccigskt\njbzfmhjzeoxruiebctsj\nijvxpeybbhrezjuajkkp\njdqriujmuvcvphlcsxfm\nykwqjokeljlnyqpirlvp\nyhcczukakwarzzloccim\nmmygnzejmxmoksms... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMahmoud was trying to solve the vertex cover problem on trees. The problem statement is:\n\nGiven an undirected tree consisting of n nodes, find the minimum number of vertices that cover all the edges. Formally, we need t... | [{"type": "stdin_stdout", "input": "43\n", "output": "1 2\n1 3\n1 4\n2 5\n2 6\n1 7\n1 8\n1 9\n1 10\n1 11\n1 12\n1 13\n1 14\n1 15\n1 16\n1 17\n1 18\n1 19\n1 20\n1 21\n1 22\n1 23\n1 24\n1 25\n1 26\n1 27\n1 28\n1 29\n1 30\n1 31\n1 32\n1 33\n1 34\n1 35\n1 36\n1 37\n1 38\n1 39\n1 40\n1 41\n1 42\n1 43\n1 2\n1 3\n1 4\n1 5\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nValera has array a, consisting of n integers a_0, a_1, ..., a_{n} - 1, and function f(x), taking an integer from 0 to 2^{n} - 1 as its single argument. Value f(x) is calculated by formula $f(x) = \\sum_{i = 0}^{n - 1} a_{... | [{"type": "stdin_stdout", "input": "43\n475 2165 8771 7146 8980 7209 9170 9006 6278 6661 4740 6321 7532 6869 3788 7918 1707 5070 3809 5189 2494 8255 1123 3197 190 5712 9873 3286 9997 133 9030 3067 8043 5297 5398 4240 8315 2141 1436 3297 247 8438 2300\n0111011100100011110010011110011011010001101\n", "output": "222013\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle penguin Polo has an n × m matrix, consisting of integers. Let's index the matrix rows from 1 to n from top to bottom and let's index the columns from 1 to m from left to right. Let's represent the matrix element on... | [{"type": "stdin_stdout", "input": "7 5 47\n9583 1734 4601 5353 2110\n3802 5165 7985 6293 324\n7045 653 9160 7891 4930\n1781 3520 4178 2298 3943\n1405 2956 5447 5494 6528\n3097 1640 7750 4883 8032\n4225 8455 1875 4789 4366\n", "output": "1508\n"}, {"type": "stdin_stdout", "input": "7 7 47\n47 47 47 47 47 47 47\n47 47 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Luba bought a very interesting book. She knows that it will take t seconds to read the book. Luba wants to finish reading as fast as she can.\n\nBut she has some work to do in each of n next days. The number of s... | [{"type": "stdin_stdout", "input": "100 1000000\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "6 1200\n86400... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described... | [{"type": "stdin_stdout", "input": "67\n1 1\n3 8\n4 10\n7 8\n9 2\n10 1\n11 5\n12 8\n13 4\n16 6\n18 3\n19 3\n22 5\n24 6\n27 5\n28 3\n29 3\n30 5\n32 5\n33 10\n34 7\n35 8\n36 5\n41 3\n42 2\n43 5\n46 4\n48 4\n49 9\n52 4\n53 9\n55 1\n56 4\n59 7\n68 7\n69 4\n71 9\n72 10\n74 5\n76 4\n77 9\n80 7\n81 9\n82 5\n83 5\n84 9\n85 7\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rooted tree with n vertices. The vertices are numbered from 1 to n, the root is the vertex number 1.\n\nEach vertex has a color, let's denote the color of vertex v by c_{v}. Initially c_{v} = 0.\n\nYou hav... | [{"type": "stdin_stdout", "input": "7\n1 1 2 3 1 4\n3 3 1 1 1 2 3\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "6\n1 2 2 1 5\n2 1 1 1 1 1\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "5\n1 2 1 4\n1 1 1 2 2\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "4\n1 2 1\n1 2 3 4\n", "output": "4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a programming language in which every program is a non-empty sequence of \"<\" and \">\" signs and digits. Let's explain how the interpreter of this programming language works. A program is interpreted using move... | [{"type": "stdin_stdout", "input": "17 21\n187<9>82<818<4229\n8 14\n4 10\n11 17\n8 8\n4 12\n6 6\n5 12\n10 12\n15 16\n7 7\n3 8\n4 8\n8 9\n8 10\n5 7\n1 7\n11 12\n3 6\n6 11\n8 16\n6 9\n", "output": "0 1 1 0 0 0 0 0 0 0 \n0 0 0 0 0 0 0 0 0 0 \n1 1 0 0 0 0 0 1 1 0 \n0 0 1 0 0 0 0 0 0 0 \n0 0 0 0 0 0 0 0 0 0 \n0 0 0 0 0 0 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've got a undirected graph G, consisting of n nodes. We will consider the nodes of the graph indexed by integers from 1 to n. We know that each node of graph G is connected by edges with at least k other nodes of this ... | [{"type": "stdin_stdout", "input": "30 70 4\n22 1\n1 25\n27 5\n25 10\n10 2\n29 4\n29 26\n28 18\n15 18\n25 11\n11 10\n11 28\n4 11\n4 26\n26 7\n26 18\n18 21\n14 17\n17 30\n30 9\n30 6\n30 27\n27 22\n22 15\n22 8\n8 4\n8 17\n17 16\n16 19\n16 12\n12 23\n23 20\n20 1\n1 23\n23 15\n15 24\n24 28\n28 21\n21 9\n21 27\n29 13\n13 5\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers $n$ and $m$. Calculate the number of pairs of arrays $(a, b)$ such that:\n\n the length of both arrays is equal to $m$; each element of each array is an integer between $1$ and $n$ (inclusive)... | [{"type": "stdin_stdout", "input": "1000 10\n", "output": "414070642\n"}, {"type": "stdin_stdout", "input": "1000 2\n", "output": "917124963\n"}, {"type": "stdin_stdout", "input": "723 9\n", "output": "157557417\n"}, {"type": "stdin_stdout", "input": "678 7\n", "output": "778650919\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKuro is living in a country called Uberland, consisting of $n$ towns, numbered from $1$ to $n$, and $n - 1$ bidirectional roads connecting these towns. It is possible to reach each town from any other. Each road connects ... | [{"type": "stdin_stdout", "input": "70 42 32\n25 50\n51 7\n39 61\n1 33\n20 5\n1 70\n1 63\n42 35\n64 16\n1 11\n39 42\n20 54\n11 14\n57 44\n1 59\n55 40\n25 3\n31 18\n38 68\n57 23\n39 57\n28 10\n39 20\n42 26\n58 6\n20 56\n57 2\n13 21\n15 69\n39 64\n1 39\n62 53\n39 13\n1 41\n22 12\n13 30\n68 67\n20 31\n51 15\n57 32\n59 34\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n phone numbers in Polycarp's contacts on his phone. Each number is a 9-digit integer, starting with a digit different from 0. All the numbers are distinct.\n\nThere is the latest version of Berdroid OS installe... | [{"type": "stdin_stdout", "input": "9\n111111111\n111111110\n111111100\n111111000\n111110000\n111100000\n111000000\n110000000\n100000000\n", "output": "111111111\n111111110\n111111100\n111111000\n111110000\n111100000\n111000000\n110000000\n00000000\n"}, {"type": "stdin_stdout", "input": "10\n302417715\n621211824\n47445... | 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": "50 2\n124 214 63 73 996 760 38 571 451 300 970 1 706 937 837 494 619 88 851 411 957 990 842 613 821 649 627 34 693 678 734 116 816 985 705 940 499 493 922 967 854 439 112 644 961 438 189 572 655 550\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "30 60\n16 13 22 38 13 35 17 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp is currently developing a project in Vaja language and using a popular dependency management system called Vamen. From Vamen's point of view both Vaja project and libraries are treated projects for simplicity.\n\... | [{"type": "stdin_stdout", "input": "9\ncodehorses 5\n3\nwebfrmk 6\nmashadb 1\nmashadb 2\n\ncommons 2\n0\n\nmashadb 3\n0\n\nwebfrmk 6\n2\nmashadb 3\ncommons 2\n\nextra 4\n1\nextra 3\n\nextra 3\n0\n\nextra 1\n0\n\nmashadb 1\n1\nextra 3\n\nmashadb 2\n1\nextra 1\n", "output": "4\ncommons 2\nextra 1\nmashadb 2\nwebfrmk 6\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan wants to write a letter to his friend. The letter is a string s consisting of lowercase Latin letters.\n\nUnfortunately, when Ivan started writing the letter, he realised that it is very long and writing the whole le... | [{"type": "stdin_stdout", "input": "aaaaaaabaaaabbbbaaaaaaabbaaaaaaaaaabbabaaaaaabaaaaabaaaaaaaabaaaaaaaaaaaaaaaabaaaaaabaaaaaaaaabbaaabaaaaabbaaabaaaaabaaabaaaaaabaaaaaaaaaaabaabaaabaaaaabbbbaaaaaaaaaaaaaaabaaaaaaaaababaaabaaaaaaaaaabaaaaaaaabaaaabbbbaaaaaaabbaaaaaaaaaabbabaaaaaabaaaaabaaaaaaaabaaaaaaaaaaaaaaaabaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSimon has a prime number x and an array of non-negative integers a_1, a_2, ..., a_{n}.\n\nSimon loves fractions very much. Today he wrote out number $\\frac{1}{x^{a} 1} + \\frac{1}{x^{a_{2}}} + \\ldots + \\frac{1}{x^{a_{n... | [{"type": "stdin_stdout", "input": "26 7\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2\n", "output": "49\n"}, {"type": "stdin_stdout", "input": "26 2\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "1 800000011\n800000011\n", "output": "1\n"}, {"type":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAsya loves animals very much. Recently, she purchased $n$ kittens, enumerated them from $1$ and $n$ and then put them into the cage. The cage consists of one row of $n$ cells, enumerated with integers from $1$ to $n$ from... | [{"type": "stdin_stdout", "input": "64\n2 20\n37 55\n42 29\n36 54\n35 50\n60 41\n25 61\n31 51\n9 43\n26 28\n48 56\n13 64\n17 19\n8 12\n52 16\n24 44\n1 18\n58 15\n5 30\n3 7\n62 22\n53 14\n11 38\n10 49\n47 59\n40 45\n33 4\n23 39\n63 57\n32 46\n34 6\n27 21\n20 55\n29 54\n35 60\n61 51\n9 26\n48 13\n19 12\n52 44\n1 58\n5 7\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a forest that we model as a plane and live $n$ rare animals. Animal number $i$ has its lair in the point $(x_{i}, y_{i})$. In order to protect them, a decision to build a nature reserve has been made.\n\nThe rese... | [{"type": "stdin_stdout", "input": "20\n7571542 9868879\n3634934 5986987\n2297651 5538795\n9701582 8250721\n-2913168 4968483\n8838674 5771883\n-3348778 8326335\n-577797 750161\n-7223138 9113512\n-1808146 6044926\n-756446 417388\n4700417 1550148\n-5568937 20029\n-9170707 6103893\n7445655 7161843\n8820510 4145867\n-44669... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAt the big break Nastya came to the school dining room. There are $n$ pupils in the school, numbered from $1$ to $n$. Unfortunately, Nastya came pretty late, so that all pupils had already stood in the queue, i.e. Nastya ... | [{"type": "stdin_stdout", "input": "20 47\n4 6 11 15 9 17 3 1 19 14 12 8 2 5 7 20 16 18 13 10\n18 10\n6 3\n15 17\n18 7\n6 5\n19 10\n6 7\n11 3\n1 10\n17 3\n6 14\n7 10\n19 5\n12 10\n1 8\n6 11\n18 5\n6 8\n12 8\n1 5\n20 10\n16 8\n6 10\n20 19\n17 8\n13 10\n2 5\n19 8\n6 9\n16 3\n16 10\n19 7\n17 16\n10 16\n8 9\n12 5\n17 10\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is constraints.\n\nIf you write a solution in Python, then prefer to send it in PyPy to speed up execution time.\n\nA session has begun at Beland State University. Many s... | [{"type": "stdin_stdout", "input": "10 50\n10 10 10 10 10 10 10 10 10 10\n", "output": "0 0 0 0 0 1 2 3 4 5 "}, {"type": "stdin_stdout", "input": "10 50\n9 9 9 9 9 9 9 9 9 9\n", "output": "0 0 0 0 0 1 2 3 4 5 "}, {"type": "stdin_stdout", "input": "8 2\n1 1 1 1 1 1 1 1\n", "output": "0 0 1 2 3 4 5 6 "}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn a certain meeting of a ruling party \"A\" minister Pavel suggested to improve the sewer system and to create a new pipe in the city.\n\nThe city is an n × m rectangular squared field. Each square of the field is either... | [{"type": "stdin_stdout", "input": "9 37\n.......#................#.##...#.....\n..#......................##..........\n..#......#.........#.................\n..........#..#..#..#...........#.....\n...#............#..##.#.....##.......\n......................#..............\n......#........##....#......#........\n........ | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider a rooted tree. A rooted tree has one special vertex called the root. All edges are directed from the root. Vertex u is called a child of vertex v and vertex v is called a parent of vertex u if there exists a dire... | [{"type": "stdin_stdout", "input": "20\n1\n1\n1\n1\n2\n2\n2\n3\n3\n3\n4\n4\n4\n5\n5\n5\n1\n1\n1\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "13\n1\n2\n2\n2\n1\n6\n6\n6\n1\n10\n10\n10\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "12\n1\n1\n1\n2\n5\n5\n5\n5\n1\n2\n2\n", "output": "No\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe array a with n integers is given. Let's call the sequence of one or more consecutive elements in a segment. Also let's call the segment k-good if it contains no more than k different values.\n\nFind any longest k-good... | [{"type": "stdin_stdout", "input": "10 3\n512008 512008 452221 512008 314256 123232 314256 512008 314256 123232\n", "output": "4 10\n"}, {"type": "stdin_stdout", "input": "5 2\n171230 171230 171230 171230 171230\n", "output": "1 5\n"}, {"type": "stdin_stdout", "input": "9 3\n6 5 1 2 3 2 1 4 5\n", "output": "3 7\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice likes snow a lot! Unfortunately, this year's winter is already over, and she can't expect to have any more of it. Bob has thus bought her a gift — a large snow maker. He plans to make some amount of snow every day. ... | [{"type": "stdin_stdout", "input": "13\n1 1 1 1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "1 1 1 1 1 1 1 1 1 1 1 1 1\n"}, {"type": "stdin_stdout", "input": "10\n11 39 16 34 25 3 12 11 31 16\n10 0 4 9 8 9 7 8 9 2\n", "output": "10 0 9 27 27 30 28 17 12 4\n"}, {"type": "stdin_stdout", "input": "10\n20 35... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has a sequence of cubes and exactly one integer is written on each cube. Vasya exhibited all his cubes in a row. So the sequence of numbers written on the cubes in the order from the left to the right equals to a_1,... | [{"type": "stdin_stdout", "input": "10 1 10\n6 7 6 1 10 10 9 5 3 9\n7 10 9 6 1 5 9 3 10 6\n", "output": "TRUTH\n"}, {"type": "stdin_stdout", "input": "8 3 6\n5 3 1 1 1 1 3 5\n3 3 1 1 1 1 5 5\n", "output": "LIE\n"}, {"type": "stdin_stdout", "input": "7 1 4\n2 5 5 5 4 3 4\n2 5 5 5 4 3 4\n", "output": "TRUTH\n"}, {"type":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA permutation of length $n$ is an array consisting of $n$ distinct integers from $1$ to $n$ in arbitrary order. For example, $[2,3,1,5,4]$ is a permutation, but $[1,2,2]$ is not a permutation ($2$ appears twice in the arr... | [{"type": "stdin_stdout", "input": "583291\n", "output": "135712853"}, {"type": "stdin_stdout", "input": "1000000\n", "output": "23581336"}, {"type": "stdin_stdout", "input": "336161\n", "output": "234634596"}, {"type": "stdin_stdout", "input": "885131\n", "output": "329995454"}, {"type": "stdin_stdout", "input": "4823... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan is a novice painter. He has $n$ dyes of different colors. He also knows exactly $m$ pairs of colors which harmonize with each other.\n\nIvan also enjoy playing chess. He has $5000$ rooks. He wants to take $k$ rooks, ... | [{"type": "stdin_stdout", "input": "4 6\n3 4\n2 3\n2 1\n1 3\n1 4\n4 2\n", "output": "4\n1 7\n1 3\n1 4\n1 5\n4\n2 8\n2 2\n2 3\n2 6\n4\n3 9\n3 1\n3 2\n3 4\n4\n4 10\n4 1\n4 5\n4 6\n"}, {"type": "stdin_stdout", "input": "7 4\n3 4\n3 5\n5 7\n2 5\n", "output": "1\n1 5\n2\n2 6\n2 4\n3\n3 7\n3 1\n3 2\n2\n4 8\n4 1\n4\n5 9\n5 2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of $n$ integers $a_1$, $a_2$, ..., $a_n$, and a set $b$ of $k$ distinct integers from $1$ to $n$.\n\nIn one operation, you may choose two integers $i$ and $x$ ($1 \\le i \\le n$, $x$ can be any inte... | [{"type": "stdin_stdout", "input": "100 0\n4 20 52 2 7 36 8 73 9 99 13 19 14 89 32 2 6 2 16 21 47 22 66 23 25 95 28 4 29 64 30 31 7 48 32 51 35 37 77 57 40 42 56 40 43 44 46 13 47 12 48 49 24 51 69 53 54 98 21 57 59 61 62 52 63 30 68 32 69 39 8 67 71 59 72 81 76 77 11 82 85 14 83 33 86 89 89 90 43 96 91 31 93 69 58 94 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. \n\nYou immediately decided to take a vac... | [{"type": "stdin_stdout", "input": "48 14\n1 1 1 1 1 6 1 1 1 1 1 1 3 3 1 1 1 1 1 2 2 2 1 1 1 1 1 1 2 1 4 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 5\n", "output": "42"}, {"type": "stdin_stdout", "input": "18 445\n89 24 6 83 53 67 17 38 39 45 2 98 72 29 38 59 78 98\n", "output": "18022"}, {"type": "stdin_stdout", "input": "10 6\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNaman has two binary strings $s$ and $t$ of length $n$ (a binary string is a string which only consists of the characters \"0\" and \"1\"). He wants to convert $s$ into $t$ using the following operation as few times as po... | [{"type": "stdin_stdout", "input": "12\n011001010101\n111001010101\n", "output": "-1"}, {"type": "stdin_stdout", "input": "10\n1111100000\n1111100001\n", "output": "-1"}, {"type": "stdin_stdout", "input": "10\n1111100000\n0000011111\n", "output": "5"}, {"type": "stdin_stdout", "input": "10\n1010111110\n1011101101\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA well-known art union called \"Kalevich is Alive!\" manufactures objects d'art (pictures). The union consists of n painters who decided to organize their work as follows.\n\nEach painter uses only the color that was assi... | [{"type": "stdin_stdout", "input": "10 3\n6 10 3\n2 7 9\n10 4 7\n6 3 4\n6 2 6\n8 4 4\n5 9 8\n6 9 7\n2 7 10\n2 6 2\n", "output": "19 32 39 43 49 53 61 68 78 80 "}, {"type": "stdin_stdout", "input": "7 1\n80\n92\n24\n88\n40\n45\n7\n", "output": "80 172 196 284 324 369 376 "}, {"type": "stdin_stdout", "input": "3 3\n3 9 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe academic year has just begun, but lessons and olympiads have already occupied all the free time. It is not a surprise that today Olga fell asleep on the Literature. She had a dream in which she was on a stairs. \n\nTh... | [{"type": "stdin_stdout", "input": "50\nUUUUUUUUUUUUUUUUUUUUUUUUUDDDDDDDDDDDDDDDDDDDDDDDDD\n", "output": "51 102 153 204 255 306 357 408 459 510 561 612 663 714 765 816 867 918 969 1020 1071 1122 1173 1224 1275 1275 1224 1173 1122 1071 1020 969 918 867 816 765 714 663 612 561 510 459 408 357 306 255 204 153 102 51 "}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSeryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are w... | [{"type": "stdin_stdout", "input": "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n<3i<>3am<3the<3<main<3in<3the<3><3family<3\n", "output": "no\n"}, {"type": "stdin_stdout", "input": "3\ni\nlove\nyou\n<3i<3lo<3ve<3y<<<<<<<ou3<3\n", "output": "yes\n"}, {"type": "stdin_stdout", "input": "3\ni\nlove\nyou\n<3i<3love<23you<3ww\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA social network for dogs called DH (DogHouse) has k special servers to recompress uploaded videos of cute cats. After each video is uploaded, it should be recompressed on one (any) of the servers, and only after that it ... | [{"type": "stdin_stdout", "input": "10 10\n999999991 1000000000\n999999992 1000000000\n999999993 1000000000\n999999994 1000000000\n999999995 1000000000\n999999996 1000000000\n999999997 1000000000\n999999998 1000000000\n999999999 1000000000\n1000000000 1000000000\n", "output": "1999999991\n1999999992\n1999999993\n199999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have to restore the wall. The wall consists of $N$ pillars of bricks, the height of the $i$-th pillar is initially equal to $h_{i}$, the height is measured in number of bricks. After the restoration all the $N$ pillar... | [{"type": "stdin_stdout", "input": "100 52 92 72\n67 100 56 15 0 92 26 74 44 61 6 44 45 19 22 19 9 85 67 78 24 61 81 99 62 84 5 71 11 65 5 97 9 72 11 81 81 64 65 91 52 21 20 53 68 91 4 75 84 88 72 27 48 23 9 65 14 6 54 55 6 1 89 78 40 45 98 45 27 51 94 72 67 81 20 19 38 64 14 40 57 21 82 99 37 92 21 22 30 14 65 93 60 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this p... | [{"type": "stdin_stdout", "input": "186\n2 1 2 1 1 1 1 1 2 1 1 2 2 2 1 1 2 2 1 1 1 2 1 1 2 2 1 1 1 2 2 1 1 1 1 1 2 1 1 1 2 1 2 1 1 2 1 1 1 2 2 2 2 2 2 2 1 2 1 2 1 1 2 1 2 2 1 1 1 1 1 2 2 1 2 2 1 2 2 1 1 1 2 2 1 1 2 2 1 2 2 1 2 2 2 2 2 1 1 1 1 2 1 1 2 2 2 2 2 2 1 1 1 1 1 2 1 1 2 2 1 2 2 1 1 1 1 1 2 2 1 1 2 2 1 2 2 2 1 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasily the bear has got a sequence of positive integers a_1, a_2, ..., a_{n}. Vasily the Bear wants to write out several numbers on a piece of paper so that the beauty of the numbers he wrote out was maximum. \n\nThe beau... | [{"type": "stdin_stdout", "input": "39\n37749932 37750076 37750391 37750488 37750607 37750812 37750978 37751835 37752173 37752254 75497669 75497829 75497852 75498044 75498061 75498155 75498198 75498341 75498382 75498465 150994988 150994989 150995009 150995019 150995024 150995030 150995031 150995069 150995072 805306369 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNadeko's birthday is approaching! As she decorated the room for the party, a long garland of Dianthus-shaped paper pieces was placed on a prominent part of the wall. Brother Koyomi will like it!\n\nStill unsatisfied with ... | [{"type": "stdin_stdout", "input": "100\ndddddccccdddddaaaaabbbbbbbbbbbbbaaacdcabbacccacccccbdbbadddbbddddbdaaccacdddbbbaddddbbbbdcbbbdddddda\n50\n54 b\n48 d\n45 b\n52 c\n52 a\n48 a\n54 b\n45 a\n47 d\n50 d\n53 a\n34 a\n51 b\n48 d\n47 d\n47 a\n48 d\n53 b\n52 d\n54 d\n46 a\n38 a\n52 b\n49 a\n49 b\n46 c\n54 a\n45 b\n35 c\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHiking club \"Up the hill\" just returned from a walk. Now they are trying to remember which hills they've just walked through.\n\nIt is known that there were N stops, all on different integer heights between 1 and N kilo... | [{"type": "stdin_stdout", "input": "100\n4\n", "output": "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 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya is reading a e-book. The file of the book consists of $n$ pages, numbered from $1$ to $n$. The screen is currently displaying the contents of page $x$, and Vasya wants to read the page $y$. There are two buttons on ... | [{"type": "stdin_stdout", "input": "5\n20 10 2 9\n1000000000 2 89 4\n1000000000 2 89 8\n1000000000 89 1 1000000000\n1000000000 1000000000 2 3\n", "output": "4\n23\n12\n1\n-1\n"}, {"type": "stdin_stdout", "input": "1\n1000000000 3 1000000000 2\n", "output": "499999999\n"}, {"type": "stdin_stdout", "input": "1\n100000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGathering darkness shrouds the woods and the world. The moon sheds its light on the boat and the river.\n\n\"To curtain off the moonlight should be hardly possible; the shades present its mellow beauty and restful nature.... | [{"type": "stdin_stdout", "input": "50 1 19\n-5213 -1\n2021 -1\n-4479 1\n1569 -1\n1618 1\n-8318 1\n3854 1\n8190 -1\n9162 1\n8849 1\n-5545 -1\n-7898 -1\n728 1\n-2175 -1\n6453 -1\n2999 1\n4716 1\n-2192 -1\n7938 -1\n1910 -1\n-6863 -1\n5230 -1\n-2782 -1\n-2587 -1\n-3389 1\n-332 -1\n5915 1\n-2604 1\n-8907 1\n-2019 1\n2992 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA flower shop has got n bouquets, and the i-th bouquet consists of a_{i} flowers. Vasya, the manager of the shop, decided to make large bouquets from these bouquets. \n\nVasya thinks that a bouquet is large if it is made ... | [{"type": "stdin_stdout", "input": "25\n742168 377547 485672 437223 96307 902863 759104 747933 512899 410317 588598 666688 823202 257684 520631 910066 168864 71499 899972 565350 764848 754913 929040 864132 289976\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "20\n274039 899325 798709 157662 963297 276599 529... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe famous joke programming language HQ9+ has only 4 commands. In this problem we will explore its subset — a language called HQ...\n\n\n-----Input-----\n\nThe only line of the input is a string between 1 and 10^6 charact... | [{"type": "stdin_stdout", "input": "HQQQQQQQHQQQQHQHQQQHHQHHHQQHQQQQHHQHHQHHHHHHQQQQQQQQHHQQQQQHHQQQQHHHQQQQQQQQHQQQHQHQQQQQQHHHQHHQHQHHQQQQQHQQHQHQQQHQHQHHHHQQHQHQQQQQHQQQHQQQHQQHQHQQHQQQQQQ\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "HQQQHQQHQHQQQQHQQQHQHQHQQQHQQQQHQQHHQQQQQHQQQQHQQQQQHQQQQQHQQQQQHHQQQQ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn army of n droids is lined up in one row. Each droid is described by m integers a_1, a_2, ..., a_{m}, where a_{i} is the number of details of the i-th type in this droid's mechanism. R2-D2 wants to destroy the sequence ... | [{"type": "stdin_stdout", "input": "49 2 1971\n794 866\n401 575\n341 83\n103 208\n352 134\n260 878\n497 931\n630 570\n885 464\n23 663\n60 775\n416 870\n955 405\n392 961\n530 258\n73 404\n736 923\n44 436\n594 314\n904 138\n980 163\n76 720\n879 809\n81 838\n263 599\n218 139\n659 493\n848 754\n656 302\n490 7\n204 530\n184... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAncient Egyptians are known to have understood difficult concepts in mathematics. The ancient Egyptian mathematician Ahmes liked to write a kind of arithmetic expressions on papyrus paper which he called as Ahmes arithmet... | [{"type": "stdin_stdout", "input": "((((4?6)?9)?((5?(7?1))?(6?(4?(((((((7?3)?7)?(((((8?(6?7))?((1?2)?(5?8)))?8)?7)?4))?6)?7)?1)?((7?(2?((1?(((8?(((((2?7)?(((((3?6)?3)?(((((9?5)?7)?(1?(5?5)))?(8?((3?(1?2))?((8?5)?(7?((9?((9?8)?7))?1))))))?1))?1)?(9?2)))?((7?5)?((9?(4?(9?6)))?(8?(((5?7)?2)?(6?(3?8)))))))?(((4?(2?2))?(7?9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day, Yuhao came across a problem about checking if some bracket sequences are correct bracket sequences.\n\nA bracket sequence is any non-empty sequence of opening and closing parentheses. A bracket sequence is called... | [{"type": "stdin_stdout", "input": "30\n)(((())()())()(\n))(()()()(\n))()((\n)())(()\n())())((\n((((())\n(((()))(\n(())\n)()(((()(()\n((())))(\n)()()())((\n))))(()\n()(((()\n)()()(\n(())())\n(()()(())(\n)()((\n)(()(())))\n))))(())((\n)()(()(((((\n(()))((\n()())\n((()()()))\n()((((((((()\n)(()(\n)(((())(()\n)((((()(\n((... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are two popular keyboard layouts in Berland, they differ only in letters positions. All the other keys are the same. In Berland they use alphabet with 26 letters which coincides with English alphabet.\n\nYou are giv... | [{"type": "stdin_stdout", "input": "buneohqdgxjsafrmwtzickvlpy\nzblwamjxifyuqtnrgdkchpoves\n4RZf8YivG6414X1GdDfcCbc10GA0Wz8514LI9D647XzPb66UNh7lX1rDQv0hQvJ7aqhyh1Z39yABGKn24g185Y85ER5q9UqPFaQ2JeK97wHZ78CMSuU8Zf091mePl2OX61BLe5KdmUWodt4BXPiseOZkZ4SZ27qtBM4hT499mCirjy6nB0ZqjQie4Wr3uhW2mGqBlHyEZbW7A6QnsNX9d3j5aHQN0H6GF8J0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEugeny has array a = a_1, a_2, ..., a_{n}, consisting of n integers. Each integer a_{i} equals to -1, or to 1. Also, he has m queries: Query number i is given as a pair of integers l_{i}, r_{i} (1 ≤ l_{i} ≤ r_{i} ≤ n). ... | [{"type": "stdin_stdout", "input": "10 10\n-1 1 -1 1 -1 -1 -1 -1 -1 -1\n6 7\n2 5\n3 6\n1 3\n3 5\n4 5\n3 4\n1 6\n1 1\n1 1\n", "output": "1\n1\n1\n0\n0\n1\n1\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "9 9\n-1 1 1 1 1 1 1 1 1\n1 7\n5 6\n1 4\n1 1\n1 1\n6 8\n1 1\n6 7\n3 5\n", "output": "0\n1\n0\n0\n0\n0\n0\n1\n0\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nВ самолёте есть n рядов мест. Если смотреть на ряды сверху, то в каждом ряду есть 3 места слева, затем проход между рядами, затем 4 центральных места, затем ещё один проход между рядами, а затем ещё 3 места справа.\n\nИзв... | [{"type": "stdin_stdout", "input": "30 1\nPPP-PPP.-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Greatest Secret Ever consists of n words, indexed by positive integers from 1 to n. The secret needs dividing between k Keepers (let's index them by positive integers from 1 to k), the i-th Keeper gets a non-empty set... | [{"type": "stdin_stdout", "input": "18 6\n", "output": "1 1 5 2 1 6 4 6 3 4 5 3 3 2 6 5 4 2\n"}, {"type": "stdin_stdout", "input": "11 3\n", "output": "3 1 2 1 1 2 3 2 2 3 1\n"}, {"type": "stdin_stdout", "input": "10 2\n", "output": "1 1 2 1 1 2 2 1 2 2\n"}, {"type": "stdin_stdout", "input": "9 3\n", "output": "3 1 1 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's been almost a week since Polycarp couldn't get rid of insomnia. And as you may already know, one week in Berland lasts k days!\n\nWhen Polycarp went to a doctor with his problem, the doctor asked him about his sleepi... | [{"type": "stdin_stdout", "input": "10 5\n1384 1129 1780 1960 1567 1928 12 1523 1165 344\n", "output": "6931.3333333333\n"}, {"type": "stdin_stdout", "input": "10 4\n127 1459 718 1183 880 1044 1857 1340 725 1496\n", "output": "4574.4285714286\n"}, {"type": "stdin_stdout", "input": "8 2\n1 2 4 100000 123 456 789 1\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n piles of pebbles on the table, the i-th pile contains a_{i} pebbles. Your task is to paint each pebble using one of the k given colors so that for each color c and any two piles i and j the difference between ... | [{"type": "stdin_stdout", "input": "100 67\n82 34 100 55 38 32 97 34 100 49 49 41 48 100 74 51 53 50 46 38 35 69 93 61 96 86 43 59 90 45 52 100 48 45 63 60 52 66 83 46 66 47 74 37 56 48 42 88 39 68 38 66 77 40 60 60 92 38 45 57 63 91 85 85 89 53 64 66 99 89 49 54 48 58 94 65 78 34 78 62 95 47 64 50 84 52 98 79 57 69 39... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya became interested in bioinformatics. He's going to write an article about similar cyclic DNA sequences, so he invented a new method for determining the similarity of cyclic sequences.\n\nLet's assume that strings s ... | [{"type": "stdin_stdout", "input": "318\nTATCAATCGGTACGTGCGCATCATTGTCAATCGGGCTTCATGGCTTGCGGGCGCTACCCGAGGGGAAGCTGCGGACAGGTAGGTAAGATACACACGAACCAAACGGAGTTATGTTGGATAAATTGGCTGGAAGGGCGTAGGTATATCGAGTCGCGGACCTGGCATAGACTATCAGGGGCAGCGGTACAAGGCAACCGTGAGCGGGGTCTGCCCACCATTAGACCGATGCGCCGGCTCGTATATGTGATTCTGGTGAAAAGTATCATGCCGGGACGCGTA... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLeonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm × h mm sheet of glass, a diamond glass cutter and lots of enthusiasm. What he lac... | [{"type": "stdin_stdout", "input": "5 15 10\nH 8\nH 9\nV 1\nH 2\nH 6\nH 4\nH 1\nV 2\nH 13\nV 3\n", "output": "40\n40\n32\n24\n24\n24\n24\n18\n12\n8\n"}, {"type": "stdin_stdout", "input": "15 5 10\nV 13\nV 10\nV 3\nH 2\nV 9\nV 7\nV 2\nH 1\nV 4\nH 3\n", "output": "65\n50\n35\n21\n18\n12\n12\n12\n9\n6\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Fair Nut found a string $s$. The string consists of lowercase Latin letters. The Nut is a curious guy, so he wants to find the number of strictly increasing sequences $p_1, p_2, \\ldots, p_k$, such that: For each $i... | [{"type": "stdin_stdout", "input": "babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab\n", "output": "813881762"}, {"type": "stdin_stdout", "input": "amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb\n", "output": "9871... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi has two integers X and Y.\nHe computed X + Y and X - Y, and the results were A and B, respectively.\nNow he cannot remember what X and Y were. Find X and Y for him.\n\n-----Constraints-----\n - -100 \\leq A, B \... | [{"type": "stdin_stdout", "input": "-100 -100\n", "output": "-100 0\n"}, {"type": "stdin_stdout", "input": "-100 100\n", "output": "0 -100\n"}, {"type": "stdin_stdout", "input": "-39 -69\n", "output": "-54 15\n"}, {"type": "stdin_stdout", "input": "100 -100\n", "output": "0 100\n"}, {"type": "stdin_stdout", "input": "-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are two 100-story buildings, called A and B. (In this problem, the ground floor is called the first floor.)\nFor each i = 1,\\dots, 100, the i-th floor of A and that of B are connected by a corridor.\nAlso, for each... | [{"type": "stdin_stdout", "input": "1 100 100 100\n", "output": "10000\n"}, {"type": "stdin_stdout", "input": "1 100 50 100\n", "output": "9950\n"}, {"type": "stdin_stdout", "input": "1 100 33 65\n", "output": "6468\n"}, {"type": "stdin_stdout", "input": "1 100 33 67\n", "output": "6567\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArkady's morning seemed to be straight of his nightmare. He overslept through the whole morning and, still half-asleep, got into the tram that arrived the first. Some time after, leaving the tram, he realized that he was ... | [{"type": "stdin_stdout", "input": "2\n64 23 81 66 95 91 56 12 48 24 78 36 67 57 75 88 82 98 83 46 100 58 62 80 8 4 28 74 70 50 42 11 68 18 19 6 94 59 13 72 37 31 90 41 60 34 86 55 76 69 32 21 73 84 3 52 92 79 61 63 38 87 17 14 29\n65 89 14 93 58 60 80 64 28 91 70 48 19 55 75 21 100 98 88 69 7 42 41 81 8 76 54 87 16 56... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou will receive 5 points for solving this problem.\n\nManao has invented a new operation on strings that is called folding. Each fold happens between a pair of consecutive letters and places the second part of the string... | [{"type": "stdin_stdout", "input": "LEHLLLLLLHAFGEGLLHAFDLHHLLLLLDGGEHGGHLLLLLLLLDFLCBLLEFLLCBLLCGLEDLGGLECLDGLEHLLLGELLLEGLLLLGDLLLDALD\n", "output": "49\n"}, {"type": "stdin_stdout", "input": "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "THISISTHELASTTEST\n", "output": "3\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThanks to the Doctor's help, the rebels managed to steal enough gold to launch a full-scale attack on the Empire! However, Darth Vader is looking for revenge and wants to take back his gold.\n\nThe rebels have hidden the ... | [{"type": "stdin_stdout", "input": "1 1\n1 1\n2 2 551454259 292052813\n1 755275238 645143315\n1 936400451 457379982\n1 873148501\n1 181471857\n", "output": "584105626\n"}, {"type": "stdin_stdout", "input": "1 1\n1 1\n2 2 205003324 933814220\n1 974625469 989301423\n1 762016619 720019121\n1 389607162\n1 162417396\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rooted tree on $n$ vertices, its root is the vertex number $1$. The $i$-th vertex contains a number $w_i$. Split it into the minimum possible number of vertical paths in such a way that each path contains ... | [{"type": "stdin_stdout", "input": "2 100000 1000000000000000000\n1000000000 1000000000\n1\n", "output": "1"}, {"type": "stdin_stdout", "input": "3 3 2200000000\n1000000000 1000000000 1000000000\n1 2\n", "output": "2"}, {"type": "stdin_stdout", "input": "7 2 91648\n7 3 6 2 5 4 1\n1 1 1 1 3 2\n", "output": "4"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya commutes by train every day. There are n train stations in the city, and at the i-th station it's possible to buy only tickets to stations from i + 1 to a_{i} inclusive. No tickets are sold at the last station.\n\nL... | [{"type": "stdin_stdout", "input": "10\n2 10 8 7 8 8 10 9 10\n", "output": "63\n"}, {"type": "stdin_stdout", "input": "9\n2 9 7 6 9 7 8 9\n", "output": "52\n"}, {"type": "stdin_stdout", "input": "8\n3 7 7 8 8 7 8\n", "output": "37\n"}, {"type": "stdin_stdout", "input": "7\n7 3 4 6 6 7\n", "output": "35\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs you could know there are no male planes nor female planes. However, each plane on Earth likes some other plane. There are n planes on Earth, numbered from 1 to n, and the plane with number i likes the plane with number... | [{"type": "stdin_stdout", "input": "100\n25 6 46 37 87 99 70 31 46 12 94 40 87 56 28 8 94 39 13 12 67 13 71 39 83 48 40 14 62 41 16 71 20 41 83 41 68 98 23 82 62 83 62 35 49 22 31 21 66 98 54 39 34 52 11 28 47 89 25 44 68 36 91 46 82 86 88 48 27 93 7 9 53 36 16 100 84 84 44 25 58 66 16 46 72 21 91 78 4 17 44 17 47 67 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe classic programming language of Bitland is Bit++. This language is so peculiar and complicated.\n\nThe language is that peculiar as it has exactly one variable, called x. Also, there are two operations:\n\n Operation... | [{"type": "stdin_stdout", "input": "45\n--X\n++X\nX--\n++X\n++X\nX++\n--X\n--X\n--X\n--X\n--X\n--X\n--X\nX++\n++X\nX--\n++X\n++X\nX--\nX++\nX--\n--X\nX--\n++X\n++X\n--X\n--X\nX--\nX--\n--X\n++X\nX--\n--X\n++X\n++X\n--X\n--X\nX--\n++X\n++X\nX++\nX++\n++X\n++X\nX++\n", "output": "-3\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself.\n\nThere are n stations in the subway. It was built according to the Bertown ... | [{"type": "stdin_stdout", "input": "100\n98 52 63 2 18 96 31 58 84 40 41 45 66 100 46 71 26 48 81 20 73 91 68 76 13 93 17 29 64 95 79 21 55 75 19 85 54 51 89 78 15 87 43 59 36 1 90 35 65 56 62 28 86 5 82 49 3 99 33 9 92 32 74 69 27 22 77 16 44 94 34 6 57 70 23 12 61 25 8 11 67 47 83 88 10 14 30 7 97 60 42 37 24 38 53 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne tradition of ACM-ICPC contests is that a team gets a balloon for every solved problem. We assume that the submission time doesn't matter and teams are sorted only by the number of balloons they have. It means that one... | [{"type": "stdin_stdout", "input": "7\n14000000003 1000000000000000000\n81000000000 88000000000\n5000000000 7000000000\n15000000000 39000000000\n46000000000 51000000000\n0 1000000000\n0 0\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "15\n143 698\n269 879\n100 728\n86 855\n368 478\n174 368\n442 980\n812 825\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEach month Blake gets the report containing main economic indicators of the company \"Blake Technologies\". There are n commodities produced by the company. For each of them there is exactly one integer in the final repor... | [{"type": "stdin_stdout", "input": "100 30\n65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 74 57 115 16 55 88 79 97 21 80 41 56 49 103 61 66 1 36 44 43 82 37 38 106 27 114 51 112 55 87 41 69 31 86 58 27 46 99 18 105 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Dima has two sequences of points with integer coordinates: sequence (a_1, 1), (a_2, 2), ..., (a_{n}, n) and sequence (b_1, 1), (b_2, 2), ..., (b_{n}, n).\n\nNow Dima wants to count the number of distinct sequences ... | [{"type": "stdin_stdout", "input": "100\n2 2 10 3 5 6 4 7 9 8 2 7 5 5 1 7 5 9 2 2 10 3 6 10 9 9 10 7 3 9 7 8 8 3 9 3 9 3 3 6 3 7 9 9 7 10 9 1 1 3 6 2 9 5 9 9 6 2 6 5 6 8 2 10 1 1 6 8 8 4 5 2 6 8 8 5 9 2 3 3 7 7 10 5 4 2 10 6 7 6 5 4 10 6 10 3 9 9 1 5\n3 5 6 4 2 3 2 9 3 8 3 1 10 7 4 3 6 9 3 5 9 5 3 10 4 7 9 7 4 3 3 6 9 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Physical education teacher at SESC is a sort of mathematician too. His most favorite topic in mathematics is progressions. That is why the teacher wants the students lined up in non-decreasing height form an arithmeti... | [{"type": "stdin_stdout", "input": "100\n246 485 -940 -186 -841 -98 711 429 -154 164 -244 -111 886 -447 22 480 224 -132 927 812 -243 -152 -843 403 -320 -346 -407 827 645 -903 -172 540 -359 498 270 284 374 -52 -983 -164 -707 -242 -159 -825 -889 661 -629 212 849 -891 -622 810 957 897 -96 -293 -257 822 690 369 -914 212 -3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nShaass has decided to hunt some birds. There are n horizontal electricity wires aligned parallel to each other. Wires are numbered 1 to n from top to bottom. On each wire there are some oskols sitting next to each other. ... | [{"type": "stdin_stdout", "input": "10\n95 54 36 39 98 30 19 24 14 12\n3\n9 5\n8 15\n7 5\n", "output": "95\n54\n36\n39\n98\n34\n0\n28\n13\n21\n"}, {"type": "stdin_stdout", "input": "10\n48 53 10 28 91 56 81 2 67 52\n2\n2 40\n6 51\n", "output": "87\n0\n23\n28\n141\n0\n86\n2\n67\n52\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThink of New York as a rectangular grid consisting of N vertical avenues numerated from 1 to N and M horizontal streets numerated 1 to M. C friends are staying at C hotels located at some street-avenue crossings. They are... | [{"type": "stdin_stdout", "input": "100 100\n10\n53 20\n97 6\n12 74\n48 92\n97 13\n47 96\n75 32\n69 21\n95 75\n1 54\n10\n36 97\n41 1\n1 87\n39 23\n27 44\n73 97\n1 1\n6 26\n48 3\n5 69\n", "output": "108\n4\n"}, {"type": "stdin_stdout", "input": "100 100\n10\n86 72\n25 73\n29 84\n34 33\n29 20\n84 83\n41 80\n22 22\n16 89\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's denote correct match equation (we will denote it as CME) an equation $a + b = c$ there all integers $a$, $b$ and $c$ are greater than zero.\n\nFor example, equations $2 + 2 = 4$ (||+||=||||) and $1 + 2 = 3$ (|+||=||... | [{"type": "stdin_stdout", "input": "100\n928\n970\n950\n921\n945\n974\n941\n999\n964\n920\n926\n942\n934\n918\n930\n901\n977\n961\n978\n962\n951\n909\n994\n953\n946\n993\n982\n922\n933\n932\n904\n910\n991\n937\n963\n988\n983\n903\n956\n976\n967\n958\n902\n986\n960\n965\n940\n914\n955\n987\n952\n971\n939\n966\n938\n911\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given $n$ intervals in form $[l; r]$ on a number line.\n\nYou are also given $m$ queries in form $[x; y]$. What is the minimal number of intervals you have to take so that every point (not necessarily integer) fro... | [{"type": "stdin_stdout", "input": "8 20\n6 10\n6 9\n9 10\n1 3\n5 8\n1 5\n6 8\n6 9\n5 9\n3 8\n8 9\n8 10\n1 9\n8 10\n9 10\n5 7\n6 10\n3 4\n5 9\n7 9\n7 8\n5 6\n9 10\n0 6\n4 8\n7 9\n3 8\n4 10\n", "output": "2\n2\n1\n1\n3\n1\n1\n1\n1\n1\n2\n1\n1\n1\n1\n-1\n2\n1\n2\n3\n"}, {"type": "stdin_stdout", "input": "6 20\n9 10\n0 1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce Max found an electronic calculator from his grandfather Dovlet's chest. He noticed that the numbers were written with seven-segment indicators (https://en.wikipedia.org/wiki/Seven-segment_display). [Image] \n\nMax st... | [{"type": "stdin_stdout", "input": "222145 353252\n", "output": "3860750\n"}, {"type": "stdin_stdout", "input": "213 221442\n", "output": "5645356\n"}, {"type": "stdin_stdout", "input": "1 1000000\n", "output": "28733372\n"}, {"type": "stdin_stdout", "input": "1000000 1000000\n", "output": "38\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLuba has to do n chores today. i-th chore takes a_{i} units of time to complete. It is guaranteed that for every $i \\in [ 2 . . n ]$ the condition a_{i} ≥ a_{i} - 1 is met, so the sequence is sorted.\n\nAlso Luba can wor... | [{"type": "stdin_stdout", "input": "100 1 99\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 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNew Year is coming, and Jaehyun decided to read many books during 2015, unlike this year. He has n books numbered by integers from 1 to n. The weight of the i-th (1 ≤ i ≤ n) book is w_{i}.\n\nAs Jaehyun's house is not lar... | [{"type": "stdin_stdout", "input": "50 60\n86 57 45 93 17 12 40 10 47 80 18 80 3 9 6 55 13 99 5 76 4 70 100 55 27 91 71 3 65 93 41 74 80 56 90 50 58 13 71 9 47 52 26 73 72 21 15 81 88 28\n40 32 5 16 49 23 3 17 14 10 1 15 1 21 28 22 13 45 12 25 44 48 46 32 36 43 11 8 49 7 7 35 10 14 39 4 42 10 30 27 1 17 31 15 8 41 44 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction.... | [{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "396825396825396"}, {"type": "stdin_stdout", "input": "718281828459045235\n", "output": "285032471610732"}, {"type": "stdin_stdout", "input": "987654321234567890\n", "output": "391926317950225"}, {"type": "stdin_stdout", "input": "504000000000000000\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKsusha the Squirrel is standing at the beginning of a straight road, divided into n sectors. The sectors are numbered 1 to n, from left to right. Initially, Ksusha stands in sector 1. \n\nKsusha wants to walk to the end o... | [{"type": "stdin_stdout", "input": "10 3\n..........\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "2 100000\n..\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "3 10000\n.#.\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "7 3\n.#.###.\n", "output": "NO\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the year of $30XX$ participants of some world programming championship live in a single large hotel. The hotel has $n$ floors. Each floor has $m$ sections with a single corridor connecting all of them. The sections are... | [{"type": "stdin_stdout", "input": "10 10 1 8 4\n10\n2 3 4 5 6 7 8 9\n10\n1 1 3 1\n2 1 7 1\n1 1 9 1\n7 1 4 1\n10 1 7 1\n2 1 7 1\n3 1 2 1\n5 1 2 1\n10 1 5 1\n6 1 9 1\n", "output": "3\n4\n4\n3\n3\n4\n3\n3\n4\n3\n"}, {"type": "stdin_stdout", "input": "4 4 1 0 1\n4\n\n5\n1 1 2 2\n1 3 2 2\n3 3 4 3\n3 2 2 2\n1 2 2 3\n", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem is same as the previous one, but has larger constraints.\n\nShiro's just moved to the new house. She wants to invite all friends of her to the house so they can play monopoly. However, her house is too small,... | [{"type": "stdin_stdout", "input": "10\n30518 30518 30518 30518 30518 30518 30518 30518 30518 30518\n", "output": "10"}, {"type": "stdin_stdout", "input": "10\n30518 96518 74071 59971 50121 4862 43967 73607 19138 90754\n", "output": "10"}, {"type": "stdin_stdout", "input": "10\n63649 14562 779 31060 84730 3390 1402 709... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.\n\nOne of the problems of... | [{"type": "stdin_stdout", "input": "100\n11 9 35 34 51 74 16 67 26 21 14 80 84 79 7 61 28 3 53 43 42 5 56 36 69 30 22 88 1 27 65 91 46 31 59 50 17 96 25 18 64 55 78 2 63 24 95 48 93 13 38 76 89 94 15 90 45 81 52 87 83 73 44 49 23 82 85 75 86 33 47 19 58 97 37 20 40 10 92 4 6 68 77 54 71 12 62 60 100 39 41 99 72 29 57 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDima got into number sequences. Now he's got sequence a_1, a_2, ..., a_{n}, consisting of n positive integers. Also, Dima has got a function f(x), which can be defined with the following recurrence: f(0) = 0; f(2·x) = f... | [{"type": "stdin_stdout", "input": "8\n851991424 32517099 310793856 776130403 342626527 58796623 49544509 517126753\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "7\n481003311 553247971 728349004 258700257 916143165 398096105 412826266\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "6\n396640239 6200... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a list of numbers from $1$ to $n$ written from left to right on the blackboard.\n\nYou perform an algorithm consisting of several steps (steps are $1$-indexed). On the $i$-th step you wipe the $i$-th number (cons... | [{"type": "stdin_stdout", "input": "2\n1000000000 1\n1000000000 500000000\n", "output": "2\n1000000000\n"}, {"type": "stdin_stdout", "input": "3\n3 1\n4 2\n69 6\n", "output": "2\n4\n12\n"}, {"type": "stdin_stdout", "input": "1\n2441139 10\n", "output": "20\n"}, {"type": "stdin_stdout", "input": "1\n2441139 12\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a_1, a_2, \\dots , a_n$, which is sorted in non-decreasing order ($a_i \\le a_{i + 1})$. \n\nFind three indices $i$, $j$, $k$ such that $1 \\le i < j < k \\le n$ and it is impossible to construct a... | [{"type": "stdin_stdout", "input": "3\n7\n4 6 11 11 15 18 20\n4\n10 10 10 11\n3\n1 1 1000000000\n", "output": "1 2 7\n-1\n1 2 3\n"}, {"type": "stdin_stdout", "input": "1\n15\n3 4 7 8 9 10 11 12 13 14 15 16 32 36 39\n", "output": "1 2 15\n"}, {"type": "stdin_stdout", "input": "1\n14\n1 2 2 2 2 2 2 2 2 2 2 2 2 4\n", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice is a beginner composer and now she is ready to create another masterpiece. And not even the single one but two at the same time! \n\nAlice has a sheet with n notes written on it. She wants to take two such non-empty... | [{"type": "stdin_stdout", "input": "10\n7776 32915 1030 71664 7542 72359 65387 75222 95899 40333\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "10\n1 1 1 1 1 1 1 1 1 1\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "10\n9 6 8 5 5 2 8 9 2 2\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "6\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the rush of modern life, people often forget how beautiful the world is. The time to enjoy those around them is so little that some even stand in queues to several rooms at the same time in the clinic, running from one... | [{"type": "stdin_stdout", "input": "20 20\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"}, {"type": "stdin_stdout", "input": "10 2\n10 0 9 0 0 4 2 6 8 0\n", "output": "1\n2\n3\n4\n6\n7\n8\n9\n"}, {"type": "stdin_stdout", "input": "10 1\n8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA film festival is coming up in the city N. The festival will last for exactly n days and each day will have a premiere of exactly one film. Each film has a genre — an integer from 1 to k.\n\nOn the i-th day the festival ... | [{"type": "stdin_stdout", "input": "129 37\n15 22 28 15 30 16 11 20 4 26 14 37 29 17 15 15 14 18 1 9 16 22 13 32 5 18 25 11 6 33 33 22 17 9 1 5 27 27 37 4 6 1 3 18 11 33 6 17 2 24 23 1 1 37 35 21 21 17 18 6 31 17 29 18 10 10 30 31 8 3 25 20 34 11 12 12 24 13 5 27 20 31 28 3 36 2 4 13 14 9 33 25 4 26 36 6 2 7 15 9 20 33... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA and B are preparing themselves for programming contests.\n\nB loves to debug his code. But before he runs the solution and starts debugging, he has to first compile the code.\n\nInitially, the compiler displayed n compi... | [{"type": "stdin_stdout", "input": "10\n460626451 802090732 277246428 661369649 388684428 784303821 376287098 656422756 9301599 25720377\n277246428 388684428 661369649 460626451 656422756 802090732 9301599 784303821 376287098\n376287098 802090732 388684428 9301599 656422756 784303821 460626451 277246428\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan had string s consisting of small English letters. However, his friend Julia decided to make fun of him and hid the string s. Ivan preferred making a new string to finding the old one. \n\nIvan knows some information ... | [{"type": "stdin_stdout", "input": "20\nadabacabaeabacabada 1 359\nabadabacabafabaca 1 213\nacabagabacaba 1 315\ncabaeabacabadabacab 1 268\nfabacabadabacabaeab 1 352\ncabafabacabada 1 28\nacabadabacabaea 1 67\ncabadabacabaeabacaba 1 484\nabacabadabacaba 1 209\nacabaiabacaba 1 251\nacabafabacabadabac 1 475\nabacabaeabac... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nВася купил стол, у которого n ножек. Каждая ножка состоит из двух частей, которые соединяются друг с другом. Каждая часть может быть произвольной положительной длины, но гарантируется, что из всех 2n частей возможно соста... | [{"type": "stdin_stdout", "input": "100\n8 7 7 5 2 7 7 5 1 8 6 3 6 7 2 4 4 2 6 8 5 6 5 2 6 1 3 9 5 8 7 6 5 4 8 6 5 5 3 2 6 5 4 9 7 1 5 7 9 5 7 4 1 6 5 8 2 6 6 1 4 2 3 2 3 9 3 8 7 1 2 4 5 7 3 5 5 6 3 8 3 6 1 5 5 3 3 3 8 8 1 4 3 6 7 1 1 2 4 4 7 3 7 7 8 9 5 8 6 6 4 7 4 9 3 4 7 5 2 8 4 1 9 7 9 7 9 6 7 7 9 6 1 1 1 9 9 4 4 1... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.