Search is not available for this dataset
problem_id stringlengths 32 32 | name stringlengths 2 112 | problem stringlengths 200 14k | test_cases stringlengths 33 79.2M | difficulty stringclasses 33
values | language listlengths 1 1 | source stringclasses 14
values | num_solutions int64 2 1.9M | starter_code stringlengths 0 1.47k | subset stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|
7c76a920fda30ae5d059967f891f2d36 | Numbers Exchange | Eugeny has *n* cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct.
Nikolay has *m* cards, distinct numbers from 1 to *m* are wr... | {"inputs": ["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10", "10 10\n12 13 10 20 13 10 19 15 21 11", "20 16\n23 27 17 29 23 21 24 23 19 25 16 24 20 17 18 17 16 17 28 17", "30 40\n26 22 10 20 29 18 38 11 41 8 33 37 37 3 14 4 3 9 21 38 27 27 7 7 33 12 39 37 17 5", "100 20\n28 42 37 40 26 40 46 46 25 28 36 36 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
7ca6ae0bf81d946812ed8cd9707b606e | Parade | Very soon there will be a parade of victory over alien invaders in Berland. Unfortunately, all soldiers died in the war and now the army consists of entirely new recruits, many of whom do not even know from which leg they should begin to march. The civilian population also poorly understands from which leg recruits beg... | {"inputs": ["3\n5 6\n8 9\n10 3", "2\n6 5\n5 6", "6\n5 9\n1 3\n4 8\n4 5\n23 54\n12 32", "2\n500 499\n500 500", "1\n139 252", "10\n18 18\n71 471\n121 362\n467 107\n138 254\n13 337\n499 373\n337 387\n147 417\n76 417", "4\n4 1\n5 3\n7 6\n3 5", "3\n6 5\n9 8\n3 10", "3\n100 9\n1 3\n1 5", "4\n10 1\n10 2\n10 3\n1 10", "5\n25 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 76 | codeforces | |
7cec9617831c07fa8b967fc9a6eedc86 | Keyboard Layouts | There are two popular keyboard layouts in Berland, they differ only in letters positions. All the other keys are the same. In Berland they use alphabet with 26 letters which coincides with English alphabet.
You are given two strings consisting of 26 distinct letters each: all keys of the first and the second layouts i... | {"inputs": ["qwertyuiopasdfghjklzxcvbnm\nveamhjsgqocnrbfxdtwkylupzi\nTwccpQZAvb2017", "mnbvcxzlkjhgfdsapoiuytrewq\nasdfghjklqwertyuiopzxcvbnm\n7abaCABAABAcaba7", "ayvguplhjsoiencbkxdrfwmqtz\nkhzvtbspcndierqumlojyagfwx\n3", "oaihbljgekzsxucwnqyrvfdtmp\nwznqcfvrthjibokeglmudpayxs\ntZ8WI33UZZytE8A99EvJjck228LxUQtL5A8q7O21... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 126 | codeforces | |
7d0021fff1db0738b43fd95baf153cdf | Bindian Signalizing | Everyone knows that long ago on the territory of present-day Berland there lived Bindian tribes. Their capital was surrounded by *n* hills, forming a circle. On each hill there was a watchman, who watched the neighbourhood day and night.
In case of any danger the watchman could make a fire on the hill. One watchman co... | {"inputs": ["5\n1 2 4 5 3", "3\n2118 2118 2118", "3\n2221 1976 2221", "3\n140 989 2895", "4\n2440 2440 2440 2440", "4\n1178 1178 2577 2577", "4\n332 2714 2420 2714", "5\n763 763 763 763 763", "5\n4136 1826 4136 1826 1826", "5\n3581 3581 305 305 3581", "10\n8097 8097 8097 8097 8097 8097 8097 8097 8097 8097", "10\n4972 4... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
7d45cdf7b667f99d847c39980aeeb60c | New Year Table | Gerald is setting the New Year table. The table has the form of a circle; its radius equals *R*. Gerald invited many guests and is concerned whether the table has enough space for plates for all those guests. Consider all plates to be round and have the same radii that equal *r*. Each plate must be completely inside th... | {"inputs": ["4 10 4", "5 10 4", "1 10 10", "3 10 20", "2 20 11", "6 9 3", "1 999 1000", "1 1000 999", "2 1000 500", "2 1000 499", "10 1000 236", "10 1000 237", "6 999 334", "100 1000 1", "100 1000 50", "13 927 179", "13 145 28", "37 307 24", "37 857 67", "100 821 25", "100 197 6", "93 704 23", "93 857 28", "85 870 31",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 21 | codeforces | |
7d508bb3c9171e2cb143d709a0195e60 | Cutting Figure | You've gotten an *n*<=×<=*m* sheet of squared paper. Some of its squares are painted. Let's mark the set of all painted squares as *A*. Set *A* is connected. Your task is to find the minimum number of squares that we can delete from set *A* to make it not connected.
A set of painted squares is called connected, if for... | {"inputs": ["5 4\n####\n#..#\n#..#\n#..#\n####", "5 5\n#####\n#...#\n#####\n#...#\n#####", "1 10\n.########.", "1 1\n#", "3 3\n.#.\n###\n.#.", "1 2\n##", "2 1\n#\n#", "3 3\n###\n#.#\n###", "2 2\n##\n#.", "2 2\n##\n##", "2 2\n.#\n##", "2 2\n.#\n.#", "9 9\n#########\n#.......#\n#.#####.#\n#.#.#.#.#\n#.#.#.#.#\n#.#.#.#.#\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
7d64dcb19ecf9079b5165273eaa64d34 | none | There are $n$ startups. Startups can be active or acquired. If a startup is acquired, then that means it has exactly one active startup that it is following. An active startup can have arbitrarily many acquired startups that are following it. An active startup cannot follow any other startup.
The following steps happe... | {"inputs": ["3\n-1 -1 -1", "2\n2 -1", "40\n3 3 -1 -1 4 4 -1 -1 -1 -1 -1 10 10 10 10 10 10 4 20 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 3 3 3 3 3 3 3", "8\n-1 3 -1 -1 -1 3 -1 -1", "10\n3 -1 -1 -1 -1 -1 -1 -1 2 2", "50\n36 36 45 44 -1 -1 13 -1 36 -1 44 36 -1 -1 -1 35 -1 36 36 35 -1 -1 -1 14 36 36 22 36 13 -1 35 -1 35 36... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
7d844d6775d42e77bdc1cb91244582dc | Win or Freeze | You can't possibly imagine how cold our friends are this winter in Nvodsk! Two of them play the following game to warm up: initially a piece of paper has an integer *q*. During a move a player should write any integer number that is a non-trivial divisor of the last written number. Then he should run this number of cir... | {"inputs": ["6", "30", "1", "2", "3", "5", "445538663413", "5138168457911", "472670214391", "1468526771489", "1307514188557", "8110708459517", "7938986881993", "34280152201", "8587340257", "1245373417369", "48855707", "614125", "1716443237161", "49380563", "2975", "5839252225", "266418", "319757451841", "3047527844089"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 26 | codeforces | |
7da890448904453791d46d9c3c30dd06 | Straight <<A>> | Noora is a student of one famous high school. It's her final year in school — she is going to study in university next year. However, she has to get an «A» graduation certificate in order to apply to a prestigious one.
In school, where Noora is studying, teachers are putting down marks to the online class register, wh... | {"inputs": ["2 10\n8 9", "3 5\n4 4 4", "3 10\n10 8 9", "2 23\n21 23", "5 10\n5 10 10 9 10", "12 50\n18 10 26 22 22 23 14 21 27 18 25 12", "38 12\n2 7 10 8 5 3 5 6 3 6 5 1 9 7 7 8 3 4 4 4 5 2 3 6 6 1 6 7 4 4 8 7 4 5 3 6 6 6", "63 86\n32 31 36 29 36 26 28 38 39 32 29 26 33 38 36 38 36 28 43 48 28 33 25 39 39 27 34 25 37 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 207 | codeforces | |
7dddbb9040083213e97b91c3df4cdee6 | Micro-World | You have a Petri dish with bacteria and you are preparing to dive into the harsh micro-world. But, unfortunately, you don't have any microscope nearby, so you can't watch them.
You know that you have $n$ bacteria in the Petri dish and size of the $i$-th bacteria is $a_i$. Also you know intergalactic positive integer c... | {"inputs": ["7 1\n101 53 42 102 101 55 54", "6 5\n20 15 10 15 20 25", "7 1000000\n1 1 1 1 1 1 1", "1 1\n1", "1 4\n8", "10 1\n1 2 3 5 6 8 10 11 9 4", "9 2\n1 6 1 5 5 8 6 8 7", "15 1\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1", "2 1000000\n1 1000000", "7 2\n1 5 5 8 9 8 8", "10 1\n2 6 3 4 2 4 4 3 2 1", "4 1\n2 2 1 1", "10 1\n6 3 1 3 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 116 | codeforces | |
7dddfc97c29f8241b7b8802b5da11818 | Dominoes | You have a set of dominoes. Each domino is a rectangular tile with a line dividing its face into two square ends. Can you put all dominoes in a line one by one from left to right so that any two dominoes touched with the sides that had the same number of points? You can rotate the dominoes, changing the left and the ri... | {"inputs": ["5\n1 2\n2 4\n2 4\n6 4\n2 1", "1\n0 0", "1\n5 5", "5\n0 0\n0 0\n0 0\n0 0\n0 0", "4\n0 0\n0 0\n1 1\n1 1", "100\n1 5\n0 3\n0 0\n3 1\n1 5\n0 5\n3 0\n3 0\n5 3\n2 4\n3 4\n1 3\n6 2\n1 5\n1 5\n5 4\n6 0\n6 0\n0 0\n3 3\n5 6\n6 3\n4 3\n5 6\n4 0\n4 2\n2 6\n0 6\n6 6\n4 1\n2 0\n1 5\n1 0\n1 5\n0 0\n1 6\n4 5\n3 0\n3 2\n1 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
7de8573438838f7b11a5b8ceb7d682db | Football Kit | Consider a football tournament where *n* teams participate. Each team has two football kits: for home games, and for away games. The kit for home games of the *i*-th team has color *x**i* and the kit for away games of this team has color *y**i* (*x**i*<=≠<=*y**i*).
In the tournament, each team plays exactly one home g... | {"inputs": ["2\n1 2\n2 1", "3\n1 2\n2 1\n1 3", "2\n1 2\n1 2", "2\n1 2\n3 4", "3\n1 100000\n1 100000\n100000 2", "5\n3 2\n3 4\n2 5\n3 2\n4 3", "6\n2 3\n2 1\n2 1\n3 2\n3 2\n3 1", "10\n2 1\n1 3\n4 1\n2 3\n4 1\n1 4\n2 4\n2 1\n2 3\n3 4", "30\n1 10\n1 7\n6 10\n2 6\n10 2\n1 8\n3 8\n10 2\n7 4\n10 4\n9 1\n3 7\n1 8\n2 5\n3 4\n2 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 20 | codeforces | |
7ded6f93db6dcb0a548c4f4a53af23db | Ilya and tic-tac-toe game | Ilya is an experienced player in tic-tac-toe on the 4<=×<=4 field. He always starts and plays with Xs. He played a lot of games today with his friend Arseny. The friends became tired and didn't finish the last game. It was Ilya's turn in the game when they left it. Determine whether Ilya could have won the game by maki... | {"inputs": ["xx..\n.oo.\nx...\noox.", "x.ox\nox..\nx.o.\noo.x", "x..x\n..oo\no...\nx.xo", "o.x.\no...\n.x..\nooxx", ".xox\no.x.\nx.o.\n..o.", "o.oo\n.x.o\nx.x.\n.x..", "xxox\no.x.\nx.oo\nxo.o", ".xox\n.x..\nxoo.\noox.", "...x\n.x.o\n.o..\n.x.o", "oo.x\nxo.o\no.xx\n.oxx", ".x.o\n..o.\n..ox\nxox.", "....\n.x..\nx...\n..o... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 45 | codeforces | |
7e0ef018667adacfdfe7b5aed7fe4248 | Short Program | Petya learned a new programming language CALPAS. A program in this language always takes one non-negative integer and returns one non-negative integer as well.
In the language, there are only three commands: apply a bitwise operation AND, OR or XOR with a given constant to the current integer. A program can contain an... | {"inputs": ["3\n| 3\n^ 2\n| 1", "3\n& 1\n& 3\n& 5", "3\n^ 1\n^ 2\n^ 3", "2\n| 999\n^ 689", "3\n& 242\n^ 506\n^ 522", "2\n| 56\n^ 875", "3\n^ 125\n^ 377\n& 1019", "1\n& 123", "1\n| 123", "1\n^ 123", "10\n^ 218\n& 150\n| 935\n& 61\n| 588\n& 897\n| 411\n| 584\n^ 800\n| 704", "10\n^ 160\n& 1021\n& 510\n^ 470\n& 1022\n& 251... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 19 | codeforces | |
7e10a81ffb453c0c0029a121b4341dfb | USB Flash Drives | Sean is trying to save a large file to a USB flash drive. He has *n* USB flash drives with capacities equal to *a*1,<=*a*2,<=...,<=*a**n* megabytes. The file size is equal to *m* megabytes.
Find the minimum number of USB flash drives needed to write Sean's file, if he can split the file between drives.
The first line... | {"inputs": ["3\n5\n2\n1\n3", "3\n6\n2\n3\n2", "2\n5\n5\n10", "5\n16\n8\n1\n3\n4\n9", "10\n121\n10\n37\n74\n56\n42\n39\n6\n68\n8\n100", "12\n4773\n325\n377\n192\n780\n881\n816\n839\n223\n215\n125\n952\n8", "15\n7758\n182\n272\n763\n910\n24\n359\n583\n890\n735\n819\n66\n992\n440\n496\n227", "30\n70\n6\n2\n10\n4\n7\n10\n5... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 513 | codeforces | |
7e2d429de3caabf36076ceafdf38d459 | Dinner with Emma | Jack decides to invite Emma out for a dinner. Jack is a modest student, he doesn't want to go to an expensive restaurant. Emma is a girl with high taste, she prefers elite places.
Munhattan consists of *n* streets and *m* avenues. There is exactly one restaurant on the intersection of each street and avenue. The stree... | {"inputs": ["3 4\n4 1 3 5\n2 2 2 2\n5 4 5 1", "3 3\n1 2 3\n2 3 1\n3 1 2", "1 1\n1", "1 10\n74 35 82 39 1 84 29 41 70 12", "10 1\n44\n23\n65\n17\n48\n29\n49\n88\n91\n85", "10 10\n256 72 455 45 912 506 235 68 951 92\n246 305 45 212 788 621 449 876 459 899\n732 107 230 357 370 610 997 669 61 192\n131 93 481 527 983 920 82... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 133 | codeforces | |
7e3b36d489e3c9308df8f9172f63895f | Kolya and Tandem Repeat | Kolya got string *s* for his birthday, the string consists of small English letters. He immediately added *k* more characters to the right of the string.
Then Borya came and said that the new string contained a tandem repeat of length *l* as a substring. How large could *l* be?
See notes for definition of a tandem re... | {"inputs": ["aaba\n2", "aaabbbb\n2", "abracadabra\n10", "zwvrx\n3", "ayi\n10", "eexlzphiay\n1", "zumtumtlitf\n2", "xbmrxbmrkzovhb\n3", "ijtvifbuajod\n5", "jhfwjyyzwrjiyrrgveiqkoltivghgkontrqragikttxxuwszjwqhwxindyrdqhucnbwgwrppgqmsasrzohezjlfmkzsqptwpratprcrxyxecnlsaiqrvimihmhjfgzwdtvmfhgbuonpsblphyoxzclkrwbwrkasahiirz... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
7e625e4a607cb083c6ac116e33b70096 | Reflection | For each positive integer *n* consider the integer ψ(*n*) which is obtained from *n* by replacing every digit *a* in the decimal notation of *n* with the digit (9<=<=-<=<=*a*). We say that ψ(*n*) is the reflection of *n*. For example, reflection of 192 equals 807. Note that leading zeros (if any) should be omitted. So ... | {"inputs": ["3 7", "1 1", "8 10", "4 6", "10 100", "1 999", "40 60", "66 74", "27 71", "66 95", "48 51", "9999999 9999999", "555555 555555", "942 572335596", "2331 77424372", "314 592188442", "6277 181089912", "163 306093048", "9265 978077465", "934 300539101", "850 629417171", "9015 34697316", "595 416293084", "3722 8... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 19 | codeforces | |
7e7f3dd7295be10757799855d78df607 | Falling Anvils | For some reason in many American cartoons anvils fall from time to time onto heroes' heads. Of course, safes, wardrobes, cruisers, planes fall sometimes too... But anvils do so most of all.
Anvils come in different sizes and shapes. Quite often they get the hero stuck deep in the ground. But have you ever thought who ... | {"inputs": ["2\n4 2\n1 2", "90\n1 1\n2 1\n3 1\n4 1\n5 1\n6 1\n7 1\n8 1\n9 1\n1 2\n2 2\n3 2\n4 2\n5 2\n6 2\n7 2\n8 2\n9 2\n1 3\n2 3\n3 3\n4 3\n5 3\n6 3\n7 3\n8 3\n9 3\n1 4\n2 4\n3 4\n4 4\n5 4\n6 4\n7 4\n8 4\n9 4\n1 5\n2 5\n3 5\n4 5\n5 5\n6 5\n7 5\n8 5\n9 5\n1 6\n2 6\n3 6\n4 6\n5 6\n6 6\n7 6\n8 6\n9 6\n1 7\n2 7\n3 7\n4 7... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
7e867a304eb0618de56b5adeb0adca21 | none | Вася купил стол, у которого *n* ножек. Каждая ножка состоит из двух частей, которые соединяются друг с другом. Каждая часть может быть произвольной положительной длины, но гарантируется, что из всех 2*n* частей возможно составить *n* ножек одинаковой длины. При составлении ножки любые две части могут быть соединены дру... | {"inputs": ["3\n1 3 2 4 5 3", "3\n1 1 1 2 2 2", "1\n3 7", "10\n9 13 18 7 18 13 2 2 5 16 3 17 5 4 18 2 15 11 7 15", "10\n759 82 475 841 46 461 288 525 918 241 789 847 58 954 712 159 942 211 153 539", "100\n8 7 7 5 2 7 7 5 1 8 6 3 6 7 2 4 4 2 6 8 5 6 5 2 6 1 3 9 5 8 7 6 5 4 8 6 5 5 3 2 6 5 4 9 7 1 5 7 9 5 7 4 1 6 5 8 2 6... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 27 | codeforces | |
7e9e640b2aa2853e7ba9b99a1f729c44 | Spoilt Permutation | Vasya collects coins: he has exactly one coin for every year from 1 to *n*. Naturally, Vasya keeps all the coins in his collection in the order in which they were released. Once Vasya's younger brother made a change — he took all the coins whose release year dated from *l* to *r* inclusively and put them in the reverse... | {"inputs": ["8\n1 6 5 4 3 2 7 8", "4\n2 3 4 1", "4\n1 2 3 4", "8\n1 3 2 4 6 5 7 8", "8\n1 3 4 2 6 5 7 8", "1\n1", "2\n1 2", "2\n2 1", "149\n9 120 122 97 93 70 85 56 102 16 103 112 88 84 118 135 113 62 65 19 89 15 108 73 82 21 147 27 115 130 136 6 1 90 29 94 149 17 53 132 99 123 64 95 71 67 141 126 59 8 10 114 121 134 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 48 | codeforces | |
7eb0da0bbbcb2806ed5714ca454320e7 | The Meaningless Game | Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting.
The game consists of multiple rounds. Its rules are very simple: in each round, a natural number *k* is chosen. Then, the one who says (or barks) it faster than the other wins the round. After that, the winner's score is... | {"inputs": ["6\n2 4\n75 45\n8 8\n16 16\n247 994\n1000000000 1000000", "3\n1 1\n8 27\n1000 1331", "1\n12004 18012002", "1\n3331 11095561", "1\n2 3", "1\n1062961 1031", "1\n6 12", "1\n3 1", "1\n3 10", "1\n31159 970883281", "1\n9907 98148649", "1\n16 8", "1\n90 72"], "outputs": ["Yes\nYes\nYes\nNo\nNo\nYes", "Yes\nNo\nNo"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
7eb8f58de43c50a8d69328b3803bf014 | Pizza Separation | Students Vasya and Petya are studying at the BSU (Byteland State University). At one of the breaks they decided to order a pizza. In this problem pizza is a circle of some radius. The pizza was delivered already cut into *n* pieces. The *i*-th piece is a sector of angle equal to *a**i*. Vasya and Petya want to divide a... | {"inputs": ["4\n90 90 90 90", "3\n100 100 160", "1\n360", "4\n170 30 150 10", "5\n10 10 10 10 320", "8\n45 45 45 45 45 45 45 45", "3\n120 120 120", "5\n110 90 70 50 40", "2\n170 190", "15\n25 25 25 25 25 25 25 25 25 25 25 25 25 25 10", "5\n30 60 180 60 30", "2\n359 1", "5\n100 100 30 100 30", "5\n36 34 35 11 244", "5\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 146 | codeforces | |
7ed2fb332ead357e5fd2ae9c305aaadf | Cormen --- The Best Friend Of a Man | Recently a dog was bought for Polycarp. The dog's name is Cormen. Now Polycarp has a lot of troubles. For example, Cormen likes going for a walk.
Empirically Polycarp learned that the dog needs at least *k* walks for any two consecutive days in order to feel good. For example, if *k*<==<=5 and yesterday Polycarp went... | {"inputs": ["3 5\n2 0 1", "3 1\n0 0 0", "4 6\n2 4 3 5", "5 1\n0 0 0 0 1", "10 500\n164 44 238 205 373 249 87 30 239 90", "1 1\n1", "5 1\n0 0 0 0 0", "5 1\n0 0 0 0 1", "5 2\n0 0 0 1 0", "5 5\n1 4 0 0 0", "5 10\n1 2 1 0 1", "5 10\n0 1 0 1 0", "10 5\n0 2 3 0 0 1 0 2 3 1", "10 1\n0 0 0 0 0 0 0 0 1 0", "10 436\n13 16 45 9 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 51 | codeforces | |
7ee0356b1b5e79e1c67200d0c9a585b1 | Shortest Path | In Ancient Berland there were *n* cities and *m* two-way roads of equal length. The cities are numbered with integers from 1 to *n* inclusively. According to an ancient superstition, if a traveller visits three cities *a**i*, *b**i*, *c**i* in row, without visiting other cities between them, a great disaster awaits him... | {"inputs": ["4 4 1\n1 2\n2 3\n3 4\n1 3\n1 4 3", "3 1 0\n1 2", "4 4 2\n1 2\n2 3\n3 4\n1 3\n1 2 3\n1 3 4", "4 4 1\n1 2\n2 3\n3 4\n1 3\n1 2 3", "2 1 0\n1 2", "4 4 1\n1 2\n2 3\n3 4\n1 3\n1 3 4", "3 2 0\n1 2\n3 2", "3 2 1\n1 2\n3 2\n1 2 3", "4 4 4\n1 2\n2 3\n3 4\n1 3\n1 2 3\n1 3 4\n1 2 4\n1 3 2"], "outputs": ["2\n1 3 4", "-... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 7 | codeforces | |
7ef8d70d94ebd6d424af6d9e8cf5d981 | Coins | One day Vasya came across three Berland coins. They didn't have any numbers that's why Vasya didn't understand how their denominations differ. He supposed that if one coin is heavier than the other one, then it should be worth more. Vasya weighed all the three pairs of coins on pan balance scales and told you the resul... | {"inputs": ["A>B\nC<B\nA>C", "A<B\nB>C\nC>A", "A<C\nB<A\nB>C", "A<B\nA<C\nB>C", "B>A\nC<B\nC>A", "A>B\nB>C\nC<A", "A>C\nA>B\nB<C", "C<B\nB>A\nA<C", "C<B\nA>B\nC<A", "C>B\nB>A\nA<C", "C<B\nB<A\nC>A", "B<C\nC<A\nA>B", "A>B\nC<B\nC<A", "B>A\nC>B\nA>C", "B<A\nC>B\nC>A", "A<B\nC>B\nA<C", "A<B\nC<A\nB<C", "A>C\nC<B\nB>A", "C... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 275 | codeforces | |
7f06cf906d3c851d618076732c708a09 | Patrick and Shopping | Today Patrick waits for a visit from his friend Spongebob. To prepare for the visit, Patrick needs to buy some goodies in two stores located near his house. There is a *d*1 meter long road between his house and the first shop and a *d*2 meter long road between his house and the second shop. Also, there is a road of len... | {"inputs": ["10 20 30", "1 1 5", "100 33 34", "777 777 777", "2 2 8", "12 34 56", "789 101112 131415", "27485716 99999999 35182", "1 293548 5", "12059 259855 5874875", "46981 105809 585858", "9889 1221 2442", "100500 200600 300700", "318476 318476 318476", "23985 3353 75633", "120 1298 2222", "98437 23487 666672", "100... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 512 | codeforces | |
7f2a40ffb32ee0ea022d8d2ccfef1568 | Big Data | Little Petya wanted to give an April Fools Day present to some scientists. After some hesitation he decided to give them the array that he got as a present in Codeforces Round #153 (Div.2). The scientists rejoiced at the gift and decided to put some important facts to this array. Here are the first few of the facts:
- ... | {"inputs": ["1", "7", "13", "3", "8", "16", "11", "2", "5", "10", "9", "15", "4", "12", "6", "14"], "outputs": ["1", "0", "1", "0", "1", "0", "0", "0", "0", "1", "1", "1", "1", "0", "1", "0"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 24 | codeforces | |
7f638bd6b5c442a8088b1872b76c3ff9 | Flags | When Igor K. was a freshman, his professor strictly urged him, as well as all other freshmen, to solve programming Olympiads. One day a problem called "Flags" from a website called Timmy's Online Judge caught his attention. In the problem one had to find the number of three-colored flags that would satisfy the conditio... | {"inputs": ["3 4", "5 6", "3 3", "3 5", "3 6", "3 7", "3 8", "3 9", "3 10", "3 100", "1 1", "1 2", "1 3", "1 4", "2 2", "2 3", "2 4", "4 4", "1 1000000000", "2 1000000000", "3 1000000000", "4 1000000000", "999999998 1000000000", "999999999 1000000000", "1000000000 1000000000", "9 30", "3 47", "9 47", "8 36", "8 37", "8... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
7f642d29a6523b89764d5462b24da7b5 | Garland | Once little Vasya read an article in a magazine on how to make beautiful handmade garland from colored paper. Vasya immediately went to the store and bought *n* colored sheets of paper, the area of each sheet is 1 square meter.
The garland must consist of exactly *m* pieces of colored paper of arbitrary area, each pie... | {"inputs": ["aaabbac\naabbccac", "a\nz", "r\nr", "stnsdn\nndnndsn", "yqfqfp\ntttwtqq", "zzbbrrtrtzr\ntbbtrrrzr", "ivvfisvsvii\npaihjinno", "zbvwnlgkshqerxptyod\nz", "xlktwjymocqrahnbesf\nfoo", "bbzmzqazmbambnmzaabznmbabzqnaabmabmnnabbmnzaanzzezebzabqaabzqaemeqqammmbazmmz\naznnbbmeebmanbeemzmemqbaeebnqenqzzbanebmnzqqebq... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 150 | codeforces | |
7f7795304e826b9b5db2579af029fffb | Literature Lesson | Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes.
Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels.
Two lines rhyme if their ... | {"inputs": ["1 1\nday\nmay\nsun\nfun", "1 1\nday\nmay\ngray\nway", "2 1\na\na\na\na\na\na\ne\ne", "2 1\nday\nmay\nsun\nfun\ntest\nhill\nfest\nthrill", "2 5\na\na\na\na\na\na\ne\ne", "1 1\nrezwbgy\nxakgmv\njogezwbgy\napezwbgy", "2 1\nnuqfxwrb\napqfkw\nuqfxwrb\nnhcuqfxwrb\nogkznwncmt\nevf\nogkznwncmt\nogkznwncmt", "1 1\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
7f7ccd7bfb17be7014596f08c0ba175f | Watto and Mechanism | Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with *n* strings. Then the mechanism should be able to process queries of the following type: "Given string *s*, determine if the memory of the ... | {"inputs": ["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac", "1 5\nacbacbacb\ncbacbacb\nacbacbac\naacbacbacb\nacbacbacbb\nacbaabacb", "5 4\nab\ncacab\ncbabc\nacc\ncacab\nabc\naa\nacbca\ncb", "9 9\ncaccbcacabccba\naacbcbcaabacbcbcba\nbabccaaacccacbb\ncaaabcaacbababbabbb\nabbaccacabacaaaa\nbccbccababcaacb\ncaacbcaacbababbab... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
7fade72fccef41df7bb624d7534b67df | Brain Network (easy) | One particularly well-known fact about zombies is that they move and think terribly slowly. While we still don't know why their movements are so sluggish, the problem of laggy thinking has been recently resolved. It turns out that the reason is not (as previously suspected) any kind of brain defect – it's the opposite!... | {"inputs": ["4 4\n1 2\n2 3\n3 1\n4 1", "6 5\n1 2\n2 3\n3 4\n4 5\n3 6", "2 1\n1 2", "3 3\n2 1\n1 3\n3 2", "3 2\n1 2\n2 3", "9 8\n1 2\n2 3\n3 4\n4 1\n5 6\n6 7\n7 8\n8 9", "8 7\n6 2\n1 5\n4 8\n4 7\n6 7\n8 3\n8 1", "200 5\n93 101\n199 164\n14 94\n115 61\n106 156", "10 9\n6 5\n9 2\n4 7\n2 3\n7 3\n3 4\n10 6\n1 2\n5 8", "10 9... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
7fb1f4b5006d1f42e41292d10c218c31 | Weird Subtraction Process | You have two variables *a* and *b*. Consider the following sequence of actions performed with these variables:
1. If *a*<==<=0 or *b*<==<=0, end the process. Otherwise, go to step 2;1. If *a*<=≥<=2·*b*, then set the value of *a* to *a*<=-<=2·*b*, and repeat step 1. Otherwise, go to step 3;1. If *b*<=≥<=2·*a*, then s... | {"inputs": ["12 5", "31 12", "1000000000000000000 7", "31960284556200 8515664064180", "1000000000000000000 1000000000000000000", "1 1000", "1 1000000", "1 1000000000000000", "1 99999999999999999", "1 4", "1000000000000001 500000000000000", "1 1000000000000000000", "2 4", "2 1", "6 19", "22 5", "10000000000000000 100000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 98 | codeforces | |
7fc45e96c02615a2cc4a675cddd533b0 | Fountains | Arkady plays Gardenscapes a lot. Arkady wants to build two new fountains. There are *n* available fountains, for each fountain its beauty and cost are known. There are two types of money in the game: coins and diamonds, so each fountain cost can be either in coins or diamonds. No money changes between the types are all... | {"inputs": ["3 7 6\n10 8 C\n4 3 C\n5 6 D", "2 4 5\n2 5 C\n2 1 D", "3 10 10\n5 5 C\n5 5 C\n10 11 D", "6 68 40\n1 18 D\n6 16 D\n11 16 D\n7 23 D\n16 30 D\n2 20 D", "6 4 9\n6 6 D\n1 4 D\n6 7 C\n7 6 D\n5 7 D\n2 5 D", "52 38 22\n9 25 D\n28 29 C\n29 25 D\n4 28 D\n23 29 D\n24 25 D\n17 12 C\n11 19 C\n13 14 C\n12 15 D\n7 25 C\n2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
7fe9b3c996302555cb30ddbb77124d9e | Unsolvable | Consider the following equation:
Let's find all integer *z* (*z*<=><=0), for which this equation is unsolvable in positive integers. The phrase "unsolvable in positive integers" means that there are no such positive integers *x* and *y* (*x*,<=*y*<=><=0), for which the given above equation holds.
Let's write o... | {"inputs": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40"], "outputs": ["1", "3", "15", "63", "4095", "65535", "262143", "73741816", "53... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
8031d3ee80b63cbdd0fc081c9cee561f | Ilya and Queries | Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.
You've got string *s*<==<=*s*1*s*2... *s**n* (*n* is the length of the string), consisting only of characters "." and "#" and *m* queries. Each query is described by a pair of integers *l**i*,<... | {"inputs": ["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4", ".#...#..\n6\n1 5\n2 3\n6 7\n2 4\n2 5\n1 3", "#.#.#..\n5\n3 4\n4 5\n5 7\n5 7\n1 3", "#.##.##.\n7\n1 8\n2 6\n2 6\n6 8\n3 5\n2 4\n2 5", "#..#\n1\n1 4", "#..##...#.\n7\n5 9\n6 10\n1 7\n5 8\n3 5\n2 10\n3 4", "#.#.#\n7\n1 2\n3 4\n3 5\n2 3\n3 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 204 | codeforces | |
80349b15c8104db3dc055c860f58511a | Maze 2D | The last product of the R2 company in the 2D games' field is a new revolutionary algorithm of searching for the shortest path in a 2<=×<=*n* maze.
Imagine a maze that looks like a 2<=×<=*n* rectangle, divided into unit squares. Each unit square is either an empty cell or an obstacle. In one unit of time, a person can ... | {"inputs": ["4 7\n.X..\n...X\n5 1\n1 3\n7 7\n1 4\n6 1\n4 7\n5 7", "10 3\nX...X..X..\n..X...X..X\n11 7\n7 18\n18 10", "1 1\n.\n.\n1 2", "2 1\n..\n.X\n1 2", "2 1\n..\nX.\n1 2", "2 1\n..\nX.\n1 4", "2 1\n.X\n..\n1 4", "2 1\nX.\n..\n2 3", "2 1\n..\n.X\n3 2"], "outputs": ["1\n4\n0\n5\n2\n2\n2", "9\n-1\n3", "1", "1", "1", "2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
8064634d8049cafb0812bc65774e8736 | Interesting Game | Two best friends Serozha and Gena play a game.
Initially there is one pile consisting of *n* stones on the table. During one move one pile should be taken and divided into an arbitrary number of piles consisting of *a*1<=><=*a*2<=><=...<=><=*a**k*<=><=0 stones. The piles should meet the condition *a*1<=-<=... | {"inputs": ["3", "6", "100", "33", "23", "35", "15", "99", "46", "78", "627", "250", "873", "871", "684", "303", "93764", "39509", "70878", "7578", "31893", "57113", "66873", "9564", "42237", "92763", "38798", "63359", "573", "60879", "67341", "15748", "42602", "67817", "81207", "8149", "95298", "41385", "27443", "7442... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
807c274c38b88f13353f30a0b0a62af6 | Discounts | One day Polycarpus stopped by a supermarket on his way home. It turns out that the supermarket is having a special offer for stools. The offer is as follows: if a customer's shopping cart contains at least one stool, the customer gets a 50% discount on the cheapest item in the cart (that is, it becomes two times cheape... | {"inputs": ["3 2\n2 1\n3 2\n3 1", "4 3\n4 1\n1 2\n2 2\n3 2", "1 1\n1 1", "1 1\n1 2", "10 1\n1 1\n2 2\n1 1\n23 2\n17 2\n1 1\n1 1\n30 2\n1 1\n9 2", "11 11\n6 2\n6 2\n1 2\n2 2\n3 1\n6 2\n1 1\n1 1\n3 1\n3 1\n6 2", "5 4\n24 1\n19 1\n28 2\n7 1\n23 2", "20 3\n28 1\n786180179 2\n16 1\n617105650 2\n23 1\n21 1\n22 1\n7 1\n314215... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
80986378f9ecabb610182e9e01ee76c7 | Reconnaissance 2 | *n* soldiers stand in a circle. For each soldier his height *a**i* is known. A reconnaissance unit can be made of such two neighbouring soldiers, whose heights difference is minimal, i.e. |*a**i*<=-<=*a**j*| is minimal. So each of them will be less noticeable with the other. Output any pair of soldiers that can form a ... | {"inputs": ["5\n10 12 13 15 10", "4\n10 20 30 40", "6\n744 359 230 586 944 442", "5\n826 747 849 687 437", "5\n999 999 993 969 999", "5\n4 24 6 1 15", "2\n511 32", "3\n907 452 355", "4\n303 872 764 401", "10\n684 698 429 694 956 812 594 170 937 764", "20\n646 840 437 946 640 564 936 917 487 752 844 734 468 969 674 646 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 529 | codeforces | |
80a02d317a162a555112fead914c31e1 | Making Sequences is Fun | We'll define *S*(*n*) for positive integer *n* as follows: the number of the *n*'s digits in the decimal base. For example, *S*(893)<==<=3, *S*(114514)<==<=6.
You want to make a consecutive integer sequence starting from number *m* (*m*,<=*m*<=+<=1,<=...). But you need to pay *S*(*n*)·*k* to add the number *n* to the ... | {"inputs": ["9 1 1", "77 7 7", "114 5 14", "1 1 2", "462 183 8", "462 183 8", "462 183 8", "462 183 8", "462 183 8", "462 183 8", "462 183 8", "10000000000000000 1 1", "2155990066796462 2710473050636183 563261158", "552719169048748 7822730034794389 374302919", "6895788044242644 3474119895793364 732614708", "92305738044... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 38 | codeforces | |
80cc5107e71a2f8ed4a0a93bc8680d56 | Reorder the Array | You are given an array of integers. Vasya can permute (change order) its integers. He wants to do it so that as many as possible integers will become on a place where a smaller integer used to stand. Help Vasya find the maximal number of such integers.
For instance, if we are given an array $[10, 20, 30, 40]$, we can ... | {"inputs": ["7\n10 1 1 1 5 5 3", "5\n1 1 1 1 1", "6\n300000000 200000000 300000000 200000000 1000000000 300000000", "10\n1 2 3 4 5 6 7 8 9 10", "1\n1", "7\n3 5 2 2 5 2 4", "5\n1 5 4 2 3"], "outputs": ["4", "0", "3", "9", "0", "4", "4"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 147 | codeforces | |
80cfb08e92b0510fb8ce855b2eaa7382 | Phone Code | Polycarpus has *n* friends in Tarasov city. Polycarpus knows phone numbers of all his friends: they are strings *s*1,<=*s*2,<=...,<=*s**n*. All these strings consist only of digits and have the same length.
Once Polycarpus needed to figure out Tarasov city phone code. He assumed that the phone code of the city is the... | {"inputs": ["4\n00209\n00219\n00999\n00909", "2\n1\n2", "3\n77012345678999999999\n77012345678901234567\n77012345678998765432", "5\n4491183345\n4491184811\n4491162340\n4491233399\n4491449214", "10\n15424\n10953\n19176\n15514\n16284\n18680\n19305\n13816\n16168\n15924", "10\n4906361343\n8985777485\n1204265609\n7088384855\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 212 | codeforces | |
80d30acd3149e5f80f5e75a75d506b79 | Developing Skills | Petya loves computer games. Finally a game that he's been waiting for so long came out!
The main character of this game has *n* different skills, each of which is characterized by an integer *a**i* from 0 to 100. The higher the number *a**i* is, the higher is the *i*-th skill of the character. The total rating of the ... | {"inputs": ["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100", "100 10000\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0", "100 10000\n100 100 100 100 100 100 100 100 100 10... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
80f7124129b659f8bb7de526beeedbb7 | Three-level Laser | An atom of element X can exist in *n* distinct states with energies *E*1<=<<=*E*2<=<<=...<=<<=*E**n*. Arkady wants to build a laser on this element, using a three-level scheme. Here is a simplified description of the scheme.
Three distinct states *i*, *j* and *k* are selected, where *i*<=<<=*j*<=<<=*k*... | {"inputs": ["4 4\n1 3 5 7", "10 8\n10 13 15 16 17 19 20 22 24 25", "3 1\n2 5 10", "5 3\n4 6 8 9 10", "10 128\n110 121 140 158 174 188 251 271 272 277", "20 17\n104 107 121 131 138 140 143 144 178 192 193 198 201 206 238 242 245 248 255 265", "30 23\n102 104 105 107 108 109 110 111 116 118 119 122 127 139 140 142 145 15... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 41 | codeforces | |
8116b0c6c5a9ed18caa329c931d33990 | Two Tables | You've got two rectangular tables with sizes *n**a*<=×<=*m**a* and *n**b*<=×<=*m**b* cells. The tables consist of zeroes and ones. We will consider the rows and columns of both tables indexed starting from 1. Then we will define the element of the first table, located at the intersection of the *i*-th row and the *j*-t... | {"inputs": ["3 2\n01\n10\n00\n2 3\n001\n111", "3 3\n000\n010\n000\n1 1\n1", "2 4\n1010\n0011\n5 5\n01100\n01110\n00111\n00110\n00110", "3 1\n0\n1\n0\n2 2\n11\n00", "1 5\n00110\n5 2\n11\n00\n01\n01\n11", "2 2\n11\n01\n2 2\n10\n11", "12 3\n111\n001\n101\n101\n010\n101\n110\n110\n101\n001\n010\n110\n1 26\n1101011001000011... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
81263fa7374bfd7992ffb8b4bd99174b | Coloring Trees | ZS the Coder and Chris the Baboon has arrived at Udayland! They walked in the park where *n* trees grow. They decided to be naughty and color the trees in the park. The trees are numbered with integers from 1 to *n* from left to right.
Initially, tree *i* has color *c**i*. ZS the Coder and Chris the Baboon recognizes ... | {"inputs": ["3 2 2\n0 0 0\n1 2\n3 4\n5 6", "3 2 2\n2 1 2\n1 3\n2 4\n3 5", "3 2 2\n2 0 0\n1 3\n2 4\n3 5", "3 2 3\n2 1 2\n1 3\n2 4\n3 5", "3 2 3\n0 0 0\n10 30000\n20000 1000000000\n1000000000 50000", "4 2 1\n0 0 0 0\n10 30000\n20000 1000000000\n1000000000 50000\n55 55", "4 2 1\n0 0 0 2\n10 30000\n20000 1000000000\n100000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 14 | codeforces | |
81530ac1defad51d6b2ce6a51a25f966 | Art Union | A well-known art union called "Kalevich is Alive!" manufactures objects d'art (pictures). The union consists of *n* painters who decided to organize their work as follows.
Each painter uses only the color that was assigned to him. The colors are distinct for all painters. Let's assume that the first painter uses color... | {"inputs": ["5 1\n1\n2\n3\n4\n5", "4 2\n2 5\n3 1\n5 3\n10 1", "1 1\n66", "2 2\n1 1\n1 1", "2 2\n10 1\n10 1", "1 5\n1 95 44 14 35", "7 1\n80\n92\n24\n88\n40\n45\n7", "1 2\n51 44", "2 1\n19\n4", "2 2\n1 10\n1 1", "3 3\n3 9 4\n5 10 8\n4 4 7", "10 3\n6 10 3\n2 7 9\n10 4 7\n6 3 4\n6 2 6\n8 4 4\n5 9 8\n6 9 7\n2 7 10\n2 6 2"]... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 134 | codeforces | |
815ad2e108b5611d42ee9b719310028e | Anton and Making Potions | Anton is playing a very interesting computer game, but now he is stuck at one of the levels. To pass to the next level he has to prepare *n* potions.
Anton has a special kettle, that can prepare one potions in *x* seconds. Also, he knows spells of two types that can faster the process of preparing potions.
1. Spells... | {"inputs": ["20 3 2\n10 99\n2 4 3\n20 10 40\n4 15\n10 80", "20 3 2\n10 99\n2 4 3\n200 100 400\n4 15\n100 800", "10 3 3\n10 33\n1 7 6\n17 25 68\n2 9 10\n78 89 125", "94 1 1\n26 324\n7\n236\n77\n5", "3 4 5\n5 9\n1 2 1 1\n3 5 4 1\n1 1 1 1 3\n1 2 3 4 5", "1 4 2\n3 10\n2 1 1 1\n1 5 3 5\n1 1\n1 5", "5 3 3\n4 4\n2 3 1\n1 3 1\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
8166a47ee028698d418e3cf19e5bdbb2 | Newspaper Headline | A newspaper is published in Walrusland. Its heading is *s*1, it consists of lowercase Latin letters. Fangy the little walrus wants to buy several such newspapers, cut out their headings, glue them one to another in order to get one big string. After that walrus erase several letters from this string in order to get a n... | {"inputs": ["abc\nxyz", "abcd\ndabc", "ab\nbabaaab", "ab\nbaaabba", "fbaaigiihhfaahgdbddgeggjdeigfadhfddja\nhbghjgijijcdafcbgiedichdeebaddfddb", "ibifgcfdbfdhihbifageaaadegbfbhgeebgdgiafgedchdg\ndedfebcfdigdefdediigcfcafbhhiacgfbeccfchd", "fcagdciidcedeaicgfffgjefaefaachfbfj\naiecchjehdgbjfcdjdefgfhiddjajeddiigidaibeja... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 20 | codeforces | |
816c9f5df0e4959202f07bb94b561c90 | Ghosts | Ghosts live in harmony and peace, they travel the space without any purpose other than scare whoever stands in their way.
There are $n$ ghosts in the universe, they move in the $OXY$ plane, each one of them has its own velocity that does not change in time: $\overrightarrow{V} = V_{x}\overrightarrow{i} + V_{y}\overrig... | {"inputs": ["4 1 1\n1 -1 -1\n2 1 1\n3 1 1\n4 -1 -1", "3 1 0\n-1 1 0\n0 0 -1\n1 -1 -2", "3 1 0\n0 0 0\n1 0 0\n2 0 0", "10 7 -626288749\n795312099 49439844 266151109\n-842143911 23740808 624973405\n-513221420 -44452680 -391096559\n-350963348 -5068756 -160670209\n690883790 11897718 3356227\n-509035268 -45646185 -210137445... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 23 | codeforces | |
819e473a539eec5cf984f904af5fbdfa | Bicycle Race | Maria participates in a bicycle race.
The speedway takes place on the shores of Lake Lucerne, just repeating its contour. As you know, the lake shore consists only of straight sections, directed to the north, south, east or west.
Let's introduce a system of coordinates, directing the *Ox* axis from west to east, and ... | {"inputs": ["6\n0 0\n0 1\n1 1\n1 2\n2 2\n2 0\n0 0", "16\n1 1\n1 5\n3 5\n3 7\n2 7\n2 9\n6 9\n6 7\n5 7\n5 3\n4 3\n4 4\n3 4\n3 2\n5 2\n5 1\n1 1", "4\n-10000 -10000\n-10000 10000\n10000 10000\n10000 -10000\n-10000 -10000", "4\n6 8\n6 9\n7 9\n7 8\n6 8", "8\n-10000 -10000\n-10000 5000\n0 5000\n0 10000\n10000 10000\n10000 0\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 88 | codeforces | |
81cbf25d21c00e543382dbf2b0b24f1e | Group Projects | There are *n* students in a class working on group projects. The students will divide into groups (some students may be in groups alone), work on their independent pieces, and then discuss the results together. It takes the *i*-th student *a**i* minutes to finish his/her independent piece.
If students work at differen... | {"inputs": ["3 2\n2 4 5", "4 3\n7 8 9 10", "4 0\n5 10 20 21", "20 1000\n50 50 100 100 150 150 200 200 250 250 300 300 350 350 400 400 450 450 500 500", "5 222\n58 369 477 58 90", "9 222\n304 142 38 334 73 122 252 381 438", "9 247\n359 350 140 26 293 488 57 481 71", "5 341\n412 32 189 303 172", "200 0\n1 1 1 1 1 1 1 1 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
81d086a4bed9b7676ed89bd1eeb0eb3c | Row | You're given a row with $n$ chairs. We call a seating of people "maximal" if the two following conditions hold:
1. There are no neighbors adjacent to anyone seated. 1. It's impossible to seat one more person without violating the first rule.
The seating is given as a string consisting of zeros and ones ($0$ means t... | {"inputs": ["3\n101", "4\n1011", "5\n10001", "1\n0", "1\n1", "100\n0101001010101001010010010101001010100101001001001010010101010010101001001010101001001001010100101010", "4\n0100", "42\n011000100101001001101011011010100010011010", "3\n001", "64\n1001001010010010100101010010010100100101001001001001010100101001", "3\n111... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 73 | codeforces | |
81ef12c3e4dd0f375966669533bed4fb | Fox And Snake | Fox Ciel starts to learn programming. The first task is drawing a fox! However, that turns out to be too hard for a beginner, so she decides to draw a snake instead.
A snake is a pattern on a *n* by *m* table. Denote *c*-th cell of *r*-th row as (*r*,<=*c*). The tail of the snake is located at (1,<=1), then it's body ... | {"inputs": ["3 3", "3 4", "5 3", "9 9", "3 5", "3 6", "7 3", "7 4", "49 50", "43 50", "43 27", "11 15", "11 3", "19 3", "23 50", "49 49", "33 43", "33 44", "45 45", "45 49", "45 3", "45 4", "5 4", "5 5", "5 6", "7 5", "7 6", "7 7"], "outputs": ["###\n..#\n###", "####\n...#\n####", "###\n..#\n###\n#..\n###", "#########\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 555 | codeforces | |
81f36a32b0401ec92d93c3f0c7e94903 | New Year and Days | Today is Wednesday, the third day of the week. What's more interesting is that tomorrow is the last day of the year 2015.
Limak is a little polar bear. He enjoyed this year a lot. Now, he is so eager to the coming year 2016.
Limak wants to prove how responsible a bear he is. He is going to regularly save candies for ... | {"inputs": ["4 of week", "30 of month", "17 of month", "31 of month", "6 of week", "1 of week", "2 of week", "3 of week", "5 of week", "7 of week", "1 of month", "2 of month", "3 of month", "4 of month", "5 of month", "6 of month", "7 of month", "8 of month", "9 of month", "10 of month", "11 of month", "12 of month", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 179 | codeforces | |
81ffdfad6d7493a8b3a4d2449992fef7 | Gravity Flip | Little Chris is bored during his physics lessons (too easy), so he has built a toy box to keep himself occupied. The box is special, since it has the ability to change gravity.
There are *n* columns of toy cubes in the box arranged in a line. The *i*-th column contains *a**i* cubes. At first, the gravity in the box is... | {"inputs": ["4\n3 2 1 2", "3\n2 3 8", "5\n2 1 2 1 2", "1\n1", "2\n4 3", "6\n100 40 60 20 1 80", "10\n10 8 6 7 5 3 4 2 9 1", "10\n1 2 3 4 5 6 7 8 9 10", "100\n82 51 81 14 37 17 78 92 64 15 8 86 89 8 87 77 66 10 15 12 100 25 92 47 21 78 20 63 13 49 41 36 41 79 16 87 87 69 3 76 80 60 100 49 70 59 72 8 38 71 45 97 71 14 76... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 540 | codeforces | |
820b4ef0d5db2fef6bd88e9befb86b13 | Suffix Structures | Bizon the Champion isn't just a bison. He also is a favorite of the "Bizons" team.
At a competition the "Bizons" got the following problem: "You are given two distinct words (strings of English letters), *s* and *t*. You need to transform word *s* into word *t*". The task looked simple to the guys because they know th... | {"inputs": ["automaton\ntomat", "array\narary", "both\nhot", "need\ntree", "abacaba\naaaa", "z\nzz", "itwtyhhsdjjffmmoqkkhxjouypznewstyorotxhozlytndehmaxogrohccnqcgkrjrdmnuaogiwmnmsbdaizqkxnkqxxiihbwepc\nsnixfywvcntitcefsgqxjcodwtumurcglfmnamnowzbjzmfzspbfuldraiepeeiyasmrsneekydsbvazoqszyjxkjiotushsddet", "y\nu", "nbji... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 65 | codeforces | |
8214a4b1281a44c4db1dc7d3160030f4 | Bits | Let's denote as the number of bits set ('1' bits) in the binary representation of the non-negative integer *x*.
You are given multiple queries consisting of pairs of integers *l* and *r*. For each query, find the *x*, such that *l*<=≤<=*x*<=≤<=*r*, and is maximum possible. If there are multiple such numbers find the... | {"inputs": ["3\n1 2\n2 4\n1 10", "55\n1 1\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n1 9\n1 10\n2 2\n2 3\n2 4\n2 5\n2 6\n2 7\n2 8\n2 9\n2 10\n3 3\n3 4\n3 5\n3 6\n3 7\n3 8\n3 9\n3 10\n4 4\n4 5\n4 6\n4 7\n4 8\n4 9\n4 10\n5 5\n5 6\n5 7\n5 8\n5 9\n5 10\n6 6\n6 7\n6 8\n6 9\n6 10\n7 7\n7 8\n7 9\n7 10\n8 8\n8 9\n8 10\n9 9\n9 10\n10 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 79 | codeforces | |
82158427dab9826528da173c784a2c45 | Greg and Graph | Greg has a weighed directed graph, consisting of *n* vertices. In this graph any pair of distinct vertices has an edge between them in both directions. Greg loves playing with the graph and now he has invented a new game:
- The game consists of *n* steps. - On the *i*-th step Greg removes vertex number *x**i* from t... | {"inputs": ["1\n0\n1", "2\n0 5\n4 0\n1 2", "4\n0 3 1 1\n6 0 400 1\n2 4 0 1\n1 1 1 0\n4 1 2 3", "4\n0 57148 51001 13357\n71125 0 98369 67226\n49388 90852 0 66291\n39573 38165 97007 0\n2 3 1 4", "5\n0 27799 15529 16434 44291\n47134 0 90227 26873 52252\n41605 21269 0 9135 55784\n70744 17563 79061 0 73981\n70529 35681 9107... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 7 | codeforces | |
823926c4d8ea61495c95a7a6f7accf46 | Hack it! | Little X has met the following problem recently.
Let's define *f*(*x*) as the sum of digits in decimal representation of number *x* (for example, *f*(1234)<==<=1<=+<=2<=+<=3<=+<=4). You are to calculate
Of course Little X has solved this problem quickly, has locked it, and then has tried to hack others. He has seen... | {"inputs": ["46", "126444381000032", "69645082595", "70602205995", "33898130785", "58929554039", "81696185182", "1", "2", "3", "4", "5", "6", "7", "8", "10", "11", "12", "43", "36", "65", "43", "23", "100", "10000", "1000000", "100000000", "10000000000", "1000000000000", "100000000000000", "10000000000000000", "1000000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 70 | codeforces | |
823e9c56b117ced7c4c45cebec880ab8 | Party | A company has *n* employees numbered from 1 to *n*. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee *A* is said to be the superior of another employee *B* if at least one of the following is true:
- Employee *A* is the immedi... | {"inputs": ["5\n-1\n1\n2\n1\n-1", "4\n-1\n1\n2\n3", "12\n-1\n1\n2\n3\n-1\n5\n6\n7\n-1\n9\n10\n11", "6\n-1\n-1\n2\n3\n1\n1", "3\n-1\n1\n1", "1\n-1", "2\n2\n-1", "2\n-1\n-1", "3\n2\n-1\n1", "3\n-1\n-1\n-1", "5\n4\n5\n1\n-1\n4", "12\n-1\n1\n1\n1\n1\n1\n3\n4\n3\n3\n4\n7", "12\n-1\n-1\n1\n-1\n1\n1\n5\n11\n8\n6\n6\n4", "12\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 283 | codeforces | |
8247c1d90bd78e0e2751b3f923feafa5 | Magical Boxes | Emuskald is a well-known illusionist. One of his trademark tricks involves a set of magical boxes. The essence of the trick is in packing the boxes inside other boxes.
From the top view each magical box looks like a square with side length equal to 2*k* (*k* is an integer, *k*<=≥<=0) units. A magical box *v* can be pu... | {"inputs": ["2\n0 3\n1 5", "1\n0 4", "2\n1 10\n2 2", "1\n0 1", "1\n1000000000 1000000000", "1\n0 16", "1\n0 17", "2\n0 16\n1 4", "3\n0 20\n1 18\n2 4", "3\n0 64\n1 16\n2 4", "5\n1 1000000\n100 100\n101 9\n102 4\n103 8", "10\n11 69\n7 56\n8 48\n2 56\n12 6\n9 84\n1 81\n4 80\n3 9\n5 18", "15\n0 268435456\n1 67108864\n2 167... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 14 | codeforces | |
826351390a4115b50553d7685070fc0c | Toys | Little Masha loves arranging her toys into piles on the floor. And she also hates it when somebody touches her toys. One day Masha arranged all her *n* toys into several piles and then her elder brother Sasha came and gathered all the piles into one. Having seen it, Masha got very upset and started crying. Sasha still ... | {"inputs": ["3", "1", "2", "4", "5", "6", "7", "8", "9", "10"], "outputs": ["5\n{1,2,3}\n{1,2},{3}\n{1},{2,3}\n{1},{2},{3}\n{1,3},{2}", "1\n{1}", "2\n{1,2}\n{1},{2}", "15\n{1,2,3,4}\n{1,2,3},{4}\n{1,2},{3,4}\n{1,2},{3},{4}\n{1,2,4},{3}\n{1,4},{2,3}\n{1},{2,3},{4}\n{1},{2,3,4}\n{1},{2,4},{3}\n{1},{2},{3,4}\n{1},{2},{3},... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
829eac8587d8cba950594bfaa3bdf50e | Mittens | A Christmas party in city S. had *n* children. All children came in mittens. The mittens can be of different colors, but each child had the left and the right mitten of the same color. Let's say that the colors of the mittens are numbered with integers from 1 to *m*, and the children are numbered from 1 to *n*. Then th... | {"inputs": ["6 3\n1 3 2 2 1 1", "4 2\n1 2 1 1", "1 1\n1", "4 1\n1 1 1 1", "2 2\n2 2", "2 2\n1 2", "4 4\n4 3 2 1", "4 2\n1 2 1 2", "5 3\n1 1 2 1 1", "6 3\n1 1 2 2 3 3", "10 3\n3 1 2 2 2 1 2 2 2 1", "10 3\n3 1 3 1 1 2 2 2 1 3", "10 3\n1 2 1 2 2 1 2 3 2 1", "10 3\n3 2 3 1 2 2 2 1 1 3", "10 3\n3 3 1 3 1 2 2 1 3 2", "100 10... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
82a0355eb15f93fc5a3bc9c298539d50 | Shaass and Bookshelf | Shaass has *n* books. He wants to make a bookshelf for all his books. He wants the bookshelf's dimensions to be as small as possible. The thickness of the *i*-th book is *t**i* and its pages' width is equal to *w**i*. The thickness of each book is either 1 or 2. All books have the same page heights.
Shaass puts the bo... | {"inputs": ["5\n1 12\n1 3\n2 15\n2 5\n2 1", "3\n1 10\n2 1\n2 4", "10\n2 10\n2 4\n2 8\n2 3\n2 5\n2 6\n1 2\n1 10\n1 10\n2 5", "1\n2 7", "50\n1 24\n1 16\n1 33\n2 34\n1 26\n2 35\n1 39\n2 44\n2 29\n2 28\n1 44\n2 48\n2 50\n2 41\n2 9\n1 22\n2 11\n2 27\n1 12\n1 50\n2 49\n1 17\n2 43\n2 6\n1 39\n2 28\n1 47\n1 45\n2 32\n1 43\n2 4... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
82a7f8952265e9e4692372f6045274b1 | Planning | Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are *n* flights that must depart today, the *i*-th of them is planned to depart at the *i*-th minute of the day.
Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. Thi... | {"inputs": ["5 2\n4 2 1 10 2", "3 2\n3 1 2", "5 5\n5 5 9 100 3", "1 1\n1", "1 1\n10000000", "6 4\n85666 52319 21890 51912 90704 10358", "10 5\n66220 81797 38439 54881 86879 94346 8802 59094 57095 41949", "8 1\n3669 11274 87693 33658 58862 78334 42958 30572", "2 2\n16927 73456", "6 6\n21673 27126 94712 82700 59725 46310... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
82d5d3e126087dd42f8f9e7919edf755 | Line to Cashier | Little Vasya went to the supermarket to get some groceries. He walked about the supermarket for a long time and got a basket full of products. Now he needs to choose the cashier to pay for the products.
There are *n* cashiers at the exit from the supermarket. At the moment the queue for the *i*-th cashier already has ... | {"inputs": ["1\n1\n1", "4\n1 4 3 2\n100\n1 2 2 3\n1 9 1\n7 8", "4\n5 4 5 5\n3 1 3 1 2\n3 1 1 3\n1 1 1 2 2\n2 2 1 1 3", "5\n5 3 6 6 4\n7 5 3 3 9\n6 8 2\n1 10 8 5 9 2\n9 7 8 5 9 10\n9 8 3 3", "5\n10 10 10 10 10\n6 7 8 6 8 5 9 8 10 5\n9 6 9 8 7 8 8 10 8 5\n8 7 7 8 7 5 6 8 9 5\n6 5 10 5 5 10 7 8 5 5\n10 9 8 7 6 9 7 9 6 5",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 356 | codeforces | |
82e4d503992da73823380c942016218f | Three Base Stations | The New Vasjuki village is stretched along the motorway and that's why every house on it is characterized by its shift relative to some fixed point — the *x**i* coordinate. The village consists of *n* houses, the *i*-th house is located in the point with coordinates of *x**i*.
TELE3, a cellular communication provider ... | {"inputs": ["4\n1 2 3 4", "3\n10 20 30", "5\n10003 10004 10001 10002 1", "1\n1", "2\n1 1", "9\n9 8 7 6 5 4 3 2 1", "2\n2 2", "3\n2 1 2", "4\n6 6 8 3", "5\n18 80 86 18 51", "10\n26 21 20 91 22 28 92 62 47 69", "4\n70 20 94 30", "3\n8 8 8", "2\n12 38", "7\n36 15 36 29 11 38 38", "5\n9 6 15 6 10", "1\n8", "2\n8 12", "3\n3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
82ee089a14af73326406db1448d794ff | Football | Petya loves football very much. One day, as he was watching a football match, he was writing the players' current positions on a piece of paper. To simplify the situation he depicted it as a string consisting of zeroes and ones. A zero corresponds to players of one team; a one corresponds to players of another team. If... | {"inputs": ["001001", "1000000001", "00100110111111101", "11110111111111111", "01", "10100101", "1010010100000000010", "101010101", "000000000100000000000110101100000", "100001000000110101100000", "100001000011010110000", "010", "10101011111111111111111111111100", "1001101100", "1001101010", "1111100111", "001101100011... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 880 | codeforces | |
82ffce87fe11c128652285a581fb9b47 | Drinks | Little Vasya loves orange juice very much. That's why any food and drink in his kitchen necessarily contains orange juice. There are *n* drinks in his fridge, the volume fraction of orange juice in the *i*-th drink equals *p**i* percent.
One day Vasya decided to make himself an orange cocktail. He took equal proportio... | {"inputs": ["3\n50 50 100", "4\n0 25 50 75", "3\n0 1 8", "5\n96 89 93 95 70", "7\n62 41 78 4 38 39 75", "13\n2 22 7 0 1 17 3 17 11 2 21 26 22", "21\n5 4 11 7 0 5 45 21 0 14 51 6 0 16 10 19 8 9 7 12 18", "26\n95 70 93 74 94 70 91 70 39 79 80 57 87 75 37 93 48 67 51 90 85 26 23 64 66 84", "29\n84 99 72 96 83 92 95 98 97 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1,064 | codeforces | |
8342d9ba17f6a37a5b5912b897f44355 | Lucky Tickets | Vasya thinks that lucky tickets are the tickets whose numbers are divisible by 3. He gathered quite a large collection of such tickets but one day his younger brother Leonid was having a sulk and decided to destroy the collection. First he tore every ticket exactly in two, but he didn’t think it was enough and Leonid a... | {"inputs": ["3\n123 123 99", "6\n1 1 1 23 10 3", "3\n43440907 58238452 82582355", "4\n31450303 81222872 67526764 17516401", "5\n83280 20492640 21552119 7655071 47966344", "6\n94861402 89285133 30745405 41537407 90189008 83594323", "7\n95136773 99982752 97528336 79027944 96847471 96928960 89423004", "1\n19938466", "2\n5... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 51 | codeforces | |
8349f6da202ade7b78d88bc6bfcd1ba8 | Anton and Fairy Tale | Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale:
"Once upon a time, there lived an emperor. He was very rich and had much grain. One day he ordered to build a huge barn to put there all his grain. Best builders were building that ba... | {"inputs": ["5 2", "8 1", "32 5", "1024 1024", "58044 52909", "996478063 658866858", "570441179141911871 511467058318039545", "1 1", "1000000000000000000 1000000000000000000", "1000000000000000000 999999999999997145", "1 1000000000000000000", "1000000000000000000 1", "999999998765257149 10", "999999998765257150 10", "9... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
836531ed000ab9717afb7fee73310986 | Two Semiknights Meet | A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le... | {"inputs": ["2\n........\n........\n......#.\nK..##..#\n.......#\n...##..#\n......#.\nK.......\n\n........\n........\n..#.....\n..#..#..\n..####..\n...##...\n........\n....K#K#", "3\n........\n........\n..#.....\n..#..#..\n..####..\n...##...\n........\n####K#K#\n\n........\nK......K\n........\n#......#\n.#....#.\n..###... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 13 | codeforces | |
83779125e360c0f88aa14c07c743b788 | The Wall (hard) | So many wall designs to choose from! Even modulo 106<=+<=3, it's an enormous number. Given that recently Heidi acquired an unlimited supply of bricks, her choices are endless! She really needs to do something to narrow them down.
Heidi is quick to come up with criteria for a useful wall:
- In a useful wall, at least... | {"inputs": ["1 1 1", "1 2 2", "1 2 3", "3 2 2", "5 4 9", "40 37 65", "100000000 100 100", "99999999 97 99", "100000000 1 100", "100000000 100 1", "100000000 1 1", "13 66 38", "13 66 57", "13 66 76", "13 66 95", "13 99 38", "13 99 57", "13 99 76", "13 99 95", "85714284 66 76", "85714284 66 95", "85714284 99 76", "857142... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
83864a1e87e1a3b2c1a1a3d603379ad0 | Card Game | There is a card game called "Durak", which means "Fool" in Russian. The game is quite popular in the countries that used to form USSR. The problem does not state all the game's rules explicitly — you can find them later yourselves if you want.
To play durak you need a pack of 36 cards. Each card has a suit ("S", "H", ... | {"inputs": ["H\nQH 9S", "S\n8D 6D", "C\n7H AS", "C\nKC 9C", "D\n7D KD", "H\n7H KD", "D\nAS AH", "H\nKH KS", "C\n9H 6C", "C\n9H JC", "D\nTD JD", "H\n6S 7S", "D\n7S 8S", "S\n8H 9H", "C\n9D TD", "H\nTC JC", "C\nJH QH", "H\nQD KD", "D\nKS AS", "S\nAH 6H", "H\n7D 6D", "S\n8H 7H", "D\n9S 8S", "S\nTC 9C", "H\nJS TS", "S\nQD J... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 119 | codeforces | |
83971be6bedcf3ef74de89eaa3c3fd4f | ZgukistringZ | Professor GukiZ doesn't accept string as they are. He likes to swap some letters in string to obtain a new one.
GukiZ has strings *a*, *b*, and *c*. He wants to obtain string *k* by swapping some letters in *a*, so that *k* should contain as many non-overlapping substrings equal either to *b* or *c* as possible. Subst... | {"inputs": ["aaa\na\nb", "pozdravstaklenidodiri\nniste\ndobri", "abbbaaccca\nab\naca", "lemigazalemiolemilicomzalemljenje\nlemi\nzlo", "xxxbbbcccoca\nca\ncb", "aleksandrehteosidatedodam\nevo\nsi", "cumurcumur\num\ncur", "saljivdzijasamjaneki\nneki\nja", "lebronnojameslebronprogrammers\nje\nbro", "lukavpastaakojelukav\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
839a326aaf591e7fbcb6196222397274 | Party | Arseny likes to organize parties and invite people to it. However, not only friends come to his parties, but friends of his friends, friends of friends of his friends and so on. That's why some of Arseny's guests can be unknown to him. He decided to fix this issue using the following procedure.
At each step he selects... | {"inputs": ["5 6\n1 2\n1 3\n2 3\n2 5\n3 4\n4 5", "4 4\n1 2\n1 3\n1 4\n3 4", "1 0", "2 1\n2 1", "3 2\n1 3\n2 3", "22 31\n5 11\n6 3\n10 1\n18 20\n3 21\n12 10\n15 19\n1 17\n17 18\n2 21\n21 7\n2 15\n3 2\n19 6\n2 19\n13 16\n21 19\n13 5\n19 3\n12 22\n9 20\n14 11\n15 21\n7 8\n2 6\n15 6\n6 21\n15 3\n4 22\n14 8\n16 9", "22 36\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
83a372c034fbb5f2b404ab2b3fb81eb4 | Fox and Box Accumulation | Fox Ciel has *n* boxes in her room. They have the same size and weight, but they might have different strength. The *i*-th box can hold at most *x**i* boxes on its top (we'll call *x**i* the strength of the box).
Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box... | {"inputs": ["3\n0 0 10", "5\n0 1 2 3 4", "4\n0 0 0 0", "9\n0 1 0 2 0 1 1 2 10", "1\n0", "2\n0 0", "2\n0 1", "2\n100 99", "9\n0 1 1 0 2 0 3 45 4", "10\n1 1 1 1 2 2 2 2 2 2", "100\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 131 | codeforces | |
83a8455c279507ddbd012d7953b13774 | Bill Total Value | Vasily exited from a store and now he wants to recheck the total price of all purchases in his bill. The bill is a string in which the names of the purchases and their prices are printed in a row without any spaces. Check has the format "*name*1*price*1*name*2*price*2...*name**n**price**n*", where *name**i* (name of th... | {"inputs": ["chipsy48.32televizor12.390", "a1b2c3.38", "aa0.01t0.03", "test0.50test0.50", "a500b500", "tcjbjlbtjf329.910", "iwpcfsmzen297.618.42ff585.209.84", "dpinb27.277fwxpdbfg709.917vocemjru16.491ade860.722tvb870.469.51wrpgy565.046gddrwv202.271.28", "vayscqiwpc686.919.75bwyudkz759.174kgqq444.563.54feupje806.486.78v... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
83f28d9be0614e982868c126897fb64e | Cycle In Maze | The Robot is in a rectangular maze of size *n*<=×<=*m*. Each cell of the maze is either empty or occupied by an obstacle. The Robot can move between neighboring cells on the side left (the symbol "L"), right (the symbol "R"), up (the symbol "U") or down (the symbol "D"). The Robot can move to the cell only if it is emp... | {"inputs": ["2 3 2\n.**\nX..", "5 6 14\n..***.\n*...X.\n..*...\n..*.**\n....*.", "3 3 4\n***\n*X*\n***", "1 1 1\nX", "1 2 2\nX.", "1 5 4\n.X**.", "1 10 1\n........X.", "1 20 10\n*.*..............*.X", "2 1 1\nX\n.", "2 2 2\nX*\n.*", "2 5 2\n.....\n*.*.X", "2 10 4\n******....\n*.****.*X*", "2 20 26\n.****..*.**.**.*....... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
83f5f45e8eab08931e16ddeb28420b18 | GCD Table | The GCD table *G* of size *n*<=×<=*n* for an array of positive integers *a* of length *n* is defined by formula
Let us remind you that the greatest common divisor (GCD) of two positive integers *x* and *y* is the greatest integer that is divisor of both *x* and *y*, it is denoted as . For example, for array *a*<==<={... | {"inputs": ["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1", "2\n54748096 1 641009859 1", "3\n1 7 923264237 374288891 7 524125987 1 1 1", "4\n1 1 1 1 1 702209411 496813081 673102149 1 1 561219907 1 1 1 1 1", "5\n1 1 1 1 1 9 564718673 585325539 1 1 3 1 9 1 1 365329221 3 291882089 3 1 412106895 1 1 1 3", "5\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 52 | codeforces | |
83f7d2cee6458359e3b27ec171ad250c | GukiZ and Contest | Professor GukiZ likes programming contests. He especially likes to rate his students on the contests he prepares. Now, he has decided to prepare a new contest.
In total, *n* students will attend, and before the start, every one of them has some positive integer rating. Students are indexed from 1 to *n*. Let's denote... | {"inputs": ["3\n1 3 3", "1\n1", "5\n3 5 3 4 5", "7\n1 3 5 4 2 2 1", "11\n5 6 4 2 9 7 6 6 6 6 7", "1\n2000", "2\n2000 2000", "3\n500 501 502", "10\n105 106 1 1 1 11 1000 999 1000 999", "6\n1 2 3 4 5 6", "7\n6 5 4 3 2 1 1", "8\n153 100 87 14 10 8 6 5", "70\n11 54 37 62 1 46 13 17 38 47 28 15 63 5 61 34 49 66 32 59 3 41 5... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 667 | codeforces | |
83fe6169fa7fac345ddf7b7d2caff627 | Load Balancing | In the school computer room there are *n* servers which are responsible for processing several computing tasks. You know the number of scheduled tasks for each server: there are *m**i* tasks assigned to the *i*-th server.
In order to balance the load for each server, you want to reassign some tasks to make the differe... | {"inputs": ["2\n1 6", "7\n10 11 10 11 10 11 11", "5\n1 2 3 4 5", "10\n0 0 0 0 0 0 0 0 0 0", "1\n0", "1\n20000", "3\n1 10000 20000", "10\n19999 19999 20000 20000 19999 20000 20000 20000 19999 19999", "10\n8 5 5 5 6 6 6 6 5 5", "2\n10 3", "5\n6 5 9 7 6", "5\n2 10 20 30 50", "7\n2 2 2 2 2 3 4"], "outputs": ["2", "0", "3",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 64 | codeforces | |
843b8ddbf88ea9a774a44e936780d7b5 | Arrays | You are given two arrays *A* and *B* consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose *k* numbers in array *A* and choose *m* numbers in array *B* so that any number chosen in the first array is strictly less than any number chosen in the second array.
The first line contai... | {"inputs": ["3 3\n2 1\n1 2 3\n3 4 5", "3 3\n3 3\n1 2 3\n3 4 5", "5 2\n3 1\n1 1 1 1 1\n2 2", "3 5\n1 1\n5 5 5\n5 5 5 5 5", "1 1\n1 1\n1\n1", "3 3\n1 1\n1 2 3\n1 2 3", "3 3\n1 2\n1 2 3\n1 2 3", "3 3\n2 2\n1 2 3\n1 2 3", "10 15\n10 1\n1 1 5 17 22 29 32 36 39 48\n9 10 20 23 26 26 32 32 33 39 43 45 47 49 49", "10 15\n1 15\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 381 | codeforces | |
84638ad2b8ecfc61e5c49b99e7a47d5b | Cinema | Overall there are *m* actors in Berland. Each actor has a personal identifier — an integer from 1 to *m* (distinct actors have distinct identifiers). Vasya likes to watch Berland movies with Berland actors, and he has *k* favorite actors. He watched the movie trailers for the next month and wrote the following informat... | {"inputs": ["5 3\n1 2 3\n6\nfirstfilm\n3\n0 0 0\nsecondfilm\n4\n0 0 4 5\nthirdfilm\n1\n2\nfourthfilm\n1\n5\nfifthfilm\n1\n4\nsixthfilm\n2\n1 0", "5 3\n1 3 5\n4\njumanji\n3\n0 0 0\ntheeagle\n5\n1 2 3 4 0\nmatrix\n3\n2 4 0\nsourcecode\n2\n2 4", "10 1\n1\n4\na\n1\n3\nb\n1\n4\nc\n1\n5\nd\n1\n2", "2 1\n1\n2\na\n1\n2\nb\n1\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
8469dddf318b05524edbda28b5a9bcfa | Sereja ans Anagrams | Sereja has two sequences *a* and *b* and number *p*. Sequence *a* consists of *n* integers *a*1,<=*a*2,<=...,<=*a**n*. Similarly, sequence *b* consists of *m* integers *b*1,<=*b*2,<=...,<=*b**m*. As usual, Sereja studies the sequences he has. Today he wants to find the number of positions *q* (*q*<=+<=(*m*<=-<=1)·*p*<=... | {"inputs": ["5 3 1\n1 2 3 2 1\n1 2 3", "6 3 2\n1 3 2 2 3 1\n1 2 3", "68 16 3\n5 3 4 3 3 3 2 2 2 3 2 4 2 2 2 2 4 3 5 1 1 2 2 2 3 1 5 1 2 2 1 5 1 5 3 2 3 5 2 1 1 4 2 3 4 3 4 3 3 1 3 4 1 5 2 5 3 4 4 1 4 5 5 1 1 2 2 2\n5 4 4 3 5 1 1 2 3 2 2 1 3 3 2 2", "44 11 4\n4 3 3 3 4 3 4 5 1 3 4 2 4 4 2 2 1 5 3 1 5 2 3 2 4 4 5 3 2 2 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
8480e73bfbab69837dd4c9ed947c982c | Minimum number of steps | We have a string of letters 'a' and 'b'. We want to perform some operations on it. On each step we choose one of substrings "ab" in the string and replace it with the string "bba". If we have no "ab" as a substring, our job is done. Print the minimum number of steps we should perform to make our job done modulo 109<=+<... | {"inputs": ["ab", "aab", "aaaaabaabababaaaaaba", "abaabaaabbabaabab", "abbaa", "abbaaabaabaaaaabbbbaababaaaaabaabbaaaaabbaabbaaaabbbabbbabb", "aababbaaaabbaabbbbbbbbabbababbbaaabbaaabbabbba", "aabbaababbabbbaabbaababaaaabbaaaabaaaaaababbaaaabaababbabbbb", "aaabaaaabbababbaabbababbbbaaaaaaabbabbba", "abbbbababbabbbbbaba... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 132 | codeforces | |
84a1ec15b35327250779bfbc7b9c9430 | Non-square Equation | Let's consider equation:
where *x*,<=*n* are positive integers, *s*(*x*) is the function, equal to the sum of digits of number *x* in the decimal number system.
You are given an integer *n*, find the smallest positive integer root of equation *x*, or else determine that there are no such roots.
A single line contains... | {"inputs": ["2", "110", "4", "8", "10000000100000000", "10000006999999929", "172541340", "172580744", "10000100000", "1000001000000", "100000010000000", "425", "1085", "4296409065", "9211004165221796", "1245131330556680", "40000000400000000", "90000000900000000", "160000001600000000", "250000002500000000", "36000000360... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 21 | codeforces | |
84a5a2ed7fa8dc2da713daa96a556173 | Inna, Dima and Song | Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much.
A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the *i*-th note at ... | {"inputs": ["3\n1 1 2\n2 2 3", "1\n2\n5", "10\n2 2 3 4 5 6 7 8 9 10\n2 2 3 4 5 6 7 8 9 10", "10\n1 2 3 4 5 6 7 8 9 10\n1 2 3 4 5 6 7 8 9 10", "3\n10000 10000 10000\n5000 5000 1", "2\n1 1\n2 1"], "outputs": ["4", "-1", "96", "94", "12499999", "0"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 13 | codeforces | |
84f6356702ad0c9612055335da1b33e8 | Almost Difference | Let's denote a function
You are given an array *a* consisting of *n* integers. You have to calculate the sum of *d*(*a**i*,<=*a**j*) over all pairs (*i*,<=*j*) such that 1<=≤<=*i*<=≤<=*j*<=≤<=*n*.
The first line contains one integer *n* (1<=≤<=*n*<=≤<=200000) — the number of elements in *a*.
The second line contai... | {"inputs": ["5\n1 2 3 1 3", "4\n6 6 5 5", "4\n6 6 4 4", "1\n1", "1\n1000000000", "2\n1 1000000000", "5\n1 999999996 999999998 999999994 1000000000", "100\n7 4 5 5 10 10 5 8 5 7 4 5 4 6 8 8 2 6 3 3 10 7 10 8 6 2 7 3 9 7 7 2 4 5 2 4 9 5 10 1 10 5 10 4 1 3 4 2 6 9 9 9 10 6 2 5 6 1 8 10 4 10 3 4 10 5 5 4 10 4 5 3 7 10 2 7 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 116 | codeforces | |
8502ae13f38ef5bda917a038126041ce | Xor-sequences | You are given *n* integers *a*1,<=<=*a*2,<=<=...,<=<=*a**n*.
A sequence of integers *x*1,<=<=*x*2,<=<=...,<=<=*x**k* is called a "xor-sequence" if for every 1<=<=≤<=<=*i*<=<=≤<=<=*k*<=-<=1 the number of ones in the binary representation of the number *x**i* *x**i*<=<=+<=<=1's is a multiple of 3 and for all 1<=≤<=*i*... | {"inputs": ["5 2\n15 1 2 4 8", "5 1\n15 1 2 4 8", "10 1\n44 65 23 44 100 19 19 23 19 40", "10 2\n93 93 85 48 44 98 93 100 98 98", "10 100\n22 0 41 63 22 41 17 22 15 42", "10 1000000000\n454240622 216977025 454240622 509843007 509843007 26552516 488949284 708817573 453191950 447767457", "100 576460752303423487\n0 0 0 0 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
851cdc37572844db5ff8db560c7a80ca | Contest | Misha and Vasya participated in a Codeforces contest. Unfortunately, each of them solved only one problem, though successfully submitted it at the first attempt. Misha solved the problem that costs *a* points and Vasya solved the problem that costs *b* points. Besides, Misha submitted the problem *c* minutes after the ... | {"inputs": ["500 1000 20 30", "1000 1000 1 1", "1500 1000 176 177", "1500 1000 74 177", "750 2500 175 178", "750 1000 54 103", "2000 1250 176 130", "1250 1750 145 179", "2000 2000 176 179", "1500 1500 148 148", "2750 1750 134 147", "3250 250 175 173", "500 500 170 176", "250 1000 179 178", "3250 1000 160 138", "3000 20... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 553 | codeforces | |
852f4210021e60c31e87d025668e7b9b | Vitaliy and Pie | After a hard day Vitaly got very hungry and he wants to eat his favorite potato pie. But it's not that simple. Vitaly is in the first room of the house with *n* room located in a line and numbered starting from one from left to right. You can go from the first room to the second room, from the second room to the third ... | {"inputs": ["3\naAbB", "4\naBaCaB", "5\nxYyXzZaZ", "26\naAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyY", "26\nzAyBxCwDvEuFtGsHrIqJpKoLnMmNlOkPjQiRhSgTfUeVdWcXbY", "5\naArRaRaR", "2\ndA", "2\ncB", "10\nhNcMeXsSlHsUwYeMcA", "100\nqDpInBmCrFwXpDbFgOzVvOcEmJrUcToAdEwEgTvBvBfWwRpGyEaXgDdRwVlQnYgWmWhMrHaIzPyXvGaFlRsVzHhZ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 246 | codeforces | |
853497d6bbbf49820ca1f6a476d78703 | Mr. Kitayuta's Technology | Shuseki Kingdom is the world's leading nation for innovation and technology. There are *n* cities in the kingdom, numbered from 1 to *n*.
Thanks to Mr. Kitayuta's research, it has finally become possible to construct teleportation pipes between two cities. A teleportation pipe will connect two cities unidirectionally,... | {"inputs": ["4 5\n1 2\n1 3\n1 4\n2 3\n2 4", "4 6\n1 2\n1 4\n2 3\n2 4\n3 2\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "3 6\n1 2\n1 3\n2 1\n2 3\n3 1\n3 2", "8 12\n6 1\n7 5\n2 5\n4 1\n6 3\n4 3\n5 7\n1 3\n5 2\n2 7\n4 6\n7 2", "2 1\n1 2", "10 4\n8 4\n9 8\n2 8\n8 1", "8 7\n6 3\n2 4\n3 7\n8 2\n4 8\n7 6\n3 2", "10 10\n10 6\n9... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
853733567b5c4563940cc2a07c2be496 | Holidays | On the planet Mars a year lasts exactly *n* days (there are no leap years on Mars). But Martians have the same weeks as earthlings — 5 work days and then 2 days off. Your task is to determine the minimum possible and the maximum possible number of days off per year on Mars.
The first line of the input contains a positi... | {"inputs": ["14", "2", "1", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "1000000", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "100", "99", "98", "97", "96", "95", "94", "93", "92", "91", "90", "89", "88", "87", "86", "85", "84", "83", "82", "81", "80", "1000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 131 | codeforces | |
855032e57951f02044cbcf81b424f300 | Seating of Students | Students went into a class to write a test and sat in some way. The teacher thought: "Probably they sat in this order to copy works of each other. I need to rearrange them in such a way that students that were neighbors are not neighbors in a new seating."
The class can be represented as a matrix with *n* rows and *m*... | {"inputs": ["2 4", "2 1", "1 1", "1 2", "1 3", "2 2", "2 3", "3 1", "3 2", "3 3", "1 4", "4 1", "4 2", "1 100000", "100000 1", "316 316", "315 316", "316 315", "315 315", "100 1000", "1000 100", "10 10000", "10000 10", "100 1", "1 100", "100 2", "2 100", "100 3", "3 100", "100 4", "4 100", "101 1", "1 101", "101 2", "2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
85596ef8043e36b06fa4d003d852efc2 | Sets | Little Vasya likes very much to play with sets consisting of positive integers. To make the game more interesting, Vasya chose *n* non-empty sets in such a way, that no two of them have common elements.
One day he wanted to show his friends just how interesting playing with numbers is. For that he wrote out all possib... | {"inputs": ["4\n3 2 7 4\n3 1 7 3\n3 5 4 2\n3 1 3 5\n4 3 1 2 4\n2 5 7", "4\n5 6 7 8 9 100\n4 7 8 9 1\n4 7 8 9 2\n3 1 6 100\n3 2 6 100\n2 1 2", "3\n2 1 2\n2 1 3\n2 2 3", "3\n2 1 2\n10 1 90 80 70 60 50 40 30 20 10\n10 2 10 20 30 40 50 60 70 80 90", "4\n4 56 44 53 43\n3 109 44 43\n3 109 56 53\n3 43 62 44\n3 62 56 53\n2 109... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
855ca95248a5bfd9520047e02b8110e6 | Scarborough Fair | Parsley, sage, rosemary and thyme.
Remember me to one who lives there.
He once was the true love of mine.
Willem is taking the girl to the highest building in island No.28, however, neither of them knows how to get there.
Willem asks his friend, Grick for directions, Grick helped them, and gave them a task.
Althou... | {"inputs": ["3 1\nioi\n1 1 i n", "5 3\nwxhak\n3 3 h x\n1 5 x a\n1 3 w g", "9 51\nbhfbdcgff\n2 3 b b\n2 8 e f\n3 8 g f\n5 7 d a\n1 5 e b\n3 4 g b\n6 7 c d\n3 6 e g\n3 6 e h\n5 6 a e\n7 9 a c\n4 9 a h\n3 7 c b\n6 9 b g\n1 7 h b\n4 5 a e\n3 9 f a\n1 2 c h\n4 8 a c\n3 5 e d\n3 4 g f\n2 3 d h\n2 3 d e\n1 7 d g\n2 6 e g\n2 3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 476 | codeforces |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.