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 |
|---|---|---|---|---|---|---|---|---|---|
2109c20ab479b87629598ec5f19ec7bd | colarr | Chef had a hard time arguing with his friend, and after getting a great old kick Chef saw a colored array with N cells, numbered from 1 to N.
The kick was so strong that Chef suddenly understood the rules of the game.
Each cell is painted with a color. Here the colors are numbered from 1 to M.
For any cell i, Chef c... | {"inputs": ["1\n4 2 1\n1 1 2 2\n1 1\n1 1\n1 1\n3 1\n0 1\n0 1\n1 0\n1 0"], "outputs": ["5"]} | 2 | [
"PYTHON3"
] | 1 | 2 | code_contests | |
64d5f3359402ce9b8a38f6f91782e329 | gameaam | Two players are playing a game. The game is played on a sequence of positive integer pairs. The players make their moves alternatively. During his move the player chooses a pair and decreases the larger integer in the pair by a positive multiple of the smaller integer in the pair in such a way that both integers in the... | {"inputs": ["3\n1\n2 3\n2\n4 5\n5 6\n2\n2 3\n3 5", "3\n1\n2 3\n2\n4 5\n5 6\n2\n2 3\n1 5", "3\n1\n2 3\n2\n4 5\n5 6\n1\n2 3\n3 5", "3\n1\n1 3\n2\n6 5\n5 6\n1\n2 6\n5 5", "3\n1\n2 3\n2\n4 5\n5 3\n1\n2 3\n3 5", "3\n1\n2 3\n2\n6 2\n5 6\n1\n2 6\n3 5", "3\n1\n2 1\n2\n6 5\n5 6\n1\n2 3\n1 5", "3\n1\n2 4\n2\n10 5\n5 6\n1\n2 6\n5... | 2 | [
"PYTHON3"
] | 1 | 2 | code_contests | |
6479b1ad352107435998f1cb59b0c38b | lucky5 | Chef 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.
Chef has a positive integer N. He can apply any of the following operations as many times as he want... | {"inputs": ["3\n25\n46\n99", "3\n2\n46\n99", "3\n0\n7\n61", "3\n25\n46\n24", "3\n2\n60\n99", "3\n0\n8\n24", "3\n25\n46\n35", "3\n0\n5\n153", "3\n0\n12\n5", "3\n61\n4\n32", "3\n4\n1\n132", "3\n0\n13\n131", "3\n3\n4\n70", "3\n15\n15\n34", "3\n15\n15\n19", "3\n32\n5\n7", "3\n4\n5\n0", "3\n25\n46\n102", "3\n2\n60\n47", "3\... | 2 | [
"PYTHON3"
] | 1 | 2 | code_contests | |
9862eeec5a0e8fb9aaf3f0ca64d49fc3 | proposal | In PrimeLand, there existed a very handsome young prince named Prima. He greatly desired the Princess of Mathematics – Facie. However, before accepting his hand in marriage, Facie asked Prima to solve the following problem:
The figure below shows a simple multiplication problem. However, not all the decimal digits ar... | {"inputs": ["5\n2 3 4 6 8", "5\n2 3 0 6 8", "5\n2 3 4 6 5", "5\n2 3 4 6 7", "5\n2 3 0 6 7", "5\n2 -1 8 6 4", "5\n6 0 8 5 2", "5\n6 0 4 5 2", "5\n3 1 9 6 15", "5\n3 1 9 4 15", "5\n3 5 9 1 2", "5\n3 5 4 1 2", "5\n3 9 4 1 2", "5\n5 18 4 1 2", "5\n5 8 4 1 2", "5\n5 8 4 0 2", "5\n1 3 4 6 7", "5\n6 0 8 4 2", "5\n4 0 4 5 2", ... | 3 | [
"PYTHON3"
] | 1 | 2 | code_contests | |
d49d7aa678ad85640d0422496cf2de20 | tech07 | You are given a square with 'n' points on each side of the square. None of these points co-incide with the corners of this square. You have to compute the total number of triangles that can be formed using these '4n' points (n points on each side of the square) as vertices of the triangle.
Input
First line contains ... | {"inputs": ["1\n1", "1\n2", "1\n0", "1\n-1", "1\n-2", "1\n-4", "1\n-5", "1\n-8", "1\n-11", "1\n3", "1\n4", "1\n6", "1\n10", "1\n-3", "1\n-7", "1\n11", "1\n17", "1\n30", "1\n7", "1\n9", "1\n16", "1\n31", "1\n58", "1\n60", "1\n56", "1\n110", "1\n111", "1\n010", "1\n001", "1\n100", "1\n101", "1\n-6", "1\n-9", "1\n29", "1\... | 6 | [
"PYTHON3"
] | 1 | 2 | code_contests | |
6e04bf61ff9c511e939c0f739698b7c6 | 1012_B. Chemical table | Innopolis University scientists continue to investigate the periodic table. There are n·m known elements and they form a periodic table: a rectangle with n rows and m columns. Each element can be described by its coordinates (r, c) (1 ≤ r ≤ n, 1 ≤ c ≤ m) in the table.
Recently scientists discovered that for every four... | {"inputs": ["1 5 3\n1 3\n1 1\n1 5\n", "2 2 3\n1 2\n2 2\n2 1\n", "4 3 6\n1 2\n1 3\n2 2\n2 3\n3 1\n3 3\n", "20 20 20\n18 16\n4 20\n2 5\n7 4\n11 13\n6 10\n20 8\n14 6\n3 12\n5 1\n16 7\n10 9\n1 11\n12 18\n19 15\n13 19\n17 3\n9 17\n15 2\n8 14\n", "20 20 1\n17 13\n", "1 1 0\n", "10000 9999 1\n5717 9264\n", "20 10 5\n18 10\n19... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
92b3f4c424fd03461bcbca3f6840e91b | 1037_B. Reach Median | You are given an array a of n integers and an integer s. It is guaranteed that n is odd.
In one operation you can either increase or decrease any single element by one. Calculate the minimum number of operations required to make the median of the array being equal to s.
The median of the array with odd length is the ... | {"inputs": ["3 8\n6 5 8\n", "7 20\n21 15 12 11 20 19 12\n", "3 1\n1 2 5\n", "1 1\n100000\n", "5 1\n2 2 4 6 1\n", "3 10\n5 5 10\n", "1 1\n1\n", "3 4\n1 2 5\n", "1 100\n88\n", "1 100\n105\n", "3 2\n1 2 5\n", "3 10\n5 3 10\n", "3 4\n0 2 5\n", "1 100\n5\n", "7 20\n2 15 12 11 20 19 12\n", "3 0\n1 2 5\n", "3 4\n5 3 10\n", "1... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
9e840c792d748f70d4cb0e392de79281 | 105_C. Item World | Each item in the game has a level. The higher the level is, the higher basic parameters the item has. We shall consider only the following basic parameters: attack (atk), defense (def) and resistance to different types of impact (res).
Each item belongs to one class. In this problem we will only consider three of such... | {"inputs": ["4\nsword weapon 10 2 3 2\npagstarmor armor 0 15 3 1\niceorb orb 3 2 13 2\nlongbow weapon 9 1 2 1\n6\nmike gladiator 5 longbow\nbobby sentry 6 pagstarmor\npetr gladiator 7 iceorb\nteddy physician 6 sword\nblackjack sentry 8 sword\njoe physician 6 iceorb\n", "4\nsword weapon 10 2 3 2\npagstarmor armor 0 15 3... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
cf9133b37b2b4677bafdf4f6767df34c | 1081_D. Maximum Distance | Chouti was tired of the tedious homework, so he opened up an old programming problem he created years ago.
You are given a connected undirected graph with n vertices and m weighted edges. There are k special vertices: x_1, x_2, …, x_k.
Let's define the cost of the path as the maximum weight of the edges in it. And th... | {"inputs": ["4 5 3\n1 2 3\n1 2 5\n4 2 1\n2 3 2\n1 4 4\n1 3 3\n", "2 3 2\n2 1\n1 2 3\n1 2 2\n2 2 1\n", "4 4 3\n1 2 3\n1 2 1\n2 3 2\n1 3 3\n1 4 4\n", "4 3 2\n1 4\n1 2 1\n2 3 5\n3 4 1\n", "3 2 2\n1 2\n1 2 1\n2 3 47\n", "3 2 2\n1 2\n1 2 1\n2 3 1000\n", "3 2 2\n1 2\n1 2 10\n2 3 100\n", "3 3 2\n2 3\n1 2 100\n1 3 100\n2 3 1\n... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
f9e9b2c676340dd312270e7d27b54799 | 1100_D. Dasha and Chess | This is an interactive task.
Dasha and NN like playing chess. While playing a match they decided that normal chess isn't interesting enough for them, so they invented a game described below.
There are 666 black rooks and 1 white king on the chess board of size 999 × 999. The white king wins if he gets checked by rook... | {"inputs": ["999 999\n1 1\n1 2\n2 1\n2 2\n1 3\n2 3\n<...>\n26 13\n26 14\n26 15\n26 16\n\n1 700 800\n\n2 1 2\n\n<...>\n\n-1 -1 -1\n", "999 999\n1 1\n1 2\n2 1\n2 2\n1 3\n2 0\n<...>\n26 13\n26 14\n26 15\n26 16\n\n1 700 800\n\n2 1 2\n\n<...>\n\n-1 -1 -1\n", "999 999\n1 1\n1 2\n2 1\n2 2\n1 3\n2 0\n&l... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
5ea70c1e2292a4a5d8c1b2f558b64a71 | 1129_A2. Toy Train | Alice received a set of Toy Train™ from Bob. It consists of one train and a connected railway network of n stations, enumerated from 1 through n. The train occupies one station at a time and travels around the network of stations in a circular manner. More precisely, the immediate station that the train will visit afte... | {"inputs": ["2 3\n1 2\n1 2\n1 2\n", "5 7\n2 4\n5 1\n2 3\n3 4\n4 1\n5 3\n3 5\n", "5 1\n3 2\n", "3 3\n1 2\n1 2\n1 2\n", "5 3\n2 4\n5 4\n3 2\n", "20 5\n3 12\n5 20\n16 4\n13 3\n9 14\n", "3 2\n3 1\n1 3\n", "3 1\n3 1\n", "3 2\n1 3\n2 1\n", "50 20\n4 18\n39 33\n49 32\n7 32\n38 1\n46 11\n8 1\n3 31\n30 47\n24 16\n33 5\n5 21\n3 ... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
44679b0bab57567962fdf343771754d9 | 1149_B. Three Religions | During the archaeological research in the Middle East you found the traces of three ancient religions: First religion, Second religion and Third religion. You compiled the information on the evolution of each of these beliefs, and you now wonder if the followers of each religion could coexist in peace.
The Word of Uni... | {"inputs": ["6 8\nabdabc\n+ 1 a\n+ 1 d\n+ 2 b\n+ 2 c\n+ 3 a\n+ 3 b\n+ 1 c\n- 2\n", "6 8\nabbaab\n+ 1 a\n+ 2 a\n+ 3 a\n+ 1 b\n+ 2 b\n+ 3 b\n- 1\n+ 2 z\n", "1 1\nt\n+ 2 p\n", "2 12\naa\n+ 1 a\n+ 2 a\n+ 3 a\n- 1\n+ 1 a\n- 2\n+ 2 a\n- 3\n+ 3 a\n+ 2 a\n- 1\n- 3\n", "2 10\nuh\n+ 1 h\n+ 2 u\n+ 3 h\n- 1\n- 2\n+ 2 h\n+ 3 u\n- 2... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
287199e83d57fe3e156d16d69d0643cd | 1189_A. Keanu Reeves | After playing Neo in the legendary "Matrix" trilogy, Keanu Reeves started doubting himself: maybe we really live in virtual reality? To find if this is true, he needs to solve the following problem.
Let's call a string consisting of only zeroes and ones good if it contains different numbers of zeroes and ones. For exa... | {"inputs": ["1\n1\n", "6\n100011\n", "2\n10\n", "72\n111101100111001110000000100010100000011011100110001010111010101011111100\n", "3\n101\n", "18\n101111001111000110\n", "7\n1111000\n", "3\n010\n", "12\n101010100101\n", "1\n0\n", "4\n1010\n", "6\n101100\n", "100\n00101100000011111101111010111001111010001100110111001000... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
68c1fe4ee739f97a3f5af45ad0f813b7 | 1208_A. XORinacci | Cengiz recently learned Fibonacci numbers and now he is studying different algorithms to find them. After getting bored of reading them, he came with his own new type of numbers that he named XORinacci numbers. He defined them as follows:
* f(0) = a;
* f(1) = b;
* f(n) = f(n-1) ⊕ f(n-2) when n > 1, where ⊕ de... | {"inputs": ["3\n3 4 2\n4 5 0\n325 265 1231232\n", "10\n669924290 408119795 804030560\n663737793 250734602 29671646\n431160679 146708815 289491233\n189259304 606497663 379372476\n707829111 49504411 81710658\n54555019 65618101 626948607\n578351356 288589794 974275296\n400531973 205638174 323247740\n219131617 178762989 79... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
210dd88e3ed817c14bd95e3a2ee401f2 | 1227_A. Math Problem | Your math teacher gave you the following problem:
There are n segments on the x-axis, [l_1; r_1], [l_2; r_2], …, [l_n; r_n]. The segment [l; r] includes the bounds, i.e. it is a set of such x that l ≤ x ≤ r. The length of the segment [l; r] is equal to r - l.
Two segments [a; b] and [c; d] have a common point (inters... | {"inputs": ["4\n3\n4 5\n5 9\n7 7\n5\n11 19\n4 17\n16 16\n3 12\n14 17\n1\n1 10\n1\n1 1\n", "1\n2\n999999997 999999998\n999999999 1000000000\n", "4\n1\n1 1000000000\n5\n1 1\n12 18\n1000000000 1000000000\n1 1\n8888888 88888888\n5\n2 5\n3 6\n4 7\n5 8\n6 9\n3\n1 1000000000\n1 1\n1000000000 1000000000\n", "1\n10\n132182352 6... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
603412173f6b527803fbcfd227d41e92 | 124_D. Squares | You are given an infinite checkered field. You should get from a square (x1; y1) to a square (x2; y2). Using the shortest path is not necessary. You can move on the field squares in four directions. That is, when you are positioned in any square, you can move to any other side-neighboring one.
A square (x; y) is cons... | {"inputs": ["2 2 1 0 0 1\n", "2 2 10 11 0 1\n", "2 4 3 -1 3 7\n", "605 297 -251700323 -366763764 -445828791 325081312\n", "14 9 44 45 -50 -9\n", "18 17 -26078453 -12853708 26705417 -4593122\n", "472555248 417950652 -897989583 -805741694 915661619 800897620\n", "1005 557 -451917708 -32771965 501646713 -357583032\n", "46... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
d4cc050eccac9f6962a49fda87daa472 | 1269_B. Modulo Equality | You are given a positive integer m and two integer sequence: a=[a_1, a_2, …, a_n] and b=[b_1, b_2, …, b_n]. Both of these sequence have a length n.
Permutation is a sequence of n different positive integers from 1 to n. For example, these sequences are permutations: [1], [1,2], [2,1], [6,7,3,4,1,2,5]. These are not: [... | {"inputs": ["3 2\n0 0 0\n1 1 1\n", "4 3\n0 0 2 1\n2 0 1 1\n", "5 10\n0 0 0 1 2\n2 1 0 0 0\n", "20 10000000\n8861863 2169292 3484361 511558 5975675 1413584 774309 5847326 6668965 2531461 3337531 9484932 2648359 3710600 2232337 5474539 2785576 4119997 5005708 1717831\n247095 4003803 2013625 1177623 7391127 1314840 519822... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
1e78c42ca94878513446e0e6add981eb | 1291_B. Array Sharpening | You're given an array a_1, …, a_n of n non-negative integers.
Let's call it sharpened if and only if there exists an integer 1 ≤ k ≤ n such that a_1 < a_2 < … < a_k and a_k > a_{k+1} > … > a_n. In particular, any strictly increasing or strictly decreasing array is sharpened. For example:
* The arrays [4], [0, 1], [... | {"inputs": ["10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 7 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1\n", "10\n1\n248618\n3\n12 10 8\n6\n100 11 15 9 2 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 1\n3\n0 1 0\n3\n1 0 1\n", "10\n1\n451008\n3\n12 10 8\n6\n000 11 15 9 2 8\n4\n0 1 1 0\n2\n0 0\n2\n0 1\n2\... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
007e27c0910133943194e3f9fc5f406c | 1311_C. Perform the Combo | You want to perform the combo on your opponent in one popular fighting game. The combo is the string s consisting of n lowercase Latin letters. To perform the combo, you have to press all buttons in the order they appear in s. I.e. if s="abca" then you have to press 'a', then 'b', 'c' and 'a' again.
You know that you ... | {"inputs": ["3\n4 2\nabca\n1 3\n10 5\ncodeforces\n2 8 3 2 9\n26 10\nqwertyuioplkjhgfdsazxcvbnm\n20 10 1 2 3 5 10 5 9 4\n", "2\n2 2\nyz\n1 1\n2 2\nyz\n1 1\n", "1\n11 2\nthisisatest\n3 5\n", "2\n2 2\nyz\n1 1\n2 2\nzy\n1 1\n", "1\n11 2\nthisisatest\n3 7\n", "3\n4 2\nabca\n1 3\n10 5\ncodeforces\n2 8 3 2 9\n26 10\nqwertyuio... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
76933d20895b6172354d8212183e555f | 1334_A. Level Statistics | Polycarp has recently created a new level in this cool new game Berlio Maker 85 and uploaded it online. Now players from all over the world can try his level.
All levels in this game have two stats to them: the number of plays and the number of clears. So when a player attempts the level, the number of plays increases... | {"inputs": ["6\n3\n0 0\n1 1\n1 2\n2\n1 0\n1000 3\n4\n10 1\n15 2\n10 2\n15 2\n1\n765 432\n2\n4 4\n4 3\n5\n0 0\n1 0\n1 0\n1 0\n1 0\n", "1\n2\n110 2\n115 112\n", "10\n5\n88 60\n10 3\n48 21\n90 70\n40 88\n5\n20 81\n39 98\n34 87\n100 82\n21 21\n2\n46 91\n89 71\n2\n81 98\n25 36\n3\n84 97\n40 32\n17 29\n2\n56 16\n96 75\n5\n35... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
6006f93aa6ed79169c73fd5c372a83ed | 1354_C2. Not So Simple Polygon Embedding | The statement of this problem is the same as the statement of problem C1. The only difference is that, in problem C1, n is always even, and in C2, n is always odd.
You are given a regular polygon with 2 ⋅ n vertices (it's convex and has equal sides and equal angles) and all its sides have length 1. Let's name it as 2n... | {"inputs": ["3\n3\n5\n199\n", "99\n3\n5\n7\n9\n11\n13\n15\n17\n19\n21\n23\n25\n27\n29\n31\n33\n35\n37\n39\n41\n43\n45\n47\n49\n51\n53\n55\n57\n59\n61\n63\n65\n67\n69\n71\n73\n75\n77\n79\n81\n83\n85\n87\n89\n91\n93\n95\n97\n99\n101\n103\n105\n107\n109\n111\n113\n115\n117\n119\n121\n123\n125\n127\n129\n131\n133\n135\n137... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
b26c0cc60d6f8a9a2f446a35f33225b1 | 1374_B. Multiply by 2, divide by 6 | You are given an integer n. In one move, you can either multiply n by two or divide n by 6 (if it is divisible by 6 without the remainder).
Your task is to find the minimum number of moves needed to obtain 1 from n or determine if it's impossible to do that.
You have to answer t independent test cases.
Input
The fi... | {"inputs": ["7\n1\n2\n3\n12\n12345\n15116544\n387420489\n", "1\n999838675\n", "1\n782058266\n", "7\n1\n2\n4\n12\n12345\n15116544\n387420489\n", "7\n1\n2\n4\n24\n12345\n2324038\n387420489\n", "7\n1\n2\n4\n24\n12345\n2324038\n655615894\n", "7\n1\n2\n3\n12\n22908\n15116544\n387420489\n", "7\n1\n2\n4\n24\n12345\n15116544\n... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
a32922519c8cbc6ed2909734fd0ca375 | 1397_C. Multiples of Length | You are given an array a of n integers.
You want to make all elements of a equal to zero by doing the following operation exactly three times:
* Select a segment, for each number in this segment we can add a multiple of len to it, where len is the length of this segment (added integers can be different).
It can... | {"inputs": ["4\n1 3 2 4\n", "2\n-492673762 -496405053\n", "13\n-958184557 -577042357 -616514099 -553646903 -719490759 -761325526 -210773060 -44979753 864458686 -387054074 546903944 638449520 299190036\n", "5\n450402558 -840167367 -231820501 586187125 -627664644\n", "32\n474784688 671671886 -592758087 -662585781 9970031... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
ef3486d9a1c25de40121fd94fb0216d0 | 1420_D. Rescue Nibel! | Ori and Sein have overcome many difficult challenges. They finally lit the Shrouded Lantern and found Gumon Seal, the key to the Forlorn Ruins. When they tried to open the door to the ruins... nothing happened.
Ori was very surprised, but Sein gave the explanation quickly: clever Gumon decided to make an additional de... | {"inputs": ["3 3\n1 3\n2 3\n3 3\n", "3 1\n1 1\n2 2\n3 3\n", "7 3\n1 7\n3 8\n4 5\n6 7\n1 3\n5 10\n8 9\n", "3 2\n1 1\n2 2\n3 3\n", "5 2\n1 3\n2 4\n3 5\n4 6\n5 7\n", "10 7\n1 10\n2 10\n3 10\n4 10\n5 10\n1 2\n1 3\n1 4\n1 5\n1 6\n", "2 2\n1 1\n1 1\n", "20 12\n18525 35038\n15816 31586\n18641 46864\n35863 38632\n13563 35915\n... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
a65cb6d760c1f7fd325e2185f80d6ce3 | 1439_C. Greedy Shopping | You are given an array a_1, a_2, …, a_n of integers. This array is non-increasing.
Let's consider a line with n shops. The shops are numbered with integers from 1 to n from left to right. The cost of a meal in the i-th shop is equal to a_i.
You should process q queries of two types:
* 1 x y: for each shop 1 ≤ i ≤ ... | {"inputs": ["10 6\n10 10 10 6 6 5 5 5 3 1\n2 3 50\n2 4 10\n1 3 10\n2 2 36\n1 4 7\n2 2 17\n", "1 1\n5\n2 1 6\n", "1 1\n5\n2 1 7\n", "10 6\n10 10 10 6 6 5 5 5 3 1\n2 3 50\n2 4 10\n1 3 10\n2 2 36\n1 4 7\n2 2 25\n", "10 6\n19 10 10 6 6 5 5 5 3 1\n2 3 50\n2 4 10\n1 3 10\n2 2 36\n1 4 7\n2 2 17\n", "10 6\n10 10 10 6 6 5 5 5 3... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
14324ead1cc6ea87ea82fa30fdba1e63 | 1466_C. Canine poetry | After his wife's tragic death, Eurydice, Orpheus descended to the realm of death to see her. Reaching its gates was uneasy, but passing through them proved to be even more challenging. Mostly because of Cerberus, the three-headed hound of Hades.
Orpheus, a famous poet, and musician plans to calm Cerberus with his poe... | {"inputs": ["7\nbabba\nabaac\ncodeforces\nzeroorez\nabcdcba\nbbbbbbb\na\n", "7\nabbab\nabaac\ncodeforces\nzeroorez\nabcdcba\nbbbbbbb\na\n", "7\nabbab\nabaac\ncodeforces\nzeroorez\nabadcbc\nbbbbbbb\na\n", "7\nabbab\nabaac\ncodeforces\nzeroorez\nabadcbc\nbbbbabb\na\n", "7\nbbbaa\nabaac\ncodeforces\nyeroorez\nabadcbc\nbba... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
40e1c92382576ff188c7fc819067c5cd | 1490_D. Permutation Transformation | A permutation — is a sequence of length n integers from 1 to n, in which all the numbers occur exactly once. For example, [1], [3, 5, 2, 1, 4], [1, 3, 2] — permutations, and [2, 3, 2], [4, 3, 1], [0] — no.
Polycarp was recently gifted a permutation a[1 ... n] of length n. Polycarp likes trees more than permutations, s... | {"inputs": ["3\n5\n3 5 2 1 4\n1\n1\n4\n4 3 1 2\n", "3\n5\n3 5 1 2 4\n1\n1\n4\n4 3 1 2\n", "3\n5\n4 5 2 1 3\n1\n1\n4\n4 3 1 2\n", "3\n5\n3 4 2 1 5\n1\n1\n4\n4 3 1 2\n", "3\n5\n2 5 3 1 4\n1\n1\n4\n4 3 1 2\n", "3\n5\n4 5 1 2 3\n1\n1\n4\n4 3 1 2\n"], "outputs": ["\n1 0 2 3 1 \n0 \n0 1 3 2 \n", "1 0 3 2 1\n0\n0 1 3 2\n", "1... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
e463a7f475a50946c4c2f15b44ed1cd3 | 1512_G. Short Task | Let us denote by d(n) the sum of all divisors of the number n, i.e. d(n) = ∑_{k | n} k.
For example, d(1) = 1, d(4) = 1+2+4=7, d(6) = 1+2+3+6=12.
For a given number c, find the minimum n such that d(n) = c.
Input
The first line contains one integer t (1 ≤ t ≤ 10^4). Then t test cases follow.
Each test case is char... | {"inputs": ["12\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n39\n691\n", "12\n1\n2\n3\n6\n5\n6\n7\n8\n9\n10\n39\n691\n", "12\n1\n2\n3\n6\n5\n6\n7\n8\n9\n6\n39\n691\n", "12\n1\n2\n3\n6\n5\n6\n6\n8\n9\n6\n39\n691\n", "12\n1\n2\n3\n4\n5\n6\n6\n8\n9\n6\n39\n691\n", "12\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n33\n691\n", "12\n1\n2\n3\n12\n5\n6\... | 13 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
b44fd892bfb9d6343c85ee3f465fbc21 | 167_C. Wizards and Numbers | In some country live wizards. They love playing with numbers.
The blackboard has two numbers written on it — a and b. The order of the numbers is not important. Let's consider a ≤ b for the sake of definiteness. The players can cast one of the two spells in turns:
* Replace b with b - ak. Number k can be chosen by... | {"inputs": ["4\n10 21\n31 10\n0 1\n10 30\n", "7\n576460752303423487 2\n82 9\n101 104\n10 21\n31 10\n0 1\n10 30\n", "1\n128817972817282999 327672410994637530\n", "66\n7 0\n5 7\n1 3\n3 2\n3 5\n0 6\n1 2\n0 7\n4 5\n4 7\n5 1\n2 0\n4 0\n0 5\n3 6\n7 3\n6 0\n5 2\n6 6\n1 7\n5 6\n2 2\n3 4\n2 1\n5 3\n4 6\n6 2\n3 3\n100000000000 1... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
741321be3b53b15cb302e7b8bd08716d | 209_B. Pixels | Flatland is inhabited by pixels of three colors: red, green and blue. We know that if two pixels of different colors meet in a violent fight, only one of them survives the fight (that is, the total number of pixels decreases by one). Besides, if pixels of colors x and y (x ≠ y) meet in a violent fight, then the pixel t... | {"inputs": ["1 1 1\n", "3 1 0\n", "9 530792195 6\n", "0 0 10\n", "1944219055 454183506 1369298327\n", "914835 2742837 9234739\n", "10 10 0\n", "2 2 0\n", "0 0 1\n", "3 10 1007169359\n", "0 1 0\n", "1016450951 2 9\n", "0 2 10\n", "2147483648 0 2147483647\n", "92134834 23742837 92374738\n", "1 4 3\n", "382601556 88132964... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
7344efd8437e5c022937b07f065f8578 | 235_A. LCM Challenge | Some days ago, I learned the concept of LCM (least common multiple). I've played with it for several times and I want to make a big number with it.
But I also don't want to use many numbers, so I'll choose three positive integers (they don't have to be distinct) which are not greater than n. Can you help me to find th... | {"inputs": ["7\n", "9\n", "447244\n", "958507\n", "816923\n", "836603\n", "862795\n", "756604\n", "1000000\n", "4\n", "668827\n", "245\n", "520731\n", "642635\n", "8\n", "244\n", "148\n", "213\n", "984699\n", "20\n", "810411\n", "796\n", "924\n", "341\n", "41\n", "33\n", "604\n", "117\n", "978187\n", "5\n", "546924\n",... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
befe8f917122c702725e835bad6dd55e | 25_D. Roads not only in Berland | Berland Government decided to improve relations with neighboring countries. First of all, it was decided to build new roads so that from each city of Berland and neighboring countries it became possible to reach all the others. There are n cities in Berland and neighboring countries in total and exactly n - 1 two-way r... | {"inputs": ["7\n1 2\n2 3\n3 1\n4 5\n5 6\n6 7\n", "2\n1 2\n", "4\n1 4\n3 1\n3 4\n", "5\n4 1\n4 3\n5 3\n2 4\n", "21\n7 15\n13 1\n14 3\n4 10\n2 3\n16 18\n17 20\n16 20\n8 4\n3 12\n2 17\n13 11\n16 1\n13 2\n13 5\n8 9\n6 14\n3 17\n16 9\n13 8\n", "3\n3 1\n3 2\n", "6\n5 2\n5 3\n1 4\n3 1\n5 6\n", "60\n17 34\n46 22\n50 44\n46 33\... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
d8743725a4de8a5fcc01332bc97b4635 | 283_D. Cows and Cool Sequences | Bessie and the cows have recently been playing with "cool" sequences and are trying to construct some. Unfortunately they are bad at arithmetic, so they need your help!
A pair (x, y) of positive integers is "cool" if x can be expressed as the sum of y consecutive integers (not necessarily positive). A sequence (a1, a2... | {"inputs": ["3\n6 4 1\n", "4\n20 6 3 4\n", "5\n1 8 1 7 9\n", "4\n6 7 4 5\n", "5\n36 37 6 18 36\n", "3\n5 1 3\n", "200\n2 1 1 1 2 1 2 1 1 1 2 1 2 2 2 1 1 2 1 2 1 1 1 2 2 1 2 1 1 2 1 1 1 2 1 1 2 2 2 2 2 2 2 2 2 2 1 2 2 1 2 1 2 2 1 1 2 2 2 2 2 2 2 1 1 1 2 1 2 2 1 1 2 1 2 2 2 1 2 1 1 1 2 1 1 2 2 1 2 2 1 2 2 1 1 2 1 1 1 1 1... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
568d13ce7bf29e28ee0cddad0bb5272d | 306_C. White, Black and White Again | Polycarpus is sure that his life fits the description: "first there is a white stripe, then a black one, then a white one again". So, Polycarpus is sure that this rule is going to fulfill during the next n days. Polycarpus knows that he is in for w good events and b not-so-good events. At least one event is going to ta... | {"inputs": ["3 2 1\n", "3 2 2\n", "4 2 2\n", "3 3 1\n", "300 2 300\n", "4000 4000 1\n", "4000 4000 100\n", "4 2 3\n", "3 300 300\n", "4000 100 4000\n", "3 300 1\n", "300 300 1\n", "4000 1000 3000\n", "3 2 4000\n", "4 3 2\n", "3 2 300\n", "4000 3998 2\n", "100 200 300\n", "300 300 300\n", "3 3 3\n", "10 10 10\n", "10 4 ... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
a4dd824c5ae8687794b5f2f980f390c7 | 331_D2. Escaping on Beaveractor | Don't put up with what you're sick of! The Smart Beaver decided to escape from the campus of Beaver Science Academy (BSA). BSA is a b × b square on a plane. Each point x, y (0 ≤ x, y ≤ b) belongs to BSA. To make the path quick and funny, the Beaver constructed a Beaveractor, an effective and comfortable types of transp... | {"inputs": ["3 3\n0 0 0 1\n0 2 2 2\n3 3 2 3\n12\n0 0 L 0\n0 0 L 1\n0 0 L 2\n0 0 L 3\n0 0 L 4\n0 0 L 5\n0 0 L 6\n2 0 U 2\n2 0 U 3\n3 0 U 5\n1 3 D 2\n1 3 R 2\n", "3 8\n2 4 4 4\n7 2 5 2\n6 5 6 3\n20\n3 2 U 1000000\n3 2 U 1\n3 2 U 2\n3 2 U 3\n3 2 U 4\n3 2 U 5\n3 2 U 6\n3 2 U 7\n3 2 U 8\n3 2 U 9\n3 2 U 10\n3 2 U 11\n3 2 U 1... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
38d2244e23e77d95e23c230c4c2eafa3 | 354_B. Game with Strings | Given an n × n table T consisting of lowercase English letters. We'll consider some string s good if the table contains a correct path corresponding to the given string. In other words, good strings are all strings we can obtain by moving from the left upper cell of the table only to the right and down. Here's the form... | {"inputs": ["2\nxa\nay\n", "2\nab\ncd\n", "3\naab\nbcb\nbac\n", "5\ncbbbb\nbcbbb\naacbb\naaacb\naaaac\n", "20\nbifcabiabgfibfccdbgd\ncffaheagahcbacafbgeb\njagcacbadagcedbigaja\naaadicdbjdiibhihbgeb\nhiijbehdeaafdabiigha\nfiifibibgddjfbdafbif\nhdbgbcfjdgibadabfgaf\ngggdaijhfgbaidfajdaj\nfajhebaaaigdjaajcaij\nbhcbajicidb... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
ffa02ab5466bf4e0cc1cd3fc464f7ff9 | 378_C. Maze | Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side.
Pavel drew a grid maze with all empty cells forming a connected area. That is, you can go from any empty cell to any oth... | {"inputs": ["3 4 2\n#..#\n..#.\n#...\n", "5 4 5\n#...\n#.#.\n.#..\n...#\n.#.#\n", "19 20 196\n###.....##.#..#..##.\n####............##..\n###....#..#.#....#.#\n##....###......#...#\n.####...#.....#.##..\n.###......#...#.#.#.\n...##.#...#..#..#...\n.....#.....#..#....#\n.#.....##..#........\n.##....#......#....#\n....#.... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
f5435a355e8d238a55308d04a945ff31 | 39_E. What Has Dirichlet Got to Do with That? | You all know the Dirichlet principle, the point of which is that if n boxes have no less than n + 1 items, that leads to the existence of a box in which there are at least two items.
Having heard of that principle, but having not mastered the technique of logical thinking, 8 year olds Stas and Masha invented a game. T... | {"inputs": ["3 1 4\n", "2 2 10\n", "5 5 16808\n", "1 4 10\n", "2 2 5\n", "9 9 1000000000\n", "3 17 999999997\n", "3 3 64\n", "5 1 64\n", "29 2 1000000000\n", "1010 1 1000000000\n", "3 2 27\n", "1 1 60\n", "2 4 64\n", "2 2 64\n", "3 4 1000\n", "2 3 64\n", "2 1 536870912\n", "2 2 17\n", "117 1 13689\n", "2 5 64\n", "3 2 ... | 11 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
9fb0a6ee181ab71176f17714508fdaab | 425_A. Sereja and Swaps | As usual, Sereja has array a, its elements are integers: a[1], a[2], ..., a[n]. Let's introduce notation:
<image>
A swap operation is the following sequence of actions:
* choose two indexes i, j (i ≠ j);
* perform assignments tmp = a[i], a[i] = a[j], a[j] = tmp.
What maximum value of function m(a) can Serej... | {"inputs": ["5 10\n-1 -1 -1 -1 -1\n", "10 2\n10 -1 2 2 2 2 2 2 -1 10\n", "1 10\n1\n", "10 1\n-1 1 1 1 1 1 1 1 1 1\n", "78 8\n-230 -757 673 -284 381 -324 -96 975 249 971 -355 186 -526 804 147 -553 655 263 -247 775 108 -246 -107 25 -786 -372 -24 -619 265 -192 269 392 210 449 335 -207 371 562 307 141 668 78 13 251 623 -23... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
d9fa7a7f69196d44731cd8540c1520f0 | 449_D. Jzzhu and Numbers | Jzzhu have n non-negative integers a1, a2, ..., an. We will call a sequence of indexes i1, i2, ..., ik (1 ≤ i1 < i2 < ... < ik ≤ n) a group of size k.
Jzzhu wonders, how many groups exists such that ai1 & ai2 & ... & aik = 0 (1 ≤ k ≤ n)? Help him and print this number modulo 1000000007 (109 + 7). Operation x & y deno... | {"inputs": ["3\n2 3 3\n", "4\n0 1 2 3\n", "6\n5 2 0 5 2 1\n", "2\n1 31\n", "2\n1 0\n", "10\n450661 128600 993228 725823 293549 33490 843121 903634 556169 448234\n", "1\n1\n", "5\n1 3 5 7 9\n", "6\n524 529 5249 524 529 529\n", "3\n1 2 3\n", "2\n0 1\n", "55\n0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 3 4 5 6 7... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
541d7aa3e26f6387a962ba199e5477ce | 494_A. Treasure | Malek has recently found a treasure map. While he was looking for a treasure he found a locked door. There was a string s written on the door consisting of characters '(', ')' and '#'. Below there was a manual on how to open the door. After spending a long time Malek managed to decode the manual and found out that the ... | {"inputs": ["(((#)((#)\n", "#\n", "()((#((#(#()\n", "(#)\n", "#(#(#((##((()))(((#)(#()#(((()()(()#(##(((()(((()))#(((((()(((((((()#((#((()(#(((()(()##(()(((()((#(\n", "(#((((()\n", "(#((\n", "((#)((#)((#)((#)((#)((#)((#)((#)((#)((#)((#)((#)((#)((#)((#)((##\n", "(())((((#)\n", "(#(\n", "(#))(#(#)((((#(##((#(#((((#(##(((... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
5ee505249300600b681eb635a1ae263f | 518_E. Arthur and Questions | After bracket sequences Arthur took up number theory. He has got a new favorite sequence of length n (a1, a2, ..., an), consisting of integers and integer k, not exceeding n.
This sequence had the following property: if you write out the sums of all its segments consisting of k consecutive elements (a1 + a2 ... + ak, ... | {"inputs": ["3 2\n? 1 2\n", "5 1\n-10 -9 ? -7 -6\n", "5 3\n4 6 7 2 9\n", "7 2\n-10 0 ? 1 ? 2 10\n", "1 1\n0\n", "5 1\n-3 -2 -1 0 1\n", "7 1\n-4 ? ? ? ? ? 2\n", "17 1\n? -13 ? ? ? -3 ? ? ? ? ? 10 ? ? ? ? 100\n", "3 1\n-5 ? 0\n", "7 2\n-10 0 ? 1 6 2 ?\n", "3 1\n-3 ? -2\n", "6 1\n-1 ? 1 2 3 4\n", "1 1\n?\n", "9 2\n-10 0 ?... | 11 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
09469d7277905e4dc09b6e53f305d413 | 544_E. Remembering Strings | You have multiset of n strings of the same length, consisting of lowercase English letters. We will say that those strings are easy to remember if for each string there is some position i and some letter c of the English alphabet, such that this string is the only string in the multiset that has letter c in position i.... | {"inputs": ["4 3\nabc\naba\nadc\nada\n10 10 10\n10 1 10\n10 10 10\n10 1 10\n", "4 5\nabcde\nabcde\nabcde\nabcde\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n", "3 3\nabc\nada\nssa\n1 1 1\n1 1 1\n1 1 1\n", "1 1\na\n10\n", "1 20\naaaaaaaaaaaaaaaaaaaa\n924705 786913 546594 427698 741583 189683 354089 380570 10694 41046 65... | 11 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
50e86f21e6f197aa15c07677aa4e0304 | 571_B. Minimization | You've got array A, consisting of n integers and a positive integer k. Array A is indexed by integers from 1 to n.
You need to permute the array elements so that value
<image> became minimal possible. In particular, it is allowed not to change order of elements at all.
Input
The first line contains two integers n,... | {"inputs": ["5 2\n3 -5 3 -5 3\n", "3 2\n1 2 4\n", "6 3\n4 3 4 3 2 5\n", "30 2\n-999999924 -499999902 500000091 -999999998 500000030 -999999934 500000086 -499999918 -499999998 67 -999999964 -499999975 -499999947 -499999925 3 -499999985 14 500000015 500000022 88 25 -499999909 500000051 -499999984 -999999964 -499999905 -4... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
aec26de877c16669efe2d20b66ca368a | 592_E. BCPC | BCPC stands for Byteforces Collegiate Programming Contest, and is the most famous competition in Byteforces.
BCPC is a team competition. Each team is composed by a coach and three contestants. Blenda is the coach of the Bit State University(BSU), and she is very strict selecting the members of her team.
<image>
In B... | {"inputs": ["7 6 6\n3 2\n1 7\n5 7\n3 7\n6 4\n8 9\n8 5\n", "5 2 2\n1 1\n4 1\n2 3\n3 2\n3 4\n", "8 61 898\n315 863\n524 559\n612 425\n577 542\n220 280\n560 880\n297 626\n381 24\n", "32 79793 36411\n37942 45805\n11123 1864\n8196 82922\n31139 76552\n77991 28555\n96327 37047\n79356 82575\n10442 62647\n90848 41723\n16799 363... | 11 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
baa55abb91a57ba032b6100f34cea7d2 | 614_C. Peter and Snow Blower | Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it... | {"inputs": ["3 0 0\n0 1\n-1 2\n1 2\n", "4 1 -1\n0 0\n1 2\n2 0\n1 1\n", "4 0 0\n1 -1\n1 3\n3 3\n3 -1\n", "3 0 0\n-10 1\n0 2\n1 1\n", "3 0 0\n-1 1\n0 3\n1 1\n", "20 -999719 -377746\n-999718 -377746\n-997432 -940486\n-982215 -950088\n-903861 -997725\n-127953 -999833\n846620 -999745\n920305 -992903\n947027 -986746\n991646 ... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
c6e6e554d074743aac0015be8fa7f25e | 633_H. Fibonacci-ish II | Yash is finally tired of computing the length of the longest Fibonacci-ish sequence. He now plays around with more complex things such as Fibonacci-ish potentials.
Fibonacci-ish potential of an array ai is computed as follows:
1. Remove all elements j if there exists i < j such that ai = aj.
2. Sort the remain... | {"inputs": ["5 10\n2 1 2 1 2\n2\n2 4\n4 5\n", "5 10\n2 1 2 2 2\n2\n2 4\n4 5\n", "5 10\n2 1 2 2 1\n2\n2 4\n4 5\n", "5 10\n3 1 4 2 1\n2\n2 4\n4 5\n", "5 10\n3 2 4 2 1\n2\n2 4\n4 5\n", "5 10\n3 2 4 2 1\n2\n2 1\n4 5\n", "5 10\n2 1 4 1 2\n2\n2 4\n4 5\n", "5 10\n3 1 2 2 1\n2\n1 4\n4 5\n", "5 10\n3 1 4 2 1\n2\n4 4\n4 5\n", "5... | 14 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
51c69f630a8caeab3f1567e86c7e3ead | 662_C. Binary Table | You are given a table consisting of n rows and m columns. Each cell of the table contains either 0 or 1. In one move, you are allowed to pick any row or any column and invert all values, that is, replace 0 by 1 and vice versa.
What is the minimum number of cells with value 1 you can get after applying some number of o... | {"inputs": ["3 4\n0110\n1010\n0111\n", "20 20\n00010110100100010111\n11110000001100101110\n01110101110001111000\n10111101000111111110\n10000101011000000011\n00010010001011010000\n00000110010110111111\n01010101000101101110\n01001110110001000011\n10111111010011101111\n10011010000110101101\n10000111011001001111\n111111101... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
68d8cda40a5fabadff240afd4b0a77c2 | 687_A. NP-Hard Problem | Recently, Pari and Arya did some research about NP-Hard problems and they found the minimum vertex cover problem very interesting.
Suppose the graph G is given. Subset A of its vertices is called a vertex cover of this graph, if for each edge uv there is at least one endpoint of it in this set, i.e. <image> or <image>... | {"inputs": ["4 2\n1 2\n2 3\n", "3 3\n1 2\n2 3\n1 3\n", "10 16\n6 10\n5 2\n6 4\n6 8\n5 3\n5 4\n6 2\n5 9\n5 7\n5 1\n6 9\n5 8\n5 10\n6 1\n6 7\n6 3\n", "10 9\n2 5\n2 4\n2 7\n2 9\n2 3\n2 8\n2 6\n2 10\n2 1\n", "20 22\n3 18\n9 19\n6 15\n7 1\n16 8\n18 7\n12 3\n18 4\n9 15\n20 1\n4 2\n6 7\n14 2\n7 15\n7 10\n8 1\n13 6\n9 7\n11 8\... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
0057fd225ac3a32d46d1af515ff591df | 709_E. Centroids | Tree is a connected acyclic graph. Suppose you are given a tree consisting of n vertices. The vertex of this tree is called centroid if the size of each connected component that appears if this vertex is removed from the tree doesn't exceed <image>.
You are given a tree of size n and can perform no more than one edge ... | {"inputs": ["3\n1 2\n2 3\n", "5\n1 2\n1 3\n1 4\n1 5\n", "8\n1 2\n1 3\n1 4\n1 5\n2 6\n2 7\n2 8\n", "9\n9 2\n9 3\n9 4\n9 5\n2 6\n5 7\n7 8\n7 1\n", "9\n8 2\n8 3\n8 4\n8 5\n2 6\n5 7\n7 1\n7 9\n", "4\n3 1\n3 2\n3 4\n", "9\n5 2\n5 3\n5 4\n5 1\n2 6\n1 7\n7 8\n7 9\n", "10\n10 1\n1 4\n4 2\n2 3\n3 6\n6 9\n9 5\n5 8\n8 7\n", "50\n... | 11 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
a6405ed3344336240e1fda69d6baa646 | 730_G. Car Repair Shop | Polycarp starts his own business. Tomorrow will be the first working day of his car repair shop. For now the car repair shop is very small and only one car can be repaired at a given time.
Polycarp is good at marketing, so he has already collected n requests from clients. The requests are numbered from 1 to n in order... | {"inputs": ["4\n1000000000 1000000\n1000000000 1000000\n100000000 1000000\n1000000000 1000000\n", "3\n9 2\n7 3\n2 4\n", "1\n1 5000000\n", "1\n1000000000 1\n", "10\n588 12\n560 10\n593 14\n438 15\n761 11\n984 6\n503 2\n855 19\n538 2\n650 7\n", "20\n360 26\n475 17\n826 12\n815 23\n567 28\n897 26\n707 20\n1000 9\n576 5\n1... | 13 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
b7406b5a520eca44d655d33968e78805 | 754_B. Ilya and tic-tac-toe game | Ilya is an experienced player in tic-tac-toe on the 4 × 4 field. He always starts and plays with Xs. He played a lot of games today with his friend Arseny. The friends became tired and didn't finish the last game. It was Ilya's turn in the game when they left it. Determine whether Ilya could have won the game by making... | {"inputs": ["o.x.\no...\n.x..\nooxx\n", "x.ox\nox..\nx.o.\noo.x\n", "xx..\n.oo.\nx...\noox.\n", "x..x\n..oo\no...\nx.xo\n", "xoox\n.xx.\no..o\n..xo\n", "o.xx\nxo.o\n...o\n..x.\n", "xxoo\no.oo\n...x\nx..x\n", "o..x\n....\n...x\n..o.\n", "....\n.o..\n....\nox.x\n", "xxo.\n.oo.\n..x.\n..xo\n", "....\n..ox\n....\n.o.x\n", ... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
b8bbc828efd8272fc410325d1e91da66 | 774_K. Stepan and Vowels | Stepan likes to repeat vowel letters when he writes words. For example, instead of the word "pobeda" he can write "pobeeeedaaaaa".
Sergey does not like such behavior, so he wants to write a program to format the words written by Stepan. This program must combine all consecutive equal vowels to a single vowel. The vowe... | {"inputs": ["18\naeiouyaaeeiioouuyy\n", "22\niiiimpleeemeentatiioon\n", "13\npobeeeedaaaaa\n", "24\naaaoooiiiuuuyyyeeeggghhh\n", "3\neoo\n", "36\naeiouyaaeeiioouuyyaaaeeeiiiooouuuyyy\n", "3\nooo\n", "1\na\n", "4\neeoo\n", "5\noooee\n", "5\nooeoo\n", "1\nf\n", "200\nmmffggzvuuzzlkafduueqocuybiiaaeeoiioouaaurccuqoouuoooo... | 17 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
54fd765099878486641cb51acf24fb4b | 79_D. Password | Finally Fox Ciel arrived in front of her castle!
She have to type a password to enter her castle. An input device attached to her castle is a bit unusual.
The input device is a 1 × n rectangle divided into n square panels. They are numbered 1 to n from left to right. Each panel has a state either ON or OFF. Initially... | {"inputs": ["3 2 1\n1 2\n3\n", "10 8 2\n1 2 3 5 6 7 8 9\n3 5\n", "10000 10 100\n2339 4118 4595 5499 5582 6055 8693 9002 9190 9658\n10 75 82 5 14 55 64 68 46 43 97 31 51 20 65 92 3 53 36 38 100 68 20 61 60 98 26 32 50 82 26 73 5 26 12 27 50 83 8 81 65 91 20 11 45 80 54 60 93 54 96 15 50 2 100 38 6 27 8 84 3 27 91 78 6 2... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
fb1e16e95551fe16c4c7b6463fb2dcf3 | 820_A. Mister B and Book Reading | Mister B once received a gift: it was a book about aliens, which he started read immediately. This book had c pages.
At first day Mister B read v0 pages, but after that he started to speed up. Every day, starting from the second, he read a pages more than on the previous day (at first day he read v0 pages, at second —... | {"inputs": ["5 5 10 5 4\n", "12 4 12 4 1\n", "15 1 100 0 0\n", "10 1 4 10 0\n", "100 1 2 1000 0\n", "1 11 12 0 10\n", "1 2 3 0 0\n", "8 6 13 2 5\n", "8 3 5 1 0\n", "17 10 12 6 5\n", "6 4 4 1 2\n", "50 4 5 5 0\n", "20 2 40 1 1\n", "1000 501 510 1 499\n", "129 2 3 4 0\n", "16 4 23 8 3\n", "11 2 4 1 1\n", "97 8 13 234 5\n... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
6897746b1411ca6eb602bfbd3e056987 | 846_B. Math Show | Polycarp takes part in a math show. He is given n tasks, each consists of k subtasks, numbered 1 through k. It takes him tj minutes to solve the j-th subtask of any task. Thus, time required to solve a subtask depends only on its index, but not on the task itself. Polycarp can solve subtasks in any order.
By solving s... | {"inputs": ["5 5 10\n1 2 4 8 16\n", "3 4 11\n1 2 3 4\n", "1 3 0\n6 3 4\n", "5 4 32\n4 2 1 1\n", "32 6 635\n3 4 2 1 7 7\n", "3 7 20012\n1 1 1 1 1 1 10000\n", "1 5 44\n2 19 18 6 8\n", "1 3 8\n5 4 4\n", "3 3 15\n1 2 1\n", "1 1 1\n1\n", "1 1 0\n2\n", "12 1 710092\n145588\n", "21 3 26\n1 2 3\n", "11 2 20\n1 9\n", "2 2 5\n5 ... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
3e8ef837364e1d24a2c5347163360261 | 867_D. Gotta Go Fast | You're trying to set the record on your favorite video game. The game consists of N levels, which must be completed sequentially in order to beat the game. You usually complete each level as fast as possible, but sometimes finish a level slower. Specifically, you will complete the i-th level in either Fi seconds or Si ... | {"inputs": ["1 8\n2 8 81\n", "2 30\n20 30 80\n3 9 85\n", "4 319\n63 79 89\n79 97 91\n75 87 88\n75 90 83\n", "48 1976\n30 97 84\n80 81 84\n41 70 86\n23 57 80\n17 60 85\n36 48 81\n51 87 81\n38 85 81\n31 67 80\n11 40 96\n63 100 83\n4 67 82\n16 67 90\n45 97 80\n60 75 82\n5 95 84\n43 85 83\n4 14 81\n21 85 81\n32 39 80\n25 3... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
4f0429d3695120a22b95b6c864bb4738 | 893_A. Chess For Three | Alex, Bob and Carl will soon participate in a team chess tournament. Since they are all in the same team, they have decided to practise really hard before the tournament. But it's a bit difficult for them because chess is a game for two players, not three.
So they play with each other according to following rules:
... | {"inputs": ["2\n1\n2\n", "3\n1\n1\n2\n", "99\n1\n3\n2\n2\n3\n1\n1\n3\n3\n3\n3\n3\n3\n1\n1\n3\n3\n3\n3\n1\n1\n3\n2\n1\n1\n1\n1\n1\n1\n1\n3\n2\n2\n2\n1\n3\n3\n1\n1\n3\n2\n1\n3\n3\n1\n2\n3\n3\n3\n1\n2\n2\n2\n3\n3\n3\n3\n3\n3\n2\n2\n2\n2\n3\n3\n3\n1\n1\n3\n2\n1\n1\n2\n2\n2\n3\n3\n2\n1\n1\n2\n2\n1\n3\n2\n1\n1\n2\n3\n3\n3\n3... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
a66c602a3cf74e793d1e3f01b9adf9a7 | 914_F. Substrings in a String | Given a string s, process q queries, each having one of the following forms:
* 1 i c — Change the i-th character in the string to c.
* 2 l r y — Consider the substring of s starting at position l and ending at position r. Output the number of times y occurs as a substring in it.
Input
The first line of the inp... | {"inputs": ["ababababa\n3\n2 1 7 aba\n1 5 c\n2 1 7 aba\n", "abcdcbc\n5\n2 1 7 bc\n1 4 b\n2 4 7 bc\n1 2 a\n2 1 4 aa\n", "abcdabcdab\n5\n2 2 8 ab\n2 1 10 ab\n1 3 a\n1 4 b\n2 1 4 ab\n", "abcdabcdab\n5\n2 2 8 ba\n2 1 10 ab\n1 3 a\n1 4 b\n2 1 4 ab\n", "ababababa\n3\n2 2 7 aba\n1 5 c\n2 1 7 aba\n", "abcdcbc\n5\n2 1 5 bc\n1 4... | 12 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
410da57d1364fe70f1cb02b89aa5dca6 | 937_D. Sleepy Game | Petya and Vasya arranged a game. The game runs by the following rules. Players have a directed graph consisting of n vertices and m edges. One of the vertices contains a chip. Initially the chip is located at vertex s. Players take turns moving the chip along some edge of the graph. Petya goes first. Player who can't m... | {"inputs": ["3 2\n1 3\n1 1\n0\n2\n", "2 2\n1 2\n1 1\n1\n", "5 6\n2 2 3\n2 4 5\n1 4\n1 5\n0\n1\n", "11 20\n1 2\n2 7 6\n1 7\n4 10 9 3 2\n2 9 2\n1 3\n0\n0\n3 1 6 7\n4 11 7 5 6\n2 2 8\n4\n", "5 5\n1 2\n1 3\n2 1 4\n1 5\n0\n1\n", "5 5\n1 2\n1 3\n2 2 4\n1 5\n0\n1\n", "4 3\n1 2\n1 3\n1 1\n0\n1\n", "6 6\n1 2\n2 3 6\n1 4\n0\n1 3... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
25b08417d2cb571c680dad7e631ccf31 | 962_F. Simple Cycles Edges | You are given an undirected graph, consisting of n vertices and m edges. The graph does not necessarily connected. Guaranteed, that the graph does not contain multiple edges (more than one edges between a pair of vertices) or loops (edges from a vertex to itself).
A cycle in a graph is called a simple, if it contains ... | {"inputs": ["6 7\n2 3\n3 4\n4 2\n1 2\n1 5\n5 6\n6 1\n", "3 3\n1 2\n2 3\n3 1\n", "5 6\n1 2\n2 3\n2 4\n4 3\n2 5\n5 3\n", "2 0\n", "100000 0\n", "8 9\n1 2\n2 3\n3 4\n4 1\n5 6\n6 7\n7 8\n8 5\n6 8\n", "2 1\n1 2\n", "11 9\n5 9\n8 5\n11 3\n11 1\n3 4\n7 11\n3 1\n11 2\n7 2\n", "7 9\n7 3\n7 4\n1 2\n2 3\n3 1\n3 4\n4 5\n5 6\n6 4\n... | 12 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
bd1122b008bbddf037910a26ff825b4f | 990_B. Micro-World | You have a Petri dish with bacteria and you are preparing to dive into the harsh micro-world. But, unfortunately, you don't have any microscope nearby, so you can't watch them.
You know that you have n bacteria in the Petri dish and size of the i-th bacteria is a_i. Also you know intergalactic positive integer constan... | {"inputs": ["6 5\n20 15 10 15 20 25\n", "7 1\n101 53 42 102 101 55 54\n", "7 1000000\n1 1 1 1 1 1 1\n", "2 1\n1 1\n", "4 1\n2 2 1 1\n", "10 1\n2 6 3 4 2 4 4 3 2 1\n", "2 1\n999152 999153\n", "8 1000000\n1 1 5 1000000 1000000 2 2 2\n", "9 2\n1 6 1 5 5 8 6 8 7\n", "15 1\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "1 4\n8\n", "10 ... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
4c94b2e9b47102ba51722a72a59b6ba1 | ankit-and-race-team-10 | Coach Ankit is forming a team for the Annual Inter Galactic Relay Race. He has N students that train under him and he knows their strengths. The strength of a student is represented by a positive integer.
The coach has to form a team of K students. The strength of a team is defined by the strength of the weakest stude... | {"inputs": ["2\n2 1\n5 4\n3 2\n1 0 2\n\nSAMPLE", "2\n2 1\n3 4\n3 2\n1 0 2\n\nSAMPLE", "2\n2 1\n5 5\n3 2\n1 0 2\n\nSAMPLE", "2\n2 1\n3 0\n3 2\n1 0 2\n\nSAMPLE", "2\n2 1\n0 5\n3 2\n1 0 2\n\nSAMPLE", "2\n2 2\n3 0\n3 2\n1 0 2\n\nELPMAS", "2\n2 2\n3 -1\n3 2\n1 0 2\n\nELPMAS", "2\n2 2\n5 4\n3 2\n1 0 2\n\nSAMPLE", "2\n2 1\n0 ... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
0d936bf28c464e225fddc1f7e26b970b | chandu-and-daspal-2 | Continuing from previous version of codeXplod series i.e. CodeXplod 1.0,Chandu and daspal are still fighting over a matter of MOMO's(they are very fond of Mo Mos of sector 3..:P).This time the fight became so savior that they want to kill each other.As we all know that during a fight it is most probable outcome that b... | {"inputs": ["1\n2 3 Chandu\n\nSAMPLE", "51\n8 10 Chandu\n2 2959 Daspal\n2903 6 Chandu\n9 2938 Daspal\n10 2907 Daspal\n8 2966 Daspal\n8 2938 Daspal\n4 2984 Daspal\n5 2939 Daspal\n2 2975 Daspal\n2925 10 Chandu\n4 2982 Daspal\n10 2959 Daspal\n3 2906 Daspal\n5 2904 Daspal\n2983 5 Chandu\n10 2998 Daspal\n10 2980 Daspal\n6 2... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
7eda68f6c2d65f69d5bab71bb9d039ed | digital-numbers | Bosky is a very curious child who turned 13 yesterday. His parents gifted him a digital watch which he really liked. He was amazed to see how each number can be represented inside one cell only by switching different edges on and off.
Today, while he was in his home alone, getting bored looking at his watch, an idea p... | {"inputs": ["4\n1 14\n1 50\n4 28\n5 700\n\nSAMPLE", "5\n1 14\n1 50\n4 28\n5 700\n3 147"], "outputs": ["1\n10\n3\n32491", "1\n10\n3\n32491\n739"]} | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
366a68acad8b5deeb8ff06bd80813b85 | give-me-my-test-monk | Professor just has checked all the N students tests. Everything was fine but then he realised that none of the students had signed their papers, so he doesn't know which test belongs to which student.
But it's definitely not professors's job to catch every student and asked him to find his paper! So he will hand out... | {"inputs": ["3 1 3\n\nSAMPLE", "60 0 58", "7 3 7"], "outputs": ["833333340", "630738177", "195634923"]} | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
d2b9d161b755d92b17f954d7c3f269fc | lexicographically-preceding-permutation | Given an integer n and a permutation of numbers 1, 2 ... , n-1, n write a program to print the permutation that lexicographically precedes the given input permutation. If the given permutation is the lexicographically least permutation, then print the input permutation itself.
Input Format:
First line is the test c... | {"inputs": ["1\n3\n1 3 2\n\nSAMPLE"], "outputs": ["1 2 3"]} | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
0fc51a04492be2d3e10efbc9fbf500d9 | monks-birthday-party | Monk's birthday is coming this weekend! He wants to plan a Birthday party and is preparing an invite list with his friend Puchi. He asks Puchi to tell him names to add to the list.
Puchi is a random guy and keeps coming up with names of people randomly to add to the invite list, even if the name is already on the list... | {"inputs": ["1\n7\nchandu\nparo\nrahul\nmohi\nparo\narindam\nrahul\n\nSAMPLE", "5\n10\nbb\nbb\nab\naa\nbb\nbb\nba\naa\nbb\nab\n10\nbb\nab\nba\nab\nba\nba\nab\nba\nba\nba\n10\naa\nba\nba\nba\nbb\nab\nab\naa\nbb\nbb\n10\nab\nab\nbb\nbb\nab\nba\naa\nba\nab\naa\n10\nba\nbb\nbb\nbb\naa\nba\nba\nba\nbb\nbb", "5\n10\nbb\nbb\n... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
8025c69347f1f103f77e05fc4f3d150e | play-with-string | Suppose you have a string S which has length N and is indexed from 0 to N−1. String R is the reverse of the string S. The string S is funny if the condition |Si−Si−1|=|Ri−Ri−1| is true for every i from 1 to N−1.
(Note: Given a string str, stri denotes the ascii value of the ith character (0-indexed) of str. |x| denote... | {"inputs": ["2\nacxz\nbcxz\n\nSAMPLE", "2\nacxz\nbcxz", "2\nacxz\nzxcb", "2\nzxda\nzxcb\n\nSAMPLE", "2\nzwac\nbcyz", "2\nywac\nbcyz", "2\nzxca\nbcxz\n\nSAMPLE", "2\nzxca\nzxcb\n\nSAMPLE", "2\nyxda\nzxcb\n\nSAMPLE", "2\nyxda\nzxcb\n\nASMPLE", "2\nyxda\nzwcb\n\nASMPLE", "2\nyxda\nzcwb\n\nASMPLE", "2\nyxea\nzcwb\n\nASMPLE... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
d85358e8d7b440535639a879e7b22af9 | roy-and-wobbly-numbers | Roy is looking for Wobbly Numbers.
An N-length wobbly number is of the form "ababababab..." and so on of length N, where a != b.
A 3-length wobbly number would be of form "aba".
Eg: 101, 121, 131, 252, 646 etc
But 111, 222, 999 etc are not 3-length wobbly number, because here a != b condition is not satisfied.
... | {"inputs": ["6\n3 1\n3 2\n3 100\n4 3\n4 4\n5 2\n\nSAMPLE", "6\n3 1\n3 2\n5 100\n4 3\n4 4\n5 2\n\nSAMPLE", "6\n6 1\n3 2\n5 100\n4 3\n4 4\n5 2\n\nSAMPLE", "6\n6 1\n3 1\n5 100\n4 3\n4 4\n5 2\n\nSAMPLE", "6\n6 1\n3 1\n5 100\n4 3\n4 5\n5 2\n\nSAMPLE", "6\n11 1\n3 1\n5 100\n4 3\n4 5\n5 2\n\nSAMPLE", "6\n11 1\n3 1\n5 100\n4 3... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
a0892dbaa5d35286c8c118f0e7c54937 | substrings-count-3 | Jack is the most intelligent student in the class.To boost his intelligence,his class teacher gave him a problem named "Substring Count".
Problem :
His Class teacher gave him n strings numbered from 1 to n which consists of only lowercase letters (each having length not more than 10) and then ask Q questions related t... | {"inputs": ["3\ncode\ncoder\ncoding\n2\n1 3 code\n1 3 co\n\nSAMPLE", "1000\nspnogbxcrp\nbaukbqnmyu\nogxdxhtcwz\nbsjufplykz\nkhicdrdixl\nzookiqggel\nfczygjfhfa\nkobjmuswpw\ndypvhmsjlh\nvbcnnpwmgm\nvzvkarnyqs\ntfssjnurqh\ntbxcluekyt\necnegofqxs\nhbhdeftboc\nqvmotsnevm\nwxzidquite\noqowdpeszj\npnypgzooxk\nuytjntdfmn\nhflt... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
86729e1c9dbf52ef01678c1874cdef49 | vibhu-and-his-mathematics | In code world all genders are considered equal ( It means their is nothing like male or female). Now their are N distinct persons living in this hypothetical world. Each person can pair up with any other person or can even remain single. One day Vbhu planned to visit code world. Being a maths guy , he always try to b... | {"inputs": ["2\n2\n3\n\n\nSAMPLE", "2\n1\n3\n\n\nSAMPLE", "2\n2\n3\n\n\nSBMPLE", "2\n2\n2\n\n\nELPMBS", "2\n4\n2\n\n\nELPMBS", "2\n3\n3\n\n\nFLQMBS", "2\n5\n2\n\n\nELPMBS", "2\n3\n1\n\n\nFLQMBS", "2\n1\n5\n\n\nEANPLS", "2\n1\n8\n\n\nEANPLS", "2\n1\n7\n\n\nEANPLS", "2\n1\n4\n\n\nEANPLS", "2\n2\n5\n\n\nSLPNAD", "2\n2\n4\... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
15367dcad420799575333e16a08c42f0 | p02610 AIsing Programming Contest 2020 - Camel Train | We have N camels numbered 1,2,\ldots,N. Snuke has decided to make them line up in a row.
The happiness of Camel i will be L_i if it is among the K_i frontmost camels, and R_i otherwise.
Snuke wants to maximize the total happiness of the camels. Find the maximum possible total happiness of the camel.
Solve this probl... | {"inputs": ["3\n2\n1 5 10\n2 15 5\n3\n2 93 78\n1 71 59\n3 57 96\n19\n19 23 16\n5 90 13\n12 85 70\n19 67 78\n12 16 60\n18 48 28\n5 4 24\n12 97 97\n4 57 87\n19 91 74\n18 100 76\n7 86 46\n9 100 57\n3 76 73\n6 84 93\n1 6 84\n11 75 94\n19 15 3\n12 11 34", "3\n2\n1 5 10\n2 15 5\n3\n2 93 78\n1 71 59\n3 57 96\n19\n19 23 16\n5 ... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
c93ca658752893b9219752de12d6c704 | p02741 Panasonic Programming Contest 2020 - Kth Term | Print the K-th element of the following sequence of length 32:
1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
Constraints
* 1 \leq K \leq 32
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
K
Output
Print ... | {"inputs": ["27", "6", "16", "19", "8", "24", "32", "28", "-22", "1", "15", "5", "-9", "-27", "-13", "29", "-20", "001", "8", "1", "32", "5", "15", "24", "-9", "-13", "19", "29", "16", "28", "-20", "-27", "-22", "001"], "outputs": ["5", "2", "14\n", "1\n", "5\n", "15\n", "51\n", "4\n", "2\n", "1\n", "1\n", "1\n", "1\n"... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
cf12c06987214121d22579d9bdd9bd29 | p02876 AtCoder Grand Contest 040 - Balance Beam | We have N balance beams numbered 1 to N. The length of each beam is 1 meters. Snuke walks on Beam i at a speed of 1/A_i meters per second, and Ringo walks on Beam i at a speed of 1/B_i meters per second.
Snuke and Ringo will play the following game:
* First, Snuke connects the N beams in any order of his choice and m... | {"inputs": ["3\n4 1\n5 2\n6 3", "4\n1 5\n4 7\n2 1\n8 4", "2\n3 2\n1 2", "10\n866111664 178537096\n705445072 318106937\n472381277 579910117\n353498483 865935868\n383133839 231371336\n378371075 681212831\n304570952 16537461\n955719384 267238505\n844917655 218662351\n550309930 62731178", "3\n1 1\n5 2\n6 3", "4\n1 5\n4 7\n... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
9d5837902bd3a890c944ee11cc872a15 | p03010 diverta 2019 Programming Contest 2 - Diverta City | Diverta City is a new city consisting of N towns numbered 1, 2, ..., N.
The mayor Ringo is planning to connect every pair of two different towns with a bidirectional road. The length of each road is undecided.
A Hamiltonian path is a path that starts at one of the towns and visits each of the other towns exactly once... | {"inputs": ["4", "3", "2", "6", "7", "8", "10", "1", "5", "9", "001", "010", "5", "6", "1", "9", "7", "2", "10", "8", "001", "010"], "outputs": ["0 111 157 193\n111 0 224 239\n157 224 0 258\n193 239 258 0", "0 6 15\n6 0 21\n15 21 0", "0 1\n1 0\n", "0 1 2 7 45 512\n1 0 4 14 90 1024\n2 4 0 28 180 2048\n7 14 28 0 315 3584... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
63b4e5dc69d206100e4524a339d5a693 | p03150 KEYENCE Programming Contest 2019 - KEYENCE String | A string is called a KEYENCE string when it can be changed to `keyence` by removing its contiguous substring (possibly empty) only once.
Given a string S consisting of lowercase English letters, determine if S is a KEYENCE string.
Constraints
* The length of S is between 7 and 100 (inclusive).
* S consists of lowerc... | {"inputs": ["keyence", "ashlfyha", "keyofscience", "mpyszsbznf", "ecneyek", "ashkfyha", "eeyofscienck", "mnyszsbzpf", "ecneyel", "arhkfyha", "eeyofsciencj", "mnyszsb{pf", "ecleyen", "arhkyfha", "eeyofscienci", "mnzszsb{pf", "neyelce", "ahfykhra", "eeyofscjenci", "mnzs{sb{pf", "neyemce", "ahfzkhra", "icnejcsfoyee", "snz... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
3c40f948ec1b67f71a65c08c17327cb8 | p03294 AtCoder Beginner Contest 103 - Modulo Summation | You are given N positive integers a_1, a_2, ..., a_N.
For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N).
Here, X\ mod\ Y denotes the remainder of the division of X by Y.
Find the maximum value of f.
Constraints
* All values in input are integers.
* 2 \leq N \leq 3000
* 2 ... | {"inputs": ["5\n7 46 11 20 11", "7\n994 518 941 851 647 2 581", "3\n3 4 6", "5\n7 46 11 17 11", "7\n994 518 941 851 647 2 568", "3\n3 1 6", "5\n7 46 11 17 13", "7\n994 518 941 523 647 2 568", "3\n3 2 6", "5\n7 13 11 17 13", "7\n994 518 941 523 647 1 568", "3\n3 3 6", "5\n7 12 11 17 13", "7\n994 765 941 523 647 1 568", ... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
1bef47e43c16fe924cea2f56ba4de4ed | p03452 AtCoder Regular Contest 090 - People on a Line | There are N people standing on the x-axis. Let the coordinate of Person i be x_i. For every i, x_i is an integer between 0 and 10^9 (inclusive). It is possible that more than one person is standing at the same coordinate.
You will given M pieces of information regarding the positions of these people. The i-th piece of... | {"inputs": ["3 3\n1 2 1\n2 3 1\n1 3 5", "100 0", "10 3\n8 7 100\n7 9 100\n9 8 100", "3 3\n1 2 1\n2 3 1\n1 3 2", "4 3\n2 1 1\n2 3 5\n3 4 2", "000 0", "10 3\n8 7 000\n7 9 100\n9 8 100", "4 3\n2 1 1\n2 3 3\n3 4 2", "10 3\n8 7 000\n7 9 110\n9 8 100", "4 3\n1 1 1\n2 3 3\n3 4 2", "10 3\n9 7 000\n7 9 110\n9 8 100", "4 3\n1 1 ... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
83a0cb624b1ad187ec0f771e206f13d1 | p03612 AtCoder Beginner Contest 072 - Derangement | You are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N. You can perform the following operation any number of times (possibly zero):
Operation: Swap two adjacent elements in the permutation.
You want to have p_i ≠ i for all 1≤i≤N. Find the minimum required number of operations to achieve this.
Constraint... | {"inputs": ["5\n1 4 3 5 2", "9\n1 2 4 9 5 8 7 3 6", "2\n1 2", "2\n2 1", "5\n1 4 4 5 2", "9\n1 2 4 9 5 8 7 6 6", "9\n1 2 4 9 5 8 4 6 6", "5\n0 4 4 5 1", "2\n1 0", "2\n1 1", "5\n1 4 4 5 1", "2\n1 -1", "2\n0 2", "9\n2 2 4 9 5 8 4 6 6", "2\n2 2", "2\n0 1", "5\n0 4 4 4 1", "9\n2 2 4 5 5 8 4 6 6", "2\n2 0", "2\n0 0", "5\n0 4... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
578f5c42517bb286c44e56609bd8a6d7 | p03771 AtCoder Grand Contest 012 - Camel and Oases | There are N oases on a number line. The coordinate of the i-th oases from the left is x_i.
Camel hopes to visit all these oases. Initially, the volume of the hump on his back is V. When the volume of the hump is v, water of volume at most v can be stored. Water is only supplied at oases. He can get as much water as he... | {"inputs": ["7 2\n-10 -4 -2 0 2 4 10", "16 19\n-49 -48 -33 -30 -21 -14 0 15 19 23 44 52 80 81 82 84", "3 2\n1 3 6", "7 4\n-10 -4 -2 0 2 4 10", "16 19\n-49 -48 -33 -30 -21 -14 0 15 19 23 44 55 80 81 82 84", "3 2\n1 3 2", "16 19\n-49 -48 -24 -30 -21 -14 0 15 19 23 44 55 80 81 82 84", "5 2\n1 3 2", "16 19\n-49 -48 -24 -30... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
c46559d876ae389c6024eeb67ca8328a | p03940 AtCoder Grand Contest 007 - Shik and Game | Imagine a game played on a line. Initially, the player is located at position 0 with N candies in his possession, and the exit is at position E. There are also N bears in the game. The i-th bear is located at x_i. The maximum moving speed of the player is 1 while the bears do not move at all.
When the player gives a c... | {"inputs": ["3 9 1\n1 3 8", "2 1000000000 1000000000\n1 999999999", "3 9 3\n1 3 8", "3 9 1\n2 3 8", "2 1000000000 1000000000\n1 199586132", "3 9 3\n1 3 7", "3 9 3\n1 0 7", "2 1000001000 1000000000\n2 199586132", "3 9 5\n1 0 7", "2 1010001000 1000000000\n2 199586132", "2 1010001000 1000001000\n4 125587868", "3 9 1\n1 3 ... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
097f57d87b4f4026530f447c45ad6910 | p00032 Plastic Board | There is a factory that inputs the data of the side and diagonal lengths to the machine and cuts out the plastic plate. At this factory, we cut out only parallelogram molds, although they vary in size. You have been ordered by your boss to count the number of rectangles and rhombuses produced among the parallelograms t... | {"inputs": ["3,4,5\n5,5,8\n4,4,4\n5,4,3", "3,4,5\n5,5,8\n4,5,4\n5,4,3", "3,3,5\n5,5,8\n4,4,4\n5,4,3", "3,4,5\n5,5,8\n4,5,4\n3,4,5", "3,4,5\n8,5,5\n4,5,4\n3,4,5", "3,5,5\n6,5,8\n4,4,5\n5,4,3", "3,3,5\n5,5,8\n3,4,4\n5,4,3", "3,4,5\n8,5,5\n4,5,4\n5,4,3", "4,4,5\n5,5,8\n4,5,4\n3,4,5", "3,4,5\n5,5,8\n4,4,4\n3,4,5", "3,2,5\n... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
f7d0f4fd4d31e8195b95bda423ebd008 | p00163 Highway Toll | In 20XX, the Aizu Chuo Road, which has a total distance of 58km and 6 sections from Atsushiokanomachi, Kitakata City to Minamiaizucho, is scheduled to be completed and opened.
For half a year after opening, the toll will be halved for vehicles that pass the departure IC or arrival IC between 17:30 and 19:30 and have a... | {"inputs": ["2\n17 25\n4\n17 45\n4\n17 25\n7\n19 35\n0", "2\n17 25\n4\n17 45\n4\n17 25\n7\n1 35\n0", "2\n19 25\n4\n17 37\n4\n17 47\n7\n0 63\n0", "2\n14 25\n4\n3 37\n4\n17 47\n7\n0 63\n0", "2\n13 25\n3\n17 45\n4\n17 25\n7\n1 35\n0", "2\n14 25\n4\n17 37\n0\n17 47\n7\n0 63\n0", "2\n13 25\n3\n17 45\n4\n17 47\n7\n1 35\n0", ... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
a6a7b5f0e25a941bca2ce410ac39c300 | p00320 Cuboid | The educational program (AHK Education) of the Aiz Broadcasting Corporation broadcasts a program called "Play with Tsukuro" for children. Today is the time to make a box with drawing paper, but I would like to see if the rectangular drawing paper I prepared can make a rectangular parallelepiped. However, do not cut or ... | {"inputs": ["2 2\n2 3\n2 3\n2 3\n2 2\n3 2", "2 2\n2 3\n2 3\n2 3\n2 2\n2 2", "2 2\n2 3\n2 3\n2 3\n2 2\n5 2", "2 2\n2 3\n2 2\n2 3\n2 2\n2 2", "2 2\n2 3\n2 3\n2 2\n2 2\n5 2", "2 2\n2 3\n2 2\n2 3\n2 2\n2 3", "2 2\n2 3\n2 3\n2 2\n2 2\n10 2", "2 2\n2 3\n4 2\n2 3\n2 2\n2 3", "2 2\n2 3\n2 2\n2 2\n2 2\n10 2", "2 2\n2 3\n4 4\n2 ... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
15c9898a16e6cc297524740da5308dcc | p00490 Best Pizza | problem
Chairman K is a regular customer of the JOI pizza shop in the center of JOI city. For some reason, he decided to start a life-saving life this month. So he wanted to order the pizza with the highest calories per dollar among the pizzas he could order at the JOI pizza store. Let's call such a pizza the "best pi... | {"inputs": ["3\n12 2\n200\n50\n300\n100", "3\n12 2\n200\n50\n300\n110", "3\n17 2\n200\n73\n300\n110", "3\n12 2\n200\n50\n599\n100", "3\n12 2\n200\n73\n575\n110", "3\n17 2\n200\n50\n300\n010", "3\n17 2\n63\n50\n300\n010", "3\n12 2\n200\n54\n506\n110", "3\n17 2\n38\n50\n300\n010", "3\n12 2\n358\n87\n575\n010", "3\n12 2\n... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
073b66100b0a7722bc531069c7183a79 | p00676 KND is So Sexy | Problem
KND is a student programmer at the University of Aizu. His chest is known to be very sexy.
<image>
For simplicity, the part of the skin that can be seen from the chest is represented by the isosceles triangle ABC in the figure. However, due to the slack in the clothes, the two sides AC and BC (where these l... | {"inputs": ["2 2 1\n2 3 1\n3 2 3\n2 3 5", "2 2 1\n2 3 1\n3 2 3\n1 3 5", "4 2 1\n2 3 1\n3 2 3\n1 3 5", "2 2 1\n2 3 1\n3 2 5\n1 3 5", "2 2 0\n2 3 1\n3 2 3\n2 3 5", "2 2 1\n2 3 1\n1 2 3\n1 3 5", "4 2 1\n2 3 1\n3 2 3\n1 3 0", "2 2 1\n2 3 1\n1 2 5\n1 3 5", "2 2 0\n2 3 0\n3 2 3\n2 3 5", "3 2 1\n2 3 1\n1 2 3\n1 3 5", "4 2 1\n... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
70deaaf9d423105e91300226528674b6 | p00819 Unreliable Message | The King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King’s statement, six servants were selected as messengers whose names were Mr. J, Miss C, Mr. E, Mr. A... | {"inputs": ["5\nAJMP\naB23d\nE\n86AE\nAM\n6\nJPEM\nWaEaETC302Q\nCP\nrTurnAGundam1isdefferentf", "5\nAJMP\naB33d\nE\n86AE\nAM\n6\nJPEM\nWaEaETC302Q\nCP\nrTurnAGundam1isdefferentf", "5\nAJMP\naB33d\nE\n86AE\nAM\n6\nEPJM\nWaEaETC302Q\nCP\nrTurnAGundam1isdefferentf", "5\nAJMP\naB33d\nE\n86AE\nAM\n0\nEPJM\nWaEaETC302Q\nCP\n... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
3b1299f62cb9ba12e49dbac56fb69a56 | p01083 RedBlue | Story
At UZIA High School in the sky city AIZU, the club activities of competitive programming are very active. N Red Coders and n Blue Coders belong to this club.
One day, during club activities, Red Coder and Blue Coder formed a pair, and from this club activity, n groups participated in a contest called KCP. At th... | {"inputs": ["2\n3 3 2\n8 3 2\n3 0\n3 7\n8 0\n8 7", "2\n3 3 2\n8 3 2\n0 3\n3 7\n8 0\n8 7", "1\n10 10 10\n31 10 10\n15 19\n26 1", "2\n3 3 2\n8 3 2\n0 0\n0 5\n11 0\n11 5", "2\n3 3 2\n8 3 2\n3 0\n3 7\n8 0\n5 7", "2\n3 3 2\n8 3 2\n1 3\n3 7\n8 0\n8 7", "1\n10 10 17\n31 10 10\n15 19\n26 1", "2\n3 3 2\n1 3 2\n0 0\n0 5\n11 0\n1... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
f10ada8d894b50fa20c06656ea88e62e | p01219 Private Teacher | You are working as a private teacher. Since you are giving lessons to many pupils, you are very busy, especially during examination seasons. This season is no exception in that regard.
You know days of the week convenient for each pupil, and also know how many lessons you have to give to him or her. You can give just ... | {"inputs": ["2 2\n6 3\nMonday Tuesday Wednesday\n8 4\nThursday Friday Saturday Sunday\n2 2\n7 3\nMonday Tuesday Wednesday\n9 4\nThursday Friday Saturday Sunday\n0 0", "2 2\n6 3\nMonday Tuesday Wednesday\n8 4\nThursday Friday Saturday Sunday\n2 2\n7 3\nMonday Tuesday Wednesday\n9 4\nTsurhday Friday Saturday Sunday\n0 0"... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
1211d0774965e9c47a46bb683e815b6c | p01353 Rabbit Plays Games! | A rabbit is playing a role-playing game. Just before entering the castle, he was ambushed by an enemy!
It was a battle between one hero operated by a rabbit and n enemies. Each character has four stats, health hi, attack power ai, defense power di, and agility si. I = 0 is the information of the main character, 1 ≤ i ... | {"inputs": ["1\n1 1 1 1\n10000 10000 10000 10000", "2\n10 3 1 2\n2 4 1 3\n2 2 1 1", "1\n1 0 1 1\n10000 10000 10000 10000", "2\n10 3 1 2\n2 4 1 3\n1 2 1 1", "2\n10 3 1 2\n2 4 1 3\n1 3 1 1", "2\n10 3 1 2\n3 4 1 3\n1 3 1 1", "2\n10 3 2 2\n3 4 1 3\n1 3 1 1", "1\n1 0 1 1\n10000 10010 10000 10000", "1\n1 0 1 1\n10000 10010 1... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
332b361e243e08443ab4f698c8b8c9cc | p01535 Markup language has Declined | E: Markup language has declined
It's been centuries since we humans have been declining slowly. The earth may already belong to "Progurama". Programa-sans with an average height of 170 cm, 7 heads, high intelligence, and loves Kodingu. I have returned to my hometown of Nibunki, becoming an important international civi... | {"inputs": ["1\nindex.dml\n<dml><title>Markup language has Declined</title><br>Programmers world</dml>\n1\n15 3 0 index", "1\nindex.dml\n<dml><title>Markup aangulge has Declined</title><br>Programmers world</dml>\n1\n15 3 0 index", "1\nindex.dml\n<dml><title>Markup aangulge sah Declined</title><br>Programmers world</dm... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
1cf42c6564f4a12995bf38481040b4a1 | p01691 Disappear Drive | E --Disappear Drive
Story
The person in D likes basketball, but he likes shooting, so other techniques are crazy. I'm not particularly good at dribbling, and when I enter the opponent's defensive range, I always get the ball stolen. So I decided to come up with a deadly dribble that would surely pull out any opponent... | {"inputs": ["1 0\n25 47 10", "1 0\n25 47 15", "1 0\n16 47 15", "1 0\n31 47 15", "2 0\n31 47 13", "2 0\n31 47 20", "2 0\n31 47 33", "1 0\n25 38 10", "1 0\n25 61 15", "1 0\n16 57 15", "1 0\n31 18 15", "2 0\n31 47 11", "2 0\n1 47 20", "1 0\n25 58 10", "2 0\n31 49 11", "1 0\n25 47 4", "1 0\n14 47 15", "1 0\n31 66 15", "1 0... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
bf1aaff0df3a6cc19bf92a0cb3721d99 | p01970 The Diversity of Prime Factorization | D: The Diversity of Prime Factorization
Problem
Ebi-chan has the FACTORIZATION MACHINE, which can factorize natural numbers M (greater than 1) in O ($ \ log $ M) time! But unfortunately, the machine could display only digits and white spaces.
In general, we consider the factorization of M as p_1 ^ {e_1} \ times p_2 ... | {"inputs": ["3\n2 3 3", "3\n2 3 6", "3\n2 3 11", "3\n3 2 3", "3\n2 5 3", "3\n2 2 3", "3\n2 2 11", "3\n3 2 6", "3\n2 2 13", "3\n4 2 6", "3\n2 2 0", "3\n4 2 2", "3\n3 2 0", "3\n2 2 2", "3\n2 3 2", "3\n2 1 2", "3\n2 1 0", "3\n2 2 1", "3\n4 2 1", "3\n4 3 3", "3\n3 2 4", "3\n2 3 17", "3\n4 2 4", "3\n2 1 1", "3\n2 2 15", "3\... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
7d8caa1b1a6fb51eec3987d9dda082f8 | p02117 Picnic | Problem
Tomorrow is finally the day of the excursion to Maizu Elementary School. Gatcho, who attends Maizu Elementary School, noticed that he had forgotten to buy tomorrow's sweets because he was so excited. Gaccho wants to stick to sweets so that he can enjoy the excursion to the fullest.
Gaccho gets a $ X $ yen al... | {"inputs": ["3 10 10\n1\n1 1 1\n1\n3 3 3\n1\n5 5 5\n0 1 0\n1 0 0\n0 1 0", "4 59 40\n1\n7 6 3\n1\n10 3 9\n2\n9 8 5\n7 6 10\n4\n8 2 9\n1 7 1\n7 7 9\n1 2 3\n0 28 7 26\n14 0 10 24\n9 6 0 21\n9 24 14 0", "1 10 10\n3\n1 10 1\n2 20 2\n3 30 3\n0", "2 10 10\n3\n1 10 1\n2 20 2\n3 30 3\n1\n5 200 1\n0 2\n3 0", "3 10 10\n1\n1 1 1\n... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
791a50b9985599f9f24ebc72ef0586c9 | p02257 Prime Numbers | A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
Write a program which reads a list of N integers and prints the number of prime numbers in the list.
Constraints
1 ≤ N ≤ 10000
2 ≤ an element of the ... | {"inputs": ["5\n2\n3\n4\n5\n6", "11\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17", "11\n7\n8\n9\n10\n11\n12\n13\n14\n27\n16\n17", "11\n7\n8\n9\n10\n11\n22\n13\n2\n27\n8\n17", "5\n2\n4\n7\n5\n6", "11\n7\n8\n9\n26\n15\n22\n2\n14\n27\n8\n27", "11\n14\n8\n9\n26\n15\n22\n2\n14\n27\n8\n27", "11\n7\n10\n9\n10\n11\n13\n17\n3\n15\n... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
cd5d4808267e19e1a9cfb988814a0ba4 | p02405 Print a Chessboard | Draw a chessboard which has a height of H cm and a width of W cm. For example, the following figure shows a chessboard which has a height of 6 cm and a width of 10 cm.
.#.#.#.#.
.#.#.#.#.#
.#.#.#.#.
.#.#.#.#.#
.#.#.#.#.
.#.#.#.#.#
Note that the top left corner should be drawn by '#'.
Constraints
* 1 ≤ H ≤ 300
* 1... | {"inputs": ["3 4\n5 6\n3 3\n2 2\n1 1\n0 0", "3 4\n5 6\n3 3\n2 2\n1 0\n0 0", "3 7\n5 6\n3 3\n2 2\n1 0\n0 0", "3 7\n5 6\n3 0\n2 2\n1 0\n0 0", "6 7\n5 6\n3 0\n2 2\n1 0\n0 0", "6 11\n5 6\n3 0\n2 2\n1 0\n0 0", "3 4\n5 6\n2 3\n2 2\n1 1\n0 0", "3 4\n5 6\n3 3\n2 4\n1 0\n0 0", "3 7\n5 6\n4 3\n2 2\n1 0\n0 0", "3 7\n5 5\n3 0\n2 2... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
1119d9e9f752278a12d77ccc1cd016bc | anuwta | There are N+1 lights. Lights are placed at (0, 0), (1, 0), (2, 0) ... (N, 0). Initially all the lights are on. You want to turn off all of them one after one. You want to follow a special pattern in turning off the lights.
You will start at (0, 0). First, you walk to the right most light that is on, turn it off. Th... | {"inputs": ["2\n1\n2", "2\n1\n4", "2\n2\n4", "2\n2\n1", "2\n0\n1", "2\n0\n2", "2\n2\n2", "2\n4\n2", "2\n2\n3", "2\n3\n2", "2\n0\n0", "2\n-1\n0", "2\n-1\n-1", "2\n-3\n-1", "2\n-3\n-6", "2\n-4\n0", "2\n-1\n2", "2\n-1\n1", "2\n1\n1", "2\n2\n0", "2\n4\n0", "2\n4\n1", "2\n3\n1", "2\n-1\n3", "2\n-13\n1", "2\n-13\n2", "2\n-15... | 2 | [
"PYTHON3"
] | 1 | 2 | code_contests | |
91761061defa25721647de3baf70cd05 | chsparr | Chef has a an array A consisting of N elements. He wants to add some elements into the array as per the below mentioned process.
After each minute, Chef iterates over the array in order from left to right, and takes every two neighbouring pair of elements, say x and y, he adds a new element x + y in the middle of eleme... | {"inputs": ["2\n3 1 1 5\n1 6 9\n3 2 6 7\n1 6 9"], "outputs": ["38\n36"]} | 3 | [
"PYTHON3"
] | 1 | 2 | code_contests | |
3e9bd6deebe3508005ffd64d831d425c | etmx05 | Middle Strings
Miss Roma has got a new job in a computer agency. To test her skills the manager has appointed her with a small project.
She will get a string of any length but of ODD length and what she has to do
is finding a center string of length 3 in the original string.
For Example: She gets a string 'CANDY' the... | {"inputs": ["CANDY", "SOLVING"], "outputs": ["AND", "LVI"]} | 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.