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 |
|---|---|---|---|---|---|---|---|---|---|
6990e0908e543ca02166cd93f642ca2b | exebit01 | Pratyush, a six year old kid has just learnt how to write 1 through 1000 in decimal number system(DNS). Being a very curious kid, he made some modifications in DNS and removed the digits 0 through 3 and 7 through 9. So the only digits remaining to be used are 4, 5 and 6. He started enumerating numbers with these digits... | {"inputs": ["5\n3\n13\n45\n64\n1000000000"], "outputs": ["6\n444\n4456\n4664\n5446456455646565564"]} | 6 | [
"PYTHON3"
] | 1 | 2 | code_contests | |
e3025625c3ed6709d5d2c6b1a2829a65 | lastride | Problem description.
Toretto has no friends. He has got family, and now they need him. His bitter enemy, Ian Shaw, has captured Toretto's beloved Letty and evil cooks in his head. All Toretto has is the algorithmic message Shaw left before leaving-
Letty(n):
L = an empty list
while n > 0:
find the larg... | {"inputs": ["2\n1 2\n3 10"], "outputs": ["3\n25"]} | 6 | [
"PYTHON3"
] | 1 | 2 | code_contests | |
aefd288503f679b3f28767fce41e8c0e | pd32 | Recall the definition of the Fibonacci numbers:
f1 := 1
f2 := 2
fn := fn-1 + fn-2 (n ≥ 3)
Given two numbers a and b, calculate how many Fibonacci numbers are in the range [a,b].
Input
The input contains several test cases. Each test case consists of two non-negative integer numbers a and b. Input is... | {"inputs": ["10 100\n1234567890 9876543210\n0 0"], "outputs": ["5\n4"]} | 6 | [
"PYTHON3"
] | 1 | 2 | code_contests | |
c36235420df29bb571f42afbeeb98ada | stfm | For positive integer x let define function F(x) = 1 * (1! + x) + 2 * (2! + x) + .. + x * (x! + x).
"k!" means factorial: k! = 1 * 2 * .. * k
Chef wants to calculate F(p1) + F(p2) + ... + F(pn).
As answer could be large, help him, calculate value modulo m.
Input
First line contains two integers n and m.
Next line c... | {"inputs": ["5 7\n1 2 3 4 5", "5 7\n1 2 3 4 4", "5 13\n1 2 3 4 4", "5 13\n1 2 0 4 4", "5 7\n1 2 3 4 3", "5 13\n1 4 3 4 4", "5 13\n1 3 0 4 4", "5 13\n1 3 0 4 6", "5 7\n1 0 0 5 4", "5 6\n0 2 4 4 6", "1 13\n1 17 0 4 6", "5 17\n1 6 0 4 3", "1 20\n1 17 2 0 6", "1 10\n1 23 3 0 6", "0 10\n0 3 3 0 12", "5 24\n1 3 3 4 3", "1 19... | 2 | [
"PYTHON3"
] | 1 | 2 | code_contests | |
32adec65d371830fde2b388c0dc5c952 | 1008_D. Pave the Parallelepiped | You are given a rectangular parallelepiped with sides of positive integer lengths A, B and C.
Find the number of different groups of three integers (a, b, c) such that 1≤ a≤ b≤ c and parallelepiped A× B× C can be paved with parallelepipeds a× b× c. Note, that all small parallelepipeds have to be rotated in the same d... | {"inputs": ["4\n1 1 1\n1 6 1\n2 2 2\n100 100 100\n", "10\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n", "1\n100000 100000 100000\n", "10\n9 6 8\n5 5 2\n8 9 2\n2 7 9\n6 4 10\n1 1 8\n2 8 1\n10 6 3\n7 5 2\n9 5 4\n", "10\n9 6 8\n5 5 2\n8 9 2\n2 7 9\n6 4 5\n1 1 8\n2 8 1\n10 6 3\n7 5 2\n9 5 4\n", "... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
0c9a6601ad897de74db03fd3b48cddf7 | 1031_B. Curiosity Has No Limits | When Masha came to math classes today, she saw two integer sequences of length n - 1 on the blackboard. Let's denote the elements of the first sequence as a_i (0 ≤ a_i ≤ 3), and the elements of the second sequence as b_i (0 ≤ b_i ≤ 3).
Masha became interested if or not there is an integer sequence of length n, which e... | {"inputs": ["4\n3 3 2\n1 2 0\n", "3\n1 3\n3 2\n", "2\n2\n0\n", "50\n3 1 2 2 3 1 1 1 3 3 1 0 2 0 1 1 0 0 1 2 2 0 0 0 2 3 0 3 1 2 0 3 0 0 1 0 3 3 1 3 1 1 2 3 1 3 2 1 3\n2 1 1 1 1 0 2 2 0 1 2 3 0 1 0 1 1 1 0 0 3 1 3 3 1 0 0 1 1 2 0 2 1 1 2 0 0 0 0 2 3 3 0 1 1 1 0 2 0\n", "2\n2\n3\n", "2\n1\n0\n", "2\n0\n3\n", "100\n2 2 2 ... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
effd7a9a2508d9f3a0ebee9dbb7411df | 1054_B. Appending Mex | Initially Ildar has an empty array. He performs n steps. On each step he takes a subset of integers already added to the array and appends the mex of this subset to the array.
The mex of an multiset of integers is the smallest non-negative integer not presented in the multiset. For example, the mex of the multiset [0... | {"inputs": ["3\n1 0 1\n", "4\n0 1 2 1\n", "4\n0 1 2 239\n", "2\n0 1\n", "3\n0 1 1000000000\n", "3\n0 2 4\n", "1\n1\n", "2\n0 0\n", "2\n0 1000000000\n", "2\n1 1\n", "5\n0 0 0 0 0\n", "2\n1 2\n", "1\n1000000000\n", "5\n0 0 2 2 3\n", "2\n0 2\n", "4\n0 0 2 1\n", "5\n0 0 2 3 4\n", "3\n0 0 2\n", "3\n3 4 5\n", "1\n0\n", "3\n1... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
9eb0378eb7c4677d97e7603bc71988a5 | 1076_B. Divisor Subtraction | You are given an integer number n. The following algorithm is applied to it:
1. if n = 0, then end algorithm;
2. find the smallest prime divisor d of n;
3. subtract d from n and go to step 1.
Determine the number of subtrations the algorithm will make.
Input
The only line contains a single integer n (2 ≤... | {"inputs": ["4\n", "5\n", "9999999999\n", "10000000000\n", "9999999967\n", "2\n", "6969696\n", "473\n", "9998200081\n", "3000000021\n", "186627465\n", "10000000010\n", "4868692902\n", "6\n", "7434214\n", "261\n", "2351148436\n", "4156825468\n", "7\n", "8\n", "25703032\n", "10010000010\n", "4984995498\n", "3320952\n", "... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
8db167bddf559911858e211cbe66c449 | 1097_B. Petr and a Combination Lock | Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! The lock has a scale of 360 degrees and a pointer which initially points at zero:
<image>
Petr called his car dealer, who in... | {"inputs": ["3\n10\n10\n10\n", "3\n120\n120\n120\n", "3\n10\n20\n30\n", "5\n179\n179\n179\n179\n4\n", "5\n179\n170\n160\n111\n100\n", "4\n1\n178\n180\n1\n", "6\n180\n178\n157\n143\n63\n1\n", "5\n100\n100\n100\n100\n40\n", "9\n80\n80\n80\n80\n80\n80\n80\n80\n80\n", "5\n179\n179\n179\n92\n91\n", "5\n30\n30\n120\n120\n120... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
839830f6131f5a8e07a68f463c99e000 | 1118_C. Palindromic Matrix | Let's call some square matrix with integer values in its cells palindromic if it doesn't change after the order of rows is reversed and it doesn't change after the order of columns is reversed.
For example, the following matrices are palindromic:
<image>
The following matrices are not palindromic because they change... | {"inputs": ["4\n1 8 8 1 2 2 2 2 2 2 2 2 1 8 8 1\n", "4\n1 2 1 9 8 4 3 8 8 3 4 8 9 2 1 1\n", "1\n10\n", "3\n1 1 1 1 1 3 3 3 3\n", "3\n13 13 42 42 69 69 420 420 666\n", "11\n1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 7 7 ... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
30a48630844d86115f5b777a7e062c88 | 1144_F. Graph Without Long Directed Paths | You are given a connected undirected graph consisting of n vertices and m edges. There are no self-loops or multiple edges in the given graph.
You have to direct its edges in such a way that the obtained directed graph does not contain any paths of length two or greater (where the length of path is denoted as the numb... | {"inputs": ["6 5\n1 5\n2 1\n1 4\n3 1\n6 1\n", "8 9\n8 1\n1 2\n1 5\n2 6\n6 5\n6 4\n4 7\n7 3\n3 5\n", "10 10\n2 1\n3 4\n7 1\n4 10\n6 1\n8 4\n9 1\n5 8\n1 8\n3 6\n", "10 10\n1 3\n9 6\n4 5\n1 9\n8 5\n9 7\n3 2\n5 7\n5 3\n10 5\n", "7 7\n4 1\n7 3\n4 7\n4 2\n1 3\n6 4\n5 3\n", "4 5\n1 2\n2 3\n3 4\n4 1\n1 3\n", "10 10\n4 3\n6 8\n... | 12 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
729f9a3c216fca90a2fc2afebd4ac80e | 1165_E. Two Arrays and Sum of Functions | You are given two arrays a and b, both of length n.
Let's define a function f(l, r) = ∑_{l ≤ i ≤ r} a_i ⋅ b_i.
Your task is to reorder the elements (choose an arbitrary order of elements) of the array b to minimize the value of ∑_{1 ≤ l ≤ r ≤ n} f(l, r). Since the answer can be very large, you have to print it modulo... | {"inputs": ["1\n1000000\n1000000\n", "5\n1 8 7 2 4\n9 7 2 9 3\n", "2\n1 3\n4 2\n", "1\n1000010\n1000000\n", "5\n1 8 7 2 4\n9 11 2 9 3\n", "2\n1 3\n4 1\n", "1\n1000011\n1000000\n", "5\n1 8 7 2 5\n9 11 2 9 3\n", "2\n1 5\n4 1\n", "1\n1001011\n1000000\n", "5\n1 11 7 2 5\n9 11 2 9 3\n", "2\n1 9\n4 1\n", "1\n1101011\n1000000... | 11 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
e6a49746a838baa0d6dbe592eab92af9 | 1184_D1. Parallel Universes (Easy) | The Third Doctor Who once correctly said that travel between parallel universes is "like travelling sideways". However, he incorrectly thought that there were infinite parallel universes, whereas in fact, as we now all know, there will never be more than 250.
Heidi recently got her hands on a multiverse observation to... | {"inputs": ["5 2 10 4\n0 1\n1 1\n0 4\n1 2\n", "10 5 20 4\n1 1\n0 4\n1 7\n1 7\n", "18 5 20 4\n1 1\n0 4\n1 7\n1 7\n", "5 2 10 4\n0 1\n1 1\n1 4\n1 2\n", "5 2 10 4\n0 1\n1 1\n1 4\n0 2\n", "18 5 20 4\n1 2\n0 2\n1 7\n1 7\n", "18 5 20 4\n1 1\n0 1\n1 7\n1 7\n", "5 2 10 4\n1 1\n1 1\n1 4\n0 2\n", "18 5 20 4\n1 4\n0 4\n0 7\n1 7\n... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
8cedd7f147a191601abc03b563f92c58 | 1203_A. Circle of Students | There are n students standing in a circle in some order. The index of the i-th student is p_i. It is guaranteed that all indices of students are distinct integers from 1 to n (i. e. they form a permutation).
Students want to start a round dance. A clockwise round dance can be started if the student 2 comes right after... | {"inputs": ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4\n", "1\n11\n11 2 3 4 5 6 7 8 9 10 1\n", "1\n12\n12 3 4 5 6 7 8 9 10 11 1 2\n", "1\n12\n12 3 8 5 6 7 8 9 10 11 1 2\n", "1\n12\n12 3 8 5 11 7 8 9 10 11 1 2\n", "1\n11\n11 2 3 4 5 6 7 13 9 10 1\n", "1\n12\n12 3 4 5 6 7 8 9 0 11 1 2\n", "1\n12\n12 3 8 5... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
cc796ab1791ad4d0c56134e8121db45b | 121_C. Lucky Permutation | 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.
One day Petya dreamt of a lexicographically k-th permutation of integers from 1 to n. Determine how ... | {"inputs": ["4 7\n", "7 4\n", "7 1000\n", "7 5032\n", "7 980\n", "777477774 1\n", "77 47\n", "777777 2\n", "7 985\n", "7 127\n", "7479 58884598\n", "49 1000000000\n", "10 1\n", "47 8547744\n", "7 5040\n", "64 87\n", "4 25\n", "7 2048\n", "27 1\n", "20 1000000000\n", "100 1\n", "1000000000 1\n", "1 1\n", "1000000000 100... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
3f5d9efd6599143dd679b4d9b36951eb | 1244_G. Running in Pairs | Demonstrative competitions will be held in the run-up to the 20NN Berlatov Olympic Games. Today is the day for the running competition!
Berlatov team consists of 2n runners which are placed on two running tracks; n runners are placed on each track. The runners are numbered from 1 to n on each track. The runner with nu... | {"inputs": ["10 54\n", "3 9\n", "5 20\n", "10 81\n", "3 1\n", "500 125251\n", "50 1274\n", "10000 75005000\n", "2 1\n", "50 1901\n", "500000 125000249999\n", "1 1\n", "3 6\n", "3 7\n", "50 1275\n", "100000 5000049999\n", "10000 74621728\n", "10000 75004999\n", "50 1900\n", "2 3\n", "3 2\n", "500 187750\n", "10000 75005... | 13 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
13dde7f4f6b5f852c7b0dae4808b5fbf | 1264_D2. Beautiful Bracket Sequence (hard version) | This is the hard version of this problem. The only difference is the limit of n - the length of the input string. In this version, 1 ≤ n ≤ 10^6.
Let's define a correct bracket sequence and its depth as follow:
* An empty string is a correct bracket sequence with depth 0.
* If "s" is a correct bracket sequence wi... | {"inputs": ["(?(?))\n", "??\n", ")))\n", "(?(??)))(()?(???)(?((?(?()))(())?))?(?)))?)?)))?)?()())??)?()?)??))?(()??)?()))()(???)())?(??)))((?())()(?\n", "???)\n", "(((\n", ")?)??)?)))??)???))?))?)?))))))?)????)??)?????)????))))???)?)??)??)??)))????)?)))))????)???)??)??))?)?))?)?\n", "???\n", "(?(??(?(((??(???((?((?(?((... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
3d03c5e562e87d2c7a465901c11849dd | 1286_A. Garland | Vadim loves decorating the Christmas tree, so he got a beautiful garland as a present. It consists of n light bulbs in a single row. Each bulb has a number from 1 to n (in arbitrary order), such that all the numbers are distinct. While Vadim was solving problems, his home Carp removed some light bulbs from the garland.... | {"inputs": ["7\n1 0 0 5 0 0 2\n", "5\n0 5 0 2 3\n", "100\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 48 69 63 77 67 28 7 23 97 99 20 42 50 43 27 81 18 76 87 79 52 37 29 24 65 85 83 68 25 10 45 75 33 15 66 71 6 21 64 47 22 8 39 57 4 1 19 35 12 34 13 9 53 40 62 94 44 90 31\n", "1\n0... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
76640e04839e4d2cd44fecb5a75e6914 | 1305_B. Kuroni and Simple Strings | Now that Kuroni has reached 10 years old, he is a big boy and doesn't like arrays of integers as presents anymore. This year he wants a Bracket sequence as a Birthday present. More specifically, he wants a bracket sequence so complex that no matter how hard he tries, he will not be able to remove a simple subsequence!
... | {"inputs": ["(()((\n", "(()())\n", ")(\n", "()()()()()()()(\n", "()\n", "())((\n", "))()((\n", "(())(\n", ")))(((\n", "(()()(\n", "()))((\n", "()(()(\n", "((()()))()()()(\n", "()(((\n", "(())))\n", "()()()()))()(((\n", "()()()())(()(((\n", ")())(\n", "((()(())()()()(\n", ")(()(())()()()(\n", "()()()())(()(()\n", "(()))... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
8142def19868eaab311d706c902bed9c | 1329_D. Dreamoon Likes Strings | Dreamoon likes strings. Today he created a game about strings:
String s_1, s_2, …, s_n is beautiful if and only if for each 1 ≤ i < n, s_i ≠ s_{i+1}.
Initially, Dreamoon has a string a. In each step Dreamoon can choose a beautiful substring of a and remove it. Then he should concatenate the remaining characters (in t... | {"inputs": ["4\naabbcc\naaabbb\naaa\nabacad\n", "4\naabbcc\naaabbb\naaa\nabacad\n", "4\naabbcc\naa`bbb\naaa\nabacad\n", "4\naabbcc\naaabbb\naaa\nabaacd\n", "4\nababcc\nbbbaaa\naaa\nabaacd\n", "4\naabbbc\naaabbb\naaa\nabacad\n", "4\naacbcc\naaabbb\naaa\nabacad\n", "4\naabbbc\naa`bbb\naaa\nabacad\n", "4\ncacbca\naaabbb\n... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
534df9860b13b33b961fedfcd6323ada | 1349_D. Slime and Biscuits | Slime and his n friends are at a party. Slime has designed a game for his friends to play.
At the beginning of the game, the i-th player has a_i biscuits. At each second, Slime will choose a biscuit randomly uniformly among all a_1 + a_2 + … + a_n biscuits, and the owner of this biscuit will give it to a random unifor... | {"inputs": ["2\n1 2\n", "5\n8 4 2 0 1\n", "2\n1 1\n", "5\n0 0 0 0 35\n", "36\n110 7 51 3 36 69 30 7 122 22 11 96 98 17 133 44 38 75 7 10 4 3 68 50 43 25 4 29 42 36 11 7 36 12 75 1\n", "10\n7758 19921 15137 1138 90104 17467 82544 55151 3999 6781\n", "100\n4364 698 1003 1128 1513 39 4339 969 7452 3415 1154 1635 6649 136 ... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
28af2552c82c47737681ab320754ce41 | 136_B. Ternary Logic | Little Petya very much likes computers. Recently he has received a new "Ternatron IV" as a gift from his mother. Unlike other modern computers, "Ternatron IV" operates with ternary and not binary logic. Petya immediately wondered how the xor operation is performed on this computer (and whether there is anything like it... | {"inputs": ["387420489 225159023\n", "14 34\n", "50 34\n", "5 5\n", "976954722 548418041\n", "4232 755480607\n", "640735701 335933492\n", "5341 813849430\n", "23476 23875625\n", "47229813 6200\n", "657244587 28654748\n", "278014879 3453211\n", "5849 7211\n", "417584836 896784933\n", "19079106 69880743\n", "922263603 38... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
f6f00baaa2f2d24d84c38deae1799e57 | 1392_B. Omkar and Infinity Clock | Being stuck at home, Ray became extremely bored. To pass time, he asks Lord Omkar to use his time bending power: Infinity Clock! However, Lord Omkar will only listen to mortals who can solve the following problem:
You are given an array a of n integers. You are also given an integer k. Lord Omkar wants you to do k ope... | {"inputs": ["3\n2 1\n-199 192\n5 19\n5 -1 4 2 0\n1 2\n69\n", "1\n2 1\n-2 -3\n", "3\n1 1\n1\n5 4\n5 -1 4 2 0\n1 2\n69\n", "1\n5 1\n-5 -4 -3 -2 -1\n", "1\n2 1\n-6 -9\n", "1\n1 398708496844866113\n959414461\n", "1\n2 1\n-5 -4\n", "2\n3 1\n-1 -2 0\n3 2\n-1 -2 0\n", "1\n5 1\n-1 -2 -3 -4 -5\n", "1\n2 1\n-1000000000 -10000000... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
ef62d5d5047d7b9cbe9f6d831506d505 | 1416_D. Graph and Queries | You are given an undirected graph consisting of n vertices and m edges. Initially there is a single integer written on every vertex: the vertex i has p_i written on it. All p_i are distinct integers from 1 to n.
You have to process q queries of two types:
* 1 v — among all vertices reachable from the vertex v using... | {"inputs": ["5 4 6\n1 2 5 4 3\n1 2\n2 3\n1 3\n4 5\n1 1\n2 1\n2 3\n1 1\n1 2\n1 2\n", "9 5 14\n7 1 4 8 5 2 6 9 3\n2 8\n1 6\n5 7\n1 3\n3 9\n1 5\n1 8\n1 5\n1 4\n1 8\n1 3\n1 5\n1 5\n1 7\n1 7\n2 3\n1 2\n1 1\n1 2\n", "6 5 8\n1 2 6 3 4 5\n2 4\n1 3\n1 6\n3 5\n2 5\n1 1\n1 4\n1 1\n2 1\n2 5\n2 2\n2 3\n1 4\n", "2 1 3\n1 2\n1 2\n1 1... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
11cf55ce1417229fe487705d33221254 | 1433_C. Dominant Piranha | There are n piranhas with sizes a_1, a_2, …, a_n in the aquarium. Piranhas are numbered from left to right in order they live in the aquarium.
Scientists of the Berland State University want to find if there is dominant piranha in the aquarium. The piranha is called dominant if it can eat all the other piranhas in the... | {"inputs": ["6\n5\n5 3 4 4 5\n3\n1 1 1\n5\n4 4 3 4 4\n5\n5 5 4 3 2\n3\n1 1 2\n5\n5 4 3 5 5\n", "1\n3\n5 3 4\n", "6\n5\n5 3 4 4 5\n3\n1 1 1\n5\n4 4 3 4 4\n5\n5 5 4 3 2\n3\n1 1 2\n5\n5 4 3 5 5\n", "1\n3\n10 1 5\n", "6\n5\n5 3 4 4 5\n3\n1 1 1\n5\n4 4 3 4 4\n5\n5 7 4 3 2\n3\n1 1 2\n5\n5 4 3 5 5\n", "1\n3\n10 1 8\n", "6\n5\... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
6c4d515fc8dc0b698b52ff18ea798416 | 1458_B. Glass Half Spilled | There are n glasses on the table numbered 1, …, n. The glass i can hold up to a_i units of water, and currently contains b_i units of water.
You would like to choose k glasses and collect as much water in them as possible. To that effect you can pour water from one glass to another as many times as you like. However, ... | {"inputs": ["3\n6 5\n6 5\n10 2\n", "100\n1 0\n1 0\n1 0\n1 0\n1 0\n1 1\n1 0\n1 0\n1 0\n1 1\n1 0\n1 0\n1 0\n1 0\n1 0\n1 0\n1 0\n1 0\n1 1\n1 0\n1 0\n1 0\n1 0\n1 1\n1 0\n1 1\n1 0\n1 1\n1 1\n1 0\n1 0\n1 0\n1 1\n1 0\n1 0\n1 0\n1 1\n1 1\n1 0\n1 1\n1 0\n1 1\n1 1\n1 0\n1 0\n1 0\n1 0\n1 1\n1 0\n1 0\n1 0\n1 0\n1 1\n1 0\n1 0\n1 1\... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
9b7c76f0b16ce82e30e099999528ccea | 1481_B. New Colony | After reaching your destination, you want to build a new colony on the new planet. Since this planet has many mountains and the colony must be built on a flat surface you decided to flatten the mountains using boulders (you are still dreaming so this makes sense to you).
<image>
You are given an array h_1, h_2, ..., ... | {"inputs": ["4\n4 3\n4 1 2 3\n2 7\n1 8\n4 5\n4 1 2 3\n3 1\n5 3 1\n", "14\n7 150\n11 21 25 35 45 52 62\n7 145\n11 21 31 41 51 61 71\n7 50\n2 12 22 32 42 52 62\n7 204\n11 21 21 31 41 51 61\n7 101\n11 21 31 41 51 61 71\n7 107\n11 21 31 41 51 59 69\n7 218\n11 19 29 39 49 54 64\n7 199\n58 7 24 70 5 43 69\n7 335\n72 55 43 64... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
a9a66b6bbf36a381ca75851e59f9d3b3 | 1508_C. Complete the MST | As a teacher, Riko Hakozaki often needs to help her students with problems from various subjects. Today, she is asked a programming task which goes as follows.
You are given an undirected complete graph with n nodes, where some edges are pre-assigned with a positive weight while the rest aren't. You need to assign all... | {"inputs": ["4 4\n2 1 14\n1 4 14\n3 2 15\n4 3 8\n", "5 6\n2 3 11\n5 3 7\n1 4 10\n2 4 14\n4 3 8\n2 5 6\n", "6 6\n3 6 4\n2 4 1\n4 5 7\n3 4 10\n3 5 1\n5 2 15\n", "2 0\n", "6 8\n1 4 1\n1 5 1\n1 6 1\n2 4 1\n2 5 1\n2 6 1\n3 5 1\n3 6 1\n", "6 12\n1 3 8763000\n1 4 8763000\n1 5 8763000\n1 6 8763000\n2 3 8763000\n2 4 1\n2 5 8763... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
44279dd7bbab0ac5573f85451b67a3a0 | 1534_D. Lost Tree | This is an interactive problem.
Little Dormi was faced with an awkward problem at the carnival: he has to guess the edges of an unweighted tree of n nodes! The nodes of the tree are numbered from 1 to n.
The game master only allows him to ask one type of question:
* Little Dormi picks a node r (1 ≤ r ≤ n), and the... | {"inputs": ["4\n\n0 1 2 2\n\n1 0 1 1", "5\n\n2 2 1 1 0\n", "5\n5 3\n2 4\n3 1\n4 5\n", "4\n2 4\n3 2\n2 1\n", "5\n5 3\n2 4\n3 1\n4 5\n", "2\n1 2\n", "4\n3 4\n2 3\n3 1\n", "10\n8 10\n2 9\n7 8\n4 1\n7 3\n4 7\n2 5\n2 4\n4 6\n", "5\n3 4\n3 2\n3 1\n1 5\n", "3\n1 2\n2 3\n", "5\n1 2\n1 3\n1 4\n1 5\n", "5\n5 3\n1 4\n3 1\n4 5\n",... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
f5dce5e8d0ddf3bc57b540421636e943 | 181_B. Number of Triplets | You are given n points on a plane. All points are different.
Find the number of different groups of three points (A, B, C) such that point B is the middle of segment AC.
The groups of three points are considered unordered, that is, if point B is the middle of segment AC, then groups (A, B, C) and (C, B, A) are consi... | {"inputs": ["3\n0 0\n-1 0\n0 1\n", "3\n1 1\n2 2\n3 3\n", "10\n-2 1\n2 -2\n-1 -2\n0 0\n2 -1\n0 -2\n2 2\n0 2\n-1 -1\n1 -2\n", "40\n-8 24\n2 -1\n1 -18\n72 -70\n5 -4\n-308 436\n-19 40\n36 -35\n-178 265\n-1 2\n-7 30\n-1 0\n3 -2\n200 -285\n17 -16\n-35 74\n0 -4\n-86 106\n-1 4\n-7 6\n0 1\n-5 4\n-2 3\n6 -5\n-4 5\n181 -262\n76 -... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
bdaf08bf1fdf7925dd5266c594ce097c | 204_D. Little Elephant and Retro Strings | The Little Elephant has found a ragged old black-and-white string s on the attic.
The characters of string s are numbered from the left to the right from 1 to |s|, where |s| is the length of the string. Let's denote the i-th character of string s as si. As the string is black-and-white, each character of the string is... | {"inputs": ["10 2\nXXBXXWXXXX\n", "3 2\nXXX\n", "4 2\nXXXX\n", "4 2\nXXBW\n", "2 1\nWB\n", "128 100\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n", "25 7\nXWBXWBXWXWBWXBWWXBWXXXXBB\n", "1 1\nX\n", "2 1\nXW\n", "20 6\nXXBXBXXBWWWWXWWXB... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
d84cc45459c1f35bc8416b12b98b0f53 | 229_C. Triangles | Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with n vertices, chooses some m edges and keeps them. Bob gets the <image> remaining edges.
Alice and Bob are fond of "triangles" in graphs, that i... | {"inputs": ["5 5\n1 2\n1 3\n2 3\n2 4\n3 4\n", "5 3\n1 2\n2 3\n1 3\n", "3 3\n1 2\n3 1\n2 3\n", "2 0\n", "10 17\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n1 9\n1 10\n2 3\n3 4\n4 5\n5 6\n6 7\n7 8\n8 9\n9 10\n", "2 1\n1 2\n", "8 13\n1 2\n2 3\n3 4\n4 1\n2 4\n1 3\n5 6\n6 7\n7 8\n8 5\n6 8\n5 7\n1 8\n", "3 2\n1 2\n2 3\n", "10 9\n1 2\... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
51de62dd32bcc3a708c803c5646b607f | 253_A. 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 that positions with indexes i... | {"inputs": ["4 2\n", "3 3\n", "100 100\n", "1 2\n", "10 100\n", "1 34\n", "1 100\n", "90 100\n", "1 4\n", "89 89\n", "6 4\n", "1 98\n", "99 3\n", "1 1\n", "46 2\n", "84 27\n", "5 5\n", "76 48\n", "2 1\n", "56 98\n", "100 90\n", "18 94\n", "100 1\n", "100 101\n", "2 2\n", "0 100\n", "1 32\n", "1 110\n", "22 100\n", "1 7... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
c5a668ddb66e3c73dc675c17a4b4dfec | 278_B. New Problem | Coming up with a new problem isn't as easy as many people think. Sometimes it is hard enough to name it. We'll consider a title original if it doesn't occur as a substring in any titles of recent Codeforces problems.
You've got the titles of n last problems — the strings, consisting of lowercase English letters. Your... | {"inputs": ["4\naa\nbdefghijklmn\nopqrstuvwxyz\nc\n", "5\nthreehorses\ngoodsubstrings\nsecret\nprimematrix\nbeautifulyear\n", "3\nrjnflsbpxqivrcdjptj\nvpojopbwbwbswdu\nrydkiwnugwddcgcrng\n", "1\nz\n", "30\nb\nu\np\nn\nf\nm\nt\ni\nj\nk\np\nh\na\nc\nw\nz\nz\np\nt\nd\no\nw\nu\nq\nl\ny\ni\no\na\nu\n", "5\nsplt\nohqykk\nxqp... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
20b9b2475386601800487985fcd9eba6 | 300_A. Array | Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold:
1. The product of all numbers in the first set is less than zero ( < 0).
2. The product of all numbers in the second set is greater than zero ( > 0).
3. The product of a... | {"inputs": ["4\n-1 -2 -3 0\n", "3\n-1 2 0\n", "100\n-34 81 85 -96 50 20 54 86 22 10 -19 52 65 44 30 53 63 71 17 98 -92 4 5 -99 89 -23 48 9 7 33 75 2 47 -56 42 70 -68 57 51 83 82 94 91 45 46 25 95 11 -12 62 -31 -87 58 38 67 97 -60 66 73 -28 13 93 29 59 -49 77 37 -43 -27 0 -16 72 15 79 61 78 35 21 3 8 84 1 -32 36 74 -88 ... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
47d8f7bfe10a63500c21834d6f9d0f2a | 325_D. Reclamation | In a far away land, there exists a planet shaped like a cylinder. There are three regions in this planet: top, bottom, and side as shown in the following picture.
<image>
Both the top and the bottom areas consist of big cities. The side area consists entirely of the sea.
One day, a city decides that it has too littl... | {"inputs": ["3 4 9\n2 2\n3 2\n2 3\n3 4\n3 1\n1 3\n2 1\n1 1\n1 4\n", "2 5 10\n2 2\n1 1\n1 4\n2 1\n1 2\n1 5\n2 4\n2 5\n1 3\n2 3\n", "2 2 2\n1 1\n2 2\n", "3 3 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n", "7 5 35\n5 3\n3 5\n1 1\n2 5\n6 4\n7 2\n5 1\n3 4\n6 5\n7 3\n4 1\n2 2\n4 2\n2 4\n4 3\n3 3\n6 1\n1 2\n4 5\n1 3\n2 1\... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
ee9f856decc8babe13b23083a1df32ee | 348_E. Pilgrims | A long time ago there was a land called Dudeland. Dudeland consisted of n towns connected with n - 1 bidirectonal roads. The towns are indexed from 1 to n and one can reach any city from any other city if he moves along the roads of the country. There are m monasteries in Dudeland located in m different towns. In each ... | {"inputs": ["8 5\n7 2 5 4 8\n1 2 1\n2 3 2\n1 4 1\n4 5 2\n1 6 1\n6 7 8\n6 8 10\n", "7 3\n1 4 7\n1 2 2\n2 3 3\n3 4 8\n2 5 1\n1 6 4\n6 7 5\n", "10 2\n1 5\n5 3 2\n8 4 8\n7 6 9\n7 10 1\n10 1 4\n9 5 1\n5 8 2\n7 2 9\n6 5 6\n", "10 5\n4 8 7 5 1\n5 1 1\n2 7 1\n4 3 1\n10 9 1\n10 1 1\n1 8 1\n10 7 1\n10 3 1\n7 6 1\n", "10 9\n9 7 6... | 11 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
b2f673e8d4783e787fe99811e3065ac5 | 372_A. Counting Kangaroos is Fun | There are n kangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another kangaroo's pocket if and only if the size of kangaroo who hold the kangaroo is at least twice as large as the size of kangaroo who is held.
Each kangaroo can hold at most one kangaroo, and the kangaroo who is ... | {"inputs": ["8\n2\n5\n7\n6\n9\n8\n4\n2\n", "8\n9\n1\n6\n2\n6\n5\n8\n3\n", "1\n1\n", "12\n55\n75\n1\n98\n63\n64\n9\n39\n82\n18\n47\n9\n", "7\n1\n2\n4\n8\n16\n32\n64\n", "4\n1\n1\n1\n2\n", "5\n1\n2\n4\n8\n16\n", "100\n678\n771\n96\n282\n135\n749\n168\n668\n17\n658\n979\n446\n998\n331\n606\n756\n37\n515\n538\n205\n647\n54... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
1e88cac78f97a3e0f4c9e1aa613e81ab | 393_C. Blocked Points | Imagine you have an infinite 2D plane with Cartesian coordinate system. Some of the integral points are blocked, and others are not. Two integral points A and B on the plane are 4-connected if and only if:
* the Euclidean distance between A and B is one unit and neither A nor B is blocked;
* or there is some inte... | {"inputs": ["2\n", "3\n", "1\n", "11\n", "0\n", "17\n", "18855321\n", "34609610\n", "25\n", "9\n", "40000000\n", "17464436\n", "38450759\n", "395938\n", "39099999\n", "8\n", "4\n", "30426905\n", "7\n", "17082858\n", "46341\n", "46340\n", "39999996\n", "6\n", "12823666\n", "39999999\n", "5\n", "5626785\n", "22578061\n",... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
f5da83d34732c2b597d7df184329434b | 416_D. Population Size | Polycarpus develops an interesting theory about the interrelation of arithmetic progressions with just everything in the world. His current idea is that the population of the capital of Berland changes over time like an arithmetic progression. Well, or like multiple arithmetic progressions.
Polycarpus believes that if... | {"inputs": ["9\n-1 6 -1 2 -1 4 7 -1 2\n", "5\n-1 -1 -1 -1 -1\n", "7\n-1 -1 4 5 1 2 3\n", "9\n8 6 4 2 1 4 7 10 2\n", "3\n-1 1 -1\n", "4\n45 -1 41 -1\n", "1\n-1\n", "5\n40 -1 44 46 48\n", "6\n43 40 37 34 -1 -1\n", "7\n-1 2 4 -1 4 1 5\n", "19\n23 26 -1 -1 35 38 41 -1 -1 -1 53 -1 59 62 6 7 8 9 -1\n", "6\n-1 2 6 -1 -1 6\n",... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
9fc08291e10e3ecee8fcb57b3676979a | 443_B. Kolya and Tandem Repeat | Kolya got string s for his birthday, the string consists of small English letters. He immediately added k more characters to the right of the string.
Then Borya came and said that the new string contained a tandem repeat of length l as a substring. How large could l be?
See notes for definition of a tandem repeat.
I... | {"inputs": ["aaabbbb\n2\n", "aaba\n2\n", "abracadabra\n10\n", "jtifziirovbklaioslunwvtdavraandnzcwqbealbvqonoxufqrsewwrzvkrecrfqhdduwmcdcdhdtvpyshfhgdwdkmglskidhzayvouwhumzhcphocqyfcdddhzayvouwhumzhcphocqyfcddayfakoxofjgusuonehbxbokjsdlktqrcdurogxltsysyjbiagrvhky\n32\n", "kbxuunznjtxutlauuuipifggjjkequbpvbagmxojhgxtakx... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
5d72f6f33ce34edaf0f5def4604c51cc | 465_C. No to Palindromes! | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.
Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable st... | {"inputs": ["3 4\ncba\n", "3 3\ncba\n", "4 4\nabcd\n", "302 4\nabdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcb... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
c4bc70424e3b9577d957ea0a4ce09986 | 489_B. BerSU Ball | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.
We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair m... | {"inputs": ["4\n1 2 3 4\n4\n10 11 12 13\n", "4\n1 4 6 2\n5\n5 1 5 7 9\n", "5\n1 1 1 1 1\n3\n1 2 3\n", "1\n4\n3\n4 4 4\n", "3\n7 7 7\n4\n2 7 2 4\n", "3\n5 4 5\n2\n2 1\n", "100\n9 90 66 62 60 9 10 97 47 73 26 81 97 60 80 84 19 4 25 77 19 17 91 12 1 27 15 54 18 45 71 79 96 90 51 62 9 13 92 34 7 52 55 8 16 61 96 12 52 38 5... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
b009f9bfe21162557a1566f8891be0b6 | 513_A. Game | Two players play a simple game. Each player is provided with a box with balls. First player's box contains exactly n1 balls and second player's box contains exactly n2 balls. In one move first player can take from 1 to k1 balls from his box and throw them away. Similarly, the second player can take from 1 to k2 balls f... | {"inputs": ["2 1 1 1\n", "2 2 1 2\n", "50 50 50 50\n", "49 49 4 1\n", "48 50 12 11\n", "5 7 1 10\n", "1 50 50 50\n", "5 7 1 4\n", "32 4 17 3\n", "1 50 1 50\n", "50 1 1 1\n", "32 31 10 9\n", "5 7 4 1\n", "49 49 3 3\n", "50 49 1 2\n", "50 48 3 1\n", "50 1 1 50\n", "5 7 10 10\n", "1 1 1 1\n", "49 50 11 12\n", "50 50 87 50... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
b4ef34c5e5340d9dc82badc478ad31a3 | 538_B. Quasi Binary | A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
Input
The first line contains a single... | {"inputs": ["32\n", "9\n", "111111\n", "100009\n", "10011\n", "1000000\n", "8\n", "10201\n", "102030\n", "908172\n", "123456\n", "415\n", "900000\n", "21\n", "909090\n", "314159\n", "999999\n", "909823\n", "987654\n", "1453\n", "1435\n", "98\n", "10\n", "2\n", "1\n", "111011\n", "74547\n", "10111\n", "4\n", "18996\n", ... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
98a1772152bc1006c48a24c645ad4781 | 566_C. Logistical Questions | Some country consists of n cities, connected by a railroad network. The transport communication of the country is so advanced that the network consists of a minimum required number of (n - 1) bidirectional roads (in the other words, the graph of roads is a tree). The i-th road that directly connects cities ai and bi, h... | {"inputs": ["5\n3 1 2 6 5\n1 2 3\n2 3 1\n4 3 9\n5 3 1\n", "2\n5 5\n1 2 2\n", "3\n1 1 5\n1 3 42\n1 2 42\n", "2\n42 23\n1 2 10\n", "10\n45792697 27183921 4791060 77070594 27286110 66957065 19283638 2944837 26775511 65379701\n5 8 25\n8 10 94\n1 4 14\n9 7 96\n4 2 16\n2 6 58\n2 3 99\n6 8 21\n8 9 87\n", "5\n3 1 2 6 5\n1 2 3\... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
ea9f9b1ac6b5a7e8f204c73c132e2a0f | 587_D. Duff in Mafia | Duff is one if the heads of Mafia in her country, Andarz Gu. Andarz Gu has n cities (numbered from 1 to n) connected by m bidirectional roads (numbered by 1 to m).
Each road has a destructing time, and a color. i-th road connects cities vi and ui and its color is ci and its destructing time is ti.
Mafia wants to dest... | {"inputs": ["5 7\n2 1 3 7\n3 1 1 6\n5 4 1 8\n4 5 1 1\n3 2 2 3\n4 5 2 5\n2 3 2 4\n", "3 5\n3 2 1 3\n1 3 1 1\n3 2 1 4\n1 3 2 2\n1 3 2 10\n", "3 5\n2 1 608591421 720962564\n3 2 608591421 641991574\n3 2 718110706 353409763\n2 3 482786015 858341723\n3 2 825397574 357507279\n", "2 1\n2 1 317425595 636156322\n", "50000 1\n208... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
c990aceee0ab45e0b963504aca1c5b25 | 609_F. Frogs and mosquitoes | There are n frogs sitting on the coordinate axis Ox. For each frog two values xi, ti are known — the position and the initial length of the tongue of the i-th frog (it is guaranteed that all positions xi are different). m mosquitoes one by one are landing to the coordinate axis. For each mosquito two values are known p... | {"inputs": ["4 6\n10 2\n15 0\n6 1\n0 1\n110 10\n1 1\n6 0\n15 10\n14 100\n12 2\n", "1 2\n10 2\n20 2\n12 1\n", "2 2\n0 0\n30 9\n6 2\n19 2\n", "1 1\n1000000000 1000000000\n1000000000 1000000000\n", "20 20\n19 1\n67 10\n42 0\n185 1\n68 2\n88 0\n74 3\n138 2\n30 5\n112 8\n1 1\n137 0\n125 0\n106 5\n145 0\n188 2\n166 11\n49 1\... | 12 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
e470d385e566331b9856d477be9d3fb6 | 630_E. 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\n", "-157778763 218978790 976692563 591093088\n", "-1 -4 1 4\n", "-999999999 -1000000000 -1 0\n", "1000000000 1000000000 1000000000 1000000000\n", "-2 -3 -2 1\n", "-1000000000 -999999999 1000000000 999999999\n", "0 -1 0 1\n", "-999999999 -999999999 999999999 999999999\n", "-946749893 -687257665 -53... | 11 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
49143f442408fb4c3bcbe8a83d051bc2 | 658_B. Bear and Displayed Friends | Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger this value is, the better the friendship is. No two friends have the same value ti.
Spring is starting and the Winter sleep is ... | {"inputs": ["6 3 9\n50 20 51 17 99 24\n1 3\n1 4\n1 5\n1 2\n2 4\n2 2\n1 1\n2 4\n2 3\n", "4 2 8\n300 950 500 200\n1 3\n2 4\n2 3\n1 1\n1 2\n2 1\n2 2\n2 3\n", "1 1 1\n1000000000\n2 1\n", "20 2 15\n12698951 55128070 116962690 156763505 188535242 194018601 269939893 428710623 442819431 483000923 516768937 552903993 633087286... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
b259166eef991bdcb528727a085850e3 | 680_D. Bear and Tower of Cubes | Limak is a little polar bear. He plays by building towers from blocks. Every block is a cube with positive integer length of side. Limak has infinitely many blocks of each side length.
A block with side a has volume a3. A tower consisting of blocks with sides a1, a2, ..., ak has the total volume a13 + a23 + ... + ak3.... | {"inputs": ["6\n", "48\n", "1000000000000000\n", "994\n", "200385\n", "3842529393411\n", "8\n", "409477218238717\n", "2\n", "419477218238718\n", "909383000\n", "7\n", "999088000000000\n", "265\n", "415000000238718\n", "780869426483087\n", "9\n", "850085504652042\n", "567000123\n", "980123123123123\n", "409477218238719\... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
bef2a91a18aaec12700ab5384de05609 | 703_C. Chris and Road | And while Mishka is enjoying her trip...
Chris is a little brown bear. No one knows, where and when he met Mishka, but for a long time they are together (excluding her current trip). However, best friends are important too. John is Chris' best friend.
Once walking with his friend, John gave Chris the following proble... | {"inputs": ["5 5 1 2\n1 2\n3 1\n4 3\n3 4\n1 4\n", "3 3 5 2\n3 1\n4 0\n5 1\n", "10 1000 59 381\n131 195\n303 53\n528 0\n546 0\n726 41\n792 76\n917 187\n755 945\n220 895\n124 796\n", "10 1000 787 576\n-126 73\n-20 24\n216 7\n314 34\n312 967\n288 976\n99 999\n-138 920\n-220 853\n-308 734\n", "10 1000 519 882\n-407 135\n-2... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
ab18829cd82c4ce70e444bd055230a98 | 725_C. Hidden Word | Let’s define a grid to be a set of tiles with 2 rows and 13 columns. Each tile has an English letter written in it. The letters don't have to be unique: there might be two or more tiles with the same letter written on them. Here is an example of a grid:
ABCDEFGHIJKLM
NOPQRSTUVWXYZ
We say that two t... | {"inputs": ["BUVTYZFQSNRIWOXXGJLKACPEMDH\n", "ABCDEFGHIJKLMNOPQRSGTUVWXYZ\n", "MKBGVNDJRAWUEHFSYLIZCOPTXKQ\n", "ABACDEFGHIJKLMNOPQRSTUVWXYZ\n", "BACDEFGHIJKLMNOPQRSTUVWXYZA\n", "BADSLHIYGMZJQKTCOPRVUXFWENN\n", "HVDEBKMJTLKQORNWCZSGXYIPUAF\n", "UNGHFQRCIPBZTEOAYJXLDMSKNWV\n", "TEGXHBUVZDPAMIJFQYCWRKSTNLO\n", "MIDLBEUAGT... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
14cfa702159111054569968836138c31 | 747_C. Servers | There are n servers in a laboratory, each of them can perform tasks. Each server has a unique id — integer from 1 to n.
It is known that during the day q tasks will come, the i-th of them is characterized with three integers: ti — the moment in seconds in which the task will come, ki — the number of servers needed to ... | {"inputs": ["8 6\n1 3 20\n4 2 1\n6 5 5\n10 1 1\n15 3 6\n21 8 8\n", "4 3\n1 3 2\n2 2 1\n3 4 3\n", "3 2\n3 2 3\n5 1 2\n", "100 1\n1000000 100 1000\n", "5 3\n1 4 10\n2 2 5\n3 1 6\n", "10 4\n1 5 20\n2 5 200\n100 6 20\n101 1 100\n", "5 3\n1 3 4\n4 3 4\n6 4 1\n", "4 1\n6 1 1\n", "8 6\n1 3 20\n4 2 1\n6 6 5\n9 1 1\n15 3 6\n21 ... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
0354c2caba903fd8328442e5397af218 | 76_F. Tourist | Tourist walks along the X axis. He can choose either of two directions and any speed not exceeding V. He can also stand without moving anywhere. He knows from newspapers that at time t1 in the point with coordinate x1 an interesting event will occur, at time t2 in the point with coordinate x2 — another one, and so on u... | {"inputs": ["3\n-1 1\n42 7\n40 8\n2\n", "12\n-6712 6\n2375 73\n4643 197\n-5660 215\n-378 223\n2228 307\n3305 340\n3449 468\n-4389 707\n-7161 729\n-1838 921\n-1655 985\n730\n", "5\n1 5\n6 7\n17127 17\n17072 42\n17042 77\n3\n", "7\n-976754 20479\n79929143 911181\n9598220 82517\n-51609349 810257\n67416551 266544\n-1417097... | 12 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
c4a7d1aeb5b4e894ab36cc3b360a61c5 | 794_C. Naming Company | Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.
To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor ea... | {"inputs": ["xxxxxx\nxxxxxx\n", "tinkoff\nzscoder\n", "ioi\nimo\n", "bcdef\nabbbc\n", "z\ny\n", "reddit\nabcdef\n", "abc\naaa\n", "y\nz\n", "cbxz\naaaa\n", "fedcb\nabbbc\n", "reddit\nbbcdef\n", "cba\naaa\n", "bbxz\naaaa\n", "xxxxxw\nxxxxxx\n", "tinkogf\nzscoder\n", "ioj\nimo\n", "feddb\nabbbc\n", "bbxz\nbaaa\n", "xxxxx... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
6e0adbe9d8bbef0c27ac61a17c3429e1 | 815_B. Karen and Test | Karen has just arrived at school, and she has a math test today!
<image>
The test is about basic addition and subtraction. Unfortunately, the teachers were too busy writing tasks for Codeforces rounds, and had no time to make an actual test. So, they just put one question in the test that is worth all the points.
Th... | {"inputs": ["4\n3 7 5 2\n", "5\n3 6 9 12 15\n", "6\n58376259 643910770 5887448 757703054 544067926 902981667\n", "5\n585325539 365329221 412106895 291882089 564718673\n", "7\n941492387 72235422 449924898 783332532 378192988 592684636 147499872\n", "1\n1\n", "16\n985629174 189232688 48695377 692426437 952164554 24346049... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
deb54d25a982365fedfee740abe6e3f9 | 840_B. Leha and another game about graph | Leha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Graph can contain multiple edges, but can not contain self loops. Each vertex has an integer di, which can be equal to 0, 1 or - 1. To pass the level, he needs to find a «good» subset of edges of the graph or say... | {"inputs": ["3 3\n0 -1 1\n1 2\n2 3\n1 3\n", "4 5\n0 0 0 -1\n1 2\n2 3\n3 4\n1 4\n2 4\n", "1 0\n1\n", "2 1\n1 1\n1 2\n", "3 2\n1 0 1\n1 2\n2 3\n", "10 10\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n6 7\n8 3\n6 4\n4 2\n9 2\n5 10\n9 8\n10 7\n5 1\n6 2\n", "10 10\n-1 -1 -1 -1 0 -1 -1 -1 -1 -1\n6 7\n8 3\n6 4\n4 2\n9 2\n5 10\n9 8\n10 7\n5... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
d5a3ee039e3c6974083339c84c4c3a84 | 860_C. Tests Renumeration | The All-Berland National Olympiad in Informatics has just ended! Now Vladimir wants to upload the contest from the Olympiad as a gym to a popular Codehorses website.
Unfortunately, the archive with Olympiad's data is a mess. For example, the files with tests are named arbitrary without any logic.
Vladimir wants to re... | {"inputs": ["5\n01 0\n2 1\n2extra 0\n3 1\n99 0\n", "2\n1 0\n2 1\n", "5\n1 0\n11 1\n111 0\n1111 1\n11111 0\n", "3\n1 1\nzwfnx2 1\n7g8t6z 1\n", "3\nqmf7iz 1\ndjwdce 1\n1 1\n", "6\n4 1\n410jiy 1\n1 0\n6 0\nxc98l2 1\n5 0\n", "3\n2 1\n3 0\nhs9j9t 1\n", "6\n5 1\n6 0\nxhfzge 0\n3 1\n1 0\n1n9mqv 1\n", "3\n3 1\n1 0\n2 1\n", "5\... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
65273b4ca09c700f3a68417e299034b4 | 887_B. Cubes for Masha | Absent-minded Masha got set of n cubes for her birthday.
At each of 6 faces of each cube, there is exactly one digit from 0 to 9. Masha became interested what is the largest natural x such she can make using her new cubes all integers from 1 to x.
To make a number Masha can rotate her cubes and put them in a row. Aft... | {"inputs": ["3\n0 1 3 5 6 8\n1 2 4 5 7 8\n2 3 4 6 7 9\n", "3\n0 1 2 3 4 5\n6 7 8 9 0 1\n2 3 4 5 6 7\n", "2\n2 6 8 1 3 1\n2 1 3 8 6 7\n", "2\n1 8 9 1 1 0\n2 3 4 5 6 7\n", "2\n0 2 9 8 1 7\n6 7 4 3 2 5\n", "3\n9 4 6 2 7 0\n3 7 1 9 6 4\n6 1 0 8 7 2\n", "3\n2 7 4 0 7 1\n5 5 4 9 1 4\n2 1 7 5 1 7\n", "3\n5 1 2 9 6 4\n9 0 6 4 ... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
5196ead71556bb48081eb18a430de432 | 90_B. African Crossword | An African crossword is a rectangular table n × m in size. Each cell of the table contains exactly one letter. This table (it is also referred to as grid) contains some encrypted word that needs to be decoded.
To solve the crossword you should cross out all repeated letters in rows and columns. In other words, a lette... | {"inputs": ["3 3\ncba\nbcd\ncbc\n", "5 5\nfcofd\nooedo\nafaoa\nrdcdf\neofsf\n", "1 2\nfg\n", "3 2\nxe\ner\nwb\n", "7 6\neklgxi\nxmpzgf\nxvwcmr\nrqssed\nouiqpt\ndueiok\nbbuorv\n", "9 3\njel\njws\ntab\nvyo\nkgm\npls\nabq\nbjx\nljt\n", "100 2\nhd\ngx\nmz\nbq\nof\nst\nzc\ndg\nth\nba\new\nbw\noc\now\nvh\nqp\nin\neh\npj\nat\... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
32426635f1dcce5bb230bbbfacec8392 | 931_E. Game with String | Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i. e. creates a new string ... | {"inputs": ["tictictactac\n", "bbaabaabbb\n", "technocup\n", "fabbbhgedd\n", "abbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaababbbaab\n", "hcdhgcchbdhbeagdcfedgcbaffebgcbcccadeefacbhefgeadfgchabgeebegahfgegahbddedfhffeadcedadgfbeebhgfahhfb\n", "khjcoijiicdkdianmdolmadobdkcmgifdnffddn... | 11 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
eddf387029e1dfab01de6dd40f11c08d | 958_F3. Lightsabers (hard) | There used to be unrest in the Galactic Senate. Several thousand solar systems had declared their intentions to leave the Republic. But fear not! Master Heidi was able to successfully select the Jedi Knights that have restored peace in the galaxy. However, she knows that evil never sleeps and a time may come when she w... | {"inputs": ["4 3 2\n1 2 3 2\n", "10 2 5\n1 1 1 2 2 2 2 2 2 2\n", "10 2 5\n1 1 1 1 1 1 2 2 2 2\n", "3 3 2\n1 3 1\n", "8 8 7\n7 2 8 6 8 5 3 8\n", "7 7 5\n2 6 3 6 3 5 1\n", "5 5 1\n5 2 5 1 2\n", "6 6 6\n5 6 5 3 4 2\n", "5 5 2\n2 3 2 2 4\n", "3 3 3\n1 1 1\n", "111 78 54\n24 13 49 22 52 38 38 63 21 10 9 56 60 47 11 78 23 52... | 12 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
bab652d77e24cd5058f6cd8e369450a7 | 985_E. Pencils and Boxes | Mishka received a gift of multicolored pencils for his birthday! Unfortunately he lives in a monochrome world, where everything is of the same color and only saturation differs. This pack can be represented as a sequence a1, a2, ..., an of n integer numbers — saturation of the color of each pencil. Now Mishka wants to ... | {"inputs": ["6 3 10\n7 2 7 7 4 2\n", "3 2 5\n10 16 22\n", "6 2 3\n4 5 3 13 4 10\n", "4 2 12\n10 16 22 28\n", "10 3 1\n5 5 5 6 6 7 8 8 8 9\n", "8 7 13\n52 85 14 52 92 33 80 85\n", "10 5 293149357\n79072863 760382815 358896034 663269192 233367425 32795628 837363300 46932461 179556769 763342555\n", "10 3 0\n1 1 2 2 2 2 2 ... | 11 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
113d247ab11709c0fc71b4d8e3e382a8 | ac-or-cooler | This summer is very hot in KGP. As the hostel rooms do not have coolers or ACs, it's even more difficult for the students. So, the management has decided to install a cooler or an AC in some of the rooms.
There are N rooms in KGP. The management has alloted a budget of M units. There are N types of coolers and AC. But... | {"inputs": ["5 10\n2 5 2 2 10\n2 1 4 1 9\n\nSAMPLE", "5 10\n2 5 2 2 10\n2 1 7 1 9\n\nSAMPLE", "5 10\n2 8 4 2 10\n2 4 7 1 9\n\nTAMPLE", "6 10\n2 5 1 2 0\n4 2 14 1 9\n\nDAMQLS", "5 4\n2 6 2 2 10\n3 2 7 1 9\n\nELPMAT", "5 4\n2 6 0 2 10\n3 2 7 1 9\n\nEMPMAT", "5 0\n2 6 2 2 20\n2 1 4 1 9\n\nSAMPLE", "10 20\n3 5 2 2 45\n6 0 ... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
a37e5a736e4bea2b712be3140cfc6076 | box-n-ball-1 | Bozo is shifting his house. He has some balls and boxes which he has to shift. He now wonders how large a ball he can fit in a given box. Given the dimensions of a box, help Bozo determine the radius of the largest ball that he can fit in the box. Assume that an inflated ball will be spherical.
Input:-
The first line... | {"inputs": ["3\n1 2 3\n3 3 7\n987548 4578445 9645875456\n\nSAMPLE", "28\n754474126400970 101 196613378898208859\n380621045618581 267501121282332999 950586\n793855488118611572 865408 211106328880\n373419125 487966671162 240278042032\n366316 973 365\n592904340231516 734 44193919246935149\n76 752 536\n343780751470180549 9... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
22e6b0026d9a6efed76952093c5ea27f | cutting-the-birthday-cake | Its Alice's birthday and her friend Bob gets him a birthday cake. Its nice delicious circle shaped cake of radius R. Now they need to cut and eat that cake, so Alice fetches a cutter from her kitchen. It is a rectangular cutter of length A and breadth B that would knock of the part of the cake when the cutter is place... | {"inputs": ["2\n1 2 2\n1 1 1\n\nSAMPLE", "1000\n725 248 935\n139 402 325\n383 976 540\n407 152 158\n897 369 160\n913 870 150\n931 478 19\n936 641 908\n147 117 438\n378 871 144\n860 850 235\n535 929 11\n218 584 955\n944 663 353\n903 402 811\n172 147 154\n869 294 168\n408 742 333\n769 375 118\n690 796 52\n819 3 924\n754 ... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
b8866c423c917bed82f99e7b1dc66eee | fun-with-primes-3 | A prime number is one which is divisible by exactly two numbers 1 and itself.
Given a number, find out if the number obtained by summing all digits of that number is a prime.
Input Format:
The input begins with number of test-cases t in a single line. In each of next tlines there is a number n.
Output Format
In each ... | {"inputs": ["2\n33\n122\n\nSAMPLE", "2\n33\n122\n\nSAMPLD", "2\n14\n122\n\nSAMPLD", "2\n14\n206\n\nSAMPLD", "2\n6\n206\n\nSAMPLD", "2\n6\n206\n\nSAMPKD", "2\n7\n206\n\nSAMPKD", "2\n7\n244\n\nSAMPKD", "2\n3\n244\n\nSAMPKD", "2\n3\n484\n\nSAMPKD", "2\n5\n484\n\nSAMPKD", "2\n5\n484\n\nKAMPSD", "2\n5\n471\n\nKAMPSD", "2\n5... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
975f79d9f633fd480210bf2f13ede3df | just-find-the-next-number | You are given an integer n find its next greater or equal number whose binary representation must not contain consecutive ones.
For eg. given n=6 whose binary is 110 and the next number with no consecutive ones is 8 whose binary is 1000.
INPUT
First line of input contains t, the total number of test cases. Then t l... | {"inputs": ["2\n6\n2\n\nSAMPLE", "10\n71\n8497\n6364\n6530\n9199\n5754\n1508\n9388\n6992\n4494", "10\n71\n8497\n6364\n6530\n9199\n5487\n1508\n9388\n6992\n4494", "2\n6\n2\n\nELPMAS", "10\n71\n8497\n6642\n6530\n9199\n5487\n2600\n9388\n6992\n4494", "10\n71\n8497\n6642\n6530\n9199\n10823\n2600\n9388\n6992\n4494", "2\n9\n2\... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
23431f42bddf65d50530d944cdef68b3 | minimum-coins | Ram has to pay Shyam R rupees and but the coins which he has got is of limited denomination .Assuming he has a limited knowledge of the mathematics and has unlimited number of coins of each denomination.Write a code to help Ram to pay the money using minimum number of coins .Suppose Ram has coins of {1,2} denomination ... | {"inputs": ["24\n{1,7,3}\n\nSAMPLE", "9\n{10}", "-19\n{10}", "79\n{2,8}"], "outputs": ["Rupee 1 coin 0\nRupee 3 coin 1\nRupee 7 coin 3", "ERROR", "ERROR", "ERROR"]} | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
9a65d6286be4dbfee4e108fcca518aa8 | palindrome-count-1 | Given a string S, count the number of non empty sub strings that are palindromes.
A sub string is any continuous sequence of characters in the string.
A string is said to be palindrome, if the reverse of the string is same as itself.
Two sub strings are different if they occur at different positions in S
Input
Input c... | {"inputs": ["dskjkd\n\nSAMPLE", "wqc", "mygrlbiadhzlabefvjtghfrtydurkpmoveczbqzzlenezq", "wpc", "mygrlbiadhzlabefwjtghfrtydurkpmoveczbqzzlenezq", "dskdkj\n\nSAMPLE", "dsjdkj\n\nELPMAQ", "qzenelzzqbzbyvompkrudytrfigtjwfebalfhdaiblrgzm", "rjjmem\n\nQNHQDQ", "megrlbiadhzlabefwjtghfrtydurkpmovyczbqzzlenfzq", "qzenelzzqbzby... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
539e60e5a99c5aa94c3dffc7ae5650fe | rhezo-and-prime-problems | Rhezo and his friend Vanya love problem solving. They have a problem set containing N problems, with points assigned to each. Rhezo wants to solve problems in such a way that he gets the maximum number of points. Rhezo has a weird habit of solving only prime number of consecutive problems, that is, if he solves X conse... | {"inputs": ["4\n8 1 3 7\n\nSAMPLE", "4\n8 2 3 7\n\nSAMPLE", "4\n8 0 3 7\n\nELPMAS", "4\n8 0 2 7\n\nELPMAS", "4\n8 -1 2 7\n\nELPMAS", "4\n8 -2 2 10\n\nELPMAS", "4\n8 -2 1 0\n\nELPMAS", "4\n8 -3 1 0\n\nELPMAS", "4\n1 -3 1 0\n\nELPMAS", "4\n1 -3 1 1\n\nELPMAS", "4\n1 -4 2 1\n\nELPMAS", "4\n0 -12 3 1\n\nELQMAS", "4\n0 -2 1... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
c97676f7896384f0bf0aacab80e552dd | special-sum-3 | Special Sum of number N is defined as follows:
def foo(n):
{
ret = 0
for i = 1 to n:
{
if gcd(n,i) is 1:
ret += 1
}
return ret
}
def SpecialSum(N):
{
ret=0
for i = 1 to N:
{
if i divides N:
ret += foo(i)
}
return ret
}
Given a N print SpecialSum(N).
Input:... | {"inputs": ["1\n5\n\nSAMPLE", "1000\n84\n87\n78\n16\n94\n36\n87\n93\n50\n22\n63\n28\n91\n60\n64\n27\n41\n27\n73\n37\n12\n69\n68\n30\n83\n31\n63\n24\n68\n36\n30\n3\n23\n59\n70\n68\n94\n57\n12\n43\n30\n74\n22\n20\n85\n38\n99\n25\n16\n71\n14\n27\n92\n81\n57\n74\n63\n71\n97\n82\n6\n26\n85\n28\n37\n6\n47\n30\n14\n58\n25\n96... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
d7cbe43fa5f2294e1d0ca7d8bb029330 | trick-with-the-cards | Mr. X is performing a trick with the cards. He has N cards, lets name them 1.....N, on a round table.
So card 1 is in between 2nd card and Nth card. Initially all cards are upside down. His trick involves making all cards face up.
His trick is whenever he taps on a card, it flips (if card was originally upside down,... | {"inputs": ["2\n2\n3\n\nSAMPLE", "2\n2\n3\n\nSAMPME", "2\n2\n5\n\nSAMPME", "2\n0\n5\n\nEMPMAS", "2\n0\n2\n\nEMPMAS", "2\n2\n0\n\nSAMPME", "2\n0\n0\n\nEMPMAS", "2\n6\n5\n\nENPM@T", "2\n0\n4\n\nSMMPAE", "2\n11\n5\n\nENPM@T", "2\n0\n8\n\nSMMPAE", "2\n19\n5\n\nENPM@T", "2\n19\n4\n\nENPM@T", "2\n1\n6\n\nSBMOME", "2\n4\n4\n\... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
a1f01955ca0ef4c651498a2c5105a955 | p02578 AtCoder Beginner Contest 176 - Step | N persons are standing in a row. The height of the i-th person from the front is A_i.
We want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person:
Condition: Nobody in front of the person is taller than the person. Here, the height of a ... | {"inputs": ["5\n3 3 3 3 3", "5\n2 1 5 4 3", "5\n1 3 3 3 3", "5\n2 1 5 8 3", "5\n1 2 3 6 3", "5\n2 1 2 8 4", "5\n2 1 2 16 6", "5\n2 1 1 16 6", "5\n4 4 3 6 6", "5\n0 1 1 16 6", "5\n4 4 3 7 6", "5\n0 0 1 19 6", "5\n0 0 1 19 4", "5\n0 0 1 10 2", "5\n0 0 1 14 0", "5\n3 1 5 8 3", "5\n0 1 2 8 4", "5\n0 -1 1 19 4", "5\n0 -1 1 ... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
83d41fadd11d7ef4992ebb5d99f5a046 | p02709 AtCoder Beginner Contest 163 - Active Infants | There are N children standing in a line from left to right. The activeness of the i-th child from the left is A_i.
You can rearrange these children just one time in any order you like.
When a child who originally occupies the x-th position from the left in the line moves to the y-th position from the left, that child... | {"inputs": ["4\n1 3 4 2", "6\n8 6 9 1 2 1", "6\n5 5 6 1 1 1", "4\n1 4 4 2", "6\n8 6 11 1 2 1", "6\n5 5 6 0 1 1", "4\n1 8 4 2", "6\n8 6 22 1 2 1", "6\n5 5 9 0 1 1", "4\n2 8 4 2", "6\n8 6 22 1 1 1", "6\n5 0 9 0 1 1", "6\n8 6 33 1 1 1", "6\n5 0 9 0 0 1", "4\n4 8 4 1", "6\n8 10 33 1 1 1", "6\n5 0 6 0 1 1", "6\n8 10 33 1 2 ... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
4efcfc12ccf9f2e09791eb6bf25887b4 | p02838 AtCoder Beginner Contest 147 - Xor Sum 4 | We have N integers. The i-th integer is A_i.
Find \sum_{i=1}^{N-1}\sum_{j=i+1}^{N} (A_i \mbox{ XOR } A_j), modulo (10^9+7).
What is \mbox{ XOR }?
The XOR of integers A and B, A \mbox{ XOR } B, is defined as follows:
* When A \mbox{ XOR } B is written in base two, the digit in the 2^k's place (k \geq 0) is 1 if eith... | {"inputs": ["3\n1 2 3", "10\n3 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820", "10\n3 1 4 1 5 9 2 6 5 3", "3\n1 2 1", "10\n1 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820", "10\n3 1 4 1 5 9 2 6 5 6", "3\n1 4 1", "10\n1 14 159 2653 58979 376446 2643383 27950288 419716939 9375105820", "1... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
93f4ef8a1f43c0acc3b61572c595e3c3 | p02975 AtCoder Grand Contest 035 - XOR Circle | Snuke has N hats. The i-th hat has an integer a_i written on it.
There are N camels standing in a circle. Snuke will put one of his hats on each of these camels.
If there exists a way to distribute the hats to the camels such that the following condition is satisfied for every camel, print `Yes`; otherwise, print `No... | {"inputs": ["3\n1 2 3", "4\n1 2 4 8", "3\n1 2 0", "3\n3 2 1", "4\n1 2 4 11", "3\n0 2 0", "4\n0 2 4 11", "3\n0 1 0", "4\n0 4 4 11", "3\n0 1 -1", "4\n0 4 4 20", "3\n1 2 1", "4\n0 4 1 20", "3\n2 2 1", "4\n0 4 1 33", "4\n0 4 1 63", "3\n3 4 1", "4\n0 4 1 39", "3\n3 7 1", "4\n0 4 1 0", "3\n6 7 1", "4\n1 4 1 0", "3\n5 7 1", "... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
0c544b1ab8b993fab4a97cf51c27a478 | p03111 AtCoder Beginner Contest 119 - Synthetic Kadomatsu | You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively.
Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number:
* Extension Magic: Consumes 1 MP (magic point).... | {"inputs": ["8 1000 800 100\n300\n333\n400\n444\n500\n555\n600\n666", "5 100 90 80\n98\n40\n30\n21\n80", "8 100 90 80\n100\n100\n90\n90\n90\n80\n80\n80", "8 1100 800 100\n300\n333\n400\n444\n500\n555\n600\n666", "5 100 171 80\n98\n40\n30\n21\n80", "8 100 90 80\n100\n100\n90\n90\n90\n80\n80\n20", "8 1100 800 100\n297\n3... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
e2ee49e8d8d56c108ebceeb82431a7ea | p03258 AtCoder Grand Contest 027 - ABBreviate | There is a string s consisting of `a` and `b`. Snuke can perform the following two kinds of operation any number of times in any order:
* Choose an occurrence of `aa` as a substring, and replace it with `b`.
* Choose an occurrence of `bb` as a substring, and replace it with `a`.
How many strings s can be obtained b... | {"inputs": ["babbabaaba", "ababababa", "aaaa", "aabb", "babbaababa", "bbabababa", "aaba", "ababbbaba", "baba", "ababbbbba", "abbabbaba", "abaababbab", "abaaababa", "baabaababa", "bbabaabbab", "ababbbabb", "aaab", "abaabbaba", "abaaaabbab", "baababbaba", "bbabbabbab", "abbbababa", "baaaaaaba", "abbbbabaab", "baabbbbbba"... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
a0909e97f4f9666f593a578a221d8e3e | p03414 AtCoder Regular Contest 092 - Two Faced Edges | You are given a directed graph with N vertices and M edges. The vertices are numbered 1, 2, ..., N, and the edges are numbered 1, 2, ..., M. Edge i points from Vertex a_i to Vertex b_i.
For each edge, determine whether the reversion of that edge would change the number of the strongly connected components in the graph... | {"inputs": ["2 2\n1 2\n2 1", "5 9\n3 2\n3 1\n4 1\n4 2\n3 5\n5 3\n3 4\n1 2\n2 5", "3 3\n1 2\n1 3\n2 3", "5 9\n5 2\n3 1\n4 1\n4 2\n3 5\n5 3\n3 4\n1 2\n2 5", "3 2\n1 2\n1 3\n2 3", "6 3\n1 2\n1 3\n2 3", "5 9\n3 2\n3 1\n4 1\n4 2\n3 5\n5 3\n5 4\n1 2\n4 5", "3 2\n1 2\n2 1", "6 3\n1 2\n1 3\n4 3", "5 9\n5 2\n3 1\n4 1\n4 2\n3 5\... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
10ed15b69ce4a81a5133c8f76e6c6695 | p03574 AtCoder Beginner Contest 075 - Minesweeper | You are given an H × W grid.
The squares in the grid are described by H strings, S_1,...,S_H.
The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W).
`.` stands for an empty square, and `#` stands for a square containin... | {"inputs": ["3 5\n.....\n.#.#.\n.....", "3 5", "6 6\n.\n.#.##\n.#\n.#..#.\n.##..\n.#...", "3 7\n.....\n.#.#.\n.....", "6 8\n.\n.#.##\n.#\n.#..#.\n.##..\n.#...", "12 8\n.\n.#.##\n.#\n.#..#.\n.##..\n.#...", "11 6\n.\n.#.##\n.#\n.#..#.\n.##..\n.#...", "2 5\n.....\n.#.#.\n.....", "21 6\n.\n.#.##\n.#\n.#..#.\n.##..\n.#...",... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
a458d27acbfdb46cbb82ed226f7d1274 | p03729 AtCoder Beginner Contest 060 - Shiritori | You are given three strings A, B and C. Check whether they form a word chain.
More formally, determine whether both of the following are true:
* The last character in A and the initial character in B are the same.
* The last character in B and the initial character in C are the same.
If both are true, print `YES`.... | {"inputs": ["a a a", "rng gorilla apple", "aaaaaaaaab aaaaaaaaaa aaaaaaaaab", "yakiniku unagi sushi", "a a `", "baaaa`aaaa aabaaaaaaa aaaaa`aaab", "rnh gorilla apple", "aaaaaaaaab aaaaaaaaaa aaaaa`aaab", "ybkiniku unagi sushi", "a b a", "rng gorilla paple", "aaaaaaaaab aaaaaaaaaa baaa`aaaaa", "ybkiniku inagu sushi", "a... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
49ac4b315c3fa8af56f47c559a58ec08 | p03893 CODE FESTIVAL 2016 Relay (Parallel) - Trichotomy | We have a cord whose length is a positive integer. We will perform the following condition until the length of the cord becomes at most 2:
* Operation: Cut the rope at two positions to obtain three cords, each with a length of a positive integer. Among these, discard one with the longest length and one with the shorte... | {"inputs": ["2", "3", "1", "6", "4", "8", "10", "9", "16", "11", "18", "31", "7", "43", "15", "20", "5", "26", "38", "13", "17", "23", "12", "19", "33", "24", "21", "51", "44", "32", "37", "22", "47", "49", "30", "25", "14", "45", "28", "46", "29", "50", "41", "27", "34", "40", "42", "39", "48", "35", "36", "52", "001"... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
e69a57b446739b3f03effc292130603e | p04052 AtCoder Grand Contest 001 - Wide Swap | You are given a permutation P_1 ... P_N of the set {1, 2, ..., N}.
You can apply the following operation to this permutation, any number of times (possibly zero):
* Choose two indices i,j (1 ≦ i < j ≦ N), such that j - i ≧ K and |P_i - P_j| = 1. Then, swap the values of P_i and P_j.
Among all permutations that can... | {"inputs": ["8 3\n4 5 7 8 3 1 2 6", "5 1\n5 4 3 2 1", "4 2\n4 2 3 1", "4 4\n4 2 3 1", "5 2\n5 4 3 2 1", "4 1\n4 2 3 1", "8 2\n4 5 7 8 3 1 2 6", "4 2\n4 3 2 1", "8 6\n4 5 7 8 3 1 2 6", "8 5\n4 5 7 8 3 1 2 6", "8 1\n4 5 7 8 3 1 2 6", "8 4\n4 5 7 8 3 1 2 6", "4 3\n4 1 3 2", "5 4\n4 5 3 2 1", "4 2\n4 1 3 2", "4 3\n3 2 4 1"... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
225441c32a89b9c224bb7e209f44d048 | p00131 Doctor's Strange Particles | Dr .: Peter. I did.
Peter: See you again? What kind of silly invention is this time?
Dr .: You invented the detector for that phantom elementary particle axion.
Peter: Speaking of Axion, researchers such as the European Organization for Nuclear Research (CERN) are chasing with a bloody eye, aren't they? Is that true... | {"inputs": ["1\n0 1 0 0 0 0 0 0 0 0\n1 1 1 0 0 0 0 0 0 0\n0 1 0 0 0 0 0 0 0 0\n0 0 0 0 1 1 0 0 0 0\n0 0 0 1 0 0 1 0 0 0\n0 0 0 0 1 1 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 1 0\n0 0 0 0 0 0 0 1 1 1\n0 0 0 0 0 0 0 0 1 0", "1\n0 1 0 0 0 0 0 0 0 0\n1 1 1 0 0 0 0 0 0 0\n0 1 0 0 0 0 0 0 0 0\n0 0 0 0 0 1 0 0 0 0\n0 0 0... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
9fa7eee35c843757fe310cc5f4f3eefc | p00264 East Wind | I decided to move and decided to leave this place. There is nothing wrong with this land itself, but there is only one thing to worry about. It's a plum tree planted in the garden. I was looking forward to this plum blooming every year. After leaving here, the fun of spring will be reduced by one. Wouldn't the scent of... | {"inputs": ["6 3\n2 1\n1 2\n5 2\n1 3\n1 5\n-2 3\n1 1 1 90 30 45\n3 -4\n-3 0\n2 -2\n45 6\n90 6\n135 6\n2 1\n1 3\n5 2\n0 1 1 90 30 45\n-3 0\n2 -2\n45 6\n0 0", "6 3\n2 1\n1 2\n5 2\n1 3\n1 5\n-2 3\n1 1 1 90 30 45\n3 -4\n-3 0\n2 -2\n45 11\n90 6\n135 6\n2 1\n1 3\n5 2\n0 1 1 90 30 45\n-3 0\n2 -2\n45 6\n0 0", "6 3\n2 1\n1 2\n5... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
a7e005a28fa5a97a8fbc83c4dc2728d4 | p00451 Common Sub-String | problem
Given two strings, find the longest of the strings contained in both strings and write a program that answers that length.
Here, the string s included in the string t means that s appears consecutively in t. An empty string, that is, a string of length 0, is included in any string. For example, the string ABR... | {"inputs": ["None", "ABRACADABRA\nECADADABRBCRDARA\nUPWJCIRUCAXIIRGL\nSBQNYBSBZDFNEV", "Nnne", "ABRACADAARA\nECADADABRBCRDARA\nUPWJCIRUCAXIIRGL\nSBQNYBSBZDFNEV", "DBRACAAAARA\nECADADBBRBCRDARA\nLCRIIXACURIGJWPU\nSBQNYBSBZDFOEV", "DBRACAAAARA\nECADADBBRBBRDARA\nLCRIIXACURIGJWPU\nSBQNYBSBFDZOEU", "DBRACAAA@RA\nECADADBBRB... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
dca6c68449377611a38816ab7acaac8b | p00642 Ben Toh | As usual, those who called wolves get together on 8 p.m. at the supermarket. The thing they want is only one, a box lunch that is labeled half price. Scrambling for a few discounted box lunch, they fiercely fight every day. And those who are blessed by hunger and appetite the best can acquire the box lunch, while other... | {"inputs": ["1\n2\n3\n0", "1\n2\n4\n0", "1\n4\n4\n0", "1\n4\n7\n0", "1\n4\n12\n0", "1\n4\n22\n0", "1\n2\n6\n0", "1\n2\n2\n0", "1\n4\n11\n0", "1\n4\n20\n0", "1\n0\n6\n0", "1\n1\n4\n0", "1\n6\n11\n0", "1\n4\n38\n0", "1\n1\n6\n0", "1\n4\n67\n0", "1\n4\n74\n0", "1\n2\n0\n0", "1\n4\n17\n0", "1\n1\n2\n0", "1\n5\n11\n0", "1\n... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
2a3f28ae63c35d07d9c0ebfdef6c55d8 | p00786 BUT We Need a Diagram | Consider a data structure called BUT (Binary and/or Unary Tree). A BUT is defined inductively as follows:
* Let l be a letter of the English alphabet, either lowercase or uppercase (n the sequel, we say simply "a letter"). Then, the object that consists only of l, designating l as its label, is a BUT. In this case, it... | {"inputs": ["a(A,b(B,C));\nx( y( y( z(z), v( s, t ) ) ), u ) ;\n\na( b( c,\n d(\n e(f),\n g\n )\n ),\n h( i(\n j(\n k(k,k),\n l(l)\n ),\n m(m)\n )\n )\n );\n\na(B(C),d(e(f(g(h(i(j,k),l),m),n),o),p))\n.", "a(A,b(B,C));\nx( y( y( z(z)... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
2d0ff37dab9bab2f9d04ddde1b6f4ed0 | p00918 Dragon's Cruller | Dragon's Cruller is a sliding puzzle on a torus. The torus surface is partitioned into nine squares as shown in its development in Figure E.1. Here, two squares with one of the sides on the development labeled with the same letter are adjacent to each other, actually sharing the side. Figure E.2 shows which squares are... | {"inputs": ["4 9\n6 3 0\n8 1 2\n4 5 7\n6 3 0\n8 1 2\n4 5 7\n31 31\n4 3 6\n0 1 5\n8 2 7\n0 3 6\n4 1 5\n8 2 7\n92 4\n1 5 3\n4 0 7\n8 2 6\n1 5 0\n4 7 3\n8 2 6\n12 28\n3 4 5\n0 2 6\n7 1 8\n5 7 1\n8 6 2\n0 3 4\n0 0", "6 9\n6 3 0\n8 1 2\n4 5 7\n6 3 0\n8 1 2\n4 5 7\n31 31\n4 3 6\n0 1 5\n8 2 7\n0 3 6\n4 1 5\n8 2 7\n92 4\n1 5 3... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
d7641b95f66fe4f1b234f02e71e4d760 | p01051 Squid Ink | Problem
In recent years, turf wars have frequently occurred among squids. It is a recent squid fighting style that multiple squids form a team and fight with their own squid ink as a weapon.
There is still a turf war, and the battlefield is represented by an R × C grid. The squid Gesota, who is participating in the t... | {"inputs": ["4 5\nS#...\n.#.#.\n.#.#.\n...#G", "5 5\nSxxxx\nxxxxx\nxxxxx\nxxxxx\nxxxxG", "4 5\nS#ooo\no#o#o\no#o#o\nooo#G", "5 5\nS....\n.....\n.....\n.....\n....G", "4 5\nG####\nooxoo\nx#o\nSoooo", "4 5\nS#...\n.#.$.\n.#.#.\n...#G", "5 5\n.S...\n.....\n.....\n.....\n....G", "4 5\nG####\nonxoo\nx#o\nSoooo", "4 5\nS#...... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
9a3531832c70dcb600ad1c218294177e | p01183 Tetrahedra | Peter P. Pepper is facing a difficulty.
After fierce battles with the Principality of Croode, the Aaronbarc Kingdom, for which he serves, had the last laugh in the end. Peter had done great service in the war, and the king decided to give him a big reward. But alas, the mean king gave him a hard question to try his in... | {"inputs": ["7 1 2 2 2 2 2 2\n0", "7 1 2 2 2 2 2 4\n0", "7 1 2 2 1 2 2 0\n0", "7 1 2 3 2 2 2 2\n0", "7 1 2 2 1 2 1 0\n0", "7 1 2 3 2 3 2 2\n0", "7 1 2 3 2 3 4 2\n0", "7 1 2 3 4 3 4 2\n0", "7 1 3 3 4 3 4 2\n0", "7 1 3 0 4 3 4 2\n0", "7 1 3 0 4 3 4 4\n0", "7 1 3 2 2 2 2 0\n0", "7 1 2 3 2 3 2 1\n0", "7 1 2 3 4 3 0 2\n0", ... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
56323b2b4cc94fe4958f961b1ed75330 | p01320 Magical Island 2 | It was an era when magic still existed as a matter of course. A clan of magicians lived on a square-shaped island created by magic.
At one point, a crisis came to this island. The empire has developed an intercontinental ballistic missile and aimed it at this island. The magic of this world can be classified into eart... | {"inputs": ["4 4 1\n1 0\n0 1\n-1 0\n0 -1\n5 6 2\n1 1\n4 4\n2 -4\n-4 2\n1 5\n0 0 0", "4 4 1\n1 0\n0 1\n-1 0\n0 -1\n5 6 2\n1 1\n4 8\n2 -4\n-4 2\n1 5\n0 0 0", "4 4 1\n0 0\n0 1\n-1 -1\n0 -1\n5 6 2\n1 1\n4 8\n2 -4\n-4 2\n1 5\n0 -1 0", "4 4 1\n0 0\n0 1\n-1 -1\n-1 -1\n5 6 2\n1 1\n4 8\n2 -4\n-4 0\n1 5\n0 -1 0", "4 4 1\n1 0\n0 ... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
ca4ad584fa9f7de5335bb98a944b1a70 | p01650 Stack Maze | Problem Statement
There is a maze which can be described as a W \times H grid. The upper-left cell is denoted as (1, 1), and the lower-right cell is (W, H). You are now at the cell (1, 1) and have to go to the cell (W, H). However, you can only move to the right adjacent cell or to the lower adjacent cell. The followi... | {"inputs": ["3 3\nac#\nb#C\n.BA\n3 3\naaZ\na#Z\naZZ\n3 3\n..#\n.#.\n#..\n1 50\nabcdefghijklmnopqrstuvwxyYXWVUTSRQPONMLKJIHGFEDCBA\n1 50\naAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyY\n1 50\nabcdefghijklmnopqrstuvwxyABCDEFGHIJKLMNOPQRSTUVWXY\n1 50\naaaaaaaaaabbbbbbbbbbcccccCCCCCBBBBBBBBBBAAAAAAAAAA\n10 10\n...#....... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
ec11f915ab6983deb64b188e56ef0d77 | p01935 Protect from the enemy attack | problem
There are $ V $ islands, numbered $ 0, 1, ..., V-1 $, respectively. There are $ E $ bridges, numbered $ 0, 1, ..., E-1 $, respectively. The $ i $ th bridge spans island $ s_i $ and island $ t_i $ and is $ c_i $ wide.
The AOR Ika-chan Corps (commonly known as the Squid Corps), which has a base on the island $ ... | {"inputs": ["4 4\n0 1 3\n0 2 4\n1 3 1\n2 3 5", "4 4\n0 1 3\n0 2 4\n1 3 1\n0 3 5", "4 8\n0 1 6\n0 2 4\n1 3 1\n0 3 5", "4 4\n0 1 3\n0 2 0\n1 3 1\n2 3 5", "2 15\n0 1 0\n0 1 4\n2 3 0\n0 3 9", "5 8\n0 1 6\n0 0 4\n2 3 4\n1 4 5", "2 15\n0 1 0\n0 1 4\n2 3 0\n0 1 9", "2 15\n0 1 0\n0 2 4\n2 1 0\n0 1 9", "4 9\n0 2 6\n1 2 4\n1 3 2... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
50d2338eca0b148403dee8697ed34d0c | p02074 N-by-M grid calculation | Problem Statement
Have you experienced $10$-by-$10$ grid calculation? It's a mathematical exercise common in Japan. In this problem, we consider the generalization of the exercise, $N$-by-$M$ grid calculation.
In this exercise, you are given an $N$-by-$M$ grid (i.e. a grid with $N$ rows and $M$ columns) with an addit... | {"inputs": [""], "outputs": [""]} | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
1d216ed4c9f2d76bef6fea522baeb03b | p02216 Array Game | Problem statement
There is a positive integer sequence $ a_1, a_2, \ ldots, a_N $ of length $ N $.
Consider the following game, which uses this sequence and is played by $ 2 $ players on the play and the play.
* Alternately select one of the following operations for the first move and the second move.
* Select a pos... | {"inputs": ["2\n1 2", "2\n0 2", "2\n-1 4", "2\n0 4", "2\n0 1", "2\n1 0", "2\n0 7", "2\n-1 2", "2\n2 0", "2\n-1 10", "2\n-2 2", "2\n2 -1", "2\n-2 4", "2\n4 -1", "2\n-2 8", "2\n4 0", "2\n-2 5", "2\n5 0", "2\n1 1", "2\n2 2", "2\n2 4", "2\n4 4", "2\n0 0", "2\n1 4", "2\n0 3", "2\n0 -2", "2\n2 1", "2\n2 8", "2\n0 8", "2\n0 1... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
b859e8add0c7e93cac13b78d139f55be | p02369 Cycle Detection for a Directed Graph | Find a cycle in a directed graph G(V, E).
Constraints
* 1 ≤ |V| ≤ 100
* 0 ≤ |E| ≤ 1,000
* si ≠ ti
Input
A directed graph G is given in the following format:
|V| |E|
s0 t0
s1 t1
:
s|E|-1 t|E|-1
|V| is the number of nodes and |E| is the number of edges in the graph. The graph nodes are named with the numbers 0, 1... | {"inputs": ["3 3\n0 1\n0 2\n1 2", "3 3\n0 1\n1 2\n2 0", "5 3\n0 1\n0 2\n1 2", "8 3\n0 1\n0 2\n1 2", "8 3\n0 2\n0 2\n1 2", "5 3\n0 2\n0 2\n1 2", "11 3\n0 1\n0 2\n1 2", "8 2\n0 1\n0 2\n1 2", "8 3\n1 2\n0 2\n1 2", "8 2\n0 1\n0 2\n1 4", "8 2\n0 1\n0 2\n2 4", "8 2\n0 2\n0 2\n2 4", "8 1\n0 2\n0 2\n2 4", "8 1\n0 4\n0 2\n2 4",... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
219cba678cedbeb32be8ca12cf85c2bd | aba15f | Problem description.
“Murphy’s Law doesn’t meant that something bad will happen. It means that whatever can happen, will happen.”
—Cooper
While traveling across space-time,the data sent by NASA to "The Endurance" spaceship is sent in the format of,
For... | {"inputs": ["5\n100\n23\n4\n1000\n5"], "outputs": ["68\n21\n4\n320\n5"]} | 6 | [
"PYTHON3"
] | 1 | 2 | code_contests |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.