CodeEff/ECCO huggingface dataset:
Problem Description: Score : 600 points
Problem Statement
There is an arithmetic progression with
L
terms:
s_0, s_1, s_2, ... , s_{L-1}
.
The initial term is
A
, and the common difference is
B
. That is,
s_i = A + B \times i
holds.
Consider the integer obtained by concatenating the terms written in base ten without leading zeros. For example, the sequence
3, 7, 11, 15, 19
would be concatenated into
37111519
. What is the remainder when that integer is divided by
M
?
Constraints
All values in input are integers.
1 \leq L, A, B < 10^{18}
2 \leq M \leq 10^9
All terms in the arithmetic progression are less than
10^{18}
.
Input
Input is given from Standard Input in the following format:
L
A
B
M
Output
Print the remainder when the integer obtained by concatenating the terms is divided by
M
.
Sample Input 1
5 3 4 10007
Sample Output 1
5563
Our arithmetic progression is
3, 7, 11, 15, 19
, so the answer is
37111519
mod
10007
, that is,
5563
.
Sample Input 2
4 8 1 1000000
Sample Output 2
891011
Sample Input 3
107 10000000000007 1000000000000007 998244353
Sample Output 3
39122908
Problem Description: Score : 400 points
Problem Statement
There are
N
squares arranged in a row, numbered
1, 2, ..., N
from left to right.
You are given a string
S
of length
N
consisting of
.
and
#
. If the
i
-th character of
S
is
#
, Square
i
contains a rock; if the
i
-th character of
S
is
.
, Square
i
is empty.
In the beginning, Snuke stands on Square
A
, and Fnuke stands on Square
B
.
You can repeat the following operation any number of times:
Choose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.
You want to repeat this operation so that Snuke will stand on Square
C
and Fnuke will stand on Square
D
.
Determine whether this is possible.
Constraints
4 \leq N \leq 200\ 000
S
is a string of length
N
consisting of
.
and
#
.
1 \leq A, B, C, D \leq N
Square
A
,
B
,
C
and
D
do not contain a rock.
A
,
B
,
C
and
D
are all different.
A < B
A < C
B < D
Input
Input is given from Standard Input in the following format:
N
A
B
C
D
S
Output
Print
Yes
if the objective is achievable, and
No
if it is not.
Sample Input 1
7 1 3 6 7
.#..#..
Sample Output 1
Yes
The objective is achievable by, for example, moving the two persons as follows. (
A
and
B
represent Snuke and Fnuke, respectively.)
A#B.#..

A#.B#..

.#AB#..

.#A.#B.

.#.A#B.

.#.A#.B

