Search is not available for this dataset
problem_id
stringlengths
32
32
name
stringlengths
2
112
problem
stringlengths
200
14k
test_cases
stringlengths
33
79.2M
difficulty
stringclasses
33 values
language
listlengths
1
1
source
stringclasses
14 values
num_solutions
int64
2
1.9M
starter_code
stringlengths
0
1.47k
subset
stringclasses
3 values
bce7376923bf4b4ff5d9c5f08fdf082b
ig01
This is a simple game you must have played around with during your school days, calculating FLAMES of you and your crush! Given the names of two people, cancel out the common letters (repeated occurrence of a letter is treated separately, so 2A's in one name and one A in the other would cancel one A in each name), coun...
{"inputs": ["2\nSHILPA\nAAMIR\nMATT\nDENISE"], "outputs": ["ENEMIES\nLOVE"]}
6
[ "PYTHON3" ]
1
2
code_contests
ac1a582eadf69793244c610253700997
muffins3
Now that Chef has finished baking and frosting his cupcakes, it's time to package them. Chef has N cupcakes, and needs to decide how many cupcakes to place in each package. Each package must contain the same number of cupcakes. Chef will choose an integer A between 1 and N, inclusive, and place exactly A cupcakes into ...
{"inputs": ["2\n2\n5", "2\n2\n7", "2\n2\n3", "2\n1\n3", "2\n3\n5", "2\n4\n4", "2\n3\n8", "2\n4\n7", "2\n4\n8", "2\n2\n16", "2\n2\n14", "2\n4\n14", "2\n7\n14", "2\n4\n3", "2\n7\n26", "2\n4\n26", "2\n4\n46", "2\n2\n46", "2\n1\n5", "2\n1\n46", "2\n1\n8", "2\n1\n1", "2\n2\n1", "2\n1\n7", "2\n4\n10", "2\n8\n2", "2\n7\n8", "...
1
[ "PYTHON3" ]
1
2
code_contests
e93b462bc7993c35847d3243200611a8
rrcode
You are given a simple code of a function and you would like to know what it will return. F(N, K, Answer, Operator, A[N]) returns int; begin for iK do for jN do AnswerAnswer operator Aj) return Answer end Here N, K, Answer and the value returned by the function F are integers;...
{"inputs": ["3\n3 1 0\n1 2 3\nXOR\n3 1 0\n1 2 3\nAND\n3 1 0\n1 2 3\nOR", "3\n3 1 0\n1 2 6\nXOR\n3 1 0\n1 2 3\nAND\n3 1 0\n1 2 3\nOR", "3\n3 1 0\n1 2 3\nXOR\n3 1 0\n1 2 3\nAND\n3 1 0\n1 2 4\nOR", "3\n3 1 0\n1 3 3\nXOR\n3 1 0\n1 2 3\nAND\n3 1 0\n1 2 4\nOR", "3\n3 1 0\n1 3 3\nXOR\n3 1 0\n1 2 3\nAND\n3 1 0\n0 2 4\nOR", "3\...
2
[ "PYTHON3" ]
1
2
code_contests
a737585c8a761a4ea3f4579e12d822c0
walk
Chef and his girlfriend are going to have a promenade. They are walking along the straight road which consists of segments placed one by one. Before walking Chef and his girlfriend stay at the beginning of the first segment, they want to achieve the end of the last segment. There are few problems: At the beginning ...
{"inputs": ["2\n5\n6 5 4 3 2\n5\n3 4 3 1 1", "2\n5\n6 5 4 3 2\n5\n3 4 6 1 1", "2\n5\n6 5 4 3 2\n5\n3 7 9 1 1", "2\n5\n6 5 4 3 3\n5\n3 7 9 1 1", "2\n5\n6 5 4 3 2\n5\n3 8 3 1 1", "2\n5\n6 5 4 5 2\n5\n3 7 6 1 1", "2\n5\n6 5 4 4 2\n5\n3 8 3 1 1", "2\n5\n6 5 2 3 0\n5\n3 4 12 1 1", "2\n5\n6 6 2 3 0\n5\n3 4 12 1 1", "2\n5\n6 ...
2
[ "PYTHON3" ]
1
2
code_contests
c631bb6fd228201e5544b933697ba1cc
101_C. Vectors
At a geometry lesson Gerald was given a task: to get vector B out of vector A. Besides, the teacher permitted him to perform the following operations with vector А: * Turn the vector by 90 degrees clockwise. * Add to the vector a certain vector C. Operations could be performed in any order any number of times. ...
{"inputs": ["0 0\n1 1\n1 1\n", "0 0\n1 1\n0 1\n", "0 0\n1 1\n2 2\n", "3 1\n-2 3\n-2 -2\n", "-8916 9282\n2666 2344\n9109 -2730\n", "0 45\n42 -47\n-51 -82\n", "45 6\n65 5\n0 5\n", "3 4\n-4 3\n1 7\n", "-75629161 -68114618\n23285096 90997125\n84795646 72358903\n", "2 3\n2 3\n0 0\n", "-3 11\n6154942 80496611\n5 0\n", "1 0\n...
9
[ "PYTHON3" ]
2
2
code_contests
26dbd46c3469f27ce1d2b27b0d20ed12
1043_A. Elections
Awruk is taking part in elections in his school. It is the final round. He has only one opponent — Elodreip. The are n students in the school. Each student has exactly k votes and is obligated to use all of them. So Awruk knows that if a person gives a_i votes for Elodreip, than he will get exactly k - a_i votes from t...
{"inputs": ["5\n2 2 3 2 2\n", "5\n1 1 1 5 1\n", "3\n1 2 6\n", "10\n7 7 7 7 7 7 7 7 7 7\n", "76\n13 13 5 6 20 20 6 1 18 18 13 15 20 3 9 11 3 11 3 8 12 15 2 4 16 17 8 11 15 6 6 5 3 12 19 15 17 8 5 20 12 6 9 7 20 15 8 7 5 17 9 12 12 17 12 16 2 6 16 16 17 18 6 7 19 13 6 3 8 16 13 7 1 14 11 9\n", "100\n100 100 100 100 100 1...
7
[ "PYTHON3" ]
2
2
code_contests
67d8677178465f4363cb06388cfe5bdd
1065_F. Up and Down the Tree
You are given a tree with n vertices; its root is vertex 1. Also there is a token, initially placed in the root. You can move the token to other vertices. Let's assume current vertex of token is v, then you make any of the following two possible moves: * move down to any leaf in subtree of v; * if vertex v is a ...
{"inputs": ["8 2\n1 1 2 3 4 5 5\n", "7 1\n1 1 3 3 4 4\n", "30 2\n26 11 22 16 14 29 16 14 8 23 21 22 11 24 15 23 22 1 11 20 23 29 13 19 19 15 13 2 7\n", "30 1\n19 20 10 21 9 26 20 21 30 12 25 25 2 1 10 3 19 12 18 12 30 18 22 1 18 18 30 30 12\n", "30 1\n1 22 24 24 2 25 5 2 22 3 1 1 26 22 15 16 17 24 24 3 24 26 9 2 5 26 4...
12
[ "PYTHON3" ]
2
2
code_contests
357fd2c3e828cae8d0a6182d2d7af836
1088_D. Ehab and another another xor problem
This is an interactive problem! Ehab plays a game with Laggy. Ehab has 2 hidden integers (a,b). Laggy can ask a pair of integers (c,d) and Ehab will reply with: * 1 if a ⊕ c>b ⊕ d. * 0 if a ⊕ c=b ⊕ d. * -1 if a ⊕ c<b ⊕ d. Operation a ⊕ b is the [bitwise-xor operation](https://en.wikipedia.org/wiki/Bitwise...
{"inputs": ["1\n-1\n0", "0 1073741823\n", "10 5\n", "16384 36739846\n", "727373493 346368330\n", "62914844 1044381411\n", "683909153 117987356\n", "534364885 625821414\n", "1063413663 0\n", "56797 6710886\n", "153391689 613566756\n", "450278829 900557658\n", "0 0\n", "477584543 68158472\n", "89478485 214748364\n", "306...
10
[ "PYTHON3" ]
2
2
code_contests
80abd6d4c1daef7cd344435901ed9546
1107_D. Compression
You are given a binary matrix A of size n × n. Let's denote an x-compression of the given matrix as a matrix B of size n/x × n/x such that for every i ∈ [1, n], j ∈ [1, n] the condition A[i][j] = B[⌈ i/x ⌉][⌈ j/x ⌉] is met. Obviously, x-compression is possible only if x divides n, but this condition is not enough. For...
{"inputs": ["8\nE7\nE7\nE7\n00\n00\nE7\nE7\nE7\n", "4\n7\nF\nF\nF\n", "8\nFF\nFF\n00\n00\nFF\nFF\n00\n00\n", "4\n0\n0\n0\n1\n", "8\n33\n33\n33\n33\n33\n33\n11\n11\n", "16\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\nFFC0\n", "12\nE38\nE38\nE38\nE38\nE38\nE38\nE38\nE38\nE38\...
10
[ "PYTHON3" ]
2
2
code_contests
85ec5d1970c56195d5b54da7b4628eef
1136_D. Nastya Is Buying Lunch
At the big break Nastya came to the school dining room. There are n pupils in the school, numbered from 1 to n. Unfortunately, Nastya came pretty late, so that all pupils had already stood in the queue, i.e. Nastya took the last place in the queue. Of course, it's a little bit sad for Nastya, but she is not going to de...
{"inputs": ["5 2\n3 1 5 4 2\n5 2\n5 4\n", "3 3\n3 1 2\n1 2\n3 1\n3 2\n", "2 1\n1 2\n1 2\n", "10 23\n6 9 8 10 4 3 7 1 5 2\n7 2\n3 2\n2 4\n2 3\n7 5\n6 4\n10 7\n7 1\n6 8\n6 2\n8 10\n3 5\n3 1\n6 1\n10 2\n8 2\n10 1\n7 4\n10 5\n6 9\n6 5\n9 1\n10 4\n", "2 0\n1 2\n", "3 2\n1 2 3\n1 2\n2 1\n", "10 20\n2 1 3 9 5 4 7 8 6 10\n4 7\...
10
[ "PYTHON3" ]
2
2
code_contests
266d9ddefc67899000279f6c1aabbb92
1155_A. Reverse a Substring
You are given a string s consisting of n lowercase Latin letters. Let's define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in position 3 and ends in position 6), but "aa" or "d" aren't substrings of this string. So the substring of the string s from po...
{"inputs": ["7\nabacaba\n", "6\naabcfg\n", "6\nbabcdc\n", "5\nbadec\n", "3\naba\n", "7\nbaaaccb\n", "3\naaa\n", "4\npara\n", "3\nbac\n", "7\nbdadccd\n", "2\nba\n", "7\nstoopid\n", "7\nyxyzyyx\n", "3\nacb\n", "7\nbcbcbdc\n", "7\nabacaba\n", "2\naa\n", "12\nparapapapaaa\n", "6\nbabddc\n", "7\nbd`dccd\n", "2\nab\n", "7\nx...
7
[ "PYTHON3" ]
2
2
code_contests
b522f6a1ff40f2f79912b73077cc2d2d
1176_F. Destroy it!
You are playing a computer card game called Splay the Sire. Currently you are struggling to defeat the final boss of the game. The boss battle consists of n turns. During each turn, you will get several cards. Each card has two parameters: its cost c_i and damage d_i. You may play some of your cards during each turn i...
{"inputs": ["5\n3\n1 6\n1 7\n1 5\n2\n1 4\n1 3\n3\n1 10\n3 5\n2 3\n3\n1 15\n2 4\n1 10\n1\n1 100\n", "5\n3\n1 1\n1 1\n1 1\n3\n1 1\n1 1\n1 1\n3\n1 1\n1 1\n1 1\n3\n1 1\n1 1\n1 1\n3\n1 100\n1 1\n1 1\n", "1\n4\n1 1\n1 1\n2 2\n3 4\n", "5\n3\n1 1\n1 1\n1 1\n3\n1 1\n1 1\n1 1\n3\n1 1\n1 1\n1 1\n3\n1 2\n1 1\n1 1\n3\n1 100\n1 1\n1...
12
[ "PYTHON3" ]
2
2
code_contests
37a14cc9a5cf5aefe474b822311fcde5
1195_D2. Submarine in the Rybinsk Sea (hard edition)
This problem differs from the previous one only in the absence of the constraint on the equal length of all numbers a_1, a_2, ..., a_n. A team of SIS students is going to make a trip on a submarine. Their target is an ancient treasure in a sunken ship lying on the bottom of the Great Rybinsk sea. Unfortunately, the st...
{"inputs": ["3\n12 3 45\n", "2\n123 456\n", "20\n76 86 70 7 16 24 10 62 26 29 40 65 55 49 34 55 92 47 43 100\n", "100\n6591 1074 3466 3728 549 5440 533 3543 1536 2967 1587 304 6326 6410 8670 6736 4482 8431 1697 9264 8338 2995 3725 1805 488 4563 4261 6025 2602 1892 9297 4359 1139 7117 1423 4834 5663 7912 1245 9287 3059 ...
10
[ "PYTHON3" ]
2
2
code_contests
3e0864051d0998e54ec5c7cd327f5870
1236_A. Stones
Alice is playing with some stones. Now there are three numbered heaps of stones. The first of them contains a stones, the second of them contains b stones and the third of them contains c stones. Each time she can do one of two operations: 1. take one stone from the first heap and two stones from the second heap (...
{"inputs": ["3\n3 4 5\n1 0 5\n5 3 2\n", "20\n9 4 8\n10 6 7\n4 6 0\n7 7 6\n3 3 10\n4 2 1\n4 4 0\n2 0 0\n8 8 7\n3 1 7\n3 10 7\n1 7 3\n7 9 1\n1 6 9\n0 9 5\n4 0 0\n2 10 0\n4 8 5\n10 0 1\n8 1 1\n", "64\n0 0 0\n0 0 1\n0 0 2\n0 0 3\n0 1 0\n0 1 1\n0 1 2\n0 1 3\n0 2 0\n0 2 1\n0 2 2\n0 2 3\n0 3 0\n0 3 1\n0 3 2\n0 3 3\n1 0 0\n1 0...
7
[ "PYTHON3" ]
2
2
code_contests
47a0e1689e1213af6eef8760f1c81d3c
1253_F. Cheap Robot
You're given a simple, undirected, connected, weighted graph with n nodes and m edges. Nodes are numbered from 1 to n. There are exactly k centrals (recharge points), which are nodes 1, 2, …, k. We consider a robot moving into this graph, with a battery of capacity c, not fixed by the constructor yet. At any time, th...
{"inputs": ["10 9 3 1\n10 9 11\n9 2 37\n2 4 4\n4 1 8\n1 5 2\n5 7 3\n7 3 2\n3 8 4\n8 6 13\n2 3\n", "9 11 3 2\n1 3 99\n1 4 5\n4 5 3\n5 6 3\n6 4 11\n6 7 21\n7 2 6\n7 8 4\n8 9 3\n9 2 57\n9 3 2\n3 1\n2 3\n", "30 35 4 30\n14 2 7\n22 23 2\n5 26 3\n28 4 3\n7 5 29\n19 15 2\n11 20 12\n1 22 9\n30 21 24\n24 11 9\n29 2 1\n12 27 4\n...
12
[ "PYTHON3" ]
2
2
code_contests
6821830bc4d662c62a61ea02dc02d056
1277_E. Two Fairs
There are n cities in Berland and some pairs of them are connected by two-way roads. It is guaranteed that you can pass from any city to any other, moving along the roads. Cities are numerated from 1 to n. Two fairs are currently taking place in Berland — they are held in two different cities a and b (1 ≤ a, b ≤ n; a ...
{"inputs": ["3\n7 7 3 5\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 5\n4 5 2 3\n1 2\n2 3\n3 4\n4 1\n4 2\n4 3 2 1\n1 2\n2 3\n4 1\n", "3\n7 7 3 5\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 5\n4 5 2 4\n1 2\n2 3\n3 4\n4 1\n4 2\n4 3 2 1\n1 2\n2 3\n4 1\n", "3\n7 7 3 5\n1 2\n2 3\n3 4\n2 5\n5 6\n6 7\n7 5\n4 5 2 4\n1 2\n2 3\n3 4\n4 1\n4 2\n4 3 2 1\...
11
[ "PYTHON3" ]
2
2
code_contests
dce95a827ce754267717836e259a45ae
1320_F. Blocks and Sensors
Polycarp plays a well-known computer game (we won't mention its name). Every object in this game consists of three-dimensional blocks — axis-aligned cubes of size 1 × 1 × 1. These blocks are unaffected by gravity, so they can float in the air without support. The blocks are placed in cells of size 1 × 1 × 1; each cell ...
{"inputs": ["1 1 1\n\n0\n\n0\n\n1337\n\n0\n\n0\n\n0\n", "1 1 1\n\n1337\n\n1337\n\n1337\n\n1337\n\n1337\n\n1337\n", "1 1 1\n\n0\n\n0\n\n0\n\n0\n\n0\n\n0\n", "4 3 2\n\n1 4\n3 2\n6 5\n\n1 4\n3 2\n6 7\n\n1 4\n1 4\n0 0\n0 7\n\n6 5\n6 5\n0 0\n0 7\n\n1 3 6\n1 3 6\n0 0 0\n0 0 7\n\n4 3 5\n4 2 5\n0 0 0\n0 0 7\n", "1 1 1\n\n0\n\n...
12
[ "PYTHON3" ]
2
2
code_contests
7e03d597da7e9535150c9be1537772e7
133_D. Piet
Piet is one of the most known visual esoteric programming languages. The programs in Piet are constructed from colorful blocks of pixels and interpreted using pretty complicated rules. In this problem we will use a subset of Piet language with simplified rules. The program will be a rectangular image consisting of col...
{"inputs": ["5 9\n10345\n23456\n34567\n45678\n56789\n", "2 10\n12\n43\n", "3 12\n1423\n6624\n6625\n", "49 749442\n8888888\n8888888\n8888888\n5777777\n5777777\n5777777\n5777777\n5777777\n5777777\n5777777\n5777777\n5777777\n5111111\n5111111\n5666666\n5666666\n5666666\n5666666\n5666666\n5666666\n5666666\n5666666\n5666666\...
10
[ "PYTHON3" ]
2
2
code_contests
d1edf2c5177303aeb4577f699c035036
1361_E. James and the Chase
James Bond has a new plan for catching his enemy. There are some cities and directed roads between them, such that it is possible to travel between any two cities using these roads. When the enemy appears in some city, Bond knows her next destination but has no idea which path she will choose to move there. The city ...
{"inputs": ["4\n3 3\n1 2\n2 3\n3 1\n3 6\n1 2\n2 1\n2 3\n3 2\n1 3\n3 1\n7 10\n1 2\n2 3\n3 1\n1 4\n4 5\n5 1\n4 6\n6 7\n7 4\n6 1\n6 8\n1 2\n2 3\n3 4\n4 5\n5 6\n6 1\n6 2\n5 1\n", "4\n3 3\n1 2\n2 3\n3 1\n3 6\n1 2\n2 1\n2 3\n3 2\n1 3\n3 1\n7 10\n1 2\n2 3\n3 1\n1 4\n4 5\n5 1\n4 6\n6 7\n7 4\n6 1\n6 8\n1 2\n2 3\n3 4\n4 5\n4 6\n...
11
[ "PYTHON3" ]
2
2
code_contests
e39f08aab074ed7df7066814503683ed
1382_A. Common Subsequence
You are given two arrays of integers a_1,…,a_n and b_1,…,b_m. Your task is to find a non-empty array c_1,…,c_k that is a subsequence of a_1,…,a_n, and also a subsequence of b_1,…,b_m. If there are multiple answers, find one of the smallest possible length. If there are still multiple of the smallest possible length, f...
{"inputs": ["5\n4 5\n10 8 6 4\n1 2 3 4 5\n1 1\n3\n3\n1 1\n3\n2\n5 3\n1000 2 2 2 3\n3 1 5\n5 5\n1 2 3 4 5\n1 2 3 4 5\n", "1\n2 2\n1 1\n1 2\n", "1\n1 3\n3\n1 2 3\n", "1\n1 1\n1000\n1000\n", "1\n2 2\n2 2\n2 2\n", "5\n4 5\n10 8 6 4\n1 2 3 4 5\n1 1\n3\n3\n1 1\n3\n2\n5 3\n1000 2 2 2 3\n3 1 5\n5 5\n1 2 3 4 5\n1 2 3 4 5\n", "1...
7
[ "PYTHON3" ]
2
2
code_contests
10a3dfc01080d7a8925ab48519bcc8aa
1424_N. BubbleSquare Tokens
BubbleSquare social network is celebrating 13^{th} anniversary and it is rewarding its members with special edition BubbleSquare tokens. Every member receives one personal token. Also, two additional tokens are awarded to each member for every friend they have on the network. Yet, there is a twist – everyone should end...
{"inputs": ["2 1\n1 2\n", "3 3\n1 2\n1 3\n2 3\n", "2 0\n1 2\n", "2 1\n1 3\n", "3 3\n1 2\n1 5\n2 3\n", "2 0\n1 0\n", "4 0\n1 0\n", "4 0\n1 -1\n", "0 0\n1 2\n", "2 0\n1 1\n", "6 0\n1 0\n", "4 0\n0 -1\n", "0 0\n1 0\n", "8 0\n0 -1\n", "0 -1\n1 0\n", "8 0\n0 0\n", "0 -1\n1 -1\n", "-1 -1\n1 -1\n", "-1 -1\n1 0\n", "-1 0\n1 0\...
21
[ "PYTHON3" ]
2
2
code_contests
5dd2344fdbe78bba3f0aa2a4287a6deb
1446_D2. Frequency Problem (Hard Version)
This is the hard version of the problem. The difference between the versions is in the constraints on the array elements. You can make hacks only if all versions of the problem are solved. You are given an array [a_1, a_2, ..., a_n]. Your goal is to find the length of the longest subarray of this array such that the...
{"inputs": ["7\n1 1 2 2 3 3 3\n", "10\n1 1 1 5 4 1 3 1 2 2\n", "1\n1\n", "100\n92 53 86 41 77 68 80 54 17 96 89 53 64 55 2 80 28 58 77 43 70 91 71 71 78 3 25 2 15 47 60 70 95 19 47 58 57 47 91 2 23 80 86 98 98 98 57 98 98 25 98 98 57 98 98 98 98 98 25 98 98 98 98 98 57 98 98 25 98 98 57 98 98 57 98 98 25 98 98 34 98 98...
10
[ "PYTHON3" ]
2
2
code_contests
5e6b0a836714c113e0e195133bef9cc9
1470_E. Strange Permutation
Alice had a permutation p_1, p_2, …, p_n. Unfortunately, the permutation looked very boring, so she decided to change it and choose some non-overlapping subranges of this permutation and reverse them. The cost of reversing a single subrange [l, r] (elements from position l to position r, inclusive) is equal to r - l, a...
{"inputs": ["2\n3 1 9\n1 2 3\n1 1\n2 1\n3 1\n1 2\n2 2\n3 2\n1 3\n2 3\n3 3\n6 4 4\n6 5 4 3 1 2\n1 1\n3 14\n1 59\n2 6\n", "1\n12 4 2\n1 2 3 4 5 6 7 8 9 10 11 12\n2 20\n2 21\n", "1\n10 2 20\n8 5 2 4 10 3 9 7 1 6\n5 10\n3 17\n6 31\n3 46\n10 42\n7 19\n9 36\n7 3\n3 13\n8 32\n10 25\n9 34\n10 34\n6 33\n3 9\n2 17\n4 5\n10 44\n9...
11
[ "PYTHON3" ]
2
2
code_contests
932989f0c4e7a164d820acee410781d2
1497_D. Genius
Please note the non-standard memory limit. There are n problems numbered with integers from 1 to n. i-th problem has the complexity c_i = 2^i, tag tag_i and score s_i. After solving the problem i it's allowed to solve problem j if and only if IQ < |c_i - c_j| and tag_i ≠ tag_j. After solving it your IQ changes and be...
{"inputs": ["5\n4\n1 2 3 4\n5 10 15 20\n4\n1 2 1 2\n5 10 15 20\n4\n2 2 4 1\n2 8 19 1\n2\n1 1\n6 9\n1\n1\n666\n", "5\n4\n1 2 3 4\n5 10 15 20\n4\n1 2 1 2\n5 10 15 20\n4\n2 2 4 1\n2 8 19 2\n2\n1 1\n6 9\n1\n1\n666\n", "5\n4\n1 2 3 4\n5 10 15 20\n4\n1 2 2 2\n5 10 15 20\n4\n2 2 4 1\n2 8 19 2\n2\n1 1\n6 9\n1\n1\n666\n", "5\n4...
10
[ "PYTHON3" ]
2
2
code_contests
883b5f5bd63b05598601043dfcf5abd3
151_C. Win or Freeze
You can't possibly imagine how cold our friends are this winter in Nvodsk! Two of them play the following game to warm up: initially a piece of paper has an integer q. During a move a player should write any integer number that is a non-trivial divisor of the last written number. Then he should run this number of circl...
{"inputs": ["1\n", "6\n", "30\n", "8587340257\n", "9\n", "81\n", "27\n", "1408514752349\n", "25\n", "49380563\n", "266418\n", "319757451841\n", "6599669076000\n", "8\n", "1000000000000\n", "30971726\n", "274875809788\n", "64\n", "34280152201\n", "236\n", "472670214391\n", "7938986881993\n", "44\n", "4\n", "388\n", "2\n...
9
[ "PYTHON3" ]
2
2
code_contests
f3b98a7c63fb2df97c66e90bddb6c1b8
1547_C. Pair Programming
Monocarp and Polycarp are learning new programming techniques. Now they decided to try pair programming. It's known that they have worked together on the same file for n + m minutes. Every minute exactly one of them made one change to the file. Before they started, there were already k lines written in the file. Ever...
{"inputs": ["5\n\n3 2 2\n2 0\n0 5\n\n4 3 2\n2 0 5\n0 6\n\n0 2 2\n1 0\n2 3\n\n5 4 4\n6 0 8 0\n0 7 0 9\n\n5 4 1\n8 7 8 0\n0\n", "5\n\n3 2 2\n2 0\n0 5\n\n4 3 2\n2 0 5\n0 6\n\n0 2 2\n1 0\n2 3\n\n5 4 4\n6 0 8 0\n0 7 0 9\n\n5 4 1\n8 7 8 0\n0\n", "5\n\n3 2 2\n2 0\n0 5\n\n4 3 2\n2 1 5\n0 6\n\n0 2 2\n1 0\n2 3\n\n5 4 4\n6 0 8 0\...
9
[ "PYTHON3" ]
2
2
code_contests
772ecbb56cbef9832da4652d9d5d17bf
174_E. Ancient Berland Hieroglyphs
Polycarpus enjoys studying Berland hieroglyphs. Once Polycarp got hold of two ancient Berland pictures, on each of which was drawn a circle of hieroglyphs. We know that no hieroglyph occurs twice in either the first or the second circle (but in can occur once in each of them). Polycarpus wants to save these pictures o...
{"inputs": ["5 4\n1 2 3 4 5\n1 3 5 6\n", "3 3\n1 2 3\n3 2 1\n", "4 6\n1 3 5 2\n1 2 3 4 5 6\n", "1 1\n1\n2\n", "6 3\n1 2 3 4 5 6\n3 5 1\n", "5 5\n5 6 3 2 1\n4 3 1 5 6\n", "1 1\n1\n1\n", "10 10\n1 2 3 4 5 6 7 8 9 10\n6 7 8 9 10 1 2 3 4 5\n", "1 2\n1\n1 2\n", "10 10\n9 12 15 2 4 14 1 5 6 13\n12 11 13 1 4 3 8 2 14 15\n", "...
11
[ "PYTHON3" ]
2
2
code_contests
9f40a1943373f004c71fbb700b6a5fbc
195_A. Let's Watch Football
Valeric and Valerko missed the last Euro football game, so they decided to watch the game's key moments on the Net. They want to start watching as soon as possible but the connection speed is too low. If they turn on the video right now, it will "hang up" as the size of data to watch per second will be more than the si...
{"inputs": ["10 3 2\n", "13 12 1\n", "4 1 1\n", "993 992 991\n", "100 1 10\n", "960 935 994\n", "99 8 99\n", "60 16 1\n", "759 10 258\n", "24 19 9\n", "196 169 144\n", "1000 999 1\n", "945 812 917\n", "1000 100 10\n", "500 300 300\n", "888 777 1000\n", "2 1 4\n", "24 12 12\n", "767 2 514\n", "2 1 2\n", "1000 1 1\n", "5...
7
[ "PYTHON3" ]
2
2
code_contests
67eebdf3a8f45d6aed03223dd9b29dba
219_A. k-String
A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string. You are given a string s, ...
{"inputs": ["2\naazz\n", "3\nabcabcabz\n", "2\naaab\n", "2\nbabac\n", "2\naaaaaabbbb\n", "1\naabaab\n", "2\naabbbbccccccdddddddd\n", "2\nabba\n", "2\naaaazzzz\n", "250\ncececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececec...
7
[ "PYTHON3" ]
2
2
code_contests
80144000270470ee548da299bb4381dc
242_C. King's Path
The black king is standing on a chess field consisting of 109 rows and 109 columns. We will consider the rows of the field numbered with integers from 1 to 109 from top to bottom. The columns are similarly numbered with integers from 1 to 109 from left to right. We will denote a cell of the field that is located in the...
{"inputs": ["3 4 3 10\n3\n3 1 4\n4 5 9\n3 10 10\n", "1 1 2 10\n2\n1 1 3\n2 6 10\n", "5 7 6 11\n3\n5 3 8\n6 7 11\n5 2 5\n", "1 1 1 2\n5\n1000000000 1 10000\n19920401 1188 5566\n1000000000 1 10000\n1 1 10000\n5 100 200\n", "6 15 7 15\n9\n6 15 15\n7 14 14\n6 15 15\n9 14 14\n7 14 16\n6 15 15\n6 15 15\n7 14 14\n8 15 15\n", ...
9
[ "PYTHON3" ]
2
2
code_contests
6f75f0ff09d468cec4217af8eb9fd1d1
268_A. Games
Manao works on a sports TV. He's spent much time watching the football games of some country. After a while he began to notice different patterns. For example, each team has two sets of uniforms: home uniform and guest uniform. When a team plays a game at home, the players put on the home uniform. When a team plays as ...
{"inputs": ["2\n1 2\n1 2\n", "4\n100 42\n42 100\n5 42\n100 5\n", "3\n1 2\n2 4\n3 4\n", "24\n9 83\n90 31\n83 3\n83 3\n21 31\n83 3\n32 31\n12 21\n31 21\n90 32\n32 21\n12 9\n12 31\n9 83\n83 12\n32 3\n32 83\n90 31\n9 32\n31 21\n83 90\n32 21\n21 3\n32 9\n", "25\n91 57\n2 73\n54 57\n2 57\n23 57\n2 6\n57 54\n57 23\n91 54\n91 ...
7
[ "PYTHON3" ]
2
2
code_contests
a45829b9b7eaaa13ec2dd1b3de5d36b8
290_D. Orange
<image> Input The first line of the input is a string (between 1 and 50 characters long, inclusive). Each character will be a letter of English alphabet, lowercase or uppercase. The second line of the input is an integer between 0 and 26, inclusive. Output Output the required string. Examples Input AprilFool 14...
{"inputs": ["AprilFool\n14\n", "qH\n2\n", "nifzlTLaeWxTD\n0\n", "WlwbRjvrOZakKXqecEdlrCnmvXQtLKBsy\n5\n", "LiqWMLEULRhW\n1\n", "kGqopTbelcDUcoZgnnRYXgPCRQwSLoqeIByFWDI\n26\n", "DuFhhnq\n4\n", "aaaaAaaaaaaAAaaAaaAaAaaaAaaaaaAAaaAAAAAaaAaAAAAaAA\n4\n", "VtQISIHREYaEGPustEkzJRN\n20\n", "aaaaaaAAAaaaaAaaAaaAaaaaAAaAAAaaAAa...
10
[ "PYTHON3" ]
2
2
code_contests
a3d006d8ffdde23805851c074c111b7f
316_B2. EKG
In the rush of modern life, people often forget how beautiful the world is. The time to enjoy those around them is so little that some even stand in queues to several rooms at the same time in the clinic, running from one queue to another. (Cultural note: standing in huge and disorganized queues for hours is a native ...
{"inputs": ["6 2\n2 3 0 5 6 0\n", "6 2\n0 0 1 0 4 5\n", "6 1\n2 0 4 0 6 0\n", "4 1\n0 0 0 0\n", "20 20\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "10 4\n0 1 4 2 7 0 10 0 5 8\n", "10 7\n10 8 6 5 0 0 0 4 3 9\n", "10 1\n8 7 0 2 0 10 0 0 3 5\n", "10 7\n7 9 2 10 0 0 0 3 5 1\n", "10 2\n10 0 9 0 0 4 2 6 8 0\n", "10 2\n0 7 0...
8
[ "PYTHON3" ]
2
2
code_contests
e6bb79deab408a5223a556f636a0a884
339_A. Helpful Maths
Xenia the beginner mathematician is a third year student at elementary school. She is now learning the addition operation. The teacher has written down the sum of multiple numbers. Pupils should calculate the sum. To make the calculation easier, the sum only contains numbers 1, 2 and 3. Still, that isn't enough for Xe...
{"inputs": ["2\n", "3+2+1\n", "1+1+3+1+3\n", "2+2+1+1+3\n", "3+1\n", "1+3\n", "2+2+1+1+1+3+1+1+3+3+2+3+1+3+1+1+3+1+1+2+2+2+2+1+2+1+2+1+1+1+3+1+3+2+3+2+3+3+1+1+1+2+3+2+1+3+1+3+2+2\n", "2+2\n", "1+1\n", "2+3+3+1+2+2+2+1+1+2+1+3+2+2+3+3+2+2+3+3+3+1+1+1+3+3+3+2+1+3+2+3+2+1+1+3+3+3+1+2+2+1+2+2+1+2+1+3+1+1\n", "1\n", "1+2+1+...
7
[ "PYTHON3" ]
2
2
code_contests
df403c474d147a62a0cdbd7962061181
361_C. Levko and Array Recovery
Levko loves array a1, a2, ... , an, consisting of integers, very much. That is why Levko is playing with array a, performing all sorts of operations with it. Each operation Levko performs is of one of two types: 1. Increase all elements from li to ri by di. In other words, perform assignments aj = aj + di for all j ...
{"inputs": ["4 5\n1 2 3 1\n2 1 2 8\n2 3 4 7\n1 1 3 3\n2 3 4 8\n", "4 5\n1 2 3 1\n2 1 2 8\n2 3 4 7\n1 1 3 3\n2 3 4 13\n", "4 5\n1 2 3 1\n2 1 2 8\n2 3 4 7\n1 1 3 3\n2 3 4 8\n", "1 4\n1 1 1 2\n2 1 1 6\n1 1 1 1\n2 1 1 7\n", "2 2\n2 1 2 8\n2 1 2 7\n", "97 29\n2 78 82 356152\n2 14 29 430177\n1 59 84 3680\n1 49 89 -2247\n1 92...
9
[ "PYTHON3" ]
2
2
code_contests
672ad1155b0cc01990e03a353d62e30a
385_A. Bear and Raspberry
The bear decided to store some raspberry for the winter. He cunningly found out the price for a barrel of honey in kilos of raspberry for each of the following n days. According to the bear's data, on the i-th (1 ≤ i ≤ n) day, the price for one barrel of honey is going to is xi kilos of raspberry. Unfortunately, the b...
{"inputs": ["6 2\n100 1 10 40 10 40\n", "5 1\n5 10 7 3 20\n", "3 0\n1 2 3\n", "89 1\n50 53 97 41 68 27 53 66 93 19 11 78 46 49 38 69 96 9 43 16 1 63 95 64 96 6 34 34 45 40 19 4 53 8 11 18 95 25 50 16 64 33 97 49 23 81 63 10 30 73 76 55 7 70 9 98 6 36 75 78 3 92 85 75 40 75 55 71 9 91 15 17 47 55 44 35 55 88 53 87 61 22...
7
[ "PYTHON3" ]
2
2
code_contests
ee21c22649e56f63eaeb1c73395d6056
405_E. Graph Cutting
Little Chris is participating in a graph cutting contest. He's a pro. The time has come to test his skills to the fullest. Chris is given a simple undirected connected graph with n vertices (numbered from 1 to n) and m edges. The problem is to cut it into edge-distinct paths of length 2. Formally, Chris has to partiti...
{"inputs": ["3 2\n1 2\n2 3\n", "3 3\n1 2\n2 3\n3 1\n", "8 12\n1 2\n2 3\n3 4\n4 1\n1 3\n2 4\n3 5\n3 6\n5 6\n6 7\n6 8\n7 8\n", "9 12\n1 2\n2 3\n4 5\n5 6\n6 7\n7 8\n1 4\n4 7\n2 5\n5 8\n3 6\n6 9\n", "5 4\n2 1\n3 2\n4 3\n5 4\n", "4 4\n1 2\n2 3\n3 1\n1 4\n", "9 8\n1 9\n2 9\n3 9\n4 9\n5 9\n6 9\n7 9\n8 9\n", "4 3\n3 2\n2 1\n1 ...
11
[ "PYTHON3" ]
2
2
code_contests
ca28b2c23488592b188716089eb93c8a
433_A. Kitahara Haruki's Gift
Kitahara Haruki has bought n apples for Touma Kazusa and Ogiso Setsuna. Now he wants to divide all the apples between the friends. Each apple weights 100 grams or 200 grams. Of course Kitahara Haruki doesn't want to offend any of his friend. Therefore the total weight of the apples given to Touma Kazusa must be equal ...
{"inputs": ["4\n100 100 100 200\n", "3\n100 200 100\n", "9\n100 100 100 200 100 100 200 100 200\n", "3\n100 100 100\n", "7\n200 200 200 100 200 200 200\n", "100\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 10...
7
[ "PYTHON3" ]
2
2
code_contests
9c9cf557c4df74f3c75c15cad55f09c6
455_C. Civilization
Andrew plays a game called "Civilization". Dima helps him. The game has n cities and m bidirectional roads. The cities are numbered from 1 to n. Between any pair of cities there either is a single (unique) path, or there is no path at all. A path is such a sequence of distinct cities v1, v2, ..., vk, that there is a r...
{"inputs": ["6 0 6\n2 1 2\n2 3 4\n2 5 6\n2 3 2\n2 5 3\n1 1\n", "10 3 5\n1 2\n2 3\n1 4\n2 3 6\n1 6\n2 1 6\n2 8 7\n1 10\n", "10 2 6\n1 2\n1 3\n2 1 8\n2 9 2\n1 2\n1 9\n2 3 5\n1 8\n", "10 5 2\n1 2\n1 3\n1 4\n2 5\n1 6\n1 5\n1 8\n", "10 6 64\n1 2\n2 3\n2 4\n4 5\n3 6\n3 7\n2 4 4\n1 4\n1 6\n1 5\n1 8\n2 1 10\n2 6 8\n2 4 2\n1 10...
9
[ "PYTHON3" ]
2
2
code_contests
15f13ad41f1131af03e3b6788e566f35
478_A. Initial Bet
There are five people playing a game called "Generosity". Each person gives some non-zero number of coins b as an initial bet. After all players make their bets of b coins, the following operation is repeated for several times: a coin is passed from one player to some other player. Your task is to write a program that...
{"inputs": ["2 5 4 0 4\n", "4 5 9 2 1\n", "99 100 100 100 100\n", "57 83 11 4 93\n", "99 99 99 99 99\n", "100 0 0 0 0\n", "0 1 2 3 4\n", "93 100 99 90 98\n", "87 38 19 33 100\n", "1 1 1 1 1\n", "0 0 0 0 1\n", "2 3 4 5 6\n", "1 2 1 2 3\n", "0 0 0 0 0\n", "100 100 100 100 100\n", "43 83 1 0 23\n", "43 83 1 100 23\n", "56...
7
[ "PYTHON3" ]
2
2
code_contests
e89127f2c7cbf96da9738c778143c3c6
500_C. New Year Book Reading
New Year is coming, and Jaehyun decided to read many books during 2015, unlike this year. He has n books numbered by integers from 1 to n. The weight of the i-th (1 ≤ i ≤ n) book is wi. As Jaehyun's house is not large enough to have a bookshelf, he keeps the n books by stacking them vertically. When he wants to read a...
{"inputs": ["3 5\n1 2 3\n1 3 2 3 1\n", "50 50\n75 71 23 37 28 23 69 75 5 62 3 11 96 100 13 50 57 51 8 90 4 6 84 27 11 89 95 81 10 62 48 52 69 87 97 95 30 74 21 42 36 64 31 80 81 50 56 53 33 99\n26 30 5 33 35 29 6 15 36 17 32 16 14 1 29 34 22 40 12 42 38 48 39 50 13 47 18 43 10 8 49 45 11 31 21 37 46 28 20 41 2 7 9 24 2...
9
[ "PYTHON3" ]
2
2
code_contests
ccdf52dcb3f516adf5f6ea5a95ca142c
526_A. King of Thieves
In this problem you will meet the simplified model of game King of Thieves. In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character, avoiding traps and obstacles on your way. <image> An interesting feature of the game is that you can design your own levels...
{"inputs": ["16\n.**.*..*.***.**.\n", "11\n.*.*...*.*.\n", "20\n.*..*...*....*.....*\n", "97\n****.***.***.*..**.**.*.*.***.*............*..*......*.***.**.*.***.*.***.*..*.**.*.***.**.*****.\n", "5\n*.***\n", "4\n****\n", "11\n.*.*.*.*...\n", "72\n.***.**.*.*...*****.*.*.*.*.**....**.*.**..*.*...**..***.**.**..*.**..*...
7
[ "PYTHON3" ]
2
2
code_contests
83abd43f965e8299d6047e0f34d6fc59
551_B. ZgukistringZ
Professor GukiZ doesn't accept string as they are. He likes to swap some letters in string to obtain a new one. GukiZ has strings a, b, and c. He wants to obtain string k by swapping some letters in a, so that k should contain as many non-overlapping substrings equal either to b or c as possible. Substring of string x...
{"inputs": ["pozdravstaklenidodiri\nniste\ndobri\n", "aaa\na\nb\n", "abbbaaccca\nab\naca\n", "brtakoktrosttttttttttosafasfkalsfkodfdasiofhadfhasdsajfdsafoasodsafahaihfdisoadspapsapiosapdsajdipsahdhasuirhaeuifhhfkjgosooooooooodafdfioottttafdsafaddfuiasdjfjasdo\nokat\ntako\n", "aleksandrehteosidatedodam\nevo\nsi\n", "goo...
8
[ "PYTHON3" ]
2
2
code_contests
5c02dfa6ae59c04cd5ae24396f30008d
578_C. Weakness and Poorness
You are given a sequence of n integers a1, a2, ..., an. Determine a real number x such that the weakness of the sequence a1 - x, a2 - x, ..., an - x is as small as possible. The weakness of a sequence is defined as the maximum value of the poorness over all segments (contiguous subsequences) of a sequence. The poor...
{"inputs": ["10\n1 10 2 9 3 8 4 7 5 6\n", "4\n1 2 3 4\n", "3\n1 2 3\n", "10\n-405 -230 252 -393 -390 -259 97 163 81 -129\n", "3\n10000 -10000 10000\n", "1\n-10000\n", "20\n-16 -23 29 44 -40 -50 -41 34 -38 30 -12 28 -44 -49 15 50 -28 38 -2 0\n", "10\n-405 -230 252 -393 -271 -259 97 163 81 -129\n", "10\n1 10 2 9 6 8 4 7 ...
9
[ "PYTHON3" ]
2
2
code_contests
c5f744d32e370d1d175d511c453823da
5_A. Chat Server's Outgoing Traffic
Polycarp is working on a new project called "Polychat". Following modern tendencies in IT, he decided, that this project should contain chat as well. To achieve this goal, Polycarp has spent several hours in front of his laptop and implemented a chat server that can process three types of commands: * Include a perso...
{"inputs": ["+Mike\nMike:hello\n+Kate\n+Dmitry\n-Dmitry\nKate:hi\n-Kate\n", "+Mike\n-Mike\n+Mike\nMike:Hi I am here\n-Mike\n+Kate\n-Kate\n", "+adabacaba\n-adabacaba\n+aca\naca:caba\n-aca\n+bacaba\n-bacaba\n+aba\n-aba\n+bad\n", "+cab\n+abac\n-abac\n+baca\n", "+8UjgAJ\n8UjgAJ:02hR7UBc1tqqfL\n-8UjgAJ\n+zdi\n-zdi\n", "+a...
7
[ "PYTHON3" ]
2
2
code_contests
744d14238637c766a4217435148be240
621_D. Rat Kwesh and Cheese
Wet Shark asked Rat Kwesh to generate three positive real numbers x, y and z, from 0.1 to 200.0, inclusive. Wet Krash wants to impress Wet Shark, so all generated numbers will have exactly one digit after the decimal point. Wet Shark knows Rat Kwesh will want a lot of cheese. So he will give the Rat an opportunity to ...
{"inputs": ["1.1 3.4 2.5\n", "1.9 1.8 1.7\n", "2.0 2.0 2.0\n", "1.0 200.0 200.0\n", "0.2 0.1 0.6\n", "1.9 3.0 4.1\n", "51.8 51.8 7.1\n", "113.9 125.2 88.8\n", "1.9 4.8 3.9\n", "2.2 148.1 138.0\n", "1.0 200.0 1.0\n", "1.7 4.5 4.2\n", "0.2 0.6 0.3\n", "200.0 200.0 0.1\n", "3.9 0.2 3.8\n", "7.0 131.1 7.4\n", "4.6 4.4 2.3\...
10
[ "PYTHON3" ]
2
2
code_contests
8c14fdb65c4df2ae885276e9425cb654
643_B. Bear and Two Paths
Bearland has n cities, numbered 1 through n. Cities are connected via bidirectional roads. Each road connects two distinct cities. No two roads connect the same pair of cities. Bear Limak was once in a city a and he wanted to go to a city b. There was no direct connection so he decided to take a long walk, visiting ea...
{"inputs": ["1000 999\n10 20 30 40\n", "7 11\n2 4 7 3\n", "1000 1001\n217 636 713 516\n", "1000 1998\n833 681 19 233\n", "4 5\n1 3 4 2\n", "6 7\n3 1 2 4\n", "5 7\n4 3 2 1\n", "55 56\n53 54 52 55\n", "1000 1000\n89 983 751 38\n", "1000 1002\n641 480 458 289\n", "6 5\n3 2 5 4\n", "999 999\n289 384 609 800\n", "5 4\n2 3 5...
8
[ "PYTHON3" ]
2
2
code_contests
64b419931aa4e52893f284df06ab575f
670_B. Game of Robots
In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an integer from 1 to 109. At some moment, robots decided to play the game "Snowball". Below there are the rules of this game. First, all robots stand in a row. Then the first robot says his identifier. Aft...
{"inputs": ["4 5\n10 4 18 3\n", "2 2\n1 2\n", "4 9\n5 1000000000 999999999 12\n", "4 6\n5 1000000000 999999999 12\n", "1 1\n4\n", "3 5\n4 5 6\n", "3 4\n4 5 6\n", "3 6\n4 5 6\n", "4 2\n5 1000000000 999999999 12\n", "2 3\n6 7\n", "2 1\n5 1\n", "4 1\n5 1000000000 999999999 12\n", "4 3\n5 1000000000 999999999 12\n", "3 1\n...
8
[ "PYTHON3" ]
2
2
code_contests
9ce8ccea6b72b21183819ab8ca3dff43
691_D. Swaps in Permutation
You are given a permutation of the numbers 1, 2, ..., n and m pairs of positions (aj, bj). At each step you can choose a pair from the given positions and swap the numbers in that positions. What is the lexicographically maximal permutation one can get? Let p and q be two permutations of the numbers 1, 2, ..., n. p i...
{"inputs": ["9 6\n1 2 3 4 5 6 7 8 9\n1 4\n4 7\n2 5\n5 8\n3 6\n6 9\n", "3 10\n2 3 1\n1 1\n3 3\n3 3\n3 2\n1 1\n2 2\n3 1\n1 3\n2 1\n3 3\n", "7 20\n6 2 5 7 3 1 4\n7 7\n1 1\n2 2\n6 1\n4 4\n2 2\n2 2\n6 6\n3 5\n7 4\n1 6\n4 4\n6 1\n1 1\n3 3\n5 3\n3 5\n5 3\n2 2\n4 4\n", "4 20\n4 2 3 1\n2 2\n1 4\n2 2\n1 1\n3 3\n3 3\n1 4\n3 3\n2 ...
10
[ "PYTHON3" ]
2
2
code_contests
ed2c5a62ceaa9b28eab20abd49542986
716_D. Complete The Graph
ZS the Coder has drawn an undirected graph of n vertices numbered from 0 to n - 1 and m edges between them. Each edge of the graph is weighted, each weight is a positive integer. The next day, ZS the Coder realized that some of the weights were erased! So he wants to reassign positive integer weight to each of the edg...
{"inputs": ["5 5 13 0 4\n0 1 5\n2 1 2\n3 2 3\n1 4 0\n4 3 4\n", "2 1 123456789 0 1\n0 1 0\n", "2 1 999999999 1 0\n0 1 1000000000\n", "7 9 999999999 0 3\n0 1 0\n1 2 0\n2 3 0\n0 4 1\n4 1 1\n1 5 499999999\n5 2 499999999\n2 6 1\n6 3 1\n", "7 9 320 0 3\n0 1 0\n1 2 0\n2 3 0\n0 4 1\n4 1 1\n1 5 100\n5 2 100\n2 6 59\n6 3 61\n", ...
10
[ "PYTHON3" ]
2
2
code_contests
31c372fe6d6d67e629ed058aa9391777
737_A. Road to Cinema
Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minutes. There is a straight road of length s from the service to the cinema. Let's introduce a coordinate system so that the car rental service is at the point 0, and the cinema is at the point s. ...
{"inputs": ["3 1 8 10\n10 8\n5 7\n11 9\n3\n", "2 2 10 18\n10 4\n20 6\n5 3\n", "1 1 2 2\n1000000000 1000000000\n1\n", "1 1 1000000000 1000000000\n100 1000000000\n1\n", "1 1 10 18\n5 6\n5\n", "2 1 1000000000 2000000000\n111 999999999\n101 999999998\n1\n", "4 13 400 600\n13 30\n1 19\n1 160\n1 113\n58 73 15 319 194 362 128...
7
[ "PYTHON3" ]
2
2
code_contests
c6eaae3a70b26b34c68410a795c9730d
760_F. Bacterial Melee
Julia is conducting an experiment in her lab. She placed several luminescent bacterial colonies in a horizontal testtube. Different types of bacteria can be distinguished by the color of light they emit. Julia marks types of bacteria with small Latin letters "a", ..., "z". The testtube is divided into n consecutive re...
{"inputs": ["7\nabacaba\n", "3\naaa\n", "2\nab\n", "4\nbabb\n", "15\ntxxtxttxxttxtxx\n", "3\nmyw\n", "127\nxixtxixnxixtxixlxixtxixnxixtxixoxixtxixnxixtxixlxixtxixnxixtxixhxixtxixnxixtxixlxixtxixnxixtxixoxixtxixnxixtxixlxixtxixnxixtxix\n", "1\na\n", "10\nisssisssss\n", "2\nff\n", "1\nz\n", "15\nxxtxttxxttxtxxt\n", "3\ny...
12
[ "PYTHON3" ]
2
2
code_contests
5c770f117dcf904b0579e68ab9ee6f8a
784_B. Kids' Riddle
Programmers' kids solve this riddle in 5-10 minutes. How fast can you do it? Input The input contains a single integer n (0 ≤ n ≤ 2000000000). Output Output a single integer. Examples Input 11 Output 2 Input 14 Output 0 Input 61441 Output 2 Input 571576 Output 10 Input 2128506 Output 3
{"inputs": ["14\n", "2128506\n", "11\n", "571576\n", "61441\n", "143165576\n", "1919020031\n", "1204252996\n", "210637432\n", "724264821\n", "1741\n", "619489590\n", "1199537418\n", "1075765759\n", "747976826\n", "638486017\n", "58438190\n", "1285316221\n", "186925426\n", "1180540990\n", "833393692\n", "1818960378\n", ...
8
[ "PYTHON3" ]
2
2
code_contests
c392ba8eb675579da957d92376d2f9ea
805_A. Fake NP
Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path. You are given l and r. For all integers from l to r, inclusive, we wrote down all of their integer divisors except 1. Find the integer that we wrote down the maximum number of times. Solve...
{"inputs": ["19 29\n", "3 6\n", "252662256 252662260\n", "141650963 141650963\n", "4 12\n", "1002523 1002523\n", "93 95\n", "331900277 331900277\n", "56 92\n", "10 100\n", "3 1000000000\n", "13 13\n", "2 879190747\n", "999900001 1000000000\n", "820844234 892579936\n", "419873015 419873018\n", "568814539 568814539\n", "...
7
[ "PYTHON3" ]
2
2
code_contests
564ce070684d0db4724f1e2fe6abce29
830_A. Office Keys
There are n people and k keys on a straight line. Every person wants to get to the office which is located on the line as well. To do that, he needs to reach some point with a key, take the key and then go to the office. Once a key is taken by somebody, it couldn't be taken by anybody else. You are to determine the mi...
{"inputs": ["1 2 10\n11\n15 7\n", "2 4 50\n20 100\n60 10 40 80\n", "1 1 10\n10\n10\n", "2 2 10\n9 11\n11 8\n", "1 1 1000000000\n1000000000\n1\n", "1 1 50\n1\n1000000000\n", "2 2 5\n2 3\n4 6\n", "5 20 1\n314 316 328 323 321\n30 61 11 83 19 63 97 87 14 79 43 57 75 48 47 95 41 27 8 88\n", "1 1 1\n2\n1000000000\n", "2 2 10...
7
[ "PYTHON3" ]
2
2
code_contests
006eba8e1cab04616abaa143660b89eb
851_B. Arpa and an exam about geometry
Arpa is taking a geometry exam. Here is the last problem of the exam. You are given three points a, b, c. Find a point and an angle such that if we rotate the page around the point by the angle, the new position of a is the same as the old position of b, and the new position of b is the same as the old position of c....
{"inputs": ["0 1 1 1 1 0\n", "1 1 0 0 1000 1000\n", "264193194 -448876521 736684426 -633906160 -328597212 -47935734\n", "-357531221 381512519 -761132895 -224448284 328888775 -237692564\n", "-1000000000 -1000000000 0 0 1000000000 999999999\n", "0 2 4 5 4 0\n", "0 0 2 45 0 90\n", "-1000000000 -1000000000 0 1000000000 100...
8
[ "PYTHON3" ]
2
2
code_contests
c7a6d38080cab4a147d384da52f05d97
875_D. High Cry
Disclaimer: there are lots of untranslateable puns in the Russian version of the statement, so there is one more reason for you to learn Russian :) Rick and Morty like to go to the ridge High Cry for crying loudly — there is an extraordinary echo. Recently they discovered an interesting acoustic characteristic of this...
{"inputs": ["5\n3 2 1 6 5\n", "4\n3 3 3 3\n", "228\n1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 31 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 63 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 31 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 127 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 31 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 63 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 31 1 3 1 7 1 3 1 15 1 3 1 7 1 3 ...
10
[ "PYTHON3" ]
2
2
code_contests
9c0901d64f6cfab89c322ab1c2eea63b
89_C. Chip Play
Let's consider the following game. We have a rectangular field n × m in size. Some squares of the field contain chips. Each chip has an arrow painted on it. Thus, each chip on the field points in one of the following directions: up, down, left or right. The player may choose a chip and make a move with it. The move ...
{"inputs": ["4 4\nDRLD\nU.UL\n.UUR\nRDDL\n", "3 5\n.D...\nRRRLL\n.U...\n", "10 10\n.L.....R..\n.........U\n..D....D..\n.R......L.\n....L.....\n.........D\n......U...\nD....R....\n...U......\n........L.\n", "5 5\nDD..D\n.....\nLU...\nU...U\n.UL.U\n", "1 1\nU\n", "5 5\nUD..L\nRRD..\n..RDD\nUUL..\nDDLRR\n", "19 23\nU..U.....
9
[ "PYTHON3" ]
2
2
code_contests
14325d6a67e458f781367c5c129c6d19
920_E. Connected Components?
You are given an undirected graph consisting of n vertices and <image> edges. Instead of giving you the edges that exist in the graph, we give you m unordered pairs (x, y) such that there is no edge between x and y, and if some pair of vertices is not listed in the input, then there is an edge between these vertices. ...
{"inputs": ["5 5\n1 2\n3 4\n3 2\n4 2\n2 5\n", "7 20\n4 6\n6 7\n4 5\n1 2\n2 4\n1 7\n3 5\n2 1\n6 2\n6 1\n7 3\n3 2\n3 6\n3 1\n3 4\n2 5\n1 6\n7 4\n6 3\n7 5\n", "8 23\n1 2\n1 4\n1 6\n1 8\n2 3\n2 4\n2 5\n2 6\n2 7\n2 8\n3 4\n3 5\n3 6\n3 7\n3 8\n4 5\n4 6\n4 7\n5 6\n5 7\n5 8\n6 8\n7 8\n", "4 4\n2 1\n3 1\n1 4\n3 2\n", "8 18\n1 4...
11
[ "PYTHON3" ]
2
2
code_contests
50fdeba223935f40d43f1914c113e248
949_C. Data Center Maintenance
BigData Inc. is a corporation that has n data centers indexed from 1 to n that are located all over the world. These data centers provide storage for client data (you can figure out that client data is really big!). Main feature of services offered by BigData Inc. is the access availability guarantee even under the ci...
{"inputs": ["3 3 5\n4 4 0\n1 3\n3 2\n3 1\n", "4 5 4\n2 1 0 3\n4 3\n3 2\n1 2\n1 4\n1 3\n", "10 9 5\n0 0 0 0 0 0 0 0 0 4\n10 3\n10 7\n10 5\n10 8\n10 9\n10 1\n10 4\n10 6\n10 2\n", "10 20 5\n2 2 1 4 0 3 0 4 1 3\n6 1\n8 5\n2 10\n3 5\n1 9\n4 6\n9 7\n2 3\n7 4\n10 8\n4 9\n2 5\n4 10\n2 8\n10 3\n1 8\n8 10\n6 7\n5 1\n10 3\n", "10...
9
[ "PYTHON3" ]
2
2
code_contests
2d5fe9b63c190d7ff61bcc797a88a813
977_B. Two-gram
Two-gram is an ordered pair (i.e. string of length two) of capital Latin letters. For example, "AZ", "AA", "ZA" — three distinct two-grams. You are given a string s consisting of n capital Latin letters. Your task is to find any two-gram contained in the given string as a substring (i.e. two consecutive characters of ...
{"inputs": ["5\nZZZAA\n", "7\nABACABA\n", "15\nMIRZOYANOVECLOX\n", "23\nAABBBAAACCCCCAAADDDDDDD\n", "2\nQA\n", "11\nGGRRAATTZZZ\n", "6\nAZAZAZ\n", "10\nSQSQSQSQTG\n", "3\nKEK\n", "100\nURXCAIZFIBNJTPCZHBQIBCILLPXZCFGMKKZMNPLCYGAVJVIBMCZEBSJWPSCPQDYCTTKPOKIJRSKIZPDGCHVOUTMPNECYORSFZFNC\n", "3\nLOL\n", "2\nWW\n", "8\nPUT...
8
[ "PYTHON3" ]
2
2
code_contests
43cb1d6bf2f7b962cfc95446a9e58bde
996_F. Game
Allen and Bessie are playing a simple number game. They both know a function f: \{0, 1\}^n → R, i. e. the function takes n binary arguments and returns a real value. At the start of the game, the variables x_1, x_2, ..., x_n are all set to -1. Each round, with equal probability, one of Allen or Bessie gets to make a mo...
{"inputs": ["2 0\n1 1 1 1\n", "2 2\n0 1 2 3\n2 5\n0 4\n", "1 0\n2 3\n", "2 0\n1 1 0 1\n", "2 2\n0 1 2 3\n2 1\n0 4\n", "1 0\n2 1\n", "2 0\n1 0 0 1\n", "2 2\n0 1 2 4\n2 1\n0 4\n", "2 2\n0 1 2 4\n3 1\n0 4\n", "2 2\n0 1 0 4\n3 1\n0 4\n", "2 2\n0 1 0 4\n2 1\n0 4\n", "2 2\n0 1 2 3\n3 5\n0 4\n", "2 2\n0 1 0 3\n2 1\n0 4\n", "1...
12
[ "PYTHON3" ]
2
2
code_contests
6399ad3d8233aa92c280f7de64989a42
battle-of-stalingrad-1
The bloodiest battle of World War II has started. Germany and its allies have attacked the Soviet union army to gain control of the city of Stalingrad (now Volgograd) in the south-western Soviet Union.The war has become intensive and the soviet union's 64th army is fighting against the germans. General "Vasily Chuikov"...
{"inputs": ["36\n2 2 2 8 9 4 8 5\n9 1 7 6 10 6 9 3\n10 2 4 6 6 2 1 1\n9 6 2 3 5 7 7 3\n6 6 3 9 10 9 1 3\n1 3 10 5 10 10 4 1\n10 3 10 4 5 5 3 4\n10 3 4 9 3 3 7 3\n6 9 9 2 6 4 3 3\n7 2 1 10 4 7 6 2\n3 4 3 4 3 2 9 5\n7 8 2 9 8 3 2 3\n5 4 6 9 4 4 8 3\n5 2 2 8 1 5 7 5\n4 7 10 2 10 9 2 3\n4 8 2 3 6 6 3 2\n8 10 4 3 4 2 1 4\n1...
0
[ "PYTHON3" ]
3
2
code_contests
58616ff7662fe68bf4e179eea08c463d
class-homework
Ramesh and Suresh were in the same class and got home work from their mathematics teacher. The Homework consists of N strings and each string consists of only digits. The task which they need to perform is that they need to divide the string into 4 integers such that their sum is maximum. Note: Each integer should be...
{"inputs": ["3\n4251\n52310\n00006\n\nSAMPLE", "100\n04\n9\n02163\n003000\n08041479\n80750340926070052\n90056\n11680\n90\n09020809009020989\n00460224000800\n0606\n6402000040\n3918080\n31052060072050\n41\n00070775690\n8000780240500799004\n66\n040934020028\n00241600300023700065\n3\n09964639222895002000\n29030020537086490...
0
[ "PYTHON3" ]
3
2
code_contests
a5a5967c0259ab20d1b7860d9ec5e3c7
even-from-end-1
Problem Description Given a list of integers, find and display all even numbers from the end of the list. Input Format Each line of input begins with an integer N indicating the number of integer n that follow which comprises a list. Output Format All even numbers from the end of the list, each separated by a sin...
{"inputs": ["5 10 25 12 4 1 \n3 16 28 100\n\nSAMPLE", "21 3 -3 3 -3 3 -3 19 3 -3 3 -3 3 -3 19 3 -3 3 -3 3 -3 19", "2 8 -100\n5 -1000 5 1000 500 250\n10 -1000 5 1000 500 250 -1000 5 1000 500 250\n7 3 -3 3 -3 3 -3 19\n5 44 7 11 -999 20", "5 10 25 12 4 1 \n3 16 28 100"], "outputs": ["4 12 10 \n100 28 16", "None to display...
0
[ "PYTHON3" ]
3
2
code_contests
1d0c5086da22aea39e71a38dcc16e760
hermione-vs-draco
Draco Malfoy and Hermione Granger have gotten into a "battle of brains". Draco was foolish enough to challenge her to a Arithmancy problem. Septima Vector, Arithmancy teacher at Hogwarts, has agreed to give them both a problem which they should solve overnight. The problem is as follows :- Firstly, a function F (fro...
{"inputs": ["6\n3\n60\n100\n1024\n23456\n8735373\n\nSAMPLE", "6\n3\n60\n100\n1024\n23456\n8735373\n\nELPMAS", "6\n5\n60\n100\n1024\n23456\n8735373\n\nELPMAS", "6\n5\n21\n100\n1024\n23456\n8735373\n\nELPMAS", "6\n4\n21\n100\n1024\n23456\n8735373\n\nEMPMAS", "6\n4\n21\n100\n1024\n17256\n8735373\n\nEMPMAS", "6\n4\n21\n100...
0
[ "PYTHON3" ]
3
2
code_contests
0fa52089341acb3e5c8dc7e7608e805a
magic-gcd
Given 2 numbers n1 and n2, following operations can be performed: 1) Decrement n1 by 1(if n1>1) 2) Decrement n2 by 1(if n2>1) 3) Incremenet n1 by 1 4) Incremenet n2 by 1 Find the maximum possible value of gcd(n1,n2) with atmost k operations. Note: Any of the 4 operations counts for one operation. gcd(n1,n2) refers to G...
{"inputs": ["1\n9\n10\n1\n\nSAMPLE", "4\n14723\n5512\n100\n28436\n33903\n100\n84816\n75747\n100\n92281\n31380\n100", "1\n45819\n95605\n83", "4\n11833\n5512\n100\n28436\n33903\n100\n84816\n75747\n100\n92281\n31380\n100", "1\n45819\n95605\n90", "1\n9\n10\n1\n\nSANPLE", "1\n45819\n95605\n136", "1\n18\n10\n1\n\nSANPLE", "4...
0
[ "PYTHON3" ]
3
2
code_contests
6b3513bd23b4aeb166d7cda850a795d5
new-world-11
The time has arrived when the world is going to end. But don't worry, because the new world yuga will start soon. Manu (carrier of mankind) has been assigned the job to carry all the necessary elements of current yuga to the upcoming yuga. There are N stones arranged in a straight line. In order to fulfill the task, M...
{"inputs": ["2\n4 1\n2 15 36 43 \n3 2\n27 30 35 \n\nSAMPLE", "2\n4 1\n2 15 36 43 \n3 2\n27 29 35 \n\nSAMPLE", "2\n4 1\n4 15 36 43 \n3 2\n27 29 35 \n\nSAMPLE", "2\n4 1\n2 15 36 43 \n3 2\n18 30 35 \n\nSAMPLE", "2\n4 1\n0 15 36 43 \n3 2\n27 29 35 \n\nSAMPLE", "2\n3 1\n2 15 36 43 \n3 2\n18 30 35 \n\nSAMPLE", "2\n3 1\n4 15 ...
0
[ "PYTHON3" ]
3
2
code_contests
ef1b11df5ee6c895ed1ac551bf73ec8e
professor-sharma
Professor Sharma gives the following problem to his students: given two integers X( ≥ 2) and Y( ≥ 2) and tells them to find the smallest positive integral exponent E such that the decimal expansion of X^E begins with Y. For example, if X = 8 and Y= 51, then X^3 = 512 begins with Y= 51, so E= 3. Professor Sharma has a...
{"inputs": ["2\n5 156\n16 40\n\nSAMPLE", "4\n39 20\n183 11\n551 27\n85 16", "8\n4 65\n5 12\n7 24\n9 38\n12 24\n14 10\n65 75\n31 26", "4\n39 18\n183 11\n551 27\n85 16", "8\n4 65\n5 12\n7 21\n9 38\n12 24\n14 10\n65 75\n31 26", "2\n5 156\n28 40\n\nSAMPLE", "4\n49 18\n183 11\n551 27\n85 16", "8\n4 65\n5 12\n7 21\n9 38\n12 ...
0
[ "PYTHON3" ]
3
2
code_contests
0cba372bd8822a6395f9bfc585af8894
sherlock-and-kgb
The russian intelligence agency KGB make an encryption technique to send their passwords. Originally the password is of 3 characters. After encryption the password is converted into 3 numbers A-B-C. Now, Sherlock wants to decrypt the password encryption technique of KGB. Sherlock knows that every number has only 2 po...
{"inputs": ["2\n27 25 4\n25 26 16\n\nSAMPLE", "5\n81 125 16\n19683 15625 8192\n59049 15630 32768\n59050 78125 131072\n177147 390625 131073"], "outputs": ["K-G-B\nX-Y-B", "K-G-B \nK-G-B \nK-Y-B \nX-G-B \nK-G-Z"]}
0
[ "PYTHON3" ]
3
2
code_contests
cbd23df2a0c3850791c830052a5a9271
the-competitive-class-3
Jiro is a fun loving lad. His classmates are very competitive and are striving for getting a good rank, while he loves seeing them fight for it. The results are going to be out soon. He is anxious to know what is the rank of each of his classmates. Rank of i'th student = 1+ (Number of students having strictly grea...
{"inputs": ["4\n62 96 82 55\n\nSAMPLE", "384\n87 78 16 94 36 87 93 50 22 63 28 91 60 64 27 41 27 73 37 12 69 68 30 83 31 63 24 68 36 30 3 23 59 70 68 94 57 12 43 30 74 22 20 85 38 99 25 16 71 14 27 92 81 57 74 63 71 97 82 6 26 85 28 37 6 47 30 14 58 25 96 83 46 15 68 35 65 44 51 88 9 77 79 89 85 4 52 55 100 33 61 77 69...
0
[ "PYTHON3" ]
3
2
code_contests
4d1b1ff93e2ff19930b1863c6ce57612
xenny-and-range-sums
PowerShell had N natural numbers. He wanted to test Xenny's speed in finding the sum and difference of several numbers. He decided to ask Xenny several questions. In each question, he gave him two positive integers L and R. He asked him to find the sum of all integers from index L to index R (inclusive) and the differ...
{"inputs": ["4 1\n1 2 3 4\n1 3\n\nSAMPLE", "78 78\n-645462 -187679 693035 927066 431506 16023 -173045 698159 -995400 -687770 -747462 789670 862673 385513 579977 -156856 22209 378002 930156 353000 67263 -758921 572468 562437 125912 -422101 -513624 43409 25348 -214377 808094 -88292 293865 910587 -731480 -509056 901506 -3...
0
[ "PYTHON3" ]
3
2
code_contests
acd18ee0a0a23d388d5ee307655b5cd8
p02652 AtCoder Grand Contest 045 - 01 Unbalanced
Given is a string S, where each character is `0`, `1`, or `?`. Consider making a string S' by replacing each occurrence of `?` with `0` or `1` (we can choose the character for each `?` independently). Let us define the unbalancedness of S' as follows: * (The unbalancedness of S') = \max \\{ The absolute difference be...
{"inputs": ["??00????0??0????0?0??00??1???11?1?1???1?11?111???1", "0??0", "0??", "0?0?", "00??", "??00????0??1????0?0??00??1???11?1?1???1?11?111???1", "1???11??11?1???1?1?11???1??00??0?0?1??1??0>>??00??", "1???111?11?1???111?11???1??00??0?0?@?????0????00??", "????111?11?1?1?111?11???1??00??0???@?????0???000??", "????11...
0
[ "PYTHON3" ]
5
2
code_contests
cacee6ae9bfcc5dc9986327b0bac4ad5
p02781 AtCoder Beginner Contest 154 - Almost Everywhere Zero
Find the number of integers between 1 and N (inclusive) that contains exactly K non-zero digits when written in base ten. Constraints * 1 \leq N < 10^{100} * 1 \leq K \leq 3 Input Input is given from Standard Input in the following format: N K Output Print the count. Examples Input 100 1 Output 19 Inpu...
{"inputs": ["9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n3", "314159\n2", "25\n2", "100\n1", "314159\n1", "25\n1", "100\n2", "314159\n3", "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n2", "25\n4", "9999999...
0
[ "PYTHON3" ]
5
2
code_contests
96fde8f248accefd5bb707a92321c76c
p02916 AtCoder Beginner Contest 140 - Buffet
Takahashi went to an all-you-can-eat buffet with N kinds of dishes and ate all of them (Dish 1, Dish 2, \ldots, Dish N) once. The i-th dish (1 \leq i \leq N) he ate was Dish A_i. When he eats Dish i (1 \leq i \leq N), he gains B_i satisfaction points. Additionally, when he eats Dish i+1 just after eating Dish i (1 \...
{"inputs": ["2\n1 2\n50 50\n50", "4\n2 3 4 1\n13 5 8 24\n45 9 15", "3\n3 1 2\n2 5 4\n3 6", "2\n1 0\n50 50\n50", "4\n2 3 4 1\n13 5 1 24\n45 9 15", "4\n2 3 4 1\n13 5 1 24\n45 9 16", "4\n2 3 4 1\n14 5 1 24\n45 9 16", "4\n2 3 4 1\n7 5 1 24\n45 9 16", "3\n3 1 2\n2 5 3\n3 6", "4\n2 3 4 1\n20 5 1 24\n45 9 16", "3\n3 1 2\n2 1 ...
0
[ "PYTHON3" ]
5
2
code_contests
3c4f27c3bce272e81cbfc8231e733807
p03052 diverta 2019 Programming Contest - Edge Ordering
You are given a simple connected undirected graph G consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Edge i connects Vertex a_i and b_i bidirectionally. It is guaranteed that the subgraph consisting of Vertex 1,2,\ldots,N and Edge 1,2,\ldots,N-1 is a spanning t...
{"inputs": ["4 4\n1 2\n3 2\n3 4\n1 3", "15 28\n10 7\n5 9\n2 13\n2 14\n6 1\n5 12\n2 10\n3 9\n10 15\n11 12\n12 6\n2 12\n12 8\n4 10\n15 3\n13 14\n1 15\n15 12\n4 14\n1 7\n5 11\n7 13\n9 10\n2 7\n1 9\n5 6\n12 14\n5 2", "3 3\n1 2\n2 3\n1 3", "15 28\n10 7\n5 9\n2 13\n2 14\n6 1\n9 12\n2 10\n3 9\n10 15\n11 12\n12 6\n2 12\n12 8\n...
0
[ "PYTHON3" ]
5
2
code_contests
0037c3748d5f312485336fc2193de6a1
p03194 CADDi 2018 for Beginners - Product and GCD
There are N integers a_1, a_2, ..., a_N not less than 1. The values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \times a_2 \times ... \times a_N = P. Find the maximum possible greatest common divisor of a_1, a_2, ..., a_N. Constraints * 1 \leq N \leq 10^{12} * 1 \leq P \leq 10^{12} Input Input is...
{"inputs": ["5 1", "4 972439611840", "3 24", "1 111", "5 2", "1 972439611840", "1 110", "1 2", "1 534720932937", "1 18", "1 010", "1 3", "1 867963093279", "1 15", "1 011", "1 5", "1 100", "1 1431379180228", "1 101", "1 243501193440", "1 4", "1 1472895801034", "1 8", "1 249458889941", "1 6", "1 465723649388", "2 2435011...
0
[ "PYTHON3" ]
5
2
code_contests
44b936295ff068d9c780d1190c598c42
p03343 AtCoder Regular Contest 098 - Range Minimum Queries
You are given an integer sequence A of length N and an integer K. You will perform the following operation on this sequence Q times: * Choose a contiguous subsequence of length K, then remove the smallest element among the K elements contained in the chosen subsequence (if there are multiple such elements, choose one ...
{"inputs": ["11 7 5\n24979445 861648772 623690081 433933447 476190629 262703497 211047202 971407775 628894325 731963982 822804784", "5 3 2\n4 3 1 5 2", "10 1 6\n1 1 2 3 5 8 13 21 34 55", "11 7 5\n24979445 861648772 623690081 433933447 476190629 262703497 147009374 971407775 628894325 731963982 822804784", "5 3 2\n4 3 1...
0
[ "PYTHON3" ]
5
2
code_contests
bc775304916a7ab6b7ebdc4c79882919
p03503 AtCoder Beginner Contest 080 - Shopping Street
Joisino is planning to open a shop in a shopping street. Each of the five weekdays is divided into two periods, the morning and the evening. For each of those ten periods, a shop must be either open during the whole period, or closed during the whole period. Naturally, a shop must be open during at least one of those ...
{"inputs": ["1\n1 1 0 1 0 0 0 1 0 1\n3 4 5 6 7 8 9 -2 -3 4 -2", "3\n1 1 1 1 1 1 0 0 1 1\n0 1 0 1 1 1 1 0 1 0\n1 0 1 1 0 1 0 1 0 1\n-8 6 -2 -8 -8 4 8 7 -6 2 2\n-9 2 0 1 7 -5 0 -2 -6 5 5\n6 -6 7 -9 6 -5 8 0 -9 -7 -7", "2\n1 1 1 1 1 0 0 0 0 0\n0 0 0 0 0 1 1 1 1 1\n0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1\n0 -2 -2 -2 -2 -2 -1 -1 -1...
0
[ "PYTHON3" ]
5
2
code_contests
8d593e64f3e30a1ff211afd5a8f2b05a
p03664 AtCoder Regular Contest 078 - Mole and Abandoned Mine
Mole decided to live in an abandoned mine. The structure of the mine is represented by a simple connected undirected graph which consists of N vertices numbered 1 through N and M edges. The i-th edge connects Vertices a_i and b_i, and it costs c_i yen (the currency of Japan) to remove it. Mole would like to remove som...
{"inputs": ["15 22\n8 13 33418\n14 15 55849\n7 10 15207\n4 6 64328\n6 9 86902\n15 7 46978\n8 14 53526\n1 2 8720\n14 12 37748\n8 3 61543\n6 5 32425\n4 11 20932\n3 12 55123\n8 2 45333\n9 12 77796\n3 9 71922\n12 15 70793\n2 4 25485\n11 6 1436\n2 7 81563\n7 11 97843\n3 1 40491", "2 1\n1 2 1", "4 6\n1 2 100\n3 1 100\n2 4 10...
0
[ "PYTHON3" ]
5
2
code_contests
446346fa992125f3cc0a94880f85256b
p03819 AtCoder Regular Contest 068 - Snuke Line
Snuke has decided to play a game, where the player runs a railway company. There are M+1 stations on Snuke Line, numbered 0 through M. A train on Snuke Line stops at station 0 and every d-th station thereafter, where d is a predetermined constant for each train. For example, if d = 3, the train stops at station 0, 3, 6...
{"inputs": ["3 3\n1 2\n2 3\n3 3", "7 9\n1 7\n5 9\n5 7\n5 9\n1 1\n6 8\n3 4", "7 9\n1 9\n5 9\n5 7\n5 9\n1 1\n6 8\n3 4", "7 9\n1 9\n9 9\n5 7\n5 9\n1 1\n6 8\n3 4", "7 11\n1 9\n5 9\n5 7\n5 9\n1 1\n6 8\n3 4", "7 9\n1 9\n9 9\n5 7\n5 9\n1 1\n8 8\n3 4", "7 9\n1 6\n5 13\n5 7\n5 9\n1 1\n6 8\n3 4", "7 11\n1 2\n5 9\n5 7\n5 9\n1 1\n...
0
[ "PYTHON3" ]
5
2
code_contests
8032c86c419cd846ae62e1ea51236f4e
p03986 AtCoder Grand Contest 005 - STring
We have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`. Takahashi, who hates the string `ST`, will perform the following operation 10^{10000} times: * Among the occurrences of `ST` in X as (contiguous) substrings, remove the leftmost one. If there is no occ...
{"inputs": ["TSTTSS", "SSTTST", "TSSTTTSS", "SSTTTSST", "STTTSS", "SSSTTT", "TTTSSS", "TTTTSSSS", "TSTSST", "SSTTTS", "TSSTST", "STTSST", "TSSSTT", "TTSSST", "TSSTTS", "STSTST", "TSTSTS", "TSSTTSST", "STSTTS", "TTSTSSST", "STTSTS", "TTSSTS", "STSSTT", "SSTTSTST", "TSSSTSTT", "TTSTSS", "SSTSTT", "TSTSTTSS", "SSSTTTST", ...
0
[ "PYTHON3" ]
5
2
code_contests
ebda8368c72c378bab29c163a1e63034
p00074 Videotape
There is a 120 minute videotape with standard recording. When I set the VCR counter to 00:00:00 with the tape completely rewound and recorded in standard recording mode, I got a certain counter value. Enter this counter value (hours, minutes, seconds), find the length of the remaining tape (recordable time), and create...
{"inputs": ["1 30 0\n-1 -1 -1", "1 36 0\n-1 -1 -1", "0 30 0\n-1 -1 -1", "0 32 0\n-1 -1 -1", "1 16 0\n-1 -1 -1", "0 36 0\n-1 -1 -1", "0 22 0\n-1 -1 -1", "0 55 0\n-1 -1 -1", "0 22 1\n-1 -1 -1", "0 31 1\n-1 -1 -1", "0 26 1\n-1 -1 -1", "0 9 1\n-1 -1 -1", "1 36 1\n-1 -1 -1", "1 8 0\n-1 -1 -1", "0 28 1\n-1 -1 -1", "1 26 1\n-...
0
[ "PYTHON3" ]
6
2
code_contests
47f0e16c728281759f95ce4460bb781d
p00206 Next Trip
You want to go on a trip with a friend. However, friends who have a habit of spending money cannot easily save travel expenses. I don't know when my friends will go on a trip if they continue their current lives. So, if you want to travel early, you decide to create a program to help your friends save in a planned mann...
{"inputs": ["10000\n5000 3150\n5000 5000\n0 0\n5000 1050\n5000 3980\n5000 210\n5000 5000\n5000 5000\n0 0\n5000 2100\n5000 2100\n5000 2100\n29170\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 70...
0
[ "PYTHON3" ]
6
2
code_contests
8751549694868f4baa7df249a1bef3f3
p00365 Age Difference
A trick of fate caused Hatsumi and Taku to come to know each other. To keep the encounter in memory, they decided to calculate the difference between their ages. But the difference in ages varies depending on the day it is calculated. While trying again and again, they came to notice that the difference of their ages w...
{"inputs": ["2008 2 29\n2015 3 1", "1999 9 9\n2001 11 3", "2008 2 29\n2015 1 1", "1505 9 9\n2001 11 3", "1505 9 9\n2619 11 3", "1505 13 9\n2619 11 3", "573 1 44\n2015 1 1", "595 2 44\n2015 2 1", "597 2 44\n2015 2 1", "246 21 0\n2619 11 5", "246 21 0\n5129 11 5", "431 21 0\n5129 11 5", "597 2 19\n895 -2 1", "51 16 1\n51...
0
[ "PYTHON3" ]
6
2
code_contests
5f2547d54e626a6a656eeacada8ecc5b
p00573 Commuter Pass
There are N stations in the city where JOI lives, and they are numbered 1, 2, ..., and N, respectively. In addition, there are M railway lines, numbered 1, 2, ..., and M, respectively. The railway line i (1 \ leq i \ leq M) connects station A_i and station B_i in both directions, and the fare is C_i yen. JOI lives nea...
{"inputs": ["6 6\n1 6\n1 4\n1 2 1\n2 3 1\n3 5 1\n2 4 3\n4 5 2\n5 6 1", "6 6\n1 6\n1 4\n1 2 1\n2 3 1\n2 5 1\n2 4 3\n4 5 2\n5 6 1", "11 6\n1 6\n1 4\n1 2 1\n4 3 1\n2 5 1\n2 4 3\n4 5 0\n5 6 1", "11 6\n1 1\n1 2\n1 2 1\n4 3 1\n2 5 1\n2 4 3\n4 5 0\n5 6 1", "11 6\n2 6\n1 4\n1 2 1\n4 3 1\n2 5 1\n2 4 3\n4 5 2\n5 6 1", "14 6\n1 1...
0
[ "PYTHON3" ]
6
2
code_contests
da402e91883049f140e712222ee7b7fe
p00720 Earth Observation with a Mobile Robot Team
A new type of mobile robot has been developed for environmental earth observation. It moves around on the ground, acquiring and recording various sorts of observational data using high precision sensors. Robots of this type have short range wireless communication devices and can exchange observational data with ones ne...
{"inputs": ["3 5 10\nred\n0 0 0\n5 0 0\ngreen\n0 5 5\n5 6 1\nblue\n0 40 5\n5 0 0\n3 10 5\natom\n0 47 32\n5 -10 -7\n10 1 0\npluto\n0 0 0\n7 0 0\n10 3 3\ngesicht\n0 25 7\n5 -7 -2\n10 -1 10\n4 100 7\nimpulse\n0 -500 0\n100 10 1\nfreedom\n0 -491 0\n100 9 2\ndestiny\n0 -472 0\n100 7 4\nstrike\n0 -482 0\n100 8 3\n0 0 0", "3 ...
0
[ "PYTHON3" ]
6
2
code_contests
c833dc4ff3ea86c67a085034c0b68501
p00860 The Morning after Halloween
You are working for an amusement park as an operator of an obakeyashiki, or a haunted house, in which guests walk through narrow and dark corridors. The house is proud of their lively ghosts, which are actually robots remotely controlled by the operator, hiding here and there in the corridors. One morning, you found th...
{"inputs": ["5 5 2\n#####\n#A#B#\n# #\n#b#a#\n#####\n16 4 3\n################\n## ########## ##\n# ABCcba #\n################\n16 16 3\n################\n### ## # ##\n## # ## # c#\n# ## ########b#\n# ## # # # #\n# # ## # # ##\n## a# # # # #\n### ## #### ## #\n## # # # #\n# ##### # ## ...
0
[ "PYTHON3" ]
6
2
code_contests
b883f4ec1dc4e0257c5a89513b33ec87
p00991 Grid
Two coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r × c are given. The cost of moving from a cell (e, f) to one of the cells (e + 1, f), (e-1, f), (e, f + 1), (e, f-1) is 1. And. You can also move between (e, c-1) and (e, 0), and between (r-1, f) and (0, f) at a cost of 1. At this time, find the number...
{"inputs": ["500 500 0 0 200 200", "4 4 0 0 1 1", "4 4 0 0 3 3", "2 3 0 0 1 2", "500 500 0 0 107 200", "4 1 0 0 1 1", "4 4 1 0 3 3", "2 3 0 0 1 1", "500 500 0 0 107 239", "2 1 0 0 1 1", "678 500 0 0 107 168", "500 500 0 0 200 277", "500 500 1 0 107 239", "678 353 0 0 107 239", "1174 500 0 0 4 168", "272 500 0 0 200 277...
0
[ "PYTHON3" ]
6
2
code_contests
c02b795f51ff945b069569639d68baff
p01123 Let's Move Tiles!
<!-- Problem G --> Let's Move Tiles! You have a framed square board forming a grid of square cells. Each of the cells is either empty or with a square tile fitting in the cell engraved with a Roman character. You can tilt the board to one of four directions, away from you, toward you, to the left, or to the right, ...
{"inputs": ["4\n..E.\n.AD.\nB...\n..C.\nD\n4\n..E.\n.AD.\nB...\n..C.\nDR\n3\n...\n.A.\nBC.\n((URD)3L)2R\n5\n...P.\nPPPPP\nPPP..\nPPPPP\n..P..\nLRLR(LR)12RLLR\n20\n....................\n....................\n.III..CC..PPP...CC..\n..I..C..C.P..P.C..C.\n..I..C....P..P.C....\n..I..C....PPP..C....\n..I..C....P....C....\n..I...
0
[ "PYTHON3" ]
6
2
code_contests
8e8177639c2d33999ac3d91e1f556694
p01262 Adaptive Time Slicing Quantization
Nathan O. Davis is a student at the department of integrated systems. Today he learned digital quanti- zation in a class. It is a process that approximates analog data (e.g. electrical pressure) by a finite set of discrete values or integers. He had an assignment to write a program that quantizes the sequence of real ...
{"inputs": ["5 2 1\n0.1 0.2 0.3 0.4 0.5\n6 2 2\n0.1 0.2 0.3 0.4 0.5 0.6\n0 0 0", "5 2 1\n0.1 0.2 0.3 0.5915213038191143 0.5\n6 2 2\n0.1 0.2 0.3 0.4 0.5 0.6\n0 0 0", "5 2 1\n0.1 0.3034585214713487 0.3 0.5915213038191143 0.5\n6 2 2\n0.1 0.2 0.3 0.4 0.5 0.6\n0 0 0", "5 2 1\n0.1 0.3034585214713487 1.0488885934387808 0.5915...
0
[ "PYTHON3" ]
6
2
code_contests
d5d37ed6f6fa0914b5125a7578693bd1
p01422 Beautiful Currency
KM country has N kinds of coins and each coin has its value a_i. The king of the country, Kita_masa, thought that the current currency system is poor, and he decided to make it beautiful by changing the values of some (possibly no) coins. A currency system is called beautiful if each coin has an integer value and the...
{"inputs": ["3\n6 11 24", "3\n6 11 30", "3\n6 11 12", "3\n6 13 24", "3\n6 4 30", "3\n12 11 12", "3\n6 20 24", "3\n6 7 30", "3\n11 20 24", "3\n10 7 30", "3\n1 15 12", "3\n8 7 30", "3\n1 1 12", "3\n11 12 15", "3\n8 7 11", "3\n14 14 26", "3\n7 15 28", "3\n19 14 28", "3\n19 14 5", "3\n6 11 1", "3\n4 11 12", "3\n6 13 1", "3...
0
[ "PYTHON3" ]
6
2
code_contests
e5eed117d9a1ae3584f63ca571c4bf20
p01576 Exciting Bicycle
You happened to get a special bicycle. You can run with it incredibly fast because it has a turbo engine. You can't wait to try it off road to enjoy the power. You planned to go straight. The ground is very rough with ups and downs, and can be seen as a series of slopes (line segments) when seen from a lateral view. T...
{"inputs": ["2 10\n0 0\n10000 0", "4 50\n0 10000\n1 10000\n2 0\n10000 0", "5 10\n0 0\n10 10\n20 0\n30 10\n40 0", "4 10000\n0 0\n1 1\n9999 0\n10000 10000", "4 50\n0 10000\n1 10000\n2 1\n10000 0", "4 10001\n0 0\n1 1\n9999 0\n10000 10000", "4 100\n0 10000\n1 10000\n2 1\n10000 0", "4 10001\n0 0\n1 1\n9999 -1\n10000 10000",...
0
[ "PYTHON3" ]
6
2
code_contests
b53d79763fa421da6217ca63c4a7ccbd
p01738 Gravity Point
You are practicing a juggle that involves in a number of square tiles. They all look the same in their size, but actually there are three different kinds of the tiles, A, B and X. The kind of a tile can be distinguishable by its mass. All the tiles of the same kind have exactly the same mass. The mass of type A tiles i...
{"inputs": ["3 3\n2 4 1 2 1\nXAX\nB.B\nXAX", "3 3\n2 4 1 0 1\nXAX\nB.B\nXAX", "3 6\n2 4 1 1 1\nXXA\nB.B\nXAX", "10 6\n1 9 1 2 3\nYXA\nB.B\nYXA", "10 6\n1 14 1 2 3\nYXA\nB.B\nYXA", "10 6\n1 24 1 2 3\nYXA\nB.B\nYXA", "10 6\n0 24 1 2 3\nYXA\nB.B\nYXA", "10 6\n0 34 1 2 3\nYXA\nB.B\nYXA", "10 6\n0 34 1 2 3\nYXB\nB.B\nYXA", ...
0
[ "PYTHON3" ]
6
2
code_contests
0918fc55ee0274708ea3f1b67cb2c516
p01878 Destiny Draw
G: Destiny Draw- problem Mr. D will play a card game. This card game uses a pile of N cards. Also, the pile cards are numbered 1, 2, 3, ..., N in order from the top. He can't afford to be defeated, carrying everything that starts with D, but unfortunately Mr. D isn't good at card games. Therefore, I decided to win b...
{"inputs": ["4 1 1 6\n3 2 3", "4 1 1 12\n3 2 3", "4 1 1 16\n3 2 3", "4 1 1 16\n2 2 3", "4 1 1 6\n3 1 3", "4 0 1 12\n3 2 3", "4 1 1 22\n3 2 3", "4 1 1 31\n2 2 3", "4 1 1 6\n3 1 1", "4 0 1 12\n3 2 2", "4 1 2 22\n3 2 3", "8 1 1 31\n2 2 3", "4 0 1 6\n3 1 1", "4 1 4 22\n3 2 3", "4 0 1 6\n3 0 1", "3 0 1 6\n3 0 1", "3 0 1 6\n...
0
[ "PYTHON3" ]
6
2
code_contests
a9b0ee79f6ea4f8d63d80e28458f67be
p02014 Rough Sorting
For skilled programmers, it is very easy to implement a sorting function. Moreover, they often avoid full sorting to reduce computation time if it is not necessary. Here, we consider "rough sorting" which sorts an array except for some pairs of elements. More formally, we define an array is "$K$-roughly sorted" if an a...
{"inputs": ["3 100\n3\n2\n1", "3 1\n3\n2\n1", "5 3\n5\n3\n2\n1\n4", "5 3\n1\n2\n3\n4\n5", "3 2\n3\n2\n1", "3 4\n3\n2\n1", "3 0\n3\n2\n1", "3 001\n3\n2\n1", "5 1\n5\n3\n2\n1\n4", "5 6\n1\n2\n3\n4\n5", "5 2\n5\n3\n2\n1\n4", "3 100\n3\n1\n2", "1 2\n1\n2\n3\n4\n5", "2 3\n1\n2\n2\n0\n1", "3 000\n3\n2\n1", "3 110\n3\n2\n1", ...
0
[ "PYTHON3" ]
6
2
code_contests
f6d87d47333fff395a0041cb8e84869e
p02157 Shuffle 2
Problem There is a bundle of $ n $ cards, with $ i $ written on the $ i $ th card from the bottom. Shuffle this bundle as defined below $ q $ times. * When looking at the bundle from below, consider a bundle $ x $ made by stacking odd-numbered cards on top, and a bundle $ y $ made by stacking even-numbered cards on ...
{"inputs": ["4 2 3 1", "7834164883628 15 2189823423122 5771212644938", "4 2 1 1", "4 1 1 4", "6 2 3 1", "7834164883628 15 2189823423122 7725883688276", "4 2 1 4", "7 1 3 2", "4 3 3 1", "4 2 2 1", "6 2 1 1", "4 4 1 1", "7834164883628 43 2189823423122 4045849112944", "8936240519454 43 2189823423122 4045849112944", "89362...
0
[ "PYTHON3" ]
6
2
code_contests
617eb651ac79379f37216a91c7272d90
p02298 Is-Convex
For a given polygon g, print "1" if g is a convex polygon, "0" otherwise. Here, in a convex polygon, all interior angles are less than or equal to 180 degrees. g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of the polygon. The line segment con...
{"inputs": ["5\n0 0\n2 0\n1 1\n2 2\n0 2", "4\n0 0\n3 1\n2 3\n0 3", "5\n0 0\n2 1\n1 1\n2 2\n0 2", "4\n0 0\n3 0\n2 1\n0 3", "4\n0 0\n3 1\n2 1\n0 3", "5\n0 0\n3 1\n1 1\n2 2\n0 2", "5\n0 0\n3 1\n1 1\n3 2\n0 2", "4\n0 0\n3 0\n2 0\n0 3", "5\n0 0\n3 1\n1 1\n3 2\n1 2", "4\n0 0\n3 1\n2 0\n0 3", "5\n0 0\n3 1\n1 1\n5 2\n1 2", "4\...
0
[ "PYTHON3" ]
6
2
code_contests
7c8dda8f315efc83cbc5760d42588e14
p02445 Swap
Write a program which reads a sequence of integers $A = \\{a_0, a_1, ..., a_{n-1}\\}$ and swap specified elements by a list of the following operation: * swapRange($b, e, t$): For each integer $k$ ($0 \leq k < (e - b)$, swap element $(b + k)$ and element $(t + k)$. Constraints * $1 \leq n \leq 1,000$ * $-1,000,000,0...
{"inputs": ["11\n1 2 3 4 5 6 7 8 9 10 11\n1\n1 4 7", "11\n1 2 3 4 5 6 7 8 9 10 11\n2\n1 4 7", "11\n1 2 3 4 5 6 2 8 9 10 11\n2\n1 4 1", "11\n1 2 3 3 5 6 2 8 9 10 11\n2\n1 4 1", "11\n1 2 3 3 5 6 2 8 18 10 11\n2\n1 4 1", "11\n1 0 3 3 5 6 2 8 18 10 11\n2\n1 4 1", "11\n1 0 3 3 5 6 2 8 34 10 11\n2\n1 4 1", "11\n1 0 3 3 5 6 2...
0
[ "PYTHON3" ]
6
2
code_contests
a3d8502e2aa0f357c08b2c1a7fc2a868
bogosort
Recently Johnny have learned bogosort sorting algorithm. He thought that it is too ineffective. So he decided to improve it. As you may know this algorithm shuffles the sequence randomly until it is sorted. Johnny decided that we don't need to shuffle the whole sequence every time. If after the last shuffle several fir...
{"inputs": ["3\n2\n6\n10", "3\n2\n4\n10", "3\n2\n6\n12", "3\n4\n6\n12", "3\n4\n6\n19", "3\n2\n4\n19", "3\n2\n3\n12", "3\n4\n11\n12", "3\n4\n5\n19", "3\n2\n2\n19", "3\n2\n3\n21", "3\n4\n7\n19", "3\n2\n2\n23", "3\n2\n3\n7", "3\n4\n7\n11", "3\n4\n2\n23", "3\n4\n7\n3", "3\n2\n2\n10", "3\n2\n7\n10", "3\n2\n6\n20", "3\n4\n6\...
2
[ "PYTHON3" ]
1
2
code_contests