messages
listlengths
1
1
ground_truth
stringlengths
88
726k
dataset
stringclasses
1 value
[ { "content": "Solve the following coding problem using the programming language python:\n\nA dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying dragon.\n\nA performer...
[{"type": "stdin_stdout", "input": "200\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given n strings. Each string consists of lowercase English letters. Rearrange (reorder) the given strings in such a way that for every string, all strings that are placed before it are its substrings.\n\nString a ...
[{"type": "stdin_stdout", "input": "3\nqwerty\nqwerty\nqwerty\n", "output": "YES\nqwerty\nqwerty\nqwerty\n"}, {"type": "stdin_stdout", "input": "5\na\naba\nabacaba\nba\naba\n", "output": "YES\na\nba\naba\naba\nabacaba\n"}, {"type": "stdin_stdout", "input": "3\nababc\nabababc\nab\n", "output": "YES\nab\nababc\nabababc\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven an array a of N integers a1, a2, a3, ... aN you have to find the longest alternating sub-sequence of this array . \n\nAn alternating sequence b1, b2 ... bk, k ≥ 1 is a sequence that has the 2 following properties:\...
[{"type": "stdin_stdout", "input": "8\n0 2 -1 -10 1 -14 -8 14\n\nEBPMLS", "output": "3\n"}, {"type": "stdin_stdout", "input": "8\n2 2 -1 -12 2 -10 -8 19\n\nSAMPLE", "output": "4\n"}, {"type": "stdin_stdout", "input": "8\n0 2 0 -10 2 -14 -16 30\n\nELOMBS", "output": "3\n"}, {"type": "stdin_stdout", "input": "8\n2 2 -1 -...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMonk has a very good friend, Puchi. As weird as his name, are the games he plays.\nOne fine day, they decided to play a game to test how diverse their choices are. Both of them choose exactly one integer each. Monk choos...
[{"type": "stdin_stdout", "input": "4\n4 6\n2 3\n10 1\n8 11\n\nSM@LPE", "output": "1\n1\n3\n2\n"}, {"type": "stdin_stdout", "input": "4\n4 11\n1 0\n18 1\n2 2\n\nSAMQLE", "output": "4\n1\n3\n0\n"}, {"type": "stdin_stdout", "input": "4\n2 7\n10 1\n10 1\n2 4\n\nSAMPLE", "output": "2\n3\n3\n2\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday professor Ka has given a string task to Oz and RK. He has given a string STR consisting only of characters '(' and ')' and asked them to convert the string STR into a closed one by adding parenthesis to start and/or...
[{"type": "stdin_stdout", "input": "20\n)((())(()()()))))())(((())()())(()()(()))))(((()(((()())))()(()))))))(()()(()())(()))))()()))((()(())())()())(((((()))((()()()(((())((((())))()))((((((()(()))(()())(((((())(()(()))))(()(()))(())()())()((())((((()(((())))))())()))()))))()((())((()()()))()((()))()(()(())))(((()))((...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRoy is going to organize Finals of Coding Contest in his college's computer labs. According to the rules of contest, problem statements will be available on each computer as pdf file.\n\nNow there are N number of computer...
[{"type": "stdin_stdout", "input": "100\n891404 114455\n610316 163967\n749122 997845\n17602 103521\n603077 115726\n155081 68879\n868235 1394\n892190 750264\n81323 17700\n291930 507040\n546018 1106118\n467431 1617425\n708086 648973\n332779 291957\n220784 47794\n235797 953712\n1157318 880076\n493806 588204\n194761 314796...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nUtkarsh is going to Cherrapunji to visit his brother Saharsh. Cherrapunji faces one of largest rainfall in the country. So, Saharsh and Utkarsh decided to measure this rainfall by T Rain Gauges. They were going to measure...
[{"type": "stdin_stdout", "input": "2\n12 1\n10 29\n\nELPMAS", "output": "2.5360\n"}, {"type": "stdin_stdout", "input": "2\n18 2\n10 33\n\nEPML@S", "output": "1.6506\n"}, {"type": "stdin_stdout", "input": "2\n9 1\n10 29\n\nELPMAS", "output": "1.9251\n"}, {"type": "stdin_stdout", "input": "2\n9 1\n10 50\n\nELPMAS", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConst...
[{"type": "stdin_stdout", "input": "108", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "212", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "238", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-152", "output": "No\n"}, {"type": "stdin_stdout", "input": "-263", "output": "No\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a circular pond with a perimeter of K meters, and N houses around them.\n\nThe i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond.\n\nWhen tra...
[{"type": "stdin_stdout", "input": "37 3\n-1 0 91", "output": "-54\n"}, {"type": "stdin_stdout", "input": "10 3\n-2 9 50", "output": "-31\n"}, {"type": "stdin_stdout", "input": "10 3\n-2 5 50", "output": "-35\n"}, {"type": "stdin_stdout", "input": "10 3\n0 1 110", "output": "-99\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nN programmers are going to participate in the preliminary stage of DDCC 20XX. Due to the size of the venue, however, at most 9 contestants can participate in the finals.\n\nThe preliminary stage consists of several rounds...
[{"type": "stdin_stdout", "input": "3\n1 0\n0 10\n7 2", "output": "12\n"}, {"type": "stdin_stdout", "input": "3\n1 0\n0 17\n7 2", "output": "19\n"}, {"type": "stdin_stdout", "input": "3\n1 1\n0 17\n7 2", "output": "20\n"}, {"type": "stdin_stdout", "input": "3\n1 0\n0 27\n7 2", "output": "29\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nE869120 has A 1-yen coins and infinitely many 500-yen coins.\nDetermine if he can pay exactly N yen using only these coins.\n\nConstraints\n\n* N is an integer between 1 and 10000 (inclusive).\n* A is an integer between 0...
[{"type": "stdin_stdout", "input": "2018\n113", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "2018\n111", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "2018\n101", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "2018\n100", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "2018\n110", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a grid with N rows and M columns of squares. Initially, all the squares are white.\n\nThere is a button attached to each row and each column. When a button attached to a row is pressed, the colors of all the squar...
[{"type": "stdin_stdout", "input": "1 13 1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1 13 0", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "7 17 0", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1 20 0", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1 21 3", "output": "Yes\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJoisino has a bar of length N, which has M marks on it. The distance from the left end of the bar to the i-th mark is X_i.\n\nShe will place several squares on this bar. Here, the following conditions must be met:\n\n* On...
[{"type": "stdin_stdout", "input": "10 9\n1 2 3 4 5 6 7 8 9", "output": "100"}, {"type": "stdin_stdout", "input": "1000100000 0", "output": "853613798\n"}, {"type": "stdin_stdout", "input": "1000101000 0", "output": "175288378\n"}, {"type": "stdin_stdout", "input": "1000101001 0", "output": "639898453\n"}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRng is baking cookies.\n\nInitially, he can bake one cookie per second.\n\nHe can also eat the cookies baked by himself. When there are x cookies not yet eaten, he can choose to eat all those cookies. After he finishes ea...
[{"type": "stdin_stdout", "input": "1000000000000 1000000100000", "output": "1000000000000\n"}, {"type": "stdin_stdout", "input": "1000010000000 1000100100001", "output": "1000010000000\n"}, {"type": "stdin_stdout", "input": "1000110000000 1000100100001", "output": "1000102100111\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n\"Fukusekiken\" is a popular ramen shop where you can line up. But recently, I've heard some customers say, \"I can't afford to have vacant seats when I enter the store, even though I have a long waiting time.\" I'd like ...
[{"type": "stdin_stdout", "input": "5\n41\n27\n26", "output": "0\n28\n18\n23\n"}, {"type": "stdin_stdout", "input": "5\n24\n18\n13", "output": "0\n11\n15\n2\n"}, {"type": "stdin_stdout", "input": "5\n24\n27\n13", "output": "0\n11\n18\n2\n"}, {"type": "stdin_stdout", "input": "5\n29\n27\n26", "output": "0\n8\n18\n23\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere was a powerful school where powerful people gathered. At the athletic meet of the powerful school, powerful people march in a formation.\n\nWhile the powerhouses always want to show off their power, most of them don...
[{"type": "stdin_stdout", "input": "3\n156 120\n100 50\n80 100", "output": "1\n"}, {"type": "stdin_stdout", "input": "3\n156 120\n100 50\n80 000", "output": "1\n"}, {"type": "stdin_stdout", "input": "3\n156 159\n100 50\n80 000", "output": "1\n"}, {"type": "stdin_stdout", "input": "3\n156 22\n100 50\n152 000", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nYou decide to invite your friends of the school and your friends of a friend to the Christmas party. The number of students in your school is n, and each student is assigned a number from 1 to n. Your number is...
[{"type": "stdin_stdout", "input": "6\n5\n1 2\n1 3\n3 4\n2 3\n4 5\n10\n5\n2 3\n3 4\n4 3\n5 6\n1 6\n0\n0", "output": "3\n2\n"}, {"type": "stdin_stdout", "input": "6\n5\n1 2\n1 3\n3 4\n2 3\n4 5\n6\n5\n2 3\n3 4\n4 5\n5 6\n2 6\n0\n0", "output": "3\n0\n"}, {"type": "stdin_stdout", "input": "6\n5\n1 2\n1 3\n3 4\n2 3\n4 5\n6\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nI came to the summer festival with the elementary school students in my neighborhood. To put it bluntly, it plays the role of a guardian, but the smell of yakisoba and takoyaki in the store, and the sound of fireworks tha...
[{"type": "stdin_stdout", "input": ".......#######......................#######..............\n.......#.....#......................#..-..#..............\n.......#.|...#......................#.|.|.#..............\n.......#.....#......................#..-..#..............\n.......#.|...#......................#.|...#........
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe surveyor starship Hakodate-maru is famous for her two fuel containers with unbounded capacities. They hold the same type of atomic fuel balls.\n\nThere, however, is an inconvenience. The shapes of the fuel containers ...
[{"type": "stdin_stdout", "input": "100\n160\n50\n20\n150323\n0", "output": "99\n160\n47\n20\n150303\n"}, {"type": "stdin_stdout", "input": "100\n31\n37\n104\n151200\n0", "output": "99\n31\n37\n99\n151200\n"}, {"type": "stdin_stdout", "input": "100\n84\n50\n20\n151200\n0", "output": "99\n84\n47\n20\n151200\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a tree that has n nodes and n-1 edges. There are military bases on t out of the n nodes. We want to disconnect the bases as much as possible by destroying k edges. The tree will be split into k+1 regions when we ...
[{"type": "stdin_stdout", "input": "2 2 0\n2 2 -1\n1\n2\n4 3 2\n1 2 1\n1 3 2\n1 4 4\n2\n3\n4\n0 0 0", "output": "Case 1: 0\nCase 2: 3\n"}, {"type": "stdin_stdout", "input": "2 2 0\n1 2 1\n1\n2\n4 3 2\n1 2 1\n1 3 2\n1 4 3\n2\n3\n4\n0 0 0", "output": "Case 1: 0\nCase 2: 3\n"}, {"type": "stdin_stdout", "input": "2 2 1\n1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nGaccho loses motivation as the final exam approaches and often misses school.\nThere are N days left until the final exam.\nGaccho's motivation on day i is Xi, and the motivation needed to go to school on day i...
[{"type": "stdin_stdout", "input": "6 10\n-1 1\n1 2\n1 3\n2 3\n1 3", "output": "5\n"}, {"type": "stdin_stdout", "input": "6 4\n1 0\n1 2\n1 -1\n0 3\n-1 3", "output": "5\n"}, {"type": "stdin_stdout", "input": "6 6\n0 1\n2 2\n1 2\n-1 3\n1 3", "output": "5\n"}, {"type": "stdin_stdout", "input": "6 10\n0 1\n1 2\n1 3\n2 3\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads an directed graph $G = (V, E)$, and finds the shortest distance from vertex $1$ to each vertex (the number of edges in the shortest path). Vertices are identified by IDs $1, 2, ... n$.\n\nConst...
[{"type": "stdin_stdout", "input": "4\n1 2 1 4\n2 -1 4\n0 -1\n4 1 0", "output": "1 0\n2 -1\n3 -1\n4 1\n"}, {"type": "stdin_stdout", "input": "4\n1 2 1 4\n2 0 4\n0 -1\n4 -1 0", "output": "1 0\n2 -1\n3 -1\n4 1\n"}, {"type": "stdin_stdout", "input": "4\n1 2 1 4\n3 0 4\n0 -1\n4 -1 0", "output": "1 0\n2 -1\n3 -1\n4 1\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads the two dices constructed in the same way as Dice I, and determines whether these two dices are identical. You can roll a dice in the same way as Dice I, and if all integers observed from the s...
[{"type": "stdin_stdout", "input": "-2 2 -3 -1 461 1\n3 0 4 0 13 -1", "output": "No\n"}, {"type": "stdin_stdout", "input": "-1 2 -3 -1 461 1\n3 0 4 0 13 -1", "output": "No\n"}, {"type": "stdin_stdout", "input": "-1 2 -3 -1 461 1\n3 0 6 0 13 -1", "output": "No\n"}, {"type": "stdin_stdout", "input": "-1 2 -3 -1 461 2\n3 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently, you bought a brand new smart lamp with programming features. At first, you set up a schedule to the lamp. Every day it will turn power on at moment 0 and turn power off at moment M. Moreover, the lamp allows you...
[{"type": "stdin_stdout", "input": "7 1000000000\n1 10001 10011 20011 20021 40021 40031\n", "output": "999999969\n"}, {"type": "stdin_stdout", "input": "7 1000000000\n3 10001 10011 20011 20021 40021 40031\n", "output": "999999969\n"}, {"type": "stdin_stdout", "input": "7 1000000000\n1 10001 10011 20011 33966 40021 4003...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIs there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras. \n\nInspired by this adventure and an a...
[{"type": "stdin_stdout", "input": "wwwbbwbbbwbwbwwbwwbbbwbwbwwbbbwbwwwbwwbwbbbbwwbwwwwwbwwwwwwwwbbwwwwbbbbbwbwbbwwbbbbbwbwbbwbwwwbbwwbbbwwwbbwwbwwbbbbwwbwbbwbwwbbwbwbwbbwwbwwwbwbwbbbwwwwwwbwwbbbwwbwwbwbwwwbbwwwwwwwwwbwwbwbbbwbwwwwbwwbbwbbwbwwbwwbwwbbwbbwwwwbwwwbwwwbwbwwwbbwwbbwwbwbwwwwwwbwbwwwwbbwwwbwbwwwbbwwwwwbwwbwb...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSomeone give a strange birthday present to Ivan. It is hedgehog — connected undirected graph in which one vertex has degree at least 3 (we will call it center) and all other vertices has degree 1. Ivan thought that hedgeh...
[{"type": "stdin_stdout", "input": "33 2\n3 13\n17 3\n2 6\n5 33\n4 18\n1 2\n31 5\n4 19\n3 16\n1 3\n9 2\n10 3\n5 1\n5 28\n21 4\n7 2\n1 4\n5 24\n30 5\n14 3\n3 11\n27 5\n8 2\n22 4\n12 3\n20 4\n26 5\n4 23\n32 5\n25 5\n15 3\n29 5\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "25 2\n1 2\n1 3\n1 4\n2 5\n2 6\n2 7\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\n\...
[{"type": "stdin_stdout", "input": "1334146180889758954\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "123456789123456789\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "999999999999994744\n", "output": "YES\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVivek initially has an empty array a and some integer constant m.\n\nHe performs the following algorithm:\n\n 1. Select a random integer x uniformly in range from 1 to m and append it to the end of a. \n 2. Compute the ...
[{"type": "stdin_stdout", "input": "100000\n", "output": "534174612\n"}, {"type": "stdin_stdout", "input": "30238\n", "output": "750441533\n"}, {"type": "stdin_stdout", "input": "47539\n", "output": "442384963\n"}, {"type": "stdin_stdout", "input": "78088\n", "output": "185311544\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAnd now the numerous qualifying tournaments for one of the most prestigious Russian contests Russian Codec Cup are over. All n participants who have made it to the finals found themselves in a huge m-floored 108-star hote...
[{"type": "stdin_stdout", "input": "8 5\n2 2 91\n5 1 97\n5 1 36\n5 4 19\n2 5 50\n4 2 1\n1 4 9\n3 2 32\n", "output": "91\n104\n40\n21\n60\n7\n19\n39\n"}, {"type": "stdin_stdout", "input": "8 5\n2 2 91\n5 1 97\n5 1 36\n5 4 19\n2 5 50\n4 2 1\n1 4 9\n3 4 32\n", "output": "91 104 40 21 60 7 19 35"}, {"type": "stdin_stdout",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a country with n citizens. The i-th of them initially has a_{i} money. The government strictly controls the wealth of its citizens. Whenever a citizen makes a purchase or earns some money, they must send a receip...
[{"type": "stdin_stdout", "input": "10\n7 9 4 4 7 6 3 7 9 10\n10\n1 4 2\n1 10 5\n1 5 3\n1 5 2\n1 2 9\n1 2 9\n1 2 10\n1 5 7\n1 6 10\n1 10 9\n", "output": "7 10 4 2 7 10 3 7 9 9\n"}, {"type": "stdin_stdout", "input": "10\n7 9 4 4 7 6 3 7 9 8\n10\n1 3 2\n1 10 5\n1 5 3\n1 5 2\n1 2 9\n1 2 9\n1 2 10\n1 5 7\n1 6 10\n1 10 9\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe final match of the Berland Football Cup has been held recently. The referee has shown n yellow cards throughout the match. At the beginning of the match there were a_1 players in the first team and a_2 players in the ...
[{"type": "stdin_stdout", "input": "1000\n1000\n1000\n1000\n2000000\n", "output": "2000 2000\n"}, {"type": "stdin_stdout", "input": "1000\n1000\n1000\n1000\n1999999\n", "output": "1999 1999\n"}, {"type": "stdin_stdout", "input": "1000\n1000\n1000\n1001\n2000000\n", "output": "1000 1999\n"}, {"type": "stdin_stdout", "in...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are playing a game where your character should overcome different obstacles. The current problem is to come down from a cliff. The cliff has height h, and there is a moving platform on each height x from 1 to h.\n\nEa...
[{"type": "stdin_stdout", "input": "28\n8 4\n8 7 6 3\n8 5\n8 7 6 3 1\n8 5\n8 7 6 3 2\n8 6\n8 7 6 3 2 1\n8 4\n8 7 6 4\n8 5\n8 7 6 4 1\n8 5\n8 7 6 4 2\n8 6\n8 7 6 4 2 1\n8 5\n8 7 6 4 3\n8 6\n8 7 6 4 3 1\n8 6\n8 7 6 4 3 2\n8 7\n8 7 6 4 3 2 1\n8 4\n8 7 6 5\n8 5\n8 7 6 5 1\n8 5\n8 7 6 5 2\n8 6\n8 7 6 5 2 1\n8 5\n8 7 6 5 3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a binary string of length n (i. e. a string consisting of n characters '0' and '1').\n\nIn one move you can swap two adjacent characters of the string. What is the lexicographically minimum possible string y...
[{"type": "stdin_stdout", "input": "3\n8 10\n01011011\n7 6\n0111100\n7 11\n0111100\n", "output": "00011111\n0011011\n0001111\n"}, {"type": "stdin_stdout", "input": "3\n8 10\n01011011\n7 6\n0111100\n7 15\n1111100\n", "output": "00011111\n0011011\n0011111\n"}, {"type": "stdin_stdout", "input": "3\n8 10\n01011011\n7 9\n01...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAsterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.\n\nA little later they found a string s, ...
[{"type": "stdin_stdout", "input": "btbdpnzdenxueteteytvkwnegodyhmdwhmrmbftrifytzudumzlacwytsuzefqfpjesdblxhpcsidgksisjdmhyxmmugrjmtfcgxmcgpmvbxbyszdugvmoyjeeqsywcvuqskcjotyhvdijyslgfvyujxthngnonasgnbzzygyikhfelirdfsvuicbiazfdeqecbtbdpnzdenxueteteytvkwnegodyhmdwhmrmbftrifytzudumzlacwytsuzefqfpjesdblxhpcsidgksisjdmhyxmm...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe spring is coming and it means that a lot of fruits appear on the counters. One sunny day little boy Valera decided to go shopping. He made a list of m fruits he wanted to buy. If Valera want to buy more than one fruit...
[{"type": "stdin_stdout", "input": "24 24\n25 69 103 18 40 8 78 14 14 10 27 61 75 140 10 69 80 71 102 8 91 14 15 10\nswtcofrcpeys{ydwkrg\nszyd\ndyzsyep\nrcpeyszydwkrgfj\nfgrkwdyzsyfp\ndwyz\nsmzginydyrtua\nj\nk\ntzwsw\ngfj\nmsplnqossy\ninydyrtuatzw\ninxdy\nlpsmzginydyrtuatzwswtcofrcpeyszy\nyssoqnlpsm\npeyszyd\nysosqnlps...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWu got hungry after an intense training session, and came to a nearby store to buy his favourite instant noodles. After Wu paid for his purchase, the cashier gave him an interesting task.\n\nYou are given a bipartite grap...
[{"type": "stdin_stdout", "input": "1\n100 31\n10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of integers a_1,a_2,…,a_n. Find the maximum possible value of a_ia_ja_ka_la_t among all five indices (i, j, k, l, t) (i<j<k<l<t).\n\nInput\n\nThe input consists of multiple test cases. The first lin...
[{"type": "stdin_stdout", "input": "4\n5\n-1 -1 -4 -1 -5\n6\n-4 -4 -3 1 2 -1\n6\n0 -1 -1 -1 -1 -1\n6\n-12 -7 -10 -3 -2 1\n", "output": "-20\n96\n0\n2520\n"}, {"type": "stdin_stdout", "input": "4\n5\n-1 -1 -4 -1 -5\n6\n-4 -4 -3 1 2 -1\n6\n0 -1 -1 -1 -1 -1\n6\n-9 -7 -10 -3 -2 1\n", "output": "-20\n96\n0\n1890\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are a paparazzi working in Manhattan.\n\nManhattan has r south-to-north streets, denoted by numbers 1, 2,…, r in order from west to east, and r west-to-east streets, denoted by numbers 1,2,…,r in order from south to n...
[{"type": "stdin_stdout", "input": "500 10\n69 477 122\n73 186 235\n341 101 145\n372 77 497\n390 117 440\n494 471 37\n522 300 498\n682 149 379\n821 486 359\n855 157 386\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "500 10\n69 477 122\n73 186 235\n341 101 145\n372 77 497\n404 117 440\n494 471 37\n522 300 498\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between the easy and hard versions is that tokens of type O do not appear in the input of the easy version.\n\nErrichto gave Monogon the following challenge in order to intimidate him from taking his t...
[{"type": "stdin_stdout", "input": "3\n3\n.X.\nXXX\n.X.\n6\nXX.XXX\nXXXXXX\nXXX.XX\nXXXXXX\nXX.X.X\nXXXXXX\n5\nXXX.X\n.X..X\nXXX.X\n..X..\n..X..\n", "output": "\n.X.\nXOX\n.X.\nXX.XXO\nXOXXOX\nOXX.XX\nXOOXXO\nXX.X.X\nOXXOXX\nXOX.X\n.X..X\nXXO.O\n..X..\n..X..\n"}, {"type": "stdin_stdout", "input": "3\n3\n.X.\nXXX\n.X.\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the 2022 year, Mike found two binary integers a and b of length n (both of them are written only by digits 0 and 1) that can have leading zeroes. In order not to forget them, he wanted to construct integer d in the fol...
[{"type": "stdin_stdout", "input": "5\n1\n0\n3\n011\n3\n110\n6\n111000\n6\n001011\n", "output": "\n1\n110\n100\n101101\n101110\n"}, {"type": "stdin_stdout", "input": "5\n1\n0\n3\n011\n3\n110\n6\n111100\n6\n001011\n", "output": "1\n110\n100\n101001\n101110\n"}, {"type": "stdin_stdout", "input": "5\n1\n0\n3\n011\n3\n111\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chore...
[{"type": "stdin_stdout", "input": "100\n2382 7572 9578 1364 2325 2929 7670 5574 2836 2440 6553 1751 929 8785 6894 9373 9308 7338 6380 9541 9951 6785 13181 9942 5087 7544 6582 7139 8458 7424 9759 8199 9464 8817 7625 6200 4955 9373 9500 3062 849 4210 9337 5466 2190 8150 4971 3145 869 5675 1975 161 1998 378 5229 9000 895...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n<image>\n\nWilliam is a huge fan of planning ahead. That is why he starts his morning routine by creating a nested list of upcoming errands.\n\nA valid nested list is any list which can be created from a list with one ite...
[{"type": "stdin_stdout", "input": "10\n4\n1\n1\n1\n1\n4\n1\n1\n1\n2\n4\n1\n1\n1\n1\n4\n1\n1\n2\n2\n4\n1\n1\n2\n3\n4\n1\n1\n1\n1\n4\n1\n2\n1\n2\n4\n1\n2\n1\n1\n4\n1\n2\n3\n1\n4\n1\n2\n3\n1\n", "output": "1\n1.1\n1.1.1\n1.1.1.1\n1\n1.1\n1.1.1\n1.1.2\n1\n1.1\n1.1.1\n1.1.1.1\n1\n1.1\n1.2\n2\n1\n1.1\n1.2\n1.3\n1\n1.1\n1.1....
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIlya plays a card game by the following rules.\n\nA player has several cards. Each card contains two non-negative integers inscribed, one at the top of the card and one at the bottom. At the beginning of the round the pla...
[{"type": "stdin_stdout", "input": "100\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 0\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\n0 1\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTo celebrate the second ABBYY Cup tournament, the Smart Beaver decided to throw a party. The Beaver has a lot of acquaintances, some of them are friends with each other, and some of them dislike each other. To make party ...
[{"type": "stdin_stdout", "input": "13\n78\n11 1\n10 6\n6 2\n10 1\n11 6\n11 3\n5 3\n8 1\n12 11\n4 2\n10 3\n13 8\n9 8\n11 7\n7 5\n11 2\n7 1\n4 1\n11 10\n8 3\n13 11\n9 6\n13 9\n12 7\n12 8\n12 9\n10 2\n5 2\n12 10\n9 2\n9 7\n3 2\n7 4\n11 4\n13 1\n10 5\n11 5\n8 5\n10 4\n8 2\n10 9\n4 3\n9 5\n13 12\n13 5\n7 2\n12 4\n9 1\n10 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant loves playing with arrays. He has array a, consisting of n positive integers, indexed from 1 to n. Let's denote the number with index i as ai. \n\nAdditionally the Little Elephant has m queries to the ...
[{"type": "stdin_stdout", "input": "6 6\n1 2 2 3 3 3\n1 2\n2 2\n1 3\n2 4\n4 6\n1 6\n", "output": "1\n0\n2\n1\n1\n3\n"}, {"type": "stdin_stdout", "input": "6 6\n1 2 2 3 3 3\n1 2\n2 2\n1 3\n2 4\n4 6\n1 3\n", "output": "1\n0\n2\n1\n1\n2\n"}, {"type": "stdin_stdout", "input": "6 6\n1 2 2 3 2 3\n1 2\n2 2\n1 3\n2 4\n4 6\n1 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarpus just has been out of luck lately! As soon as he found a job in the \"Binary Cat\" cafe, the club got burgled. All ice-cream was stolen.\n\nOn the burglary night Polycarpus kept a careful record of all club visi...
[{"type": "stdin_stdout", "input": "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEmuskald is a well-known illusionist. One of his trademark tricks involves a set of magical boxes. The essence of the trick is in packing the boxes inside other boxes.\n\nFrom the top view each magical box looks like a sq...
[{"type": "stdin_stdout", "input": "15\n999999986 268435456\n999999987 67108864\n999999988 16777216\n999999989 4194304\n999999990 1048576\n999999991 262144\n999999992 65536\n999999993 16384\n999999994 4096\n999999995 1024\n999999996 256\n999999997 64\n999999998 16\n999999999 4\n1000000000 1\n", "output": "1000000001\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA system of n vessels with water is given. Several pairs of vessels are connected by tubes with transfusion mechanisms. One may transfer an integer amount of liters of water between two vessels connected by such tube (tub...
[{"type": "stdin_stdout", "input": "5 1000000000 4\n1000000000 1000000000 1000000000 1000000000 294967296\n-1 -1 0 0 0\n1 2\n2 3\n3 4\n4 0\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "5 1000000000 4\n1000000000 1000000000 1000000000 1000000000 409977952\n-1 -1 0 0 0\n1 2\n2 3\n3 4\n4 0\n", "output": "NO\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIahub is so happy about inventing bubble sort graphs that he's staying all day long at the office and writing permutations. Iahubina is angry that she is no more important for Iahub. When Iahub goes away, Iahubina comes t...
[{"type": "stdin_stdout", "input": "20\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n", "output": "927799753\n"}, {"type": "stdin_stdout", "input": "10\n4 10 -1 1 6 8 9 2 -1 -1\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "10\n3 10 -1 1 6 8 9 2 -1 -1\n", "output": "6\n"}, {"type": "stdin_stdo...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFox Ciel studies number theory.\n\nShe thinks a non-empty set S contains non-negative integers is perfect if and only if for any <image> (a can be equal to b), <image>. Where operation xor means exclusive or operation (ht...
[{"type": "stdin_stdout", "input": "1000000000\n", "output": "866215044\n"}, {"type": "stdin_stdout", "input": "1059916422\n", "output": "691290739\n"}, {"type": "stdin_stdout", "input": "1000001000\n", "output": "214567917\n"}, {"type": "stdin_stdout", "input": "1001707390\n", "output": "183716036\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a mysterious language (codenamed \"Secret\") available in \"Custom Invocation\" tab. Figure out what this language is and write a program which prints its name. Note that the program must be written in this ...
[{"type": "stdin_stdout", "input": "-111\n", "output": "INTERCAL\n"}, {"type": "stdin_stdout", "input": "-165\n", "output": "INTERCAL\n"}, {"type": "stdin_stdout", "input": "-137\n", "output": "INTERCAL\n"}, {"type": "stdin_stdout", "input": "-116\n", "output": "INTERCAL\n"}, {"type": "stdin_stdout", "input": "-14\n", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nParmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (although he's not)! Parmida has prepared the following test problem for Pashmak.\n\nThere is ...
[{"type": "stdin_stdout", "input": "24\n1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4\n", "output": "114\n"}, {"type": "stdin_stdout", "input": "24\n1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 1 4\n", "output": "114\n"}, {"type": "stdin_stdout", "input": "24\n1 2 3 4 1 2 3 2 1 2 3 4 1 2 3 4 1 2 3 4 1 2 1 4\n", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nImagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the floor number a. You are very...
[{"type": "stdin_stdout", "input": "5000 2314 1234 5000\n", "output": "546628648\n"}, {"type": "stdin_stdout", "input": "4988 3629 4106 4488\n", "output": "349016655\n"}, {"type": "stdin_stdout", "input": "5000 1031 4782 5000\n", "output": "981271392\n"}, {"type": "stdin_stdout", "input": "5000 4998 5000 5000\n", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMany years have passed, and n friends met at a party again. Technologies have leaped forward since the last meeting, cameras with timer appeared and now it is not obligatory for one of the friends to stand with a camera, ...
[{"type": "stdin_stdout", "input": "10\n489 685\n857 870\n736 221\n687 697\n166 360\n265 200\n738 519\n393 760\n66 176\n798 160\n", "output": "3231747\n"}, {"type": "stdin_stdout", "input": "10\n864 874\n534 702\n73 363\n856 895\n827 72\n435 468\n888 921\n814 703\n648 715\n384 781\n", "output": "4909752\n"}, {"type": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's define the permutation of length n as an array p = [p1, p2, ..., pn] consisting of n distinct integers from range from 1 to n. We say that this permutation maps value 1 into the value p1, value 2 into the value p2 a...
[{"type": "stdin_stdout", "input": "50 20365011074\n", "output": "2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49\n"}, {"type": "stdin_stdout", "input": "50 5608642004\n", "output": "1 2 4 3 5 6 8 7 9 10 11 13 12 15 14 17 16 18...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKefa decided to celebrate his first big salary by going to the restaurant. \n\nHe lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house...
[{"type": "stdin_stdout", "input": "15 2\n1 0 1 0 1 0 0 0 0 0 0 0 0 1 0\n1 2\n1 3\n2 4\n2 5\n3 6\n1 7\n4 8\n4 9\n5 10\n5 11\n6 12\n6 13\n12 14\n7 15\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "15 2\n1 0 1 0 1 0 0 0 0 0 0 0 0 1 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7\n4 8\n4 9\n5 10\n5 11\n6 12\n6 13\n7 14\n11 15\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen Xellos was doing a practice course in university, he once had to measure the intensity of an effect that slowly approached equilibrium. A good way to determine the equilibrium intensity would be choosing a sufficient...
[{"type": "stdin_stdout", "input": "15\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "15\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1001 1000 1000 1000 1000\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "15\n1000 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n problems prepared for the next Codeforces round. They are arranged in ascending order by their difficulty, and no two problems have the same difficulty. Moreover, there are m pairs of similar problems. Authors...
[{"type": "stdin_stdout", "input": "100000 10\n99562 484\n1099 99684\n593 99867\n99529 175\n99738 616\n99523 766\n99503 121\n99784 158\n199 99199\n15 99849\n", "output": "98100\n"}, {"type": "stdin_stdout", "input": "100000 10\n99562 484\n1099 99684\n593 99867\n99529 175\n99738 616\n99523 766\n42925 121\n99784 158\n199...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEfim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he de...
[{"type": "stdin_stdout", "input": "320 142\n2704701300865535.432223312233434114130011113220102420131323010344144201124303144444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444447444444444444444444444444444444615444444482101673308979557675074444444444444446...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it ...
[{"type": "stdin_stdout", "input": "999999999 1000000000 1000000000 1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "1714658473 1000000000 999999990 1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "999999999 1000000000 1000000100 1000000000\n", "output": "10000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSince the giant heads have appeared in the sky all humanity is in danger, so all Ricks and Mortys from all parallel universes are gathering in groups to find a solution to get rid of them. \n\nThere are n parallel univers...
[{"type": "stdin_stdout", "input": "100 50\n2 62 -62\n2 19 -19\n2 38 -38\n2 -84 84\n2 -16 16\n2 67 -67\n2 41 -41\n2 -32 32\n2 32 -32\n2 -62 62\n2 89 -89\n2 -84 84\n2 96 -96\n2 -11 11\n2 59 -59\n2 -13 13\n2 -70 70\n2 -3 3\n2 -41 41\n2 -74 74\n2 47 -47\n2 87 -87\n2 17 -17\n2 20 -20\n2 -14 14\n2 -67 67\n2 -95 95\n2 -15 15...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAn atom of element X can exist in n distinct states with energies E1 < E2 < ... < En. Arkady wants to build a laser on this element, using a three-level scheme. Here is a simplified description of the scheme. \n\nThree di...
[{"type": "stdin_stdout", "input": "50 64\n257 258 350 375 1014 1017 1051 1097 1169 1177 1223 1836 1942 1983 2111 2131 2341 2418 2593 2902 2948 3157 3243 3523 3566 4079 4499 4754 5060 5624 6279 6976 7011 7071 7278 7366 7408 7466 7526 7837 7934 8532 8577 8680 9221 9271 9327 9411 9590 9794\n", "output": "0.918918918919"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n<image>\n\nYou have one chip and one chance to play roulette. Are you feeling lucky?\n\nOutput\n\nPrint your bet. Your chip must be placed entirely within some square (not on an edge or a corner shared by adjacent squares...
[{"type": "stdin_stdout", "input": "-105\n", "output": "red\n"}, {"type": "stdin_stdout", "input": "-108\n", "output": "red\n"}, {"type": "stdin_stdout", "input": "-117\n", "output": "red\n"}, {"type": "stdin_stdout", "input": "-121\n", "output": "red\n"}, {"type": "stdin_stdout", "input": "-157\n", "output": "red\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.\n\nMost damage those strange...
[{"type": "stdin_stdout", "input": "7002108534951820589946967018226114921984364117669853212254634761258884835434844673935047882480101006606512119541798298905598015607366335061012709906661245805358900665571472645463994925687210711492820804158354236327017974683658305043146543214454877759341394.202118562635032813887482826...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIkshu and his machine gun\n\nTo celebrate his new year Ikshu went to play \"beyond to beyond\" (abbreviated as BOB) with his friends.\nBOB can be described as follows :\nIt consists of Infinite boxes arranged one over ano...
[{"type": "stdin_stdout", "input": "5020\n50952 27934 26386 45282 37261 21958 53523 7620 51404 18144 13722 50860 20764 22350 59525 43411 44184 17513 34709 57358 8380 1048 25498 49181 56055 5073 14827 41631 52664 56188 38519 1974 31615 18060 56035 12106 49806 58549 44763 43223 54360 53789 39273 5893 32358 16773 34761 57...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRahul likes to play with mathematics and geometry and when it comes for 2D geometry, he just can’t stop himself doing experiments. While working with 2D geometry, he came up with an interesting pattern of numbers as shown...
[{"type": "stdin_stdout", "input": "12\n1 3\n4 6\n7 9\n2 3\n5 6\n8 9\n5 5\n46 46\n89 89\n96 96\n94 94\n79 97", "output": "No Number\nNo Number\nNo Number\nNo Number\nNo Number\nNo Number\n9\n92\n177\n192\n188\nNo Number\n"}, {"type": "stdin_stdout", "input": "3\n1 2\n11 0\n3 4\n\nSAMPLE", "output": "No Number\nNo Numbe...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEveryone has got to know that HELL and Printf{} use cheats while playing Counter-Strike 1.6. Everyone decides to give them a punishment.\nThey are going to be made to paint all the rooms of the ground floor of the hostel....
[{"type": "stdin_stdout", "input": "2\n4 1\n20 1\n\nMR@PLF", "output": "8991\n89999999999999999991\n"}, {"type": "stdin_stdout", "input": "2\n3 1\n20 1\n\nMR@PLF", "output": "891\n89999999999999999991\n"}, {"type": "stdin_stdout", "input": "2\n7 1\n16 2\n\nE@QMLS", "output": "8999991\n9899999999999901\n"}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have a string S of length N. Initially, all characters in S are `1`s.\n\nYou will perform queries Q times. In the i-th query, you are given two integers L_i, R_i and a character D_i (which is a digit). Then, you must ...
[{"type": "stdin_stdout", "input": "8 8\n3 7 2\n1 4 7\n3 8 3\n2 2 4\n4 5 1", "output": "11222221\n77772221\n77333333\n74333333\n74311333\n74311333\n74311333\n74311333\n"}, {"type": "stdin_stdout", "input": "8 8\n3 7 2\n1 4 3\n3 8 3\n2 2 4\n4 5 1", "output": "11222221\n33332221\n33333333\n34333333\n34311333\n34311333\n3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou start with the number 0 and you want to reach the number N.\n\nYou can change the number, paying a certain amount of coins, with the following operations:\n\n* Multiply the number by 2, paying A coins.\n* Multiply the...
[{"type": "stdin_stdout", "input": "5\n11 1 4 4 8\n11 1 2 2 8\n32 10 8 5 4\n29384293847243 454353412 332423423 1011333844 1\n900000000000000000 332423423 454353412 1637794384 987654321", "output": "21\n19\n26\n3821859835\n27283812973\n"}, {"type": "stdin_stdout", "input": "5\n13 1 4 4 8\n15 1 2 2 8\n32 10 8 5 4\n293842...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a sequence of N integers A_1, \\ldots, A_N.\n\nFind the (multiplicative) inverse of the sum of the inverses of these numbers, \\frac{1}{\\frac{1}{A_1} + \\ldots + \\frac{1}{A_N}}.\n\nConstraints\n\n* 1 \\leq N \\...
[{"type": "stdin_stdout", "input": "3\n200 200 200", "output": "66.66666666666667"}, {"type": "stdin_stdout", "input": "3\n283 200 200", "output": "73.8903394256\n"}, {"type": "stdin_stdout", "input": "3\n114 143 200", "output": "48.1581046350\n"}, {"type": "stdin_stdout", "input": "3\n200 200 197", "output": "66.32996...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are two buttons, one of size A and one of size B.\n\nWhen you press a button of size X, you get X coins and the size of that button decreases by 1.\n\nYou will press a button twice. Here, you can press the same butt...
[{"type": "stdin_stdout", "input": "-134 -12", "output": "-25\n"}, {"type": "stdin_stdout", "input": "-134 -8", "output": "-17\n"}, {"type": "stdin_stdout", "input": "-13 -10", "output": "-21\n"}, {"type": "stdin_stdout", "input": "100 100", "output": "200\n"}, {"type": "stdin_stdout", "input": "111 111", "output": "22...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer N. Among the divisors of N! (= 1 \\times 2 \\times ... \\times N), how many Shichi-Go numbers (literally \"Seven-Five numbers\") are there?\n\nHere, a Shichi-Go number is a positive integer that h...
[{"type": "stdin_stdout", "input": "100", "output": "543"}, {"type": "stdin_stdout", "input": "72", "output": "227\n"}, {"type": "stdin_stdout", "input": "59", "output": "148\n"}, {"type": "stdin_stdout", "input": "52", "output": "123\n"}, {"type": "stdin_stdout", "input": "67", "output": "170\n"}, {"type": "stdin_stdo...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke found a record of a tree with N vertices in ancient ruins. The findings are as follows:\n\n* The vertices of the tree were numbered 1,2,...,N, and the edges were numbered 1,2,...,N-1.\n* Edge i connected Vertex a_i ...
[{"type": "stdin_stdout", "input": "15\n9 10\n9 15\n15 4\n4 13\n13 2\n13 11\n2 14\n13 6\n11 1\n2 12\n12 3\n12 7\n2 5\n14 8\n1154 890 2365 883 2930 2076 1590 1104 1726 1791 1091 1226 151 1000 1657", "output": "5\n6\n86\n104\n739\n85\n10\n148\n4\n37\n87\n28\n156\n8\n"}, {"type": "stdin_stdout", "input": "15\n9 10\n9 15\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke is playing a puzzle game. In this game, you are given a rectangular board of dimensions R × C, filled with numbers. Each integer i from 1 through N is written twice, at the coordinates (x_{i,1},y_{i,1}) and (x_{i,2}...
[{"type": "stdin_stdout", "input": "5 5 7\n1 -1 2 4\n2 3 4 4\n3 5 5 4\n5 5 2 4\n0 4 5 1\n2 2 1 1\n0 10 4 1", "output": "YES\n"}, {"type": "stdin_stdout", "input": "5 5 7\n1 -1 2 4\n1 3 4 4\n3 5 5 4\n5 5 2 4\n0 4 5 1\n2 2 1 1\n0 10 4 1", "output": "YES\n"}, {"type": "stdin_stdout", "input": "5 5 7\n-1 -1 2 4\n2 3 4 5\n3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke has a calculator. It has a display and two buttons.\n\nInitially, the display shows an integer x. Snuke wants to change this value into another integer y, by pressing the following two buttons some number of times i...
[{"type": "stdin_stdout", "input": "-10 -23", "output": "15\n"}, {"type": "stdin_stdout", "input": "110 -1", "output": "110\n"}, {"type": "stdin_stdout", "input": "-10 -63", "output": "55\n"}, {"type": "stdin_stdout", "input": "273 -1", "output": "273\n"}, {"type": "stdin_stdout", "input": "141 -1", "output": "141\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that:\n\n* There is at least one red block and at least one blue block....
[{"type": "stdin_stdout", "input": "19 9 5", "output": "45\n"}, {"type": "stdin_stdout", "input": "11 5 5", "output": "25\n"}, {"type": "stdin_stdout", "input": "-1 2 10", "output": "0\n"}, {"type": "stdin_stdout", "input": "19 5 5", "output": "25\n"}, {"type": "stdin_stdout", "input": "5 5 5", "output": "25\n"}, {"typ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakayuki and Kazuyuki are good twins, but their behavior is exactly the opposite. For example, if Takayuki goes west, Kazuyuki goes east, and if Kazuyuki goes north, Takayuki goes south. Currently the two are in a departm...
[{"type": "stdin_stdout", "input": "6 6\n2 4\n6 2\n0 0 0 0 1 0\n0 1 1 0 0 0\n0 1 0 0 0 0\n0 0 0 1 0 0\n0 0 0 0 0 1\n0 0 0 0 0 0\n3 3\n1 1\n3 3\n0 0 0\n0 1 0\n0 0 0\n0 0", "output": "3\nNA\n"}, {"type": "stdin_stdout", "input": "6 6\n2 4\n6 2\n0 0 0 0 1 0\n0 1 0 0 1 0\n0 1 0 0 0 0\n0 1 0 1 1 0\n0 0 0 0 0 1\n0 0 0 0 0 0\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's play a game using a robot on a rectangular board covered with a square mesh (Figure D-1). The robot is initially set at the start square in the northwest corner facing the east direction. The goal of this game is to...
[{"type": "stdin_stdout", "input": "8 3\n0 0 -1 1 0 0 0 1\n2 3 1 2 3 0 0 1\n3 3 0 0 0 1 -1 4\n11 9 2 9\n4 4\n3 3 4 0\n1 2 4 4\n0 1 1 0\n0 2 4 4\n16 7 2 1\n2 8\n2 1\n4 1\n0 4\n1 3\n1 0\n2 1\n0 6\n1 4\n1 9 3 1\n0 0", "output": "13\n11\n5\n"}, {"type": "stdin_stdout", "input": "8 3\n0 0 0 0 -1 0 0 1\n2 3 0 1 4 0 0 1\n3 3 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNumbers of black and white points are placed on a plane. Let's imagine that a straight line of infinite length is drawn on the plane. When the line does not meet any of the points, the line divides these points into two g...
[{"type": "stdin_stdout", "input": "3 3\n100 700\n200 200\n600 600\n500 100\n605 300\n800 578\n3 3\n100 300\n400 600\n400 100\n600 400\n500 900\n300 300\n3 4\n300 300\n935 300\n400 600\n100 100\n200 900\n500 900\n158 110\n1 2\n300 300\n100 100\n500 500\n1 1\n100 100\n200 100\n2 2\n0 0\n500 700\n1000 1400\n1500 2100\n2 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSquare Route\n\nSquare root\n\nEnglish text is not available in this practice contest.\n\nMillionaire Shinada, who has decided to build a new mansion, is wondering in which city to build the new mansion. To tell the truth...
[{"type": "stdin_stdout", "input": "3 3\n2\n1\n2\n-1\n3\n1\n1 2\n22\n11\n10\n0 0", "output": "7\n0\n"}, {"type": "stdin_stdout", "input": "3 3\n1\n1\n2\n1\n1\n1\n1 2\n10\n10\n23\n0 0", "output": "11\n1\n"}, {"type": "stdin_stdout", "input": "3 3\n1\n1\n1\n2\n3\n1\n1 2\n10\n10\n10\n0 0", "output": "6\n2\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAll space-time unified dimension sugoroku tournament. You are representing the Earth in the 21st century in the tournament, which decides only one Sugoroku absolute champion out of more than 500 trillion participants.\n\n...
[{"type": "stdin_stdout", "input": "12\n0\n-1\n7\n0\n2\n-1\n-1\n3\n-10\n-2\n1\n0", "output": "1\n"}, {"type": "stdin_stdout", "input": "12\n0\n-1\n7\n0\n2\n0\n-1\n3\n-10\n-2\n1\n0", "output": "1\n"}, {"type": "stdin_stdout", "input": "12\n0\n-1\n7\n0\n2\n0\n-2\n3\n-10\n-2\n1\n0", "output": "1\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA robot, a wall, and a goal are installed on the board, and a program that describes the behavior pattern of the robot is given.\n\nThe given program is represented by the following EBNF.\n\n\nProgram: = {statement};\nSta...
[{"type": "stdin_stdout", "input": "5 11\n\n.#g..#\n.###.#\ns....#\n\n{T{~C^}>}", "output": "-1\n"}, {"type": "stdin_stdout", "input": "6 11\n\n.#g..#\n.###.#\ns....#\n\n{T{~C^}>}", "output": "-1\n"}, {"type": "stdin_stdout", "input": "8 11\n\n.#g..#\n.###.#\ns....#\n\n{T{~C^}>}", "output": "-1\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nA mysterious $ X $ [cm] plant grows in one place. This plant has the following mysterious properties.\n\n* Say \"nobiro\" to this plant and it will grow $ A $ [cm].\n* Say \"tidime\" to this plant and it will g...
[{"type": "stdin_stdout", "input": "109 30 5\n0\norioan\nnobiro\nuifimd", "output": "109\n"}, {"type": "stdin_stdout", "input": "112 30 9\n0\norioan\nniboro\ntieimd", "output": "112\n"}, {"type": "stdin_stdout", "input": "84 122 10\n0\noobrjn\nonciro\nudfimi", "output": "84\n"}, {"type": "stdin_stdout", "input": "17 12...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFind the edit distance between given two words s1 and s2.\n\nThe disntace is the minimum number of single-character edits required to change one word into the other. The edits including the following operations:\n\n* inse...
[{"type": "stdin_stdout", "input": "icpc\nipcc", "output": "2\n"}, {"type": "stdin_stdout", "input": "icpb\ncbio", "output": "4\n"}, {"type": "stdin_stdout", "input": "cpci\nipcc", "output": "2\n"}, {"type": "stdin_stdout", "input": "cpci\nccpi", "output": "2\n"}, {"type": "stdin_stdout", "input": "icpc\nccpi", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFind the union of two sets $A = \\\\{a_0, a_1, ..., a_{n-1}\\\\}$ and $B = \\\\{b_0, b_1, ..., b_{m-1}\\\\}$.\n\nConstraints\n\n* $1 \\leq n, m \\leq 200,000$\n* $0 \\leq a_0 < a_1 < ... < a_{n-1} \\leq 10^9$\n* $0 \\leq ...
[{"type": "stdin_stdout", "input": "3\n2 4 15\n2\n11 64", "output": "2\n4\n11\n15\n64\n"}, {"type": "stdin_stdout", "input": "3\n-1 5 10\n2\n3 16", "output": "-1\n3\n5\n10\n16\n"}, {"type": "stdin_stdout", "input": "3\n-1 4 10\n2\n3 16", "output": "-1\n3\n4\n10\n16\n"}, {"type": "stdin_stdout", "input": "3\n-1 4 10\n2\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nChef has a special affection for sets of binary strings of equal length which have same numbers of 1's. Given three integers n, k and m, your task is to find the the lexicographically m^th smallest string among strings ...
[{"type": "stdin_stdout", "input": "1\n57 0 -2", "output": "000000000000000000000000000000000000000000000000000000000\n"}, {"type": "stdin_stdout", "input": "1\n51 2 0", "output": "000000000000000000000000000000000000000000000000000\n"}, {"type": "stdin_stdout", "input": "1\n51 2 1", "output": "000000000000000000000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNatasha is planning an expedition to Mars for n people. One of the important tasks is to provide food for each participant.\n\nThe warehouse has m daily food packages. Each package has some food type a_i.\n\nEach particip...
[{"type": "stdin_stdout", "input": "4 100\n84 99 66 69 86 94 89 96 98 93 93 82 87 93 91 100 69 99 93 81 99 84 75 100 86 88 98 100 84 96 44 70 94 91 85 78 86 79 45 88 91 78 98 94 81 87 93 72 96 88 96 97 96 62 86 72 94 84 80 98 88 90 93 73 73 98 78 50 91 96 97 82 85 90 87 41 97 82 97 77 100 100 92 83 98 81 70 81 74 78 84...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's call some positive integer classy if its decimal representation contains no more than 3 non-zero digits. For example, numbers 4, 200000, 10203 are classy and numbers 4231, 102306, 7277420000 are not.\n\nYou are give...
[{"type": "stdin_stdout", "input": "4\n1 1000\n1024 1024\n65536 65536\n999999 1000001\n", "output": " 1000\n 1\n 0\n ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nStudent Andrey has been skipping physical education lessons for the whole term, and now he must somehow get a passing grade on this subject. Obviously, it is impossible to do this by legal means, but Andrey doesn't give u...
[{"type": "stdin_stdout", "input": "8 8\n.#.#.#.#\n#.#.#.#.\n.#.#.#.#\n#.#.#.#.\n.#.#.#.#\n#.#.#.#.\n.#.#.#.#\n#.#.#.#.\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "8 8\n.#.#.#.#\n.#.#.#.#\n.#.#.#.#\n#.#.#.#.\n.#.#.#.#\n#.#.#.#.\n.#.#.#.#\n#.#.#.#.\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently, Olya received a magical square with the size of 2^n× 2^n.\n\nIt seems to her sister that one square is boring. Therefore, she asked Olya to perform exactly k splitting operations.\n\nA Splitting operation is an ...
[{"type": "stdin_stdout", "input": "19\n1 2\n2 1\n2 2\n2 3\n2 4\n2 5\n2 6\n1 1000000000000000000\n1000000000 1000000000000000000\n64 64\n64 3\n4 4\n2 100\n3 6\n3 7\n4 10000\n4 100000\n4 71\n4 70\n", "output": "NO\nYES 1\nYES ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNot long ago Billy came across such a problem, where there were given three natural numbers A, B and C from the range [1, N], and it was asked to check whether the equation AB = C is correct. Recently Billy studied the co...
[{"type": "stdin_stdout", "input": "1000000\n", "output": "111111074060178115\n"}, {"type": "stdin_stdout", "input": "987572\n", "output": "107019643962508968\n"}, {"type": "stdin_stdout", "input": "983242\n", "output": "105618162572849728\n"}, {"type": "stdin_stdout", "input": "600000\n", "output": "23999973325791164\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMike decided to teach programming to children in an elementary school. He knows that it is not an easy task to interest children in that age to code. That is why he decided to give each child two sweets.\n\nMike has n swe...
[{"type": "stdin_stdout", "input": "20\n43 48 38 34 23 18 8 22 12 7 47 1 13 20 3 15 49 6 10 26\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "20\n43 48 38 34 41 18 8 22 12 7 47 1 13 20 3 15 49 6 10 26\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "20\n43 48 38 34 23 18 8 22 12 7 47 1 17 20 3 15 49 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLinear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arriv...
[{"type": "stdin_stdout", "input": "100\n0 1\n0 0\n0 0\n1 0\n0 0\n0 1\n0 1\n1 1\n0 0\n0 0\n1 1\n0 0\n1 1\n0 1\n1 1\n0 1\n1 1\n1 0\n1 0\n0 0\n1 0\n0 0\n1 0\n0 0\n0 1\n1 1\n1 1\n0 1\n0 0\n1 0\n1 1\n0 1\n1 0\n1 1\n0 1\n1 1\n1 0\n0 0\n0 0\n0 1\n0 0\n-1 1\n1 1\n0 0\n1 1\n1 1\n0 0\n0 1\n1 0\n0 1\n0 0\n0 1\n0 1\n1 1\n1 1\n1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNote that this is the first problem of the two similar problems. You can hack this problem only if you solve both problems.\n\nYou are given a tree with n nodes. In the beginning, 0 is written on all edges. In one operati...
[{"type": "stdin_stdout", "input": "60\n26 6\n59 30\n31 12\n31 3\n38 23\n59 29\n53 9\n38 56\n53 54\n29 21\n17 55\n59 38\n26 16\n24 59\n24 25\n17 35\n24 41\n30 15\n31 27\n8 44\n26 5\n26 48\n8 32\n53 17\n3 34\n3 51\n30 28\n47 10\n53 60\n36 42\n24 53\n59 22\n53 40\n26 52\n36 4\n59 8\n29 37\n36 20\n17 47\n53 18\n3 50\n30 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are two types of burgers in your restaurant — hamburgers and chicken burgers! To assemble a hamburger you need two buns and a beef patty. To assemble a chicken burger you need two buns and a chicken cutlet. \n\nYou ...
[{"type": "stdin_stdout", "input": "7\n2 1 1\n1 1\n100 101 100\n101 100\n2 101 110\n000 111\n010 3 1\n101 100\n010 77 14\n110 99\n010 001 3\n100 99\n362 51 11\n011 165\n", "output": "1\n5050\n111\n403\n550\n397\n2376\n"}, {"type": "stdin_stdout", "input": "7\n2 1 2\n1 1\n100 100 000\n101 110\n2 101 000\n011 110\n010 3 ...
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\nThe BerTV channel every day broadcasts one episode of one of the k TV shows. You know the schedule for the next n days: a sequence of integers a_1, a_2...
[{"type": "stdin_stdout", "input": "4\n5 2 2\n1 2 1 2 2\n9 3 3\n3 3 3 2 2 4 1 1 1\n4 18 4\n10 8 6 4\n16 10 8\n3 1 7 1 5 4 2 6 7 6 5 8 9 8 11 3\n", "output": "1\n1\n4\n6\n"}, {"type": "stdin_stdout", "input": "4\n5 2 4\n1 2 1 2 1\n9 3 3\n3 3 3 2 2 4 1 1 1\n4 18 4\n10 8 6 4\n16 10 8\n3 1 4 2 5 4 2 6 5 6 5 10 9 8 9 3\n", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's call two strings s and t anagrams of each other if it is possible to rearrange symbols in the string s to get a string, equal to t.\n\nLet's consider two strings s and t which are anagrams of each other. We say that...
[{"type": "stdin_stdout", "input": "aabbbbbbc\n6\n1 4\n2 4\n2 2\n2 9\n2 7\n1 5\n", "output": "Yes\nYes\nYes\nYes\nYes\nYes\n"}, {"type": "stdin_stdout", "input": "aabbbbbbc\n6\n1 4\n2 4\n2 2\n2 9\n5 7\n1 5\n", "output": "Yes\nYes\nYes\nYes\nNo\nYes\n"}, {"type": "stdin_stdout", "input": "aabbbbbbc\n6\n1 4\n2 4\n2 2\n2 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYoung boy Artem tries to paint a picture, and he asks his mother Medina to help him. Medina is very busy, that's why she asked for your help.\n\nArtem wants to paint an n × m board. Each cell of the board should be colore...
[{"type": "stdin_stdout", "input": "19\n15 73\n16 92\n22 97\n13 64\n49 127\n79 79\n66 13\n49 48\n173 75\n64 77\n27 95\n27 156\n29 53\n48 10\n265 151\n26 37\n13 2\n44 13\n85 70\n", "output": "WBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a of length n consisting of zeros. You perform n actions with this array: during the i-th action, the following sequence of operations appears:\n\n 1. Choose the maximum by length subarray (continu...
[{"type": "stdin_stdout", "input": "6\n4\n4\n2\n26\n2\n10\n", "output": "3 1 2 4\n3 1 2 4\n1 2\n11 16 7 12 17 3 13 18 4 19 8 20 1 14 21 5 22 9 23 2 15 24 6 25 10 26\n1 2\n7 3 4 8 1 5 9 2 6 10\n"}, {"type": "stdin_stdout", "input": "6\n2\n2\n2\n16\n3\n21\n", "output": "1 2\n1 2\n1 2\n9 5 10 3 11 6 12 1 13 7 14 2 15 4 8 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s consisting only of characters + and -. You perform some process with this string. This process can be described by the following pseudocode: \n \n \n res = 0 \n for init = 0 to inf \...
[{"type": "stdin_stdout", "input": "15\n-\n--\n+\n+-\n-\n+\n-\n+\n-\n-+\n-+\n-+\n-+\n-+\n-+\n", "output": "2\n5\n1\n2\n2\n1\n2\n1\n2\n3\n3\n3\n3\n3\n3\n"}, {"type": "stdin_stdout", "input": "15\n-\n--\n+\n+-\n-\n+\n-\n+\n-\n-+\n-+\n-+\n-+\n+-\n-+\n", "output": "2\n5\n1\n2\n2\n1\n2\n1\n2\n3\n3\n3\n3\n2\n3\n"}, {"type": ...
code_stdio