problem_id stringlengths 32 32 | name stringlengths 2 112 | problem stringlengths 200 14k | test_cases stringlengths 33 79.2M | difficulty stringclasses 34
values | language listlengths 1 1 | source stringclasses 15
values | num_solutions int64 1 1.12M | starter_code stringlengths 0 1.47k | subset stringclasses 4
values |
|---|---|---|---|---|---|---|---|---|---|
87f45615ea3832b39e3e4fb9c33c420c | Vitaly and Cycle | After Vitaly was expelled from the university, he became interested in the graph theory.
Vitaly especially liked the cycles of an odd length in which each vertex occurs at most once.
Vitaly was wondering how to solve the following problem. You are given an undirected graph consisting of *n* vertices and *m* edges, no... | {"inputs": ["4 4\n1 2\n1 3\n4 2\n4 3", "3 3\n1 2\n2 3\n3 1", "3 0", "6 3\n1 2\n4 3\n6 5", "100000 0", "5 4\n1 2\n1 3\n1 4\n1 5", "6 3\n1 2\n2 3\n4 5", "5 5\n1 2\n2 3\n3 4\n4 5\n5 1", "59139 0", "9859 0", "25987 0", "9411 0", "25539 0", "59139 1\n10301 5892", "9859 1\n1721 9478", "76259 0", "92387 0", "6 4\n1 2\n2 3\n3 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
87fa1fe92bd779cf0b2298740f0f708c | IQ test | Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given *n* numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob — to check his answers, he needs a program that among the given *n* numbers finds one that i... | {"inputs": ["5\n2 4 7 8 10", "4\n1 2 1 1", "3\n1 2 2", "3\n100 99 100", "3\n5 3 2", "4\n43 28 1 91", "4\n75 13 94 77", "4\n97 8 27 3", "10\n95 51 12 91 85 3 1 31 25 7", "20\n88 96 66 51 14 88 2 92 18 72 18 88 20 30 4 82 90 100 24 46", "30\n20 94 56 50 10 98 52 32 14 22 24 60 4 8 98 46 34 68 82 82 98 90 50 20 78 49 52 9... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3,134 | codeforces | |
87fbfafa354e50b7c4f052a6f1671e69 | Kostya the Sculptor | Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to present him a rectangular parallelepiped of marble from which he can carve the sphere.
Zahar has *n* stones which are rectang... | {"inputs": ["6\n5 5 5\n3 2 4\n1 4 1\n2 1 3\n3 2 4\n3 3 4", "7\n10 7 8\n5 10 3\n4 2 6\n5 5 5\n10 2 8\n4 2 1\n7 7 7", "1\n1 1 1", "2\n2 3 1\n2 2 3", "1\n1000000000 1000000000 1000000000", "3\n100 100 100\n25 63 11\n63 15 11", "2\n999999999 1000000000 1000000000\n1000000000 1000000000 1000000000", "3\n1 1 2\n1 2 2\n1 1 1"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 23 | codeforces | |
880524f2cab75c03474a3bd4b45b4390 | Months and Years | Everybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in March, 30 days in April, 31 days in May, 30 in June, 31 in July, 31 in August, 30 in September, 31 in October, 30 in November, 31 in December.
... | {"inputs": ["4\n31 31 30 31", "2\n30 30", "5\n29 31 30 31 30", "3\n31 28 30", "3\n31 31 28", "24\n29 28 31 30 31 30 31 31 30 31 30 31 31 29 31 30 31 30 31 31 30 31 30 31", "4\n31 29 31 30", "24\n31 28 31 30 31 30 31 31 30 31 30 31 31 29 31 30 31 30 31 31 30 31 30 31", "8\n31 29 31 30 31 30 31 31", "1\n29", "8\n31 29 31... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 94 | codeforces | |
88133b86e2c023a0f6539769a94a9b40 | Nastya and an Array | Nastya owns too many arrays now, so she wants to delete the least important of them. However, she discovered that this array is magic! Nastya now knows that the array has the following properties:
- In one second we can add an arbitrary (possibly negative) integer to all elements of the array that are not equal to ze... | {"inputs": ["5\n1 1 1 1 1", "3\n2 0 -1", "4\n5 -6 -5 1", "1\n0", "2\n21794 -79194", "3\n-63526 95085 -5239", "3\n0 53372 -20572", "13\n-2075 -32242 27034 -37618 -96962 82203 64846 48249 -71761 28908 -21222 -61370 46899", "5\n806 0 1308 1954 683", "8\n-26 0 -249 -289 -126 -206 288 -11", "10\n2 2 2 1 2 -1 0 2 -1 1", "1\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 398 | codeforces | |
881a96925d078b4a047e5ae1de94811c | Tennis Tournament | A tennis tournament with *n* participants is running. The participants are playing by an olympic system, so the winners move on and the losers drop out.
The tournament takes place in the following way (below, *m* is the number of the participants of the current round):
- let *k* be the maximal power of the number 2 ... | {"inputs": ["5 2 3", "8 2 4", "10 1 500", "20 500 1", "100 123 99", "500 1 1", "500 500 500", "500 237 474", "1 2 3", "1 2 133", "1 2 100", "1 3 4", "1 10 15", "1 1 1", "1 2 5", "1 500 500", "1 3 8", "10 10 10", "1 3 5", "1 2 1", "1 2 4", "1 10 10", "1 345 345", "7 12 13", "1 500 1", "1 12 13", "1 500 499", "1 100 90",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 206 | codeforces | |
884ce38c4e05ce1b7792e50f06613eae | Burning Midnight Oil | One day a highly important task was commissioned to Vasya — writing a program in a night. The program consists of *n* lines of code. Vasya is already exhausted, so he works like that: first he writes *v* lines of code, drinks a cup of tea, then he writes as much as lines, drinks another cup of tea, then he writes lin... | {"inputs": ["7 2", "59 9", "1 9", "11 2", "747 2", "6578 2", "37212 2", "12357 2", "7998332 2", "86275251 2", "75584551 2", "6 3", "43 4", "811 3", "3410 4", "21341 4", "696485 4", "8856748 3", "2959379 4", "831410263 3", "2 5", "19 6", "715 7", "9122 5", "89117 6", "689973 7", "3024524 5", "67127156 6", "412262167 7",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 171 | codeforces | |
884fb11aa9749ce2a54ec963e9036754 | Find a car | After a wonderful evening in the restaurant the time to go home came. Leha as a true gentlemen suggested Noora to give her a lift. Certainly the girl agreed with pleasure. Suddenly one problem appeared: Leha cannot find his car on a huge parking near the restaurant. So he decided to turn to the watchman for help.
Form... | {"inputs": ["4\n1 1 1 1 1\n3 2 5 4 5\n1 1 5 5 10000\n1 4 2 5 2", "10\n3 7 4 10 7\n6 1 7 10 18\n9 6 10 8 3\n1 8 3 10 3\n10 4 10 5 19\n8 9 9 10 10\n10 1 10 5 4\n8 1 9 4 18\n6 3 9 5 1\n6 6 9 6 16", "10\n1 1 2 2 8\n3 4 5 9 4\n2 10 5 10 6\n8 5 10 8 8\n1 2 8 2 20\n8 6 10 8 20\n6 7 6 7 9\n8 5 10 10 13\n1 8 10 9 13\n9 8 10 9 3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
88707b4cec2285331afee820a59c2935 | Tennis Championship | Famous Brazil city Rio de Janeiro holds a tennis tournament and Ostap Bender doesn't want to miss this event. There will be *n* players participating, and the tournament will follow knockout rules from the very first game. That means, that if someone loses a game he leaves the tournament immediately.
Organizers are st... | {"inputs": ["2", "3", "4", "10", "1000", "2500", "690000", "3000000000", "123456789123456789", "5", "143", "144", "145", "232", "233", "234", "679891637638612257", "679891637638612258", "679891637638612259", "1000000000000000000", "10235439547", "1240723548", "92353046212453", "192403205846532", "13925230525389", "1204... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 107 | codeforces | |
887f5c0fe1611ba2eb173a645088bda2 | Vladik and cards | Vladik was bored on his way home and decided to play the following game. He took *n* cards and put them in a row in front of himself. Every card has a positive integer number not exceeding 8 written on it. He decided to find the longest subsequence of cards which satisfies the following conditions:
- the number of oc... | {"inputs": ["3\n1 1 1", "8\n8 7 6 5 4 3 2 1", "24\n1 8 1 2 8 2 3 8 3 4 8 4 5 8 5 6 8 6 7 8 7 8 8 8", "1\n8", "2\n5 4", "3\n3 3 2", "18\n3 6 6 8 8 1 1 4 4 3 3 5 5 7 7 2 2 3", "5\n2 6 1 2 6", "6\n4 3 1 6 7 4", "7\n8 8 2 6 1 8 5", "8\n2 8 4 7 5 3 6 1", "8\n8 6 3 6 7 5 5 3", "15\n5 2 2 7 5 2 6 4 3 8 1 8 4 2 7", "15\n8 8 1 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
88833c580e1089eeff007f19c143dece | Pencils and Boxes | Mishka received a gift of multicolored pencils for his birthday! Unfortunately he lives in a monochrome world, where everything is of the same color and only saturation differs. This pack can be represented as a sequence *a*1,<=*a*2,<=...,<=*a**n* of *n* integer numbers — saturation of the color of each pencil. Now Mis... | {"inputs": ["6 3 10\n7 2 7 7 4 2", "6 2 3\n4 5 3 13 4 10", "3 2 5\n10 16 22", "8 7 13\n52 85 14 52 92 33 80 85", "6 4 0\n1 3 2 4 2 1", "10 4 9\n47 53 33 48 35 51 18 47 33 11", "3 2 76\n44 5 93", "5 2 9\n3 8 9 14 20", "8 2 3\n1 2 3 4 10 11 12 13", "10 3 3\n1 1 2 4 5 6 9 10 11 12", "7 3 3\n1 1 3 4 4 4 7", "8 3 6\n1 2 3 3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
888e5c0f86ce38c7eb6f2a5f40de8280 | Sereja and Swaps | As usual, Sereja has array *a*, its elements are integers: *a*[1],<=*a*[2],<=...,<=*a*[*n*]. Let's introduce notation:
A swap operation is the following sequence of actions:
- choose two indexes *i*,<=*j* (*i*<=≠<=*j*); - perform assignments *tmp*<==<=*a*[*i*],<=*a*[*i*]<==<=*a*[*j*],<=*a*[*j*]<==<=*tmp*.
What max... | {"inputs": ["10 2\n10 -1 2 2 2 2 2 2 -1 10", "5 10\n-1 -1 -1 -1 -1", "18 1\n166 788 276 -103 -491 195 -960 389 376 369 630 285 3 575 315 -987 820 466", "29 6\n-21 486 -630 -433 -123 -387 618 110 -203 55 -123 524 -168 662 432 378 -155 -136 -162 811 457 -157 -215 861 -565 -506 557 348 -7", "9 9\n-767 148 -323 -818 41 -22... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 19 | codeforces | |
8890a94989620c9df947b82ca957f018 | Perfect Squares | Given an array *a*1,<=*a*2,<=...,<=*a**n* of *n* integers, find the largest number in the array that is not a perfect square.
A number *x* is said to be a perfect square if there exists an integer *y* such that *x*<==<=*y*2.
The first line contains a single integer *n* (1<=≤<=*n*<=≤<=1000) — the number of elements in ... | {"inputs": ["2\n4 2", "8\n1 2 4 8 16 32 64 576", "3\n-1 -4 -9", "5\n918375 169764 598796 76602 538757", "5\n804610 765625 2916 381050 93025", "5\n984065 842724 127449 525625 573049", "2\n226505 477482", "2\n370881 659345", "2\n4 5", "2\n3 4", "2\n999999 1000000", "3\n-1 -2 -3", "2\n-1000000 1000000", "2\n-1 0", "1\n2",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 90 | codeforces | |
8891a9d7e5544bb50fc3a3842c39a9cf | Zero-One | Little Petya very much likes playing with little Masha. Recently he has received a game called "Zero-One" as a gift from his mother. Petya immediately offered Masha to play the game with him.
Before the very beginning of the game several cards are lain out on a table in one line from the left to the right. Each card c... | {"inputs": ["????", "1010", "1?1", "111?", "000?", "1??1?", "?111111?00?", "??????????0????????????????0000000000000", "1?1?1?1?0?10", "?0101", "??0101", "??1010", "00", "11", "1110110101111111001111111110111011100001110111011001011111111111011010011111?111111?011111110001010110011111010111100111?111101010011101010?011... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
889f498ec3484cf118ca64ffd0df42d2 | Balanced Substring | You are given a string *s* consisting only of characters 0 and 1. A substring [*l*,<=*r*] of *s* is a string *s**l**s**l*<=+<=1*s**l*<=+<=2... *s**r*, and its length equals to *r*<=-<=*l*<=+<=1. A substring is called balanced if the number of zeroes (0) equals to the number of ones in this substring.
You have to deter... | {"inputs": ["8\n11010111", "3\n111", "11\n00001000100", "10\n0100000000", "13\n0001000011010", "14\n00000100101011", "14\n01111101111111", "18\n110010101101111111", "11\n00010000011", "10\n1000010110", "15\n100000100000011", "18\n011010101110111101", "10\n0011011111", "3\n011", "14\n11111111111111", "65\n11001000110001... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 139 | codeforces | |
88a9414a5b52e94c5b877e3e07e40bc0 | Award Ceremony | All-Berland programming contest comes to an end. In total, *n* teams participated in it. Like in ACM-ICPC, current results stopped refreshing one hour before the contest ends. So at the Award Ceremony, results are partially known. For each team the value *a**i* is given — the number of points the *i*-th team has earned... | {"inputs": ["4\n17 -14\n52 -5\n1 52\n6 0", "5\n4 5\n3 2\n5 -3\n6 -2\n4 3", "3\n2 1\n1 -1\n1 2", "5\n4 1\n5 4\n3 5\n4 5\n5 2", "10\n3 3\n1 1\n1 2\n2 2\n3 4\n3 2\n4 3\n2 2\n2 2\n1 2", "20\n5 4\n1 5\n5 4\n4 5\n4 5\n1 1\n5 3\n3 3\n4 5\n1 4\n5 2\n4 2\n4 4\n5 1\n1 1\n5 3\n2 4\n2 4\n1 2\n2 3", "40\n5 4\n1 4\n5 1\n3 4\n1 4\n5 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
88c00f744c62257aff2d2df925559c97 | Blinds | The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are *n* blind stripes with the width of 1 in the factory warehouse for blind production. The problem is that all of them are spare details from different orders, that is, they ... | {"inputs": ["4 2\n1 2 3 4", "5 3\n5 5 7 3 1", "2 3\n1 2", "2 2\n3 3", "5 2\n2 4 1 1 3", "7 4\n3 2 1 1 1 3 2", "10 1\n1 2 2 6 6 1 2 5 5 6", "10 2\n6 3 1 1 6 4 6 1 6 3", "15 6\n1 6 6 5 2 10 4 4 7 8 7 3 5 1 2", "20 2\n13 3 6 11 6 11 9 1 1 2 5 2 9 15 14 10 3 12 3 13", "25 20\n10 8 4 6 12 14 19 18 19 9 21 16 16 15 10 15 12 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 34 | codeforces | |
88d941a8d49063c57c8e264ff7932a42 | Polycarp's Practice | Polycarp is practicing his problem solving skill. He has a list of $n$ problems with difficulties $a_1, a_2, \dots, a_n$, respectively. His plan is to practice for exactly $k$ days. Each day he has to solve at least one problem from his list. Polycarp solves the problems in the order they are given in his list, he cann... | {"inputs": ["8 3\n5 4 2 6 5 1 9 2", "5 1\n1 1 1 1 1", "4 2\n1 2000 2000 2", "1 1\n2000", "1 1\n1234", "3 2\n1 1 1", "4 2\n3 5 1 1", "5 3\n5 5 6 7 1", "6 4\n1 1 1 1 2 2", "5 3\n5 5 6 6 4", "16 15\n14 4 9 12 17 1 1 8 12 13 6 9 17 2 18 12", "1 1\n1996", "5 3\n5 5 5 9 10", "18 15\n18 2 13 1 18 3 2 18 18 20 9 2 20 20 4 20 9... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 86 | codeforces | |
88f39d68bb4b079df4d1512539367c6f | Practice | Little time is left before Berland annual football championship. Therefore the coach of team "Losewille Rangers" decided to resume the practice, that were indefinitely interrupted for uncertain reasons. Overall there are *n* players in "Losewille Rangers". Each player on the team has a number — a unique integer from 1 ... | {"inputs": ["2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "13", "15", "16", "18", "20", "100", "110", "120", "140", "157", "171", "199", "200", "213", "231", "240", "250", "253", "260", "270", "271", "277", "280", "290", "300", "700", "730", "766", "777", "800", "832", "855", "869", "888", "900", "914", "930", "9... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
890dc69313bd417ff2d70cfa1ba21d98 | Analyzing Polyline | As Valeric and Valerko were watching one of the last Euro Championship games in a sports bar, they broke a mug. Of course, the guys paid for it but the barman said that he will let them watch football in his bar only if they help his son complete a programming task. The task goes like that.
Let's consider a set of fun... | {"inputs": ["1\n1 0", "3\n1 0\n0 2\n-1 1", "3\n-2 -4\n1 7\n-5 1", "10\n9 9\n-5 2\n-2 9\n0 6\n6 7\n-1 -10\n-8 6\n3 6\n-3 -9\n0 4", "10\n-4 -9\n5 9\n-4 -1\n6 -1\n-10 -10\n3 4\n3 5\n3 10\n9 7\n4 -7", "5\n3 3\n2 2\n2 -3\n-3 3\n-1 1", "4\n0 2\n-1 -2\n1 0\n-2 2", "10\n-1 2\n0 1\n-2 0\n1 1\n-1 -1\n-2 1\n-2 2\n2 -1\n0 -1\n-1 0... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
8916d23cafaf87358fda6c265d1c3240 | Maximum path | You are given a rectangular table 3<=×<=*n*. Each cell contains an integer. You can move from one cell to another if they share a side.
Find such path from the upper left cell to the bottom right cell of the table that doesn't visit any of the cells twice, and the sum of numbers written in the cells of this path is ma... | {"inputs": ["3\n1 1 1\n1 -1 1\n1 1 1", "5\n10 10 10 -1 -1\n-1 10 10 10 10\n-1 10 10 10 10", "15\n-87 -91 31 63 91 35 -14 51 20 20 -20 -94 -59 77 76\n11 81 22 -29 91 -26 -10 -12 46 10 100 88 14 64 41\n26 -31 99 -39 -30 30 28 74 -7 21 2 32 -60 -74 46", "20\n16 82 25 21 -60 9 29 -55 70 54 -50 10 -19 40 46 41 31 -66 1 85\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
8945042f2c8d6960cb0d9cc6116dc3de | Skills | Lesha plays the recently published new version of the legendary game hacknet. In this version character skill mechanism was introduced. Now, each player character has exactly *n* skills. Each skill is represented by a non-negative integer *a**i* — the current skill level. All skills have the same maximum level *A*.
Al... | {"inputs": ["3 5 10 1 5\n1 3 1", "3 5 10 1 339\n1 3 1", "2 6 0 1 4\n5 1", "1 1000000000 1000 1000 1000000000000000\n0", "1 100 1 2 30\n1", "1 100 1 2 30\n71", "1 1000000000 1000 1000 1000000000000000\n1000000000", "5 5 10 20 50\n0 0 0 0 0", "5 5 10 20 50\n3 3 3 3 3", "4 5 3 7 15\n4 3 3 1", "3 6 4 6 8\n6 4 5"], "outputs... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
89491360e66f8310e95485370a17fd93 | none | You are given several queries. In the *i*-th query you are given a single positive integer *n**i*. You are to represent *n**i* as a sum of maximum possible number of composite summands and print this maximum number, or print -1, if there are no such splittings.
An integer greater than 1 is composite, if it is not prim... | {"inputs": ["1\n12", "2\n6\n8", "3\n1\n2\n3", "6\n1\n2\n3\n5\n7\n11", "3\n4\n6\n9", "20\n8\n13\n20\n12\n9\n16\n4\n19\n7\n15\n10\n6\n14\n11\n3\n2\n5\n17\n18\n1", "100\n611\n513\n544\n463\n38\n778\n347\n317\n848\n664\n382\n108\n718\n33\n334\n876\n234\n22\n944\n305\n159\n245\n513\n691\n639\n135\n308\n324\n813\n459\n304\n1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 127 | codeforces | |
895d55b60d3cf7fbe8a8d7aee6e5bf90 | Tourist Problem | Iahub is a big fan of tourists. He wants to become a tourist himself, so he planned a trip. There are *n* destinations on a straight road that Iahub wants to visit. Iahub starts the excursion from kilometer 0. The *n* destinations are described by a non-negative integers sequence *a*1, *a*2, ..., *a**n*. The number *a*... | {"inputs": ["3\n2 3 5", "4\n1 5 77 2", "5\n3 3842 288 199 334", "7\n1 2 3 40 52 33 86", "7\n1 10 100 1000 10000 1000000 10000000", "6\n3835302 971984 8706888 1080445 2224695 1093317", "40\n8995197 7520501 942559 8012058 3749344 3471059 9817796 3187774 4735591 6477783 7024598 3155420 6039802 2879311 2738670 5930138 4604... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 35 | codeforces | |
896e4fa6c27d59192730b1a332916bbd | Center Alignment | Almost 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.
You are to implement the alignment in the shortest possible time. Good luck!
The input file consists ... | {"inputs": ["This is\n\nCodeforces\nBeta\nRound\n5", "welcome to the\nCodeforces\nBeta\nRound 5\n\nand\ngood luck", "0\n2", "O\no\nd", "0v uO M6Sy", "fm v\nOL U W", "vb\nJ\nyU\nZ", "N\nSV\nEh\n6f\nX6\n9e", "Pj\nA\nFA\nP\nVJ\nU\nEb\nW", "T\n7j\nS\nb\nq8\nVZ\nn\n4T\niZ\npA", "8\n\n\n\ny\nW\n\n\n\n3B\n\nw\nV\n\n\n\nL\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 104 | codeforces | |
898bd3d15572e3c5b3a6e55eee7cebf1 | Minimum Sum | Petya has *n* positive integers *a*1,<=*a*2,<=...,<=*a**n*.
His friend Vasya decided to joke and replaced all digits in Petya's numbers with a letters. He used the lowercase letters of the Latin alphabet from 'a' to 'j' and replaced all digits 0 with one letter, all digits 1 with another letter and so on. For any two... | {"inputs": ["3\nab\nde\naj", "5\nabcdef\nghij\nbdef\naccbd\ng", "3\naa\njj\naa", "9\na\nb\nc\nd\nf\ng\nh\ni\nj", "5\nbdgbh\nadi\naa\ngjh\ngh", "6\nchafj\nabhj\nfhe\nhfbd\njifgg\ng", "1\nh", "7\nffh\nfhec\nfbchc\ng\ndfbhi\ncdbdi\ni", "8\ne\nbhbib\nj\ndgb\njjbgb\nei\ndggbdh\nhfbbfj", "10\ncf\ncha\nceiab\ng\naajac\ndj\nhe... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 41 | codeforces | |
898f5cceb39732df2744828494acaa59 | Different Subsets For All Tuples | For a sequence *a* of *n* integers between 1 and *m*, inclusive, denote *f*(*a*) as the number of distinct subsequences of *a* (including the empty subsequence).
You are given two positive integers *n* and *m*. Let *S* be the set of all sequences of length *n* consisting of numbers from 1 to *m*. Compute the sum *f*(*... | {"inputs": ["1 3", "2 2", "3 3", "1 1000000", "1000000 1", "500 500", "1000000 1000000"], "outputs": ["6", "14", "174", "2000000", "1000001", "383255233", "247171672"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
899ad686a6f5f7729afbc31a2d42123f | Tree Construction | During the programming classes Vasya was assigned a difficult problem. However, he doesn't know how to code and was unable to find the solution in the Internet, so he asks you to help.
You are given a sequence $a$, consisting of $n$ distinct integers, that is used to construct the binary search tree. Below is the form... | {"inputs": ["3\n1 2 3", "5\n4 2 3 1 6", "2\n1 2", "10\n991309218 517452607 870021923 978357992 136426010 10601767 302627526 883615372 163475700 600546765", "2\n656402233 488475947"], "outputs": ["1 2", "4 2 2 4", "1", "991309218 517452607 870021923 517452607 136426010 136426010 978357992 302627526 870021923", "65640223... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
899dbfc5766d6ae6850a7869f0de87da | Reversing Encryption | A string $s$ of length $n$ can be encrypted by the following algorithm:
- iterate over all divisors of $n$ in decreasing order (i.e. from $n$ to $1$), - for each divisor $d$, reverse the substring $s[1 \dots d]$ (i.e. the substring which starts at position $1$ and ends at position $d$).
For example, the above algor... | {"inputs": ["10\nrocesfedoc", "16\nplmaetwoxesisiht", "1\nz", "2\nir", "3\nilj", "4\njfyy", "6\nkrdych", "60\nfnebsopcvmlaoecpzmakqigyuutueuozjxutlwwiochekmhjgwxsgfbcrpqj", "64\nhnlzzhrvqnldswxfsrowfhmyzbxtyoxhogudasgywxycyhzgiseerbislcncvnwy", "97\nqnqrmdhmbubaijtwsecbidqouhlecladwgwcuxbigckrfzasnbfbslukoayhcgquuacyga... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 173 | codeforces | |
89c2bcffb56fcdb0dba9ea994e161d20 | Color Stripe | A colored stripe is represented by a horizontal row of *n* square cells, each cell is pained one of *k* colors. Your task is to repaint the minimum number of cells so that no two neighbouring cells are of the same color. You can use any color from 1 to *k* to repaint the cells.
The first input line contains two integer... | {"inputs": ["6 3\nABBACC", "3 2\nBBB", "1 2\nA", "1 26\nZ", "2 2\nAA", "2 2\nBA", "6 2\nAAABBB", "8 3\nAABBABBB", "10 26\nAAAAAAAAAA", "12 3\nAAABBBAAABBB", "3 2\nAAB", "3 3\nBBA", "3 3\nCCC", "8 3\nAABBCCBB", "200 2\nBABAABBABBABBABABBBABAAABABBABABBBAABBBBABBAABBABABAAAAABAABBBAAAAAAABBBABAAAABABBBAABABAABAABBBAABBAB... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 11 | codeforces | |
89f33e47241992f5c2c6cbeeaf3d4ead | Captain Marmot | Captain Marmot wants to prepare a huge and important battle against his enemy, Captain Snake. For this battle he has *n* regiments, each consisting of 4 moles.
Initially, each mole *i* (1<=≤<=*i*<=≤<=4*n*) is placed at some position (*x**i*,<=*y**i*) in the Cartesian plane. Captain Marmot wants to move some moles to m... | {"inputs": ["4\n1 1 0 0\n-1 1 0 0\n-1 1 0 0\n1 -1 0 0\n1 1 0 0\n-2 1 0 0\n-1 1 0 0\n1 -1 0 0\n1 1 0 0\n-1 1 0 0\n-1 1 0 0\n-1 1 0 0\n2 2 0 1\n-1 0 0 -2\n3 0 0 -2\n-1 1 -2 0", "3\n-2248 6528 -2144 6181\n-2245 6663 -2100 7054\n-4378 7068 -4061 7516\n-4274 6026 -3918 5721\n4942 -6793 5014 -6807\n3463 -5170 3112 -5181\n287... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
8a0c32c216a57e2b1ebcc493f38f1de4 | Movie Critics | A film festival is coming up in the city N. The festival will last for exactly *n* days and each day will have a premiere of exactly one film. Each film has a genre — an integer from 1 to *k*.
On the *i*-th day the festival will show a movie of genre *a**i*. We know that a movie of each of *k* genres occurs in the fes... | {"inputs": ["10 3\n1 1 2 3 2 3 3 1 1 3", "7 3\n3 1 3 2 3 1 2", "2 2\n1 2", "10 2\n1 2 2 1 1 2 1 1 2 2", "10 10\n5 7 8 2 4 10 1 3 9 6", "100 10\n6 2 8 1 7 1 2 9 2 6 10 4 2 8 7 5 2 9 5 2 3 2 8 3 7 2 4 3 1 8 8 5 7 10 2 1 8 4 1 4 9 4 2 1 9 3 7 2 4 8 4 3 10 3 9 5 7 7 1 2 10 7 7 8 9 7 1 7 4 8 9 4 1 10 2 4 2 10 9 6 10 5 1 4 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 12 | codeforces | |
8a19c08339325adedb08655029389065 | Robot Bicorn Attack | Vasya plays Robot Bicorn Attack.
The game consists of three rounds. For each one a non-negative integer amount of points is given. The result of the game is the sum of obtained points. Vasya has already played three rounds and wrote obtained points one by one (without leading zeros) into the string *s*. Vasya decided ... | {"inputs": ["1234", "9000", "0009", "100000010000001000000", "1000000011", "9991", "1000001999", "100000010000011000000", "100000010000001000001", "102", "100", "000", "001", "090", "999999999999999999999999999999", "12345678901234567", "12635000000127683", "428595000000042345353", "48726340000000", "93246310000000", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 24 | codeforces | |
8a2e86e2f136815a2d31168586eb8de7 | Roma and Lucky Numbers | Roma (a popular Russian name that means 'Roman') loves the Little Lvov Elephant's lucky numbers.
Let us remind you that lucky numbers are positive integers whose decimal representation only contains lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Roma's got *n* positive integer... | {"inputs": ["3 4\n1 2 4", "3 2\n447 44 77", "2 2\n507978501 180480073", "9 6\n655243746 167613748 1470546 57644035 176077477 56984809 44677 215706823 369042089", "6 100\n170427799 37215529 675016434 168544291 683447134 950090227", "4 2\n194041605 706221269 69909135 257655784", "4 2\n9581849 67346651 530497 272158241", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 500 | codeforces | |
8a318d25c4228c01367164cd22486e42 | Minimum spanning tree for each edge | Connected undirected weighted graph without self-loops and multiple edges is given. Graph contains *n* vertices and *m* edges.
For each edge (*u*,<=*v*) find the minimal possible weight of the spanning tree that contains the edge (*u*,<=*v*).
The weight of the spanning tree is the sum of weights of all edges included... | {"inputs": ["5 7\n1 2 3\n1 3 1\n1 4 5\n2 3 2\n2 5 3\n3 4 2\n4 5 4", "2 1\n1 2 42", "3 3\n1 2 10\n2 3 20\n3 1 40", "4 6\n1 2 999999001\n1 3 999999003\n1 4 999999009\n2 3 999999027\n2 4 999999243\n3 4 999999729", "8 10\n2 5 4\n7 5 2\n7 3 28\n4 5 14\n3 2 15\n1 2 3\n6 2 5\n2 8 17\n4 6 2\n1 4 10", "8 10\n8 7 11\n3 5 23\n2 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
8a39a0fc528e653f23f943f263f57591 | Mister B and Boring Game | Sometimes Mister B has free evenings when he doesn't know what to do. Fortunately, Mister B found a new game, where the player can play against aliens.
All characters in this game are lowercase English letters. There are two players: Mister B and his competitor.
Initially the players have a string *s* consisting of t... | {"inputs": ["1 1 1 8", "4 2 2 6", "3 7 4 6", "4 5 1 1", "12 12 1 1000", "12 1 1000 1000", "3 4 701 703", "12 12 13 1000000000", "3 4 999999999 1000000000", "5 6 1000000000 1000000000", "1 1 1 1", "12 1 100000011 100000024", "10 12 220000011 220000032", "1 1 1 1000000000", "1 1 999999999 1000000000", "1 1 1000000000 100... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
8a91e345120c4e99d41dd166b1ac3025 | Gerald and Giant Chess | Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an *h*<=×<=*w* field, and it is painted in two colors, but not like in chess. Almost all cells of the field are white and only some of them are black. Currently Gerald is finishing a game ... | {"inputs": ["3 4 2\n2 2\n2 3", "100 100 3\n15 16\n16 15\n99 88", "1000 1000 4\n50 50\n51 50\n50 51\n51 51", "100000 100000 4\n50001 50001\n50000 50000\n50000 50001\n50001 50000", "2 2 2\n2 1\n1 2", "100 10 30\n40 4\n15 3\n75 3\n88 10\n32 1\n16 5\n81 8\n45 2\n72 8\n11 6\n86 4\n50 2\n9 4\n11 1\n20 3\n47 3\n2 4\n68 3\n90 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
8a957f78e0d55fcc24a4b2ca6c9e4fec | Increase Sequence | Peter has a sequence of integers *a*1,<=*a*2,<=...,<=*a**n*. Peter wants all numbers in the sequence to equal *h*. He can perform the operation of "adding one on the segment [*l*,<=*r*]": add one to all elements of the sequence with indices from *l* to *r* (inclusive). At that, Peter never chooses any element as the be... | {"inputs": ["3 2\n1 1 1", "5 1\n1 1 1 1 1", "4 3\n3 2 1 1", "1 2000\n2000", "3 2\n2 1 1", "3 4\n4 3 2", "10 6\n5 4 4 4 5 4 4 4 4 5", "10 6\n5 4 4 4 5 4 4 4 4 5", "7 4\n3 3 4 4 4 3 3", "3 6\n5 6 5", "3 2\n1 0 1", "6 1\n0 1 0 0 0 1", "6 3\n2 1 2 2 1 2", "99 1999\n1999 1998 1997 1996 1995 1994 1993 1992 1991 1990 1989 198... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
8b05508e415ac732ef63660436500b6f | Cannon | Bertown is under siege! The attackers have blocked all the ways out and their cannon is bombarding the city. Fortunately, Berland intelligence managed to intercept the enemies' shooting plan. Let's introduce the Cartesian system of coordinates, the origin of which coincides with the cannon's position, the *Ox* axis is ... | {"inputs": ["2 10\n0.7853\n0.3\n3\n5.0 5.0\n4.0 2.4\n6.0 1.9", "2 10\n0.7853\n0.3\n2\n4.0 2.4\n6.0 1.9", "3 186\n0.4084\n0.4559\n0.1203\n3\n978.8435 234.6507\n343.6961 128.6128\n611.2897 458.9593", "4 851\n0.3178\n0.5635\n0.1335\n0.5107\n4\n685.3785 249.6264\n681.8946 242.4571\n917.2937 600.3285\n150.5685 135.5137", "2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
8b08ea902b7acfe6c832a6ab2e5cbf65 | New York Hotel | Think of New York as a rectangular grid consisting of *N* vertical avenues numerated from 1 to *N* and *M* horizontal streets numerated 1 to *M*. *C* friends are staying at *C* hotels located at some street-avenue crossings. They are going to celebrate birthday of one of them in the one of *H* restaurants also located ... | {"inputs": ["10 10\n2\n1 1\n3 3\n2\n1 10\n4 4", "100 100\n10\n53 20\n97 6\n12 74\n48 92\n97 13\n47 96\n75 32\n69 21\n95 75\n1 54\n10\n36 97\n41 1\n1 87\n39 23\n27 44\n73 97\n1 1\n6 26\n48 3\n5 69", "100 100\n10\n86 72\n25 73\n29 84\n34 33\n29 20\n84 83\n41 80\n22 22\n16 89\n77 49\n1\n4 23", "100 100\n1\n66 77\n10\n70 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
8b27e972e3fa26ad5abe3942fc090f84 | Permute Digits | You are given two positive integer numbers *a* and *b*. Permute (change order) of the digits of *a* to construct maximal number not exceeding *b*. No number in input and/or output can start with the digit 0.
It is allowed to leave *a* as it is.
The first line contains integer *a* (1<=≤<=*a*<=≤<=1018). The second line ... | {"inputs": ["123\n222", "3921\n10000", "4940\n5000", "23923472834\n23589234723", "102391019\n491010301", "123456789123456789\n276193619183618162", "1000000000000000000\n1000000000000000000", "1\n1000000000000000000", "999999999999999999\n1000000000000000000", "2475345634895\n3455834583479", "15778899\n98715689", "4555\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 53 | codeforces | |
8b3fa8eccfdabf8716ba8e9019da55da | none | You are given an array of positive integers *a*1,<=*a*2,<=...,<=*a**n*<=×<=*T* of length *n*<=×<=*T*. We know that for any *i*<=><=*n* it is true that *a**i*<==<=*a**i*<=-<=*n*. Find the length of the longest non-decreasing sequence of the given array.
The first line contains two space-separated integers: *n*, *T* (... | {"inputs": ["4 3\n3 1 4 2", "1 1000\n42", "31 3767\n16 192 152 78 224 202 186 52 118 19 13 38 199 196 35 295 100 64 205 37 166 124 169 214 66 243 134 192 253 270 92", "15 12226\n18 125 213 221 124 147 154 182 134 184 51 49 267 88 251", "81 10683\n3 52 265 294 213 242 185 151 27 165 128 237 124 14 43 147 104 162 124 103... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
8b4044b6c20a561a758869590fbe0d05 | GukiZ and Binary Operations | We all know that GukiZ often plays with arrays.
Now he is thinking about this problem: how many arrays *a*, of length *n*, with non-negative elements strictly less then 2*l* meet the following condition: ? Here operation means bitwise AND (in Pascal it is equivalent to and, in C/C++/Java/Python it is equivalent to &... | {"inputs": ["2 1 2 10", "2 1 1 3", "3 3 2 10", "5135 42542 15 4354", "21 21 21 21", "2 0 0 5", "1564 153 12 1000000007", "101 102 13 104", "5 6 29 108", "1000000001 1000000002 37 1000000007", "45305640 6540640606 51 5406546", "68706870687 984089409849 59 156465748", "987408898498 1233432432 15 15", "111111111111 111111... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
8b794f61bba5cf73f873c4461a6dc912 | Processing Queries | In this problem you have to simulate the workflow of one-thread server. There are *n* queries to process, the *i*-th will be received at moment *t**i* and needs to be processed for *d**i* units of time. All *t**i* are guaranteed to be distinct.
When a query appears server may react in three possible ways:
1. If ser... | {"inputs": ["5 1\n2 9\n4 8\n10 9\n15 2\n19 1", "4 1\n2 8\n4 8\n10 9\n15 2", "1 1\n1000000000 1000000000", "4 3\n999999996 1000000000\n999999997 1000000000\n999999998 1000000000\n999999999 1000000000", "5 1\n2 1\n3 6\n4 5\n6 4\n7 2", "10 2\n4 14\n5 2\n6 6\n7 11\n8 6\n9 5\n10 13\n11 8\n13 2\n20 2", "6 4\n2 4\n4 2\n5 2\n6... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 56 | codeforces | |
8b980c9c96fff0ee36b71d033b996015 | Lucky Permutation | A permutation *p* of size *n* is the sequence *p*1,<=*p*2,<=...,<=*p**n*, consisting of *n* distinct integers, each of them is from 1 to *n* (1<=≤<=*p**i*<=≤<=*n*).
A lucky permutation is such permutation *p*, that any integer *i* (1<=≤<=*i*<=≤<=*n*) meets this condition *p**p**i*<==<=*n*<=-<=*i*<=+<=1.
You have inte... | {"inputs": ["1", "2", "4", "5", "3", "100000", "6", "7", "8", "9", "99997", "10000", "10001", "10002", "10003", "10004", "25", "29", "33", "9", "13", "17", "50001", "20001", "30001", "99996", "99999", "101", "505", "565"], "outputs": ["1 ", "-1", "2 4 1 3 ", "2 5 3 1 4 ", "-1", "2 100000 4 99998 6 99996 8 99994 10 9999... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
8baaa070ecac7d157bd2a81f95a18b77 | MUH and Important Things | It's time polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got down to business. In total, there are *n* tasks for the day and each animal should do each of these tasks. For each task, they have evaluated its difficulty. Also animals decided to do the tasks in ord... | {"inputs": ["4\n1 3 3 1", "5\n2 4 1 4 8", "8\n1 5 4 12 7 2 10 11", "6\n5 1 2 5 2 4", "1\n1083", "10\n5 5 5 5 5 5 5 5 5 5", "6\n3 8 3 9 3 10", "19\n895 1302 724 952 340 952 939 1302 724 952 939 340 340 1844 770 976 435 1302 1302", "7\n766 766 1477 766 107 1774 990", "11\n1552 1010 1552 1248 1550 388 1541 1010 613 1821 3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 50 | codeforces | |
8bb5b84ac8b7a2f06ed0f1e18350f2ef | none | One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane *n* rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other.
Help Timofey to color his rectangles in 4 differe... | {"inputs": ["8\n0 0 5 3\n2 -1 5 0\n-3 -4 2 -1\n-1 -1 2 0\n-3 0 0 5\n5 2 10 3\n7 -3 10 2\n4 -2 7 -1", "1\n0 0 1 1", "4\n0 0 1 1\n1 0 2 1\n1 1 2 2\n0 1 1 2", "3\n0 0 1 3\n1 0 4 1\n1 1 2 2", "6\n0 1 1 4\n0 4 1 7\n1 0 2 3\n1 3 2 4\n1 4 2 5\n2 3 3 4", "25\n0 0 7 7\n0 18 7 29\n7 36 12 41\n7 18 12 29\n15 29 26 36\n7 7 12 18\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 24 | codeforces | |
8bbcbb9e2645ba1ed5dd33803c1dee7b | Text Volume | You are given a text of single-space separated words, consisting of small and capital Latin letters.
Volume of the word is number of capital letters in the word. Volume of the text is maximum volume of all words in the text.
Calculate the volume of the given text.
The first line contains one integer number *n* (1<=≤<... | {"inputs": ["7\nNonZERO", "24\nthis is zero answer text", "24\nHarbour Space University", "2\nWM", "200\nLBmJKQLCKUgtTxMoDsEerwvLOXsxASSydOqWyULsRcjMYDWdDCgaDvBfATIWPVSXlbcCLHPYahhxMEYUiaxoCebghJqvmRnaNHYTKLeOiaLDnATPZAOgSNfBzaxLymTGjfzvTegbXsAthTxyDTcmBUkqyGlVGZhoazQzVSoKbTFcCRvYsgSCwjGMxBfWEwMHuagTBxkz", "199\no A r ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 436 | codeforces | |
8be1c3722f69c951ceff8bd6b888d662 | 80-th Level Archeology | Archeologists have found a secret pass in the dungeon of one of the pyramids of Cycleland. To enter the treasury they have to open an unusual lock on the door. The lock consists of *n* words, each consisting of some hieroglyphs. The wall near the lock has a round switch. Each rotation of this switch changes the hierogl... | {"inputs": ["4 3\n2 3 2\n1 1\n3 2 3 1\n4 2 3 1 2", "2 5\n2 4 2\n2 4 2", "4 4\n1 2\n1 3\n1 4\n1 2", "3 1\n2 1 1\n2 1 1\n3 1 1 1", "2 10\n14 9 6 7 1 6 9 3 1 9 4 6 8 8 1\n3 3 7 6", "5 10\n1 5\n7 5 1 10 5 3 7 10\n1 2\n1 3\n7 4 7 3 9 4 6 1", "50 5\n1 4\n1 4\n1 4\n1 4\n2 4 4\n2 4 5\n2 4 5\n3 4 1 1\n4 4 1 2 5\n7 4 3 2 1 4 4 5... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
8be653bb7d31a6854b649c9565e080e5 | April Fools' Problem (easy) | The marmots have prepared a very easy problem for this year's HC2 – this one. It involves numbers *n*, *k* and a sequence of *n* positive integers *a*1,<=*a*2,<=...,<=*a**n*. They also came up with a beautiful and riveting story for the problem statement. It explains what the input means, what the program should output... | {"inputs": ["8 5\n1 1 1 1 1 1 1 1", "10 3\n16 8 2 4 512 256 32 128 64 1", "5 1\n20 10 50 30 46", "6 6\n6 6 6 6 6 6", "1 1\n100", "1 1\n1", "10 5\n147 1917 5539 7159 5763 416 711 1412 6733 4402", "100 60\n1443 3849 6174 8249 696 8715 3461 9159 4468 2496 3044 2301 2437 7559 7235 7956 8959 2036 4399 9595 8664 9743 7688 37... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 44 | codeforces | |
8bf008186e7ef1b9076e19b8f3ab5c1a | Scrambled | Btoh yuo adn yuor roomatme lhoate wianshg disehs, btu stlil sdmoeboy msut peorrfm tihs cohre dialy. Oen dya yuo decdie to idourtcne smoe syestm. Yuor rmmotaoe sstgegus teh fooniwllg dael. Yuo argee on tow arayrs of ientgres M adn R, nmebur upmicnog dyas (induiclng teh cunrret oen) wtih sicsescuve irnegets (teh ceurrnt ... | {"inputs": ["1\n2\n0", "2\n2 3\n1 0", "3\n2 4 4\n0 1 3", "1\n16\n15", "16\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16\n0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15", "16\n5 6 9 13 13 15 9 10 2 6 10 11 12 7 4 8\n4 3 3 5 8 3 6 5 1 4 2 6 7 4 0 1", "8\n15 3 7 11 14 10 16 2\n0 2 1 4 0 0 13 1", "1\n7\n5", "9\n6 12 3 10 15 14 6 9 3\n5 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 25 | codeforces | |
8bfbb4d2c2d479b59b4a5cb61941820d | Hide-and-Seek | Victor and Peter are playing hide-and-seek. Peter has hidden, and Victor is to find him. In the room where they are playing, there is only one non-transparent wall and one double-sided mirror. Victor and Peter are points with coordinates (*x**v*,<=*y**v*) and (*x**p*,<=*y**p*) respectively. The wall is a segment joinin... | {"inputs": ["-1 3\n1 3\n0 2 0 4\n0 0 0 1", "0 0\n1 1\n0 1 1 0\n-100 -100 -101 -101", "0 0\n1 1\n0 1 1 0\n-1 1 1 3", "0 0\n10 0\n100 100 101 101\n1 0 3 0", "0 0\n1 1\n100 100 101 101\n-100 -100 -101 -101", "-1 1\n1 1\n0 3 0 4\n0 0 0 2", "0 0\n2 0\n1 1 1 -1\n0 2 1 2", "0 0\n2 0\n1 1 1 -1\n-10 2 -12 2", "0 0\n2 0\n0 2 2 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
8c0044cad84ef54874eff46f8f5fe656 | Sonya and Matrix | Since Sonya has just learned the basics of matrices, she decided to play with them a little bit.
Sonya imagined a new type of matrices that she called rhombic matrices. These matrices have exactly one zero, while all other cells have the Manhattan distance to the cell containing the zero. The cells with equal numbers ... | {"inputs": ["20\n1 0 2 3 5 3 2 1 3 2 3 1 4 2 1 4 2 3 2 4", "18\n2 2 3 2 4 3 3 3 0 2 4 2 1 3 2 1 1 1", "6\n2 1 0 2 1 2", "1\n0", "7\n0 1 2 3 4 2 6", "6\n0 0 0 0 0 0", "4\n0 0 0 0"], "outputs": ["4 5\n2 2", "3 6\n2 3", "-1", "1 1\n1 1", "-1", "-1", "-1"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
8c4a32fe0eb2f98ede0b2c62a4d73b97 | Harmony Analysis | The semester is already ending, so Danil made an effort and decided to visit a lesson on harmony analysis to know how does the professor look like, at least. Danil was very bored on this lesson until the teacher gave the group a simple task: find 4 vectors in 4-dimensional space, such that every coordinate of every vec... | {"inputs": ["2", "1", "3", "0", "4", "5", "6", "7", "8", "9"], "outputs": ["++++\n+*+*\n++**\n+**+", "++\n+*", "++++++++\n+*+*+*+*\n++**++**\n+**++**+\n++++****\n+*+**+*+\n++****++\n+**+*++*", "+", "++++++++++++++++\n+*+*+*+*+*+*+*+*\n++**++**++**++**\n+**++**++**++**+\n++++****++++****\n+*+**+*++*+**+*+\n++****++++***... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
8c79b8c1ac558a266dbe4c8f55ed51e7 | Vasya and Beautiful Arrays | Vasya's got a birthday coming up and his mom decided to give him an array of positive integers *a* of length *n*.
Vasya thinks that an array's beauty is the greatest common divisor of all its elements. His mom, of course, wants to give him as beautiful an array as possible (with largest possible beauty). Unfortunately... | {"inputs": ["6 1\n3 6 10 12 13 16", "5 3\n8 21 52 15 77", "13 11\n55 16 26 40 84 80 48 52 25 43 75 21 58", "18 9\n85 29 29 15 17 71 46 69 48 80 44 73 40 55 61 57 22 68", "25 7\n67 18 36 85 64 22 32 66 17 64 66 65 82 36 16 52 19 70 38 51 17 32 85 16 64", "7 1\n12 84 21 60 33 21 45", "1 1\n1", "10 10\n40141 53368 66538 6... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
8c94a95b56f6f7c5dcc0c59a65f20967 | Anton and Chess | Anton likes to play chess. Also, he likes to do programming. That is why he decided to write the program that plays chess. However, he finds the game on 8 to 8 board to too simple, he uses an infinite one instead.
The first task he faced is to check whether the king is in check. Anton doesn't know how to implement thi... | {"inputs": ["2\n4 2\nR 1 1\nB 1 5", "2\n4 2\nR 3 3\nB 1 5", "5\n-1 1\nR -10 10\nQ -9 9\nQ -2 -8\nB -6 10\nB -10 1", "20\n-321 454\nQ 967 -89\nR -811 454\nQ -404 454\nR -734 454\nQ -804 454\nQ -316 77\nQ -802 454\nB -499 454\nQ 401 -663\nQ -601 454\nQ -974 454\nB 710 298\nB -917 454\nB -555 -542\nQ -337 950\nR 501 40\nR... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
8c973212d593a4182fe97b22e3f856eb | Olesya and Rodion | Olesya loves numbers consisting of *n* digits, and Rodion only likes numbers that are divisible by *t*. Find some number that satisfies both of them.
Your task is: given the *n* and *t* print an integer strictly larger than zero consisting of *n* digits that is divisible by *t*. If such number doesn't exist, print <=-... | {"inputs": ["3 2", "2 2", "4 3", "5 3", "10 7", "2 9", "18 8", "1 5", "1 10", "100 5", "10 2", "18 10", "1 9", "7 6", "4 4", "14 7", "3 8", "1 3", "2 8", "3 8", "4 3", "5 9", "4 8", "3 4", "9 4", "8 10", "1 6", "20 3", "15 10", "31 4", "18 9", "72 4", "76 8", "12 5", "54 5", "96 10", "15 9", "100 2", "99 3", "98 4", "9... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 308 | codeforces | |
8ca09bef1240e1e23975c668191930e4 | Headquarters | Sensation, sensation in the two-dimensional kingdom! The police have caught a highly dangerous outlaw, member of the notorious "Pihters" gang. The law department states that the outlaw was driving from the gang's headquarters in his car when he crashed into an ice cream stall. The stall, the car, and the headquarters e... | {"inputs": ["3\nUR\nUL\nULDR", "2\nDR\nDL", "4\nUL\nUR\nDR\nDL", "10\nUL\nUL\nUL\nUL\nUL\nUL\nUL\nUL\nUL\nUL", "6\nUL\nDL\nDL\nUL\nUL\nDL", "1\nUL", "1\nUR", "1\nDR", "1\nDL", "1\nULDR", "2\nUL\nULDR", "4\nULDR\nUR\nULDR\nUR", "10\nUR\nDR\nUL\nDR\nUL\nULDR\nUR\nUL\nULDR\nUL", "4\nUL\nUR\nDR\nDL", "10\nUL\nUR\nUR\nDR\nD... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
8cd687a88783833ff1c31127372696fe | George and Accommodation | George has recently entered the BSUCP (Berland State University for Cool Programmers). George has a friend Alex who has also entered the university. Now they are moving into a dormitory.
George and Alex want to live in the same room. The dormitory has *n* rooms in total. At the moment the *i*-th room has *p**i* peopl... | {"inputs": ["3\n1 1\n2 2\n3 3", "3\n1 10\n0 10\n10 10", "2\n36 67\n61 69", "3\n21 71\n10 88\n43 62", "3\n1 2\n2 3\n3 4", "10\n0 10\n0 20\n0 30\n0 40\n0 50\n0 60\n0 70\n0 80\n0 90\n0 100", "13\n14 16\n30 31\n45 46\n19 20\n15 17\n66 67\n75 76\n95 97\n29 30\n37 38\n0 2\n36 37\n8 9", "19\n66 67\n97 98\n89 91\n67 69\n67 68\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 648 | codeforces | |
8d337c19b31a325a4e2c5679c23c0f2a | Fools and Roads | They say that Berland has exactly two problems, fools and roads. Besides, Berland has *n* cities, populated by the fools and connected by the roads. All Berland roads are bidirectional. As there are many fools in Berland, between each pair of cities there is a path (or else the fools would get upset). Also, between eac... | {"inputs": ["5\n1 2\n1 3\n2 4\n2 5\n2\n1 4\n3 5", "5\n3 4\n4 5\n1 4\n2 4\n3\n2 3\n1 3\n3 5"], "outputs": ["2 1 1 1 ", "3 1 1 1 "]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
8d65492fc90cdeead7cd95db3a21418d | none | Young Teodor enjoys drawing. His favourite hobby is drawing segments with integer borders inside his huge [1;*m*] segment. One day Teodor noticed that picture he just drawn has one interesting feature: there doesn't exist an integer point, that belongs each of segments in the picture. Having discovered this fact, Teodo... | {"inputs": ["2 4\n1 2\n3 4", "4 6\n1 3\n2 3\n4 6\n5 6", "43 1319\n750 1030\n857 946\n941 1203\n407 1034\n947 1290\n546 585\n630 1201\n72 342\n693 1315\n34 719\n176 1097\n36 931\n198 973\n5 1025\n892 1054\n461 1287\n195 1273\n832 1039\n308 955\n642 866\n770 838\n440 777\n289 948\n98 814\n458 768\n82 265\n300 596\n182 70... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
8d7482c6a683d3296ea22a704783715b | Om Nom and Necklace | One day Om Nom found a thread with *n* beads of different colors. He decided to cut the first several beads from this thread to make a bead necklace and present it to his girlfriend Om Nelly.
Om Nom knows that his girlfriend loves beautiful patterns. That's why he wants the beads on the necklace to form a regular patt... | {"inputs": ["7 2\nbcabcab", "21 2\nababaababaababaababaa", "321 2\nabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaa... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
8d8fab3e7d35cb8634eaf569edcf87b7 | Rain and Umbrellas | Polycarp lives on a coordinate line at the point $x = 0$. He goes to his friend that lives at the point $x = a$. Polycarp can move only from left to right, he can pass one unit of length each second.
Now it's raining, so some segments of his way are in the rain. Formally, it's raining on $n$ non-intersecting segments,... | {"inputs": ["10 2 4\n3 7\n8 10\n0 10\n3 4\n8 1\n1 2", "10 1 1\n0 9\n0 5", "10 1 1\n0 9\n1 5", "1 1 1\n0 1\n1 100000", "1 1 1\n0 1\n0 100000", "2000 1 1\n0 1\n2000 33303", "2000 1 1\n1999 2000\n0 18898", "100 50 1\n1 2\n3 4\n5 6\n7 8\n9 10\n11 12\n13 14\n15 16\n17 18\n19 20\n21 22\n23 24\n25 26\n27 28\n29 30\n31 32\n33 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
8d9078b0a36ff7bd5d993ae41b3780b0 | Rounding | Vasya has a non-negative integer *n*. He wants to round it to nearest integer, which ends up with 0. If *n* already ends up with 0, Vasya considers it already rounded.
For example, if *n*<==<=4722 answer is 4720. If *n*<==<=5 Vasya can round it to 0 or to 10. Both ways are correct.
For given *n* find out to which int... | {"inputs": ["5", "113", "1000000000", "5432359", "999999994", "10", "9", "1", "0", "3", "4", "6", "7", "8", "19", "100", "997", "9994", "10002", "100000", "99999", "999999999", "999999998", "999999995", "999999990", "1000000", "1000010", "10000010", "100000011", "400000003", "234234", "675621", "43532", "4576453", "657... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 461 | codeforces | |
8daea05e984def6f793db9d374212130 | Segments | You are given an integer *N*. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and *N*, inclusive; there will be of them.
You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoin... | {"inputs": ["2", "3", "4", "21", "100", "1", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "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"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 157 | codeforces | |
8db0bc286b569043a28bd31c19f4c65b | Shaass and Oskols | Shaass has decided to hunt some birds. There are *n* horizontal electricity wires aligned parallel to each other. Wires are numbered 1 to *n* from top to bottom. On each wire there are some oskols sitting next to each other. Oskol is the name of a delicious kind of birds in Shaass's territory. Supposed there are *a**i*... | {"inputs": ["5\n10 10 10 10 10\n5\n2 5\n3 13\n2 12\n1 13\n4 6", "3\n2 4 1\n1\n2 2", "5\n58 51 45 27 48\n5\n4 9\n5 15\n4 5\n5 8\n1 43", "10\n48 53 10 28 91 56 81 2 67 52\n2\n2 40\n6 51", "2\n72 45\n6\n1 69\n2 41\n1 19\n2 7\n1 5\n2 1", "10\n95 54 36 39 98 30 19 24 14 12\n3\n9 5\n8 15\n7 5", "100\n95 15 25 18 64 62 23 59 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 397 | codeforces | |
8dbf384ae645ced530cdc48451343e58 | Pipeline | Vova, the Ultimate Thule new shaman, wants to build a pipeline. As there are exactly *n* houses in Ultimate Thule, Vova wants the city to have exactly *n* pipes, each such pipe should be connected to the water supply. A pipe can be connected to the water supply if there's water flowing out of it. Initially Vova has onl... | {"inputs": ["4 3", "5 5", "8 4", "1000000000000000000 1000000000", "499999998500000001 1000000000", "499999998500000000 1000000000", "499999999500000000 1000000000", "499999999500000001 1000000000", "525 34", "223265034477 726990", "15597035789572051 185473109", "499999999500000002 1000000000", "1 1000000000", "1000000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 50 | codeforces | |
8dd48a95d077948b9426c6505bdbe45c | none | This is an interactive problem.
Jury has hidden a permutation *p* of integers from 0 to *n*<=-<=1. You know only the length *n*. Remind that in permutation all integers are distinct.
Let *b* be the inverse permutation for *p*, i.e. *p**b**i*<==<=*i* for all *i*. The only thing you can do is to ask xor of elements *p*... | {"inputs": ["3\n0 1 2", "4\n3 1 2 0", "4\n3 2 1 0", "8\n2 3 0 1 4 5 6 7", "1\n0", "10\n0 1 2 3 4 5 6 7 8 9", "6\n0 1 2 4 3 5", "2\n0 1", "10\n6 7 4 5 0 1 8 9 2 3", "10\n9 8 1 7 6 4 5 2 0 3", "64\n0 1 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... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
8e200e66a6bc8b339fc2303f84d097ff | Geometrical Progression | For given *n*, *l* and *r* find the number of distinct geometrical progression, each of which contains *n* distinct integers not less than *l* and not greater than *r*. In other words, for each progression the following must hold: *l*<=≤<=*a**i*<=≤<=*r* and *a**i*<=≠<=*a**j* , where *a*1,<=*a*2,<=...,<=*a**n* is the ge... | {"inputs": ["1 1 10", "2 6 9", "3 1 10", "3 3 10", "1 25 845", "2 25 845", "3 25 845", "4 25 845", "5 25 845", "6 25 845", "7 25 845", "8 25 845", "1 1 10000000", "2 1 10000000", "3 1 10000000", "4 1 10000000", "5 1 10000000", "6 1 10000000", "7 1 10000000", "8 1 10000000", "9 1 10000000", "10 1 10000000", "11 1 100000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
8e2fa585a4cce90d151115947a7dfe76 | Maximal Binary Matrix | You are given matrix with *n* rows and *n* columns filled with zeroes. You should put *k* ones in it in such a way that the resulting matrix is symmetrical with respect to the main diagonal (the diagonal that goes from the top left to the bottom right corner) and is lexicographically maximal.
One matrix is lexicograph... | {"inputs": ["2 1", "3 2", "2 5", "1 0", "1 1", "20 398", "20 401", "100 3574", "100 10000", "100 10001", "2 3", "4 5", "5 6", "5 24", "2 0", "3 5", "3 3", "5 10", "3 4", "4 3", "1 1000000", "3 6", "1 2", "1 0", "1 1", "1 2", "1 3", "1 4", "1 5", "1 6", "1 7", "1 8", "1 9", "1 10", "1 11", "1 12", "1 13", "1 14", "1 15"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 99 | codeforces | |
8e4411543e2b85f1a8bb736483bfdbcb | Beautiful Divisors | Recently Luba learned about a special kind of numbers that she calls beautiful numbers. The number is called beautiful iff its binary representation consists of *k*<=+<=1 consecutive ones, and then *k* consecutive zeroes.
Some examples of beautiful numbers:
- 12 (110); - 1102 (610); - 11110002 (12010); - 1111100... | {"inputs": ["3", "992", "81142", "76920", "2016", "1", "6", "32640", "12096", "55948", "47262", "22876", "96120", "42160", "38304", "89408", "97920", "55493", "38021", "21445", "100000", "497", "240", "21204", "65536", "364", "1024", "36", "28", "14400", "10080", "9", "2", "42", "83160", "65534", "1026", "1025", "1027"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 83 | codeforces | |
8e50612d70a28d84b770df9166669c6b | The Monster | As Will is stuck in the Upside Down, he can still communicate with his mom, Joyce, through the Christmas lights (he can turn them on and off with his mind). He can't directly tell his mom where he is, because the monster that took him to the Upside Down will know and relocate him.
Thus, he came up with a puzzle to te... | {"inputs": ["((?))", "??()??", "?????)(???", "()()((?(()(((()()(())(((()((())))(()))(()(((((())))()))(((()()()))))))(((((()))))))))", "))((()(()((((()))())()())((())())(((()()(())))))((())()()(()()(())()))()()(()()()(((()(()(()(()))))(", "?????????????????????????????????????????????????????????????????????????????????... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
8e64f356f5e4e4ae535eb42d9e1ea3df | Fancy Fence | Emuskald needs a fence around his farm, but he is too lazy to build it himself. So he purchased a fence-building robot.
He wants the fence to be a regular polygon. The robot builds the fence along a single path, but it can only make fence corners at a single angle *a*.
Will the robot be able to build the fence Emuska... | {"inputs": ["3\n30\n60\n90", "6\n1\n2\n3\n170\n179\n25"], "outputs": ["NO\nYES\nYES", "NO\nNO\nNO\nYES\nYES\nNO"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 625 | codeforces | |
8e719483e5e5418e54575f188ffb7458 | Holes | Little Petya likes to play a lot. Most of all he likes to play a game «Holes». This is a game for one person with following rules:
There are *N* holes located in a single row and numbered from left to right with numbers from 1 to *N*. Each hole has it's own power (hole number *i* has the power *a**i*). If you throw a ... | {"inputs": ["8 5\n1 1 1 1 1 2 8 2\n1 1\n0 1 3\n1 1\n0 3 4\n1 2", "10 10\n5 1 2 4 1 7 3 8 10 8\n0 5 6\n1 8\n1 1\n0 10 3\n1 5\n1 3\n1 2\n0 6 1\n1 9\n1 1"], "outputs": ["8 7\n8 5\n7 3", "8 1\n6 2\n5 1\n5 2\n5 3\n9 1\n10 4"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
8e83fc290467bbae2f2bbd15052cee39 | Long number | Consider the following grammar:
- <expression> ::= <term> | <expression> '+' <term>- <term> ::= <number> | <number> '-' <number> | <number> '(' <expression> ')'- <number> ::= <pos_digit> | <number> <digit>- <digit> ::= '0' | &... | {"inputs": ["8-11", "2(2-4+1)+2(2(17))", "1234-5678", "1+2+3+4-5+6+7-9", "598777", "49603501749575096738857", "11-57", "7177-57797", "4510812433666-7741104736713", "4778066503(27032-80044+16+51+58(9)+5668114736297420472+2336+6-117+8495(7265))", "9678329648012859556810940272201-70370609657815505164700664074744+288702310... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
8e884a3f9a82d8283675daa517424cea | Buying A House | Zane the wizard had never loved anyone before, until he fell in love with a girl, whose name remains unknown to us.
The girl lives in house *m* of a village. There are *n* houses in that village, lining in a straight line from left to right: house 1, house 2, ..., house *n*. The village is also well-structured: house ... | {"inputs": ["5 1 20\n0 27 32 21 19", "7 3 50\n62 0 0 0 99 33 22", "10 5 100\n1 0 1 0 0 0 0 0 1 1", "5 3 1\n1 1 0 0 1", "5 5 5\n1 0 5 6 0", "15 10 50\n20 0 49 50 50 50 50 50 50 0 50 50 49 0 20", "7 5 1\n0 100 2 2 0 2 1", "100 50 100\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 329 | codeforces | |
8e997023d723a3471ac07fd67fc26280 | Gargari and Permutations | Gargari got bored to play with the bishops and now, after solving the problem about them, he is trying to do math homework. In a math book he have found *k* permutations. Each of them consists of numbers 1,<=2,<=...,<=*n* in some order. Now he should find the length of the longest common subsequence of these permutatio... | {"inputs": ["4 3\n1 4 2 3\n4 1 2 3\n1 2 4 3", "6 3\n2 5 1 4 6 3\n5 1 4 3 2 6\n5 4 2 6 3 1", "41 4\n24 15 17 35 13 41 4 14 23 5 8 16 21 18 30 36 6 22 11 29 26 1 40 31 7 3 32 10 28 38 12 20 39 37 34 19 33 27 2 25 9\n22 13 25 24 38 35 29 12 15 8 11 37 3 19 4 23 18 32 30 40 36 21 16 34 27 9 5 41 39 2 14 17 31 33 26 7 1 10 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
8ea2947adf1fbbc23b60a162d770b3ba | Alyona and flowers | Little Alyona is celebrating Happy Birthday! Her mother has an array of *n* flowers. Each flower has some mood, the mood of *i*-th flower is *a**i*. The mood can be positive, zero or negative.
Let's define a subarray as a segment of consecutive flowers. The mother suggested some set of subarrays. Alyona wants to choos... | {"inputs": ["5 4\n1 -2 1 3 -4\n1 2\n4 5\n3 4\n1 4", "4 3\n1 2 3 4\n1 3\n2 4\n1 1", "2 2\n-1 -2\n1 1\n1 2", "5 6\n1 1 1 -1 0\n2 4\n1 3\n4 5\n1 5\n1 4\n4 5", "8 3\n5 -4 -2 5 3 -4 -2 6\n3 8\n4 6\n2 3", "10 10\n0 0 0 0 0 0 0 0 0 0\n5 9\n1 9\n5 7\n3 8\n1 6\n1 9\n1 6\n6 9\n1 10\n3 8", "3 6\n0 0 0\n1 1\n1 1\n1 3\n3 3\n2 3\n1 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 209 | codeforces | |
8ed90872b9454656dda60a242d493820 | Ebony and Ivory | Dante is engaged in a fight with "The Savior". Before he can fight it with his sword, he needs to break its shields. He has two guns, Ebony and Ivory, each of them is able to perform any non-negative number of shots.
For every bullet that hits the shield, Ebony deals *a* units of damage while Ivory deals *b* units of ... | {"inputs": ["4 6 15", "3 2 7", "6 11 6", "3 12 15", "5 5 10", "6 6 7", "1 1 20", "12 14 19", "15 12 26", "2 4 8", "4 5 30", "4 5 48", "2 17 105", "10 25 282", "6 34 323", "2 47 464", "4 53 113", "6 64 546", "1 78 725", "1 84 811", "3 100 441", "20 5 57", "14 19 143", "17 23 248", "11 34 383", "20 47 568", "16 58 410", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 192 | codeforces | |
8f150d098d84cde9f7d73b00f0091443 | none | Astronaut Natasha arrived on Mars. She knows that the Martians are very poor aliens. To ensure a better life for the Mars citizens, their emperor decided to take tax from every tourist who visited the planet. Natasha is the inhabitant of Earth, therefore she had to pay the tax to enter the territory of Mars.
There are... | {"inputs": ["2 8\n12 20", "3 10\n10 20 30", "5 10\n20 16 4 16 2", "10 5\n4 6 8 6 4 10 2 10 8 6", "20 25\n15 10 5 20 10 5 15 5 15 10 15 5 5 5 5 10 15 20 20 20", "30 30\n11 23 7 30 13 6 25 29 1 15 20 5 28 15 19 22 21 5 27 25 29 10 1 4 12 19 1 5 8 10", "40 30\n16 12 12 22 18 28 32 24 36 26 12 30 22 16 32 30 36 18 20 16 12... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 35 | codeforces | |
8f1d925cbfe50cd21d804490a288b86a | Memory and Scores | Memory and his friend Lexa are competing to get higher score in one popular computer game. Memory starts with score *a* and Lexa starts with score *b*. In a single turn, both Memory and Lexa get some integer in the range [<=-<=*k*;*k*] (i.e. one integer among <=-<=*k*,<=<=-<=*k*<=+<=1,<=<=-<=*k*<=+<=2,<=...,<=<=-<=2,<=... | {"inputs": ["1 2 2 1", "1 1 1 2", "2 12 3 1", "4 6 2 1", "4 6 2 2", "6 4 2 2", "10 1 3 3", "5 3 1 1", "50 22 5 5", "6 20 1 1", "42 42 2 3", "42 42 3 2", "45 54 4 5", "6 5 4 3", "42 42 42 42", "1 100 42 42", "1 100 1000 100", "1 1 1000 100", "100 100 1000 100", "1 8 1 4", "9 4 5 2", "2 6 6 2", "7 8 5 9", "3 7 8 6", "69 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
8f73f953a8856ca3a4c9cf3d04b14148 | TL | Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.
Valera has written *n* correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote *m* wrong solutions and for each wrong solution he knows its running ... | {"inputs": ["3 6\n4 5 2\n8 9 6 10 7 11", "3 1\n3 4 5\n6", "2 5\n45 99\n49 41 77 83 45", "50 50\n18 13 5 34 10 36 36 12 15 11 16 17 14 36 23 45 32 24 31 18 24 32 7 1 31 3 49 8 16 23 3 39 47 43 42 38 40 22 41 1 49 47 9 8 19 15 29 30 16 18\n91 58 86 51 94 94 73 84 98 69 74 56 52 80 88 61 53 99 88 50 55 95 65 84 87 79 51 5... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 305 | codeforces | |
8f7bee73b29e1a11e67f9279a1507384 | The Child and Set | At the children's day, the child came to Picks's house, and messed his house up. Picks was angry at him. A lot of important things were lost, in particular the favorite set of Picks.
Fortunately, Picks remembers something about his set *S*:
- its elements were distinct integers from 1 to *limit*; - the value of wa... | {"inputs": ["5 5", "4 3", "5 1", "54321 12345", "1997 508", "100000 30000", "100000 100000", "1 100000", "29985 15678", "83451 17526", "96024 12472", "21741 3575", "40287 17817", "58934 6404", "62658 10881", "89829 8298", "5499 1023", "5499 1024", "53689 10552", "247 3270", "58413 1253", "47283 15757", "93145 14496", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 104 | codeforces | |
8f93f9bd8f9064af561ecdf39f5a1e37 | Alternating Current | Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u... | {"inputs": ["-++-", "+-", "++", "-", "+-+-", "-+-", "-++-+--+", "+", "-+", "--", "+++", "--+", "++--++", "+-++-+", "+-+--+", "--++-+", "-+-+--", "+-+++-", "-+-+-+", "-++-+--++--+-++-", "+-----+-++---+------+++-++++", "-+-++--+++-++++---+--+----+--+-+-+++-+++-+---++-++++-+--+--+--+-+-++-+-+-++++++---++--+++++-+--++--+-+... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 189 | codeforces | |
8fa59503460967189c33fd84aaf7e67c | Help Farmer | Once upon a time in the Kingdom of Far Far Away lived Sam the Farmer. Sam had a cow named Dawn and he was deeply attached to her. Sam would spend the whole summer stocking hay to feed Dawn in winter. Sam scythed hay and put it into haystack. As Sam was a bright farmer, he tried to make the process of storing hay simple... | {"inputs": ["4", "7", "12", "1", "6", "8", "9", "14", "15", "16", "18", "20", "299999771", "54", "96", "348", "748", "908", "1026", "1985", "4472", "20845", "50480", "62497", "646055", "790620", "989903", "7033800", "7661860", "7834243", "45134118", "89054701", "99264891", "127039320", "206898748", "231136953", "257259... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 17 | codeforces | |
8fc062d952d56f65554254a2fbe9f3e8 | none | Petya 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.
Petya loves long lucky numbers very much. He is interested in the minimum lucky number *d* that me... | {"inputs": ["2 2 1 1", "4 7 3 1", "4 7 4 7", "1 1 1 1", "2 2 1 2", "2 1 2 1", "2 2 2 1", "3 3 1 1", "3 2 1 2", "2 1 3 1", "7 7 1 1", "4 7 2 1", "3 3 2 2", "4 3 2 1", "4 4 2 2", "1000000 1000000 1 1", "1000000 1 1 1", "10 10 3 5", "10 10 3 7", "1 7 1 1", "8 3 2 1", "1000000 1000000 1000000 1000000", "4584 45854 25 685",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
8fca4ffe8f07d1e257b834639a4873d8 | Hulk | Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.
Hulk likes the Inception so much, and like that his feelings are complicated. They have *n* layers. The first layer is hate, se... | {"inputs": ["1", "2", "3", "4", "5", "10", "18", "19", "76", "77", "81", "82", "85", "86", "100", "99", "98", "33", "34", "57", "100"], "outputs": ["I hate it", "I hate that I love it", "I hate that I love that I hate it", "I hate that I love that I hate that I love it", "I hate that I love that I hate that I love that... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 532 | codeforces | |
8fd162f8011e9ed6789a81a11aa77d54 | Winter is here | Winter is here at the North and the White Walkers are close. John Snow has an army consisting of *n* soldiers. While the rest of the world is fighting for the Iron Throne, he is going to get ready for the attack of the White Walkers.
He has created a method to know how strong his army is. Let the *i*-th soldier’s stre... | {"inputs": ["3\n3 3 1", "4\n2 3 4 6"], "outputs": ["12", "39"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
902081dac1e789e7037f497776442362 | Recover Polygon (easy) | The zombies are gathering in their secret lair! Heidi will strike hard to destroy them once and for all. But there is a little problem... Before she can strike, she needs to know where the lair is. And the intel she has is not very good.
Heidi knows that the lair can be represented as a rectangle on a lattice, with si... | {"inputs": ["6\n000000\n000000\n012100\n024200\n012100\n000000", "6\n000000\n012210\n024420\n012210\n000000\n000000", "6\n000100\n001210\n002420\n001210\n000000\n000000", "10\n0000000000\n0122210000\n0244420100\n0122210000\n0000000000\n0000000000\n0000000000\n0000000000\n0000000000\n0000000000", "10\n0000000000\n000000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
903195a712890e0984e95392fc3fad6d | Positions in Permutations | Permutation *p* is an ordered set of integers *p*1,<=<=*p*2,<=<=...,<=<=*p**n*, consisting of *n* distinct positive integers, each of them doesn't exceed *n*. We'll denote the *i*-th element of permutation *p* as *p**i*. We'll call number *n* the size or the length of permutation *p*1,<=<=*p*2,<=<=...,<=<=*p**n*.
We'l... | {"inputs": ["1 0", "2 1", "3 2", "4 1", "7 4", "7 7", "8 4", "8 5", "10 3", "20 0", "100 99", "13 13", "100 100", "1000 0", "1000 1", "1000 2", "1000 10", "1000 99", "1000 500", "1000 700", "1000 900", "1000 999", "1000 998", "1000 1000", "999 0", "999 1", "999 5", "999 13", "999 300", "999 600", "999 999", "999 989", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
903758cfd129ec5da50a446fab0de40f | Mahmoud and Ehab and the function | Dr. Evil is interested in math and functions, so he gave Mahmoud and Ehab array *a* of length *n* and array *b* of length *m*. He introduced a function *f*(*j*) which is defined for integers *j*, which satisfy 0<=≤<=*j*<=≤<=*m*<=-<=*n*. Suppose, *c**i*<==<=*a**i*<=-<=*b**i*<=+<=*j*. Then *f*(*j*)<==<=|*c*1<=-<=*c*2<=+<... | {"inputs": ["5 6 3\n1 2 3 4 5\n1 2 3 4 5 6\n1 1 10\n1 1 -9\n1 5 -1", "1 1 1\n937982044\n179683049\n1 1 821220804"], "outputs": ["0\n9\n0\n0", "758298995\n1579519799"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
904ddf9a4d594b95a85d8cf3bef73636 | Turn Off The TV | Luba needs your help again! Luba has *n* TV sets. She knows that *i*-th TV set will be working from moment of time *l**i* till moment *r**i*, inclusive.
Luba wants to switch off one of TV sets in order to free the socket. Let's call some TV set redundant if after switching it off the number of integer moments of time ... | {"inputs": ["3\n1 3\n4 6\n1 7", "2\n0 10\n0 10", "3\n1 2\n3 4\n6 8", "3\n1 2\n2 3\n3 4", "3\n0 500000000\n500000001 1000000000\n0 1000000000", "3\n1 5\n2 4\n6 10", "10\n4 4\n5 9\n5 7\n2 8\n6 10\n4 10\n1 3\n8 9\n0 0\n5 7", "2\n1 3\n2 4", "1\n8 9", "8\n13 17\n83 89\n31 33\n7 13\n52 52\n88 89\n29 30\n16 22", "4\n63 63\n12... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
90b3babebf9e99d1cac2b06764636584 | none | You are given a rectangular parallelepiped with sides of positive integer lengths $A$, $B$ and $C$.
Find the number of different groups of three integers ($a$, $b$, $c$) such that $1\leq a\leq b\leq c$ and parallelepiped $A\times B\times C$ can be paved with parallelepipeds $a\times b\times c$. Note, that all small p... | {"inputs": ["4\n1 1 1\n1 6 1\n2 2 2\n100 100 100", "10\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1", "10\n9 6 8\n5 5 2\n8 9 2\n2 7 9\n6 4 10\n1 1 8\n2 8 1\n10 6 3\n7 5 2\n9 5 4", "1\n100000 100000 100000"], "outputs": ["1\n4\n4\n165", "1\n1\n1\n1\n1\n1\n1\n1\n1\n1", "41\n6\n21\n12\n39\n4\n7\n2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
90c3ae3432be76316c44df8b294d09fc | Money Transfers | There are *n* banks in the city where Vasya lives, they are located in a circle, such that any two banks are neighbouring if their indices differ by no more than 1. Also, bank 1 and bank *n* are neighbours if *n*<=><=1. No bank is a neighbour of itself.
Vasya has an account in each bank. Its balance may be negative... | {"inputs": ["3\n5 0 -5", "4\n-1 0 1 0", "4\n1 2 3 -6", "1\n0", "50\n108431864 128274949 -554057370 -384620666 -202862975 -803855410 -482167063 -55139054 -215901009 0 0 0 0 0 94325701 730397219 358214459 -673647271 -131397668 -377892440 0 0 0 0 0 -487994257 -360271553 639988328 489338210 -281060728 250208758 0 993242346... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 28 | codeforces | |
90c94d1f5e83e4c8b0d3186dacb5a837 | Good Number | Let's call a number *k*-good if it contains all digits not exceeding *k* (0,<=...,<=*k*). You've got a number *k* and an array *a* containing *n* numbers. Find out how many *k*-good numbers are in *a* (count each number every time it occurs in array *a*).
The first line contains integers *n* and *k* (1<=≤<=*n*<=≤<=100,... | {"inputs": ["10 6\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560", "2 1\n1\n10", "1 0\n1000000000", "1 1\n1000000000", "6 0\n10\n102\n120\n1032\n1212103\n1999999", "1 3\n1000000000", "1 9\n1000000000", "1 0\n1", "1 1\n1", "1 3\n1", "1 9\n1", "2 8\n123456780\n123", "2 8\n123456... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 318 | codeforces | |
90e34ecfae4b0a43ec885c28e8b50ef6 | Фото на память - 2 (round version) | Прошло много лет, и на вечеринке снова встретились *n* друзей. С момента последней встречи техника шагнула далеко вперёд, появились фотоаппараты с автоспуском, и теперь не требуется, чтобы один из друзей стоял с фотоаппаратом, и, тем самым, оказывался не запечатлённым на снимке.
Упрощенно процесс фотографирования можн... | {"inputs": ["3\n10 1\n20 2\n30 3", "3\n3 1\n2 2\n4 3", "1\n5 10", "10\n168 538\n836 439\n190 873\n206 47\n891 591\n939 481\n399 898\n859 466\n701 777\n629 222", "42\n13 62\n114 242\n265 839\n756 349\n298 476\n533 704\n348 277\n554 573\n654 112\n429 836\n574 766\n909 415\n163 891\n532 983\n873 457\n719 117\n1 302\n170 6... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 7 | codeforces | |
912f39a3ff6a9f5dd8230e1c50920c4f | none | Little Chris is very keen on his toy blocks. His teacher, however, wants Chris to solve more problems, so he decided to play a trick on Chris.
There are exactly *s* blocks in Chris's set, each block has a unique number from 1 to *s*. Chris's teacher picks a subset of blocks *X* and keeps it to himself. He will give th... | {"inputs": ["3\n1 4 5", "1\n1", "1\n1000000", "2\n2 999999", "9\n1 2 3 100 500000 500001 999901 999997 999999", "3\n999998 999999 1000000", "3\n1 2 3", "3\n5 345435 999996", "6\n1 10 100 1000 10000 1000000", "2\n1 1000000", "2\n500000 500001", "4\n1 2 999999 1000000", "10\n63649 456347 779 458642 201571 534312 583774 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
9136cb00808749220dc6c0007520b499 | Insomnia cure | «One dragon. Two dragon. Three dragon», — the princess was counting. She had trouble falling asleep, and she got bored of counting lambs when she was nine.
However, just counting dragons was boring as well, so she entertained herself at best she could. Tonight she imagined that all dragons were here to steal her, and ... | {"inputs": ["1\n2\n3\n4\n12", "2\n3\n4\n5\n24", "1\n1\n1\n1\n100000", "10\n9\n8\n7\n6", "8\n4\n4\n3\n65437", "8\n4\n1\n10\n59392", "4\n1\n8\n7\n44835", "6\n1\n7\n2\n62982", "2\n7\n4\n9\n56937", "2\n9\n8\n1\n75083", "8\n7\n7\n6\n69038", "4\n4\n2\n3\n54481", "6\n4\n9\n8\n72628", "9\n7\n8\n10\n42357", "5\n6\n4\n3\n60504",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 410 | codeforces | |
913a723377dcbcee617e84424051c006 | Guess the Array | This is an interactive problem. You should use flush operation after each printed line. For example, in C++ you should use fflush(stdout), in Java you should use System.out.flush(), and in Pascal — flush(output).
In this problem you should guess an array *a* which is unknown for you. The only information you have init... | {"inputs": ["5\n4 6 1 5 5", "3\n1 1 1", "4\n100 1 100 1", "10\n9 5 10 7 4 4 8 5 10 5", "3\n1 1 1", "3\n100000 100000 100000", "3\n91906 50782 19777", "15\n5 10 10 7 7 6 4 6 8 10 8 4 10 9 4", "30\n2 3 3 4 3 2 4 4 4 3 3 2 4 2 3 4 4 2 4 3 4 2 2 4 3 3 4 4 4 4", "35\n4 2 2 2 4 4 3 2 4 2 2 4 2 2 3 2 3 4 4 2 3 2 2 4 3 3 3 3 4... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 109 | codeforces | |
9143317c9ec97376be9a5c100718a323 | Passwords | Vanya is managed to enter his favourite site Codehorses. Vanya uses *n* distinct passwords for sites at all, however he can't remember which one exactly he specified during Codehorses registration.
Vanya will enter passwords in order of non-decreasing their lengths, and he will enter passwords of same length in arbitr... | {"inputs": ["5 2\ncba\nabc\nbb1\nabC\nABC\nabc", "4 100\n11\n22\n1\n2\n22", "1 1\na1\na1", "1 100\na1\na1", "2 1\nabc\nAbc\nAbc", "2 2\nabc\nAbc\nabc", "2 1\nab\nabc\nab", "2 2\nab\nabc\nab", "2 1\nab\nabc\nabc", "2 2\nab\nabc\nabc", "10 3\nOIbV1igi\no\nZS\nQM\n9woLzI\nWreboD\nQ7yl\nA5Rb\nS9Lno72TkP\nfT97o\no", "10 3\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 104 | codeforces |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.