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 |
|---|---|---|---|---|---|---|---|---|---|
e070fa09a730ded5af470dfb1b5ddf32 | Almost Identity Permutations | A permutation *p* of size *n* is an array such that every integer from 1 to *n* occurs exactly once in this array.
Let's call a permutation an almost identity permutation iff there exist at least *n*<=-<=*k* indices *i* (1<=≤<=*i*<=≤<=*n*) such that *p**i*<==<=*i*.
Your task is to count the number of almost identity ... | {"inputs": ["4 1", "4 2", "5 3", "5 4", "200 1", "200 2", "200 3", "200 4", "400 1", "400 2", "400 3", "400 4", "600 1", "600 2", "600 3", "600 4", "800 1", "800 2", "800 3", "800 4", "1000 1", "1000 2", "1000 3", "1000 4", "4 4"], "outputs": ["1", "7", "31", "76", "1", "19901", "2646701", "584811251", "1", "79801", "2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 118 | codeforces | |
e095fc0f2706652ae0c7e6370b7eedb8 | Timetable | Ivan is a student at Berland State University (BSU). There are *n* days in Berland week, and each of these days Ivan might have some classes at the university.
There are *m* working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during *i*... | {"inputs": ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110", "3 4 0\n0000\n0000\n0000", "3 4 12\n1111\n1111\n1111", "3 4 6\n1111\n1111\n1111", "10 10 0\n1000000001\n1000000001\n1000000001\n1000000001\n1000000001\n1000000001\n1000000001\n1000000001\n1000000001\n1000000001", "10 10 5\n1000000001\n1000000001\n1000000001\n100... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
e0978618e361da10f11b0837442672c5 | Game on Tree | Momiji has got a rooted tree, consisting of *n* nodes. The tree nodes are numbered by integers from 1 to *n*. The root has number 1. Momiji decided to play a game on this tree.
The game consists of several steps. On each step, Momiji chooses one of the remaining tree nodes (let's denote it by *v*) and removes all the ... | {"inputs": ["2\n1 2", "3\n1 2\n1 3", "10\n1 2\n2 3\n3 4\n1 5\n2 6\n6 7\n4 8\n6 9\n9 10", "6\n1 3\n2 4\n5 6\n3 6\n5 4"], "outputs": ["1.50000000000000000000", "2.00000000000000000000", "3.81666666666666690000", "2.45000000000000020000"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
e0a25aa6735cc7bbb4f5284e0f982675 | Watching Fireworks is Fun | A festival will be held in a town's main street. There are *n* sections in the main street. The sections are numbered 1 through *n* from left to right. The distance between each adjacent sections is 1.
In the festival *m* fireworks will be launched. The *i*-th (1<=≤<=*i*<=≤<=*m*) launching is on time *t**i* at section... | {"inputs": ["50 3 1\n49 1 1\n26 1 4\n6 1 10", "10 2 1\n1 1000 4\n9 1000 4", "30 8 2\n15 97 3\n18 64 10\n20 14 20\n16 18 36\n10 23 45\n12 60 53\n17 93 71\n11 49 85", "100 20 5\n47 93 3\n61 49 10\n14 69 10\n88 2 14\n35 86 18\n63 16 20\n39 49 22\n32 45 23\n66 54 25\n77 2 36\n96 85 38\n33 28 45\n29 78 53\n78 13 60\n58 96 6... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
e0a8066c3ffaf53d1423dd8bb7537fb4 | The Brand New Function | Polycarpus has a sequence, consisting of *n* non-negative integers: *a*1,<=*a*2,<=...,<=*a**n*.
Let's define function *f*(*l*,<=*r*) (*l*,<=*r* are integer, 1<=≤<=*l*<=≤<=*r*<=≤<=*n*) for sequence *a* as an operation of bitwise OR of all the sequence elements with indexes from *l* to *r*. Formally: *f*(*l*,<=*r*)<==<=... | {"inputs": ["3\n1 2 0", "10\n1 2 3 4 5 6 1 2 9 10", "1\n123", "10\n6 8 4 5 1 9 10 2 3 7", "7\n1 2 4 8 16 32 64", "10\n375813 659427 484038 348181 432640 368050 271089 721588 345312 630771", "5\n0 1 2 0 4", "1\n0", "1\n1000000"], "outputs": ["4", "11", "1", "15", "28", "29", "7", "1", "1"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 21 | codeforces | |
e0d0422a544145c98c802c1517bec7f7 | Industrial Nim | There are *n* stone quarries in Petrograd.
Each quarry owns *m**i* dumpers (1<=≤<=*i*<=≤<=*n*). It is known that the first dumper of the *i*-th quarry has *x**i* stones in it, the second dumper has *x**i*<=+<=1 stones in it, the third has *x**i*<=+<=2, and the *m**i*-th dumper (the last for the *i*-th quarry) has *x**... | {"inputs": ["2\n2 1\n3 2", "4\n1 1\n1 1\n1 1\n1 1", "10\n2 3\n1 4\n5 8\n4 10\n10 8\n7 2\n1 2\n1 7\n4 10\n5 3", "20\n8 6\n6 3\n2 9\n7 8\n9 1\n2 4\n3 6\n6 3\n5 6\n5 3\n6 5\n2 10\n2 9\n6 3\n10 6\n10 10\n10 7\n3 9\n16 1\n1 3", "30\n53 12\n13 98\n21 60\n76 58\n39 5\n62 58\n73 80\n13 75\n37 45\n44 86\n1 85\n13 33\n17 50\n12 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
e0d62a2e04817aababe97ea9ff251c84 | Dividing the numbers | Petya has *n* integers: 1,<=2,<=3,<=...,<=*n*. He wants to split these integers in two non-empty groups in such a way that the absolute difference of sums of integers in each group is as small as possible.
Help Petya to split the integers. Each of *n* integers should be exactly in one group.
The first line contains a... | {"inputs": ["4", "2", "3", "5", "59998", "60000", "59991", "59989", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "59999", "59997", "59996", "59995", "59994", "59993", "59992", "59990", "100", "1000", "10001", "103", "1002", "31724", "2032", "42620", "1807... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 144 | codeforces | |
e0d9b47413ecdfc4e7b25dd15d254c2c | Two Strings Swaps | You are given two strings $a$ and $b$ consisting of lowercase English letters, both of length $n$. The characters of both strings have indices from $1$ to $n$, inclusive.
You are allowed to do the following changes:
- Choose any index $i$ ($1 \le i \le n$) and swap characters $a_i$ and $b_i$; - Choose any index $... | {"inputs": ["7\nabacaba\nbacabaa", "5\nzcabd\ndbacz", "1\na\nb", "5\nahmad\nyogaa"], "outputs": ["4", "0", "1", "3"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 18 | codeforces | |
e12509b906dd993ec3ead38d458dc7f9 | Maximize Sum of Digits | Anton has the integer *x*. He is interested what positive integer, which doesn't exceed *x*, has the maximum sum of digits.
Your task is to help Anton and to find the integer that interests him. If there are several such integers, determine the biggest of them.
The first line contains the positive integer *x* (1<=≤<=*... | {"inputs": ["100", "48", "521", "1", "2", "3", "39188", "5", "6", "7", "8", "9", "10", "59999154", "1000", "10000", "100000", "1000000", "10000000", "100000000", "1000000000", "10000000000", "100000000000", "1000000000000", "10000000000000", "100000000000000", "1000000000000000", "10000000000000000", "10000000000000000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
e130bca7c9717c52c141f6eb021a0626 | Delete from the Left | You are given two strings $s$ and $t$. In a single move, you can choose any of two strings and delete the first (that is, the leftmost) character. After a move, the length of the string decreases by $1$. You can't choose a string if it is empty.
For example:
- by applying a move to the string "where", the result is ... | {"inputs": ["test\nwest", "codeforces\nyes", "test\nyes", "b\nab", "z\nz", "abacabadabacaba\nabacabadacaba", "z\na", "ama\nsama", "aaabc\nbc", "lxuyspmieeuyxluv\ndfwxqvavzxctblaa", "ahmedaly\naly", "aa\na", "aa\nba", "cccba\nba", "a\nab", "dadc\ndddc", "aacaaab\nb", "dddc\ncdcde", "bbdab\ndab", "a\naa", "aa\nab", "code... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 233 | codeforces | |
e13a6e6f6d8c190168588e4e23f98439 | DZY Loves Strings | DZY loves collecting special strings which only contain lowercase letters. For each lowercase letter *c* DZY knows its value *w**c*. For each special string *s*<==<=*s*1*s*2... *s*|*s*| (|*s*| is the length of the string) he represents its value with a function *f*(*s*), where
Now DZY has a string *s*. He wants to in... | {"inputs": ["abc\n3\n1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1", "mmzhr\n3\n443 497 867 471 195 670 453 413 579 466 553 881 847 642 269 996 666 702 487 209 257 741 974 133 519 453", "ajeeseerqnpaujubmajpibxrccazaawetywxmifzehojf\n23\n359 813 772 413 733 654 33 87 890 433 395 311 801 852 376 148 914 420 636 69... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 420 | codeforces | |
e1478fe113da588a61423b6304a9e4dc | Godsend | Leha somehow found an array consisting of *n* integers. Looking at it, he came up with a task. Two players play the game on the array. Players move one by one. The first player can choose for his move a subsegment of non-zero length with an odd sum of numbers and remove it from the array, after that the remaining parts... | {"inputs": ["4\n1 3 2 3", "2\n2 2", "4\n2 4 6 8", "5\n1 1 1 1 1", "4\n720074544 345031254 849487632 80870826", "1\n0", "1\n999999999", "2\n1 999999999", "4\n3 3 4 4", "2\n1 2", "8\n2 2 2 1 1 2 2 2", "5\n3 3 2 2 2", "4\n0 1 1 0", "3\n1 2 2", "6\n2 2 1 1 4 2", "8\n2 2 2 3 3 2 2 2", "4\n2 3 3 4", "10\n2 2 2 2 3 1 2 2 2 2"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 223 | codeforces | |
e14b7011b3fe8a743e826ee023646996 | Kitahara Haruki's Gift | Kitahara Haruki has bought *n* apples for Touma Kazusa and Ogiso Setsuna. Now he wants to divide all the apples between the friends.
Each apple weights 100 grams or 200 grams. Of course Kitahara Haruki doesn't want to offend any of his friend. Therefore the total weight of the apples given to Touma Kazusa must be equa... | {"inputs": ["3\n100 200 100", "4\n100 100 100 200", "1\n100", "1\n200", "2\n100 100", "2\n200 200", "100\n200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 20... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 102 | codeforces | |
e182ab5da357b6cd08d11902dd0b81d8 | Cats Transport | Zxr960115 is owner of a large farm. He feeds *m* cute cats and employs *p* feeders. There's a straight road across the farm and *n* hills along the road, numbered from 1 to *n* from left to right. The distance between hill *i* and (*i*<=-<=1) is *d**i* meters. The feeders live in hill 1.
One day, the cats went out to ... | {"inputs": ["4 6 2\n1 3 5\n1 0\n2 1\n4 9\n1 10\n2 10\n3 12"], "outputs": ["3"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
e186d5e1fd55287a9b94b5ef95540968 | Distances to Zero | You are given the array of integer numbers *a*0,<=*a*1,<=...,<=*a**n*<=-<=1. For each element find the distance to the nearest zero (to the element which equals to zero). There is at least one zero element in the given array.
The first line contains integer *n* (1<=≤<=*n*<=≤<=2·105) — length of the array *a*. The secon... | {"inputs": ["9\n2 1 0 3 0 0 3 2 4", "5\n0 1 2 3 4", "7\n5 6 0 1 -2 3 4", "1\n0", "2\n0 0", "2\n0 1", "2\n1 0", "5\n0 1000000000 1000000000 1000000000 1000000000", "5\n-1000000000 -1000000000 0 1000000000 1000000000", "5\n-1000000000 1000000000 1000000000 1000000000 0", "15\n1000000000 -1000000000 -1000000000 1000000000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 109 | codeforces | |
e1c5ad14b20dbf5c26e55715bcabf8fe | Blog Photo | One popular blog site edits the uploaded photos like this. It cuts a rectangular area out of them so that the ratio of height to width (i.e. the *height*<=/<=*width* quotient) can vary from 0.8 to 1.25 inclusively. Besides, at least one side of the cut area should have a size, equal to some power of number 2 (2*x* for ... | {"inputs": ["2 1", "2 2", "5 5", "9 10", "15 13", "47 46", "99 100", "939 887", "4774 4806", "39271 49032", "483242 484564", "4939191 4587461", "9909199 9945873", "49829224 49889315", "49728622 49605627", "49934587 49239195", "48298903 49928606", "49874820 49474021", "48945079 49798393", "99692141 99232337", "998557701... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
e1c6638094e6ffa59cfa504b3bf9c472 | Year of University Entrance | There is the faculty of Computer Science in Berland. In the social net "TheContact!" for each course of this faculty there is the special group whose name equals the year of university entrance of corresponding course of students at the university.
Each of students joins the group of his course and joins all groups f... | {"inputs": ["3\n2014 2016 2015", "1\n2050", "1\n2010", "1\n2011", "3\n2010 2011 2012", "3\n2049 2047 2048", "5\n2043 2042 2041 2044 2040", "5\n2012 2013 2014 2015 2016", "1\n2045", "1\n2046", "1\n2099", "1\n2100", "3\n2011 2010 2012", "3\n2011 2012 2010", "3\n2012 2011 2010", "3\n2010 2012 2011", "3\n2012 2010 2011", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 202 | codeforces | |
e24711b2b5950e08097da53153bb27f7 | Curfew | Instructors of Some Informatics School make students go to bed.
The house contains *n* rooms, in each room exactly *b* students were supposed to sleep. However, at the time of curfew it happened that many students are not located in their assigned rooms. The rooms are arranged in a row and numbered from 1 to *n*. Init... | {"inputs": ["5 1 1\n1 0 0 0 4", "6 1 2\n3 8 0 1 0 0", "5 1 1\n1 1 0 3 0", "5 1 1\n4 0 0 1 0", "2 1 1\n0 2", "100 66 30\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 25 27 15 53 29 56 30 24 50 39 39 46 4 14 44 16 55 48 15 54 25 4 44 15 29 55 22 49 52 9 2 22 15 14 33 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
e252f37a5a13caef34246bf269d2c655 | Broken BST | Let *T* be arbitrary binary tree — tree, every vertex of which has no more than two children. Given tree is rooted, so there exists only one vertex which doesn't have a parent — it's the root of a tree. Every vertex has an integer number written on it. Following algorithm is run on every value from the tree *T*:
1. S... | {"inputs": ["3\n15 -1 -1\n10 1 3\n5 -1 -1", "8\n6 2 3\n3 4 5\n12 6 7\n1 -1 8\n4 -1 -1\n5 -1 -1\n14 -1 -1\n2 -1 -1", "1\n493041212 -1 -1", "10\n921294733 5 9\n341281094 -1 -1\n35060484 10 -1\n363363160 -1 -1\n771156014 6 8\n140806462 -1 -1\n118732846 4 2\n603229555 -1 -1\n359289513 3 7\n423237010 -1 -1", "10\n911605217 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
e2626de63784e9b7531e6074e35aabfc | k-Tree | Quite recently a creative student Lesha had a lecture on trees. After the lecture Lesha was inspired and came up with the tree of his own which he called a *k*-tree.
A *k*-tree is an infinite rooted tree where:
- each vertex has exactly *k* children; - each edge has some weight; - if we look at the edges that goes... | {"inputs": ["3 3 2", "3 3 3", "4 3 2", "4 5 2", "28 6 3", "5 100 1", "50 6 3", "10 13 6", "20 16 14", "1 10 1", "8 11 4", "16 5 4", "5 26 17", "35 47 42", "11 6 2", "54 60 16", "47 5 1", "70 6 1", "40 77 77", "96 9 6", "52 46 4", "74 41 28", "100 100 100", "99 99 5", "100 100 1", "98 98 64", "28 74 2", "86 69 62", "9 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 77 | codeforces | |
e28053549a307d4c6f596921d5df6f25 | Homework | Once when Gerald studied in the first year at school, his teacher gave the class the following homework. She offered the students a string consisting of *n* small Latin letters; the task was to learn the way the letters that the string contains are written. However, as Gerald is too lazy, he has no desire whatsoever to... | {"inputs": ["aaaaa\n4", "abacaba\n4", "abcdefgh\n10", "aaaaaaaaaaaaaaaaaaaa\n19", "abcdefghijjihgedcba\n0", "aababcabcdabcde\n9", "xyzuvwxyz\n4", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n99", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n0", "abcdefghijklmnopqrstuvwxyz\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 43 | codeforces | |
e28950364eeabec68304f41b59baaf3a | Yaroslav and Two Strings | Yaroslav thinks that two strings *s* and *w*, consisting of digits and having length *n* are non-comparable if there are two numbers, *i* and *j* (1<=≤<=*i*,<=*j*<=≤<=*n*), such that *s**i*<=><=*w**i* and *s**j*<=<<=*w**j*. Here sign *s**i* represents the *i*-th digit of string *s*, similarly, *w**j* represents t... | {"inputs": ["2\n90\n09", "2\n11\n55", "5\n?????\n?????", "10\n104?3?1??3\n?1755?1??7", "10\n6276405116\n6787?352?9", "10\n0844033584\n0031021311", "10\n???0?19?01\n957461????", "10\n8703870339\n994987934?", "10\n?8?528?91?\n45??06???1", "10\n8030456630\n83406?6890", "1\n?\n?", "2\n12\n?9", "3\n??1\n?12", "3\n?12\n??1",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
e29a81b722db7b430a0a5ff0aaf2aa1f | A Map of the Cat | If you have ever interacted with a cat, you have probably noticed that they are quite particular about how to pet them. Here is an approximate map of a normal cat.
However, some cats won't tolerate this nonsense from the humans. Here is a map of a grumpy cat.
You have met a cat. Can you figure out whether it's normal... | {"inputs": ["5 0 1 2 5 3 5 4 5 5", "5 5 5 6 6 7 8 9 10 11", "10 6 5 7 5 6 11 5 8 9", "7 10 8 9 6 5 5 11 5 6", "5 5 4 5 2 5 5 0 1 3", "0 4 3 5 5 5 2 1 5 5", "3 5 5 0 5 5 2 5 4 1", "5 4 5 1 5 5 0 5 2 3", "5 5 1 2 5 5 4 3 0 5", "7 10 5 5 11 6 5 9 6 8", "6 5 10 5 5 7 8 11 9 6", "5 5 5 5 5 0 4 2 3 1", "11 5 6 5 9 5 10 8 7 6... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 24 | codeforces | |
e2bca028d9266e692bf63ce037440cc9 | Bath Queue | There are *n* students living in the campus. Every morning all students wake up at the same time and go to wash. There are *m* rooms with wash basins. The *i*-th of these rooms contains *a**i* wash basins. Every student independently select one the rooms with equal probability and goes to it. After all students selecte... | {"inputs": ["1 1\n2", "2 2\n1 1", "2 3\n1 1 1", "7 5\n1 1 2 3 1", "10 4\n8 4 7 6", "5 5\n5 5 5 5 5", "7 4\n1 2 3 4", "50 50\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1", "30 30\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1", "20 20\n1 1 1 1 1 1 1 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
e2c2354fd6b205a5686ab9e5bc4c2f43 | Easy Number Challenge | Let's denote *d*(*n*) as the number of divisors of a positive integer *n*. You are given three integers *a*, *b* and *c*. Your task is to calculate the following sum:
Find the sum modulo 1073741824 (230).
The first line contains three space-separated integers *a*, *b* and *c* (1<=≤<=*a*,<=*b*,<=*c*<=≤<=100).
Print a s... | {"inputs": ["2 2 2", "5 6 7", "91 42 25", "38 47 5", "82 29 45", "40 15 33", "35 5 21", "71 2 1", "22 44 41", "73 19 29", "76 12 17", "16 10 49", "59 99 33", "17 34 25", "21 16 9", "31 51 29", "26 41 17", "85 19 5", "36 61 45", "76 58 25", "71 48 13", "29 34 53", "72 16 41", "8 21 21", "11 51 5", "70 38 49", "13 31 33"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
e319d416e5dc2aab18120817702c6393 | Feed with Candy | The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem.
One day, Om Nom visited his friend Evan. Evan has *n* candies of two types (fruit drops and caramel drops), the *i*-th candy hangs at the height of *h**i* centimeters ab... | {"inputs": ["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5", "5 2\n1 15 2\n1 11 2\n0 17 2\n0 16 1\n1 18 2", "6 2\n1 17 3\n1 6 1\n0 4 2\n1 10 1\n1 7 3\n1 5 1", "7 2\n1 14 1\n1 9 2\n0 6 3\n0 20 2\n0 4 2\n0 3 1\n0 9 2", "8 2\n0 20 3\n1 5 2\n1 4 1\n1 7 1\n0 1 3\n1 5 3\n1 7 2\n1 3 1", "9 2\n0 1 1\n1 8 2\n1 11 1\n0 9 1\n1 18 2\n1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 17 | codeforces | |
e32e231b443af9f76b845068a3b5735c | Dividing Orange | One day Ms Swan bought an orange in a shop. The orange consisted of *n*·*k* segments, numbered with integers from 1 to *n*·*k*.
There were *k* children waiting for Ms Swan at home. The children have recently learned about the orange and they decided to divide it between them. For that each child took a piece of paper... | {"inputs": ["2 2\n4 1", "3 1\n2", "5 5\n25 24 23 22 21", "1 30\n8 22 13 25 10 30 12 27 6 4 7 2 20 16 26 14 15 17 23 3 24 9 5 11 29 1 19 28 21 18", "30 1\n29", "10 10\n13 39 6 75 84 94 96 21 85 71", "10 15\n106 109 94 50 3 143 147 10 89 145 29 28 87 126 110", "15 10\n126 111 12 6 28 47 51 116 53 35", "30 30\n455 723 796... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 151 | codeforces | |
e34659897384fdf431133167ef516793 | Dungeons and Candies | During the loading of the game "Dungeons and Candies" you are required to get descriptions of *k* levels from the server. Each description is a map of an *n*<=×<=*m* checkered rectangular field. Some cells of the field contain candies (each cell has at most one candy). An empty cell is denoted as "." on the map, but if... | {"inputs": ["1 1 4 1\nA\n.\nB\n.", "1 3 5 2\nABA\nBBB\nBBA\nBAB\nABB", "2 2 5 1\n..\nBA\n.A\nB.\n..\nA.\nAB\n.B\n..\n..", "3 3 10 2\nBA.\n..A\n.BB\nB..\n..B\n.AA\nB..\nAB.\n..A\nBAB\n.A.\n.B.\n..B\nA..\n...\n...\n.B.\nBA.\n..B\n.AB\n.B.\nB.A\n.A.\n.BA\n..B\n...\n.A.\n.AA\n..A\n.B.", "3 1 5 1\nB\nA\nB\nA\nA\nB\nA\nA\nA\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
e34b47ed73a79f95085318930434821b | Special Olympics | A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine.
Let us remind you that a ring is a region located between two... | {"inputs": ["60 60 45 55\n80 80 8 32", "60 60 45 55\n80 60 15 25", "50 50 35 45\n90 50 35 45", "0 0 50 70\n1 0 60 80", "0 0 1 2\n10 0 2 20", "31 13 22 95\n48 63 21 98", "31 40 37 76\n48 65 66 98", "-65 -81 37 76\n48 65 66 98", "41 -14 37 76\n48 65 66 98", "41 -14 16 100\n48 17 37 66", "-75 -9 20 40\n25 55 99 100", "-45... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 7 | codeforces | |
e3545ed51cba0620cc82f0844cfe967d | Fifa and Fafa | Fifa and Fafa are sharing a flat. Fifa loves video games and wants to download a new soccer game. Unfortunately, Fafa heavily uses the internet which consumes the quota. Fifa can access the internet through his Wi-Fi access point. This access point can be accessed within a range of *r* meters (this range can be chosen ... | {"inputs": ["5 3 3 1 1", "10 5 5 5 15", "5 0 0 0 7", "10 0 0 0 0", "100000 100000 100000 10000 10000", "100000 -100000 100000 -10000 100000", "1 0 0 0 -1", "100000 83094 84316 63590 53480", "1 0 0 0 0", "1 0 0 -2 -2", "10 0 0 4 0", "82 1928 -30264 2004 -30294", "75 -66998 89495 -66988 89506", "11 9899 34570 9895 34565"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
e359e5399b15238079e2f37af9c7990d | Petya and File System | Recently, on a programming lesson little Petya showed how quickly he can create files and folders on the computer. But he got soon fed up with this activity, and he decided to do a much more useful thing. He decided to calculate what folder contains most subfolders (including nested folders, nested folders of nested fo... | {"inputs": ["C:\\folder1\\file1.txt", "C:\\folder1\\folder2\\folder3\\file1.txt\nC:\\folder1\\folder2\\folder4\\file1.txt\nD:\\folder1\\file1.txt", "C:\\file\\file\\file\\file\\file.txt\nC:\\file\\file\\file\\file2\\file.txt", "C:\\file\\file.txt\nD:\\file\\file.txt\nE:\\file\\file.txt\nF:\\file\\file.txt\nG:\\file\\fi... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
e35b59696236a1f3116b78369f8d714a | Petya and Catacombs | A very brave explorer Petya once decided to explore Paris catacombs. Since Petya is not really experienced, his exploration is just walking through the catacombs.
Catacombs consist of several rooms and bidirectional passages between some pairs of them. Some passages can connect a room to itself and since the passages ... | {"inputs": ["2\n0 0", "5\n0 1 0 1 3", "7\n0 1 0 0 0 0 0", "100\n0 0 0 0 0 0 1 4 4 0 2 2 4 1 7 1 11 0 8 4 12 12 3 0 3 2 2 4 3 9 1 5 4 6 9 14 6 2 4 18 7 7 19 11 20 13 17 16 0 34 2 6 12 27 9 4 29 22 4 20 20 17 17 20 37 53 17 3 3 15 1 46 11 24 31 6 12 6 11 18 13 1 5 0 19 10 24 41 16 41 18 52 46 39 16 30 18 23 53 13", "100\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 111 | codeforces | |
e35e610ac148cf150660bb1f42980765 | Boys and Girls | There are *n* boys and *m* girls studying in the class. They should stand in a line so that boys and girls alternated there as much as possible. Let's assume that positions in the line are indexed from left to right by numbers from 1 to *n*<=+<=*m*. Then the number of integers *i* (1<=≤<=*i*<=<<=*n*<=+<=*m*) such th... | {"inputs": ["3 3", "4 2", "5 5", "6 4", "100 1", "76 48", "100 90", "90 100", "1 98", "1 100", "56 98", "89 89", "18 94", "84 27", "1 1", "1 2", "2 1", "1 34", "46 2", "99 3", "10 100", "100 100", "1 4"], "outputs": ["GBGBGB", "BGBGBB", "GBGBGBGBGB", "BGBGBGBGBB", "BGBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 92 | codeforces | |
e38c20558f898049bdd9d53ea518eea9 | Permutation Game | *n* children are standing in a circle and playing a game. Children's numbers in clockwise order form a permutation *a*1,<=*a*2,<=...,<=*a**n* of length *n*. It is an integer sequence such that each integer from 1 to *n* appears exactly once in it.
The game consists of *m* steps. On each step the current leader with in... | {"inputs": ["4 5\n2 3 1 4 4", "3 3\n3 1 2", "1 100\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1", "6 8\n2 5 4 2 5 4 2 5", "100 1\n6", "10 5\n7 7 9 9 3", "10 20\n10 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 19 | codeforces | |
e38dfdf946eae11efa5d9a21f3f4c2e0 | Unsorting Array | Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of *n* elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct ... | {"inputs": ["1\n1", "2\n1 2", "4\n1 2 3 4", "3\n1 1 1", "3\n1 2 2", "5\n1 1 1 1 2", "6\n1 2 3 3 2 1", "7\n6 5 4 3 2 1 0", "10\n1 2 1 2 1 2 1 2 1 2", "11\n1 1 1 1 1 2 2 2 2 2 1", "3\n1 2 1", "4\n562617869 961148050 596819899 951133776", "4\n562617869 596819899 951133776 961148050", "4\n961148050 951133776 596819899 5626... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
e39c2b784af5d5aba5d400fe46821f40 | Voting for Photos | After celebrating the midcourse the students of one of the faculties of the Berland State University decided to conduct a vote for the best photo. They published the photos in the social network and agreed on the rules to choose a winner: the photo which gets most likes wins. If multiple photoes get most likes, the win... | {"inputs": ["5\n1 3 2 2 1", "9\n100 200 300 200 100 300 300 100 200", "1\n5", "1\n1000000", "5\n1 3 4 2 2", "10\n2 1 2 3 1 5 8 7 4 8", "7\n1 1 2 2 2 3 3", "12\n2 3 1 2 3 3 3 2 1 1 2 1", "15\n7 6 8 4 9 8 7 3 4 6 7 5 4 2 8", "15\n100 200 300 500 300 400 600 300 100 200 400 300 600 200 100", "10\n677171 677171 677171 6771... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 119 | codeforces | |
e3abacc6abe0ee07cdb442dc8ff735e4 | Is This a Zebra? | A camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of *n* pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a sequence of *n* zeros and ones, where 0 means that the corresponding column is all white, and 1 m... | {"inputs": ["9\n0 0 0 1 1 1 0 0 0", "7\n0 0 0 1 1 1 1", "5\n1 1 1 1 1", "8\n1 1 1 0 0 0 1 1", "9\n1 1 0 1 1 0 1 1 0", "1\n0", "1\n1", "2\n0 0", "2\n0 1", "2\n1 0", "2\n1 1", "3\n1 1 0", "7\n0 0 0 1 1 1 0", "3\n0 1 1", "3\n0 0 1", "6\n0 0 1 0 1 0", "4\n0 1 1 0", "5\n0 1 1 0 0", "4\n0 1 0 0", "5\n1 1 1 0 0", "10\n0 0 1 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 91 | codeforces | |
e3b1fb30d6b7e49c9f8d4e32d68da69a | Little Pony and Summer Sun Celebration | Twilight Sparkle learnt that the evil Nightmare Moon would return during the upcoming Summer Sun Celebration after one thousand years of imprisonment on the moon. She tried to warn her mentor Princess Celestia, but the princess ignored her and sent her to Ponyville to check on the preparations for the celebration.
Twi... | {"inputs": ["3 2\n1 2\n2 3\n1 1 1", "5 7\n1 2\n1 3\n1 4\n1 5\n3 4\n3 5\n4 5\n0 1 0 1 0", "2 0\n0 0", "10 10\n2 1\n2 3\n4 2\n4 5\n3 6\n5 7\n8 4\n4 9\n5 10\n4 7\n0 0 1 0 1 1 1 0 1 0", "10 10\n2 1\n3 1\n4 1\n3 5\n6 2\n5 7\n1 8\n5 9\n10 5\n7 2\n1 0 0 0 1 1 1 0 0 1", "10 10\n1 2\n1 3\n3 4\n3 5\n6 1\n7 6\n8 7\n9 7\n10 1\n2 4... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
e3bcaa6255789a6043a882a7aa399d52 | Vladik and flights | Vladik is a competitive programmer. This year he is going to win the International Olympiad in Informatics. But it is not as easy as it sounds: the question Vladik face now is to find the cheapest way to get to the olympiad.
Vladik knows *n* airports. All the airports are located on a straight line. Each airport has u... | {"inputs": ["4 1 4\n1010", "5 5 2\n10110", "10 9 5\n1011111001", "7 3 7\n1110111", "1 1 1\n1", "10 3 3\n1001011011", "1 1 1\n0", "10 5 8\n1000001110", "10 1 10\n0000011111", "4 1 4\n0011", "10 3 7\n0000011111", "5 1 5\n11010", "6 1 6\n111000", "2 1 2\n01", "10 10 1\n0000011111", "6 1 6\n000111", "10 2 10\n0000011111", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 201 | codeforces | |
e3ef0e1738a58490809dd66924789fd2 | Eleven | Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. Eleven wants her name to have exactly *n* characters.
Her friend suggested that her name should only consist of uppercase and lowercase letters 'O'. More precisely, they suggested that the ... | {"inputs": ["8", "15", "85", "381", "805", "1000", "1", "2", "3", "5", "17", "49", "256", "512", "933", "61", "781", "999"], "outputs": ["OOOoOooO", "OOOoOooOooooOoo", "OOOoOooOooooOoooooooOooooooooooooOooooooooooooooooooooOoooooooooooooooooooooooooooooo", "OOOoOooOooooOoooooooOooooooooooooOooooooooooooooooooooOooooooo... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 455 | codeforces | |
e3fe082fc38571aabd3b4f88454d51ea | Choosing The Commander | As you might remember from the previous round, Vova is currently playing a strategic game known as Rage of Empires.
Vova managed to build a large army, but forgot about the main person in the army - the commander. So he tries to hire a commander, and he wants to choose the person who will be respected by warriors.
Ea... | {"inputs": ["5\n1 3\n1 4\n3 6 3\n2 4\n3 6 3"], "outputs": ["1\n0"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
e40684cda255dcda1121368f0af3e27d | Periodic RMQ Problem | You are given an array *a* consisting of positive integers and *q* queries to this array. There are two types of queries:
- 1 *l* *r* *x* — for each index *i* such that *l*<=≤<=*i*<=≤<=*r* set *a**i*<==<=*x*. - 2 *l* *r* — find the minimum among such *a**i* that *l*<=≤<=*i*<=≤<=*r*.
We decided that this problem is... | {"inputs": ["3 1\n1 2 3\n3\n2 1 3\n1 1 2 4\n2 1 3", "3 2\n1 2 3\n5\n2 4 4\n1 4 4 5\n2 4 4\n1 1 6 1\n2 6 6", "10 10\n10 8 10 9 2 2 4 6 10 1\n10\n1 17 87 5\n2 31 94\n1 5 56 8\n1 56 90 10\n1 25 93 6\n1 11 32 4\n2 20 49\n1 46 87 8\n2 14 48\n2 40 48", "10 10\n4 2 3 8 1 2 1 7 5 4\n10\n2 63 87\n2 2 48\n2 5 62\n2 33 85\n2 30 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
e40c630afd73a6f1182ef69cbf40aad2 | Infinite Inversions | There is an infinite sequence consisting of all positive integers in the increasing order: *p*<==<={1,<=2,<=3,<=...}. We performed *n* swap operations with this sequence. A *swap*(*a*,<=*b*) is an operation of swapping the elements of the sequence on positions *a* and *b*. Your task is to find the number of inversions ... | {"inputs": ["2\n4 2\n1 4", "3\n1 6\n3 4\n2 5", "1\n1000000000 1", "5\n2 5\n6 3\n4 6\n5 4\n2 5", "4\n2 5\n4 3\n1 4\n6 2", "3\n1 3\n4 6\n5 2", "5\n1 1000000000\n2 999999999\n3 999999998\n4 999999997\n5 999999996", "30\n1 200000\n2 199999\n3 199998\n4 199997\n5 199996\n200001 399996\n200002 399997\n200003 399998\n200004 3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
e421645e9eb603b650a8ddacc45396f5 | Jamie and Interesting Graph | Jamie has recently found undirected weighted graphs with the following properties very interesting:
- The graph is connected and contains exactly *n* vertices and *m* edges. - All edge weights are integers and are in range [1,<=109] inclusive. - The length of shortest path from 1 to *n* is a prime number. - The su... | {"inputs": ["4 4", "5 4", "2 1", "10 19", "9 18", "92 280", "89 3439", "926 31057", "753 98686", "9724 31045", "8732 93395", "80297 83088", "86549 98929", "87 109", "95 3582", "96 557", "85 3106", "98 367", "77 2344", "84 286", "100 4665", "94 350", "100 4309", "88 666", "93 4075", "100 342", "84 3482", "943 51645", "8... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 23 | codeforces | |
e45b65b89c65f1b5c76b0d160106837e | Little Girl and Maximum XOR | A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers *l* and *r*. Let's consider the values of for all pairs of integers *a* and *b* (*l*<=≤<=*a*<=≤<=*b*<=≤<=*r*). Your task is to find the maximum value among all considered ones.
Expression means applying bitw... | {"inputs": ["1 2", "8 16", "1 1", "506 677", "33 910", "36 94", "10000000000 20000000000", "79242383109441603 533369389165030783", "797162752288318119 908416915938410706", "230148668013473494 573330407369354716", "668869743157683834 805679503731305624", "32473107276976561 588384394540535099", "632668612680440378 864824... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 54 | codeforces | |
e473417d063d5db8ecc735c3ecdaf67d | Alyona and the Tree | Alyona decided to go on a diet and went to the forest to get some apples. There she unexpectedly found a magic rooted tree with root in the vertex 1, every vertex and every edge of which has a number written on.
The girl noticed that some of the tree's vertices are sad, so she decided to play with them. Let's call ver... | {"inputs": ["9\n88 22 83 14 95 91 98 53 11\n3 24\n7 -8\n1 67\n1 64\n9 65\n5 12\n6 -80\n3 8", "6\n53 82 15 77 71 23\n5 -77\n6 -73\n2 0\n1 26\n4 -92", "10\n99 60 68 46 51 11 96 41 48 99\n4 50\n6 -97\n3 -92\n7 1\n9 99\n2 79\n1 -15\n8 -68\n5 -84", "8\n53 41 22 22 34 95 56 24\n3 -20\n7 -56\n5 -3\n3 22\n1 37\n6 -34\n2 32", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 22 | codeforces | |
e47af8d23ee4295de6a8eeae7a68aa9d | Marina and Vasya | Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly *t* characters. Help Vasya find at least one such string.
More formally, you are given two strings *s*1, *s*2 of length *n* and number *t*. Let's denote as *f*(*a*,<=*b*) the number of characters in whi... | {"inputs": ["3 2\nabc\nxyc", "1 0\nc\nb", "1 1\na\na", "2 1\naa\naa", "3 1\nbcb\nbca", "4 3\nccbb\ncaab", "4 2\nacbc\nacba", "4 1\nbcbc\nacab", "4 2\nacbb\nbabc", "5 2\nabaac\nbbbaa", "5 2\nabbab\nacbab", "5 3\nbcaaa\ncbacc", "5 3\ncbacb\ncbacb", "5 1\ncbabb\nbabaa", "1 0\na\na", "2 2\nbb\ncb", "2 1\ncc\nba", "2 0\nbb\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
e4848ab39b32f977a4fce10003d683ec | Second-Price Auction | In this problem we consider a special type of an auction, which is called the second-price auction. As in regular auction *n* bidders place a bid which is price a bidder ready to pay. The auction is closed, that is, each bidder secretly informs the organizer of the auction price he is willing to pay. After that, the au... | {"inputs": ["2\n5 7", "3\n10 2 8", "6\n3 8 2 9 4 14", "4\n4707 7586 4221 5842", "5\n3304 4227 4869 6937 6002", "6\n5083 3289 7708 5362 9031 7458", "7\n9038 6222 3392 1706 3778 1807 2657", "8\n7062 2194 4481 3864 7470 1814 8091 733", "9\n2678 5659 9199 2628 7906 7496 4524 2663 3408", "2\n3458 1504", "50\n9237 3904 407 9... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 409 | codeforces | |
e485a47b51ae09651c2a41eea8f762d7 | Looksery Party | The Looksery company, consisting of *n* staff members, is planning another big party. Every employee has his phone number and the phone numbers of his friends in the phone book. Everyone who comes to the party, sends messages to his contacts about how cool it is. At the same time everyone is trying to spend as much tim... | {"inputs": ["3\n101\n010\n001\n0 1 2", "1\n1\n1", "4\n1111\n0101\n1110\n0001\n1 0 1 0", "2\n11\n01\n0 2", "5\n10110\n01110\n00101\n00011\n00001\n0 0 2 2 3", "6\n100000\n010000\n001000\n000100\n000010\n000001\n1 1 1 1 1 1", "10\n1000100000\n0100000000\n0010001000\n0011000000\n0100100000\n0000010010\n1000001000\n00000001... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
e48eefa4a778a5eb4ace0e0e546e7606 | Возможно, вы знаете этих людей? | Основой любой социальной сети является отношение дружбы между двумя пользователями в том или ином смысле. В одной известной социальной сети дружба симметрична, то есть если *a* является другом *b*, то *b* также является другом *a*.
В этой же сети есть функция, которая демонстрирует множество людей, имеющих высокую ве... | {"inputs": ["5 51\n10 23\n23 42\n39 42\n10 39\n39 58", "5 100\n1 2\n1 3\n1 4\n2 3\n2 4", "4 1\n1 2\n1 3\n2 3\n4 5", "10 0\n648169314 459970755\n973677547 255163231\n982998000 498743911\n959912791 891928\n404623428 891928\n474720235 271683165\n709045873 539751127\n973677547 179588015\n629049356 622519100\n624998275 9589... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 12 | codeforces | |
e49b35fb289302baa36a4adb166975a2 | Vitaly and Night | One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.
Vitaly sees a building of *n* floors and 2·*m* windows on each floor. On each floor there are *m* flats num... | {"inputs": ["2 2\n0 0 0 1\n1 0 1 1", "1 3\n1 1 0 1 0 0", "3 3\n1 1 1 1 1 1\n1 1 0 1 1 0\n1 0 0 0 1 1", "1 5\n1 0 1 1 1 0 1 1 1 1", "1 100\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 534 | codeforces | |
e4a7a813d8c783e52c2741581652cff3 | The World is a Theatre | There are *n* boys and *m* girls attending a theatre club. To set a play "The Big Bang Theory", they need to choose a group containing exactly *t* actors containing no less than 4 boys and no less than one girl. How many ways are there to choose a group? Of course, the variants that only differ in the composition of th... | {"inputs": ["5 2 5", "4 3 5", "4 1 5", "7 3 6", "30 30 30", "10 10 8", "10 10 10", "10 10 20", "20 15 27", "20 20 40", "20 20 24", "4 20 20", "4 20 24", "20 3 23", "20 1 21", "20 1 5", "20 20 5", "30 30 60", "30 30 59", "30 29 55", "30 29 59", "4 30 34", "30 1 20", "30 1 31", "29 30 57", "25 30 40", "4 2 6", "5 1 6", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 18 | codeforces | |
e4bdedea4ab7fc642876b9b634d8943e | Road Improvement | The country has *n* cities and *n*<=-<=1 bidirectional roads, it is possible to get from every city to any other one if you move only along the roads. The cities are numbered with integers from 1 to *n* inclusive.
All the roads are initially bad, but the government wants to improve the state of some roads. We will ass... | {"inputs": ["3\n1 1", "5\n1 2 3 4", "31\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1", "29\n1 2 2 4 4 6 6 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28", "70\n1 2 2 4 4 6 6 8 9 9 11 11 13 13 15 15 17 17 19 19 21 22 22 24 24 26 27 27 29 29 31 31 33 34 34 36 37 37 39 39 41 42 42 44 44 46 47... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
e4ca507269f95c66d0e7b2314e214b54 | Magic Squares | The Smart Beaver from ABBYY loves puzzles. One of his favorite puzzles is the magic square. He has recently had an idea to automate the solution of this puzzle. The Beaver decided to offer this challenge to the ABBYY Cup contestants.
The magic square is a matrix of size *n*<=×<=*n*. The elements of this matrix are int... | {"inputs": ["3\n1 2 3 4 5 6 7 8 9", "3\n1 0 -1 0 2 -1 -2 0 1", "2\n5 5 5 5", "2\n-1 -1 -1 -1", "3\n58 -83 72 65 -90 -2 -9 -16 -76", "3\n399 -1025 -129 -497 927 -577 479 31 -49", "3\n2 4 6 8 10 12 14 16 18", "3\n36 31 -25 3 -20 -30 8 -2 26", "3\n175 -1047 -731 -141 38 -594 -415 -278 491", "3\n-1256 74 -770 -284 -105 381... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
e4f0ceca7cea499af8cc012c2748fc43 | Mishka and Interesting sum | Little Mishka enjoys programming. Since her birthday has just passed, her friends decided to present her with array of non-negative integers *a*1,<=*a*2,<=...,<=*a**n* of *n* elements!
Mishka loved the array and she instantly decided to determine its beauty value, but she is too little and can't process large arrays. ... | {"inputs": ["3\n3 7 8\n1\n1 3", "7\n1 2 1 3 3 2 3\n5\n4 7\n4 5\n1 3\n1 7\n1 5", "10\n1 2 4 1 1 1 1 1 1 4\n55\n5 8\n3 9\n6 8\n4 6\n4 10\n2 8\n1 5\n7 8\n8 9\n7 9\n5 6\n8 10\n9 9\n2 2\n3 3\n3 7\n1 8\n2 3\n4 9\n8 8\n10 10\n1 1\n1 6\n2 4\n6 9\n3 10\n3 8\n9 10\n7 7\n3 6\n4 7\n2 10\n7 10\n3 4\n4 8\n5 9\n2 7\n6 6\n4 4\n5 10\n1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
e51ad8620299c1b8250aa20b7d466787 | Wizards' Duel | Harry Potter and He-Who-Must-Not-Be-Named engaged in a fight to the death once again. This time they are located at opposite ends of the corridor of length *l*. Two opponents simultaneously charge a deadly spell in the enemy. We know that the impulse of Harry's magic spell flies at a speed of *p* meters per second, and... | {"inputs": ["100\n50\n50", "199\n60\n40", "1\n1\n1", "1\n1\n500", "1\n500\n1", "1\n500\n500", "1000\n1\n1", "1000\n1\n500", "1000\n500\n1", "1000\n500\n500", "101\n11\n22", "987\n1\n3", "258\n25\n431", "979\n39\n60", "538\n479\n416", "583\n112\n248", "978\n467\n371", "980\n322\n193", "871\n401\n17", "349\n478\n378", "4... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 406 | codeforces | |
e53c2a712af419ebf3b9bcf5bb958b21 | Joysticks | Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at *a*1 percent and second one is charged at *a*2 percent. You can connect charger to a joystick only at the beginning of each minute. In one minute joystick either discharges by 2 percent (if n... | {"inputs": ["3 5", "4 4", "100 100", "1 100", "100 1", "1 4", "1 1", "8 8", "7 2", "24 15", "19 30", "15 31", "14 15", "58 33", "15 25", "59 45", "3 73", "48 1", "100 25", "40 49", "85 73", "29 1", "74 25", "24 57", "23 12", "2 99", "98 2", "2 97", "30 54", "32 53", "32 54", "1 2", "2 1", "2 2", "1 3", "3 1", "1 4", "2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 202 | codeforces | |
e5403e11236a1d22e81c748ae35e1b9f | Soldier and Cards | Two bored soldiers are playing card war. Their card deck consists of exactly *n* cards, numbered from 1 to *n*, all values are different. They divide cards between them in some manner, it's possible that they have different number of cards. Then they play a "war"-like card game.
The rules are following. On each turn ... | {"inputs": ["4\n2 1 3\n2 4 2", "3\n1 2\n2 1 3", "5\n4 5 3 2 4\n1 1", "6\n2 6 5\n4 1 2 3 4", "7\n6 6 5 2 7 4 1\n1 3", "8\n7 2 3 1 5 6 4 8\n1 7", "9\n2 3 6\n7 9 7 8 5 2 1 4", "10\n3 7 10 8\n7 4 6 9 2 5 1 3", "3\n2 2 1\n1 3", "3\n2 3 2\n1 1", "3\n1 3\n2 2 1", "3\n1 1\n2 3 2", "3\n1 2\n2 3 1", "3\n2 3 1\n1 2", "3\n1 3\n2 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
e5433904b208cad09a5947d4ae338fcb | Goats and Wolves | Once Vasya needed to transport *m* goats and *m* wolves from riverbank to the other as quickly as possible. The boat can hold *n* animals and Vasya, in addition, he is permitted to put less than *n* animals in the boat. If in one place (on one of the banks or in the boat) the wolves happen to strictly outnumber the goa... | {"inputs": ["3 2", "33 3", "2 3", "100000 100000", "100000 4", "1 3", "97351 58063", "76652 89696", "2 1", "2 2", "2 4", "39600 21330", "3 1", "3 3", "3 4", "18900 52964", "4 1", "4 2", "4 3", "4 4", "4 5", "5 1", "5 2", "5 3", "5 4", "5 5", "6 6", "6 1", "6 2", "6 3", "6 4", "6 5", "99998 99998", "99998 99999", "99998... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
e56214dc9f144c4a71c86dfcd4bd0a70 | Basketball Team | As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC).
A team is to be formed of *n* players, all of which are GUC students. However, the team might have players belonging to differ... | {"inputs": ["3 2 1\n2 1", "3 2 1\n1 1", "3 2 1\n2 2", "3 2 1\n1 2", "6 5 3\n5 2 3 10 5", "7 10 6\n9 10 2 3 3 6 9 9 3 7", "17 5 1\n10 4 9 6 2", "5 8 3\n9 7 2 5 2 10 3 4", "14 8 4\n6 2 10 6 2 8 4 2", "14 9 9\n9 4 7 2 1 2 4 3 9", "46 73 68\n4 2 6 4 1 9 8 10 7 8 7 2 6 4 7 9 7 9 9 1 5 1 5 1 8 2 10 2 1 7 10 2 8 3 5 3 8 9 10 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 49 | codeforces | |
e57fcb4b4002133ee853323ff082131c | Tablecity | There was a big bank robbery in Tablecity. In order to catch the thief, the President called none other than Albert – Tablecity’s Chief of Police. Albert does not know where the thief is located, but he does know how he moves.
Tablecity can be represented as 1000<=×<=2 grid, where every cell represents one district. E... | {"inputs": ["dummy"], "outputs": ["2000\n1 1 1 2\n2 1 2 2\n3 1 3 2\n4 1 4 2\n5 1 5 2\n6 1 6 2\n7 1 7 2\n8 1 8 2\n9 1 9 2\n10 1 10 2\n11 1 11 2\n12 1 12 2\n13 1 13 2\n14 1 14 2\n15 1 15 2\n16 1 16 2\n17 1 17 2\n18 1 18 2\n19 1 19 2\n20 1 20 2\n21 1 21 2\n22 1 22 2\n23 1 23 2\n24 1 24 2\n25 1 25 2\n26 1 26 2\n27 1 27 2\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 18 | codeforces | |
e59289ccaaa19425dda3a70ff20768e5 | Memory and Crow | There are *n* integers *b*1,<=*b*2,<=...,<=*b**n* written in a row. For all *i* from 1 to *n*, values *a**i* are defined by the crows performing the following procedure:
- The crow sets *a**i* initially 0. - The crow then adds *b**i* to *a**i*, subtracts *b**i*<=+<=1, adds the *b**i*<=+<=2 number, and so on until th... | {"inputs": ["5\n6 -4 8 -2 3", "5\n3 -2 -1 5 6", "10\n13 -2 532 -63 -23 -63 -64 -23 12 10", "10\n0 0 0 0 0 0 0 0 0 0", "10\n1 -1 1 -1 1 -1 1 -1 1 -1", "10\n-1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000", "10\n124 532 -642 6482 -124 952 -235 7594 34 -12... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 291 | codeforces | |
e5a3243f561080c07faa1d584aa2ccae | Exam | An exam for *n* students will take place in a long and narrow room, so the students will sit in a line in some order. The teacher suspects that students with adjacent numbers (*i* and *i*<=+<=1) always studied side by side and became friends and if they take an exam sitting next to each other, they will help each other... | {"inputs": ["6", "3", "1", "2", "4", "5", "7", "8", "9", "10", "13", "16", "25", "29", "120", "128", "216", "729", "1111", "1597", "1777", "2048", "2999", "3001", "4181", "4990", "4991", "4992", "4993", "4994", "4995", "4996", "4997", "4998", "4999", "5000"], "outputs": ["6\n5 3 1 6 4 2 ", "2\n1 3", "1\n1 ", "1\n1", "4... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 129 | codeforces | |
e5ab2a069857df3a839cc2a15ef7044f | Divide by Three | A positive integer number *n* is written on a blackboard. It consists of not more than 105 digits. You have to transform it into a beautiful number by erasing some of the digits, and you want to erase as few digits as possible.
The number is called beautiful if it consists of at least one digit, doesn't have leading z... | {"inputs": ["1033", "10", "11", "3", "1", "117", "518", "327", "270461", "609209", "110930", "37616145150713688775", "98509135612114839419", "41674994051436988162", "82547062721736129804", "4902501252475186372406731932548506197390793597574544727433297197476846519276598727359617092494798814", "12910072096053014468749986... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 21 | codeforces | |
e5c1492df82be26090ac459cf081f0c9 | Covered Points Count | You are given $n$ segments on a coordinate line; each endpoint of every segment has integer coordinates. Some segments can degenerate to points. Segments can intersect with each other, be nested in each other or even coincide.
Your task is the following: for every $k \in [1..n]$, calculate the number of points with in... | {"inputs": ["3\n0 3\n1 3\n3 8", "3\n1 3\n2 4\n5 7", "1\n0 1000000000000000000"], "outputs": ["6 2 1 ", "5 2 0 ", "1000000000000000001 "]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 11 | codeforces | |
e5d95d51685545ecb2cbc871cbfe17da | Too Easy Problems | You are preparing for an exam on scheduling theory. The exam will last for exactly *T* milliseconds and will consist of *n* problems. You can either solve problem *i* in exactly *t**i* milliseconds or ignore it and spend no time. You don't need time to rest after solving a problem, either.
Unfortunately, your teacher ... | {"inputs": ["5 300\n3 100\n4 150\n4 80\n2 90\n2 300", "2 100\n1 787\n2 788", "2 100\n2 42\n2 58", "1 1\n1 1", "10 481\n4 25\n3 85\n6 96\n6 13\n1 9\n4 27\n2 7\n3 42\n9 66\n9 70", "1 1000000000\n1 10000", "1 1\n1 10000", "5 66\n2 64\n4 91\n5 91\n1 79\n3 85", "1 1000000000\n1 1", "5 100\n1 10\n1 10\n1 10\n1 10\n1 10"], "o... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
e5eb77ed5fde83dd01fd25945e8d87e6 | Jury Meeting | Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process.
There are *n*<=+<=1 cities consecutively numbered from 0 to *n*. City 0 is Metropolis that is the meeting poi... | {"inputs": ["2 6 5\n1 1 0 5000\n3 2 0 5500\n2 2 0 6000\n15 0 2 9000\n9 0 1 7000\n8 0 2 6500", "2 4 5\n1 2 0 5000\n2 1 0 4500\n2 1 0 3000\n8 0 1 6000", "2 5 5\n1 1 0 1\n2 2 0 100\n3 2 0 10\n9 0 1 1000\n10 0 2 10000", "2 4 5\n1 1 0 1\n2 2 0 10\n8 0 1 100\n9 0 2 1000", "1 2 1\n10 1 0 16\n20 0 1 7", "1 2 10\n20 0 1 36\n10 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
e5f49ec42951e7d7c45b82e1e5435575 | Symmetric Projections | You are given a set of *n* points on the plane. A line containing the origin is called good, if projection of the given set to this line forms a symmetric multiset of points. Find the total number of good lines.
Multiset is a set where equal elements are allowed.
Multiset is called symmetric, if there is a point *P* ... | {"inputs": ["3\n1 2\n2 1\n3 3", "2\n4 3\n1 2", "6\n0 4\n1 5\n2 1\n3 2\n4 3\n5 0", "1\n5 2", "4\n2 4\n1 2\n0 0\n-2 -4", "10\n0 5\n1 0\n2 3\n3 2\n4 6\n5 9\n6 1\n7 8\n8 4\n9 7", "9\n-1000000 -500000\n-750000 250000\n-500000 1000000\n-250000 -250000\n0 -1000000\n250000 750000\n500000 0\n750000 -750000\n1000000 500000", "10... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
e5fd38f32e822cd47f7428b401223cab | none | Вам задано прямоугольное клетчатое поле, состоящее из *n* строк и *m* столбцов. Поле содержит цикл из символов «*», такой что:
- цикл можно обойти, посетив каждую его клетку ровно один раз, перемещаясь каждый раз вверх/вниз/вправо/влево на одну клетку; - цикл не содержит самопересечений и самокасаний, то есть две кл... | {"inputs": ["3 3\n***\n*.*\n*S*", "6 7\n.***...\n.*.*...\n.*.S**.\n.*...**\n.*....*\n.******", "100 3\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 | 13 | codeforces | |
e60b3cbd2c86af1239ce62fe75b31479 | Pizza, Pizza, Pizza!!! | Katie, Kuro and Shiro are best friends. They have known each other since kindergarten. That's why they often share everything with each other and work together on some very hard problems.
Today is Shiro's birthday. She really loves pizza so she wants to invite her friends to the pizza restaurant near her house to cele... | {"inputs": ["3", "4", "10", "10000000000", "1234567891", "7509213957", "99999999999999999", "21", "712394453192", "172212168", "822981260158260519", "28316250877914571", "779547116602436424", "578223540024979436", "335408917861648766", "74859962623690078", "252509054433933439", "760713016476190622", "919845426262703496... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 154 | codeforces | |
e638521913c2072acd0316e2f71ff040 | Hamming Distance Sum | Genos needs your help. He was asked to solve the following programming problem by Saitama:
The length of some string *s* is denoted |*s*|. The Hamming distance between two strings *s* and *t* of equal length is defined as , where *s**i* is the *i*-th character of *s* and *t**i* is the *i*-th character of *t*. For exam... | {"inputs": ["01\n00111", "0011\n0110", "0\n0", "1\n0", "0\n1", "1\n1", "1001101001101110101101000\n01111000010011111111110010001101000100011110101111", "1110010001000101001011111\n00011011000000100001010000010100110011010001111010"], "outputs": ["3", "2", "0", "1", "1", "0", "321", "316"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 113 | codeforces | |
e666dd51fa2686b4cee373003f8f43e6 | Photo Processing | Evlampiy has found one more cool application to process photos. However the application has certain limitations.
Each photo *i* has a contrast *v**i*. In order for the processing to be truly of high quality, the application must receive at least *k* photos with contrasts which differ as little as possible.
Evlampiy a... | {"inputs": ["5 2\n50 110 130 40 120", "4 1\n2 3 4 1", "1 1\n4", "2 2\n7 5", "3 2\n34 3 75", "5 2\n932 328 886 96 589", "10 4\n810 8527 9736 3143 2341 6029 7474 707 2513 2023", "20 11\n924129 939902 178964 918687 720767 695035 577430 407131 213304 810868 596349 266075 123602 376312 36680 18426 716200 121546 61834 851586... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
e66985f39a9769f994faf9ce3d63f424 | none | Fox Ciel is playing a game. In this game there is an infinite long tape with cells indexed by integers (positive, negative and zero). At the beginning she is standing at the cell 0.
There are also *n* cards, each card has 2 attributes: length *l**i* and cost *c**i*. If she pays *c**i* dollars then she can apply *i*-th... | {"inputs": ["3\n100 99 9900\n1 1 1", "5\n10 20 30 40 50\n1 1 1 1 1", "7\n15015 10010 6006 4290 2730 2310 1\n1 1 1 1 1 1 10", "8\n4264 4921 6321 6984 2316 8432 6120 1026\n4264 4921 6321 6984 2316 8432 6120 1026", "6\n1 2 4 8 16 32\n32 16 8 4 2 1", "1\n1\n1", "1\n2\n2", "8\n2 3 5 7 11 13 17 19\n4 8 7 1 5 2 6 3", "1\n1000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
e677e0b9b13403595b58533bae5f399b | April Fools' Problem (medium) | The marmots need to prepare *k* problems for HC2 over *n* days. Each problem, once prepared, also has to be printed.
The preparation of a problem on day *i* (at most one per day) costs *a**i* CHF, and the printing of a problem on day *i* (also at most one per day) costs *b**i* CHF. Of course, a problem cannot be print... | {"inputs": ["8 4\n3 8 7 9 9 4 6 8\n2 5 9 4 3 8 9 1", "10 6\n60 8 63 72 1 100 23 59 71 59\n81 27 66 53 46 64 86 27 41 82", "13 13\n93 19 58 34 96 7 35 46 60 5 36 40 41\n57 3 42 68 26 85 25 45 50 21 60 23 79", "12 1\n49 49 4 16 79 20 86 94 43 55 45 17\n15 36 51 20 83 6 83 80 72 22 66 100", "1 1\n96\n86"], "outputs": ["32... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
e68539488f58313b1362264cddb9b8e7 | Diplomas and Certificates | There are *n* students who have taken part in an olympiad. Now it's time to award the students.
Some of them will receive diplomas, some wiil get certificates, and others won't receive anything. Students with diplomas and certificates are called winners. But there are some rules of counting the number of diplomas and ... | {"inputs": ["18 2", "9 10", "1000000000000 5", "1000000000000 499999999999", "1 1", "5 3", "42 6", "1000000000000 1000", "999999999999 999999", "732577309725 132613", "152326362626 15", "2 1", "1000000000000 500000000000", "100000000000 50000000011", "1000000000000 32416187567", "1000000000000 7777777777", "10000000000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 282 | codeforces | |
e69b2a591819307c7664c4c2dab6fe18 | Translation | The translation from the Berland language into the Birland language is not an easy task. Those languages are very similar: a berlandish word differs from a birlandish word with the same meaning a little: it is spelled (and pronounced) reversely. For example, a Berlandish word code corresponds to a Birlandish word edoc.... | {"inputs": ["code\nedoc", "abb\naba", "code\ncode", "abacaba\nabacaba", "q\nq", "asrgdfngfnmfgnhweratgjkk\nasrgdfngfnmfgnhweratgjkk", "z\na", "asd\ndsa", "abcdef\nfecdba", "ywjjbirapvskozubvxoemscfwl\ngnduubaogtfaiowjizlvjcu", "mfrmqxtzvgaeuleubcmcxcfqyruwzenguhgrmkuhdgnhgtgkdszwqyd\nmfxufheiperjnhyczclkmzyhcxntdfskzkz... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3,021 | codeforces | |
e6b16af4f70ea70aaebdec8c6ceac0a5 | New Year and Curling | Carol is currently curling.
She has *n* disks each with radius *r* on the 2D plane.
Initially she has all these disks above the line *y*<==<=10100.
She then will slide the disks towards the line *y*<==<=0 one by one in order from 1 to *n*.
When she slides the *i*-th disk, she will place its center at the point (*... | {"inputs": ["6 2\n5 5 6 8 3 12", "1 1\n5", "5 300\n939 465 129 611 532", "5 1\n416 387 336 116 81", "3 10\n1 100 1000", "2 1\n2 20", "3 2\n10 10 100"], "outputs": ["2 6.0 9.87298334621 13.3370849613 12.5187346573 13.3370849613", "1", "300 667.864105343 1164.9596696 1522.27745533 2117.05388391", "1 1 1 1 1", "10 10 10",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 83 | codeforces | |
e6b7e7392f48b167d94f2e889a34a656 | An express train to reveries | Sengoku still remembers the mysterious "colourful meteoroids" she discovered with Lala-chan when they were little. In particular, one of the nights impressed her deeply, giving her the illusion that all her fancies would be realized.
On that night, Sengoku constructed a permutation *p*1,<=*p*2,<=...,<=*p**n* of intege... | {"inputs": ["5\n1 2 3 4 3\n1 2 5 4 5", "5\n4 4 2 3 1\n5 4 5 3 1", "4\n1 1 3 4\n1 4 3 4", "10\n1 2 3 4 7 6 7 8 9 10\n1 2 3 4 5 6 5 8 9 10", "10\n1 2 3 4 5 6 7 8 7 10\n1 2 3 4 5 6 7 8 9 9", "10\n1 2 3 4 5 6 7 8 4 10\n1 2 3 4 5 6 7 6 9 10", "10\n8 6 1 7 9 3 5 2 10 9\n8 6 1 7 4 3 5 2 10 4", "10\n2 9 7 7 8 5 4 10 6 1\n2 8 7... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 55 | codeforces | |
e6ba62d7628af9509485a672f3cc2f6d | Permutation | A permutation *p* is an ordered group of numbers *p*1,<=<=<=*p*2,<=<=<=...,<=<=<=*p**n*, consisting of *n* distinct positive integers, each is no more than *n*. We'll define number *n* as the length of permutation *p*1,<=<=<=*p*2,<=<=<=...,<=<=<=*p**n*.
Simon has a positive integer *n* and a non-negative integer *k*, ... | {"inputs": ["1 0", "2 1", "4 0", "50000 0", "50000 25000", "50000 24999", "49999 24999", "49999 3", "1333 156", "7563 3781", "7563 3780", "2 0", "3 0", "4 1", "4 2", "6 3", "48888 24444", "50000 1", "50000 1000", "34 17", "43244 1233", "213 100", "50 1", "55 0", "5000 0", "3 1", "7563 0", "7563 1", "7563 2", "6 0"], "o... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 90 | codeforces | |
e6f40a496ed1368ff423474239e446b9 | Flea travel | A flea is sitting at one of the *n* hassocks, arranged in a circle, at the moment. After minute number *k* the flea jumps through *k*<=-<=1 hassoсks (clockwise). For example, after the first minute the flea jumps to the neighboring hassock. You should answer: will the flea visit all the hassocks or not. We assume that ... | {"inputs": ["1", "3", "2", "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", "64", "289", "170... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 57 | codeforces | |
e6f96ba887f3f4cbc4d1ee4739ea50c5 | The Elder Trolls IV: Oblivon | Vasya plays The Elder Trolls IV: Oblivon. Oh, those creators of computer games! What they do not come up with! Absolutely unique monsters have been added to the The Elder Trolls IV: Oblivon. One of these monsters is Unkillable Slug. Why it is "Unkillable"? Firstly, because it can be killed with cutting weapon only, so ... | {"inputs": ["2 2 2 3", "2 2 2 1", "1 1 1 1", "1 2 3 3", "20 4 5 12", "100 500 100500 1000000000", "2 5 5 9", "11 1 11 11", "100500 5000 500 100000000", "2 2 2 0", "1000000 1000000 1000000 2444441", "1000000 1000000 1000000 1000000000", "1000000 1000000 1000000 2999996", "1000000 1000000 1000000 2999997", "999999 100000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
e70fa67ea06a7630a6efb9cae15a0301 | Aramic script | In Aramic language words can only represent objects.
Words in Aramic have special properties:
- A word is a root if it does not contain the same letter more than once. - A root and all its permutations represent the same object. - The root $x$ of a word $y$ is the word that contains all letters that appear in $y$... | {"inputs": ["5\na aa aaa ab abb", "3\namer arem mrea", "10\nbda bbb cda dca dda dcb bcd dcb ada ddd", "2\nfhjlqs aceginpr", "2\nbcdfghimn efghijlmo"], "outputs": ["2", "1", "6", "2", "2"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 310 | codeforces | |
e73692d6bb84386ad415f4124200e21c | The Holmes Children | The Holmes children are fighting over who amongst them is the cleverest.
Mycroft asked Sherlock and Eurus to find value of *f*(*n*), where *f*(1)<==<=1 and for *n*<=≥<=2, *f*(*n*) is the number of distinct ordered positive integer pairs (*x*,<=*y*) that satisfy *x*<=+<=*y*<==<=*n* and *gcd*(*x*,<=*y*)<==<=1. The integ... | {"inputs": ["7 1", "10 2", "640 15", "641 17", "641 2000", "961 2", "524288 1000000000000", "557056 12", "999961 19", "891581 1", "500009 1", "549755813888 2", "893277279607 1", "500000000023 2", "999999999937 1", "549755813888 38", "549755813888 100000", "847288609443 47", "847288609443 200", "999999999937 10000000000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
e758d03fb0bcaacacfd82acd36a1127c | Little Elephant and Array | The Little Elephant loves playing with arrays. He has array *a*, consisting of *n* positive integers, indexed from 1 to *n*. Let's denote the number with index *i* as *a**i*.
Additionally the Little Elephant has *m* queries to the array, each query is characterised by a pair of integers *l**j* and *r**j* (1<=≤<=*l**j... | {"inputs": ["7 2\n3 1 2 2 3 3 7\n1 7\n3 4", "6 6\n1 2 2 3 3 3\n1 2\n2 2\n1 3\n2 4\n4 6\n1 6", "1 2\n1\n1 1\n1 1", "1 1\n1000000000\n1 1"], "outputs": ["3\n1", "1\n0\n2\n1\n1\n3", "1\n1", "0"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 13 | codeforces | |
e78bff238edea0cf1c9a09c8dda2be96 | WTF? |
The input contains between 1 and 10 lines, *i*-th line contains an integer number *x**i* (0<=≤<=*x**i*<=≤<=9).
Output a single real number. The answer is considered to be correct if its absolute or relative error does not exceed 10<=-<=4.
Sample Input
3
0
1
1
Sample Output
0.666667
| {"inputs": ["3\n0\n1\n1", "1\n0", "1\n1", "2\n0\n1", "9\n0\n0\n0\n0\n0\n0\n0\n0\n1", "5\n1\n1\n1\n0\n1", "9\n1\n0\n0\n1\n0\n1\n1\n1\n1", "9\n1\n1\n1\n0\n0\n1\n1\n1\n0", "9\n1\n0\n0\n0\n0\n1\n1\n1\n1", "6\n0\n0\n1\n1\n1\n0", "6\n0\n1\n1\n0\n1\n0", "1\n0", "7\n1\n0\n1\n0\n0\n0\n0", "8\n1\n1\n0\n1\n1\n0\n0\n1", "5\n0\n1\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 17 | codeforces | |
e790774778ff918d8e1a9920c7285ad1 | Cellular Network | You are given *n* points on the straight line — the positions (*x*-coordinates) of the cities and *m* points on the same line — the positions (*x*-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than ... | {"inputs": ["3 2\n-2 2 4\n-3 0", "5 3\n1 5 10 14 17\n4 11 15", "1 1\n-1000000000\n1000000000", "1 1\n1000000000\n-1000000000", "10 10\n1 1 2 2 2 4 4 6 7 9\n0 1 3 3 3 6 7 8 9 10", "10 10\n2 52 280 401 416 499 721 791 841 943\n246 348 447 486 507 566 568 633 953 986", "7 7\n1 2 3 3 4 5 6\n1 1 2 3 4 5 6", "1 3\n-3\n-1 -1 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 64 | codeforces | |
e7a24282e64e9a559734d9c57f71f873 | DZY Loves Planting | DZY loves planting, and he enjoys solving tree problems.
DZY has a weighted tree (connected undirected graph without cycles) containing *n* nodes (they are numbered from 1 to *n*). He defines the function *g*(*x*,<=*y*) (1<=≤<=*x*,<=*y*<=≤<=*n*) as the longest edge in the shortest path between nodes *x* and *y*. Speci... | {"inputs": ["4\n1 2 1\n2 3 2\n3 4 3\n1\n1\n1\n1", "4\n1 2 1\n2 3 2\n3 4 3\n4\n4\n4\n4", "10\n2 1 8760\n3 1 3705\n4 1 1862\n5 2 7332\n6 3 7015\n7 5 4866\n8 3 4465\n9 7 8886\n10 3 9362\n2\n5\n5\n4\n4\n5\n4\n5\n1\n2", "10\n2 1 5297\n3 2 7674\n4 1 1935\n5 2 1941\n6 3 1470\n7 1 3823\n8 2 4959\n9 4 6866\n10 9 2054\n1\n1\n1\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
e7e468057d071412f9402d331e19530a | none | A schoolboy named Vasya loves reading books on programming and mathematics. He has recently read an encyclopedia article that described the method of median smoothing (or median filter) and its many applications in science and engineering. Vasya liked the idea of the method very much, and he decided to try it in practi... | {"inputs": ["4\n0 0 1 1", "5\n0 1 0 1 0", "3\n1 0 0", "4\n1 0 0 1", "7\n1 0 1 1 1 0 1", "14\n0 1 0 0 0 1 1 0 1 0 1 0 1 0", "3\n1 0 1", "3\n0 0 1", "3\n1 1 0", "3\n1 1 1", "4\n1 1 0 1", "4\n1 0 1 1", "10\n0 1 0 1 0 0 1 0 1 0", "4\n0 1 1 0", "168\n0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 19 | codeforces | |
e7e6030c3ae371e9f00ee3345a6d9d83 | Flag of Berland | The flag of Berland is such rectangular field *n*<=×<=*m* that satisfies following conditions:
- Flag consists of three colors which correspond to letters 'R', 'G' and 'B'. - Flag consists of three equal in width and height stripes, parralel to each other and to sides of the flag. Each stripe has exactly one color. ... | {"inputs": ["6 5\nRRRRR\nRRRRR\nBBBBB\nBBBBB\nGGGGG\nGGGGG", "4 3\nBRG\nBRG\nBRG\nBRG", "6 7\nRRRGGGG\nRRRGGGG\nRRRGGGG\nRRRBBBB\nRRRBBBB\nRRRBBBB", "4 4\nRRRR\nRRRR\nBBBB\nGGGG", "1 3\nGRB", "3 1\nR\nG\nB", "4 3\nRGB\nGRB\nGRB\nGRB", "4 6\nGGRRBB\nGGRRBB\nGGRRBB\nRRGGBB", "100 3\nRGB\nRGB\nRGB\nRGB\nRGB\nRGB\nRGB\nRGB... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 37 | codeforces | |
e7efdd6202603b58ce82a64e3af8ac83 | Sereja and Mugs | Sereja showed an interesting game to his friends. The game goes like that. Initially, there is a table with an empty cup and *n* water mugs on it. Then all players take turns to move. During a move, a player takes a non-empty mug of water and pours all water from it into the cup. If the cup overfills, then we assume th... | {"inputs": ["3 4\n1 1 1", "3 4\n3 1 3", "3 4\n4 4 4", "2 1\n1 10", "3 12\n5 6 6", "4 10\n6 3 8 7", "5 16\n3 3 2 7 9", "6 38\n9 10 3 8 10 6", "7 12\n4 4 5 2 2 4 9", "8 15\n8 10 4 2 10 9 7 6", "9 22\n1 3 5 9 7 6 1 10 1", "10 30\n9 10 4 5 5 7 1 7 7 2", "38 83\n9 9 3 10 2 4 6 10 9 5 1 8 7 4 7 2 6 5 3 1 10 8 4 8 3 7 1 2 7 6... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 235 | codeforces | |
e7f8d16eda19fa59e0fcebc5e64319f7 | Transferring Pyramid | Vasya and Petya are using an interesting data storing structure: a pyramid.
The pyramid consists of *n* rows, the *i*-th row contains *i* cells. Each row is shifted half a cell to the left relative to the previous row. The cells are numbered by integers from 1 to as shown on the picture below.
An example of a pyrami... | {"inputs": ["4 5\n3 1\n3 3\n4 1\n4 3\n4 4", "7 11\n2 2\n3 1\n4 3\n5 1\n5 2\n5 5\n6 4\n7 2\n7 3\n7 4\n7 5", "2 3\n1 1\n2 1\n2 2", "10 15\n2 1\n3 2\n4 1\n4 2\n4 3\n5 5\n7 6\n7 7\n8 2\n8 6\n9 7\n10 4\n10 7\n10 9\n10 10", "10 18\n4 3\n5 4\n6 1\n6 3\n7 2\n7 6\n8 2\n9 1\n9 4\n9 6\n9 7\n9 8\n9 9\n10 3\n10 4\n10 7\n10 9\n10 10... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
e80bb87ba55d7191e672aba5bedf48eb | Build String | You desperately need to build some string *t*. For that you've got *n* more strings *s*1,<=*s*2,<=...,<=*s**n*. To build string *t*, you are allowed to perform exactly |*t*| (|*t*| is the length of string *t*) operations on these strings. Each operation looks like that:
1. choose any non-empty string from strings *s*... | {"inputs": ["bbaze\n3\nbzb 2\naeb 3\nba 10", "abacaba\n4\naba 2\nbcc 1\ncaa 2\nbbb 5", "xyz\n4\naxx 8\nza 1\nefg 4\nt 1", "aaabbtttefg\n6\nabbbca 3\nffatgg 2\nyioa 4\nppaeg 2\naetgffff 4\ntreiiaav 10", "tatarioispoe\n5\ntyfad 3\npopsia 10\ntszza 3\nioioioio 4\nrarartteea 3", "abcdabcd\n4\nabc 10\nab 3\nefg 3\nsahdjqweg... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
e838a89a79807b2a26db58e7b829b520 | Maximum Value | You are given a sequence *a* consisting of *n* integers. Find the maximum possible value of (integer remainder of *a**i* divided by *a**j*), where 1<=≤<=*i*,<=*j*<=≤<=*n* and *a**i*<=≥<=*a**j*.
The first line contains integer *n* — the length of the sequence (1<=≤<=*n*<=≤<=2·105).
The second line contains *n* space-... | {"inputs": ["3\n3 4 5", "3\n1 2 4", "1\n1", "1\n1000000", "2\n1000000 999999", "12\n4 4 10 13 28 30 41 43 58 61 70 88", "7\n2 13 22 32 72 91 96", "5\n5 11 12 109 110"], "outputs": ["2", "0", "0", "0", "1", "30", "27", "10"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
e8589326b260d6321cd1a00bcf796662 | Candy Bags | Gerald has *n* younger brothers and their number happens to be even. One day he bought *n*2 candy bags. One bag has one candy, one bag has two candies, one bag has three candies and so on. In fact, for each integer *k* from 1 to *n*2 he has exactly one bag with *k* candies.
Help him give *n* bags of candies to each b... | {"inputs": ["2", "4", "6", "8", "10", "100", "62", "66", "18", "68", "86", "96", "12", "88", "28", "80", "48", "54", "58", "64", "44"], "outputs": ["1 4\n2 3", "1 16 2 15\n3 14 4 13\n5 12 6 11\n7 10 8 9", "1 36 2 35 3 34\n4 33 5 32 6 31\n7 30 8 29 9 28\n10 27 11 26 12 25\n13 24 14 23 15 22\n16 21 17 20 18 19", "1 64 2 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 465 | codeforces | |
e881e66aa9438f91dbec22567634de7d | Two Cakes | It's New Year's Eve soon, so Ivan decided it's high time he started setting the table. Ivan has bought two cakes and cut them into pieces: the first cake has been cut into *a* pieces, and the second one — into *b* pieces.
Ivan knows that there will be *n* people at the celebration (including himself), so Ivan has set ... | {"inputs": ["5 2 3", "4 7 10", "100 100 100", "10 100 3", "2 9 29", "4 6 10", "3 70 58", "5 7 10", "5 30 22", "5 5 6", "2 4 3", "10 10 31", "2 1 1", "10 98 99", "4 10 16", "11 4 8", "5 10 14", "6 7 35", "5 6 7", "4 15 3", "7 48 77", "4 4 10", "4 7 20", "5 2 8", "3 2 3", "14 95 1", "99 82 53", "10 71 27", "5 7 8", "11 7... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 140 | codeforces | |
e885d82416ccee788a6b4d182d3995d1 | Pairs of Numbers | Let's assume that we have a pair of numbers (*a*,<=*b*). We can get a new pair (*a*<=+<=*b*,<=*b*) or (*a*,<=*a*<=+<=*b*) from the given pair in a single step.
Let the initial pair of numbers be (1,1). Your task is to find number *k*, that is, the least number of steps needed to transform (1,1) into the pair where at ... | {"inputs": ["5", "1", "2", "3", "4", "10", "1009", "2009", "7009", "9009", "19009", "29009", "12434", "342342", "342235", "362235", "762235", "878235", "978235", "1000000", "6", "10000", "999999", "524287", "777777", "123756", "976438", "434563", "345634", "65457", "123456", "999997", "98989", "8", "123455", "990001", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
e8908e1d6d457399e3895364aa5e96ce | Games with Rectangle | In this task Anna and Maria play the following game. Initially they have a checkered piece of paper with a painted *n*<=×<=*m* rectangle (only the border, no filling). Anna and Maria move in turns and Anna starts. During each move one should paint inside the last-painted rectangle a new lesser rectangle (along the grid... | {"inputs": ["3 3 1", "4 4 1", "6 7 2", "5 5 3", "2 2 1", "999 999 499", "456 876 1000", "3 5 1", "5 7 2", "10 13 3", "1000 1000 499", "1000 1000 500", "3 1000 1", "1000 3 1", "998 1000 499", "1000 1000 250", "999 996 247", "86 564 16", "711 390 95", "963 415 36", "356 628 17", "214 538 33", "840 474 207", "589 898 280"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 13 | codeforces | |
e89960771ce7eba2a45f2ce8487fd6e2 | Magic Forest | Imp is in a magic forest, where xorangles grow (wut?)
A xorangle of order *n* is such a non-degenerate triangle, that lengths of its sides are integers not exceeding *n*, and the xor-sum of the lengths is equal to zero. Imp has to count the number of distinct xorangles of order *n* to get out of the forest.
Formally... | {"inputs": ["6", "10", "3", "4", "5", "2500", "952", "88", "1216", "2140", "564", "1488", "116", "1040", "1965", "593", "779", "1703", "331", "1051", "2179", "603", "1731", "2451", "1079", "2207", "2394", "818", "1946", "166", "1294", "2218", "846", "1566", "194", "1322", "1508", "2433", "857", "1781", "1", "2", "2444"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 43 | codeforces | |
e8ae8c9ad5707a2ba6b86f356f3bdda6 | Simple Strings | zscoder loves simple strings! A string *t* is called simple if every pair of adjacent characters are distinct. For example ab, aba, zscoder are simple whereas aa, add are not simple.
zscoder is given a string *s*. He wants to change a minimum number of characters so that the string *s* becomes simple. Help him with th... | {"inputs": ["aab", "caaab", "zscoder", "u", "h", "dtottttotd", "rxxxrrxrxxxxxrrrrrxxxxrrrrxrxxrxxrxrxrrrxrrxrrxrxxxrxrrxrrxrxrxxxxxrxxxxrrrxrxxrxxrxxxrrrrrxrrxrrxrr", "aazz", "zz", "gg", "qasdasd", "aa", "ab", "zza", "g", "nnop", "xx"], "outputs": ["bab", "cabab", "zscoder", "u", "h", "dtotataotd", "rxaxraxrxaxaxrararx... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 110 | codeforces | |
e8cb5c49fb8b3653b3c5c23c8b90dec4 | none | Alyona's mother wants to present an array of *n* non-negative integers to Alyona. The array should be special.
Alyona is a capricious girl so after she gets the array, she inspects *m* of its subarrays. Subarray is a set of some subsequent elements of the array. The *i*-th subarray is described with two integers *l**... | {"inputs": ["5 3\n1 3\n2 5\n4 5", "4 2\n1 4\n2 4", "1 1\n1 1", "2 1\n2 2", "5 6\n2 4\n2 3\n1 4\n3 4\n2 5\n1 3", "8 3\n2 3\n2 8\n3 6", "10 10\n1 9\n4 8\n4 8\n5 9\n1 9\n3 8\n1 6\n1 9\n1 6\n6 9", "3 6\n1 3\n1 3\n1 1\n1 1\n3 3\n3 3", "3 3\n1 3\n2 2\n1 3", "6 8\n3 5\n3 6\n4 6\n2 5\n2 5\n1 3\n3 6\n3 5", "10 4\n4 10\n4 6\n6 8... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 99 | codeforces |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.