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 |
|---|---|---|---|---|---|---|---|---|---|
741bb1f946dda8d9d2ae4bdb4ddc08bc | T-shirts Distribution | The organizers of a programming contest have decided to present t-shirts to participants. There are six different t-shirts sizes in this problem: S, M, L, XL, XXL, XXXL (sizes are listed in increasing order). The t-shirts are already prepared. For each size from S to XXXL you are given the number of t-shirts of this si... | {"inputs": ["0 1 0 1 1 0\n3\nXL\nS,M\nXL,XXL", "1 1 2 0 1 1\n5\nS\nM\nS,M\nXXL,XXXL\nXL,XXL", "1 2 4 4 1 1\n10\nXL\nXL\nS,M\nL\nM,L\nL\nS,M\nM\nXL,XXL\nXL", "1 3 0 2 2 2\n10\nL,XL\nS,M\nXXL,XXXL\nS,M\nS,M\nXXXL\nXL,XXL\nXXL\nS,M\nXL", "5 1 5 2 4 3\n20\nL,XL\nS,M\nL,XL\nXXL,XXXL\nS,M\nS,M\nXL,XXL\nL,XL\nS,M\nL,XL\nS,M\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 12 | codeforces | |
74216fbb643744f747461380b71d0be3 | Checking the Calendar | You are given names of two days of the week.
Please, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day of the next month was equal to the second day of the week you are given. Both months should belong t... | {"inputs": ["monday\ntuesday", "sunday\nsunday", "saturday\ntuesday", "tuesday\nthursday", "friday\nwednesday", "sunday\nsaturday", "monday\nmonday", "monday\nwednesday", "monday\nthursday", "monday\nfriday", "monday\nsaturday", "monday\nsunday", "tuesday\nmonday", "tuesday\ntuesday", "tuesday\nwednesday", "tuesday\nfr... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 156 | codeforces | |
74244487ce06cc0da0e22a0572c585c6 | Leha and Function | Leha like all kinds of strange things. Recently he liked the function *F*(*n*,<=*k*). Consider all possible *k*-element subsets of the set [1,<=2,<=...,<=*n*]. For subset find minimal element in it. *F*(*n*,<=*k*) — mathematical expectation of the minimal element among all *k*-element subsets.
But only function does n... | {"inputs": ["5\n7 3 5 3 4\n2 1 3 2 3", "7\n4 6 5 8 8 2 6\n2 1 2 2 1 1 2"], "outputs": ["4 7 3 5 3", "2 6 4 5 8 8 6"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 54 | codeforces | |
7431c78681efd4e5818be5fd32cb59e8 | Fox and Cross | Fox Ciel has a board with *n* rows and *n* columns. So, the board consists of *n*<=×<=*n* cells. Each cell contains either a symbol '.', or a symbol '#'.
A cross on the board is a connected set of exactly five cells of the board that looks like a cross. The picture below shows how it looks.
Ciel wants to draw several... | {"inputs": ["4\n####\n####\n####\n####", "6\n.#....\n####..\n.####.\n.#.##.\n######\n.#..#.", "6\n.#..#.\n######\n.####.\n.####.\n######\n.#..#.", "5\n.....\n.#...\n####.\n.####\n...#.", "5\n#....\n###..\n.###.\n..##.\n..##.", "10\n....#...#.\n.#.###.###\n#####.#.#.\n.#######..\n.#.##.#.#.\n######.###\n.#..#.#.#.\n.#..... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 68 | codeforces | |
7432deec97885b39b604ea686f87155a | Hockey | Petya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name *w* and the collection of forbidden substrings *s*1,<=*s*2,<=...,<=*s**n*. All those strings consist of uppercase and low... | {"inputs": ["3\nbers\nucky\nelu\nPetrLoveLuckyNumbers\nt", "4\nhello\nparty\nabefglghjdhfgj\nIVan\npetrsmatchwin\na", "2\naCa\ncba\nabAcaba\nc", "3\nlol\nhello\neho\nPetrUnited\nt", "2\ntrsd\ndream\nPetrsDreamOh\ny", "1\nPetrsDreamOh\nPetrsDreamOh\nh", "3\netr\ned\nied\nPetrUnited\nd", "3\netr\ned\nied\nPetrUnited\nz",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
743d2125ab70ce92fbcc50088321ef71 | Theatre Square | Theatre Square in the capital city of Berland has a rectangular shape with the size *n*<=×<=*m* meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each flagstone is of the size *a*<=×<=*a*.
What is the least number of flagstones needed to pave the... | {"inputs": ["6 6 4", "1 1 1", "2 1 1", "1 2 1", "2 2 1", "2 1 2", "1 1 3", "2 3 4", "1000000000 1000000000 1", "12 13 4", "222 332 5", "1000 1000 10", "1001 1000 10", "100 10001 1000000000", "1000000000 1000000000 1000000000", "1000000000 1000000000 999999999", "1000000000 1000000000 192", "1000000000 987654321 1", "45... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2,260 | codeforces | |
7451485ce70557064845f1b022da2b0b | Elevator | And now the numerous qualifying tournaments for one of the most prestigious Russian contests Russian Codec Cup are over. All *n* participants who have made it to the finals found themselves in a huge *m*-floored 108-star hotel. Of course the first thought to come in a place like this is "How about checking out the elev... | {"inputs": ["7 4\n2 4 3\n1 2 0\n2 2 0\n1 2 1\n4 3 5\n1 2 2\n4 2 0", "5 5\n1 5 4\n1 3 1\n1 3 4\n3 1 5\n4 2 5", "5 5\n1 3 4\n4 4 2\n3 2 1\n2 4 0\n1 5 3", "8 5\n2 2 91\n5 1 97\n5 1 36\n5 4 19\n2 5 50\n4 2 1\n1 4 9\n3 2 32", "7 5\n2 2 85\n4 3 76\n4 1 17\n5 4 70\n2 5 3\n3 3 14\n3 1 51", "5 2\n1 2 0\n2 1 1\n2 2 0\n2 2 5\n2 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
745a11c35b7aa99d52b544581262721d | Strange Game On Matrix | Ivan is playing a strange game.
He has a matrix *a* with *n* rows and *m* columns. Each element of the matrix is equal to either 0 or 1. Rows and columns are 1-indexed. Ivan can replace any number of ones in this matrix with zeroes. After that, his score in the game will be calculated as follows:
1. Initially Ivan's... | {"inputs": ["4 3 2\n0 1 0\n1 0 1\n0 1 0\n1 1 1", "3 2 1\n1 0\n0 1\n0 0", "3 4 2\n0 1 1 1\n1 0 1 1\n1 0 0 1", "3 57 3\n1 0 0 1 1 0 1 1 0 0 0 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 1 0 1 1 1 1 0 1 1 1 0 0 0 1 1 0 0 1 0 0 0 1 1 0 0 1 0\n1 1 0 0 0 1 1 1 0 1 1 0 0 0 0 1 1 0 0 1 0 0 1 1 1 0 1 0 0 0 0 1 1 1 0 0 0 1 0 1 0 0 0 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 37 | codeforces | |
745d4711d6cd7d0f3f5f9cb57cbb1ba9 | Elephant | An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point *x*(*x*<=><=0) of the coordinate line. In one step the elephant can move 1, 2, 3, 4 or 5 positions forward. Determine, what is the minimum number of steps he need to make ... | {"inputs": ["5", "12", "999999", "41", "1000000", "1", "2", "3", "4", "534204", "469569", "502877", "942212", "97", "53", "89", "574", "716", "729", "8901", "3645", "4426", "46573", "86380", "94190", "999990", "999991", "999992", "999993", "999994", "999995", "999996", "999997", "999998"], "outputs": ["1", "3", "200000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 759 | codeforces | |
74746b6772a19f1dff2accd003348e03 | Sonya and Robots | Since Sonya is interested in robotics too, she decided to construct robots that will read and recognize numbers.
Sonya has drawn $n$ numbers in a row, $a_i$ is located in the $i$-th position. She also has put a robot at each end of the row (to the left of the first number and to the right of the last number). Sonya wi... | {"inputs": ["5\n1 5 4 1 3", "7\n1 2 1 1 1 3 2", "10\n2 2 4 4 3 1 1 2 3 2", "15\n1 2 2 1 2 4 2 1 1 6 6 4 2 5 4", "1\n1"], "outputs": ["9", "7", "14", "20", "0"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 126 | codeforces | |
7483de00921fbbd67ba427bdfb4a54c8 | Punctuation | You are given a text that consists of lowercase Latin letters, spaces and punctuation marks (dot, comma, exclamation mark and question mark). A word is defined as a sequence of consecutive Latin letters.
Your task is to add spaces to the text by the following rules:
- if there is no punctuation mark between two word... | {"inputs": ["galileo galilei was an italian physicist ,mathematician,astronomer", "galileo was born in pisa", "jkhksdfhsdfsf", "a a a a a", "ksdfk sdlfsdf sdf sdf sdf", "gdv", "incen q", "k ? gq dad", "ntomzzut !pousysvfg ,rnl mcyytihe hplnqnb", "mck . gq dauqminf wee bazyzy humnv d... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 44 | codeforces | |
74957bef0ae6692daca852a9741e1138 | Traveling Graph | You are given undirected weighted graph. Find the length of the shortest cycle which starts from the vertex 1 and passes throught all the edges at least once. Graph may contain multiply edges between a pair of vertices and loops (edges from the vertex to itself).
The first line of the input contains two integers *n* an... | {"inputs": ["4 6\n1 2 10\n2 3 1000\n3 4 10\n4 1 1000\n4 2 5000\n1 3 2", "2 9\n1 2 9\n1 2 9\n2 1 9\n1 2 8\n2 1 9\n1 2 9\n1 2 9\n1 2 11\n1 2 9", "2 10\n1 2 9\n1 2 9\n2 1 9\n1 2 8\n2 1 9\n1 2 9\n1 2 9\n1 2 11\n1 2 9\n1 2 9", "15 14\n1 2 1\n2 3 1\n2 4 1\n3 5 1\n3 6 1\n4 7 1\n4 8 1\n5 9 1\n5 10 1\n6 11 1\n6 12 1\n7 13 1\n7 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
74b1be24aae77b05b2d4dbcef091a8da | Spiders | One day mum asked Petya to sort his toys and get rid of some of them. Petya found a whole box of toy spiders. They were quite dear to him and the boy didn't want to throw them away. Petya conjured a cunning plan: he will glue all the spiders together and attach them to the ceiling. Besides, Petya knows that the lower t... | {"inputs": ["1\n3 1 2 2 3", "2\n3 1 2 1 3\n4 1 2 2 3 2 4", "2\n5 1 2 2 3 3 4 3 5\n7 3 4 1 2 2 4 4 6 2 7 6 5", "3\n3 1 2 2 3\n5 2 5 5 3 3 4 5 1\n9 6 5 5 9 4 8 4 7 2 1 2 6 2 4 6 3", "7\n2 2 1\n4 1 4 2 3 1 2\n3 3 1 3 2\n5 1 4 3 5 1 2 1 3\n6 4 5 1 3 4 2 3 6 5 1\n7 1 3 3 6 7 4 7 1 5 2 3 5\n10 6 8 2 6 6 3 2 7 2 4 6 10 3 1 6 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 14 | codeforces | |
74c7eb05a7a7c46fb862f9ab7cfa58e0 | Mashmokh and Tokens | Bimokh is Mashmokh's boss. For the following *n* days he decided to pay to his workers in a new way. At the beginning of each day he will give each worker a certain amount of tokens. Then at the end of each day each worker can give some of his tokens back to get a certain amount of money. The worker can save the rest o... | {"inputs": ["5 1 4\n12 6 11 9 1", "3 1 2\n1 2 3", "1 1 1\n1", "1 1 1000000000\n1000000000", "1 1 1000000000\n999999999", "10 1 100000000\n999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999"], "outputs": ["0 2 3 1 1 ", "1 0 1 ", "0 ", "0 ", "999999999 ", "99999999 9999999... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 78 | codeforces | |
750b2e050867ca435456d6232b303fd1 | Ivan and Powers of Two | Ivan has got an array of *n* non-negative integers *a*1,<=*a*2,<=...,<=*a**n*. Ivan knows that the array is sorted in the non-decreasing order.
Ivan wrote out integers 2*a*1,<=2*a*2,<=...,<=2*a**n* on a piece of paper. Now he wonders, what minimum number of integers of form 2*b* (*b*<=≥<=0) need to be added to the pi... | {"inputs": ["4\n0 1 1 1", "1\n3", "1\n0", "1\n2000000000", "1\n1", "26\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2"], "outputs": ["0", "3", "0", "2000000000", "1", "5"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 20 | codeforces | |
752107aaa1473f689aaa56e39034671e | Timofey and cubes | Young Timofey has a birthday today! He got kit of *n* cubes as a birthday present from his parents. Every cube has a number *a**i*, which is written on it. Timofey put all the cubes in a row and went to unpack other presents.
In this time, Timofey's elder brother, Dima reordered the cubes using the following rule. Sup... | {"inputs": ["7\n4 3 7 6 9 1 2", "8\n6 1 4 2 5 6 9 2", "1\n1424", "9\n-7 9 -4 9 -6 11 15 2 -10", "2\n21968 5686", "5\n241218936 -825949895 -84926813 491336344 -872198236", "42\n-557774624 828320986 -345782722 -62979938 -681259411 -945983652 -139095040 832293378 -82572118 432027535 88438103 568183540 961782904 73543295 6... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 222 | codeforces | |
7541acbed93b5dd57610e64bd1571264 | Lazy Security Guard | Your security guard friend recently got a new job at a new security company. The company requires him to patrol an area of the city encompassing exactly *N* city blocks, but they let him choose which blocks. That is, your friend must walk the perimeter of a region whose area is exactly *N* blocks. Your friend is quite ... | {"inputs": ["4", "11", "22", "3", "1024", "101", "30", "1000000", "1", "2", "5", "6", "7", "8", "9", "10", "999000", "999001", "999999", "933206", "718351", "607443", "347887", "246206", "151375", "12639", "3751", "3607", "124", "64", "31", "23", "15", "19", "59637"], "outputs": ["8", "14", "20", "8", "128", "42", "22"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 224 | codeforces | |
754c9237727a83ab77d875525e1bac65 | Pie Rules | You may have heard of the pie rule before. It states that if two people wish to fairly share a slice of pie, one person should cut the slice in half, and the other person should choose who gets which slice. Alice and Bob have many slices of pie, and rather than cutting the slices in half, each individual slice will be ... | {"inputs": ["3\n141 592 653", "5\n10 21 10 21 10", "1\n100000", "50\n100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 68 | codeforces | |
7556993199c339a3be059e3c49eb86dc | I Wanna Be the Guy | There is a game called "I Wanna Be the Guy", consisting of *n* levels. Little X and his friend Little Y are addicted to the game. Each of them wants to pass the whole game.
Little X can pass only *p* levels of the game. And Little Y can pass only *q* levels of the game. You are given the indices of levels Little X can... | {"inputs": ["4\n3 1 2 3\n2 2 4", "4\n3 1 2 3\n2 2 3", "10\n5 8 6 1 5 4\n6 1 3 2 9 4 6", "10\n8 8 10 7 3 1 4 2 6\n8 9 5 10 3 7 2 4 8", "10\n9 6 1 8 3 9 7 5 10 4\n7 1 3 2 7 6 9 5", "100\n75 83 69 73 30 76 37 48 14 41 42 21 35 15 50 61 86 85 46 3 31 13 78 10 2 44 80 95 56 82 38 75 77 4 99 9 84 53 12 11 36 74 39 72 43 89 5... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 291 | codeforces | |
75bd96eaf1d058b3b0acafa7aaf06d1a | Maximum Absurdity | Reforms continue entering Berland. For example, during yesterday sitting the Berland Parliament approved as much as *n* laws (each law has been assigned a unique number from 1 to *n*). Today all these laws were put on the table of the President of Berland, G.W. Boosch, to be signed.
This time mr. Boosch plans to sign ... | {"inputs": ["5 2\n3 6 1 1 6", "6 2\n1 1 1 1 1 1", "6 2\n1 4 1 2 5 6", "4 1\n1 2 2 2", "6 3\n15 20 1 15 43 6", "12 3\n1 2 1 15 2 3 6 8 3 3 8 6", "14 2\n2 1 2 3 1 2 2 3 1 2 2 3 2 3", "2 1\n1 1", "2 1\n1000000000 999999999", "3 1\n100 30 563", "3 1\n547468 78578678 6467834", "4 1\n90000 34567 90000 90001", "4 2\n999999 88... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 53 | codeforces | |
75d7721c34fb451b39638108c261fdfe | Segments | You are given *n* segments on the Ox-axis. You can drive a nail in any integer point on the Ox-axis line nail so, that all segments containing this point, are considered nailed down. If the nail passes through endpoint of some segment, this segment is considered to be nailed too. What is the smallest number of nails ne... | {"inputs": ["2\n0 2\n2 5", "5\n0 3\n4 2\n4 8\n8 10\n7 7", "3\n40 -83\n52 -80\n-21 -4", "4\n67 -88\n37 -62\n-26 91\n-99 -50", "5\n45 58\n22 6\n-32 36\n49 -37\n43 62", "10\n47 -85\n71 40\n-87 64\n76 73\n52 -51\n-20 -57\n-14 -77\n-45 -11\n-56 -48\n81 20", "35\n-47 61\n-73 -15\n9 43\n43 -49\n13 -6\n48 -65\n49 -84\n-6 76\n4... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 19 | codeforces | |
75fe450019cc75c44b9c4a2ed5ad2024 | Chain Reaction | There are *n* beacons located at distinct positions on a number line. The *i*-th beacon has position *a**i* and power level *b**i*. When the *i*-th beacon is activated, it destroys all beacons to its left (direction of decreasing coordinates) within distance *b**i* inclusive. The beacon itself is not destroyed however.... | {"inputs": ["4\n1 9\n3 1\n6 1\n7 4", "7\n1 1\n2 1\n3 1\n4 1\n5 1\n6 1\n7 1", "1\n0 1", "1\n0 1000000", "1\n1000000 1000000", "7\n1 1\n2 1\n3 1\n4 1\n5 1\n6 6\n7 7", "5\n1 1\n3 1\n5 1\n7 10\n8 10", "11\n110 90\n100 70\n90 10\n80 10\n70 1\n60 1\n50 10\n40 1\n30 1\n10 1\n20 1"], "outputs": ["1", "3", "0", "0", "0", "4", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 87 | codeforces | |
7623e6a775ed42e82fa807f998873abf | Checkposts | Your city has *n* junctions. There are *m* one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.
To ensure the security, you have to build some police checkposts. Checkposts can only be built in a junction. A checkpost at junction *i* can protect junction *j... | {"inputs": ["3\n1 2 3\n3\n1 2\n2 3\n3 2", "5\n2 8 0 6 0\n6\n1 4\n1 3\n2 4\n3 4\n4 5\n5 1", "10\n1 3 2 2 1 3 1 4 10 10\n12\n1 2\n2 3\n3 1\n3 4\n4 5\n5 6\n5 7\n6 4\n7 3\n8 9\n9 10\n10 9", "2\n7 91\n2\n1 2\n2 1", "10\n1 1 1 1 1 1 1 2 2 2\n15\n2 3\n2 4\n4 1\n4 7\n4 10\n4 5\n4 8\n2 6\n3 2\n1 2\n7 2\n10 2\n5 2\n8 2\n6 2", "1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
7633fd36fd792dd159c25f0914eed4c8 | King of Thieves | In this problem you will meet the simplified model of game King of Thieves.
In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character, avoiding traps and obstacles on your way.
An interesting feature of the game is that you can design your own levels that wil... | {"inputs": ["16\n.**.*..*.***.**.", "11\n.*.*...*.*.", "53\n*.*.****.*.*......**....**.***.*.*.**.*.*.***...*..*.", "71\n**.**..*****.*.*.*.********.....*****.****.*..***...*.*.*.**.****.**.**", "56\n**.*..*...***.*.**.**..**.*.*.*.**...*.**.**....*...**..", "64\n***.*...*...*.***.....*.....**.*****.*.*...*..*.*..***..... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 54 | codeforces | |
76493a7daaff07951caf248451558065 | Guards In The Storehouse | Polycarp owns a shop in the capital of Berland. Recently the criminal activity in the capital increased, so Polycarp is thinking about establishing some better security in the storehouse of his shop.
The storehouse can be represented as a matrix with *n* rows and *m* columns. Each element of the matrix is either . (an... | {"inputs": ["1 3\n.x.", "2 2\nxx\nxx", "2 2\n..\n..", "3 1\nx\n.\nx", "100 2\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..\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..\n..\n..\n..\n..\n..\n..\n..\n..\n..\n..\n..... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
76669443e7378ca137df9628ed85e6a9 | Fashion in Berland | According to rules of the Berland fashion, a jacket should be fastened by all the buttons except only one, but not necessarily it should be the last one. Also if the jacket has only one button, it should be fastened, so the jacket will not swinging open.
You are given a jacket with *n* buttons. Determine if it is fast... | {"inputs": ["3\n1 0 1", "3\n1 0 0", "3\n1 1 0", "3\n1 1 1", "3\n0 0 1", "3\n0 0 0", "3\n0 1 1", "3\n0 1 0", "2\n0 1", "2\n1 0", "2\n0 0", "2\n1 1", "1\n1", "1\n0", "10\n1 0 1 1 1 1 1 1 1 1", "5\n1 1 1 1 0", "4\n1 0 1 0", "4\n1 1 0 0", "10\n0 0 1 1 1 1 1 1 1 1", "10\n1 1 1 1 1 1 1 1 1 1", "123\n1 1 1 1 1 1 1 1 1 1 1 1 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 166 | codeforces | |
7684443c62d44e19ea93c1ba3f6df7b4 | Levko and Table | Levko loves tables that consist of *n* rows and *n* columns very much. He especially loves beautiful tables. A table is beautiful to Levko if the sum of elements in each row and column of the table equals *k*.
Unfortunately, he doesn't know any such table. Your task is to help him to find at least one of them.
The sin... | {"inputs": ["2 4", "4 7", "1 8", "9 3", "31 581", "100 1000", "100 999", "99 998", "100 997", "81 111", "1 407", "54 341", "92 460", "34 47", "11 547", "100 1", "99 1", "99 2", "2 7", "100 100", "4 3", "3 2"], "outputs": ["4 0 \n0 4 ", "7 0 0 0 \n0 7 0 0 \n0 0 7 0 \n0 0 0 7 ", "8 ", "3 0 0 0 0 0 0 0 0 \n0 3 0 0 0 0 0 0... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 367 | codeforces | |
768e6345e264704e23f22e7840d3742a | none | There is a right triangle with legs of length *a* and *b*. Your task is to determine whether it is possible to locate the triangle on the plane in such a way that none of its sides is parallel to the coordinate axes. All the vertices must have integer coordinates. If there exists such a location, you have to output the... | {"inputs": ["1 1", "5 5", "5 10", "2 2", "5 6", "5 11", "10 15", "935 938", "999 1000", "1000 1000", "15 20", "20 15", "629 865", "45 872", "757 582", "173 588", "533 298", "949 360", "661 175", "728 299", "575 85", "385 505", "755 865", "395 55", "600 175", "280 210", "180 135", "140 105", "440 330", "130 312", "65 15... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 18 | codeforces | |
76bb3f769dfb164c76a4fe5eac98c396 | School | There are *n* students studying in the 6th grade, in group "B" of a berland secondary school. Every one of them has exactly one friend whom he calls when he has some news. Let us denote the friend of the person number *i* by *g*(*i*). Note that the friendships are not mutual, i.e. *g*(*g*(*i*)) is not necessarily equal... | {"inputs": ["3 4\n2 3 1\n1 2 3 4\n1 2 3 4", "8 6\n7 6 4 2 3 5 5 7\n10 4 3 8 9 1\n1 1 1 2 2 2", "2 2\n2 1\n3304501 9446989\n1 1", "7 3\n7 5 5 1 1 1 1\n9034254 4422892 8872331\n1 2 2", "15 10\n15 3 15 10 11 8 12 5 12 1 4 14 2 2 1\n7571484 4599112 1145547 6936854 5801110 425356 2034668 588381 3181461 3390332\n3 3 1 1 3 1 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
76bcef84c53dbedb2f1b4529391130b6 | Thoroughly Bureaucratic Organization | Once *n* people simultaneously signed in to the reception at the recently opened, but already thoroughly bureaucratic organization (abbreviated TBO). As the organization is thoroughly bureaucratic, it can accept and cater for exactly one person per day. As a consequence, each of *n* people made an appointment on one of... | {"inputs": ["5\n4 1\n4 2\n7 3\n1 1\n42 7", "12\n11 4\n9 2\n10000 100\n1000000000 2345\n123456 1234567\n123456 65536\n5 55\n5 3\n2323 10\n999111000 232323\n999888777 777888999\n999888777 777", "17\n1 1000000000\n1000000000 1\n1000000000 1000000000\n1000000000 999999999\n999999999 1000000000\n1 2\n2 1\n2 3\n3 2\n2 100000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
76da8f8730411f205ecf823f2528d55c | none | Throughout Igor K.'s life he has had many situations worthy of attention. We remember the story with the virus, the story of his mathematical career and of course, his famous programming achievements. However, one does not always adopt new hobbies, one can quit something as well.
This time Igor K. got disappointed in ... | {"inputs": ["11 4 3 9", "20 5 2 20", "1 1 1 1", "26 5 2 18", "21 5 1 15", "21 5 1 21", "21 5 8 14", "20 4 1 20", "21 5 1 13", "21 5 4 15", "17 3 1 16", "19 5 7 19", "18 2 1 13", "21 3 6 11", "21 5 3 12", "21 3 6 10", "28 5 4 26", "21 5 6 18", "21 5 4 21", "17 5 6 17", "21 5 9 12", "21 3 6 7", "21 5 7 9", "12 4 5 8", "2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
76e6bb403b4b2b2676a6771e9d9e4d1e | Friends or Not | Polycarpus has a hobby — he develops an unusual social network. His work is almost completed, and there is only one more module to implement — the module which determines friends. Oh yes, in this social network one won't have to add friends manually! Pairs of friends are deduced in the following way. Let's assume that ... | {"inputs": ["4 1\nvasya petya 1\npetya vasya 2\nanya ivan 2\nivan anya 4", "1 1000\na b 0", "2 1\na b 0\nb a 0", "3 1\na b 1\nb c 2\nc d 3", "10 2\nlutdc xfavzancwrokyzzkpco 0\nxfavzancwrokyzzkpco lutdc 1\nlutdc vydvatbnibttqgn 2\nxfavzancwrokyzzkpco vydvatbnibttqgn 2\nvydvatbnibttqgn lutdc 3\nlutdc xfavzancwrokyzzkpco... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
771139a2d1667bd0deb3cbea3e7902e4 | IQ Test | In the city of Ultima Thule job applicants are often offered an IQ test.
The test is as follows: the person gets a piece of squared paper with a 4<=×<=4 square painted on it. Some of the square's cells are painted black and others are painted white. Your task is to repaint at most one cell the other color so that the... | {"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.#.#\n.#.#\n.#.#", "#..#\n.##.\n####\n####", "#.#.\n.###\n#.#.\n.###", "#..#\n.##.\n.##.\n#..... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 221 | codeforces | |
7733ab8e2222578e78c4856a48ff3078 | System of Equations | Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?
You are given a system of equations:
You should count, how many there are pairs of int... | {"inputs": ["9 3", "14 28", "4 20", "18 198", "22 326", "26 104", "14 10", "8 20", "2 8", "20 11", "57 447", "1 1", "66 296", "75 683", "227 975", "247 499", "266 116", "286 916", "307 341", "451 121", "471 921", "502 346", "535 59", "555 699", "747 351", "790 64", "810 704", "855 225", "902 34", "922 514", "971 131", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 522 | codeforces | |
77493b95633982ea7b597a0e3aff9aa0 | Ksusha the Squirrel | Ksusha the Squirrel is standing at the beginning of a straight road, divided into *n* sectors. The sectors are numbered 1 to *n*, from left to right. Initially, Ksusha stands in sector 1.
Ksusha wants to walk to the end of the road, that is, get to sector *n*. Unfortunately, there are some rocks on the road. We know ... | {"inputs": ["2 1\n..", "5 2\n.#.#.", "7 3\n.#.###.", "2 200\n..", "2 1\n..", "2 2\n..", "2 100000\n..", "3 1\n.#.", "3 2\n.#.", "3 10000\n.#."], "outputs": ["YES", "YES", "NO", "YES", "YES", "YES", "YES", "NO", "YES", "YES"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 174 | codeforces | |
77559f3bff47a375c58414034dd838e5 | Bear and Three Balls | Limak is a little polar bear. He has *n* balls, the *i*-th ball has size *t**i*.
Limak wants to give one ball to each of his three friends. Giving gifts isn't easy — there are two rules Limak must obey to make friends happy:
- No two friends can get balls of the same size. - No two friends can get balls of sizes th... | {"inputs": ["4\n18 55 16 17", "6\n40 41 43 44 44 44", "8\n5 972 3 4 1 4 970 971", "3\n959 747 656", "4\n1 2 2 3", "50\n998 30 384 289 505 340 872 223 663 31 929 625 864 699 735 589 676 399 745 635 963 381 75 97 324 612 597 797 103 382 25 894 219 458 337 572 201 355 294 275 278 311 586 573 965 704 936 237 715 543", "50\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 184 | codeforces | |
775bf86700385871a4c415dd98d0e276 | Jon Snow and his Favourite Number | Jon Snow now has to fight with White Walkers. He has *n* rangers, each of which has his own strength. Also Jon Snow has his favourite number *x*. Each ranger can fight with a white walker only if the strength of the white walker equals his strength. He however thinks that his rangers are weak and need to improve. Jon n... | {"inputs": ["5 1 2\n9 7 11 15 5", "2 100000 569\n605 986", "10 10 98\n1 58 62 71 55 4 20 17 25 29", "100 100 96\n11 79 47 73 77 66 50 32 26 38 8 58 45 86 35 49 63 13 35 61 52 44 16 80 32 18 8 4 49 90 78 83 72 3 86 71 96 93 97 60 43 74 58 61 21 96 43 92 31 23 64 60 14 77 27 45 71 27 49 41 40 22 72 50 14 73 72 91 39 54 6... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
77648609db63b536c2fed07fc8dfd61b | Open Communication | Two participants are each given a pair of distinct numbers from 1 to 9 such that there's exactly one number that is present in both pairs. They want to figure out the number that matches by using a communication channel you have access to without revealing it to you.
Both participants communicated to each other a set ... | {"inputs": ["2 2\n1 2 3 4\n1 5 3 4", "2 2\n1 2 3 4\n1 5 6 4", "2 3\n1 2 4 5\n1 2 1 3 2 3", "2 1\n1 2 1 3\n1 2", "4 4\n1 2 3 4 5 6 7 8\n2 3 4 5 6 7 8 1", "3 3\n1 2 5 6 7 8\n2 3 4 5 8 9", "4 3\n1 2 4 5 6 7 8 9\n1 2 8 9 3 1", "3 4\n2 1 8 9 3 1\n1 2 4 5 6 7 8 9", "3 8\n8 9 8 5 9 2\n8 4 8 3 2 6 4 2 4 3 3 7 3 6 1 6", "9 1\n3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 19 | codeforces | |
777032d786f2e0f4f7249941810cd2e2 | Dreamoon and WiFi | Dreamoon is standing at the position 0 on a number line. Drazil is sending a list of commands through Wi-Fi to Dreamoon's smartphone and Dreamoon follows them.
Each command is one of the following two types:
1. Go 1 unit towards the positive direction, denoted as '+' 1. Go 1 unit towards the negative direction, de... | {"inputs": ["++-+-\n+-+-+", "+-+-\n+-??", "+++\n??-", "++++++++++\n+++??++?++", "--+++---+-\n??????????", "+--+++--+-\n??????????", "+\n+", "-\n?", "+\n-", "-\n-", "-\n+", "+\n?", "++++++++++\n++++++++++", "++++++++++\n++++-+++++", "----------\n++++++++++", "++++++++++\n++++??++++", "----------\n+++?++++-+", "+++++++++... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 212 | codeforces | |
77882bc7c3a1570e125a93874785cc09 | none | Imagine that you are in a building that has exactly *n* floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to *n*. Now you're on the floor number *a*. You are very bored, so you want to take the lift. Floor number *b* has a secret lab, the entry is forbidd... | {"inputs": ["5 2 4 1", "5 2 4 2", "5 3 4 1", "2 2 1 1", "10 1 10 2", "2222 1206 1425 2222", "3 2 3 1", "5 1 2 1", "50 48 41 2", "50 25 21 50", "5000 1 100 3", "100 1 30 500", "50 5 2 50", "35 9 10 35", "10 1 3 4", "22 9 18 3", "500 500 498 4999", "300 300 299 300", "100 3 30 5000", "222 187 134 500", "300 299 300 300",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
778b2187fee20fcdab6240e536a76739 | The Text Splitting | You are given the string *s* of length *n* and the numbers *p*,<=*q*. Split the string *s* to pieces of length *p* and *q*.
For example, the string "Hello" for *p*<==<=2, *q*<==<=3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".
Note it is allowed to split the string *s* to the st... | {"inputs": ["5 2 3\nHello", "10 9 5\nCodeforces", "6 4 5\nPrivet", "8 1 1\nabacabac", "1 1 1\n1", "10 8 1\nuTl9w4lcdo", "20 6 4\nfmFRpk2NrzSvnQC9gB61", "30 23 6\nWXDjl9kitaDTY673R5xyTlbL9gqeQ6", "40 14 3\nSOHBIkWEv7ScrkHgMtFFxP9G7JQLYXFoH1sJDAde", "50 16 3\nXCgVJUu4aMQ7HMxZjNxe3XARNiahK303g9y7NV8oN6tWdyXrlu", "60 52 8\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 99 | codeforces | |
779fdfa680ef6b95e64785246e21ff16 | Face Detection | The developers of Looksery have to write an efficient algorithm that detects faces on a picture. Unfortunately, they are currently busy preparing a contest for you, so you will have to do it for them.
In this problem an image is a rectangular table that consists of lowercase Latin letters. A face on the image is a 2<... | {"inputs": ["4 4\nxxxx\nxfax\nxcex\nxxxx", "4 2\nxx\ncf\nae\nxx", "2 3\nfac\ncef", "1 4\nface", "5 5\nwmmwn\nlurcm\nkeetd\nfokon\ncxxgx", "5 5\nkjxbw\neacra\nxefhx\nucmcz\npgtjk", "1 1\np", "2 5\nacdmw\nefazb", "5 2\ndz\nda\nsx\nyu\nzz", "5 5\nxeljd\nwriac\nveief\nlcacf\nbqefn", "5 5\nacnbx\nefacp\nlrefa\norqce\nzvbay"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 260 | codeforces | |
77cd1f091319b7e918a798512706abd9 | Subsegments | Programmer Sasha has recently begun to study data structures. His coach Stas told him to solve the problem of finding a minimum on the segment of the array in , which Sasha coped with. For Sasha not to think that he had learned all, Stas gave him a new task. For each segment of the fixed length Sasha must find the maxi... | {"inputs": ["5 3\n1\n2\n2\n3\n3", "6 4\n3\n3\n3\n4\n4\n2", "10 3\n-55\n-35\n-80\n91\n-96\n-93\n-39\n-77\n4\n29", "10 3\n-13\n26\n-97\n-38\n43\n-12\n80\n3\n8\n45", "10 3\n-84\n25\n-25\n8\n60\n-74\n-98\n48\n-55\n38", "10 3\n-62\n-81\n46\n22\n-84\n19\n-86\n44\n-84\n-73", "10 3\n-6\n2\n79\n-49\n86\n13\n-31\n-71\n57\n93", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
77dd332fafec225b0a001ffa4b0736af | Restoring IPv6 | An IPv6-address is a 128-bit number. For convenience, this number is recorded in blocks of 16 bits in hexadecimal record, the blocks are separated by colons — 8 blocks in total, each block has four hexadecimal digits. Here is an example of the correct record of a IPv6 address: "0124:5678:90ab:cdef:0124:5678:90ab:cdef".... | {"inputs": ["6\na56f:d3:0:0124:01:f19a:1000:00\na56f:00d3:0000:0124:0001::\na56f::0124:0001:0000:1234:0ff0\na56f:0000::0000:0001:0000:1234:0ff0\n::\n0ea::4d:f4:6:0", "20\n0:0:9e39:9:b21:c9b:c:0\n0:0:0:0:0:a27:6b:cb0a\n2:7:4d:b:0:3:2:f401\n17:2dc6::0:89e3:0:dc:0\nca:4:0:0:d6:b999:e:0\n4af:553:b29:dd7:2:5b:0:7\n0:c981:8f... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 41 | codeforces | |
780a1c7b659cc52202d5fb7c7b7d95ba | Collective Mindsets (hard) | Heidi got one brain, thumbs up! But the evening isn't over yet and one more challenge awaits our dauntless agent: after dinner, at precisely midnight, the *N* attendees love to play a very risky game...
Every zombie gets a number *n**i* (1<=≤<=*n**i*<=≤<=*N*) written on his forehead. Although no zombie can see his own... | {"inputs": ["4\n2 1\n1\n2 2\n1\n2 1\n2\n2 2\n2", "4\n2 1\n1\n2 2\n1\n2 1\n2\n2 2\n2", "27\n3 1\n1 1\n3 2\n1 1\n3 3\n1 1\n3 1\n2 1\n3 2\n2 1\n3 3\n2 1\n3 1\n3 1\n3 2\n3 1\n3 3\n3 1\n3 1\n1 2\n3 2\n1 2\n3 3\n1 2\n3 1\n2 2\n3 2\n2 2\n3 3\n2 2\n3 1\n3 2\n3 2\n3 2\n3 3\n3 2\n3 1\n1 3\n3 2\n1 3\n3 3\n1 3\n3 1\n2 3\n3 2\n2 3\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
780ea41ae2abba43273b718c11ef01fa | Kyoya and Colored Balls | Kyoya Ootori has a bag with *n* colored balls that are colored with *k* different colors. The colors are labeled from 1 to *k*. Balls of the same color are indistinguishable. He draws balls from the bag one by one until the bag is empty. He noticed that he drew the last ball of color *i* before drawing the last ball of... | {"inputs": ["3\n2\n2\n1", "4\n1\n2\n3\n4", "10\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100", "5\n10\n10\n10\n10\n10", "11\n291\n381\n126\n39\n19\n20\n3\n1\n20\n45\n2", "1\n1", "13\n67\n75\n76\n80\n69\n86\n75\n86\n81\n84\n73\n72\n76", "25\n35\n43\n38\n33\n47\n44\n40\n36\n41\n42\n33\n30\n49\n42\n62\n39\n40\n35\n43\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 113 | codeforces | |
7817fa3aebed2caadd9283cb701d61ca | Black-and-White Cube | You are given a cube of size *k*<=×<=*k*<=×<=*k*, which consists of unit cubes. Two unit cubes are considered neighbouring, if they have common face.
Your task is to paint each of *k*3 unit cubes one of two colours (black or white), so that the following conditions must be satisfied:
- each white cube has exactly 2 ... | {"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", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
781ae30408322baa7c0802c2f4550202 | String Transformation | You are given a string *s* consisting of |*s*| small english letters.
In one move you can replace any character of this string to the next character in alphabetical order (a will be replaced with b, s will be replaced with t, etc.). You cannot replace letter z with any other letter.
Your target is to make some number... | {"inputs": ["aacceeggiikkmmooqqssuuwwyy", "thereisnoanswer", "jqcfvsaveaixhioaaeephbmsmfcgdyawscpyioybkgxlcrhaxs", "rtdacjpsjjmjdhcoprjhaenlwuvpfqzurnrswngmpnkdnunaendlpbfuylqgxtndhmhqgbsknsy", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "abcdefghijklmnopqrstuvwxxx", "abcdefghijklmnopqrstuvwxya", "aaaaaaaaaaaaaaaaa... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 68 | codeforces | |
7857ee10aa0bd43979386048eba04748 | Tourist's Notes | A tourist hiked along the mountain range. The hike lasted for *n* days, during each day the tourist noted height above the sea level. On the *i*-th day height was equal to some integer *h**i*. The tourist pick smooth enough route for his hike, meaning that the between any two consecutive days height changes by at most ... | {"inputs": ["8 2\n2 0\n7 0", "8 3\n2 0\n7 0\n8 3", "10 10\n1 0\n2 0\n3 0\n4 0\n5 1\n6 2\n7 3\n8 2\n9 3\n10 4", "50 10\n1 42\n7 36\n16 40\n21 40\n26 39\n30 41\n32 41\n36 40\n44 37\n50 41", "50 10\n5 17\n7 15\n10 4\n15 11\n18 13\n21 15\n31 5\n34 13\n40 15\n49 16", "100 50\n1 53\n3 51\n4 50\n6 48\n9 45\n12 48\n14 46\n16 4... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 21 | codeforces | |
786f75d6b052237b13d2da32090caf0a | Berland and the Shortest Paths | There are $n$ cities in Berland. Some pairs of cities are connected by roads. All roads are bidirectional. Each road connects two different cities. There is at most one road between a pair of cities. The cities are numbered from $1$ to $n$.
It is known that, from the capital (the city with the number $1$), you can rea... | {"inputs": ["4 4 3\n1 2\n2 3\n1 4\n4 3", "4 6 3\n1 2\n2 3\n1 4\n4 3\n2 4\n1 3", "5 6 2\n1 2\n1 3\n2 4\n2 5\n3 4\n3 5", "2 1 200000\n2 1", "3 2 100000\n1 2\n2 3", "3 2 100000\n1 2\n1 3", "3 3 1000\n1 2\n2 3\n3 1", "5 6 166666\n1 2\n1 3\n2 4\n2 5\n3 4\n3 5", "5 6 10\n4 5\n3 2\n3 5\n1 3\n5 1\n1 2", "6 9 10\n3 5\n3 2\n1 3\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
7876e81248cf45d60db62213c103a381 | C*++ Calculations | C*++ language is quite similar to C++. The similarity manifests itself in the fact that the programs written in C*++ sometimes behave unpredictably and lead to absolutely unexpected effects. For example, let's imagine an arithmetic expression in C*++ that looks like this (*expression* is the main term):
- *expression... | {"inputs": ["1\n5*a++-3*++a+a++", "3\na+++++a", "-668\n820*a+++402*++a-482*++a", "902\n600*++a+411*a+++20*a++-340*++a-306*++a+485*a++-776*a+++417*a+++70*a++-703*a++", "-215\n840*++a+183*++a-975*++a+301*a+++874*a++", "-211\n849*a++-419*a+++720*++a-543*a+++193*a++-506*++a", "-206\n859*a++-655*a+++466*++a-786*++a+512*a+++... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
787aba56bc9a1aaf3dc9a8864f8cf62f | Timofey and remoduling | Little Timofey likes integers a lot. Unfortunately, he is very young and can't work with very big integers, so he does all the operations modulo his favorite prime *m*. Also, Timofey likes to look for arithmetical progressions everywhere.
One of his birthday presents was a sequence of distinct integers *a*1,<=*a*2,<=.... | {"inputs": ["17 5\n0 2 4 13 15", "17 5\n0 2 4 13 14", "5 3\n1 2 3", "17 8\n7 9 11 13 15 1 3 5", "13 2\n0 11", "3 1\n0", "2 1\n1", "241 120\n235 136 237 28 90 60 27 122 239 59 72 46 180 233 182 21 206 153 97 112 94 219 52 109 31 17 8 152 3 118 191 222 214 119 217 39 33 40 1 164 38 173 42 82 130 229 226 73 44 155 85 41 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
788a3dee5440e886594b2630be6fc988 | none | Filya just learned new geometry object — rectangle. He is given a field consisting of *n*<=×<=*n* unit cells. Rows are numbered from bottom to top with integer from 1 to *n*. Columns are numbered from left to right with integers from 1 to *n*. Cell, located at the intersection of the row *r* and column *c* is denoted a... | {"inputs": ["5\n2 2 2 2\n3 4 3 5", "10\n1 2 4 2\n1 6 4 9", "10\n2 2 4 4\n7 10 9 10", "10\n1 1 10 1\n5 5 5 10", "10\n3 4 10 4\n1 1 10 1", "100\n8 7 90 37\n4 64 4 100", "10\n1 3 1 3\n5 6 5 6", "8\n5 5 5 5\n7 7 7 7", "65536\n56677 37631 57096 58131\n37503 6356 53664 37172", "32768\n17828 4528 27798 14063\n19889 15555 2346... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
78954224f7bdc7ecf9906476c7b560db | Dispute | Valera has *n* counters numbered from 1 to *n*. Some of them are connected by wires, and each of the counters has a special button.
Initially, all the counters contain number 0. When you press a button on a certain counter, the value it has increases by one. Also, the values recorded in all the counters, directly conn... | {"inputs": ["5 5\n2 3\n4 1\n1 5\n5 3\n2 1\n1 1 2 0 2", "4 2\n1 2\n3 4\n0 0 0 0", "3 3\n2 3\n1 3\n1 2\n1 1 3", "4 6\n3 4\n2 3\n2 4\n1 2\n1 3\n4 1\n4 0 2 3", "7 10\n5 4\n1 4\n7 4\n1 2\n6 2\n7 3\n7 2\n5 7\n6 1\n5 1\n3 3 0 3 4 1 4", "9 15\n7 4\n4 6\n3 2\n7 2\n8 1\n9 8\n9 6\n2 8\n7 8\n6 7\n3 6\n7 5\n3 5\n3 7\n1 7\n3 0 5 2 0... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
7897a1fc1ebef585fd78b52d787c82b8 | Igor In the Museum | Igor is in the museum and he wants to see as many pictures as possible.
Museum can be represented as a rectangular field of *n*<=×<=*m* cells. Each cell is either empty or impassable. Empty cells are marked with '.', impassable cells are marked with '*'. Every two adjacent cells of different types (one empty and one i... | {"inputs": ["5 6 3\n******\n*..*.*\n******\n*....*\n******\n2 2\n2 5\n4 3", "4 4 1\n****\n*..*\n*.**\n****\n3 2", "3 3 1\n***\n*.*\n***\n2 2", "5 5 10\n*****\n*...*\n*..**\n*.***\n*****\n2 4\n4 2\n2 2\n2 3\n2 2\n2 2\n2 4\n3 2\n2 2\n2 2", "10 3 10\n***\n*.*\n*.*\n***\n***\n*.*\n*.*\n*.*\n*.*\n***\n2 2\n2 2\n2 2\n2 2\n8 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
78ad365464eb2d196e496497bb74dac6 | 3-palindrome | In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.
He is too selfish, so for a given *n* he wants to obtain a string of *n* characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a su... | {"inputs": ["2", "3", "38", "47", "59", "67", "77", "89", "98", "109", "117", "1", "200000", "100000", "143670", "104217", "17879", "131809", "140873", "77859", "153022", "179227", "182801", "5188", "86539", "12802", "120289", "132866", "133377", "31775", "160397", "161415", "163623", "22942", "134767", "52257", "64905... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 236 | codeforces | |
78cd454c6bfd25122af23d08c5adc899 | Undoubtedly Lucky Numbers | Polycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits *x* and *y*. For example, if *x*<==<=4, and *y*<==<=7, then numbers 47, 744, 4 are lucky.
Let's call a positive integer *a* undoubtedly lucky, if... | {"inputs": ["10", "123", "1", "2", "1000", "1000000000", "999999999", "999999998", "999999997", "909090901", "142498040", "603356456", "64214872", "820040584", "442198", "784262", "642678", "468390", "326806", "940", "356", "68", "132", "72", "89", "1", "3", "4", "5", "6", "7", "8", "9", "101", "102"], "outputs": ["10"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 45 | codeforces | |
78ce6dee4e09ffe09fe48a5bcd2ea123 | Yaroslav and Sequence | Yaroslav has an array, consisting of (2·*n*<=-<=1) integers. In a single operation Yaroslav can change the sign of exactly *n* elements in the array. In other words, in one operation Yaroslav can select exactly *n* array elements, and multiply each of them by -1.
Yaroslav is now wondering: what maximum sum of array el... | {"inputs": ["2\n50 50 50", "2\n-1 -100 -1", "3\n-959 -542 -669 -513 160", "4\n717 473 344 -51 -548 703 -869", "5\n270 -181 957 -509 -6 937 -175 434 -625", "6\n-403 901 -847 -708 -624 413 -293 709 886 445 716", "7\n-236 533 869 903 655 -714 27 890 -311 800 307 -682 665", "8\n-338 134 708 -761 -135 535 631 -354 -259 -973... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 12 | codeforces | |
78d130ce1afd05b3b09a51d2895466ea | Power Consumption Calculation | Tom is interested in power consumption of his favourite laptop. His laptop has three modes. In normal mode laptop consumes *P*1 watt per minute. *T*1 minutes after Tom moved the mouse or touched the keyboard for the last time, a screensaver starts and power consumption changes to *P*2 watt per minute. Finally, after *T... | {"inputs": ["1 3 2 1 5 10\n0 10", "2 8 4 2 5 10\n20 30\n50 100", "3 15 9 95 39 19\n873 989\n1003 1137\n1172 1436", "4 73 2 53 58 16\n51 52\n209 242\n281 407\n904 945", "5 41 20 33 43 4\n46 465\n598 875\n967 980\n1135 1151\n1194 1245", "6 88 28 100 53 36\n440 445\n525 614\n644 844\n1238 1261\n1305 1307\n1425 1434", "7 4... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 171 | codeforces | |
78f4855baf50ff5eef1bbd27a0eaf775 | Buns | Lavrenty, a baker, is going to make several buns with stuffings and sell them.
Lavrenty has *n* grams of dough as well as *m* different stuffing types. The stuffing types are numerated from 1 to *m*. Lavrenty knows that he has *a**i* grams left of the *i*-th stuffing. It takes exactly *b**i* grams of stuffing *i* and ... | {"inputs": ["10 2 2 1\n7 3 2 100\n12 3 1 10", "100 1 25 50\n15 5 20 10", "10 1 5 2\n100 1 2 3", "10 1 5 11\n3 1 3 8", "10 2 11 5\n100 1 3 10\n100 1 2 4", "5 8 6 5\n1 2 5 4\n1 2 6 7\n1 2 3 5\n1 2 1 6\n1 2 8 3\n1 2 2 4\n1 2 5 6\n1 2 7 7", "300 4 100 2\n10 1 24 5\n10 1 25 6\n10 1 26 7\n10 1 27 8", "1 1 1 1\n1 1 1 1", "2 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 33 | codeforces | |
78f83e8784694ae9326e4d91df76bbed | Team Work | You have a team of *N* people. For a particular task, you can pick any non-empty subset of people. The cost of having *x* people for the task is *x**k*.
Output the sum of costs over all non-empty subsets of people.
Only line of input contains two integers *N* (1<=≤<=*N*<=≤<=109) representing total number of people an... | {"inputs": ["1 1", "3 2", "5 3", "12 4", "20 5", "522 4575", "1426 4445", "81 3772", "629 3447", "2202 3497", "2775 4325", "3982 4784", "2156 3417", "902 1932", "728 3537", "739 3857", "1918 4211", "3506 4679", "1000000000 5000", "2500 5000", "158260522 4575", "602436426 4445", "861648772 81", "433933447 629", "2627034... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
78fff4dcbecda8aae8ffe88f4ae1b36f | Tram | The tram in Berland goes along a straight line from the point 0 to the point *s* and back, passing 1 meter per *t*1 seconds in both directions. It means that the tram is always in the state of uniform rectilinear motion, instantly turning around at points *x*<==<=0 and *x*<==<=*s*.
Igor is at the point *x*1. He should... | {"inputs": ["4 2 4\n3 4\n1 1", "5 4 0\n1 2\n3 1", "5 4 0\n5 14\n1 -1", "10 7 2\n7 9\n9 -1", "20 5 19\n163 174\n4 1", "1000 610 733\n226 690\n357 1", "40 31 14\n628 1000\n36 1", "100 20 83\n186 434\n64 -1", "200 179 81\n126 457\n37 -1", "400 30 81\n193 1000\n338 1", "500 397 440\n202 1000\n75 1", "600 443 587\n260 1000\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
792832800768d03ba046bbaf6bc7252b | Beru-taxi | Vasiliy lives at point (*a*,<=*b*) of the coordinate plane. He is hurrying up to work so he wants to get out of his house as soon as possible. New app suggested *n* available Beru-taxi nearby. The *i*-th taxi is located at point (*x**i*,<=*y**i*) and moves with a speed *v**i*.
Consider that each of *n* drivers will m... | {"inputs": ["0 0\n2\n2 0 1\n0 2 2", "1 3\n3\n3 3 2\n-2 3 6\n-2 7 10", "2 2\n10\n8 10 1\n14 18 5\n2 2 1\n4 2 2\n5 2 1\n0 2 1\n2 10 4\n10 2 4\n14 18 20\n14 18 10", "-100 100\n3\n100 100 1\n-100 0 5\n-100 -100 20", "5 5\n4\n20 5 1\n20 5 3\n20 5 5\n20 5 15", "0 0\n6\n12 0 1\n0 12 12\n12 0 6\n12 0 3\n0 12 4\n12 0 2", "0 0\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 19 | codeforces | |
793101446ecf77b43dcb093365a0c277 | Arthur and Table | Arthur has bought a beautiful big table into his new flat. When he came home, Arthur noticed that the new table is unstable.
In total the table Arthur bought has *n* legs, the length of the *i*-th leg is *l**i*.
Arthur decided to make the table stable and remove some legs. For each of them Arthur determined number *d... | {"inputs": ["2\n1 5\n3 2", "3\n2 4 4\n1 1 1", "6\n2 2 1 1 3 3\n4 3 5 5 2 1", "10\n20 1 15 17 11 2 15 3 16 3\n129 114 183 94 169 16 18 104 49 146", "10\n15 16 19 5 14 19 6 17 7 19\n140 183 186 195 67 25 70 56 54 132", "20\n24 15 7 18 6 18 11 22 18 20 28 8 23 17 22 22 23 23 30 23\n24 137 173 189 43 164 2 11 142 153 16 20... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
79517c03da7240d02d74e5c8b15b5af8 | Maximum Xor Secondary | Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers *x*1,<=*x*2,<=...,<=*x**k* (*k*<=><=1) is such maximum element *x**j*, that the following inequality holds: .
The lucky number of the sequence of distinct positive integers *x*1,<=*x*2,<... | {"inputs": ["5\n5 2 1 4 3", "5\n9 8 3 5 7", "10\n76969694 71698884 32888447 31877010 65564584 87864180 7850891 1505323 17879621 15722446", "10\n4547989 39261040 94929326 38131456 26174500 7152864 71295827 77784626 89898294 68006331", "10\n30301275 19973434 63004643 54007648 93722492 91677384 58694045 41546981 15552151 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 20 | codeforces | |
7955c1f6f1073143e4e2612f93654a80 | Little Pony and Harmony Chest | Princess Twilight went to Celestia and Luna's old castle to research the chest from the Elements of Harmony.
A sequence of positive integers *b**i* is harmony if and only if for every two elements of the sequence their greatest common divisor equals 1. According to an ancient book, the key of the chest is a harmony se... | {"inputs": ["5\n1 1 1 1 1", "5\n1 6 4 2 8", "10\n16 3 16 10 12 5 14 14 15 27", "10\n8 7 11 5 17 24 28 18 7 8", "10\n22 17 28 14 14 26 20 28 21 27", "10\n28 13 14 9 26 21 25 16 4 22", "100\n11 27 18 3 26 1 23 2 28 21 28 18 7 26 13 4 12 11 1 29 9 23 6 27 15 6 26 25 11 21 26 29 29 8 18 29 3 24 2 28 7 7 11 23 26 29 30 18 3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
7957d1deb681dae7bde5b711125af628 | Defragmentation | In this problem you have to implement an algorithm to defragment your hard disk. The hard disk consists of a sequence of clusters, numbered by integers from 1 to *n*. The disk has *m* recorded files, the *i*-th file occupies clusters with numbers *a**i*,<=1, *a**i*,<=2, ..., *a**i*,<=*n**i*. These clusters are not nece... | {"inputs": ["7 2\n2 1 2\n3 3 4 5", "7 2\n2 1 3\n3 2 4 5", "2 1\n1 2", "3 1\n2 3 1", "3 2\n1 3\n1 2", "5 3\n1 2\n1 4\n1 5", "7 3\n1 7\n2 6 5\n3 4 3 2", "7 2\n3 1 3 5\n3 2 4 6", "10 1\n5 7 4 6 9 2", "7 2\n2 2 1\n3 3 4 5", "7 2\n2 1 2\n3 4 5 6", "20 5\n7 12 16 14 17 20 4 15\n2 7 8\n1 5\n5 3 6 18 11 2\n4 9 13 19 1", "20 10... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
798e69af66946802a90c8b03fcdb29c4 | Pie or die | Volodya and Vlad play the following game. There are *k* pies at the cells of *n*<=<=×<=<=*m* board. Each turn Volodya moves one pie to the neighbouring (by side) cell. If the pie lies at the border of the board then Volodya can move it outside the board, get the pie and win. After Volodya's move, Vlad bans some edge at... | {"inputs": ["2 2 1\n1 2", "3 4 0", "100 50 2\n50 25\n50 25", "20 20 4\n10 10\n10 10\n10 10\n10 10", "15 15 1\n8 8", "8 8 2\n4 4\n5 5", "100 100 2\n50 96\n51 96", "100 100 2\n50 95\n51 95", "20 20 1\n16 10", "20 20 4\n15 9\n15 10\n15 11\n15 12", "11 11 1\n6 6", "11 11 1\n6 5", "35 13 20\n13 8\n19 8\n24 7\n20 6\n23 7\n23... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
79a38cf64ad5510445ae44b028dbd4aa | Bear and Reverse Radewoosh | Limak and Radewoosh are going to compete against each other in the upcoming algorithmic contest. They are equally skilled but they won't solve problems in the same order.
There will be *n* problems. The *i*-th problem has initial score *p**i* and it takes exactly *t**i* minutes to solve it. Problems are sorted by diff... | {"inputs": ["3 2\n50 85 250\n10 15 25", "3 6\n50 85 250\n10 15 25", "8 1\n10 20 30 40 50 60 70 80\n8 10 58 63 71 72 75 76", "4 1\n3 5 6 9\n1 2 4 8", "4 1\n1 3 6 10\n1 5 7 8", "4 1\n2 4 5 10\n2 3 9 10", "18 4\n68 97 121 132 146 277 312 395 407 431 458 461 595 634 751 855 871 994\n1 2 3 4 9 10 13 21 22 29 31 34 37 38 39 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 292 | codeforces | |
79bee3be5bae0add3e18f78c8efd72b6 | none | It's a beautiful April day and Wallace is playing football with his friends. But his friends do not know that Wallace actually stayed home with Gromit and sent them his robotic self instead. Robo-Wallace has several advantages over the other guys. For example, he can hit the ball directly to the specified point. And ye... | {"inputs": ["4 10 13 10 3 1", "1 4 6 2 2 1", "3 10 15 17 9 2", "4 9 30 3 3 1", "4 9 13 2 3 1", "4 9 13 1 1 1", "1 9 10 6 6 3", "4 9 24 10 3 1", "4 9 20 10 3 1", "1 8 10 8 3 3", "2 9 10 4 6 3", "2 9 10 6 3 3", "1 9 10 7 3 3", "1 9 10 9 5 3", "2 9 10 6 5 3", "1 9 10 5 5 3", "2 9 10 9 3 3", "1 9 10 9 5 3", "1 8 10 3 3 3",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
79e0d3456ed7b662db679a702bb43977 | Letters Removing | Petya has a string of length *n* consisting of small and large English letters and digits.
He performs *m* operations. Each operation is described with two integers *l* and *r* and a character *c*: Petya removes from the string all characters *c* on positions between *l* and *r*, inclusive. It's obvious that the lengt... | {"inputs": ["4 2\nabac\n1 3 a\n2 2 c", "3 2\nA0z\n1 3 0\n1 1 z", "10 4\nagtFrgF4aF\n2 5 g\n4 9 F\n1 5 4\n1 7 a", "9 5\naAAaBBccD\n1 4 a\n5 6 c\n2 3 B\n4 4 D\n2 3 A", "10 10\nhRZQK137KY\n1 10 V\n8 10 g\n2 6 E\n2 2 y\n6 8 J\n1 5 w\n4 6 q\n6 8 K\n2 10 c\n4 6 t", "20 4\n8QYQY1tp6CA02NGnR04s\n1 9 N\n1 10 y\n5 11 t\n6 7 C", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
79f867bd960bd74ebd3a5c734bf1389c | Pasha and Hamsters | Pasha has two hamsters: Arthur and Alexander. Pasha put *n* apples in front of them. Pasha knows which apples Arthur likes. Similarly, Pasha knows which apples Alexander likes. Pasha doesn't want any conflict between the hamsters (as they may like the same apple), so he decided to distribute the apples between the hams... | {"inputs": ["4 2 3\n1 2\n2 3 4", "5 5 2\n3 4 1 2 5\n2 3", "100 69 31\n1 3 4 5 6 7 8 9 10 11 12 14 15 16 17 18 19 20 21 24 26 27 29 31 37 38 39 40 44 46 48 49 50 51 53 55 56 57 58 59 60 61 63 64 65 66 67 68 69 70 71 72 74 76 77 78 79 80 81 82 83 89 92 94 95 97 98 99 100\n2 13 22 23 25 28 30 32 33 34 35 36 41 42 43 45 47... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 283 | codeforces | |
7a03ba5e18ef1df44dc03ac8d8878cde | Fight the Monster | A monster is attacking the Cyberland!
Master Yang, a braver, is going to beat the monster. Yang and the monster each have 3 attributes: hitpoints (*HP*), offensive power (*ATK*) and defensive power (*DEF*).
During the battle, every second the monster's HP decrease by *max*(0,<=*ATK**Y*<=-<=*DEF**M*), while Yang's HP ... | {"inputs": ["1 2 1\n1 100 1\n1 100 100", "100 100 100\n1 1 1\n1 1 1", "50 80 92\n41 51 56\n75 93 12", "76 63 14\n89 87 35\n20 15 56", "12 59 66\n43 15 16\n12 18 66", "51 89 97\n18 25 63\n22 91 74", "72 16 49\n5 21 84\n48 51 88", "74 89 5\n32 76 99\n62 95 36", "39 49 78\n14 70 41\n3 33 23", "11 82 51\n90 84 72\n98 98 43... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
7a050be457f1abb1e33be44a0a8dfabc | Raising Bacteria | You are a lover of bacteria. You want to raise some bacteria in a box.
Initially, the box is empty. Each morning, you can put any number of bacteria into the box. And each night, every bacterium in the box will split into two bacteria. You hope to see exactly *x* bacteria in the box at some moment.
What is the mini... | {"inputs": ["5", "8", "536870911", "1", "343000816", "559980448", "697681824", "41313494", "673935585", "117422204", "954746654", "536838144", "1000000000", "2", "3", "4", "6", "7", "9", "10", "999999999", "999999998", "999999997", "999999996", "999999995", "999999994", "999999993", "999999992", "999999991", "999999990... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 604 | codeforces | |
7a4dd76945e19b3e410c657bd294b6e1 | Bear and Poker | Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are *n* players (including Limak himself) and right now all of them have bids on the table. *i*-th of them has bid with size *a**i* dollars.
Each player can double his bid any number of times and triple his bid any nu... | {"inputs": ["4\n75 150 75 50", "3\n100 150 250", "7\n34 34 68 34 34 68 34", "10\n72 96 12 18 81 20 6 2 54 1", "20\n958692492 954966768 77387000 724664764 101294996 614007760 202904092 555293973 707655552 108023967 73123445 612562357 552908390 914853758 915004122 466129205 122853497 814592742 373389439 818473058", "2\n1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 304 | codeforces | |
7a52b45a3918d9332ab9a559a1953314 | Petr# | Long ago, when Petya was a schoolboy, he was very much interested in the Petr# language grammar. During one lesson Petya got interested in the following question: how many different continuous substrings starting with the *s**begin* and ending with the *s**end* (it is possible *s**begin*<==<=*s**end*), the given string... | {"inputs": ["round\nro\nou", "codeforces\ncode\nforca", "abababab\na\nb", "aba\nab\nba", "abcdefghijklmnopqrstuvwxyz\nabc\nxyz", "aaaaaaaaaaaaaaa\na\na", "aaaaaaaaa\naa\naaa", "rmf\nrm\nf", "kennyhorror\nkenny\nhorror", "itsjustatest\njust\nits", "ololo\ntrololo\nololo", "ololololololololololololololo\no\nl", "includec... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
7a56eef43ec386b74abffa147e261099 | Ice Sculptures | The Berland University is preparing to celebrate the 256-th anniversary of its founding! A specially appointed Vice Rector for the celebration prepares to decorate the campus. In the center of the campus *n* ice sculptures were erected. The sculptures are arranged in a circle at equal distances from each other, so they... | {"inputs": ["8\n1 2 -3 4 -5 5 2 3", "6\n1 -2 3 -4 5 -6", "6\n1 2 3 4 5 6", "4\n1 -10 1 -10", "6\n1 0 1 0 1 0", "12\n1 1 1 1 1 1 1 -1000 1 1 1 1", "3\n-1 -1 -1", "97\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 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
7a78bd250f3e01a2588006385a66a6ee | The Evil Temple and the Moving Rocks | Important: All possible tests are in the pretest, so you shouldn't hack on this problem. So, if you passed pretests, you will also pass the system test.
You are an adventurer currently journeying inside an evil temple. After defeating a couple of weak monsters, you arrived at a square room consisting of tiles forming ... | {"inputs": ["5 5", "3 2", "100 100000"], "outputs": [">...v\nv.<..\n..^..\n>....\n..^.<\n1 1", ">vv\n^<.\n^.<\n1 3", ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>v.\n^v<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<.<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<.... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
7a89f15c9c25f50f7100dea915d05aa5 | none | International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where *y* stands for some number of consequent last digits of the current year. Organizers always pick an abbreviation with non-empty string *y* that has never been used before.... | {"inputs": ["5\nIAO'15\nIAO'2015\nIAO'1\nIAO'9\nIAO'0", "4\nIAO'9\nIAO'99\nIAO'999\nIAO'9999", "1\nIAO'111110", "2\nIAO'0\nIAO'00", "1\nIAO'111111", "1\nIAO'111111111", "1\nIAO'001", "1\nIAO'2000", "1\nIAO'11109999", "1\nIAO'11111", "1\nIAO'100000", "1\nIAO'18999990", "1\nIAO'113098", "1\nIAO'111122", "1\nIAO'1110222",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
7a9a8a7e5402fd8076337a84117a28db | Triangle | Johnny has a younger sister Anne, who is very clever and smart. As she came home from the kindergarten, she told his brother about the task that her kindergartener asked her to solve. The task was just to construct a triangle out of four sticks of different colours. Naturally, one of the sticks is extra. It is not allo... | {"inputs": ["4 2 1 3", "7 2 2 4", "3 5 9 1", "3 1 5 1", "10 10 10 10", "11 5 6 11", "1 1 1 1", "10 20 30 40", "45 25 5 15", "20 5 8 13", "10 30 7 20", "3 2 3 2", "70 10 100 30", "4 8 16 2", "3 3 3 10", "1 5 5 5", "13 25 12 1", "10 100 7 3", "50 1 50 100", "50 1 100 49", "49 51 100 1", "5 11 2 25", "91 50 9 40", "27 53 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 372 | codeforces | |
7aa4872341e638bdc2ec23b356052e20 | Lara Croft and the New Game | You might have heard about the next game in Lara Croft series coming out this year. You also might have watched its trailer. Though you definitely missed the main idea about its plot, so let me lift the veil of secrecy.
Lara is going to explore yet another dangerous dungeon. Game designers decided to use good old 2D e... | {"inputs": ["4 3 0", "4 3 11", "4 3 7", "1000000000 2 1999999999", "1000000000 1000000000 999999999999999999", "1000000000 1000000000 999999999", "1000000000 1000000000 2000000500", "2 2 2", "28 3 1", "2 3 3", "4 6 8", "6 6 18", "4 3 8", "4 3 4", "4 4 10", "4 5 4", "4 3 9", "4 3 6", "4 5 5", "6 4 8", "4 4 12", "10 6 15... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 67 | codeforces | |
7ab2968b04610f2f8b3a9b37df7726eb | Vika and Squares | Vika has *n* jars with paints of distinct colors. All the jars are numbered from 1 to *n* and the *i*-th jar contains *a**i* liters of paint of color *i*.
Vika also has an infinitely long rectangular piece of paper of width 1, consisting of squares of size 1<=×<=1. Squares are numbered 1, 2, 3 and so on. Vika decided ... | {"inputs": ["5\n2 4 2 3 3", "3\n5 5 5", "6\n10 10 10 1 10 10", "1\n167959139", "10\n896619242 805194919 844752453 848347723 816995848 856813612 805194919 833406689 816255448 805194919", "2\n2 3", "2\n10 10", "2\n1111 1110", "3\n100 101 100", "3\n100 100 101", "3\n101 100 100", "4\n2 3 2 2", "4\n1 1 1 1", "4\n100 100 10... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 90 | codeforces | |
7ad1ef546a97f18893db5a42709c135a | Road Improvement | In Berland there are *n* cities and *n*<=-<=1 bidirectional roads. Each road connects some pair of cities, from any city you can get to any other one using only the given roads.
In each city there is exactly one repair brigade. To repair some road, you need two teams based in the cities connected by the road to work s... | {"inputs": ["4\n1 2\n3 4\n3 2", "6\n3 4\n5 4\n3 2\n1 3\n4 6", "8\n1 3\n1 6\n3 4\n6 2\n5 6\n6 7\n7 8", "5\n1 2\n1 3\n1 4\n1 5", "2\n1 2", "2\n2 1", "3\n1 2\n3 2", "3\n1 3\n2 3", "4\n1 4\n1 2\n4 3", "4\n1 2\n1 3\n1 4", "6\n1 2\n1 3\n1 4\n3 5\n4 6", "6\n1 2\n1 3\n1 4\n3 5\n3 6", "8\n1 2\n2 3\n3 4\n1 5\n5 6\n6 7\n1 8", "10... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
7ad6bfee3f30ccca47af9b134d529ac7 | Dasha and Stairs | On her way to programming school tiger Dasha faced her first test — a huge staircase!
The steps were numbered from one to infinity. As we know, tigers are very fond of all striped things, it is possible that it has something to do with their color. So on some interval of her way she calculated two values — the number ... | {"inputs": ["2 3", "3 1", "5 4", "9 9", "85 95", "0 1", "89 25", "74 73", "62 39", "57 57", "100 99", "0 0", "98 100", "99 100", "1 0", "100 0", "0 100", "100 98", "100 100", "0 5", "2 2"], "outputs": ["YES", "NO", "YES", "YES", "NO", "YES", "NO", "YES", "NO", "YES", "YES", "NO", "NO", "YES", "YES", "NO", "NO", "NO", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 204 | codeforces | |
7ada3ad5df947ef2e0f77ab0f870f31c | Paper task | Alex was programming while Valentina (his toddler daughter) got there and started asking many questions about the round brackets (or parenthesis) in the code. He explained her a bit and when she got it he gave her a task in order to finish his code on time.
For the purpose of this problem we consider only strings cons... | {"inputs": ["10\n()()()()()", "7\n)(())()", "1\n(", "2\n))", "15\n(())(()())(()()", "30\n()(())(())(())()(())()()()(()(", "100\n(((((((((((((((((((((((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))))))))))))))))))))", "1\n)", "2\n)(", "2\n((", "3\n(()", "3\n()(", "5\n()(()", "7\n(()(())", "10\n()()((())(",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
7af11cd684cd4b3c73c10f445ad8cc8b | none | Imagine you have an infinite 2D plane with Cartesian coordinate system. Some of the integral points are blocked, and others are not. Two integral points *A* and *B* on the plane are 4-connected if and only if:
- the Euclidean distance between *A* and *B* is one unit and neither *A* nor *B* is blocked; - or there is ... | {"inputs": ["1", "2", "3", "4", "0", "30426905", "38450759", "743404", "3766137", "19863843", "24562258", "24483528", "25329968", "31975828", "2346673", "17082858", "22578061", "17464436", "18855321", "614109", "3107977", "39268638", "31416948", "34609610", "17590047", "12823666", "34714265", "2870141", "15012490", "31... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 11 | codeforces | |
7b29761fa91b3fd359b750e3b402b806 | Add Points | There are *n* points on a straight line, and the *i*-th point among them is located at *x**i*. All these coordinates are distinct.
Determine the number *m* — the smallest number of points you should add on the line to make the distances between all neighboring points equal.
The first line contains a single integer *n*... | {"inputs": ["3\n-5 10 5", "6\n100 200 400 300 600 500", "4\n10 9 0 -1", "3\n1 4 7", "3\n1 4 6", "3\n1 2 6", "3\n1 3 6", "4\n1 2 3 4", "3\n-1000000000 -999999999 1000000000", "3\n-1000000000 999999999 1000000000", "3\n-1000000000 -999999998 1000000000", "3\n-1000000000 999999998 1000000000", "3\n422800963 4663162 694989... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 92 | codeforces | |
7b6630ecc28410fed28db9ce61242dda | Imbalanced Array | You are given an array *a* consisting of *n* elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.
For example, the imbalance value of ... | {"inputs": ["3\n1 4 1", "10\n1 1 1 1 1 1 1 1 1 1", "10\n1 4 4 3 5 2 4 2 4 5", "10\n9 6 8 5 5 2 8 9 2 2", "30\n4 5 2 2 5 2 3 4 3 3 2 1 3 4 4 5 3 3 1 5 2 3 5 4 5 4 4 3 5 2", "30\n2 2 9 1 10 8 3 3 1 4 6 10 2 2 1 4 1 1 1 1 1 2 4 7 6 7 5 10 8 9", "30\n6 19 12 6 25 24 12 2 24 14 10 10 24 19 11 29 10 22 7 1 9 1 2 27 7 24 20 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 14 | codeforces | |
7b72b4b75cf50dfdbb310061b3772773 | Minesweeper | One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he saved world from bombs planted by terrorists, but he rarely won.
Alex has grown up since then, so he easily wins the most difficu... | {"inputs": ["3 3\n111\n1*1\n111", "2 4\n*.*.\n1211", "1 10\n.....1*1..", "1 1\n4", "10 10\n..........\n...111111.\n..13*21*1.\n.12**2111.\n.1*542..11\n.13**1..1*\n..2*31..11\n..111..111\n.......1*1\n.......111", "10 17\n12*2*22123*31....\n2*333*3*4***3211.\n*22*213**4***3*1.\n11111.12224*6*21.\n221..111.14**4311\n**223... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 33 | codeforces | |
7b79384344f556b9724fdd5e9b4aa4b6 | Beautiful Year | It seems like the year of 2013 came only yesterday. Do you know a curious fact? The year of 2013 is the first year after the old 1987 with only distinct digits.
Now you are suggested to solve the following problem: given a year number, find the minimum year number which is strictly larger than the given one and has on... | {"inputs": ["1987", "2013", "1000", "1001", "1234", "5555", "9000", "1111", "8999", "4572", "6666", "2001", "3000", "7712", "8088", "1594", "6016", "8800", "3331", "5090", "2342", "2334", "1123", "8989", "8977", "6869", "8999"], "outputs": ["2013", "2014", "1023", "1023", "1235", "5601", "9012", "1203", "9012", "4573",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 715 | codeforces | |
7b8a429b011c4755f203e29fac2800e6 | Rectangles | You are given *n*<=×<=*m* table. Each cell of the table is colored white or black. Find the number of non-empty sets of cells such that:
1. All cells in a set have the same color. 1. Every two cells in a set share row or column.
The first line of input contains integers *n* and *m* (1<=≤<=*n*,<=*m*<=≤<=50) — the num... | {"inputs": ["1 1\n0", "2 3\n1 0 1\n0 1 0", "2 2\n1 1\n1 1", "1 10\n0 0 0 0 0 0 0 0 0 0", "11 1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1", "10 11\n1 1 0 1 1 0 0 0 1 0 0\n1 0 0 1 1 1 0 0 1 1 0\n0 0 1 0 1 1 0 1 0 1 1\n0 1 1 1 0 1 0 1 0 0 0\n1 1 1 1 1 1 1 0 1 0 0\n1 1 0 1 1 1 1 0 0 1 1\n1 0 1 0 1 0 0 1 1 1 0\n1 1 0 0 0 0 0 1 0 1 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 159 | codeforces | |
7b93a4c1574b65a354e5e4d577e339f6 | Winnie-the-Pooh and honey | As we all know, Winnie-the-Pooh just adores honey. Ones he and the Piglet found out that the Rabbit has recently gotten hold of an impressive amount of this sweet and healthy snack. As you may guess, Winnie and the Piglet asked to come at the Rabbit's place. Thus, there are *n* jars of honey lined up in front of Winnie... | {"inputs": ["3 3\n15 8 10", "1 3\n3", "3 4\n3 8 2", "3 2\n95 25 49", "3 1\n8 3 2", "5 1\n4 7 9 5 7", "8 6\n19 15 1 14 7 2 10 14", "8 5\n5 2 17 12 16 12 17 3", "10 7\n26 11 10 8 5 20 9 27 30 9", "10 10\n20 82 19 82 18 96 40 99 87 2", "10 10\n75 52 78 83 60 31 46 28 33 17", "20 5\n33 45 36 13 46 40 15 11 29 44 43 50 14 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 36 | codeforces | |
7b9a01e874f7194f37722f21c8c656b9 | Even Odds | Being a nonconformist, Volodya is displeased with the current state of things, particularly with the order of natural numbers (natural number is positive integer number). He is determined to rearrange them. But there are too many natural numbers, so Volodya decided to start with the first *n*. He writes down the follow... | {"inputs": ["10 3", "7 7", "7 1", "7 2", "8 5", "8 3", "8 4", "1000000000000 500000000001", "999999999997 499999999999", "999999999999 999999999999", "1000000000000 1", "999999999999 1", "1 1", "1000000000000 1000000000000", "1000000000000 500000000000", "1000000000000 499999999999", "999999999997 499999999998", "61923... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 291 | codeforces | |
7bd10aae4248a44fed5def6fc5d7b76f | Inna and Dima | Inna and Dima bought a table of size *n*<=×<=*m* in the shop. Each cell of the table contains a single letter: "D", "I", "M", "A".
Inna loves Dima, so she wants to go through his name as many times as possible as she moves through the table. For that, Inna acts as follows:
1. initially, Inna chooses some cell of the... | {"inputs": ["1 2\nDI", "2 2\nMA\nID", "5 5\nDIMAD\nDIMAI\nDIMAM\nDDMAA\nAAMID", "1 1\nI", "5 5\nDIMAD\nADDDI\nMDDDM\nIDDDA\nDAMID", "5 5\nAAAAA\nAAAAA\nAAAAA\nAAAAA\nAAAAA", "1 1\nD", "1 4\nDIMA", "4 1\nD\nI\nM\nA", "2 2\nDI\nAM", "2 2\nDI\nMA", "5 5\nDIADD\nDMADD\nDDDID\nAMMMD\nMIDAD", "10 10\nDIDDIMDIDD\nDMDDAADIDD\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
7bdf1792023fed0ee2299b19cea20807 | New Roads | There are *n* cities in Berland, each of them has a unique id — an integer from 1 to *n*, the capital is the one with id 1. Now there is a serious problem in Berland with roads — there are no roads.
That is why there was a decision to build *n*<=-<=1 roads so that there will be exactly one simple path between each pai... | {"inputs": ["7 3 3\n2 3 1", "14 5 6\n4 4 2 2 1", "3 1 1\n2", "6 3 3\n1 2 2", "11 6 4\n1 2 2 1 3 1", "21 10 9\n2 1 3 1 1 1 3 2 3 3", "51 16 31\n1 3 3 3 4 4 3 5 4 1 3 3 3 2 3 5", "1001 179 490\n8 8 6 7 1 6 10 3 7 8 8 7 2 4 9 8 4 5 8 3 5 7 9 10 9 5 2 6 5 3 3 2 9 6 4 2 10 2 3 5 7 4 5 8 3 9 5 9 2 5 4 9 3 8 2 9 6 7 4 4 10 9 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
7bedb5e10e2916d9c08ae8e42bf62636 | Mushroom Gnomes | Once upon a time in the thicket of the mushroom forest lived mushroom gnomes. They were famous among their neighbors for their magic mushrooms. Their magic nature made it possible that between every two neighboring mushrooms every minute grew another mushroom with the weight equal to the sum of weights of two neighbori... | {"inputs": ["2 1 0 657276545\n1 2", "2 1 1 888450282\n1 2", "4 5 0 10000\n1 2 3 4", "4 0 8 78731972\n1 52 76 81", "4 0 8 414790855\n1 88 97 99", "11 10 6 560689961\n2 17 20 24 32 37 38 39 40 61 86", "8 4 9 371687114\n1 7 22 31 35 38 62 84", "4 8 6 398388678\n21 22 78 88", "49 46 48 698397508\n1098 1160 1173 1269 1438 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
7c10d0df3c5615067fece309da99e575 | Maxim and Restaurant | Maxim has opened his own restaurant! The restaurant has got a huge table, the table's length is *p* meters.
Maxim has got a dinner party tonight, *n* guests will come to him. Let's index the guests of Maxim's restaurant from 1 to *n*. Maxim knows the sizes of all guests that are going to come to him. The *i*-th guest'... | {"inputs": ["3\n1 2 3\n3", "9\n2 2 2 2 2 2 2 1 2\n9", "7\n2 1 1 2 1 1 2\n2", "8\n3 1 5 6 1 5 4 4\n7", "2\n1 3\n3", "2\n1 2\n2", "5\n1 2 3 1 2\n3", "9\n1 2 2 7 4 4 1 4 7\n7", "6\n1 1 1 1 1 1\n1", "10\n35 5 7 41 17 27 32 9 45 40\n30", "27\n38 39 19 33 30 42 34 16 40 9 5 31 28 7 24 37 22 46 25 23 21 30 28 24 48 13 37\n24"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
7c36cde070092df3c067bac6429bb832 | Magic Five | There is a long plate *s* containing *n* digits. Iahub wants to delete some digits (possibly none, but he is not allowed to delete all the digits) to form his "magic number" on the plate, a number that is divisible by 5. Note that, the resulting number may contain leading zeros.
Now Iahub wants to count the number of ... | {"inputs": ["1256\n1", "13990\n2", "555\n2", "14\n178", "27755776656210607832788619414635535178188775623838313967013958143619017005079991285469853503718562504927535176713879737569375166451462839457844835806559098448980069427607\n151", "205831218776360805549796263726315728152440389522084825015113219980083245807721536032... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
7c4b50700e3e6704a97d5d9f8e133a5f | Zuma | Genos recently installed the game Zuma on his phone. In Zuma there exists a line of *n* gemstones, the *i*-th of which has color *c**i*. The goal of the game is to destroy all the gemstones in the line as quickly as possible.
In one second, Genos is able to choose exactly one continuous substring of colored gemstones ... | {"inputs": ["3\n1 2 1", "3\n1 2 3", "7\n1 4 4 2 3 2 1", "1\n1", "2\n1 1", "2\n1 2", "8\n1 2 1 3 4 1 2 1", "50\n5 7 5 10 7 9 1 9 10 2 8 3 5 7 3 10 2 3 7 6 2 7 1 2 2 2 4 7 3 5 8 3 4 4 1 6 7 10 5 4 8 1 9 5 5 3 4 4 8 3", "50\n13 17 20 5 14 19 4 17 9 13 10 19 16 13 17 2 18 3 1 9 19 4 19 10 17 12 16 20 10 11 15 10 3 19 8 6 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 24 | codeforces | |
7c74fd35bee1aab8fedb79f0ecc2c005 | Intercity Travelling | Leha is planning his journey from Moscow to Saratov. He hates trains, so he has decided to get from one city to another by car.
The path from Moscow to Saratov can be represented as a straight line (well, it's not that straight in reality, but in this problem we will consider it to be straight), and the distance betwe... | {"inputs": ["2\n1 2", "4\n1 3 3 7", "100\n3 3 3 4 7 8 8 8 9 9 10 12 12 13 14 14 15 15 16 17 17 20 21 21 22 22 23 25 29 31 36 37 37 38 39 40 41 41 41 42 43 44 45 46 46 47 47 49 49 49 51 52 52 53 54 55 59 59 59 60 62 63 63 64 66 69 70 71 71 72 74 76 76 77 77 78 78 79 80 81 81 82 82 84 85 86 87 87 87 89 91 92 92 92 92 97 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 18 | codeforces |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.