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\nAlice and Bob are playing One Card Poker.\nOne Card Poker is a two-player game using playing cards.\n\nEach card in this game shows an integer between `1` and `13`, inclusive.\nThe strength of a card is determined by the ... | [{"type": "stdin_stdout", "input": "-1 -4", "output": "Alice\n"}, {"type": "stdin_stdout", "input": "-2 -3", "output": "Alice\n"}, {"type": "stdin_stdout", "input": "-2 -4", "output": "Alice\n"}, {"type": "stdin_stdout", "input": "-2 -6", "output": "Alice\n"}, {"type": "stdin_stdout", "input": "-2 -8", "output": "Alice... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these.\n\nOnly Japanese students or overseas students can pas... | [{"type": "stdin_stdout", "input": "12 14 3\ncaababaccaba", "output": "No\nYes\nYes\nYes\nYes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\n"}, {"type": "stdin_stdout", "input": "12 14 3\nabaccababaac", "output": "Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nYes\nYes\nNo\n"}, {"type": "stdin_stdout", "input": "12 16 2\ncabbabaacaaa"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is one card each with the numbers from \"1\" to \"10\", for a total of 10 cards. This card has numbers on the front and nothing on the back. Using this card, you and your opponent will play the game according to the... | [{"type": "stdin_stdout", "input": "1 2 3\n4 1 10\n5 1 10", "output": "YES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "1 2 3\n5 6 10\n4 9 10", "output": "YES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "1 2 3\n7 1 10\n5 1 10", "output": "YES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "1 4 3\n5 6 10\n4 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDr. Sato, a botanist, invented a number of special fertilizers for seedlings. When you give the fertilizer to the seedlings, the size of the seedlings changes in a blink of an eye. However, it was found that fertilizer ha... | [{"type": "stdin_stdout", "input": "3 3\n1.8036677694351575 3.7376015310643522 0.9359006248557373\n4.789021816134845 2.456993805979323 1.0\n3.0 1.470921439035275 1.5624820640788264\n2 7\n1.2643980385584639 1.3805003041132355\n2.3877376705228617 1.9499455465451372\n0 0", "output": "17.90\n67.31\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEkiden competitions are held every year in Aizukuni. The country of Aiz is dotted with N towns, each numbered from 1 to N. Several towns are connected by roads that allow them to come and go directly to each other. You ca... | [{"type": "stdin_stdout", "input": "7 11\n2 4 2\n1 6 2\n2 4 2\n1 5 10\n2 6 2\n6 4 1\n6 5 1\n3 6 1\n4 7 0\n5 5 6\n6 7 1", "output": "4\n3\n4\n5\n7\n"}, {"type": "stdin_stdout", "input": "7 11\n2 1 2\n1 3 1\n2 3 2\n3 4 4\n2 6 1\n4 4 1\n3 5 2\n3 6 1\n4 7 3\n5 7 7\n6 7 1", "output": "4\n1\n2\n6\n7\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nJOI took six subjects: physics, chemistry, biology, earth science, history, and geography. Each test was scored on a 100-point scale.\n\nJOI chooses 3 subjects from 4 subjects of physics, chemistry, biology, an... | [{"type": "stdin_stdout", "input": "100\n-3\n8\n108\n-12\n-4", "output": "212\n"}, {"type": "stdin_stdout", "input": "100\n-7\n8\n108\n-12\n-1", "output": "215\n"}, {"type": "stdin_stdout", "input": "100\n66\n-13\n-1\n-2\n2", "output": "167\n"}, {"type": "stdin_stdout", "input": "100\n106\n-5\n-1\n-2\n3", "output": "20... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSeiji Hayashi had been a professor of the Nisshinkan Samurai School in the domain of Aizu for a long time in the 18th century. In order to reward him for his meritorious career in education, Katanobu Matsudaira, the lord ... | [{"type": "stdin_stdout", "input": "16\n10 8\n2 2\n2 6\n2 7\n6 6\n4 8\n4 2\n5 5\n4 8\n10 2\n6 7\n7 7\n7 8\n8 1\n5 4\n9 1\n10 3\n4 3\n8\n6 4\n2 2\n2 1\n2 4\n3 4\n4 2\n5 3\n1 1\n3 2\n3 3\n0", "output": "5\n5\n"}, {"type": "stdin_stdout", "input": "16\n10 9\n2 4\n2 6\n2 7\n6 6\n4 8\n4 2\n5 5\n4 8\n6 4\n6 7\n7 6\n7 8\n8 0\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne of the questions children often ask is \"How many stars are there in the sky?\" Under ideal conditions, even with the naked eye, nearly eight thousands are observable in the northern hemisphere. With a decent telescop... | [{"type": "stdin_stdout", "input": "3\n101 0 500\n-500.243 -199.7339381714296 -300.2711264812515\n0 176 354\n2\n0 1 1 1.1788431079539103\n-1 0 2 1.57\n3\n1 1 0\n0 1 0\n2 0 1\n4\n1 -2 -1 0.9553\n1 0 -1 0.9554\n-2 -2 1 0.9553\n-2 0 -1 0.9554\n3\n1 0 0\n1 2 0\n0 0 1\n4\n1 -1 -1 2.346642102923443\n-1 4 -1 2.792119841628054... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIncome Inequality\n\nWe often compute the average as the first step in processing statistical data. Yes, the average is a good tendency measure of data, but it is not always the best. In some cases, the average may hinder... | [{"type": "stdin_stdout", "input": "7\n27 15 2 15 15 23 15\n4\n10 20 30 5\n1\n1 1 1 2 1 1 1 0 1 110\n7\n90 122 90 90 90 9 10\n7\n2 8 2 8 2 11 8\n0", "output": "5\n2\n1\n1\n2\n1\n1\n2\n3\n"}, {"type": "stdin_stdout", "input": "7\n27 15 2 18 15 23 15\n4\n10 20 30 5\n1\n1 1 1 2 1 1 1 0 1 110\n7\n90 122 90 90 90 5 10\n7\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIkta, who hates to lose, has recently been enthusiastic about playing games using the Go board. However, neither Go nor Gomoku can beat my friends at all, so I decided to give a special training to the lesser-known game P... | [{"type": "stdin_stdout", "input": "...............\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\nproblem\n\nGiven the lengths of $ 2 $ sides that are not the hypotenuse of a right triangle, $ A $ and $ B $. The side of length $ A $ overlaps the $ x $ axis, and the side of length $ B $ overlaps the $ y $ axis.\n\nDo t... | [{"type": "stdin_stdout", "input": "-23 -12", "output": "-7238.229473871\n"}, {"type": "stdin_stdout", "input": "-26 -9", "output": "-3053.628059289\n"}, {"type": "stdin_stdout", "input": "-74 -8", "output": "-2144.660584851\n"}, {"type": "stdin_stdout", "input": "-11 -4", "output": "-268.082573106\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a dynamic array $A = \\\\{a_0, a_1, ...\\\\}$ of integers, perform a sequence of the following operations:\n\n* pushBack($x$): add element $x$ at the end of $A$\n* randomAccess($p$):print element $a_p$\n* popBack(): d... | [{"type": "stdin_stdout", "input": "8\n0 -1\n0 14\n0 1\n2\n0 4\n1 0\n1 0\n1 1", "output": "-1\n-1\n14\n"}, {"type": "stdin_stdout", "input": "8\n0 -1\n0 9\n1 1\n2\n0 4\n1 0\n1 0\n1 1", "output": "9\n-1\n-1\n4\n"}, {"type": "stdin_stdout", "input": "8\n0 -1\n0 2\n0 3\n2\n0 4\n1 0\n1 0\n1 0", "output": "-1\n-1\n-1\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBajtek, known for his unusual gifts, recently got an integer array x_0, x_1, …, x_{k-1}.\n\nUnfortunately, after a huge array-party with his extraordinary friends, he realized that he'd lost it. After hours spent on searc... | [{"type": "stdin_stdout", "input": "100\n57 81 176 211 251 311 346 404 469 506 563 587 682 717 757 817 852 910 975 1012 1069 1093 1188 1223 1263 1323 1358 1416 1481 1518 1575 1599 1694 1729 1769 1829 1864 1922 1987 2024 2081 2105 2200 2235 2275 2335 2370 2428 2493 2530 2587 2611 2706 2741 2781 2841 2876 2934 2999 3036 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA telephone number is a sequence of exactly 11 digits such that its first digit is 8.\n\nVasya and Petya are playing a game. Initially they have a string s of length n (n is odd) consisting of digits. Vasya makes the firs... | [{"type": "stdin_stdout", "input": "109\n8800880880088088880888808880888088800880888088088088888080880000080000800000808008008800080008000888000808880\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "109\n194738436769545519120557423157544990694461710781832332842159709627880402291528792654921639807013409671450... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSeryozha conducts a course dedicated to building a map of heights of Stepanovo recreation center. He laid a rectangle grid of size n × m cells on a map (rows of grid are numbered from 1 to n from north to south, and colum... | [{"type": "stdin_stdout", "input": "3000 3000 10 4\n122375063 551934841 132649021 999999937\n", "output": "218197599525055\n"}, {"type": "stdin_stdout", "input": "3000 3000 4 10\n623629309 917769297 890844966 987654319\n", "output": "215591588260257\n"}, {"type": "stdin_stdout", "input": "3000 3000 1000 1000\n794639486... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n chips on a number line. The i-th chip is placed at the integer coordinate x_i. Some chips can have equal coordinates.\n\nYou can perform each of the two following types of moves any (possibly, zero) number... | [{"type": "stdin_stdout", "input": "66\n17474 17509 20550 10873 31311 10156 24680 28012 29609 8266 18126 20151 648 2722 13599 9467 8289 17005 1 31436 21443 265 21543 32682 11647 30228 15498 1331 8459 20026 24054 23702 15400 7243 3017 10315 451 22673 6648 30210 27673 27232 4178 13529 23071 28654 8969 23505 27681 14437 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice got many presents these days. So she decided to pack them into boxes and send them to her friends.\n\nThere are n kinds of presents. Presents of one kind are identical (i.e. there is no way to distinguish two gifts ... | [{"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "751201557\n"}, {"type": "stdin_stdout", "input": "534571158 222043261\n", "output": "212941625\n"}, {"type": "stdin_stdout", "input": "922338645 900544285\n", "output": "187784871\n"}, {"type": "stdin_stdout", "input": "188186551 379116090\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLong is a huge fan of CFC (Codeforces Fried Chicken). But the price of CFC is increasing, so he decides to breed the chicken on his own farm.\n\nHis farm is presented by a rectangle grid with r rows and c columns. Some of... | [{"type": "stdin_stdout", "input": "4\n3 5 3\n..R..\n...R.\n....R\n6 4 6\nR..R\nRR..\nRRRR\nRRRR\nR..R\nR..R\n5 5 12\nRRR..\nR.R..\nRRR..\nRR...\nR...R\n2 31 62\nRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\nRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\n", "output": "aaabb\ncccbb\nccccc\naaaa\nbaaa\nbbcc\ndddc\neeee\nffff\nabcdd\needdd\nfghii\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n integers. You need to choose a subset and put the chosen numbers in a beautiful rectangle (rectangular matrix). Each chosen number should occupy one of its rectangle cells, each cell must be filled with ex... | [{"type": "stdin_stdout", "input": "15\n6 7 11 8 13 11 4 20 17 12 9 15 18 13 9\n", "output": "15\n3 5\n13 11 20 15 7 \n6 13 9 18 12 \n8 4 11 9 17 \n"}, {"type": "stdin_stdout", "input": "15\n17 5 20 11 14 9 5 12 10 11 5 6 1 12 18\n", "output": "15\n3 5\n5 12 11 17 9 \n6 5 12 20 14 \n10 1 5 11 18 \n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp is preparing the first programming contest for robots. There are n problems in it, and a lot of robots are going to participate in it. Each robot solving the problem i gets p_i points, and the score of each robot... | [{"type": "stdin_stdout", "input": "100\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA lot of people associate Logo programming language with turtle graphics. In this case the turtle moves along the straight line and accepts commands \"T\" (\"turn around\") and \"F\" (\"move 1 unit forward\").\n\nYou are ... | [{"type": "stdin_stdout", "input": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\n50\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\n40\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n piles of stones, where the i-th pile has a_i stones. Two people play a game, where they take alternating turns removing stones.\n\nIn a move, a player may remove a positive number of stones from the first non-... | [{"type": "stdin_stdout", "input": "7\n3\n2 5 10\n8\n1 2 1 1 1 1 1 1\n6\n2 2 5 4 5 6\n6\n1 1 2 1 2 1\n1\n1000000000\n5\n1 4 2 1 1\n3\n1 1 1\n", "output": "First \nSecond\nFirst \nFirst \nFirst \nSecond\nFirst \n"}, {"type": "stdin_stdout", "input": "7\n3\n2 5 10\n8\n1 2 1 1 1 1 1 1\n6\n2 2 5 4 5 6\n6\n1 1 2 1 2 1\n1\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLately, Mr. Chanek frequently plays the game Arena of Greed. As the name implies, the game's goal is to find the greediest of them all, who will then be crowned king of Compfestnesia.\n\nThe game is played by two people t... | [{"type": "stdin_stdout", "input": "2\n18\n122\n", "output": "14\n114\n"}, {"type": "stdin_stdout", "input": "2\n20\n122\n", "output": "15\n114\n"}, {"type": "stdin_stdout", "input": "2\n12\n122\n", "output": "9\n114\n"}, {"type": "stdin_stdout", "input": "2\n10\n122\n", "output": "8\n114\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA sequence of non-negative integers a_1, a_2, ..., a_n is called growing if for all i from 1 to n - 1 all ones (of binary representation) in a_i are in the places of ones (of binary representation) in a_{i + 1} (in other ... | [{"type": "stdin_stdout", "input": "5\n4\n4 3 7 20\n4\n1 2 4 5\n5\n1 0 3 4 5\n4\n11 16 15 1\n1\n0\n", "output": "0 4 0 3\n0 1 3 2\n0 1 0 3 2\n0 11 16 30\n0\n"}, {"type": "stdin_stdout", "input": "5\n4\n4 3 7 20\n4\n1 2 4 5\n5\n1 0 3 6 5\n4\n11 16 15 1\n1\n0\n", "output": "0 4 0 3\n0 1 3 2\n0 1 0 1 2\n0 11 16 30\n0\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positione... | [{"type": "stdin_stdout", "input": "10894 92356\n", "output": "46178\n46179\n46177\n46180\n46176\n46181\n46175\n46182\n46174\n46183\n46173\n46184\n46172\n46185\n46171\n46186\n46170\n46187\n46169\n46188\n46168\n46189\n46167\n46190\n46166\n46191\n46165\n46192\n46164\n46193\n46163\n46194\n46162\n46195\n46161\n46196\n46160... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus is an amateur businessman. Recently he was surprised to find out that the market for paper scissors is completely free! Without further ado, Polycarpus decided to start producing and selling such scissors.\n\nP... | [{"type": "stdin_stdout", "input": "1000000000000000000 999999999999999999\n", "output": "999999999999999999\n"}, {"type": "stdin_stdout", "input": "1000010000000000000 999999999999999999\n", "output": "999999999999999999\n"}, {"type": "stdin_stdout", "input": "999999999999999998 999999999999999997\n", "output": "89999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nValera has n counters numbered from 1 to n. Some of them are connected by wires, and each of the counters has a special button.\n\nInitially, all the counters contain number 0. When you press a button on a certain counter... | [{"type": "stdin_stdout", "input": "15 31\n8 11\n7 14\n12 8\n2 1\n6 4\n3 11\n3 1\n8 9\n3 8\n15 5\n5 11\n9 10\n8 6\n1 10\n1 14\n1 8\n11 12\n14 15\n7 9\n7 3\n13 14\n3 2\n3 4\n4 5\n14 5\n6 14\n15 7\n11 13\n15 1\n10 7\n5 11\n5 3 7 4 1 0 0 3 3 1 6 3 2 0 3\n", "output": "3\n6 7 10 \n"}, {"type": "stdin_stdout", "input": "15 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nManao is trying to open a rather challenging lock. The lock has n buttons on it and to open it, you should press the buttons in a certain order to open the lock. When you push some button, it either stays pressed into the... | [{"type": "stdin_stdout", "input": "2000\n", "output": "1333335000\n"}, {"type": "stdin_stdout", "input": "1837\n", "output": "1033182073\n"}, {"type": "stdin_stdout", "input": "1999\n", "output": "1331335999\n"}, {"type": "stdin_stdout", "input": "1241\n", "output": "318541121\n"}, {"type": "stdin_stdout", "input": "1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe famous joke programming language HQ9+ has only 4 commands. In this problem we will explore its subset — a language called HQ...\n\nInput\n\nThe only line of the input is a string between 1 and 106 characters long.\n\n... | [{"type": "stdin_stdout", "input": "HQQQQQQQHQQQQHQHQQQHHQHHHQQHQQQQHHQHHQHHHHHHQQQQQQQQHHQQQQQHHQQQQHHHQQQQQQQQHQQQHQHQQQQQQHHHQHHQHQHHQQQQQHQQHQHQQQHQHQHHHHQQHQHQQQQQHQQQHQQQHQQHQHQQHQQQQQQ\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "HQQQQQQQHQQQQHQHQQQHHQHHHQQHQQQQHHQHHQHHHHHHQQQQQQQQHHQQQQQHHQQHQHHHQQ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nXenia lives in a city that has n houses built along the main ringroad. The ringroad houses are numbered 1 through n in the clockwise order. The ringroad traffic is one way and also is clockwise.\n\nXenia has recently move... | [{"type": "stdin_stdout", "input": "100 100\n48 73 63 16 49 88 36 17 66 6 87 13 94 52 58 70 71 52 7 70 25 42 24 36 57 9 79 26 75 39 13 14 38 26 33 66 88 28 75 98 53 48 67 54 63 25 69 87 88 32 72 17 36 35 29 67 74 89 70 47 20 90 78 13 94 57 32 73 29 74 45 78 85 64 81 56 12 65 19 67 34 86 55 71 41 33 76 13 100 47 44 76 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe bear has a string s = s1s2... s|s| (record |s| is the string's length), consisting of lowercase English letters. The bear wants to count the number of such pairs of indices i, j (1 ≤ i ≤ j ≤ |s|), that string x(i, j) ... | [{"type": "stdin_stdout", "input": "pbearjbearbebearnbabcffbearbearwubearjezpiorrbearbearjbdlbearbearqbearjbearwipmsbearoaftrsebearzsnqb\n", "output": "4419\n"}, {"type": "stdin_stdout", "input": "pbearjbearbebfarnbabcffbearbearwubearjezpiorrbearbearjbdlbearbearqbearjbearwipmsbearoaftrsebearzsnqb\n", "output": "4353\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.\n\nThe dot product of two integer number vectors x and y of size n is the sum of the produc... | [{"type": "stdin_stdout", "input": "5\n1 0 1 0 1\n0 1 0 1 0\n1 0 1 0 1\n0 1 0 1 0\n1 0 1 0 1\n7\n3\n2 4\n1 3\n3\n2 5\n1 2\n3\n", "output": "111\n"}, {"type": "stdin_stdout", "input": "5\n1 0 1 1 1\n0 1 0 1 0\n1 0 1 1 1\n0 1 0 1 0\n1 0 1 0 0\n7\n3\n2 4\n1 3\n3\n2 5\n1 1\n3\n", "output": "000\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is vi. Kuriyama Mirai wants to know something about these stones so she will ask you t... | [{"type": "stdin_stdout", "input": "56\n43 100 44 66 65 11 26 75 96 77 5 15 75 96 11 44 11 97 75 53 33 26 32 33 90 26 68 72 5 44 53 26 33 88 68 25 84 21 25 92 1 84 21 66 94 35 76 51 11 95 67 4 61 3 34 18\n27\n1 20 38\n1 11 46\n2 42 53\n1 8 11\n2 11 42\n2 35 39\n2 37 41\n1 48 51\n1 32 51\n1 36 40\n1 31 56\n1 18 38\n2 9 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nn participants of the competition were split into m teams in some manner so that each team has at least one participant. After the competition each pair of participants from the same team became friends.\n\nYour task is t... | [{"type": "stdin_stdout", "input": "1011000000 0001000\n", "output": "511059994500000 511059489505999500\n"}, {"type": "stdin_stdout", "input": "1011100000 0001000\n", "output": "511161099450000 511160594406049500\n"}, {"type": "stdin_stdout", "input": "1011110000 0001000\n", "output": "511171210495000 5111707054460545... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNew Year is coming in Tree World! In this world, as the name implies, there are n cities connected by n - 1 roads, and for any two distinct cities there always exists a path between them. The cities are numbered by intege... | [{"type": "stdin_stdout", "input": "10\n1 2 938\n1 6 23\n1 10 727\n1 9 814\n9 5 644\n8 5 39\n2 7 999\n1 3 666\n5 4 577\n10\n9 1099\n5 64\n4 318\n3 373\n4 548\n7 219\n5 43\n5 27\n3 155\n8 359\n", "output": "5336.333333333333\n4524.333333333333\n3730.733333333333\n3518.3333333333335\n3886.3333333333335\n3418.333333333333... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOm Nom is the main character of a game \"Cut the Rope\". He is a bright little monster who likes visiting friends living at the other side of the park. However the dark old parks can scare even somebody as fearless as Om ... | [{"type": "stdin_stdout", "input": "6\n87 62 58 32 81 92 12 50 23 27 38 39 64 74 16 35 84 59 91 87 14 48 90 47 44 95 64 45 31 11 67 5 80 60 36 15 91 3 21 2 40 24 37 69 5 50 23 37 49 19 68 21 49 9 100 94 45 41 22 31 31 48 25 70 25 25 95 88 82 1 37 53 49 31 57 74 94 45 55 93 43 37 13 85 59 72 15 68 3 90 96 55 100 64 63 6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProfessor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way. \n\nIn total there are n piles of boxes, arranged in a line, from left to right, i-th pile (1 ≤ i ≤ n) cont... | [{"type": "stdin_stdout", "input": "5 3\n999999999 999999999 999999999 999999999 19992232\n", "output": " 1339997413"}, {"type": "stdin_stdout", "input": "19 100000\n1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1\n", "output": " ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlmost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor «Textpad» decided to introduce this functionality into the fourth release of the product.\n\n... | [{"type": "stdin_stdout", "input": "8\n\n\n\ny\nW\n\n\n\n3B\n\nw\nV\n\n\n\nL\nSr\n\n\nV\n\n5\n\nAq\n\n\n\nJ\nR\n\n04\nJ\nv\nUh\n\n\n\nY\nG\n4\n\nG\nb\n\n\n9\n\n6\nd\n\n2\n\n\nE\n7\n\nr\n\n\n\n\nKC\ns\nE\n\nab\n4\nx\n\n\n\n\n\nEe\n4\n\nl\n\np\n\nG\nM\n\n\nn\n\n\nm0\n\nw\n\n\nP\n\n\n\n0\n\n\n", "output": "****\n*8 *\n* ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are b blocks of digits. Each one consisting of the same n digits, which are given to you in the input. Wet Shark must choose exactly one digit from each block and concatenate all of those digits together to form one... | [{"type": "stdin_stdout", "input": "100 1000000000 42 97\n2 5 1 8 8 1 5 2 1 2 5 1 8 8 1 5 2 1 2 5 1 8 8 1 5 2 1 2 5 1 8 8 1 5 2 1 2 5 1 8 8 1 5 2 1 2 5 1 8 8 1 5 2 1 2 5 1 8 8 1 5 2 1 2 5 1 8 1 1 5 2 1 2 5 1 8 8 1 5 2 1 2 5 1 8 8 1 5 2 1 2 5 1 8 8 1 5 2 1 2\n", "output": "253082707\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn her way to programming school tiger Dasha faced her first test — a huge staircase!\n\n<image>\n\nThe steps were numbered from one to infinity. As we know, tigers are very fond of all striped things, it is possible that... | [{"type": "stdin_stdout", "input": "100 100\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 101\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "110 111\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "111 111\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 99\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDO YOU EXPECT ME TO FIND THIS OUT?\n\nWHAT BASE AND/XOR LANGUAGE INCLUDES string?\n\nDON'T BYTE OF MORE THAN YOU CAN CHEW\n\nYOU CAN ONLY DISTORT THE LARGEST OF MATHEMATICS SO FAR\n\nSAYING \"ABRACADABRA\" WITHOUT A MAGIC... | [{"type": "stdin_stdout", "input": "10\n5 5 10 10 10 2 4 3 4 10\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n5 5 10 10 10 1 4 3 4 10\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n3 5 10 10 10 1 4 3 4 10\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n3 5 10 10 10 1 4 3 5 10\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.\n\nHe is too selfish, so for a given n he wants to obtain a string of n characters, each of... | [{"type": "stdin_stdout", "input": "89946\n", "output": "aabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaab... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasily has a deck of cards consisting of n cards. There is an integer on each of the cards, this integer is between 1 and 100 000, inclusive. It is possible that some cards have the same integers on them.\n\nVasily decide... | [{"type": "stdin_stdout", "input": "100\n12 9 97 55 14 8 55 34 35 67 3 18 73 92 41 49 15 60 18 66 9 26 97 47 43 88 71 97 19 63 48 96 79 53 8 47 69 49 21 23 77 12 21 176 66 9 29 13 61 69 54 77 10 13 4 68 37 74 7 6 29 76 55 72 89 4 78 27 29 82 18 83 12 4 32 69 89 85 66 13 92 54 38 5 26 56 17 55 29 4 17 39 29 94 3 67 85 7... | 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\nOnce upon a time in the galaxy of far, far away...\n\nDarth Wader found out the location of a rebels' base. Now he is going to destroy the base (and the whole planet that the base is located at), using the Death Star.\n\n... | [{"type": "stdin_stdout", "input": "-47 -7 -43 5 -8 -10 13\n13\n-7 -40 -34 5 3\n6 -2 3\n-1 -1 -4\n-6 -1 2\n-36 45 33 10 2\n-4 -6 1\n0 -14 -5\n14 -15 6 1 3\n-1 -1 0\n1 -1 -1\n0 -1 1\n9 -32 10 6 2\n-1 6 -1\n-4 -2 -5\n45 -31 2 11 2\n0 14 8\n-12 -11 0\n-5 35 -3 7 2\n-9 1 1\n-3 -9 1\n-17 -13 -6 2 1\n2 0 1\n-45 -41 16 10 1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInstructors of Some Informatics School make students go to bed.\n\nThe house contains n rooms, in each room exactly b students were supposed to sleep. However, at the time of curfew it happened that many students are not ... | [{"type": "stdin_stdout", "input": "100 3 30\n20 10 8 3 97 20 40 4 58 24 105 56 26 21 66 1 126 4 21 46 8 2 9 21 0 13 24 53 58 23 3 107 1 22 189 3 31 4 31 0 3 0 9 43 19 74 92 7 71 22 46 26 31 49 18 3 10 9 9 110 30 2 40 21 33 4 11 14 47 4 1 37 3 19 18 63 10 53 19 35 11 57 8 3 11 27 23 5 45 15 127 27 23 48 3 8 20 33 5 28\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven an array A(A0, A1…. An-1) of n integers. Your task is to find the smallest number larger than a given no. X in the range [l,r] inclusive. Indexing is 0 based. If there is no greater no. than X in the specified range... | [{"type": "stdin_stdout", "input": "1000 2 997 1000\n30018 884 323 24597 1680 10042 12834 3877 29077 17866 24269 31308 15852 5031 18387 1451 3518 32420 26307 15204 7734 31889 4673 12125 11316 11545 10328 20545 4422 21227 13074 18888 11476 26648 15174 23609 28058 20924 15794 19757 3931 30433 30281 21909 24788 16032 3015... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Monk wants to teach all its disciples a lesson about patience, since they are always in a hurry to do something crazy. To teach them this, he gives them a list of N numbers, which may or may not be distinct. The stude... | [{"type": "stdin_stdout", "input": "30\n317 36 191 1392 377 107 41 1092 229 503 447 1442 481 719 551 351 11 10 394 207 630 78 113 955 673 728 4773 567 1432 309", "output": "387621135\n"}, {"type": "stdin_stdout", "input": "30\n317 36 191 1392 100 107 41 1092 88 503 447 1442 1694 719 551 351 11 10 766 207 630 78 113 955... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke is standing on a two-dimensional plane. In one operation, he can move by 1 in the positive x-direction, or move by 1 in the positive y-direction.\n\nLet us define a function f(r, c) as follows:\n\n* f(r,c) := (The ... | [{"type": "stdin_stdout", "input": "139 159 2856 1003", "output": "588676804\n"}, {"type": "stdin_stdout", "input": "139 307 16230 589", "output": "518297224\n"}, {"type": "stdin_stdout", "input": "314 159 2856 589", "output": "373278476\n"}, {"type": "stdin_stdout", "input": "139 159 2856 589", "output": "507735392\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is an integer sequence A of length N whose values are unknown.\n\nGiven is an integer sequence B of length N-1 which is known to satisfy the following:\n\nB_i \\geq \\max(A_i, A_{i+1})\n\nFind the maximum possible s... | [{"type": "stdin_stdout", "input": "6\n0 153 10 14 23", "output": "57\n"}, {"type": "stdin_stdout", "input": "6\n0 153 10 14 17", "output": "51\n"}, {"type": "stdin_stdout", "input": "6\n0 153 10 14 26", "output": "60\n"}, {"type": "stdin_stdout", "input": "6\n0 153 10 10 23", "output": "53"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N bags of biscuits. The i-th bag contains A_i biscuits.\n\nTakaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags.\n\nHe would like ... | [{"type": "stdin_stdout", "input": "45 1\n17 55 85 55 74 20 90 67 40 121 39 178 91 50 16 38 14 43 24 68 25 9 89 71 41 16 53 11 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 24 26", "output": "17592186044416\n"}, {"type": "stdin_stdout", "input": "45 1\n17 55 85 55 74 20 90 67 40 121 39 178 91 50 16 38 14 43 24 68 25 9 89 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke has decided to play with N cards and a deque (that is, a double-ended queue). Each card shows an integer from 1 through N, and the deque is initially empty.\n\nSnuke will insert the cards at the beginning or the end... | [{"type": "stdin_stdout", "input": "2000 1000", "output": "674286644"}, {"type": "stdin_stdout", "input": "2000 1100", "output": "270390985"}, {"type": "stdin_stdout", "input": "2000 1001", "output": "353739079"}, {"type": "stdin_stdout", "input": "2000 0100", "output": "973529324"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day, Snuke was given a permutation of length N, a_1, a_2, ..., a_N, from his friend.\n\nFind the following:\n\n<image>\n\nConstraints\n\n* 1 ≦ N ≦ 200,000\n* (a_1, a_2, ..., a_N) is a permutation of (1, 2, ..., N).\n\... | [{"type": "stdin_stdout", "input": "8\n5 3 8 1 2 6 7 4", "output": "84\n"}, {"type": "stdin_stdout", "input": "8\n4 5 8 1 2 6 7 3", "output": "86\n"}, {"type": "stdin_stdout", "input": "8\n5 4 8 1 2 6 7 3", "output": "85"}, {"type": "stdin_stdout", "input": "4\n2 3 1 4", "output": "17\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nObesity is cited as the cause of many adult diseases. In the past, with a few exceptions, it was unrelated to high school students. However, it is no longer unrealistic to suffer from lack of exercise due to excessive stu... | [{"type": "stdin_stdout", "input": "1011,50.0,1.60\n1002,60.1,0.70\n1003,60.0,0.80\n1004,80.0,1.71\n1005,90.0,1.60", "output": "1002\n1003\n1004\n1005\n"}, {"type": "stdin_stdout", "input": "1011,50.0,1.60\n1102,60.1,0.70\n1003,60.0,0.80\n1004,80.0,1.71\n1005,80.0,1.60", "output": "1102\n1003\n1004\n1005\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRelative B came to Mr. A's house. He is 3 years old and loves blocks. The block he has is shaped like Figure 1.\n\n<image>\n\nFigure 1\n\nMr. B is laying blocks on the board. When I asked him, \"What are you making?\", He... | [{"type": "stdin_stdout", "input": "20 21\n1 0\n14 8\n7\n4 0 1 1\n6 -1 1 3\n2 0 3 3\n1 0 5 0\n5 1 7 3\n2 -1 2 7\n2 -1 6 8\n20 20\n9 9\n1 1\n6\n2 0 1 1\n1 0 5 0\n2 1 1 4\n5 0 1 0\n4 1 6 10\n4 0 8 5\n0 0", "output": "NG\nNG\n"}, {"type": "stdin_stdout", "input": "20 21\n1 0\n14 8\n7\n4 0 1 1\n6 -1 1 3\n2 0 3 3\n1 0 5 0\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this problem, we consider a simple programming language that has only declarations of one- dimensional integer arrays and assignment statements. The problem is to find a bug in the given program.\n\nThe syntax of this ... | [{"type": "stdin_stdout", "input": "a[3]\na[0]=a[1]\n.\nx[1]\nx[0]=x[0]\n.\na[0]\na[0]=1\n.\nb[2]\nb[0]=2\nb[1]=b[b[0]]\nb[0]=b[1]\n.\ng[2]\nG[10]\ng[0]=0\ng[1]=G[0]\n.\na[2147483647]\na[0]=1\nB[2]\nB[a[0]]=2\na[B[a[0]]]=3\na[2147483646]=b[2]\n.\n.", "output": "2\n2\n2\n3\n4\n6\n"}, {"type": "stdin_stdout", "input": "a... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA rabbit Taro decided to hold a party and invite some friends as guests. He has n rabbit friends, and m pairs of rabbits are also friends with each other. Friendliness of each pair is expressed with a positive integer. If... | [{"type": "stdin_stdout", "input": "0 5\n-2 2 0\n1 3 6\n2 -1 8\n5 1 10\n1 2 2", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 5\n-2 2 0\n1 3 6\n2 -1 8\n5 1 10\n1 3 2", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 5\n-2 2 0\n1 3 6\n2 -1 8\n5 1 10\n1 3 4", "output": "0\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a given polygon g and target points t, print \"2\" if g contains t, \"1\" if t is on a segment of g, \"0\" otherwise.\n\ng is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi... | [{"type": "stdin_stdout", "input": "4\n3 0\n15 -1\n0 1\n-1 0\n3\n-1 -2\n1 0\n-1 -1", "output": "0\n1\n0\n"}, {"type": "stdin_stdout", "input": "4\n3 0\n8 -1\n0 1\n-1 2\n3\n-1 -2\n0 -1\n0 -1", "output": "0\n0\n0\n"}, {"type": "stdin_stdout", "input": "4\n-1 -1\n4 -2\n3 -1\n1 4\n2\n0 1\n1 0\n-2 1", "output": "2\n2\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a sequence of integers $A = \\\\{a_0, a_1, ..., a_{n-1}\\\\}$ which is sorted by ascending order, eliminate all equivalent elements.\n\nConstraints\n\n* $1 \\leq n \\leq 100,000$\n* $-1000,000,000 \\leq a_i \\leq 1,00... | [{"type": "stdin_stdout", "input": "4\n-2 -1 1 2", "output": "-2 -1 1 2\n"}, {"type": "stdin_stdout", "input": "4\n-2 -1 0 2", "output": "-2 -1 0 2\n"}, {"type": "stdin_stdout", "input": "4\n-2 -1 0 4", "output": "-2 -1 0 4\n"}, {"type": "stdin_stdout", "input": "4\n-1 0 1 10", "output": "-1 0 1 10\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe executive chef is trying to bring some competitive spirit into his kitchen. He wants to split the chefs into two teams based on their age - he'll form the young and the old team. To make it fair, he will split them ev... | [{"type": "stdin_stdout", "input": "5\n6 2\n4 -1\n0 28\n3 1\n0 76", "output": "2\n3\n25\n28\n104\n"}, {"type": "stdin_stdout", "input": "5\n0 2\n0 -1\n12 11\n4 1\n5 25", "output": "2\n3\n10\n11\n34\n"}, {"type": "stdin_stdout", "input": "5\n0 2\n2 1\n12 20\n4 0\n13 11", "output": "2\n1\n17\n17\n28\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA plane is flying at a constant height of h meters above the ground surface. Let's consider that it is flying from the point (-10^9, h) to the point (10^9, h) parallel with Ox axis.\n\nA glider is inside the plane, ready ... | [{"type": "stdin_stdout", "input": "2 1000000000\n304257720 349183572\n464960891 551998862\n", "output": "1131963823\n"}, {"type": "stdin_stdout", "input": "2 1000000000\n231403049 328821611\n335350528 883433844\n", "output": "1645501878\n"}, {"type": "stdin_stdout", "input": "2 1000000000\n205773571 705350420\n8847841... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA non-empty string is called palindrome, if it reads the same from the left to the right and from the right to the left. For example, \"abcba\", \"a\", and \"abba\" are palindromes, while \"abab\" and \"xy\" are not.\n\nA... | [{"type": "stdin_stdout", "input": "21\narozaupalanalapuazora\n", "output": "aaaaaaaallnoopprruuzz\n"}, {"type": "stdin_stdout", "input": "16\ngagadbcgghhchbdf\n", "output": "aabbccddfgggghhh\n"}, {"type": "stdin_stdout", "input": "15\nabacabadabacaba\n", "output": "aaaaaaaabbbbccd\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Squareland national forest is divided into equal 1 × 1 square plots aligned with north-south and east-west directions. Each plot can be uniquely described by integer Cartesian coordinates (x, y) of its south-west corn... | [{"type": "stdin_stdout", "input": "0 1000\n1000 0\n1000 1000\n", "output": "2001\n0 1000\n1 1000\n2 1000\n3 1000\n4 1000\n5 1000\n6 1000\n7 1000\n8 1000\n9 1000\n10 1000\n11 1000\n12 1000\n13 1000\n14 1000\n15 1000\n16 1000\n17 1000\n18 1000\n19 1000\n20 1000\n21 1000\n22 1000\n23 1000\n24 1000\n25 1000\n26 1000\n27 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLunar New Year is approaching, and you bought a matrix with lots of \"crosses\".\n\nThis matrix M of size n × n contains only 'X' and '.' (without quotes). The element in the i-th row and the j-th column (i, j) is defined... | [{"type": "stdin_stdout", "input": "14\nXXX.XXXXX..X.X\nX..XX..X...X..\n.....X.XX..XXX\n.X..X..XXX.XX.\n...XXXX.XX..XX\n.X..XX...XXX..\nXX.XX.XX..XXX.\n.X..X.....X.XX\n...XXX...XX.XX\nXXX.XX.XX.X.XX\nX.XXXX..XX.XX.\n.X.XX....X....\nX..XX..X.XX.X.\n..X...XX....XX\n", "output": "2"}, {"type": "stdin_stdout", "input": "6\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInternational Women's Day is coming soon! Polycarp is preparing for the holiday.\n\nThere are n candy boxes in the shop for sale. The i-th box contains d_i candies.\n\nPolycarp wants to prepare the maximum number of gifts... | [{"type": "stdin_stdout", "input": "8 2\n1 2 2 3 2 4 6 10\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "8 2\n2 2 2 2 2 4 6 10\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "8 2\n1 2 2 2 2 4 6 10\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "8 2\n2 2 2 2 2 4 7 10\n", "output": "6\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem.\n\nNow Serval is a senior high school student in Japari Middle School. However, on the way to the school, he must go across a pond, in which there is a dangerous snake. The pond can be repr... | [{"type": "stdin_stdout", "input": "1000\n2\n2 998\n2 530\n", "output": "? 1 1 1 1000\n? 1 1 2 1000\n? 1 1 3 1000\n? 1 1 4 1000\n? 1 1 5 1000\n? 1 1 6 1000\n? 1 1 7 1000\n? 1 1 8 1000\n? 1 1 9 1000\n? 1 1 10 1000\n? 1 1 11 1000\n? 1 1 12 1000\n? 1 1 13 1000\n? 1 1 14 1000\n? 1 1 15 1000\n? 1 1 16 1000\n? 1 1 17 1000\n?... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a_1, a_2, ..., a_n and an integer k.\n\nYou are asked to divide this array into k non-empty consecutive subarrays. Every element in the array should be included in exactly one subarray. Let f(i) be ... | [{"type": "stdin_stdout", "input": "7 6\n-6 1 -1 -1 -2 -4 -1\n", "output": "-43\n"}, {"type": "stdin_stdout", "input": "7 7\n-3 0 -1 -2 -2 -4 -1\n", "output": "-55\n"}, {"type": "stdin_stdout", "input": "7 6\n-5 1 -1 -1 -2 -4 -1\n", "output": "-42\n"}, {"type": "stdin_stdout", "input": "7 6\n-3 0 -1 -2 -2 -4 -1\n", "ou... | 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, erase it fro... | [{"type": "stdin_stdout", "input": "1\naaaaaabbbbbbbbcccccccccccdddd\naaaaabbbbbbccccccccddddddddd\naaaaabbbbbbbbbcccccccccddddd\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "1\naaaaaabbbbbbbbcccccccccccdddd\naaaaabbbbbbccccccccddddddddd\ndddddcccccccccbbbbbbbbbaaaaa\n", "output": "NO\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a robot on a coordinate plane. Initially, the robot is located at the point (0, 0). Its path is described as a string s of length n consisting of characters 'L', 'R', 'U', 'D'.\n\nEach of these characters corresp... | [{"type": "stdin_stdout", "input": "4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLRDDL\n", "output": "1 2 \n1 4 \n3 4 \n1 2 \n"}, {"type": "stdin_stdout", "input": "4\n4\nLRUD\n4\nLURD\n5\nRURDU\n5\nLRDDL\n", "output": "1 2 \n1 4 \n4 5 \n1 2 \n"}, {"type": "stdin_stdout", "input": "4\n4\nDURL\n4\nLURD\n5\nUDURR\n5\nLRDDL\n", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n boys and m girls attending a theatre club. To set a play \"The Big Bang Theory\", they need to choose a group containing exactly t actors containing no less than 4 boys and no less than one girl. How many ways... | [{"type": "stdin_stdout", "input": "30 30 30\n", "output": "118264581548187697"}, {"type": "stdin_stdout", "input": "30 29 19\n", "output": "1396982287132530\n"}, {"type": "stdin_stdout", "input": "30 30 19\n", "output": "2044156982307300\n"}, {"type": "stdin_stdout", "input": "30 29 42\n", "output": "277508869722315\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp wants to buy exactly n shovels. The shop sells packages with shovels. The store has k types of packages: the package of the i-th type consists of exactly i shovels (1 ≤ i ≤ k). The store has an infinite number of... | [{"type": "stdin_stdout", "input": "10\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n", "output": "104395301\n104395301\n104395301\n104395301\n104395301\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a set of n discs, the i-th disc has radius i. Initially, these discs are split among m towers: each tower contains at least one disc, and the discs in each tower are sorted in descending order of their radii from... | [{"type": "stdin_stdout", "input": "10 10\n2 10 8 7 9 3 4 6 5 1\n10 4\n10 1\n10 6\n10 8\n10 2\n10 9\n10 7\n10 3\n10 5\n", "output": "9\n9\n9\n8\n7\n6\n6\n4\n2\n0\n"}, {"type": "stdin_stdout", "input": "10 10\n2 10 8 7 9 3 4 6 5 1\n9 4\n10 1\n10 6\n10 8\n10 2\n10 9\n10 7\n10 3\n10 5\n", "output": "9\n9\n9\n9\n8\n7\n6\n4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a multiset containing several integers. Initially, it contains a_1 elements equal to 1, a_2 elements equal to 2, ..., a_n elements equal to n.\n\nYou may apply two types of operations:\n\n * choose two integers ... | [{"type": "stdin_stdout", "input": "20\n1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "20\n1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 3\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "20\n1 2 1 2 1 2 0 2 1 2 1 2 1 2 1 2 1 2 1 3\n", "output": "12\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two arrays a and b, each consisting of n positive integers, and an integer x. Please determine if one can rearrange the elements of b so that a_i + b_i ≤ x holds for each i (1 ≤ i ≤ n).\n\nInput\n\nThe first... | [{"type": "stdin_stdout", "input": "4\n3 4\n0 2 -1\n1 2 2\n\n2 6\n1 4\n2 5\n\n4 4\n2 2 3 -1\n3 5 2 4\n\n1 0\n5\n5\n", "output": "Yes\nYes\nNo\nNo\n"}, {"type": "stdin_stdout", "input": "4\n3 4\n0 2 -1\n1 2 2\n\n2 6\n1 4\n2 5\n\n4 4\n2 2 3 -1\n1 5 2 4\n\n1 0\n5\n5\n", "output": "Yes\nYes\nNo\nNo\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\... | [{"type": "stdin_stdout", "input": "50\n44747747774474747747747447777447774747447477444474\n", "output": "YES"}, {"type": "stdin_stdout", "input": "50\n44444444444444444444444444444444444444444444444444\n", "output": "YES"}, {"type": "stdin_stdout", "input": "50\n77777777777777777777777777777777777777777777777777\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are many sunflowers in the Garden of the Sun.\n\nGarden of the Sun is a rectangular table with n rows and m columns, where the cells of the table are farmlands. All of the cells grow a sunflower on it. Unfortunately... | [{"type": "stdin_stdout", "input": "5\n3 3\nX.X\n...\nX.X\n4 4\n....\n.X.X\n....\n.X.X\n5 5\n.X...\n....X\n.X...\n.....\nX.X.X\n1 10\n....X.X.X.\n2 2\n..\n..\n", "output": "\nXXX\n..X\nXXX\nXXXX\n.X.X\n.X..\n.XXX\n.X...\n.XXXX\n.X...\n.X...\nXXXXX\nXXXXXXXXXX\n..\n..\n"}, {"type": "stdin_stdout", "input": "5\n3 3\nX.X\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!).\n\nLet us remind you the rules of this game. Rock-paper-scissors is played by two players. In each round the players choose o... | [{"type": "stdin_stdout", "input": "1457057352\nR\nPSRSRSSRPSRRSSSRSRRPRSPPSPPRPSRRPPRSRRSPPSPPSPRPRPRPSSRPRPRRPSSSSSPSRRRPSRSPPSPSRRSPSSRSRPSPRRRSRRRPSPRPPRPPPPPRPPRRRRRRPPRRSPSPSSPSSPRPRSPPRRRPSPSRSRRRRRPPPSRPRSPPSSRRRRPRPPRSPSSPRRRPPPPPRRSRSPRPPSRPRSRSRRPRRRPRSRSPRRRSRSSRPPPRRSRRSSRRPSRPPRSPSPRPRSSSRSSRRPSRRRRPSRRPP... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n cities in the country where the Old Peykan lives. These cities are located on a straight line, we'll denote them from left to right as c1, c2, ..., cn. The Old Peykan wants to travel from city c1 to cn using r... | [{"type": "stdin_stdout", "input": "100 6\n15 20 32 8 29 10 33 15 9 26 28 21 34 7 41 23 9 17 16 15 14 29 25 31 24 26 13 18 19 40 9 16 36 32 39 11 4 31 37 28 32 40 7 18 45 21 15 45 6 15 27 22 27 41 28 7 22 43 25 40 6 7 32 31 36 14 5 27 31 28 23 9 13 14 7 25 28 33 40 22 44 9 29 26 41 30 16 15 31 42 13 40 36 44 17 29 32 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle penguin Polo likes permutations. But most of all he likes permutations of integers from 0 to n, inclusive.\n\nFor permutation p = p0, p1, ..., pn, Polo has defined its beauty — number <image>.\n\nExpression <image>... | [{"type": "stdin_stdout", "input": "16281\n", "output": "265087242\n1 0 5 4 3 2 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41... | 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\nValera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have ... | [{"type": "stdin_stdout", "input": "15\nrxeeeeeeeeeeeer\nereeeeeeeeeeere\needeeeeeeeeeoee\neeereeeeeeeewee\neeeereeeeebeeee\nqeeeereeejedyee\neeeeeerereeeeee\neeeeeeereeeeeee\neeeeeerereeeeze\neeeeereeereeeee\neeeereeeeegeeee\neeereeeeeeereee\neereeeeeeqeeved\ncreeeeeeceeeere\nreeerneeeeeeeer\n", "output": "NO\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMany students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. \n\nThere is only one shower and there are multiple students who wish to have a sho... | [{"type": "stdin_stdout", "input": "0 14299 32984 96001 30445\n77723 0 75669 14101 55389\n30897 17295 0 52675 29987\n36518 108118 11343 0 64020\n91242 50085 86272 62454 0\n", "output": "747422\n"}, {"type": "stdin_stdout", "input": "0 14299 32984 96001 30445\n77723 0 75669 14101 55389\n30897 17295 0 52675 29987\n36518 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDreamoon is standing at the position 0 on a number line. Drazil is sending a list of commands through Wi-Fi to Dreamoon's smartphone and Dreamoon follows them.\n\nEach command is one of the following two types: \n\n 1. G... | [{"type": "stdin_stdout", "input": "+--+------\n??????????\n", "output": "0.0439453125\n"}, {"type": "stdin_stdout", "input": "+-----+---\n??????????\n", "output": "0.0439453125\n"}, {"type": "stdin_stdout", "input": "---+-----+\n??????????\n", "output": "0.0439453125\n"}, {"type": "stdin_stdout", "input": "----------\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya bought the collected works of a well-known Berland poet Petya in n volumes. The volumes are numbered from 1 to n. He thinks that it does not do to arrange the book simply according to their order. Vasya wants to min... | [{"type": "stdin_stdout", "input": "17079\n", "output": "2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 9... | 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\nIn the probability theory the following paradox called Benford's law is known: \"In many lists of random numbers taken from real sources, numbers starting with digit 1 occur much more often than numbers starting with any ... | [{"type": "stdin_stdout", "input": "20\n3 21\n15 28\n21 26\n4 6\n13 28\n20 23\n22 27\n4 13\n1 7\n5 35\n3 3\n16 30\n9 32\n9 16\n3 7\n21 22\n24 29\n6 25\n15 25\n28 33\n51\n", "output": "3.349496664437241e-05\n"}, {"type": "stdin_stdout", "input": "20\n10 21\n18 29\n4 8\n1 27\n24 29\n5 5\n22 22\n4 5\n1 4\n7 12\n11 23\n11 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhile Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Patrick's personal stuff and found a sequence a1, a2, ..., am of length m, consisting of integers... | [{"type": "stdin_stdout", "input": "2 100\n2 1\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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\n", "output": "Possible\n2 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\nProfessor GukiZ makes a new robot. The robot are in the point with coordinates (x1, y1) and should go to the point (x2, y2). In a single step the robot can change any of its coordinates (maybe both of them) by one (decrea... | [{"type": "stdin_stdout", "input": "-1000000000 -1000000000\n1000000000 -1000000000\n", "output": "2000000000\n"}, {"type": "stdin_stdout", "input": "-1000000000 -1000000000\n1000000000 1000000000\n", "output": "2000000000\n"}, {"type": "stdin_stdout", "input": "-1000000000 1000000000\n1000000000 -1000000000\n", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKarlsson has visited Lillebror again. They found a box of chocolates and a big whipped cream cake at Lillebror's place. Karlsson immediately suggested to divide the sweets fairly between Lillebror and himself. Specificall... | [{"type": "stdin_stdout", "input": ". . .\n . . O .\n. . O O .\n . . . .\n . . .\n", "output": "Lillebror\n"}, {"type": "stdin_stdout", "input": "O O .\n O O . .\n. . . . .\n . . . .\n . O .\n", "output": "Lillebror\n"}, {"type": "stdin_stdout", "input": ". . O\n . O O .\nO . O . O\n O O O O\n . . O\n", "output": "L... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store recently and Artem immediat... | [{"type": "stdin_stdout", "input": "13 21 1\n2 11\n", "output": "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSo many wall designs to choose from! Even modulo 106 + 3, it's an enormous number. Given that recently Heidi acquired an unlimited supply of bricks, her choices are endless! She really needs to do something to narrow them... | [{"type": "stdin_stdout", "input": "100000000 100 100\n", "output": "807624\n"}, {"type": "stdin_stdout", "input": "100000100 100 100\n", "output": "515397\n"}, {"type": "stdin_stdout", "input": "100000000 100 1\n", "output": "245069\n"}, {"type": "stdin_stdout", "input": "100000000 1 100\n", "output": "389182\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSonya was unable to think of a story for this problem, so here comes the formal description.\n\nYou are given the array containing n positive integers. At one turn you can pick any element and increase or decrease it by 1... | [{"type": "stdin_stdout", "input": "75\n392 593 98 1017 515 448 220 310 475 79 539 294 208 828 75 534 875 493 94 205 656 105 546 493 60 188 222 108 788 504 809 621 934 455 307 236 630 298 938 62 850 421 839 134 950 256 934 817 209 559 866 67 990 835 534 672 733 768 757 516 959 893 275 315 692 927 321 554 801 805 885 12... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLocal authorities have heard a lot about combinatorial abilities of Ostap Bender so they decided to ask his help in the question of urbanization. There are n people who plan to move to the cities. The wealth of the i of t... | [{"type": "stdin_stdout", "input": "69 6 15\n3845 22036 69001 38625 10662 85485 88195 12883 2257 101913 40235 87797 15559 15841 74716 92979 167517 49466 68603 123491 99905 35606 65184 98603 68232 54398 105580 63002 38979 41488 9636 24737 15892 173020 69670 29711 1460 473 32171 717 21097 108932 86760 55720 116079 61122 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFacetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority factor (it will be described).\... | [{"type": "stdin_stdout", "input": "kmircqsffq\n14\nfrnf likes xgmmp's post\nfnfdpupayp commented on syz's post\nxefshpn commented on xgmmp's post\nm posted on gdwydzktok's wall\neskm likes pqmbnuc's post\npnqiapduhz likes zzqvjdz's post\nx likes nouuurc's post\nvnyxhoukuo posted on uhblapjab's wall\nblpjpxn likes zvwb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndryusha is an orderly boy and likes to keep things in their place.\n\nToday he faced a problem to put his socks in the wardrobe. He has n distinct pairs of socks which are initially in a bag. The pairs are numbered from... | [{"type": "stdin_stdout", "input": "50\n50 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 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 10 4 3 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEach evening Roma plays online poker on his favourite website. The rules of poker on this website are a bit strange: there are always two players in a hand, there are no bets, and the winner takes 1 virtual bourle from th... | [{"type": "stdin_stdout", "input": "20 7\n?LLLLLWWWWW?????????\n", "output": "WLLLLLWWWWWWWWWWDDDW\n"}, {"type": "stdin_stdout", "input": "20 6\n?LLLLLWWWWW?????????\n", "output": "WLLLLLWWWWWWWWWDDDDW\n"}, {"type": "stdin_stdout", "input": "20 5\n?LLLLLWWWWW?????????\n", "output": "WLLLLLWWWWWWWWDDDDDW"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan had string s consisting of small English letters. However, his friend Julia decided to make fun of him and hid the string s. Ivan preferred making a new string to finding the old one. \n\nIvan knows some information ... | [{"type": "stdin_stdout", "input": "20\nadabacabaeabacabada 1 359\nabadabacabafabaca 1 213\nacabagabacaba 1 315\ncabaeabacabadabacab 1 268\nfabacabadabacabaeab 1 352\ncabafabacabada 1 28\nacabadabacabaea 1 67\ncabadabacabaeabacaba 1 484\nabacabadabacaba 1 209\nacabaiabacaba 1 251\nacabafabacabadabac 1 475\nabacabaeabac... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n animals in the queue to Dr. Dolittle. When an animal comes into the office, the doctor examines him, gives prescriptions, appoints tests and may appoint extra examination. Doc knows all the forest animals perf... | [{"type": "stdin_stdout", "input": "150 2476\n70 21 114 127 22 11 29 59 51 59 35 3 53 88 5 8 44 4 8 100 1 27 1 25 27 56 48 22 23 103 85 66 14 58 20 7 176 11 19 26 105 97 83 3 29 30 52 92 59 11 135 37 59 8 66 20 47 19 143 16 93 18 57 71 1 13 141 1 119 6 2 87 40 68 28 22 20 53 31 19 15 33 32 9 70 63 16 26 77 7 45 52 73 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLuba has to do n chores today. i-th chore takes ai units of time to complete. It is guaranteed that for every <image> the condition ai ≥ ai - 1 is met, so the sequence is sorted.\n\nAlso Luba can work really hard on some ... | [{"type": "stdin_stdout", "input": "100 1 99\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA correct expression of the form a+b=c was written; a, b and c are non-negative integers without leading zeros. In this expression, the plus and equally signs were lost. The task is to restore the expression. In other wor... | [{"type": "stdin_stdout", "input": "100277221476489181970323375139380435110027722147648918197032337513938043511002772214764891819703233751393804351100277221476489181970323375139380435120055444295297836394064675027876087022005544429529783639406467502787608702\n", "output": "1002772214764891819703233751393804351100277221... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.