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
69769ded2ddea958b4e6622ce7fb7d10
none
Pavel cooks barbecue. There are *n* skewers, they lay on a brazier in a row, each on one of *n* positions. Pavel wants each skewer to be cooked some time in every of *n* positions in two directions: in the one it was directed originally and in the reversed direction. Pavel has a plan: a permutation *p* and a sequence ...
{"inputs": ["4\n4 3 2 1\n0 1 1 1", "3\n2 3 1\n0 0 0", "1\n1\n0", "2\n1 2\n0 0", "2\n2 1\n0 0", "2\n1 2\n0 1", "2\n2 1\n1 0", "2\n1 2\n1 1", "2\n2 1\n1 1", "5\n2 1 3 4 5\n1 0 0 0 1", "10\n4 10 5 1 6 8 9 2 3 7\n0 1 0 0 1 0 0 1 0 0", "20\n10 15 20 17 8 1 14 6 3 13 19 2 16 12 4 5 11 7 9 18\n0 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
20
codeforces
6978724378602e63542d64fd1f157f42
Line
A line on the plane is described by an equation *Ax*<=+<=*By*<=+<=*C*<==<=0. You are to find any point on this line, whose coordinates are integer numbers from <=-<=5·1018 to 5·1018 inclusive, or to find out that such points do not exist. The first line contains three integers *A*, *B* and *C* (<=-<=2·109<=≤<=*A*,<=*B*...
{"inputs": ["2 5 3", "0 2 3", "931480234 -1767614767 -320146190", "-1548994394 -1586527767 -1203252104", "296038088 887120955 1338330394", "1906842444 749552572 -1693767003", "-1638453107 317016895 -430897103", "-1183748658 875864960 -1315510852", "427055698 738296578 -52640953", "-1516373701 -584304312 -746376800", "2...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
29
codeforces
69acc2eae81f23c8a6ec3869ee66ed2f
Archer
SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner. Output the probability that SmallR will...
{"inputs": ["1 2 1 2", "1 3 1 3", "1 3 2 3", "3 4 3 4", "1 2 10 11", "4 5 4 5", "466 701 95 721", "268 470 444 885", "632 916 713 821", "269 656 918 992", "71 657 187 695", "435 852 973 978", "518 816 243 359", "882 962 311 811", "684 774 580 736", "486 868 929 999", "132 359 996 998", "933 977 266 450", "298 833 615 8...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
353
codeforces
6a1937e725b9a6aff7dc0feedc20e9f0
Binary Number
Little walrus Fangy loves math very much. That's why when he is bored he plays with a number performing some operations. Fangy takes some positive integer *x* and wants to get a number one from it. While *x* is not equal to 1, Fangy repeats the following action: if *x* is odd, then he adds 1 to it, otherwise he divide...
{"inputs": ["1", "1001001", "101110", "11", "11110001101", "1010101001001111000111110011111000010101011111101010", "1100000010010100111011100011110101111", "11000111111110110110100110110101111100010100110110010", "11100000110100011110101001101111100000011001111000011110000000111110111", "1000101100110000000001111010110...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
47
codeforces
6a442951f918b3291f7632fa0bf0689e
Connected Components?
You are given an undirected graph consisting of *n* vertices and edges. Instead of giving you the edges that exist in the graph, we give you *m* unordered pairs (*x*,<=*y*) such that there is no edge between *x* and *y*, and if some pair of vertices is not listed in the input, then there is an edge between these verti...
{"inputs": ["5 5\n1 2\n3 4\n3 2\n4 2\n2 5", "8 15\n2 1\n4 5\n2 4\n3 4\n2 5\n3 5\n2 6\n3 6\n5 6\n4 6\n2 7\n3 8\n2 8\n3 7\n6 7", "12 58\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n1 10\n1 11\n1 12\n2 3\n2 4\n2 5\n2 6\n2 7\n2 8\n2 9\n2 10\n2 11\n2 12\n3 4\n3 5\n3 6\n3 7\n3 8\n3 9\n3 10\n3 11\n3 12\n4 5\n4 6\n4 8\n4 11\n4 12\n5 6\...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
16
codeforces
6a66d1afd709b4c997f0e107675265b7
Fedya and Maths
Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression: for given value of *n*. Fedya managed to complete the task. Can you? Note that given number *n* can be extremely large (e.g. it can exceed any integer type of your programming language). The single line contains a single int...
{"inputs": ["4", "124356983594583453458888889", "2", "7854", "584660", "464", "192329", "85447", "956", "83", "33", "64", "971836", "578487", "71752", "2563", "51494", "247", "52577", "13", "26232", "0", "10", "12", "8", "1"], "outputs": ["4", "0", "0", "0", "4", "4", "0", "0", "4", "0", "0", "4", "4", "0", "4", "0", "...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
84
codeforces
6a681fb01eaba2e90830b8381036cd5d
Not Equal on a Segment
You are given array *a* with *n* integers and *m* queries. The *i*-th query is given with three integers *l**i*,<=*r**i*,<=*x**i*. For the *i*-th query find any position *p**i* (*l**i*<=≤<=*p**i*<=≤<=*r**i*) so that *a**p**i*<=≠<=*x**i*. The first line contains two integers *n*,<=*m* (1<=≤<=*n*,<=*m*<=≤<=2·105) — the ...
{"inputs": ["6 4\n1 2 1 1 3 5\n1 4 1\n2 6 2\n3 4 1\n3 4 2", "1 1\n1\n1 1 1", "1 1\n2\n1 1 2", "1 1\n569888\n1 1 967368", "10 10\n1 1 1 1 1 1 1 1 1 1\n3 10 1\n3 6 1\n1 8 1\n1 7 1\n1 5 1\n3 7 1\n4 7 1\n9 9 1\n6 7 1\n3 4 1", "10 10\n1 2 2 2 2 1 1 2 1 1\n3 3 1\n4 9 1\n4 8 1\n2 7 2\n2 8 2\n3 10 1\n7 7 2\n10 10 2\n1 5 1\n1 2...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
15
codeforces
6a9c2f420ce1c26085455b0f8032be0f
Palindrome Degree
String *s* of length *n* is called *k*-palindrome, if it is a palindrome itself, and its prefix and suffix of length are (*k*<=-<=1)-palindromes. By definition, any string (even empty) is 0-palindrome. Let's call the palindrome degree of string *s* such a maximum number *k*, for which *s* is *k*-palindrome. For examp...
{"inputs": ["a2A", "abacaba", "CCeCeCCCee", "opooppppopppopoppopoooppopopooopopppooopppoppoppoppppoooppooooooopppoopoopooooppooooppppppppooopooop", "odribmizzsgholprdsth", "z"], "outputs": ["1", "6", "4", "3", "1", "1"]}
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
2
codeforces
6a9dad7100e9c491d15d4d8c2341be0d
Bear and Raspberry
The bear decided to store some raspberry for the winter. He cunningly found out the price for a barrel of honey in kilos of raspberry for each of the following *n* days. According to the bear's data, on the *i*-th (1<=≤<=*i*<=≤<=*n*) day, the price for one barrel of honey is going to is *x**i* kilos of raspberry. Unfo...
{"inputs": ["5 1\n5 10 7 3 20", "6 2\n100 1 10 40 10 40", "3 0\n1 2 3", "2 0\n2 1", "10 5\n10 1 11 2 12 3 13 4 14 5", "100 4\n2 57 70 8 44 10 88 67 50 44 93 79 72 50 69 19 21 9 71 47 95 13 46 10 68 72 54 40 15 83 57 92 58 25 4 22 84 9 8 55 87 0 16 46 86 58 5 21 32 28 10 46 11 29 13 33 37 34 78 33 33 21 46 70 77 51 45 9...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
297
codeforces
6acf2fb9e0257a25a02dab4cf9af8c13
Minimal Labels
You are given a directed acyclic graph with *n* vertices and *m* edges. There are no self-loops or multiple edges between any pair of vertices. Graph can be disconnected. You should assign labels to all vertices in such a way that: - Labels form a valid permutation of length *n* — an integer sequence such that each ...
{"inputs": ["3 3\n1 2\n1 3\n3 2", "4 5\n3 1\n4 1\n2 3\n3 4\n2 4", "5 4\n3 1\n2 1\n2 3\n4 5", "2 1\n2 1", "5 10\n5 2\n4 1\n2 1\n3 4\n2 4\n3 2\n5 4\n3 5\n3 1\n5 1", "100 10\n73 55\n29 76\n15 12\n94 46\n77 67\n76 16\n72 50\n41 40\n89 75\n27 22", "100000 10\n4412 787\n97243 62644\n78549 66107\n43440 41961\n39621 35680\n870...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
21
codeforces
6b3e4bd0a44e3c15f50145c3a8b35a30
Pasha and Pixels
Pasha loves his phone and also putting his hair up... But the hair is now irrelevant. Pasha has installed a new game to his phone. The goal of the game is following. There is a rectangular field consisting of *n* row with *m* pixels in each row. Initially, all the pixels are colored white. In one move, Pasha can choos...
{"inputs": ["2 2 4\n1 1\n1 2\n2 1\n2 2", "2 3 6\n2 3\n2 2\n1 3\n2 2\n1 2\n1 1", "5 3 7\n2 3\n1 2\n1 1\n4 1\n3 1\n5 3\n3 2", "3 3 11\n2 1\n3 1\n1 1\n1 3\n1 2\n2 3\n3 3\n3 2\n2 2\n1 3\n3 3", "2 2 5\n1 1\n2 1\n2 1\n1 2\n2 2", "518 518 10\n37 97\n47 278\n17 467\n158 66\n483 351\n83 123\n285 219\n513 187\n380 75\n304 352", ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
207
codeforces
6b3e915ee56ea07b2680bd5f2731c25e
Walking!
There is a sand trail in front of Alice's home. In daytime, people walk over it and leave a footprint on the trail for their every single step. Alice cannot distinguish the order of the footprints, but she can tell whether each footprint is made by left foot or right foot. Also she's certain that all people are walkin...
{"inputs": ["RRLRL", "RLRLRLRLR", "RRRRRLLLL", "RRLLRRRRLLRRLLRRLLLLRRLL", "RRLRRRLLRRLRRRLRLLRRLLLRRRLLRLRRRLRLLRRRRRLLLLRLRRRLRRRLRLRLLLRLLLLLRRLRLLLRRLLLLLRLRRLRRLLLRLLRRLRL", "L", "R", "LLLLRRRRRRLLLLLLRRRRR", "RLRRLLLRLRLRR", "LR", "RL", "LLRRRLLRRRLL", "RRLLLRRLLLRR", "RRLLR", "LLRRL"], "outputs": ["1\n2 5 1 3 4"...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
1
codeforces
6b44c6785c6ccefed3314b846f146f9e
Molly's Chemicals
Molly Hooper has *n* different kinds of chemicals arranged in a line. Each of the chemicals has an affection value, The *i*-th of them has affection value *a**i*. Molly wants Sherlock to fall in love with her. She intends to do this by mixing a contiguous segment of chemicals together to make a love potion with total ...
{"inputs": ["4 2\n2 2 2 2", "4 -3\n3 -6 -3 12", "14 -9\n-2 -4 62 53 90 41 35 21 85 74 85 57 10 39", "20 9\n90 21 -6 -61 14 -21 -17 -65 -84 -75 -48 56 67 -50 16 65 -79 -61 92 85", "89 -7\n5972 4011 3914 670 3727 2913 6935 6927 2118 6645 7141 3585 9811 2859 459 8870 6578 8667 468 5152 3241 7455 7323 8817 4866 1040 5102 9...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
6
codeforces
6b5a6f7fd3372a62826ecad686da6fb9
Cinema Cashier
All cinema halls in Berland are rectangles with *K* rows of *K* seats each, and *K* is an odd number. Rows and seats are numbered from 1 to *K*. For safety reasons people, who come to the box office to buy tickets, are not allowed to choose seats themselves. Formerly the choice was made by a cashier, but now this is th...
{"inputs": ["2 1\n1 1", "4 3\n1 2 3 1", "1 3\n1", "2 3\n3 3", "3 3\n3 2 3", "1 5\n5", "2 5\n3 4", "3 5\n2 5 2", "4 5\n5 5 3 5", "5 5\n4 1 3 1 1", "10 11\n3 11 6 4 4 11 9 2 1 9", "10 13\n12 8 7 11 11 9 2 12 10 1", "10 15\n15 6 1 9 3 10 11 1 14 10", "10 17\n5 8 13 5 11 12 10 17 16 7", "10 19\n8 19 17 12 4 5 9 16 7 3", "5...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
5
codeforces
6b5c9fda8d18efd41bd1e2f20140d0ed
Mind the Gap
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $1$ minute. He was asked to insert one takeoff in the schedule. The takeoff takes $1$ minut...
{"inputs": ["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0", "24 60\n0 21\n2 21\n2 46\n3 17\n4 15\n5 43\n6 41\n7 50\n8 21\n9 8\n10 31\n10 45\n12 30\n14 8\n14 29\n14 32\n14 52\n15 16\n16 7...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
85
codeforces
6b803dbd74756c7a0ce25de8e96ff2e5
A Compatible Pair
Nian is a monster which lives deep in the oceans. Once a year, it shows up on the land, devouring livestock and even people. In order to keep the monster away, people fill their villages with red colour, light, and cracking noise, all of which frighten the monster out of coming. Little Tommy has *n* lanterns and Big B...
{"inputs": ["2 2\n20 18\n2 14", "5 3\n-1 0 1 2 3\n-1 0 1", "10 2\n1 6 2 10 2 3 2 10 6 4\n5 7", "50 50\n1 6 2 10 2 3 2 10 6 4 5 0 3 1 7 3 2 4 4 2 1 5 0 6 10 1 8 0 10 9 0 4 10 5 5 7 4 9 9 5 5 2 6 7 9 4 3 7 2 0\n0 5 9 4 4 6 1 8 2 1 6 6 8 6 4 4 7 2 1 8 6 7 4 9 8 3 0 2 0 10 7 1 4 9 4 4 2 5 3 5 1 3 2 4 1 6 5 3 8 6", "5 7\n-1...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
92
codeforces
6b871f4add35d8a08ea4c61c04c0b5d4
Mishka and trip
Little Mishka is a great traveller and she visited many countries. After thinking about where to travel this time, she chose XXX — beautiful, but little-known northern country. Here are some interesting facts about XXX: 1. XXX consists of *n* cities, *k* of whose (just imagine!) are capital cities. 1. All of cities...
{"inputs": ["4 1\n2 3 1 2\n3", "5 2\n3 5 2 2 4\n1 4", "3 1\n1 1 1\n1", "3 3\n1 1 1\n1 2 3", "7 7\n6 9 2 7 4 8 7\n1 2 3 4 5 6 7", "5 5\n6 2 4 10 2\n1 2 3 4 5", "5 5\n6 7 8 8 8\n1 2 3 4 5", "9 4\n5 6 7 1 5 4 8 7 1\n1 5 7 9", "7 2\n1 6 8 3 3 5 5\n1 3", "9 4\n182 938 865 240 911 25 373 22 875\n3 6 7 8", "10 4\n7931 7116 49...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
5
codeforces
6ba63d2f5d8138cc02354cc2aa491aa6
Watermelon
One hot summer day Pete and his friend Billy decided to buy a watermelon. They chose the biggest and the ripest one, in their opinion. After that the watermelon was weighed, and the scales showed *w* kilos. They rushed home, dying of thirst, and decided to divide the berry, however they faced a hard problem. Pete and ...
{"inputs": ["8", "5", "4", "3", "2", "1", "7", "6", "10", "9", "53", "77", "32", "44", "98", "99", "90", "67", "100", "88"], "outputs": ["YES", "NO", "YES", "NO", "NO", "NO", "NO", "YES", "YES", "NO", "NO", "NO", "YES", "YES", "YES", "NO", "YES", "NO", "YES", "YES"]}
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
693
codeforces
6bf60cd692f741caed0e551b1119e8ec
Devu, the Singer and Churu, the Joker
Devu is a renowned classical singer. He is invited to many big functions/festivals. Recently he was invited to "All World Classical Singing Festival". Other than Devu, comedian Churu was also invited. Devu has provided organizers a list of the songs and required time for singing them. He will sing *n* songs, *i**th* s...
{"inputs": ["3 30\n2 2 1", "3 20\n2 1 1", "50 10000\n5 4 10 9 9 6 7 7 7 3 3 7 7 4 7 4 10 10 1 7 10 3 1 4 5 7 2 10 10 10 2 3 4 7 6 1 8 4 7 3 8 8 4 10 1 1 9 2 6 1", "50 10000\n4 7 15 9 11 12 20 9 14 14 10 13 6 13 14 17 6 8 20 12 10 15 13 17 5 12 13 11 7 5 5 2 3 15 13 7 14 14 19 2 13 14 5 15 3 19 15 16 4 1", "100 9000\n5 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
471
codeforces
6c50edebb128b0ef825474bcdce42054
Find The Bone
Zane the wizard is going to perform a magic show shuffling the cups. There are *n* cups, numbered from 1 to *n*, placed along the *x*-axis on a table that has *m* holes on it. More precisely, cup *i* is on the table at the position *x*<==<=*i*. The problematic bone is initially at the position *x*<==<=1. Zane will co...
{"inputs": ["7 3 4\n3 4 6\n1 2\n2 5\n5 7\n7 1", "5 1 2\n2\n1 2\n2 4", "10000 1 9\n55\n44 1\n2929 9292\n9999 9998\n44 55\n49 94\n55 53\n100 199\n55 50\n53 11", "100000 3 7\n2 3 4\n1 5\n5 1\n1 5\n5 1\n1 4\n4 3\n3 2", "1000000 9 11\n38 59 999999 199 283 4849 1000000 2 554\n39 94\n3 9\n1 39\n39 40\n40 292\n5399 5858\n292 4...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
50
codeforces
6c7887430d8f0c8d26269c0b9a7af34e
You're a Professional
A simple recommendation system would recommend a user things liked by a certain number of their friends. In this problem you will implement part of such a system. You are given user's friends' opinions about a list of items. You are also given a threshold *T* — the minimal number of "likes" necessary for an item to be...
{"inputs": ["3 3 2\nYYY\nNNN\nYNY", "4 4 1\nNNNY\nNNYN\nNYNN\nYNNN", "3 5 2\nNYNNY\nYNNNN\nNNYYN", "1 10 1\nYYYNYNNYNN", "10 1 5\nY\nN\nN\nN\nY\nN\nN\nY\nN\nN", "10 10 1\nNNNNNNNNNN\nNNNNNNNNNN\nNNNNNNNNNN\nNNNNNNNNNN\nNNNNNNNNNN\nNNNNNNNNNN\nNNNNNNNNNN\nNNNNNNNNNN\nNNNNNNNNNN\nNNNNNNNNNN", "10 10 10\nYYYYYYYYYY\nYYYYY...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
16
codeforces
6c919e2b0df67554198028b21a7e301e
First Digit Law
In the probability theory the following paradox called Benford's law is known: "In many lists of random numbers taken from real sources, numbers starting with digit 1 occur much more often than numbers starting with any other digit" (that's the simplest form of the law). Having read about it on Codeforces, the Hedgeho...
{"inputs": ["1\n1 2\n50", "2\n1 2\n9 11\n50", "3\n2 9\n20 99\n5 5\n0", "3\n2 9\n20 99\n5 5\n100", "1\n1 1\n100", "4\n1 100\n11 19\n101 199\n15 15\n100", "10\n10 17\n10 12\n3 6\n17 18\n6 15\n9 18\n3 10\n10 15\n17 19\n2 13\n59", "10\n5 20\n13 16\n12 30\n7 16\n10 29\n21 21\n22 26\n14 22\n2 10\n1 29\n48", "15\n11 20\n16 18...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
4
codeforces
6ca98a9abcdc68bfd325eb090fa72aab
New Year Cards
As meticulous Gerald sets the table, Alexander finished another post on Codeforces and begins to respond to New Year greetings from friends. Alexander has *n* friends, and each of them sends to Alexander exactly one e-card. Let us number his friends by numbers from 1 to *n* in the order in which they send the cards. Le...
{"inputs": ["4\n1 2 3 4\n4 1 3 2\n4 3 1 2\n3 4 2 1\n3 1 2 4", "2\n1 2\n2 1\n2 1", "3\n1 2 3\n2 3 1\n1 3 2\n3 2 1", "5\n1 4 2 3 5\n5 1 3 4 2\n3 2 4 1 5\n1 4 5 3 2\n5 2 3 4 1\n5 4 2 1 3", "10\n5 1 6 2 8 3 4 10 9 7\n3 1 10 6 8 5 2 7 9 4\n2 9 1 4 10 6 8 7 3 5\n10 1 7 8 3 2 4 6 5 9\n3 2 10 4 7 8 5 6 1 9\n5 6 3 10 8 7 2 9 4 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
6
codeforces
6cb4576303d3b40dbf510002d41cd3b1
Andrey and Problem
Andrey needs one more problem to conduct a programming contest. He has *n* friends who are always willing to help. He can ask some of them to come up with a contest problem. Andrey knows one value for each of his fiends — the probability that this friend will come up with a problem if Andrey asks him. Help Andrey choo...
{"inputs": ["4\n0.1 0.2 0.3 0.8", "2\n0.1 0.2", "1\n0.217266", "2\n0.608183 0.375030", "3\n0.388818 0.399762 0.393874", "4\n0.801024 0.610878 0.808545 0.732504", "5\n0.239482 0.686259 0.543226 0.764939 0.401318", "6\n0.462434 0.775020 0.479749 0.373861 0.492031 0.746333", "7\n0.745337 0.892271 0.792853 0.892917 0.76824...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
28
codeforces
6cefe83344a570d72979ed5ace1b0015
Alyona and copybooks
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook for *a* rubles, a pack of two copybooks for *b* rubles, and a pack ...
{"inputs": ["1 1 3 4", "6 2 1 1", "4 4 4 4", "999999999 1000000000 1000000000 1000000000", "1016 3 2 1", "17 100 100 1", "17 2 3 100", "18 1 3 3", "19 1 1 1", "999999997 999999990 1000000000 1000000000", "999999998 1000000000 999999990 1000000000", "634074578 336470888 481199252 167959139", "999999999 1000000000 100000...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
142
codeforces
6cf2d7404c1710c85dd4176b03c54664
Summer Camp
Every year, hundreds of people come to summer camps, they learn new algorithms and solve hard problems. This is your first year at summer camp, and you are asked to solve the following problem. All integers starting with 1 are written in one line. The prefix of these line is "123456789101112131415...". Your task is to...
{"inputs": ["3", "11", "12", "13", "29", "30", "1000", "999", "100", "123", "8", "157", "289", "179", "942", "879", "394", "423", "952", "121", "613", "945", "270", "781", "453", "171", "643", "570", "750", "500", "2", "1", "108", "500", "189", "491", "191"], "outputs": ["3", "0", "1", "1", "9", "2", "3", "9", "5", "6"...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
368
codeforces
6d2e99edaf65af436e74bf409494fe5b
Very Beautiful Number
Teacher thinks that we make a lot of progress. Now we are even allowed to use decimal notation instead of counting sticks. After the test the teacher promised to show us a "very beautiful number". But the problem is, he's left his paper with the number in the teachers' office. The teacher remembers that the "very beau...
{"inputs": ["6 5", "1 2", "6 4", "11 1", "42 5", "36 5", "56 3", "88 9", "81 7", "100 1", "58 6", "3282 5", "24002 7", "8140 7", "23910 4", "11478 4", "12818 8", "999999 8", "100002 4", "337 6", "11389 6", "1000000 3", "1000000 1", "2 7", "1 1"], "outputs": ["142857", "Impossible", "102564", "11111111111", "10204081632...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
7
codeforces
6d5221a978b652defdeae7f5e3469cac
Levko and Permutation
Levko loves permutations very much. A permutation of length *n* is a sequence of distinct positive integers, each is at most *n*. Let’s assume that value *gcd*(*a*,<=*b*) shows the greatest common divisor of numbers *a* and *b*. Levko assumes that element *p**i* of permutation *p*1,<=*p*2,<=... ,<=*p**n* is good if *g...
{"inputs": ["4 2", "1 1", "7 4", "10 9", "10000 5000", "7 0", "1 0", "7 7", "100000 47", "100000 100000", "100000 43425", "7 6", "100000 99999", "47 46", "5 0", "4 2", "1533 1052", "81314 52747", "17767 145", "18168 7942", "26593 15915", "26593 8877", "13852 12727", "4 1", "8834 8834", "8485 8484", "14564 14564", "8254...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
108
codeforces
6d5b1c026ba6c1af6fba85c8d6e409bb
Purification
You are an adventurer currently journeying inside an evil temple. After defeating a couple of weak zombies, you arrived at a square room consisting of tiles forming an *n*<=×<=*n* grid. The rows are numbered 1 through *n* from top to bottom, and the columns are numbered 1 through *n* from left to right. At the far side...
{"inputs": ["3\n.E.\nE.E\n.E.", "3\nEEE\nE..\nE.E", "5\nEE.EE\nE.EE.\nE...E\n.EE.E\nEE.EE", "3\n.EE\n.EE\n.EE", "5\nEE.EE\nEE..E\nEEE..\nEE..E\nEE.EE", "1\nE", "8\nE.EEE..E\nEEE.E.E.\nEEE.E.E.\nEE.E.E..\nE...EE..\nE.EE....\n..EE....\nE..E.EE.", "17\nEE...E.EE.EE..E..\nE.....EE..E..E..E\nEEEE.EEEE..E..E.E\n.E.E.EEE.EEEE...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
21
codeforces
6dadd620920edfb1edbee1553bb820ee
Dasha and Password
After overcoming the stairs Dasha came to classes. She needed to write a password to begin her classes. The password is a string of length *n* which satisfies the following requirements: - There is at least one digit in the string, - There is at least one lowercase (small) letter of the Latin alphabet in the string,...
{"inputs": ["3 4\n1**2\na3*0\nc4**", "5 5\n#*&#*\n*a1c&\n&q2w*\n#a3c#\n*&#*&", "5 2\n&l\n*0\n*9\n*#\n#o", "25 16\nvza**ooxkmd#*ywa\ndip#*#&ef&z&&&pv\nwggob&&72#*&&nku\nrsb##*&jm&#u**te\nzif#lu#t&2w#jbqb\nwfo&#&***0xp#&hp\njbw##h*###nkmkdn\nqrn*&y#3cnf&d*rc\nend*zg&0f*&g*&ak\niayh&r#8om#o**yq\nwym&e&*v0j&#zono\ntzu*vj&i...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
43
codeforces
6dd4ecd12771553ae125882e94ff943c
Significant Cups
Stepan is a very experienced olympiad participant. He has *n* cups for Physics olympiads and *m* cups for Informatics olympiads. Each cup is characterized by two parameters — its significance *c**i* and width *w**i*. Stepan decided to expose some of his cups on a shelf with width *d* in such a way, that: - there is ...
{"inputs": ["3 1 8\n4 2\n5 5\n4 2\n3 2", "4 3 12\n3 4\n2 4\n3 5\n3 4\n3 5\n5 2\n3 4", "2 2 2\n5 3\n6 3\n4 2\n8 1", "10 10 229\n15 17\n5 4\n4 15\n4 17\n15 11\n7 6\n5 19\n14 8\n4 1\n10 12\n20 13\n20 14\n16 13\n7 15\n2 16\n11 11\n19 20\n6 7\n4 11\n14 16", "10 20 498\n40 12\n23 25\n20 9\n8 1\n23 8\n31 24\n33 2\n22 33\n4 13...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
2
codeforces
6df7a596947d9d0d3c1607821180ca35
Beautiful Paintings
There are *n* pictures delivered for the new exhibition. The *i*-th painting has beauty *a**i*. We know that a visitor becomes happy every time he passes from a painting to a more beautiful one. We are allowed to arranged pictures in any order. What is the maximum possible number of times the visitor may become happy ...
{"inputs": ["5\n20 30 10 50 40", "4\n200 100 100 200", "10\n2 2 2 2 2 2 2 2 2 2", "1\n1000", "2\n444 333", "100\n9 9 72 55 14 8 55 58 35 67 3 18 73 92 41 49 15 60 18 66 9 26 97 47 43 88 71 97 19 34 48 96 79 53 8 24 69 49 12 23 77 12 21 88 66 9 29 13 61 69 54 77 41 13 4 68 37 74 7 6 29 76 55 72 89 4 78 27 29 82 18 83 12...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
97
codeforces
6dfc961b9b9cd5602504e14fc0fb01c4
Finding Team Member
There is a programing contest named SnakeUp, 2*n* people want to compete for it. In order to attend this contest, people need to form teams of exactly two people. You are given the strength of each possible combination of two people. All the values of the strengths are distinct. Every contestant hopes that he can find...
{"inputs": ["2\n6\n1 2\n3 4 5", "3\n487060\n3831 161856\n845957 794650 976977\n83847 50566 691206 498447\n698377 156232 59015 382455 626960", "3\n8\n1 6\n14 13 15\n4 2 11 9\n12 5 3 7 10", "1\n1000000", "3\n1000000\n999999 999998\n999997 999996 999995\n999994 999993 999992 999991\n999990 999989 999988 999987 999986"], "...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
7
codeforces
6dfcac919c08dffa6e6836e1c3a3b8ed
Sequence Formatting
Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something else does not look neat, he rushes to correct it. For example, number sequence written like "1,2 ,3,...,   10" will be corrected ...
{"inputs": ["1,2 ,3,..., 10", "1,,,4...5......6", ",,,,,,,,,,,,,", "123456789", ",", "1 4 5 6 7 999 1 1 1 2 311111111111111111111111111111111111111111", "1,2,,,,,,,,,5566", "...,", ",,", ",...,", "1...10", ", ,", "1235634615111235634615111235634615111235634615111235634615111235634...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
14
codeforces
6e0b77cb8cb7c6adcab680be206a2647
Points and Powers of Two
There are $n$ distinct points on a coordinate line, the coordinate of $i$-th point equals to $x_i$. Choose a subset of the given set of points such that the distance between each pair of points in a subset is an integral power of two. It is necessary to consider each pair of points, not only adjacent. Note that any sub...
{"inputs": ["6\n3 5 4 7 10 12", "5\n-1 2 5 8 11", "1\n42", "3\n0 -536870912 536870912", "2\n536870912 -536870912", "3\n1 2 3", "4\n1 2 3 8", "2\n1 2", "3\n0 1 2", "2\n-3 -2", "2\n-4 -2", "2\n2 1", "1\n1", "3\n0 2 6", "3\n2 4 8", "2\n1 0", "3\n5 6 7", "3\n-1 1 0"], "outputs": ["3\n3 4 5 ", "1\n-1 ", "1\n42 ", "3\n-53687...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
33
codeforces
6e0bc12d128f12665442cb838644357e
Giga Tower
Giga Tower is the tallest and deepest building in Cyberland. There are 17<=777<=777<=777 floors, numbered from <=-<=8<=888<=888<=888 to 8<=888<=888<=888. In particular, there is floor 0 between floor <=-<=1 and floor 1. Every day, thousands of tourists come to this place to enjoy the wonderful view. In Cyberland, it ...
{"inputs": ["179", "-1", "18", "-410058385", "-586825624", "852318890", "919067153", "690422411", "-408490162", "-8", "-6", "-4", "-2", "0", "2", "4", "6", "8", "1000000000", "-1000000000", "88888", "89", "-80000000", "-8888", "-17", "78", "-19", "-999999998", "-999999997", "999999997", "811111111", "-8", "-5", "-7", "...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
325
codeforces
6e0dc02ba7291c453c2ec9afee5215ce
Petya and Exam
It's hard times now. Today Petya needs to score 100 points on Informatics exam. The tasks seem easy to Petya, but he thinks he lacks time to finish them all, so he asks you to help with one.. There is a glob pattern in the statements (a string consisting of lowercase English letters, characters "?" and "*"). It is kno...
{"inputs": ["ab\na?a\n2\naaa\naab", "abc\na?a?a*\n4\nabacaba\nabaca\napapa\naaaaax", "s\nc*?cb\n26\nbbaa\nb\ncc\ncbaab\nacacc\nca\na\nc\ncb\nabb\nba\nb\nba\ncac\nccccb\nccb\nbbbc\nabbcb\na\nbc\nc\na\nabb\nca\ncacb\nac", "o\n*\n28\nbac\nbcc\ncbcb\ncaabc\ncb\nacab\ncbccb\ncbccc\nc\nbbaa\ncaaaa\nbbc\nba\nc\ncacbc\ncbab\na...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
8
codeforces
6e5afbd84d28e58ac91f81bf4f65bc6c
Hexadecimal's Numbers
One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got access to the memory of his not less mean sister Hexadecimal. He loaded there a huge amount of *n* different natural numbers from 1 to *n* to obtain total control over her energy. But his plan failed. The reason for th...
{"inputs": ["10", "20", "72", "99", "100", "101", "102", "111", "112", "745", "23536", "1", "1010011", "312410141", "1000000000", "999999999", "111111111", "101010101", "121212121", "106341103", "901556123", "832513432", "3", "732875234", "7", "9", "2", "11", "12", "13", "101020101", "111100100", "110110101", "10011100...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
156
codeforces
6e8114ca264a25df7a13855f7cf6b174
Palindrome
Given a string *s*, determine if it contains any palindrome of length exactly 100 as a subsequence. If it has any, print any one of them. If it doesn't have any, print a palindrome that is a subsequence of *s* and is as long as possible. The only line of the input contains one string *s* of length *n* (1<=≤<=*n*<=≤<=5·...
{"inputs": ["bbbabcbbb", "rquwmzexectvnbanemsmdufrg", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "ab", "abacaba", "star...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
1
codeforces
6e860da383f076b1aad581c40df6343a
Rooter's Song
Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size *w*<=×<=*h*, represented by a rectangle with corners (0,<=0), (*w*,<=0), (*w*,<=*h*) and (0,<=*h*). It can be seen that no collisions will happen before one enters the stage. ...
{"inputs": ["8 10 8\n1 1 10\n1 4 13\n1 7 1\n1 8 2\n2 2 0\n2 5 14\n2 6 0\n2 6 1", "3 2 3\n1 1 2\n2 1 1\n1 1 5", "1 10 10\n1 8 1", "3 4 5\n1 3 9\n2 1 9\n1 2 8", "10 500 500\n2 88 59\n2 470 441\n1 340 500\n2 326 297\n1 74 45\n1 302 273\n1 132 103\n2 388 359\n1 97 68\n2 494 465", "20 50000 50000\n2 45955 55488\n1 19804 293...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
8
codeforces
6e98357b8c0bdb3110306bd85830da4a
Convert to Ones
You've got a string $a_1, a_2, \dots, a_n$, consisting of zeros and ones. Let's call a sequence of consecutive elements $a_i, a_{i<=+<=1}, \ldots,<=a_j$ ($1\leq<=i\leq<=j\leq<=n$) a substring of string $a$. You can apply the following operations any number of times: - Choose some substring of string $a$ (for examp...
{"inputs": ["5 1 10\n01000", "5 10 1\n01000", "7 2 3\n1111111", "1 60754033 959739508\n0", "1 431963980 493041212\n1", "1 314253869 261764879\n0", "1 491511050 399084767\n1", "2 163093925 214567542\n00", "2 340351106 646854722\n10", "2 222640995 489207317\n01", "2 399898176 552898277\n11", "2 690218164 577155357\n00", ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
118
codeforces
6e9dcbd071b375bcf1238a31296b6008
Bear and Big Brother
Bear Limak wants to become the largest of bears, or at least to become larger than his brother Bob. Right now, Limak and Bob weigh *a* and *b* respectively. It's guaranteed that Limak's weight is smaller than or equal to his brother's weight. Limak eats a lot and his weight is tripled after every year, while Bob's we...
{"inputs": ["4 7", "4 9", "1 1", "4 6", "1 10", "1 1", "1 2", "1 3", "1 4", "1 5", "1 6", "1 7", "1 8", "1 9", "1 10", "2 2", "2 3", "2 4", "2 5", "2 6", "2 7", "2 8", "2 9", "2 10", "3 3", "3 4", "3 5", "3 6", "3 7", "3 8", "3 9", "3 10", "4 4", "4 5", "4 6", "4 7", "4 8", "4 9", "4 10", "5 5", "5 6", "5 7", "5 8", "5...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
631
codeforces
6ec23bfaec147ed3968f9eb421419a85
Sorting Railway Cars
An infinitely long railway has a train consisting of *n* cars, numbered from 1 to *n* (the numbers of all the cars are distinct) and positioned in arbitrary order. David Blaine wants to sort the railway cars in the order of increasing numbers. In one move he can make one of the cars disappear from its place and telepor...
{"inputs": ["5\n4 1 2 5 3", "4\n4 1 3 2", "1\n1", "2\n1 2", "2\n2 1", "6\n5 3 6 1 4 2", "7\n1 2 3 6 7 4 5", "8\n6 2 1 8 5 7 3 4", "3\n1 2 3", "3\n1 3 2", "3\n2 1 3", "3\n2 3 1", "3\n3 1 2", "3\n3 2 1", "7\n1 3 5 7 2 4 6", "7\n1 5 2 6 3 7 4", "5\n1 4 2 3 5", "9\n1 6 4 5 9 8 7 3 2", "10\n5 1 6 2 8 3 4 10 9 7", "50\n39 8 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
82
codeforces
6eec6d76e2ac4d80c0ce716c2185a9b9
Lizards and Basements 2
This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements». At the moment he is playing it as a magician. At one of the las...
{"inputs": ["3 2 1\n2 2 2", "4 3 1\n1 4 1 1", "3 5 3\n1 2 1", "3 5 3\n3 2 2", "3 5 3\n3 2 2", "3 5 1\n10 10 10", "3 5 3\n10 9 7", "3 5 1\n1 9 10", "3 5 3\n10 9 7", "3 5 2\n9 3 6", "4 5 3\n2 2 2 1", "4 5 3\n2 3 2 2", "4 5 3\n4 2 4 2", "4 5 1\n4 9 1 8", "4 5 3\n9 9 3 4", "4 5 1\n8 8 9 8", "4 5 3\n10 10 10 10", "4 5 2\n7 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
5
codeforces
6ef0e2137716f500bd93702edd34f22b
Propagating tree
Iahub likes trees very much. Recently he discovered an interesting tree named propagating tree. The tree consists of *n* nodes numbered from 1 to *n*, each node *i* having an initial value *a**i*. The root of the tree is node 1. This tree has a special property: when a value *val* is added to a value of node *i*, the ...
{"inputs": ["5 5\n1 2 1 1 2\n1 2\n1 3\n2 4\n2 5\n1 2 3\n1 1 2\n2 1\n2 2\n2 4", "10 10\n137 197 856 768 825 894 86 174 218 326\n7 8\n4 7\n8 9\n7 10\n1 2\n2 4\n3 6\n3 5\n2 3\n1 9 624\n2 1\n2 4\n1 6 505\n1 8 467\n1 3 643\n2 1\n1 8 631\n2 4\n1 7 244", "10 10\n418 45 865 869 745 901 177 773 854 462\n4 8\n1 4\n3 6\n1 5\n1 10...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
1
codeforces
6f1948aa1a3f58e6b1b4feacc7b7e014
Tower of Hanoi
The Tower of Hanoi is a well-known mathematical puzzle. It consists of three rods, and a number of disks of different sizes which can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending order of size on one rod, the smallest at the top, thus making a conical shape. The objective of the pu...
{"inputs": ["0 1 1\n1 0 1\n1 1 0\n3", "0 2 2\n1 0 100\n1 2 0\n3", "0 2 1\n1 0 100\n1 2 0\n5", "0 5835 1487\n6637 0 9543\n6961 6820 0\n7", "0 3287 5433\n6796 0 5787\n1445 6158 0\n26", "0 4449 3122\n6816 0 8986\n1048 1468 0\n4", "0 913 8129\n8352 0 4408\n9073 7625 0\n30", "0 8392 3430\n5262 0 6256\n8590 8091 0\n29", "0 6...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
2
codeforces
6f32c4a1bdb0354e980a56e43f7f70b4
Matrix Walk
There is a matrix *A* of size *x*<=×<=*y* filled with integers. For every , *A**i*,<=*j*<==<=*y*(*i*<=-<=1)<=+<=*j*. Obviously, every integer from [1..*xy*] occurs exactly once in this matrix. You have traversed some path in this matrix. Your path can be described as a sequence of visited cells *a*1, *a*2, ..., *a**...
{"inputs": ["8\n1 2 3 6 9 8 5 2", "6\n1 2 1 2 5 3", "2\n1 10", "3\n1 2 2", "1\n1", "1\n6", "2\n2 3", "2\n1000000000 1", "4\n3 2 4 2", "5\n1 2 5 4 3", "2\n1 1", "3\n1 3 4", "1\n1000000000", "6\n1 4 5 6 3 2", "8\n1 2 3 6 9 8 7 6", "9\n4 3 2 1 5 6 7 8 9", "8\n2 5 8 9 6 3 2 1", "4\n1 2 1 3", "3\n1 4 3", "5\n1 2 3 4 1", "6\...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
1
codeforces
6f6ba61afc5da72f67d05cadb8e29e00
Hungry Student Problem
Ivan's classes at the university have just finished, and now he wants to go to the local CFK cafe and eat some fried chicken. CFK sells chicken chunks in small and large portions. A small portion contains 3 chunks; a large one — 7 chunks. Ivan wants to eat exactly *x* chunks. Now he wonders whether he can buy exactly ...
{"inputs": ["2\n6\n5", "100\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n71\n72\n73\n74\n75\n...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
205
codeforces
6f88d078f556c38aa64f874a732d49a1
Spit Problem
In a Berland's zoo there is an enclosure with camels. It is known that camels like to spit. Bob watched these interesting animals for the whole day and registered in his notepad where each animal spitted. Now he wants to know if in the zoo there are two camels, which spitted at each other. Help him to solve this task. ...
{"inputs": ["2\n0 1\n1 -1", "3\n0 1\n1 1\n2 -2", "5\n2 -10\n3 10\n0 5\n5 -5\n10 1", "10\n-9897 -1144\n-4230 -6350\n2116 -3551\n-3635 4993\n3907 -9071\n-2362 4120\n-6542 984\n5807 3745\n7594 7675\n-5412 -6872", "11\n-1536 3809\n-2406 -8438\n-1866 395\n5636 -490\n-6867 -7030\n7525 3575\n-6796 2908\n3884 4629\n-2862 -6122...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
244
codeforces
6f94033e42e6a08e91be2f6a70cd3a1f
Lakes in Berland
The map of Berland is a rectangle of the size *n*<=×<=*m*, which consists of cells of size 1<=×<=1. Each cell is either land or water. The map is surrounded by the ocean. Lakes are the maximal regions of water cells, connected by sides, which are not connected with the ocean. Formally, lake is a set of water cells, s...
{"inputs": ["5 4 1\n****\n*..*\n****\n**.*\n..**", "3 3 0\n***\n*.*\n***", "3 5 1\n.**.*\n*.*.*\n***..", "3 5 0\n.**.*\n*.*.*\n***..", "3 50 7\n***.********.*********************.**********.****\n*...**..*.**.*.*.*.*.*.*.*..*.*.*.*.*.*.*.*.*.*..*\n****************.*.********.**********************", "50 3 4\n***\n*.*\n...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
3
codeforces
6fa56519080e5ae2d001b4538fae2064
Less or Equal
You are given a sequence of integers of length $n$ and integer number $k$. You should print any integer number $x$ in the range of $[1; 10^9]$ (i.e. $1 \le x \le 10^9$) such that exactly $k$ elements of given sequence are less than or equal to $x$. Note that the sequence can contain equal elements. If there is no suc...
{"inputs": ["7 4\n3 7 5 1 10 3 20", "7 2\n3 7 5 1 10 3 20", "1 0\n1", "1 0\n2", "1 1\n1000000000", "3 0\n3 3 3", "3 0\n2 2 3", "5 0\n3 4 5 6 7", "4 0\n2 3 4 5", "2 2\n1000000000 1000000000", "7 2\n2 7 5 1 10 2 20", "2 1\n1 1", "5 3\n1 3 3 4 5", "4 4\n1000000000 1000000000 1000000000 1000000000"], "outputs": ["5", "-1",...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
34
codeforces
6fad140b01b60938c5f1ca7ca0c595c1
A Mist of Florescence
"I've been here once," Mino exclaims with delight, "it's breathtakingly amazing." "What is it like?" "Look, Kanno, you've got your paintbrush, and I've got my words. Have a try, shall we?" There are four kinds of flowers in the wood, Amaranths, Begonias, Centaureas and Dianthuses. The wood can be represented by a ...
{"inputs": ["5 3 2 1", "50 50 1 1", "1 6 4 5", "1 1 1 1", "4 8 16 32", "1 1 1 50", "19 58 20 18", "100 100 100 100", "1 1 1 2", "1 1 3 1", "1 4 1 1", "5 1 1 1", "1 4 7 3", "6 2 5 1", "1 5 6 3", "4 1 4 5", "4 5 3 6", "2 5 1 17", "11 4 5 14", "19 19 8 10", "49 49 49 49", "49 50 50 50", "50 50 51 50", "15 63 41 45", "45 3...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
37
codeforces
6fcc6e981568cc6fcb2d4525c65fed0a
Queries for Number of Palindromes
You've got a string *s*<==<=*s*1*s*2... *s*|*s*| of length |*s*|, consisting of lowercase English letters. There also are *q* queries, each query is described by two integers *l**i*,<=*r**i* (1<=≤<=*l**i*<=≤<=*r**i*<=≤<=|*s*|). The answer to the query is the number of substrings of string *s*[*l**i*... *r**i*], which a...
{"inputs": ["caaaba\n5\n1 1\n1 4\n2 3\n4 6\n4 5", "a\n100\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
1
codeforces
6fd7e39fbfb49f8c3355674346e9c9e3
none
The main road in Bytecity is a straight line from south to north. Conveniently, there are coordinates measured in meters from the southernmost building in north direction. At some points on the road there are *n* friends, and *i*-th of them is standing at the point *x**i* meters and can move with any speed no greater ...
{"inputs": ["3\n7 1 3\n1 2 1", "4\n5 10 3 2\n2 3 2 4", "3\n1 1000000000 2\n1 2 1000000000", "2\n4 5\n10 8", "4\n14 12 10 17\n8 6 5 10", "5\n1 15 61 29 43\n15 11 19 19 19", "10\n20 11 17 38 15 27 2 40 24 37\n22 30 22 30 28 16 7 20 22 13", "2\n1000000000 1000000000\n1 1", "3\n1 1 1\n1 1 1"], "outputs": ["2.000000000000",...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
126
codeforces
6fef8e4304c116331fb41daf0b0b2c4b
Bear and Different Names
In the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they got an order that Bob is a scouter, if there are two Bobs?). A group of soldiers is effective if and only if their names...
{"inputs": ["8 3\nNO NO YES YES YES NO", "9 8\nYES NO", "3 2\nNO NO", "2 2\nYES", "2 2\nNO", "7 2\nYES NO YES YES NO YES", "18 7\nYES YES YES YES YES YES YES NO NO NO NO NO", "50 3\nNO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
48
codeforces
6ff3cefda98378fc0c21b62cb6ae02e9
Music
Little Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favorite songs in a well-known social network InTalk. Unfortunately, internet is not that fast in the city of Ekaterinozavodsk and the song takes a lot of time to download. But Lesha is quite ...
{"inputs": ["5 2 2", "5 4 7", "6 2 3", "2 1 2", "2 1 3", "2 1 10000", "12326 6163 2", "10000 2500 4", "100000 99999 4", "12351 1223 6", "100000 1 10000", "10028 13 10000", "100000 99999 2", "100000 99999 3", "100000 1 2", "100000 1 3", "100000 1 4", "100000 1 5", "100000 3125 2", "12628 1804 7", "100000 45 13", "100000...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
92
codeforces
6ff5c28d8fd9e8778ea5afef93fb2782
Lucky Tree
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. One day Petya encountered a tree with *n* vertexes. Besides, the tree was weighted, i. e. each edge ...
{"inputs": ["4\n1 2 4\n3 1 2\n1 4 7", "4\n1 2 4\n1 3 47\n1 4 7447", "9\n1 2 7\n1 3 12\n4 1 2\n4 5 4\n4 6 47\n4 7 9\n5 8 2\n5 9 1", "2\n1 2 7", "2\n2 1 1000000000", "9\n1 2 1\n1 3 7\n3 4 19\n3 5 2\n4 6 46\n7 4 25\n5 8 64\n5 9 73", "7\n1 2 47\n1 3 9\n3 7 7\n3 4 2\n3 5 4\n3 6 1", "5\n1 2 1\n2 3 1\n3 4 1\n4 5 2", "7\n1 2 4...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
2
codeforces
6ff65660825765bf2edf2a8845293afc
Gotta Catch Em' All!
Bash wants to become a Pokemon master one day. Although he liked a lot of Pokemon, he has always been fascinated by Bulbasaur the most. Soon, things started getting serious and his fascination turned into an obsession. Since he is too young to go out and catch Bulbasaur, he came up with his own way of catching a Bulbas...
{"inputs": ["Bulbbasaur", "F", "aBddulbasaurrgndgbualdBdsagaurrgndbb", "BBBBBBBBBBbbbbbbbbbbuuuuuuuuuullllllllllssssssssssaaaaaaaaaarrrrrrrrrr", "BBBBBBBBBBbbbbbbbbbbbbbbbbbbbbuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuussssssssssssssssssssaaaaaaaaaaaaaaaaaaaaaaaa...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
162
codeforces
704b7c118ec16d231e3db433b28d05dd
Minimal string
Petya recieved a gift of a string *s* with length up to 105 characters for his birthday. He took two more empty strings *t* and *u* and decided to play a game. This game has two possible moves: - Extract the first character of *s* and append *t* with this character. - Extract the last character of *t* and append *u*...
{"inputs": ["cab", "acdb", "a", "ab", "ba", "dijee", "bhrmc", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bababaaababaabbbbbabbbbbbaaabbabaaaaabbbbbaaaabbbbabaabaabababbbabbabbabaaababbabbababaaaaabaaaabbba", "bccbbcccbccbacacbaccaababcbaababaaaaabcaaabcaacba...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
51
codeforces
705bd4865fdc3cbea4d14da2c58f73e0
Online Courses In BSU
Now you can take online courses in the Berland State University! Polycarp needs to pass *k* main online courses of his specialty to get a diploma. In total *n* courses are availiable for the passage. The situation is complicated by the dependence of online courses, for each course there is a list of those that must be...
{"inputs": ["6 2\n5 3\n0\n0\n0\n2 2 1\n1 4\n1 5", "9 3\n3 9 5\n0\n0\n3 9 4 5\n0\n0\n1 8\n1 6\n1 2\n2 1 2", "3 3\n1 2 3\n1 2\n1 3\n1 1", "5 3\n2 1 4\n0\n0\n1 5\n0\n0", "5 2\n4 1\n0\n1 4\n1 5\n0\n2 1 2", "5 2\n4 5\n2 3 4\n1 4\n1 4\n0\n0", "6 6\n5 4 3 2 6 1\n1 4\n0\n2 2 6\n2 3 6\n3 3 4 6\n0", "6 6\n4 1 6 3 2 5\n2 3 5\n4 1...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
6
codeforces
7064cdd96129ae92a071cde28506aecb
Learning Languages
The "BerCorp" company has got *n* employees. These employees can use *m* approved official languages for the formal correspondence. The languages are numbered with integers from 1 to *m*. For each employee we have the list of languages, which he knows. This list could be empty, i. e. an employee may know no official la...
{"inputs": ["5 5\n1 2\n2 2 3\n2 3 4\n2 4 5\n1 5", "8 7\n0\n3 1 2 3\n1 1\n2 5 4\n2 6 7\n1 3\n2 7 4\n1 1", "2 2\n1 2\n0", "2 2\n0\n0", "5 5\n1 3\n0\n0\n2 4 1\n0", "6 2\n0\n0\n2 1 2\n1 1\n1 1\n0", "7 3\n3 1 3 2\n3 2 1 3\n2 2 3\n1 1\n2 2 3\n3 3 2 1\n3 2 3 1", "8 4\n0\n0\n4 2 3 1 4\n4 2 1 4 3\n3 4 3 1\n1 2\n2 4 1\n2 4 2", "...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
105
codeforces
706acd5730014b72a9d13d61f09d85ff
Mister B and Book Reading
Mister B once received a gift: it was a book about aliens, which he started read immediately. This book had *c* pages. At first day Mister B read *v*0 pages, but after that he started to speed up. Every day, starting from the second, he read *a* pages more than on the previous day (at first day he read *v*0 pages, at ...
{"inputs": ["5 5 10 5 4", "12 4 12 4 1", "15 1 100 0 0", "1 1 1 0 0", "1000 999 1000 1000 998", "1000 2 2 5 1", "1000 1 1 1000 0", "737 41 74 12 11", "1000 1000 1000 0 999", "765 12 105 5 7", "15 2 2 1000 0", "1000 1 1000 1000 0", "20 3 7 1 2", "1000 500 500 1000 499", "1 1000 1000 1000 0", "1000 2 1000 56 0", "1000 2 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
195
codeforces
7076598337a1b1fdaeeb053b998c22c7
none
Память компьютера состоит из *n* ячеек, которые выстроены в ряд. Пронумеруем ячейки от 1 до *n* слева направо. Про каждую ячейку известно, свободна она или принадлежит какому-либо процессу (в таком случае известен процесс, которому она принадлежит). Для каждого процесса известно, что принадлежащие ему ячейки занимают ...
{"inputs": ["4\n0 2 2 1", "8\n0 8 8 8 0 4 4 2", "5\n0 0 0 1 1", "6\n0 0 0 3 0 0", "10\n0 10 10 0 0 3 3 0 0 0", "10\n0 9 9 9 9 0 8 8 8 8", "15\n0 0 6 6 0 0 0 0 4 0 0 0 9 0 0", "21\n0 11 11 11 11 0 7 0 12 12 12 12 12 0 19 19 19 0 1 1 1", "24\n0 0 6 6 6 0 22 22 0 23 23 0 19 19 19 19 0 0 17 0 0 3 3 3", "15\n1 1 1 1 5 5 5 4...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
4
codeforces
708287e8934727d8ebe2beebfac85f87
Chtholly's request
— I experienced so many great things. — You gave me memories like dreams... But I have to leave now... — One last request, can you... — Help me solve a Codeforces problem? — ...... — What? Chtholly has been thinking about a problem for days: If a number is palindrome and length of its decimal representation with...
{"inputs": ["2 100", "5 30", "42147 412393322", "77809 868097296", "5105 443422097", "75615 376679484", "22951 23793302", "12785 993582106", "60276 428978808", "84776 104860385", "41984 653766991", "100000 1000000000", "41163 472310076", "6983 765352180", "33493 967727004", "90898 94010922", "67298 349286579", "92452 2...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
239
codeforces
709787118e4472b115d8d0cf837ebc30
A Determined Cleanup
In order to put away old things and welcome a fresh new year, a thorough cleaning of the house is a must. Little Tommy finds an old polynomial and cleaned it up by taking it modulo another. But now he regrets doing this... Given two integers *p* and *k*, find a polynomial *f*(*x*) with non-negative integer coefficien...
{"inputs": ["46 2", "2018 214", "4 2", "5 2", "10 3", "250 1958", "1000000000000000000 2000", "1 2", "2 2", "3 2", "6 2", "7 2", "8 2", "9 2", "10 2", "1 3", "2 3", "3 3", "4 3", "5 3", "6 3", "7 3", "8 3", "9 3", "462 2", "462 3", "2018 4", "20180214 5", "1317 221", "1314 520", "1562 862", "6666666666666666 3", "25252...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
37
codeforces
709fd4d9e29409d95b3039b0cf648ced
Correcting Mistakes
Analyzing the mistakes people make while typing search queries is a complex and an interesting work. As there is no guaranteed way to determine what the user originally meant by typing some query, we have to use different sorts of heuristics. Polycarp needed to write a code that could, given two words, check whether t...
{"inputs": ["7\nreading\ntrading", "5\nsweet\nsheep", "3\ntoy\ntry", "5\nspare\nspars", "1\na\nb", "1\nz\ny", "2\nab\nac", "2\nba\nca", "2\nac\ncb", "100\neebdeddddbecdbddaaecbbaccbecdeacedddcaddcdebedbabbceeeadecadbbeaecdaeabbceacbdbdbbdacebbbccdcbbeedbe\ndacdeebebeaeaacdeedadbcbaedcbddddddedacbabeddebaaebbdcebebaaccb...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
14
codeforces
70ad39a204d5f344618bb21bc61d6a45
Karen and Supermarket
On the way home, Karen decided to stop by the supermarket to buy some groceries. She needs to buy a lot of goods, but since she is a student her budget is still quite limited. In fact, she can only spend up to *b* dollars. The supermarket sells *n* goods. The *i*-th good can be bought for *c**i* dollars. Of course, e...
{"inputs": ["6 16\n10 9\n10 5 1\n12 2 1\n20 18 3\n10 2 3\n2 1 5", "5 10\n3 1\n3 1 1\n3 1 2\n3 1 3\n3 1 4", "13 30\n6 4\n25 5 1\n7 1 2\n9 4 2\n10 2 1\n12 3 1\n5 2 3\n10 9 6\n2 1 1\n5 3 9\n10 2 10\n10 9 6\n3 2 11", "8 9\n4 3\n8 3 1\n2 1 1\n4 2 2\n7 2 2\n3 1 2\n7 3 5\n2 1 3", "9 15\n3 1\n6 2 1\n8 3 2\n4 1 2\n2 1 2\n3 2 3\...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
2
codeforces
70cd612001f2bd39369ae10726c2feac
none
A remote island chain contains *n* islands, labeled 1 through *n*. Bidirectional bridges connect the islands to form a simple cycle — a bridge connects islands 1 and 2, islands 2 and 3, and so on, and additionally a bridge connects islands *n* and 1. The center of each island contains an identical pedestal, and all but...
{"inputs": ["3\n1 0 2\n2 0 1", "2\n1 0\n0 1", "4\n1 2 3 0\n0 3 2 1", "9\n3 8 4 6 7 1 5 2 0\n6 4 8 5 3 1 2 0 7", "4\n2 3 1 0\n2 0 1 3", "4\n0 1 2 3\n2 0 1 3", "4\n3 0 1 2\n1 0 2 3", "3\n0 2 1\n1 2 0", "2\n0 1\n0 1", "6\n3 1 5 4 0 2\n0 4 3 5 2 1", "4\n2 0 3 1\n3 1 0 2", "5\n3 0 2 1 4\n4 3 0 1 2", "3\n2 0 1\n1 0 2", "10\n...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
45
codeforces
7106a5a4ccf392528293f254daca3836
Permutations
You are given a permutation *p* of numbers 1,<=2,<=...,<=*n*. Let's define *f*(*p*) as the following sum: Find the lexicographically *m*-th permutation of length *n* in the set of permutations having the maximum possible value of *f*(*p*). The single line of input contains two integers *n* and *m* (1<=≤<=*m*<=≤<=*cnt*...
{"inputs": ["2 2", "3 2", "1 1", "3 1", "3 3", "3 4", "4 1", "4 3", "4 4", "4 8", "5 2", "5 7", "5 15", "6 23", "7 7", "7 44", "8 1", "8 127", "8 128"], "outputs": ["2 1 ", "1 3 2 ", "1 ", "1 2 3 ", "2 3 1 ", "3 2 1 ", "1 2 3 4 ", "1 3 4 2 ", "1 4 3 2 ", "4 3 2 1 ", "1 2 3 5 4 ", "1 4 5 3 2 ", "4 5 3 2 1 ", "2 5 6 4 3 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
48
codeforces
7138af4685444691c2b25b0bdce983e3
Destruction of a Tree
You are given a tree (a graph with *n* vertices and *n*<=-<=1 edges in which it's possible to reach any vertex from any other vertex using only its edges). A vertex can be destroyed if this vertex has even degree. If you destroy a vertex, all edges connected to it are also deleted. Destroy all vertices in the given t...
{"inputs": ["5\n0 1 2 1 2", "4\n0 1 2 3", "1\n0", "8\n3 1 4 0 4 2 4 5", "100\n81 96 65 28 4 40 5 49 5 89 48 70 94 70 17 58 58 1 61 19 45 33 46 19 22 83 56 67 62 82 57 16 29 36 84 71 42 66 78 54 73 45 82 80 67 88 79 69 61 66 5 36 24 60 96 21 77 67 68 29 87 37 91 34 78 43 0 69 49 62 16 2 68 79 57 1 60 12 39 99 14 37 30 9...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
2
codeforces
716e110f0464198d037e1dd300a49754
Bear and Five Cards
A little bear Limak plays a game. He has five cards. There is one number written on each card. Each number is a positive integer. Limak can discard (throw out) some cards. His goal is to minimize the sum of numbers written on remaining (not discarded) cards. He is allowed to at most once discard two or three cards wi...
{"inputs": ["7 3 7 3 20", "7 9 3 1 8", "10 10 10 10 10", "8 7 1 8 7", "7 7 7 8 8", "8 8 8 2 2", "8 8 2 2 2", "5 50 5 5 60", "100 100 100 100 100", "1 1 1 1 1", "29 29 20 20 20", "20 29 20 29 20", "31 31 20 20 20", "20 20 20 31 31", "20 31 20 31 20", "20 20 20 30 30", "30 30 20 20 20", "8 1 8 8 8", "1 1 1 8 1", "1 2 3 4...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
133
codeforces
7191b886b2342aa9f0bc1752ce01932b
Pasha and String
Pasha got a very beautiful string *s* for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |*s*| from left to right, where |*s*| is the length of the given string. Pasha didn't like his present very much so he decided to change it. After his birthday Pasha ...
{"inputs": ["abcdef\n1\n2", "vwxyz\n2\n2 2", "abcdef\n3\n1 2 3", "jc\n5\n1 1 1 1 1", "wljqgdlxyc\n13\n3 4 3 3 5 4 4 2 4 4 5 3 3", "keicnqmuqinhsmtudqcilocxkbqgzhbkitmqwttdyoyvcbxincwjryzknubpacsngorexaldfurondbednowemnnlphhboycfavs\n2\n5 12", "xwcxggxvfqbdklewbxkjzibmufnaywuxsqvwakefxbbkfandvigasbhbatsxyqxicrosatfsfybe...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
104
codeforces
71bdb35746c7c54bba2602aa6767893a
Arthur and Brackets
Notice that the memory limit is non-standard. Recently Arthur and Sasha have studied correct bracket sequences. Arthur understood this topic perfectly and become so amazed about correct bracket sequences, so he even got himself a favorite correct bracket sequence of length 2*n*. Unlike Arthur, Sasha understood the top...
{"inputs": ["4\n1 1\n1 1\n1 1\n1 1", "3\n5 5\n3 3\n1 1", "3\n5 5\n3 3\n2 2", "3\n2 3\n1 4\n1 4", "6\n1 5\n2 4\n1 1\n1 1\n1 1\n1 1", "3\n1 4\n2 2\n1 1", "5\n1 3\n2 5\n3 4\n1 2\n1 9", "2\n3 3\n3 3", "1\n1 1", "10\n9 9\n5 5\n1 1\n1 1\n13 13\n11 11\n1 1\n5 5\n1 1\n1 1", "50\n97 97\n61 61\n59 59\n29 29\n13 13\n7 7\n5 5\n3 3...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
1
codeforces
71e025842157ee5552327ed027b3b6d3
Substring
You are given a graph with $n$ nodes and $m$ directed edges. One lowercase letter is assigned to each node. We define a path's value as the number of the most frequently occurring letter. For example, if letters on a path are "abaca", then the value of that path is $3$. Your task is find a path whose value is the large...
{"inputs": ["5 4\nabaca\n1 2\n1 3\n3 4\n4 5", "6 6\nxzyabc\n1 2\n3 1\n2 3\n5 4\n4 3\n6 4", "10 14\nxzyzyzyzqx\n1 2\n2 4\n3 5\n4 5\n2 6\n6 8\n6 5\n2 10\n3 9\n10 9\n4 6\n1 10\n2 8\n3 7", "1 1\nf\n1 1", "10 50\nebibwbjihv\n1 10\n1 2\n5 4\n1 8\n9 7\n5 6\n1 8\n8 7\n2 6\n5 4\n1 9\n3 2\n8 3\n5 6\n5 9\n2 4\n2 7\n3 9\n1 2\n1 7\...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
24
codeforces
71f7922bb52860546e0b6c4ad6365d5d
Quasi-palindrome
Let quasi-palindromic number be such number that adding some leading zeros (possible none) to it produces a palindromic string. String *t* is called a palindrome, if it reads the same from left to right and from right to left. For example, numbers 131 and 2010200 are quasi-palindromic, they can be transformed to str...
{"inputs": ["131", "320", "2010200", "1", "1000000000", "999999999", "999999998", "102000", "210000000", "213443120", "99", "22002", "1010", "1201", "6460046", "503435", "21002", "101001", "200102", "20010002", "33003", "100101", "1021", "1101", "10101100", "101", "1011", "11010", "10110", "110000", "2011", "10020001",...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
246
codeforces
72154bce8f297ac2e3f2dbe058abef0e
Marvolo Gaunt's Ring
Professor Dumbledore is helping Harry destroy the Horcruxes. He went to Gaunt Shack as he suspected a Horcrux to be present there. He saw Marvolo Gaunt's Ring and identified it as a Horcrux. Although he destroyed it, he is still affected by its curse. Professor Snape is helping Dumbledore remove the curse. For this, he...
{"inputs": ["5 1 2 3\n1 2 3 4 5", "5 1 2 -3\n-1 -2 -3 -4 -5", "5 886327859 82309257 -68295239\n-731225382 354766539 -48222231 -474691998 360965777", "4 -96405765 -495906217 625385006\n-509961652 392159235 -577128498 -744548876", "43 959134961 -868367850 142426380\n921743429 63959718 -797293233 122041422 -407576197 7001...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
96
codeforces
72192ff030fb3bf908ee666a246cd70b
Mentors
In BerSoft $n$ programmers work, the programmer $i$ is characterized by a skill $r_i$. A programmer $a$ can be a mentor of a programmer $b$ if and only if the skill of the programmer $a$ is strictly greater than the skill of the programmer $b$ $(r_a &gt; r_b)$ and programmers $a$ and $b$ are not in a quarrel. You are...
{"inputs": ["4 2\n10 4 10 15\n1 2\n4 3", "10 4\n5 4 1 5 4 3 7 1 2 5\n4 6\n2 1\n10 8\n3 5", "2 0\n3 1", "2 0\n1 1", "10 35\n322022227 751269818 629795150 369443545 344607287 250044294 476897672 184054549 986884572 917181121\n6 3\n7 3\n1 9\n7 9\n10 7\n3 4\n8 6\n7 4\n6 10\n7 2\n3 5\n6 9\n3 10\n8 7\n6 5\n8 1\n8 5\n1 7\n8 1...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
22
codeforces
7228f18da7fed17083cc15458e82d310
Domino piling
You are given a rectangular board of *M*<=×<=*N* squares. Also you are given an unlimited number of standard domino pieces of 2<=×<=1 squares. You are allowed to rotate the pieces. You are asked to place as many dominoes as possible on the board so as to meet the following conditions: 1. Each domino completely covers ...
{"inputs": ["2 4", "3 3", "1 5", "1 6", "1 15", "1 16", "2 5", "2 6", "2 7", "2 14", "2 15", "1 4", "2 16", "3 5", "3 6", "3 10", "3 14", "3 15", "3 16", "5 7", "16 16", "15 16", "2 3", "15 15", "14 16", "11 13", "5 16", "8 15", "2 2", "3 4", "4 4", "1 1", "1 2", "1 3", "14 15"], "outputs": ["4", "4", "2", "3", "7", "8...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
3,908
codeforces
722da95a33955b90c2bf82a34b3bb610
Pig and Palindromes
Peppa the Pig was walking and walked into the forest. What a strange coincidence! The forest has the shape of a rectangle, consisting of *n* rows and *m* columns. We enumerate the rows of the rectangle from top to bottom with numbers from 1 to *n*, and the columns — from left to right with numbers from 1 to *m*. Let's ...
{"inputs": ["3 4\naaab\nbaaa\nabba", "2 2\nab\naa", "3 5\nqqqrw\nwqqtw\newqqq", "1 5\nabbba", "1 5\nabbbb", "1 4\nabca", "5 1\na\na\na\na\na", "5 2\nab\nab\ncc\nba\nba", "5 3\naba\naba\nccc\nbaa\nbaa", "5 5\naaaaa\naaaaa\naaaaa\naaaaa\naaaaa", "5 5\naaaaa\nadaaa\naaaaa\naaaaa\naacaa", "5 5\naaaqa\naaaaa\naaaaa\naaaaa\n...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
5
codeforces
72392bfc46fcb8be3645ce5e5dc8ca05
Mountain Scenery
Little Bolek has found a picture with *n* mountain peaks painted on it. The *n* painted peaks are represented by a non-closed polyline, consisting of 2*n* segments. The segments go through 2*n*<=+<=1 points with coordinates (1,<=*y*1), (2,<=*y*2), ..., (2*n*<=+<=1,<=*y*2*n*<=+<=1), with the *i*-th segment connecting th...
{"inputs": ["3 2\n0 5 3 5 1 5 2", "1 1\n0 2 0", "1 1\n1 100 0", "3 1\n0 1 0 1 0 2 0", "3 1\n0 1 0 2 0 1 0", "3 3\n0 100 35 67 40 60 3", "7 3\n1 2 1 3 1 2 1 2 1 3 1 3 1 2 1", "100 100\n1 3 1 3 1 3 0 2 0 3 1 3 1 3 1 3 0 3 1 3 0 2 0 2 0 3 0 2 0 2 0 3 1 3 1 3 1 3 1 3 0 2 0 3 1 3 0 2 0 2 0 2 0 2 0 2 0 3 0 3 0 3 0 3 0 2 0 3 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
128
codeforces
724a4c13f3ca6aa5877b722fc19e0413
Resource Distribution
One department of some software company has $n$ servers of different specifications. Servers are indexed with consecutive integers from $1$ to $n$. Suppose that the specifications of the $j$-th server may be expressed with a single integer number $c_j$ of artificial resource units. In order for production to work, it ...
{"inputs": ["6 8 16\n3 5 2 9 8 7", "4 20 32\n21 11 11 12", "4 11 32\n5 5 16 16", "5 12 20\n7 8 4 11 9", "2 1 1\n1 1", "2 1 1\n1 1000000", "2 1 1\n1000000000 1000000000", "2 1 2\n1 1", "15 250 200\n71 2 77 69 100 53 54 40 73 32 82 58 24 82 41", "4 12 11\n4 4 6 11"], "outputs": ["Yes\n4 2\n3 1 2 6\n5 4", "Yes\n1 3\n1\n2 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
8
codeforces
72820233354134500e4063498a6717f0
Weird Rounding
Polycarp is crazy about round numbers. He especially likes the numbers divisible by 10*k*. In the given number of *n* Polycarp wants to remove the least number of digits to get a number that is divisible by 10*k*. For example, if *k*<==<=3, in the number 30020 it is enough to delete a single digit (2). In this case, t...
{"inputs": ["30020 3", "100 9", "10203049 2", "0 1", "0 9", "100 2", "102030404 2", "1000999999 3", "12000000 4", "1090090090 5", "10 1", "10 2", "10 9", "100 1", "100 3", "101010110 3", "101010110 1", "101010110 2", "101010110 4", "101010110 5", "101010110 9", "1234567890 1", "1234567890 2", "1234567890 9", "200000000...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
179
codeforces
72b27ecee4e2a8f3268f429ae77dad23
Ant on the Tree
Connected undirected graph without cycles is called a tree. Trees is a class of graphs which is interesting not only for people, but for ants too. An ant stands at the root of some tree. He sees that there are *n* vertexes in the tree, and they are connected by *n*<=-<=1 edges so that there is a path between any pair ...
{"inputs": ["3\n1 2\n2 3\n3", "6\n1 2\n1 3\n2 4\n4 5\n4 6\n5 6 3", "6\n1 2\n1 3\n2 4\n4 5\n4 6\n5 3 6", "10\n8 10\n2 1\n7 5\n5 4\n6 10\n2 3\n3 10\n2 9\n7 2\n6 9 4 8", "8\n4 3\n6 7\n8 6\n6 1\n4 6\n6 5\n6 2\n3 2 7 8 5", "8\n4 3\n1 4\n8 5\n7 6\n3 5\n7 3\n4 2\n2 6 8", "20\n4 13\n17 7\n19 10\n18 1\n5 15\n2 6\n11 7\n3 6\n5 1...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
13
codeforces
72b42c09aa731632c82d0fda042cc4d8
Lucky Subsequence
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 has sequence *a* consisting of *n* integers. The subsequence of the sequence *a* is such su...
{"inputs": ["3 2\n10 10 10", "4 2\n4 4 7 7", "7 4\n1 2 3 4 5 6 7", "7 4\n7 7 7 7 7 7 7", "10 1\n1 2 3 4 5 6 7 8 9 10", "10 7\n1 2 3 4 5 6 7 8 9 10", "20 7\n1 4 5 8 47 777777777 1 5 4 8 5 9 5 4 7 4 5 7 7 44474", "5 2\n47 47 47 47 47", "13 5\n44 44 44 44 44 44 44 44 77 55 66 99 55", "3 2\n1 47 47", "2 2\n47 47", "2 2\n44...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
3
codeforces
72bbbcff66eb716aa7bc1702a512ce3d
Dima and Guards
Nothing has changed since the last round. Dima and Inna still love each other and want to be together. They've made a deal with Seryozha and now they need to make a deal with the dorm guards... There are four guardposts in Dima's dorm. Each post contains two guards (in Russia they are usually elderly women). You can b...
{"inputs": ["10\n5 6 5 6\n6 6 7 7\n5 8 6 6\n9 9 9 9", "10\n6 6 6 6\n7 7 7 7\n4 4 4 4\n8 8 8 8", "5\n3 3 3 3\n3 3 3 3\n3 3 3 3\n3 3 3 3", "100000\n100000 100000 100000 100000\n100000 100000 100000 100000\n100000 100000 100000 100000\n100000 100000 100000 100000", "5\n3 2 3 3\n3 2 3 3\n4 4 4 4\n4 4 1 1", "100\n1 1 2 2\n1...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
57
codeforces
72d25ec743d032211913d9611cd07a45
Square Earth?
Meg the Rabbit decided to do something nice, specifically — to determine the shortest distance between two points on the surface of our planet. But Meg... what can you say, she wants everything simple. So, she already regards our planet as a two-dimensional circle. No, wait, it's even worse — as a square of side *n*. T...
{"inputs": ["2 0 0 1 0", "2 0 1 2 1", "100 0 0 100 100", "4 0 3 1 4", "10 8 10 10 0", "26 21 0 26 14", "15 0 1 11 0", "26 26 7 26 12", "6 6 0 2 6", "5 1 5 2 5", "99 12 0 35 99", "44 44 31 28 0", "42 42 36 5 0", "87 87 66 0 5", "85 0 32 0 31", "30 20 30 3 0", "5 4 0 5 1", "40 24 40 4 0", "11 0 2 11 4", "82 0 11 35 0", "...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
28
codeforces
7307aab67e8176e638767b6378a44995
Chocolate Bar
You have a rectangular chocolate bar consisting of *n*<=×<=*m* single squares. You want to eat exactly *k* squares, so you may need to break the chocolate bar. In one move you can break any single rectangular piece of chocolate in two rectangular pieces. You can break only by lines between squares: horizontally or ve...
{"inputs": ["4\n2 2 1\n2 2 3\n2 2 2\n2 2 4"], "outputs": ["5\n5\n4\n0"]}
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
3
codeforces
733c09dbb540865f8619f90de41154e5
The Wall
Iahub and his friend Floyd have started painting a wall. Iahub is painting the wall red and Floyd is painting it pink. You can consider the wall being made of a very large number of bricks, numbered 1, 2, 3 and so on. Iahub has the following scheme of painting: he skips *x*<=-<=1 consecutive bricks, then he paints th...
{"inputs": ["2 3 6 18", "4 6 20 201", "15 27 100 10000", "105 60 3456 78910", "1 1 1000 100000", "3 2 5 5", "555 777 1 1000000", "1000 1000 1 32323", "45 125 93451125 100000000", "101 171 1 1000000000", "165 255 69696 1000000000", "555 777 666013 1000000000", "23 46 123321 900000000", "321 123 15 1000000", "819 1000 95...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
148
codeforces
7342c11337a3f2aed7498a23929c2593
GCD Table
Consider a table *G* of size *n*<=×<=*m* such that *G*(*i*,<=*j*)<==<=*GCD*(*i*,<=*j*) for all 1<=≤<=*i*<=≤<=*n*,<=1<=≤<=*j*<=≤<=*m*. *GCD*(*a*,<=*b*) is the greatest common divisor of numbers *a* and *b*. You have a sequence of positive integer numbers *a*1,<=*a*2,<=...,<=*a**k*. We say that this sequence occurs in t...
{"inputs": ["100 100 5\n5 2 1 2 1", "100 8 5\n5 2 1 2 1", "100 100 7\n1 2 3 4 5 6 7", "5 5 5\n1 1 1 1 1", "11 10 1\n11", "108 942 35\n1 1 3 1 1 3 1 1 3 1 1 3 1 1 3 1 1 3 1 1 3 1 1 3 31 1 3 1 1 3 1 1 3 1 1", "1000000000000 1000000000000 116\n1587924000 7 2 3 4 5 6 1 56 9 10 1 12 13 2 105 16 1 18 1 620 3 14 1 24 25 26 27...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
6
codeforces
735a04aff31665beb4885fab2271e2bf
Playing with Paper
One day Vasya was sitting on a not so interesting Maths lesson and making an origami from a rectangular *a* mm <=×<= *b* mm sheet of paper (*a*<=&gt;<=*b*). Usually the first step in making an origami is making a square piece of paper from the rectangular sheet by folding the sheet along the bisector of the right angle...
{"inputs": ["2 1", "10 7", "1000000000000 1", "3 1", "4 1", "3 2", "4 2", "1000 700", "959986566087 524054155168", "4 3", "7 6", "1000 999", "1000 998", "1000 997", "42 1", "1000 1", "8 5", "13 8", "987 610", "442 42", "754 466", "1000000000000 999999999999", "1000000000000 999999999998", "941 14", "998 2", "1000 42", ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
312
codeforces
736d64400df84fb0b7e53e0ca922c7a8
Polycarpus' Dice
Polycarp has *n* dice *d*1,<=*d*2,<=...,<=*d**n*. The *i*-th dice shows numbers from 1 to *d**i*. Polycarp rolled all the dice and the sum of numbers they showed is *A*. Agrippina didn't see which dice showed what number, she knows only the sum *A* and the values *d*1,<=*d*2,<=...,<=*d**n*. However, she finds it enough...
{"inputs": ["2 8\n4 4", "1 3\n5", "2 3\n2 3", "1 1\n3", "1 2\n3", "2 2\n2 3", "2 4\n2 3", "3 3\n5 1 5", "3 4\n5 1 5", "3 5\n5 1 5", "3 6\n5 1 5", "3 7\n5 1 5", "3 8\n5 1 5", "3 5\n1 2 100", "10 20\n1 1 1 1 5 100 1 1 1 1", "5 50\n1 1 1 1 1000000", "5 50\n2 2 2 2 1000000", "5 50\n10 10 10 10 1000000", "10 19\n1 5 6 1 6 4...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
70
codeforces
73844bd17524419c97f556d2c107bd32
Clothes
A little boy Gerald entered a clothes shop and found out something very unpleasant: not all clothes turns out to match. For example, Gerald noticed that he looks rather ridiculous in a smoking suit and a baseball cap. Overall the shop sells *n* clothing items, and exactly *m* pairs of clothing items match. Each item h...
{"inputs": ["3 3\n1 2 3\n1 2\n2 3\n3 1", "3 2\n2 3 4\n2 3\n2 1", "4 4\n1 1 1 1\n1 2\n2 3\n3 4\n4 1", "4 3\n10 10 5 1\n2 1\n3 1\n3 4", "4 0\n9 8 2 10", "4 3\n5 5 9 6\n3 2\n1 4\n3 4", "4 3\n5 1 10 1\n2 1\n3 2\n1 4", "4 3\n1 2 8 6\n1 3\n1 4\n3 4", "4 4\n9 3 3 1\n1 2\n3 1\n3 2\n4 3", "4 3\n6 8 10 1\n2 3\n1 4\n3 4", "4 5\n4...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
15
codeforces
73ac9650486f781ac4e25a416255efdb
Cutting Carrot
Igor the analyst has adopted *n* little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally, and thus he wants to cut the carrot into *n* pieces of equal area. Formally, the carrot can be viewed as an isosceles tri...
{"inputs": ["3 2", "2 100000", "1000 100000", "2 1", "1000 1", "20 17", "999 1", "998 99999", "574 29184", "2 5713", "937 23565", "693 39706", "449 88550", "642 37394", "961 53535", "4 31901", "4 23850", "4 72694", "4 21538", "4 70383", "5 1", "5 1", "5 1", "5 1", "5 1", "20 1", "775 1", "531 1", "724 1", "917 1", "458...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
167
codeforces
73c2c373039ed01f1cd16fb20ce3d7a7
Lucky Mask
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 calls a mask of a positive integer *n* the number that is obtained after successive writing ...
{"inputs": ["1 7", "100 47", "458 47", "7 7", "547 47", "77 77", "44 4", "740 4", "100000 77777", "77777 77777", "47 74", "74 77", "77 74", "98545 7474", "99997 4", "100000 7", "99997 47", "47774 774", "47744 7", "45896 4", "45679 77777", "99979 77", "10 77777", "1 47774", "47774 47774", "47580 47774", "55557 74", "597...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
33
codeforces
73c44a48d44126430dc7349b0c20f436
Magnum Opus
Salve, mi amice. Et tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non potest creatio ex nihilo. Necesse est partibus. Rp:     I Aqua Fortis     I Aqua Regia     II Amalgama     VII Minium     IV Vitriol Misce in vitro et æstus, et nil admirari. Festina lente, et nulla tenaci...
{"inputs": ["2 4 6 8 10", "50 27 17 31 89", "50 87 29 81 21", "74 21 36 68 80", "75 82 48 95 12", "41 85 14 43 23", "94 28 3 29 9", "94 21 36 89 20", "60 92 82 71 53", "46 68 3 0 51", "12 39 3 50 84", "12 31 47 31 84", "79 2 93 92 16", "65 46 3 77 81", "31 38 47 26 13", "42 9 59 19 24", "51 19 70 5 78", "51 56 14 99 21...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
17
codeforces
73d950c4bb08b0f14ae222ba7f1c8b69
Compatible Numbers
Two integers *x* and *y* are compatible, if the result of their bitwise "AND" equals zero, that is, *a* &amp; *b*<==<=0. For example, numbers 90 (10110102) and 36 (1001002) are compatible, as 10110102 &amp; 1001002<==<=02, and numbers 3 (112) and 6 (1102) are not compatible, as 112 &amp; 1102<==<=102. You are given an...
{"inputs": ["2\n90 36", "4\n3 6 3 6", "5\n10 6 9 8 2", "10\n4 9 8 3 2 6 8 2 9 7", "10\n3 5 18 12 4 20 11 19 15 6", "15\n8 4 9 3 6 6 6 6 1 6 7 1 8 9 2", "20\n280 983 126 941 167 215 868 748 383 554 917 285 43 445 331 800 527 998 503 164", "5\n1 4 2 3 5", "1\n1", "1\n4000000", "1\n2097152"], "outputs": ["36 90", "-1 -1 -...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
7
codeforces
73e0e3099a08bef90835f286bcd130e8
none
One day student Vasya was sitting on a lecture and mentioned a string *s*1*s*2... *s**n*, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph *G* with the following properties: - *G* has exactly *n* vertices, numbe...
{"inputs": ["2 1\n1 2", "4 3\n1 2\n1 3\n1 4", "4 4\n1 2\n1 3\n1 4\n3 4", "1 0", "8 28\n3 2\n4 2\n7 4\n6 3\n3 7\n8 1\n3 4\n5 1\n6 5\n5 3\n7 1\n5 8\n5 4\n6 1\n6 4\n2 1\n4 1\n8 2\n7 2\n6 8\n8 4\n6 7\n3 1\n7 8\n3 8\n5 7\n5 2\n6 2", "8 28\n3 2\n4 2\n7 4\n6 3\n3 7\n8 1\n3 4\n5 1\n6 5\n5 3\n7 1\n5 8\n5 4\n6 1\n6 4\n2 1\n4 1\n...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
12
codeforces
740f0bdf10e187653b10fb1e412b52c9
Game
Two players play a simple game. Each player is provided with a box with balls. First player's box contains exactly *n*1 balls and second player's box contains exactly *n*2 balls. In one move first player can take from 1 to *k*1 balls from his box and throw them away. Similarly, the second player can take from 1 to *k*2...
{"inputs": ["2 2 1 2", "2 1 1 1", "5 7 4 1", "5 7 1 4", "5 7 10 10", "5 7 1 10", "1 1 1 1", "50 50 50 50", "50 49 1 2", "50 48 3 1", "48 50 12 11", "49 50 11 12", "49 49 4 1", "49 49 3 3", "1 50 1 50", "1 50 50 50", "50 1 1 1", "50 1 1 50", "32 31 10 9", "32 4 17 3"], "outputs": ["Second", "First", "Second", "Second", ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
375
codeforces
74216fbb643744f747461380b71d0be3
Checking the Calendar
You are given names of two days of the week. Please, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day of the next month was equal to the second day of the week you are given. Both months should belong t...
{"inputs": ["monday\ntuesday", "sunday\nsunday", "saturday\ntuesday", "tuesday\nthursday", "friday\nwednesday", "sunday\nsaturday", "monday\nmonday", "monday\nwednesday", "monday\nthursday", "monday\nfriday", "monday\nsaturday", "monday\nsunday", "tuesday\nmonday", "tuesday\ntuesday", "tuesday\nwednesday", "tuesday\nfr...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
156
codeforces
74244487ce06cc0da0e22a0572c585c6
Leha and Function
Leha like all kinds of strange things. Recently he liked the function *F*(*n*,<=*k*). Consider all possible *k*-element subsets of the set [1,<=2,<=...,<=*n*]. For subset find minimal element in it. *F*(*n*,<=*k*) — mathematical expectation of the minimal element among all *k*-element subsets. But only function does n...
{"inputs": ["5\n7 3 5 3 4\n2 1 3 2 3", "7\n4 6 5 8 8 2 6\n2 1 2 2 1 1 2"], "outputs": ["4 7 3 5 3", "2 6 4 5 8 8 6"]}
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
54
codeforces