.#..#AB
Sample Input 2
7 1 3 7 6
.#..#..
Sample Output 2
No
Sample Input 3
15 1 3 15 13
...#.#...#.#...
Sample Output 3
Yes
Problem Description: Score : 600 points
Problem Statement
You are given a string
s
consisting of
A
,
B
and
C
.
Snuke wants to perform the following operation on
s
as many times as possible:
Choose a contiguous substring of
s
that reads
ABC
and replace it with
BCA
.
Find the maximum possible number of operations.
Constraints
1 \leq |s| \leq 200000
Each character of
s
is
A
,
B
and
C
.
Input
Input is given from Standard Input in the following format:
s
Output
Find the maximum possible number of operations.
Sample Input 1
ABCABC
Sample Output 1
3
You can perform the operations three times as follows:
ABCABC
→
BCAABC
→
BCABCA
→
BCBCAA
. This is the maximum result.
Sample Input 2
C
Sample Output 2
0
Sample Input 3
ABCACCBABCBCAABCB
Sample Output 3
6
Problem Description: Score : 800 points
Problem Statement
Takahashi and Aoki will take
N
exams numbered
1
to
N
.
They have decided to compete in these exams.
The winner will be determined as follows:
For each exam
i
, Takahashi decides its
importance
c_i
, which must be an integer between
l_i
and
u_i
(inclusive).
Let
A
be
\sum_{i=1}^{N} c_i \times
(Takahashi's score on Exam
i
), and
B
be
\sum_{i=1}^{N} c_i \times
(Aoki's score on Exam
i
). Takahashi wins if
A \geq B
, and Aoki wins if
A < B
.
Takahashi knows that Aoki will score
b_i
on Exam
i
, with his supernatural power.
Takahashi himself, on the other hand, will score
0
on all the exams without studying more. For each hour of study, he can increase his score on some exam by
1
. (He can only study for an integer number of hours.)
However,
he cannot score more than
X
on an exam
, since the perfect score for all the exams is
X
.
Print the minimum number of study hours required for Takahashi to win.
Constraints
1 \leq N \leq 10^5
1 \leq X \leq 10^5
0 \leq b_i \leq X
(1 \leq i \leq N)
1 \leq l_i \leq u_i \leq 10^5
(1 \leq i \leq N)
All values in input are integers.
Input
Input is given from Standard Input in the following format:
N
X
b_1
l_1
u_1
b_2
l_2
u_2
:
b_N
l_N
u_N
Output
Print the minimum number of study hours required for Takahashi to win.
Sample Input 1
2 100
85 2 3
60 1 1
Sample Output 1
115
One optimal strategy is as follows:
Choose
c_1 = 3, c_2 = 1
.
Study to score
100
on Exam
1
and
15
on Exam
2
.
Then,
A = 3 \times 100 + 1 \times 15 = 315
,
B = 3 \times 85 + 1 \times 60 = 315
and Takahashi will win.
Sample Input 2
2 100
85 2 3
60 10 10
Sample Output 2
77
Sample Input 3
1 100000
31415 2718 2818
Sample Output 3
31415
Sample Input 4
10 1000
451 4593 6263
324 310 6991
378 1431 7068
71 1757 9218
204 3676 4328
840 6221 9080
684 1545 8511
709 5467 8674
862 6504 9835
283 4965 9980
Sample Output 4
2540
Problem Description: Score : 1500 points
Problem Statement
You are given a tree with
N
vertices numbered
1, 2, ..., N
. The
i
-th edge connects Vertex
a_i
and Vertex
b_i
.
You are also given a string
S
of length
N
consisting of
0
and
1
. The
i
-th character of
S
represents the number of pieces placed on Vertex
i
.
Snuke will perform the following operation some number of times:
Choose two pieces the distance between which is at least
2
, and bring these pieces closer to each other by
1
. More formally, choose two vertices
u
and
v
, each with one or more pieces, and consider the shortest path between them. Here the path must contain at least two edges. Then, move one piece from
u
to its adjacent vertex on the path, and move one piece from
v
to its adjacent vertex on the path.
By repeating this operation, Snuke wants to have all the pieces on the same vertex. Is this possible?
If the answer is yes, also find the minimum number of operations required to achieve it.
Constraints
2 \leq N \leq 2000
|S| = N
S
consists of
0
and
1
, and contains at least one
1
.
1 \leq a_i, b_i \leq N(a_i \neq b_i)
The edges
(a_1, b_1), (a_2, b_2), ..., (a_{N - 1}, b_{N - 1})
forms a tree.
Input
Input is given from Standard Input in the following format:
N
S
a_1
b_1
a_2
b_2
:
a_{N - 1}
b_{N - 1}
Output
If it is impossible to have all the pieces on the same vertex, print
-1
. If it is possible, print the minimum number of operations required.
Sample Input 1
7
0010101
1 2
2 3
1 4
4 5
1 6
6 7
Sample Output 1
3
We can gather all the pieces in three operations as follows:
Choose the pieces on Vertex
3
and
5
.
Choose the pieces on Vertex
2
and
7
.
Choose the pieces on Vertex
4
and
6
.
Sample Input 2
7
0010110
1 2
2 3
1 4
4 5
1 6
6 7
Sample Output 2
-1
Sample Input 3
2
01
1 2
Sample Output 3
0
Problem Description: Score : 100 points
Problem Statement
Given an integer
N
not less than
3
, find the sum of the interior angles of a regular polygon with
N
sides.
Print the answer in degrees, but do not print units.
Constraints
3 \leq N \leq 100
Input
Input is given from Standard Input in the following format:
N
Output
Print an integer representing the sum of the interior angles of a regular polygon with
N
sides.
Sample Input 1
3
Sample Output 1
180
The sum of the interior angles of a regular triangle is
180
degrees.
Sample Input 2
100
Sample Output 2
17640
Problem Description: Score : 200 points
Problem Statement
Takahashi is competing in a sumo tournament.
The tournament lasts for
15
days, during which he performs in one match per day.
If he wins
8
or more matches, he can also participate in the next tournament.
The matches for the first
k
days have finished.
You are given the results of Takahashi's matches as a string
S
consisting of
o
and
x
.
If the
i
-th character in
S
is
o
, it means that Takahashi won the match on the
i
-th day; if that character is
x
, it means that Takahashi lost the match on the
i
-th day.
Print
YES
if there is a possibility that Takahashi can participate in the next tournament, and print
NO
if there is no such possibility.
Constraints
1 \leq k \leq 15
S
is a string of length
k
consisting of
o
and
x
.
Input
Input is given from Standard Input in the following format:
S
Output
Print
YES
if there is a possibility that Takahashi can participate in the next tournament, and print
NO
otherwise.
Sample Input 1
oxoxoxoxoxoxox
Sample Output 1
YES
Takahashi has
7
wins and
7
losses before the last match. If he wins that match, he will have
8
wins.
Sample Input 2
xxxxxxxx
Sample Output 2
NO
Problem Description: Score : 500 points
Problem Statement
Takahashi and Aoki will play a game. They will repeatedly play it until one of them have
N
wins in total.
When they play the game once, Takahashi wins with probability
A
%, Aoki wins with probability
B
%, and the game ends in a draw (that is, nobody wins) with probability
C
%.
Find the expected number of games that will be played, and print it as follows.
We can represent the expected value as
P/Q
with coprime integers
P
and
Q
.
Print the integer
R
between
0
and
10^9+6
(inclusive) such that
R \times Q \equiv P\pmod {10^9+7}
.
(Such an integer
R
always uniquely exists under the constraints of this problem.)
Constraints
1 \leq N \leq 100000
0 \leq A,B,C \leq 100
1 \leq A+B
A+B+C=100
All values in input are integers.
Input
Input is given from Standard Input in the following format:
N
A
B
C
Output
Print the expected number of games that will be played, in the manner specified in the statement.
Sample Input 1
1 25 25 50
Sample Output 1
2
Since
N=1
, they will repeat the game until one of them wins.
The expected number of games played is
2
.
Sample Input 2
4 50 50 0
Sample Output 2
312500008
C
may be
0
.
Sample Input 3
1 100 0 0
Sample Output 3
1
B
may also be
0
.
Sample Input 4
100000 31 41 28
Sample Output 4
104136146
Problem Description: Score : 600 points
Problem Statement
Consider the following arithmetic progression with
n
terms:
x, x + d, x + 2d, \ldots, x + (n-1)d
What is the product of all terms in this sequence?
Compute the answer modulo
1\ 000\ 003
.
You are given
Q
queries of this form.
In the
i
-th query, compute the answer in case
x = x_i, d = d_i, n = n_i
.
Constraints
1 \leq Q \leq 10^5
0 \leq x_i, d_i \leq 1\ 000\ 002
1 \leq n_i \leq 10^9
All values in input are integers.
Input
Input is given from Standard Input in the following format:
Q
x_1
d_1
n_1
:
x_Q
d_Q
n_Q
Output
Print
Q
lines.
In the
i
-th line, print the answer for the
i
-th query.
Sample Input 1
2
7 2 4
12345 67890 2019
Sample Output 1
9009
916936
For the first query, the answer is
7 \times 9 \times 11 \times 13 = 9009
.
Don't forget to compute the answer modulo
1\ 000\ 003
.
Problem Description: Score : 1000 points
Problem Statement
We will host a rock-paper-scissors tournament with
N
people. The participants are called Person
1
, Person
2
,
\ldots
, Person
N
.
For any two participants, the result of the match between them is determined in advance.
This information is represented by positive integers
A_{i,j}
(
1 \leq j < i \leq N
) as follows:
If
A_{i,j} = 0
, Person
j
defeats Person
i
.
If
A_{i,j} = 1
, Person
i
defeats Person
j
.
The tournament proceeds as follows:
We will arrange the
N
participants in a row, in the order Person
1
, Person
2
,
\ldots
, Person
N
from left to right.
We will randomly choose two consecutive persons in the row. They will play a match against each other, and we will remove the loser from the row.
We will repeat this process
N-1
times, and the last person remaining will be declared the champion.
Find the number of persons with the possibility of becoming the champion.
Constraints
1 \leq N \leq 2000
A_{i,j}
is
0
or
1
.
Input
Input is given from Standard Input in the following format:
N
A_{2,1}
A_{3,1}
A_{3,2}
:
A_{N,1}
\ldots
A_{N,N-1}
Output
Print the number of persons with the possibility of becoming the champion.
Sample Input 1
3
0
10
Sample Output 1
2
Person
1
defeats Person
2
, Person
2
defeats Person
3
and Person
3
defeats Person
1
.
If Person
1
and Person
2
play the first match, Person
3
will become the champion.
If Person
2
and Person
3
play the first match, Person
1
will become the champion.
Sample Input 2
6
0
11
111
1111
11001
Sample Output 2
3
Problem Description: Score : 100 points
Problem Statement
We have
A
apples and
P
pieces of apple.
We can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.
Find the maximum number of apple pies we can make with what we have now.
Constraints
All values in input are integers.
0 \leq A, P \leq 100
Input
Input is given from Standard Input in the following format:
A
P
Output
Print the maximum number of apple pies we can make with what we have.
Sample Input 1
1 3
Sample Output 1
3
We can first make one apple pie by simmering two of the three pieces of apple. Then, we can make two more by simmering the remaining piece and three more pieces obtained by cutting the whole apple.
Sample Input 2
0 1
Sample Output 2
0
We cannot make an apple pie in this case, unfortunately.
Sample Input 3
32 21
Sample Output 3
58
Problem Description: Score : 200 points
Problem Statement
You have decided to write a book introducing good restaurants.
There are
N
restaurants that you want to introduce: Restaurant
1
, Restaurant
2
,
...
, Restaurant
N
. Restaurant
i
is in city
S_i
, and your assessment score of that restaurant on a
100
-point scale is
P_i
.
No two restaurants have the same score.
You want to introduce the restaurants in the following order:
The restaurants are arranged in lexicographical order of the names of their cities.
If there are multiple restaurants in the same city, they are arranged in descending order of score.
Print the identification numbers of the restaurants in the order they are introduced in the book.
Constraints
1 ≤ N ≤ 100
S
is a string of length between
1
and
10
(inclusive) consisting of lowercase English letters.
0 ≤ P_i ≤ 100
P_i
is an integer.
P_i ≠ P_j
(1 ≤ i < j ≤ N)
Input
Input is given from Standard Input in the following format:
N
S_1
P_1
:
S_N
P_N
Output
Print
N
lines. The
i
-th line (
1 ≤ i ≤ N
) should contain the identification number of the restaurant that is introduced
i
-th in the book.
Sample Input 1
6
khabarovsk 20
moscow 10
kazan 50
kazan 35
moscow 60
khabarovsk 40
Sample Output 1
3
4
6
1
5
2
The lexicographical order of the names of the three cities is
kazan
<
khabarovsk
<
moscow
. For each of these cities, the restaurants in it are introduced in descending order of score. Thus, the restaurants are introduced in the order
3,4,6,1,5,2
.
Sample Input 2
10
yakutsk 10
yakutsk 20
yakutsk 30
yakutsk 40
yakutsk 50
yakutsk 60
yakutsk 70
yakutsk 80
yakutsk 90
yakutsk 100
Sample Output 2
10
9
8
7
6
5
4
3
2
1
Problem Description: Score : 300 points
Problem Statement
We have
N
switches with "on" and "off" state, and
M
bulbs. The switches are numbered
1
to
N
, and the bulbs are numbered
1
to
M
.
Bulb
i
is connected to
k_i
switches: Switch
s_{i1}
,
s_{i2}
,
...
, and
s_{ik_i}
. It is lighted when the number of switches that are "on" among these switches is congruent to
p_i
modulo
2
.
How many combinations of "on" and "off" states of the switches light all the bulbs?
Constraints
1 \leq N, M \leq 10
1 \leq k_i \leq N
1 \leq s_{ij} \leq N
s_{ia} \neq s_{ib} (a \neq b)
p_i
is
0
or
1
.
All values in input are integers.
Input
Input is given from Standard Input in the following format:
N
M
k_1
s_{11}
s_{12}
...
s_{1k_1}
:
k_M
s_{M1}
s_{M2}
...
s_{Mk_M}
p_1
p_2
...
p_M
Output
Print the number of combinations of "on" and "off" states of the switches that light all the bulbs.
Sample Input 1
2 2
2 1 2
1 2
0 1
Sample Output 1
1
Bulb
1
is lighted when there is an even number of switches that are "on" among the following: Switch
1
and
2
.
Bulb
2
is lighted when there is an odd number of switches that are "on" among the following: Switch
2
.
There are four possible combinations of states of (Switch
1
, Switch
2
): (on, on), (on, off), (off, on) and (off, off). Among them, only (on, on) lights all the bulbs, so we should print
1
.
Sample Input 2
2 3
2 1 2
1 1
1 2
0 0 1
Sample Output 2
0
Bulb
1
is lighted when there is an even number of switches that are "on" among the following: Switch
1
and
2
.
Bulb
2
is lighted when there is an even number of switches that are "on" among the following: Switch
1
.
Bulb
3
is lighted when there is an odd number of switches that are "on" among the following: Switch
2
.
Switch
1
has to be "off" to light Bulb
2
and Switch
2
has to be "on" to light Bulb
3
, but then Bulb
1
will not be lighted. Thus, there are no combinations of states of the switches that light all the bulbs, so we should print
0
.
Sample Input 3
5 2
3 1 2 5
2 2 3
1 0
Sample Output 3
8
Problem Description: Score : 400 points
Problem Statement
Your friend gave you a dequeue
D
as a birthday present.
D
is a horizontal cylinder that contains a row of
N
jewels.
The
values
of the jewels are
V_1, V_2, ..., V_N
from left to right. There may be jewels with negative values.
In the beginning, you have no jewel in your hands.
You can perform at most
K
operations on
D
, chosen from the following, at most
K
times (possibly zero):
Operation A: Take out the leftmost jewel contained in
D
and have it in your hand. You cannot do this operation when
D
is empty.
Operation B: Take out the rightmost jewel contained in
D
and have it in your hand. You cannot do this operation when
D
is empty.
Operation C: Choose a jewel in your hands and insert it to the left end of
D
. You cannot do this operation when you have no jewel in your hand.
Operation D: Choose a jewel in your hands and insert it to the right end of
D
. You cannot do this operation when you have no jewel in your hand.
Find the maximum possible sum of the values of jewels in your hands after the operations.
Constraints
All values in input are integers.
1 \leq N \leq 50
1 \leq K \leq 100
-10^7 \leq V_i \leq 10^7
Input
Input is given from Standard Input in the following format:
N
K
V_1
V_2
...
V_N
Output
Print the maximum possible sum of the values of jewels in your hands after the operations.
Sample Input 1
6 4
-10 8 2 1 2 6
Sample Output 1
14
After the following sequence of operations, you have two jewels of values
8
and
6
in your hands for a total of
14
, which is the maximum result.
Do operation A. You take out the jewel of value
-10
from the left end of
D
.
Do operation B. You take out the jewel of value
6
from the right end of
D
.
Do operation A. You take out the jewel of value
8
from the left end of
D
.
Do operation D. You insert the jewel of value
-10
to the right end of
D
.
Sample Input 2
6 4
-6 -100 50 -2 -5 -3
Sample Output 2
44
Sample Input 3
6 3
-6 -100 50 -2 -5 -3
Sample Output 3
0
It is optimal to do no operation.
Problem Description: Score : 500 points
Problem Statement
There is an infinitely long street that runs west to east, which we consider as a number line.
There are
N
roadworks scheduled on this street.
The
i
-th roadwork blocks the point at coordinate
X_i
from time
S_i - 0.5
to time
T_i - 0.5
.
Q
people are standing at coordinate
0
. The
i
-th person will start the coordinate
0
at time
D_i
, continue to walk with speed
1
in the positive direction and stop walking when reaching a blocked point.
Find the distance each of the
Q
people will walk.
Constraints
All values in input are integers.
1 \leq N, Q \leq 2 \times 10^5
0 \leq S_i < T_i \leq 10^9
1 \leq X_i \leq 10^9
0 \leq D_1 < D_2 < ... < D_Q \leq 10^9
If
i \neq j
and
X_i = X_j
, the intervals
[S_i, T_i)
and
[S_j, T_j)
do not overlap.
Input
Input is given from Standard Input in the following format:
N
Q
S_1
T_1
X_1
:
S_N
T_N
X_N
D_1
:
D_Q
Output
Print
Q
lines. The
i
-th line should contain the distance the
i
-th person will walk or
-1
if that person walks forever.
Sample Input 1
4 6
1 3 2
7 13 10
18 20 13
3 4 2
0
1
2
3
5
8
Sample Output 1
2
2
10
-1
13
-1
The first person starts coordinate
0
at time
0
and stops walking at coordinate
2
when reaching a point blocked by the first roadwork at time
2
.
The second person starts coordinate
0
at time
1
and reaches coordinate
2
at time
3
. The first roadwork has ended, but the fourth roadwork has begun, so this person also stops walking at coordinate
2
.
The fourth and sixth persons encounter no roadworks while walking, so they walk forever. The output for these cases is
-1
.
Problem Description: Score : 600 points
Problem Statement
There is an infinitely large pond, which we consider as a number line.
In this pond, there are
N
lotuses floating at coordinates
0
,
1
,
2
, ...,
N-2
and
N-1
.
On the lotus at coordinate
i
, an integer
s_i
is written.
You are standing on the lotus at coordinate
0
. You will play a game that proceeds as follows:
1
. Choose positive integers
A
and
B
. Your score is initially
0
.
2
. Let
x
be your current coordinate, and
y = x+A
. The lotus at coordinate
x
disappears, and you move to coordinate
y
.
If
y = N-1
, the game ends.
If
y \neq N-1
and there is a lotus floating at coordinate
y
, your score increases by
s_y
.
If
y \neq N-1
and there is no lotus floating at coordinate
y
, you drown. Your score decreases by
10^{100}
points, and the game ends.
3
. Let
x
be your current coordinate, and
y = x-B
. The lotus at coordinate
x
disappears, and you move to coordinate
y
.
If
y = N-1
, the game ends.
If
y \neq N-1
and there is a lotus floating at coordinate
y
, your score increases by
s_y
.
If
y \neq N-1
and there is no lotus floating at coordinate
y
, you drown. Your score decreases by
10^{100}
points, and the game ends.
4
. Go back to step
2
.
You want to end the game with as high a score as possible.
What is the score obtained by the optimal choice of
A
and
B
?
Constraints
3 \leq N \leq 10^5
-10^9 \leq s_i \leq 10^9
s_0=s_{N-1}=0
All values in input are integers.
Input
Input is given from Standard Input in the following format:
N
s_0
s_1
......
s_{N-1}
Output
Print the score obtained by the optimal choice of
A
and
B
.
Sample Input 1
5
0 2 5 1 0
Sample Output 1
3
If you choose
A = 3
and
B = 2
, the game proceeds as follows:
Move to coordinate
0 + 3 = 3
. Your score increases by
s_3 = 1
.
Move to coordinate
3 - 2 = 1
. Your score increases by
s_1 = 2
.
Move to coordinate
1 + 3 = 4
. The game ends with a score of
3
.
There is no way to end the game with a score of
4
or higher, so the answer is
3
. Note that you cannot land the lotus at coordinate
2
without drowning later.
Sample Input 2
6
0 10 -7 -4 -13 0
Sample Output 2
0
The optimal strategy here is to land the final lotus immediately by choosing
A = 5
(the value of
B
does not matter).
Sample Input 3
11
0 -4 0 -99 31 14 -15 -39 43 18 0
Sample Output 3
59
Problem Description: Score : 100 points
Problem Statement
Takahashi, who is
A
years old, is riding a Ferris wheel.
It costs
B
yen (
B
is an even number) to ride the Ferris wheel if you are
13
years old or older, but children between
6
and
12
years old (inclusive) can ride it for half the cost, and children who are
5
years old or younger are free of charge. (Yen is the currency of Japan.)
Find the cost of the Ferris wheel for Takahashi.
Constraints
0 ≤ A ≤ 100
2 ≤ B ≤ 1000
B
is an even number.
Input
Input is given from Standard Input in the following format:
A
B
Output
Print the cost of the Ferris wheel for Takahashi.
Sample Input 1
30 100
Sample Output 1
100
Takahashi is
30
years old now, and the cost of the Ferris wheel is
100
yen.
Sample Input 2
12 100
Sample Output 2
50
Takahashi is
12
years old, and the cost of the Ferris wheel is the half of
100
yen, that is,
50
yen.
Sample Input 3
0 100
Sample Output 3
0
Takahashi is
0
years old, and he can ride the Ferris wheel for free.