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 |
|---|---|---|---|---|---|---|---|---|---|
4c628953952ca885e9bdfe1f8d432e5f | Points | You are given *N* points on a plane. Write a program which will find the sum of squares of distances between all pairs of points.
The first line of input contains one integer number *N* (1<=≤<=*N*<=≤<=100<=000) — the number of points. Each of the following *N* lines contain two integer numbers *X* and *Y* (<=-<=10<=000... | {"inputs": ["4\n1 1\n-1 -1\n1 -1\n-1 1", "1\n6 3", "30\n-7 -12\n-2 5\n14 8\n9 17\n15 -18\n20 6\n20 8\n-13 12\n-4 -20\n-11 -16\n-6 16\n1 -9\n5 -12\n13 -17\n11 5\n8 -9\n-13 5\n19 -13\n-19 -8\n-14 10\n10 3\n-16 -8\n-17 16\n-14 -15\n5 1\n-13 -9\n13 17\n-14 -8\n2 5\n18 5"], "outputs": ["32", "0", "265705"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 19 | codeforces | |
4c6f3c4cf65608d51f3e8cb2edb582fa | Summarize to the Power of Two | A sequence $a_1, a_2, \dots, a_n$ is called good if, for each element $a_i$, there exists an element $a_j$ ($i \ne j$) such that $a_i+a_j$ is a power of two (that is, $2^d$ for some non-negative integer $d$).
For example, the following sequences are good:
- $[5, 3, 11]$ (for example, for $a_1=5$ we can choose $a_2=3... | {"inputs": ["6\n4 7 1 5 4 9", "5\n1 2 3 4 5", "1\n16", "4\n1 1 1 1023", "10\n2 10 9 1 10 4 7 8 5 4", "2\n1 1", "2\n1 6", "6\n1 7 7 7 7 7", "3\n1 2 3", "3\n1 3 3", "2\n3 3", "2\n3 1", "3\n1 2 2", "2\n2 2", "2\n2 1", "3\n1 1 3", "3\n1 3 2", "3\n1 1 2", "1\n1"], "outputs": ["1", "2", "1", "0", "5", "0", "2", "0", "1", "0"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 25 | codeforces | |
4c73f2082dd47092f72be6e744d64e2a | Pursuit For Artifacts | Johnny is playing a well-known computer game. The game are in some country, where the player can freely travel, pass quests and gain an experience.
In that country there are *n* islands and *m* bridges between them, so you can travel from any island to any other. In the middle of some bridges are lying ancient powerfu... | {"inputs": ["6 7\n1 2 0\n2 3 0\n3 1 0\n3 4 1\n4 5 0\n5 6 0\n6 4 0\n1 6", "5 4\n1 2 0\n2 3 0\n3 4 0\n2 5 1\n1 4", "5 6\n1 2 0\n2 3 0\n3 1 0\n3 4 0\n4 5 1\n5 3 0\n1 2", "1 0\n1 1", "2 1\n1 2 1\n1 2", "2 1\n1 2 1\n1 1", "3 2\n1 2 1\n2 3 0\n3 1", "3 2\n1 2 1\n2 3 0\n2 3", "3 3\n1 2 0\n2 3 0\n3 1 1\n2 2", "4 4\n1 2 0\n2 3 0... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
4c9a939d342fd4c12a76fa302d4e427b | Sorting by Subsequences | You are given a sequence *a*1,<=*a*2,<=...,<=*a**n* consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.
Sorting integers in a sub... | {"inputs": ["6\n3 2 1 6 5 4", "6\n83 -75 -49 11 37 62", "1\n1", "2\n1 2", "2\n2 1", "3\n1 2 3", "3\n3 2 1", "3\n3 1 2", "10\n3 7 10 1 9 5 4 8 6 2", "20\n363756450 -204491568 95834122 -840249197 -49687658 470958158 -445130206 189801569 802780784 -790013317 -192321079 586260100 -751917965 -354684803 418379342 -253230108 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 43 | codeforces | |
4c9bcbb129bcfcac01bafaf31161d591 | ucyhf | qd ucyhf yi q fhycu dkcruh mxeiu huluhiu yi q tyvvuhudj fhycu dkcruh. oekh jqia yi je vydt jxu djx ucyhf.
jxu ydfkj sediyiji ev q iydwbu ydjuwuh *d* (1<=≤<=*d*<=≤<=11184) — jxu edu-rqiut ydtun ev jxu ucyhf je vydt.
ekjfkj q iydwbu dkcruh.
Sample Input
1
Sample Output
13
| {"inputs": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "8216", "119", "10618", "6692", "10962", "6848", "4859", "8653", "6826", "10526", "9819", "10844", "7779", "1340", "4020", "2279", "5581", "11107", "7397", "5273", "10476", "7161", "4168", "1438", "6327", "10107", "6399", "11182", "11183", "11184"], "output... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 11 | codeforces | |
4cb7aba01159e7079d9d6d1b8549c5e8 | Elimination | The finalists of the "Russian Code Cup" competition in 2214 will be the participants who win in one of the elimination rounds.
The elimination rounds are divided into main and additional. Each of the main elimination rounds consists of *c* problems, the winners of the round are the first *n* people in the rating list.... | {"inputs": ["1 10\n7 2\n1", "2 2\n2 1\n2", "8 9\n2 2\n3", "5 5\n8 8\n7", "1 8\n8 10\n8", "5 7\n9 1\n8", "35 28\n35 60\n44", "19 76\n91 91\n87", "20 38\n38 70\n58", "2 81\n3 39\n45", "7 63\n18 69\n30", "89 69\n57 38\n15", "3 30\n10 83\n57", "100 3\n93 23\n98", "2 78\n21 24\n88", "40 80\n4 31\n63", "1 48\n89 76\n24", "5 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 21 | codeforces | |
4cc15ba1bf48baf470e3df7be87f7edc | none | Есть *n*-подъездный дом, в каждом подъезде по *m* этажей, и на каждом этаже каждого подъезда ровно *k* квартир. Таким образом, в доме всего *n*·*m*·*k* квартир. Они пронумерованы естественным образом от 1 до *n*·*m*·*k*, то есть первая квартира на первом этаже в первом подъезде имеет номер 1, первая квартира на втором ... | {"inputs": ["4 10 5\n200 6", "3 1 5\n7 2", "100 100 100\n1 1000000", "1000 1000 1000\n1 1000000000", "125 577 124\n7716799 6501425", "624 919 789\n436620192 451753897", "314 156 453\n9938757 14172410", "301 497 118\n11874825 13582548", "491 980 907\n253658701 421137262", "35 296 7\n70033 65728", "186 312 492\n19512588 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
4cc989015af2251b0ec9feb79fcb0189 | The Union of k-Segments | You are given *n* segments on the coordinate axis Ox and the number *k*. The point is satisfied if it belongs to at least *k* segments. Find the smallest (by the number of segments) set of segments on the coordinate axis Ox which contains all satisfied points and no others.
The first line contains two integers *n* and ... | {"inputs": ["3 2\n0 5\n-3 2\n3 8", "3 2\n0 5\n-3 3\n3 8", "1 1\n-1 1", "10 2\n27 96\n-22 45\n-68 26\n46 69\n-91 86\n12 73\n-89 76\n-11 33\n17 47\n-57 78", "10 1\n3 60\n-73 -37\n59 69\n-56 1\n-84 -24\n-14 46\n-65 -23\n-66 -57\n-87 -80\n-21 20", "10 10\n-92 87\n-100 -67\n-88 80\n-82 -59\n-72 81\n-50 30\n30 77\n65 92\n-76... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
4d20c7698eadee9d13c983381c5be7d6 | Vanya and Cards | Vanya loves playing. He even has a special set of cards to play with. Each card has a single integer. The number on the card can be positive, negative and can even be equal to zero. The only limit is, the number on each card doesn't exceed *x* in the absolute value.
Natasha doesn't like when Vanya spends a long time p... | {"inputs": ["3 2\n-1 1 2", "2 3\n-2 -2", "4 4\n1 2 3 4", "2 2\n-1 -1", "15 5\n-2 -1 2 -4 -3 4 -4 -2 -2 2 -2 -1 1 -4 -2", "15 16\n-15 -5 -15 -14 -8 15 -15 -12 -5 -3 5 -7 3 8 -15", "1 4\n-3", "10 7\n6 4 6 6 -3 4 -1 2 3 3", "2 1\n1 -1", "1 1\n0", "8 13\n-11 -1 -11 12 -2 -2 -10 -11", "16 11\n3 -7 7 -9 -2 -3 -4 -2 -6 8 10 7... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 229 | codeforces | |
4d2e7d38f23a5531f3d391346ad788ae | Journey | Recently Irina arrived to one of the most famous cities of Berland — the Berlatov city. There are *n* showplaces in the city, numbered from 1 to *n*, and some of them are connected by one-directional roads. The roads in Berlatov are designed in a way such that there are no cyclic routes between showplaces.
Initially I... | {"inputs": ["4 3 13\n1 2 5\n2 3 7\n2 4 8", "6 6 7\n1 2 2\n1 3 3\n3 6 3\n2 4 2\n4 6 2\n6 5 1", "5 5 6\n1 3 3\n3 5 3\n1 2 2\n2 4 3\n4 5 2", "10 10 100\n1 4 1\n6 4 1\n9 3 2\n2 7 2\n5 8 11\n1 2 8\n4 10 10\n8 9 2\n7 5 8\n3 6 4", "10 10 56\n4 8 5\n9 3 11\n2 5 5\n5 9 9\n3 6 1\n1 4 9\n8 7 7\n6 10 1\n1 6 12\n7 2 9", "4 4 3\n1 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 7 | codeforces | |
4d315db31337800f8068a03044a6854a | Crazy Computer | ZS the Coder is coding on a crazy computer. If you don't type in a word for a *c* consecutive seconds, everything you typed disappear!
More formally, if you typed a word at second *a* and then the next word at second *b*, then if *b*<=-<=*a*<=≤<=*c*, just the new word is appended to other words on the screen. If *b*<... | {"inputs": ["6 5\n1 3 8 14 19 20", "6 1\n1 3 5 7 9 10", "1 1\n1000000000", "5 5\n1 7 12 13 14", "2 1000000000\n1 1000000000", "3 5\n1 10 20", "3 10\n1 2 3", "2 1\n1 100", "3 1\n1 2 10", "2 1\n1 2"], "outputs": ["3", "2", "1", "4", "2", "1", "3", "1", "1", "2"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 455 | codeforces | |
4d461faa69703d521ca3e9d5400fb27e | Om Nom and Dark Park | Om Nom is the main character of a game "Cut the Rope". He is a bright little monster who likes visiting friends living at the other side of the park. However the dark old parks can scare even somebody as fearless as Om Nom, so he asks you to help him.
The park consists of 2*n*<=+<=1<=-<=1 squares connected by roads so... | {"inputs": ["2\n1 2 3 4 5 6", "2\n1 2 3 3 2 2", "1\n39 52", "2\n59 96 34 48 8 72", "3\n87 37 91 29 58 45 51 74 70 71 47 38 91 89", "5\n39 21 95 89 73 90 9 55 85 32 30 21 68 59 82 91 20 64 52 70 6 88 53 47 30 47 34 14 11 22 42 15 28 54 37 48 29 3 14 13 18 77 90 58 54 38 94 49 45 66 13 74 11 14 64 72 95 54 73 79 41 35", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 48 | codeforces | |
4d4743cbbd6fab36d93393b725364698 | Game Outcome | Sherlock Holmes and Dr. Watson played some game on a checkered board *n*<=×<=*n* in size. During the game they put numbers on the board's squares by some tricky rules we don't know. However, the game is now over and each square of the board contains exactly one number. To understand who has won, they need to count the ... | {"inputs": ["1\n1", "2\n1 2\n3 4", "4\n5 7 8 4\n9 5 3 2\n1 6 6 4\n9 5 7 3", "2\n1 1\n1 1", "3\n1 2 3\n4 5 6\n7 8 9", "3\n1 2 3\n3 1 2\n2 3 1", "4\n1 2 3 4\n8 7 6 5\n9 10 11 12\n16 15 14 13", "1\n53", "5\n1 98 22 9 39\n10 9 44 49 66\n79 17 23 8 47\n59 69 72 47 14\n94 91 98 19 54", "1\n31", "1\n92", "5\n61 45 70 19 48\n5... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 139 | codeforces | |
4d5a50f021c4770a7b23556a5ad893bf | String | You are given a string *s*. Each pair of numbers *l* and *r* that fulfill the condition 1<=≤<=*l*<=≤<=*r*<=≤<=|*s*|, correspond to a substring of the string *s*, starting in the position *l* and ending in the position *r* (inclusive).
Let's define the function of two strings *F*(*x*,<=*y*) like this. We'll find a list... | {"inputs": ["aaaa", "abcdef", "abacabadabacaba", "tkth", "eqkrqe", "cwuiax", "hhhhqhqh", "gmxfmcgp", "eleellleeee", "usussubuubbbbs", "lhmpaugvnqzrfxke", "xkkkkkkkkkkkkkkkkxkkkk", "pprppppriiriiiirprppprriir", "jsoxkutcvyshsinfmtrpujedcbmyqlojzco", "emcegmekgnlefkeguqkfffnduqhfhhhndlfhlfdqdncefnn", "ffffdjfddffdjdfffdd... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
4d5a544372c1f78904b64c235df052b3 | Maximum Submatrix 2 | You are given a matrix consisting of digits zero and one, its size is *n*<=×<=*m*. You are allowed to rearrange its rows. What is the maximum area of the submatrix that only consists of ones and can be obtained in the given problem by the described operations?
Let's assume that the rows of matrix *a* are numbered from... | {"inputs": ["1 1\n1", "2 2\n10\n11", "4 3\n100\n011\n000\n101", "11 16\n0111110101100011\n1000101100010000\n0010110110010101\n0110110010110010\n0011101101110000\n1001100011010111\n0010011111111000\n0100100100111110\n1001000000100111\n0110000011001000\n1011111011010000", "19 12\n110001100110\n100100000000\n101011001111\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
4d7ccba00f2546ab87348b15d1ccaedd | Palindrome Transformation | Nam is playing with a string on his computer. The string consists of *n* lowercase English letters. It is meaningless, so Nam decided to make the string more beautiful, that is to make it be a palindrome by using 4 arrow keys: left, right, up, down.
There is a cursor pointing at some symbol of the string. Suppose that... | {"inputs": ["8 3\naeabcaez", "8 3\nabcddcbb", "4 4\nrkoa", "39 30\nyehuqwaffoiyxhkmdipxroolhahbhzprioobxfy", "40 23\nvwjzsgpdsopsrpsyccavfkyyahdgkmdxrquhcplw", "10 5\nabcdeedcba", "5 5\npjfjb", "57 9\nibkypcbtpdlhhpmghwrmuwaqoqxxexxqoqawumrwhgmphhldixezvfpqh", "10 6\nabcdefdcba", "167 152\nvqgjxbuxevpqbpnuyxktgpwdgyebn... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
4d80ebfc6443ce589574ba07fc4ccc26 | Lucky Permutation Triple | Bike is interested in permutations. A permutation of length *n* is an integer sequence such that each integer from 0 to (*n*<=-<=1) appears exactly once in it. For example, [0,<=2,<=1] is a permutation of length 3 while both [0,<=2,<=2] and [1,<=2,<=3] is not.
A permutation triple of permutations of length *n* (*a*,<=... | {"inputs": ["5", "2", "8", "9", "2", "77", "6", "87", "72", "1", "23", "52", "32", "25", "54", "39", "20", "53", "34", "23", "37123", "41904", "46684", "67817", "72598", "85891", "74320", "11805", "16586", "5014", "73268", "61697", "99182", "79771", "68199", "5684", "10465", "31598", "36379", "16968", "93061", "73650",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 112 | codeforces | |
4d8d291a20665d34f57ee85c1c0b09e5 | Nuts | You have *a* nuts and lots of boxes. The boxes have a wonderful feature: if you put *x* (*x*<=≥<=0) divisors (the spacial bars that can divide a box) to it, you get a box, divided into *x*<=+<=1 sections.
You are minimalist. Therefore, on the one hand, you are against dividing some box into more than *k* sections. On ... | {"inputs": ["3 10 3 3", "3 10 1 3", "100 100 1 1000", "5 347 20 1", "6 978 10 5", "6 856 50 35", "8 399 13 36", "4 787 48 4", "4 714 7 6", "7 915 12 24", "8 995 3 28", "10 267 4 48", "10 697 1 34", "7 897 49 42", "10 849 3 28", "477 492 438 690", "461 790 518 105", "510 996 830 417", "763 193 388 346", "958 380 405 434... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 66 | codeforces | |
4d968990515143126bf1c953554bd7af | Bottles | Nick has *n* bottles of soda left after his birthday. Each bottle is described by two values: remaining amount of soda *a**i* and bottle volume *b**i* (*a**i*<=≤<=*b**i*).
Nick has decided to pour all remaining soda into minimal number of bottles, moreover he has to do it as soon as possible. Nick spends *x* seconds t... | {"inputs": ["4\n3 3 4 3\n4 7 6 5", "2\n1 1\n100 100", "5\n10 30 5 6 24\n10 41 7 8 24", "1\n1\n100", "1\n100\n100", "1\n50\n100", "10\n18 42 5 1 26 8 40 34 8 29\n18 71 21 67 38 13 99 37 47 76", "20\n24 22 4 34 76 13 78 1 81 51 72 11 25 46 22 33 60 42 25 19\n40 81 10 34 84 16 90 38 99 81 100 19 79 65 26 80 62 47 76 47", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 16 | codeforces | |
4d9ab805a078033afdc5d734124742b1 | Bank Hacking | Although Inzane successfully found his beloved bone, Zane, his owner, has yet to return. To search for Zane, he would need a lot of money, of which he sadly has none. To deal with the problem, he has decided to hack the banks.
There are *n* banks, numbered from 1 to *n*. There are also *n*<=-<=1 wires connecting the b... | {"inputs": ["5\n1 2 3 4 5\n1 2\n2 3\n3 4\n4 5", "7\n38 -29 87 93 39 28 -55\n1 2\n2 5\n3 2\n2 4\n1 7\n7 6", "5\n1 2 7 6 7\n1 5\n5 3\n3 4\n2 4", "3\n2 2 2\n3 2\n1 2", "3\n999397 999397 999397\n2 3\n2 1", "5\n1000000000 0 1000000000 0 1000000000\n1 2\n2 3\n3 4\n4 5", "10\n-1000000000 -1000000000 -1000000000 -1000000000 -1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 7 | codeforces | |
4dc3104dd6c4d9f7b9c8e2f32e3e753a | Letters Cyclic Shift | You are given a non-empty string *s* consisting of lowercase English letters. You have to pick exactly one non-empty substring of *s* and shift all its letters 'z' 'y' 'x' 'b' 'a' 'z'. In other words, each character is replaced with the previous character of English alphabet and 'a' is replaced with 'z'.
What is ... | {"inputs": ["codeforces", "abacaba", "babbbabaababbaa", "bcbacaabcababaccccaaaabacbbcbbaa", "cabaccaacccabaacdbdcbcdbccbccbabbdadbdcdcdbdbcdcdbdadcbcda", "a", "eeeedddccbceaabdaecaebaeaecccbdeeeaadcecdbeacecdcdcceabaadbcbbadcdaeddbcccaaeebccecaeeeaebcaaccbdaccbdcadadaaeacbbdcbaeeaecedeeeedadec", "fddfbabadaadaddfbfecad... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 56 | codeforces | |
4e08ca09a438f1950115137022731cbe | Pens And Days Of Week | Stepan has *n* pens. Every day he uses them, and on the *i*-th day he uses the pen number *i*. On the (*n*<=+<=1)-th day again he uses the pen number 1, on the (*n*<=+<=2)-th — he uses the pen number 2 and so on.
On every working day (from Monday to Saturday, inclusive) Stepan spends exactly 1 milliliter of ink of the... | {"inputs": ["3\n3 3 3", "5\n5 4 5 4 4", "28\n2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033", "7\n10 10 10 10 10 10 10", "28\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
4e1001b37563a9d7ff5a7f598df7bd5e | Arithmetic Progression | Everybody knows what an arithmetic progression is. Let us remind you just in case that an arithmetic progression is such sequence of numbers *a*1,<=*a*2,<=...,<=*a**n* of length *n*, that the following condition fulfills:
For example, sequences [1, 5], [10], [5, 4, 3] are arithmetic progressions and sequences [1, 3, ... | {"inputs": ["3\n4 1 7", "1\n10", "4\n1 3 5 9", "4\n4 3 4 5", "2\n2 4", "4\n1 3 4 5", "2\n3 3", "2\n13 2", "5\n2 2 2 2 2", "6\n11 1 7 9 5 13", "2\n100000000 1", "5\n2 3 1 4 6", "5\n1 2 2 3 4", "3\n1 4 2", "3\n8 8 8", "5\n2 2 2 2 3", "1\n100000000", "20\n27 6 3 18 54 33 9 15 39 12 57 48 21 51 60 30 24 36 42 45", "40\n100... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 14 | codeforces | |
4e13badfe8593ea28f7db56aa201e76c | Median on Segments (General Case Edition) | You are given an integer sequence $a_1, a_2, \dots, a_n$.
Find the number of pairs of indices $(l, r)$ ($1 \le l \le r \le n$) such that the value of median of $a_l, a_{l+1}, \dots, a_r$ is exactly the given number $m$.
The median of a sequence is the value of an element which is in the middle of the sequence after s... | {"inputs": ["5 4\n1 4 5 60 4", "3 1\n1 1 1", "15 2\n1 2 3 1 2 3 1 2 3 1 2 3 1 2 3", "1 1\n1", "2 1\n1 2", "2 1\n2 1", "2 2\n1 2", "2 2\n2 1", "3 1\n1 2 3", "3 1\n1 3 2", "3 1\n2 1 3", "3 1\n2 3 1", "3 1\n3 1 2", "3 1\n3 2 1", "2 2\n1 1", "3 2\n1 1 2", "2 1\n1 1", "1 1\n2", "2 2\n4 1", "3 3\n5 5 3", "4 3\n3 5 2 3", "5 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
4e1984b93f1c4fa1a4de130e3bd4e45c | Bipartite Checking | You are given an undirected graph consisting of *n* vertices. Initially there are no edges in the graph. Also you are given *q* queries, each query either adds one undirected edge to the graph or removes it. After each query you have to check if the resulting graph is bipartite (that is, you can paint all vertices of t... | {"inputs": ["3 5\n2 3\n1 3\n1 2\n1 2\n1 2", "5 10\n1 5\n2 5\n2 4\n1 4\n4 5\n2 4\n2 5\n1 4\n2 3\n1 2", "10 20\n1 10\n5 7\n1 2\n3 5\n3 6\n4 9\n3 4\n6 9\n4 8\n6 9\n7 8\n3 8\n7 10\n2 7\n3 7\n5 9\n6 7\n4 6\n2 10\n8 10", "10 30\n5 6\n5 9\n4 9\n6 7\n7 9\n3 10\n5 6\n5 7\n6 10\n2 4\n2 6\n2 5\n3 7\n1 8\n8 9\n3 4\n3 5\n1 9\n6 7\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
4e220ac1005c900d81bf721ad9ab46cb | Devu and his Brother | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays *a* and *b* by their father. The array *a* is given to Devu and *b* to his brother.
As Devu is really a naughty kid, he wants the minimum value of his array *a* should be at least as much... | {"inputs": ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2", "10 10\n23 100 38 38 73 54 59 69 44 86\n100 100 100 100 100 100 100 100 100 100", "1 1\n401114\n998223974", "1 1\n100\n4", "1 1\n100\n183299", "1 1\n999999999\n1000000000", "1 1\n1000000000\n1000000000", "1 1\n1\n2", "1 1\n1\n1", "1 1\n2\n1", "1 1\n1\n2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 24 | codeforces | |
4e2f2585b450362d7e2a53f3e8966fe1 | none | It's another Start[c]up finals, and that means there is pizza to order for the onsite contestants. There are only 2 types of pizza (obviously not, but let's just pretend for the sake of the problem), and all pizzas contain exactly *S* slices.
It is known that the *i*-th contestant will eat *s**i* slices of pizza, and ... | {"inputs": ["3 12\n3 5 7\n4 6 7\n5 9 5", "6 10\n7 4 7\n5 8 8\n12 5 8\n6 11 6\n3 3 7\n5 9 6", "1 100\n97065 97644 98402", "1 100000\n1 82372 5587", "25 6\n1 10 5\n1 8 4\n1 8 2\n4 8 9\n3 2 8\n1 9 5\n2 10 10\n3 9 6\n3 5 4\n2 7 8\n2 3 2\n2 6 8\n3 7 8\n4 3 7\n1 8 1\n3 6 4\n3 2 8\n2 2 1\n4 8 8\n4 8 4\n3 10 2\n3 6 6\n2 2 5\n1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
4e6946d661b5320cd47b3c77431ea1bd | Food on the Plane | A new airplane SuperPuperJet has an infinite number of rows, numbered with positive integers starting with 1 from cockpit to tail. There are six seats in each row, denoted with letters from 'a' to 'f'. Seats 'a', 'b' and 'c' are located to the left of an aisle (if one looks in the direction of the cockpit), while seats... | {"inputs": ["1f", "2d", "4a", "5e", "2c", "1b", "1000000000000000000d", "999999999999999997a", "1c", "1d", "1e", "1a", "2a", "2b", "2e", "2f", "3a", "3b", "3c", "3d", "3e", "3f", "4b", "4c", "4d", "4e", "4f", "999999997a", "999999997b", "999999997c", "999999997d", "999999997e", "999999997f", "999999998a", "999999998b",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 101 | codeforces | |
4e6f6cbabbc99f8cca4697f102ddcb4a | Kyoya and Photobooks | Kyoya Ootori is selling photobooks of the Ouran High School Host Club. He has 26 photos, labeled "a" to "z", and he has compiled them into a photo booklet with some photos in some order (possibly with some photos being duplicated). A photo booklet can be described as a string of lowercase letters, consisting of the pho... | {"inputs": ["a", "hi", "y", "kgan", "zoabkyuvus", "spyemhyznjieyhhbk", "xulsyfkuizjauadjjopu", "e", "zv", "jgv", "zsfo", "jselr", "dwemig", "mddoxsf", "jgirkrmi", "spkxurcum", "fykkiubdkt", "fznbcxsxygs", "qcrvrdqcbtou", "qktrbjzrqgmlr", "foamodbvptlxxg", "ydzpjhsidipricw", "lpfpndmjfvqejdgf", "ofkvparuvjtggnmab", "xxn... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 398 | codeforces | |
4e7689d6c8eafdd03fd8c880eb071bcf | Enemy is weak | The Romans have attacked again. This time they are much more than the Persians but Shapur is ready to defeat them. He says: "A lion is never afraid of a hundred sheep".
Nevertheless Shapur has to find weaknesses in the Roman army to defeat them. So he gives the army a weakness number.
In Shapur's opinion the weaknes... | {"inputs": ["3\n3 2 1", "3\n2 3 1", "4\n10 8 3 1", "4\n1 5 4 3", "9\n10 9 5 6 8 3 4 7 11", "7\n11 3 8 4 2 9 6", "6\n2 1 10 7 3 5", "4\n1 5 3 10", "3\n2 7 11", "5\n4 11 7 5 10", "72\n685 154 298 660 716 963 692 257 397 974 92 191 519 838 828 957 687 776 636 997 101 800 579 181 691 256 95 531 333 347 803 682 252 655 297 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 21 | codeforces | |
4e7ef17cfdabf27d2d245b8f76ac89d4 | Tetrahedron | You are given a tetrahedron. Let's mark its vertices with letters *A*, *B*, *C* and *D* correspondingly.
An ant is standing in the vertex *D* of the tetrahedron. The ant is quite active and he wouldn't stay idle. At each moment of time he makes a step from one vertex to another one along some edge of the tetrahedron. ... | {"inputs": ["2", "4", "1", "3", "5", "6", "7", "8", "9", "10", "15", "30", "10000000", "100", "300", "900", "1500", "3000", "5000", "10000", "50000", "90000", "99999", "100000", "300000", "800000", "1000000", "4000000", "9000000", "9999999", "1000000", "9999999", "10000000", "9999998", "30", "31"], "outputs": ["3", "21... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 129 | codeforces | |
4e93562b61be1dc35e16228296a50a7a | Jumping Ball | In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of *n* bumpers. The bumpers are numbered with integers from 1 to *n* from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at pos... | {"inputs": ["4\n<<><", "5\n>>>>>", "4\n>><<", "3\n<<>", "3\n<<<", "3\n><<", "1\n<", "2\n<>", "3\n<>>", "3\n><>", "2\n><", "2\n>>", "2\n<<", "1\n>", "3\n>><", "3\n>>>", "3\n<><", "10\n<<<><<<>>>", "20\n><><<><<<>>>>>>>>>>>", "20\n<<<<<<<<<<><<<<>>>>>", "50\n<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>", "100\n<<<<... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 163 | codeforces | |
4e9884823cc182d8bcd7b08538d77a54 | MUH and Sticks | Two polar bears Menshykov and Uslada from the St.Petersburg zoo and elephant Horace from the Kiev zoo got six sticks to play with and assess the animals' creativity. Menshykov, Uslada and Horace decided to make either an elephant or a bear from those sticks. They can make an animal from sticks in the following way:
-... | {"inputs": ["4 2 5 4 4 4", "4 4 5 4 4 5", "1 2 3 4 5 6", "5 5 5 5 5 5", "1 1 1 2 3 5", "1 1 1 1 1 1", "9 9 9 9 9 9", "1 8 9 1 1 1", "9 9 9 1 9 9", "1 2 3 8 9 7", "5 5 5 6 6 6", "1 1 2 2 3 4", "4 4 4 4 4 2", "2 2 3 3 4 4", "4 4 4 4 4 5", "1 1 2 2 2 2", "1 2 5 5 5 5", "4 4 2 2 2 2", "1 1 1 1 1 2", "2 2 4 4 4 4", "4 4 4 4... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 200 | codeforces | |
4eb717ee9cf01551ebb483e88ba4b9f5 | Vladik and Entertaining Flags | In his spare time Vladik estimates beauty of the flags.
Every flag could be represented as the matrix *n*<=×<=*m* which consists of positive integers.
Let's define the beauty of the flag as number of components in its matrix. We call component a set of cells with same numbers and between any pair of cells from that s... | {"inputs": ["4 5 4\n1 1 1 1 1\n1 2 2 3 3\n1 1 1 2 5\n4 4 5 5 5\n1 5\n2 5\n1 2\n4 5", "5 2 9\n6 1\n6 6\n6 6\n6 6\n5 6\n1 2\n1 1\n1 2\n1 2\n1 2\n1 1\n1 1\n1 2\n1 1", "5 4 10\n5 5 5 5\n5 5 5 5\n5 5 5 5\n5 5 5 5\n5 5 5 5\n2 4\n2 2\n1 2\n1 4\n1 1\n1 3\n2 4\n2 3\n1 3\n3 3", "8 4 12\n7 20 20 29\n29 7 29 29\n29 20 20 29\n29 20... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
4ec79af96774776f3541a3c3c00f4d6a | Mike and Foam | Mike is a bartender at Rico's bar. At Rico's, they put beer glasses in a special shelf. There are *n* kinds of beer at Rico's numbered from 1 to *n*. *i*-th kind of beer has *a**i* milliliters of foam on it.
Maxim is Mike's boss. Today he told Mike to perform *q* queries. Initially the shelf is empty. In each request,... | {"inputs": ["5 6\n1 2 3 4 6\n1\n2\n3\n4\n5\n1", "3 3\n151790 360570 1\n2\n3\n3", "1 1\n1\n1", "5 10\n1 1 1 1 1\n1\n2\n3\n4\n5\n5\n4\n3\n2\n1", "1 2\n499590\n1\n1"], "outputs": ["0\n1\n3\n5\n6\n2", "0\n1\n0", "0", "0\n1\n3\n6\n10\n6\n3\n1\n0\n0", "0\n0"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
4ecaefff8877a36ffd6fb1febd12369d | The Untended Antiquity | Adieu l'ami.
Koyomi is helping Oshino, an acquaintance of his, to take care of an open space around the abandoned Eikou Cram School building, Oshino's makeshift residence.
The space is represented by a rectangular grid of *n*<=×<=*m* cells, arranged into *n* rows and *m* columns. The *c*-th cell in the *r*-th row is ... | {"inputs": ["5 6 5\n1 2 2 4 5\n1 3 3 3 3\n3 4 4 1 1\n2 2 2 4 5\n3 1 1 4 4", "2500 2500 8\n1 549 1279 1263 2189\n1 303 795 1888 2432\n1 2227 622 2418 1161\n3 771 2492 1335 1433\n1 2017 2100 2408 2160\n3 48 60 798 729\n1 347 708 1868 792\n3 1940 2080 377 1546", "3 3 5\n3 1 3 1 3\n3 1 1 3 1\n1 2 2 2 2\n3 2 3 2 2\n3 1 1 2 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
4ed5cab6a6a8f2e20270f96bf0b11ab9 | You're Given a String... | You're given a string of lower-case Latin letters. Your task is to find the length of its longest substring that can be met in the string at least twice. These occurrences can overlap (see sample test 2).
The first input line contains the string. It's guaranteed, that the string is non-empty, consists of lower-case Lat... | {"inputs": ["abcd", "ababa", "zzz", "kmmm", "wzznz", "qlzazaaqll", "lzggglgpep", "iegdlraaidefgegiagrdfhihe", "esxpqmdrtidgtkxojuxyrcwxlycywtzbjzpxvbngnlepgzcaeg", "garvpaimjdjiivamusjdwfcaoswuhxyyxvrxzajoyihggvuxumaadycfphrzbprraicvjjlsdhojihaw", "ckvfndqgkmhcyojaqgdkenmbexufryhqejdhctxujmtrwkpbqxufxamgoeigzfyzbhevpbk... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 147 | codeforces | |
4eddd3363623be37a94dbf0b2b374a00 | Cowslip Collections | In an attempt to make peace with the Mischievious Mess Makers, Bessie and Farmer John are planning to plant some flower gardens to complement the lush, grassy fields of Bovinia. As any good horticulturist knows, each garden they plant must have the exact same arrangement of flowers. Initially, Farmer John has *n* diffe... | {"inputs": ["3 3 2\n4\n6\n9\n8\n6", "4 1 2\n6\n5\n4\n3\n2\n1", "3 3 3\n6\n8\n10\n12\n14\n16", "1 1 1\n1\n1", "10 10 10\n10\n10\n10\n10\n10\n10\n10\n10\n10\n10\n10\n10\n10\n10\n10\n10\n10\n10\n10\n10", "7 1 9\n3\n6\n7\n2\n10\n8\n1\n3\n9\n2\n9\n10\n2\n4\n5\n2", "5 1 7\n10\n8\n4\n5\n8\n3\n9\n3\n9\n3\n10\n1", "7 2 8\n2\n5\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
4ee030eb81b88d70cace434a5be31ced | Multipliers | Ayrat has number *n*, represented as it's prime factorization *p**i* of size *m*, i.e. *n*<==<=*p*1·*p*2·...·*p**m*. Ayrat got secret information that that the product of all divisors of *n* taken modulo 109<=+<=7 is the password to the secret data base. Now he wants to calculate this value.
The first line of the input... | {"inputs": ["2\n2 3", "3\n2 3 2", "1\n2017", "2\n63997 63997", "5\n11 7 11 7 11", "5\n2 2 2 2 2", "4\n3 3 3 5", "6\n101 103 107 109 101 103", "10\n3 3 3 3 3 3 3 3 3 3", "5\n7 5 2 3 13", "23\n190979 191627 93263 72367 52561 188317 198397 24979 70313 105239 86263 78697 6163 7673 84137 199967 14657 84391 101009 16231 1751... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 12 | codeforces | |
4efe90f9fc3fbf649ac705ac3ad803c1 | Multitasking | Iahub wants to enhance his multitasking abilities. In order to do this, he wants to sort *n* arrays simultaneously, each array consisting of *m* integers.
Iahub can choose a pair of distinct indices *i* and *j* (1<=≤<=*i*,<=*j*<=≤<=*m*,<=*i*<=≠<=*j*). Then in each array the values at positions *i* and *j* are swapped ... | {"inputs": ["2 5 0\n1 3 2 5 4\n1 4 3 2 5", "3 2 1\n1 2\n2 3\n3 4", "2 5 0\n836096 600367 472071 200387 79763\n714679 505282 233544 157810 152591", "2 5 1\n331081 525217 574775 753333 840639\n225591 347017 538639 620341 994088", "1 1 0\n1", "1 1 1\n1", "2 1 0\n1\n2", "1 2 1\n2 1", "2 2 0\n2 1\n3 1", "2 2 0\n2 1\n1 3", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 28 | codeforces | |
4f3f1b3886bf8084ebd7c68cecda1017 | Ring road | Nowadays the one-way traffic is introduced all over the world in order to improve driving safety and reduce traffic jams. The government of Berland decided to keep up with new trends. Formerly all *n* cities of Berland were connected by *n* two-way roads in the ring, i. e. each city was connected directly to exactly tw... | {"inputs": ["3\n1 3 1\n1 2 1\n3 2 1", "3\n1 3 1\n1 2 5\n3 2 1", "6\n1 5 4\n5 3 8\n2 4 15\n1 6 16\n2 3 23\n4 6 42", "4\n1 2 9\n2 3 8\n3 4 7\n4 1 5", "5\n5 3 89\n2 3 43\n4 2 50\n1 4 69\n1 5 54", "10\n1 8 16\n6 1 80\n6 5 27\n5 7 86\n7 9 72\n4 9 20\n4 3 54\n3 2 57\n10 2 61\n8 10 90", "17\n8 12 43\n13 12 70\n7 13 68\n11 7 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 90 | codeforces | |
4f681d465ce8905f9eebe024d288c041 | Laser | Petya is the most responsible worker in the Research Institute. So he was asked to make a very important experiment: to melt the chocolate bar with a new laser device. The device consists of a rectangular field of *n*<=×<=*m* cells and a robotic arm. Each cell of the field is a 1<=×<=1 square. The robotic arm has two l... | {"inputs": ["2\n4 4 1 1 3 3\n4 3 1 1 2 2", "1\n2 2 1 2 2 1", "1\n2 2 1 2 2 1", "1\n3 3 3 2 1 1", "1\n3 4 1 1 1 2", "1\n4 3 3 1 4 1", "1\n3 5 2 4 3 5", "1\n4 5 2 2 4 2", "1\n2 5 1 5 2 2", "1\n2 6 2 6 2 3", "1\n3 6 3 5 2 4", "1\n4 6 2 1 2 3", "1\n5 6 3 4 4 2", "1\n7 3 6 2 5 2", "1\n8 2 6 1 7 2", "1\n9 6 6 5 3 1", "20\n10... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
4f6d771773c09a28a6671135a970f49c | Death Stars (easy) | The stardate is 1977 and the science and art of detecting Death Stars is in its infancy. Princess Heidi has received information about the stars in the nearby solar system from the Rebel spies and now, to help her identify the exact location of the Death Star, she needs to know whether this information is correct.
Tw... | {"inputs": ["4\nXOOO\nXXOO\nOOOO\nXXXX\nXOOO\nXOOO\nXOXO\nXOXX", "2\nXX\nOO\nXO\nOX", "1\nO\nO", "1\nX\nO", "2\nOX\nXX\nOX\nXX", "2\nOX\nXO\nXO\nOX", "2\nOX\nOX\nXX\nOX", "2\nOO\nOO\nOO\nOO", "2\nOX\nOX\nXO\nXO", "10\nXXXOOOOXOX\nOOOXXXOXXO\nXOXXXXOOXX\nXOOOXXOXOO\nOOXOOOOOOX\nXXXXOXOOOO\nXXXOOXOXOX\nOOOOXOXOXX\nXOXXOX... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 22 | codeforces | |
4f84f706f58aeadbed87aac8b2b1859c | Multiplication Table | Bizon the Champion isn't just charming, he also is very smart.
While some of us were learning the multiplication table, Bizon the Champion had fun in his own manner. Bizon the Champion painted an *n*<=×<=*m* multiplication table, where the element on the intersection of the *i*-th row and *j*-th column equals *i*·*j* ... | {"inputs": ["2 2 2", "2 3 4", "1 10 5", "1 1 1", "10 1 7", "10 10 33", "500000 500000 1", "500000 500000 250000000000", "3 3 1", "3 3 2", "3 3 3", "3 3 5", "3 3 8", "3 3 9", "1 500000 74747", "500000 1 47474", "499975 499981 12345", "499997 499989 248758432143", "5 1 2", "2 2 4", "1 2 1", "2 44 36", "2 28 49", "3 48 30... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 34 | codeforces | |
4f926e59c7bf0478b3b3f334a6fa879a | Shell Game | Bomboslav likes to look out of the window in his room and watch lads outside playing famous shell game. The game is played by two persons: operator and player. Operator takes three similar opaque shells and places a ball beneath one of them. Then he shuffles the shells by swapping some pairs and the player has to guess... | {"inputs": ["4\n2", "1\n1", "2\n2", "3\n1", "3\n2", "3\n0", "2000000000\n0", "2\n0", "2\n1", "4\n0", "4\n1", "5\n0", "5\n1", "5\n2", "6\n0", "6\n1", "6\n2", "7\n0", "7\n1", "7\n2", "100000\n0", "100000\n1", "100000\n2", "99999\n1", "99998\n1", "99997\n1", "99996\n1", "99995\n1", "1999999995\n0", "1999999995\n1", "19999... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 172 | codeforces | |
4f96c364ed54ea97246ce9afac3b7d1b | Closest Equals | You are given sequence *a*1,<=*a*2,<=...,<=*a**n* and *m* queries *l**j*,<=*r**j* (1<=≤<=*l**j*<=≤<=*r**j*<=≤<=*n*). For each query you need to print the minimum distance between such pair of elements *a**x* and *a**y* (*x*<=≠<=*y*), that:
- both indexes of the elements lie within range [*l**j*,<=*r**j*], that is, *l... | {"inputs": ["5 3\n1 1 2 3 2\n1 5\n2 4\n3 5", "6 5\n1 2 1 3 2 3\n4 6\n1 3\n2 5\n2 4\n1 6", "10 6\n2 2 1 5 6 4 9 8 5 4\n1 2\n1 10\n2 10\n2 9\n5 5\n2 8", "1 1\n1\n1 1", "1 3\n1\n1 1\n1 1\n1 1", "2 1\n1 1\n1 2", "2 1\n1 1\n1 1", "2 5\n1 1\n1 1\n1 2\n2 2\n1 2\n1 1", "2 4\n1 2\n1 1\n1 2\n2 2\n1 2"], "outputs": ["1\n-1\n2", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
4fcfeab57c0f51c448943dcc7cb20eb1 | Knights of a Polygonal Table | Unlike Knights of a Round Table, Knights of a Polygonal Table deprived of nobility and happy to kill each other. But each knight has some power and a knight can kill another knight if and only if his power is greater than the power of victim. However, even such a knight will torment his conscience, so he can kill no mo... | {"inputs": ["4 2\n4 5 9 7\n1 2 11 33", "5 1\n1 2 3 4 5\n1 2 3 4 5", "1 0\n2\n3", "7 1\n2 3 4 5 7 8 9\n0 3 7 9 5 8 9", "7 2\n2 4 6 7 8 9 10\n10 8 4 8 4 5 9", "11 10\n1 2 3 4 5 6 7 8 9 10 11\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000", "2 0\n2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 73 | codeforces | |
4fe0252045164e7628be3435258cb5a1 | Alice and Bob | It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of *n* distinct integers. And then they take turns to make the following moves. During each move, either Alice or Bob (the player whose turn is the current) can choose two ... | {"inputs": ["2\n2 3", "2\n5 3", "3\n5 6 7", "10\n72 96 24 66 6 18 12 30 60 48", "10\n78 66 6 60 18 84 36 96 72 48", "10\n98 63 42 56 14 77 70 35 84 21", "2\n1 1000000000", "2\n1000000000 999999999", "3\n2 4 6", "2\n4 6", "2\n2 6", "2\n6 2", "10\n100000000 200000000 300000000 400000000 500000000 600000000 700000000 8000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 98 | codeforces | |
4fe552649d99fa72c49afc64c9577426 | Lucky Division | Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya calls a number almost lucky if it could be evenly divided by some lucky number. Help him find ... | {"inputs": ["47", "16", "78", "48", "100", "107", "77", "477", "480", "1", "3", "4", "49", "56", "124", "1000", "999", "298", "274", "998", "42", "788", "70", "444", "777", "799", "25", "882", "88", "11", "2", "7", "8", "94", "477", "141"], "outputs": ["YES", "YES", "NO", "YES", "YES", "NO", "YES", "YES", "YES", "NO", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 451 | codeforces | |
4ff1d09db6f2d9a2ebec4be3201d5014 | Squats | Pasha has many hamsters and he makes them work out. Today, *n* hamsters (*n* is even) came to work out. The hamsters lined up and each hamster either sat down or stood up.
For another exercise, Pasha needs exactly hamsters to stand up and the other hamsters to sit down. In one minute, Pasha can make some hamster ethe... | {"inputs": ["4\nxxXx", "2\nXX", "6\nxXXxXx", "4\nxXXX", "2\nXx", "22\nXXxXXxxXxXxXXXXXXXXXxx", "30\nXXxXxxXXXXxxXXxxXXxxxxXxxXXXxx", "104\nxxXxXxxXXXxxXxXxxXXXxxxXxxXXXxxXXXxXxXxXXxxXxxxxxXXXXxXXXXxXXXxxxXxxxxxxxXxxXxXXxxXXXXxXXXxxXXXXXXXXXxXX", "78\nxxxXxxXxXxxXxxxxxXxXXXxXXXXxxxxxXxXXXxxXxXXXxxxxXxxXXXxxxxxxxxXXXXxXx... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 177 | codeforces | |
50193bc9e697c53d3b8f630d05729da8 | Elections | The country of Byalechinsk is running elections involving *n* candidates. The country consists of *m* cities. We know how many people in each city voted for each candidate.
The electoral system in the country is pretty unusual. At the first stage of elections the votes are counted for each city: it is assumed that in ... | {"inputs": ["3 3\n1 2 3\n2 3 1\n1 2 1", "3 4\n10 10 3\n5 1 6\n2 2 2\n1 5 7", "1 3\n5\n3\n2", "3 1\n1 2 3", "3 1\n100 100 100", "2 2\n1 2\n2 1", "2 2\n2 1\n2 1", "2 2\n1 2\n1 2", "3 3\n0 0 0\n1 1 1\n2 2 2", "1 1\n1000000000", "5 5\n1 2 3 4 5\n2 3 4 5 6\n3 4 5 6 7\n4 5 6 7 8\n5 6 7 8 9", "4 4\n1 3 1 3\n3 1 3 1\n2 0 0 2\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 180 | codeforces | |
5027834466ec82df4cc3c1242f683414 | none | A tree is a connected undirected graph consisting of *n* vertices and *n*<=<=-<=<=1 edges. Vertices are numbered 1 through *n*.
Limak is a little polar bear and Radewoosh is his evil enemy. Limak once had a tree but Radewoosh stolen it. Bear is very sad now because he doesn't remember much about the tree — he can tell... | {"inputs": ["5 3 2", "8 5 2", "8 4 2", "2 1 1", "10 3 3", "15 6 4", "16 15 14", "1000 51 25", "100000 10 7", "3 1 1", "3 2 1", "3 2 2", "4 1 1", "4 2 1", "4 2 2", "4 3 1", "4 3 2", "4 3 3", "8 5 3", "20 19 19", "30 14 14", "33 5 3", "5432 200 100", "5433 200 99", "99999 1 1", "99999 2 1", "99999 7 4", "9999 7 3", "1000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 22 | codeforces | |
503aa9522a8ac3af4f5e2355c3273d17 | Sereja and Contest | During the last Sereja's Codesecrof round the server crashed many times, so the round was decided to be made unrated for some participants.
Let's assume that *n* people took part in the contest. Let's assume that the participant who got the first place has rating *a*1, the second place participant has rating *a*2, ..... | {"inputs": ["5 0\n5 3 4 1 2", "10 -10\n5 5 1 7 5 1 2 4 9 2"], "outputs": ["2\n3\n4", "2\n4\n5\n7\n8\n9"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 12 | codeforces | |
50551a5504711861b7c6daf400d98f68 | Sleepy Game | Petya and Vasya arranged a game. The game runs by the following rules. Players have a directed graph consisting of *n* vertices and *m* edges. One of the vertices contains a chip. Initially the chip is located at vertex *s*. Players take turns moving the chip along some edge of the graph. Petya goes first. Player who c... | {"inputs": ["5 6\n2 2 3\n2 4 5\n1 4\n1 5\n0\n1", "3 2\n1 3\n1 1\n0\n2", "2 2\n1 2\n1 1\n1", "92 69\n1 76\n1 14\n1 9\n0\n1 46\n1 80\n0\n0\n1 77\n0\n1 53\n1 81\n1 61\n1 40\n0\n1 20\n1 71\n1 24\n1 54\n1 82\n1 23\n0\n1 63\n1 25\n1 38\n1 68\n0\n1 65\n0\n1 76\n1 55\n1 87\n1 1\n1 37\n1 68\n1 30\n1 17\n1 19\n0\n1 16\n1 69\n0\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
50791db071f3edbf0b1751f2239c954b | Coin Troubles | In the Isle of Guernsey there are *n* different types of coins. For each *i* (1<=≤<=*i*<=≤<=*n*), coin of type *i* is worth *a**i* cents. It is possible that *a**i*<==<=*a**j* for some *i* and *j* (*i*<=≠<=*j*).
Bessie has some set of these coins totaling *t* cents. She tells Jessie *q* pairs of integers. For each *i... | {"inputs": ["4 2 17\n3 1 2 5\n4 2\n3 4", "3 2 6\n3 1 1\n1 2\n2 3", "3 2 10\n1 2 3\n1 2\n2 1", "10 0 97\n7 2 10 5 10 5 8 9 6 2", "10 2 11\n4 9 3 1 4 10 2 6 10 8\n3 6\n6 4", "10 4 18\n9 2 8 2 7 4 9 5 10 9\n7 9\n9 2\n2 5\n5 10", "10 0 96374\n9 4 9 8 4 1 10 1 6 6", "10 5 857\n3 9 8 10 10 5 3 3 8 1\n6 9\n9 2\n2 7\n4 3\n8 10... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
508e636f3924d8df0d7fac38849e57da | none | Piegirl was asked to implement two table join operation for distributed database system, minimizing the network traffic.
Suppose she wants to join two tables, *A* and *B*. Each of them has certain number of rows which are distributed on different number of partitions. Table *A* is distributed on the first cluster cons... | {"inputs": ["2 2\n2 6\n3 100", "2 3\n10 10\n1 1 1", "2 2\n888381664 866366630\n170399907 404233949", "3 4\n337369924 278848730 654933675\n866361693 732544605 890800310 350303294", "10 10\n510955240 684852706 455356451 284505713 595775142 646334608 563116339 941123613 818750895 516673753\n382626402 204542396 341363992 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 7 | codeforces | |
50deaa2fdf386fcdaf44f03cf4706b8e | A rectangle | Developing tools for creation of locations maps for turn-based fights in a new game, Petya faced the following problem.
A field map consists of hexagonal cells. Since locations sizes are going to be big, a game designer wants to have a tool for quick filling of a field part with identical enemy units. This action will... | {"inputs": ["1 1 5 5", "-1 -3 1 3", "-2 -2 2 2", "0 0 2 2", "0 0 2 0", "0 0 0 0", "0 -2 0 2", "-2 -2 -2 0", "-1000000000 -1000000000 1000000000 1000000000", "-999999999 -999999999 999999999 999999999", "-999999999 -999999999 -1 -1", "-411495869 33834653 -234317741 925065545", "-946749893 -687257665 -539044455 -44356867... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
50e08cf44bddd6a4b194ec1f594526c0 | Black Square | Polycarp has a checkered sheet of paper of size *n*<=×<=*m*. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.
You are to determine the minimum pos... | {"inputs": ["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW", "100 1\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nB\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 73 | codeforces | |
50e3de91cc5521bb0c2850880e212a5f | Commentary Boxes | Berland Football Cup starts really soon! Commentators from all over the world come to the event.
Organizers have already built $n$ commentary boxes. $m$ regional delegations will come to the Cup. Every delegation should get the same number of the commentary boxes. If any box is left unoccupied then the delegations wil... | {"inputs": ["9 7 3 8", "2 7 3 7", "30 6 17 19", "500000000001 1000000000000 100 100", "1000000000000 750000000001 10 100", "1000000000000 750000000001 100 10", "42 1 1 1", "1 1000000000000 1 100", "7 2 3 7", "999999999 2 1 1", "999999999999 10000000007 100 100", "10000000001 2 1 1", "29 6 1 2", "99999999999 6 100 100",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 269 | codeforces | |
510995f0772298cdcea496ca8e30b37f | Jamie and Alarm Snooze | Jamie loves sleeping. One day, he decides that he needs to wake up at exactly *hh*:<=*mm*. However, he hates waking up, so he wants to make waking up less painful by setting the alarm at a lucky time. He will then press the snooze button every *x* minutes until *hh*:<=*mm* is reached, and only then he will wake up. He ... | {"inputs": ["3\n11 23", "5\n01 07", "34\n09 24", "2\n14 37", "14\n19 54", "42\n15 44", "46\n02 43", "14\n06 41", "26\n04 58", "54\n16 47", "38\n20 01", "11\n02 05", "55\n22 10", "23\n10 08", "23\n23 14", "51\n03 27", "35\n15 25", "3\n12 15", "47\n00 28", "31\n13 34", "59\n17 32", "25\n11 03", "9\n16 53", "53\n04 06", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 221 | codeforces | |
5178b46518ed8b00d8287e9a143991df | New Year Tree | The New Year holidays are over, but Resha doesn't want to throw away the New Year tree. He invited his best friends Kerim and Gural to help him to redecorate the New Year tree.
The New Year tree is an undirected tree with *n* vertices and root in the vertex 1.
You should process the queries of the two types:
1. Cha... | {"inputs": ["7 10\n1 1 1 1 1 1 1\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n1 3 2\n2 1\n1 4 3\n2 1\n1 2 5\n2 1\n1 6 4\n2 1\n2 2\n2 3", "23 30\n1 2 2 6 5 3 2 1 1 1 2 4 5 3 4 4 3 3 3 3 3 4 6\n1 2\n1 3\n1 4\n2 5\n2 6\n3 7\n3 8\n4 9\n4 10\n4 11\n6 12\n6 13\n7 14\n7 15\n7 16\n8 17\n8 18\n10 19\n10 20\n10 21\n11 22\n11 23\n2 1\n2 5\n2 6... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
517c2823ba28b9c195cdcd650d4db4fb | 2 + 2 != 4 | One very experienced problem writer decided to prepare a problem for April Fools Day contest. The task was very simple - given an arithmetic expression, return the result of evaluating this expression. However, looks like there is a bug in the reference solution...
The only line of input data contains the arithmetic ex... | {"inputs": ["8-7+6-5+4-3+2-1-0", "2+2", "112-37", "255+255+255+255+255+255+255+255+255+255", "0-255-255-255-255-255-255-255-255-255", "0+0+0+0+0+0+0+0+0+0", "0-0-0-0-0-0-0-0-0-0", "0+100+100+100+100+100+100+100+100+100", "255-100-100-100-100-100-100-100-100-100", "45+5", "23+6-9", "123+234-56-78-90", "97+67+12+9+42+45+... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
51871bcfc6ef6119fe456069494bd418 | Tricky Alchemy | During the winter holidays, the demand for Christmas balls is exceptionally high. Since it's already 2018, the advances in alchemy allow easy and efficient ball creation by utilizing magic crystals.
Grisha needs to obtain some yellow, green and blue balls. It's known that to produce a yellow ball one needs two yellow ... | {"inputs": ["4 3\n2 1 1", "3 9\n1 1 3", "12345678 87654321\n43043751 1000000000 53798715", "12 12\n3 5 2", "770 1390\n170 442 311", "3555165 6693472\n1499112 556941 3075290", "0 0\n1000000000 1000000000 1000000000", "1 1\n0 1 0", "117708228 562858833\n118004008 360437130 154015822", "999998118 700178721\n822106746 8298... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 401 | codeforces | |
51911583dab871f5ea0ac52588a84b8b | Antimatter | Iahub accidentally discovered a secret lab. He found there *n* devices ordered in a line, numbered from 1 to *n* from left to right. Each device *i* (1<=≤<=*i*<=≤<=*n*) can create either *a**i* units of matter or *a**i* units of antimatter.
Iahub wants to choose some contiguous subarray of devices in the lab, specify... | {"inputs": ["4\n1 1 1 1", "10\n16 9 9 11 10 12 9 6 10 8", "50\n2 1 5 2 1 3 1 2 3 2 1 1 5 2 2 2 3 2 1 2 2 2 3 3 1 3 1 1 2 2 2 2 1 2 3 1 2 4 1 1 1 3 2 1 1 1 3 2 1 3", "100\n8 3 3 7 3 6 4 6 9 4 6 5 5 5 4 3 4 2 3 5 3 6 5 3 6 5 6 6 2 6 4 5 5 4 6 4 3 2 8 5 6 6 7 4 4 9 5 6 6 3 7 1 6 2 6 5 9 3 8 6 2 6 3 2 4 4 3 5 4 7 6 5 4 6 3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
51b23f121a010950ffd4756d31d02d4a | Fafa and Ancient Alphabet | Ancient Egyptians are known to have used a large set of symbols to write on the walls of the temples. Fafa and Fifa went to one of the temples and found two non-empty words *S*1 and *S*2 of equal lengths on the wall of temple written one below the other. Since this temple is very ancient, some symbols from the words w... | {"inputs": ["1 2\n0\n1", "1 2\n1\n0", "7 26\n0 15 12 9 13 0 14\n11 1 0 13 15 12 0", "6 26\n14 5 19 18 9 14\n0 0 0 0 0 0", "4 26\n0 0 0 0\n13 15 18 1", "5 100\n0 0 0 0 0\n0 0 0 0 0", "7 30\n11 1 0 13 15 12 0\n0 15 12 9 13 0 14", "4 50\n19 1 19 1\n19 1 19 15", "4 50\n19 1 19 15\n19 1 19 1", "107 100000\n0 0 0 0 0 0 0 0 0... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
51cf8476c1c8c68b031ab3f1f1625c98 | Points on the line | We've got no test cases. A big olympiad is coming up. But the problemsetters' number one priority should be adding another problem to the round.
The diameter of a multiset of points on the line is the largest distance between two points from this set. For example, the diameter of the multiset {1,<=3,<=2,<=1} is 2.
D... | {"inputs": ["3 1\n2 1 4", "3 0\n7 7 7", "6 3\n1 3 4 6 9 10", "11 5\n10 11 12 13 14 15 16 17 18 19 20", "1 100\n1", "100 10\n22 75 26 45 72 81 47 29 97 2 75 25 82 84 17 56 32 2 28 37 57 39 18 11 79 6 40 68 68 16 40 63 93 49 91 10 55 68 31 80 57 18 34 28 76 55 21 80 22 45 11 67 67 74 91 4 35 34 65 80 21 95 1 52 25 31 2 5... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 121 | codeforces | |
51dcd299d4c1375028194acc6f588742 | Vitaly and Strings | Vitaly is a diligent student who never missed a lesson in his five years of studying in the university. He always does his homework on time and passes his exams in time.
During the last lesson the teacher has provided two strings *s* and *t* to Vitaly. The strings have the same length, they consist of lowercase Engli... | {"inputs": ["a\nc", "aaa\nzzz", "abcdefg\nabcdefh", "abcdefg\nabcfefg", "frt\nfru", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz", "zzzzzzzzzzzzzzzzzzzzzzzzzzzzz... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 118 | codeforces | |
525529e7c4f14a1e5c41a441db482ecb | Mister B and Flight to the Moon | In order to fly to the Moon Mister B just needs to solve the following problem.
There is a complete indirected graph with *n* vertices. You need to cover it with several simple cycles of length 3 and 4 so that each edge is in exactly 2 cycles.
We are sure that Mister B will solve the problem soon and will fly to the ... | {"inputs": ["3", "5", "299", "300", "4", "5", "6", "7", "8", "9", "10", "298", "297", "11", "14", "21", "28", "35", "42", "49", "56", "63", "70", "77", "84", "91", "98", "105", "112", "119", "126", "133", "140", "147", "154", "161", "168", "175", "182", "189", "196", "203", "210", "217", "224", "231", "238", "245", "25... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
528e74abdd6f1a9f497825c446f2ef2b | Chewbaсca and Number | Luke Skywalker gave Chewbacca an integer number *x*. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit *t* means replacing it with digit 9<=-<=*t*.
Help Chewbacca to transform the initial number *x* to the minimum possible positive number by inverting some (possibly, zero) digits.... | {"inputs": ["27", "4545", "1", "9", "8772", "81", "71723447", "91730629", "420062703497", "332711047202", "3395184971407775", "8464062628894325", "164324828731963982", "384979173822804784", "41312150450968417", "2156", "1932", "5902", "5728", "8537", "55403857", "270739", "28746918", "10279211", "40289679", "5452032385... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 346 | codeforces | |
5292b9c42c14e162f4ce34076de89ae1 | none | Little Elephant loves Furik and Rubik, who he met in a small city Kremenchug.
The Little Elephant has two strings of equal length *a* and *b*, consisting only of uppercase English letters. The Little Elephant selects a pair of substrings of equal length — the first one from string *a*, the second one from string *b*. ... | {"inputs": ["2\nAB\nBA", "3\nAAB\nCAA", "7\nAAAAAAA\nBBBBBBB", "4\nAAAA\nAAAB", "10\nSATYFFJYBA\nBGFOBFBVAV", "1\nA\nA", "1\nA\nZ", "14\nBABBABABABABAA\nBABABAABAAABAB", "10\nQUDLGGRJEG\nMIZIEZRCJU", "47\nGMQXICWAZQNJFYHHAFWXZOLNEZGUIPEKMWPWXLXUBDFONZF\nXSGRAAAFYJBCJYECMTWRTZNKVWMSVYJOFDNZFEFYLWGUGYX", "25\nYWORWQKEMDA... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
5298cee5f0c18b0718c0ec3fe8bd388a | Wet Shark and Flowers | There are *n* sharks who grow flowers for Wet Shark. They are all sitting around the table, such that sharks *i* and *i*<=+<=1 are neighbours for all *i* from 1 to *n*<=-<=1. Sharks *n* and 1 are neighbours too.
Each shark will grow some number of flowers *s**i*. For *i*-th shark value *s**i* is random integer equipro... | {"inputs": ["3 2\n1 2\n420 421\n420420 420421", "3 5\n1 4\n2 3\n11 14", "3 3\n3 3\n2 4\n1 1", "5 5\n5 204\n420 469\n417 480\n442 443\n44 46", "3 2\n2 2\n3 3\n4 4", "6 7\n8 13\n14 14\n8 13\n14 14\n8 13\n14 14", "3 7\n7 14\n700000000 700000007\n420 4200", "5 999999937\n999999935 999999936\n999999937 999999938\n999999939 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 52 | codeforces | |
52bb700295732c2b5c9555abba470fd8 | Kids' Riddle | Programmers' kids solve this riddle in 5-10 minutes. How fast can you do it?
The input contains a single integer *n* (0<=≤<=*n*<=≤<=2000000000).
Output a single integer.
Sample Input
11
14
61441
571576
2128506
Sample Output
2
0
2
10
3
| {"inputs": ["11", "14", "61441", "571576", "2128506", "0", "2000000000", "143165576", "1741", "1919020031", "1795248373", "1818960378", "1285316221", "1309028227", "1304312649", "1180540990", "1204252996", "1199537418", "1075765759", "724264821", "747976826", "624205168", "619489590", "643201595", "638486017", "5147143... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 33 | codeforces | |
52bdea90e6852a13d360805c66942d58 | Finite or not? | You are given several queries. Each query consists of three integers $p$, $q$ and $b$. You need to answer whether the result of $p/q$ in notation with base $b$ is a finite fraction.
A fraction in notation with base $b$ is finite if it contains finite number of numerals after the decimal point. It is also possible that... | {"inputs": ["2\n6 12 10\n4 3 10", "4\n1 1 2\n9 36 2\n4 12 3\n3 5 4", "10\n10 5 3\n1 7 10\n7 5 7\n4 4 9\n6 5 2\n6 7 5\n9 9 7\n7 5 5\n6 6 4\n10 8 2", "10\n1 3 10\n6 2 6\n2 3 9\n7 8 4\n5 6 10\n1 2 7\n0 3 6\n9 3 4\n4 4 9\n10 9 10", "10\n10 8 5\n0 6 9\n0 7 6\n5 7 3\n7 6 8\n0 4 8\n2 6 3\n10 2 9\n6 7 9\n9 1 4", "10\n5 8 2\n0 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 12 | codeforces | |
52c301e110c218203ec5f2e7b16fdaef | k-substrings | You are given a string *s* consisting of *n* lowercase Latin letters.
Let's denote *k*-substring of *s* as a string *subs**k*<==<=*s**k**s**k*<=+<=1..*s**n*<=+<=1<=-<=*k*. Obviously, *subs*1<==<=*s*, and there are exactly such substrings.
Let's call some string *t* an odd proper suprefix of a string *T* iff the foll... | {"inputs": ["15\nbcabcabcabcabca", "24\nabaaabaaaabaaabaaaabaaab", "19\ncabcabbcabcabbcabca", "2\nza", "20\nbbbaaabbbbbbbbaaabbb", "2\nzz", "3\ndad", "4\naccd", "5\naabcd", "6\nbcabbd", "7\nbaaaadd"], "outputs": ["9 7 5 3 1 -1 -1 -1", "15 13 11 9 7 5 3 1 1 -1 -1 1", "5 3 1 -1 -1 1 1 -1 -1 -1", "-1", "9 7 5 3 1 1 7 5 3 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
52f5dd7190e4ec2cbb522191d7d08ee6 | Robot Sequence | Calvin the robot lies in an infinite rectangular grid. Calvin's source code contains a list of *n* commands, each either 'U', 'R', 'D', or 'L' — instructions to move a single square up, right, down, or left, respectively. How many ways can Calvin execute a non-empty contiguous substrings of commands and return to the s... | {"inputs": ["6\nURLLDR", "4\nDLUU", "7\nRLRLRLR", "1\nR", "100\nURDLURDLURDLURDLURDLURDLURDLURDLURDLURDLURDLURDLURDLURDLURDLURDLURDLURDLURDLURDLURDLURDLURDLURDLURDL", "200\nLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 166 | codeforces | |
533ae5b3b2eae7d179cdcdabdab45238 | Little Elephant and Chess | The Little Elephant loves chess very much.
One day the Little Elephant and his friend decided to play chess. They've got the chess pieces but the board is a problem. They've got an 8<=×<=8 checkered board, each square is painted either black or white. The Little Elephant and his friend know that a proper chessboard d... | {"inputs": ["WBWBWBWB\nBWBWBWBW\nBWBWBWBW\nBWBWBWBW\nWBWBWBWB\nWBWBWBWB\nBWBWBWBW\nWBWBWBWB", "WBWBWBWB\nWBWBWBWB\nBBWBWWWB\nBWBWBWBW\nBWBWBWBW\nBWBWBWWW\nBWBWBWBW\nBWBWBWBW", "BWBWBWBW\nWBWBWBWB\nBWBWBWBW\nBWBWBWBW\nWBWBWBWB\nWBWBWBWB\nWBWBWBWB\nWBWBWBWB", "BWBWBWBW\nWBWBWBWB\nBWBWBWBW\nWBWBWBWB\nBWBWBWBW\nWBWBWBWB\nW... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 204 | codeforces | |
53591cfe13dfca10ed3fe3da3e03db20 | Little Artem and Random Variable | Little Artyom decided to study probability theory. He found a book with a lot of nice exercises and now wants you to help him with one of them.
Consider two dices. When thrown each dice shows some integer from 1 to *n* inclusive. For each dice the probability of each outcome is given (of course, their sum is 1), and d... | {"inputs": ["2\n0.25 0.75\n0.75 0.25", "3\n0.125 0.25 0.625\n0.625 0.25 0.125", "10\n0.01 0.01 0.01 0.01 0.01 0.1 0.2 0.2 0.4 0.05\n1.0 0 0 0 0 0 0 0 0 0", "10\n0 0 0 0 0 0 0 0 0 1.0\n1.0 0 0 0 0 0 0 0 0 0", "1\n1.0\n1.0", "2\n0.00001 0.99999\n0.5 0.5", "3\n0.1 0.1 0.8\n0.6 0.2 0.2", "8\n0.09597231 0.11315755 0.3207711... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
535ff148f11b5e0f05a3efd56473da55 | Ilya and Roads | Everything is great about Ilya's city, except the roads. The thing is, the only ZooVille road is represented as *n* holes in a row. We will consider the holes numbered from 1 to *n*, from left to right.
Ilya is really keep on helping his city. So, he wants to fix at least *k* holes (perharps he can fix more) on a sing... | {"inputs": ["10 4 6\n7 9 11\n6 9 13\n7 7 7\n3 5 6", "10 7 1\n3 4 15\n8 9 8\n5 6 8\n9 10 6\n1 4 2\n1 4 10\n8 10 13", "10 1 9\n5 10 14", "10 6 9\n6 8 7\n2 8 11\n2 6 10\n8 10 9\n2 5 8\n2 3 8", "10 6 8\n3 6 7\n1 4 3\n2 7 10\n4 7 4\n7 10 15\n4 7 7", "10 4 10\n1 1 11\n7 7 15\n2 3 11\n2 8 6", "10 3 7\n4 6 6\n5 7 1\n2 10 15", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
538e5a259bf9609053b62f07a3684521 | The Child and Toy | On Children's Day, the child got a toy from Delayyy as a present. However, the child is so naughty that he can't wait to destroy the toy.
The toy consists of *n* parts and *m* ropes. Each rope links two parts, but every pair of parts is linked by at most one rope. To split the toy, the child must remove all its parts.... | {"inputs": ["4 3\n10 20 30 40\n1 4\n1 2\n2 3", "4 4\n100 100 100 100\n1 2\n2 3\n2 4\n3 4", "7 10\n40 10 20 10 20 80 40\n1 5\n4 7\n4 5\n5 2\n5 7\n6 4\n1 6\n1 3\n4 3\n1 4", "1 0\n23333", "5 4\n1 2 2 2 2\n1 2\n1 3\n1 4\n1 5", "10 30\n3 6 17 15 13 15 6 12 9 1\n3 8\n1 10\n4 7\n1 7\n3 7\n2 9\n8 10\n3 1\n3 4\n8 6\n10 3\n3 9\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 224 | codeforces | |
53bf4c704b2a544a0f1fb3c16762f47a | Lineland Mail | All cities of Lineland are located on the *Ox* coordinate axis. Thus, each city is associated with its position *x**i* — a coordinate on the *Ox* axis. No two cities are located at a single point.
Lineland residents love to send letters to each other. A person may send a letter only if the recipient lives in another c... | {"inputs": ["4\n-5 -2 2 7", "2\n-1 1", "3\n-1 0 1", "4\n-1 0 1 3", "3\n-1000000000 0 1000000000", "2\n-1000000000 1000000000", "10\n1 10 12 15 59 68 130 912 1239 9123", "5\n-2 -1 0 1 2", "5\n-2 -1 0 1 3", "3\n-10000 1 10000", "5\n-1000000000 -999999999 -999999998 -999999997 -999999996", "10\n-857422304 -529223472 82412... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 608 | codeforces | |
53c54a45f7b49ca7ba7f34ca352c10d6 | Dog Show | A new dog show on TV is starting next week. On the show dogs are required to demonstrate bottomless stomach, strategic thinking and self-preservation instinct. You and your dog are invited to compete with other participants and naturally you want to win!
On the show a dog needs to eat as many bowls of dog food as poss... | {"inputs": ["3 5\n1 5 3", "1 2\n1", "1 1\n1", "1 1\n2", "2 2\n2 3", "2 3\n2 1", "3 3\n2 3 2", "3 2\n2 3 4", "3 4\n2 1 2", "4 4\n2 1 2 3", "4 3\n2 1 2 3", "4 6\n2 3 4 5", "5 5\n2 1 2 3 4", "5 3\n2 3 2 1 2", "5 7\n2 1 2 3 4", "6 6\n2 3 2 3 4 3", "6 4\n2 3 2 3 4 3", "6 9\n2 1 2 1 2 3", "7 7\n2 3 4 5 6 5 6", "7 4\n2 1 2 3 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
53de648b0565d1a3703a8ca27e960722 | Nikita and string | One day Nikita found the string containing letters "a" and "b" only.
Nikita thinks that string is beautiful if it can be cut into 3 strings (possibly empty) without changing the order of the letters, where the 1-st and the 3-rd one contain only letters "a" and the 2-nd contains only letters "b".
Nikita wants to make... | {"inputs": ["abba", "bab", "bbabbbaabbbb", "bbabbbbbaaba", "bbabbbababaa", "aabbaababbab", "a", "b", "ab", "ba", "bb", "aa", "babbbaab", "abaaaa", "aaa"], "outputs": ["4", "2", "9", "10", "9", "8", "1", "1", "2", "2", "2", "2", "6", "6", "3"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 72 | codeforces | |
53fa4bd5bc566062e8f1db038d8f15de | Pattern | Developers often face with regular expression patterns. A pattern is usually defined as a string consisting of characters and metacharacters that sets the rules for your search. These patterns are most often used to check whether a particular string meets the certain rules.
In this task, a pattern will be a string con... | {"inputs": ["2\n?ab\n??b", "2\na\nb", "1\n?a?b", "1\n?", "3\nabacaba\nabacaba\nabacaba", "3\nabc?t\n?bc?z\nab??t", "4\nabc\ndef\n???\nxyz", "2\n?????\n?????", "2\na\na", "3\nabc\n???\naxc", "1\n?m??x?xxexxx?xxmxx??", "2\nhszhh?zszs\nhhzhz?zzhs", "3\neddzde\needded\nzdde?z", "4\nff?o?\nfk?of\nk?kof\nfk?oo", "5\nyigi\ne?... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 74 | codeforces | |
5400ae66fbdd291d560caf981f43e7e0 | Petya and Staircases | Little boy Petya loves stairs very much. But he is bored from simple going up and down them — he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a time. But some stairs are too dirty and Petya doesn't want to step on them.
No... | {"inputs": ["10 5\n2 4 8 3 6", "10 5\n2 4 5 7 9", "10 9\n2 3 4 5 6 7 8 9 10", "5 2\n4 5", "123 13\n36 73 111 2 92 5 47 55 48 113 7 78 37", "10 10\n7 6 4 2 5 10 8 3 9 1", "12312 0", "9817239 1\n6323187", "1 1\n1", "5 4\n4 2 5 1", "5 3\n4 3 5", "500 3\n18 62 445", "500 50\n72 474 467 241 442 437 336 234 410 120 438 164 4... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 44 | codeforces | |
5403d9edc0e697bd7a0b0ef11150d83c | Gleb And Pizza | Gleb ordered pizza home. When the courier delivered the pizza, he was very upset, because several pieces of sausage lay on the crust, and he does not really like the crust.
The pizza is a circle of radius *r* and center at the origin. Pizza consists of the main part — circle of radius *r*<=-<=*d* with center at the or... | {"inputs": ["8 4\n7\n7 8 1\n-7 3 2\n0 2 1\n0 -2 2\n-3 -3 1\n0 6 2\n5 3 1", "10 8\n4\n0 0 9\n0 0 10\n1 0 1\n1 0 2", "1 0\n1\n1 1 0", "3 0\n5\n3 0 0\n0 3 0\n-3 0 0\n0 -3 0\n3 0 1", "9 0\n5\n8 1 0\n8 2 0\n8 3 0\n-8 3 0\n-8 2 0", "10 2\n11\n1 1 0\n2 2 3\n3 3 0\n4 4 0\n5 5 0\n6 6 0\n7 7 4\n8 8 7\n9 9 3\n10 10 100\n9 0 1", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 190 | codeforces | |
540cb1fd4a6870c7db9c8333423e798f | Cows and Poker Game | There are *n* cows playing poker at a table. For the current betting phase, each player's status is either "ALLIN", "IN", or "FOLDED", and does not change throughout the phase. To increase the suspense, a player whose current status is not "FOLDED" may show his/her hand to the table. However, so as not to affect any be... | {"inputs": ["6\nAFFAAA", "3\nAFI", "3\nFFF", "3\nFIF", "3\nAAA", "3\nIII", "3\nIIA", "3\nAFF", "5\nFAFFF", "3\nIAA", "3\nIIF", "2\nFA", "2\nFF", "2\nIF", "5\nAAAAI", "5\nIIIIF", "10\nAAAAAAAAAA", "100\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "5\nFAIAF", "5\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 126 | codeforces | |
549053419f14efeb49ea7377628d5a2d | Mashmokh and Numbers | It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh.
In this game Mashmokh writes sequence of *n* distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes the first and the second integer from from the board, on the second move he r... | {"inputs": ["5 2", "5 3", "7 2", "1 1", "2 0", "1 10", "1 0", "7 3", "7 6", "7 7", "100000 100000000", "3455 2792393", "74086 16504611", "28515 44887064", "21324 73830196", "90212 5921828", "25095 2372924", "92977 95851971", "39095 77350428", "785 70908164", "28051 5506872", "74077 37498088", "58284 12998910", "28768 3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 43 | codeforces | |
54a78b545ae5ffb4e728231eb0a098e9 | Surrounded | So, the Berland is at war with its eternal enemy Flatland again, and Vasya, an accountant, was assigned to fulfil his duty to the nation.
Right now the situation in Berland is dismal — their both cities are surrounded! The armies of flatlanders stand on the borders of circles, the circles' centers are in the surround... | {"inputs": ["0 0 1\n6 0 3", "-10 10 3\n10 -10 3", "2 1 3\n8 9 5", "0 0 1\n-10 -10 9", "10000 -9268 1\n-9898 9000 10", "10000 10000 1\n-10000 -10000 1", "123 21 50\n10 100 1000", "0 3278 2382\n2312 1 1111", "3 4 5\n5 12 13", "-2 7 5\n4 0 6", "4 0 2\n6 -1 10", "41 17 3\n71 -86 10", "761 641 6\n506 -293 5", "-5051 -7339 9... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 24 | codeforces | |
54ae528218897038012509ab2051c563 | Broken robot | You received as a gift a very clever robot walking on a rectangular board. Unfortunately, you understood that it is broken and behaves rather strangely (randomly). The board consists of *N* rows and *M* columns of cells. The robot is initially at some cell on the *i*-th row and the *j*-th column. Then at every step the... | {"inputs": ["10 10\n10 4", "10 14\n5 14", "126 125\n115 22", "755 51\n205 12", "385 978\n344 18", "663 904\n192 518", "293 183\n279 21", "922 109\n431 55", "552 36\n199 35", "182 314\n54 201", "812 240\n561 19", "595 881\n417 120", "694 685\n278 653", "793 840\n534 276", "892 996\n288 751", "990 800\n801 66", "89 955\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
54b9ba5fab7b748e49429697be63d53e | Present from Lena | Vasya's birthday is approaching and Lena decided to sew a patterned handkerchief to him as a present. Lena chose digits from 0 to *n* as the pattern. The digits will form a rhombus. The largest digit *n* should be located in the centre. The digits should decrease as they approach the edges. For example, for *n*<==<=5 t... | {"inputs": ["2", "3", "4", "5", "6", "7", "8", "9"], "outputs": [" 0\n 0 1 0\n0 1 2 1 0\n 0 1 0\n 0", " 0\n 0 1 0\n 0 1 2 1 0\n0 1 2 3 2 1 0\n 0 1 2 1 0\n 0 1 0\n 0", " 0\n 0 1 0\n 0 1 2 1 0\n 0 1 2 3 2 1 0\n0 1 2 3 4 3 2 1 0\n 0 1 2 3 2 1 0\n 0 1 2 1 0\n 0 1 0\n ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 13 | codeforces | |
54eabc2821352e7e3a39754857af9e14 | A Game With Numbers | Imagine that Alice is playing a card game with her friend Bob. They both have exactly $8$ cards and there is an integer on each card, ranging from $0$ to $4$. In each round, Alice or Bob in turns choose two cards from different players, let them be $a$ and $b$, where $a$ is the number on the player's card, and $b$ is t... | {"inputs": ["4\n1\n0 0 0 0 0 0 0 0\n1 2 3 4 1 2 3 4\n1\n0 0 0 1 0 0 0 0\n0 0 0 0 4 0 0 0\n0\n1 0 0 0 0 0 0 0\n0 0 0 4 0 0 2 0\n1\n1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1", "1\n0\n0 2 2 0 1 2 1 2\n1 2 4 3 2 1 1 0"], "outputs": ["Alice\nBob\nAlice\nDeal", "Alice"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
54ef95eac742c7cf136cec111b8e7b83 | Borya's Diagnosis | It seems that Borya is seriously sick. He is going visit *n* doctors to find out the exact diagnosis. Each of the doctors needs the information about all previous visits, so Borya has to visit them in the prescribed order (i.e. Borya should first visit doctor 1, then doctor 2, then doctor 3 and so on). Borya will get t... | {"inputs": ["3\n2 2\n1 2\n2 2", "2\n10 1\n6 5", "3\n6 10\n3 3\n8 2", "4\n4 8\n10 10\n4 2\n8 2", "5\n7 1\n5 1\n6 1\n1 6\n6 8", "6\n1 3\n2 5\n4 7\n7 5\n6 8\n8 8", "10\n4 10\n8 7\n6 5\n2 1\n2 3\n8 8\n2 4\n2 2\n6 7\n7 9", "1\n1 1", "1\n1000 1000", "42\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 67 | codeforces | |
54f2b0eb96295a35dd0ba51561306f0a | none | Natasha travels around Mars in the Mars rover. But suddenly it broke down, namely — the logical scheme inside it. The scheme is an undirected tree (connected acyclic graph) with a root in the vertex $1$, in which every leaf (excluding root) is an input, and all other vertices are logical elements, including the root, w... | {"inputs": ["10\nAND 9 4\nIN 1\nIN 1\nXOR 6 5\nAND 3 7\nIN 0\nNOT 10\nIN 1\nIN 1\nAND 2 8", "3\nAND 2 3\nIN 0\nIN 0", "3\nAND 2 3\nIN 1\nIN 0", "3\nAND 2 3\nIN 0\nIN 1", "3\nAND 2 3\nIN 1\nIN 1", "3\nOR 2 3\nIN 0\nIN 0", "3\nOR 2 3\nIN 1\nIN 0", "3\nOR 2 3\nIN 0\nIN 1", "3\nOR 2 3\nIN 1\nIN 1", "3\nXOR 2 3\nIN 0\nIN 0"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
54f654755a3f3b43fcc1e4463c5ec344 | K-Periodic Array | This task will exclusively concentrate only on the arrays where all elements equal 1 and/or 2.
Array *a* is *k*-period if its length is divisible by *k* and there is such array *b* of length *k*, that *a* is represented by array *b* written exactly times consecutively. In other words, array *a* is *k*-periodic, if it... | {"inputs": ["6 2\n2 1 2 2 2 1", "8 4\n1 1 2 1 1 1 2 1", "9 3\n2 1 1 1 2 1 1 1 2", "1 1\n2", "2 1\n1 1", "2 2\n2 2", "100 1\n1 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 1 2 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 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 81 | codeforces | |
5593c830d71188d6cb7298d1414d88e3 | Python Indentation | In Python, code blocks don't have explicit begin/end or curly braces to mark beginning and end of the block. Instead, code blocks are defined by indentation.
We will consider an extremely simplified subset of Python with only two types of statements.
Simple statements are written in a single line, one per line. An ex... | {"inputs": ["4\ns\nf\nf\ns", "4\nf\ns\nf\ns", "156\nf\ns\nf\ns\nf\ns\ns\ns\ns\nf\ns\ns\nf\nf\ns\nf\nf\nf\nf\ns\ns\ns\nf\ns\ns\nf\nf\nf\nf\nf\nf\ns\ns\ns\ns\nf\ns\nf\ns\nf\ns\nf\nf\nf\nf\ns\ns\nf\nf\ns\ns\ns\ns\nf\ns\nf\ns\nf\ns\nf\ns\ns\ns\nf\ns\ns\nf\ns\nf\nf\ns\ns\ns\nf\nf\nf\nf\ns\ns\nf\nf\nf\nf\nf\nf\nf\ns\nf\ns\ns... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 27 | codeforces | |
55ae3df199bb9e610ef7dd2ba38b3fe1 | Shooting Gallery | One warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize — big pink plush panda. The king is not good at shooting, so he invited you to help him.
The shooting gallery is an infinite vertical plane with Cartesian coordinate system on it. The targ... | {"inputs": ["1\n0 0 0 0.5", "2\n0 0 0 0.6\n5 0 5 0.7", "1\n-5 2 3 0.886986", "4\n10 -7 14 0.926305\n-7 -8 12 0.121809\n-7 7 14 0.413446\n3 -8 6 0.859061", "5\n-2 -2 34 0.127276\n5 -5 4 0.459998\n10 3 15 0.293766\n1 -3 7 0.089869\n-4 -7 11 0.772515", "5\n2 5 1 0.955925\n9 -9 14 0.299977\n0 1 97 0.114582\n-4 -2 66 0.5610... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
55bd32dabd659fa4145edf5cace46d7e | Maximal Area Quadrilateral | Iahub has drawn a set of *n* points in the cartesian plane which he calls "special points". A quadrilateral is a simple polygon without self-intersections with four sides (also called edges) and four vertices (also called corners). Please note that a quadrilateral doesn't have to be convex. A special quadrilateral is o... | {"inputs": ["5\n0 0\n0 4\n4 0\n4 4\n2 3", "10\n-6 -4\n-7 5\n-7 -7\n5 -7\n4 -9\n-6 7\n2 9\n-4 -6\n2 10\n-10 -4", "4\n-3 3\n0 3\n-2 -1\n2 2", "5\n-4 -3\n-3 -2\n3 3\n-1 2\n3 -3", "6\n-4 -3\n-1 3\n0 0\n2 2\n2 1\n-3 1", "7\n-2 -1\n4 3\n2 2\n-4 0\n-2 4\n0 0\n1 -3", "4\n-874 606\n-996 -207\n897 847\n775 191", "10\n156 -415\n8... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
55d0b2a7f663cfde27c5fb8e3f1bdcd8 | Schedule | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, *n* groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, beca... | {"inputs": ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7", "4\n1 5\n5 7\n6 9\n9 10", "11\n717170 795210\n866429 970764\n163324 322182\n677099 717170\n241684 393937\n50433 114594\n970764 997956\n393937 664883\n235698 241684\n795210 832346\n114594 232438", "16\n203671 381501\n58867 59732\n817520 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 12 | codeforces | |
55e0f5d579ec5fa6ede167fd6433cad2 | Gifts by the List | Sasha lives in a big happy family. At the Man's Day all the men of the family gather to celebrate it following their own traditions. There are *n* men in Sasha's family, so let's number them with integers from 1 to *n*.
Each man has at most one father but may have arbitrary number of sons.
Man number *A* is considere... | {"inputs": ["3 2\n1 2\n2 3\n1 2 1", "4 2\n1 2\n3 4\n1 2 3 3", "1 0\n1", "2 1\n2 1\n2 2", "2 1\n2 1\n1 2", "4 3\n1 2\n2 3\n3 4\n1 1 3 2", "4 3\n4 3\n3 2\n2 1\n3 4 4 4", "4 3\n1 2\n2 3\n3 4\n1 1 1 2"], "outputs": ["-1", "3\n2\n1\n3", "1\n1", "1\n2", "2\n1\n2", "-1", "-1", "-1"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
55e2de5ea4444a213d58a4e0107ee79d | none | Bob is about to take a hot bath.
There are two taps to fill the bath: a hot water tap and a cold water tap. The cold water's temperature is *t*1, and the hot water's temperature is *t*2. The cold water tap can transmit any integer number of water units per second from 0 to *x*1, inclusive. Similarly, the hot water ta... | {"inputs": ["10 70 100 100 25", "300 500 1000 1000 300", "143 456 110 117 273", "10 20 5 5 13", "1 3 1999 3444 2", "100 110 2 2 109", "3746 3797 485 485 3747", "900000 1000000 50000 50000 960000", "1 3 100 100 2", "1 3 100 100 3", "1 1 100 100 1", "1 1 1 1 1", "10 14 1 1 12", "10 14 1 1 13", "10 14 1 1 14", "10 14 1 1 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.