messages listlengths 1 1 | ground_truth stringlengths 88 726k | dataset stringclasses 2
values |
|---|---|---|
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDr. Asimov, a robotics researcher, released cleaning robots he developed (see Problem B). His robots soon became very popular and he got much income. Now he is pretty rich. Wonderful.\n\nFirst, he renovated his house. Onc... | [{"type": "stdin_stdout", "input": "34 1\n1 6\n2 6\n0 0", "output": "..................................\n.EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE.\n.E..............................E.\n.E.EEEEEEEEEEEEEEEEEEEEEEEEEEEE.E.\n.E.E..........................E.E.\n.E.E.EEEEEEEEEEEEEEEEEEEEEEEE.E.E.\n.E.E.E......................E.E.E.\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe nth triangular number is defined as the sum of the first n positive integers. The nth tetrahedral number is defined as the sum of the first n triangular numbers. It is easy to show that the nth tetrahedral number is e... | [{"type": "stdin_stdout", "input": "40\n14\n10\n55\n120\n199\n61\n150\n0", "output": "2 6\n2 14\n1 10\n2 21\n1 18\n4 29\n3 27\n3 14\n"}, {"type": "stdin_stdout", "input": "40\n14\n10\n55\n120\n269\n61\n150\n0", "output": "2 6\n2 14\n1 10\n2 21\n1 18\n3 31\n3 27\n3 14\n"}, {"type": "stdin_stdout", "input": "40\n14\n10\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBackground\n\nThe kindergarten attached to the University of Aizu is a kindergarten where children who love programming gather. Yu, one of the kindergarten children, loves rectangles as much as programming. Yu-kun decided... | [{"type": "stdin_stdout", "input": "4 4\n10 2 -1 6\n8 1 -100 41\n22 47 103 11\n-41 171 12 -8\n2 -1 0 2\n0 0 2 0\n0 1 0 1\n0 0 1 0\n2 3\n1 0 1\n0 1 0", "output": "336\n"}, {"type": "stdin_stdout", "input": "4 4\n10 2 -1 6\n8 1 -100 41\n22 47 32 11\n-41 99 12 -16\n2 -1 0 2\n0 0 2 0\n0 1 0 1\n1 0 1 0\n2 3\n1 0 1\n0 1 0", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob are going to drive from their home to a theater for a date. They are very challenging - they have no maps with them even though they don’t know the route at all (since they have just moved to their new home)... | [{"type": "stdin_stdout", "input": "5 1 5\n1 1 0 0 1\n0 2 1 0 0\n2 0 0 0 0\n1 0 0 2 0\n0 1 0 0 2\n0 0 1 1 -1\n0 0 0", "output": "15.0000000000\n"}, {"type": "stdin_stdout", "input": "5 1 5\n0 0 1 0 0\n0 2 0 0 0\n2 0 0 1 0\n1 0 0 1 0\n0 1 0 0 1\n0 -1 0 1 1\n0 0 0", "output": "14.0000000000\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nYou are a hero. The world in which the hero is traveling consists of N cities and M roads connecting different cities. Road i connects town a_i and town b_i and can move in both directions.\n\nThe pur... | [{"type": "stdin_stdout", "input": "8 5 2 0 1 5\n0 2\n0 3\n1 1\n0 2\n10 7\n1 4 13\n1 2 6", "output": "-1\n"}, {"type": "stdin_stdout", "input": "8 5 4 0 1 5\n0 2\n0 3\n1 1\n0 2\n10 7\n1 4 13\n1 2 6", "output": "-1\n"}, {"type": "stdin_stdout", "input": "8 6 3 1 1 17\n0 2\n0 4\n0 1\n1 2\n6 7\n1 0 25\n0 18 6", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nD: Many Decimal Integers\n\nproblem\n\nGiven a string S consisting only of numbers (0-9) and a string T consisting only of numbers and `?`. S and T are the same length.\n\nConsider changing each `?` That exists in T to on... | [{"type": "stdin_stdout", "input": "73\n??", "output": "2701\n"}, {"type": "stdin_stdout", "input": "73\n?6", "output": "252\n"}, {"type": "stdin_stdout", "input": "73\n5?", "output": "545\n"}, {"type": "stdin_stdout", "input": "73\n?5", "output": "245\n"}, {"type": "stdin_stdout", "input": "73\n4?", "output": "445\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAddition of Big Integers\n\nGiven two integers $A$ and $B$, compute the sum, $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 sum in a line.\n\nConst... | [{"type": "stdin_stdout", "input": "109 30", "output": "139\n"}, {"type": "stdin_stdout", "input": "195 30", "output": "225\n"}, {"type": "stdin_stdout", "input": "302 30", "output": "332\n"}, {"type": "stdin_stdout", "input": "552 30", "output": "582\n"}, {"type": "stdin_stdout", "input": "139 37", "output": "176\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the country of Numberia, there is a city called Primeland. Sherry is one of the rich inhabitants of the city, who likes to collect coins of various denominations. Coins in primeland are little strange , they are only a... | [{"type": "stdin_stdout", "input": "2\n0 12\n-1 7", "output": "-12\n-13\n"}, {"type": "stdin_stdout", "input": "2\n-1 2\n-1 7", "output": "-3\n-13\n"}, {"type": "stdin_stdout", "input": "2\n-2 2\n-1 7", "output": "-4\n-13\n"}, {"type": "stdin_stdout", "input": "2\n-2 1\n-1 7", "output": "-1\n-13\n"}, {"type": "stdin_st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNatasha is going to fly to Mars. She needs to build a rocket, which consists of several stages in some order. Each of the stages is defined by a lowercase Latin letter. This way, the rocket can be described by the string ... | [{"type": "stdin_stdout", "input": "50 13\nqwertyuiopasdfghjklzxcvbnmaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "169\n"}, {"type": "stdin_stdout", "input": "50 31\nahbyyoxltryqdmvenemaqnbakglgqolxnaifnqtoclnnqiabpz\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "50 14\nqwertyuiopasdfghjklzxcvbnmaaaaaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMikhail walks on a Cartesian plane. He starts at the point (0, 0), and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point (0, 0), he can go to any of the following poi... | [{"type": "stdin_stdout", "input": "3\n7 0 0\n3 1 0\n22 0 2\n", "output": "-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "3\n1 1 1\n9 -1 5\n35 0 1\n", "output": "1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "3\n2 2 3\n6 2 18\n10 0 1\n", "output": "1\n18\n-1\n"}, {"type": "stdin_stdout", "input": "3\n1 0 1\n9 -1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has recently got a job as a cashier at a local store. His day at work is L minutes long. Vasya has already memorized n regular customers, the i-th of which comes after t_{i} minutes after the beginning of the day, a... | [{"type": "stdin_stdout", "input": "1 1000000000 1\n0 1000000000\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 1000000000 1\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "0 1000000000 1000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "0 1000000000 1000000010\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, Masha was presented with a chessboard with a height of n and a width of m.\n\nThe rows on the chessboard are numbered from 1 to n from bottom to top. The columns are numbered from 1 to m from left to right. Ther... | [{"type": "stdin_stdout", "input": "5\n2 2\n1 1 2 2\n1 1 2 2\n3 4\n2 2 3 3\n3 1 4 3\n1 5\n1 1 3 1\n3 1 5 1\n6 4\n1 1 4 2\n1 3 4 4\n3 4\n1 2 4 2\n2 1 3 3\n", "output": "0 4\n4 8\n2 3\n12 12\n4 8\n"}, {"type": "stdin_stdout", "input": "5\n2 2\n1 1 2 2\n1 1 2 2\n3 5\n2 2 3 2\n3 1 4 3\n1 5\n1 1 5 1\n3 1 5 1\n4 4\n1 1 4 2\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAll cinema halls in Berland are rectangles with K rows of K seats each, and K is an odd number. Rows and seats are numbered from 1 to K. For safety reasons people, who come to the box office to buy tickets, are not allowe... | [{"type": "stdin_stdout", "input": "100 67\n66 12 2 49 62 63 59 14 13 26 15 25 22 16 33 17 15 14 13 33 9 10 53 28 17 27 18 39 35 64 1 59 33 24 66 64 4 2 4 5 22 9 52 36 44 57 62 3 52 21 62 55 25 2 65 18 20 40 8 30 27 28 47 19 67 67 42 6 53 17 36 38 57 37 45 13 58 12 31 24 15 67 9 18 56 20 34 8 20 31 13 19 42 12 16 15 54... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree with n nodes. You have to write non-negative integers on its edges so that the following condition would be satisfied:\n\nFor every two nodes i, j, look at the path between them and count the sum of n... | [{"type": "stdin_stdout", "input": "40\n11 8\n18 34\n21 23\n6 7\n23 28\n27 27\n8 18\n12 1\n27 4\n11 30\n40 22\n29 19\n9 32\n13 12\n15 9\n34 5\n27 37\n20 2\n18 33\n39 13\n27 17\n35 24\n40 3\n11 21\n1 35\n20 10\n25 20\n1 16\n27 6\n11 26\n38 36\n40 11\n17 25\n2 38\n40 39\n1 15\n12 27\n30 29\n14 31\n", "output": "12 1 1\n1... | 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": "30\n4 4 1\n3 3 1 2\n4 4 1\n4 1 4 1\n1 1 1\n1\n3 2 1\n2 1 2\n4 4 2\n3 2 2 2\n4 2 4\n1 2 2 2\n1 4 1\n4\n2 3 1\n2 3\n2 2 1\n2 2\n4 4 2\n1 2 4 2\n4 4 1\n2 4 4 3\n4 3 1\n1 3 1 3\n1 1 1\n1\n2 2 2\n2 1\n2 4 1\n1 4\n2 4 1\n3 4\n1 2 1\n1\n2 4 2\n2 1\n3 1 2\n1 1 1\n2 4 1\n1 4\n2 3 1\n3 3\n4 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLucy likes letters. She studied the definition of the lexicographical order at school and plays with it.\n\nAt first, she tried to construct the lexicographically smallest word out of given letters. It was so easy! Then s... | [{"type": "stdin_stdout", "input": "100 1 92\nxwcbimztwcyuckyappbkrddnxgnxqvmobveinzvvnseqxooecwrrdeuwzfzxvfkvguqrsofbbnhfcscxggpxzmruycgqfmnnoovd\n", "output": "a\nb\nb\nb\nb\nb\nc\nc\nc\nc\nc\nc\nc\nd\nd\nd\nd\ne\ne\ne\ne\nf\nf\nf\nf\nf\ng\ng\ng\ng\ng\nh\ni\ni\nk\nk\nk\nm\nm\nm\nm\nn\nn\nn\nn\nn\nn\nn\no\no\no\no\no\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou and your n - 1 friends have found an array of integers a_1, a_2, ..., a_n. You have decided to share it in the following way: All n of you stand in a line in a particular order. Each minute, the person at the front of... | [{"type": "stdin_stdout", "input": "4\n6 3 2\n4 16 1 3 8 5\n4 4 1\n2 13 60 4\n4 2 3\n1 -1 2 2\n2 2 0\n2 2\n", "output": "16\n4\n2\n2\n"}, {"type": "stdin_stdout", "input": "4\n6 3 2\n2 9 2 3 10 5\n4 4 1\n2 13 60 4\n4 2 3\n1 2 2 1\n2 2 0\n1 2\n", "output": "10\n4\n2\n1\n"}, {"type": "stdin_stdout", "input": "4\n6 3 2\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a sequence of integers a of length n, a tuple (i,j,k) is called monotone triples if \n\n * 1 ≤ i<j<k≤ n; \n * a_i ≤ a_j ≤ a_k or a_i ≥ a_j ≥ a_k is satisfied. \n\n\n\nFor example, a=[5,3,4,5], then (2,3,4) is mono... | [{"type": "stdin_stdout", "input": "30 27\n698632656 525581861 577504542 296603772 998990943 638005908 954895689 281259836 501177498 256330408 76466544 702835982 616513496 248342985 523962020 40996762 511850624 770240476 16065190 223228156 684298386 413908009 791936146 358337607 806286367 436654632 51668240 860274173 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlica and Bob are playing a game.\n\nInitially they have a binary string s consisting of only characters 0 and 1.\n\nAlice and Bob make alternating moves: Alice makes the first move, Bob makes the second move, Alice makes... | [{"type": "stdin_stdout", "input": "1\n111111111111111110000000000000000\n", "output": "NET\n"}, {"type": "stdin_stdout", "input": "1\n111111111111101110000000000000000\n", "output": "NET\n"}, {"type": "stdin_stdout", "input": "1\n111111111111101100100000000000000\n", "output": "NET\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a of n integers.\n\nYou want to make all elements of a equal to zero by doing the following operation exactly three times:\n\n * Select a segment, for each number in this segment we can add a multi... | [{"type": "stdin_stdout", "input": "32\n474784688 671671886 -592758087 -662585781 1305489182 333008394 111507813 985930436 -352098852 400811080 770280786 168025633 -426652315 726678951 914413742 -544810046 496546254 -749255284 -332401894 346164819 -207260314 68209011 940966817 -284672239 -655684691 845249877 -632338846... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the Main Berland Bank n people stand in a queue at the cashier, everyone knows his/her height hi, and the heights of the other people in the queue. Each of them keeps in mind number ai — how many people who are taller ... | [{"type": "stdin_stdout", "input": "36\nehsz 3\nog 7\nuzi 9\nraqkfkyvo 11\nu 34\nk 28\nzoukn 33\nz 11\nljkd 5\nzqveo 29\nfoftv 32\ne 1\ntv 34\ns 3\ntkyacr 20\nemhtosyne 1\nrto 7\nnoxv 23\nsw 6\nwisywcj 6\nmjjkdgwwth 2\nwbjfux 1\ndubrh 4\nrttidtex 2\nrprbjlsjy 9\nmmc 0\nofy 28\npvirnjc 14\nffdycmsbri 4\nhn 3\nggwb 0\nli... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe princess is going to escape the dragon's cave, and she needs to plan it carefully.\n\nThe princess runs at vp miles per hour, and the dragon flies at vd miles per hour. The dragon will discover the escape after t hour... | [{"type": "stdin_stdout", "input": "2\n100\n10\n10\n739\n", "output": "22\n"}, {"type": "stdin_stdout", "input": "1\n100\n1\n1\n1000\n", "output": "152\n"}, {"type": "stdin_stdout", "input": "2\n100\n13\n10\n739\n", "output": "22\n"}, {"type": "stdin_stdout", "input": "1\n100\n2\n1\n1000\n", "output": "151\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLena is the most economical girl in Moscow. So, when her dad asks her to buy some food for a trip to the country, she goes to the best store — \"PriceFixed\". Here are some rules of that store:\n\n * The store has an inf... | [{"type": "stdin_stdout", "input": "15\n1 18646259228611\n1 76062756486449\n1 5817259716888\n1 22110867828535\n1 100627485465221\n1 40799537235509\n1 56529154503793\n1 56148198559428\n1 77940886559829\n1 74079407528201\n1 6574734766207\n1 79264199999788\n1 19171266033881\n1 38437872037474\n1 34320923862986\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnother programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However,... | [{"type": "stdin_stdout", "input": "50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 50\n50 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Elephant loves magic squares very much.\n\nA magic square is a 3 × 3 table, each cell contains some positive integer. At that the sums of integers in all rows, columns and diagonals of the table are equal. The figu... | [{"type": "stdin_stdout", "input": "0 100000 100000\n100000 0 100000\n100000 100000 0\n", "output": "100000 100000 100000\n100000 100000 100000\n100000 100000 100000\n"}, {"type": "stdin_stdout", "input": "0 99626 99582\n99766 0 99258\n99442 99398 0\n", "output": "99328 99626 99582\n99766 99512 99258\n99442 99398 99696... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Bitlandians are quite weird people. They have very peculiar customs.\n\nAs is customary, Uncle J. wants to have n eggs painted for Bitruz (an ancient Bitland festival). He has asked G. and A. to do the work.\n\nThe ki... | [{"type": "stdin_stdout", "input": "10\n2 658\n5 29\n2 558\n1 1275\n2 1177\n1 1033\n1 247\n-1 4605\n0 1170\n-1 999\n", "output": "AAAAAAAAAA\n"}, {"type": "stdin_stdout", "input": "10\n2 658\n5 66\n2 784\n1 1275\n2 1177\n1 999\n1 247\n-1 4605\n0 1170\n-1 999\n", "output": "AAAAAAAAAA\n"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side.\n\nPavel drew a grid m... | [{"type": "stdin_stdout", "input": "19 20 196\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\nRecently a serious bug has been found in the FOS code. The head of the F company wants to find the culprit and punish him. For that, he set up an organizational meeting, the issue is: who's bugged the code? Each of the n ... | [{"type": "stdin_stdout", "input": "10 3\n6 3\n6 10\n2 5\n5 7\n6 2\n9 2\n8 1\n10 5\n5 10\n7 6\n", "output": "34\n"}, {"type": "stdin_stdout", "input": "10 2\n10 2\n9 3\n9 4\n7 2\n4 6\n10 1\n9 2\n3 10\n7 1\n5 1\n", "output": "43\n"}, {"type": "stdin_stdout", "input": "10 3\n6 3\n6 10\n2 5\n5 7\n6 2\n9 2\n8 1\n10 5\n5 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBizon the Champion isn't just a bison. He also is a favorite of the \"Bizons\" team.\n\nAt a competition the \"Bizons\" got the following problem: \"You are given two distinct words (strings of English letters), s and t. ... | [{"type": "stdin_stdout", "input": "itwtyhhsdjjffmmoqkkhxjouypznewstyorotxhozlytndehmaxogrohccnqcgkrjrdmnuaogiwmnmsbdaizqkxnkqxxiihbwepc\nsnixfywvcntitcefsgqxjcodwtumurcglfmnamnowzbjzmfzspbfuldraiepeeiyasmrsneekydsbvazoqszyjxkjiotushsddet\n", "output": "need tree\n"}, {"type": "stdin_stdout", "input": "yyyyxxxxyxyyxxxy... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday there is going to be an unusual performance at the circus — hamsters and tigers will perform together! All of them stand in circle along the arena edge and now the trainer faces a difficult task: he wants to swap th... | [{"type": "stdin_stdout", "input": "178\nTTTTTTHTHHHTHHTHHHHTTTHTHTTHTHHHTHTTTTHHTTHHHTTHHTTHHTTHHHHHTHHTTHTHHTTHHTTTTTTTTTHTHTTHTHHTHHHHHHTTTHTHHHHTHHTTHHHHTTTTTTTTHHHTHHHTHTHHHTTTTTHTHTTTHTHHTTHTTTHHHHHTTHTTHTTTHTHHHT\n", "output": "40\n"}, {"type": "stdin_stdout", "input": "178\nTTTTTTHTHHHTHHTHHHHTTTHTHTTHTHHHTHTTT... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVanya and his friend Vova play a computer game where they need to destroy n monsters to pass a level. Vanya's character performs attack with frequency x hits per second and Vova's character performs attack with frequency ... | [{"type": "stdin_stdout", "input": "20 6 15\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n", "output": "Both\nBoth\nVova\nVova\nVanya\nVova\nVova\nBoth\nBoth\nVova\nVova\nVanya\nVova\nVova\nBoth\nBoth\nVova\nVova\nVanya\nVova\n"}, {"type": "stdin_stdout", "input": "20 5 15\n20\n21\n22... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA schoolboy named Vasya loves reading books on programming and mathematics. He has recently read an encyclopedia article that described the method of median smoothing (or median filter) and its many applications in scienc... | [{"type": "stdin_stdout", "input": "168\n0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPeter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it w... | [{"type": "stdin_stdout", "input": "29 -999961 689169\n-999960 689169\n-999927 -938525\n-999735 -989464\n-993714 -997911\n-870186 -999686\n-796253 -999950\n-139940 -999968\n969552 -999972\n985446 -999398\n992690 -997295\n999706 -973137\n999898 -848630\n999997 -192297\n999969 773408\n999495 960350\n999143 981671\n998324... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDante is engaged in a fight with \"The Savior\". Before he can fight it with his sword, he needs to break its shields. He has two guns, Ebony and Ivory, each of them is able to perform any non-negative number of shots.\n\... | [{"type": "stdin_stdout", "input": "26 100 5582\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "128 81 3880\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "19 100 1446\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "73 100 3111\n", "output": "YES"}, {"type": "stdin_stdout", "input": "63... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has a sequence of cubes and exactly one integer is written on each cube. Vasya exhibited all his cubes in a row. So the sequence of numbers written on the cubes in the order from the left to the right equals to a1, ... | [{"type": "stdin_stdout", "input": "10 1 10\n6 7 6 1 10 10 9 5 3 9\n7 10 9 6 1 5 9 3 10 6\n", "output": "TRUTH\n"}, {"type": "stdin_stdout", "input": "8 3 6\n5 3 1 1 1 1 1 10\n3 3 1 1 1 1 5 5\n", "output": "LIE\n"}, {"type": "stdin_stdout", "input": "8 4 6\n5 3 1 1 2 1 3 5\n3 3 1 1 1 2 8 10\n", "output": "LIE\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn one of the games Arkady is fond of the game process happens on a rectangular field. In the game process Arkady can buy extensions for his field, each extension enlarges one of the field sizes in a particular number of ... | [{"type": "stdin_stdout", "input": "63481 80094 3 2 200\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLuba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the tick... | [{"type": "stdin_stdout", "input": "111000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "000000\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "123456\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "191578\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "877542\n", "output": "2\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou can perfectly predict the price of a certain stock for the next N days. You would like to profit on this knowledge, but only want to transact one share of stock per day. That is, each day you will either buy one share... | [{"type": "stdin_stdout", "input": "100\n411 642 560 340 276 440 515 519 182 314 35 227 390 136 97 5 502 584 567 79 543 444 413 463 455 316 545 329 437 443 9 435 291 384 328 501 603 234 285 297 453 587 550 72 130 163 282 298 605 349 270 198 24 179 243 92 115 56 83 26 3 456 622 325 366 360 299 153 140 552 216 117 61 307... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJulia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after k minutes after turning on.\n\nDuring cooking, Julia goes to the kitchen every d min... | [{"type": "stdin_stdout", "input": "1000000000000000000 1001000000000000000 1000000000000000000\n", "output": "1000000000000000000.000000000000000\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 1000000000000000000\n", "output": "1000000000000000000.000000000000000"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAll the students in NIT are very lazy. They want to have maximum time for rest. But due to college rules, they must maintain 75% attendance at the end of every week.\n\nGiven the schedule of a week, tell them what is the ... | [{"type": "stdin_stdout", "input": "1\n3 60 70 80 131 110 200\n3 50 70 100 120 150 200\n3 50 80 90 100 200 220\n3 80 100 110 115 200 210\n3 10 20 40 50 60 100\n3 10 50 60 80 90 100\n3 50 80 90 100 200 300\n\nSAMPLE", "output": "604525\n"}, {"type": "stdin_stdout", "input": "1\n3 60 70 80 154 100 200\n3 50 70 100 120 15... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRoy wants to change his profile picture on Facebook. Now Facebook has some restriction over the dimension of picture that we can upload.\nMinimum dimension of the picture can be L x L, where L is the length of the side of... | [{"type": "stdin_stdout", "input": "180\n3\n1111 112\n37 300\n164 180\n\nBRLELP", "output": "UPLOAD ANOTHER\nUPLOAD ANOTHER\nUPLOAD ANOTHER\n"}, {"type": "stdin_stdout", "input": "180\n3\n147 643\n133 300\n180 180\n\nSAMELP", "output": "UPLOAD ANOTHER\nUPLOAD ANOTHER\nACCEPTED\n"}, {"type": "stdin_stdout", "input": "18... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYes, you read it right - Little Jhool is back, but no, he's not over his break up, still. And he's sad, broken and depressed; thus, he decided to visit a psychologist. She tells him to think about his pleasant memories of... | [{"type": "stdin_stdout", "input": "10\n10\n113\n34\n82\n82\n9\n17\n9\n52\n64", "output": "1\n-1\n3\n7\n7\n-1\n-1\n-1\n5\n6\n"}, {"type": "stdin_stdout", "input": "10\n10\n113\n34\n82\n82\n94\n86\n9\n52\n64", "output": "1\n-1\n3\n7\n7\n8\n8\n-1\n5\n6\n"}, {"type": "stdin_stdout", "input": "10\n10\n113\n34\n82\n82\n9\n8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs it is the Valentines month, Puchi's girlfriend asks him to take her shopping. He, being the average bloke, does not have a lot of money to spend. Hence, decides to buy each item from the shop that offers the best pric... | [{"type": "stdin_stdout", "input": "2\n1 3\n20 20 50\n30 20 0\n60 50 0\n2 2\n20 20 20\n30 20 40\n10 100 90\n35 60 50\n\nSAMPLE", "output": "3\n2 1\n"}, {"type": "stdin_stdout", "input": "2\n1 3\n20 20 50\n30 20 0\n60 50 0\n2 2\n20 20 20\n30 20 40\n10 100 90\n6 60 50\n\nSAMPLE", "output": "3\n2 1\n"}, {"type": "stdin_st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTo become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives.\n\nHe is famous across the... | [{"type": "stdin_stdout", "input": "7\n100 130 243 130 115 115 150", "output": "3165\n"}, {"type": "stdin_stdout", "input": "7\n100 130 243 130 115 115 271", "output": "5706\n"}, {"type": "stdin_stdout", "input": "7\n110 130 243 130 115 115 271", "output": "5161\n"}, {"type": "stdin_stdout", "input": "7\n110 130 136 13... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have N points numbered 1 to N arranged in a line in this order.\n\nTakahashi decides to make an undirected graph, using these points as the vertices. In the beginning, the graph has no edge. Takahashi will do M operati... | [{"type": "stdin_stdout", "input": "14 7\n2 4 18\n1 4 10\n2 3 1\n4 10 10\n3 9 -1\n6 14 5\n5 10 0", "output": "14\n"}, {"type": "stdin_stdout", "input": "10 7\n1 5 18\n3 4 14\n1 3 5\n4 7 10\n1 9 8\n6 10 5\n5 10 10", "output": "13\n"}, {"type": "stdin_stdout", "input": "10 7\n1 5 18\n3 4 10\n1 2 5\n4 7 10\n3 9 1\n6 10 6\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integer sequences S and T of length N and M, respectively, both consisting of integers between 1 and 10^5 (inclusive).\n\nIn how many pairs of a subsequence of S and a subsequence of T do the two subsequ... | [{"type": "stdin_stdout", "input": "20 20\n1 1 1 1 1 1 1 0 1 1 2 1 2 1 1 1 1 1 1 -1\n1 1 1 1 1 1 1 0 1 1 1 1 1 -1 1 1 1 1 1 2", "output": "533905917\n"}, {"type": "stdin_stdout", "input": "20 20\n1 1 1 1 1 1 1 0 1 2 2 1 2 1 1 1 1 1 1 -1\n1 1 1 1 1 1 1 0 1 1 1 1 1 -1 1 1 1 1 1 2", "output": "743290736\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being... | [{"type": "stdin_stdout", "input": "10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000010 1000000000 1000000000", "output": "13\n"}, {"type": "stdin_stdout", "input": "10 400000000\n1000000000 1000000010 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a tree with N vertices. Vertex 1 is the root of the tree, and the parent of Vertex i (2 \\leq i \\leq N) is Vertex P_i.\n\nTo each vertex in the tree, Snuke will allocate a color, either black or white, and a non-... | [{"type": "stdin_stdout", "input": "8\n1 2 2 3 4 5 5\n4 1 6 2 2 1 3 3", "output": "IMPOSSIBLE\n"}, {"type": "stdin_stdout", "input": "8\n1 2 2 2 4 5 5\n4 1 6 2 2 1 3 3", "output": "IMPOSSIBLE\n"}, {"type": "stdin_stdout", "input": "8\n1 1 1 3 4 5 5\n5 1 6 0 2 1 6 3", "output": "IMPOSSIBLE\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInput\n\nThe input is given from standard input in the following format.\n\n\n> $H \\ W$ $a_{1, 1} \\ a_{1, 2} \\ \\cdots \\ a_{1, W}$ $a_{2, 1} \\ a_{2, 2} \\ \\cdots \\ a_{2, W}$ $\\vdots \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \... | [{"type": "stdin_stdout", "input": "4 6\n2 3 3 8 2 3\n11 8 9 0 2 0\n0 1 0 1 8 5\n3 10 3 5 9 27\n0 1 1 -1 2 4\n2 19 1 12 1 15", "output": "107\n"}, {"type": "stdin_stdout", "input": "4 6\n2 3 3 7 1 3\n11 8 9 0 2 0\n0 1 4 1 8 5\n3 10 3 5 9 14\n0 1 1 0 2 2\n2 19 1 12 1 10", "output": "96\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's play Hit and Blow game. A imagines four numbers and B guesses the numbers. After B picks out four numbers, A answers:\n\n* The number of numbers which have the same place with numbers A imagined (Hit)\n* The number ... | [{"type": "stdin_stdout", "input": "9 1 8 3\n6 1 4 3\n8 6 -1 -1\n2 7 3 1", "output": "2 0\n0 0\n"}, {"type": "stdin_stdout", "input": "4 1 8 2\n6 1 2 3\n8 6 -1 -1\n2 7 3 1", "output": "1 1\n0 0\n"}, {"type": "stdin_stdout", "input": "5 0 8 2\n6 1 2 3\n7 6 -1 -1\n2 7 3 1", "output": "0 1\n0 1\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNow, a ninja is planning to sneak into the castle tower from outside the castle. This ninja can easily run on the ground and swim in the moat, but he is not very good at climbing up from the moat, so he wants to enter the... | [{"type": "stdin_stdout", "input": "4 5\n.###.\n#...#\n#.&.#\n#...#\n.###.\n18 15\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\nThe secret organization AiZu AnalyticS has launched a top-secret investigation. There are N people targeted, with identification numbers from 1 to N. As an AZAS Information Strategy Investigator, you have decided to deter... | [{"type": "stdin_stdout", "input": "100\n3 -1 100 3\n-1\n2 4 3", "output": "1\n"}, {"type": "stdin_stdout", "input": "100\n3 0 001 4\n-2\n2 10 3", "output": "2\n"}, {"type": "stdin_stdout", "input": "100\n3 0 001 4\n-3\n2 10 3", "output": "2\n"}, {"type": "stdin_stdout", "input": "100\n3 -1 100 3\n-1\n2 6 3", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter a long journey, the super-space-time immigrant ship carrying you finally discovered a planet that seems to be habitable. The planet, named JOI, is a harsh planet with three types of terrain, \"Jungle,\" \"Ocean,\" a... | [{"type": "stdin_stdout", "input": "4 7\n4\nJIOJOIJ\nIJIOJOO\nJOIJOOI\nOOJJIJO\n5 7 0 7\n2 2 3 0\n2 3 2 2\n1 1 0 7", "output": "-1 -2 -1\n-1 0 -1\n0 0 0\n0 0 0\n"}, {"type": "stdin_stdout", "input": "4 7\n4\nJIOJOIJ\nIJIOJOO\nJOIJOOI\nOOJJIJO\n5 2 0 7\n2 2 2 0\n2 3 2 2\n1 1 0 7", "output": "-8 -10 -6\n0 0 -1\n0 0 0\n0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. Simpson got up with a slight feeling of tiredness. It was the start of another day of hard work. A bunch of papers were waiting for his inspection on his desk in his office. The papers contained his students' answers ... | [{"type": "stdin_stdout", "input": "a+b+c\n(a+b)+c\na- (b-c)+2\n.\n4ab\n(a - b) (0-b+a) - 1a ^ 2 - b ^ 3\n2 b 2 a\n.\n108 a\n2 2 3 3 3 a\n4 a^1 27\n.\n.", "output": "yes\nno\n.\nno\nyes\n.\nyes\nyes\n.\n"}, {"type": "stdin_stdout", "input": "a+b+c\n(a+b)+c\na- (b-c)+2\n.\n4ab\n(a - b) (0-b+a) - 1a ^ 4 - b ^ 3\n2 b 2 a\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nThere are n vertices that are not connected to any of the vertices.\nAn undirected side is stretched between each vertex.\nFind out how many sides can be stretched when the diameter is set to d.\nThe diameter r... | [{"type": "stdin_stdout", "input": "-11 14", "output": "287\n"}, {"type": "stdin_stdout", "input": "-14 17", "output": "449\n"}, {"type": "stdin_stdout", "input": "-11 18", "output": "393\n"}, {"type": "stdin_stdout", "input": "-1 20", "output": "207\n"}, {"type": "stdin_stdout", "input": "-6 11", "output": "128\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem Statement\n\nAlice is a private teacher. One of her job is to prepare the learning materials for her student. Now, as part of the materials, she is drawing a Venn diagram between two sets $A$ and $B$.\n\nVenn diag... | [{"type": "stdin_stdout", "input": "17 5 1 1 0\n10 14 2 2 1\n10 10 71 70 20\n0 0 0 0 0", "output": "0.564189584 0.564189584 0.564189584 16.435810416 4.435810416 0.564189584\n0.797884561 0.797884561 0.797884561 1.159474025 1.331572803 0.797884561\nimpossible\n"}, {"type": "stdin_stdout", "input": "14 5 1 1 0\n10 5 2 2 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\nacmicpc\ntsukuba\n\n\nOutput\n\nNo\n\nThe input will be given via stdin and the output should be printed to stdout by your code.\n\nNow solve the problem by providing the code.\n\nWrite Python code to ... | [{"type": "stdin_stdout", "input": "acmicpc\nttukuba", "output": "No\n"}, {"type": "stdin_stdout", "input": "acmpcic\nttukuba", "output": "No\n"}, {"type": "stdin_stdout", "input": "acmpcid\nttukuba", "output": "No\n"}, {"type": "stdin_stdout", "input": "acmpcid\nttakubu", "output": "No\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDetermine whether a text T includes a pattern P. Your program should answer for given queries consisting of P_i.\n\nConstraints\n\n* 1 ≤ length of T ≤ 1000000\n* 1 ≤ length of P_i ≤ 1000\n* 1 ≤ Q ≤ 10000\n* The input cons... | [{"type": "stdin_stdout", "input": "aabaaa\n4\nab\nba\nbb\nxyz", "output": "1\n1\n0\n0\n"}, {"type": "stdin_stdout", "input": "aabaaa\n4\nab\nba\nba\nxyz", "output": "1\n1\n1\n0\n"}, {"type": "stdin_stdout", "input": "aabaaa\n4\nba\nbb\nac\nzyx", "output": "1\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "aabaaa\n4\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHow Many Divisors?\n\nWrite a program which reads three integers a, b and c, and prints the number of divisors of c between a and b.\n\nConstraints\n\n* 1 ≤ a, b, c ≤ 10000\n* a ≤ b\n\nInput\n\nThree integers a, b and c a... | [{"type": "stdin_stdout", "input": "4 32 120", "output": "10\n"}, {"type": "stdin_stdout", "input": "13 14 107", "output": "0\n"}, {"type": "stdin_stdout", "input": "5 14 149", "output": "0\n"}, {"type": "stdin_stdout", "input": "13 14 80", "output": "0\n"}, {"type": "stdin_stdout", "input": "5 14 241", "output": "0\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya's house is situated in a forest, and there is a mushroom glade near it. The glade consists of two rows, each of which can be divided into n consecutive cells. For each cell Vasya knows how fast the mushrooms grow in... | [{"type": "stdin_stdout", "input": "6\n4 1 11 9 3 11\n12 32 19 12 19 11\n", "output": "1035\n"}, {"type": "stdin_stdout", "input": "6\n4 1 11 6 3 11\n12 32 19 12 19 11\n", "output": "1026\n"}, {"type": "stdin_stdout", "input": "6\n4 1 11 6 3 18\n12 32 19 12 19 11\n", "output": "1061\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter all the events in Orlando we all know, Sasha and Roma decided to find out who is still the team's biggest loser. Thankfully, Masha found somewhere a revolver with a rotating cylinder of n bullet slots able to contai... | [{"type": "stdin_stdout", "input": "15 10 15\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n", "output": ".X.X.X.X.XXXXXX\n"}, {"type": "stdin_stdout", "input": "15 10 15\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n1\n14\n15\n", "output": ".X.X.X.X.XXX.XX"}, {"type": "stdin_stdout", "input": "15 10 15\n1\n2\n3\n3\n5\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a positive integer n greater or equal to 2. For every pair of integers a and b (2 ≤ |a|, |b| ≤ n), you can transform a into b if and only if there exists an integer x such that 1 < |x| and (a ⋅ x = b or b ⋅ ... | [{"type": "stdin_stdout", "input": "100000\n", "output": "12898363344"}, {"type": "stdin_stdout", "input": "88077\n", "output": "10005839736\n"}, {"type": "stdin_stdout", "input": "88853\n", "output": "10182812524\n"}, {"type": "stdin_stdout", "input": "93365\n", "output": "11243148040\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Fair Nut found a string s. The string consists of lowercase Latin letters. The Nut is a curious guy, so he wants to find the number of strictly increasing sequences p_1, p_2, …, p_k, such that: \n\n 1. For each i (1 ... | [{"type": "stdin_stdout", "input": "babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab\n", "output": "813881762\n"}, {"type": "stdin_stdout", "input": "babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabbaaabaaaaababaaaabaaab\n", "output": "45... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRoman and Denis are on the trip to the programming competition. Since the trip was long, they soon got bored, and hence decided to came up with something. Roman invented a pizza's recipe, while Denis invented a string mul... | [{"type": "stdin_stdout", "input": "4\nqe\nnc\niqryhukieskfvaeettersinksrmazelxtgvartuz\nvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn a random day, Neko found n treasure chests and m keys. The i-th chest has an integer a_i written on it and the j-th key has an integer b_j on it. Neko knows those chests contain the powerful mysterious green Grapes, th... | [{"type": "stdin_stdout", "input": "10 10\n522312461 931001459 598654597 488228616 544064902 21923894 329635457 980089248 988262691 654502493\n967529230 543358150 835120075 128123793 809901567 613170206 152157661 479980560 859252956 318029856\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "10 10\n522312461 93... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, Tokitsukaze found an interesting game. Tokitsukaze had n items at the beginning of this game. However, she thought there were too many items, so now she wants to discard m (1 ≤ m ≤ n) special items of them.\n\nT... | [{"type": "stdin_stdout", "input": "1000000000000000000 20 365\n31881893160049984 103938857870698567 103962228223609431 140762820261865064 175962215264653912 239086305245565642 354522451098745823 383839975876242372 443471287955807705 478923027151493682 511195154588214957 619570919279066139 677571312513476877 7058647976... | 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\nNow elections are held in Berland and you want to win them. More precisely, you want everyone to vote for you.\n\nThere are n voters, and two ways to c... | [{"type": "stdin_stdout", "input": "3\n3\n1 5\n2 10\n2 15\n7\n0 1\n3 1\n1 1\n6 1\n1 1\n4 1\n4 1\n6\n2 6\n2 3\n2 15\n2 7\n4 4\n5 5\n", "output": "10\n0\n7\n"}, {"type": "stdin_stdout", "input": "3\n3\n1 5\n2 10\n2 4\n7\n0 1\n3 1\n1 1\n6 1\n1 1\n4 1\n4 1\n6\n2 6\n2 3\n2 14\n2 1\n4 4\n5 5\n", "output": "4\n0\n4\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four neighbouring buildings. Al... | [{"type": "stdin_stdout", "input": "2 1000000000 100000\n1000000000 1000000\n1000000000 00000\n", "output": "1\n1000000000 100001\n"}, {"type": "stdin_stdout", "input": "2 1000000000 100000\n1000000000 1000000\n1000000000 10000\n", "output": "1\n1000000000 100001"}, {"type": "stdin_stdout", "input": "7 10 12\n5 8\n39 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecall that MEX of an array is a minimum non-negative integer that does not belong to the array. Examples:\n\n * for the array [0, 0, 1, 0, 2] MEX equals to 3 because numbers 0, 1 and 2 are presented in the array and 3 i... | [{"type": "stdin_stdout", "input": "7 3\n0\n1\n2\n2\n0\n0\n10\n", "output": "1\n2\n3\n3\n4\n4\n7\n"}, {"type": "stdin_stdout", "input": "7 5\n0\n1\n2\n2\n0\n0\n10\n", "output": "1\n2\n3\n3\n3\n3\n3\n"}, {"type": "stdin_stdout", "input": "4 4\n0\n1\n2\n2\n0\n0\n10\n", "output": "1\n2\n3\n3\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVK news recommendation system daily selects interesting publications of one of n disjoint categories for each user. Each publication belongs to exactly one category. For each category i batch algorithm selects a_i publica... | [{"type": "stdin_stdout", "input": "40\n19 20 8 13 13 17 1 14 15 20 14 17 2 9 9 10 19 16 6 12 9 7 20 5 12 6 4 4 12 5 4 11 8 1 2 8 11 19 18 4\n52258 5648 46847 9200 101064 79328 64407 54479 1788 60107 8234 64215 15419 84411 50307 78075 92548 17867 43456 7970 1390 99373 97297 90662 82950 678 79356 51351 2794 82477 16508 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob are playing yet another card game. This time the rules are the following. There are n cards lying in a row in front of them. The i-th card has value a_i. \n\nFirst, Alice chooses a non-empty consecutive segm... | [{"type": "stdin_stdout", "input": "131\n30 -29 29 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrey's favourite number is n. Andrey's friends gave him two identical numbers n as a New Year present. He hung them on a wall and watched them adoringly.\n\nThen Andrey got bored from looking at the same number and he s... | [{"type": "stdin_stdout", "input": "73552900025351606679224588872327647961330089042655630665222580520508672870102563487600132539752481214659858863022476410484266570139810532470714984092503934751571221521306943121997450187110428026190962582430971693370613087381790614697689671767000004095232276975952292053272119035138483... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n cities and m bidirectional roads in Berland. The i-th road connects the cities x_i and y_i, and has the speed limit s_i. The road network allows everyone to get from any city to any other city. \n\nThe Berland... | [{"type": "stdin_stdout", "input": "4\n4 5 7\n4 1 3\n1 2 5\n2 3 8\n2 4 1\n3 4 4\n4 6 5\n1 2 1\n1 3 1\n1 4 2\n2 4 1\n4 3 1\n3 2 1\n3 2 10\n1 2 8\n1 3 10\n5 5 15\n1 2 17\n3 1 15\n2 3 10\n1 4 14\n2 5 8\n", "output": "\n1\n3\n0\n0\n"}, {"type": "stdin_stdout", "input": "4\n4 5 7\n4 1 3\n1 2 5\n2 1 6\n1 3 1\n3 4 4\n4 6 5\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s consisting of lowercase English letters and a number k. Let's call a string consisting of lowercase English letters beautiful if the number of occurrences of each letter in that string is divisibl... | [{"type": "stdin_stdout", "input": "12\n12 3\nzazasqzqsasq\n1 2\ny\n1 1\na\n15 5\nabccbaabccbazaa\n16 8\ncadjfdsljfdkljds\n6 2\nbaazaa\n6 3\nbosszb\n6 1\nqwerty\n7 7\ndaaaaaa\n14 2\nacabcbdeffewzc\n18 6\nzzzzzzzzzzzzyyyyyz\n9 4\naabaabbbc\n", "output": "zazasqzqsasq\n-1\na\nabccbaabccbbaac\ncbbbbbbbbccccccc\nbaazbz\nbp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHighway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divided into n sub-tracks. You ... | [{"type": "stdin_stdout", "input": "3\n3\n1 2 3\n4\n0 1 1 0\n10\n10 3 1 11 5 2 1 7 19 4\n", "output": "0\n4\n21\n"}, {"type": "stdin_stdout", "input": "3\n3\n1 2 3\n4\n0 1 1 0\n10\n10 3 1 11 5 2 1 7 10 4\n", "output": "0\n4\n24\n"}, {"type": "stdin_stdout", "input": "3\n3\n1 1 3\n4\n1 1 1 0\n10\n16 3 6 11 0 2 1 3 10 4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHow to make a cake you'll never eat.\n\nIngredients. \n\n * 2 carrots\n * 0 calories\n * 100 g chocolate spread\n * 1 pack of flour\n * 1 egg\n\n\n\nMethod. \n\n 1. Put calories into the mixing bowl.\n 2. Take carr... | [{"type": "stdin_stdout", "input": "100 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1010 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe ancient Berlanders believed that the longer the name, the more important its bearer is. Thus, Berland kings were famous for their long names. But long names are somewhat inconvenient, so the Berlanders started to abbr... | [{"type": "stdin_stdout", "input": "50\nagecd\ncghafi\nfiide\niecc\njbdcfjhgd\ndiee\nhfeg\nehc\ngfijgjh\ngacaifebg\ndicbbddc\nhjgciaei\njjcdh\ng\ngc\ncf\nhfdjhd\nc\nicidbec\nji\neeh\ncgeejggc\nacfd\njjg\najefdj\neghhebiic\nbih\ngbb\njjaa\nidc\ngafi\necg\ndbigbjiehj\ncedif\nahidfaaajg\nhfhhiccbgb\ndgegjgieif\nhgjebhfdc\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya's bicycle chain drive consists of two parts: n stars are attached to the pedal axle, m stars are attached to the rear wheel axle. The chain helps to rotate the rear wheel by transmitting the pedal rotation.\n\nWe kn... | [{"type": "stdin_stdout", "input": "50\n159 880 1070 1139 1358 1608 1691 1841 2073 2171 2213 2597 2692 2759 2879 2931 3173 3217 3441 4201 4878 5106 5129 5253 5395 5647 5968 6019 6130 6276 6286 6330 6409 6728 7488 7713 7765 7828 7899 8064 8264 8457 8483 8685 8900 8946 8965 9133 9187 9638\n45\n57 159 1070 1139 1391 1608 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nValera had two bags of potatoes, the first of these bags contains x (x ≥ 1) potatoes, and the second — y (y ≥ 1) potatoes. Valera — very scattered boy, so the first bag of potatoes (it contains x potatoes) Valera lost. Va... | [{"type": "stdin_stdout", "input": "1 2 27764\n", "output": "1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 15... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a string s, determine if it contains any palindrome of length exactly 100 as a subsequence. If it has any, print any one of them. If it doesn't have any, print a palindrome that is a subsequence of s and is as long ... | [{"type": "stdin_stdout", "input": "gamjuklsvzwddaocadujdmvlenyyvlflipneqofeyipmtunbdmbdyhkovnpdetueeiunsipowrhxrhtastjniqdhmehcumdcrghewljvpikcraoouhfwtnoaukbnykjapkvyakdnckkypargamvnsqtchesbmuffqqycnjvolmtpjfykvkeexkpdxjexrvdzpcbthhkxuucermkaebrvcxoovidpqnpkgbhiatyjvumihptrigqxsemqbbxwmyunmmayubqqjaioqmzyekhtqgoockis... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSeryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are w... | [{"type": "stdin_stdout", "input": "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n<3i<>3am<3the<3<main<3in<3the<3><3family<3\n", "output": "no\n"}, {"type": "stdin_stdout", "input": "7\ni\nam\nont\nmain\nin\nthe\nfamily\n<3i<>3am<3the<3<main<3in<3the<3><3fami... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's a very unfortunate day for Volodya today. He got bad mark in algebra and was therefore forced to do some work in the kitchen, namely to cook borscht (traditional Russian soup). This should also improve his algebra sk... | [{"type": "stdin_stdout", "input": "20 3696\n87 22 21 83 95 31 28 96 71 25 56 40 70 79 46 87 19 19 34 25\n70 44 34 11 2 1 59 22 46 28 3 53 52 71 34 18 65 71 76 30\n", "output": "21.768421052631577\n"}, {"type": "stdin_stdout", "input": "20 1479\n69 30 15 62 81 24 5 16 25 65 47 23 62 51 87 50 6 44 88 61\n57 47 76 68 7 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe call a string good, if after merging all the consecutive equal characters, the resulting string is palindrome. For example, \"aabba\" is good, because after the merging step it will become \"aba\".\n\nGiven a string, y... | [{"type": "stdin_stdout", "input": "bbabaaabaaaabaabbababbbabababaabaaaaabbaabbbbbaababaabbbaabaabaaaababaabaabbabaaabaabbbabbaaaaaaabaabababaaabaaabbbabbabbaabaaabaabbbbbabbababbbbbbbababbababbbabbbbbababaaaababaabbabaaabbaaabaabbbbabbaaababbbbbbaaabbaaabbaaabaaaaaababaabababaabaaabaaaabaabbabbabbbbabbaaabaabbaababaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCaptain Marmot wants to prepare a huge and important battle against his enemy, Captain Snake. For this battle he has n regiments, each consisting of 4 moles.\n\nInitially, each mole i (1 ≤ i ≤ 4n) is placed at some positi... | [{"type": "stdin_stdout", "input": "3\n-3238 6528 -2144 6181\n-2245 6663 -2100 7054\n-4378 7068 -4061 7516\n-4274 6026 -3918 5721\n4942 -6793 5014 -6807\n3767 -5170 3112 -5181\n2870 -6992 3038 -6567\n5688 -4318 5358 -4744\n5249 7233 5016 6863\n4312 7385 4162 7383\n5965 13494 5607 8728\n4053 8349 4124 8389\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt turns out that you are a great fan of rock band AC/PE. Peter learned that and started the following game: he plays the first song of the list of n songs of the group, and you have to find out the name of the song. Afte... | [{"type": "stdin_stdout", "input": "50 4191\n43 1771\n51 2057\n31 1931\n89 1605\n63 3899\n0 2604\n34 2554\n78 1967\n57 3239\n35 1440\n97 1836\n50 2422\n82 3406\n97 2371\n94 2827\n90 3286\n69 1945\n97 2389\n26 2022\n84 3437\n1 4088\n40 3725\n22 4102\n26 2735\n19 3923\n19 1732\n79 1844\n38 2393\n44 2491\n77 1451\n16 2985... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya is sitting on an extremely boring math class. To have fun, he took a piece of paper and wrote out n numbers on a single line. After that, Vasya began to write out different ways to put pluses (\"+\") in the line bet... | [{"type": "stdin_stdout", "input": "200 100\n56988719755815575893282254081467698462485803782142631369385180999746639622554559884281193367342283559238834106917388166048020056852911293394377949964185368886333934084399980368238188117302968424219707\n", "output": "295455656\n"}, {"type": "stdin_stdout", "input": "200 99\n9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob has a permutation of integers from 1 to n. Denote this permutation as p. The i-th element of p will be denoted as pi. For all pairs of distinct integers i, j between 1 and n, he wrote the number ai, j = min(pi, pj). H... | [{"type": "stdin_stdout", "input": "13\n0 5 5 2 5 4 5 5 3 5 5 5 1\n5 0 6 2 6 4 6 6 3 6 6 6 1\n5 6 0 2 10 4 7 10 3 8 10 9 1\n2 2 2 0 2 2 2 2 2 2 2 2 1\n5 6 10 2 0 4 7 12 3 8 11 9 1\n4 4 4 2 4 0 4 4 3 4 4 4 1\n5 6 7 2 7 4 0 7 3 7 7 7 1\n5 6 10 2 12 4 7 0 3 8 11 9 1\n3 3 3 2 3 3 3 3 0 3 3 3 1\n5 6 8 2 8 4 7 8 3 0 8 8 1\n5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA super computer has been built in the Turtle Academy of Sciences. The computer consists of n·m·k CPUs. The architecture was the paralellepiped of size n × m × k, split into 1 × 1 × 1 cells, each cell contains exactly one... | [{"type": "stdin_stdout", "input": "100 1 1\n0\n\n1\n\n1\n\n1\n\n0\n\n0\n\n0\n\n1\n\n1\n\n0\n\n0\n\n1\n\n0\n\n1\n\n1\n\n1\n\n1\n\n0\n\n0\n\n1\n\n1\n\n1\n\n0\n\n0\n\n0\n\n0\n\n0\n\n1\n\n1\n\n0\n\n1\n\n1\n\n1\n\n0\n\n1\n\n0\n\n0\n\n1\n\n0\n\n1\n\n1\n\n0\n\n0\n\n0\n\n0\n\n1\n\n0\n\n1\n\n0\n\n0\n\n1\n\n1\n\n1\n\n0\n\n1\n\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA famous sculptor Cicasso goes to a world tour!\n\nWell, it is not actually a world-wide. But not everyone should have the opportunity to see works of sculptor, shouldn't he? Otherwise there will be no any exclusivity. So... | [{"type": "stdin_stdout", "input": "4 35\n1 1\n1 1\n1 1\n1 4\n1 2\n1 1\n1 1\n1 1\n1 1\n2 4\n2 2\n2 1\n2 4\n2 2\n2 1\n2 4\n2 2\n2 2\n2 3\n3 4\n3 3\n3 3\n3 4\n3 2\n3 4\n3 3\n3 2\n3 4\n3 1\n3 3\n4 4\n4 4\n4 2\n4 4\n4 2\n", "output": "4 1 3 2\n"}, {"type": "stdin_stdout", "input": "4 35\n1 1\n1 1\n1 1\n1 4\n1 2\n1 1\n1 1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTonight is brain dinner night and all zombies will gather together to scarf down some delicious brains. The artful Heidi plans to crash the party, incognito, disguised as one of them. Her objective is to get away with at ... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "500000000\n"}, {"type": "stdin_stdout", "input": "1001000000\n", "output": "500500000\n"}, {"type": "stdin_stdout", "input": "1393488002\n", "output": "696744001\n"}, {"type": "stdin_stdout", "input": "1001000100\n", "output": "500500050\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMemory and his friend Lexa are competing to get higher score in one popular computer game. Memory starts with score a and Lexa starts with score b. In a single turn, both Memory and Lexa get some integer in the range [ - ... | [{"type": "stdin_stdout", "input": "87 100 200 80\n", "output": " 913761305\n"}, {"type": "stdin_stdout", "input": "38 38 701 74\n", "output": " 496603581\n"}, {"type": "stdin_stdout", "input": "40 94 510 53\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere was an epidemic in Monstropolis and all monsters became sick. To recover, all monsters lined up in queue for an appointment to the only doctor in the city.\n\nSoon, monsters became hungry and began to eat each other... | [{"type": "stdin_stdout", "input": "23\n3 2 1 3 3 3 1 1 2 1 2 1 1 1 2 2 3 1 2 2 3 3 4\n5\n6 16 5 5 15\n", "output": "YES\n1 R\n1 R\n4 R\n4 R\n4 R\n4 R\n4 R\n4 L\n3 L\n6 L\n5 L\n4 L\n5 L\n10 L\n9 L\n8 L\n7 L\n6 L\n"}, {"type": "stdin_stdout", "input": "23\n3 2 1 3 3 3 1 1 2 1 2 1 1 1 2 2 3 1 2 3 3 3 3\n5\n6 16 5 5 15\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Berland each high school student is characterized by academic performance — integer value between 1 and 5.\n\nIn high school 0xFF there are two groups of pupils: the group A and the group B. Each group consists of exac... | [{"type": "stdin_stdout", "input": "100\n3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5\n2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a directed acyclic graph with n vertices and m edges. There are no self-loops or multiple edges between any pair of vertices. Graph can be disconnected.\n\nYou should assign labels to all vertices in such a ... | [{"type": "stdin_stdout", "input": "101 10\n73 41\n29 76\n11 8\n94 46\n77 67\n76 18\n72 50\n45 40\n89 75\n27 22\n", "output": "1 2 3 4 5 6 7 9 10 11 8 12 13 14 15 16 17 20 21 22 23 25 26 27 28 29 24 30 18 31 32 33 34 35 36 37 38 39 40 42 44 45 46 47 41 49 50 51 52 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 72 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two lists of non-zero digits.\n\nLet's call an integer pretty if its (base 10) representation has at least one digit from the first list and at least one digit from the second list. What is the smallest posi... | [{"type": "stdin_stdout", "input": "9 9\n9 8 7 6 5 4 3 2 1\n9 8 7 6 5 4 3 2 1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "9 9\n5 4 3 2 1 6 7 8 9\n3 2 1 5 4 7 8 9 6\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "9 9\n9 8 7 6 5 4 3 2 1\n1 2 3 4 5 6 7 8 9\n", "output": "1\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. Eleven wants her name to have exactly n characters. \n\n<image>\n\nHer friend suggested that... | [{"type": "stdin_stdout", "input": "1000\n", "output": "OOOoOooOooooOoooooooOooooooooooooOooooooooooooooooooooOoooooooooooooooooooooooooooooooooOooooooooooooooooooooooooooooooooooooooooooooooooooooooOooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooOooooooooooooooooooooooooooooooo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe've got no test cases. A big olympiad is coming up. But the problemsetters' number one priority should be adding another problem to the round.\n\nThe diameter of a multiset of points on the line is the largest distance ... | [{"type": "stdin_stdout", "input": "100 100\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne department of some software company has n servers of different specifications. Servers are indexed with consecutive integers from 1 to n. Suppose that the specifications of the j-th server may be expressed with a sing... | [{"type": "stdin_stdout", "input": "15 250 200\n71 2 77 69 100 53 54 40 73 32 82 58 24 82 41\n", "output": "Yes\n4 3\n4 1 9 3 \n11 14 5 "}, {"type": "stdin_stdout", "input": "15 250 200\n71 0 77 69 100 53 54 40 73 32 82 58 24 82 41\n", "output": "Yes\n4 3\n4 1 9 3 \n11 14 5 "}, {"type": "stdin_stdout", "input": "15 250... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLike other girlfriends Chintu's girlfriend is also very demanding. This time she is demanding for bracelet having atleast k special beads. A bracelet is composed of N strands. Each strand can have any number of beads and ... | [{"type": "stdin_stdout", "input": "100 3\nqboshbkwydsriaddbfrrjebrbaaclcyhdxwzqkoxwcdsmjlmfb\nzpsrabbcwuoqujwvxgdmnvxtssrqcdnsjiwlqjxbrrfmqanjqffsiflbbfapwvecckttabfqmcbah\ndransgswohnablgyrnxubsrkwdzqgkoqbcdyomotuvwadcxbpnuooemmgqptuthdsgcxuwcvwebqalq\npkgzmachsruexbdpzbuibiifotrzklzgccamiu\nxsmnyiqimydxdfabgtaspuujj... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this problem your goal is to guess some secret permutation A of integers from 1 to 16.\n\nThere are 17 tests in this problem. Test number i for 1 ≤ i ≤ 16 will have the following form:\nthe first line of the input con... | [{"type": "stdin_stdout", "input": "ELEMENT\n1 13", "output": "13\n"}, {"type": "stdin_stdout", "input": "ELEMENT\n2 15", "output": "15\n"}, {"type": "stdin_stdout", "input": "ELEMENT\n16 3", "output": "3\n"}, {"type": "stdin_stdout", "input": "ELEMENT\n6 4", "output": "4\n"}, {"type": "stdin_stdout", "input": "ELEMENT... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.