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 |
|---|---|---|---|---|---|---|---|---|---|
1362627538d9eee04bfe245e5ac407a4 | ism1 | Hackers! Hackers! Everywhere!
Some days back your email ID was hacked. Some one read the personal messages and Love Letters you sent to your girl friend. That's a terrible thing, well, you know how are the boys at ISM. So, you have decided that from now onwards you will write Love Letters to your girlfriend in a differ... | {"inputs": ["3\ncan you meet me outside ccd today\na\nthis year hard kaur is coming to entertain us", "3\ncan you meet me ouuside ccd today\na\nthis year hard kaur is coming to entertain us", "3\ncan you meet me ouuside ccd today\na\nthis xear hard kaur is coming to entertain us", "3\ncan you meet me ouuside ccd uoday\... | 6 | [
"PYTHON3"
] | 1 | 2 | code_contests | |
80921ecc087b5587a0e66d331a73884b | nopc10 | Computation of the date either previous or forthcoming dates is quiet easy. But it is quiet difficult to calculate the day from a particular given date.
You are required to find a day from a particular date given to you.
Input
It consists of a single line entry consisting of date in format dd mm yyyy.
i.e. the input... | {"inputs": ["14 3 2012", "14 2 2012", "14 4 2012", "14 4 1177", "20 4 1177", "20 4 1433", "20 3 1433", "14 3 1433", "14 3 1186", "14 1 1186", "7 1 1186", "7 2 1186", "7 2 1946", "7 1 1946", "10 1 1946", "10 1 3808", "2 1 3808", "2 1 6973", "0 1 6973", "0 2 6973", "0 2 13465", "0 2 11195", "0 1 11195", "1 1 11195", "1 0... | 6 | [
"PYTHON3"
] | 1 | 2 | code_contests | |
40db3db8370ae846c1c465035afdcdf3 | seg003 | Problem description.
The problem statement is simple , you are given an array and you have to perform two types of operation on it.
Type 1 : update the value of array at the given index.
Type 2 : find the maximum sum you can obtained in the given range ( L , R ) by taking any two index i and j , such that ( L <=... | {"inputs": ["5 3 \n1 2 3 4 5\n2 1 5\n1 2 5\n2 1 5"], "outputs": ["9 \n10"]} | 6 | [
"PYTHON3"
] | 1 | 2 | code_contests | |
f1301671002c44ea460612e1e40e4e9f | 1003_D. Coins and Queries | Polycarp has n coins, the value of the i-th coin is a_i. It is guaranteed that all the values are integer powers of 2 (i.e. a_i = 2^d for some non-negative integer number d).
Polycarp wants to know answers on q queries. The j-th query is described as integer number b_j. The answer to the query is the minimum number of... | {"inputs": ["5 4\n2 4 8 2 4\n8\n5\n14\n10\n", "1 10\n8\n1\n2\n3\n4\n5\n6\n7\n8\n9\n16\n", "1 10\n4\n1\n2\n3\n4\n5\n6\n7\n8\n9\n16\n", "1 10\n2\n1\n2\n3\n4\n5\n6\n7\n8\n9\n16\n", "1 10\n1\n1\n2\n3\n4\n5\n6\n7\n8\n9\n16\n", "3 3\n1 1 1\n1\n2\n3\n", "4 1\n2 4 16 32\n14\n", "1 10\n8\n1\n2\n3\n4\n5\n6\n7\n13\n9\n16\n", "1 1... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
6d19897861cd68fb80861c1fef9b7e26 | 1027_E. Inverse Coloring | You are given a square board, consisting of n rows and n columns. Each tile in it should be colored either white or black.
Let's call some coloring beautiful if each pair of adjacent rows are either the same or different in every position. The same condition should be held for the columns as well.
Let's call some col... | {"inputs": ["2 3\n", "1 1\n", "49 1808\n", "4 15\n", "4 2\n", "467 4\n", "4 11\n", "4 7\n", "3 1\n", "4 14\n", "500 125000\n", "3 7\n", "499 248999\n", "3 2\n", "4 9\n", "3 4\n", "2 2\n", "4 12\n", "499 249001\n", "4 5\n", "499 249000\n", "4 13\n", "3 8\n", "467 1\n", "4 8\n", "4 6\n", "2 1\n", "4 1\n", "2 4\n", "3 6\n... | 11 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
11fd7d796534acf0e6c2ffcc2000ffb0 | 1046_D. Interstellar battle | In the intergalactic empire Bubbledom there are N planets, of which some pairs are directly connected by two-way wormholes. There are N-1 wormholes. The wormholes are of extreme religious importance in Bubbledom, a set of planets in Bubbledom consider themselves one intergalactic kingdom if and only if any two planets ... | {"inputs": ["5\n0.50 0.29 0.49 0.95 0.83\n2 3\n0 3\n3 4\n2 1\n3\n4 0.66\n1 0.69\n0 0.36\n", "26\n0.98 0.64 0.06 0.90 0.01 0.73 0.21 0.98 0.65 1.00 0.87 0.85 0.01 0.06 0.65 0.00 0.65 0.40 0.71 0.80 0.66 0.16 0.54 0.39 0.21 0.29\n20 21\n9 23\n9 0\n17 13\n16 20\n1 8\n9 4\n22 15\n14 17\n14 6\n2 16\n5 19\n11 23\n2 14\n12 10... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
646b6557475f3ad62a7c2eae927b50a2 | 1070_C. Cloud Computing | Buber is a Berland technology company that specializes in waste of investor's money. Recently Buber decided to transfer its infrastructure to a cloud. The company decided to rent CPU cores in the cloud for n consecutive days, which are numbered from 1 to n. Buber requires k CPU cores each day.
The cloud provider offer... | {"inputs": ["7 13 5\n2 3 10 7\n3 5 10 10\n1 2 10 6\n4 5 10 9\n3 4 10 8\n", "4 100 3\n3 3 2 5\n1 1 3 2\n2 4 4 4\n", "5 7 3\n1 4 5 3\n1 3 5 2\n2 5 10 1\n", "5 2 5\n3 5 2 1\n2 3 1 4\n1 4 3 1\n2 3 1 2\n2 3 1 5\n", "2 1 1\n1 2 1 1\n", "1 2 1\n1 1 3 1\n", "2 1 5\n1 1 1 4\n2 2 1 1\n1 2 1 1\n1 2 1 3\n2 2 1 2\n", "5 1 5\n1 5 1 ... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
369ff59f422232b72aeae05a0e8824f0 | 1091_G. New Year and the Factorisation Collaboration | Integer factorisation is hard. The RSA Factoring Challenge offered $100 000 for factoring RSA-1024, a 1024-bit long product of two prime numbers. To this date, nobody was able to claim the prize. We want you to factorise a 1024-bit number.
Since your programming language of choice might not offer facilities for handli... | {"inputs": ["21\n\n7\n\n17\n\n15\n\n17\n\n11\n\n-1\n\n15\n\n", "3\n230967221047542071272908186525868331398921682471308664253988778356539397562182960087 182611080502122916090565666030857827681271950069759605734177210648361435031281924911 20558124518720812021713072667920464230570676159940964371555251615699135858693492398... | 13 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
3c1a543f40721ce54505caa8ffd2414b | 1110_E. Magic Stones | Grigory has n magic stones, conveniently numbered from 1 to n. The charge of the i-th stone is equal to c_i.
Sometimes Grigory gets bored and selects some inner stone (that is, some stone with index i, where 2 ≤ i ≤ n - 1), and after that synchronizes it with neighboring stones. After that, the chosen stone loses its ... | {"inputs": ["4\n7 2 4 12\n7 15 10 12\n", "3\n4 4 4\n1 2 3\n", "10\n62159435 282618243 791521863 214307200 976959598 590907019 166397456 708291256 85377387 569889619\n296371399 546807332 272720717 689420404 273026579 74510326 749070707 104458586 450770185 466655231\n", "7\n12 9 8 6 9 12 84\n12 9 8 5 9 12 84\n", "2\n1 3\... | 11 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
30475d77ef4e1df21aa0c23a81ff2958 | 1140_B. Good String | You have a string s of length n consisting of only characters > and <. You may do some operations with this string, for each operation you have to choose some character that still remains in the string. If you choose a character >, the character that comes right after it is deleted (if the character you chose was the l... | {"inputs": ["3\n2\n<>\n3\n><<\n1\n>\n", "1\n9\n>>>>>>>><\n", "13\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n", "14\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n>\n1\n<\n", "3\n2\n<>\n3\n><<\n1\n>\n", "13\n1\n>\n1\n?\n1\n>\n1\n>\n1\n>\n... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
90384a211601de42db9ab19d5fbdec7e | 1158_F. Density of subarrays | Let c be some positive integer. Let's call an array a_1, a_2, …, a_n of positive integers c-array, if for all i condition 1 ≤ a_i ≤ c is satisfied. Let's call c-array b_1, b_2, …, b_k a subarray of c-array a_1, a_2, …, a_n, if there exists such set of k indices 1 ≤ i_1 < i_2 < … < i_k ≤ n that b_j = a_{i_j} for all 1 ≤... | {"inputs": ["5 2\n1 2 1 2 1\n", "3 3\n1 2 3\n", "4 1\n1 1 1 1\n", "2 1\n1 1\n", "2 3\n3 1\n", "100 5\n5 5 2 4 5 4 4 4 4 2 5 3 4 2 4 4 1 1 5 3 2 2 1 3 3 2 5 3 4 5 1 3 5 4 4 4 3 1 4 4 3 4 5 2 5 4 2 1 2 2 3 5 5 5 1 4 5 3 1 4 2 2 5 1 5 3 4 1 5 1 2 2 3 5 1 3 2 4 2 4 2 2 4 1 3 5 2 2 2 3 3 4 3 2 2 5 5 4 2 5\n", "11 3\n1 3 2 1... | 12 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
5b085f4472b563a0865a9a38e2a004dc | 1180_E. Serge and Dining Room | Serge came to the school dining room and discovered that there is a big queue here. There are m pupils in the queue. He's not sure now if he wants to wait until the queue will clear, so he wants to know which dish he will receive if he does. As Serge is very tired, he asks you to compute it instead of him.
Initially t... | {"inputs": ["1 1\n1\n1\n1\n2 1 100\n", "4 6\n1 8 2 4\n3 3 6 1 5 2\n3\n1 1 1\n2 5 10\n1 1 6\n", "1 1\n1\n1\n1\n1 1 100\n", "4 1\n7 6 1 1\n3\n3\n2 1 9\n2 1 10\n2 1 6\n", "5 1\n8 4 8 7 3\n9\n5\n2 1 3\n1 5 1\n2 1 8\n2 1 7\n2 1 3\n", "3 5\n3 2 8\n1 2 8 1 1\n4\n1 3 3\n1 2 2\n2 2 10\n1 1 5\n", "4 1\n7 6 1 2\n3\n3\n2 1 9\n2 1 ... | 11 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
6e2c64009851c6b0213815a620ab0c0f | 1199_E. Matching vs Independent Set | You are given a graph with 3 ⋅ n vertices and m edges. You are to find a matching of n edges, or an independent set of n vertices.
A set of edges is called a matching if no two edges share an endpoint.
A set of vertices is called an independent set if no two vertices are connected with an edge.
Input
The first line... | {"inputs": ["4\n1 2\n1 3\n1 2\n1 2\n1 3\n1 2\n2 5\n1 2\n3 1\n1 4\n5 1\n1 6\n2 15\n1 2\n1 3\n1 4\n1 5\n1 6\n2 3\n2 4\n2 5\n2 6\n3 4\n3 5\n3 6\n4 5\n4 6\n5 6\n", "1\n5 39\n1 2\n3 4\n5 6\n7 8\n1 9\n3 10\n3 11\n5 12\n5 13\n7 14\n7 15\n9 2\n10 2\n11 2\n12 2\n13 2\n14 2\n15 2\n9 4\n10 4\n11 4\n12 4\n13 4\n14 4\n15 4\n9 6\n10... | 11 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
afa689048db3854af8e1b531f4058add | 1216_D. Swords | There were n types of swords in the theater basement which had been used during the plays. Moreover there were exactly x swords of each type. y people have broken into the theater basement and each of them has taken exactly z swords of some single type. Note that different people might have taken different types of swo... | {"inputs": ["2\n2 9\n", "3\n3 12 6\n", "7\n2 1000000000 4 6 8 4 2\n", "6\n13 52 0 13 26 52\n", "10\n100000000 200000000 300000000 20 500000000 600000000 700000000 800000000 900000000 1000000000\n", "10\n1 1000000000 1 1 1 1 1 1 1 1\n", "5\n0 0 1 0 0\n", "10\n1000000000 1 2 3 4 5 6 7 8 9\n", "3\n1000000000 1 1000000000\... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
ab296b0ee112044e0121dbaa79e1b3df | 1239_E. Turtle | Kolya has a turtle and a field of size 2 × n. The field rows are numbered from 1 to 2 from top to bottom, while the columns are numbered from 1 to n from left to right.
Suppose in each cell of the field there is a lettuce leaf. The energy value of lettuce leaf in row i and column j is equal to a_{i,j}. The turtle is i... | {"inputs": ["3\n1 0 1\n0 0 0\n", "2\n1 4\n2 3\n", "3\n0 0 0\n0 0 0\n", "25\n11632 6805 12792 25513 4573 48789 42308 23247 17502 23125 43597 22173 45527 8637 33001 23532 16047 26169 49458 32012 44865 11178 34515 12381 2780\n21476 20495 26007 43987 19150 12922 29730 13310 19333 34685 25982 10775 25880 20230 34685 37998 3... | 11 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
e6c674ab6a7b77e47a8f112a041c07dd | 1257_G. Divisor Set | You are given an integer x represented as a product of n its prime divisors p_1 ⋅ p_2, ⋅ … ⋅ p_n. Let S be the set of all positive integer divisors of x (including 1 and x itself).
We call a set of integers D good if (and only if) there is no pair a ∈ D, b ∈ D such that a ≠ b and a divides b.
Find a good subset of S ... | {"inputs": ["3\n2999999 43 2999957\n", "6\n2 3 2 3 2 2\n", "16\n2 2 2 2 2 3 3 3 3 5 5 7 7 11 13 17\n", "16\n2 2 2 2 2 2 2 2 3 3 5 5 7 11 13 17\n", "16\n2 2 2 2 2 2 3 3 3 5 5 7 7 11 13 17\n", "16\n2 2 2 2 2 2 3 3 3 3 3 5 7 11 13 17\n", "1\n2999999\n", "16\n2 2 2 2 2 2 2 2 2 3 3 5 7 11 13 17\n", "16\n2 2 2 3 3 3 5 5 5 7 ... | 13 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
1c57bf54a7117382933986666d8a53cd | 1281_B. Azamon Web Services | Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high enough on the search engines. If only he could rename his products to have better ... | {"inputs": ["3\nAZAMON APPLE\nAZAMON AAAAAAAAAAALIBABA\nAPPLE BANANA\n", "3\nAZAMON APPLE\nAZAMON AAAAAAAAAAALIBABA\nAPPLE BANANA\n", "3\nAZAMON APPLE\nAZOMAN AAAAAAAAAAALIBABA\nAPPLE BANANA\n", "3\nAZAMNO ELPPA\nAZAMON AAAAAAAAAAALIBABA\nAPPLE BANANA\n", "3\nAZAMON APPLE\nAZAMON AAAAAAAAAAALIBABA\nAPPLF ANANAB\n", "3\... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
2ae34b2c9f679730d4824fbf5d6a1fae | 1301_B. Motarack's Birthday | Dark is going to attend Motarack's birthday. Dark decided that the gift he is going to give to Motarack is an array a of n non-negative integers.
Dark created that array 1000 years ago, so some elements in that array disappeared. Dark knows that Motarack hates to see an array that has two adjacent elements with a high... | {"inputs": ["7\n5\n-1 10 -1 12 -1\n5\n-1 40 35 -1 35\n6\n-1 -1 9 -1 3 -1\n2\n-1 -1\n2\n0 -1\n4\n1 -1 3 -1\n7\n1 -1 7 5 2 -1 5\n", "7\n5\n-1 10 -1 12 -1\n5\n-1 40 35 -1 35\n6\n-1 -1 9 -1 3 -1\n2\n-1 -1\n2\n0 -1\n4\n1 -1 3 -1\n7\n1 -1 7 5 2 -1 5\n", "7\n5\n-1 10 -1 12 -1\n5\n-1 40 35 -1 35\n6\n-1 -1 9 -1 3 -1\n2\n-1 -1\n... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
207baf27959e44e4ac4e9948743c397d | 1325_B. CopyCopyCopyCopyCopy | Ehab has an array a of length n. He has just enough free time to make a new array consisting of n copies of the old array, written back-to-back. What will be the length of the new array's longest increasing subsequence?
A sequence a is a subsequence of an array b if a can be obtained from b by deletion of several (pos... | {"inputs": ["2\n3\n3 2 1\n6\n3 1 4 1 5 9\n", "1\n5\n1 3 4 5 2\n", "1\n3\n1 1 274005660\n", "4\n7\n6 6 8 8 6 6 6\n1\n2\n5\n4 5 9 8 7\n7\n1 2 7 1 6 10 2\n", "2\n3\n1 1 1\n2\n1 1\n", "2\n2\n1 1\n1\n1\n", "2\n5\n5 5 5 5 5\n3\n1 2 5\n", "2\n5\n1 2 3 4 5\n4\n2 3 4 5\n", "2\n4\n1 3 3 3\n3\n1 2 3\n", "1\n5\n2 3 4 5 2\n", "1\n3... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
b5bfc4ef9dc1ae1328575781a80c4574 | 1344_A. Hilbert's Hotel | Hilbert's Hotel is a very unusual hotel since the number of rooms is infinite! In fact, there is exactly one room for every integer, including zero and negative integers. Even stranger, the hotel is currently at full capacity, meaning there is exactly one guest in every room. The hotel's manager, David Hilbert himself,... | {"inputs": ["6\n1\n14\n2\n1 -1\n4\n5 5 5 1\n3\n3 2 1\n2\n0 1\n5\n-239 -2 -100 -3 -11\n", "10\n3\n-15 -33 79\n16\n45 -84 19 85 69 -64 93 -70 0 -53 2 -52 -55 66 33 -60\n2\n14 -2\n4\n-65 -76 5 25\n5\n55 -66 63 -66 -35\n5\n-87 59 78 2 -10\n1\n25\n1\n-19\n1\n-8\n12\n32 34 43 -83 57 8 -86 88 -25 96 22 -44\n", "10\n1\n1000000... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
6f3d1794f0ed9918df732e03b99ed4c3 | 1366_A. Shovels and Swords | Polycarp plays a well-known computer game (we won't mention its name). In this game, he can craft tools of two types — shovels and swords. To craft a shovel, Polycarp spends two sticks and one diamond; to craft a sword, Polycarp spends two diamonds and one stick.
Each tool can be sold for exactly one emerald. How many... | {"inputs": ["4\n4 4\n1000000000 0\n7 15\n8 7\n", "1\n656 656\n", "1\n666 666\n", "2\n7 4\n1 5\n", "1\n33993 5\n", "1\n1656 5\n", "1\n1319 1777\n", "1\n667 666\n", "1\n656 281\n", "1\n666 760\n", "2\n10 4\n1 5\n", "1\n33993 6\n", "1\n1656 9\n", "1\n1425 1777\n", "1\n667 288\n", "4\n4 4\n1000000000 0\n12 15\n8 7\n", "1\n... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
195db11a6ffd60b8a4a9e0a4a4c4d14f | 1386_A. Colors | Linda likes to change her hair color from time to time, and would be pleased if her boyfriend Archie would notice the difference between the previous and the new color. Archie always comments on Linda's hair color if and only if he notices a difference — so Linda always knows whether Archie has spotted the difference o... | {"inputs": ["1\n\n7\n\n1\n\n1\n\n0\n\n0\n\n1\n", "46\n63 1\n63 63\n123 1\n123 123\n63 2\n63 62\n123 2\n123 122\n63 3\n63 61\n123 3\n123 121\n63 4\n63 60\n123 4\n123 120\n63 5\n63 59\n123 5\n123 119\n66 65\n80 30\n114 107\n95 66\n87 83\n103 40\n71 65\n72 48\n104 93\n93 14\n65 61\n118 4\n75 68\n108 26\n97 94\n106 5\n84 8... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
82e528a863b9828c8d57388822dbf252 | 1408_A. Circle Coloring | You are given three sequences: a_1, a_2, …, a_n; b_1, b_2, …, b_n; c_1, c_2, …, c_n.
For each i, a_i ≠ b_i, a_i ≠ c_i, b_i ≠ c_i.
Find a sequence p_1, p_2, …, p_n, that satisfy the following conditions:
* p_i ∈ \\{a_i, b_i, c_i\}
* p_i ≠ p_{(i mod n) + 1}.
In other words, for each element, you need to choose ... | {"inputs": ["5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3\n", "5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
d57f00bd7b87cf667fdcd1a04a6d0854 | 1428_D. Bouncing Boomerangs | To improve the boomerang throwing skills of the animals, Zookeeper has set up an n × n grid with some targets, where each row and each column has at most 2 targets each. The rows are numbered from 1 to n from top to bottom, and the columns are numbered from 1 to n from left to right.
For each column, Zookeeper will t... | {"inputs": ["1\n0\n", "6\n2 0 3 0 1 1\n", "6\n3 2 2 2 1 1\n", "6\n0 1 3 2 1 2\n", "4\n1 2 3 1\n", "4\n1 1 1 2\n", "4\n3 3 2 1\n", "4\n1 2 1 1\n", "4\n1 1 2 1\n", "1\n3\n", "6\n1 3 2 0 3 1\n", "4\n1 3 2 1\n", "4\n2 3 1 1\n", "4\n3 1 1 1\n", "4\n3 2 3 1\n", "4\n2 1 2 1\n", "6\n0 2 1 3 2 3\n", "4\n1 3 3 1\n", "4\n2 3 3 1\... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
741c8beffa4fa3d5bd6f5fe57341a6be | 1451_D. Circle Game | Utkarsh is forced to play yet another one of Ashish's games. The game progresses turn by turn and as usual, Ashish moves first.
Consider the 2D plane. There is a token which is initially at (0,0). In one move a player must increase either the x coordinate or the y coordinate of the token by exactly k. In doing so, the... | {"inputs": ["5\n2 1\n5 2\n10 3\n25 4\n15441 33\n", "5\n2 1\n5 2\n10 3\n25 4\n25479 33\n", "5\n2 1\n9 1\n10 3\n25 4\n25479 33\n", "5\n1 1\n9 1\n10 3\n46 4\n25479 33\n", "5\n2 1\n5 1\n10 3\n25 3\n25479 33\n", "5\n2 1\n9 1\n10 3\n25 4\n25479 57\n", "5\n2 1\n9 1\n11 3\n25 4\n25479 57\n", "5\n2 1\n4 1\n10 3\n46 4\n25479 47\... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
a2a7d6e29dbeef0061e85bfedd6f45e7 | 1475_D. Cleaning the Phone | Polycarp often uses his smartphone. He has already installed n applications on it. Application with number i takes up a_i units of memory.
Polycarp wants to free at least m units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with the fol... | {"inputs": ["5\n5 7\n5 3 2 1 4\n2 1 1 2 1\n1 3\n2\n1\n5 10\n2 3 2 3 2\n1 2 1 2 1\n4 10\n5 1 3 4\n1 2 1 2\n4 5\n3 2 1 2\n2 1 2 1\n", "1\n17 20\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 6 10 10\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2\n", "5\n5 7\n5 3 2 1 4\n2 1 1 2 1\n1 3\n2\n1\n5 10\n2 3 2 3 2\n1 1 1 2 1\n4 10\n5 1 3 4\n1 2 1 2\n4 5\n3 2... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
74037d2a430b8d8313bbc040fe837abe | 1500_B. Two chandeliers | Vasya is a CEO of a big construction company. And as any other big boss he has a spacious, richly furnished office with two crystal chandeliers. To stay motivated Vasya needs the color of light at his office to change every day. That's why he ordered both chandeliers that can change its color cyclically. For example: r... | {"inputs": ["3 8 41\n1 3 2\n1 6 4 3 5 7 2 8\n", "1 2 31\n1\n1 2\n", "4 2 4\n4 2 3 1\n2 1\n", "20 101 100\n1 14 20 3 19 10 12 18 4 17 13 6 8 5 2 15 7 16 9 11\n69 53 101 100 41 38 63 84 96 21 57 93 13 43 90 86 7 20 87 88 59 49 80 82 40 18 9 1 2 67 6 15 99 79 16 22 56 19 60 61 85 28 65 8 23 46 39 25 48 36 64 98 37 27 45 1... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
7bb20a9d9bde75db9c5b9bec143c80bc | 1525_D. Armchairs | There are n armchairs, numbered from 1 to n from left to right. Some armchairs are occupied by people (at most one person per armchair), others are not. The number of occupied armchairs is not greater than n/2.
For some reason, you would like to tell people to move from their armchairs to some other ones. If the i-th ... | {"inputs": ["6\n1 1 1 0 0 0\n", "5\n0 0 0 0 0\n", "7\n1 0 0 1 0 0 1\n", "100\n0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0\n", "2\n1 0\n", "2\n0 0\n", "100\n1 1 0 1 ... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
061b0aba62d36e3ca2c2414f23f7037b | 157_A. Game Outcome | Sherlock Holmes and Dr. Watson played some game on a checkered board n × n in size. During the game they put numbers on the board's squares by some tricky rules we don't know. However, the game is now over and each square of the board contains exactly one number. To understand who has won, they need to count the number... | {"inputs": ["1\n1\n", "2\n1 2\n3 4\n", "4\n5 7 8 4\n9 5 3 2\n1 6 6 4\n9 5 7 3\n", "9\n53 80 94 41 58 49 88 24 42\n85 11 32 64 40 56 63 95 73\n17 85 60 41 13 71 54 67 87\n38 14 21 81 66 59 52 33 86\n29 34 46 18 19 80 10 44 51\n4 27 65 75 77 21 15 49 50\n35 68 86 98 98 62 69 52 71\n43 28 56 91 89 21 14 57 79\n27 27 29 26... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
922e52eb45f84b091c95a35670ce46e6 | 178_A1. Educational Game | The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.
The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. some prefix of the sequenc... | {"inputs": ["8\n1 2 3 4 5 6 7 8\n", "4\n1 0 1 2\n", "80\n72 66 82 46 44 22 63 92 71 65 5 30 45 84 29 73 9 90 25 19 26 15 12 29 33 19 85 92 91 66 83 39 100 53 20 99 11 81 26 41 36 51 21 72 28 100 34 3 24 58 11 85 73 18 4 45 90 99 42 85 26 71 58 49 76 32 88 13 40 98 57 95 20 36 70 66 75 12 54 96\n", "80\n72 66 82 46 44 2... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
ca005188dd79e361933fd6c0171e8f89 | 19_B. Checkout Assistant | Bob came to a cash & carry store, put n items into his trolley, and went to the checkout counter to pay. Each item is described by its price ci and time ti in seconds that a checkout assistant spends on this item. While the checkout assistant is occupied with some item, Bob can steal some other items from his trolley. ... | {"inputs": ["4\n2 10\n0 20\n1 5\n1 3\n", "3\n0 1\n0 10\n0 100\n", "5\n0 968804136\n0 736567537\n2 343136264\n0 259899572\n1 425744418\n", "5\n0 51690939\n0 62436494\n0 39009053\n0 70426298\n0 631569476\n", "5\n5 491957578\n4 747764103\n3 446810728\n4 896625835\n4 190748656\n", "2\n2 87623264\n0 864627704\n", "10\n3 512... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
20c388490676a38a07511f8c3dbd815d | 223_C. Partial Sums | You've got an array a, consisting of n integers. The array elements are indexed from 1 to n. Let's determine a two step operation like that:
1. First we build by the array a an array s of partial sums, consisting of n elements. Element number i (1 ≤ i ≤ n) of array s equals <image>. The operation x mod y means that ... | {"inputs": ["5 0\n3 14 15 92 6\n", "3 1\n1 2 3\n", "10 1000000\n1 2 3 4 84 5 6 7 8 9\n", "1 1\n3\n", "13 666\n84 89 29 103 128 233 190 122 117 208 119 97 200\n", "1 0\n0\n", "42 42\n42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42\n", "4 1\n3 ... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
2ac8d514dfdc168544ada654fa66d762 | 248_A. Cupboards | One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.
Karlsson's gaze immediately fell on n wooden ... | {"inputs": ["5\n0 1\n1 0\n0 1\n1 1\n0 1\n", "8\n0 1\n1 0\n0 1\n1 1\n0 1\n1 0\n0 1\n1 0\n", "8\n1 0\n1 0\n1 0\n0 1\n0 1\n1 1\n1 1\n0 1\n", "2\n0 0\n0 0\n", "3\n0 1\n1 1\n1 1\n", "5\n1 0\n1 0\n1 0\n0 1\n0 1\n", "15\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n", "8\n0 1\n1 0\n0 1\n1 1\n0 0\... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
af0ca9121a5dc494fe535749a64ad364 | 272_B. Dima and Sequence | Dima got into number sequences. Now he's got sequence a1, a2, ..., an, consisting of n positive integers. Also, Dima has got a function f(x), which can be defined with the following recurrence:
* f(0) = 0;
* f(2·x) = f(x);
* f(2·x + 1) = f(x) + 1.
Dima wonders, how many pairs of indexes (i, j) (1 ≤ i < j ≤... | {"inputs": ["3\n1 2 4\n", "3\n5 3 1\n", "6\n396640239 62005863 473635171 329666981 510631133 207643327\n", "4\n363034183 741262741 657823174 453546052\n", "2\n7 1\n", "1\n1\n", "2\n1 1\n", "8\n851991424 32517099 310793856 776130403 342626527 58796623 49544509 517126753\n", "8\n7 1 2 7 6 8 6 5\n", "2\n469264357 99656949... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
c8c3a5eaea5f8e7d87953ca72ca1bf46 | 295_D. Greg and Caves | Greg has a pad. The pad's screen is an n × m rectangle, each cell can be either black or white. We'll consider the pad rows to be numbered with integers from 1 to n from top to bottom. Similarly, the pad's columns are numbered with integers from 1 to m from left to right.
Greg thinks that the pad's screen displays a c... | {"inputs": ["3 5\n", "1 1\n", "4 4\n", "5 3\n", "1500 2000\n", "500 1000\n", "1000 1000\n", "5 5\n", "2000 2\n", "1000 500\n", "3 1000\n", "2000 1\n", "1 2\n", "3 1999\n", "100 100\n", "1 1000\n", "1000 3\n", "7 8\n", "9 8\n", "10 10\n", "2000 1777\n", "1000 1\n", "100 200\n", "10 500\n", "1998 4\n", "2 2000\n", "10 10... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
845588b47738a7fc311e7fa9da2ee464 | 319_B. Psychos in a Line | There are n psychos standing in a line. Each psycho is assigned a unique integer from 1 to n. At each step every psycho who has an id greater than the psycho to his right (if exists) kills his right neighbor in the line. Note that a psycho might kill and get killed at the same step.
You're given the initial arrangeme... | {"inputs": ["6\n1 2 3 4 5 6\n", "10\n10 9 7 8 6 5 3 4 2 1\n", "2\n1 2\n", "100\n61 96 25 10 50 71 38 77 76 75 59 100 89 66 6 99 2 13 3 23 91 93 22 92 4 86 90 44 39 31 9 47 28 95 18 54 1 73 94 78 60 20 42 84 97 83 16 81 67 64 74 46 82 5 88 80 14 48 53 79 30 11 62 21 41 70 63 58 51 56 57 17 87 72 27 85 68 49 52 8 12 98 4... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
63b81adff9e2c491e3b352a5b0635f97 | 343_B. Alternating Current | Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glance and started experimenting right away. After a while Mike observed that the wires ended u... | {"inputs": ["-++-\n", "++\n", "+-\n", "-\n", "+-+--+-+\n", "+-+--+\n", "+-+++-\n", "+++-\n", "-++-+--++--+-++-\n", "-+++--\n", "-+--+-\n", "+-++-+\n", "+++---+++---\n", "+-+-\n", "-+-+-+\n", "+++---\n", "++--++\n", "+---+\n", "--++-+\n", "-+\n", "-+-\n", "--\n", "-+++++\n", "+-+-++\n", "+++\n", "-+-+-+-+-+-+-++-+-+-+-+... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
d95914d3f745ff2e7d72419690f1661a | 366_D. Dima and Trap Graph | Dima and Inna love spending time together. The problem is, Seryozha isn't too enthusiastic to leave his room for some reason. But Dima and Inna love each other so much that they decided to get criminal...
Dima constructed a trap graph. He shouted: "Hey Seryozha, have a look at my cool graph!" to get his roommate inter... | {"inputs": ["4 4\n1 2 1 10\n2 4 3 5\n1 3 1 5\n2 4 2 7\n", "5 6\n1 2 1 10\n2 5 11 20\n1 4 2 5\n1 3 10 11\n3 4 12 10000\n4 5 6 6\n", "5 5\n1 5 9403 40347\n1 3 13851 29314\n4 5 1315 561894\n3 5 2748 33090\n5 3 10717 32306\n", "2 1\n1 2 1 1\n", "1000 0\n", "10 0\n", "6 6\n1 2 1 10\n2 3 1 10\n3 6 1 1\n1 4 1 4\n4 5 1 3\n5 6 ... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
8123e4f811faca01317a28c6beb19454 | 38_C. Blinds | The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The problem is that all of them are spare details from different orders, that is, they ma... | {"inputs": ["5 3\n5 5 7 3 1\n", "4 2\n1 2 3 4\n", "2 3\n1 2\n", "93 10\n6 47 6 89 21 91 51 72 32 48 54 89 36 12 25 38 58 62 54 16 5 52 52 85 67 33 81 72 6 42 91 16 29 78 56 62 75 48 69 12 89 34 27 15 7 80 14 57 29 6 80 46 64 94 83 96 1 42 11 41 15 26 17 36 44 11 68 73 93 45 73 35 91 14 84 48 7 8 63 84 59 68 87 26 91 10... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
6c0b53bc435f909471acfe88aceef5d0 | 40_B. Repaintings | A chessboard n × m in size is given. During the zero minute we repaint all the black squares to the 0 color. During the i-th minute we repaint to the i color the initially black squares that have exactly four corner-adjacent squares painted i - 1 (all such squares are repainted simultaneously). This process continues a... | {"inputs": ["1 1\n1\n", "3 3\n2\n", "3 3\n1\n", "2016 4549\n433\n", "5000 1\n3\n", "4035 369\n26\n", "1595 2881\n710\n", "3762 3914\n1073\n", "4583 2774\n1206\n", "10 10\n1\n", "1812 240\n9\n", "991 2301\n291\n", "3154 527\n112\n", "1353 2988\n589\n", "4999 1\n7\n", "3432 4788\n1203\n", "3990 1800\n171\n", "5000 5000\n... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
f1b743c598faf60b17470822e998a85e | 438_A. The Child and Toy | On Children's Day, the child got a toy from Delayyy as a present. However, the child is so naughty that he can't wait to destroy the toy.
The toy consists of n parts and m ropes. Each rope links two parts, but every pair of parts is linked by at most one rope. To split the toy, the child must remove all its parts. The... | {"inputs": ["4 4\n100 100 100 100\n1 2\n2 3\n2 4\n3 4\n", "4 3\n10 20 30 40\n1 4\n1 2\n2 3\n", "7 10\n40 10 20 10 20 80 40\n1 5\n4 7\n4 5\n5 2\n5 7\n6 4\n1 6\n1 3\n4 3\n1 4\n", "1 0\n23333\n", "3 3\n1 1 1\n1 2\n2 3\n3 1\n", "5 4\n1 2 2 2 2\n1 2\n1 3\n1 4\n1 5\n", "10 30\n3 6 17 15 13 15 6 12 9 1\n3 8\n1 10\n4 7\n1 7\n3... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
725a3bb3dae7c7e400ea42067160b85c | 45_H. Road Problem | The Berland capital (as you very well know) contains n junctions, some pairs of which are connected by two-way roads. Unfortunately, the number of traffic jams in the capital has increased dramatically, that's why it was decided to build several new roads. Every road should connect two junctions.
The city administrat... | {"inputs": ["4 4\n1 2\n2 3\n2 4\n3 4\n", "4 3\n1 2\n2 3\n3 4\n", "10 9\n7 9\n8 9\n8 2\n10 6\n8 3\n9 4\n2 6\n8 5\n9 1\n", "2 1\n1 2\n", "20 20\n1 9\n11 9\n3 5\n15 13\n1 20\n11 18\n10 6\n10 8\n10 19\n12 16\n10 3\n9 18\n8 4\n15 1\n13 16\n11 2\n7 20\n10 15\n3 17\n17 14\n", "20 20\n2 17\n5 17\n14 4\n4 11\n5 1\n4 9\n18 16\n1... | 14 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
d1f8e6bb3150e90b1c2574aab490e92e | 483_B. Friends and Presents | You have two friends. You want to present each of them several positive integers. You want to present cnt1 numbers to the first friend and cnt2 numbers to the second friend. Moreover, you want all presented numbers to be distinct, that also means that no number should be presented to both friends.
In addition, the fir... | {"inputs": ["3 1 2 3\n", "1 3 2 3\n", "1 999999999 29983 29989\n", "9999999 10000 29983 29989\n", "808351 17767 433 509\n", "197 2 6361 18223\n", "5099 2895 16273 29473\n", "500000000 500000000 2 3\n", "1000 9999999 29983 29989\n", "1277613 596606 10427 29387\n", "26941620 135675892 4093 28979\n", "39 154 1033 18947\n"... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
d9b67b7e49ce7822c4f0ea811df6f5a2 | 507_B. Amr and Pins | Amr loves Geometry. One day he came up with a very interesting problem.
Amr has a circle of radius r and center in point (x, y). He wants the circle center to be in new position (x', y').
In one step Amr can put a pin to the border of the circle in a certain point, then rotate the circle around that pin by any angle ... | {"inputs": ["1 1 1 4 4\n", "2 0 0 0 4\n", "4 5 6 5 6\n", "1 100000 100000 100000 -100000\n", "46456 -2621 -23623 -98302 -99305\n", "9 20 0 40 0\n", "100000 -100000 -100000 100000 100000\n", "5 6 3 7 2\n", "97741 23818 78751 97583 26933\n", "99125 26876 -21414 14176 17443\n", "56767 -29030 51625 79823 -56297\n", "125 45... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
dcbacff787955b773244dd2f735980ac | 556_C. Case of Matryoshkas | Andrewid the Android is a galaxy-famous detective. He is now investigating the case of vandalism at the exhibition of contemporary art.
The main exhibit is a construction of n matryoshka dolls that can be nested one into another. The matryoshka dolls are numbered from 1 to n. A matryoshka with a smaller number can be ... | {"inputs": ["3 2\n2 1 2\n1 3\n", "7 3\n3 1 3 7\n2 2 5\n2 4 6\n", "100 3\n45 1 2 3 4 5 6 7 8 9 19 21 24 27 28 30 34 35 37 39 40 41 42 43 46 47 48 51 52 55 58 59 61 63 64 66 69 71 76 80 85 86 88 89 94 99\n26 10 11 15 18 23 29 31 33 36 38 44 49 54 56 60 62 65 75 78 82 83 84 95 96 97 98\n29 12 13 14 16 17 20 22 25 26 32 45... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
e64f477485afb61bcc0215095284b6f6 | 582_A. GCD Table | The GCD table G of size n × n for an array of positive integers a of length n is defined by formula
<image>
Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as <image>. For example, for array a = {4, 3, 6,... | {"inputs": ["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2\n", "1\n42\n", "2\n1 1 1 1\n", "3\n121339 121339 121339 55451923 531222142 121339 121339 435485671 121339\n", "3\n1 7 923264237 374288891 7 524125987 1 1 1\n", "5\n2029 6087 2029 2029 6087 2029 527243766 4058 2029 2029 2029 2029 2029 2029 2029 2029 165353355 4058 2029 731... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
830559c71a760496bdb70e0440b18559 | 604_A. Uncowed Forces | Kevin Sun has just finished competing in Codeforces Round #334! The round was 120 minutes long and featured five problems with maximum point values of 500, 1000, 1500, 2000, and 2500, respectively. Despite the challenging tasks, Kevin was uncowed and bulldozed through all of them, distinguishing himself from the herd a... | {"inputs": ["20 40 60 80 100\n0 1 2 3 4\n1 0\n", "119 119 119 119 119\n0 0 0 0 0\n10 0\n", "36 102 73 101 19\n5 9 2 2 6\n4 13\n", "119 0 0 0 0\n2 0 0 0 0\n5 5\n", "0 0 119 0 0\n0 0 2 0 0\n5 5\n", "0 0 0 0 0\n10 10 10 10 10\n0 20\n", "0 46 86 72 40\n1 5 5 5 9\n6 5\n", "45 45 75 36 76\n6 2 2 0 0\n8 17\n", "119 119 119 11... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
a217dd2226c4c80077b6f06e1c450ffe | 626_D. Jerry's Protest | Andrew and Jerry are playing a game with Harry as the scorekeeper. The game consists of three rounds. In each round, Andrew and Jerry draw randomly without replacement from a jar containing n balls, each labeled with a distinct positive integer. Without looking, they hand their balls to Harry, who awards the point to t... | {"inputs": ["3\n1 2 10\n", "2\n1 2\n", "11\n54 91 4 6 88 23 38 71 77 26 84\n", "20\n11 37 81 56 61 2 26 27 59 69 24 7 71 76 45 54 89 17 95 20\n", "13\n1 2 4 8 16 32 64 128 256 512 1024 2048 4096\n", "11\n1 2 4 8 16 32 64 128 256 512 1024\n", "4\n2 4 1 3\n", "15\n1 2 3 4 5 10 20 40 80 160 320 640 1280 2560 5000\n", "3\n... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
b0cddbfaed8b7dfc050055643c4bcba1 | 650_B. Image Preview | Vasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent photo by swiping finger over the screen. If you swipe left from the first photo, you reach photo n. Similarly, by swiping right from the last photo you reach photo 1. It takes a sec... | {"inputs": ["5 2 4 13\nhhwhh\n", "3 1 100 10\nwhw\n", "5 2 4 1000\nhhwhh\n", "4 2 3 10\nwwhw\n", "5 2 4 12\nhhhwh\n", "2 5 5 1000000000\nwh\n", "16 1 1000 2100\nhhhwwwhhhwhhhwww\n", "1 2 3 3\nw\n", "10 2 3 32\nhhwwhwhwwh\n", "5 2 4 13\nhhhwh\n", "7 1 1000 13\nhhhhwhh\n", "100 20 100 10202\nwwwwhhwhhwhhwhhhhhwwwhhhwwwhw... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
aa8f8fbedaac9bfdeed3487f6eecb498 | 675_E. Trains and Statistic | Vasya commutes by train every day. There are n train stations in the city, and at the i-th station it's possible to buy only tickets to stations from i + 1 to ai inclusive. No tickets are sold at the last station.
Let ρi, j be the minimum number of tickets one needs to buy in order to get from stations i to station j.... | {"inputs": ["4\n4 4 4\n", "5\n2 3 5 5\n", "7\n7 3 4 6 6 7\n", "4\n3 3 4\n", "6\n3 3 6 6 6\n", "5\n4 4 4 5\n", "9\n2 9 7 6 9 7 8 9\n", "3\n3 3\n", "8\n3 7 7 8 8 7 8\n", "10\n2 10 8 7 8 8 10 9 10\n", "2\n2\n", "9\n3 9 7 6 9 7 8 9\n", "4\n3 4 4\n", "8\n3 5 7 8 8 7 8\n", "8\n3 8 7 8 8 7 8\n", "7\n7 3 4 7 6 7\n", "5\n3 3 5 ... | 11 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
b4d7d13215be5692b79ebe6568ec5716 | 699_F. Limak and Shooting Points | Bearland is a dangerous place. Limak can’t travel on foot. Instead, he has k magic teleportation stones. Each stone can be used at most once. The i-th stone allows to teleport to a point (axi, ayi). Limak can use stones in any order.
There are n monsters in Bearland. The i-th of them stands at (mxi, myi).
The given k... | {"inputs": ["3 8\n10 20\n0 0\n20 40\n300 600\n30 60\n170 340\n50 100\n28 56\n90 180\n-4 -8\n-1 -2\n", "2 4\n-2 -1\n4 5\n4 2\n2 1\n4 -1\n1 -1\n", "1 10\n778084 -205153\n778001 -205093\n778155 -205118\n778168 -204997\n778066 -205141\n778146 -205036\n778041 -205063\n778012 -204996\n778132 -205128\n778049 -205131\n778049 -... | 12 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
912dcea5533b0a415cc99a2402272e66 | 720_C. Homework | Today Peter has got an additional homework for tomorrow. The teacher has given three integers to him: n, m and k, and asked him to mark one or more squares on a square grid of size n × m.
The marked squares must form a connected figure, and there must be exactly k triples of marked squares that form an L-shaped tromi... | {"inputs": ["3\n3 3 4\n3 3 5\n3 3 3\n", "1\n317 314 18260\n", "1\n315 315 355287\n", "1\n316 314 143218\n", "1\n516 6 6571\n", "1\n317 315 396613\n", "1\n18 5 158\n", "1\n315 316 124373\n", "1\n315 317 46432\n", "1\n314 317 33011\n", "1\n316 316 153829\n", "1\n314 315 29709\n", "1\n315 314 148940\n", "1\n314 314 191131... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
da96c14862fff76178ce3713f2e27f1e | 741_E. Arpa’s abnormal DNA and Mehrdad’s deep interest | All of us know that girls in Arpa’s land are... ok, you’ve got the idea :D
Anyone knows that Arpa isn't a normal man, he is ... well, sorry, I can't explain it more. Mehrdad is interested about the reason, so he asked Sipa, one of the best biology scientists in Arpa's land, for help. Sipa has a DNA editor.
<image>
S... | {"inputs": ["abbbbbbaaa baababaaab 10\n1 2 1 0 0\n2 7 8 4 7\n2 3 9 2 8\n3 4 6 1 1\n0 8 5 2 4\n2 8 10 4 7\n7 10 1 0 0\n1 4 6 0 2\n0 9 8 0 6\n4 8 5 0 1\n", "abc d 4\n0 3 2 0 0\n0 3 1 0 0\n1 2 1 0 0\n0 1 3 2 2\n", "xkbvkadjec gqjlhxpnsx 10\n2 7 1 0 0\n2 5 8 0 0\n4 7 8 0 4\n0 4 7 3 6\n5 5 9 3 7\n7 9 5 0 3\n6 8 6 4 4\n5 7 6... | 11 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
73386d0f5cd2e2cb31c1c1f1da3deb72 | 765_D. Artsem and Saunders | Artsem has a friend Saunders from University of Chicago. Saunders presented him with the following problem.
Let [n] denote the set {1, ..., n}. We will also write f: [x] → [y] when a function f is defined in integer points 1, ..., x, and all its values are integers from 1 to y.
Now then, you are given a function f: [... | {"inputs": ["3\n1 2 3\n", "3\n2 2 2\n", "2\n2 1\n", "3\n2 2 3\n", "5\n1 4 5 4 5\n", "4\n2 2 4 4\n", "3\n1 1 2\n", "4\n1 2 1 2\n", "4\n4 2 2 4\n", "6\n1 2 3 4 5 5\n", "1\n1\n", "10\n4 4 4 4 4 4 4 4 4 4\n", "7\n7 3 3 5 5 7 7\n", "5\n1 2 3 4 3\n", "4\n1 2 1 1\n", "4\n4 2 4 4\n", "6\n1 1 1 4 4 4\n", "2\n1 2\n", "4\n3 4 3 4... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
f4a2ecb83cf8d44fda519af5cbbaefaf | 789_A. Anastasia and pebbles | Anastasia loves going for a walk in Central Uzhlyandian Park. But she became uninterested in simple walking, so she began to collect Uzhlyandian pebbles. At first, she decided to collect all the pebbles she could find in the park.
She has only two pockets. She can put at most k pebbles in each pocket at the same time.... | {"inputs": ["5 4\n3 1 8 9 7\n", "3 2\n2 3 4\n", "10 1\n1 1 1 1 1 1 1 1 1 1\n", "3 57\n78 165 54\n", "1 1\n10000\n", "2 2\n2 2\n", "9 13\n132 87 200 62 168 51 185 192 118\n", "5 72\n74 10 146 189 184\n", "1 22\n1\n", "10 1\n1 0 1 1 1 1 1 1 1 1\n", "3 87\n78 165 54\n", "9 13\n132 166 200 62 168 51 185 192 118\n", "5 72\n... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
49d5bd2bcfc8607c824507883eb03d22 | 80_C. Heroes | The year of 2012 is coming...
According to an ancient choradrican legend in this very year, in 2012, Diablo and his brothers Mephisto and Baal will escape from hell, and innumerable hordes of demons will enslave the human world. But seven brave heroes have already gathered on the top of a mountain Arreat to protect us... | {"inputs": ["3\nTroll likes Dracul\nDracul likes Anka\nSnowy likes Hexadecimal\n210 200 180\n", "2\nAnka likes Chapay\nChapay likes Anka\n10000 50 50\n", "0\n2000000000 2000000000 1\n", "22\nCleo likes Snowy\nCleo likes Troll\nChapay likes Dracul\nSnowy likes Troll\nDracul likes Chapay\nDracul likes Snowy\nChapay likes... | 9 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
a04f8a4312cf1039bf94939f04dbaec7 | 835_A. Key races | Two boys decided to compete in text typing on the site "Key races". During the competition, they have to type a text consisting of s characters. The first participant types one character in v1 milliseconds and has ping t1 milliseconds. The second participant types one character in v2 milliseconds and has ping t2 millis... | {"inputs": ["4 5 3 1 5\n", "5 1 2 1 2\n", "3 3 1 1 1\n", "2 313 856 964 421\n", "61 464 623 89 548\n", "37 261 207 1 1000\n", "4 202 512 995 375\n", "3 3 1 6 9\n", "213 480 811 134 745\n", "1 10 2 6 10\n", "6 5 7 10 4\n", "2 7 6 2 3\n", "29 344 406 900 1\n", "1 2 8 8 5\n", "1 1 1 1 1\n", "424 41 41 909 909\n", "641 31 ... | 7 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
37113893932f9913935f0ef688fd303c | 855_D. Rowena Ravenclaw's Diadem | Harry, upon inquiring Helena Ravenclaw's ghost, came to know that she told Tom Riddle or You-know-who about Rowena Ravenclaw's diadem and that he stole it from her.
Harry thought that Riddle would have assumed that he was the only one to discover the Room of Requirement and thus, would have hidden it there. So Harry ... | {"inputs": ["3\n-1 -1\n1 0\n2 0\n2\n1 1 3\n2 1 3\n", "3\n-1 -1\n1 0\n1 1\n2\n2 2 3\n2 3 2\n", "20\n-1 -1\n1 0\n2 0\n2 1\n2 1\n4 0\n1 0\n4 0\n3 0\n9 0\n6 1\n3 1\n11 1\n2 0\n2 1\n8 1\n14 1\n5 1\n15 0\n18 1\n20\n1 11 11\n2 6 8\n1 13 13\n2 3 4\n2 3 7\n2 14 5\n2 5 4\n1 7 7\n2 10 15\n2 3 5\n1 16 16\n1 20 20\n2 3 4\n1 10 10\n... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
3c6cba5f9e3b514b6b742c8f3356756b | 87_B. Vasya and Types | Programmer Vasya is studying a new programming language &K*. The &K* language resembles the languages of the C family in its syntax. However, it is more powerful, which is why the rules of the actual C-like languages are unapplicable to it. To fully understand the statement, please read the language's description below... | {"inputs": ["17\ntypedef void* b\ntypedef b* c\ntypeof b\ntypeof c\ntypedef &b b\ntypeof b\ntypeof c\ntypedef &&b* c\ntypeof c\ntypedef &b* c\ntypeof c\ntypedef &void b\ntypeof b\ntypedef b******* c\ntypeof c\ntypedef &&b* c\ntypeof c\n", "5\ntypedef void* ptv\ntypeof ptv\ntypedef &&... | 8 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
814aa770f9a818c1f1f37782912b4dc7 | 903_D. Almost Difference | Let's denote a function
<image>
You are given an array a consisting of n integers. You have to calculate the sum of d(ai, aj) over all pairs (i, j) such that 1 ≤ i ≤ j ≤ n.
Input
The first line contains one integer n (1 ≤ n ≤ 200000) — the number of elements in a.
The second line contains n integers a1, a2, ..., ... | {"inputs": ["4\n6 6 5 5\n", "5\n1 2 3 1 3\n", "4\n6 6 4 4\n", "100\n591 417 888 251 792 847 685 3 182 461 102 348 555 956 771 901 712 878 580 631 342 333 285 899 525 725 537 718 929 653 84 788 104 355 624 803 253 853 201 995 536 184 65 205 540 652 549 777 248 405 677 950 431 580 600 846 328 429 134 983 526 103 500 963 ... | 10 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
e1de0893198ccacd3e041f70c023a06a | 925_E. May Holidays | It's May in Flatland, and there are m days in this month. Despite the fact that May Holidays are canceled long time ago, employees of some software company still have a habit of taking short or long vacations in May.
Of course, not all managers of the company like this. There are n employees in the company that form a... | {"inputs": ["5 6\n1 2 3 4\n4 0 0 1 0\n1 5 2 3 -5 -1\n", "7 8\n4 5 1 1 5 5\n0 0 0 1 2 0 0\n2 6 3 7 -2 4 -3 1\n", "10 10\n5 9 1 3 5 8 3 4 7\n2 0 4 7 1 0 0 0 7 0\n5 7 -7 3 10 4 7 2 9 -9\n", "2 2\n1\n0 0\n1 2\n", "2 2\n1\n0 0\n2 -2\n", "10 10\n1 1 3 6 1 2 3 3 6\n3 0 2 0 0 0 0 0 0 0\n7 9 4 -9 6 -6 2 -7 7 10\n", "2 2\n1\n0 0... | 11 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
2adcfcaa077e85f20a909bb2183bb989 | 954_F. Runner's Problem | You are running through a rectangular field. This field can be represented as a matrix with 3 rows and m columns. (i, j) denotes a cell belonging to i-th row and j-th column.
You start in (2, 1) and have to end your path in (2, m). From the cell (i, j) you may advance to:
* (i - 1, j + 1) — only if i > 1,
* (i, ... | {"inputs": ["2 5\n1 3 4\n2 2 3\n", "50 100\n1 71 96\n2 34 52\n2 16 95\n1 54 55\n1 65 85\n1 76 92\n2 19 91\n1 26 43\n2 83 95\n2 70 88\n2 67 88\n1 9 75\n2 4 50\n2 9 11\n1 77 92\n1 28 58\n1 23 72\n1 24 75\n2 12 50\n1 54 55\n2 45 93\n1 88 93\n2 98 99\n1 40 58\n2 40 42\n1 16 61\n2 94 94\n1 82 86\n2 81 85\n2 46 46\n2 88 97\n... | 12 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
7a87d4bd89214bc17cf87c0d7760b71f | 980_E. The Number Games | The nation of Panel holds an annual show called The Number Games, where each district in the nation will be represented by one contestant.
The nation has n districts numbered from 1 to n, each district has exactly one path connecting it to every other district. The number of fans of a contestant from district i is equ... | {"inputs": ["6 3\n2 1\n2 6\n4 2\n5 6\n2 3\n", "8 4\n2 6\n2 7\n7 8\n1 2\n3 1\n2 4\n7 5\n", "64 63\n11 51\n64 11\n64 39\n11 6\n24 64\n51 63\n43 51\n64 29\n6 22\n47 6\n1 47\n41 22\n41 38\n4 47\n35 47\n41 23\n45 1\n52 35\n26 45\n15 35\n21 35\n23 32\n12 21\n21 62\n25 21\n28 25\n15 54\n57 12\n20 28\n48 57\n8 57\n20 44\n46 28... | 11 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
059042f7dd8d7b9d8c662c33742c414c | 9_E. Interesting Graph and Apples | Hexadecimal likes drawing. She has drawn many graphs already, both directed and not. Recently she has started to work on a still-life «interesting graph and apples». An undirected graph is called interesting, if each of its vertices belongs to one cycle only — a funny ring — and does not belong to any other cycles. A f... | {"inputs": ["3 2\n1 2\n2 3\n", "42 28\n7 19\n15 24\n3 42\n18 5\n32 27\n26 20\n40 30\n35 2\n14 8\n22 10\n36 4\n16 14\n21 29\n37 40\n2 12\n30 21\n19 17\n39 34\n31 28\n20 3\n4 33\n11 42\n26 21\n9 10\n4 32\n6 1\n1 14\n14 12\n", "2 2\n1 2\n2 1\n", "3 2\n3 2\n2 1\n", "3 3\n1 3\n2 1\n3 2\n", "2 3\n1 1\n1 2\n2 1\n", "50 27\n10... | 11 | [
"PYTHON3"
] | 2 | 2 | code_contests | |
0571f5aa98cc1231bb591e405ba9aaa1 | bhavanas-and-bhuvanas-bet | Bhavana and Bhuvana place bet every time they see something interesting that can occur with a probability 0.5.
Both of them place a bet for a higher amount which they don’t posses at that time. But when one wins she demands other for the bet amount. For example if Bhuvana wins she asks bhavana for the bet amount.
But... | {"inputs": ["2\n3\n10"], "outputs": ["1\n3"]} | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
5fa14da6b32349f1b335936cbe2aa4cd | cost-of-data-11 | Strings can be efficiently stored as a data structure, to have efficient searching methods.
A new startup is going to use this method, but they don't have much space. So they want to check beforehand how much memory will be required for their data.
Following method describes the way in which this startup's engineers s... | {"inputs": ["5\net\neq\nbd\nbe\nbdp\n\nSAMPLE", "5\neu\neq\nbd\nbe\nbdp\n\nSAMPLE", "5\neu\neq\nbd\nbe\ndbp\n\nSAMQLE", "5\neu\neq\nbd\nbd\ndbp\n\nSAMQLE", "5\net\nqe\nbd\ndc\ndbp\n\nSAMQLE", "5\nte\nqe\nbd\ndb\np`d\n\nDAQMKS", "5\neu\neq\nbd\nbe\nbdp\n\nELPMAS", "5\neu\neq\nbd\nbe\nbdp\n\nSAMQLE", "5\neu\nqe\nbd\nbd\n... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
42a10cb888f1bfdf72adccca13f7e11f | find-the-nth-prime | Given the value of n, print the n'th prime number.
Input : A single integer n.
Output : A single number which is the n'th prime number.
Constraints :
1 ≤ n ≤ 1000
SAMPLE INPUT
2
SAMPLE OUTPUT
3
Explanation
The first few prime numbers are:
2,3,5,7. So, the answer is 3. | {"inputs": ["2\n\nSAMPLE", "2\n\nSBMPLE", "2\n\nSBPMLE", "2\n\nELMPBS", "2\n\nELMPAS", "2\n\nSAPMLE", "2\n\nSAQMLE", "2\n\nELMQAS", "2\n\nELMQBS", "2\n\nELLQBS", "2\n\nEMLQBS", "2\n\nEMLQBT", "2\n\nTBQLME", "2\n\nTCQLME", "2\n\nSCQLME", "2\n\nTCQKME", "2\n\nEMKQCT", "2\n\nCMKQET", "2\n\nBMKQET", "2\n\nCMKQTE", "2\n\nCM... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
1ce153405b603328ef38ac29718802f0 | insect-colony-2 | Yesterday Oz heard a story about insect colony. The specialty of insects is that they splits sometimes i.e an insect of size A can split into two insects of positive integral sizes B and C such that A = B + C. Also sometimes they attack each other i.e. two insects of sizes P and Q will become R = P XOR Q .
You are give... | {"inputs": ["2\n2 9 17\n1 1\n\nSAMPLE", "10\n75 995991040 148627929 566366239 458028006 823890903 945174886 530827147 546010999 720763988 183796976 748924885 868038355 870234651 273702889 972313979 607688156 495203509 981301128 72001489 10285302 970980434 30653173 738175457 455018413 940530064 537884091 418532701 98235... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
159e1c4c5db4a80885cc00f63a3334db | max-min | you are given an array of size N. You need to select K elements from the array such that the difference between the max number among selected and the min number among selected array elements should be minimum. Print the minimum difference.
INPUT:
First line N number i.e., length of array
Second line K number
Next N l... | {"inputs": ["5\n3\n1\n2\n3\n4\n5\n\nSAMPLE", "5\n3\n1\n1\n3\n4\n5\n\nSAMPLE", "5\n3\n1\n3\n3\n4\n5\n\nSAMPLE", "5\n4\n1\n1\n3\n5\n5\n\nSAMPLE", "5\n1\n0\n3\n3\n4\n5\n\nQAMRLD", "5\n3\n0\n6\n3\n4\n9\n\nLMRDAQ", "5\n3\n1\n1\n3\n5\n5\n\nSAMPLE", "5\n3\n1\n2\n3\n4\n7\n\nSAMPLE", "5\n3\n1\n3\n3\n4\n5\n\nPAMSLE", "5\n3\n1\n3... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
fc6e36bb433ffec9d45165d05d26d47a | once-upon-a-time-in-time-land | In a mystical TimeLand, a person's health and wealth is measured in terms of time(seconds) left.
Suppose a person there has 24x60x60 = 86400 seconds left, then he would live for another 1 day.
A person dies when his time left becomes 0. Some time-amount can be borrowed from other person, or time-banks.
Some time-amoun... | {"inputs": ["2\n10 1\n1 2 -3 -5 4 6 -3 2 -1 2\n10 2\n1 2 -3 -5 4 6 -3 2 -1 2\n\nSAMPLE", "30\n16 3\n-334 -500 -169 -724 -478 -358 -962 -464 -705 -145 -281 -827 -961 -491 -995 -942 \n22 2\n391 604 902 153 292 382 421 716 718 895 447 726 771 538 869 912 667 299 35 894 703 811 \n17 5\n-673 141 -253 -547 662 -37 723 -529 3... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
10075807c38ff83cb323f23e40de711d | rams-love-for-sita-2 | Sita loves chocolate and Ram being his boyfriend wants to give Sita as many chocolates as he can. So, he goes to a chocolate store with Rs. N in his pocket. The price of each chocolate is Rs. C. The store offers a discount that for every M wrappers he gives to the store, he gets one chocolate for free. How many chocola... | {"inputs": ["3\n10 2 5\n12 4 4\n6 2 2\n\nSAMPLE", "3\n10 2 5\n12 4 8\n6 2 2\n\nSAMPLE", "3\n7 2 5\n12 4 8\n6 2 2\n\nSAMPLF", "3\n7 2 5\n12 4 8\n6 2 4\n\nSAMPLF", "3\n12 2 5\n12 4 8\n6 2 4\n\nSAMPLF", "3\n12 2 5\n2 4 16\n6 2 4\n\nSAMPLF", "3\n12 2 5\n4 4 16\n6 2 4\n\nSAMPLF", "3\n12 2 5\n8 4 16\n6 2 4\n\nSAMPLF", "3\n12... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
f13601a109f8350f6ec1e72d1b50db94 | simple-prime-factorization | Surya loves to play with primes. One day, he asked his friend don to print any number in the form of multiple of prime factors. Help don in solving the problem.
Input
The first line will contain an integer t (1 ≤ t ≤ 10^6) denoting number of test case.
For each test case, you will be given an integer n (2 ≤ n ≤ 10^6... | {"inputs": ["3\n32\n100\n9085\n\nSAMPLE", "1000\n999001\n999002\n999003\n999004\n999005\n999006\n999007\n999008\n999009\n999010\n999011\n999012\n999013\n999014\n999015\n999016\n999017\n999018\n999019\n999020\n999021\n999022\n999023\n999024\n999025\n999026\n999027\n999028\n999029\n999030\n999031\n999032\n999033\n999034\... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
38fc1a3262829486d91577d287821420 | the-strongest-string-1-1 | Maga and Alex are good at string manipulation problems. Just now they have faced a problem related to string. But it is not a standard string problem. They have no idea to solve it. They need your help.
A string is called unique if all characters of string are distinct.
String s_1 is called subsequence of string s_2 ... | {"inputs": ["5\nabvzx\n\nSAMPLE", "5\nabvzx\n\nSAMOLE", "5\nxbvza\n\nSAMOLE", "5\nxbvya\n\nSAMOLE", "5\nabvxz\n\nSAMOLE", "5\nayvbx\n\nSAMOLE", "5\nzavbw\n\nSAMOLE", "5\nazwaw\n\nSOMALF", "5\nbywaw\n\nSOMALF", "5\nwawyb\n\nSOMALG", "5\nxywab\n\nDTALON", "5\nxw`xb\n\nSOMALE", "5\nb`wyy\n\nCTAMON", "5\nxzvaa\n\nBKNNER", ... | 0 | [
"PYTHON3"
] | 3 | 2 | code_contests | |
2713f04b18fed5a27508c50e26a6bbe6 | p02548 AtCoder Beginner Contest 179 - A x B + C | Given is a positive integer N. How many tuples (A,B,C) of positive integers satisfy A \times B + C = N?
Constraints
* 2 \leq N \leq 10^6
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N
Output
Print the answer.
Examples
Input
3
Output
3
Input
100
... | {"inputs": ["3", "100", "1000000", "4", "101", "5", "001", "8", "6", "2", "110", "10", "13", "111", "12", "17", "9", "7", "14", "16", "11", "22", "26", "18", "19", "24", "43", "23", "44", "72", "32", "20", "15", "33", "27", "65", "42", "54", "31", "25", "59", "37", "107", "71", "183", "74", "113", "90", "29", "21", "28... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
9909710829cc8d56f7b0ea5e735466df | p02679 AtCoder Beginner Contest 168 - ∙ (Bullet) | We have caught N sardines. The deliciousness and fragrantness of the i-th sardine is A_i and B_i, respectively.
We will choose one or more of these sardines and put them into a cooler. However, two sardines on bad terms cannot be chosen at the same time.
The i-th and j-th sardines (i \neq j) are on bad terms if and o... | {"inputs": ["3\n1 2\n-1 1\n2 -1", "10\n3 2\n3 2\n-1 1\n2 -1\n-3 -9\n-8 12\n7 7\n8 1\n8 2\n8 4", "3\n1 4\n-1 1\n2 -1", "10\n3 2\n3 2\n-1 1\n2 -1\n-3 -6\n-8 12\n7 7\n8 1\n8 2\n8 4", "3\n2 4\n-1 1\n2 -1", "10\n3 2\n3 2\n-1 1\n2 -1\n-3 -6\n-8 12\n7 1\n8 1\n8 2\n8 4", "3\n2 4\n-2 1\n2 -1", "10\n3 2\n3 0\n-1 1\n2 -1\n-3 -6\n... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
86529836c89c8cd486f638c12995639a | p02807 Dwango Programming Contest 6th - Fusing Slimes | There are N slimes standing on a number line. The i-th slime from the left is at position x_i.
It is guaruanteed that 1 \leq x_1 < x_2 < \ldots < x_N \leq 10^{9}.
Niwango will perform N-1 operations. The i-th operation consists of the following procedures:
* Choose an integer k between 1 and N-i (inclusive) with equ... | {"inputs": ["12\n161735902 211047202 430302156 450968417 628894325 707723857 731963982 822804784 880895728 923078537 971407775 982631932", "3\n1 2 3", "12\n161735902 211047202 430302156 450968417 628894325 707723857 731963982 822804784 880895728 923078537 971407775 1765707086", "3\n1 2 5", "12\n161735902 394362112 4303... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
307e6c73cbb492e20c731fb2cb3f4855 | p02943 AtCoder Grand Contest 037 - Reversing and Concatenating | Takahashi has a string S of length N consisting of lowercase English letters. On this string, he will perform the following operation K times:
* Let T be the string obtained by reversing S, and U be the string obtained by concatenating S and T in this order.
* Let S' be some contiguous substring of U with length N, an... | {"inputs": ["5 1\nbacba", "10 2\nbbaabbbaab", "5 2\nbacba", "10 2\nbbbabbbaaa", "10 3\nbbaabbbaab", "5 2\nbacaa", "10 2\nbaabbbaabb", "10 2\nbaabbaaabb", "10 2\nbbaaabbbab", "5 1\nbabba", "10 2\nbabbbbaabb", "10 1\nbaabbaaabb", "5 1\nbabbb", "10 2\nbbaabbbbab", "10 1\nbbaaabbaab", "8 5\nbbaaabbbab", "5 1\nbabbc", "5 2\... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
3400d4e733ea455f17f84a6a32d8b504 | p03080 ExaWizards 2019 - Red or Blue | There are N people numbered 1 to N. Each person wears a red hat or a blue hat.
You are given a string s representing the colors of the people. Person i wears a red hat if s_i is `R`, and a blue hat if s_i is `B`.
Determine if there are more people wearing a red hat than people wearing a blue hat.
Constraints
* 1 \l... | {"inputs": ["4\nRRBR", "4\nBRBR", "4\nRBRR", "4\nBBRR", "4\nRRCR", "4\nRRAR", "4\nRARR", "4\nBQBR", "4\nRCRR", "4\nBPBR", "4\nRRRC", "4\nAQBR", "4\nRRRD", "4\nAQBS", "4\nDRRR", "4\nARBS", "4\nERRR", "4\nBQBS", "4\nBPBS", "4\nPBBS", "4\nSBBP", "4\nPBSB", "4\nPASB", "4\nPASC", "4\nPACS", "4\nPCAS", "4\nCPAS", "4\nCOAS", ... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
d0756bf24007d2d1c2da98d184ba713f | p03225 Tenka1 Programmer Contest - Equilateral | There are some coins in the xy-plane. The positions of the coins are represented by a grid of characters with H rows and W columns. If the character at the i-th row and j-th column, s_{ij}, is `#`, there is one coin at point (i,j); if that character is `.`, there is no coin at point (i,j). There are no other coins in t... | {"inputs": ["5 4\n#.##\n.##.\n#...\n..##\n...#", "13 27\n......#.........#.......#..\n...#.....###..\n..............#####...##...\n...#######......#...#######\n...#.....#.....###...#...#.\n...#######....#.#.#.#.###.#\n..............#.#.#...#.#..\n.#.#.#...###..\n...........#...#...#######\n..#######..#...#...#.....#\n.... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
05f6cb8840e3fa19db7f521b5e4eaff0 | p03371 AtCoder Beginner Contest 095 - Half and Half | "Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the curr... | {"inputs": ["1500 2000 1600 3 2", "1500 2000 500 90000 100000", "1500 2000 1900 3 2", "1500 1572 1600 3 2", "1500 2445 500 90000 100000", "1500 2000 1615 3 2", "1500 1572 1600 0 2", "1500 2000 1166 3 2", "1500 651 1600 0 2", "1500 3132 752 90000 100000", "1500 2000 1343 3 2", "1500 2000 1343 3 3", "1339 651 1600 0 1", ... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
d6cbe312c420d5d0a558605639d83406 | p03534 CODE FESTIVAL 2017 Final (Parallel) - Palindrome-phobia | Snuke has a string S consisting of three kinds of letters: `a`, `b` and `c`.
He has a phobia for palindromes, and wants to permute the characters in S so that S will not contain a palindrome of length 2 or more as a substring. Determine whether this is possible.
Constraints
* 1 \leq |S| \leq 10^5
* S consists of `a`... | {"inputs": ["aba", "abac", "babacccabab", "acac", "bacaccbabab", "ccaa", "bacaacbcbab", "babcbcaacab", "bababccacab", "bacaccbabac", "bacaccbaaac", "caaabccacab", "caaaaccacab", "bacaccaaaac", "baa", "caba", "babacccbaab", "aacc", "bacabcbabab", "bacaacccbab", "babcbbaacab", "aacaccbabac", "caabaccacab", "bbcaccbaaac",... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
16ae05016f16d8a236c4b261a54cbfea | p03694 AtCoder Beginner Contest 064 - Traveling AtCoDeer Problem | It is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts.
There are N houses along TopCoDeer street. The i-th house is located at coordinate a_i. He has decided to deliver gifts to all these houses.
Find the minimum distance to be traveled when AtCoDeer can start and ... | {"inputs": ["4\n2 3 7 9", "8\n3 1 4 1 5 9 2 6", "4\n2 3 9 9", "8\n3 1 4 1 5 18 2 6", "4\n2 3 13 9", "4\n4 4 13 9", "8\n3 1 1 1 5 15 1 6", "4\n4 4 8 9", "4\n0 4 8 18", "8\n1 1 1 2 5 14 1 6", "4\n-1 2 4 18", "4\n-1 2 4 31", "8\n0 1 0 2 7 8 1 6", "4\n-1 2 11 6", "8\n1 1 -1 2 -1 0 1 5", "4\n-3 3 7 2", "8\n2 2 0 2 0 -1 0 1"... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
028f9ac24db128ead29476d6a4a6faf5 | p03849 AtCoder Regular Contest 066 - Xor Sum | You are given a positive integer N. Find the number of the pairs of integers u and v (0≦u,v≦N) such that there exist two non-negative integers a and b satisfying a xor b=u and a+b=v. Here, xor denotes the bitwise exclusive OR. Since it can be extremely large, compute the answer modulo 10^9+7.
Constraints
* 1≦N≦10^{18... | {"inputs": ["3", "1422", "1000000000000000000", "4", "1026", "1000000001000000000", "0", "530", "1100000001000000000", "1", "706", "1100000001000010000", "2", "152", "1100000001001010000", "7", "192", "1100000011001010000", "5", "292", "1100000001001010010", "271", "1101000001001010010", "266", "1101000000001010010", "... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
e2bd724d96c50b5ce5b4604138207478 | p04015 AtCoder Regular Contest 060 - Tak and Cards | Tak has N cards. On the i-th (1 \leq i \leq N) card is written an integer x_i. He is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A. In how many ways can he make his selection?
Constraints
* 1 \leq N \leq 50
* 1 \leq A \leq 50
* 1 \leq x_... | {"inputs": ["4 8\n7 9 8 9", "3 8\n6 6 9", "33 3\n3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3", "8 5\n3 6 2 8 7 6 5 9", "4 8\n7 12 8 9", "3 8\n9 6 9", "33 3\n3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 3 3 3 3", "8 5\n3 6 2 8 7 2 5 9", "3 8\n15 6 9", "33 3\n3 3 3 3 3 3 3 3 3 3 3 3 3 3... | 0 | [
"PYTHON3"
] | 5 | 2 | code_contests | |
71c7db1543f13b9024515f01065dc92c | p00100 Sale Result | There is data on sales of your company. Your task is to write a program which identifies good workers.
The program should read a list of data where each item includes the employee ID i, the amount of sales q and the corresponding unit price p. Then, the program should print IDs of employees whose total sales proceeds ... | {"inputs": ["4\n1001 2000 520\n1002 1800 450\n1003 1600 625\n1001 200 1220\n2\n1001 100 3\n1005 1000 100\n2\n2013 5000 100\n2013 5000 100\n0", "4\n1001 2000 520\n80 1800 450\n1003 1600 625\n1001 200 1220\n2\n1001 100 3\n1005 1000 100\n2\n2013 5000 100\n2013 5000 100\n0", "4\n0001 2000 520\n80 1800 450\n1003 1600 625\n1... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
7c7deaa21786bdc72f5edf0168b4bc5b | p00232 Life Game | Taro went to a toy store to buy a game of life made by Aizu Hobby. Life games are played using a board with squares and roulette. As shown in the figure, the board has one start point and one goal point, which are connected by a single grid. First, the pieces are placed in the square at the starting point, and the piec... | {"inputs": ["1 2 0\n1\n1 2 1\n1\n1 2 100\n1 2 1\n2\n1 2 100\n2 2 1\n1 2\n1 2 100\n4 5 3\n1 2 3 4\n1 1 2\n2 2 100\n4 3 60\n0 0 0", "1 2 0\n1\n1 2 1\n1\n1 2 101\n1 2 1\n2\n1 2 100\n2 2 1\n1 2\n1 2 100\n4 5 3\n1 2 3 4\n1 1 2\n2 2 100\n4 3 60\n0 0 0", "1 2 0\n1\n1 2 1\n1\n1 2 101\n1 2 1\n2\n1 2 100\n2 2 1\n1 2\n1 2 100\n4 ... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
d131b71ec3717527e93e10ceea27fba8 | p00395 Maze and Items | Maze & Items is a puzzle game in which the player tries to reach the goal while collecting items. The maze consists of $W \times H$ grids, and some of them are inaccessible to the player depending on the items he/she has now. The score the player earns is defined according to the order of collecting items. The objectiv... | {"inputs": ["12 5\n.....S......\n.abcdefghij.\n.0123456789.\n.ABCDEFGHIJ.\n.....T......\n0 1 0 0 0 0 0 0 0 0\n2 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0", "5 6\n..S..\n\n01234... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
0d85460dfc9d71a1495f7c47be58286e | p00610 Cleaning Robot 2 | Dr. Asimov, a robotics researcher, released cleaning robots he developed (see Problem B). His robots soon became very popular and he got much income. Now he is pretty rich. Wonderful.
First, he renovated his house. Once his house had 9 rooms that were arranged in a square, but now his house has N × N rooms arranged in... | {"inputs": ["2 1\n2 3\n6 4\n0 0", "3 1\n2 3\n6 4\n0 0", "4 1\n2 3\n6 4\n0 0", "3 1\n4 3\n6 4\n0 0", "4 1\n1 3\n6 6\n0 0", "5 1\n4 3\n6 6\n0 0", "8 1\n1 3\n6 6\n0 0", "5 1\n4 3\n12 4\n0 0", "8 1\n1 3\n2 6\n0 0", "5 1\n4 3\n23 4\n0 0", "16 1\n1 3\n2 6\n0 0", "19 1\n1 3\n2 6\n0 0", "34 1\n1 6\n2 6\n0 0", "2 1\n3 3\n6 4\n0... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
3bf8388875cfffd8af34a59dd77ca91c | p00748 Pollock's conjecture | The nth triangular number is defined as the sum of the first n positive integers. The nth tetrahedral number is defined as the sum of the first n triangular numbers. It is easy to show that the nth tetrahedral number is equal to n(n+1)(n+2) ⁄ 6. For example, the 5th tetrahedral number is 1+(1+2)+(1+2+3)+(1+2+3+4)+(1+2+... | {"inputs": ["40\n14\n5\n165\n120\n103\n106\n139\n0", "40\n14\n5\n165\n120\n133\n106\n139\n0", "40\n14\n5\n98\n120\n133\n106\n139\n0", "40\n14\n5\n98\n120\n133\n106\n150\n0", "40\n14\n5\n70\n120\n133\n106\n150\n0", "40\n14\n9\n70\n120\n133\n106\n150\n0", "40\n14\n9\n70\n72\n133\n106\n150\n0", "40\n14\n9\n29\n72\n133\n10... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
cf28ca9d77b5b9e6e2c13f7f92a8026f | p00886 Towns along a Highway | There are several towns on a highway. The highway has no forks. Given the distances between the neighboring towns, we can calculate all distances from any town to others. For example, given five towns (A, B, C, D and E) and the distances between neighboring towns like in Figure C.1, we can calculate the distance matrix... | {"inputs": ["2\n1\n3\n5 3 2\n3\n6 3 2\n5\n9 8 7 6 6 4 3 2 2 1\n6\n9 8 8 7 6 6 5 5 3 3 3 2 2 1 1\n6\n11 10 9 8 7 6 6 5 5 4 3 2 2 1 1\n7\n72 65 55 51 48 45 40 38 34 32 27 25 24 23 21 17 14 13 11 10 7\n20\n190 189 188 187 186 185 184 183 182 181 180 179 178 177 176 175 174 173 172 171\n170 169 168 167 166 165 164 163 162 ... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
0b190b0672746706000cbd3ab9e0d646 | p01017 Yu-kun Likes Rectangles | Background
The kindergarten attached to the University of Aizu is a kindergarten where children who love programming gather. Yu, one of the kindergarten children, loves rectangles as much as programming. Yu-kun decided to write a program to calculate the maximum score that can be obtained, thinking of a new play to ge... | {"inputs": ["4 4\n10 2 -1 6\n8 1 -100 41\n22 47 32 11\n-41 99 12 -8\n1 0 0 1\n0 0 1 0\n0 1 0 1\n0 0 1 0\n2 3\n1 0 1\n0 1 0", "3 4\n4 1 9 1\n9 1 -1 3\n2 -4 1 10\n1 1 0 1\n0 1 1 1\n1 1 0 0\n1 4\n1 1 1 1", "3 3\n5 1 3\n2 5 9\n0 1 5\n1 0 0\n0 1 1\n0 1 1\n1 1\n1", "4 4\n10 2 -1 6\n8 1 -100 41\n22 47 32 11\n-41 99 12 -8\n1 0... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
59d04f0e9c5b39dc2753daa0c97a587f | p01150 Eight Princes | Once upon a time in a kingdom far, far away, there lived eight princes. Sadly they were on very bad terms so they began to quarrel every time they met.
One day, the princes needed to seat at the same round table as a party was held. Since they were always in bad mood, a quarrel would begin whenever:
* A prince took t... | {"inputs": ["8\n16\n17\n0", "8\n6\n17\n0", "8\n23\n17\n0", "8\n6\n3\n0", "8\n0\n17\n0", "8\n30\n17\n0", "8\n6\n23\n0", "8\n23\n33\n0", "8\n1\n0\n0", "8\n30\n24\n0", "8\n6\n21\n0", "8\n40\n33\n0", "8\n15\n33\n0", "8\n5\n25\n0", "8\n23\n2\n0", "8\n39\n33\n0", "8\n52\n24\n0", "8\n20\n33\n0", "8\n9\n19\n0", "8\n44\n33\n0",... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
b4f298de837d68c0f92eaa9230af45b1 | p01289 Strange Couple | Alice and Bob are going to drive from their home to a theater for a date. They are very challenging - they have no maps with them even though they don’t know the route at all (since they have just moved to their new home). Yes, they will be going just by their feeling.
The town they drive can be considered as an undir... | {"inputs": ["5 1 5\n1 0 1 0 0\n0 2 1 0 0\n2 0 0 1 0\n1 0 0 1 0\n0 1 1 0 1\n0 0 0 1 0\n0 0 0", "5 1 5\n0 0 1 0 0\n0 2 1 0 0\n2 0 0 1 0\n1 0 0 1 0\n0 1 1 0 1\n0 0 0 1 0\n0 0 0", "5 1 5\n1 0 1 0 1\n0 2 1 0 0\n2 0 0 1 0\n1 0 0 1 0\n0 1 1 0 1\n0 0 0 1 0\n0 0 0", "5 1 5\n1 0 1 0 1\n0 2 1 0 0\n2 0 0 1 0\n1 0 0 1 0\n0 2 1 0 1\... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
22f29e6ff0febb08bc84b8c3f1b82692 | p01458 Kth Sentence | A student, Kita_masa, is taking an English examination. In this examination, he has to write a sentence of length m.
Since he completely forgot the English grammar, he decided to consider all sentences of length m constructed by concatenating the words he knows and write the K-th sentence among the candidates sorted i... | {"inputs": ["3 3 6\na\naa\nb", "2 10 2\nhello\nworld", "2 59 1000000000000000000\na\nb", "3 3 4\na\naa\nb", "3 3 4\nb\naa\nb", "3 3 1\na\naa\nb", "2 10 0\nhello\nworld", "2 67 1000000000000000000\na\nb", "3 3 4\nc\naa\nb", "2 12 0\nhello\nworld", "2 132 1000000000000000000\na\nb", "3 5 4\nc\naa\nb", "2 12 1\nhello\nwor... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
722273a8ad8d7716b7028c9a6105b46b | p01609 One | One
Problem Statement
A beautiful mountain range can be seen from the train window.
The window is a rectangle with the coordinates of the lower left corner (0, 0) and the coordinates of the upper right corner (W, H).
N peaks can be seen from the window, and the i-th peak has the shape of an upwardly convex parabola y... | {"inputs": ["20 20 2\n-1 10 10\n-2 10 5", "15 100 2\n-2 5 100\n-2 10 100", "20 20 1\n-1 10 10", "20 20 2\n-1 10 10\n-2 10 9", "20 20 2\n-1 18 10\n-2 10 9", "20 20 2\n-1 18 10\n-2 10 3", "20 28 1\n-2 15 10", "20 28 1\n-2 15 16", "13 20 2\n-1 10 10\n-2 10 5", "20 20 2\n-1 10 7\n-2 10 9", "20 20 2\n-1 18 12\n-2 10 9", "20... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
48ed653ff4224de003f544c1e1be9ebf | p01770 Arojam's Mask | Problem statement
You are a hero. The world in which the hero is traveling consists of N cities and M roads connecting different cities. Road i connects town a_i and town b_i and can move in both directions.
The purpose of the brave is to start from town S and move to town T. S and T are different cities. The hero ca... | {"inputs": ["8 5 2 0 5 5\n0 1\n0 3\n0 6\n1 2\n6 7\n3 4 7\n4 5 2", "8 5 2 0 5 5\n0 1\n0 3\n0 6\n1 2\n6 7\n1 4 7\n4 5 2", "8 5 2 0 5 5\n0 1\n0 3\n0 2\n1 2\n6 7\n3 4 7\n4 5 2", "8 5 2 0 5 5\n0 1\n0 3\n0 6\n1 2\n6 7\n1 4 7\n4 5 4", "8 5 2 0 5 5\n0 2\n0 3\n0 6\n1 2\n6 7\n1 4 7\n4 5 4", "8 5 2 0 3 5\n0 2\n0 3\n0 6\n1 2\n6 7\... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
4fa6e7382e68c753d0738b05f502c105 | p01904 Minimum Enclosing Rectangle | G: Minimum Enclosing Rectangle-Minimum Enclosing Rectangle-
story
Hello everyone! It's Airi Aiza from the Hachimori Naka Prokon Club. Suddenly, I want everyone to solve the problem that Airi couldn't solve before. I solved the A problem of ICPC2010 in this front activity, but the problem at that time was difficult.
... | {"inputs": ["1", "001", "001"], "outputs": ["1", "1.000000000\n", "1.000000000\n"]} | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
64eb5be7d935507e73684752b8b7ae21 | p02042 ABSum | problem
Given a sequence $ A $ of length $ N $. You can swap the $ i $ th and $ j $ th ($ 0 \ leq i, j \ leq N-1 $) elements of a sequence up to $ M $ times.
Find the maximum value of $ \ sum_ {i = 0} ^ {N -1} abs (A_i --i) $ in the sequence created by the operation.
output
Find the maximum value of $ \ sum_ {i =... | {"inputs": ["5 2\n0 3 2 1 4", "5 2\n0 1 2 1 4", "5 2\n0 1 0 1 0", "5 2\n0 1 0 1 -1", "5 3\n-1 1 0 2 -1", "2 2\n0 1 2 1 4", "1 2\n0 1 0 1 0", "4 3\n0 1 0 2 -1", "2 3\n-1 1 0 2 -1", "2 3\n-2 1 0 2 -1", "5 2\n0 0 4 1 4", "5 2\n0 0 4 2 4", "2 3\n0 0 -1 2 -1", "9 1\n1 0 4 2 0", "9 1\n1 1 4 2 0", "9 1\n0 1 7 2 0", "4 2\n0 1 ... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
0a64352b6a1bc74ef05d21f0e08bc281 | p02185 Many Decimal Integers | D: Many Decimal Integers
problem
Given a string S consisting only of numbers (0-9) and a string T consisting only of numbers and `?`. S and T are the same length.
Consider changing each `?` That exists in T to one of the numbers from 0 to 9 to create the string T'consisting of only numbers. At this time, it must be ... | {"inputs": ["73\n6?", "73\n?6", "73\n@6", "73\n5?", "73\n?5", "73\n4?", "73\n?4", "73\n?8", "73\n?7", "73\n7?", "73\n?3", "73\n3?", "73\n?9", "73\n?2", "73\n70", "73\n1?", "73\n27", "73\n?1", "73\n49", "73\n72", "73\n59", "73\n?0", "73\n69", "73\n21", "73\n11", "73\n64", "73\n54", "73\n??", "73\n10", "73\n48", "73\n29"... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests | |
fa1e014c0474b2adfcdbadc6174ddcfe | p02327 Largest Rectangle | Given a matrix (H × W) which contains only 1 and 0, find the area of the largest rectangle which only contains 0s.
Constraints
* 1 ≤ H, W ≤ 1,400
Input
H W
c1,1 c1,2 ... c1,W
c2,1 c2,2 ... c2,W
:
cH,1 cH,2 ... cH,W
In the first line, two integers H and W separated by a space character are given. In the following... | {"inputs": ["4 5\n0 0 1 0 0\n1 0 0 0 0\n0 0 0 1 0\n0 0 0 1 0", "4 5\n0 0 1 0 0\n1 0 0 0 0\n0 0 0 0 0\n0 0 0 1 0", "4 5\n0 0 1 0 0\n1 0 0 0 0\n0 0 0 0 1\n0 0 0 1 0", "1 5\n0 0 1 0 0\n1 0 0 0 1\n0 0 0 1 0\n0 0 0 1 0", "0 5\n0 0 1 -1 0\n1 0 0 0 0\n0 0 0 0 0\n0 0 0 1 0", "1 5\n1 0 1 0 1\n2 0 -1 0 1\n0 -1 0 0 0\n0 0 0 1 0",... | 0 | [
"PYTHON3"
] | 6 | 2 | code_contests |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.