CodeEff/ECCO huggingface dataset:
Problem Description: Score : 100 points
Problem Statement
There are a total of
A + B
cats and dogs.
Among them,
A
are known to be cats, but the remaining
B
are not known to be either cats or dogs.
Determine if it is possible that there are exactly
X
cats among these
A + B
animals.
Constraints
1 \leq A \leq 100
1 \leq B \leq 100
1 \leq X \leq 200
All values in input are integers.
Input
Input is given from Standard Input in the following format:
A
B
X
Output
If it is possible that there are exactly
X
cats, print
YES
; if it is impossible, print
NO
.
Sample Input 1
3 5 4
Sample Output 1
YES
If there are one cat and four dogs among the
B = 5
animals, there are
X = 4
cats in total.
Sample Input 2
2 2 6
Sample Output 2
NO
Even if all of the
B = 2
animals are cats, there are less than
X = 6
cats in total.
Sample Input 3
5 3 2
Sample Output 3
NO
Even if all of the
B = 3
animals are dogs, there are more than
X = 2
cats in total.
Problem Description: Score : 200 points
Problem Statement
Print all the integers that satisfies the following in ascending order:
Among the integers between
A
and
B
(inclusive), it is either within the
K
smallest integers or within the
K
largest integers.
Constraints
1 \leq A \leq B \leq 10^9
1 \leq K \leq 100
All values in input are integers.
Input
Input is given from Standard Input in the following format:
A
B
K
Output
Print all the integers that satisfies the condition above in ascending order.
Sample Input 1
3 8 2
Sample Output 1
3
4
7
8
3
is the first smallest integer among the integers between
3
and
8
.
4
is the second smallest integer among the integers between
3
and
8
.
7
is the second largest integer among the integers between
3
and
8
.
8
is the first largest integer among the integers between
3
and
8
.
Sample Input 2
4 8 3
Sample Output 2
4
5
6
7
8
Sample Input 3
2 9 100
Sample Output 3
2
3
4
5
6
7
8
9
Problem Description: Score : 700 points
Problem Statement
You are given
N
integers
A_1
,
A_2
, ...,
A_N
.
Consider the sums of all non-empty subsequences of
A
. There are
2^N - 1
such sums, an odd number.
Let the list of these sums in non-decreasing order be
S_1
,
S_2
, ...,
S_{2^N - 1}
.
Find the median of this list,
S_{2^{N-1}}
.
Constraints
1 \leq N \leq 2000
1 \leq A_i \leq 2000
All input values are integers.
Input
Input is given from Standard Input in the following format:
N
A_1
A_2
...
A_N
Output
Print the median of the sorted list of the sums of all non-empty subsequences of
A
.
Sample Input 1
3
1 2 1
Sample Output 1
2
In this case,
S = (1, 1, 2, 2, 3, 3, 4)
. Its median is
S_4 = 2
.
Sample Input 2
1
58
Sample Output 2
58
In this case,
S = (58)
.
Problem Description: Score : 100 points
Problem Statement
A balance scale tips to the left if
L>R
, where
L
is the total weight of the masses on the left pan and
R
is the total weight of the masses on the right pan. Similarly, it balances if
L=R
, and tips to the right if
L<R
.
Takahashi placed a mass of weight
A
and a mass of weight
B
on the left pan of a balance scale, and placed a mass of weight
C
and a mass of weight
D
on the right pan.
Print
Left
if the balance scale tips to the left; print
Balanced
if it balances; print
Right
if it tips to the right.
Constraints
1\leq A,B,C,D \leq 10
All input values are integers.
Input
Input is given from Standard Input in the following format:
A
B
C
D
Output
Print
Left
if the balance scale tips to the left; print
Balanced
if it balances; print
Right
if it tips to the right.
Sample Input 1
3 8 7 1
Sample Output 1
Left
The total weight of the masses on the left pan is
11
, and the total weight of the masses on the right pan is
8
. Since
11>8
, we should print
Left
.
Sample Input 2
3 4 5 2
Sample Output 2
Balanced
The total weight of the masses on the left pan is
7
, and the total weight of the masses on the right pan is
7
. Since
7=7
, we should print
Balanced
.
Sample Input 3
1 7 6 4
Sample Output 3
Right
The total weight of the masses on the left pan is
8
, and the total weight of the masses on the right pan is
10
. Since
8<10
, we should print
Right
.
Problem Description: Score : 300 points
Problem Statement
You are playing the following game with Joisino.
Initially, you have a blank sheet of paper.
Joisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated
N
times.
Then, you are asked a question: How many numbers are written on the sheet now?
The numbers announced by Joisino are given as
A_1, ... ,A_N
in the order she announces them. How many numbers will be written on the sheet at the end of the game?
Constraints
1≤N≤100000
1≤A_i≤1000000000(=10^9)
All input values are integers.
Input
Input is given from Standard Input in the following format:
N
A_1
:
A_N
Output
Print how many numbers will be written on the sheet at the end of the game.
Sample Input 1
3
6
2
6
Sample Output 1
1
The game proceeds as follows:
6
is not written on the sheet, so write
6
.
2
is not written on the sheet, so write
2
.
6
is written on the sheet, so erase
6
.
Thus, the sheet contains only
2
in the end. The answer is
1
.
Sample Input 2
4
2
5
5
2
Sample Output 2
0
It is possible that no number is written on the sheet in the end.
Sample Input 3
6
12
22
16
22
18
12
Sample Output 3
2
Problem Description: Score : 100 points
Problem Statement
Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most
X
days earlier.
He gets a stomachache if the "best-by" date of the food is
X+1
or more days earlier, though.
Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.
Takahashi bought some food
A
days before the "best-by" date, and ate it
B
days after he bought it.
Write a program that outputs
delicious
if he found it delicious,
safe
if he did not found it delicious but did not get a stomachache either, and
dangerous
if he got a stomachache.
Constraints
1 ≤ X,A,B ≤ 10^9
Input
Input is given from Standard Input in the following format:
X
A
B
Output
Print
delicious
if Takahashi found the food delicious; print
safe
if he neither found it delicious nor got a stomachache; print
dangerous
if he got a stomachache.
Sample Input 1
4 3 6
Sample Output 1
safe
He ate the food three days after the "best-by" date. It was not delicious or harmful for him.
Sample Input 2
6 5 1
Sample Output 2
delicious
He ate the food by the "best-by" date. It was delicious for him.
Sample Input 3
3 7 12
Sample Output 3
dangerous
He ate the food five days after the "best-by" date. It was harmful for him.
Problem Description: Score : 400 points
Problem Statement
You are going out for a walk, when you suddenly encounter
N
monsters. Each monster has a parameter called
health
, and the health of the
i
-th monster is
h_i
at the moment of encounter. A monster will vanish immediately when its health drops to
0
or below.
Fortunately, you are a skilled magician, capable of causing explosions that damage monsters. In one explosion, you can damage monsters as follows:
Select an alive monster, and cause an explosion centered at that monster. The health of the monster at the center of the explosion will decrease by
A
, and the health of each of the other monsters will decrease by
B
. Here,
A
and
B
are predetermined parameters, and
A > B
holds.
At least how many explosions do you need to cause in order to vanish all the monsters?
Constraints
All input values are integers.
1 ≤ N ≤ 10^5
1 ≤ B < A ≤ 10^9
1 ≤ h_i ≤ 10^9
Input
Input is given from Standard Input in the following format:
N
A
B
h_1
h_2
:
h_N
Output
Print the minimum number of explosions that needs to be caused in order to vanish all the monsters.
Sample Input 1
4 5 3
8
7
4
2
Sample Output 1
2
You can vanish all the monsters in two explosion, as follows:
First, cause an explosion centered at the monster with
8
health. The healths of the four monsters become
3
,
4
,
1
and
-1
, respectively, and the last monster vanishes.
Second, cause an explosion centered at the monster with
4
health remaining. The healths of the three remaining monsters become
0
,
-1
and
-2
, respectively, and all the monsters are now vanished.
Sample Input 2
2 10 4
20
20
Sample Output 2
4
You need to cause two explosions centered at each monster, for a total of four.
Sample Input 3
5 2 1
900000000
900000000
1000000000
1000000000
1000000000
Sample Output 3
800000000
Problem Description: Score : 100 points
Problem Statement
You are given three integers
A
,
B
and
C
.
Determine whether
C
is not less than
A
and not greater than
B
.
Constraints
-100≤A,B,C≤100
A
,
B
and
C
are all integers.
Input
Input is given from Standard Input in the following format:
A
B
C
Output
If the condition is satisfied, print
Yes
; otherwise, print
No
.
Sample Input 1
1 3 2
Sample Output 1
Yes
C=2
is not less than
A=1
and not greater than
B=3
, and thus the output should be
Yes
.
Sample Input 2
6 5 4
Sample Output 2
No
C=4
is less than
A=6
, and thus the output should be
No
.
Sample Input 3
2 2 2
Sample Output 3
Yes
Problem Description: Score : 700 points
Problem Statement
N
people are waiting in a single line in front of the Takahashi Store. The cash on hand of the
i
-th person from the front of the line is a positive integer
A_i
.
Mr. Takahashi, the shop owner, has decided on the following scheme: He picks a product, sets a positive integer
P
indicating its price, and shows this product to customers in order, starting from the front of the line. This step is repeated as described below.
At each step, when a product is shown to a customer, if price
P
is equal to or less than the cash held by that customer at the time, the customer buys the product and Mr. Takahashi ends the current step. That is, the cash held by the first customer in line with cash equal to or greater than
P
decreases by
P
, and the next step begins.
Mr. Takahashi can set the value of positive integer
P
independently at each step.
He would like to sell as many products as possible. However, if a customer were to end up with
0
cash on hand after a purchase, that person would not have the fare to go home. Customers not being able to go home would be a problem for Mr. Takahashi, so he does not want anyone to end up with
0
cash.
Help out Mr. Takahashi by writing a program that determines the maximum number of products he can sell, when the initial cash in possession of each customer is given.
Constraints
1 ≦ | N | ≦ 100000
1 ≦ A_i ≦ 10^9(1 ≦ i ≦ N)
All inputs are integers.
Input
Inputs are provided from Standard Inputs in the following form.
N
A_1
:
A_N
Output
Output an integer representing the maximum number of products Mr. Takahashi can sell.
Sample Input 1
3
3
2
5
Sample Output 1
3
As values of
P
, select in order
1, 4, 1
.
Sample Input 2
15
3
1
4
1
5
9
2
6
5
3
5
8
9
7
9
Sample Output 2
18
Problem Description: Score : 200 points
Problem Statement
Let
w
be a string consisting of lowercase letters.
We will call
w
beautiful
if the following condition is satisfied:
Each lowercase letter of the English alphabet occurs even number of times in
w
.
You are given the string
w
. Determine if
w
is beautiful.
Constraints
1 \leq |w| \leq 100
w
consists of lowercase letters (
a
-
z
).
Input
The input is given from Standard Input in the following format:
w
Output
Print
Yes
if
w
is beautiful. Print
No
otherwise.
Sample Input 1
abaccaba
Sample Output 1
Yes
a
occurs four times,
b
occurs twice,
c
occurs twice and the other letters occur zero times.
Sample Input 2
hthth
Sample Output 2
No
Problem Description: Score : 1100 points
Problem Statement
Snuke got positive integers
s_1,...,s_N
from his mother, as a birthday present. There may be duplicate elements.
He will circle some of these
N
integers. Since he dislikes cubic numbers, he wants to ensure that if both
s_i
and
s_j (i ≠ j)
are circled, the product
s_is_j
is
not
cubic. For example, when
s_1=1,s_2=1,s_3=2,s_4=4
, it is not possible to circle both
s_1
and
s_2
at the same time. It is not possible to circle both
s_3
and
s_4
at the same time, either.
Find the maximum number of integers that Snuke can circle.
Constraints
1 ≦ N ≦ 10^5
1 ≦ s_i ≦ 10^{10}
All input values are integers.
Input
The input is given from Standard Input in the following format:
N
s_1
:
s_N
Output
Print the maximum number of integers that Snuke can circle.
Sample Input 1
8
1
2
3
4
5
6
7
8
Sample Output 1
6
Snuke can circle
1,2,3,5,6,7
.
Sample Input 2
6
2
4
8
16
32
64
Sample Output 2
3
Sample Input 3
10
1
10
100
1000000007
10000000000
1000000009
999999999
999
999
999
Sample Output 3
9