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 |
|---|---|---|---|---|---|---|---|---|---|
55e557b14d1dcc88b6b22982f8316a5d | Verse Pattern | You are given a text consisting of *n* lines. Each line contains some space-separated words, consisting of lowercase English letters.
We define a syllable as a string that contains exactly one vowel and any arbitrary number (possibly none) of consonants. In English alphabet following letters are considered to be vowel... | {"inputs": ["3\n2 2 3\nintel\ncode\nch allenge", "4\n1 2 3 1\na\nbcdefghi\njklmnopqrstu\nvwxyz", "4\n13 11 15 15\nto be or not to be that is the question\nwhether tis nobler in the mind to suffer\nthe slings and arrows of outrageous fortune\nor to take arms against a sea of troubles", "5\n2 2 1 1 1\nfdbie\naaj\ni\ni n\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 170 | codeforces | |
5614f76a9a106b37d45a3d86e6f37cd2 | Pixels | Flatland is inhabited by pixels of three colors: red, green and blue. We know that if two pixels of different colors meet in a violent fight, only one of them survives the fight (that is, the total number of pixels decreases by one). Besides, if pixels of colors *x* and *y* (*x*<=≠<=*y*) meet in a violent fight, then t... | {"inputs": ["1 1 1", "3 1 0", "1 4 4", "5 10 6", "6 8 10", "1 10 2", "10 6 8", "18 67 5", "67 81 1", "51 10 91", "48 6 7", "8 97 83", "2 7 95", "772486757 1747374885 377299255", "1358352906 27037371 1947040615", "1944219055 454183506 1369298327", "382601556 881329640 791556039", "246543403 71853598 1504509195", "506063... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
561ea8f650301bad39b3ab5015b8b0dd | Space Voyage | The Smart Beaver from ABBYY plans a space travel on an ultramodern spaceship. During the voyage he plans to visit *n* planets. For planet *i* *a**i* is the maximum number of suitcases that an alien tourist is allowed to bring to the planet, and *b**i* is the number of citizens on the planet.
The Smart Beaver is going ... | {"inputs": ["2 5\n1 5\n2 4", "1 97\n1 91", "2 79\n1 91\n1 77", "3 100\n8 46\n8 56\n77 98", "71 100\n1 92\n1 94\n1 97\n1 95\n1 100\n1 100\n1 98\n1 99\n1 98\n1 96\n1 97\n1 93\n1 97\n1 92\n1 91\n1 96\n1 97\n1 96\n1 92\n1 99\n1 92\n1 95\n1 93\n1 99\n1 99\n1 99\n1 97\n1 99\n1 95\n1 95\n1 95\n1 96\n1 95\n1 97\n1 93\n1 93\n1 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
56451bdd43f18cd529603f3281b1328a | Vanya and Brackets | Vanya is doing his maths homework. He has an expression of form , where *x*1,<=*x*2,<=...,<=*x**n* are digits from 1 to 9, and sign represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in this expression so that to maximize the value of the resulting expression.
The firs... | {"inputs": ["3+5*7+8*4", "2+3*5", "3*4*5", "5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5", "2*2+2*2", "1+1+1+1+1+1+1", "1+5*6+7*8", "9*8+7*6+5*4+3*2+1", "3*3*9+4+6+8*4+5+1*4*6", "4*9+4+5+8*4+6+9+8+2+5+2+5*7+6+8", "9+9+9*9*9*9+9+9", "9+9+9+9+9*9*9*9", "1*1*1*1*1*1*1*1+1*1*1*1*1*1*1*1", "4+2*7+8+9*6+6*9+8+7*2+4", "5", "4+6*7+4", "2+7... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 27 | codeforces | |
565ba3eb6d9564437c2cdd828875b47c | Kefa and Watch | One day Kefa the parrot was walking down the street as he was on the way home from the restaurant when he saw something glittering by the road. As he came nearer he understood that it was a watch. He decided to take it to the pawnbroker to earn some money.
The pawnbroker said that each watch contains a serial number ... | {"inputs": ["3 1 2\n112\n2 2 3 1\n1 1 3 8\n2 1 2 1", "6 2 3\n334934\n2 2 5 2\n1 4 4 3\n2 1 6 3\n1 2 3 8\n2 3 6 1", "1 0 1\n5\n2 1 1 1", "20 1 2\n34075930750342906718\n2 1 20 20\n1 1 20 6\n2 1 20 1", "10 1 4\n4545454545\n2 1 10 2\n2 2 4 2\n2 2 9 4\n1 2 9 6\n2 3 8 3", "15 1 5\n234072305423089\n2 1 15 1\n2 5 6 1\n2 8 11 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
56792a031cc15f8d2f78b3cbe37979f4 | Funky Numbers | As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as , where *k* is some positive integer), and the coolest numbers are those that are representable as a sum of two triangular numbers.
A well-known hipster Andrew adores everything funky and c... | {"inputs": ["256", "512", "80", "828", "6035", "39210", "79712", "190492", "5722367", "816761542", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "12", "13", "14", "15", "16", "17", "18", "19", "20", "41", "11", "69", "82", "85", "736", "895", "934", "6213", "7405", "9919", "40942", "41992", "68535", "405718", "104... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 116 | codeforces | |
5691be4e6291720f4fc740dc091f5666 | Working out | Summer is coming! It's time for Iahub and Iahubina to work out, as they both want to look hot at the beach. The gym where they go is a matrix *a* with *n* lines and *m* columns. Let number *a*[*i*][*j*] represents the calories burned by performing workout at the cell of gym in the *i*-th line and the *j*-th column.
Ia... | {"inputs": ["3 3\n100 100 100\n100 1 100\n100 100 100", "4 5\n87882 40786 3691 85313 46694\n28884 16067 3242 97367 78518\n4250 35501 9780 14435 19004\n64673 65438 56977 64495 27280", "3 3\n3 1 2\n3 2 0\n2 3 2", "3 3\n1 10 1\n1 10 1\n1 10 1", "3 3\n0 0 0\n0 10000 0\n0 0 0", "3 3\n1 1 1\n0 10000 0\n1 1 1", "3 3\n9 0 9\n0... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 13 | codeforces | |
569f266d1ef3cadb019f0bea338062a5 | none | Valentin participates in a show called "Shockers". The rules are quite easy: jury selects one letter which Valentin doesn't know. He should make a small speech, but every time he pronounces a word that contains the selected letter, he receives an electric shock. He can make guesses which letter is selected, but for eac... | {"inputs": ["5\n! abc\n. ad\n. b\n! cd\n? c", "8\n! hello\n! codeforces\n? c\n. o\n? d\n? h\n. l\n? e", "7\n! ababahalamaha\n? a\n? b\n? a\n? b\n? a\n? h", "4\n! abcd\n! cdef\n? d\n? c", "1\n? q", "15\n. r\n? e\n. s\n. rw\n? y\n. fj\n. zftyd\n? r\n! wq\n? w\n? p\n. ours\n. dto\n. lbyfru\n? q", "3\n. abcdefghijklmnopqrs... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 82 | codeforces | |
56c299caf0c2946a94e66bc57bd96b66 | Tom Riddle's Diary | Harry Potter is on a mission to destroy You-Know-Who's Horcruxes. The first Horcrux that he encountered in the Chamber of Secrets is Tom Riddle's diary. The diary was with Ginny and it forced her to open the Chamber of Secrets. Harry wants to know the different people who had ever possessed the diary to make sure they ... | {"inputs": ["6\ntom\nlucius\nginny\nharry\nginny\nharry", "3\na\na\na", "1\nzn", "9\nliyzmbjwnzryjokufuxcqtzwworjeoxkbaqrujrhdidqdvwdfzilwszgnzglnnbogaclckfnbqovtziuhwvyrqwmskx\nliyzmbjwnzryjokufuxcqtzwworjeoxkbaqrujrhdidqdvwdfzilwszgnzglnnbogaclckfnbqovtziuhwvyrqwmskx\nliyzmbjwnzryjokufuxcqtzwworjeoxkbaqrujrhdidqdvwdf... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 591 | codeforces | |
56c6f54cc6eef938ce3755bc6b36a16d | Banana | Piegirl is buying stickers for a project. Stickers come on sheets, and each sheet of stickers contains exactly *n* stickers. Each sticker has exactly one character printed on it, so a sheet of stickers can be described by a string of length *n*. Piegirl wants to create a string *s* using stickers. She may buy as many s... | {"inputs": ["banana\n4", "banana\n3", "banana\n2", "p\n1000", "b\n1", "aba\n2", "aaa\n2", "aa\n3", "aaaaaaaabbbbbccccccccccccccccccccccccccccccc\n7", "aaaaa\n10", "baba\n3", "a\n1000", "aan\n5", "banana\n5", "a\n5", "aaaaaaa\n5", "abc\n100", "zzz\n4", "aaabbb\n3", "abc\n5", "abc\n10", "aaaaa\n100", "abc\n1000", "a\n10"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
56dd00818d60b0d068df5b0ca0550b87 | Perfect Pair | Let us call a pair of integer numbers *m*-perfect, if at least one number in the pair is greater than or equal to *m*. Thus, the pairs (3, 3) and (0, 2) are 2-perfect while the pair (-1, 1) is not.
Two integers *x*, *y* are written on the blackboard. It is allowed to erase one of them and replace it with the sum of th... | {"inputs": ["1 2 5", "-1 4 15", "0 -1 5", "0 1 8", "-134 -345 -134", "-134 -345 -133", "999999999 -1000000000 1000000000", "0 0 0", "0 0 1", "-1000000000000000000 1 1000000000000000000", "-3 26 -1", "-25 4 -8", "12 30 -8", "-12 17 3", "4 -11 28", "38 174 957147453", "154 30 763391461", "3 193 648520002", "139 82 923851... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 22 | codeforces | |
570f9c7077215c141fdea3f969d947e8 | Pineapple Incident | Ted has a pineapple. This pineapple is able to bark like a bulldog! At time *t* (in seconds) it barks for the first time. Then every *s* seconds after it, it barks twice with 1 second interval. Thus it barks at times *t*, *t*<=+<=*s*, *t*<=+<=*s*<=+<=1, *t*<=+<=2*s*, *t*<=+<=2*s*<=+<=1, etc.
Barney woke up in the morn... | {"inputs": ["3 10 4", "3 10 3", "3 8 51", "3 8 52", "456947336 740144 45", "33 232603 599417964", "4363010 696782227 701145238", "9295078 2 6", "76079 281367 119938421", "93647 7 451664565", "5 18553 10908", "6 52 30", "6431 855039 352662", "749399100 103031711 761562532", "21 65767 55245", "4796601 66897 4860613", "8 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 205 | codeforces | |
571ae45c10d438fc84e131b6b6598e6f | Subsequence Counting | Pikachu had an array with him. He wrote down all the non-empty subsequences of the array on paper. Note that an array of size *n* has 2*n*<=-<=1 non-empty subsequences in it.
Pikachu being mischievous as he always is, removed all the subsequences in which Maximum_element_of_the_subsequence <=-<= Minimum_element_of_su... | {"inputs": ["10 5", "4 2", "4 1", "1 1", "63 1", "98 88", "746 173", "890 553", "883 1000", "1 1000", "695 188", "2060 697", "70 3321", "6358 1646", "167959139 481199252", "641009859 54748096", "524125987 923264237", "702209411 496813081", "585325539 365329221", "58376259 643910770", "941492387 72235422", "824608515 94... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 30 | codeforces | |
571fcb9db60f838e9e04086862d0e748 | Energy exchange | It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the *i*-th accumulator has *a**i* units of energy. Energy ... | {"inputs": ["3 50\n4 2 1", "2 90\n1 11", "5 26\n42 65 23 43 64", "5 45\n964 515 454 623 594", "1 20\n784", "10 20\n812 896 36 596 709 641 679 778 738 302", "10 83\n689 759 779 927 15 231 976 943 604 917", "11 1\n235 280 196 670 495 379 391 280 847 875 506", "12 71\n472 111 924 103 975 527 807 618 400 523 607 424", "13 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 47 | codeforces | |
573dc1b93b6aae1166255b4af7c1e03a | k-Multiple Free Set | A *k*-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by *k*. That is, there are no two integers *x* and *y* (*x*<=<<=*y*) from the set, such that *y*<==<=*x*·*k*.
You're given a set of *n* distinct positive integers. Your task is to find th... | {"inputs": ["6 2\n2 3 6 5 4 10", "10 2\n1 2 3 4 5 6 7 8 9 10", "1 1\n1", "100 2\n191 17 61 40 77 95 128 88 26 69 79 10 131 106 142 152 68 39 182 53 83 81 6 89 65 148 33 22 5 47 107 121 52 163 150 158 189 118 75 180 177 176 112 167 140 184 29 166 25 46 169 145 187 123 196 18 115 126 155 100 63 58 159 19 173 113 133 60 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 77 | codeforces | |
5798885d5811c8fe3f4c55cfa0dcc0b7 | Cave Painting | Imp is watching a documentary about cave painting.
Some numbers, carved in chaotic order, immediately attracted his attention. Imp rapidly proposed a guess that they are the remainders of division of a number *n* by all integers *i* from 1 to *k*. Unfortunately, there are too many integers to analyze for Imp.
Imp wan... | {"inputs": ["4 4", "5 3", "1 1", "744 18", "47879 10", "1000000000000000000 1000000000000000000", "657180569218773599 42", "442762254977842799 30", "474158606260730555 1", "807873101233533988 39", "423 7", "264306177888923090 5", "998857801526481788 87", "999684044704565212 28", "319575605003866172 71", "75580456057741... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 29 | codeforces | |
57afa8f407534eefb24cd9f1ed75cce9 | none | While Duff was resting in the beach, she accidentally found a strange array *b*0,<=*b*1,<=...,<=*b**l*<=-<=1 consisting of *l* positive integers. This array was strange because it was extremely long, but there was another (maybe shorter) array, *a*0,<=...,<=*a**n*<=-<=1 that *b* can be build from *a* with formula: *b**... | {"inputs": ["3 5 3\n5 9 1", "5 10 3\n1 2 3 4 5", "1 1000000000000000000 1\n508953607", "13 1984343432234 32\n347580985 506695806 506695806 42598441 347580985 720568974 208035957 385072757 42598441 506695806 42598441 42598441 506695806", "1 75937459749 1000000\n521563672", "1 1 1000000\n496389707", "10 82374928374234234... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
57b85f4fcba005a67ee75fe25e8a7e4b | Array and Operations | You have written on a piece of paper an array of *n* positive integers *a*[1],<=*a*[2],<=...,<=*a*[*n*] and *m* good pairs of integers (*i*1,<=*j*1),<=(*i*2,<=*j*2),<=...,<=(*i**m*,<=*j**m*). Each good pair (*i**k*,<=*j**k*) meets the following conditions: *i**k*<=+<=*j**k* is an odd number and 1<=≤<=*i**k*<=<<=*j**... | {"inputs": ["3 2\n8 3 8\n1 2\n2 3", "3 2\n8 12 8\n1 2\n2 3", "6 4\n35 33 46 58 7 61\n4 5\n3 6\n5 6\n1 6", "10 25\n262144 262144 64 64 16 134217728 32 512 32 8192\n1 2\n3 10\n5 8\n9 10\n2 5\n5 10\n3 6\n3 8\n2 9\n4 5\n8 9\n1 4\n4 9\n3 4\n1 6\n4 7\n7 8\n5 6\n2 3\n1 10\n1 8\n6 9\n6 7\n2 7\n7 10", "10 9\n67108864 8 2 131072... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
57b85f9568ee496d7d360784500df856 | Strip | Alexandra has a paper strip with *n* numbers on it. Let's call them *a**i* from left to right.
Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy:
- Each piece should contain at least *l* numbers.- The difference between the maximal and the minimal number on the p... | {"inputs": ["7 2 2\n1 3 1 2 4 1 2", "7 2 2\n1 100 1 100 1 100 1", "1 0 1\n0", "6 565 2\n31 76 162 -182 -251 214", "1 0 1\n0", "1 0 1\n-1000000000", "1 100 2\n42", "2 1000000000 1\n-1000000000 1000000000", "2 1000000000 2\n-1000000000 1000000000", "10 3 3\n1 1 1 1 1 5 6 7 8 9", "10 3 3\n1 1 1 2 2 5 6 7 8 9"], "outputs":... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
57d971eb6fe7181e2ba33519339db54d | Exams | One day the Codeforces round author sat exams. He had *n* exams and he needed to get an integer from 2 to 5 for each exam. He will have to re-sit each failed exam, i.e. the exam that gets mark 2.
The author would need to spend too much time and effort to make the sum of his marks strictly more than *k*. That could ha... | {"inputs": ["4 8", "4 10", "1 3", "1 2", "4 9", "50 234", "50 100", "50 250", "29 116", "20 69", "46 127", "3 7", "36 99", "45 104", "13 57", "25 106", "8 19", "20 69", "13 32", "47 128", "17 73", "3 7", "16 70", "1 5", "38 137", "7 20", "1 5", "36 155", "5 15", "27 75", "21 73", "2 5", "49 177", "7 20", "44 173", "49 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 261 | codeforces | |
57d99909d9c306e4442f6732b3ca3243 | Little Elephant and Cards | The Little Elephant loves to play with color cards.
He has *n* cards, each has exactly two colors (the color of the front side and the color of the back side). Initially, all the cards lay on the table with the front side up. In one move the Little Elephant can turn any card to the other side. The Little Elephant thin... | {"inputs": ["3\n4 7\n4 7\n7 4", "5\n4 7\n7 4\n2 11\n9 7\n1 1", "1\n1 1", "2\n1 1\n1 1", "7\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 8", "2\n1 2\n2 1", "3\n7 7\n1 2\n2 1", "3\n1 1\n2 5\n3 6", "4\n1000000000 1000000000\n999999999 1000000000\n999999997 999999998\n47 74", "6\n1 2\n3 1\n4 7\n4 1\n9 1\n7 2", "4\n1 2\n1 2\n2 1\n2 1",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 12 | codeforces | |
57e7e421e1a36b78c8e4fde63ced274c | Anatoly and Cockroaches | Anatoly lives in the university dorm as many other students do. As you know, cockroaches are also living there together with students. Cockroaches might be of two colors: black and red. There are *n* cockroaches living in Anatoly's room.
Anatoly just made all his cockroaches to form a single line. As he is a perfectio... | {"inputs": ["5\nrbbrr", "5\nbbbbb", "3\nrbr", "13\nrbbbrbrrbrrbb", "18\nrrrrrrrrrrrrrrrrrb", "100\nbrbbbrrrbbrbrbbrbbrbbbbrbbrrbbbrrbbbbrbrbbbbbbbbbbbbbbbbrrrrbbbbrrrbbbbbbbrbrrbrbbbbrrrbbbbrbbrbbbrb", "166\nrbbbbbbbbbbbbrbrrbbrbbbrbbbbbbbbbbrbbbbbbrbbbrbbbbbrbbbbbbbrbbbbbbbrbbrbbbbbbbbrbbbbbbbbbbbbbbrrbbbrbbbbbbbbbbbb... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 110 | codeforces | |
57ee5e055f24eba95c780683a584296b | ZS and The Birthday Paradox | ZS the Coder has recently found an interesting concept called the Birthday Paradox. It states that given a random set of 23 people, there is around 50% chance that some two of them share the same birthday. ZS the Coder finds this very interesting, and decides to test this with the inhabitants of Udayland.
In Udayland,... | {"inputs": ["3 2", "1 3", "4 3", "1000000000000000000 1000000000000000000", "59 576460752303423489", "1234567891234 100005", "2 4", "59 576460752303423488", "2016 2016", "2016 2017", "468804735183774830 244864585447548924", "172714899512474455 414514930706102803", "876625063841174080 360793239109880865", "7018187597523... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
57f6b670c52d8702a7686ef2568dbfed | The Monster | A monster is chasing after Rick and Morty on another planet. They're so frightened that sometimes they scream. More accurately, Rick screams at times *b*,<=*b*<=+<=*a*,<=*b*<=+<=2*a*,<=*b*<=+<=3*a*,<=... and Morty screams at times *d*,<=*d*<=+<=*c*,<=*d*<=+<=2*c*,<=*d*<=+<=3*c*,<=....
The Monster will catch them if a... | {"inputs": ["20 2\n9 19", "2 1\n16 12", "39 52\n88 78", "59 96\n34 48", "87 37\n91 29", "11 81\n49 7", "39 21\n95 89", "59 70\n48 54", "87 22\n98 32", "15 63\n51 13", "39 7\n97 91", "18 18\n71 71", "46 71\n16 49", "70 11\n74 27", "94 55\n20 96", "18 4\n77 78", "46 44\n23 55", "74 88\n77 37", "94 37\n34 7", "22 81\n80 8... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 210 | codeforces | |
5828394940254fd6efa3a0abedfaa1be | Genetic Engineering | You will receive 3 points for solving this problem.
Manao is designing the genetic code for a new type of algae to efficiently produce fuel. Specifically, Manao is focusing on a stretch of DNA that encodes one protein. The stretch of DNA is represented by a string containing only the characters 'A', 'T', 'G' and 'C'.
... | {"inputs": ["GTTAAAG", "AACCAACCAAAAC", "GTGAATTTCC", "CAGGGGGCCGCCCATGAAAAAAACCCGGCCCCTTGGGAAAACTTGGGTTA", "CCCTTCACCCGGATCCAAATCCCTTAGAAATAATCCCCGACGGCGTTGTATCACCTCTGCACTTGTTAGTAAGGTCAGGCGTCCATTACGGAAGAACGTA", "GCATTACATGGGGGGGTCCTACGAGCCCGGCATCCCGGAAACTAGCCGGTTAATTTGGTTTAAACCCTCCCACCCCGGATTGTAACCCCCCTCATTGGTT", "TTC... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 42 | codeforces | |
582ec02a56804cc5560660c3e04cd02a | On Number of Decompositions into Multipliers | You are given an integer *m* as a product of integers *a*1,<=*a*2,<=... *a**n* . Your task is to find the number of distinct decompositions of number *m* into the product of *n* ordered positive integers.
Decomposition into *n* products, given in the input, must also be considered in the answer. As the answer can be v... | {"inputs": ["1\n15", "3\n1 1 2", "2\n5 7", "2\n5 10", "3\n1 30 1", "2\n1000000000 1000000000", "1\n1", "3\n1 1 1", "2\n1 2", "2\n1 6", "3\n8 10 8", "5\n14 67 15 28 21", "8\n836 13 77 218 743 530 404 741", "10\n6295 3400 4042 2769 3673 264 5932 4977 1776 5637", "23\n77 12 25 7 44 75 80 92 49 77 56 93 59 45 45 39 86 83 9... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
58300c1535aca1212396fa7342a89cff | Domino | Valera has got *n* domino pieces in a row. Each piece consists of two halves — the upper one and the lower one. Each of the halves contains a number from 1 to 6. Valera loves even integers very much, so he wants the sum of the numbers on the upper halves and the sum of the numbers on the lower halves to be even.
To do... | {"inputs": ["2\n4 2\n6 4", "1\n2 3", "3\n1 4\n2 3\n4 4", "5\n5 4\n5 4\n1 5\n5 5\n3 3", "20\n1 3\n5 2\n5 2\n2 6\n2 4\n1 1\n1 3\n1 4\n2 6\n4 2\n5 6\n2 2\n6 2\n4 3\n2 1\n6 2\n6 5\n4 5\n2 4\n1 4", "100\n2 3\n2 4\n3 3\n1 4\n5 2\n5 4\n6 6\n3 4\n1 1\n4 2\n5 1\n5 5\n5 3\n3 6\n4 1\n1 6\n1 1\n3 2\n4 5\n6 1\n6 4\n1 1\n3 4\n3 3\n2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 236 | codeforces | |
5836b24c0f11bb4c360cb09cc7022291 | Mean Requests | In this problem you will have to deal with a real algorithm that is used in the VK social network.
As in any other company that creates high-loaded websites, the VK developers have to deal with request statistics regularly. An important indicator reflecting the load of the site is the mean number of requests for a cer... | {"inputs": ["1 1 2.000000\n1\n1\n1", "11 4 1.250000\n9 11 7 5 15 6 6 6 6 6 6\n8\n4 5 6 7 8 9 10 11", "13 4 1.250000\n3 3 3 3 3 20 3 3 3 3 3 3 3\n10\n4 5 6 7 8 9 10 11 12 13", "1 1 2.000000\n4\n1\n1", "1 1 2.000000\n1121\n1\n1", "1 1 2.000000\n758432\n1\n1", "3 1 2.000000\n8 25 21\n3\n1 2 3", "19 3 1.333333\n12 15 11 10... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
5845aa1a775a0630183ec6836b5c2a58 | Super M | Ari the monster is not an ordinary monster. She is the hidden identity of Super M, the Byteforces’ superhero. Byteforces is a country that consists of *n* cities, connected by *n*<=-<=1 bidirectional roads. Every road connects exactly two distinct cities, and the whole road system is designed in a way that one is able ... | {"inputs": ["7 2\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n2 7", "6 4\n1 2\n2 3\n2 4\n4 5\n4 6\n2 4 5 6", "2 1\n2 1\n1", "1 1\n1", "10 2\n6 9\n6 2\n1 6\n4 10\n3 7\n9 4\n9 5\n6 7\n2 8\n7 6", "15 2\n7 12\n13 11\n6 8\n2 15\n10 9\n5 1\n13 5\n5 4\n14 3\n8 9\n8 4\n4 7\n12 14\n5 2\n7 4", "20 2\n1 16\n12 5\n15 19\n18 9\n8 4\n10 16\n9 16\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
5877a100f511348a0d6590e174c3e4fa | Fake NP | Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path.
You are given *l* and *r*. For all integers from *l* to *r*, inclusive, we wrote down all of their integer divisors except 1. Find the integer that we wrote down the maximum number of times... | {"inputs": ["19 29", "3 6", "39 91", "76 134", "93 95", "17 35", "94 95", "51 52", "47 52", "38 98", "30 37", "56 92", "900000000 1000000000", "37622224 162971117", "760632746 850720703", "908580370 968054552", "951594860 953554446", "347877978 913527175", "620769961 988145114", "820844234 892579936", "741254764 741254... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 173 | codeforces | |
587a688de32a2c20d1ca304fba736ece | Camels | Bob likes to draw camels: with a single hump, two humps, three humps, etc. He draws a camel by connecting points on a coordinate plane. Now he's drawing camels with *t* humps, representing them as polylines in the plane. Each polyline consists of *n* vertices with coordinates (*x*1,<=*y*1), (*x*2,<=*y*2), ..., (*x**n*,... | {"inputs": ["6 1", "4 2", "3 1", "3 2", "3 3", "3 10", "4 1", "4 3", "4 9", "5 1", "5 2", "5 3", "5 5", "5 9", "5 10", "6 1", "6 2", "6 3", "6 4", "6 10", "19 1", "19 2", "19 3", "19 4", "19 5", "19 6", "19 7", "19 8", "19 9", "19 10", "20 1", "20 2", "20 3", "20 4", "20 5", "20 6", "20 7", "20 8", "20 9", "20 10"], "o... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
588081e1dbf946870f913796b2adf243 | none | Student Vladislav came to his programming exam completely unprepared as usual. He got a question about some strange algorithm on a graph — something that will definitely never be useful in real life. He asked a girl sitting next to him to lend him some cheat papers for this questions and found there the following defin... | {"inputs": ["4 5\n2 1\n3 1\n4 0\n1 1\n5 0", "3 3\n1 0\n2 1\n3 1", "2 1\n7 1", "3 2\n8 1\n9 1", "3 3\n4 1\n5 0\n7 1", "3 3\n4 1\n5 1\n7 0", "3 3\n4 1\n4 0\n4 1", "3 3\n4 0\n5 1\n4 1", "3 3\n5 0\n4 1\n5 1", "4 4\n2 1\n3 0\n3 1\n4 1", "4 5\n4 1\n4 1\n4 0\n4 0\n6 1", "4 6\n2 1\n4 0\n3 0\n1 1\n4 1\n5 0", "4 4\n2 1\n6 0\n7 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
5892b69c55b4fe459e4286fdace16edf | Sort the Array | Being a programmer, you like arrays a lot. For your birthday, your friends have given you an array *a* consisting of *n* distinct integers.
Unfortunately, the size of *a* is too small. You want a bigger array! Your friends agree to give you a bigger array, but only if you are able to answer the following question corr... | {"inputs": ["3\n3 2 1", "4\n2 1 3 4", "4\n3 1 2 4", "2\n1 2", "2\n58 4", "5\n69 37 27 4 2", "9\n6 78 63 59 28 24 8 96 99", "6\n19517752 43452931 112792556 68417469 779722934 921694415", "6\n169793171 335736854 449917902 513287332 811627074 938727967", "6\n509329 173849943 297546987 591032670 796346199 914588283", "25\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 97 | codeforces | |
5897bd968f90d3c87e025d3df2080b70 | Dominoes | During the break, we decided to relax and play dominoes. Our box with Domino was empty, so we decided to borrow the teacher's dominoes.
The teacher responded instantly at our request. He put *nm* dominoes on the table as an *n*<=×<=2*m* rectangle so that each of the *n* rows contained *m* dominoes arranged horizontall... | {"inputs": ["2 3\n01 11 00\n00 01 11", "4 1\n11\n10\n01\n00", "1 1\n00", "1 1\n01", "1 1\n11", "9 9\n01 00 00 01 00 01 11 11 11\n10 10 10 01 10 01 11 01 10\n10 00 10 00 11 01 00 10 00\n01 00 01 01 11 00 00 11 11\n11 00 10 11 01 01 11 00 01\n01 10 00 00 11 10 01 01 10\n11 10 11 00 11 11 01 10 10\n10 00 01 00 00 00 11 01... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
5898c00f01fa4b898400dca4b5772eea | Puzzles | Barney lives in country USC (United States of Charzeh). USC has *n* cities numbered from 1 through *n* and *n*<=-<=1 roads between them. Cities and roads of USC form a rooted tree (Barney's not sure why it is rooted). Root of the tree is the city number 1. Thus if one will start his journey from city 1, he can visit an... | {"inputs": ["7\n1 2 1 1 4 4", "12\n1 1 2 2 4 4 3 3 1 10 8", "3\n1 2", "8\n1 1 2 2 3 6 1", "85\n1 1 2 2 4 6 1 3 6 3 3 11 9 14 12 5 8 11 16 19 12 17 2 19 1 24 6 2 6 6 24 3 20 1 1 1 17 8 4 25 31 32 39 12 35 23 31 26 46 9 37 7 5 23 41 41 39 9 11 54 36 54 28 15 25 58 56 18 23 70 68 18 3 48 57 70 15 65 22 35 25 13 49 34", "1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
58a83557040dfdbc385a042906d45d1f | Wrong Subtraction | Little girl Tanya is learning how to decrease a number by one, but she does it wrong with a number consisting of two or more digits. Tanya subtracts one from a number by the following algorithm:
- if the last digit of the number is non-zero, she decreases the number by one; - if the last digit of the number is zero,... | {"inputs": ["512 4", "1000000000 9", "131203 11", "999999999 50", "999999999 49", "131203 9", "900000000 16", "909090909 50", "1001 2", "5 2", "2 1"], "outputs": ["50", "1", "12", "9999", "99990", "130", "1", "3", "100", "3", "1"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 428 | codeforces | |
58bb01f8136f320b940058018a44f47c | Design Tutorial: Learn from Math | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.
For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two ... | {"inputs": ["12", "15", "23", "1000000", "63874", "14568", "192", "86", "46220", "57114", "869", "738457", "58113", "4864", "15", "74752", "6073", "1289", "20", "58134", "57756", "765", "59", "991666", "70761", "13", "999999", "17", "21", "19", "100007", "999987", "22"], "outputs": ["4 8", "6 9", "8 15", "500000 500000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 597 | codeforces | |
58c5d42231d8ef54d85d53c0d3311e95 | Appleman and Toastman | Appleman and Toastman play a game. Initially Appleman gives one group of *n* numbers to the Toastman, then they start to complete the following tasks:
- Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. - Each time Appleman... | {"inputs": ["3\n3 1 5", "1\n10", "10\n8 10 2 5 6 2 4 7 2 1", "10\n171308 397870 724672 431255 228496 892002 542924 718337 888642 161821", "10\n1 2 2 2 4 5 6 7 8 10", "10\n161821 171308 228496 397870 431255 542924 718337 724672 888642 892002", "1\n397870", "1\n1000000", "10\n10 8 7 6 5 4 2 2 2 1", "10\n892002 888642 724... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 503 | codeforces | |
58c677856c4b02ac52a4fc953812e4cd | Longest Subsequence | You are given array *a* with *n* elements and the number *m*. Consider some subsequence of *a* and the value of least common multiple (LCM) of its elements. Denote LCM as *l*. Find any longest subsequence of *a* with the value *l*<=≤<=*m*.
A subsequence of *a* is an array we can get by erasing some elements of *a*. It... | {"inputs": ["7 8\n6 2 9 2 7 2 3", "6 4\n2 2 2 3 3 3", "10 50\n39 22 60 88 11 65 41 85 65 100", "100 343\n999 284 486 785 176 742 856 415 992 601 600 122 460 214 338 92 627 913 376 835 384 914 335 179 409 957 96 784 531 43 584 206 971 799 592 801 870 978 437 517 466 952 1 327 731 689 816 681 383 969 452 298 114 687 314 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
58d9c92f6edcd490cef2fee5f38142a7 | Weather | Scientists say a lot about the problems of global warming and cooling of the Earth. Indeed, such natural phenomena strongly influence all life on our planet.
Our hero Vasya is quite concerned about the problems. He decided to try a little experiment and observe how outside daily temperature changes. He hung out a ther... | {"inputs": ["4\n-1 1 -2 1", "5\n0 -1 1 2 -5", "6\n0 0 0 0 0 0", "6\n-1 -2 -3 -4 5 6", "8\n1 2 -1 0 10 2 12 13", "7\n-1 -2 -3 3 -1 3 4", "2\n3 -5", "50\n4 -8 0 -1 -3 -9 0 -2 0 1 -1 0 7 -10 9 7 0 -10 5 0 1 -6 9 -9 3 -3 3 7 4 -8 -8 3 3 -1 0 2 -6 10 7 -1 -6 -3 -4 2 3 0 -4 0 7 -9", "90\n52 -89 17 64 11 -61 92 51 42 -92 -14 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 32 | codeforces | |
58dd3c2180285dbfc243479705c44459 | none | In the capital city of Berland, Bertown, demonstrations are against the recent election of the King of Berland. Berland opposition, led by Mr. Ovalny, believes that the elections were not fair enough and wants to organize a demonstration at one of the squares.
Bertown has *n* squares, numbered from 1 to *n*, they are ... | {"inputs": ["5 2\n8\n2 4 5 3 1", "5 2\n8\n3 2 4 1 5", "5 4\n1000000000000000\n5 4 3 2 1", "10 1\n55\n45 55 61 64 95 95 98 96 65 81", "10 6\n462\n33 98 95 82 91 63 61 51 68 94", "10 4\n38080\n15 3005 4725 1952 8761 8797 9712 9752 9858 9128", "10 9\n46660\n724 2304 7793 7049 7847 5593 4685 7971 2701 5643", "100 50\n42431... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
58e042e2444f9dd4fa27b74cbe69e58f | Beautiful numbers | Volodya is an odd boy and his taste is strange as well. It seems to him that a positive integer number is beautiful if and only if it is divisible by each of its nonzero digits. We will not argue with this and just count the quantity of beautiful numbers in given ranges.
The first line of the input contains the number ... | {"inputs": ["1\n1 9", "1\n12 15", "1\n25 53", "1\n1 1000", "1\n1 100000", "2\n234 59843\n46 3243", "4\n55 55\n1234 2348\n620 620\n4 1000", "1\n1 9000000000000000000", "5\n5397562498 1230483490253448\n39218765 5293867493184739\n99 999999999999\n546234 2394748365397856\n67 801834", "3\n1 1\n9000000000000000000 9000000000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
5905d6dd07b7ab56dc2b9a6790ab9061 | Supercentral Point | One day Vasya painted a Cartesian coordinate system on a piece of paper and marked some set of points (*x*1,<=*y*1),<=(*x*2,<=*y*2),<=...,<=(*x**n*,<=*y**n*). Let's define neighbors for some fixed point from the given set (*x*,<=*y*):
- point (*x*',<=*y*') is (*x*,<=*y*)'s right neighbor, if *x*'<=><=*x* and *y*'... | {"inputs": ["8\n1 1\n4 2\n3 1\n1 2\n0 2\n0 1\n1 0\n1 3", "5\n0 0\n0 1\n1 0\n0 -1\n-1 0", "9\n-565 -752\n-184 723\n-184 -752\n-184 1\n950 723\n-565 723\n950 -752\n950 1\n-565 1", "25\n-651 897\n916 897\n-651 -808\n-748 301\n-734 414\n-651 -973\n-734 897\n916 -550\n-758 414\n916 180\n-758 -808\n-758 -973\n125 -550\n125 -... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 390 | codeforces | |
59114d397555cf1a5a46cb976295c8dc | Vasily the Bear and Sequence | Vasily the bear has got a sequence of positive integers *a*1,<=*a*2,<=...,<=*a**n*. Vasily the Bear wants to write out several numbers on a piece of paper so that the beauty of the numbers he wrote out was maximum.
The beauty of the written out numbers *b*1,<=*b*2,<=...,<=*b**k* is such maximum non-negative integer *... | {"inputs": ["5\n1 2 3 4 5", "3\n1 2 4", "3\n1 20 22", "10\n109070199 215498062 361633800 406156967 452258663 530571268 670482660 704334662 841023955 967424642", "30\n61 65 67 71 73 75 77 79 129 131 135 137 139 141 267 520 521 522 524 526 1044 1053 6924600 32125372 105667932 109158064 192212084 202506108 214625360 26007... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 7 | codeforces | |
591ed0b026ba4de1b7775863a47e033e | none | You are given an array *a* with *n* distinct integers. Construct an array *b* by permuting *a* such that for every non-empty subset of indices *S*<==<={*x*1,<=*x*2,<=...,<=*x**k*} (1<=≤<=*x**i*<=≤<=*n*, 0<=<<=*k*<=<<=*n*) the sums of elements on that positions in *a* and *b* are different, i. e.
The first line co... | {"inputs": ["2\n1 2", "4\n1000 100 10 1", "5\n1 3 4 5 2", "1\n10000000", "4\n1 5 8 4", "3\n1 3 2", "4\n3 1 2 4", "12\n7 1 62 12 3 5 8 9 10 22 23 0", "17\n1 3 2 5 4 6 7 8 10 9 13 11 12 14 15 16 18", "22\n1 3 5 7 22 2 4 6 8 9 10 11 12 13 15 14 17 18 16 20 19 23", "22\n17 6 1 22 9 23 38 40 10 20 29 11 12 39 3 32 26 4 13 3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 29 | codeforces | |
5936c23389b0b6633ac3994de8d5c7ce | Polo the Penguin and Lucky Numbers | Everybody knows that lucky numbers are positive integers that contain only lucky digits 4 and 7 in their decimal representation. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Polo the Penguin have two positive integers *l* and *r* (*l*<=<<=*r*), both of them are lucky numbers. Moreover, their le... | {"inputs": ["4\n7", "474\n777", "44\n77", "444\n777", "444\n477", "444\n744", "47\n74", "447\n774", "4444\n7777", "44444\n77777", "444444\n777777", "44744\n74747", "47774\n74777", "47\n77", "474\n747", "7447\n7744", "74744\n74747", "7447777\n7774477", "747447\n777744", "4477447744\n4477744774", "77474444777444447747\n7... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
594a2bc844be518fed9dfa9b8c429849 | Buses | Little boy Gerald studies at school which is quite far from his house. That's why he has to go there by bus every day. The way from home to school is represented by a segment of a straight line; the segment contains exactly *n*<=+<=1 bus stops. All of them are numbered with integers from 0 to *n* in the order in which ... | {"inputs": ["2 2\n0 1\n1 2", "3 2\n0 1\n1 2", "5 5\n0 1\n0 2\n0 3\n0 4\n0 5", "3 3\n1 2\n2 3\n1 3", "10 10\n0 1\n0 2\n0 3\n0 4\n0 5\n0 6\n0 7\n0 8\n0 9\n0 10", "6 6\n3 4\n2 3\n3 5\n0 1\n1 2\n3 6", "7 7\n0 1\n1 3\n2 3\n4 6\n5 7\n4 5\n5 7", "1000000000 0", "8 8\n0 1\n4 5\n7 8\n3 4\n2 3\n6 7\n5 6\n1 2", "6 1\n0 6", "6 4\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
5981eb223dfdc830bf9b127597cd72c8 | Chocolate | Bob loves everything sweet. His favorite chocolate bar consists of pieces, each piece may contain a nut. Bob wants to break the bar of chocolate into multiple pieces so that each part would contain exactly one nut and any break line goes between two adjacent pieces.
You are asked to calculate the number of ways he can... | {"inputs": ["3\n0 1 0", "5\n1 0 1 0 1", "10\n0 0 1 0 0 0 1 1 0 1", "20\n0 0 0 0 1 1 1 0 1 0 0 1 0 1 1 0 1 1 1 0", "50\n0 1 1 1 1 1 1 0 1 1 0 1 1 1 0 0 1 0 1 1 0 1 0 0 1 1 1 1 1 1 0 1 1 0 0 0 1 0 0 0 0 1 0 1 1 0 0 0 0 0", "99\n0 0 0 1 0 1 0 1 0 1 0 1 0 0 1 1 1 1 1 1 1 0 1 0 1 1 0 1 1 1 0 0 0 0 0 1 1 0 1 0 0 0 1 0 1 1 0 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 7 | codeforces | |
5a03252e08654084ead3b38a23622e60 | Square | There is a square painted on a piece of paper, the square's side equals *n* meters. John Doe draws crosses on the square's perimeter. John paints the first cross in the lower left corner of the square. Then John moves along the square's perimeter in the clockwise direction (first upwards, then to the right, then downwa... | {"inputs": ["3\n4 8 100", "8\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 13", "3\n13 17 21"], "outputs": ["17\n33\n401", "4000000001\n4000000001\n4000000001\n4000000001\n4000000001\n4000000001\n4000000001\n27", "27\n35\n43"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 51 | codeforces | |
5a24aa8483eed58623cb80e41be4360e | Three Parts of the Array | You are given an array $d_1, d_2, \dots, d_n$ consisting of $n$ integer numbers.
Your task is to split this array into three parts (some of which may be empty) in such a way that each element of the array belongs to exactly one of the three parts, and each of the parts forms a consecutive contiguous subsegment (possib... | {"inputs": ["5\n1 3 1 1 4", "5\n1 3 2 1 4", "3\n4 1 2", "1\n1000000000", "2\n1 1", "5\n1 3 5 4 5"], "outputs": ["5", "4", "0", "0", "1", "9"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 213 | codeforces | |
5a338e4f6ff782ab607304e21f0f2372 | DNA Evolution | Everyone knows that DNA strands consist of nucleotides. There are four types of nucleotides: "A", "T", "G", "C". A DNA strand is a sequence of nucleotides. Scientists decided to track evolution of a rare species, which DNA strand was string *s* initially.
Evolution of the species is described as a sequence of changes... | {"inputs": ["ATGCATGC\n4\n2 1 8 ATGC\n2 2 6 TTT\n1 4 T\n2 2 6 TA", "GAGTTGTTAA\n6\n2 3 4 TATGGTG\n1 1 T\n1 6 G\n2 5 9 AGTAATA\n1 10 G\n2 2 6 TTGT", "TCAATCGGGCGGACTAACCC\n20\n2 4 17 CTCGGATGTT\n1 4 T\n1 1 C\n2 15 18 CA\n2 13 20 GGCACCCA\n1 20 T\n2 3 11 TCGGAG\n1 4 C\n2 13 18 A\n1 14 C\n1 18 T\n1 5 T\n1 8 T\n1 6 A\n2 3 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
5a3e001f740f7d6ec5e22ec35d23b8a5 | none | It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has *n* cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells with positive numbers from 1 to *n* from the left to the right.
Unfortunately, ... | {"inputs": ["2 3 1\n2 3", "3 2 2\n4 1 3", "5 10 10\n7 0 7 0 7", "6 10 4\n1 2 3 4 5 6", "7 5 2\n1 2 3 4 5 6 7", "16 100 100\n30 89 12 84 62 24 10 59 98 21 13 69 65 12 54 32", "99 999 999\n9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
5a3e4daa29dd1209216eaed32f5c3fa4 | Pupils Redistribution | In Berland each high school student is characterized by academic performance — integer value between 1 and 5.
In high school 0xFF there are two groups of pupils: the group *A* and the group *B*. Each group consists of exactly *n* students. An academic performance of each student is known — integer value between 1 and ... | {"inputs": ["4\n5 4 4 4\n5 5 4 5", "6\n1 1 1 1 1 1\n5 5 5 5 5 5", "1\n5\n3", "9\n3 2 5 5 2 3 3 3 2\n4 1 4 1 1 2 4 4 1", "1\n1\n2", "1\n1\n1", "8\n1 1 2 2 3 3 4 4\n4 4 5 5 1 1 1 1", "10\n1 1 1 1 1 1 1 1 1 1\n2 2 2 2 2 2 2 2 2 2", "100\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 168 | codeforces | |
5a43cf8bfbc24f17efa03fa099792295 | Anton and Polyhedrons | Anton's favourite geometric figures are regular polyhedrons. Note that there are five kinds of regular polyhedrons:
- Tetrahedron. Tetrahedron has 4 triangular faces. - Cube. Cube has 6 square faces. - Octahedron. Octahedron has 8 triangular faces. - Dodecahedron. Dodecahedron has 12 pentagonal faces. - Icosahed... | {"inputs": ["4\nIcosahedron\nCube\nTetrahedron\nDodecahedron", "3\nDodecahedron\nOctahedron\nOctahedron", "25\nIcosahedron\nOctahedron\nTetrahedron\nDodecahedron\nCube\nIcosahedron\nOctahedron\nCube\nTetrahedron\nIcosahedron\nIcosahedron\nTetrahedron\nOctahedron\nDodecahedron\nIcosahedron\nOctahedron\nIcosahedron\nTetr... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 902 | codeforces | |
5a520f7f2910b43b1571de9435761b7a | Xenia and Spies | Xenia the vigorous detective faced *n* (*n*<=≥<=2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to *n* from left to right.
Spy *s* has an important note. He has to pass the note to spy *f*. Xenia interrogates the spies in several steps. During one step the spy keeping the important note c... | {"inputs": ["3 5 1 3\n1 1 2\n2 2 3\n3 3 3\n4 1 1\n10 1 3", "2 3 2 1\n1 1 2\n2 1 2\n4 1 2", "5 11 1 5\n1 1 5\n2 2 2\n3 1 1\n4 3 3\n5 3 3\n6 1 1\n7 4 4\n8 4 5\n10 1 3\n11 5 5\n13 1 5", "4 6 4 2\n2 2 2\n3 3 3\n4 1 1\n10 1 4\n11 2 3\n12 2 4", "7 5 7 6\n1 4 5\n2 7 7\n3 6 6\n4 3 4\n5 1 3", "4 4 3 4\n1 2 4\n2 1 2\n3 3 4\n4 2 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
5a587b91d3cc6bf57740e0b2e69de3a2 | Factory | One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were *x* details in the factory storage, then by the end of the day the factory has to produce (remainder after dividing *x* by *m*) more details. Unfortunately, no cu... | {"inputs": ["1 5", "3 6", "1 8", "2 3", "3 24", "1 1", "100000 100000", "1 99989", "512 2", "100 24", "1 100000", "100000 1", "3 99929", "99961 99971", "1 65536", "4 65536", "3 65536", "32768 65536", "65535 65536", "1 65535", "98812 100000", "10 5", "6 8"], "outputs": ["No", "Yes", "Yes", "No", "Yes", "Yes", "Yes", "No... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 143 | codeforces | |
5a5e1e98fe1734fbbdcb54b182736712 | Almost Arithmetical Progression | Gena loves sequences of numbers. Recently, he has discovered a new type of sequences which he called an almost arithmetical progression. A sequence is an almost arithmetical progression, if its elements can be represented as:
- *a*1<==<=*p*, where *p* is some integer; - *a**i*<==<=*a**i*<=-<=1<=+<=(<=-<=1)*i*<=+<=1·... | {"inputs": ["2\n3 5", "4\n10 20 10 30", "5\n4 4 3 5 1", "6\n2 3 2 2 1 3", "8\n2 2 5 3 4 3 3 2", "2\n468 335", "1\n170", "5\n479 359 963 465 706", "6\n282 828 962 492 996 943", "8\n437 392 605 903 154 293 383 422", "42\n68 35 1 70 25 79 59 63 65 6 46 82 28 62 92 96 43 28 37 92 5 3 54 93 83 22 17 19 96 48 27 72 39 70 13 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 16 | codeforces | |
5a69561084767484a896765b580a3e2c | The Eternal Immortality | Even if the world is full of counterfeits, I still regard it as wonderful.
Pile up herbs and incense, and arise again from the flames and ashes of its predecessor — as is known to many, the phoenix does it like this.
The phoenix has a rather long lifespan, and reincarnates itself once every *a*! years. Here *a*! deno... | {"inputs": ["2 4", "0 10", "107 109", "10 13", "998244355 998244359", "999999999000000000 1000000000000000000", "2 3", "3 15", "24 26", "14 60", "11 79", "1230 1232", "2633 2634", "535 536", "344319135 396746843", "696667767 696667767", "419530302 610096911", "238965115 821731161", "414626436 728903812", "274410639 293... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 275 | codeforces | |
5a6cf8639416a46ab7eda2b3000d21e2 | Simple Game | One day Misha and Andrew were playing a very simple game. First, each player chooses an integer in the range from 1 to *n*. Let's assume that Misha chose number *m*, and Andrew chose number *a*.
Then, by using a random generator they choose a random integer *c* in the range between 1 and *n* (any integer from 1 to *n*... | {"inputs": ["3 1", "4 3", "5 5", "10 5", "20 13", "51 1", "100 50", "100 51", "100 49", "1000000000 1000000000", "1000000000 1", "1000000000 100000000", "1000000000 500000000", "1000000000 123124", "12412523 125123", "54645723 432423", "1 1", "262833325 131416663", "477667530 238833766", "692501734 346250868", "9073359... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 120 | codeforces | |
5aadac2815c9ae74cba7aae270fa2bab | Tavas and Nafas | Today Tavas got his test result as an integer score and he wants to share it with his girlfriend, Nafas.
His phone operating system is Tavdroid, and its keyboard doesn't have any digits! He wants to share his score with Nafas via text, so he has no choice but to send this number using words.
He ate coffee mix without... | {"inputs": ["6", "99", "20", "10", "15", "27", "40", "63", "0", "1", "2", "8", "9", "11", "12", "13", "14", "16", "17", "18", "19", "21", "29", "30", "32", "38", "43", "47", "50", "54", "56", "60", "66", "70", "76", "80", "82", "90", "91", "95", "71", "46", "84", "22", "23", "24", "25", "26", "28", "31", "33", "34", "3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 95 | codeforces | |
5aadd7c6ae2e239904112e924628ef9b | Swap Adjacent Elements | You have an array *a* consisting of *n* integers. Each integer from 1 to *n* appears exactly once in this array.
For some indices *i* (1<=≤<=*i*<=≤<=*n*<=-<=1) it is possible to swap *i*-th element with (*i*<=+<=1)-th, for other indices it is not possible. You may perform any number of swapping operations any order. T... | {"inputs": ["6\n1 2 5 3 4 6\n01110", "6\n1 2 5 3 4 6\n01010", "6\n1 6 3 4 5 2\n01101", "6\n2 3 1 4 5 6\n01111", "4\n2 3 1 4\n011", "2\n2 1\n0", "5\n1 2 4 5 3\n0101", "5\n1 2 4 5 3\n0001", "5\n1 4 5 2 3\n0110", "5\n4 5 1 2 3\n0111", "3\n3 1 2\n10", "5\n2 3 4 5 1\n0011", "16\n3 4 14 16 11 7 13 9 10 8 6 5 15 12 1 2\n11111... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 85 | codeforces | |
5ab9c601c9a94cdb1168ab643f4355bf | Lieges of Legendre | Kevin and Nicky Sun have invented a new game called Lieges of Legendre. In this game, two players take turns modifying the game state with Kevin moving first. Initially, the game is set up so that there are *n* piles of cows, with the *i*-th pile containing *a**i* cows. During each player's turn, that player calls upon... | {"inputs": ["2 1\n3 4", "1 2\n3", "4 5\n20 21 22 25", "5 1\n1 7 7 6 6", "7 1\n8 6 10 10 1 5 8", "10 1\n2 3 5 2 7 4 7 7 4 2", "10 1\n5 6 3 10 6 6 1 1 5 3", "6 1\n1 4 4 4 2 2", "10 2\n3 10 10 8 6 10 9 9 5 7", "6 2\n5 3 5 6 2 2", "9 2\n8 2 9 4 7 5 2 4 9", "9 2\n2 8 4 2 5 7 1 8 10", "7 2\n9 1 7 6 10 3 5", "2 2\n1 2", "2 2\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
5aba9714089213b40d5a9627e3af22e9 | Replacing Digits | You are given an integer *a* that consists of *n* digits. You are also given a sequence of digits *s* of length *m*. The digit in position *j* (1<=≤<=*j*<=≤<=*m*) of sequence *s* means that you can choose an arbitrary position *i* (1<=≤<=*i*<=≤<=*n*) in *a* and replace the digit in the chosen position *i* with *s**j*. ... | {"inputs": ["1024\n010", "987\n1234567", "10\n1", "11\n1", "12\n2", "1\n0", "123456\n9999", "909090\n000111", "588\n24", "25206\n88", "9776247464\n8629", "3666566898\n3001", "3338860467\n5848", "9768757689\n1010", "6669490269\n6240849376", "1794210278\n50931901955213461294", "6997854871\n15113453341706470344", "8947769... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 61 | codeforces | |
5abfc1559fdbd07702d539e4c4bf2ae9 | Mahmoud and a Triangle | Mahmoud has *n* line segments, the *i*-th of them has length *a**i*. Ehab challenged him to use exactly 3 line segments to form a non-degenerate triangle. Mahmoud doesn't accept challenges unless he is sure he can win, so he asked you to tell him if he should accept the challenge. Given the lengths of the line segments... | {"inputs": ["5\n1 5 3 2 4", "3\n4 1 2", "30\n197 75 517 39724 7906061 1153471 3 15166 168284 3019844 272293 316 16 24548 42 118 5792 5 9373 1866366 4886214 24 2206 712886 104005 1363 836 64273 440585 3576", "30\n229017064 335281886 247217656 670601882 743442492 615491486 544941439 911270108 474843964 803323771 17711539... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 269 | codeforces | |
5ae999481a4320688b1d6b02a240dada | Queue | There are *n* schoolchildren, boys and girls, lined up in the school canteen in front of the bun stall. The buns aren't ready yet and the line is undergoing some changes.
Each second all boys that stand right in front of girls, simultaneously swap places with the girls (so that the girls could go closer to the beginni... | {"inputs": ["MFM", "MMFF", "FFMMM", "MMFMMFFFFM", "MFFFMMFMFMFMFFFMMMFFMMMMMMFMMFFMMMFMMFMFFFMMFMMMFFMMFFFFFMFMFFFMMMFFFMFMFMFMFFFMMMMFMMFMMFFMMMMMMFFM", "MFFMFMFFMM", "MFFFFFMFFM", "MMMFMFFFFF", "MMMMMFFMFMFMFMMFMMFFMMFMFFFFFFFMFFFMMMMMMFFMMMFMFMMFMFFMMFMMMFFFFFMMMMMFMMMMFMMMFFMFFMFFFMFFMFFMMFFM", "MMMMFMMMMMFFMMFMFMM... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
5af3996112509cc07f8add53fa6f0c12 | Cookies | Fangy collects cookies. Once he decided to take a box and put cookies into it in some way. If we take a square *k*<=×<=*k* in size, divided into blocks 1<=×<=1 in size and paint there the main diagonal together with cells, which lie above it, then the painted area will be equal to the area occupied by one cookie *k* in... | {"inputs": ["3", "1", "2", "4", "6", "11", "14", "15", "7", "0", "1000", "657", "561", "823", "850", "298", "262", "910", "617", "857", "69", "589", "928", "696", "226"], "outputs": ["9", "1", "3", "27", "243", "59049", "594320", "782957", "729", "1", "691074", "874011", "842553", "858672", "557186", "999535", "946384"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 46 | codeforces | |
5af75c396e8515ffc1c890d93db329c3 | Shell Game | Today the «Z» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so ... | {"inputs": ["1\n1 2\n2 1\n2 1", "1\n2 1\n3 1\n1 3", "3\n3 1\n2 1\n1 2", "1\n1 3\n1 2\n2 3", "3\n3 2\n3 1\n3 1", "1\n2 1\n1 3\n1 3", "3\n3 1\n2 3\n3 2", "2\n1 3\n1 2\n2 1", "1\n1 3\n3 2\n1 2", "1\n1 3\n1 3\n2 3", "2\n1 2\n2 3\n2 1", "3\n1 3\n3 2\n2 1", "1\n1 2\n2 1\n2 3", "1\n2 3\n1 3\n1 2", "2\n3 1\n3 2\n2 3", "2\n1 3\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 99 | codeforces | |
5b1f6ea3b80876a99fa3edeb8b62611e | none | As behooves any intelligent schoolboy, Kevin Sun is studying psycowlogy, cowculus, and cryptcowgraphy at the Bovinia State University (BGU) under Farmer Ivan. During his Mathematics of Olympiads (MoO) class, Kevin was confronted with a weird functional equation and needs your help. For two fixed integers *k* and *p*, w... | {"inputs": ["3 2", "5 4", "7 2", "7 6", "10007 25", "40037 4", "5 0", "5 3", "7 1", "13 5", "13 4", "5 2", "11 1", "11 10", "6907 2590", "3229 153", "727 282", "7621 6195", "4649 4648", "5527 1711", "1901 633", "463 408", "6871 5566", "4177 556", "65213 29960", "375103 52131", "990037 453792", "95531 94787", "498653 11... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 16 | codeforces | |
5b996c84a4e9b643847702897cd4376e | Shovel Sale | There are *n* shovels in Polycarp's shop. The *i*-th shovel costs *i* burles, that is, the first shovel costs 1 burle, the second shovel costs 2 burles, the third shovel costs 3 burles, and so on. Polycarps wants to sell shovels in pairs.
Visitors are more likely to buy a pair of shovels if their total cost ends with ... | {"inputs": ["7", "14", "50", "999999999", "15", "3", "6500", "4", "13", "10", "499999", "6", "8", "9", "11", "12", "5", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "4... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
5bb0e40b287748d6afecc3d5be073136 | Anya and Ghosts | Anya loves to watch horror movies. In the best traditions of horror, she will be visited by *m* ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for exactly *t* seconds. It takes the girl one second to light one candle. More formally, Anya can spend one second to light one... | {"inputs": ["1 8 3\n10", "2 10 1\n5 8", "1 1 3\n10", "21 79 1\n13 42 51 60 69 77 94 103 144 189 196 203 210 215 217 222 224 234 240 260 282", "125 92 2\n1 2 3 4 5 7 8 9 10 12 17 18 20 21 22 23 24 25 26 28 30 32 33 34 35 36 37 40 41 42 43 44 45 46 50 51 53 54 55 57 60 61 62 63 69 70 74 75 77 79 80 81 82 83 84 85 86 88 8... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
5bb44940fe915dd1fa210408ac57c145 | Yet Another Maxflow Problem | In this problem you will have to deal with a very special network.
The network consists of two parts: part *A* and part *B*. Each part consists of *n* vertices; *i*-th vertex of part *A* is denoted as *A**i*, and *i*-th vertex of part *B* is denoted as *B**i*.
For each index *i* (1<=≤<=*i*<=<<=*n*) there is a dire... | {"inputs": ["4 3 2\n1 2\n3 4\n5 6\n2 2 7\n1 4 8\n4 3 9\n1 100\n2 100", "10 10 10\n291546518 199012865\n327731857 137263959\n145140225 631959974\n559674936 815057131\n677050070 949982094\n839693202 160045764\n967872826 489258292\n706535160 594950620\n230389718 274785590\n1 10 861488983\n7 10 994974516\n4 3 117635148\n6 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
5bea950a4b3692c0b55275b4bd4d1133 | Conan and Agasa play a Card Game | Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has *n* cards, and the *i*-th card has a number *a**i* written on it.
They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he remov... | {"inputs": ["3\n4 5 7", "2\n1 1", "10\n38282 53699 38282 38282 38282 38282 38282 38282 38282 38282", "10\n50165 50165 50165 50165 50165 50165 50165 50165 50165 50165", "10\n83176 83176 83176 23495 83176 8196 83176 23495 83176 83176", "10\n32093 36846 32093 32093 36846 36846 36846 36846 36846 36846", "3\n1 2 3", "4\n2 3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 70 | codeforces | |
5c05aa54bdafe322b5a3076e15032999 | Ping-Pong (Easy Version) | In this problem at each moment you have a set of intervals. You can move from interval (*a*,<=*b*) from our set to interval (*c*,<=*d*) from our set if and only if *c*<=<<=*a*<=<<=*d* or *c*<=<<=*b*<=<<=*d*. Also there is a path from interval *I*1 from our set to interval *I*2 from our set if there is a seq... | {"inputs": ["5\n1 1 5\n1 5 11\n2 1 2\n1 2 9\n2 1 2", "10\n1 -311 -186\n1 -1070 -341\n1 -1506 -634\n1 688 1698\n2 2 4\n1 70 1908\n2 1 2\n2 2 4\n1 -1053 1327\n2 5 4", "10\n1 -1365 -865\n1 1244 1834\n2 1 2\n1 -1508 -752\n2 3 2\n2 2 1\n1 -779 595\n1 -1316 877\n2 2 1\n1 -698 1700", "20\n1 1208 1583\n1 -258 729\n1 -409 1201\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 43 | codeforces | |
5c31552aa05de8e16664f4d645bf4d91 | Longtail Hedgehog | This Christmas Santa gave Masha a magic picture and a pencil. The picture consists of *n* points connected by *m* segments (they might cross in any way, that doesn't matter). No two segments connect the same pair of points, and no segment connects the point to itself. Masha wants to color some segments in order paint a... | {"inputs": ["8 6\n4 5\n3 5\n2 5\n1 2\n2 8\n6 7", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 7\n1 3\n2 4\n4 5\n5 3\n2 1\n1 4\n3 2", "5 9\n1 3\n2 4\n4 5\n5 3\n2 1\n1 4\n3 2\n1 5\n2 5", "10 10\n6 3\n2 9\n9 4\n4 5\n10 3\n8 3\n10 5\n7 6\n1 4\n6 8", "100 50\n66 3\n92 79\n9 44\n84 45\n30 63\n30 20\n33 86\n8 83\n40 75\n7 36\n91 4... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
5c4478806ba085b0df028f9fe6a6e89b | Harry Potter and the Sorting Hat | As you know, Hogwarts has four houses: Gryffindor, Hufflepuff, Ravenclaw and Slytherin. The sorting of the first-years into houses is done by the Sorting Hat. The pupils are called one by one in the alphabetical order, each of them should put a hat on his head and, after some thought, the hat solemnly announces the nam... | {"inputs": ["11\nG????SS???H", "2\nH?", "1\n?", "1\nG", "3\nGHS", "4\n????", "5\nGH??S", "5\nH?S?G", "7\n???????", "10\n??HS??HSGR", "55\n??RS?HGH?S?GS?HRGHRHRR?G?GSGSSHGS?HRSHRSR?HGHGRH?GGGHHH", "108\n??RS?HGH?S?GS?HRGHRHRR?G?GSGSSHGS?HRSHRSR?HGHGRH??????????????RS?HGH?S?GS?HRGHRHRR?G?GSGSSHGS?HRSHRSR?HGHGRH", "20\n?H... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
5c467ca04386f97d028df6a21043acfd | Mischievous Mess Makers | It is a balmy spring afternoon, and Farmer John's *n* cows are ruminating about link-cut cacti in their stalls. The cows, labeled 1 through *n*, are arranged so that the *i*-th cow occupies the *i*-th stall from the left. However, Elsie, after realizing that she will forever live in the shadows beyond Bessie's limeligh... | {"inputs": ["5 2", "1 10", "100000 2", "1 1", "8 3", "7 1", "100000 40000", "1 1000", "100 45", "9 2", "456 78", "100000 50000", "100000 50001", "100000 50002", "100000 50003", "100000 49998", "100000 49997", "99999 49998", "99999 49997", "99999 49996", "99999 50000", "99999 50001", "99999 50002", "30062 9", "13486 3",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 87 | codeforces | |
5c49c54a42a6a4ed55defba272f7a724 | Shop | Vasya plays one very well-known and extremely popular MMORPG game. His game character has *k* skill; currently the *i*-th of them equals to *a**i*. Also this game has a common rating table in which the participants are ranked according to the product of all the skills of a hero in the descending order.
Vasya decided t... | {"inputs": ["2 4 3\n13 20\n1 1 14\n1 2 30\n2 1 6\n3 2 2", "1 0 0\n1", "1 1 1\n1\n3 1 8", "1 1 1\n1\n2 1 8", "1 1 1\n1\n1 1 8", "1 0 0\n8", "1 1 1\n8\n3 1 8", "1 1 1\n8\n2 1 8", "1 1 1\n8\n1 1 8", "2 10 10\n8 8\n1 2 8\n1 1 8\n1 1 8\n1 1 8\n1 2 8\n1 2 8\n1 2 8\n1 1 8\n1 1 8\n1 2 8", "10 7 6\n7 1 8 7 1 2 1 3 3 5\n3 1 5\n3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
5c6b49b83886363de94d6f84869ae958 | Next Round | "Contestant who earns a score equal to or greater than the *k*-th place finisher's score will advance to the next round, as long as the contestant earns a positive score..." — an excerpt from contest rules.
A total of *n* participants took part in the contest (*n*<=≥<=*k*), and you already know their scores. Calculate... | {"inputs": ["8 5\n10 9 8 7 7 7 5 5", "4 2\n0 0 0 0", "5 1\n1 1 1 1 1", "5 5\n1 1 1 1 1", "1 1\n10", "17 14\n16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0", "5 5\n3 2 1 0 0", "8 6\n10 9 8 7 7 7 5 5", "8 7\n10 9 8 7 7 7 5 5", "8 4\n10 9 8 7 7 7 5 5", "8 3\n10 9 8 7 7 7 5 5", "8 1\n10 9 8 7 7 7 5 5", "8 2\n10 9 8 7 7 7 5 5", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 235 | codeforces | |
5c7e34e3e37936ee6716f219e3a22ed8 | One-Based Arithmetic | Prof. Vasechkin wants to represent positive integer *n* as a sum of addends, where each addends is an integer number containing only 1s. For example, he can represent 121 as 121=111+11+–1. Help him to find the least number of digits 1 in such sum.
The first line of the input contains integer *n* (1<=≤<=*n*<=<<=1015)... | {"inputs": ["121", "10", "72", "1", "2", "3", "4", "5", "6", "7", "11", "12", "2038946593", "81924761239462", "973546235465729", "999999999999999", "21", "79", "33", "185", "513", "634", "5300", "3724", "2148", "82415", "35839", "79263", "274634", "690762", "374186", "2673749", "5789877", "1873301", "30272863", "333889... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
5ca219f9efcff505576207e1dd0ceb89 | Treasure Hunt | Captain Bill the Hummingbird and his crew recieved an interesting challenge offer. Some stranger gave them a map, potion of teleportation and said that only this potion might help them to reach the treasure.
Bottle with potion has two values *x* and *y* written on it. These values define four moves which can be perfo... | {"inputs": ["0 0 0 6\n2 3", "1 1 3 6\n1 5", "5 4 6 -10\n1 1", "6 -3 -7 -7\n1 2", "2 -5 -8 8\n2 1", "70 -81 -17 80\n87 23", "41 366 218 -240\n3456 1234", "-61972 -39646 -42371 -24854\n573 238", "-84870 -42042 94570 98028\n8972 23345", "-58533 -50999 -1007 -59169\n8972 23345", "-100000 -100000 100000 100000\n100000 10000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 166 | codeforces | |
5cbdab2b174eb6f2360e10275bea52ea | Polycarp and Letters | Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string *s* consisting only of lowercase and uppercase Latin letters.
Let *A* be a set of positions in the string. Let's call it pretty if following conditions are met:
- letters on positions from *A* in the string are all distinct and lowerc... | {"inputs": ["11\naaaaBaabAbA", "12\nzACaAbbaazzC", "3\nABC", "1\na", "2\naz", "200\nXbTJZqcbpYuZQEoUrbxlPXAPCtVLrRExpQzxzqzcqsqzsiisswqitswzCtJQxOavicSdBIodideVRKHPojCNHmbnrLgwJlwOpyrJJIhrUePszxSjJGeUgTtOfewPQnPVWhZAtogRPrJLwyShNQaeNsvrJwjuuBOMPCeSckBMISQzGngfOmeyfDObncyeNsihYVtQbSEh", "2\nAZ", "28\nAabcBabcCBNMaaaaabb... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 115 | codeforces | |
5cd7e775c7c97932f3b29d2af3121b29 | Jeff and Periods | One day Jeff got hold of an integer sequence *a*1, *a*2, ..., *a**n* of length *n*. The boy immediately decided to analyze the sequence. For that, he needs to find all values of *x*, for which these conditions hold:
- *x* occurs in sequence *a*. - Consider all positions of numbers *x* in the sequence *a* (such *i*, ... | {"inputs": ["1\n2", "8\n1 2 1 3 1 2 1 5", "3\n1 10 5", "4\n9 9 3 5", "6\n1 2 2 1 1 2", "6\n2 6 3 8 7 2", "7\n2 1 2 1 2 1 2", "8\n1 1 1 1 1 1 1 1", "9\n2 3 3 3 2 1 2 3 2", "10\n3 1 1 1 1 3 1 2 2 1", "12\n10 9 8 7 7 8 9 10 10 9 8 7"], "outputs": ["1\n2 0", "4\n1 2\n2 4\n3 0\n5 0", "3\n1 0\n5 0\n10 0", "3\n3 0\n5 0\n9 1",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 64 | codeforces | |
5cf7fec69f77240413a6649520c63d03 | Help General | Once upon a time in the Kingdom of Far Far Away lived Sir Lancelot, the chief Royal General. He was very proud of his men and he liked to invite the King to come and watch drill exercises which demonstrated the fighting techniques and tactics of the squad he was in charge of. But time went by and one day Sir Lancelot h... | {"inputs": ["2 4", "3 4", "4 4", "4 3", "4 2", "1 1", "3 5", "5 3", "506 44", "555 349", "757 210", "419 503", "515 19", "204 718", "862 330", "494 982", "967 4", "449 838", "635 458", "156 911", "409 295", "755 458", "936 759", "771 460", "563 802", "953 874", "354 720", "915 72", "860 762", "396 387", "675 710", "728... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
5d1998d3222e1d5f64d103af6720a3ee | Trading Business | To get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, and then sell the bought items on another planet. Note that this operation is not repeated, that is, the buying and the sellin... | {"inputs": ["3 3 10\nVenus\n6 5 3\n7 6 5\n8 6 10\nEarth\n10 9 0\n8 6 4\n10 9 3\nMars\n4 3 0\n8 4 12\n7 2 5", "2 1 5\nA\n6 5 5\nB\n10 9 0", "2 2 5\nAbcdefghij\n20 15 20\n10 5 13\nKlmopqrstu\n19 16 20\n12 7 14", "3 1 5\nTomato\n10 7 20\nBanana\n13 11 0\nApple\n15 14 10", "3 2 11\nMars\n15 10 4\n7 6 3\nSnickers\n20 17 2\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 13 | codeforces | |
5d6f4738ba2052d7b15af604afb86be9 | Sereja and Dima | Sereja and Dima play a game. The rules of the game are very simple. The players have *n* cards in a row. Each card contains a number, all numbers on the cards are distinct. The players take turns, Sereja moves first. During his turn a player can take one card: either the leftmost card in a row, or the rightmost one. Th... | {"inputs": ["4\n4 1 2 10", "7\n1 2 3 4 5 6 7", "42\n15 29 37 22 16 5 26 31 6 32 19 3 45 36 33 14 25 20 48 7 42 11 24 28 9 18 8 21 47 17 38 40 44 4 35 1 43 39 41 27 12 13", "43\n32 1 15 48 38 26 25 14 20 44 11 30 3 42 49 19 18 46 5 45 10 23 34 9 29 41 2 52 6 17 35 4 50 22 33 51 7 28 47 13 39 37 24", "1\n3", "45\n553 40 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 867 | codeforces | |
5d8ef656cdf086c8101d576fae62302e | Square Subsets | Petya was late for the lesson too. The teacher gave him an additional task. For some array *a* Petya should find the number of different ways to select non-empty subset of elements from it in such a way that their product is equal to a square of some integer.
Two ways are considered different if sets of indexes of ele... | {"inputs": ["4\n1 1 1 1", "4\n2 2 2 2", "5\n1 2 4 5 8", "1\n64", "5\n2 2 2 2 2", "6\n1 2 3 4 5 6", "2\n70 70", "7\n4 9 16 25 36 49 64", "13\n64 65 40 26 36 46 53 31 63 11 2 46 59", "15\n66 34 43 45 61 14 12 67 38 25 55 9 30 41 16", "17\n44 57 54 57 54 65 40 57 59 16 39 51 32 51 20 9 8", "18\n22 41 40 8 36 48 23 5 58 12... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 11 | codeforces | |
5db2e7f14bd88a44a444bfbc8f828386 | none | Профиль горного хребта схематично задан в виде прямоугольной таблицы из символов «.» (пустое пространство) и «*» (часть горы). Каждый столбец таблицы содержит хотя бы одну «звёздочку». Гарантируется, что любой из символов «*» либо находится в нижней строке матрицы, либо непосредственно под ним находится другой символ «... | {"inputs": ["6 11\n...........\n.........*.\n.*.......*.\n**.......*.\n**..*...**.\n***********", "5 5\n....*\n...**\n..***\n.****\n*****", "8 7\n.......\n.*.....\n.*.....\n.**....\n.**.*..\n.****.*\n.******\n*******", "1 1\n*", "2 2\n**\n**", "1 10\n**********", "10 1\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*", "5 5\n.....\n........ | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 32 | codeforces | |
5dda3e0143c8d305726f93da43852f5d | Carrot Cakes | In some game by Playrix it takes *t* minutes for an oven to bake *k* carrot cakes, all cakes are ready at the same moment *t* minutes after they started baking. Arkady needs at least *n* cakes to complete a task, but he currently don't have any. However, he has infinitely many ingredients and one oven. Moreover, Arkady... | {"inputs": ["8 6 4 5", "8 6 4 6", "10 3 11 4", "4 2 1 4", "28 17 16 26", "60 69 9 438", "599 97 54 992", "11 22 18 17", "1 13 22 11", "1 1 1 1", "3 1 1 1", "1000 1000 1000 1000", "1000 1000 1 1", "1000 1000 1 400", "1000 1000 1 1000", "1000 1000 1 999", "53 11 3 166", "313 2 3 385", "214 9 9 412", "349 9 5 268", "611 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 280 | codeforces | |
5df9d8e573c06fc045114e08ee7bca33 | Extract Numbers | You are given string *s*. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string *s*=";;" contains three empty words separated by ';'.
... | {"inputs": ["aba,123;1a;0", "1;;01,a0,", "1", "a", ",;,,;", "123;abacab,123;1,sadasfas,123213132g;02131313;aaa,0,012;0;03242;1", ".", ";", "6;2,", "000", "5345rhhr34t.k;k;k;k;k;5677;000000,000000;000098,0.70k;89.;;;", "100.000", ",,;,;,5345rh;hr;34t.k;k;k0,;,0,;k;k;5677.;000000,000000;000098,000.70k;89.;;;", "01", "ash... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 39 | codeforces | |
5e4e2e8c7c34063b37d1d4c3797d8ccc | Gadgets for dollars and pounds | Nura wants to buy *k* gadgets. She has only *s* burles for that. She can buy each gadget for dollars or for pounds. So each gadget is selling only for some type of currency. The type of currency and the cost in that currency are not changing.
Nura can buy gadgets for *n* days. For each day you know the exchange rates ... | {"inputs": ["5 4 2 2\n1 2 3 2 1\n3 2 1 2 3\n1 1\n2 1\n1 2\n2 2", "4 3 2 200\n69 70 71 72\n104 105 106 107\n1 1\n2 2\n1 2", "4 3 1 1000000000\n900000 910000 940000 990000\n990000 999000 999900 999990\n1 87654\n2 76543\n1 65432", "5 5 3 1000000\n921 853 547 187 164\n711 462 437 307 246\n2 94\n2 230\n1 373\n1 476\n2 880",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
5e5d9db11c7acd51d33b3de0186daa19 | Dima and Friends | Dima and his friends have been playing hide and seek at Dima's place all night. As a result, Dima's place got messy. In the morning they decided that they need to clean the place.
To decide who exactly would clean the apartment, the friends want to play a counting-out game. First, all the guys stand in a circle, and t... | {"inputs": ["1\n1", "1\n2", "2\n3 5", "2\n3 5", "1\n5", "5\n4 4 3 5 1", "6\n2 3 2 2 1 3", "8\n2 2 5 3 4 3 3 2", "7\n4 1 3 2 2 4 5", "3\n3 5 1", "95\n4 2 3 4 4 5 2 2 4 4 3 5 3 3 3 5 4 2 5 4 2 1 1 3 4 2 1 3 5 4 2 1 1 5 1 1 2 2 4 4 5 4 5 5 2 1 2 2 2 4 5 5 2 4 3 4 4 3 5 2 4 1 5 4 5 1 3 2 4 2 2 1 5 3 1 5 3 4 3 3 2 1 2 2 1 3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 646 | codeforces | |
5e684bd707170b65c68bb4d8d2a77f83 | Solitaire | A boy named Vasya wants to play an old Russian solitaire called "Accordion". In this solitaire, the player must observe the following rules:
- A deck of *n* cards is carefully shuffled, then all *n* cards are put on the table in a line from left to right; - Before each move the table has several piles of cards lying... | {"inputs": ["4\n2S 2S 2C 2C", "2\n3S 2C", "5\n2S 2S 4S 3S 2S", "5\n5S 5S 7S 4S 3H", "5\n7S 7S 4S 8H 4H", "5\n4S 2H 3S 3S 2H", "52\n3H 6S 3S 2S 2S 3S 4S 3H 2C 4S 3C 3S 2S 2C 2S 6S 4C 3S 5C 3S 2S 4S 3S 5S 2H 2S 4H 3S 3S 4H 4S 2C 2H 2S 4S 6D 4C 4H 2H 4S 3H 6D 6S 3C 3C 4H 5S 3S 3S 2H 2S 4C", "52\n2S 4S 3S 2S 4S 3S 4S 4S 8S... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
5e87611ad3c19c8e572fd38f664c1e27 | Foe Pairs | You are given a permutation *p* of length *n*. Also you are given *m* foe pairs (*a**i*,<=*b**i*) (1<=≤<=*a**i*,<=*b**i*<=≤<=*n*,<=*a**i*<=≠<=*b**i*).
Your task is to count the number of different intervals (*x*,<=*y*) (1<=≤<=*x*<=≤<=*y*<=≤<=*n*) that do not contain any foe pairs. So you shouldn't count intervals (*x... | {"inputs": ["4 2\n1 3 2 4\n3 2\n2 4", "9 5\n9 7 2 3 1 4 6 5 8\n1 6\n4 5\n2 7\n7 2\n2 7", "2 1\n1 2\n1 2", "10 3\n4 10 5 1 6 8 9 2 3 7\n10 5\n2 10\n4 1", "50 10\n41 15 17 1 5 31 7 38 30 39 43 35 2 26 20 42 48 25 19 32 50 4 8 10 44 12 9 18 13 36 28 6 27 23 40 24 3 14 29 11 49 47 45 46 34 21 37 16 22 33\n13 48\n24 12\n2 3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 16 | codeforces | |
5ec25699a1e8a3a06113525155678244 | Felicity is Coming! | It's that time of the year, Felicity is around the corner and you can see people celebrating all around the Himalayan region. The Himalayan region has *n* gyms. The *i*-th gym has *g**i* Pokemon in it. There are *m* distinct Pokemon types in the Himalayan region numbered from 1 to *m*. There is a special evolution camp... | {"inputs": ["2 3\n2 1 2\n2 2 3", "1 3\n3 1 2 3", "2 4\n2 1 2\n3 2 3 4", "2 2\n3 2 2 1\n2 1 2", "3 7\n2 1 2\n2 3 4\n3 5 6 7", "10 100\n16 25 7 48 43 16 23 66 3 17 31 64 27 7 17 11 60\n62 76 82 99 77 19 26 66 46 9 54 77 8 34 76 70 48 53 35 69 29 84 22 16 53 36 27 24 81 2 86 67 45 22 54 96 37 8 3 22 9 30 63 61 86 19 16 47... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
5ed7cffa8b0078ab40b7a770e5f54ea3 | Sereja and the Arrangement of Numbers | Let's call an array consisting of *n* integer numbers *a*1, *a*2, ..., *a**n*, beautiful if it has the following property:
- consider all pairs of numbers *x*,<=*y* (*x*<=≠<=*y*), such that number *x* occurs in the array *a* and number *y* occurs in the array *a*; - for each pair *x*,<=*y* must exist some position *... | {"inputs": ["5 2\n1 2\n2 3", "100 3\n1 2\n2 1\n3 1", "1 2\n1 1\n2 100", "25 29\n82963 53706\n63282 73962\n14996 48828\n84392 31903\n96293 41422\n31719 45448\n46772 17870\n9668 85036\n36704 83323\n73674 63142\n80254 1548\n40663 44038\n96724 39530\n8317 42191\n44289 1041\n63265 63447\n75891 52371\n15007 56394\n55630 6008... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
5f055246626e15ae85a2320bf48ff035 | Wilbur and Array | Wilbur the pig is tinkering with arrays again. He has the array *a*1,<=*a*2,<=...,<=*a**n* initially consisting of *n* zeros. At one step, he can choose any index *i* and either add 1 to all elements *a**i*,<=*a**i*<=+<=1,<=... ,<=*a**n* or subtract 1 from all elements *a**i*,<=*a**i*<=+<=1,<=...,<=*a**n*. His goal is ... | {"inputs": ["5\n1 2 3 4 5", "4\n1 2 2 1", "3\n1 2 4", "6\n1 2 3 6 5 4", "10\n2 1 4 3 6 5 8 7 10 9", "7\n12 6 12 13 4 3 2", "15\n15 14 13 1 2 3 12 11 10 4 5 6 9 8 7", "16\n1 2 3 4 13 14 15 16 9 10 11 12 5 6 7 8", "6\n1000 1 2000 1 3000 1", "1\n0", "5\n1000000000 1 1000000000 1 1000000000", "5\n1000000000 0 1000000000 0 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 183 | codeforces | |
5f292eed4d5faa894c50048b3cebaf39 | Lesson Timetable | When Petya has free from computer games time, he attends university classes. Every day the lessons on Petya’s faculty consist of two double classes. The floor where the lessons take place is a long corridor with *M* classrooms numbered from 1 to *M*, situated along it.
All the students of Petya’s year are divided into... | {"inputs": ["3\n1 1 1\n1 2 3", "3\n1 1 1\n1 1 1", "3\n2 1 1\n5 1 2", "5\n2 1 1 1 1\n5 3 1 1 3", "5\n1 3 15 3 18\n2 6 18 5 19", "6\n3 8 2 6 18 2\n6 20 9 6 19 3", "7\n3 4 7 8 6 5 2\n6 12 19 16 15 7 5", "9\n1 1 1 3 6 1 4 2 1\n1 14 1 6 15 2 14 5 2", "9\n7 1 4 7 8 4 5 7 1\n12 10 6 15 13 7 5 17 1", "11\n4 12 2 1 2 9 13 1 12 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
5f2c9558381de1736909b582f70980f6 | none | Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | {"inputs": ["3\nrivest\nshamir\nadleman", "10\ntourist\npetr\nwjmzbmr\nyeputons\nvepifanov\nscottwu\noooooooooooooooo\nsubscriber\nrowdark\ntankengineer", "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever", "7\ncar\ncare\ncareful\ncarefully\nbeca... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 25 | codeforces | |
5f389135c7741bbbe16125a372058e67 | Lomsat gelral | You are given a rooted tree with root in vertex 1. Each vertex is coloured in some colour.
Let's call colour *c* dominating in the subtree of vertex *v* if there are no other colours that appear in the subtree of vertex *v* more times than colour *c*. So it's possible that two or more colours will be dominating in the... | {"inputs": ["4\n1 2 3 4\n1 2\n2 3\n2 4", "15\n1 2 3 1 2 3 3 1 1 3 2 2 1 2 3\n1 2\n1 3\n1 4\n1 14\n1 15\n2 5\n2 6\n2 7\n3 8\n3 9\n3 10\n4 11\n4 12\n4 13"], "outputs": ["10 9 3 4", "6 5 4 3 2 3 3 1 1 3 2 2 1 2 3"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
5f544507a89d8890327fa2f6658e917e | none | ...Once upon a time a man came to the sea. The sea was stormy and dark. The man started to call for the little mermaid to appear but alas, he only woke up Cthulhu...
Whereas on the other end of the world Pentagon is actively collecting information trying to predict the monster's behavior and preparing the secret super... | {"inputs": ["6 6\n6 3\n6 4\n5 1\n2 5\n1 4\n5 4", "6 5\n5 6\n4 6\n3 1\n5 1\n1 2", "10 10\n4 10\n8 5\n2 8\n4 9\n9 3\n2 7\n10 6\n10 2\n9 8\n1 8", "5 4\n1 5\n1 3\n1 4\n3 2", "12 12\n4 12\n4 7\n4 9\n7 2\n5 12\n2 1\n5 9\n8 6\n10 12\n2 5\n10 9\n12 3", "12 15\n3 2\n11 12\n1 9\n2 1\n1 8\n9 6\n11 5\n9 5\n9 10\n11 3\n7 11\n5 6\n1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 56 | codeforces |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.