name stringlengths 2 112 | description stringlengths 29 13k | private_tests dict | public_tests dict | generated_tests dict |
|---|---|---|---|---|
p03408 AtCoder Beginner Contest 091 - Two Colors Card Game | Takahashi has N blue cards and M red cards. A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i.
Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will ea... | {
"input": [],
"output": []
} | {
"input": [
"3\napple\norange\napple\n5\napple\napple\napple\napple\napple",
"3\napple\norange\napple\n1\ngrape",
"6\nred\nred\nblue\nyellow\nyellow\nred\n5\nred\nred\nyellow\ngreen\nblue",
"1\nvoldemort\n10\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvold... | {
"input": [
"3\napple\norange\napple\n5\naeplp\napple\napple\napple\napple",
"6\nred\nred\nblue\nyellow\nyellow\nred\n5\nred\nree\nyellow\ngreen\nblue",
"1\nvoldemort\n10\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nuoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort",
"6\nred\nred\nblue... |
p03571 CODE FESTIVAL 2017 qual C - Cubes | We constructed a rectangular parallelepiped of dimensions A \times B \times C built of ABC cubic blocks of side 1. Then, we placed the parallelepiped in xyz-space as follows:
* For every triple i, j, k (0 \leq i < A, 0 \leq j < B, 0 \leq k < C), there exists a block that has a diagonal connecting the points (i, j, k) ... | {
"input": [],
"output": []
} | {
"input": [
"1 2 3 0",
"3 5 7 100",
"3 4 5 1",
"1234 12345 1234567 5",
"3 123456781 1000000000 100",
"999999997 999999999 1000000000 50000"
],
"output": [
"4",
"105",
"54",
"150673016",
"444124403",
"8402143"
]
} | {
"input": [
"1 2 3 1",
"3 9 7 100",
"1234 12345 317740 5",
"1034375698 999999999 1000000000 50000",
"2 2 3 1",
"3 9 7 000",
"1392 12345 317740 5",
"1034375698 1456125281 1000000000 50000",
"2 2 6 1",
"3 9 6 000",
"1392 12345 193058 5",
"1034375698 1456125281 1000010000... |
p03726 AtCoder Grand Contest 014 - Black and White Tree | There is a tree with N vertices numbered 1 through N. The i-th of the N-1 edges connects vertices a_i and b_i.
Initially, each vertex is uncolored.
Takahashi and Aoki is playing a game by painting the vertices. In this game, they alternately perform the following operation, starting from Takahashi:
* Select a vertex... | {
"input": [],
"output": []
} | {
"input": [
"3\n1 2\n2 3",
"6\n1 2\n2 3\n3 4\n2 5\n5 6",
"4\n1 2\n2 3\n2 4"
],
"output": [
"First",
"Second",
"First"
]
} | {
"input": [
"4\n1 2\n2 3\n2 3",
"4\n1 2\n1 3\n2 4",
"3\n1 2\n1 3",
"4\n1 2\n2 3\n2 2",
"4\n1 2\n2 3\n2 0",
"4\n0 2\n2 3\n2 2",
"4\n1 2\n2 3\n0 0",
"3\n0 2\n2 3",
"6\n2 2\n2 3\n3 4\n2 5\n5 6",
"4\n1 2\n2 3\n0 2",
"4\n1 1\n2 3\n2 0",
"4\n0 2\n2 4\n2 2",
"4\n0 2\n2 3\... |
p03890 CODE FESTIVAL 2016 Relay (Parallel) - Kode Festival | Kode Festival is an anual contest where the hardest stone in the world is determined. (Kode is a Japanese word for "hardness".)
This year, 2^N stones participated. The hardness of the i-th stone is A_i.
In the contest, stones are thrown at each other in a knockout tournament.
When two stones with hardness X and Y ar... | {
"input": [],
"output": []
} | {
"input": [
"3\n1\n3\n2\n4\n6\n8\n100\n104",
"2\n1\n3\n10\n19"
],
"output": [
"2",
"7"
]
} | {
"input": [
"3\n1\n5\n2\n4\n6\n8\n100\n104",
"2\n1\n5\n10\n19",
"3\n1\n5\n2\n4\n6\n8\n100\n130",
"2\n1\n5\n4\n19",
"3\n1\n5\n2\n4\n8\n8\n100\n130",
"2\n1\n5\n8\n19",
"3\n1\n6\n2\n4\n8\n8\n100\n130",
"2\n1\n5\n8\n0",
"3\n1\n6\n2\n4\n8\n10\n100\n130",
"3\n1\n6\n2\n4\n0\n10\n100\... |
p04049 AtCoder Grand Contest 001 - Shorten Diameter | Given an undirected tree, let the distance between vertices u and v be the number of edges on the simple path from u to v. The diameter of a tree is the maximum among the distances between any two vertices. We will call a tree good if and only if its diameter is at most K.
You are given an undirected tree with N verti... | {
"input": [],
"output": []
} | {
"input": [
"6 2\n1 2\n3 2\n4 2\n1 6\n5 6",
"6 5\n1 2\n3 2\n4 2\n1 6\n5 6"
],
"output": [
"2",
"0"
]
} | {
"input": [
"6 1\n1 2\n3 2\n4 2\n1 6\n5 6",
"6 7\n1 2\n3 2\n4 2\n1 6\n5 6",
"6 2\n1 2\n3 2\n4 2\n1 6\n5 2",
"6 2\n1 3\n3 2\n4 2\n1 6\n5 6",
"6 2\n0 3\n3 2\n4 2\n1 6\n5 6",
"6 0\n1 3\n6 2\n4 2\n1 6\n5 6",
"6 7\n1 2\n3 4\n4 2\n1 6\n5 6",
"6 5\n1 3\n3 2\n4 2\n1 6\n5 6",
"6 1\n1 2\n3 ... |
p00128 Abacus | <image>
At the request of a friend who started learning abacus, you decided to create a program to display the abacus beads. Create a program that takes a certain number as input and outputs a row of abacus beads. However, the number of digits of the abacus to be displayed is 5 digits, and the arrangement of beads fr... | {
"input": [],
"output": []
} | {
"input": [
"2006\n1111"
],
"output": [
"****\n *\n=====\n * *\n****\n* ***\n*****\n*****\n\n*****\n\n=====\n ****\n*\n*****\n*****\n*****"
]
} | {
"input": [
"2006\n1101",
"2006\n0101",
"2006\n0100",
"2006\n1100",
"2006\n1000",
"2006\n1001",
"2006\n1011",
"2006\n1010",
"2006\n0010",
"2006\n0011",
"2006\n0001",
"2006\n0000",
"2006\n0110",
"2006\n0111",
"2006\n1110",
"2006\n1101",
"2006\n1100",... |
p00261 Aka-beko and 40 Thieves | Aka Beko, trying to escape from 40 bandits, got lost in the city of A. Aka Beko wants to go to City B, where the new hideout is, but the map has been stolen by a bandit.
Kobborg, one of the thieves, sympathized with Aka Beko and felt sorry for him. So I secretly told Aka Beko, "I want to help you go to City B, but I w... | {
"input": [],
"output": []
} | {
"input": [
"0100\n0101\n10100\n01000\n0101011\n0011\n011111\n#"
],
"output": [
"Yes\nNo\nYes\nNo\nYes\nNo\nYes"
]
} | {
"input": [
"0100\n0101\n10100\n01000\n0101011\n0011\n011110\n#",
"0100\n1101\n10100\n11000\n0001011\n0011\n011110\n#",
"0100\n1101\n10000\n10000\n0001011\n0011\n011110\n#",
"0100\n0101\n10100\n10001\n0011011\n1011\n011110\n#",
"0100\n0100\n10100\n10001\n0011011\n1001\n011110\n#",
"0100\n1101... |
p00448 Osenbei | problem
At IOI Confectionery, rice crackers are baked using the traditional method since the company was founded. This traditional method is to bake the front side for a certain period of time with charcoal, turn it over when the front side is baked, and bake the back side for a certain period of time with charcoal. W... | {
"input": [],
"output": []
} | {
"input": [
"2 5\n0 1 0 1 0\n1 0 0 0 1\n3 6\n1 0 0 0 1 0\n1 1 1 0 1 0\n1 0 1 1 0 1\n0 0"
],
"output": [
"9\n15"
]
} | {
"input": [
"2 5\n0 1 0 1 0\n1 0 0 0 1\n3 6\n1 0 1 0 1 0\n1 1 1 0 1 0\n1 0 1 1 0 1\n0 0",
"2 5\n0 1 1 1 0\n1 0 0 0 1\n3 6\n1 0 0 0 1 0\n1 1 1 0 1 0\n1 0 1 1 0 1\n0 0",
"2 5\n0 1 0 1 0\n1 0 0 0 1\n3 6\n1 0 0 0 1 1\n1 1 1 0 1 0\n1 0 1 1 0 1\n0 0",
"2 5\n1 1 1 1 0\n1 0 0 1 1\n3 6\n1 0 0 0 1 0\n0 1 1 0 1... |
p00639 Accelerated Railgun | She catched the thrown coin that draws parabolic curve with her sparkling fingers. She is an ESPer. Yes, she is an electro-master who has the third strongest power among more than one million ESPers in the city. Being flicked by her thumb, the coin is accelerated by electromagnetic force and is shot as Fleming's right-... | {
"input": [],
"output": []
} | {
"input": [
"10.0\n0.5 0.0 -0.2 0.0\n1.0\n0.1 0.0 0.2 0.2\n0"
],
"output": [
"0.50000000\nimpossible"
]
} | {
"input": [
"10.0\n0.5 0.8573113359511872 -0.2 0.0\n1.0\n0.1 0.0 0.2 0.2\n0",
"10.0\n0.5 0.0 -0.2 0.0\n1.6288231664863946\n0.1 0.0 0.2 0.2\n0",
"10.0\n0.5 0.8573113359511872 -0.2 0.0\n1.0\n0.8161714117428612 0.0 0.2 0.2\n0",
"10.0\n0.5 0.8573113359511872 -0.2 0.0\n1.0\n1.200533227235908 0.0 0.2 0.2\n... |
p00782 Mobile Phone Coverage | A mobile phone company ACMICPC (Advanced Cellular, Mobile, and Internet-Connected Phone Corporation) is planning to set up a collection of antennas for mobile phones in a city called Maxnorm. The company ACMICPC has several collections for locations of antennas as their candidate plans, and now they want to know which ... | {
"input": [],
"output": []
} | {
"input": [
"3\n4.0 4.0 3.0\n5.0 6.0 3.0\n5.5 4.5 1.0\n2\n3.0 3.0 3.0\n1.5 1.5 1.0\n0"
],
"output": [
"1 52.00\n2 36.00"
]
} | {
"input": [
"3\n4.0 4.0 3.0\n5.0 6.0 3.0\n5.5 4.5 1.0\n2\n3.0 3.0 3.0\n1.5 2.4837552710328548 1.0\n0",
"3\n4.0 4.919471432458173 3.0\n5.0 6.0 3.0\n5.5 5.446740750188785 1.0\n2\n3.0 3.0 3.0\n2.0201718577591117 2.4837552710328548 1.0\n0",
"3\n4.0 4.0 3.0\n5.0 6.0 3.0\n5.5 4.5 1.0\n1\n3.0 3.0 3.0\n1.5 1.5 1... |
p00915 The Last Ant | A straight tunnel without branches is crowded with busy ants coming and going. Some ants walk left to right and others right to left. All ants walk at a constant speed of 1 cm/s. When two ants meet, they try to pass each other. However, some sections of the tunnel are narrow and two ants cannot pass each other. When tw... | {
"input": [],
"output": []
} | {
"input": [
"3 6\nR 1\nL 2\nL 5\n1 10\nR 1\n2 10\nR 5\nL 7\n2 10\nR 3\nL 8\n2 99\nR 1\nL 98\n4 10\nL 1\nR 2\nL 8\nR 9\n6 10\nR 2\nR 3\nL 4\nR 6\nL 7\nL 8\n0 0"
],
"output": [
"5 1\n9 1\n7 1\n8 2\n98 2\n8 2\n8 3"
]
} | {
"input": [
"3 6\nR 1\nL 2\nL 5\n1 20\nR 1\n2 10\nR 5\nL 7\n2 10\nR 3\nL 8\n2 99\nR 1\nL 98\n4 10\nL 1\nR 2\nL 8\nR 9\n6 10\nR 2\nR 3\nL 4\nR 6\nL 7\nL 8\n0 0",
"3 6\nR 1\nL 2\nL 5\n1 10\nR 1\n2 10\nR 5\nL 7\n2 10\nR 3\nL 3\n2 99\nR 1\nL 98\n4 10\nL 1\nR 2\nL 8\nR 9\n6 10\nR 2\nR 3\nL 4\nR 6\nL 7\nL 8\n0 0",... |
p01048 Divisor | Problem
Given a natural number N less than or equal to 12, find the smallest natural number such that the number of divisors is exactly N.
Constraints
* 1 ≤ N ≤ 12
Input
One natural number N is given in one line.
Output
Output the smallest natural number on a line so that the number of divisors is exactly N.
Ex... | {
"input": [],
"output": []
} | {
"input": [
"1",
"3",
"2"
],
"output": [
"1",
"4",
"2"
]
} | {
"input": [
"5",
"4",
"6",
"11",
"8",
"7",
"10",
"9",
"12",
"001",
"010",
"011",
"4",
"6",
"9",
"8",
"10",
"5",
"7",
"11",
"12",
"001",
"010",
"011"
],
"output": [
"16\n",
"6\n",
"12\n",
"1024\n",
... |
p01180 The Closest Circle | You are given N non-overlapping circles in xy-plane. The radius of each circle varies, but the radius of the largest circle is not double longer than that of the smallest.
<image>
Figure 1: The Sample Input
The distance between two circles C1 and C2 is given by the usual formula
<image>
where (xi, yi ) is the coor... | {
"input": [],
"output": []
} | {
"input": [
"4\n1.0 0.0 0.0\n1.5 0.0 3.0\n2.0 4.0 0.0\n1.0 3.0 4.0\n0"
],
"output": [
"0.5"
]
} | {
"input": [
"4\n1.0 0.0 0.0\n1.5 0.0 3.0\n2.4193437752467455 4.0 0.0\n1.0 3.0 4.0\n0",
"4\n1.0 0.0 0.5226161732400485\n1.5 0.0 3.0\n2.4193437752467455 4.0 0.0\n1.0 3.0 4.0\n0",
"4\n1.0 0.0 1.3084678474472202\n1.5 0.0 3.0\n2.4193437752467455 4.0 0.0\n1.0 3.0 4.0\n0",
"4\n1.0 0.0 1.3084678474472202\n2.... |
p01317 Mr. Rito Post Office | Problem D: Mr. Rito Post Office
You are a programmer working at a post office on a remote island. The area you live in consists of multiple islands. There is one or more port towns on each island. There may be other towns and villages in addition to them. You have to use a boat to go from one island to another. You ca... | {
"input": [],
"output": []
} | {
"input": [
"3 3\n1 2 5 L\n1 2 7 S\n2 3 11 S\n3\n1 2 3\n5 5\n1 2 15 L\n2 3 10 L\n4 5 7 L\n1 3 30 S\n3 4 100 S\n5\n1 3 5 4 1\n0 0"
],
"output": [
"18\n269"
]
} | {
"input": [
"3 3\n1 2 5 L\n1 2 7 S\n2 3 11 S\n3\n1 2 3\n5 5\n1 2 15 L\n2 3 10 L\n4 5 7 L\n1 3 30 S\n3 5 100 S\n5\n1 3 5 4 1\n0 0",
"3 3\n1 2 5 L\n1 2 7 S\n2 3 11 S\n3\n1 2 3\n7 5\n1 2 15 L\n2 3 10 L\n4 5 7 L\n1 3 30 S\n3 4 000 S\n5\n1 3 5 4 1\n0 0",
"3 3\n1 2 5 L\n1 2 7 S\n2 3 11 S\n3\n2 2 3\n5 5\n1 2 15... |
p01485 Satan Attacks | Time Limit: 8 sec / Memory Limit: 64 MB
Example
Input
2
0 0 5 0 10
1 0 6 0 10
1
0.000000 0.000000
6.000000 0.000000
Output
2 | {
"input": [],
"output": []
} | {
"input": [
"2\n0 0 5 0 10\n1 0 6 0 10\n1\n0.000000 0.000000\n6.000000 0.000000"
],
"output": [
"2"
]
} | {
"input": [
"2\n0 0 5 0 10\n2 0 6 0 10\n1\n0.000000 0.000000\n6.000000 0.000000",
"2\n0 0 9 0 10\n1 0 6 0 10\n1\n0.000000 0.000000\n6.000000 0.000000",
"2\n0 0 9 0 10\n1 0 6 0 10\n2\n0.000000 0.000000\n6.000000 0.000000",
"2\n1 0 5 0 10\n1 0 6 0 10\n1\n0.000000 0.000000\n6.000000 0.000000",
"2\n0... |
p01647 Texas hold 'em | Problem Statement
Texas hold 'em is one of the standard poker games, originated in Texas, United States. It is played with a standard deck of 52 cards, which has 4 suits (spades, hearts, diamonds and clubs) and 13 ranks (A, K, Q, J and 10-2), without jokers.
With betting aside, a game goes as described below.
At the... | {
"input": [],
"output": []
} | {
"input": [
"SA SK\nDA CA\nSQ SJ ST\nSA HA\nD2 C3\nH4 S5 DA\nHA D9\nH6 C9\nH3 H4 H5\n#"
],
"output": [
"1.00000000000000000000\n0.34444444444444444198\n0.63030303030303025391"
]
} | {
"input": [
"SA SK\nDA CA\nSQ SJ ST\nSA HA\nD2 C3\nH4 S6 DA\nHA D9\nH6 C9\nH3 H4 H5\n#",
"SA SK\nDA CA\nSQ SJ ST\nSA HA\nD2 C3\nH3 S5 DA\nHA D9\nH6 C9\nH3 H4 H5\n#",
"SA SK\nDA CA\nSQ SJ ST\nSA HA\nD2 C3\nH3 S5 DA\nHA D9\nH6 C9\nH3 H4 H6\n#",
"SA SK\nDA CA\nSQ SJ ST\nSA HA\nD3 C3\nH3 S5 DA\nHA D9\nH6... |
p01798 Midpoint | Example
Input
2 2 3
0 0
2 0
0 0
0 2
0 0
1 1
1 1
Output
3 | {
"input": [],
"output": []
} | {
"input": [
"2 2 3\n0 0\n2 0\n0 0\n0 2\n0 0\n1 1\n1 1"
],
"output": [
"3"
]
} | {
"input": [
"2 2 3\n0 0\n2 0\n0 1\n0 2\n0 0\n1 1\n1 1",
"2 2 3\n0 0\n3 0\n0 1\n0 2\n0 0\n1 1\n1 1",
"2 2 2\n0 0\n2 0\n0 1\n0 2\n0 -1\n1 1\n1 1",
"2 2 3\n0 0\n2 0\n0 1\n0 2\n0 1\n1 1\n1 1",
"2 2 5\n0 0\n3 0\n0 1\n0 2\n0 0\n1 1\n1 1",
"2 2 3\n0 0\n2 0\n0 1\n0 2\n0 -1\n1 1\n1 1",
"2 2 3\n0 0... |
p01932 All Japan Association of Return home | problem
AOR Co., Ltd. (Association Of Return home) has $ N $ employees.
Employee $ i $ wants to use the elevator to go down to the $ 1 $ floor and arrives in front of the elevator on the $ F_i $ floor at time $ t_i $. You decide to remotely control an elevator that has only $ 1 $ on the $ 1 $ floor at time $ 0 $ and ... | {
"input": [],
"output": []
} | {
"input": [
"2 2\n2 2\n3 3"
],
"output": [
"5"
]
} | {
"input": [
"2 2\n2 1\n3 3",
"2 2\n1 2\n3 3",
"1 2\n2 1\n3 3",
"2 4\n2 2\n3 3",
"2 3\n2 2\n2 2",
"1 2\n3 -1\n3 2",
"2 2\n2 2\n6 3",
"2 4\n2 2\n6 4",
"1 2\n1 2\n3 1",
"2 2\n2 2\n2 3",
"2 0\n2 2\n2 3",
"2 0\n0 2\n2 3",
"3 2\n2 2\n2 3",
"2 0\n2 2\n2 4",
"2 0\n... |
p02070 Permutation Sort | Problem Statement
One day (call it day 0), you find a permutation $P$ of $N$ integers written on the blackboard in a single row. Fortunately you have another permutation $Q$ of $N$ integers, so you decide to play with these permutations.
Every morning of the day 1,2,3,... , you rewrite every number on the blackboard ... | {
"input": [],
"output": []
} | {
"input": [
""
],
"output": [
""
]
} | {
"input": [],
"output": []
} |
p02212 Team Making | Problem statement
When you heard that this year's KUPC can be joined as a team, you decided to talk to your friends and join as a team.
Eventually, $ 4 $ people, including you, got together.
Individual strength is expressed in ratings, and $ 4 $ person ratings are $ a $, $ b $, $ c $, and $ d $, respectively.
You d... | {
"input": [],
"output": []
} | {
"input": [
"2 1 3 4"
],
"output": [
"0"
]
} | {
"input": [
"2 1 3 6",
"3 1 3 6",
"3 0 3 6",
"3 0 3 12",
"4 0 1 0",
"6 0 1 0",
"6 1 1 0",
"0 11 -2 -1",
"0 11 -2 -2",
"0 11 -2 0",
"0 11 -2 1",
"0 11 -3 1",
"0 17 -3 1",
"0 17 -3 0",
"0 17 -2 0",
"-1 16 -1 0",
"-14 0 -1 1",
"0 1 0 22",
"0 1 ... |
p02366 Articulation Points | Find articulation points of a given undirected graph G(V, E).
A vertex in an undirected graph is an articulation point (or cut vertex) iff removing it disconnects the graph.
Constraints
* 1 ≤ |V| ≤ 100,000
* 0 ≤ |E| ≤ 100,000
* The graph is connected
* There are no parallel edges
* There are no self-loops
Input
|... | {
"input": [],
"output": []
} | {
"input": [
"5 4\n0 1\n1 2\n2 3\n3 4",
"4 4\n0 1\n0 2\n1 2\n2 3"
],
"output": [
"1\n2\n3",
"2"
]
} | {
"input": [
"5 4\n0 1\n1 2\n2 3\n3 2",
"3 4\n0 1\n0 2\n1 2\n2 3",
"5 4\n0 1\n1 2\n2 1\n3 4",
"5 4\n0 0\n1 2\n3 0\n3 2",
"8 4\n0 1\n1 2\n2 3\n3 4",
"3 4\n0 1\n0 2\n2 2\n2 4",
"5 4\n0 0\n1 3\n3 0\n3 2",
"8 4\n0 1\n1 2\n1 3\n3 4",
"5 4\n0 1\n1 4\n2 3\n3 0",
"5 4\n0 1\n0 4\n2 3\n3... |
bitcj5 | Doge and Cate can no longer coexist in the same planet. Time has finally come to decide once and for all, who will reign over this planet.
They agreed on a non violent way to settle this. Both are given an array of N integers and a positive integer K. In a single operation, one can change an element of the array to any... | {
"input": [],
"output": []
} | {
"input": [
"2\n5 1\n1 2 3 4 5\n4 3\n1 2 2 1"
],
"output": [
"0\n1"
]
} | {
"input": [],
"output": []
} |
coins | In Byteland they have a very strange monetary system.
Each Bytelandian gold coin has an integer number written on it. A coin n
can be exchanged in a bank into three coins: n/2, n/3 and n/4.
But these numbers are all rounded down (the banks have to make a profit).
You can also sell Bytelandian coins for American doll... | {
"input": [],
"output": []
} | {
"input": [
"12\n2"
],
"output": [
"13\n2\n"
]
} | {
"input": [
"12\n1",
"12\n0",
"12\n3",
"12\n4",
"12\n5",
"12\n10",
"12\n7",
"12\n9",
"12\n19",
"12\n6",
"12\n11",
"12\n21",
"12\n27",
"12\n12",
"12\n15",
"12\n14",
"12\n20",
"12\n8",
"12\n26",
"12\n23",
"12\n17",
"12\n33",
"1... |
galactik | WARNING Large input/output files. Use faster I/O.
It's Galactik Football time! The Galactik Football Assosiation (GFA) has announced a football tournament between all the teams of all the planets in the galaxy (say N). Teams like Snow Kids, Shadows, Xenons, Red Tigers, Wambas, Pirates, etc. are in total enthusiasm and ... | {
"input": [],
"output": []
} | {
"input": [
"6 6\n1 2\n2 3\n1 3\n4 5\n5 6\n4 6\n1\n3\n5\n2\n4\n6",
"3 1\n2 3\n1\n-1\n-1"
],
"output": [
"3\n",
"-1\n"
]
} | {
"input": [
"6 6\n1 2\n2 5\n1 3\n4 5\n5 6\n4 6\n1\n3\n5\n2\n4\n6",
"3 1\n3 3\n1\n-1\n-1",
"6 6\n1 2\n2 3\n1 3\n4 5\n5 6\n4 6\n1\n3\n5\n2\n4\n1",
"6 6\n1 2\n2 3\n1 3\n4 5\n5 6\n4 6\n1\n3\n8\n2\n4\n6",
"6 6\n1 4\n1 5\n1 3\n4 5\n5 6\n4 6\n1\n3\n5\n2\n4\n6",
"3 1\n3 3\n1\n0\n0",
"6 6\n2 2\n1 ... |
lucky10 | The Little Elephant loves lucky strings. Everybody knows that the lucky string is a string of digits that contains only the lucky digits 4 and 7. For example, strings "47", "744", "4" are lucky while "5", "17", "467" are not.
The Little Elephant has the strings A and B of digits. These strings are of equal lengths, t... | {
"input": [],
"output": []
} | {
"input": [
"4\n4\n7\n435\n479\n7\n8\n1675475\n9756417"
],
"output": [
"7\n74\n\n777744"
]
} | {
"input": [
"4\n4\n7\n707\n479\n7\n8\n1675475\n9756417",
"4\n4\n7\n707\n479\n7\n8\n1675475\n18691566",
"4\n4\n7\n707\n479\n7\n8\n1675475\n9140046",
"4\n4\n7\n300\n479\n5\n8\n1675475\n9140046",
"4\n4\n11\n551\n479\n5\n8\n1675475\n9140046",
"4\n2\n1\n551\n479\n5\n13\n1675475\n9140046",
"4\n... |
promo | Mo the pro does not want to be late for the promo of Incident'14, the annual cultural fest of NITK. In his excitement, he drops his only 2 wrist watches. He sets his watches according to a wall clock. After some time N he discovers that one of the watch is X minutes fast, and the other watch is Y minutes slow. What ... | {
"input": [],
"output": []
} | {
"input": [
"2\n10 5 5\n1 1 1"
],
"output": [
"720\n360"
]
} | {
"input": [],
"output": []
} |
tech04 | In this problem, you are given two strings S1 and S2, your task is to determine whether one string is an anagram of the other. An anagram of a string is a string obtained by permuting the letters of a string. For example aaba and aaab are anagrams, while abcd and deba are not.
Input
The first line would consist of t... | {
"input": [],
"output": []
} | {
"input": [
"2\naaba aaab\nabcd deba"
],
"output": [
"YES\nNO\n"
]
} | {
"input": [
"2\naaba baaa\nabcd deba",
"2\na`ba aaab\ncbad deba",
"2\naaba baaa\ncbad deba",
"2\naaba aaab\ncbad deba",
"2\nab`a aaab\ncbad deba",
"2\naba` aaab\ncbad deba",
"2\naba` a`ab\ncbad deba",
"2\naba` a`ba\ncbad deba",
"2\n`aba a`ba\ncbad deba",
"2\n`aba a`ba\ncbad ed... |
1170_A. Three Integers Again | We have three positive integers a, b and c. You don't know their values, but you know some information about them. Consider all three pairwise sums, i.e. the numbers a+b, a+c and b+c. You know exactly two (any) of three pairwise sums.
Your task is to find such three positive integers a, b and c which match the given i... | {
"input": [],
"output": []
} | {
"input": [
"3\n123 13\n2 2\n2000000000 2000000000\n"
],
"output": [
"\n111 1 12\n1 1 1\n1999999999 1 1\n"
]
} | {
"input": [],
"output": []
} |
1466_B. Last minute enhancements | Athenaeus has just finished creating his latest musical composition and will present it tomorrow to the people of Athens. Unfortunately, the melody is rather dull and highly likely won't be met with a warm reception.
His song consists of n notes, which we will treat as positive integers. The diversity of a song is th... | {
"input": [],
"output": []
} | {
"input": [
"5\n6\n1 2 2 2 5 6\n2\n4 4\n6\n1 1 3 4 4 5\n1\n1\n6\n1 1 1 2 2 2\n"
],
"output": [
"\n5\n2\n6\n1\n3\n"
]
} | {
"input": [
"5\n6\n1 2 2 2 5 6\n2\n2 4\n6\n1 1 3 4 4 5\n1\n1\n6\n1 1 1 2 2 2\n",
"5\n6\n1 2 2 2 5 6\n2\n4 4\n6\n1 1 3 4 4 5\n1\n1\n6\n1 1 1 2 2 3\n",
"5\n6\n1 2 2 4 5 6\n2\n2 4\n6\n1 1 3 4 4 5\n1\n1\n6\n1 1 2 2 2 2\n",
"5\n6\n1 2 2 4 5 6\n2\n2 4\n6\n1 1 1 4 4 5\n1\n1\n6\n1 1 2 2 2 2\n",
"5\n6\n1 ... |
1512_F. Education | Polycarp is wondering about buying a new computer, which costs c tugriks. To do this, he wants to get a job as a programmer in a big company.
There are n positions in Polycarp's company, numbered starting from one. An employee in position i earns a[i] tugriks every day. The higher the position number, the more tugriks... | {
"input": [],
"output": []
} | {
"input": [
"3\n4 15\n1 3 10 11\n1 2 7\n4 100\n1 5 10 50\n3 14 12\n2 1000000000\n1 1\n1\n"
],
"output": [
"\n6\n13\n1000000000\n"
]
} | {
"input": [
"3\n4 15\n1 3 10 11\n1 2 7\n4 100\n1 5 10 42\n3 14 12\n2 1000000000\n1 1\n1\n",
"3\n4 15\n1 3 10 11\n1 2 7\n4 111\n2 5 10 39\n3 14 12\n2 1000000000\n1 1\n1\n",
"3\n4 15\n1 3 10 11\n1 2 7\n4 111\n2 5 10 39\n3 14 1\n2 1000000000\n1 1\n1\n",
"3\n4 15\n1 3 10 11\n1 2 7\n4 100\n1 5 17 42\n3 14... |
153_D. Date Change | You are given a date in "DD.MM.YYYY" ("day.month.year") format and a number of days shift you have to add to this date. Output the resulting date.
Input
The first line of input contains the date in "DD.MM.YYYY" format: two digits for day (with leading zero if needed), dot, two digits for month (with leading zero if n... | {
"input": [],
"output": []
} | {
"input": [
"10.02.2012\n12\n",
"01.02.2010\n-40\n",
"01.01.2000\n365\n",
"13.08.1990\n-609\n"
],
"output": [
"22.02.2012\n",
"23.12.2009\n",
"31.12.2000\n",
"12.12.1988\n"
]
} | {
"input": [],
"output": []
} |
188_C. LCM | Least common multiple (LCM) of two numbers is the smallest positive integer which is divisible by both of them. You are given integers a and b. Calculate their LCM.
Input
The input contains two integers a and b (1 ≤ a, b ≤ 103), separated by a single space.
Output
Output LCM(a, b).
Examples
Input
10 42
Output
... | {
"input": [],
"output": []
} | {
"input": [
"10 42\n",
"123 41\n"
],
"output": [
"210\n",
"123\n"
]
} | {
"input": [],
"output": []
} |
470_B. Hexakosioihexekontahexaphobia | This (unpronounceable) word means simply fear of number 666.
You are given a string of digits. Check whether it is scary for a person suffering from this phobia, i.e., whether it contains number 666 as a substring.
Input
The input will consist of a single string p. The string contains between 1 and 100 digits ('0'-... | {
"input": [],
"output": []
} | {
"input": [
"123098\n",
"16660\n",
"1606061\n"
],
"output": [
"NO\n",
"YES\n",
"NO\n"
]
} | {
"input": [],
"output": []
} |
ankit-and-numbers-8 | Ankit has a set of numbers and has recently studied set theory. He has created a power set of this set and is writing a program to compute sum of all elements of all the subsets in power set.
Power set of a set S is defined as set of all possible subsets of S.
Set S consist of all the number from 1 to N.
You need to... | {
"input": [],
"output": []
} | {
"input": [
"1\n3\n\nSAMPLE"
],
"output": [
"24\n"
]
} | {
"input": [
"1\n2\n\nSAMPLE",
"1\n3\n\nASMPLE",
"1\n4\n\nELPAMS",
"1\n1\n\nELPAMS",
"1\n6\n\nAPMRLE",
"1\n8\n\nAPMRLE",
"1\n15\n\nAPMQLE",
"1\n9\n\nELQMPA",
"1\n5\n\nAPMRLE",
"1\n13\n\nAPMRLE",
"1\n18\n\nELQMPA",
"1\n11\n\nELAMPQ",
"1\n17\n\nAPMPLE",
"1\n12\n\n... |
chandu-and-consecutive-letters | Chandu is very fond of strings. (Or so he thinks!) But, he does not like strings which have same consecutive letters. No one has any idea why it is so. He calls these strings as Bad strings. So, Good strings are the strings which do not have same consecutive letters. Now, the problem is quite simple. Given a string S, ... | {
"input": [],
"output": []
} | {
"input": [
"3\nabb\naaab\nababa\n\nSAMPLE"
],
"output": [
"ab\nab\nababa\n"
]
} | {
"input": [
"3\nabb\naaab\nababa\n\nSAMLPE",
"3\nbab\naaab\nababa\n\nSAMMPF",
"3\nbab\nbaab\nababa\n\nSAMMPF",
"3\nbab\nbaac\nababa\n\nSAMMPF",
"3\nbab\ncaab\nababa\n\nSAMMPF",
"3\nbab\ncaaa\nababa\n\nSAMMPF",
"3\nbab\ncaaa\nabaaa\n\nEPMMAS",
"3\nbab\naaac\nabaaa\n\nSAMMPE",
"3\nc... |
girlfriends-demands | Like most of the girlfriends, Ashima when asks for something, won’t stop until she gets that.
The way she gets that is by keep on repeating the same things again and again. Like if she wants chocolate, she will just keep on repeating “chocolate” again and again.
I have decided to answer to her demands as “Yes” or “No”... | {
"input": [],
"output": []
} | {
"input": [
"vgxgp\n3\n2 4\n2 5\n7 14\n\nSAMPLE"
],
"output": [
"Yes\nNo\nYes\n"
]
} | {
"input": [
"vgxgp\n3\n2 4\n2 3\n7 14\n\nSAMPLE",
"vgxgp\n3\n2 4\n1 5\n11 14\n\nSALPLE",
"vgxgp\n3\n2 5\n1 5\n11 14\n\nELPLAS",
"vgxgp\n3\n2 5\n1 5\n22 14\n\nELPLAS",
"vgxgp\n1\n2 4\n1 5\n7 14\n\nSALPLE",
"vgwgp\n2\n2 5\n1 5\n11 14\n\nELPLAS",
"vgxgp\n3\n2 4\n2 4\n7 17\n\nSALPLE",
"vg... |
plane-with-points | There are N points on an XY plane. In one turn, you can select a set of collinear points on the plane and remove them. Your goal is to remove all the points in the least number of turns. Given the coordinates of the points, calculate two things:
The minimum number of turns (T) needed to remove all the points.
The numb... | {
"input": [],
"output": []
} | {
"input": [
"2\n3\n0 0\n0 1\n1 0\n4\n3 4\n3 5\n3 6\n5 5\n\nSAMPLE"
],
"output": [
"2 6\n2 8"
]
} | {
"input": [],
"output": []
} |
p02609 AIsing Programming Contest 2020 - Anything Goes to Zero | Let \mathrm{popcount}(n) be the number of `1`s in the binary representation of n. For example, \mathrm{popcount}(3) = 2, \mathrm{popcount}(7) = 3, and \mathrm{popcount}(0) = 0.
Let f(n) be the number of times the following operation will be done when we repeat it until n becomes 0: "replace n with the remainder when n... | {
"input": [],
"output": []
} | {
"input": [
"23\n00110111001011011001110",
"3\n011"
],
"output": [
"2\n1\n2\n2\n1\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n1\n3",
"2\n1\n1"
]
} | {
"input": [
"23\n00110111001011011001111",
"3\n111",
"23\n00110111001011011101111",
"3\n110",
"23\n00110111001011011101101",
"3\n101",
"23\n00110111001011011001101",
"3\n100",
"23\n01110111001011011101101",
"3\n001",
"23\n01110111001011001101101",
"23\n0111010100101100... |
p02740 AtCoder Grand Contest 043 - Jewelry Box | There are N jewelry shops numbered 1 to N.
Shop i (1 \leq i \leq N) sells K_i kinds of jewels. The j-th of these jewels (1 \leq j \leq K_i) has a size and price of S_{i,j} and P_{i,j}, respectively, and the shop has C_{i,j} jewels of this kind in stock.
A jewelry box is said to be good if it satisfies all of the foll... | {
"input": [],
"output": []
} | {
"input": [
"5\n5\n86849520 30 272477201869\n968023357 28 539131386006\n478355090 8 194500792721\n298572419 6 894877901270\n203794105 25 594579473837\n5\n730211794 22 225797976416\n842538552 9 420531931830\n871332982 26 81253086754\n553846923 29 89734736118\n731788040 13 241088716205\n5\n903534485 22 14004515377... | {
"input": [
"5\n5\n86849520 30 272477201869\n968023357 28 539131386006\n478355090 8 194500792721\n298572419 6 894877901270\n203794105 25 594579473837\n5\n730211794 22 225797976416\n842538552 9 420531931830\n871332982 26 81253086754\n553846923 29 89734736118\n731788040 13 241088716205\n5\n903534485 22 14004515377... |
p02875 AtCoder Grand Contest 040 - Neither AB nor BA | Given is a positive even number N.
Find the number of strings s of length N consisting of `A`, `B`, and `C` that satisfy the following condition:
* s can be converted to the empty string by repeating the following operation:
* Choose two consecutive characters in s and erase them. However, choosing `AB` or `BA` is no... | {
"input": [],
"output": []
} | {
"input": [
"2",
"1000000",
"10"
],
"output": [
"7",
"210055358",
"50007"
]
} | {
"input": [
"4",
"1100000",
"8",
"0100000",
"14",
"0110000",
"0110010",
"6",
"1100010",
"0100100",
"12",
"0110100",
"16",
"1110010",
"0110110",
"0",
"1000010",
"0000010",
"0100010",
"0000100",
"24",
"1001000",
"20",
"1100... |
p03009 diverta 2019 Programming Contest 2 - Balanced Piles | There are N squares arranged in a row, numbered 1 to N from left to right. Takahashi will stack building blocks on these squares, on which there are no blocks yet.
He wants to stack blocks on the squares evenly, so he will repeat the following operation until there are H blocks on every square:
* Let M and m be the m... | {
"input": [],
"output": []
} | {
"input": [
"31415 9265 3589",
"2 30 15",
"2 2 1"
],
"output": [
"312069529",
"94182806",
"6"
]
} | {
"input": [
"31415 9265 4472",
"2 30 23",
"60899 9265 4472",
"2 30 9",
"60899 6796 4472",
"2 30 14",
"60899 6796 8504",
"2 22 14",
"118261 6796 8504",
"2 22 26",
"2 44 26",
"2 60 26",
"118261 3351 8683",
"2 7 26",
"194739 3351 8683",
"2 1 26",
"2 2 ... |
p03149 KEYENCE Programming Contest 2019 - Beginning | You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
Constraints
* 0 \leq N_1, N_2, N_3, N_4 \leq 9
* N_1, N_2, N_3 and N_4 are integers.
Input
Input is given from Standard Input in the following format:
N_1 N_2 N_3 N_4
Output
If N_1, N_2, N_3 ... | {
"input": [],
"output": []
} | {
"input": [
"1 9 7 4",
"1 2 9 1",
"4 9 0 8",
"1 7 9 4"
],
"output": [
"YES",
"NO",
"NO",
"YES"
]
} | {
"input": [
"1 9 13 4",
"1 2 3 1",
"4 9 0 13",
"0 7 9 4",
"1 9 13 3",
"1 3 3 1",
"3 9 0 13",
"1 12 9 4",
"1 9 13 0",
"1 2 3 2",
"3 9 -1 13",
"1 15 9 4",
"1 3 13 0",
"1 0 3 2",
"3 1 -1 13",
"1 15 11 4",
"1 3 13 -1",
"1 0 4 2",
"3 1 -1 24",
... |
p03293 AtCoder Beginner Contest 103 - String Rotation | You are given string S and T consisting of lowercase English letters.
Determine if S equals T after rotation.
That is, determine if S equals T after the following operation is performed some number of times:
Operation: Let S = S_1 S_2 ... S_{|S|}. Change S to S_{|S|} S_1 S_2 ... S_{|S|-1}.
Here, |X| denotes the len... | {
"input": [],
"output": []
} | {
"input": [
"aaaaaaaaaaaaaaab\naaaaaaaaaaaaaaab",
"kyoto\ntokyo",
"abc\narc"
],
"output": [
"Yes",
"Yes",
"No"
]
} | {
"input": [
"aaaaaaaaaaaaaaab\naaaabaaaaaaaaaaa",
"kyoto\ntnkyo",
"cba\narc",
"aaaaaabaaaaaaaab\naaaabaaaaaaaaaaa",
"kyoto\ntmkyo",
"cba\ncra",
"aaaaaabaaaaaaaab\naaaaaaaaaaabaaaa",
"kyoso\ntmkyo",
"bca\ncra",
"baaaaaaaabaaaaaa\naaaaaaaaaaabaaaa",
"kyoso\ntmkyn",
"bca\... |
p03449 AtCoder Beginner Contest 087 - Candies | We have a 2 \times N grid. We will denote the square at the i-th row and j-th column (1 \leq i \leq 2, 1 \leq j \leq N) as (i, j).
You are initially in the top-left square, (1, 1). You will travel to the bottom-right square, (2, N), by repeatedly moving right or down.
The square (i, j) contains A_{i, j} candies. You ... | {
"input": [],
"output": []
} | {
"input": [
"7\n3 3 4 5 4 5 3\n5 3 4 4 2 3 2",
"1\n2\n3",
"5\n3 2 2 4 1\n1 2 2 2 1",
"4\n1 1 1 1\n1 1 1 1"
],
"output": [
"29",
"5",
"14",
"5"
]
} | {
"input": [
"7\n3 3 4 5 4 5 3\n5 3 8 4 2 3 2",
"1\n2\n6",
"5\n3 2 2 4 1\n0 2 2 2 1",
"4\n1 1 0 1\n1 1 1 1",
"7\n3 3 4 5 4 5 3\n5 3 8 4 2 5 2",
"4\n1 1 0 1\n1 1 0 1",
"7\n3 3 4 5 4 5 3\n5 3 8 4 0 5 2",
"1\n2\n7",
"5\n3 2 0 4 1\n0 2 1 2 1",
"7\n3 3 4 5 4 5 3\n5 3 15 4 0 5 2",
... |
p03609 AtCoder Beginner Contest 072 - Sandglass2 | We have a sandglass that runs for X seconds. The sand drops from the upper bulb at a rate of 1 gram per second. That is, the upper bulb initially contains X grams of sand.
How many grams of sand will the upper bulb contains after t seconds?
Constraints
* 1≤X≤10^9
* 1≤t≤10^9
* X and t are integers.
Input
The input ... | {
"input": [],
"output": []
} | {
"input": [
"48 58",
"1000000000 1000000000",
"100 17"
],
"output": [
"0",
"0",
"83"
]
} | {
"input": [
"48 39",
"1000000010 1000000000",
"000 17",
"48 19",
"1001000010 1000000000",
"48 0",
"1001000010 1000010000",
"101 17",
"3 0",
"1001000010 1000010001",
"1 0",
"1001000010 1000010011",
"100 30",
"1001010010 1000010011",
"100 24",
"1001010110... |
p03770 AtCoder Grand Contest 012 - Colorful Balls | Snuke arranged N colorful balls in a row. The i-th ball from the left has color c_i and weight w_i.
He can rearrange the balls by performing the following two operations any number of times, in any order:
* Operation 1: Select two balls with the same color. If the total weight of these balls is at most X, swap the po... | {
"input": [],
"output": []
} | {
"input": [
"1 1 1\n1 1",
"4 7 3\n3 2\n4 3\n2 1\n4 4",
"21 77 68\n16 73\n16 99\n19 66\n2 87\n2 16\n7 17\n10 36\n10 68\n2 38\n10 74\n13 55\n21 21\n3 7\n12 41\n13 88\n18 6\n2 12\n13 87\n1 9\n2 27\n13 15"
],
"output": [
"1",
"2",
"129729600"
]
} | {
"input": [
"4 7 3\n3 1\n4 3\n2 1\n4 4",
"21 77 68\n16 73\n16 99\n19 66\n2 87\n2 16\n7 17\n10 36\n10 68\n2 38\n10 74\n13 55\n21 21\n3 7\n12 41\n2 88\n18 6\n2 12\n13 87\n1 9\n2 27\n13 15",
"21 77 68\n16 73\n16 99\n19 66\n2 87\n2 16\n7 17\n10 36\n10 68\n2 38\n10 74\n13 55\n21 21\n2 7\n12 41\n2 88\n18 6\n2 ... |
p03939 AtCoder Grand Contest 007 - Pushing Balls | There are N balls and N+1 holes in a line. Balls are numbered 1 through N from left to right. Holes are numbered 1 through N+1 from left to right. The i-th ball is located between the i-th hole and (i+1)-th hole. We denote the distance between neighboring items (one ball and one hole) from left to right as d_i (1 \leq ... | {
"input": [],
"output": []
} | {
"input": [
"1 3 3",
"1000 100 100",
"2 1 0"
],
"output": [
"4.500000000000000",
"649620280.957660079002380",
"2.500000000000000"
]
} | {
"input": [
"1 6 3",
"1000 100 000",
"2 1 -1",
"1 6 5",
"1010 100 000",
"3 1 0",
"2 6 5",
"1010 000 000",
"6 1 0",
"2 0 5",
"1010 010 000",
"1 1 0",
"2 0 10",
"1110 010 000",
"2 0 -1",
"2 0 20",
"1110 011 000",
"2 1 20",
"1110 001 000",
... |
p00031 Weight | <image>
My grandmother uses a balance. The balance will balance if you place the same size on both of the two dishes, otherwise it will tilt to the heavier side. The weights of the 10 weights are 1g, 2g, 4g, 8g, 16g, 32g, 64g, 128g, 256g, 512g in order of lightness.
My grandmother says, "Weigh up to about 1 kg in gr... | {
"input": [],
"output": []
} | {
"input": [
"5\n7\n127"
],
"output": [
"1 4\n1 2 4\n1 2 4 8 16 32 64"
]
} | {
"input": [
"5\n7\n135",
"5\n8\n135",
"5\n5\n135",
"5\n4\n135",
"5\n4\n218",
"5\n2\n218",
"5\n2\n143",
"5\n2\n167",
"5\n2\n89",
"5\n3\n89",
"5\n1\n89",
"5\n1\n155",
"5\n2\n155",
"5\n4\n155",
"5\n4\n233",
"5\n2\n233",
"5\n2\n351",
"5\n2\n181",
... |
p00162 Hamming Numbers | The number obtained by multiplying 1 by 2, 3, 5 several times (0 or more times) is called the Hamming numbers. For example
* 1
* 1 x 2 x 2 = 4
* 1 x 2 x 2 x 3 x 5 x 5 = 300
Etc. are humming numbers, but 11, 13, 14 etc. are not humming numbers.
All humming numbers are divisible by a power of 60 (for example, 54 is ... | {
"input": [],
"output": []
} | {
"input": [
"3 8\n1 27\n1 86\n0"
],
"output": [
"5\n17\n31"
]
} | {
"input": [
"3 8\n2 27\n1 86\n0",
"3 9\n2 27\n1 86\n0",
"3 8\n1 35\n1 86\n0",
"5 8\n2 27\n1 86\n0",
"3 9\n4 27\n1 86\n0",
"3 9\n6 27\n1 86\n0",
"3 9\n6 31\n1 86\n0",
"3 6\n6 31\n1 86\n0",
"3 6\n6 9\n1 86\n0",
"3 6\n8 9\n1 86\n0",
"3 8\n1 19\n1 86\n0",
"3 8\n2 27\n1 140... |
p00319 Downhill Race | You will participate in the ski competition held on Mt. Bandai. In this competition, each player slides down the slope twice and competes for the short total time. There are several flags on the slopes, and a line is set between them for athletes to pass through. Athletes slide down the line from the start point to the... | {
"input": [],
"output": []
} | {
"input": [
"4 5\n1 2 3 5\n1 3 1 3\n3 2 2 5\n2 4 6 1\n3 4 5 5",
"3 3\n1 2 1 2\n2 3 1 2\n1 3 1 3",
"3 3\n1 2 1 2\n2 3 1 2\n1 3 1 1"
],
"output": [
"13",
"3",
"2"
]
} | {
"input": [
"3 3\n1 2 1 2\n2 3 0 2\n1 3 1 1",
"4 5\n1 2 3 5\n1 3 1 3\n3 2 2 5\n2 4 9 1\n3 4 5 5",
"3 3\n1 2 1 2\n2 3 0 2\n1 3 1 0",
"3 3\n1 2 1 2\n2 3 0 2\n1 3 0 0",
"3 3\n1 2 2 2\n2 3 0 1\n1 3 1 2",
"4 5\n1 2 4 5\n1 3 1 3\n3 2 2 5\n2 4 6 0\n3 4 5 5",
"4 5\n1 2 1 5\n1 3 1 3\n3 2 2 5\n2 4 ... |
p00489 Soccer | problem
Soccer is popular in JOI, and a league match called the JOI League is held every week.
There are N teams in the JOI league, numbered from 1 to N. All combinations of matches are played exactly once. In other words, N × (N -1) / 2 games are played. The outcome of each match is determined by the score of each t... | {
"input": [],
"output": []
} | {
"input": [
"4\n1 2 0 1\n1 3 2 1\n1 4 2 2\n2 3 1 1\n2 4 3 0\n3 4 1 3"
],
"output": [
"2\n1\n4\n2"
]
} | {
"input": [
"4\n1 2 0 1\n1 3 2 1\n1 4 2 2\n2 3 2 1\n2 4 3 0\n3 4 1 3",
"4\n1 2 0 1\n1 3 2 1\n1 4 2 2\n4 3 2 1\n2 4 3 0\n3 4 1 3",
"4\n1 2 1 1\n1 3 2 1\n1 4 2 2\n4 0 3 1\n2 4 3 0\n0 4 1 4",
"4\n1 1 1 1\n1 3 2 1\n1 4 2 0\n4 0 3 1\n2 4 3 0\n0 4 1 4",
"4\n1 2 0 1\n2 3 2 1\n1 4 2 2\n2 3 2 1\n2 4 3 0\n... |
p00675 Sports Days | The University of Aizu Elementary School (Aizu University and Small) is famous as one of Japan's leading competition programmer training schools. Of course, it is essential to practice the algorithm even when attending an athletic meet.
Of course you, the director of the competitive programming department, want to win... | {
"input": [],
"output": []
} | {
"input": [
"2\n1\n1\n2\n1 2 1\n2 1 1\n1\n1111\n2\n1\n1\n2\n1 2 1\n2 1 1\n1\n11\n2\n1\n1\n2\n1 2 1\n2 1 1\n10\n1111\n2\n1\n1\n2\n1 2 1\n2 1 1\n10\n111111\n2\n1\n1\n2\n1 2 -1\n2 1 0\n10\n11\n2\n1\n1\n2\n1 2 -1\n2 1 0\n10\n1111\n2\n1\n1\n2\n1 2 -1\n2 1 0\n10\n12\n2\n1\n1\n2\n1 2 -1\n2 1 0\n10\n1111111111\n0"
],
... | {
"input": [
"2\n1\n1\n2\n1 2 1\n2 1 1\n1\n1111\n2\n1\n1\n2\n1 2 1\n2 1 1\n1\n11\n2\n1\n1\n2\n1 2 1\n2 1 1\n14\n1111\n2\n1\n1\n2\n1 2 1\n2 1 1\n10\n111111\n2\n1\n1\n2\n1 2 -1\n2 1 0\n10\n11\n2\n1\n1\n2\n1 2 -1\n2 1 0\n10\n1111\n2\n1\n1\n2\n1 2 -1\n2 1 0\n10\n12\n2\n1\n1\n2\n1 2 -1\n2 1 0\n10\n1111111111\n0",
... |
p00818 Viva Confetti | Do you know confetti? They are small discs of colored paper, and people throw them around during parties or festivals. Since people throw lots of confetti, they may end up stacked one on another, so there may be hidden ones underneath.
A handful of various sized confetti have been dropped on a table. Given their posit... | {
"input": [],
"output": []
} | {
"input": [
"3\n0 0 0.5\n-0.9 0 1.00000000001\n0.9 0 1.00000000001\n5\n0 1 0.5\n1 1 1.00000000001\n0 2 1.00000000001\n-1 1 1.00000000001\n0 -0.00001 1.00000000001\n5\n0 1 0.5\n1 1 1.00000000001\n0 2 1.00000000001\n-1 1 1.00000000001\n0 0 1.00000000001\n2\n0 0 1.0000001\n0 0 1\n2\n0 0 1\n0.00000001 0 1\n0"
],
... | {
"input": [
"3\n0 0 0.5\n-0.9 0 1.00000000001\n0.9 0 1.00000000001\n5\n0 1 0.5\n1 1 1.00000000001\n0 2 1.00000000001\n-1 1 1.00000000001\n0 -0.00001 1.00000000001\n5\n0 1 0.5\n1 1 1.00000000001\n0 2 1.00000000001\n-1 1 1.00000000001\n0 0 1.00000000001\n2\n0 0 1.0000001\n-1 0 1\n2\n0 0 1\n0.00000001 0 1\n0",
... |
p00949 Hidden Anagrams | Example
Input
anagram
grandmother
Output
4 | {
"input": [],
"output": []
} | {
"input": [
"anagram\ngrandmother"
],
"output": [
"4"
]
} | {
"input": [
"anagram\ngrandmosher",
"anbgram\ngrandmosher",
"anbfram\ngrandmosher",
"narfamb\nreoahmodsrg",
"nbgaqnb\ntohtheodscl",
"anagram\ngrandlother",
"anagram\nrehtoldnarg",
"anagram\nsehtoldnarg",
"anbfram\ngrandmhsoer",
"anagram\nsehtolndarg",
"anbfram\ngraodmhsoer... |
p01082 Escape of Lappin the Phantom Thief | Problem
Phantom thief Rappan came to steal the jewels. It was easy to get the jewel, but the jewel was equipped with a sensor and was surrounded by security robots.
The guard robot is designed to move towards the jewel. The sensor didn't seem to be easy to remove, so I decided to put a jewel and escape. I decided to ... | {
"input": [],
"output": []
} | {
"input": [
"20 10 1\n0 0",
"20 10 2\n0 0\n17 5",
"20 10 3\n0 0\n17 5\n6 9"
],
"output": [
"28",
"15",
"11"
]
} | {
"input": [
"16 10 1\n0 0",
"20 10 2\n-1 0\n17 5",
"20 4 3\n0 0\n17 5\n6 9",
"23 10 1\n0 0",
"20 4 3\n0 0\n15 5\n6 9",
"23 17 1\n0 0",
"23 5 1\n0 0",
"23 1 1\n0 0",
"31 1 1\n0 0",
"31 4 1\n0 0",
"31 6 3\n0 0",
"31 6 3\n1 0",
"31 2 3\n2 0",
"16 2 3\n2 0",
"1... |
p01218 Nagashi Soumen | Mr. Natsume, the captain of a baseball club, decided to hold a nagashi-soumen party. He first planned to put a flume at the arena, and let members stand by the side of the flume to eat soumen. But they are so weird that they adhere to each special position, and refused to move to the side of the flume. They requested M... | {
"input": [],
"output": []
} | {
"input": [
"1 1\n0 0 0\n4 4\n0 0 0\n1 1 1\n2 2 2\n3 3 3\n3 4\n0 0 0\n1 1 1\n2 2 2\n4 1\n1 0 1\n0 0 0\n1 1 0\n0 1 -1\n5 2\n0 0 100\n0 0 99\n1 0 99\n1 0 98\n1 0 -100\n7 4\n71 55 -77\n-43 -49 50\n73 -22 -89\n32 99 -33\n64 -22 -25\n-76 -1 6\n39 4 23\n0 0"
],
"output": [
"0\n0\n0\n-1\n200\n197.67136673733841... | {
"input": [
"1 1\n0 0 0\n4 4\n0 0 0\n1 1 1\n2 2 2\n3 3 3\n3 4\n0 0 0\n1 1 1\n2 2 2\n4 1\n1 0 1\n0 0 0\n1 1 0\n0 1 -1\n5 2\n0 0 100\n0 0 99\n1 0 99\n1 0 98\n1 0 -100\n7 4\n91 55 -77\n-43 -49 50\n73 -22 -89\n32 99 -33\n64 -22 -25\n-76 -1 6\n39 4 23\n0 0",
"1 1\n0 0 0\n4 4\n0 0 0\n1 1 1\n2 2 2\n3 3 3\n3 4\n0 0 ... |
p01352 Graph Construction | There are n rabbits, one in each of the huts numbered 0 through n − 1.
At one point, information came to the rabbits that a secret organization would be constructing an underground passage. The underground passage would allow the rabbits to visit other rabbits' huts. I'm happy.
The passages can go in both directions,... | {
"input": [],
"output": []
} | {
"input": [
"4 10\n1 0 1\n1 0 2\n3 1 2\n2 0 1\n1 2 3\n3 0 1\n1 0 1\n2 0 2\n1 1 3\n3 0 2"
],
"output": [
"YES\nNO\nYES"
]
} | {
"input": [
"4 10\n1 0 1\n1 0 2\n3 1 2\n2 0 1\n1 3 3\n3 0 1\n1 0 1\n2 0 2\n1 1 3\n3 0 2",
"4 10\n1 0 1\n1 0 2\n3 1 2\n2 0 1\n1 3 3\n3 0 2\n1 0 1\n2 0 2\n1 1 3\n3 0 2",
"4 10\n1 0 1\n1 0 2\n3 1 2\n2 0 1\n1 3 2\n3 0 2\n1 0 1\n2 0 2\n1 1 3\n3 0 2",
"4 10\n1 0 1\n1 0 2\n3 2 2\n2 0 1\n1 2 3\n3 0 1\n1 0 1\... |
p01534 Anipero 2012 | D: Anipero 2012
Anipero Summer Live, commonly known as Anipero, is the largest anime song live event in Japan where various anime song artists gather. 2D, who loves anime songs, decided to go to Anipero this year as well as last year.
He has already purchased m of psyllium to enjoy Anipero. Psyllium is a stick that g... | {
"input": [],
"output": []
} | {
"input": [
"1 5\n2 3 8"
],
"output": [
"10"
]
} | {
"input": [
"1 5\n2 0 8",
"1 5\n1 -1 8",
"1 5\n1 -1 6",
"1 1\n2 1 1",
"1 0\n2 1 1",
"1 0\n4 -2 5",
"1 2\n1 0 11",
"1 0\n0 -2 7",
"1 1\n1 0 13",
"1 5\n3 3 8",
"0 5\n1 0 6",
"1 2\n1 0 18",
"1 0\n0 -3 14",
"1 1\n2 0 4",
"1 9\n2 -1 13",
"1 2\n-1 0 3",
"... |
p01690 Disciple Life is Hard | D --Disciple Life is Hard / Disciple is hard
Story
The person in D loves donuts. I always want donuts. However, D, who was ordered by his master, Bunashimejitan, to train himself, must limit his calorie intake. Therefore, D person decided to eat donuts up to the calories burned by the training that day, considering t... | {
"input": [],
"output": []
} | {
"input": [
"10 1 1 1 4 3\n6 10\n5 8"
],
"output": [
"15"
]
} | {
"input": [
"17 1 1 1 4 3\n6 10\n5 8",
"8 1 1 1 4 3\n6 14\n5 8",
"17 1 1 1 4 3\n6 10\n4 8",
"17 1 1 1 4 3\n6 14\n5 4",
"17 1 1 1 4 3\n6 10\n4 4",
"17 1 1 1 4 3\n6 14\n10 4",
"22 1 1 1 4 6\n6 14\n5 8",
"30 1 1 1 4 5\n6 14\n5 8",
"17 1 1 1 4 6\n6 10\n7 8",
"17 1 1 1 4 1\n6 10\n5... |
p01834 Cube Dividing | Example
Input
2 2 2 4
0 0 0
1 1 0
1 0 1
0 1 1
Output
4 | {
"input": [],
"output": []
} | {
"input": [
"2 2 2 4\n0 0 0\n1 1 0\n1 0 1\n0 1 1"
],
"output": [
"4"
]
} | {
"input": [
"2 2 4 4\n0 0 0\n1 1 0\n1 0 1\n0 1 1",
"2 2 4 4\n0 0 -1\n1 1 0\n1 0 1\n0 1 1",
"2 2 2 4\n0 0 0\n1 0 0\n1 0 1\n0 1 1",
"2 2 4 4\n0 0 -1\n1 1 0\n2 0 1\n0 1 1",
"2 2 4 4\n0 1 -1\n1 1 0\n2 0 1\n0 1 1",
"2 2 4 4\n0 0 1\n1 1 0\n1 0 1\n0 1 1",
"2 2 4 0\n0 1 -1\n1 1 0\n2 0 1\n0 1 1",
... |
p01969 AA Graph | C: AA グラフ (AA Graph)
Problem
Given a graph as an ASCII Art (AA), please print the length of shortest paths from the vertex s to the vertex t. The AA of the graph satisfies the following constraints.
A vertex is represented by an uppercase alphabet and symbols `o` in 8 neighbors as follows.
ooo
oAo
ooo
Horizontal... | {
"input": [],
"output": []
} | {
"input": [
""
],
"output": [
""
]
} | {
"input": [],
"output": []
} |
p02116 nCm | Problem
Given the integer n, output the smallest m such that nCm (the number of combinations that choose m out of n different ones) is even.
Constraints
The input satisfies the following conditions.
* 1 ≤ n ≤ 1018
Input
The input is given in the following format.
n
Output
Output the minimum m such that nCm i... | {
"input": [],
"output": []
} | {
"input": [
"3",
"2",
"111"
],
"output": [
"4",
"1",
"16"
]
} | {
"input": [
"4",
"11",
"101",
"7",
"15",
"31",
"63",
"127",
"255",
"110",
"6",
"010",
"16",
"011",
"5",
"000",
"0",
"-2",
"8",
"100",
"10",
"14",
"20",
"12",
"-4",
"24",
"-6",
"9",
"13",
"-8",
... |
p02256 Greatest Common Divisor | Write a program which finds the greatest common divisor of two natural numbers a and b
Hint
You can use the following observation:
For integers x and y, if x ≥ y, then gcd(x, y) = gcd(y, x%y)
Constrants
1 ≤ a, b ≤ 109
Input
a and b are given in a line sparated by a single space.
Output
Output the greatest comm... | {
"input": [],
"output": []
} | {
"input": [
"54 20",
"147 105"
],
"output": [
"2",
"21"
]
} | {
"input": [
"86 20",
"147 6",
"9 20",
"9 9",
"268 8",
"14 7",
"8 24",
"12 12",
"624 18",
"48 64",
"124 31",
"25 35",
"35 35",
"252 63",
"32 192",
"110 11",
"110 90",
"-1 -1",
"18 18",
"-2 -2",
"28 28",
"506 22",
"13 130",
... |
p02404 Print a Frame | Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm.
........#
........#
........#
........#
Constraints
* 3 ≤ H ≤ 300
* 3 ≤ W ≤ 300
Input
The input consists of multiple datasets. Each dataset consists of t... | {
"input": [],
"output": []
} | {
"input": [
"3 4\n5 6\n3 3\n0 0"
],
"output": [
"####\n#..#\n####\n\n######\n#....#\n#....#\n#....#\n######\n\n###\n#.#\n###"
]
} | {
"input": [
"3 4\n5 7\n3 3\n0 0",
"3 4\n5 10\n3 3\n0 0",
"3 4\n4 10\n3 3\n0 0",
"3 6\n5 6\n3 3\n0 0",
"3 4\n5 0\n3 3\n0 0",
"3 4\n5 3\n3 3\n0 0",
"3 4\n4 10\n4 3\n0 0",
"3 4\n8 0\n3 3\n0 0",
"3 4\n10 3\n3 3\n0 0",
"5 4\n8 0\n3 3\n0 0",
"5 4\n8 0\n3 6\n0 0",
"3 4\n5 6\n... |
cdva1604 | Everyone knows the famous detective Sherlock. He has been handed over a new case of "The Abominable Bride". Each night she kills N people but to irritate
Sherlock she leaves exactly one people. The way she kills the people is somewhat strange. She makes 1 to N people stand in a line and starts killing
them. But, in t... | {
"input": [],
"output": []
} | {
"input": [
"5\n2\n4\n6\n9\n12"
],
"output": [
"2\n4\n4\n2\n8"
]
} | {
"input": [],
"output": []
} |
dce03 | The captain of TITANIC is a mathematics freak. He has recently been given a problem that he is unable to solve. And he has asked your help to solve it.
There are n numbers in a given expression.
X1 X2 X3 .... Xn
What is the number of ways to put parenthesis in the expression.
For n=4, the different ways are
(((x... | {
"input": [],
"output": []
} | {
"input": [
"2\n4\n5"
],
"output": [
"5\n14\n"
]
} | {
"input": [
"2\n4\n10",
"2\n8\n10",
"2\n15\n10",
"2\n19\n10",
"2\n13\n10",
"2\n7\n10",
"2\n6\n10",
"2\n6\n16",
"2\n5\n16",
"2\n4\n16",
"2\n4\n13",
"2\n2\n10",
"2\n15\n4",
"2\n14\n10",
"2\n5\n10",
"2\n11\n10",
"2\n5\n31",
"2\n4\n27",
"2\n4\n2... |
ignus15b | Problem Description
You are an army personnel in the great army of the Zorin race, where you are a part of a team of n people.
Unfortunately, your army has lost a war to an intergalactic species, genetically much advanced than yours.
Their captain Bruno have kept all your men (including you) as hostages, and now they... | {
"input": [],
"output": []
} | {
"input": [
"6\n6\n125\n32\n46\n98\n156"
],
"output": [
"5\n123\n1\n29\n69\n57"
]
} | {
"input": [],
"output": []
} |
mulmagic | Rohit was travelling to NIT Warangal, to attend their annual technical fest - "Technozion". In the train, opposite to him, Rohit found quite a peculiar man playing with an array of numbers. When he enquired, the man told that he is trying to solve a puzzle for decades but unable to do so. Seeing Rohit's interest in the... | {
"input": [],
"output": []
} | {
"input": [
"1\n8\n1 2 3 4 5 6 7 8"
],
"output": [
"20"
]
} | {
"input": [],
"output": []
} |
rrecipe | Chef had an interesting dream last night. He dreamed of a new revolutionary chicken recipe. When he woke up today he tried very hard to reconstruct the ingredient list. But, he could only remember certain ingredients. To simplify the problem, the ingredient list can be represented by a string of lowercase characters 'a... | {
"input": [],
"output": []
} | {
"input": [
"5\n?\n??\nab?\na?c\naba"
],
"output": [
"26\n26\n1\n0\n1\n"
]
} | {
"input": [
"5\n?\n??\n?ba\na?c\naba",
"5\n?\n?>\n?ba\na?c\naba",
"5\n@\n?>\n?ba\nb?c\naba",
"5\nA\n?>\n?ab\nc?b\n`ba",
"5\n@\n?=\nba>\nc?b\n`ba",
"5\n@\n=?\nba?\nc?c\n`bb",
"5\n@\n=?\nba?\nc?c\nb`b",
"5\nA\n?<\n?`b\n?cc\nb`b",
"5\nB\n?<\n>`b\n?cd\nb_b",
"5\nA\n<?\n`b=\n?cd\nb... |
wicq9 | Tic-Tac-Toe-Tomek is a game played on a 4 x 4 square board. The board starts empty, except that a single 'T' symbol may appear in one of the 16 squares. There are two players: X and O. They take turns to make moves, with X starting. In each move a player puts her symbol in one of the empty squares. Player X's symbol is... | {
"input": [],
"output": []
} | {
"input": [
"6\nX X X T\n. . . .\nO O . .\n. . . .\n\nX O X T\nX X O O\nO X O X\nX X O O\n\nX O X .\nO X . .\n. . . .\n. . . .\n\nO O X X\nO X X X\nO X . T\nO . . O\n\nX X X O\n. . O .\n. O . .\nT . . .\n\nO X X X\nX O . .\n. . O .\n. . . O"
],
"output": [
"Case #1: X won\nCase #2: Draw\nCase #3: Game no... | {
"input": [
"6\nX X X T\n. . . .\nO O . .\n. . . .\n\nX O X T\nX X O O\nO X O Y\nX X O O\n\nX O X .\nO X . .\n. . . .\n. . . .\n\nO O X X\nO X X X\nO X . T\nO . . O\n\nX X X O\n. . O .\n. O . .\nT . . .\n\nO X X X\nX O . .\n. . O .\n. . . O",
"6\nX X X T\n. . . .\nO O . .\n. . . /\n\nX O X T\nX Y O O\nO X P ... |
1213_B. Bad Prices | Polycarp analyzes the prices of the new berPhone. At his disposal are the prices for n last days: a_1, a_2, ..., a_n, where a_i is the price of berPhone on the day i.
Polycarp considers the price on the day i to be bad if later (that is, a day with a greater number) berPhone was sold at a lower price. For example, if ... | {
"input": [],
"output": []
} | {
"input": [
"5\n6\n3 9 4 6 7 5\n1\n1000000\n2\n2 1\n10\n31 41 59 26 53 58 97 93 23 84\n7\n3 2 1 2 3 4 5\n"
],
"output": [
"3\n0\n1\n8\n2\n"
]
} | {
"input": [
"5\n6\n3 9 4 6 7 5\n1\n1000000\n2\n2 0\n10\n31 41 59 26 53 58 97 93 23 84\n7\n3 2 1 2 3 4 5\n",
"5\n6\n3 9 2 6 7 5\n1\n1000000\n2\n2 1\n10\n31 41 59 26 53 58 97 93 23 84\n7\n3 2 1 2 3 4 5\n",
"5\n6\n3 5 4 6 7 5\n1\n1000000\n2\n2 0\n10\n31 41 59 26 15 58 97 93 23 84\n7\n3 2 1 2 3 4 5\n",
"... |
1297_G. M-numbers | For a given positive integer m, a positive number is called a m-number if the product of its digits is m. For example, the beginning of a series of 24-numbers are as follows: 38, 46, 64, 83, 138, 146, 164, 183, 226 ...
You are given a positive integer m and k. Print k-th among m-numbers if all m-numbers are sorted in ... | {
"input": [],
"output": []
} | {
"input": [
"24 9\n",
"24 1\n",
"5040 1000000000\n",
"2020 2020\n"
],
"output": [
"\n226\n",
"\n38\n",
"\n111121111315213227111\n",
"\n-1\n"
]
} | {
"input": [],
"output": []
} |
1340_A. Nastya and Strange Generator | Denis was very sad after Nastya rejected him. So he decided to walk through the gateways to have some fun. And luck smiled at him! When he entered the first courtyard, he met a strange man who was selling something.
Denis bought a mysterious item and it was... Random permutation generator! Denis could not believed hi... | {
"input": [],
"output": []
} | {
"input": [
"5\n5\n2 3 4 5 1\n1\n1\n3\n1 3 2\n4\n4 2 3 1\n5\n1 5 2 4 3\n"
],
"output": [
"Yes\nYes\nNo\nYes\nNo\n"
]
} | {
"input": [
"5\n5\n3 2 4 5 1\n1\n1\n3\n1 3 2\n4\n4 2 3 1\n5\n1 5 2 4 3\n",
"5\n5\n2 3 5 4 1\n1\n1\n3\n1 3 2\n4\n4 2 3 1\n5\n1 5 2 4 3\n",
"5\n5\n3 1 4 5 2\n1\n1\n3\n1 3 2\n4\n4 2 3 1\n5\n1 5 2 4 3\n"
],
"output": [
"NO\nYES\nNO\nYES\nNO\n",
"NO\nYES\nNO\nYES\nNO\n",
"NO\nYES\nNO\nYES\nNO\... |
1402_C. Star Trek | The United Federation of Planets is an alliance of N planets, they are indexed from 1 to N. Some planets are connected by space tunnels. In a space tunnel, a starship can fly both ways really fast. There are exactly N-1 space tunnels, and we can travel from any planet to any other planet in the Federation using these t... | {
"input": [],
"output": []
} | {
"input": [
"3 1\n1 2\n2 3\n"
],
"output": [
"\n4\n"
]
} | {
"input": [],
"output": []
} |
1498_A. GCD Sum | The \text{gcdSum} of a positive integer is the gcd of that integer with its sum of digits. Formally, \text{gcdSum}(x) = gcd(x, sum of digits of x) for a positive integer x. gcd(a, b) denotes the greatest common divisor of a and b — the largest integer d such that both integers a and b are divisible by d.
For example... | {
"input": [],
"output": []
} | {
"input": [
"3\n11\n31\n75\n"
],
"output": [
"\n12\n33\n75\n"
]
} | {
"input": [
"3\n11\n38\n75\n",
"3\n16\n38\n75\n",
"3\n16\n76\n75\n",
"3\n22\n76\n75\n",
"3\n11\n76\n75\n",
"3\n11\n76\n107\n",
"3\n11\n76\n92\n",
"3\n11\n134\n92\n",
"3\n11\n61\n92\n",
"3\n11\n96\n92\n",
"3\n11\n83\n92\n",
"3\n17\n83\n92\n",
"3\n17\n100\n92\n",
... |
920_G. List Of Integers | Let's denote as L(x, p) an infinite sequence of integers y such that gcd(p, y) = 1 and y > x (where gcd is the greatest common divisor of two integer numbers), sorted in ascending order. The elements of L(x, p) are 1-indexed; for example, 9, 13 and 15 are the first, the second and the third elements of L(7, 22), respec... | {
"input": [],
"output": []
} | {
"input": [
"5\n42 42 42\n43 43 43\n44 44 44\n45 45 45\n46 46 46\n",
"3\n7 22 1\n7 22 2\n7 22 3\n"
],
"output": [
"187\n87\n139\n128\n141\n",
"9\n13\n15\n"
]
} | {
"input": [
"5\n42 42 42\n43 43 43\n44 44 44\n45 45 45\n46 46 68\n",
"3\n7 22 1\n7 1 2\n7 22 3\n",
"5\n42 42 42\n43 43 43\n44 44 44\n45 45 45\n84 46 68\n",
"3\n7 22 1\n7 1 2\n1 22 3\n",
"3\n7 22 1\n7 1 2\n1 28 3\n",
"5\n42 42 42\n43 71 43\n44 44 44\n45 45 45\n0 46 68\n",
"3\n4 22 1\n7 1 2... |
battle-of-words | Alice and Bob are fighting over who is a superior debater. However they wish to decide this in a dignified manner.
So they decide to fight in the Battle of Words.
In each game both get to speak a sentence. Because this is a dignified battle, they do not fight physically, the alphabets in their words do so for them. ... | {
"input": [],
"output": []
} | {
"input": [
"3\ni will win\nwill i\ntoday or tomorrow\ntoday or tomorrow and yesterday\ni dare you\nbad day\n\nSAMPLE"
],
"output": [
"You win some.\nYou lose some.\nYou draw some.\n"
]
} | {
"input": [
"3\ni will win\nwill i\ntoday or tomorrow\nyadot or tomorrow and yesterday\ni dare you\nbad day\n\nSAMPLE",
"3\nh will win\nwill i\ntoday ro tomorrow\nyadot or tnmorrow adn yesterday\ni dare yot\ncad day\n\nT@LPLE",
"3\nh will niw\nwill g\nuodby ro tomorwor\nyadot ro tnmorsov nda yetterday\nh... |
higher-multiples-of-triangular-numbers | Archith loves to play with number series. Archith asked his girlfriend to a date. But she was busy in solving the homework on triangular series which stated that find the least number which has higher divisors than n in a triangular series. His girlfriend made a condition that if he solves this assignment for her she w... | {
"input": [],
"output": []
} | {
"input": [
"4\n1\n2\n3\n4\n\nSAMPLE"
],
"output": [
"3\n6\n6\n28\n"
]
} | {
"input": [
"4\n1\n2\n3\n7\n\nSAMPLE",
"4\n2\n2\n3\n4\n\nSAMPLE",
"4\n1\n1\n3\n7\n\nSAMPLE",
"4\n2\n2\n2\n6\n\nSAMPLE",
"4\n3\n1\n2\n6\n\nEL@NPR",
"4\n4\n1\n2\n6\n\nEL@NPR",
"4\n6\n1\n2\n6\n\nEL@NPR",
"4\n6\n1\n1\n6\n\nEL@NPR",
"4\n4\n1\n1\n6\n\nEL@NPR",
"4\n1\n2\n4\n4\n\nSAMP... |
sherlock-and-numbers | Watson gives to Sherlock a bag of numbers [1, 2, 3 ... N] and then he removes K numbers A1, A2 ... AK from the bag. He now asks Sherlock to find the P'th smallest number in the bag.
Input
First line contains T, the number of test cases. Each test case consists of N, K and P followed by K integers in next line denoting... | {
"input": [],
"output": []
} | {
"input": [
"2\n4 1 2\n1\n5 2 4\n1 3\n\nSAMPLE"
],
"output": [
"3\n-1\n"
]
} | {
"input": [
"2\n4 1 2\n1\n5 2 4\n1 3\n\nMASPLE",
"2\n4 1 1\n1\n5 2 4\n1 4\n\nMASQEL",
"2\n4 1 2\n1\n5 2 0\n1 4\n\nQELSAM",
"2\n4 1 2\n1\n8 2 4\n1 3\n\nMASPLE",
"2\n4 1 0\n1\n5 2 4\n1 3\n\nMASQLE",
"2\n4 1 0\n1\n8 2 4\n1 3\n\nMASQLE",
"2\n4 1 -1\n1\n9 2 4\n1 3\n\nELPSAM",
"2\n4 1 0\n1\... |
the-door-closing-game-5 | Alice and Bob are taking a walk in the Land Of Doors which is a magical place having a series of N adjacent doors that are either open or close.
After a while they get bored and decide to do something interesting. So they started closing the open doors taking turns.
In each turn, the person walks upto any closed door... | {
"input": [],
"output": []
} | {
"input": [
"4\n_|_\n|||\n|__\n|__||_|\n\nSAMPLE"
],
"output": [
"Bob\nBob\nAlice\nAlice\n"
]
} | {
"input": [
"4\n_|_\n|||\n__|\n|__||_|\n\nSAMPLE",
"4\n_|_\n|||\n_|_\n|__||_|\n\nSAMPLE",
"4\n__|\n|||\n__|\n|__||_|\n\nT@MPLE",
"4\n__|\n|||\n_|_\n|__||_|\n\nELOM@V",
"4\n_|_\n|||\n|__\n|__||_|\n\nSAMPEL",
"4\n_|_\n|||\n__|\n|__||_|\n\nS@MPLE",
"4\n_|_\n|||\n|__\n|__||_|\n\nSAMPDL",
... |
p02654 AtCoder Grand Contest 045 - Lamps and Buttons | We have N lamps numbered 1 to N, and N buttons numbered 1 to N. Initially, Lamp 1, 2, \cdots, A are on, and the other lamps are off.
Snuke and Ringo will play the following game.
* First, Ringo generates a permutation (p_1,p_2,\cdots,p_N) of (1,2,\cdots,N). The permutation is chosen from all N! possible permutations ... | {
"input": [],
"output": []
} | {
"input": [
"3 1",
"3 2",
"8 4",
"9999999 4999"
],
"output": [
"2",
"3",
"16776",
"90395416"
]
} | {
"input": [
"14 4",
"5 1",
"3 0",
"9479599 4999",
"23 4",
"8 1",
"23 6",
"4 1",
"34 6",
"7 6",
"8 2",
"14 8",
"5 2",
"45 4",
"2 1",
"25 6",
"59 6",
"9 6",
"14 2",
"24 8",
"6 1",
"32 6",
"86 6",
"8 6",
"6 2",
"32 8... |
p02783 AtCoder Beginner Contest 153 - Serval vs Monster | Serval is fighting with a monster.
The health of the monster is H.
In one attack, Serval can decrease the monster's health by A. There is no other way to decrease the monster's health.
Serval wins when the monster's health becomes 0 or below.
Find the number of attacks Serval needs to make before winning.
Constrai... | {
"input": [],
"output": []
} | {
"input": [
"10 4",
"1 10000",
"10000 1"
],
"output": [
"3",
"1",
"10000"
]
} | {
"input": [
"14 4",
"2 10000",
"11000 1",
"14 3",
"11 2",
"4 3",
"14 5",
"10010 1",
"26 4",
"10001 1",
"20 2",
"15 2",
"10010 2",
"10000 2",
"31 3",
"10010 4",
"11010 2",
"11010 3",
"53 3",
"11011 4",
"42 2",
"11011 3",
"53 1... |
p02918 AtCoder Beginner Contest 140 - Face Produces Unhappiness | There are N people standing in a queue from west to east.
Given is a string S of length N representing the directions of the people. The i-th person from the west is facing west if the i-th character of S is `L`, and east if that character of S is `R`.
A person is happy if the person in front of him/her is facing the... | {
"input": [],
"output": []
} | {
"input": [
"6 1\nLRLRRL",
"9 2\nRRRLRLRLL",
"13 3\nLRRLRLRRLRLLR",
"10 1\nLLLLLRRRRR"
],
"output": [
"3",
"7",
"9",
"9"
]
} | {
"input": [
"6 2\nLRLRRL",
"9 3\nRRRLRLRLL",
"9 0\nRRRLRLRLL",
"6 0\nLRRLRL",
"9 1\nRRRRLLRLL",
"9 1\nRLRRLLLRR",
"6 1\nRRLLRL",
"10 2\nLLLLLRRRRR",
"13 4\nLRRLRLRRLRLLR",
"13 8\nLRRLRLRRLRLLR",
"6 0\nRRLLRL",
"6 0\nLRLRLR",
"9 0\nRRRRLLRLL",
"6 4\nLRLRRL",
... |
p03054 AtCoder Grand Contest 033 - LRUD Game | We have a rectangular grid of squares with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left. On this grid, there is a piece, which is initially placed at square (s_r,s_c).
Takahashi and Aoki will play a game, where each player has a st... | {
"input": [],
"output": []
} | {
"input": [
"2 3 3\n2 2\nRRL\nLUD",
"4 3 5\n2 2\nUDRRR\nLLDUD",
"5 6 11\n2 1\nRLDRRUDDLRL\nURRDRLLDLRD"
],
"output": [
"YES",
"NO",
"NO"
]
} | {
"input": [
"2 3 3\n2 2\nRLR\nLUD",
"4 3 5\n2 2\nUDRRR\nLLDTD",
"2 6 11\n2 1\nRLDRRUDDLRL\nURRDRLLDLRD",
"2 6 3\n2 2\nRLR\nLUD",
"4 1 5\n2 2\nUDRRR\nLLDTD",
"4 1 5\n0 2\nUDRRR\nLLDTD",
"4 1 5\n0 2\nUDRRR\nDTDLL",
"1 1 5\n0 2\nUDRRR\nDTDLL",
"1 1 5\n-1 2\nUDRRR\nDTDLL",
"1 1 4\... |
p03198 CADDi 2018 - Negative Doubling | There are N positive integers A_1, A_2, ..., A_N. Takahashi can perform the following operation on these integers any number of times:
* Choose 1 \leq i \leq N and multiply the value of A_i by -2.
Notice that he multiplies it by minus two.
He would like to make A_1 \leq A_2 \leq ... \leq A_N holds. Find the minimu... | {
"input": [],
"output": []
} | {
"input": [
"4\n3 1 4 1",
"8\n657312726 129662684 181537270 324043958 468214806 916875077 825989291 319670097",
"5\n1 2 3 4 5"
],
"output": [
"3",
"7",
"0"
]
} | {
"input": [
"4\n2 1 4 1",
"8\n347554626 129662684 181537270 324043958 468214806 916875077 825989291 319670097",
"5\n1 2 2 4 5",
"8\n67210447 129662684 181537270 324043958 468214806 916875077 825989291 319670097",
"5\n1 2 2 8 5",
"4\n3 1 4 4",
"8\n989919 129662684 181537270 289484339 25950... |
p03345 AtCoder Grand Contest 024 - Fairness | Takahashi, Nakahashi and Hikuhashi have integers A, B and C, respectively. After repeating the following operation K times, find the integer Takahashi will get minus the integer Nakahashi will get:
* Each of them simultaneously calculate the sum of the integers that the other two people have, then replace his own inte... | {
"input": [],
"output": []
} | {
"input": [
"1 2 3 1",
"2 3 2 0",
"1000000000 1000000000 1000000000 1000000000000000000"
],
"output": [
"1",
"-1",
"0"
]
} | {
"input": [
"2 2 3 1",
"0 3 2 0",
"1000000000 1000000010 1000000000 1000000000000000000",
"2 3 3 1",
"4 3 3 1",
"0 3 2 -1",
"-1 3 4 -1",
"1000000000 0000000010 1000000010 1000010100000000000",
"-2 3 8 -1",
"1000010000 0000000010 1100000010 1000010100000000000",
"9 6 3 2",
... |
p03505 Code Festival Team Relay (Parallel) - Kaiden | ButCoder Inc. runs a programming competition site called ButCoder. In this site, a user is given an integer value called rating that represents his/her skill, which changes each time he/she participates in a contest. The initial value of a new user's rating is 0, and a user whose rating reaches K or higher is called Ka... | {
"input": [],
"output": []
} | {
"input": [
"4000 500 2000",
"4000 2000 500",
"1000000000000000000 2 1"
],
"output": [
"-1",
"5",
"1999999999999999997"
]
} | {
"input": [
"5856 500 2000",
"4000 2000 312",
"1000000000000000000 2 0",
"1100000000000000000 2 0",
"5856 883 583",
"1100000000000000000 4 0",
"6439 2000 572",
"1100000000100000000 4 0",
"6439 987 572",
"1101000000100000000 4 0",
"6439 1177 572",
"1101000010100000000 4... |
p03666 AtCoder Grand Contest 017 - Moderate Differences | There are N squares in a row. The leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty.
Aohashi would like to fill the empty squares with integers so that the following condition is satisfied:
* For any two adjacent squares, the (absolute) difference of the two... | {
"input": [],
"output": []
} | {
"input": [
"48792 105960835 681218449 90629745 90632170",
"491995 412925347 825318103 59999126 59999339",
"5 1 5 2 4",
"4 7 6 4 5"
],
"output": [
"NO",
"YES",
"YES",
"NO"
]
} | {
"input": [
"1788 105960835 681218449 90629745 90632170",
"4 7 11 4 5",
"491995 412925347 465710940 59999126 59999339",
"1788 122437383 681218449 90629745 90632170",
"491995 412925347 465710940 59999126 4650906",
"4 7 11 4 6",
"1788 122437383 681218449 90629745 148553464",
"801386 412... |
p03821 AtCoder Grand Contest 009 - Multiple Array | There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1.
There is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so th... | {
"input": [],
"output": []
} | {
"input": [
"7\n3 1\n4 1\n5 9\n2 6\n5 3\n5 8\n9 7",
"3\n3 5\n2 7\n9 4"
],
"output": [
"22",
"7"
]
} | {
"input": [
"7\n3 1\n4 1\n5 12\n2 6\n5 3\n5 8\n9 7",
"3\n3 5\n2 2\n9 4",
"3\n3 4\n2 2\n9 4",
"3\n2 4\n2 1\n9 4",
"7\n4 1\n4 2\n5 12\n2 4\n6 4\n5 8\n10 3",
"7\n4 1\n4 2\n5 12\n2 4\n6 1\n5 8\n13 6",
"7\n5 2\n4 2\n5 12\n2 4\n6 1\n1 8\n17 6",
"7\n3 1\n4 1\n5 9\n2 6\n5 3\n5 8\n6 7",
"3... |
p03988 AtCoder Grand Contest 005 - Tree Restoring | Aoki loves numerical sequences and trees.
One day, Takahashi gave him an integer sequence of length N, a_1, a_2, ..., a_N, which made him want to construct a tree.
Aoki wants to construct a tree with N vertices numbered 1 through N, such that for each i = 1,2,...,N, the distance between vertex i and the farthest vert... | {
"input": [],
"output": []
} | {
"input": [
"6\n1 1 1 1 1 5",
"3\n1 1 2",
"5\n3 2 2 3 3",
"5\n4 3 2 3 4",
"10\n1 2 2 2 2 2 2 2 2 2",
"10\n1 1 2 2 2 2 2 2 2 2"
],
"output": [
"Impossible",
"Impossible",
"Possible",
"Possible",
"Possible",
"Impossible"
]
} | {
"input": [
"6\n1 1 1 1 2 5",
"3\n2 2 1",
"3\n1 1 3",
"5\n3 2 4 3 3",
"5\n3 3 2 3 4",
"10\n1 2 2 2 2 3 2 2 2 2",
"10\n1 1 2 2 2 3 2 2 2 2",
"6\n0 1 1 1 2 5",
"3\n1 0 3",
"5\n3 3 4 3 3",
"5\n3 3 4 3 4",
"10\n1 2 2 2 2 1 2 2 2 2",
"10\n1 1 2 3 2 3 2 2 2 2",
"6\n0... |
p00076 Treasure Hunt II | As I was cleaning up the warehouse, I found an old document that describes how to get to the treasures of my ancestors. The following was written in this ancient document.
1. First, stand 1m east of the well on the outskirts of the town and turn straight toward the well.
2. Turn clockwise 90 degrees, go straight for ... | {
"input": [],
"output": []
} | {
"input": [
"3\n6\n-1"
],
"output": [
"0.29\n1.71\n-2.31\n0.80"
]
} | {
"input": [
"3\n2\n-1",
"3\n3\n-1",
"3\n1\n-1",
"3\n5\n-1",
"3\n4\n-1",
"3\n-1\n-1",
"3\n8\n-1",
"3\n11\n-1",
"3\n21\n-1",
"3\n39\n-1",
"3\n47\n-1",
"3\n41\n-1",
"3\n74\n-1",
"3\n140\n-1",
"3\n19\n-1",
"3\n13\n-1",
"3\n9\n-1",
"3\n20\n-1",
"... |
p00208 Room Numbers of a Hospital | An architect, Devunky, who lives in Water Deven, has been asked to renovate an old large hospital.
In some countries, people don't want to use numbers that are disliked as numerophobia (4 and 9 are famous in Japan). However, the room numbers in this hospital were numbered from 1 regardless of the number of numerophobi... | {
"input": [],
"output": []
} | {
"input": [
"15\n100\n1000000000\n3\n0"
],
"output": [
"19\n155\n9358757000\n3"
]
} | {
"input": [
"15\n100\n1000000000\n1\n0",
"15\n110\n1000000000\n1\n0",
"15\n101\n1000000000\n3\n0",
"15\n110\n1000000000\n0\n0",
"15\n101\n1001000000\n3\n0",
"15\n100\n1000000000\n0\n0",
"15\n111\n1001000000\n3\n0",
"15\n000\n1000000000\n0\n0",
"15\n111\n1001000000\n2\n0",
"15\... |
p00368 Checkered Pattern | You have a cross-section paper with W x H squares, and each of them is painted either in white or black. You want to re-arrange the squares into a neat checkered pattern, in which black and white squares are arranged alternately both in horizontal and vertical directions (the figure shown below is a checkered patter wi... | {
"input": [],
"output": []
} | {
"input": [
"3 2\n1 1 0\n0 0 1",
"2 2\n0 0\n1 1"
],
"output": [
"yes",
"no"
]
} | {
"input": [
"3 3\n1 1 0\n0 0 1",
"3 4\n1 1 0\n0 0 1",
"3 5\n1 1 0\n0 0 1",
"3 5\n1 1 0\n1 0 1",
"3 5\n1 1 0\n1 -1 1",
"3 3\n1 1 -1\n0 0 1",
"3 4\n1 1 0\n0 1 1",
"3 5\n1 0 0\n1 0 1",
"3 5\n1 1 -1\n1 0 1",
"3 4\n1 1 0\n0 1 0",
"3 5\n1 -1 0\n1 0 1",
"3 7\n1 1 -1\n1 0 1",
... |
p00575 Social Game | Problem statement
JOI decided to start a new social game from tomorrow.
In this social game, you can log in up to once a day, and you will get A coins each time you log in.
Also, if you log in for 7 consecutive days from Monday to Sunday, you will get an additional B coins each time.
No other coins will be given.
... | {
"input": [],
"output": []
} | {
"input": [
"3 0 10"
],
"output": [
"4"
]
} | {
"input": [
"3 0 19",
"2 0 19",
"4 0 19",
"5 -1 19",
"5 -1 30",
"5 -1 58",
"4 -1 58",
"8 0 22",
"6 0 43",
"2 0 31",
"3 -1 30",
"4 1 58",
"4 0 2",
"0 1 22",
"5 0 43",
"1 -2 19",
"0 1 58",
"0 1 12",
"5 0 10",
"1 0 19",
"0 1 105",
"... |
p00722 Dirichlet's Theorem on Arithmetic Progressions | Good evening, contestants.
If a and d are relatively prime positive integers, the arithmetic sequence beginning with a and increasing by d, i.e., a, a + d, a + 2d, a + 3d, a + 4d, ..., contains infinitely many prime numbers. This fact is known as Dirichlet's Theorem on Arithmetic Progressions, which had been conjectur... | {
"input": [],
"output": []
} | {
"input": [
"367 186 151\n179 10 203\n271 37 39\n103 230 1\n27 104 185\n253 50 85\n1 1 1\n9075 337 210\n307 24 79\n331 221 177\n259 170 40\n269 58 102\n0 0 0"
],
"output": [
"92809\n6709\n12037\n103\n93523\n14503\n2\n899429\n5107\n412717\n22699\n25673"
]
} | {
"input": [
"367 186 151\n179 10 203\n271 37 39\n103 230 1\n27 104 185\n253 87 85\n1 1 1\n9075 337 210\n307 24 79\n331 221 177\n259 170 40\n269 58 102\n0 0 0",
"367 186 151\n179 10 203\n271 37 39\n103 230 1\n27 104 185\n253 87 85\n1 1 1\n9075 337 210\n307 24 79\n331 221 345\n259 170 40\n269 58 102\n0 0 0",
... |
p00862 Most Distant Point from the Sea | The main land of Japan called Honshu is an island surrounded by the sea. In such an island, it is natural to ask a question: "Where is the most distant point from the sea?" The answer to this question for Honshu was found in 1996. The most distant point is located in former Usuda Town, Nagano Prefecture, whose distance... | {
"input": [],
"output": []
} | {
"input": [
"4\n0 0\n10000 0\n10000 10000\n0 10000\n3\n0 0\n10000 0\n7000 1000\n6\n0 40\n100 20\n250 40\n250 70\n100 90\n0 70\n3\n0 0\n10000 10000\n5000 5001\n0"
],
"output": [
"5000.000000\n494.233641\n34.542948\n0.353553"
]
} | {
"input": [
"4\n0 0\n10000 0\n10000 10000\n0 10000\n3\n0 0\n10010 0\n7000 1000\n6\n0 40\n100 20\n250 40\n250 70\n100 90\n0 70\n3\n0 0\n10000 10000\n5000 5001\n0",
"4\n0 0\n10000 0\n10000 10000\n0 10000\n3\n0 0\n10010 0\n7000 1000\n6\n0 40\n100 20\n250 40\n250 70\n100 90\n0 70\n3\n0 0\n10000 10001\n5000 5001\... |
p00993 Numbers | Given n, find n consecutive positive integers. However, all numbers must have divisors other than 1 and the number itself.
Hint
In Sample Output 2, 8, 9 and 10 are selected as three consecutive integers.
The second and third lines output 3, as a divisor of 9, and the fourth line outputs 5, as a divisor of 10.
Inpu... | {
"input": [],
"output": []
} | {
"input": [
"3",
"2"
],
"output": [
"8\n2\n3\n5",
"8\n2\n3"
]
} | {
"input": [
"6",
"4",
"1",
"8",
"0",
"11",
"18",
"16",
"5",
"13",
"7",
"10",
"14",
"19",
"31",
"17",
"22",
"12",
"23",
"37",
"49",
"15",
"39",
"9",
"29",
"74",
"87",
"35",
"44",
"43",
"56",
... |
p01125 Misterious Gems | From 1603 to 1867, people call that era the EDO era. EDO stands for Enhanced Driving Operation, the most advanced space navigation technology at the time, and was developed by Dr. Izy in 1603.
You are a space adventurer, flying around the universe and adventuring on various planets. During that adventure, you discover... | {
"input": [],
"output": []
} | {
"input": [
"2\n10 11\n11 12\n2\nN 2\nE 1\n2\n10 11\n11 12\n2\nN 2\nW 1\n3\n0 15\n5 10\n5 15\n5\nW 10\nS 10\nN 20\nE 10\nS 10\n0"
],
"output": [
"Yes\nNo\nNo"
]
} | {
"input": [
"2\n10 11\n11 12\n2\nN 2\nE 1\n2\n10 11\n11 12\n2\nN 2\nW 1\n3\n0 15\n5 10\n5 15\n5\nW 20\nS 10\nN 20\nE 10\nS 10\n0",
"2\n10 11\n15 12\n2\nN 2\nE 1\n2\n10 15\n11 12\n2\nN 2\nW 1\n3\n0 15\n5 10\n5 15\n5\nW 20\nS 10\nN 20\nE 10\nS 10\n0",
"2\n10 17\n11 12\n2\nN -1\nE 1\n2\n10 11\n10 12\n2\nN 3... |
p01264 Magical Island | This is a story in the epoch of magic. A clan of magicians lived in an artificial island built by magic power.
One day, a crisis erupted on the island. An Empire ACM (Atlas Country of Magic) required unconditional surrender to them, otherwise an imperial force attacked by magical missiles to the island. However, they ... | {
"input": [],
"output": []
} | {
"input": [
"1 1 1\n10 15 5\n15 10 100\n0 0 0"
],
"output": [
"8.000\n409.479\n861.420"
]
} | {
"input": [
"1 1 1\n10 13 5\n15 10 100\n0 0 0",
"1 1 1\n10 15 5\n15 10 100\n0 1 0",
"1 1 1\n9 15 5\n15 10 100\n0 1 0",
"1 2 1\n9 15 5\n15 10 100\n0 2 0",
"1 1 1\n10 15 5\n22 10 100\n0 0 0",
"1 1 1\n10 15 5\n15 10 110\n0 1 0",
"1 1 1\n9 8 5\n15 10 100\n0 1 0",
"1 2 1\n9 15 5\n15 10 101... |
p01424 Palindrome Generator | A palidrome craftsperson starts to work in the early morning, with the clear air allowing him to polish up his palindromes.
On this morning, he is making his pieces to submit to the International Contest for Palindrome Craftspeople.
By the way, in order to make palindromes, he uses a special dictionary which contains... | {
"input": [],
"output": []
} | {
"input": [
"2 2\nab\nba\n1 1\n2 2",
"2 2\nab\nba\n1 1\n1 2",
"2 2\nab\na\n1 1\n1 2"
],
"output": [
"0",
"4",
"-1"
]
} | {
"input": [
"2 2\nac\nba\n1 1\n2 2",
"2 2\nba\na\n1 1\n1 2",
"2 2\nba\nb\n1 1\n1 2",
"2 2\n`b\nb`\n1 2\n1 2",
"4 2\n`c\nbb\n-2 -4\n2 4",
"2 2\nab\na\n1 2\n1 2",
"2 2\nba\nba\n1 1\n2 2",
"2 2\nac\nba\n1 2\n2 2",
"2 2\n`b\nba\n1 1\n1 2",
"2 2\nac\nba\n2 1\n2 2",
"2 2\nba\nba... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.