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 |
|---|---|---|---|---|---|---|---|---|---|
241db9c5a973ea82a73166583a928c0d | Mahmoud and Ehab and another array construction task | Mahmoud has an array *a* consisting of *n* integers. He asked Ehab to find another array *b* of the same length such that:
- *b* is lexicographically greater than or equal to *a*. - *b**i*<=≥<=2. - *b* is pairwise coprime: for every 1<=≤<=*i*<=<<=*j*<=≤<=*n*, *b**i* and *b**j* are coprime, i. e. *GCD*(*b**i*,<=*... | {"inputs": ["5\n2 3 5 4 13", "3\n10 3 7", "5\n7 10 2 5 5", "7\n20 9 7 6 7 9 15", "10\n5 3 2 2 3 3 3 4 2 5", "3\n3 18 2"], "outputs": ["2 3 5 7 11 ", "10 3 7 ", "7 10 3 11 13 ", "20 9 7 11 13 17 19 ", "5 3 2 7 11 13 17 19 23 29 ", "3 19 2 "]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
2429f322b7cc404abce8166b8b9136a5 | Caisa and Sugar | Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town.
Unfortunately, he has just *s* dollars for sugar. But that's not a reason to be sad, because there are *n* types of sugar in the supermarket, maybe he able to buy one. B... | {"inputs": ["5 10\n3 90\n12 0\n9 70\n5 50\n7 0", "5 5\n10 10\n20 20\n30 30\n40 40\n50 50", "1 2\n1 0", "2 10\n20 99\n30 99", "15 21\n16 51\n33 44\n32 92\n19 91\n67 81\n94 94\n40 67\n77 38\n42 22\n48 19\n9 35\n90 36\n57 80\n58 97\n13 15", "1 2\n5 0", "37 10\n57 61\n78 79\n59 60\n48 17\n39 22\n11 87\n19 55\n56 78\n25 12\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 36 | codeforces | |
242feae3e5b6572f61ecbafac4a4cf6f | Berland Local Positioning System | In Berland a bus travels along the main street of the capital. The street begins from the main square and looks like a very long segment. There are *n* bus stops located along the street, the *i*-th of them is located at the distance *a**i* from the central square, all distances are distinct, the stops are numbered in ... | {"inputs": ["6\n2 3 5 7 11 13\n5\n3 4 5 5 6", "6\n2 3 5 7 11 13\n9\n1 2 2 3 3 4 5 5 6", "3\n10 200 300\n4\n1 2 2 3", "3\n1 2 3\n4\n1 2 2 3", "2\n1 1000000000\n1\n1", "2\n1 1000000000\n1\n2", "2\n1 1000000000\n2\n1 2", "2\n1 1000000000\n3\n1 1 2", "2\n1 1000000000\n3\n1 2 2", "2\n1 1000000000\n4\n1 1 2 2", "3\n1 3 11\n2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
245edba82711e93fa3c7b2d0769daac0 | none |
Nephren is playing a game with little leprechauns.
She gives them an infinite array of strings, *f*0... ∞.
*f*0 is "What are you doing at the end of the world? Are you busy? Will you save us?".
She wants to let more people know about it, so she defines *f**i*<==<= "What are you doing while sending "*f**i*<=-<=1"? ... | {"inputs": ["3\n1 1\n1 2\n1 111111111111", "5\n0 69\n1 194\n1 139\n0 47\n1 66", "10\n4 1825\n3 75\n3 530\n4 1829\n4 1651\n3 187\n4 584\n4 255\n4 774\n2 474", "1\n0 1", "1\n999 1000000000000000000", "10\n1 8\n1 8\n9 5\n0 1\n8 1\n7 3\n5 2\n0 9\n4 6\n9 4", "10\n5 235941360876088213\n10 65160787148797531\n0 531970131175601... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 11 | codeforces | |
24727c565c8de8d98b5f7525b92f4188 | Plumber | Little John aspires to become a plumber! Today he has drawn a grid consisting of *n* rows and *m* columns, consisting of *n*<=×<=*m* square cells.
In each cell he will draw a pipe segment. He can only draw four types of segments numbered from 1 to 4, illustrated as follows:
Each pipe segment has two ends, illustrated... | {"inputs": ["2 2\n13\n..", "3 1\n1\n4\n.", "2 2\n3.\n.1", "2 2\n..\n..", "2 2\n32\n41", "4 4\n....\n.3.3\n....\n.3.3", "1 3\n12.", "1 1\n4", "2 2\n..\n1.", "1 1\n."], "outputs": ["2", "0", "1", "16", "1", "16", "0", "1", "4", "4"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
249f6787700af82291a3ea226be0f68f | Soft Drinking | This winter is so cold in Nvodsk! A group of *n* friends decided to buy *k* bottles of a soft drink called "Take-It-Light" to warm up a bit. Each bottle has *l* milliliters of the drink. Also they bought *c* limes and cut each of them into *d* slices. After that they found *p* grams of salt.
To make a toast, each frie... | {"inputs": ["3 4 5 10 8 100 3 1", "5 100 10 1 19 90 4 3", "10 1000 1000 25 23 1 50 1", "1 7 4 5 5 8 3 2", "2 3 3 5 5 10 1 3", "2 6 4 5 6 5 1 3", "1 7 3 5 3 6 2 1", "2 4 5 4 5 7 3 2", "2 3 6 5 7 8 2 1", "1 4 5 5 3 10 3 1", "1 4 6 7 3 5 1 3", "1 6 5 5 5 8 3 1", "1 7 5 3 3 9 2 1", "3 5 3 7 6 10 3 1", "3 6 3 5 3 6 3 1", "1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 713 | codeforces | |
24a5265e9508929ff7aba46a658ca400 | Interview | Blake is a CEO of a large company called "Blake Technologies". He loves his company very much and he thinks that his company should be the best. That is why every candidate needs to pass through the interview that consists of the following problem.
We define function *f*(*x*,<=*l*,<=*r*) as a bitwise OR of integers *x... | {"inputs": ["5\n1 2 4 3 2\n2 3 3 12 1", "10\n13 2 7 11 8 4 9 8 5 1\n5 7 18 9 2 3 0 11 8 6", "25\n12 30 38 109 81 124 80 33 38 48 29 78 96 48 96 27 80 77 102 65 80 113 31 118 35\n25 64 95 13 12 6 111 80 85 16 61 119 23 65 73 65 20 95 124 18 28 79 125 106 116", "20\n64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 6... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 187 | codeforces | |
24c217d715fb4fddc13a3e2389631c73 | Tree Queries | You are given a tree consisting of *n* vertices (numbered from 1 to *n*). Initially all vertices are white. You have to process *q* queries of two different types:
1. 1 *x* — change the color of vertex *x* to black. It is guaranteed that the first query will be of this type. 1. 2 *x* — for the vertex *x*, find the m... | {"inputs": ["4 6\n1 2\n2 3\n3 4\n1 2\n1 2\n2 2\n1 3\n2 2\n2 2", "10 10\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 8\n8 9\n9 10\n1 3\n2 10\n1 8\n1 7\n1 6\n1 4\n2 9\n2 7\n1 5\n1 5", "10 10\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 8\n8 9\n9 10\n1 10\n1 4\n1 1\n2 7\n2 4\n1 2\n2 6\n2 4\n2 3\n1 3", "10 10\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 8\n8... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
24d955e00035d7cf0cc67a95de0b508b | Vasya and the Bus | One day Vasya heard a story: "In the city of High Bertown a bus number 62 left from the bus station. It had *n* grown-ups and *m* kids..."
The latter events happen to be of no importance to us. Vasya is an accountant and he loves counting money. So he wondered what maximum and minimum sum of money these passengers cou... | {"inputs": ["1 2", "0 5", "2 2", "2 7", "4 10", "6 0", "7 1", "0 0", "71 24", "16 70", "0 1", "1 0", "1 1", "63 82", "8 26", "21 27", "0 38", "46 84", "59 96", "63028 0", "9458 0", "80236 0", "26666 0", "59617 0", "0 6048", "63028 28217", "9458 39163", "80236 14868", "26666 52747", "59617 28452", "6048 4158", "76826 42... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 41 | codeforces | |
24d9f8e55c368c2af7b5d03bbea4d3f5 | none | Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store recently and Artem immediately bought it.
That element can store information about the matrix of integers size *n*<=×<=*m*. T... | {"inputs": ["2 2 6\n2 1\n2 2\n3 1 1 1\n3 2 2 2\n3 1 2 8\n3 2 1 8", "3 3 2\n1 2\n3 2 2 5", "5 5 1\n1 5", "1 1 3\n1 1\n2 1\n3 1 1 1000000000", "1 1 3\n1 1\n2 1\n3 1 1 -1000000000", "2 2 6\n2 1\n2 2\n3 1 1 -1\n3 2 2 -1\n3 1 2 -1\n3 2 1 -1", "1 4 5\n1 1\n3 1 1 1\n3 1 2 2\n3 1 3 3\n3 1 4 4", "4 2 5\n2 1\n3 1 1 5\n3 2 1 6\n3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 25 | codeforces | |
24dbe8f3cdc00759382e9f0f0b4eccc4 | Choose Place | A classroom in a school has six rows with 3 desks in each row. Two people can use the same desk: one sitting on the left and one sitting on the right.
Some places are already occupied, and some places are vacant. Petya has just entered the class and wants to occupy the most convenient place. The conveniences of the p... | {"inputs": ["..-**-..\n..-**-..\n..-..-..\n..-..-..\n..-..-..\n..-..-..", "**-**-**\n**-**-**\n..-**-.*\n**-**-**\n..-..-..\n..-**-..", "**-**-*.\n*.-*.-**\n**-**-**\n**-**-**\n..-..-..\n..-**-..", "..-..-..\n..-..-..\n..-..-..\n..-..-..\n..-..-..\n..-..-..", "**-**-**\n**-**-**\n..-**-..\n..-**-..\n..-..-..\n..-..-.."... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 38 | codeforces | |
24e150d8c5f260671cf9203c5ee1e940 | Equivalent Strings | Today on a lecture about strings Gerald learned a new definition of string equivalency. Two strings *a* and *b* of equal length are called equivalent in one of the two cases:
1. They are equal. 1. If we split string *a* into two halves of the same size *a*1 and *a*2, and string *b* into two halves of the same size ... | {"inputs": ["aaba\nabaa", "aabb\nabab", "a\na", "a\nb", "ab\nab", "ab\nba", "ab\nbb", "zzaa\naazz", "azza\nzaaz", "abc\nabc", "abc\nacb", "azzz\nzzaz", "abcd\ndcab", "abcd\ncdab", "abcd\ndcba", "abcd\nacbd", "oloaxgddgujq\noloaxgujqddg", "uwzwdxfmosmqatyv\ndxfmzwwusomqvyta", "hagnzomowtledfdotnll\nledfdotnllomowthagnz"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 236 | codeforces | |
24f19bdb6be07ff0093e1444727f095f | New Year and Buggy Bot | Bob programmed a robot to navigate through a 2d maze.
The maze has some obstacles. Empty cells are denoted by the character '.', where obstacles are denoted by '#'.
There is a single robot in the maze. Its start position is denoted with the character 'S'. This position has no obstacle in it. There is also a single ex... | {"inputs": ["5 6\n.....#\nS....#\n.#....\n.#....\n...E..\n333300012", "6 6\n......\n......\n..SE..\n......\n......\n......\n01232123212302123021", "5 3\n...\n.S.\n###\n.E.\n...\n3", "10 10\n.#......#.\n#.........\n#.........\n....#.#..E\n.......#..\n....##....\n....S.....\n....#.....\n.........#\n...##...#.\n2332333231... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 73 | codeforces | |
24f4d21c263435dc34ebb0ec7f3d03a5 | Vladik and Courtesy | At regular competition Vladik and Valera won *a* and *b* candies respectively. Vladik offered 1 his candy to Valera. After that Valera gave Vladik 2 his candies, so that no one thought that he was less generous. Vladik for same reason gave 3 candies to Valera in next turn.
More formally, the guys take turns giving eac... | {"inputs": ["1 1", "7 6", "25 38", "8311 2468", "250708 857756", "957985574 24997558", "999963734 999994456", "1000000000 1000000000", "946 879", "10819 45238", "101357 236928", "1033090 7376359", "9754309 9525494", "90706344 99960537", "965161805 908862070", "9 11", "3 2", "6 6", "4 4", "5 5", "5 4", "12345680 1", "9 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 283 | codeforces | |
2517406285090844d7d7115b9128e8f9 | Petya and Inequiations | Little Petya loves inequations. Help him find *n* positive integers *a*1,<=*a*2,<=...,<=*a**n*, such that the following two conditions are satisfied:
- *a*12<=+<=*a*22<=+<=...<=+<=*a**n*2<=≥<=*x*- *a*1<=+<=*a*2<=+<=...<=+<=*a**n*<=≤<=*y*
The first line contains three space-separated integers *n*, *x* and *y* (1<=≤<=*... | {"inputs": ["5 15 15", "2 3 2", "1 99 11", "100000 810000099998 1000000", "3 254 18", "4 324 77", "5 315 90", "6 225 59", "7 351 29", "100 913723780421 955988", "200 894176381082 945808", "300 923251939897 961159", "1000 824905348050 909242", "10000 795416053320 901860", "31000 819461299082 936240", "44000 772772899626... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 26 | codeforces | |
2526cb35c0d93ebb38fe1749da75e883 | Number of Triplets | You are given *n* points on a plane. All points are different.
Find the number of different groups of three points (*A*,<=*B*,<=*C*) such that point *B* is the middle of segment *AC*.
The groups of three points are considered unordered, that is, if point *B* is the middle of segment *AC*, then groups (*A*,<=*B*,<=*C... | {"inputs": ["3\n1 1\n2 2\n3 3", "3\n0 0\n-1 0\n0 1", "4\n0 0\n1 0\n2 0\n3 0", "5\n0 -1\n0 -2\n0 -3\n0 -4\n0 -5", "7\n1 1\n-1 -1\n1 0\n0 1\n-1 0\n0 -1\n0 0", "9\n1 1\n1 0\n0 1\n0 0\n-1 0\n-1 1\n-1 -1\n1 -1\n0 -1", "10\n2 1\n-1 0\n-2 -1\n-1 1\n0 2\n2 -2\n0 0\n-2 -2\n0 -2\n-2 1", "10\n-2 1\n2 -2\n-1 -2\n0 0\n2 -1\n0 -2\n2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 23 | codeforces | |
2552869b7f8bc189f2c0c77a04453143 | INTERCALC | DO YOU EXPECT ME TO FIND THIS OUT?
WHAT BASE AND/XOR LANGUAGE INCLUDES string?
DON'T BYTE OF MORE THAN YOU CAN CHEW
YOU CAN ONLY DISTORT THE LARGEST OF MATHEMATICS SO FAR
SAYING "ABRACADABRA" WITHOUT A MAGIC AND WON'T DO YOU ANY GOOD
THE LAST STACK RUPTURES. ALL DIE. OH, THE EMBARRASSMENT!
I HAVE NO ARRAY AND I M... | {"inputs": ["4\n2 5 3 1", "2\n1 5", "1\n8", "6\n1 1 1 3 2 9", "5\n8 9 3 1 9", "6\n1 5 2 1 7 11", "8\n1 6 11 8 5 10 7 8", "3\n4 9 6", "2\n4 8", "3\n1 1 5", "5\n4 5 5 2 11", "6\n1 7 2 8 8 2", "5\n3 9 3 2 3", "7\n6 6 1 1 1 2 3", "7\n11 1 2 8 10 5 9", "7\n4 5 1 10 10 4 1", "10\n5 5 10 10 10 2 4 3 4 10", "8\n4 7 11 3 11 3 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 16 | codeforces | |
2556101bcb9b00b841fbeb612b2d3950 | Cinema | Moscow is hosting a major international conference, which is attended by *n* scientists from different countries. Each of the scientists knows exactly one language. For convenience, we enumerate all languages of the world with integers from 1 to 109.
In the evening after the conference, all *n* scientists decided to g... | {"inputs": ["3\n2 3 2\n2\n3 2\n2 3", "6\n6 3 1 1 3 7\n5\n1 2 3 4 5\n2 3 4 5 1", "1\n10\n1\n10\n3", "2\n1 6\n1\n6\n1", "1\n5\n2\n2 2\n5 5", "2\n4 4\n2\n4 7\n7 5", "10\n3 1 8 8 1 1 5 1 3 5\n2\n1 4\n3 1", "10\n7 6 1 2 7 3 9 7 7 9\n10\n2 9 6 5 9 3 10 3 1 6\n4 6 7 9 7 4 1 9 2 5", "20\n2 2 1 6 6 5 10 2 5 5 4 8 6 8 8 10 2 1 5... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 19 | codeforces | |
256f1073ba43640c9ceff83143a93081 | Sonya and Hotels | Sonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.
The country where Sonya lives is an endless line. There is a city in each integer coordinate on this line. She has $n$ hotels, where the $i$-th hotel is located in the city with coordin... | {"inputs": ["4 3\n-3 2 9 16", "5 2\n4 8 11 18 19", "10 10\n-67 -59 -49 -38 -8 20 41 59 74 83", "10 10\n0 20 48 58 81 95 111 137 147 159", "100 1\n0 1 2 3 4 5 7 8 10 11 12 13 14 15 16 17 19 21 22 23 24 25 26 27 28 30 32 33 36 39 40 41 42 46 48 53 54 55 59 60 61 63 65 68 70 71 74 75 76 79 80 81 82 84 88 89 90 91 93 94 96... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 383 | codeforces | |
257624b63116c5dfb1ba7d3521e72bed | Checkout Assistant | Bob came to a cash & carry store, put *n* items into his trolley, and went to the checkout counter to pay. Each item is described by its price *c**i* and time *t**i* in seconds that a checkout assistant spends on this item. While the checkout assistant is occupied with some item, Bob can steal some other items from... | {"inputs": ["4\n2 10\n0 20\n1 5\n1 3", "3\n0 1\n0 10\n0 100", "2\n0 635254032\n0 75159864", "2\n0 861438648\n1 469893784", "2\n2 87623264\n0 864627704", "5\n0 51690939\n0 62436494\n0 39009053\n0 70426298\n0 631569476", "5\n0 968804136\n0 736567537\n2 343136264\n0 259899572\n1 425744418", "5\n4 33400980\n2 410698581\n4 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
2596f17ff730075940d9426f2b8b66e2 | Rectangular Game | The Smart Beaver from ABBYY decided to have a day off. But doing nothing the whole day turned out to be too boring, and he decided to play a game with pebbles. Initially, the Beaver has *n* pebbles. He arranges them in *a* equal rows, each row has *b* pebbles (*a*<=><=1). Note that the Beaver must use all the pebble... | {"inputs": ["10", "8", "4", "36", "32", "46", "6", "13", "9", "18", "20", "37", "42", "50", "48", "33", "49", "34", "35", "37", "39", "42", "14", "2", "3", "5"], "outputs": ["16", "15", "7", "67", "63", "70", "10", "14", "13", "31", "36", "38", "71", "81", "94", "45", "57", "52", "43", "38", "53", "71", "22", "3", "4",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 137 | codeforces | |
2603a61557410075552cd451e048e3de | New Problem | Coming up with a new problem isn't as easy as many people think. Sometimes it is hard enough to name it. We'll consider a title original if it doesn't occur as a substring in any titles of recent Codeforces problems.
You've got the titles of *n* last problems — the strings, consisting of lowercase English letters. Yo... | {"inputs": ["5\nthreehorses\ngoodsubstrings\nsecret\nprimematrix\nbeautifulyear", "4\naa\nbdefghijklmn\nopqrstuvwxyz\nc", "1\na", "1\nb", "1\nz", "5\nsplt\nohqykk\nxqpz\nknojbur\npmfm", "2\nrxscdzkkezud\nwjehahqgouqvjienq", "2\nxlaxwpjabtpwddc\ntxwdjmohrrszorrnomc", "1\nepkotfpkkrhhmuipmtdk", "2\nhk\nobsp", "3\nrjnflsb... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 36 | codeforces | |
26074f95ee047bcf97707736dcd359a6 | Star sky | The Cartesian coordinate system is set in the sky. There you can see *n* stars, the *i*-th has coordinates (*x**i*, *y**i*), a maximum brightness *c*, equal for all stars, and an initial brightness *s**i* (0<=≤<=*s**i*<=≤<=*c*).
Over time the stars twinkle. At moment 0 the *i*-th star has brightness *s**i*. Let at mom... | {"inputs": ["2 3 3\n1 1 1\n3 2 0\n2 1 1 2 2\n0 2 1 4 5\n5 1 1 5 5", "3 4 5\n1 1 2\n2 3 0\n3 3 1\n0 1 1 100 100\n1 2 2 4 4\n2 2 1 4 7\n1 50 50 51 51"], "outputs": ["3\n0\n3", "3\n3\n5\n0"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 17 | codeforces | |
2608bd8a990c81e43e433d7209973bfb | New Year Transportation | New Year is coming in Line World! In this world, there are *n* cells numbered by integers from 1 to *n*, as a 1<=×<=*n* board. People live in cells. However, it was hard to move between distinct cells, because of the difficulty of escaping the cell. People wanted to meet people who live in other cells.
So, user tncks0... | {"inputs": ["8 4\n1 2 1 2 1 2 1", "8 5\n1 2 1 2 1 1 1", "20 19\n13 16 7 6 12 1 5 7 8 6 5 7 5 5 3 3 2 2 1", "50 49\n11 7 1 41 26 36 19 16 38 14 36 35 37 27 20 27 3 6 21 2 27 11 18 17 19 16 22 8 8 9 1 7 5 12 5 6 13 6 11 2 6 3 1 5 1 1 2 2 1", "120 104\n41 15 95 85 34 11 25 42 65 39 77 80 74 17 66 73 21 14 36 63 63 79 45 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 479 | codeforces | |
260b30fbb2bc2ccd461fce570369a337 | High School: Become Human | Year 2118. Androids are in mass production for decades now, and they do all the work for humans. But androids have to go to school to be able to solve creative tasks. Just like humans before.
It turns out that high school struggles are not gone. If someone is not like others, he is bullied. Vasya-8800 is an economy-cl... | {"inputs": ["5 8", "10 3", "6 6", "14 1", "2 4", "987654321 123456987", "1 10", "9 1", "1 1", "2 2", "3 3", "4 4", "5 5", "2 3", "2 5", "3 2", "3 4", "3 5", "4 2", "4 3", "4 5", "5 2", "5 3", "5 4", "100 101", "876543 372647", "1000000000 999999999", "1000000000 2", "1000000000 1", "987654321 123456789", "1000000000 10... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 126 | codeforces | |
263dec96d78bc29b65ddd53d4e793a14 | Ciel and Dancing | Fox Ciel and her friends are in a dancing room. There are *n* boys and *m* girls here, and they never danced before. There will be some songs, during each song, there must be exactly one boy and one girl are dancing. Besides, there is a special rule:
- either the boy in the dancing pair must dance for the first time ... | {"inputs": ["2 1", "2 2", "1 1", "2 3", "4 4", "1 12", "12 1", "100 100", "24 6", "7 59", "26 75", "32 87", "42 51", "4 63", "10 79", "20 95", "35 55", "45 71", "7 83", "32 100", "42 17", "1 77", "19 93", "25 5", "35 21", "99 99", "99 100", "100 99"], "outputs": ["2\n1 1\n2 1", "3\n1 1\n1 2\n2 2", "1\n1 1", "4\n1 1\n1 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 131 | codeforces | |
264ce6a14a5e091a72fd750eb279c9d1 | Business trip | What joy! Petya's parents went on a business trip for the whole year and the playful kid is left all by himself. Petya got absolutely happy. He jumped on the bed and threw pillows all day long, until...
Today Petya opened the cupboard and found a scary note there. His parents had left him with duties: he should water... | {"inputs": ["5\n1 1 1 1 2 2 3 2 2 1 1 1", "0\n0 0 0 0 0 0 0 1 1 2 3 0", "11\n1 1 4 1 1 5 1 1 4 1 1 1", "15\n20 1 1 1 1 2 2 1 2 2 1 1", "7\n8 9 100 12 14 17 21 10 11 100 23 10", "52\n1 12 3 11 4 5 10 6 9 7 8 2", "50\n2 2 3 4 5 4 4 5 7 3 2 7", "0\n55 81 28 48 99 20 67 95 6 19 10 93", "93\n85 40 93 66 92 43 61 3 64 51 90 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 316 | codeforces | |
26590802eae1165c1ef752a1f65bc001 | Lucky Numbers | Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Lucky number is super lucky if it's decimal representation contains equal amount of digits 4 and 7. Fo... | {"inputs": ["4500", "47", "1", "12", "4587", "100", "1007", "99999999", "49102094540227023300", "1000000000", "777777", "99999999", "474", "85469", "7474747", "2145226", "5556585", "87584777", "77777777", "1000000000", "999999999", "74477744", "444444444", "467549754", "147474747", "555", "100000", "74777443", "4700007... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
266a1d7c803771117c8c2e3572000a36 | Drazil and Factorial | Drazil is playing a math game with Varda.
Let's define for positive integer *x* as a product of factorials of its digits. For example, .
First, they choose a decimal number *a* consisting of *n* digits that contains at least one digit larger than 1. This number may possibly start with leading zeroes. Then they shoul... | {"inputs": ["4\n1234", "3\n555", "15\n012345781234578", "1\n8", "10\n1413472614", "8\n68931246", "7\n4424368", "6\n576825", "5\n97715", "3\n915", "2\n26", "1\n4", "15\n028745260720699", "13\n5761790121605", "10\n3312667105", "1\n7", "15\n989898989898989", "15\n000000000000007", "15\n999999999999990", "1\n2", "1\n3", "1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 264 | codeforces | |
267a0c5f52c91226c15d7f2b4ed743da | Simple Molecules | Mad scientist Mike is busy carrying out experiments in chemistry. Today he will attempt to join three atoms into one molecule.
A molecule consists of atoms, with some pairs of atoms connected by atomic bonds. Each atom has a valence number — the number of bonds the atom must form with other atoms. An atom can form one... | {"inputs": ["1 1 2", "3 4 5", "4 1 1", "1 1 1", "1000000 1000000 1000000", "3 11 8", "8 5 12", "1000000 500000 1", "1000000 500000 2", "2 2 2", "3 3 3", "4 4 4", "2 4 2", "10 5 14", "10 5 15", "10 4 16", "3 3 6", "9 95 90", "3 5 8", "5 8 13", "6 1 5", "59 54 56", "246 137 940", "7357 3578 9123", "93952 49553 83405", "6... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
268367e01de0c640fb14121de2c71171 | Mike and Fish | As everyone knows, bears love fish. But Mike is a strange bear; He hates fish! The even more strange thing about him is he has an infinite number of blue and red fish.
He has marked *n* distinct points in the plane. *i*-th point is point (*x**i*,<=*y**i*). He wants to put exactly one fish in each of these points such... | {"inputs": ["4\n1 1\n1 2\n2 1\n2 2", "3\n1 1\n1 2\n2 1", "3\n157210 22861\n175396 39466\n40933 17093", "5\n55599 84144\n169207 98421\n1909 186625\n31525 147710\n7781 82078", "15\n44249 54630\n165741 91307\n49455 83026\n52521 88269\n39286 65158\n38282 73821\n96608 30032\n155832 122920\n22021 13546\n161556 192797\n168062... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
26931ae597cbb3891a79c3265e535a8d | none | A new innovative ticketing systems for public transport is introduced in Bytesburg. Now there is a single travel card for all transport. To make a trip a passenger scan his card and then he is charged according to the fare.
The fare is constructed in the following manner. There are three types of tickets:
1. a tick... | {"inputs": ["3\n10\n20\n30", "10\n13\n45\n46\n60\n103\n115\n126\n150\n256\n516", "7\n100\n138\n279\n308\n396\n412\n821", "8\n0\n2\n51\n63\n69\n75\n80\n90", "8\n0\n3\n5\n6\n7\n8\n9\n10", "1\n0"], "outputs": ["20\n20\n10", "20\n20\n10\n0\n20\n0\n0\n20\n20\n10", "20\n20\n20\n20\n20\n20\n0", "20\n20\n10\n0\n0\n0\n0\n20", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 29 | codeforces | |
269b7d25ead4791a23137dacc9b960b3 | Fox and Minimal path | Fox Ciel wants to write a task for a programming contest. The task is: "You are given a simple undirected graph with *n* vertexes. Each its edge has unit length. You should calculate the number of shortest paths between vertex 1 and vertex 2."
Same with some writers, she wants to make an example with some certain outp... | {"inputs": ["2", "9", "1", "7", "10", "16", "27", "29", "31", "1000000", "167959139", "641009859", "524125987", "702209411", "585325539", "58376259", "941492387", "824608515", "2691939", "802030518", "685146646", "863230070", "41313494", "219396918", "102513046", "985629174", "458679894", "341796022", "519879446", "452... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
26da59ebb8bc79d0a2378b568f4e52c3 | Divisors | Bizon the Champion isn't just friendly, he also is a rigorous coder.
Let's define function *f*(*a*), where *a* is a sequence of integers. Function *f*(*a*) returns the following sequence: first all divisors of *a*1 go in the increasing order, then all divisors of *a*2 go in the increasing order, and so on till the las... | {"inputs": ["6 1", "4 2", "10 3", "10 0", "1 1", "1 1000000000000000000", "16 10", "963761198400 1", "963761198400 65535", "1000000000000 0", "963761198400 576460752303423487", "128 10", "8 50", "999999999989 1727", "999999999899 2816", "999999999989 99999", "999999999899 100000", "549755813888 4", "549755813888 13", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
26db7e114e5d76aa0dd20d2ef4c1bee6 | Changing a String | There is a string *s*, consisting of capital Latin letters. Let's denote its current length as |*s*|. During one move it is allowed to apply one of the following operations to it:
- INSERT *pos* *ch* — insert a letter *ch* in the string *s* in the position *pos* (1<=≤<=*pos*<=≤<=|*s*|<=+<=1,<=*A*<=≤<=*ch*<=≤<=*Z*). ... | {"inputs": ["ABA\nABBBA", "ACCEPTED\nWRONGANSWER", "V\nBNBNE", "UB\nPWL", "JOYXNKYPF\nGDV", "SZDAWSVGK\nUM", "TJHGFKKCDOHRNAXZROCWIYFF\nZBWUEHEVEOUATECAGLZIQMUDXEMHRSOZMAUJRWLQMPPZOUMXHAMWUGEDIKVKBLVMXWUOFMPAFDPRBCFTEWOULCZWRQHCTBTBXRHHODWBCXWIMNCNEXOSKSUJLISGCLLLXOKRSBNOZTHAJNNLILYFFMSYKOFPTXRNEFBSOUHFOLTIQAINRPXWRQ",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
26eb6a4362396e077c4834f617cf17c1 | Covered Path | The on-board computer on Polycarp's car measured that the car speed at the beginning of some section of the path equals *v*1 meters per second, and in the end it is *v*2 meters per second. We know that this section of the route took exactly *t* seconds to pass.
Assuming that at each of the seconds the speed is constan... | {"inputs": ["5 6\n4 2", "10 10\n10 0", "87 87\n2 10", "1 11\n6 2", "100 10\n10 10", "1 1\n100 10", "1 1\n5 1", "1 1\n5 2", "100 100\n100 0", "100 100\n100 10", "1 100\n100 1", "1 100\n100 10", "100 1\n100 1", "100 1\n100 10", "1 10\n2 10", "1 1\n2 1", "1 1\n2 10", "1 2\n2 1", "1 2\n2 10", "1 5\n3 2", "2 1\n2 2", "2 1\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 117 | codeforces | |
26f13d75ab3cd66221e8975cb5136a05 | Planning The Expedition | Natasha is planning an expedition to Mars for $n$ people. One of the important tasks is to provide food for each participant.
The warehouse has $m$ daily food packages. Each package has some food type $a_i$.
Each participant must eat exactly one food package each day. Due to extreme loads, each participant must eat t... | {"inputs": ["4 10\n1 5 2 1 1 1 2 5 7 2", "100 1\n1", "2 5\n5 4 3 2 1", "3 9\n42 42 42 42 42 42 42 42 42", "1 1\n100", "4 100\n84 99 66 69 86 94 89 96 98 93 93 82 87 93 91 100 69 99 93 81 99 84 75 100 86 88 98 100 84 96 44 70 94 91 85 78 86 79 45 88 91 78 98 94 81 87 93 72 96 88 96 97 96 62 86 72 94 84 80 98 88 90 93 73... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 162 | codeforces | |
2700f76d05ed9d786799492f4c826085 | Doctor | There are *n* animals in the queue to Dr. Dolittle. When an animal comes into the office, the doctor examines him, gives prescriptions, appoints tests and may appoint extra examination. Doc knows all the forest animals perfectly well and therefore knows exactly that the animal number *i* in the queue will have to visit... | {"inputs": ["3 3\n1 2 1", "4 10\n3 3 2 1", "7 10\n1 3 3 1 2 3 1", "1 0\n1", "6 101\n9 78 54 62 2 91", "9 100\n11 11 11 11 11 11 11 11 11", "10 77\n7 45 10 10 9 8 1 2 3 1", "5 12\n1 3 4 1 5", "5 23\n7 1 4 7 9", "5 41\n19 19 19 15 20", "10 7\n5 1 2 5 4 3 5 2 2 4", "10 109\n5 5 4 4 8 10 9 10 9 8", "20 430\n25 27 25 24 24 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
276e4a6596f5df558504926e8cb13609 | Spongebob and Joke | While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Patrick's personal stuff and found a sequence *a*1,<=*a*2,<=...,<=*a**m* of length *m*, consisting of integers from 1 to *n*, not necessarily distinct. Then he picked some sequence *f*1,<=*f*2,<=.... | {"inputs": ["3 3\n3 2 1\n1 2 3", "3 3\n1 1 1\n1 1 1", "3 3\n1 2 1\n3 3 3", "2 100\n2 1\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2", "5 6\n5 2 4 3 5\n1 2 3 4 4 5",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
277d4ef7196d95a0f81fc8d1062ce98d | Planets | Goa'uld Apophis captured Jack O'Neill's team again! Jack himself was able to escape, but by that time Apophis's ship had already jumped to hyperspace. But Jack knows on what planet will Apophis land. In order to save his friends, Jack must repeatedly go through stargates to get to this planet.
Overall the galaxy has *... | {"inputs": ["4 6\n1 2 2\n1 3 3\n1 4 8\n2 3 4\n2 4 5\n3 4 3\n0\n1 3\n2 3 4\n0", "3 1\n1 2 3\n0\n1 3\n0", "2 1\n1 2 3\n0\n1 3", "2 1\n1 2 3\n1 0\n0", "3 3\n1 2 5\n2 3 6\n1 3 7\n0\n0\n0", "3 3\n1 2 3\n2 3 2\n1 3 7\n0\n0\n0", "2 0\n0\n0", "3 1\n1 2 3\n1 1\n1 5\n0", "2 1\n1 2 3\n0\n2 2 4", "2 1\n1 2 1\n0\n0", "2 1\n2 1 1000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 12 | codeforces | |
2780dc35f4b3d6b38846a3670b9c4d27 | Given Length and Sum of Digits... | You have a positive integer *m* and a non-negative integer *s*. Your task is to find the smallest and the largest of the numbers that have length *m* and sum of digits *s*. The required numbers should be non-negative integers written in the decimal base without leading zeroes.
The single line of the input contains a pa... | {"inputs": ["2 15", "3 0", "2 1", "3 10", "100 100", "1 900", "1 9", "1 0", "1 1", "1 2", "1 8", "1 10", "1 11", "2 0", "2 1", "2 2", "2 8", "2 10", "2 11", "2 16", "2 17", "2 18", "2 19", "2 20", "2 900", "3 1", "3 2", "3 3", "3 9", "3 10", "3 20", "3 21", "3 26", "3 27", "3 28", "3 100", "100 0", "100 1", "100 2", "1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 60 | codeforces | |
27912b09315cd9d2d2025df33ade7e4b | Anya and Smartphone | Anya has bought a new smartphone that uses Berdroid operating system. The smartphone menu has exactly *n* applications, each application has its own icon. The icons are located on different screens, one screen contains *k* icons. The icons from the first to the *k*-th one are located on the first screen, from the (*k*<... | {"inputs": ["8 3 3\n1 2 3 4 5 6 7 8\n7 8 1", "5 4 2\n3 1 5 2 4\n4 4 4 4", "10 10 3\n1 2 3 4 5 6 7 8 9 10\n2 3 4 5 6 7 8 9 10 1", "10 12 3\n6 1 2 9 3 10 8 5 7 4\n3 9 9 4 8 2 3 8 10 8 3 4", "16 12 8\n6 11 12 5 1 10 16 3 13 15 9 4 8 2 14 7\n6 13 8 12 8 15 12 16 8 11 3 16", "4 3 5\n3 1 4 2\n4 2 4", "4 2 15\n2 4 3 1\n1 2", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 26 | codeforces | |
27a77c2ab905683f7ad7df0fcd6084c9 | XK Segments | While Vasya finished eating his piece of pizza, the lesson has already started. For being late for the lesson, the teacher suggested Vasya to solve one interesting problem. Vasya has an array *a* and integer *x*. He should find the number of different ordered pairs of indexes (*i*,<=*j*) such that *a**i*<=≤<=*a**j* and... | {"inputs": ["4 2 1\n1 3 5 7", "4 2 0\n5 3 1 7", "5 3 1\n3 3 3 3 3", "5 3 4\n24 13 1 24 24", "4 2 2\n1 3 5 7", "5 1 0\n10 12 14 20 30", "7 3 1\n3 3 6 9 12 15 18", "2 5 0\n3 4", "3 5 0\n4 4 4", "3 6 0\n3 4 5", "10 2 1\n2 2 2 2 2 2 2 1 2 1", "100 2 1\n1 2 2 2 1 2 1 2 2 2 2 1 2 1 1 2 1 2 2 1 1 2 1 1 2 2 1 1 2 1 2 2 2 2 2 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 23 | codeforces | |
27af0c4bf25826baa2ff43d700aa6bb8 | Jerry's Protest | Andrew and Jerry are playing a game with Harry as the scorekeeper. The game consists of three rounds. In each round, Andrew and Jerry draw randomly without replacement from a jar containing *n* balls, each labeled with a distinct positive integer. Without looking, they hand their balls to Harry, who awards the point to... | {"inputs": ["2\n1 2", "3\n1 2 10", "3\n1 2 3", "4\n2 4 1 3", "11\n1 2 4 8 16 32 64 128 256 512 1024", "18\n69 88 49 91 42 56 58 13 38 93 77 99 18 32 82 81 92 46", "16\n14 34 22 53 11 40 50 12 91 86 32 75 36 33 41 9", "11\n54 91 4 6 88 23 38 71 77 26 84", "20\n11 37 81 56 61 2 26 27 59 69 24 7 71 76 45 54 89 17 95 20", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
27b36ddbab25919f8d6f603219863b67 | none | For an array $b$ of length $m$ we define the function $f$ as
where $\oplus$ is [bitwise exclusive OR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR).
For example, $f(1,2,4,8)=f(1\oplus2,2\oplus4,4\oplus8)=f(3,6,12)=f(3\oplus6,6\oplus12)=f(5,10)=f(5\oplus10)=f(15)=15$
You are given an array $a$ and a few queri... | {"inputs": ["3\n8 4 1\n2\n2 3\n1 2", "6\n1 2 4 8 16 32\n4\n1 6\n2 5\n3 4\n1 2"], "outputs": ["5\n12", "60\n30\n12\n3"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 26 | codeforces | |
27d894e4222e08d40735bc2a7f8ac2bf | Okabe and City | Okabe likes to be able to walk through his city on a path lit by street lamps. That way, he doesn't get beaten up by schoolchildren.
Okabe's city is represented by a 2D grid of cells. Rows are numbered from 1 to *n* from top to bottom, and columns are numbered 1 to *m* from left to right. Exactly *k* cells in the city... | {"inputs": ["4 4 5\n1 1\n2 1\n2 3\n3 3\n4 3", "5 5 4\n1 1\n2 1\n3 1\n3 2", "2 2 4\n1 1\n1 2\n2 1\n2 2", "5 5 4\n1 1\n2 2\n3 3\n4 4", "7 10 53\n1 1\n7 5\n2 3\n5 3\n1 9\n2 10\n6 1\n7 6\n2 9\n3 3\n3 4\n5 1\n5 4\n1 10\n4 1\n3 10\n7 7\n7 8\n7 1\n1 8\n2 4\n6 5\n3 5\n6 3\n6 6\n2 8\n3 6\n5 2\n3 8\n3 9\n5 5\n7 2\n3 1\n4 8\n1 3\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
2823db17c9eac312a30cd139d327c0b9 | The Best Gift | Emily's birthday is next week and Jack has decided to buy a present for her. He knows she loves books so he goes to the local bookshop, where there are *n* books on sale from one of *m* genres.
In the bookshop, Jack decides to buy two books of different genres.
Based on the genre of books on sale in the shop, find th... | {"inputs": ["4 3\n2 1 3 1", "7 4\n4 2 3 1 2 4 3", "2 2\n1 2", "3 2\n1 2 2", "10 10\n1 2 3 4 5 6 7 8 9 10", "9 2\n1 1 1 1 2 1 1 1 1", "12 3\n1 2 3 1 2 3 1 2 3 1 2 3", "100 3\n2 1 1 1 3 2 3 3 2 3 3 1 3 3 1 3 3 1 1 1 2 3 1 2 3 1 2 3 3 1 3 1 1 2 3 2 3 3 2 3 3 1 2 2 1 2 3 2 3 2 2 1 1 3 1 3 2 1 3 1 3 1 3 1 1 3 3 3 2 3 2 2 2 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 156 | codeforces | |
28246d079b86cc5aea0af5f8f33a5423 | Lengthening Sticks | You are given three sticks with positive integer lengths of *a*,<=*b*, and *c* centimeters. You can increase length of some of them by some positive integer number of centimeters (different sticks can be increased by a different length), but in total by at most *l* centimeters. In particular, it is allowed not to incre... | {"inputs": ["1 1 1 2", "1 2 3 1", "10 2 1 7", "1 2 1 5", "10 15 17 10", "5 5 5 10000", "5 7 30 100", "5 5 5 300000", "4 2 5 28", "2 7 8 4", "85 50 17 89", "17 28 19 5558", "5276 8562 1074 8453", "9133 7818 3682 82004", "81780 54799 231699 808", "53553 262850 271957 182759", "300000 300000 300000 300000", "1 1 300000 30... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
283652cba8bc6649f1610093f8a997ab | Shortest Path Problem? | You are given an undirected graph with weighted edges. The length of some path between two vertices is the bitwise xor of weights of all edges belonging to this path (if some edge is traversed more than once, then it is included in bitwise xor the same number of times). You have to find the minimum length of path betwe... | {"inputs": ["3 3\n1 2 3\n1 3 2\n3 2 0", "2 2\n1 1 3\n1 2 3", "10 20\n8 5 64\n5 6 48\n4 5 91\n10 1 2\n3 4 51\n8 2 74\n6 1 98\n3 10 24\n2 10 35\n8 7 52\n10 5 72\n5 9 25\n2 9 65\n7 4 69\n5 7 26\n7 2 44\n6 8 61\n3 5 43\n10 7 33\n4 2 28", "10 20\n1 8 2\n2 9 94\n9 5 43\n7 2 83\n9 7 42\n5 10 11\n3 10 48\n8 6 31\n3 4 57\n9 3 7... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
283e1019f37f86a0f8edcc07d12acadb | Bus to Udayland | ZS the Coder and Chris the Baboon are travelling to Udayland! To get there, they have to get on the special IOI bus. The IOI bus has *n* rows of seats. There are 4 seats in each row, and the seats are separated into pairs by a walkway. When ZS and Chris came, some places in the bus was already occupied.
ZS and Chris a... | {"inputs": ["6\nOO|OX\nXO|XX\nOX|OO\nXX|OX\nOO|OO\nOO|XX", "4\nXO|OX\nXO|XX\nOX|OX\nXX|OX", "5\nXX|XX\nXX|XX\nXO|OX\nXO|OO\nOX|XO", "1\nXO|OX", "1\nOO|OO", "4\nXO|XX\nXX|XO\nOX|XX\nXO|XO", "9\nOX|XO\nOX|XO\nXO|OX\nOX|OX\nXO|OX\nXX|OO\nOX|OX\nOX|XO\nOX|OX", "61\nOX|XX\nOX|XX\nOX|XX\nXO|XO\nXX|XO\nXX|XX\nXX|XX\nOX|XX\nXO... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 433 | codeforces | |
28411c5d29d114ba8323796db78ba7c8 | Power Substring | You are given *n* positive integers *a*1,<=*a*2,<=...,<=*a**n*.
For every *a**i* you need to find a positive integer *k**i* such that the decimal notation of 2*k**i* contains the decimal notation of *a**i* as a substring among its last *min*(100,<=*length*(2*k**i*)) digits. Here *length*(*m*) is the length of the deci... | {"inputs": ["2\n8\n2", "2\n3\n4857", "7\n1\n7\n9\n5\n6\n10\n4", "10\n384\n179\n982\n466\n646\n226\n759\n798\n291\n852", "10\n677\n958\n20\n169\n441\n752\n24\n809\n41\n96", "10\n31\n362\n396\n661\n314\n803\n366\n124\n748\n875", "50\n415546\n6493493\n5136540\n6965643\n8466744\n3329383\n9711334\n9543203\n4478668\n375580\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
2864da2c1b6bbbed5dd64a4f5a8f4888 | Array Division | Vasya has an array *a* consisting of positive integer numbers. Vasya wants to divide this array into two non-empty consecutive parts (the prefix and the suffix) so that the sum of all elements in the first part equals to the sum of elements in the second part. It is not always possible, so Vasya will move some element ... | {"inputs": ["3\n1 3 2", "5\n1 2 3 4 5", "5\n2 2 3 4 5", "5\n72 32 17 46 82", "6\n26 10 70 11 69 57", "7\n4 7 10 7 5 5 1", "8\n9 5 5 10 4 9 5 8", "10\n9 6 8 5 5 2 8 9 2 2", "15\n4 8 10 3 1 4 5 9 3 2 1 7 7 3 8", "20\n71 83 54 6 10 64 91 98 94 49 65 68 14 39 91 60 74 100 17 13", "20\n2 8 10 4 6 6 4 1 2 2 6 9 5 1 9 1 9 8 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 45 | codeforces | |
286a400f485c1c229063aea4feb0c7b6 | Send the Fool Further! (easy) | Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects that the message she is asked to deliver states: "Send the fool further!", and upon reading it the recipient will ask Heidi to d... | {"inputs": ["4\n0 1 4\n0 2 2\n2 3 3", "3\n1 0 5987\n2 0 8891", "10\n1 0 518\n2 0 4071\n3 1 121\n4 2 3967\n5 3 9138\n6 2 9513\n7 3 3499\n8 2 2337\n9 4 7647", "11\n1 0 6646\n2 0 8816\n3 2 9375\n4 2 5950\n5 1 8702\n6 2 2657\n7 2 885\n8 7 2660\n9 2 5369\n10 6 3798", "10\n0 1 7171\n0 2 2280\n1 3 9126\n2 4 2598\n5 4 8320\n6 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 46 | codeforces | |
287397a481ede563607cff0a1ddf0ea0 | Roadside Trees (Simplified Edition) | Squirrel Liss loves nuts. There are *n* trees (numbered 1 to *n* from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree *i* is *h**i*. Liss wants to eat all nuts.
Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the fol... | {"inputs": ["2\n1\n2", "5\n2\n1\n2\n1\n1", "1\n1"], "outputs": ["5", "14", "2"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 204 | codeforces | |
288b3bbc8ba7b9d6fe341a00d99b015b | Recursive Queries | Let us define two functions *f* and *g* on positive integer numbers.
You need to process *Q* queries. In each query, you will be given three integers *l*, *r* and *k*. You need to print the number of integers *x* between *l* and *r* inclusive, such that *g*(*x*)<==<=*k*.
The first line of the input contains an int... | {"inputs": ["4\n22 73 9\n45 64 6\n47 55 7\n2 62 4", "4\n82 94 6\n56 67 4\n28 59 9\n39 74 4"], "outputs": ["1\n4\n0\n8", "3\n1\n1\n5"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
288c99b2fff6797baa38bd27fdb238e2 | Fox And Travelling | Fox Ciel is going to travel to New Foxland during this summer.
New Foxland has *n* attractions that are linked by *m* undirected roads. Two attractions are called adjacent if they are linked by a road. Fox Ciel has *k* days to visit this city and each day she will visit exactly one attraction.
There is one important ... | {"inputs": ["3 2\n1 2\n2 3", "4 4\n1 2\n2 3\n3 4\n4 1", "12 11\n2 3\n4 7\n4 5\n5 6\n4 6\n6 12\n5 12\n5 8\n8 9\n10 8\n11 9", "13 0", "1 0", "2 0", "2 1\n1 2", "4 4\n1 2\n2 3\n3 1\n1 4", "10 9\n1 2\n1 3\n1 4\n2 5\n2 6\n3 7\n3 8\n4 9\n4 10", "5 10\n1 2\n2 3\n3 4\n4 5\n5 1\n1 3\n2 4\n3 5\n4 1\n5 2", "100 0", "100 2\n12 34\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
28901a501e75b526313e1ccaf84d830d | Mammoth's Genome Decoding | The process of mammoth's genome decoding in Berland comes to its end!
One of the few remaining tasks is to restore unrecognized nucleotides in a found chain *s*. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, *s... | {"inputs": ["8\nAG?C??CT", "4\nAGCT", "6\n????G?", "4\nAA??", "4\n????", "252\n???????GCG??T??TT?????T?C???C?CCG???GA???????AC??A???AAC?C?CC??CCC??A??TA?CCC??T???C??CA???CA??G????C?C?C????C??C??A???C?T????C??ACGC??CC?A?????A??CC?C??C?CCG?C??C??A??CG?A?????A?CT???CC????CCC?CATC?G??????????A???????????????TCCCC?C?CA??AC?... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 163 | codeforces | |
289e0f64b860d6bf9e29d7d35a32f48a | none | The project of a data center of a Big Software Company consists of *n* computers connected by *m* cables. Simply speaking, each computer can be considered as a box with multiple cables going out of the box. Very Important Information is transmitted along each cable in one of the two directions. As the data center plan ... | {"inputs": ["4 6\n1 2\n2 3\n3 4\n4 1\n1 3\n1 3", "3 4\n1 2\n2 3\n1 1\n3 3", "1 1\n1 1", "1 2\n1 1\n1 1", "1 3\n1 1\n1 1\n1 1", "1 4\n1 1\n1 1\n1 1\n1 1", "2 1\n1 2", "2 2\n1 2\n1 2", "2 3\n1 2\n1 2\n1 2", "2 2\n1 1\n1 2", "2 3\n1 1\n1 2\n2 2", "3 4\n1 1\n2 2\n3 2\n2 1", "3 9\n1 2\n1 3\n3 1\n1 3\n1 3\n1 1\n1 1\n1 3\n3 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
28b963cddc578fef58c98986cc553cc1 | New Year Contest | As Gerald sets the table, Alexander sends the greeting cards, and Sergey and his twins create an army of clone snowmen, Gennady writes a New Year contest.
The New Year contest begins at 18:00 (6.00 P.M.) on December 31 and ends at 6:00 (6.00 A.M.) on January 1. There are *n* problems for the contest. The penalty time ... | {"inputs": ["3\n30 330 720", "1\n720", "5\n100 200 300 400 500", "7\n120 110 100 110 120 120 50", "3\n350 340 360", "8\n150 100 50 70 70 80 90 100", "100\n18 96 216 240 1 114 126 38 7 72 28 1 8 29 5 93 1 56 50 142 79 30 6 7 13 126 49 154 6 44 116 3 120 17 181 36 32 7 33 41 59 88 20 21 77 110 7 23 99 15 49 151 68 68 52 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
28c9a440c64ef30409a136d86be5bc53 | Cycle in Graph | You've got a undirected graph *G*, consisting of *n* nodes. We will consider the nodes of the graph indexed by integers from 1 to *n*. We know that each node of graph *G* is connected by edges with at least *k* other nodes of this graph. Your task is to find in the given graph a simple cycle of length of at least *k*<=... | {"inputs": ["3 3 2\n1 2\n2 3\n3 1", "4 6 3\n4 3\n1 2\n1 3\n1 4\n2 3\n2 4", "9 9 2\n5 6\n6 7\n7 8\n8 9\n9 5\n1 2\n2 3\n3 4\n4 1", "5 10 4\n1 2\n2 3\n1 3\n1 5\n4 1\n2 5\n2 4\n5 3\n5 4\n3 4", "10 15 3\n9 4\n4 8\n4 2\n2 9\n9 6\n6 2\n6 5\n1 10\n1 7\n10 5\n10 7\n1 8\n8 3\n3 5\n3 7", "12 40 3\n6 11\n7 11\n9 2\n9 1\n9 3\n3 4\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
28d190993da0190a391548824cc06741 | Two-gram | Two-gram is an ordered pair (i.e. string of length two) of capital Latin letters. For example, "AZ", "AA", "ZA" — three distinct two-grams.
You are given a string $s$ consisting of $n$ capital Latin letters. Your task is to find any two-gram contained in the given string as a substring (i.e. two consecutive characters... | {"inputs": ["7\nABACABA", "5\nZZZAA", "26\nQWERTYUIOPASDFGHJKLZXCVBNM", "2\nQA", "2\nWW", "11\nGGRRAATTZZZ", "50\nNYQAHBYYOXLTRYQDMVENEMAQNBAKGLGQOLXNAIFNQTOCLNNQIA", "100\nURXCAIZFIBNJTPCZHBQIBCILLPXZCFGMKKZMNPLCYGAVJVIBMCZEBSJWPSCPQDYCTTKPOKIJRSKIZPDGCHVOUTMPNECYORSFZFNC", "100\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 67 | codeforces | |
28d2c70f4674dc987c27d930ced3b8b5 | none | Pupils decided to go to amusement park. Some of them were with parents. In total, *n* people came to the park and they all want to get to the most extreme attraction and roll on it exactly once.
Tickets for group of *x* people are sold on the attraction, there should be at least one adult in each group (it is possible... | {"inputs": ["3 4 1\n011", "4 7 2\n1101", "1 2 2\n1", "2 3 10\n01", "5 10 3\n11100", "10 2 2\n1111101111", "20 3 13\n01111110011111010101", "50 13 44\n11101110100110111100010110001111001001110010111011", "100 1000 1000\n0000010100101100110100101111001111111111100101111100111011110001011110110111111010000000101000111000"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
28d8994423a75f615720682d6568e5bc | New Year and Original Order | Let *S*(*n*) denote the number that represents the digits of *n* in sorted order. For example, *S*(1)<==<=1,<=*S*(5)<==<=5,<=*S*(50394)<==<=3459,<=*S*(353535)<==<=333555.
Given a number *X*, compute modulo 109<=+<=7.
The first line of input will contain the integer *X* (1<=≤<=*X*<=≤<=10700).
Print a single integer, t... | {"inputs": ["21", "345342", "9438174368", "33340691714056185860211260984431382156326935244157", "60659389952427965488066632743799525603106037644498358605868947137979908494800892265261453803791510334840960342863677552781925982028425181448855359993703120262947850907075964314040305228976226486729250", "4464901405497108121... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
28ddc714cc47a07c865fe5ad1a7cafc8 | Little Elephant and Retro Strings | The Little Elephant has found a ragged old black-and-white string *s* on the attic.
The characters of string *s* are numbered from the left to the right from 1 to |*s*|, where |*s*| is the length of the string. Let's denote the *i*-th character of string *s* as *s**i*. As the string is black-and-white, each character ... | {"inputs": ["3 2\nXXX", "4 2\nXXXX", "10 2\nXXBXXWXXXX", "3 1\nXBX", "1 1\nX", "2 1\nXW", "2 1\nWX", "10 3\nXBXBXWXBXW", "10 1\nXXXWXBXBXX", "20 2\nXXXBXWBBBBWXWWWXWWXB", "20 1\nXBBBWBXXBWXWWWBWWXXW", "10 3\nBXBWBWWWWX", "10 3\nWWXBWXXWWW", "20 3\nBWWWWWXBWXXXXBBWBBWX", "20 4\nWWWWXWBXBBXWWXWXBWWW", "20 5\nXBBXXXXXXXBW... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
28ee68f16a520e48dfcd63f4a9b73c66 | Airport | Lolek and Bolek are about to travel abroad by plane. The local airport has a special "Choose Your Plane" offer. The offer's conditions are as follows:
- it is up to a passenger to choose a plane to fly on; - if the chosen plane has *x* (*x*<=><=0) empty seats at the given moment, then the ticket for such a plane ... | {"inputs": ["4 3\n2 1 1", "4 3\n2 2 2", "10 5\n10 3 3 1 2", "10 1\n10", "10 1\n100", "10 2\n4 7", "40 10\n1 2 3 4 5 6 7 10 10 10", "1 1\n6", "1 2\n10 9", "2 1\n7", "2 2\n7 2", "3 2\n4 7", "3 3\n2 1 1", "3 3\n2 1 1", "10 10\n3 1 2 2 1 1 2 1 2 3", "10 2\n7 3", "10 1\n19", "100 3\n29 36 35", "100 5\n3 38 36 35 2", "510 13... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 351 | codeforces | |
28ff8cf17cbb44dad168383bfd558933 | Little Elephant and Rozdil | The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil").
However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn't like to spend much time on travelling, so for his journey he will choose a town that needs minimum ti... | {"inputs": ["2\n7 4", "7\n7 4 47 100 4 9 12", "1\n47", "2\n1000000000 1000000000", "7\n7 6 5 4 3 2 1", "10\n1 1 1 1 1 1 1 1 1 1", "4\n1000000000 100000000 1000000 1000000", "20\n7 1 1 2 1 1 8 7 7 8 4 3 7 10 5 3 10 5 10 6", "20\n3 3 6 9 8 2 4 1 7 3 2 9 7 7 9 7 2 6 2 7", "47\n35 79 84 56 67 95 80 34 77 68 14 55 95 32 40 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 536 | codeforces | |
290445341dfe78a9bbf77a0fbe373202 | Cloning Toys | Imp likes his plush toy a lot.
Recently, he found a machine that can clone plush toys. Imp knows that if he applies the machine to an original toy, he additionally gets one more original toy and one copy, and if he applies the machine to a copied toy, he gets two additional copies.
Initially, Imp has only one origina... | {"inputs": ["6 3", "4 2", "1000 1001", "1000000000 999999999", "81452244 81452247", "188032448 86524683", "365289629 223844571", "247579518 361164458", "424836699 793451637", "602093880 930771525", "779351061 773124120", "661640950 836815080", "543930839 974134967", "16155311 406422145", "81601559 445618240", "96389144... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 70 | codeforces | |
2907018f6993427776ddcf7fb2788f22 | Hit Ball | When Valera was playing football on a stadium, it suddenly began to rain. Valera hid in the corridor under the grandstand not to get wet. However, the desire to play was so great that he decided to train his hitting the ball right in this corridor. Valera went back far enough, put the ball and hit it. The ball bounced ... | {"inputs": ["7 2 11\n3 -11 2", "7 2 11\n4 -3 3", "44 94 98\n-17 -64 9", "41 4 58\n81 -9 65", "98 11 74\n79 -66 76", "7 21 86\n1 -19 20", "4 27 2\n-52 -64 31", "8 89 62\n47 -18 53", "57 7 78\n-31 -63 98", "62 14 94\n-33 -20 8", "59 24 6\n65 -73 53", "28 7 59\n83 -44 80", "24 26 75\n80 -97 58", "33 32 87\n-22 -47 2", "30... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
293234b109a5f13075a7b508cf4f0a59 | Neural Network country | Due to the recent popularity of the Deep learning new countries are starting to look like Neural Networks. That is, the countries are being built deep with many layers, each layer possibly having many cities. They also have one entry, and one exit point.
There are exactly *L* layers, each having *N* cities. Let us loo... | {"inputs": ["2 3 13\n4 6\n2 1\n3 4", "2 4 5\n1 1\n1 1\n1 1", "1 1234 5\n1\n1\n1", "3 2 2\n0 1 0\n0 0 1\n1 1 0", "5 4 3\n2 1 0 1 2\n0 1 2 1 0\n1 2 1 0 2", "4 4 4\n0 1 3 2\n1 2 0 3\n2 3 1 0"], "outputs": ["2", "16", "1", "3", "209", "64"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
297437049d4e500bc445497b1d321b1e | Settlers' Training | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly *n* soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either i... | {"inputs": ["4 4\n1 2 2 3", "4 3\n1 1 1 1", "3 3\n1 2 3", "1 1\n1", "1 5\n1", "1 5\n4", "2 6\n2 5", "6 10\n1 1 3 4 9 9", "7 7\n1 1 1 1 1 1 7", "10 10\n1 1 1 3 3 4 7 8 8 8", "10 13\n1 1 1 1 1 1 1 1 1 1", "10 13\n2 6 6 7 9 9 9 10 12 12", "17 9\n2 3 4 5 5 5 5 5 6 6 7 7 8 8 8 8 8", "18 24\n3 3 3 4 5 7 8 8 9 9 9 9 10 10 11 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 69 | codeforces | |
298842cf255460074457de672e78bc2b | Restoring Increasing Sequence | Peter wrote on the board a strictly increasing sequence of positive integers *a*1,<=*a*2,<=...,<=*a**n*. Then Vasil replaced some digits in the numbers of this sequence by question marks. Thus, each question mark corresponds to exactly one lost digit.
Restore the the original sequence knowing digits remaining on the b... | {"inputs": ["3\n?\n18\n1?", "2\n??\n?", "5\n12224\n12??5\n12226\n?0000\n?00000", "10\n473883\n3499005\n4?74792\n58146??\n8?90593\n9203?71\n?39055?\n1?692641\n11451902\n?22126?2", "8\n?\n2\n3\n4\n?\n?\n?\n9", "98\n?\n?0\n2?\n6?\n6?\n69\n??\n??\n96\n1?2\n??3\n104\n??4\n1?9\n??2\n18?\n?01\n205\n?19\n244\n??8\n?5?\n?5?\n27... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
29bd0490fe176e76bac1e031211a7544 | Amity Assessment | Bessie the cow and her best friend Elsie each received a sliding puzzle on Pi Day. Their puzzles consist of a 2<=×<=2 grid and three tiles labeled 'A', 'B', and 'C'. The three tiles sit on top of the grid, leaving one grid cell empty. To make a move, Bessie or Elsie can slide a tile adjacent to the empty cell into the ... | {"inputs": ["AB\nXC\nXB\nAC", "AB\nXC\nAC\nBX", "XC\nBA\nCB\nAX", "AB\nXC\nAX\nCB", "CB\nAX\nXA\nBC", "BC\nXA\nBA\nXC", "CA\nXB\nBA\nCX", "CA\nXB\nAC\nBX", "CB\nAX\nCX\nAB", "AX\nCB\nBC\nXA", "CA\nXB\nBA\nXC", "CX\nAB\nAX\nCB", "AB\nXC\nAB\nCX", "XC\nBA\nXC\nAB", "BA\nXC\nAC\nXB", "AX\nBC\nAC\nBX", "XC\nBA\nCB\nXA", "C... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 95 | codeforces | |
29ecd093ea72b0b060198f59c4a18db5 | Three Sons | Three sons inherited from their father a rectangular corn fiend divided into *n*<=×<=*m* squares. For each square we know how many tons of corn grows on it. The father, an old farmer did not love all three sons equally, which is why he bequeathed to divide his field into three parts containing *A*, *B* and *C* tons of ... | {"inputs": ["3 3\n1 1 1\n1 1 1\n1 1 1\n3 3 3", "2 5\n1 1 1 1 1\n2 2 2 2 2\n3 6 6", "3 3\n1 2 3\n3 1 2\n2 3 1\n5 6 7", "3 3\n0 0 0\n0 0 1\n1 1 0\n2 1 0", "3 3\n0 0 0\n0 1 0\n0 0 0\n1 0 0", "3 2\n0 0\n0 2\n0 0\n2 0 0", "3 2\n0 1\n2 1\n0 1\n3 1 1", "5 10\n0 1 4 4 4 1 4 0 0 4\n1 1 2 0 4 4 2 2 0 3\n3 2 4 0 3 0 1 3 1 0\n4 1 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
29f9d8a3d36ed0108307535ffacebc46 | Find Maximum | Valera has array *a*, consisting of *n* integers *a*0,<=*a*1,<=...,<=*a**n*<=-<=1, and function *f*(*x*), taking an integer from 0 to 2*n*<=-<=1 as its single argument. Value *f*(*x*) is calculated by formula , where value *bit*(*i*) equals one if the binary representation of number *x* contains a 1 on the *i*-th posit... | {"inputs": ["2\n3 8\n10", "5\n17 0 10 2 1\n11010", "18\n4382 3975 9055 7554 8395 204 5313 5739 1555 2306 5423 828 8108 9736 2683 7940 1249 5495\n110001100101110111", "43\n475 2165 8771 7146 8980 7209 9170 9006 6278 6661 4740 6321 7532 6869 3788 7918 1707 5070 3809 5189 2494 8255 1123 3197 190 5712 9873 3286 9997 133 90... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 31 | codeforces | |
2a130954f3cc1e321e7e8e7593c5ef5a | Milking cows | Iahub helps his grandfather at the farm. Today he must milk the cows. There are *n* cows sitting in a row, numbered from 1 to *n* from left to right. Each cow is either facing to the left or facing to the right. When Iahub milks a cow, all the cows that see the current cow get scared and lose one unit of the quantity o... | {"inputs": ["4\n0 0 1 0", "5\n1 0 1 0 1", "50\n1 1 0 1 1 1 1 1 1 0 0 1 1 0 1 1 0 0 1 0 1 1 0 1 1 1 1 0 1 0 1 0 1 1 1 0 0 0 0 0 0 0 1 1 0 1 0 0 1 0", "100\n1 1 0 0 1 1 1 1 0 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 1 1 1 0 0 1 0 0 1 1 0 1 1 1 1 1 1 0 0 0 0 1 1 0 0 0 0 0 1 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0 1 0 1 1 0 1 1 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 66 | codeforces | |
2a36302b6d7ee6e2e5069592a4d07e84 | The Art of Dealing with ATM | ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most *k* bills from it, and the ... | {"inputs": ["6 20\n10 50 100 500 1000 5000\n8\n4200\n100000\n95000\n96000\n99000\n10100\n2015\n9950", "5 2\n1 2 3 5 8\n8\n1\n3\n5\n7\n9\n11\n13\n15", "5 5\n1 2 3 6 102\n10\n1\n4\n30\n1\n76\n114\n10\n13\n13\n4", "3 5\n1 36 95\n10\n3\n1\n4212\n144\n4\n109\n6\n5\n2\n24", "4 5\n1 11 50 203\n10\n5\n5\n150\n53\n56\n5\n12304\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
2a66bad0fc0565adc9835909ce2b06c6 | Vanya and Computer Game | Vanya and his friend Vova play a computer game where they need to destroy *n* monsters to pass a level. Vanya's character performs attack with frequency *x* hits per second and Vova's character performs attack with frequency *y* hits per second. Each character spends fixed time to raise a weapon and then he hits (the t... | {"inputs": ["4 3 2\n1\n2\n3\n4", "2 1 1\n1\n2", "7 5 20\n26\n27\n28\n29\n30\n31\n32", "10 10 1\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10", "10 1 10\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10", "1 999999 1000000\n1000000000", "5 5 6\n999999999\n999999998\n999999997\n999999996\n999999995", "10 13 27\n3\n21\n23\n17\n15\n23\n16\n7\n24\n20", "1 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
2aabae6e92b6532ec48754a161b83180 | White, Black and White Again | Polycarpus is sure that his life fits the description: "first there is a white stripe, then a black one, then a white one again". So, Polycarpus is sure that this rule is going to fulfill during the next *n* days. Polycarpus knows that he is in for *w* good events and *b* not-so-good events. At least one event is going... | {"inputs": ["3 2 1", "4 2 2", "3 2 2", "3 3 1", "3 2 2", "3 3 3", "4 2 3", "4 3 2", "10 10 10", "10 7 5", "10 4 9", "100 200 300", "200 100 300", "239 300 231", "300 300 300", "300 2 300", "300 300 1", "3 300 300", "3 2 300", "3 300 1", "4000 1000 3000", "4000 2000 2000", "4000 100 3900", "4000 2 3998", "3 2 4000", "3 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
2b14359cdb47916fbca3f80ffe7e2333 | Treasure Hunt | After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.
The three friends are very smart so they passed all the challenges very quickly and finally reached the destination... | {"inputs": ["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE", "1\naaaaaaaaaa\nAAAAAAcAAA\nbbbbbbzzbb", "60\nddcZYXYbZbcXYcZdYbddaddYaZYZdaZdZZdXaaYdaZZZaXZXXaaZbb\ndcdXcYbcaXYaXYcacYabYcbZYdacaYbYdXaccYXZZZdYbbYdcZZZbY\nXaZXbbdcX... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 23 | codeforces | |
2b1d53828b5f8636bf0f7bf04797d798 | Queries on a String | You are given a string *s* and should process *m* queries. Each query is described by two 1-based indices *l**i*, *r**i* and integer *k**i*. It means that you should cyclically shift the substring *s*[*l**i*... *r**i*] *k**i* times. The queries should be processed one after another in the order they are given.
One ope... | {"inputs": ["abacaba\n2\n3 6 1\n1 4 2", "u\n1\n1 1 1", "p\n5\n1 1 5\n1 1 9\n1 1 10\n1 1 10\n1 1 4", "ssssssssss\n5\n5 7 9\n3 9 3\n2 7 1\n7 7 10\n1 9 6", "tcpyzttcpo\n10\n2 3 6\n2 4 1\n2 6 9\n7 10 5\n2 3 5\n4 5 6\n3 4 5\n7 9 4\n9 10 7\n1 10 8", "yywlblbblw\n10\n4 7 2\n3 8 2\n4 10 6\n4 7 1\n3 9 6\n1 7 3\n3 7 3\n3 7 1\n1 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 61 | codeforces | |
2b29fa76601c100b41a167c1605ef5fb | SMSC | Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the efficiency of the SMSC.
For that, he asked to give him the statistics of the performance of the SMSC for some period of time. In... | {"inputs": ["2\n1 1\n2 1", "1\n1000000 10", "3\n3 3\n4 3\n5 3", "1\n1 1", "2\n1 11\n100 10", "4\n1 10\n2 9\n3 8\n40 3", "5\n2 1\n5 2\n6 1\n7 1\n8 1", "4\n10 1000\n99998 20\n99999 10\n1000000 100", "6\n10 10\n100 500\n200 500\n500 1\n999995 4\n999996 15", "10\n1 5\n2 5\n3 10\n4 8\n5 5\n6 4\n7 8\n8 9\n9 2\n10 10", "10\n2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 22 | codeforces | |
2b7a88a8b2f2498416289bb61345d762 | Problem About Equation | A group of *n* merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is really important. In other words, the drink's volume in each of the *n* mugs must be the same.
Polycarpus has already began the... | {"inputs": ["5 50\n1 2 3 4 5", "2 2\n1 100", "2 2\n1 1", "3 2\n1 2 1", "3 5\n1 2 1", "10 95\n0 0 0 0 0 1 1 1 1 1", "3 5\n1 2 3", "3 5\n1 3 2", "3 5\n2 1 3", "3 5\n2 3 1", "3 5\n3 1 2", "3 5\n3 2 1", "2 1\n1 1", "2 1\n2 2", "3 2\n2 1 2", "3 3\n2 2 1", "3 3\n3 1 2", "100 100\n37 97 75 52 33 29 51 22 33 37 45 96 96 60 82 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 60 | codeforces | |
2b7abc2a0c81c17cc233bb6a548d4284 | Petya and Spiders | Little Petya loves training spiders. Petya has a board *n*<=×<=*m* in size. Each cell of the board initially has a spider sitting on it. After one second Petya chooses a certain action for each spider, and all of them humbly perform its commands. There are 5 possible commands: to stay idle or to move from current cell ... | {"inputs": ["1 1", "2 3", "4 1", "4 2", "4 3", "4 4", "1 40", "1 1", "1 2", "1 3", "1 4", "1 5", "1 6", "1 7", "1 8", "1 9", "1 10", "1 11", "1 12", "1 13", "1 14", "1 15", "1 16", "1 17", "1 18", "1 19", "1 20", "1 21", "1 22", "1 23", "1 24", "1 25", "1 26", "1 27", "1 28", "1 29", "1 30", "1 31", "1 32", "1 33", "1 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
2b86cf8aaf86f541b96b91d680b154cb | Help Shrek and Donkey | Shrek and the Donkey (as you can guess, they also live in the far away kingdom) decided to play a card game called YAGame. The rules are very simple: initially Shrek holds *m* cards and the Donkey holds *n* cards (the players do not see each other's cards), and one more card lies on the table face down so that both pla... | {"inputs": ["0 3", "1 0", "1 1", "0 0", "2 0", "0 1", "0 2", "1 2", "2 1", "2 2", "863 814", "593 676", "124 830", "582 865", "458 81", "969 527", "886 340", "869 326", "292 760", "999 929", "528 716", "290 221", "863 620", "797 754", "915 183", "8 145", "176 38", "945 457", "997 971", "44 932", "230 840", "995 646", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
2bc3804437ac327173e6ef757e083bb1 | Mike and strings | Mike has *n* strings *s*1,<=*s*2,<=...,<=*s**n* each consisting of lowercase English letters. In one move he can choose a string *s**i*, erase the first character and append it to the end of the string. For example, if he has the string "coolmike", in one move he can transform it into the string "oolmikec".
Now Mike a... | {"inputs": ["4\nxzzwo\nzwoxz\nzzwox\nxzzwo", "2\nmolzv\nlzvmo", "3\nkc\nkc\nkc", "3\naa\naa\nab", "3\nkwkb\nkbkw\nbkwk", "1\na", "2\nnjtazaab\nabnjtaza", "38\nkmlzdcnm\nmlzdcnmk\nlzdcnmkm\nkmlzdcnm\nlzdcnmkm\nzdcnmkml\nzdcnmkml\nmlzdcnmk\nzdcnmkml\nmlzdcnmk\nlzdcnmkm\nzdcnmkml\nkmlzdcnm\nlzdcnmkm\nzdcnmkml\nmlzdcnmk\nk... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 17 | codeforces | |
2bdc40552d3c516afc25977c351a847a | Messenger | Each employee of the "Blake Techologies" company uses a special messaging app "Blake Messenger". All the stuff likes this app and uses it constantly. However, some important futures are missing. For example, many users want to be able to search through the message history. It was already announced that the new feature ... | {"inputs": ["5 3\n3-a 2-b 4-c 3-a 2-c\n2-a 2-b 1-c", "6 1\n3-a 6-b 7-a 4-c 8-e 2-a\n3-a", "5 5\n1-h 1-e 1-l 1-l 1-o\n1-w 1-o 1-r 1-l 1-d", "9 3\n1-h 1-e 2-l 1-o 1-w 1-o 1-r 1-l 1-d\n2-l 1-o 1-w", "5 3\n1-m 1-i 2-r 1-o 1-r\n1-m 1-i 1-r", "9 2\n1-a 2-b 1-o 1-k 1-l 1-m 1-a 3-b 3-z\n1-a 2-b", "10 3\n1-b 1-a 2-b 1-a 1-b 1-a... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
2bec4379a795a2f285822a1a74be9293 | none | Once Vasya and Petya assembled a figure of *m* cubes, each of them is associated with a number between 0 and *m*<=-<=1 (inclusive, each number appeared exactly once). Let's consider a coordinate system such that the *OX* is the ground, and the *OY* is directed upwards. Each cube is associated with the coordinates of it... | {"inputs": ["3\n2 1\n1 0\n0 1", "5\n0 0\n0 1\n0 2\n0 3\n0 4", "10\n-1 2\n-3 0\n5 5\n4 4\n-2 1\n1 1\n3 3\n2 2\n0 0\n-1000000000 0", "10\n-678318184 2\n-678318182 3\n580731357 2\n-678318182 1\n-678318184 1\n-678318183 0\n-678318181 2\n580731357 1\n580731358 0\n-678318183 2", "15\n-491189818 2\n-491189821 6\n-491189823 4\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
2becae75cadf2898f188dd0410a44eb1 | Safe | Vasya tries to break in a safe. He knows that a code consists of *n* numbers, and every number is a 0 or a 1. Vasya has made *m* attempts to enter the code. After each attempt the system told him in how many position stand the right numbers. It is not said in which positions the wrong numbers stand. Vasya has been so u... | {"inputs": ["6 2\n000000 2\n010100 4", "6 3\n000000 2\n010100 4\n111100 0", "6 3\n000000 2\n010100 4\n111100 2", "6 1\n101011 2", "7 2\n1011111 2\n1001111 1", "6 4\n000110 2\n010001 2\n001111 2\n001100 2", "8 3\n00111100 5\n10100111 2\n10110101 2", "35 10\n10010111001010111001011111000111111 1\n101001110010101000011111... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
2bfb5015a753c9976a410730dcd8bc2e | Square Root of Permutation | A permutation of length *n* is an array containing each integer from 1 to *n* exactly once. For example, *q*<==<=[4,<=5,<=1,<=2,<=3] is a permutation. For the permutation *q* the square of permutation is the permutation *p* that *p*[*i*]<==<=*q*[*q*[*i*]] for each *i*<==<=1... *n*. For example, the square of *q*<==<=[4... | {"inputs": ["4\n2 1 4 3", "4\n2 1 3 4", "5\n2 3 4 5 1", "1\n1", "1\n1", "10\n8 2 10 3 4 6 1 7 9 5", "10\n3 5 1 2 10 8 7 6 4 9", "100\n11 9 35 34 51 74 16 67 26 21 14 80 84 79 7 61 28 3 53 43 42 5 56 36 69 30 22 88 1 27 65 91 46 31 59 50 17 96 25 18 64 55 78 2 63 24 95 48 93 13 38 76 89 94 15 90 45 81 52 87 83 73 44 49 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
2c3e5f11a0cecba2139f42a28820c14f | Replacement | Little Petya very much likes arrays consisting of *n* integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that a... | {"inputs": ["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2", "4\n1 1 2 3", "3\n1 1 1", "10\n5 6 1 2 3 1 3 45 7 1000000000", "4\n1000000000 234765 3485636 385634876", "1\n1", "25\n1 1 1 2 2 2 1 2 1 2 2 2 2 2 1 2 2 2 1 2 2 2 2 1 2", "2\n2 1", "3\n1 2 1", "1\n2", "1\n4", "3\n1 1 2", "2\n1 2", "2\n1 3", "2\n1 1", "2\n5 5", "1\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 48 | codeforces | |
2c4ee4399f143ea9b2870f8e4b4d7336 | Vanya and Exams | Vanya wants to pass *n* exams and get the academic scholarship. He will get the scholarship if the average grade mark for all the exams is at least *avg*. The exam grade cannot exceed *r*. Vanya has passed the exams and got grade *a**i* for the *i*-th exam. To increase the grade for the *i*-th exam by 1 point, Vanya mu... | {"inputs": ["5 5 4\n5 2\n4 7\n3 1\n3 2\n2 5", "2 5 4\n5 2\n5 2", "6 5 5\n1 7\n2 4\n3 5\n4 6\n5 6\n4 7", "1 1000000000 1000000\n1 1000000", "10 10 7\n1 10\n2 9\n3 8\n4 7\n5 6\n6 5\n7 4\n8 3\n9 2\n10 1", "3 5 2\n1 10\n1 7\n1 4", "10 10 10\n9 8\n3 9\n3 6\n10 5\n5 5\n6 10\n10 3\n6 7\n2 3\n9 8", "1 1 1\n1 1", "1 100 10\n8 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 12 | codeforces | |
2cebca1bd851b6b5e931ae824f9d6d35 | Almost Increasing Array | We call an array almost increasing if we can erase not more than one element from it so that the array becomes strictly increasing (that is, every element is striclty greater than every element before it).
You are given an array *a* consisting of *n* elements. You are allowed to replace any element with any integer nu... | {"inputs": ["5\n5 4 3 2 1", "5\n1 2 8 9 5", "15\n1013 8003 4947 359 17360 21594 25180 25764 22357 22357 16649 12544 23382 10579 25937", "8\n1 1 1 1 1 1 1 1", "7\n100 105 108 108 107 108 109", "7\n1 5 6 2 3 4 5", "5\n3 4 1 2 5", "8\n53 8 4 6 4 3 8 5", "6\n13 7 4 3 1 4", "6\n6 1 6 2 1 5", "4\n1 2 1 2", "8\n1 5 2 3 4 7 5 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
2d0d04fdf064776c1cdb48fe19f15fc2 | Text Document Analysis | Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
- uppercase and lowercase English ... | {"inputs": ["37\n_Hello_Vasya(and_Petya)__bye_(and_OK)", "37\n_a_(_b___c)__de_f(g_)__h__i(j_k_l)m__", "27\n(LoooonG)__shOrt__(LoooonG)", "5\n(___)", "254\n()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
2d13ff2f926ab901a329406d9816deef | Sereja and Contests | Sereja is a coder and he likes to take part in Codesorfes rounds. However, Uzhland doesn't have good internet connection, so Sereja sometimes skips rounds.
Codesorfes has rounds of two types: *Div*1 (for advanced coders) and *Div*2 (for beginner coders). Two rounds, *Div*1 and *Div*2, can go simultaneously, (*Div*1 ro... | {"inputs": ["3 2\n2 1\n2 2", "9 3\n1 2 3\n2 8\n1 4 5", "10 0", "10 2\n1 1 2\n1 8 9", "9 3\n1 4 5\n1 1 2\n1 6 7", "7 2\n2 3\n1 5 6", "81 28\n1 77 78\n1 50 51\n2 9\n1 66 67\n1 12 13\n1 20 21\n1 28 29\n1 34 35\n1 54 55\n2 19\n1 70 71\n1 45 46\n1 36 37\n2 47\n2 7\n2 76\n2 6\n2 31\n1 16 17\n1 4 5\n1 73 74\n1 64 65\n2 62\n2 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 16 | codeforces | |
2d14cbaed2e88019a8850c627c775f85 | Analysis of Pathes in Functional Graph | You are given a functional graph. It is a directed graph, in which from each vertex goes exactly one arc. The vertices are numerated from 0 to *n*<=-<=1.
Graph is given as the array *f*0,<=*f*1,<=...,<=*f**n*<=-<=1, where *f**i* — the number of vertex to which goes the only arc from the vertex *i*. Besides you are giv... | {"inputs": ["7 3\n1 2 3 4 3 2 6\n6 3 1 4 2 2 3", "4 4\n0 1 2 3\n0 1 2 3", "5 3\n1 2 3 4 0\n4 1 2 14 3", "1 1\n0\n10000", "1 2\n0\n10000", "1 10000000000\n0\n10000", "2 3\n0 0\n4 7", "2 3\n0 1\n4 7", "2 3\n1 0\n4 7", "2 3\n1 1\n4 7", "3 10\n0 1 2\n9240 5331 6721", "4 10\n2 1 2 1\n960 2596 3752 8303", "5 10\n0 2 2 0 2\n8... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
2d174b69461e55ae9529cf4af4ca99b1 | Area of Two Circles' Intersection | You are given two circles. Find the area of their intersection.
The first line contains three integers *x*1,<=*y*1,<=*r*1 (<=-<=109<=≤<=*x*1,<=*y*1<=≤<=109,<=1<=≤<=*r*1<=≤<=109) — the position of the center and the radius of the first circle.
The second line contains three integers *x*2,<=*y*2,<=*r*2 (<=-<=109<=≤<=*x*... | {"inputs": ["0 0 4\n6 0 4", "0 0 5\n11 0 5", "0 0 10\n9 0 1", "0 0 2\n2 2 2", "0 0 10\n5 0 5", "-9 8 7\n-9 8 5", "-60 -85 95\n-69 -94 95", "159 111 998\n161 121 1023", "6008 8591 6693\n5310 8351 7192", "-13563 -6901 22958\n-19316 -16534 18514", "-875463 79216 524620\n-891344 76571 536598", "-8907963 -8149654 8808560\n-... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
2d1c15eaa6b2e5c07888d4cc3cc6634d | Tree | Recently Bob invented a new game with a tree (we should remind you, that a tree is a connected graph without cycles): he deletes any (possibly, zero) amount of edges of the tree, and counts the product of sizes of the connected components left after the deletion. Your task is to find out the maximum number that Bob can... | {"inputs": ["5\n1 2\n2 3\n3 4\n4 5", "8\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7\n6 8", "3\n1 2\n1 3", "5\n3 2\n1 5\n4 5\n5 3", "5\n2 1\n3 4\n3 5\n5 2", "5\n1 4\n4 5\n4 3\n4 2", "5\n2 3\n3 4\n3 5\n3 1", "10\n4 8\n10 2\n6 3\n10 9\n2 3\n4 1\n7 10\n2 1\n5 1", "15\n4 6\n15 1\n3 8\n15 2\n13 11\n9 10\n14 4\n9 12\n11 6\n8 10\n4 5\n2 11\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 20 | codeforces | |
2d40ef94f714e4d7728707c478647ad9 | Parliament of Berland | There are *n* parliamentarians in Berland. They are numbered with integers from 1 to *n*. It happened that all parliamentarians with odd indices are Democrats and all parliamentarians with even indices are Republicans.
New parliament assembly hall is a rectangle consisting of *a*<=×<=*b* chairs — *a* rows of *b* chair... | {"inputs": ["3 2 2", "8 4 3", "10 2 2", "1 1 1", "8 3 3", "1 1 100", "1 100 1", "12 4 3", "64 8 9", "13 2 6", "41 6 7", "9999 100 100", "10000 100 100", "2099 70 30", "2098 30 70", "10000 1 1", "1583 49 36", "4825 77 88", "26 1 33", "274 25 77", "694 49 22", "3585 77 62", "3 1 6", "352 25 59", "150 53 3", "4227 91 80",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 86 | codeforces | |
2d41028b2f20a6fa7a921b8da75abb0f | Constructing Tests | Let's denote a *m*-free matrix as a binary (that is, consisting of only 1's and 0's) matrix such that every square submatrix of size *m*<=×<=*m* of this matrix contains at least one zero.
Consider the following problem:
You are given two integers *n* and *m*. You have to construct an *m*-free square matrix of size *... | {"inputs": ["3\n21\n0\n1", "1\n420441920", "1\n4", "1\n297540", "1\n9", "1\n144", "1\n16", "1\n25", "1\n999944", "1\n6", "1\n14", "1\n81", "1\n2", "1\n36", "1\n2925", "1\n5704", "1\n4104", "1\n1980", "1\n10", "1\n4860", "1\n2601", "1\n28", "1\n56"], "outputs": ["5 2\n1 1\n-1", "-1", "-1", "546 22", "-1", "-1", "-1", "-... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 13 | codeforces | |
2d4b95f543aaa58b6d6b05cdb200b4f4 | Alternating Sum | You are given two integers $a$ and $b$. Moreover, you are given a sequence $s_0, s_1, \dots, s_{n}$. All values in $s$ are integers $1$ or $-1$. It's known that sequence is $k$-periodic and $k$ divides $n+1$. In other words, for each $k \leq i \leq n$ it's satisfied that $s_{i} = s_{i - k}$.
Find out the non-negative ... | {"inputs": ["2 2 3 3\n+-+", "4 1 5 1\n-", "1 1 4 2\n-+", "3 1 4 4\n+--+", "5 1 1 6\n++---+", "5 2 2 6\n+--++-", "686653196 115381398 884618610 3\n+-+", "608663287 430477711 172252358 8\n-+--+-+-", "904132655 827386249 118827660 334\n+++-+++++--+++----+-+-+-+-+--+-+---++--++--++--+-+-+++-+++--+-+-+----+-+-++++-----+--++... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 12 | codeforces |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.