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\nGildong has a square board consisting of n rows and n columns of square cells, each consisting of a single digit (from 0 to 9). The cell at the j-th column of the i-th row can be represented as (i, j), and the length of t... | [{"type": "stdin_stdout", "input": "5\n3\n000\n122\n101\n2\n57\n75\n4\n0123\n5469\n3401\n2340\n1\n9\n8\n42987101\n91120855\n77861569\n87599023\n92834718\n83917348\n19823743\n38947912\n", "output": "4 4 1 0 0 0 0 0 0 0\n0 0 0 0 0 1 0 1 0 0\n9 6 9 9 4 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n18 49 49 49 49 30 15 35 42 42\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet the following equality:\n\na + b + c + d = n\n\nFor example, for n = 35, we have 4 differ... | [{"type": "stdin_stdout", "input": "35\n011", "output": "4\n348\n"}, {"type": "stdin_stdout", "input": "35\n010", "output": "4\n282\n"}, {"type": "stdin_stdout", "input": "35\n15", "output": "4\n592\n"}, {"type": "stdin_stdout", "input": "35\n26", "output": "4\n282\n"}, {"type": "stdin_stdout", "input": "35\n13", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJamie is preparing a Codeforces round. He has got an idea for a problem, but does not know how to solve it. Help him write a solution to the following problem:\n\nFind k integers such that the sum of two to the power of e... | [{"type": "stdin_stdout", "input": "10 19228\n", "output": "Yes\n-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\nThe committee members of the Kitoshima programming contest had decided to use crypto-graphic software for their secret communication. They had asked a company, Kodai Software, to develop cryptographic software that employ... | [{"type": "stdin_stdout", "input": "4\nA\nAMD\nCAT\nDOG\nZ XUW ZVX Z YZT.\n2\nZA\nAY\nZA.\n2\n@A\nBB\nCC.\n16\nA\nB\nC\nD\nE\nF\nG\nH\nI\nJ\nK\nL\nM\nN\nO\nONMLKJIHGFEDCBA\nA B C D E F G H I J K L M N O ABCDEFGHIJKLMNO.\n0", "output": "A DOG AMD A CAT.\nZA.\nBB.\nO N M L K J I H G F E D C B A ONMLKJIHGFEDCBA.\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA penguin Rocher has $n$ sticks. He has exactly one stick with length $i$ for all $1 \\le i \\le n$.\n\nHe can connect some sticks. If he connects two sticks that have lengths $a$ and $b$, he gets one stick with length $a... | [{"type": "stdin_stdout", "input": "4\n1\n2\n3\n20\n", "output": "1\n1\n2\n10\n"}, {"type": "stdin_stdout", "input": "4\n1\n3\n3\n20\n", "output": "1\n2\n2\n10\n"}, {"type": "stdin_stdout", "input": "4\n3\n2\n12\n15\n", "output": "2\n1\n6\n8\n"}, {"type": "stdin_stdout", "input": "4\n1\n3\n1\n20\n", "output": "1\n2\n1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPak Chanek has a grid that has $N$ rows and $M$ columns. Each row is numbered from $1$ to $N$ from top to bottom. Each column is numbered from $1$ to $M$ from left to right.\n\nEach tile in the grid contains a number. The... | [{"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "999999999000000000\n"}, {"type": "stdin_stdout", "input": "767928735 1000000000\n", "output": "767928734232071265\n"}, {"type": "stdin_stdout", "input": "1000000000 906523442\n", "output": "906523441000000000\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA brave princess in a poor country's tomboy is married to another country for a political marriage. However, a villain who is trying to kill the princess is releasing a thug on the way to his wife.\n\nYou have already dec... | [{"type": "stdin_stdout", "input": "3 2 10\n1 2 13 6\n2 3 10 3\n3 2 10\n1 2 3 16\n2 3 9 7\n3 3 10\n1 3 17 6\n1 2 2 4\n2 3 9 19\n4 4 5\n1 3 13 5\n1 4 7 25\n2 3 8 2\n2 4 9 3\n0 0 0", "output": "6\n7\n4\n10\n"}, {"type": "stdin_stdout", "input": "3 2 10\n1 2 8 5\n2 3 10 0\n3 2 10\n1 2 3 8\n2 3 7 7\n3 3 10\n1 3 17 6\n1 2 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan unexpectedly saw a present from one of his previous birthdays. It is array of n numbers from 1 to 200. Array is old and some numbers are hard to read. Ivan remembers that for all elements at least one of its neighbou... | [{"type": "stdin_stdout", "input": "37\n52 52 66 149 149 130 47 47 26 110 185 -1 73 73 65 -1 -1 130 -1 -1 -1 94 97 190 -1 -1 49 49 54 -1 92 92 5 25 48 79 79\n", "output": "903952722\n"}, {"type": "stdin_stdout", "input": "37\n52 52 66 149 149 130 47 47 17 110 185 -1 73 73 65 -1 -1 130 -1 -1 -1 94 97 190 -1 -1 49 49 54 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDreamoon likes sequences very much. So he created a problem about the sequence that you can't find in OEIS: \n\nYou are given two integers $d, m$, find the number of arrays $a$, satisfying the following constraints: The ... | [{"type": "stdin_stdout", "input": "10\n1 1000000000\n2 999999999\n3 39238314\n2 14233839\n3 1308869\n6 99995\n13 14099\n8 474\n9 146\n10 2\n", "output": "1\n3\n5\n3\n5\n23\n209\n59\n89\n1\n"}, {"type": "stdin_stdout", "input": "10\n1 1000000000\n2 999999999\n3 99999998\n4 9999997\n5 999996\n6 99995\n7 9994\n12 993\n15... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHamming distance between strings a and b of equal length (denoted by h(a, b)) is equal to the number of distinct integers i (1 ≤ i ≤ |a|), such that ai ≠ bi, where ai is the i-th symbol of string a, bi is the i-th symbol ... | [{"type": "stdin_stdout", "input": "5728 5729 5750\n5631 5768\n9163\n", "output": "10321\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.\n\nRecently, she was presented with an array $a$ of the size of $10^9$ elements that is filled... | [{"type": "stdin_stdout", "input": "10\n449347852 741090797\n541919355 938202256\n442458747 465872502\n463474612 789217678\n146477812 390217056\n302933612 477640295\n48191125 1417399529\n173202385 374432789\n78807265 428215825\n194590462 1318087870\n", "output": "-145871473\n198141451\n11706878\n626346145\n268347434\n-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have A apples and P pieces of apple.\nWe can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.\nFind the maximum number of apple pies we can make with what we ha... | [{"type": "stdin_stdout", "input": "100 100\n", "output": "200\n"}, {"type": "stdin_stdout", "input": "1052 1", "output": "1578\n"}, {"type": "stdin_stdout", "input": "1829 1", "output": "2744\n"}, {"type": "stdin_stdout", "input": "3156 1", "output": "4734\n"}, {"type": "stdin_stdout", "input": "1450 1", "output": "21... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe want to encode a given string $S$ to a binary string. Each alphabet character in $S$ should be mapped to a different variable-length code and the code must not be a prefix of others.\n\nHuffman coding is known as one o... | [{"type": "stdin_stdout", "input": "aaabbcccdeeegfg", "output": "41\n"}, {"type": "stdin_stdout", "input": "aaadbcccbeedgfg", "output": "42\n"}, {"type": "stdin_stdout", "input": "gegdeebcccbeaaa", "output": "38\n"}, {"type": "stdin_stdout", "input": "aeaaacccbeedgeg", "output": "36\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are three horses living in a horse land: one gray, one white and one gray-and-white. The horses are really amusing animals, which is why they adore special cards. Each of those cards must contain two integers, the f... | [{"type": "stdin_stdout", "input": "10 10\n4 8 4 10 2 10 8 10 4 6\n", "output": " 25\n"}, {"type": "stdin_stdout", "input": "10 10\n9 3 6 6 3 3 6 3 6 9\n", "output": " 25\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya organized a strange birthday party. He invited $n$ friends and assigned an integer $k_i$ to the $i$-th of them. Now Petya would like to give a present to each of them. In the nearby shop there are $m$ unique present... | [{"type": "stdin_stdout", "input": "6\n6 6\n2 3 1 5 6 6\n629717071 992393438 995305242 999968259 999970082 999971487\n6 6\n2 5 2 2 4 3\n756869732 979591024 993778447 1268827656 999873038 999943064\n6 6\n5 1 4 5 6 4\n733550952 979779220 979918868 983712198 991976436 995169050\n6 6\n4 2 2 3 2 4\n257971677 920812339 98100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem.\n\nImur Ishakov decided to organize a club for people who love to play the famous game «The hat». The club was visited by n students, where n is even. Imur arranged them all in a circle and... | [{"type": "stdin_stdout", "input": "100\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nE: Jam\n\nproblem\n\nThere are N cities in a country, numbered 1, \\ 2, \\ ..., \\ N. These cities are connected in both directions by M roads, and the i-th road allows you to travel between the cities u_i and v_i in time... | [{"type": "stdin_stdout", "input": "4 4 3\n3 12 1 6\n1 1 2 3\n10 1 9 5\n1 2 1\n2 3 1\n1 3 1\n1 4 1", "output": "20\n18\n13\n"}, {"type": "stdin_stdout", "input": "4 4 3\n3 12 1 6\n1 1 2 3\n10 1 9 5\n1 2 0\n2 3 1\n1 3 1\n1 4 1", "output": "22\n19\n15\n"}, {"type": "stdin_stdout", "input": "4 4 3\n3 12 1 6\n1 1 2 3\n10 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRemainder of Big Integers\n\nGiven two integers $A$ and $B$, compute the remainder of $\\frac{A}{B}$.\n\nInput\n\nTwo integers $A$ and $B$ separated by a space character are given in a line.\n\nOutput\n\nPrint the remaind... | [{"type": "stdin_stdout", "input": "10 16", "output": "10\n"}, {"type": "stdin_stdout", "input": "11 12", "output": "11\n"}, {"type": "stdin_stdout", "input": "12 47", "output": "12\n"}, {"type": "stdin_stdout", "input": "14 28", "output": "14\n"}, {"type": "stdin_stdout", "input": "18 11", "output": "7\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has an array $a$ consisting of $n$ integers.\n\nHe wants to play a game with this array. The game consists of several moves. On the first move he chooses any element and deletes it (after the first move the array... | [{"type": "stdin_stdout", "input": "2\n1000000 1000000\n", "output": "1000000\n"}, {"type": "stdin_stdout", "input": "2\n1000010 1001000\n", "output": "1000010\n"}, {"type": "stdin_stdout", "input": "2\n1000110 1001000\n", "output": "1000110\n"}, {"type": "stdin_stdout", "input": "2\n1000110 1000000\n", "output": "1000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday s kilometer long auto race takes place in Berland. The track is represented by a straight line as long as s kilometers. There are n cars taking part in the race, all of them start simultaneously at the very beginnin... | [{"type": "stdin_stdout", "input": "9 81812\n8 31 410 547 18 22 77 449 5 491 8 10 382 746 21 61 523\n1 452 181\n1 724 113\n1 113 724\n1 226 362\n46 5 257 2 126 373 6 6 491 9 7 137 23 93 73 163 13 17 106 3 100 5 415 270 2 7 723 597 4 176 3 274 18 1 852 334 14 7 25 163 1 3 199 29 140 32 32 191 2 583 3 23 11 22 23 250 1 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou all know the Dirichlet principle, the point of which is that if n boxes have no less than n + 1 items, that leads to the existence of a box in which there are at least two items.\n\nHaving heard of that principle, but... | [{"type": "stdin_stdout", "input": "10000 1 1000000000\n", "output": "Masha\n\n"}, {"type": "stdin_stdout", "input": "1010 1 1000000000\n", "output": "Masha\n\n"}, {"type": "stdin_stdout", "input": "2635 2 1000000000\n", "output": "Masha\n\n"}, {"type": "stdin_stdout", "input": "1 30 1000000000\n", "output": "Missing\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasily the bear has a favorite rectangle, it has one vertex at point (0, 0), and the opposite vertex at point (x, y). Of course, the sides of Vasya's favorite rectangle are parallel to the coordinate axes. \n\nVasya also ... | [{"type": "stdin_stdout", "input": "-1000000000 -1000000000\n", "output": "-2000000000 0 0 -2000000000\n"}, {"type": "stdin_stdout", "input": "-1000000000 -1000000000\n", "output": "-2000000000 0 0 -2000000000 "}, {"type": "stdin_stdout", "input": "-1000000000 -999999999\n", "output": "-1999999999 0 0 -1999999999\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBerland, 2016. The exchange rate of currency you all know against the burle has increased so much that to simplify the calculations, its fractional part was neglected and the exchange rate is now assumed to be an integer.... | [{"type": "stdin_stdout", "input": "4314752277691991627730686134692292422155753465948025897701703862445837045929984759093775762579123919\n", "output": "9314752277691991627730686134692292422155753465948025897701703862445837045929984759093775762579123914\n"}, {"type": "stdin_stdout", "input": "431475227769199162773068613... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA popular game in a certain country, Pachimon Creature, has been remade and released in Japan. If you love games, after playing this game many times, you've come to think about how you can clear it the fastest. However, n... | [{"type": "stdin_stdout", "input": "6 6\nS.1..4\n5..3..\n..4.1.\n4....5\n.2.32.\n5.1..G\n3 2\n...\nS.G\n0 0", "output": "3 12\nNA\n"}, {"type": "stdin_stdout", "input": "6 6\nS.1..4\n3..5..\n..4.1.\n4...5.\n.2.32.\n5.1..G\n3 2\n...\nS.G\n0 0", "output": "2 10\nNA\n"}, {"type": "stdin_stdout", "input": "6 6\nS.1..4\n4..... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIgor is a post-graduate student of chemistry faculty in Berland State University (BerSU). He needs to conduct a complicated experiment to write his thesis, but laboratory of BerSU doesn't contain all the materials require... | [{"type": "stdin_stdout", "input": "11\n1 1 1 1 1 1 1 1 1 1 1\n1 1000000001 1000000001 1000000001 1000000001 1000000001 1000000001 1000000001 1000000001 1000000001 1000000001\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.\n\nThe world can be modeled as an undirected graph with n nodes and m edges. k of t... | [{"type": "stdin_stdout", "input": "24 38 2\n4 13\n7 1\n24 1\n2 8\n17 2\n2 18\n22 2\n23 3\n5 9\n21 5\n6 7\n6 19\n6 20\n11 7\n7 20\n13 8\n16 8\n9 10\n14 9\n21 9\n12 10\n10 22\n23 10\n17 11\n11 24\n20 12\n13 16\n13 23\n15 14\n17 14\n14 20\n19 16\n17 20\n17 23\n18 22\n18 23\n22 19\n21 20\n23 24\n", "output": "215\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou already know that Valery's favorite sport is biathlon. Due to your help, he learned to shoot without missing, and his skills are unmatched at the shooting range. But now a smaller task is to be performed, he should le... | [{"type": "stdin_stdout", "input": "20 20 2\nbaaaaaaaaaaaaaaaaaaa\nbfffffffacfffffffffa\nbgggggggaccgggggggga\nbhhhhhhhaccchhhhhhha\nbiiiiiiiacccciiiiiia\nbjjjjjjjacccccjjjjja\nbkkkkkkkacccccckkkka\nblllllllacccccccllla\nbbbbbbbbSccccccccmma\nbddddddddddcccccccna\nbodddddddcccccccccca\nbppddddddddTaaaaaaaa\nbqqqddddddd... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is taking exams on N subjects. The score on each subject will be an integer between 0 and K (inclusive).\nHe has already taken exams on N-1 subjects and scored A_i points on the i-th subject.\nHis goal is to ach... | [{"type": "stdin_stdout", "input": "100 100 100\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nIf you bring an empty bottle of $ a $ milk, you can exchange it for a new bottle of $ b $ milk.\nHow many bottles of milk can Mr. Kawabayashi, who initially has a bottle of $ x $ milk, drink? Output the remaind... | [{"type": "stdin_stdout", "input": "560118409912468 316250877917599 1316995007040099", "output": "500636509\n"}, {"type": "stdin_stdout", "input": "316250877917604 316250877917599 672514164456590", "output": "265329493\n"}, {"type": "stdin_stdout", "input": "560118409912468 316250877917599 681260158257385", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRick and Morty are playing their own version of Berzerk (which has nothing in common with the famous Berzerk game). This game needs a huge space, so they play it with a computer.\n\nIn this game there are n objects number... | [{"type": "stdin_stdout", "input": "7000\n7 419 1631 1925 3861 6940 379 493\n29 5389 5925 2923 4696 972 6125 3779 6044 5477 1305 6488 5059 5515 3238 3863 248 6947 4023 6168 1915 6607 2991 2220 2023 200 4457 6398 1017 447\n", "output": "Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop... | 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\n2 1 2 3 3 10\n1 2\n2 2\n1 3\n2 4\n3 6\n2 2\n", "output": "1\n1\n2\n1\n0\n1\n"}, {"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\n4 4\n4 6\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArtist Shinagawa was asked to exhibit n works. Therefore, I decided to exhibit the six sides of the cube colored with paint as a work. The work uses all six colors, Red, Yellow, Blue, Magenta, Green, and Cyan, and each si... | [{"type": "stdin_stdout", "input": "3\nCyan Yellow Red Magenta Green Blue\nCyan Yellow Red Magenta Green Blue\nRed Yellow Magenta Blue Green Cyan\n4\nRed Mahenta Blue Green Yellow Cyan\nRed Yellow Magenta Blue Green Cyan\nMagenta Green Red Cyan Yellow Blue\nCyan Green Yellow Blue Magenta Red\n0", "output": "1\n1\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. \n\nThe manager of logging factory wants them to go to the jungle and cut n trees with heigh... | [{"type": "stdin_stdout", "input": "6\n1 2 3 10 20 30\n6 5 4 3 2 0\n", "output": "138\n"}, {"type": "stdin_stdout", "input": "6\n2 2 3 10 20 30\n6 5 4 3 2 0\n", "output": "138\n"}, {"type": "stdin_stdout", "input": "6\n1 2 3 10 20 25\n6 5 4 3 2 0\n", "output": "118\n"}, {"type": "stdin_stdout", "input": "6\n1 1 2 10 20... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an equation: \n\nAx2 + Bx + C = 0. \n\nYour task is to find the number of distinct roots of the equation and print all of them in ascending order.\n\nInput\n\nThe first line contains three integer numbers A,... | [{"type": "stdin_stdout", "input": "-50000 110001 -1028\n", "output": "2\n0.009385408263686695\n2.1906345917363135\n"}, {"type": "stdin_stdout", "input": "50000 110001 10338\n", "output": "2\n-2.1016396721343673\n-0.09838032786563272\n"}, {"type": "stdin_stdout", "input": "-50000 100001 -50000\n", "output": "2\n0.99553... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPeople in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (= 172), i.e., 1-credit coins, 4-credit coins, 9-credit c... | [{"type": "stdin_stdout", "input": "2\n19\n51\n0", "output": "1\n10\n107\n"}, {"type": "stdin_stdout", "input": "2\n19\n92\n0", "output": "1\n10\n804\n"}, {"type": "stdin_stdout", "input": "2\n173\n0\n-6", "output": "1\n13027\n"}, {"type": "stdin_stdout", "input": "2\n10\n51\n0", "output": "1\n4\n107\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGame \"Minesweeper 1D\" is played on a line of squares, the line's height is 1 square, the line's width is n squares. Some of the squares contain bombs. If a square doesn't contain a bomb, then it contains a number from 0... | [{"type": "stdin_stdout", "input": "?2*?2*??1*2**?2*1???*2???100?????*???*?*????0????2?*?*?1??1??*?01**2**1001??**??**??1*?*???00??**??*\n", "output": "147483634\n"}, {"type": "stdin_stdout", "input": "?2*?2*??1*2**?2*1???*2???100?????*???*?*????0????2?*?*?1??1??*?01**2**1001??**??**??1*?*???00??**??*\n", "output": "14... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTrouble came from the overseas lands: a three-headed dragon Gorynych arrived. The dragon settled at point C and began to terrorize the residents of the surrounding villages.\n\nA brave hero decided to put an end to the dr... | [{"type": "stdin_stdout", "input": "-1000000000 1000000000\n-1000000000 -1000000000\n1000000000 -1000000000\n", "output": "LEFT\n"}, {"type": "stdin_stdout", "input": "-1000000000 1000001000\n-1000000000 -1000000000\n1000000000 -1000000000\n", "output": "LEFT\n"}, {"type": "stdin_stdout", "input": "-1000000000 10000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp is working on a new project called \"Polychat\". Following modern tendencies in IT, he decided, that this project should contain chat as well. To achieve this goal, Polycarp has spent several hours in front of hi... | [{"type": "stdin_stdout", "input": "+qlHEc2AuYy\nqlHE02AuYy:YYRwDc edNZgpE nGfOguRWnMYpTpGUVM aXDKGWo1GL1tHv9\n0Upwze6PcQNBcUovrqmIcPsG3hvy:yYuA2cEHlq oaNiKV49p[KatlVAx\nqlHEc2AuYy:zuCO6Opey L eu7lTwysaSk00zjpv zrDfbt8l ufHph\n+pErDMxgVgh\nsiLF1I:yYu@1cEHlq mmQbZtd8Ui7y 2vcax6yZBMhVdRD6Ahlq7MNCw\nqlHEc2AuYy:lz MFUNJ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus analyzes a string called abracadabra. This string is constructed using the following algorithm: \n\n * On the first step the string consists of a single character \"a\". \n * On the k-th step Polycarpus conca... | [{"type": "stdin_stdout", "input": "156642200 503020953 296806626 871864091\n", "output": "234585497\n"}, {"type": "stdin_stdout", "input": "462616550 929253987 199885647 365920450\n", "output": "166034804\n"}, {"type": "stdin_stdout", "input": "166724572 472113234 358126054 528083792\n", "output": "125430608\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor the multiset of positive integers $s=\\{s_1,s_2,\\dots,s_k\\}$, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of $s$ as follow: $\\gcd(s)$ is the maximum positive integer $x$, such that all ... | [{"type": "stdin_stdout", "input": "10\n972 972 324 972 324 648 1944 243 324 474\n", "output": "162\n"}, {"type": "stdin_stdout", "input": "10\n972 972 324 972 324 648 1944 243 324 474\n", "output": "162\n"}, {"type": "stdin_stdout", "input": "10\n540 648 1116 648 720 540 594 864 972 648\n", "output": "36\n"}, {"type":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA sequence of positive integers is called great for a positive integer $x$, if we can split it into pairs in such a way that in each pair the first number multiplied by $x$ is equal to the second number. More formally, a ... | [{"type": "stdin_stdout", "input": "1\n11 100000\n310065408 310065408 310065408 310065408 89000 89000 89000 89000 10000000 5 69\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "4\n4 4\n1 16 4 4\n6 2\n1 2 2 2 4 7\n5 3\n5 2 3 5 15\n9 10\n10 10 10 20 1 100 200 2000 3\n", "output": "0\n2\n3\n3\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers $n$ and $k$.\n\nYou should create an array of $n$ positive integers $a_1, a_2, \\dots, a_n$ such that the sum $(a_1 + a_2 + \\dots + a_n)$ is divisible by $k$ and maximum element in $a$ is minim... | [{"type": "stdin_stdout", "input": "25\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA substring of some string is called the most frequent, if the number of its occurrences is not less than number of occurrences of any other substring.\n\nYou are given a set of strings. A string (not necessarily from thi... | [{"type": "stdin_stdout", "input": "76\namnctposz\nmnctpos\nos\nu\ne\nam\namnc\neamnctpo\nl\nx\nq\nposzq\neamnc\nctposzq\nctpos\nmnc\ntpos\namnctposzql\ntposzq\nmnctposz\nnctpos\nctposzql\namnctpos\nmnct\np\nux\nposzql\ntpo\nmnctposzql\nmnctp\neamnctpos\namnct\ntposzql\nposz\nz\nct\namnctpo\noszq\neamnct\ntposz\ns\nmn\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVova had a pretty weird sleeping schedule. There are $h$ hours in a day. Vova will sleep exactly $n$ times. The $i$-th time he will sleep exactly after $a_i$ hours from the time he woke up. You can assume that Vova woke u... | [{"type": "stdin_stdout", "input": "65 654 560 571\n83 511 615 263 171 146 241 511 582 216 352 632 506 538 536 217 627 213 324 579 172 241 363 584 450 144 447 536 241 523 162 21 437 291 191 111 567 502 170 570 231 493 169 360 107 114 322 160 574 611 460 558 616 361 284 58 41 345 450 560 543 520 105 416 38\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's dive into one of the most interesting areas of magic — writing spells. Learning this exciting but challenging science is very troublesome, so now you will not learn the magic words, but only get to know the basic ru... | [{"type": "stdin_stdout", "input": "# a \n # a \n\n # a \n\n\n # a \n \n # a \n \n\n # a \n\n \n # a\n \n \n # a \n\n\n \n\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCurry making\n\nAs the ACM-ICPC domestic qualifying is approaching, you who wanted to put more effort into practice decided to participate in a competitive programming camp held at a friend's house. Participants decided t... | [{"type": "stdin_stdout", "input": "10 5 3 4\n1 6 2 3\n150 13 7 62\n10 1 3 5\n20 100 3 20\n2 14 13 1\n0 0 0 0", "output": "2\n4\n0\n0\n14\n180\n"}, {"type": "stdin_stdout", "input": "10 5 3 4\n1 5 2 3\n150 13 12 62\n10 1 11 5\n20 100 3 20\n3 14 3 1\n0 0 0 0", "output": "2\n3\n1\n1\n14\n39\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA remote island chain contains n islands, labeled 1 through n. Bidirectional bridges connect the islands to form a simple cycle — a bridge connects islands 1 and 2, islands 2 and 3, and so on, and additionally a bridge co... | [{"type": "stdin_stdout", "input": "10\n2 4 8 3 6 1 15 0 5 14\n3 6 1 10 0 5 7 2 14 4\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "10\n2 4 8 3 6 1 15 0 5 7\n3 6 1 10 0 5 7 2 14 4\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "10\n2 4 8 3 6 1 15 0 5 7\n3 6 1 10 0 5 7 2 22 4\n", "output": "NO\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.\n\nWe will call point a bad if there are different points b and c, not equal to a, from the given set such ... | [{"type": "stdin_stdout", "input": "11\n358 -724 -232 53 -520\n486 -554 -328 53 -220\n358 -554 -232 -372 -520\n358 -554 -232 308 -520\n868 -554 448 53 -520\n478 -554 -322 53 -600\n358 296 -232 53 -520\n256 -554 -368 53 -520\n230 -554 -136 53 -820\n-182 -554 173 53 -160\n358 -554 -232 53 -520\n", "output": "1\n11\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNick is interested in prime numbers. Once he read about Goldbach problem. It states that every even integer greater than 2 can be expressed as the sum of two primes. That got Nick's attention and he decided to invent a pr... | [{"type": "stdin_stdout", "input": "1000 1000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1000 1100\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1000 44\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "428 23\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "332 20\n", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's define the sum of two permutations p and q of numbers 0, 1, ..., (n - 1) as permutation <image>, where Perm(x) is the x-th lexicographically permutation of numbers 0, 1, ..., (n - 1) (counting from zero), and Ord(p)... | [{"type": "stdin_stdout", "input": "84\n83 4 68 34 24 2 48 38 22 51 5 62 31 67 66 53 49 70 9 71 46 41 30 8 50 17 28 79 15 80 32 43 14 74 29 42 81 60 56 65 23 0 77 76 58 78 1 11 37 27 75 35 18 73 54 20 57 33 36 6 61 69 64 55 39 10 3 45 13 26 59 82 21 25 63 52 16 44 47 72 19 12 7 40\n63 41 80 52 36 45 17 69 22 66 37 21 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya came up with his own weather forecasting method. He knows the information about the average air temperature for each of the last n days. Assume that the average air temperature for each day is integral.\n\nVasya bel... | [{"type": "stdin_stdout", "input": "100\n-85 -80 -76 -72 -68 -64 -60 -56 -52 -48 -44 -40 -36 -32 -28 -24 -20 -16 -12 -8 -4 0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle X and Little Z are good friends. They always chat online. But both of them have schedules.\n\nLittle Z has fixed schedule. He always online at any moment of time between a_1 and b_1, between a_2 and b_2, ..., betwe... | [{"type": "stdin_stdout", "input": "13 42 292 733\n304 308\n362 365\n396 397\n686 688\n719 722\n815 816\n901 902\n904 905\n921 924\n929 933\n953 954\n977 980\n982 985\n28 30\n36 37\n108 112\n123 127\n134 135\n151 153\n160 162\n203 205\n208 212\n240 243\n261 264\n271 274\n294 297\n356 358\n383 385\n408 412\n415 418\n435... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given three strings $s$, $t$ and $p$ consisting of lowercase Latin letters. You may perform any number (possibly, zero) operations on these strings.\n\nDuring each operation you choose any character from $p$, eras... | [{"type": "stdin_stdout", "input": "1\naaaaaabbbbbbbbcccccccccccdddd\naaaaabbbbbbccccccccddddddddd\naaaaabbbbbbbbbcccccccccddddd\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1\naaaaaabbbbbbbbcccccccccccdddd\naaaaabbbbbbccccccccddddddddd\naaaaabbbbbbbbbcccccccccddddd\n", "output": "No\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice got a new doll these days. It can even walk!\n\nAlice has built a maze for the doll and wants to test it. The maze is a grid with n rows and m columns. There are k obstacles, the i-th of them is on the cell (x_i, y_... | [{"type": "stdin_stdout", "input": "10 10 70\n10 4\n5 5\n6 10\n8 9\n3 8\n10 9\n10 10\n8 2\n2 10\n7 2\n7 3\n10 2\n8 3\n9 8\n2 9\n3 1\n6 5\n6 9\n2 8\n10 7\n8 4\n8 6\n7 6\n5 6\n9 10\n3 9\n5 8\n4 8\n3 10\n10 5\n5 2\n5 4\n8 8\n3 2\n3 6\n2 3\n1 9\n6 6\n2 4\n6 2\n5 3\n6 4\n7 9\n2 2\n5 9\n7 10\n7 8\n3 3\n2 6\n7 5\n8 10\n3 4\n6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVova plans to go to the conference by train. Initially, the train is at the point $1$ and the destination point of the path is the point $L$. The speed of the train is $1$ length unit per minute (i.e. at the first minute ... | [{"type": "stdin_stdout", "input": "10\n10 1 1 1\n10 1 1 2\n10 1 1 3\n10 1 1 4\n10 1 1 5\n10 1 1 6\n10 1 1 7\n10 1 1 8\n10 1 1 9\n10 1 1 10\n", "output": "9\n8\n7\n6\n5\n4\n3\n2\n1\n0\n"}, {"type": "stdin_stdout", "input": "10\n10 2 1 1\n10 2 1 2\n10 2 1 3\n10 2 1 4\n10 2 1 5\n10 2 1 6\n10 2 1 7\n10 2 1 8\n10 2 1 9\n10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIahub got lost in a very big desert. The desert can be represented as a n × n square matrix, where each cell is a zone of the desert. The cell (i, j) represents the cell at row i and column j (1 ≤ i, j ≤ n). Iahub can go ... | [{"type": "stdin_stdout", "input": "999999989 38\n999999980 999999981\n10 8\n2 5\n999999978 999999981\n999999978 999999985\n7 9\n8 10\n9 10\n999999984 999999980\n6 6\n999999985 999999986\n999999982 999999978\n999999981 999999987\n8 5\n999999982 999999980\n999999989 999999980\n999999988 999999983\n999999982 999999984\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThree poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right.\nWe will call the arrangement of the poles beautiful if the tops of the poles lie on the same line, that is, b-a = c-b... | [{"type": "stdin_stdout", "input": "-1 -1 -1", "output": "YES\n"}, {"type": "stdin_stdout", "input": "-2 -3 -4", "output": "YES\n"}, {"type": "stdin_stdout", "input": "-1 -2 -1", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-1 -3 -1", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-2 -4 -1", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers $x$ and $y$. You can perform two types of operations: Pay $a$ dollars and increase or decrease any of these integers by $1$. For example, if $x = 0$ and $y = 7$ there are four possible outcome... | [{"type": "stdin_stdout", "input": "3\n1 3\n391 555\n129 8437\n9 4\n321 654\n3 4\n", "output": "1337\n75288\n2283\n"}, {"type": "stdin_stdout", "input": "3\n1 3\n391 555\n129 8437\n9 4\n321 654\n3 4\n", "output": "1337\n75288\n2283\n"}, {"type": "stdin_stdout", "input": "3\n1 6\n391 555\n129 8437\n9 4\n321 654\n3 4\n",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya came up with a password to register for EatForces — a string s. The password in EatForces should be a string, consisting of lowercase and uppercase Latin letters and digits.\n\nBut since EatForces takes care of the ... | [{"type": "stdin_stdout", "input": "6\n11b\n4bh\nBeh\nTuY\n1YJ\nP28\n", "output": "A1b\n4Ah\nB1h\n1uY\n1aJ\nPa8\n"}, {"type": "stdin_stdout", "input": "6\n11b\n4bh\nBeh\nTvY\n1YJ\nP28\n", "output": "A1b\n4Ah\nB1h\n1vY\n1aJ\nPa8\n"}, {"type": "stdin_stdout", "input": "6\n11b\n4bh\nBeh\nvTY\n1YJ\nP28\n", "output": "A1b\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe start with a string $s$ consisting only of the digits $1$, $2$, or $3$. The length of $s$ is denoted by $|s|$. For each $i$ from $1$ to $|s|$, the $i$-th character of $s$ is denoted by $s_i$. \n\nThere is one cursor. T... | [{"type": "stdin_stdout", "input": "9\n1500\n1212\n1500\n1221\n1500\n122\n1500\n12121\n1500\n22\n1500\n1111112111111112\n1500\n1111111111221111111\n1500\n111111122\n1500\n11111121111121111111\n", "output": "1504\n1599\n1502\n1598\n1502\n1510\n1657\n1502\n1763\n"}, {"type": "stdin_stdout", "input": "9\n1500\n1212\n1500\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 1234567891011121314151617181920212223242526272829303... | [{"type": "stdin_stdout", "input": "1000000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1000000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1000000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "100000000000\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHarry Potter is on a mission to destroy You-Know-Who's Horcruxes. The first Horcrux that he encountered in the Chamber of Secrets is Tom Riddle's diary. The diary was with Ginny and it forced her to open the Chamber of Se... | [{"type": "stdin_stdout", "input": "9\nliyzmbjwnzryjokufuxcqtzwworjeoxkbaqrujrhdidqdvwdfzilwszgnzglnnbogaclckfnbqovtziuhwvyrqwmskx\nliyzmbjwnzryjokufuxcqtzwworjeoxkbaqrujrhdidqdvwdfzilwszgnzglnnbogaclckfnbqovtziuhwvyrqwmskx\nliyzmbjwnzryjokufuxcqtzwworjeoxkbaqrujrhdidqdvwdfzilwszgnzglnnbogaclckfnbqovtziuhwvyrqwmskx\nhr... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nStep up and down\n\nKazuki, commonly known as Kerr, who attends JAG University, was invited by your friend this summer to participate in the ICPC (International Collegiate Potchari Contest). ICPC is a sports contest and r... | [{"type": "stdin_stdout", "input": "4\nlu ru ld rd\n4\nlu ld lu ru\n1\nlu\n10\nru lu ld rd ru rd ru lu rd ld\n0", "output": "2\n1\n0\n4"}, {"type": "stdin_stdout", "input": "4\nlu ru ld rd\n4\nlu ld lu ru\n0\nlu\n10\nur lu ld rd ru rd ru lu rd ld\n-1", "output": "2\n1\n"}, {"type": "stdin_stdout", "input": "4\nlu ru ld... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProfessor Tsukuba invented a mysterious jewelry box that can be opened with a special gold key whose shape is very strange. It is composed of gold bars joined at their ends. Each gold bar has the same length and is placed... | [{"type": "stdin_stdout", "input": "19\n 1 +x 1 +y +z 3 +z\n 3 +y -z +x +y -z -x +z 2 +z\n 2 +y\n19\n 1 +x 1 +x +z 3 +y -z +x +y -z -x +z 2 +y\n 3 +z\n 2 +z\n19\n 1 +x 1 +y +z 3 +z\n 3 +y -z +x +y -z -x +z 2 +y\n 2 +z\n18\n 1 -y\n 1 +y -z +x\n 1 +z +y +x +z +y -x -y 1 -y\n 2 +z\n3 +x +y +z\n3 +y +z -x\n0",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. Th... | [{"type": "stdin_stdout", "input": "100 3\n.*.\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n**... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a permutation of length $n$. Recall that the permutation 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]$ i... | [{"type": "stdin_stdout", "input": "4\n5\n5 4 1 3 2\n4\n1 2 4 3\n1\n1\n4\n4 3 2 1\n", "output": "1 5 2 4 3 \n1 2 3 4 \n1 \n1 4 3 2 \n"}, {"type": "stdin_stdout", "input": "4\n5\n5 4 1 3 2\n4\n1 2 4 3\n1\n1\n4\n4 3 2 1\n", "output": "1 5 2 4 3 \n1 2 3 4 \n1 \n1 4 3 2 \n"}, {"type": "stdin_stdout", "input": "4\n5\n5 4 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N men and N women, both numbered 1, 2, \\ldots, N.\n\nFor each i, j (1 \\leq i, j \\leq N), the compatibility of Man i and Woman j is given as an integer a_{i, j}. If a_{i, j} = 1, Man i and Woman j are compatib... | [{"type": "stdin_stdout", "input": "21\n0 0 0 0 0 0 0 1 1 0 1 1 1 1 0 0 0 1 0 0 1\n1 1 1 0 1 1 0 0 0 1 0 0 0 0 1 1 1 0 1 1 0\n0 0 1 1 1 1 0 1 1 0 0 1 0 0 1 1 0 0 0 1 1\n0 1 1 0 1 1 0 1 0 1 0 0 1 0 0 0 0 0 1 1 0\n1 1 0 0 1 0 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0\n0 1 1 0 1 1 1 0 1 1 1 0 0 0 1 1 1 1 0 0 1\n0 1 0 0 0 1 0 1 0 0 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is a member of a programming competition site, ButCoder.\nEach member of ButCoder is assigned two values: Inner Rating and Displayed Rating.\nThe Displayed Rating of a member is equal to their Inner Rating if th... | [{"type": "stdin_stdout", "input": "100 4111\n", "output": "4111\n"}, {"type": "stdin_stdout", "input": "22 3051\n", "output": "3051\n"}, {"type": "stdin_stdout", "input": "10 3141\n", "output": "3141\n"}, {"type": "stdin_stdout", "input": "11 3141\n", "output": "3141\n"}, {"type": "stdin_stdout", "input": "2 2919\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nGPA is an abbreviation for \"Galaxy Point of Aizu\" and takes real numbers from 0 to 4.\nGPA rock-paper-scissors is a game played by two people. After each player gives a signal of \"rock-paper-scissors, pon (h... | [{"type": "stdin_stdout", "input": "3\n1.2162360718264462\n2.9346880694304285\n3.9759367558439593", "output": "0\n3\n6\n"}, {"type": "stdin_stdout", "input": "3\n1.3676423535538285\n2.5451927881659007\n3.4551403734048662", "output": "0\n3\n6\n"}, {"type": "stdin_stdout", "input": "3\n2.2132650658019095\n2.5451927881659... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have an integer sequence A of length N, where A_1 = X, A_{i+1} = A_i + D (1 \\leq i < N ) holds.\nTakahashi will take some (possibly all or none) of the elements in this sequence, and Aoki will take all of the others.... | [{"type": "stdin_stdout", "input": "199903 -42042635 15996643\n", "output": "1331394274247808\n"}, {"type": "stdin_stdout", "input": "199937 46898475 97994148\n", "output": "1332073730358274\n"}, {"type": "stdin_stdout", "input": "199903 2748118 -84690464\n", "output": "1331394274247808\n"}, {"type": "stdin_stdout", "i... | 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 the given string $s$ in the easy version is initially a palindrome, this condition is not always true for the hard version.\n\nA palindrome is a string that r... | [{"type": "stdin_stdout", "input": "3\n3\n110\n2\n00\n4\n1010\n", "output": "\nALICE\nBOB\nALICE\n"}, {"type": "stdin_stdout", "input": "3\n3\n110\n2\n00\n4\n1010\n", "output": "ALICE\nBOB\nALICE\n"}, {"type": "stdin_stdout", "input": "3\n3\n110\n2\n00\n4\n1011\n", "output": "ALICE\nBOB\nALICE\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $s=s_1s_2\\dots s_n$ of length $n$, which only contains digits $1$, $2$, ..., $9$.\n\nA substring $s[l \\dots r]$ of $s$ is a string $s_l s_{l + 1} s_{l + 2} \\ldots s_r$. A substring $s[l \\dots r]... | [{"type": "stdin_stdout", "input": "39\n263254663359864483324578786753512345165\n", "output": "327\n"}, {"type": "stdin_stdout", "input": "39\n263254663359864483324578786753512345165\n", "output": "327"}, {"type": "stdin_stdout", "input": "10\n9572683145\n", "output": "24\n"}, {"type": "stdin_stdout", "input": "10\n957... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChef Jessie has a lot of recipes with her (N). She often remembered the starting few characters of the recipe and forgot the rest. As all the great chefs do, Jessie also numbered the recipes depending on the priority. So,... | [{"type": "stdin_stdout", "input": "4\nflour-with-eggs 100\nchicken-ham -10\nflour-without-eggs 200\nfish-with-pepper 1100\n6\nf\nflour-with\nflour-with-\nc\nfl\nchik\n", "output": "fish-with-pepper\nflour-without-eggs\nflour-with-eggs\nchicken-ham\nflour-without-eggs\nNO\n"}, {"type": "stdin_stdout", "input": "4\nflou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAllen has a LOT of money. He has $n$ dollars in the bank. For security reasons, he wants to withdraw it in cash (we will not disclose the reasons here). The denominations for dollar bills are $1$, $5$, $10$, $20$, $100$. ... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "10000000\n"}, {"type": "stdin_stdout", "input": "1230910855\n", "output": "12309112\n"}, {"type": "stdin_stdout", "input": "1199225057\n", "output": "11992256\n"}, {"type": "stdin_stdout", "input": "1100000000\n", "output": "11000000\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya studies in a school and he adores Maths. His class has been studying arithmetic expressions. On the last class the teacher wrote three positive integers a, b, c on the blackboard. The task was to insert signs of ope... | [{"type": "stdin_stdout", "input": "10\n10\n10\n", "output": "1000\n"}, {"type": "stdin_stdout", "input": "10\n10\n10\n", "output": "1000\n"}, {"type": "stdin_stdout", "input": "10\n5\n6\n", "output": "300\n"}, {"type": "stdin_stdout", "input": "10\n5\n6\n", "output": "300\n"}, {"type": "stdin_stdout", "input": "9\n14\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nManao works on a sports TV. He's spent much time watching the football games of some country. After a while he began to notice different patterns. For example, each team has two sets of uniforms: home uniform and guest un... | [{"type": "stdin_stdout", "input": "30\n44 17\n44 17\n44 17\n17 44\n44 17\n44 17\n17 44\n17 44\n17 44\n44 17\n44 17\n44 17\n44 17\n44 17\n17 44\n17 44\n17 44\n44 17\n44 17\n17 44\n44 17\n44 17\n44 17\n17 44\n17 44\n44 17\n17 44\n44 17\n44 17\n44 17\n", "output": "418\n"}, {"type": "stdin_stdout", "input": "30\n67 21\n8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCirno has a DAG (Directed Acyclic Graph) with $n$ nodes and $m$ edges. The graph has exactly one node that has no out edges. The $i$-th node has an integer $a_i$ on it.\n\nEvery second the following happens:\n\nLet $S$ be... | [{"type": "stdin_stdout", "input": "5\n3 2\n1 1 1\n1 2\n2 3\n5 5\n1 0 0 0 0\n1 2\n2 3\n3 4\n4 5\n1 5\n10 11\n998244353 0 0 0 998244353 0 0 0 0 0\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 8\n8 9\n9 10\n1 3\n7 9\n5 6\n1293 1145 9961 9961 1919\n1 2\n2 3\n3 4\n5 4\n1 4\n2 4\n6 9\n10 10 10 10 10 10\n1 2\n1 3\n2 3\n4 3\n6 3\n3 5\n6 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAquaMoon has n friends. They stand in a row from left to right, and the i-th friend from the left wears a T-shirt with a number a_i written on it. Each friend has a direction (left or right). In the beginning, the directi... | [{"type": "stdin_stdout", "input": "10\n10\n6 2 1 1 1 10 10 2 10 5\n8\n1 3 1 1 4 5 4 4\n9\n9 6 9 9 2 8 7 2 2\n10\n9 4 3 3 5 4 3 10 4 5\n9\n7 5 1 7 5 5 5 5 6\n8\n8 8 4 4 7 6 2 8\n10\n6 8 1 6 8 8 5 6 8 4\n10\n5 5 5 8 3 4 3 3 10 10\n8\n1 1 3 6 6 7 1 2\n8\n4 1 3 5 3 1 3 3\n", "output": "NO\nYES\nYES\nYES\nYES\nYES\nYES\nYE... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nYou are in charge of quality control at a machine manufacturing plant. This machine requires a power supply, a motor, and a cable as parts. The manufacturing plant has a power supply, b motors, and c cables, nu... | [{"type": "stdin_stdout", "input": "2 2 8\n4\n1 1 1 0\n5 3 4 0\n1 4 0 0\n1 3 0 0\n0 0 0", "output": "2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n"}, {"type": "stdin_stdout", "input": "1 2 8\n4\n4 1 1 0\n5 0 5 0\n-1 4 0 0\n1 3 2 0\n0 0 0", "output": "2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n"}, {"type": "stdin_stdout", "input": "4 2 4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nn people are standing on a coordinate axis in points with positive integer coordinates strictly less than 10^6. For each person we know in which direction (left or right) he is facing, and his maximum speed.\n\nYou can pu... | [{"type": "stdin_stdout", "input": "26 10\n495492 7 1\n256604 5 2\n511773 3 2\n590712 4 1\n206826 7 2\n817878 4 2\n843915 1 1\n349160 3 1\n351298 4 1\n782251 8 2\n910928 4 1\n662354 4 2\n468621 2 2\n466991 7 2\n787303 6 2\n221623 8 2\n343518 6 1\n141123 7 1\n24725 6 1\n896603 3 2\n918129 8 2\n706071 6 2\n512369 2 2\n60... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin and Russian. Translations in Vietnamese to be uploaded soon. \n\nYou have a matrix of size N * N with rows numbered through 1 to N from top to bottom and columns through 1 to N from le... | [{"type": "stdin_stdout", "input": "2\n2\n1 3\n2 4\n3\n2 7 9\n1 4 8\n3 6 5", "output": "4\n13\n"}, {"type": "stdin_stdout", "input": "2\n2\n1 3\n2 4\n3\n1 7 9\n3 4 8\n2 6 5", "output": "4\n12\n"}, {"type": "stdin_stdout", "input": "2\n2\n1 3\n2 4\n3\n1 7 9\n2 4 8\n6 3 5", "output": "4\n14\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is the easy version of the problem. The difference is the constraints on $n$, $m$ and $t$. You can make hacks only if all versions of the problem are solved.\n\nAlice and Bob are given the numbers $n$, $m$ and $k$, a... | [{"type": "stdin_stdout", "input": "10\n74 66 762901908\n543 237 181918820\n455 298 213830486\n54 35 373479158\n85 72 98863599\n85 72 351650459\n106 18 450755091\n344 26 748825922\n65 48 594595004\n189 52 282125334\n", "output": "271485562\n845881147\n625043331\n624104397\n478865056\n346406768\n733766402\n149326158\n29... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is a string S consisting of digits from 1 through 9.\nFind the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:\nCondition: In base ten, the i-th through j-th characters of S... | [{"type": "stdin_stdout", "input": "17363411548681837295128261415319567339781353176864449667411811151437528238242154453591258857339631698313648443916861223514163135267434612598561425414167173299132999132912477426521378378857571251998814421613836117444161875651252375139311654156139512913688822685276844411124583145973751... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAshish has two strings $a$ and $b$, each of length $n$, and an integer $k$. The strings only contain lowercase English letters.\n\nHe wants to convert string $a$ into string $b$ by performing some (possibly zero) operatio... | [{"type": "stdin_stdout", "input": "4\n3 3\nabc\nbcd\n4 2\nabba\nazza\n2 1\nzz\naa\n6 2\naaabba\nddddcc\n", "output": "\nNo\nYes\nNo\nYes\n"}, {"type": "stdin_stdout", "input": "4\n3 3\nabc\nbcd\n4 2\nabba\nazza\n2 1\nzz\naa\n6 2\naaabba\nddddcc\n", "output": "No\nYes\nNo\nYes\n"}, {"type": "stdin_stdout", "input": "4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nSoccer is popular in JOI, and a league match called the JOI League is held every week.\n\nThere are N teams in the JOI league, numbered from 1 to N. All combinations of matches are played exactly once. In other... | [{"type": "stdin_stdout", "input": "4\n1 1 0 21\n1 4 2 0\n1 -1 12 2\n4 3 1 3\n4 16 6 1\n-1 1 1 12", "output": "1\n4\n2\n2\n"}, {"type": "stdin_stdout", "input": "4\n1 2 0 19\n2 3 2 2\n1 0 22 1\n3 3 3 -1\n3 16 6 0\n0 1 -1 8", "output": "2\n3\n1\n4\n"}, {"type": "stdin_stdout", "input": "4\n1 2 0 19\n2 3 8 1\n2 0 22 1\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSergey Semyonovich is a mayor of a county city N and he used to spend his days and nights in thoughts of further improvements of Nkers' lives. Unfortunately for him, anything and everything has been done already, and ther... | [{"type": "stdin_stdout", "input": "10\n2 3\n3 9\n6 3\n9 8\n9 10\n4 10\n3 1\n2 5\n7 2\n", "output": "70\n"}, {"type": "stdin_stdout", "input": "10\n2 3\n2 9\n6 3\n9 8\n9 10\n4 10\n3 1\n2 5\n7 2\n", "output": "70\n"}, {"type": "stdin_stdout", "input": "10\n2 3\n3 9\n6 4\n10 8\n9 10\n4 2\n3 1\n3 5\n7 1\n", "output": "75\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Cereal Guy's friend Serial Guy likes to watch soap operas. An episode is about to start, and he hasn't washed his plate yet. But he decided to at least put in under the tap to be filled with water. The plate can be re... | [{"type": "stdin_stdout", "input": "4 10 10\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\nGiven an array $a$, consisting of $n$ integers, find:\n\n$$\\max\\limits_{1 \\le i < j \\le n} LCM(a_i,a_j),$$\n\nwhere $LCM(x, y)$ is the smallest positive integer that is divisible by both $x$ and $y$. For example, $LCM... | [{"type": "stdin_stdout", "input": "174\n28 44 12 32 9 27 23 5 23 47 14 49 39 5 10 5 20 9 4 34 18 40 16 4 45 30 32 44 44 30 29 23 21 27 35 13 23 46 5 32 47 45 44 23 12 2 9 28 47 23 22 27 45 27 40 41 22 39 50 14 40 44 20 40 49 23 14 29 27 23 16 40 45 44 15 18 28 9 23 15 21 10 46 29 18 6 15 3 11 34 1 15 35 27 46 36 4 20 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a multiset $S$ initially consisting of $n$ distinct non-negative integers. A multiset is a set, that can contain some elements multiple times.\n\nYou will perform the following operation $k$ times:\n\nAdd th... | [{"type": "stdin_stdout", "input": "7\n5 1000000000\n4 2 3 0 1\n4 0\n5 2 0 1\n3 0\n100 0 1\n6 1234567\n1 2 3 4 5 0\n3 114514\n8 0 4\n1 1000000\n0\n1 10000000\n1\n", "output": "1000000005\n4\n3\n1234573\n4\n1000001\n1\n"}, {"type": "stdin_stdout", "input": "7\n5 1000000000\n4 2 3 0 1\n4 0\n5 2 0 1\n3 0\n100 0 1\n6 12345... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are H rows and W columns of white square cells.\nYou will choose h of the rows and w of the columns, and paint all of the cells contained in those rows or columns.\nHow many white cells will remain?\nIt can be prove... | [{"type": "stdin_stdout", "input": "21 -1\n-5 -5", "output": "104\n"}, {"type": "stdin_stdout", "input": "39 -1\n-5 -5", "output": "176\n"}, {"type": "stdin_stdout", "input": "13 13\n8 10\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "20 20\n19 19\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "19 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe main street of Berland is a straight line with n houses built along it (n is an even number). The houses are located at both sides of the street. The houses with odd numbers are at one side of the street and are numbe... | [{"type": "stdin_stdout", "input": "100000 99999\n", "output": "50000\n"}, {"type": "stdin_stdout", "input": "100000 23458\n", "output": "38272\n"}, {"type": "stdin_stdout", "input": "100000 23457\n", "output": "11729\n"}, {"type": "stdin_stdout", "input": "92480 43074\n", "output": "24704\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA permutation of length n is an array containing each integer from 1 to n exactly once. For example, q = [4, 5, 1, 2, 3] is a permutation. For the permutation q the square of permutation is the permutation p that p[i] = q... | [{"type": "stdin_stdout", "input": "100\n94 22 24 99 58 97 20 29 67 30 38 64 77 50 15 44 92 88 39 42 25 70 2 76 84 6 37 49 17 71 31 19 26 79 10 35 65 63 32 95 5 8 52 27 83 18 53 93 13 81 48 68 54 82 34 60 87 23 16 86 55 40 61 45 28 7 74 41 14 91 3 72 33 11 98 89 90 69 78 36 80 59 56 21 43 1 75 46 47 12 96 73 57 51 4 85... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnya has bought a new smartphone that uses Berdroid operating system. The smartphone menu has exactly n applications, each application has its own icon. The icons are located on different screens, one screen contains k ic... | [{"type": "stdin_stdout", "input": "71 96 75634\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71\n27 26 27 26 27 26 27 26 27 26 27 26 27 26 27 26 27 26 27 26 27 26 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n4 3\n1000 1\n2000 2\n3000 3\n\n\nOutput\n\n2 3 4 4\n\nThe input will be stdin and you should print your solution to stdout\n\n\nNow solve the problem and return the code.\n\nWrite Python code to solve ... | [{"type": "stdin_stdout", "input": "25 1\n1010 1\n3784 7\n3000 6", "output": "2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n"}, {"type": "stdin_stdout", "input": "25 2\n1011 2\n2889 1\n308 2", "output": "3 3 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n"}, {"type": "stdin_stdout", "input": "20 3\n0010 1\n4107 3\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a data which provides heights (in meter) of mountains. The data is only for ten mountains.\n\nWrite a program which prints heights of the top three mountains in descending order.\n\nConstraints\n\n0 ≤ height of m... | [{"type": "stdin_stdout", "input": "1819\n2003\n1094\n2489\n1723\n492\n4419\n2848\n2834\n1724", "output": "4419\n2848\n2834\n"}, {"type": "stdin_stdout", "input": "1819\n2003\n1094\n2489\n1142\n492\n4419\n4289\n2834\n1724", "output": "4419\n4289\n2834\n"}, {"type": "stdin_stdout", "input": "1819\n2003\n876\n2840\n1723\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from a... | [{"type": "stdin_stdout", "input": "58 5\n1 6 9 18 34 41 82 99 164 179 183 204 240 396 636 1224 2023 2856 4488 4705 5712 9180 9266 18360 18850 20270 23086 60810 190701 197064 211140 214200 222970 243240 263510 314442 425670 486480 708288 789888 1009800 1025349 1054040 1094580 1325184 1579776 1748076 2050698 2635100 289... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n types of coins in Byteland. Conveniently, the denomination of the coin type k divides the denomination of the coin type k + 1, the denomination of the coin type 1 equals 1 tugrick. The ratio of the denominatio... | [{"type": "stdin_stdout", "input": "100\n4 1 5 3 2 1 1 1 4 1 1 2 1 1 1 4 1 1 3 1 3 1 1 1 1 4 5 1 5 2 5 3 1 1 1 1 1 1 1 3 2 1 1 3 1 1 3 4 3 2 4 1 1 4 1 1 2 2 4 1 4 1 2 5 1 2 2 1 5 3 1 5 4 2 1 1 2 5 5 1 4 4 2 3 1 4 1 3 2 1 1 1 4 1 3 1 1 5 1\n0 18 10 2 1 9 9 0 9 5 6 8 11 6 28 11 29 50 25 15 9 4 3 51 13 4 68 31 4 6 2 5 26 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNew Year is just around the corner, which means that in School 179, preparations for the concert are in full swing.\n\nThere are $n$ classes in the school, numbered from $1$ to $n$, the $i$-th class has prepared a scene o... | [{"type": "stdin_stdout", "input": "30\n3 1 3 2 3 1 1 3 2 1 1 3 3 3 3 3 2 1 2 1 3 2 2 1 3 1 3 1 2 3\n", "output": "0 1 1 1 1 2 3 3 3 4 5 5 5 6 6 6 6 7 7 8 8 8 9 10 10 11 11 12 12 12 "}, {"type": "stdin_stdout", "input": "7\n2 12 4 8 18 3 6\n", "output": "0 1 1 1 2 2 2 "}, {"type": "stdin_stdout", "input": "3\n1 1000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe elections to Berland parliament are happening today. Voting is in full swing!\n\nTotally there are n candidates, they are numbered from 1 to n. Based on election results k (1 ≤ k ≤ n) top candidates will take seats in... | [{"type": "stdin_stdout", "input": "100 100 100 100\n71 22 92 3 19 90 1 16 88 56 62 37 56 84 52 46 4 64 21 19 37 54 21 81 56 33 71 57 86 75 62 42 79 67 14 8 66 30 13 38 20 71 36 66 46 55 4 99 18 37 7 24 72 46 32 86 87 7 90 93 96 94 21 23 62 53 16 11 11 83 21 81 68 50 85 9 94 60 47 41 34 82 11 12 95 81 61 81 86 85 64 36... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Mishka is a great traveller and she visited many countries. After thinking about where to travel this time, she chose XXX — beautiful, but little-known northern country.\n\nHere are some interesting facts about XXX... | [{"type": "stdin_stdout", "input": "76 24\n6814 3834 1131 6256 2598 850 7353 1702 5773 1699 35 5103 1368 2258 7891 7455 8546 7316 7428 8864 6536 5750 8455 2624 7326 2197 8239 3806 3016 7126 85 3249 1138 6783 9684 4417 7417 3660 6334 7324 9760 9755 7605 9891 3676 8784 8739 8266 3272 9250 5875 939 4130 6540 7813 6867 914... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.