Search is not available for this dataset
problem_id stringlengths 32 32 | name stringlengths 2 112 | problem stringlengths 200 14k | test_cases stringlengths 33 79.2M | difficulty stringclasses 33
values | language listlengths 1 1 | source stringclasses 14
values | num_solutions int64 2 1.9M | starter_code stringlengths 0 1.47k | subset stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|
0bdec0206f2e8377cd892fe5698579c4 | Sinking Ship | The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All *n* crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to *n*) and await further instructions. However, one should evacuate the crew properly, in a stri... | {"inputs": ["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman", "1\nA captain", "1\nAbcdefjhij captain", "5\nA captain\nB man\nD woman\nC child\nE rat", "10\nCap captain\nD child\nC woman\nA woman\nE child\nMan man\nB child\nF woman\nRat rat\nRatt rat", "5\nJoyxnkypf captain\nDxssgr woman\nK... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 380 | codeforces | |
0c154754b5d73543126f0c6904d0f27a | HQ9+ | HQ9+ is a joke programming language which has only four one-character instructions:
- "H" prints "Hello, World!",- "Q" prints the source code of the program itself,- "9" prints the lyrics of "99 Bottles of Beer" song, - "+" increments the value stored in the internal accumulator.
Instructions "H" and "Q" are case-s... | {"inputs": ["Hi!", "Codeforces", "a+b=c", "hq-lowercase", "Q", "9", "H", "+", "~", "dEHsbM'gS[\\brZ_dpjXw8f?L[4E\"s4Zc9*(,j:>p$}m7HD[_9nOWQ\\uvq2mHWR", "tt6l=RHOfStm.;Qd$-}zDes*E,.F7qn5-b%HC", "@F%K2=%RyL/", "juq)k(FT.^G=G\\zcqnO\"uJIE1_]KFH9S=1c\"mJ;F9F)%>&.WOdp09+k`Yc6}\"6xw,Aos:M\\_^^:xBb[CcsHm?J", "6G_\"Fq#<AWyHG=R... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 281 | codeforces | |
0c30ee035d1be2789b81861987cb9945 | Okabe and El Psy Kongroo | Okabe likes to take walks but knows that spies from the Organization could be anywhere; that's why he wants to know how many different walks he can take in his city safely. Okabe's city can be represented as all points (*x*,<=*y*) such that *x* and *y* are non-negative. Okabe starts at the origin (point (0,<=0)), and n... | {"inputs": ["1 3\n0 3 3", "2 6\n0 3 0\n3 10 2", "2 3\n0 2 13\n2 3 11", "2 9\n0 8 0\n8 10 10", "1 1\n0 3 9", "3 8\n0 7 3\n7 8 5\n8 9 13", "2 10\n0 9 6\n9 10 5", "2 6\n0 3 3\n3 8 13", "1 5\n0 6 15", "2 6\n0 5 8\n5 8 4", "2 10\n0 9 13\n9 10 1", "3 100\n0 94 4\n94 99 5\n99 100 2", "4 100\n0 51 3\n51 98 2\n98 99 1\n99 100 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
0c34bbbc2306102aab4c7b97a203e0e5 | Disposition | Vasya 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 minimize the number of the disposition’s divisors — the positive integers *i* such that for at lea... | {"inputs": ["2", "3", "4", "5", "6", "1", "7", "8", "9", "10", "96", "97", "98", "99", "100", "9996", "9997", "9998", "9999", "10000", "99996", "99997", "99998", "99999", "100000", "9149", "72877", "52956", "33035", "13114", "93193", "73273", "37000", "17079", "84653", "27251", "53496", "96093", "22338", "64935"], "out... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 17 | codeforces | |
0c45b94028303ef4fffe2d2c090237ad | Minimize the error | You are given two arrays *A* and *B*, each of size *n*. The error, *E*, between these two arrays is defined . You have to perform exactly *k*1 operations on array *A* and exactly *k*2 operations on array *B*. In one operation, you have to choose one element of the array and increase or decrease it by 1.
Output the min... | {"inputs": ["2 0 0\n1 2\n2 3", "2 1 0\n1 2\n2 2", "2 5 7\n3 4\n14 4", "2 0 1\n1 2\n2 2", "2 1 1\n0 0\n1 1", "5 5 5\n0 0 0 0 0\n0 0 0 0 0", "3 4 5\n1 2 3\n3 2 1", "3 1000 0\n1 2 3\n-1000 -1000 -1000", "10 300 517\n-6 -2 6 5 -3 8 9 -10 8 6\n5 -9 -2 6 1 4 6 -2 5 -3", "10 819 133\n87 22 30 89 82 -97 -52 25 76 -22\n-20 95 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 87 | codeforces | |
0c4fbb69ea6a8fda6a0507a8c111bb9a | Unary | Unary is a minimalistic Brainfuck dialect in which programs are written using only one token.
Brainfuck programs use 8 commands: "+", "-", "[", "]", "<", ">", "." and "," (their meaning is not important for the purposes of this problem). Unary programs are created from Brainfuck programs using the following alg... | {"inputs": [",.", "++++[>,.<-]", "[-],<],<<,<[,>,+>[[<>.,[>-[-[<><>><<<<]>,.-].>-[[>+,>,[,-,.-,-[[]>..<>,<[+,-<]-++.<+.]<,[[.<<-><<<],", "+", "-", "<", ">", ".", ",", "[", "]", ",]+>.],,+->+>-[]][><,-]><]++<.,-[.>.<+.[.<,[-,,[<]+>]->>]>]-+-+<][].,.]+][[<,-.+][+<<-+.],,,<,.]-].-", "][-+>,>[,<[<+-,[+[-.<+,<[.,<+<,>+],.]>... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 17 | codeforces | |
0c57b0428a882e021b4f692a3e535189 | Qualification Rounds | Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of *n* problems, and they want to select any non-empty subset of it as a problemset.
*k* experienced teams are participating in the contest. Some of these teams already know some of the prob... | {"inputs": ["5 3\n1 0 1\n1 1 0\n1 0 0\n1 0 0\n1 0 0", "3 2\n1 0\n1 1\n0 1", "10 2\n1 0\n1 0\n0 0\n1 1\n0 0\n1 1\n0 0\n1 1\n0 1\n0 1", "10 3\n1 0 0\n0 1 1\n1 0 0\n0 1 0\n0 0 1\n1 0 1\n0 1 1\n1 0 0\n1 1 0\n0 0 0", "10 4\n1 0 1 0\n1 0 0 1\n1 1 0 1\n1 0 1 1\n1 1 0 1\n1 0 1 0\n0 0 0 0\n0 0 1 0\n1 0 1 0\n0 0 1 1", "2 2\n0 0\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 48 | codeforces | |
0c6e3e4e843b406632384caa2fbb3749 | Burglar and Matches | A burglar got into a matches warehouse and wants to steal as many matches as possible. In the warehouse there are *m* containers, in the *i*-th container there are *a**i* matchboxes, and each matchbox contains *b**i* matches. All the matchboxes are of the same size. The burglar's rucksack can hold *n* matchboxes exactl... | {"inputs": ["7 3\n5 10\n2 5\n3 6", "3 3\n1 3\n2 2\n3 1", "1 1\n1 2", "1 2\n1 9\n1 6", "1 10\n1 1\n1 9\n1 3\n1 9\n1 7\n1 10\n1 4\n1 7\n1 3\n1 1", "2 1\n2 1", "2 2\n2 4\n1 4", "2 3\n1 7\n1 2\n1 5", "4 1\n2 2", "4 2\n1 10\n4 4", "4 3\n1 4\n6 4\n1 7", "5 1\n10 5", "5 2\n3 9\n2 2", "5 5\n2 9\n3 1\n2 1\n1 8\n2 8", "5 10\n1 3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 244 | codeforces | |
0c70c1730bd895feea2883bb012782b2 | none | In Absurdistan, there are *n* towns (numbered 1 through *n*) and *m* bidirectional railways. There is also an absurdly simple road network — for each pair of different towns *x* and *y*, there is a bidirectional road between towns *x* and *y* if and only if there is no railway between them. Travelling to a different to... | {"inputs": ["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2", "5 4\n1 2\n3 2\n3 4\n5 4", "3 1\n1 2", "2 1\n1 2", "2 0", "20 0", "381 0", "3 3\n1 2\n2 3\n3 1", "3 0", "3 1\n1 3", "3 2\n2 3\n3 1", "4 1\n1 4", "4 5\n1 3\n2 1\n3 4\n4 2\n2 3", "20 1\n20 1", "21 1\n21 1", "100 1\n100 1", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 164 | codeforces | |
0c7952f2ca39ae21d131031bba678184 | Vanya and Scales | Vanya has a scales for weighing loads and weights of masses *w*0,<=*w*1,<=*w*2,<=...,<=*w*100 grams where *w* is some integer not less than 2 (exactly one weight of each nominal value). Vanya wonders whether he can weight an item with mass *m* using the given weights, if the weights can be put on both pans of the scale... | {"inputs": ["3 7", "100 99", "100 50", "1000000000 1", "100 10002", "4 7", "4 11", "5 781", "7 9", "5077 5988", "2 9596", "4 1069", "4 7134", "4 9083", "4 7927", "4 6772", "5 782", "4 1000000000", "4 357913941", "4 357918037", "5 12207031", "5 41503906", "5 90332031", "11 1786324", "10 999", "8 28087", "8 28598", "32 3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 40 | codeforces | |
0c84e48381cf6190a9397d86d6c3b7de | Blackjack | One rainy gloomy evening when all modules hid in the nearby cafes to drink hot energetic cocktails, the Hexadecimal virus decided to fly over the Mainframe to look for a Great Idea. And she has found one!
Why not make her own Codeforces, with blackjack and other really cool stuff? Many people will surely be willing to... | {"inputs": ["12", "20", "10", "11", "15", "18", "25", "22", "1", "2", "3", "4", "5", "6", "7", "8", "9", "13", "14", "16", "17", "19", "21", "23", "24"], "outputs": ["4", "15", "0", "4", "4", "4", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "4", "4", "4", "4", "4", "4", "0", "0"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 329 | codeforces | |
0c8b321b7154ef0e7847a58958a4c5f3 | Beautiful Road | A long time ago in some country in Asia were civil wars.
Each of *n* cities wanted to seize power. That's why sometimes one city gathered an army and sent it to campaign against another city.
Road making was difficult, so the country had few roads, exactly *n*<=-<=1. Also you could reach any city from any other city ... | {"inputs": ["2\n2 1 5", "6\n1 2 1\n1 3 5\n3 4 2\n3 5 3\n3 6 4", "10\n10 6 43981\n4 2 6730\n1 2 35174\n5 3 61951\n8 7 43981\n7 1 6730\n5 8 6730\n9 3 52479\n6 4 18138", "9\n6 4 72697\n9 6 72697\n1 6 38220\n2 6 38220\n6 7 72697\n6 5 72697\n8 6 72697\n3 6 38220", "10\n9 2 18232\n3 4 45701\n3 9 13895\n8 9 18232\n7 6 56122\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
0cd13038b6b1d8af20a4bfe259f65af7 | Pages | User ainta is making a web site. This time he is going to make a navigation of the pages. In his site, there are *n* pages numbered by integers from 1 to *n*. Assume that somebody is on the *p*-th page now. The navigation will look like this:
When someone clicks the button "<<" he is redirected to page 1, and wh... | {"inputs": ["17 5 2", "6 5 2", "6 1 2", "6 2 2", "9 6 3", "10 6 3", "8 5 4", "100 10 20", "100 25 11", "5 2 1", "5 3 1", "79 35 12", "100 99 5", "100 99 15", "100 100 17", "100 35 28", "100 46 38", "100 46 48", "100 10 100", "3 1 1", "3 2 1", "17 5 3", "3 1 3", "7 5 1", "5 5 5", "5 3 5"], "outputs": ["<< 3 4 (5) 6 7 >>... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 196 | codeforces | |
0cd16fcabb7afbcb633d4e2d16d8330b | none | This is an interactive problem.
Bob lives in a square grid of size $n \times n$, with rows numbered $1$ through $n$ from top to bottom, and columns numbered $1$ through $n$ from left to right. Every cell is either allowed or blocked, but you don't know the exact description of the grid. You are given only an integer $... | {"inputs": ["5\n.....\n.###.\n.###.\n.###.\n...#.", "7\n.......\n.......\n.......\n.......\n......#\n.......\n....#..", "2\n..\n..", "2\n.#\n..", "2\n..\n#.", "5\n.....\n.....\n.....\n.....\n.#.#.", "10\n..#.......\n..#......#\n......###.\n.#......#.\n.......#.#\n.##....#.#\n.....#....\n#...####..\n.#....##..\n##..#...... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
0ce006c0eb78b2ee3e77330642120204 | none | Limak is a little polar bear. He doesn't have many toys and thus he often plays with polynomials.
He considers a polynomial valid if its degree is *n* and its coefficients are integers not exceeding *k* by the absolute value. More formally:
Let *a*0,<=*a*1,<=...,<=*a**n* denote the coefficients, so . Then, a polynomi... | {"inputs": ["3 1000000000\n10 -9 -3 5", "3 12\n10 -9 -3 5", "2 20\n14 -7 19", "5 5\n0 -4 -2 -2 0 5", "6 10\n-2 -1 7 -3 2 7 -6", "7 100\n2 21 11 45 58 85 -59 38", "100 1000\n-62 57 -27 -67 49 -10 66 -64 -36 -78 62 -75 -39 75 -47 -36 41 -88 62 -43 22 29 -20 58 40 16 71 -2 -87 12 86 -90 -92 67 -12 -48 -10 -26 78 68 22 -3 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
0ce04c7522161634da17dd0a350180e7 | Juicer | Kolya is going to make fresh orange juice. He has *n* oranges of sizes *a*1,<=*a*2,<=...,<=*a**n*. Kolya will put them in the juicer in the fixed order, starting with orange of size *a*1, then orange of size *a*2 and so on. To be put in the juicer the orange must have size not exceeding *b*, so if Kolya sees an orange ... | {"inputs": ["2 7 10\n5 6", "1 5 10\n7", "3 10 10\n5 7 7", "1 1 1\n1", "2 951637 951638\n44069 951637", "50 100 129\n55 130 91 19 116 3 63 52 104 76 75 27 151 99 149 147 39 148 84 9 132 49 40 112 124 141 144 93 36 32 146 74 48 38 150 55 94 32 107 69 77 81 33 57 62 98 78 127 154 126", "100 1000 1083\n992 616 818 359 609 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 419 | codeforces | |
0d78606b1f006c98a437599329ad938e | Volleyball | Petya loves volleyball very much. One day he was running late for a volleyball match. Petya hasn't bought his own car yet, that's why he had to take a taxi. The city has *n* junctions, some of which are connected by two-way roads. The length of each road is defined by some positive integer number of meters; the roads c... | {"inputs": ["4 4\n1 3\n1 2 3\n1 4 1\n2 4 1\n2 3 5\n2 7\n7 2\n1 2\n7 7", "3 3\n1 3\n1 2 2\n1 3 3\n3 2 1\n2 7\n2 7\n3 6", "3 1\n1 3\n1 2 2\n2 7\n2 7\n3 6", "3 2\n3 3\n1 2 2\n1 3 3\n2 7\n2 7\n3 7", "2 2\n1 2\n1 2 3\n1 2 2\n2 7\n3 2", "1 0\n1 1\n74 47", "5 5\n1 3\n1 3 3\n5 1 6\n4 3 8\n1 3 3\n5 2 4\n1 2\n4 1\n2 5\n5 2\n1 2"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
0d902b95505260c05a57bdc1eeca9891 | Warrior and Archer | In the official contest this problem has a different statement, for which jury's solution was working incorrectly, and for this reason it was excluded from the contest. This mistake have been fixed and the current given problem statement and model solution corresponds to what jury wanted it to be during the contest.
V... | {"inputs": ["6\n0 1 3 7 15 31", "2\n73 37", "2\n0 1000000000", "8\n729541013 135019377 88372488 319157478 682081360 558614617 258129110 790518782", "2\n0 1", "8\n552283832 997699491 89302459 301640204 288141798 31112026 710831619 862166501", "4\n0 500000000 500000001 1000000000", "18\n515925896 832652240 279975694 5709... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
0d91bb06eb67c4ce2c2a089bdde1617d | Petr and Book | One Sunday Petr went to a bookshop and bought a new book on sports programming. The book had exactly *n* pages.
Petr decided to start reading it starting from the next day, that is, from Monday. Petr's got a very tight schedule and for each day of the week he knows how many pages he will be able to read on that day. S... | {"inputs": ["100\n15 20 20 15 10 30 45", "2\n1 0 0 0 0 0 0", "100\n100 200 100 200 300 400 500", "3\n1 1 1 1 1 1 1", "1\n1 1 1 1 1 1 1", "20\n5 3 7 2 1 6 4", "10\n5 1 1 1 1 1 5", "50\n10 1 10 1 10 1 10", "77\n11 11 11 11 11 11 10", "1\n1000 1000 1000 1000 1000 1000 1000", "1000\n100 100 100 100 100 100 100", "999\n10 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 402 | codeforces | |
0d96290ec1b71abbe19125d7e7eb6517 | Seat Arrangements | Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that many seats there are already occupied. Today you and your friends went for class, and found out that some of the seats were occupied.
The classroom contains $n$ rows of seat... | {"inputs": ["1 2 2\n..", "3 3 4\n.*.\n*.*\n.*.", "1 1 1\n.", "1 1 1\n*", "2 2 2\n.*\n*.", "1 1 1000\n.", "1 1 2000\n*", "3 3 1\n.*.\n.*.\n.*.", "2 2 1\n..\n.."], "outputs": ["1", "0", "1", "0", "0", "0", "0", "6", "4"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
0debd0e39e8f9597e4e1a057bfdb4df9 | Места в самолёте | В самолёте есть *n* рядов мест. Если смотреть на ряды сверху, то в каждом ряду есть 3 места слева, затем проход между рядами, затем 4 центральных места, затем ещё один проход между рядами, а затем ещё 3 места справа.
Известно, что некоторые места уже заняты пассажирами. Всего есть два вида пассажиров — статусные (те, ... | {"inputs": ["1 2\nSP.-SS.S-S.S", "4 9\nPP.-PPPS-S.S\nPSP-PPSP-.S.\n.S.-S..P-SS.\nP.S-P.PP-PSP", "3 7\n.S.-SSSP-..S\nS..-.SPP-S.P\n.S.-PPPP-PSP", "5 6\nPP.-PS.P-P..\nPPS-SP..-P.P\nP.P-....-S..\nSPP-.P.S-.S.\nSP.-S.PS-PPP", "1 1\n..S-PS..-.PP", "2 2\nPP.-S.SS-.S.\nSSP-SSSS-S.S", "30 1\nPPP-PPP.-PPP\nPPP-PPPP-PPP\nPPP-PPP... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 85 | codeforces | |
0df75644338ab2c4b5718e93078c22e0 | Game | Two players play a game.
Initially there are $n$ integers $a_1, a_2, \ldots, a_n$ written on the board. Each turn a player selects one number and erases it from the board. This continues until there is only one number left on the board, i. e. $n - 1$ turns are made. The first player makes the first move, then players ... | {"inputs": ["3\n2 1 3", "3\n2 2 2", "9\n44 53 51 80 5 27 74 79 94", "10\n38 82 23 37 96 4 81 60 67 86", "10\n58 26 77 15 53 81 68 48 22 65", "1\n124", "2\n2 1", "3\n1 1 1000", "2\n322 322", "3\n9 92 12", "3\n1 2 2"], "outputs": ["2", "2", "53", "60", "53", "124", "1", "1", "322", "12", "2"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 391 | codeforces | |
0e157a547fc5207bba32733c03b0e7fa | Dark Assembly | Dark Assembly is a governing body in the Netherworld. Here sit the senators who take the most important decisions for the player. For example, to expand the range of the shop or to improve certain characteristics of the character the Dark Assembly's approval is needed.
The Dark Assembly consists of *n* senators. Each ... | {"inputs": ["5 6 100\n11 80\n14 90\n23 70\n80 30\n153 70", "5 3 100\n11 80\n14 90\n23 70\n80 30\n153 70", "1 3 20\n20 20", "4 3 40\n10 40\n11 50\n10 50\n9 50", "4 4 60\n10 40\n11 50\n10 50\n12 30", "2 7 20\n10 40\n10 50", "2 1 25\n10 40\n12 50", "3 3 31\n10 40\n12 50\n15 0", "1 3 40\n10 0", "1 4 30\n10 20", "1 7 10\n40... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
0e3294f49387c2acfaea24e248588750 | Before an Exam | Tomorrow Peter has a Biology exam. He does not like this subject much, but *d* days ago he learnt that he would have to take this exam. Peter's strict parents made him prepare for the exam immediately, for this purpose he has to study not less than *minTime**i* and not more than *maxTime**i* hours per each *i*-th day. ... | {"inputs": ["1 48\n5 7", "2 5\n0 1\n3 5", "1 1\n5 6", "1 4\n2 4", "2 5\n4 6\n0 0", "27 97\n2 8\n0 5\n5 6\n3 6\n5 5\n1 2\n3 5\n1 8\n0 4\n3 3\n0 2\n0 0\n4 8\n5 6\n5 8\n0 7\n1 4\n0 4\n1 5\n3 7\n2 5\n5 6\n4 7\n3 8\n0 1\n3 4\n5 7", "30 92\n4 5\n4 7\n2 6\n8 8\n7 8\n4 5\n1 5\n7 8\n1 2\n6 8\n2 7\n2 4\n0 0\n1 3\n4 5\n1 1\n0 7\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 27 | codeforces | |
0e34ebe5fef7204f2fe932a215b89c7f | Domino Principle | Vasya is interested in arranging dominoes. He is fed up with common dominoes and he uses the dominoes of different heights. He put *n* dominoes on the table along one axis, going from left to right. Every domino stands perpendicular to that axis so that the axis passes through the center of its base. The *i*-th domino ... | {"inputs": ["4\n16 5\n20 5\n10 10\n18 2", "4\n0 10\n1 5\n9 10\n15 10", "3\n6 7\n2 9\n-6 10", "4\n-6 9\n9 5\n-7 4\n0 9", "5\n-47 19\n-43 14\n83 27\n-67 46\n-58 98", "6\n20 39\n38 13\n-25 48\n-22 38\n13 39\n90 54", "10\n34 9\n-41 26\n-62 32\n1 10\n77 14\n92 7\n-45 35\n75 19\n-23 2\n-46 8"], "outputs": ["3 1 4 1 ", "4 1 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
0e3feaf5ee19e176f276c89f80d998d6 | Interactive Bulls and Cows (Easy) | This problem is a little bit unusual. Here you are to implement an interaction with a testing system. That means that you can make queries and get responses in the online mode. Please be sure to use the stream flushing operation after each query's output in order not to leave part of your output in some buffer. For exa... | {"inputs": ["0123", "1234", "9876", "7158", "7590", "7325", "7524", "7269", "7802", "7436", "7190", "7390", "2548", "2193", "2491", "2469", "2659", "2405", "2058", "2580", "2316", "2516", "8796", "8534", "9067", "8712", "9023", "8645", "8623", "8923", "8567", "8756", "0351", "9863", "0518", "0263", "0462", "0429", "062... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
0e82cefa01c6997641a42ae83143b95c | Arpa's weak amphitheater and Mehrdad's valuable Hoses | Just to remind, girls in Arpa's land are really nice.
Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight *w**i* and some beauty *b**i*. Also each Hos may have some friends. Hoses are divided in some friendship groups. Two Hoses *x* and *y* are in the same friendship group if... | {"inputs": ["3 1 5\n3 2 5\n2 4 2\n1 2", "4 2 11\n2 4 6 6\n6 4 2 1\n1 2\n2 3", "10 5 100\n70 67 8 64 28 82 18 61 82 7\n596434 595982 237932 275698 361351 850374 936914 877996 789231 331012\n1 7\n2 4\n3 6\n5 7\n1 5", "10 5 100\n64 90 3 94 96 97 52 54 82 31\n796554 444893 214351 43810 684158 555762 686198 339093 383018 69... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 14 | codeforces | |
0ea22e7ee558ec693ca7ade63f2070c0 | none | Arkady decides to observe a river for *n* consecutive days. The river's water level on each day is equal to some real value.
Arkady goes to the riverside each day and makes a mark on the side of the channel at the height of the water level, but if it coincides with a mark made before, no new mark is created. The water... | {"inputs": ["6\n0 1 0 3 0 2", "5\n0 1 2 1 2", "5\n0 1 1 2 2", "1\n0", "100\n0 1 2 2 3 0 1 5 6 6 0 0 8 7 1 9 9 4 10 11 12 2 12 12 12 12 9 13 14 8 15 15 15 19 15 7 17 17 18 19 9 10 21 0 22 9 2 24 24 4 24 7 25 14 5 8 28 29 30 31 31 31 0 3 15 31 8 33 6 35 35 35 36 36 37 37 38 39 28 0 2 23 41 9 9 0 6 25 41 41 12 42 43 43 36... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 28 | codeforces | |
0ea603ee7629911d0ced82f19b960bfe | none | Rick and Morty are playing their own version of Berzerk (which has nothing in common with the famous Berzerk game). This game needs a huge space, so they play it with a computer.
In this game there are *n* objects numbered from 1 to *n* arranged in a circle (in clockwise order). Object number 1 is a black hole and the... | {"inputs": ["5\n2 3 2\n3 1 2 3", "8\n4 6 2 3 4\n2 3 6", "10\n3 4 7 5\n2 8 5", "17\n1 10\n1 12", "23\n1 20\n3 9 2 12", "85\n12 76 7 75 51 43 41 66 13 59 48 81 73\n3 65 60 25", "100\n84 80 73 28 76 21 44 97 63 59 6 77 41 2 8 71 57 19 33 46 92 5 61 88 53 68 94 56 14 35 4 47 17 79 84 10 67 58 45 38 13 12 87 3 91 30 15 11 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
0ebc1719d1f245ede35d95c7bd681e06 | Taxes | Mr. Funt now lives in a country with a very specific tax laws. The total income of mr. Funt during this year is equal to *n* (*n*<=≥<=2) burles and the amount of tax he has to pay is calculated as the maximum divisor of *n* (not equal to *n*, of course). For example, if *n*<==<=6 then Funt has to pay 3 burles, while fo... | {"inputs": ["4", "27", "3", "5", "10", "2000000000", "26", "7", "2", "11", "1000000007", "1000000009", "1999999999", "1000000011", "101", "103", "1001", "1003", "10001", "10003", "129401294", "234911024", "192483501", "1234567890", "719241201", "9", "33", "25", "15", "147", "60119912", "45", "21", "9975", "17", "99", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 101 | codeforces | |
0ec70b522b9282b4d80872c39c9db3fb | Berland Square | Last year the world's largest square was built in Berland. It is known that the square can be represented as an infinite plane with an introduced Cartesian system of coordinates. On that square two sets of concentric circles were painted. Let's call the set of concentric circles with radii 1,<=2,<=...,<=*K* and the cen... | {"inputs": ["1 0 1 1", "1 0 1 2", "3 3 4 7", "2 2 2 3", "1 100000 1 99999", "4 7 3 3", "1 0 1 100", "1 0 2 3", "2 2 4 4", "4 4 2 2", "1 -1 5 -10", "5 2 1 -5", "5 4 3 -2", "3 7 4 1", "3 -9 3 4", "2 -6 4 6", "2 -4 1 9", "2 1 4 -7", "2 4 5 -4", "5 7 1 2", "94925 5648 96389 1799", "94244 7010 97753 -7757", "93564 8371 9911... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
0ee88c557025d4dd9e3747078da8071a | Long Path | One day, little Vasya found himself in a maze consisting of (*n*<=+<=1) rooms, numbered from 1 to (*n*<=+<=1). Initially, Vasya is at the first room and to get out of the maze, he needs to get to the (*n*<=+<=1)-th one.
The maze is organized as follows. Each room of the maze has two one-way portals. Let's consider roo... | {"inputs": ["2\n1 2", "4\n1 1 2 3", "5\n1 1 1 1 1", "7\n1 2 1 3 1 2 1", "1\n1", "3\n1 1 3", "10\n1 1 3 2 2 1 3 4 7 5", "20\n1 2 2 2 2 1 4 7 8 6 5 3 5 3 8 11 5 10 16 10", "32\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", "10\n1 1 3 2 2 1 3 4 7 5", "30\n1 1 2 2 5 6 4 3 4 7 3 5 12 12 2 15 3 8 3 10 12 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 54 | codeforces | |
0f0ab0ca68d9693bfdba9ec3a78d7157 | Royal Questions | In a medieval kingdom, the economic crisis is raging. Milk drops fall, Economic indicators are deteriorating every day, money from the treasury disappear. To remedy the situation, King Charles Sunnyface decided make his *n* sons-princes marry the brides with as big dowry as possible.
In search of candidates, the king ... | {"inputs": ["2 3\n1 2 5\n1 2 1\n2 1 10", "3 2\n1 2 10\n3 2 20", "2 2\n1 2 1\n1 2 2", "3 3\n1 3 4\n1 3 2\n1 3 8", "2 1\n1 2 6", "4 3\n1 2 1\n2 3 2\n3 4 1", "4 2\n1 2 4\n1 2 5", "4 2\n1 2 3\n1 3 4", "4 4\n1 2 6971\n1 2 4379\n3 4 1092\n3 2 9449", "7 6\n3 5 4229\n2 7 7116\n3 4 2492\n7 3 3742\n7 3 2996\n3 4 8359", "7 15\n5 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
0f282b1f9ea8de06a0b9a6c9266ff534 | Cards | There are *n* cards (*n* is even) in the deck. Each card has a positive integer written on it. *n*<=/<=2 people will play new card game. At the beginning of the game each player gets two cards, each card is given to exactly one player.
Find the way to distribute cards such that the sum of values written of the cards ... | {"inputs": ["6\n1 5 7 4 4 3", "4\n10 10 10 10", "100\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", "4\n82 46 8 44", "2\n35 50", "8\n24 39 49 38 44 64 44 50", "100\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 354 | codeforces | |
0f2fcfff4d971d95c3358fe7ecd570c7 | Collecting Beats is Fun | Cucumber boy is fan of Kyubeat, a famous music game.
Kyubeat has 16 panels for playing arranged in 4<=×<=4 table. When a panel lights up, he has to press that panel.
Each panel has a timing to press (the preffered time when a player should press it), and Cucumber boy is able to press at most *k* panels in a time with... | {"inputs": ["1\n.135\n1247\n3468\n5789", "5\n..1.\n1111\n..1.\n..1.", "1\n....\n12.1\n.2..\n.2..", "1\n6981\n.527\n4163\n2345", "5\n9999\n9999\n9999\n9999", "2\n4444\n3333\n2222\n1111", "3\n2123\n1232\n2321\n3213", "2\n1...\n.1..\n..1.\n...1", "2\n1.1.\n.1.1\n2.2.\n.222", "1\n1..2\n.3.4\n567.\n.89.", "1\n1122\n3344\n55... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 224 | codeforces | |
0f42dc2a3032e100f108c4a739f07748 | Treasure Island | Our brave travelers reached an island where pirates had buried treasure. However as the ship was about to moor, the captain found out that some rat ate a piece of the treasure map.
The treasure map can be represented as a rectangle *n*<=×<=*m* in size. Each cell stands for an islands' square (the square's side length ... | {"inputs": ["6 10\n##########\n#K#..#####\n#.#..##.##\n#..L.#...#\n###D###A.#\n##########\n4\nN 2\nS 1\nE 1\nW 2", "3 4\n####\n#.A#\n####\n2\nW 1\nN 2", "10 10\n##########\n#K#..##..#\n##...ZB..#\n##.......#\n#D..#....#\n##...Y..##\n#...N...J#\n#.G...#.##\n#.S.I....#\n##########\n4\nE 2\nW 4\nS 3\nN 4", "17 19\n#######... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
0f58d81163a401fa15ec625c5344c8cd | Geometry Horse | Vasya plays the Geometry Horse.
The game goal is to destroy geometric figures of the game world. A certain number of points is given for destroying each figure depending on the figure type and the current factor value.
There are *n* types of geometric figures. The number of figures of type *k**i* and figure cost *c*... | {"inputs": ["1\n5 10\n2\n3 6", "2\n3 8\n5 10\n1\n20", "3\n10 3\n20 2\n30 1\n3\n30 50 60", "1\n100 1000\n1\n1", "1\n1 1000\n1\n1", "1\n1 1000\n1\n2", "2\n1000000000 1000\n1 1\n1\n10", "6\n5 9\n63 3\n30 4\n25 6\n48 2\n29 9\n8\n105 137 172 192 632 722 972 981", "7\n9902 9\n5809 6\n2358 0\n6868 7\n9630 2\n8302 10\n9422 3\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
0f711255a3be0db0ebe92759ed87ff6c | Stadium and Games | Daniel is organizing a football tournament. He has come up with the following tournament format:
1. In the first several (possibly zero) stages, while the number of teams is even, they split in pairs and play one game for each pair. At each stage the loser of each pair is eliminated (there are no draws). Such stages... | {"inputs": ["3", "25", "2", "1", "15", "314", "524800", "5149487579894806", "249999998807430810", "1000000000000000000", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "21", "28", "36", "45", "55", "78", "105", "120", "136", "171", "210", "255", "5460", "16383", "391170", "1906128", "576460752303423487", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 23 | codeforces | |
0f7b0ee4cd52ba5f602dd8c53867f494 | Multicolored Marbles | Polycarpus plays with red and blue marbles. He put *n* marbles from the left to the right in a row. As it turned out, the marbles form a zebroid.
A non-empty sequence of red and blue marbles is a zebroid, if the colors of the marbles in this sequence alternate. For example, sequences (red; blue; red) and (blue) are ze... | {"inputs": ["3", "4", "1", "2", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "30", "40", "35", "747", "811", "523", "939", "7218", "6578", "4994", "3410", "9122", "11500", "37212", "95628", "21341", "63405", "670293", "12357", "838069", "696485", "1000000", "999... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 16 | codeforces | |
0fa262b62ad1fc05fa98a73f6cec7828 | Complicated GCD | Greatest common divisor *GCD*(*a*,<=*b*) of two positive integers *a* and *b* is equal to the biggest integer *d* such that both integers *a* and *b* are divisible by *d*. There are many efficient algorithms to find greatest common divisor *GCD*(*a*,<=*b*), for example, Euclid algorithm.
Formally, find the biggest in... | {"inputs": ["1 2", "61803398874989484820458683436563811772030917980576 61803398874989484820458683436563811772030917980576", "1 100", "100 100000", "12345 67890123456789123457", "1 1", "2 2", "8392739158839273915883927391588392739158839273915883927391588392739158839273915883927391588392739158 839273915883927391588392739... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 374 | codeforces | |
0fafdabf58fdb7b9bc79f12cceb407f3 | Airplane Arrangements | There is an airplane which has *n* rows from front to back. There will be *m* people boarding this airplane.
This airplane has an entrance at the very front and very back of the plane.
Each person has some assigned seat. It is possible for multiple people to have the same assigned seat. The people will then board the... | {"inputs": ["3 3", "1000000 1000000", "1000000 500000", "1 1", "10 1", "285042 201091", "896437 604720", "284114 73851", "541826 316395", "353093 96536", "540898 158491", "858309 773589", "56322 42432", "461466 56468", "29102 1503", "42800 41731", "235175 92933", "921643 744360", "619924 583916", "43657 852", "4672 308... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
0fce72ef3ce162bced800165e0d75fe4 | Interesting Sequence | Berland scientists noticed long ago that the world around them depends on Berland population. Due to persistent research in this area the scientists managed to find out that the Berland chronology starts from the moment when the first two people came to that land (it is considered to have happened in the first year). A... | {"inputs": ["2", "3", "13", "1729", "1", "156", "144", "15407021574586369", "1283918464548876", "106993205379216", "8916100449984", "743008391424", "61917613056", "5162766336", "465813504", "749018868196746805223329946373352590959663287279411259311764529219426154819446575772163700626968045411915608325823147333921760188... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
0fd3c9bddbe0ccc202f9c7c24aea01d3 | King Moves | The only king stands on the standard chess board. You are given his position in format "cd", where *c* is the column from 'a' to 'h' and *d* is the row from '1' to '8'. Find the number of moves permitted for the king.
Check the king's moves here [https://en.wikipedia.org/wiki/King_(chess)](https://en.wikipedia.org/wik... | {"inputs": ["e4", "a1", "h8", "a4", "g7", "e1", "b2", "c7", "h6", "c8", "h2", "h5", "a8", "f8", "h1", "f2", "e8", "h3", "b8", "g8", "d8", "h4", "b1", "a2"], "outputs": ["8", "3", "3", "5", "8", "5", "8", "8", "5", "5", "5", "5", "3", "5", "3", "8", "5", "5", "5", "5", "5", "5", "5", "5"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 324 | codeforces | |
0fd712709f42f0903bd59203c4ea71f4 | Beaver Game | Two beavers, Timur and Marsel, play the following game.
There are *n* logs, each of exactly *m* meters in length. The beavers move in turns. For each move a beaver chooses a log and gnaws it into some number (more than one) of equal parts, the length of each one is expressed by an integer and is no less than *k* meter... | {"inputs": ["1 15 4", "4 9 5", "14 30 9", "81 180 53", "225 187 20", "501 840 11", "3 11 6", "1 2 1", "1 1 2", "1 1 1", "1 2 2", "2 1 1", "2 1 2", "2 2 1", "2 2 2", "1000000000 1000000000 1000000000", "999999999 735134400 1", "999999999 735134400 100", "787965358 999999986 2", "588462355 999999986 2", "994427144 999999... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 7 | codeforces | |
0ff293f9b8bd79037a2e24a7751fb766 | Constellation | A star map in Berland is a checked field *n*<=×<=*m* squares. In each square there is or there is not a star. The favourite constellation of all Berland's astronomers is the constellation of the Cross. This constellation can be formed by any 5 stars so, that for some integer *x* (radius of the constellation) the follow... | {"inputs": ["5 6 1\n....*.\n...***\n....*.\n..*...\n.***..", "5 6 2\n....*.\n...***\n....*.\n..*...\n.***..", "5 5 1\n.....\n.....\n.*..*\n*.*..\n....*", "5 5 3\n*.***\n.****\n..***\n*.***\n.**.*", "10 10 6\n.*..**.**.\n**********\n****.*****\n**.***....\n***.******\n****.**..*\n**.**.****\n****.**..*\n..**.**.*.\n.*.*... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
10283a6443b1aa148146d9713d2ec662 | none | This is an interactive problem. In the output section below you will see the information about flushing the output.
Bear Limak thinks of some hidden number — an integer from interval [2,<=100]. Your task is to say if the hidden number is prime or composite.
Integer *x*<=><=1 is called prime if it has exactly two d... | {"inputs": ["30", "59", "2", "7", "9", "13", "55", "89", "3", "4", "6", "8", "11", "12", "25", "36", "46", "47", "49", "51", "53", "59", "64", "81", "91", "93", "94", "95", "96", "97", "99", "100", "26", "94", "25", "46", "49", "82", "87", "85", "74", "86", "93", "58", "47", "22", "23", "62", "38", "91", "34", "95", "4... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 65 | codeforces | |
102e033fa305ffe7eb4ac9cd64298025 | Towers | Little Vasya has received a young builder’s kit. The kit consists of several wooden bars, the lengths of all of them are known. The bars can be put one on the top of the other if their lengths are the same.
Vasya wants to construct the minimal number of towers from the bars. Help Vasya to use the bars in the best way ... | {"inputs": ["3\n1 2 3", "4\n6 5 6 7", "4\n3 2 1 1", "4\n1 2 3 3", "3\n20 22 36", "25\n47 30 94 41 45 20 96 51 110 129 24 116 9 47 32 82 105 114 116 75 154 151 70 42 162", "45\n802 664 442 318 318 827 417 878 711 291 231 414 807 553 657 392 279 202 386 606 465 655 658 112 887 15 25 502 95 44 679 775 942 609 209 871 31 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 790 | codeforces | |
1040a7cfb73d4e95e9ff68875b67993c | Two Buttons | Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multiplies the displayed number by two. After clicking the blue button, device subtracts one from the number on the display. If at so... | {"inputs": ["4 6", "10 1", "1 2", "2 1", "1 3", "3 1", "2 10", "100 99", "99 100", "10 17", "666 6666", "6666 666", "1 8192", "1 8193", "9999 10000", "10000 9999", "10000 1", "1234 5678", "9102 9103", "8192 1", "9912 1023", "100 500", "9997 9999", "5000 10000", "4000 7997", "1 10000", "1 8191", "9999 10000", "9097 9998... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 68 | codeforces | |
1047525a13a957e0b64cc5b18b0b5e81 | Candies | Polycarpus has got *n* candies and *m* friends (*n*<=≥<=*m*). He wants to make a New Year present with candies to each friend. Polycarpus is planning to present all candies and he wants to do this in the fairest (that is, most equal) manner. He wants to choose such *a**i*, where *a**i* is the number of candies in the *... | {"inputs": ["12 4", "15 6", "18 8", "1 1", "2 1", "100 1", "100 100", "100 10", "64 8", "81 27", "100 99", "100 51", "100 49", "100 13", "97 11", "19 3", "99 10", "88 5", "87 34", "97 55"], "outputs": ["3 3 3 3 ", "2 2 2 3 3 3 ", "2 2 2 2 2 2 3 3 ", "1 ", "2 ", "100 ", "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... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 355 | codeforces | |
105128009fdb4d359d3d6d3777c9553b | Students in Railway Carriage | There are $n$ consecutive seat places in a railway carriage. Each place is either empty or occupied by a passenger.
The university team for the Olympiad consists of $a$ student-programmers and $b$ student-athletes. Determine the largest number of students from all $a+b$ students, which you can put in the railway carri... | {"inputs": ["5 1 1\n*...*", "6 2 3\n*...*.", "11 3 10\n.*....**.*.", "3 2 3\n***", "9 5 3\n*...*...*", "9 2 4\n*...*...*", "9 2 200000\n*...*...*", "1 0 1\n.", "14 3 7\n.*.......*..*.", "6 1 3\n*....*", "5 1 2\n...*.", "2 2 0\n..", "2 0 2\n..", "5 3 3\n...**", "3 0 1\n.*.", "13 3 3\n*...*...*...*", "7 0 4\n...*..*", "2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 75 | codeforces | |
1057717c0867a122f0a8018ba7fd151e | Lizard Era: Beginning | In the game Lizard Era: Beginning the protagonist will travel with three companions: Lynn, Meliana and Worrigan. Overall the game has *n* mandatory quests. To perform each of them, you need to take exactly two companions.
The attitude of each of the companions to the hero is an integer. Initially, the attitude of each... | {"inputs": ["3\n1 0 0\n0 1 0\n0 0 1", "7\n0 8 9\n5 9 -2\n6 -8 -7\n9 4 5\n-4 -9 9\n-4 5 2\n-6 8 -7", "2\n1 0 0\n1 1 0", "25\n26668 10412 12658\n25216 11939 10247\n28514 22515 5833\n4955 19029 22405\n12552 6903 19634\n12315 1671 505\n20848 9175 6060\n12990 5827 16433\n9184 30621 25596\n31818 7826 11221\n18090 4476 30078\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
105e3758d5f44e0c1bef1b8e45b47ba2 | Rectangle Puzzle II | You are given a rectangle grid. That grid's size is *n*<=×<=*m*. Let's denote the coordinate system on the grid. So, each point on the grid will have coordinates — a pair of integers (*x*,<=*y*) (0<=≤<=*x*<=≤<=*n*,<=0<=≤<=*y*<=≤<=*m*).
Your task is to find a maximum sub-rectangle on the grid (*x*1,<=*y*1,<=*x*2,<=*y*2... | {"inputs": ["9 9 5 5 2 1", "100 100 52 50 46 56", "100 100 16 60 42 75", "100 100 28 22 47 50", "100 100 44 36 96 21", "100 100 56 46 1 47", "100 100 20 53 6 22", "100 100 32 63 2 41", "100 100 48 73 63 16", "100 100 13 59 14 20", "36830763 28058366 30827357 20792295 11047103 20670351", "87453374 60940601 74141787 3214... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
1072a16321aa47d4398947c1354d3c62 | Games on a CD | Several years ago Tolya had *n* computer games and at some point of time he decided to burn them to CD. After that he wrote down the names of the games one after another in a circle on the CD in clockwise order. The names were distinct, the length of each name was equal to *k*. The names didn't overlap.
Thus, there is... | {"inputs": ["3 1\nabc\n4\nb\na\nc\nd", "4 2\naabbccdd\n4\ndd\nab\nbc\ncd", "2 2\nkdcj\n4\ncj\nkd\njk\ndc", "10 10\nlgfrjgityzwtmfyygmpsmokiwphewhpoelsvnctwxmpimqvblgrisozncsidqlqzovrzlgvneovgvkjoxvprlqhlgokaooflsiih\n20\ngvkjoxvprl\nihlgfrjgit\nygmpsmokiw\nphewhpoels\nqhlgokaoof\nrzlgvneovg\ngityzwtmfy\nvnctwxmpim\nmqv... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
1085303f1d6a1301030c5bec6cc8f050 | Race | The Old City is a rectangular city represented as an *m*<=×<=*n* grid of blocks. This city contains many buildings, straight two-way streets and junctions. Each junction and each building is exactly one block. All the streets have width of one block and are either vertical or horizontal. There is a junction on both sid... | {"inputs": ["3 10 12\n##########\n#z1a1111b#\n##########\n2 3 ab 2 8", "10 3 5\n###\n#w#\n#1#\n#a#\n#1#\n#1#\n#1#\n#1#\n#b#\n###\n3 2 abababababababab 6 2", "3 10 6\n##########\n#z1a1311b#\n##########\n2 3 ab 2 8", "14 14 187\n##############\n##############\n##############\n##############\n#####a5284b7c#\n#####1####7#7... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
10b1b7f6e837f3a28641aed3a8d8cfd6 | Washer, Dryer, Folder | You have *k* pieces of laundry, each of which you want to wash, dry and fold. You are at a laundromat that has *n*1 washing machines, *n*2 drying machines and *n*3 folding machines. Each machine can process only one piece of laundry at a time. You can't dry a piece of laundry before it is washed, and you can't fold it ... | {"inputs": ["1 1 1 1 5 5 5", "8 4 3 2 10 5 2", "10000 1000 1000 1000 1000 1000 1000", "8 3 4 3 10 9 4", "5 2 4 5 9 9 6", "4 5 1 2 4 6 2", "11 5 5 1 9 6 8", "1 3 2 2 5 2 8", "2933 578 144 393 710 699 874", "2460 502 99 260 659 409 586", "1444 75 246 287 64 416 2", "4076 135 200 961 469 286 418", "7251 708 347 932 65 292... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
10cc24a3b490499bfd4553c68f068241 | Local Extrema | You are given an array *a*. Some element of this array *a**i* is a local minimum iff it is strictly less than both of its neighbours (that is, *a**i*<=<<=*a**i*<=-<=1 and *a**i*<=<<=*a**i*<=+<=1). Also the element can be called local maximum iff it is strictly greater than its neighbours (that is, *a**i*<=><=*... | {"inputs": ["3\n1 2 3", "4\n1 5 2 5", "1\n1", "1\n548", "2\n1 1", "3\n3 2 3", "2\n1 1000", "3\n1 2 1"], "outputs": ["0", "2", "0", "0", "0", "1", "0", "1"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 250 | codeforces | |
1110f42e88d5749b1b194cda75112c7e | Cosmic Tables | The Free Meteor Association (FMA) has got a problem: as meteors are moving, the Universal Cosmic Descriptive Humorous Program (UCDHP) needs to add a special module that would analyze this movement.
UCDHP stores some secret information about meteors as an *n*<=×<=*m* table with integers in its cells. The order of mete... | {"inputs": ["3 3 5\n1 2 3\n4 5 6\n7 8 9\ng 3 2\nr 3 2\nc 2 3\ng 2 2\ng 3 2", "2 3 3\n1 2 4\n3 1 5\nc 2 1\nr 1 2\ng 1 3", "1 1 15\n1\ng 1 1\ng 1 1\ng 1 1\ng 1 1\ng 1 1\ng 1 1\ng 1 1\ng 1 1\ng 1 1\ng 1 1\ng 1 1\ng 1 1\ng 1 1\ng 1 1\ng 1 1", "1 2 3\n1 2\nc 1 2\ng 1 1\ng 1 2", "2 2 6\n1 2\n3 4\nc 1 2\nr 1 2\ng 1 1\ng 1 2\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 17 | codeforces | |
1117c37e54f15529eba3946a452af50b | 123-sequence | There is a given sequence of integers *a*1,<=*a*2,<=...,<=*a**n*, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other.
The first line contains an integer *n* (1<=≤<=*n*<=≤<=106). The second line contains a... | {"inputs": ["9\n1 3 2 2 2 1 1 2 3", "6\n3 3 2 2 1 3", "12\n3 1 3 1 2 1 3 2 2 1 2 1", "15\n3 2 1 1 1 1 3 2 2 3 3 1 2 3 2", "2\n2 1", "2\n3 2", "2\n3 1", "18\n2 3 2 1 2 3 2 1 2 3 3 3 1 2 3 3 3 2", "30\n2 1 3 2 3 2 2 2 2 3 2 2 3 2 1 1 3 1 3 2 1 2 3 1 1 3 3 1 3 1", "1\n1", "1\n2", "1\n3"], "outputs": ["5", "3", "7", "10", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 327 | codeforces | |
11378dd44866f43b807db4d6e54786f9 | Game | Allen and Bessie are playing a simple number game. They both know a function $f: \{0, 1\}^n \to \mathbb{R}$, i. e. the function takes $n$ binary arguments and returns a real value. At the start of the game, the variables $x_1, x_2, \dots, x_n$ are all set to $-1$. Each round, with equal probability, one of Allen or Bes... | {"inputs": ["2 2\n0 1 2 3\n2 5\n0 4", "1 0\n2 3", "2 0\n1 1 1 1"], "outputs": ["1.500000\n2.250000\n3.250000", "2.500000", "1.000000"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
113eb2e2363de9dd2354a2f80ef3e77c | The Great Julya Calendar | Yet another Armageddon is coming! This time the culprit is the Julya tribe calendar.
The beavers in this tribe knew math very well. Smart Beaver, an archaeologist, got a sacred plate with a magic integer on it. The translation from Old Beaverish is as follows:
"May the Great Beaver bless you! May your chacres open ... | {"inputs": ["24", "0", "3", "8", "9", "10", "31", "701", "222", "156", "12343", "7984", "1000000", "1", "3", "5", "11", "77", "216", "1468", "1995", "11010", "47320", "258634"], "outputs": ["5", "0", "1", "1", "1", "2", "6", "116", "39", "28", "1778", "1178", "128207", "1", "1", "1", "3", "14", "37", "233", "305", "156... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 236 | codeforces | |
113ec2417613db6fa12611d3704da165 | Anton and currency you all know | Berland, 2016. The exchange rate of currency you all know against the burle has increased so much that to simplify the calculations, its fractional part was neglected and the exchange rate is now assumed to be an integer.
Reliable sources have informed the financier Anton of some information about the exchange rate of... | {"inputs": ["527", "4573", "1357997531", "444443", "22227", "24683", "11", "1435678543", "4250769", "4052769", "5685341", "1111111111111111231", "333333332379", "85", "7700016673", "35451519805848712272404365322858764249299938505103", "431475227769199162773068613469229242215575346594802589770170386244583704592998475909... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 83 | codeforces | |
1151407dedf0eca70322463ffde4a040 | Arpa and an exam about geometry | Arpa is taking a geometry exam. Here is the last problem of the exam.
You are given three points *a*,<=*b*,<=*c*.
Find a point and an angle such that if we rotate the page around the point by the angle, the new position of *a* is the same as the old position of *b*, and the new position of *b* is the same as the old ... | {"inputs": ["0 1 1 1 1 0", "1 1 0 0 1000 1000", "1 0 2 0 3 0", "3 4 0 0 4 3", "-1000000000 1 0 0 1000000000 1", "49152 0 0 0 0 81920", "1 -1 4 4 2 -3", "-2 -2 1 4 -2 0", "5 0 4 -2 0 1", "-4 -3 2 -1 -3 4", "-3 -3 5 2 3 -1", "-1000000000 -1000000000 0 0 1000000000 999999999", "-1000000000 -1000000000 0 0 1000000000 10000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 84 | codeforces | |
115825905aae4a75d5ae8efd5fd5deda | Network Topology | This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.
Polycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of *n* computers, some of them... | {"inputs": ["4 3\n1 2\n2 3\n3 4", "4 4\n1 2\n2 3\n3 4\n4 1", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n2 3\n3 1\n1 4", "5 4\n1 2\n3 5\n1 4\n5 4", "5 5\n3 4\n5 2\n2 1\n5 4\n3 1", "5 4\n4 2\n5 2\n1 2\n2 3", "5 9\n5 3\n4 5\n3 1\n3 2\n2 1\n2 5\n1 5\n1 4\n4 2", "4 3\n2 4\n1 3\n4 1", "4 4\n2 4\n4 1\n1 3\n2 3", "4 3\n1 2\n2 4\n3 2", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 131 | codeforces | |
1161687473cc8d5e3083ca002aaaffda | Array Queries | *a* is an array of *n* positive integers, all of which are not greater than *n*.
You have to process *q* queries to this array. Each query is represented by two numbers *p* and *k*. Several operations are performed in each query; each operation changes *p* to *p*<=+<=*a**p*<=+<=*k*. There operations are applied until ... | {"inputs": ["3\n1 1 1\n3\n1 1\n2 1\n3 1", "10\n3 5 4 3 7 10 6 7 2 3\n10\n4 5\n2 10\n4 6\n9 9\n9 2\n5 1\n6 4\n1 1\n5 6\n6 4", "50\n6 2 5 6 10 2 5 8 9 2 9 5 10 4 3 6 10 6 1 1 3 7 2 1 7 8 5 9 6 2 7 6 1 7 2 10 10 2 4 2 8 4 3 10 7 1 7 8 6 3\n50\n23 8\n12 8\n3 3\n46 3\n21 6\n7 4\n26 4\n12 1\n25 4\n18 7\n29 8\n27 5\n47 1\n50 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
116948838e1fa56269475f9485f3b01d | Shake It! | A never-ending, fast-changing and dream-like world unfolds, as the secret door opens.
A world is an unordered graph *G*, in whose vertex set *V*(*G*) there are two special vertices *s*(*G*) and *t*(*G*). An initial world has vertex set {*s*(*G*),<=*t*(*G*)} and an edge between them.
A total of *n* changes took place ... | {"inputs": ["3 2", "4 4", "7 3", "31 8", "1 1", "10 2", "33 22", "50 50", "1 2", "1 3", "2 1", "2 2", "2 3", "3 1", "3 3", "3 4", "4 1", "4 2", "4 3", "4 5", "5 1", "5 2", "5 3", "5 4", "5 5", "5 6", "6 1", "6 2", "6 3", "6 4", "6 5", "6 6", "6 7", "7 1", "7 2", "7 4", "7 5", "7 6", "7 7", "7 8", "8 5", "9 2", "10 4", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
11baceb65703f5fa83aa13b9e1e98724 | Free Ice Cream | After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.
At the start of the day they have *x* ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the... | {"inputs": ["5 7\n+ 5\n- 10\n- 20\n+ 40\n- 20", "5 17\n- 16\n- 2\n- 98\n+ 100\n- 98", "6 1000000000\n+ 1000000000\n+ 1000000000\n+ 1000000000\n+ 1000000000\n+ 1000000000\n+ 1000000000", "5 12\n- 12\n+ 7\n- 6\n- 1\n+ 46", "11 1000\n- 100\n+ 100\n+ 100\n+ 100\n+ 100\n- 100\n- 100\n- 100\n- 100\n- 100\n- 100", "1 0\n- 526... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1,058 | codeforces | |
11bd126ec7b33ec1ee8b4f3a44b88d55 | Devu and Flowers | Devu wants to decorate his garden with flowers. He has purchased *n* boxes, where the *i*-th box contains *f**i* flowers. All flowers in a single box are of the same color (hence they are indistinguishable). Also, no two boxes have flowers of the same color.
Now Devu wants to select exactly *s* flowers from the boxes ... | {"inputs": ["2 3\n1 3", "2 4\n2 2", "3 5\n1 3 2", "2 270030023747\n891135146290 437305641972", "20 4385085334307\n273634411136 208521328637 450482376435 844118010709 197241285878 472126475472 2414038897 672334205413 809269727018 409013884362 739986692075 953956651947 462216461906 388007176838 245504550965 527140291750 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
11bfc921b8411694b749730a04000c16 | Game | Vasya and Petya have invented a new game. Vasya takes a stripe consisting of 1<=×<=*n* square and paints the squares black and white. After that Petya can start moves — during a move he may choose any two neighboring squares of one color and repaint these two squares any way he wants, perhaps in different colors. Petya... | {"inputs": ["6\n111010", "5\n10001", "7\n1100010", "5\n00100", "3\n101", "6\n111111", "6\n000000", "10\n1000101001", "100\n1001001000011010001101000011100101101110101001110110010001110011011100111000010010011011101000011101", "100\n0000000000100000000000000000000000000000000000000000000000000000000000000000000000000000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 31 | codeforces | |
11c1c0b65c6949532970769144a92a59 | Idempotent functions | Some time ago Leonid have known about idempotent functions. Idempotent function defined on a set {1,<=2,<=...,<=*n*} is such function , that for any the formula *g*(*g*(*x*))<==<=*g*(*x*) holds.
Let's denote as *f*(*k*)(*x*) the function *f* applied *k* times to the value *x*. More formally, *f*(1)(*x*)<==<=*f*(*x*),... | {"inputs": ["4\n1 2 2 4", "3\n2 3 3", "3\n2 3 1", "1\n1", "16\n1 4 13 9 11 16 14 6 5 12 7 8 15 2 3 10", "20\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20", "20\n11 14 2 10 17 5 9 6 18 3 17 7 4 15 17 1 4 14 10 11", "100\n46 7 63 48 75 82 85 90 65 23 36 96 96 29 76 67 26 2 72 76 18 30 48 98 100 61 55 74 18 28 36 89... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 12 | codeforces | |
11e1871581824dfb08ec542251c5ca25 | Travel Cards | In the evening Polycarp decided to analyze his today's travel expenses on public transport.
The bus system in the capital of Berland is arranged in such a way that each bus runs along the route between two stops. Each bus has no intermediate stops. So each of the buses continuously runs along the route from one stop t... | {"inputs": ["3 5 3 1 8\nBerBank University\nUniversity BerMall\nUniversity BerBank", "4 2 1 300 1000\na A\nA aa\naa AA\nAA a", "2 2 1 0 1\naca BCBA\nBCBA aca", "2 2 1 2 1\nBDDB C\nC BDDB", "2 3 1 1 9\nbacAB aAdb\nbacAB aAdb", "2 3 1 4 6\nAaCdC CdD\naBACc CdD", "1 2 1 2 1\nC BA", "1 3 1 1 4\nbCCCC BC", "1 4 3 1 1\nC bC"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
1227949a1bf9ddb09337a57819e135a2 | Exams | Vasiliy has an exam period which will continue for *n* days. He has to pass exams on *m* subjects. Subjects are numbered from 1 to *m*.
About every day we know exam for which one of *m* subjects can be passed on that day. Perhaps, some day you can't pass any exam. It is not allowed to pass more than one exam on any da... | {"inputs": ["7 2\n0 1 0 2 1 0 2\n2 1", "10 3\n0 0 1 2 3 0 2 0 1 2\n1 1 4", "5 1\n1 1 1 1 1\n5", "100 10\n1 1 6 6 6 2 5 7 6 5 3 7 10 10 8 9 7 6 9 2 6 7 8 6 7 5 2 5 10 1 10 1 8 10 2 9 7 1 6 8 3 10 9 4 4 8 8 6 6 1 5 5 6 5 6 6 6 9 4 7 5 4 6 6 1 1 2 1 8 10 6 2 1 7 2 1 8 10 9 2 7 3 1 5 10 2 8 10 10 10 8 9 5 4 6 10 8 9 6 6\n2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 7 | codeforces | |
1242b7a42964481d8e4bbc5e3d3435d6 | Greenhouse Effect | Emuskald is an avid horticulturist and owns the world's longest greenhouse — it is effectively infinite in length.
Over the years Emuskald has cultivated *n* plants in his greenhouse, of *m* different plant species numbered from 1 to *m*. His greenhouse is very narrow and can be viewed as an infinite line, with each p... | {"inputs": ["3 2\n2 1\n1 2.0\n1 3.100", "3 3\n1 5.0\n2 5.5\n3 6.0", "6 3\n1 14.284235\n2 17.921382\n1 20.328172\n3 20.842331\n1 25.790145\n1 27.204125", "1 1\n1 0", "8 2\n1 0.000000\n1 1.000000\n1 2.000000\n2 2.000001\n1 999999997.000000\n2 999999998.000000\n2 999999999.999999\n2 1000000000.000000", "15 5\n4 6.039627\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 28 | codeforces | |
1265110d8fb5c19020abe0903ee7b295 | LLPS | This problem's actual name, "Lexicographically Largest Palindromic Subsequence" is too long to fit into the page headline.
You are given string *s* consisting of lowercase English letters only. Find its lexicographically largest palindromic subsequence.
We'll call a non-empty string *s*[*p*1*p*2... *p**k*] = *s**p*1*... | {"inputs": ["radar", "bowwowwow", "codeforces", "mississipp", "tourist", "romka", "helloworld", "zzzzzzzazz", "testcase", "hahahahaha", "abbbbbbbbb", "zaz", "aza", "dcbaedcba", "abcdeabcd", "edcbabcde", "aaaaaaaaab", "testzzzzzz", "zzzzzzwait", "rrrrrqponm", "zzyzyy", "aababb", "zanzibar", "hhgfedcbaa", "aabcdefghh", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 713 | codeforces | |
127271f32b49adfdbf73c1c5f1ee489a | Turn the Rectangles | There are $n$ rectangles in a row. You can either turn each rectangle by $90$ degrees or leave it as it is. If you turn a rectangle, its width will be height, and its height will be width. Notice that you can turn any number of rectangles, you also can turn all or none of them. You can not change the order of the recta... | {"inputs": ["3\n3 4\n4 6\n3 5", "2\n3 4\n5 5", "10\n4 3\n1 1\n6 5\n4 5\n2 4\n9 5\n7 9\n9 2\n4 10\n10 1", "10\n241724251 76314740\n80658193 177743680\n213953908 406274173\n485639518 859188055\n103578427 56645210\n611931853 374099541\n916667853 408945969\n677773241 808703176\n575586508 440395988\n450102404 244301685", "1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 34 | codeforces | |
12785439f019574c6379b2557b4c2af2 | Love Triangle | As you could know there are no male planes nor female planes. However, each plane on Earth likes some other plane. There are *n* planes on Earth, numbered from 1 to *n*, and the plane with number *i* likes the plane with number *f**i*, where 1<=≤<=*f**i*<=≤<=*n* and *f**i*<=≠<=*i*.
We call a love triangle a situation ... | {"inputs": ["5\n2 4 5 1 3", "5\n5 5 5 5 1", "3\n3 1 2", "10\n4 10 9 5 3 1 5 10 6 4", "10\n5 5 4 9 10 9 9 5 3 1", "100\n50 40 60 87 39 58 44 84 46 68 16 57 77 87 92 95 42 31 74 15 36 84 30 3 47 15 87 90 76 66 6 63 74 19 40 49 6 84 41 9 77 34 7 12 11 73 58 24 81 14 81 29 65 100 1 85 64 32 38 4 54 67 32 81 80 7 100 71 29 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 490 | codeforces | |
1290054e6b5f04220016c64ece88f5db | Boy or Girl | Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so). After that they talked very often and eventually they became a couple in the network.
Bu... | {"inputs": ["wjmzbmr", "xiaodao", "sevenkplus", "pezu", "wnemlgppy", "zcinitufxoldnokacdvtmdohsfdjepyfioyvclhmujiqwvmudbfjzxjfqqxjmoiyxrfsbvseawwoyynn", "qsxxuoynwtebujwpxwpajitiwxaxwgbcylxneqiebzfphugwkftpaikixmumkhfbjiswmvzbtiyifbx", "qwbdfzfylckctudyjlyrtmvbidfatdoqfmrfshsqqmhzohhsczscvwzpwyoyswhktjlykumhvaounpzwpxc... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 595 | codeforces | |
12ac6ee7b374eaba6ddb61a68ebddee3 | Reberland Linguistics | First-rate specialists graduate from Berland State Institute of Peace and Friendship. You are one of the most talented students in this university. The education is not easy because you need to have fundamental knowledge in different areas, which sometimes are not related to each other.
For example, you should know l... | {"inputs": ["abacabaca", "abaca", "gzqgchv", "iosdwvzerqfi", "oawtxikrpvfuzugjweki", "abcdexyzzzz", "affviytdmexpwfqplpyrlniprbdphrcwlboacoqec", "lmnxtobrknqjvnzwadpccrlvisxyqbxxmghvl", "tbdbdpkluawodlrwldjgplbiylrhuywkhafbkiuoppzsjxwbaqqiwagprqtoauowtaexrhbmctcxwpmplkyjnpwukzwqrqpv", "caqmjjtwmqxytcsawfufvlofqcqdwnyvy... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 22 | codeforces | |
12be6f6b6f79389b9d1b141176a2b327 | Unordered Subsequence | The sequence is called ordered if it is non-decreasing or non-increasing. For example, sequnces [3, 1, 1, 0] and [1, 2, 3, 100] are ordered, but the sequence [1, 3, 3, 1] is not. You are given a sequence of numbers. You are to find it's shortest subsequence which is not ordered.
A subsequence is a sequence that can be... | {"inputs": ["3\n3 1 2", "1\n-895376", "2\n166442 61629", "3\n-771740 -255752 -300809", "4\n-227347 -573134 -671045 11011", "5\n834472 -373089 441294 -633071 -957672", "2\n7 8"], "outputs": ["3\n1 2 3", "0", "0", "3\n1 2 3", "3\n2 3 4", "3\n1 2 3", "0"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 20 | codeforces | |
12d93ca6906e39940b5ee321de7f9ae7 | Postcards and photos | Polycarpus has postcards and photos hung in a row on the wall. He decided to put them away to the closet and hang on the wall a famous painter's picture. Polycarpus does it like that: he goes from the left to the right and removes the objects consecutively. As Polycarpus doesn't want any mix-ups to happen, he will not ... | {"inputs": ["CPCPCPC", "CCCCCCPPPPPP", "CCCCCCPPCPPPPPPPPPP", "CCCCCCCCCC", "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC", "CPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCPCP", "CCCCCCPPPPPPCCCCCCPPPPPPCCCCCCPPPPP... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 133 | codeforces | |
13056962b3f1cb803ad09d79e4bde485 | Primes on Interval | You've decided to carry out a survey in the theory of prime numbers. Let us remind you that a prime number is a positive integer that has exactly two distinct positive integer divisors.
Consider positive integers *a*, *a*<=+<=1, ..., *b* (*a*<=≤<=*b*). You want to find the minimum integer *l* (1<=≤<=*l*<=≤<=*b*<=-<=*a... | {"inputs": ["2 4 2", "6 13 1", "1 4 3", "5 8 2", "8 10 3", "1 5 2", "6 8 3", "21 29 2", "17 27 3", "1 1000000 10000", "690059 708971 10000", "12357 534133 2", "838069 936843 3", "339554 696485 4", "225912 522197 5", "404430 864261 6", "689973 807140 7", "177146 548389 8", "579857 857749 9", "35648 527231 10", "2 100000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 27 | codeforces | |
1334299b4247da2d1bdae5974c6fcb0f | Red and Blue Balls | User ainta has a stack of *n* red and blue balls. He can apply a certain operation which changes the colors of the balls inside the stack.
- While the top ball inside the stack is red, pop the ball from the top of the stack. - Then replace the blue ball on the top with a red ball. - And finally push some blue balls... | {"inputs": ["3\nRBR", "4\nRBBR", "5\nRBBRR", "5\nRBRBR", "10\nRRBRRBBRRR", "10\nBRBRRRRRRR", "10\nBRRRRRRRRR", "20\nBRBRRRRRRRRRRRRRRRRR", "30\nRRBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "50\nBRRRBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "20\nRRRBRBBBBBRRRRRRRRRR", "20\nRRBRBBBBBRRRRRRRRRRR", "1\nR", "1\nB", "2\nRR", "2\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 64 | codeforces | |
13448478d4e49c8e2d1caa3ff518b3c1 | Valera and Antique Items | Valera is a collector. Once he wanted to expand his collection with exactly one antique item.
Valera knows *n* sellers of antiques, the *i*-th of them auctioned *k**i* items. Currently the auction price of the *j*-th object of the *i*-th seller is *s**ij*. Valera gets on well with each of the *n* sellers. He is perfec... | {"inputs": ["3 50000\n1 40000\n2 20000 60000\n3 10000 70000 190000", "3 50000\n1 50000\n3 100000 120000 110000\n3 120000 110000 120000", "2 100001\n1 895737\n1 541571", "1 1000000\n1 1000000", "1 1000000\n1 561774", "3 1000000\n5 1000000 568832 1000000 1000000 1000000\n13 1000000 1000000 1000000 596527 1000000 1000000 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 294 | codeforces | |
134adde1602a65ae3022bdcfbb7f3925 | Life Without Zeros | Can you imagine our life if we removed all zeros from it? For sure we will have many problems.
In this problem we will have a simple example if we removed all zeros from our life, it's the addition operation. Let's assume you are given this equation *a*<=+<=*b*<==<=*c*, where *a* and *b* are positive integers, and *c*... | {"inputs": ["101\n102", "105\n106", "544\n397", "822\n280", "101\n413", "309\n139", "693\n970", "981\n1", "352\n276", "164\n691", "110036\n43", "100\n1000", "1000000000\n1000000000", "999999999\n999999999", "6\n4", "123456\n876543", "1234567\n9876543", "1111111\n1119111", "10502405\n40403403", "1\n1", "5\n4", "1\n6", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 625 | codeforces | |
134e58b9e1ffbdb158576f17eed68543 | Substring and Subsequence | One day Polycarpus got hold of two non-empty strings *s* and *t*, consisting of lowercase Latin letters. Polycarpus is quite good with strings, so he immediately wondered, how many different pairs of "*x* *y*" are there, such that *x* is a substring of string *s*, *y* is a subsequence of string *t*, and the content of ... | {"inputs": ["aa\naa", "codeforces\nforceofcode", "coderscontest\ncodeforces", "a\nb", "ab\nbbbba", "abbbccbba\nabcabc", "zxzxzxzxzxzxzx\nd", "pfdempfohomnpgbeegikfmflnalbbajpnpgeacaicoehopgnabnklheepnlnflohjegcciflmfjhachnhekckfjgoffhkblncidn\nidlhklpclcghngeggpjdgefccihndpoikojdjnbkdfjgaanoolfmnifnmbpeeghpicehjdiipnlf... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
1354c407fb01914d81f781d3516fb837 | Sleuth | Vasya plays the sleuth with his friends. The rules of the game are as follows: those who play for the first time, that is Vasya is the sleuth, he should investigate a "crime" and find out what is happening. He can ask any questions whatsoever that can be answered with "Yes" or "No". All the rest agree beforehand to ans... | {"inputs": ["Is it a melon?", "Is it an apple?", " Is it a banana ?", "Is it an apple and a banana simultaneouSLY?", "oHtSbDwzHb?", "sZecYdUvZHrXx?", "uMtXK?", "U?", "aqFDkCUKeHMyvZFcAyWlMUSQTFomtaWjoKLVyxLCw vcufPBFbaljOuHWiDCROYTcmbgzbaqHXKPOYEbuEtRqqoxBbOETCsQzhw?", "dJcNqQiFXzcbsj fItCpBLyXOnrSBPebwyFHlx... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 536 | codeforces | |
138d94919a947e94d844bc2c1441a473 | Title | Vasya has recently finished writing a book. Now he faces the problem of giving it the title. Vasya wants the title to be vague and mysterious for his book to be noticeable among others. That's why the title should be represented by a single word containing at least once each of the first *k* Latin letters and not conta... | {"inputs": ["3\na?c", "2\na??a", "2\n?b?a", "3\n????", "2\n????", "1\n?", "2\n?", "6\nabcdeffcdfda", "1\n?a", "23\napfpbfgmiko?mno?qre??cv?wvjt?r?foqm??op?g?udcfa", "16\n?bc??f?hi?k??n??hb??liiglal???npi???b???p?n?j?al????j???ponmlkjih??e??b?", "23\na??d??g?i????n????????wj?spqbfr?wp?ob?g??h??r?????orf?q?s??w?u?srqp?n?... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
138f4354a7cd017a0367d09d328aee4e | Another Sith Tournament | The rules of Sith Tournament are well known to everyone. *n* Sith take part in the Tournament. The Tournament starts with the random choice of two Sith who will fight in the first battle. As one of them loses, his place is taken by the next randomly chosen Sith who didn't fight before. Does it need to be said that each... | {"inputs": ["3\n0.0 0.5 0.8\n0.5 0.0 0.4\n0.2 0.6 0.0", "1\n0.0", "2\n0.00 0.75\n0.25 0.00", "4\n0.0 0.6 0.5 0.4\n0.4 0.0 0.3 0.8\n0.5 0.7 0.0 0.5\n0.6 0.2 0.5 0.0", "4\n0.0 0.3 0.5 0.6\n0.7 0.0 0.1 0.4\n0.5 0.9 0.0 0.6\n0.4 0.6 0.4 0.0", "2\n0.0 0.0\n1.0 0.0", "2\n0.0 1.0\n0.0 0.0", "5\n0.0 0.3 0.4 0.5 0.6\n0.7 0.0 0.... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
13b28296e941bf4b38a92e234423bc69 | Resort | Valera's finally decided to go on holiday! He packed up and headed for a ski resort.
Valera's fancied a ski trip but he soon realized that he could get lost in this new place. Somebody gave him a useful hint: the resort has *n* objects (we will consider the objects indexed in some way by integers from 1 to *n*), each ... | {"inputs": ["5\n0 0 0 0 1\n0 1 2 3 4", "5\n0 0 1 0 1\n0 1 2 2 4", "4\n1 0 0 0\n2 3 4 2", "10\n0 0 0 0 0 0 0 0 0 1\n4 0 8 4 7 8 5 5 7 2", "50\n0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1 0\n28 4 33 22 4 35 36 31 42 25 50 33 25 36 18 23 23 28 43 3 18 31 1 2 15 22 40 4... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
13b7ef974745d76a78439919a6ed01eb | Mike and gcd problem | Mike has a sequence *A*<==<=[*a*1,<=*a*2,<=...,<=*a**n*] of length *n*. He considers the sequence *B*<==<=[*b*1,<=*b*2,<=...,<=*b**n*] beautiful if the *gcd* of all its elements is bigger than 1, i.e. .
Mike wants to change his sequence in order to make it beautiful. In one move he can choose an index *i* (1<=≤<=*i*<... | {"inputs": ["2\n1 1", "3\n6 2 4", "2\n1 3", "9\n57 30 28 81 88 32 3 42 25", "2\n8 77", "4\n92 46 3 21", "2\n78 26", "2\n3 6", "2\n3 9", "2\n3 3", "3\n3 6 3", "3\n3 9 15", "3\n3 6 9", "3\n3 3 3", "3\n3 9 18", "5\n1 2 1 2 1", "2\n9 6", "4\n3 6 9 12", "3\n3 9 27", "3\n3 9 12", "5\n6 6 9 15 21", "2\n5 15", "4\n2 3 9 13", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
13bdb1f2506b952ef6004ba0c77808ec | Inbox (100500) | Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread.
Alexey's mail program can either show a list of all letters or show the content of a single letter. As soon as the program shows the content of an unread letter, it becomes read letter (if the program shows... | {"inputs": ["5\n0 1 0 1 0", "5\n1 1 0 0 1", "2\n0 0", "9\n1 0 1 0 1 0 1 0 1", "5\n1 1 1 1 1", "14\n0 0 1 1 1 0 1 1 1 0 1 1 1 0", "23\n1 1 1 0 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1 1 1", "27\n0 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 0", "10\n1 0 0 0 0 1 0 0 0 1", "10\n1 0 0 1 0 0 1 1 0 1", "27\n0 0 0 0 0 0 0 0 0 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 209 | codeforces | |
13cbed0d2f029102bb46ecec65fe6d8d | Switches and Lamps | You are given *n* switches and *m* lamps. The *i*-th switch turns on some subset of the lamps. This information is given as the matrix *a* consisting of *n* rows and *m* columns where *a**i*,<=*j*<==<=1 if the *i*-th switch turns on the *j*-th lamp and *a**i*,<=*j*<==<=0 if the *i*-th switch is not connected to the *j*... | {"inputs": ["4 5\n10101\n01000\n00111\n10000", "4 5\n10100\n01000\n00110\n00101", "1 5\n11111", "10 1\n1\n0\n0\n0\n0\n0\n0\n0\n0\n1", "1 1\n1", "3 4\n1010\n0100\n1101", "2 5\n10101\n11111", "5 5\n10000\n11000\n11100\n11110\n11111", "2 5\n10000\n11111", "4 5\n01000\n10100\n00010\n10101", "2 2\n10\n11", "2 5\n00100\n1111... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 99 | codeforces | |
13ced2a3d8b5a62401f7b011c2f5576b | Simba on the Circle | You are given a circular array with *n* elements. The elements are numbered from some element with values from 1 to *n* in clockwise order. The *i*-th cell contains the value *a**i*. The robot Simba is in cell *s*.
Each moment of time the robot is in some of the *n* cells (at the begin he is in *s*). In one turn the r... | {"inputs": ["9 1\n0 1 2 2 2 1 0 1 1", "8 1\n0 1 0 1 0 1 0 1", "8 1\n1 2 3 4 5 6 7 8", "8 1\n0 0 0 0 0 0 0 0", "8 1\n0 1 2 2 1 0 1 1", "1 1\n4", "10 1\n-1 0 1 0 -1 1 0 0 1 -1", "20 7\n0 6 0 0 0 -7 -8 9 -7 4 7 2 -4 4 -5 2 6 8 -2 -7", "30 13\n68 50 99 23 84 23 24 -42 82 36 -10 -51 -96 96 19 -4 4 -41 74 92 13 58 26 79 -11 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
13d695394072750e82992d500f1bcc2c | Garden | Luba thinks about watering her garden. The garden can be represented as a segment of length *k*. Luba has got *n* buckets, the *i*-th bucket allows her to water some continuous subsegment of garden of length exactly *a**i* each hour. Luba can't water any parts of the garden that were already watered, also she can't wat... | {"inputs": ["3 6\n2 3 5", "6 7\n1 2 3 4 5 6", "5 97\n1 10 50 97 2", "5 97\n1 10 50 100 2", "100 100\n2 46 24 18 86 90 31 38 84 49 58 28 15 80 14 24 87 56 62 87 41 87 55 71 87 32 41 56 91 32 24 75 43 42 35 30 72 53 31 26 54 61 87 85 36 75 44 31 7 38 77 57 61 54 70 77 45 96 39 57 11 8 91 42 52 15 42 30 92 41 27 26 34 27 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 379 | codeforces | |
1406f44b358d0fb8fc59355a2bc1ea3e | Binary Table | You are given a table consisting of *n* rows and *m* columns. Each cell of the table contains either 0 or 1. In one move, you are allowed to pick any row or any column and invert all values, that is, replace 0 by 1 and vice versa.
What is the minimum number of cells with value 1 you can get after applying some number ... | {"inputs": ["3 4\n0110\n1010\n0111", "1 1\n0", "1 1\n1", "2 1\n0\n1", "1 2\n10", "2 2\n01\n10", "2 2\n11\n10", "2 2\n00\n00", "2 2\n00\n11", "3 3\n100\n010\n001", "3 9\n010100100\n101011011\n101011101", "8 3\n000\n001\n010\n100\n110\n011\n101\n111", "1 10\n0110010001", "9 1\n0\n1\n1\n0\n1\n0\n1\n0\n1", "4 5\n01010\n101... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
141fac17f61c95c45f5139058556a5cd | Four Segments | You are given an array of *n* integer numbers. Let *sum*(*l*,<=*r*) be the sum of all numbers on positions from *l* to *r* non-inclusive (*l*-th element is counted, *r*-th element is not counted). For indices *l* and *r* holds 0<=≤<=*l*<=≤<=*r*<=≤<=*n*. Indices in array are numbered from 0.
For example, if *a*<==<=[<... | {"inputs": ["3\n-1 2 3", "4\n0 0 -1 0", "1\n10000", "1\n-1", "1\n0", "10\n0 0 0 0 0 0 0 0 0 0", "100\n-1 -1 0 1 -1 0 0 -1 -1 1 1 0 1 0 -1 1 0 0 -1 0 0 0 1 0 0 1 1 1 1 0 -1 -1 0 0 0 1 1 -1 0 0 1 1 1 0 -1 -1 0 -1 0 -1 -1 0 1 0 1 -1 1 -1 -1 -1 0 0 -1 0 -1 -1 0 -1 1 1 -1 1 0 1 -1 -1 1 1 -1 1 0 -1 1 -1 1 1 1 1 1 -1 0 1 0 0 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
14224c4b4244d0fe292621f678e1422f | none | From beginning till end, this message has been waiting to be conveyed.
For a given unordered multiset of *n* lowercase English letters ("multi" means that a letter may appear more than once), we treat all letters as strings of length 1, and repeat the following operation *n*<=-<=1 times:
- Remove any two elements *s... | {"inputs": ["12", "3", "0", "2", "5", "10", "233", "418", "100000", "1", "4", "6", "7", "8", "9", "11", "1317", "1926", "14514", "25252", "99681", "99998", "82944", "831", "39393"], "outputs": ["abababab", "codeforces", "o", "aabb", "aaabbcc", "aaaaa", "ooououououououououooohhhhhhaaiiiiiibbjjjjjjcckkkkkkddlllllleemmmmm... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 35 | codeforces | |
142ca9504dab57200c552d5380ecc69f | Almost Acyclic Graph | You are given a [directed graph](https://en.wikipedia.org/wiki/Directed_graph) consisting of *n* vertices and *m* edges (each edge is directed, so it can be traversed in only one direction). You are allowed to remove at most one edge from it.
Can you make this graph [acyclic](https://en.wikipedia.org/wiki/Directed_acy... | {"inputs": ["3 4\n1 2\n2 3\n3 2\n3 1", "5 6\n1 2\n2 3\n3 2\n3 1\n2 1\n4 5", "2 2\n1 2\n2 1", "7 7\n1 3\n3 6\n3 7\n5 3\n6 2\n6 7\n7 2", "500 50\n396 340\n47 341\n422 140\n492 209\n263 248\n461 300\n124 495\n33 6\n93 384\n389 182\n130 297\n217 329\n131 136\n355 94\n388 275\n115 368\n279 462\n126 285\n185 287\n223 221\n20... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
143975608b5342cde4acac925204f195 | Little Elephant and Interval | The Little Elephant very much loves sums on intervals.
This time he has a pair of integers *l* and *r* (*l*<=≤<=*r*). The Little Elephant has to find the number of such integers *x* (*l*<=≤<=*x*<=≤<=*r*), that the first digit of integer *x* equals the last one (in decimal notation). For example, such numbers as 101, 4... | {"inputs": ["2 47", "47 1024", "1 1000", "1 10000", "47 8545", "1000 1000", "47547 4587554587754542", "1 1000000", "47 74", "10001 10000002", "10000 100000", "458754 4588754", "111 111", "110 147", "1 1000000000", "12 10000000000", "1000000000 1000000000", "1 1000000000000000000", "11 111111111111111100", "100000000000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 52 | codeforces | |
143bfa7b8d53e4b19209a18df9563490 | "Or" Game | You are given *n* numbers *a*1,<=*a*2,<=...,<=*a**n*. You can perform at most *k* operations. For each operation you can multiply one of the numbers by *x*. We want to make as large as possible, where denotes the bitwise OR.
Find the maximum possible value of after performing at most *k* operations optimally.
The ... | {"inputs": ["3 1 2\n1 1 1", "4 2 3\n1 2 4 8", "2 1 2\n12 9", "2 1 2\n12 7", "3 1 3\n3 2 0", "5 10 8\n1000000000 1000000000 1000000000 1000000000 1000000000", "1 2 3\n612635770", "3 2 5\n0 2 3", "2 1 8\n18 17", "5 10 8\n0 0 0 0 0", "1 1 2\n1", "1 1 2\n0", "3 2 6\n724148075 828984987 810015532", "3 1 2\n17 18 4", "3 1 2\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 22 | codeforces | |
1450da53095949ecb270a669f433444e | Hopscotch | So nearly half of the winter is over and Maria is dreaming about summer. She's fed up with skates and sleds, she was dreaming about Hopscotch all night long. It's a very popular children's game. The game field, the court, looks as is shown in the figure (all blocks are square and are numbered from bottom to top, blocks... | {"inputs": ["1 0 0", "3 1 1", "3 0 10", "3 0 7", "3 4 0", "9 3 2", "100 0 953748", "17 0 1000000", "17 15 99999", "55 -20 1000000", "1 154871 37516", "1 -1 0", "1 -1 1", "1 0 2", "1 0 552012", "1 1 293372", "1 -1 551084", "5 -744240 145890", "5 -4 2", "5 -5 7", "5 -3 14", "5 0 660386", "5 5 918098", "5 -5 659458", "10 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.