message stringlengths 2 22.7k | message_type stringclasses 2 values | message_id int64 0 1 | conversation_id int64 145 109k | cluster float64 9 9 | __index_level_0__ int64 290 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and there are a_i apples of Color i.
You and Lunlun the dachshund alternately perform the following operation (starting from you):
* Choose one or more apples from the tree and eat them. Here, the apples chosen at the same time must all have different colors.
The one who eats the last apple from the tree will be declared winner. If both you and Lunlun play optimally, which will win?
Constraints
* 1 \leq N \leq 10^5
* 1 \leq a_i \leq 10^9
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N
a_1
a_2
:
a_N
Output
If you will win, print `first`; if Lunlun will win, print `second`.
Examples
Input
2
1
2
Output
first
Input
3
100000
30000
20000
Output
second
Submitted Solution:
```
print("sfeicrosntd"[(sum([int(input())for i in range(int(input()))])-2)%2::2])
``` | instruction | 0 | 3,162 | 9 | 6,324 |
No | output | 1 | 3,162 | 9 | 6,325 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and there are a_i apples of Color i.
You and Lunlun the dachshund alternately perform the following operation (starting from you):
* Choose one or more apples from the tree and eat them. Here, the apples chosen at the same time must all have different colors.
The one who eats the last apple from the tree will be declared winner. If both you and Lunlun play optimally, which will win?
Constraints
* 1 \leq N \leq 10^5
* 1 \leq a_i \leq 10^9
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N
a_1
a_2
:
a_N
Output
If you will win, print `first`; if Lunlun will win, print `second`.
Examples
Input
2
1
2
Output
first
Input
3
100000
30000
20000
Output
second
Submitted Solution:
```
n=int(input())
a=0
for i in range(n):
if int(input())%2==1:
print("first")
a=1
break
if a==0:
print("second")
``` | instruction | 0 | 3,163 | 9 | 6,326 |
No | output | 1 | 3,163 | 9 | 6,327 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and there are a_i apples of Color i.
You and Lunlun the dachshund alternately perform the following operation (starting from you):
* Choose one or more apples from the tree and eat them. Here, the apples chosen at the same time must all have different colors.
The one who eats the last apple from the tree will be declared winner. If both you and Lunlun play optimally, which will win?
Constraints
* 1 \leq N \leq 10^5
* 1 \leq a_i \leq 10^9
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N
a_1
a_2
:
a_N
Output
If you will win, print `first`; if Lunlun will win, print `second`.
Examples
Input
2
1
2
Output
first
Input
3
100000
30000
20000
Output
second
Submitted Solution:
```
def main():
n = int(input())
a = list([(int(input())) % 2 for i in range(n)])
ans = sum(a)
if(ans * 2 >= n):
print('first')
else:
print('second')
main()
``` | instruction | 0 | 3,164 | 9 | 6,328 |
No | output | 1 | 3,164 | 9 | 6,329 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and there are a_i apples of Color i.
You and Lunlun the dachshund alternately perform the following operation (starting from you):
* Choose one or more apples from the tree and eat them. Here, the apples chosen at the same time must all have different colors.
The one who eats the last apple from the tree will be declared winner. If both you and Lunlun play optimally, which will win?
Constraints
* 1 \leq N \leq 10^5
* 1 \leq a_i \leq 10^9
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N
a_1
a_2
:
a_N
Output
If you will win, print `first`; if Lunlun will win, print `second`.
Examples
Input
2
1
2
Output
first
Input
3
100000
30000
20000
Output
second
Submitted Solution:
```
n = int(input())
a_list = [int(input()) for _ in range(n)]
a_list.sort()
d = ["second", "first"]
print(d[a_list[0] %2])
``` | instruction | 0 | 3,165 | 9 | 6,330 |
No | output | 1 | 3,165 | 9 | 6,331 |
Provide a correct Python 3 solution for this coding contest problem.
There are N bags of biscuits. The i-th bag contains A_i biscuits.
Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags.
He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such ways to select bags there are?
Constraints
* 1 \leq N \leq 50
* P = 0 or 1
* 1 \leq A_i \leq 100
Input
Input is given from Standard Input in the following format:
N P
A_1 A_2 ... A_N
Output
Print the number of ways to select bags so that the total number of biscuits inside is congruent to P modulo 2.
Examples
Input
2 0
1 3
Output
2
Input
1 1
50
Output
0
Input
3 0
1 1 1
Output
4
Input
45 1
17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26
Output
17592186044416 | instruction | 0 | 3,189 | 9 | 6,378 |
"Correct Solution:
```
N, P = map(int, input().split())
A = list(map(int, input().split()))
# すべて偶数か判定
if all(a % 2 == 0 for a in A):
if P == 0:
print(2**N)
else:
print(0)
else:
print(2**(N-1))
``` | output | 1 | 3,189 | 9 | 6,379 |
Provide a correct Python 3 solution for this coding contest problem.
There are N bags of biscuits. The i-th bag contains A_i biscuits.
Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags.
He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such ways to select bags there are?
Constraints
* 1 \leq N \leq 50
* P = 0 or 1
* 1 \leq A_i \leq 100
Input
Input is given from Standard Input in the following format:
N P
A_1 A_2 ... A_N
Output
Print the number of ways to select bags so that the total number of biscuits inside is congruent to P modulo 2.
Examples
Input
2 0
1 3
Output
2
Input
1 1
50
Output
0
Input
3 0
1 1 1
Output
4
Input
45 1
17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26
Output
17592186044416 | instruction | 0 | 3,190 | 9 | 6,380 |
"Correct Solution:
```
n,p=map(int,input().split())
a=list(map(int,input().split()))
if all(elem %2==0 for elem in a):
if p==0:
print(2**n)
else:
print(0)
else:
print(2**(n-1))
``` | output | 1 | 3,190 | 9 | 6,381 |
Provide a correct Python 3 solution for this coding contest problem.
There are N bags of biscuits. The i-th bag contains A_i biscuits.
Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags.
He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such ways to select bags there are?
Constraints
* 1 \leq N \leq 50
* P = 0 or 1
* 1 \leq A_i \leq 100
Input
Input is given from Standard Input in the following format:
N P
A_1 A_2 ... A_N
Output
Print the number of ways to select bags so that the total number of biscuits inside is congruent to P modulo 2.
Examples
Input
2 0
1 3
Output
2
Input
1 1
50
Output
0
Input
3 0
1 1 1
Output
4
Input
45 1
17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26
Output
17592186044416 | instruction | 0 | 3,191 | 9 | 6,382 |
"Correct Solution:
```
n, p = list(map(int, input().split()))
a = list(map(int, input().split()))
flag = True
for ele in a:
if ele%2==1:
flag = False
if flag:
if p==1:
print(0)
else:
print(2**n)
else:
print(2**(n-1))
``` | output | 1 | 3,191 | 9 | 6,383 |
Provide a correct Python 3 solution for this coding contest problem.
There are N bags of biscuits. The i-th bag contains A_i biscuits.
Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags.
He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such ways to select bags there are?
Constraints
* 1 \leq N \leq 50
* P = 0 or 1
* 1 \leq A_i \leq 100
Input
Input is given from Standard Input in the following format:
N P
A_1 A_2 ... A_N
Output
Print the number of ways to select bags so that the total number of biscuits inside is congruent to P modulo 2.
Examples
Input
2 0
1 3
Output
2
Input
1 1
50
Output
0
Input
3 0
1 1 1
Output
4
Input
45 1
17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26
Output
17592186044416 | instruction | 0 | 3,192 | 9 | 6,384 |
"Correct Solution:
```
n, p = map(int, input().split())
A = list(map(int, input().split()))
if all(a % 2 == 0 for a in A):
print(0 if p == 1 else 2**n)
else:
print(2**(n - 1))
``` | output | 1 | 3,192 | 9 | 6,385 |
Provide a correct Python 3 solution for this coding contest problem.
There are N bags of biscuits. The i-th bag contains A_i biscuits.
Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags.
He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such ways to select bags there are?
Constraints
* 1 \leq N \leq 50
* P = 0 or 1
* 1 \leq A_i \leq 100
Input
Input is given from Standard Input in the following format:
N P
A_1 A_2 ... A_N
Output
Print the number of ways to select bags so that the total number of biscuits inside is congruent to P modulo 2.
Examples
Input
2 0
1 3
Output
2
Input
1 1
50
Output
0
Input
3 0
1 1 1
Output
4
Input
45 1
17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26
Output
17592186044416 | instruction | 0 | 3,193 | 9 | 6,386 |
"Correct Solution:
```
N,P=map(int,input().split())
A=list(map(int,input().split()))
for a in A:
if a%2==1:
print(2**(N-1))
exit()
print(2**N if P==0 else 0)
``` | output | 1 | 3,193 | 9 | 6,387 |
Provide a correct Python 3 solution for this coding contest problem.
There are N bags of biscuits. The i-th bag contains A_i biscuits.
Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags.
He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such ways to select bags there are?
Constraints
* 1 \leq N \leq 50
* P = 0 or 1
* 1 \leq A_i \leq 100
Input
Input is given from Standard Input in the following format:
N P
A_1 A_2 ... A_N
Output
Print the number of ways to select bags so that the total number of biscuits inside is congruent to P modulo 2.
Examples
Input
2 0
1 3
Output
2
Input
1 1
50
Output
0
Input
3 0
1 1 1
Output
4
Input
45 1
17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26
Output
17592186044416 | instruction | 0 | 3,194 | 9 | 6,388 |
"Correct Solution:
```
n,p,*a=map(int,open(0).read().split())
if len([i for i in a if i%2])==0:
print(2**n*(p^1))
else:
print(2**(n-1))
``` | output | 1 | 3,194 | 9 | 6,389 |
Provide a correct Python 3 solution for this coding contest problem.
There are N bags of biscuits. The i-th bag contains A_i biscuits.
Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags.
He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such ways to select bags there are?
Constraints
* 1 \leq N \leq 50
* P = 0 or 1
* 1 \leq A_i \leq 100
Input
Input is given from Standard Input in the following format:
N P
A_1 A_2 ... A_N
Output
Print the number of ways to select bags so that the total number of biscuits inside is congruent to P modulo 2.
Examples
Input
2 0
1 3
Output
2
Input
1 1
50
Output
0
Input
3 0
1 1 1
Output
4
Input
45 1
17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26
Output
17592186044416 | instruction | 0 | 3,195 | 9 | 6,390 |
"Correct Solution:
```
N, P = map(int, input().split())
A = list(map(int, input().split()))
even = 0
for a in A:
if a % 2 == 0:
even += 1
if even == N:
if P == 0:
print(2 ** N)
else:
print(0)
else:
print(2 ** (N-1))
``` | output | 1 | 3,195 | 9 | 6,391 |
Provide a correct Python 3 solution for this coding contest problem.
There are N bags of biscuits. The i-th bag contains A_i biscuits.
Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags.
He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such ways to select bags there are?
Constraints
* 1 \leq N \leq 50
* P = 0 or 1
* 1 \leq A_i \leq 100
Input
Input is given from Standard Input in the following format:
N P
A_1 A_2 ... A_N
Output
Print the number of ways to select bags so that the total number of biscuits inside is congruent to P modulo 2.
Examples
Input
2 0
1 3
Output
2
Input
1 1
50
Output
0
Input
3 0
1 1 1
Output
4
Input
45 1
17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26
Output
17592186044416 | instruction | 0 | 3,196 | 9 | 6,392 |
"Correct Solution:
```
n,p=map(int,input().split())
l=list(map(lambda x:int(x)%2,input().split()))
a,b=0,0
for i in l:
if i>0:
a+=1
else:
b+=1
if a==0:
if p==0:
print(2**n)
else:
print(0)
else:
print(2**(n-1))
``` | output | 1 | 3,196 | 9 | 6,393 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N bags of biscuits. The i-th bag contains A_i biscuits.
Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags.
He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such ways to select bags there are?
Constraints
* 1 \leq N \leq 50
* P = 0 or 1
* 1 \leq A_i \leq 100
Input
Input is given from Standard Input in the following format:
N P
A_1 A_2 ... A_N
Output
Print the number of ways to select bags so that the total number of biscuits inside is congruent to P modulo 2.
Examples
Input
2 0
1 3
Output
2
Input
1 1
50
Output
0
Input
3 0
1 1 1
Output
4
Input
45 1
17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26
Output
17592186044416
Submitted Solution:
```
def check(a):
for i in a:
if i%2:
return True
return False
n,p = map(int, input().split())
a = list(map(int,input().split()))
if check(a):
print(2**(n-1))
elif p==0:
print(2**n)
else:
print(0)
``` | instruction | 0 | 3,197 | 9 | 6,394 |
Yes | output | 1 | 3,197 | 9 | 6,395 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N bags of biscuits. The i-th bag contains A_i biscuits.
Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags.
He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such ways to select bags there are?
Constraints
* 1 \leq N \leq 50
* P = 0 or 1
* 1 \leq A_i \leq 100
Input
Input is given from Standard Input in the following format:
N P
A_1 A_2 ... A_N
Output
Print the number of ways to select bags so that the total number of biscuits inside is congruent to P modulo 2.
Examples
Input
2 0
1 3
Output
2
Input
1 1
50
Output
0
Input
3 0
1 1 1
Output
4
Input
45 1
17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26
Output
17592186044416
Submitted Solution:
```
n, p = map(int, input().split())
A = list(map(int, input().split()))
odd = False
for a in A:
if a % 2 == 1:
odd = True
break
if odd:
print(2**(n-1))
elif p == 0:
print(2**n)
else:
print(0)
``` | instruction | 0 | 3,198 | 9 | 6,396 |
Yes | output | 1 | 3,198 | 9 | 6,397 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N bags of biscuits. The i-th bag contains A_i biscuits.
Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags.
He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such ways to select bags there are?
Constraints
* 1 \leq N \leq 50
* P = 0 or 1
* 1 \leq A_i \leq 100
Input
Input is given from Standard Input in the following format:
N P
A_1 A_2 ... A_N
Output
Print the number of ways to select bags so that the total number of biscuits inside is congruent to P modulo 2.
Examples
Input
2 0
1 3
Output
2
Input
1 1
50
Output
0
Input
3 0
1 1 1
Output
4
Input
45 1
17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26
Output
17592186044416
Submitted Solution:
```
N, P = map(int, input().split())
A_list=map(int, input().split())
# N=7
# P=1
# A_list=[1,1,1,1,1,1,1]
count=len([A for A in A_list if int(A)%2==P])
if count==(N*(not P)):
print((not P) * (2**N))
else:
print(2**(N-1))
``` | instruction | 0 | 3,199 | 9 | 6,398 |
Yes | output | 1 | 3,199 | 9 | 6,399 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N bags of biscuits. The i-th bag contains A_i biscuits.
Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags.
He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such ways to select bags there are?
Constraints
* 1 \leq N \leq 50
* P = 0 or 1
* 1 \leq A_i \leq 100
Input
Input is given from Standard Input in the following format:
N P
A_1 A_2 ... A_N
Output
Print the number of ways to select bags so that the total number of biscuits inside is congruent to P modulo 2.
Examples
Input
2 0
1 3
Output
2
Input
1 1
50
Output
0
Input
3 0
1 1 1
Output
4
Input
45 1
17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26
Output
17592186044416
Submitted Solution:
```
n, p = map(int, input().split())
a = list(map(int, input().split()))
for i in a:
if i % 2 == 1:
print(2 ** (n - 1))
exit()
if p == 0:
print(2 ** n)
else:
print(0)
``` | instruction | 0 | 3,200 | 9 | 6,400 |
Yes | output | 1 | 3,200 | 9 | 6,401 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N bags of biscuits. The i-th bag contains A_i biscuits.
Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags.
He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such ways to select bags there are?
Constraints
* 1 \leq N \leq 50
* P = 0 or 1
* 1 \leq A_i \leq 100
Input
Input is given from Standard Input in the following format:
N P
A_1 A_2 ... A_N
Output
Print the number of ways to select bags so that the total number of biscuits inside is congruent to P modulo 2.
Examples
Input
2 0
1 3
Output
2
Input
1 1
50
Output
0
Input
3 0
1 1 1
Output
4
Input
45 1
17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26
Output
17592186044416
Submitted Solution:
```
n,k = map(int,input().split())
lst = list(map(int,input().split()))
print(2**(n-1))
``` | instruction | 0 | 3,201 | 9 | 6,402 |
No | output | 1 | 3,201 | 9 | 6,403 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N bags of biscuits. The i-th bag contains A_i biscuits.
Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags.
He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such ways to select bags there are?
Constraints
* 1 \leq N \leq 50
* P = 0 or 1
* 1 \leq A_i \leq 100
Input
Input is given from Standard Input in the following format:
N P
A_1 A_2 ... A_N
Output
Print the number of ways to select bags so that the total number of biscuits inside is congruent to P modulo 2.
Examples
Input
2 0
1 3
Output
2
Input
1 1
50
Output
0
Input
3 0
1 1 1
Output
4
Input
45 1
17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26
Output
17592186044416
Submitted Solution:
```
import collections
def nCk(n, k):
k = min(k, n-k)
numer = 1
for i in range(n, n-k, -1):
numer *= i
denom = 1
for i in range(k, 1, -1):
denom *= i
return numer // denom
def main():
N, P = map(int, input().split())
A = list(map(int, input().split()))
B = [x%2 for x in A]
Bcount = collections.Counter(B)
tmp = pow(2, Bcount[P])
ans = 0
if N == 1:
print(((P == 1) ^ (B[0] == 1))^1)
return
for i in range(0, Bcount[(P+1)%2]+1, 2):
ans += tmp * nCk(Bcount[(P+1)%2], i)
print(ans)
if __name__ == "__main__":
main()
``` | instruction | 0 | 3,202 | 9 | 6,404 |
No | output | 1 | 3,202 | 9 | 6,405 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N bags of biscuits. The i-th bag contains A_i biscuits.
Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags.
He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such ways to select bags there are?
Constraints
* 1 \leq N \leq 50
* P = 0 or 1
* 1 \leq A_i \leq 100
Input
Input is given from Standard Input in the following format:
N P
A_1 A_2 ... A_N
Output
Print the number of ways to select bags so that the total number of biscuits inside is congruent to P modulo 2.
Examples
Input
2 0
1 3
Output
2
Input
1 1
50
Output
0
Input
3 0
1 1 1
Output
4
Input
45 1
17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26
Output
17592186044416
Submitted Solution:
```
N, P = map(int, input().split())
A = list(map(int, input().split()))
even = 0
odd = 0
for a in A:
if a % 2 == 0:
even += 1
else:
odd += 1
ans = 2 ** (even + odd - 1)
if odd == 0 and P == 1:
ans = 0
print(ans)
``` | instruction | 0 | 3,203 | 9 | 6,406 |
No | output | 1 | 3,203 | 9 | 6,407 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There are N bags of biscuits. The i-th bag contains A_i biscuits.
Takaki will select some of these bags and eat all of the biscuits inside. Here, it is also possible to select all or none of the bags.
He would like to select bags so that the total number of biscuits inside is congruent to P modulo 2. How many such ways to select bags there are?
Constraints
* 1 \leq N \leq 50
* P = 0 or 1
* 1 \leq A_i \leq 100
Input
Input is given from Standard Input in the following format:
N P
A_1 A_2 ... A_N
Output
Print the number of ways to select bags so that the total number of biscuits inside is congruent to P modulo 2.
Examples
Input
2 0
1 3
Output
2
Input
1 1
50
Output
0
Input
3 0
1 1 1
Output
4
Input
45 1
17 55 85 55 74 20 90 67 40 70 39 89 91 50 16 24 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 25 26
Output
17592186044416
Submitted Solution:
```
N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
odd = len([a for a in A if a % 2 == 1])
if P == 1 and odd == 0:
print(0)
if P == 0 and odd == 0 :
print(2 ** N)
else:
print(2 ** (N - 1))
``` | instruction | 0 | 3,204 | 9 | 6,408 |
No | output | 1 | 3,204 | 9 | 6,409 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Golorps are mysterious creatures who feed on variables. Golorp's name is a program in some programming language. Some scientists believe that this language is Befunge; golorps are tantalizingly silent.
Variables consumed by golorps can take values from 0 to 9, inclusive. For each golorp its daily diet is defined by its name. Some golorps are so picky that they can't be fed at all. Besides, all golorps are very health-conscious and try to eat as little as possible. Given a choice of several valid sequences of variable values, each golorp will choose lexicographically smallest one.
For the purposes of this problem you can assume that a golorp consists of jaws and a stomach. The number of variables necessary to feed a golorp is defined by the shape of its jaws. Variables can get to the stomach only via the jaws.
A hungry golorp is visiting you. You know its name; feed it or figure out that it's impossible.
Input
The input is a single string (between 13 and 1024 characters long) — the name of the visiting golorp. All names are similar and will resemble the ones given in the samples. The name is guaranteed to be valid.
Output
Output lexicographically smallest sequence of variable values fit for feeding this golorp. Values should be listed in the order in which they get into the jaws. If the golorp is impossible to feed, output "false".
Examples
Input
?(_-_/___*__):-___>__.
Output
0010
Input
?(__-_+_/_____):-__>__,_____<__.
Output
false
Input
?(______________________/____+_______*__-_____*______-___):-__<___,___<____,____<_____,_____<______,______<_______.
Output
0250341
Input
?(__+___+__-___):-___>__.
Output
0101 | instruction | 0 | 3,730 | 9 | 7,460 |
Tags: *special
Correct Solution:
```
class InputHandlerObject(object):
inputs = []
def getInput(self, n = 0):
res = ""
inputs = self.inputs
if not inputs: inputs.extend(input().split(" "))
if n == 0:
res = inputs[:]
inputs[:] = []
while n > len(inputs):
inputs.extend(input().split(" "))
if n > 0:
res = inputs[:n]
inputs[:n] = []
return res
InputHandler = InputHandlerObject()
g = InputHandler.getInput
golorp = input().split(":-")
golorp[0] = golorp[0][2:]
ct = 0
jaws = []
for x in range(len(golorp[0])):
if golorp[0][x] == "_":
ct += 1
else:
jaws.append(ct)
ct = 0
ct = 0
conditionsraw = []
for x in range(len(golorp[1])):
if golorp[1][x] == "_":
ct += 1
else:
conditionsraw.append(ct)
conditionsraw.append(golorp[1][x])
ct = 0
conditions = []
for x in range(0, len(conditionsraw)//4):
if conditionsraw[4*x+1] == ">":
conditions.append((conditionsraw[4*x+2], conditionsraw[4*x]))
else:
conditions.append((conditionsraw[4*x], conditionsraw[4*x+2]))
inedges = [[-1]] * (max(jaws) + 1)
outedges = [[-1]] * (max(jaws) + 1)
val = [-1] * (max(jaws) + 1)
processed = [False] * (max(jaws) + 1)
for x in jaws:
inedges[x] = []
outedges[x] = []
for x, y in conditions:
inedges[y].append(x)
outedges[x].append(y)
for i in range(10):
for x in jaws:
if not inedges[x] and not processed[x]:
val[x] += 1
processed[x] = True
for y in outedges[x]:
val[y] = max(val[y], val[x])
inedges[y].remove(x)
failure = False
for x in jaws:
if not processed[x] or val[x] > 9:
failure = True
break
if failure:
print("false")
else:
s = ""
for x in jaws:
s += str(val[x])
print(s)
``` | output | 1 | 3,730 | 9 | 7,461 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Golorps are mysterious creatures who feed on variables. Golorp's name is a program in some programming language. Some scientists believe that this language is Befunge; golorps are tantalizingly silent.
Variables consumed by golorps can take values from 0 to 9, inclusive. For each golorp its daily diet is defined by its name. Some golorps are so picky that they can't be fed at all. Besides, all golorps are very health-conscious and try to eat as little as possible. Given a choice of several valid sequences of variable values, each golorp will choose lexicographically smallest one.
For the purposes of this problem you can assume that a golorp consists of jaws and a stomach. The number of variables necessary to feed a golorp is defined by the shape of its jaws. Variables can get to the stomach only via the jaws.
A hungry golorp is visiting you. You know its name; feed it or figure out that it's impossible.
Input
The input is a single string (between 13 and 1024 characters long) — the name of the visiting golorp. All names are similar and will resemble the ones given in the samples. The name is guaranteed to be valid.
Output
Output lexicographically smallest sequence of variable values fit for feeding this golorp. Values should be listed in the order in which they get into the jaws. If the golorp is impossible to feed, output "false".
Examples
Input
?(_-_/___*__):-___>__.
Output
0010
Input
?(__-_+_/_____):-__>__,_____<__.
Output
false
Input
?(______________________/____+_______*__-_____*______-___):-__<___,___<____,____<_____,_____<______,______<_______.
Output
0250341
Input
?(__+___+__-___):-___>__.
Output
0101 | instruction | 0 | 3,731 | 9 | 7,462 |
Tags: *special
Correct Solution:
```
"""
Codeforces April Fools Contest 2014 Problem I
Author : chaotic_iak
Language: Python 3.3.4
"""
class InputHandlerObject(object):
inputs = []
def getInput(self, n = 0):
res = ""
inputs = self.inputs
if not inputs: inputs.extend(input().split(" "))
if n == 0:
res = inputs[:]
inputs[:] = []
while n > len(inputs):
inputs.extend(input().split(" "))
if n > 0:
res = inputs[:n]
inputs[:n] = []
return res
InputHandler = InputHandlerObject()
g = InputHandler.getInput
############################## SOLUTION ##############################
# ?(_/____+_______*__-_____*______-___):-__<___,___<____,____<_____,_____<______,______<_______.
golorp = input().split(":-")
golorp[0] = golorp[0][2:]
ct = 0
jaws = []
for x in range(len(golorp[0])):
if golorp[0][x] == "_":
ct += 1
else:
jaws.append(ct)
ct = 0
ct = 0
conditionsraw = []
for x in range(len(golorp[1])):
if golorp[1][x] == "_":
ct += 1
else:
conditionsraw.append(ct)
conditionsraw.append(golorp[1][x])
ct = 0
conditions = []
for x in range(0, len(conditionsraw)//4):
if conditionsraw[4*x+1] == ">":
conditions.append((conditionsraw[4*x+2], conditionsraw[4*x]))
else:
conditions.append((conditionsraw[4*x], conditionsraw[4*x+2]))
inedges = [[-1]] * (max(jaws) + 1)
outedges = [[-1]] * (max(jaws) + 1)
val = [-1] * (max(jaws) + 1)
processed = [False] * (max(jaws) + 1)
for x in jaws:
inedges[x] = []
outedges[x] = []
for x, y in conditions:
inedges[y].append(x)
outedges[x].append(y)
for i in range(10):
for x in jaws:
if not inedges[x] and not processed[x]:
val[x] += 1
processed[x] = True
for y in outedges[x]:
val[y] = max(val[y], val[x])
inedges[y].remove(x)
failure = False
for x in jaws:
if not processed[x] or val[x] > 9:
failure = True
break
if failure:
print("false")
else:
s = ""
for x in jaws:
s += str(val[x])
print(s)
``` | output | 1 | 3,731 | 9 | 7,463 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Golorps are mysterious creatures who feed on variables. Golorp's name is a program in some programming language. Some scientists believe that this language is Befunge; golorps are tantalizingly silent.
Variables consumed by golorps can take values from 0 to 9, inclusive. For each golorp its daily diet is defined by its name. Some golorps are so picky that they can't be fed at all. Besides, all golorps are very health-conscious and try to eat as little as possible. Given a choice of several valid sequences of variable values, each golorp will choose lexicographically smallest one.
For the purposes of this problem you can assume that a golorp consists of jaws and a stomach. The number of variables necessary to feed a golorp is defined by the shape of its jaws. Variables can get to the stomach only via the jaws.
A hungry golorp is visiting you. You know its name; feed it or figure out that it's impossible.
Input
The input is a single string (between 13 and 1024 characters long) — the name of the visiting golorp. All names are similar and will resemble the ones given in the samples. The name is guaranteed to be valid.
Output
Output lexicographically smallest sequence of variable values fit for feeding this golorp. Values should be listed in the order in which they get into the jaws. If the golorp is impossible to feed, output "false".
Examples
Input
?(_-_/___*__):-___>__.
Output
0010
Input
?(__-_+_/_____):-__>__,_____<__.
Output
false
Input
?(______________________/____+_______*__-_____*______-___):-__<___,___<____,____<_____,_____<______,______<_______.
Output
0250341
Input
?(__+___+__-___):-___>__.
Output
0101 | instruction | 0 | 3,732 | 9 | 7,464 |
Tags: *special
Correct Solution:
```
import re
line=input()
line = line.rstrip('.')
a, b, c = line.partition("):-")
rels = c.split(',')
relations = set()
for rel in rels:
if "<" in rel:
x, _, y = rel.partition("<")
relations.add((len(x), len(y)))
else:
x, _, y = rel.partition(">")
relations.add((len(y), len(x)))
a = a.lstrip("?(")
args = re.split(r"(\+|-|\*|/)", a)
args = [len(args[i]) for i in range(0, len(args), 2)]
# print(args)
# print(relations)
edges = {k:[] for k in args}
for j, i in relations:
edges[i].append(j)
seen = {k:0 for k in args}
q = []
def topsort(k):
if seen[k] == 1:
print("false")
quit()
seen[k] = 1
for other in edges[k]:
topsort(other)
q.append(k)
seen[k] = 2
return True
for k in args:
if seen[k] == 0:
topsort(k)
vals = {}
for k in q:
others = edges[k]
maxval = -1
for other in others:
maxval = max(maxval, vals.get(other, -1))
vals[k] = maxval+1
if(vals[k]>9):
print("false")
quit()
for k in args:
print(vals[k], end='')
print()
``` | output | 1 | 3,732 | 9 | 7,465 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
<image>
Some time ago Slastyona the Sweetmaid decided to open her own bakery! She bought required ingredients and a wonder-oven which can bake several types of cakes, and opened the bakery.
Soon the expenses started to overcome the income, so Slastyona decided to study the sweets market. She learned it's profitable to pack cakes in boxes, and that the more distinct cake types a box contains (let's denote this number as the value of the box), the higher price it has.
She needs to change the production technology! The problem is that the oven chooses the cake types on its own and Slastyona can't affect it. However, she knows the types and order of n cakes the oven is going to bake today. Slastyona has to pack exactly k boxes with cakes today, and she has to put in each box several (at least one) cakes the oven produced one right after another (in other words, she has to put in a box a continuous segment of cakes).
Slastyona wants to maximize the total value of all boxes with cakes. Help her determine this maximum possible total value.
Input
The first line contains two integers n and k (1 ≤ n ≤ 35000, 1 ≤ k ≤ min(n, 50)) – the number of cakes and the number of boxes, respectively.
The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) – the types of cakes in the order the oven bakes them.
Output
Print the only integer – the maximum total value of all boxes with cakes.
Examples
Input
4 1
1 2 2 1
Output
2
Input
7 2
1 3 3 1 4 4 4
Output
5
Input
8 3
7 7 8 7 7 8 1 7
Output
6
Note
In the first example Slastyona has only one box. She has to put all cakes in it, so that there are two types of cakes in the box, so the value is equal to 2.
In the second example it is profitable to put the first two cakes in the first box, and all the rest in the second. There are two distinct types in the first box, and three in the second box then, so the total value is 5.
Submitted Solution:
```
s=input()
n=int(s[0])
k=int(s[2])
f=input()
l=f.split()
v=[int(l[i]) for i in range (len(l))]
t=[v[0]]
p=0
m=0
o=0
pos=0
for i in range(1,n-1):
if (o==k-1):
pos=i
break
if((v[i]==t[p]) and (v[i]==v[i+1])):
t.append(v[i])
p+=1
elif(v[i]not in t) :
t.append(v[i])
p+=1
else :
m+=len(set(t))
o+=1
p=0
t=[v[i]]
g=v[pos:n]
m=m+len(set(g))
print(m)
``` | instruction | 0 | 3,863 | 9 | 7,726 |
No | output | 1 | 3,863 | 9 | 7,727 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
<image>
Some time ago Slastyona the Sweetmaid decided to open her own bakery! She bought required ingredients and a wonder-oven which can bake several types of cakes, and opened the bakery.
Soon the expenses started to overcome the income, so Slastyona decided to study the sweets market. She learned it's profitable to pack cakes in boxes, and that the more distinct cake types a box contains (let's denote this number as the value of the box), the higher price it has.
She needs to change the production technology! The problem is that the oven chooses the cake types on its own and Slastyona can't affect it. However, she knows the types and order of n cakes the oven is going to bake today. Slastyona has to pack exactly k boxes with cakes today, and she has to put in each box several (at least one) cakes the oven produced one right after another (in other words, she has to put in a box a continuous segment of cakes).
Slastyona wants to maximize the total value of all boxes with cakes. Help her determine this maximum possible total value.
Input
The first line contains two integers n and k (1 ≤ n ≤ 35000, 1 ≤ k ≤ min(n, 50)) – the number of cakes and the number of boxes, respectively.
The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) – the types of cakes in the order the oven bakes them.
Output
Print the only integer – the maximum total value of all boxes with cakes.
Examples
Input
4 1
1 2 2 1
Output
2
Input
7 2
1 3 3 1 4 4 4
Output
5
Input
8 3
7 7 8 7 7 8 1 7
Output
6
Note
In the first example Slastyona has only one box. She has to put all cakes in it, so that there are two types of cakes in the box, so the value is equal to 2.
In the second example it is profitable to put the first two cakes in the first box, and all the rest in the second. There are two distinct types in the first box, and three in the second box then, so the total value is 5.
Submitted Solution:
```
s=input()
n=int(s[0])
k=int(s[2])
f=input()
l=f.split()
v=[int(l[i]) for i in range (len(l))]
t=[v[0]]
p=0
m=0
o=0
pos=0
for i in range(1,n-1):
if (o==k-1):
g=v[pos:n]+[v[i-1]]
pos=i
break
if((v[i]==t[p]) and (v[i]==v[i+1])):
t.append(v[i])
p+=1
elif(v[i]not in t) :
t.append(v[i])
p+=1
else :
print(t)
m+=len(set(t))
o+=1
p=0
t=[v[i]]
print(t)
m=m+len(set(g))
print(m)
``` | instruction | 0 | 3,864 | 9 | 7,728 |
No | output | 1 | 3,864 | 9 | 7,729 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
<image>
Some time ago Slastyona the Sweetmaid decided to open her own bakery! She bought required ingredients and a wonder-oven which can bake several types of cakes, and opened the bakery.
Soon the expenses started to overcome the income, so Slastyona decided to study the sweets market. She learned it's profitable to pack cakes in boxes, and that the more distinct cake types a box contains (let's denote this number as the value of the box), the higher price it has.
She needs to change the production technology! The problem is that the oven chooses the cake types on its own and Slastyona can't affect it. However, she knows the types and order of n cakes the oven is going to bake today. Slastyona has to pack exactly k boxes with cakes today, and she has to put in each box several (at least one) cakes the oven produced one right after another (in other words, she has to put in a box a continuous segment of cakes).
Slastyona wants to maximize the total value of all boxes with cakes. Help her determine this maximum possible total value.
Input
The first line contains two integers n and k (1 ≤ n ≤ 35000, 1 ≤ k ≤ min(n, 50)) – the number of cakes and the number of boxes, respectively.
The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) – the types of cakes in the order the oven bakes them.
Output
Print the only integer – the maximum total value of all boxes with cakes.
Examples
Input
4 1
1 2 2 1
Output
2
Input
7 2
1 3 3 1 4 4 4
Output
5
Input
8 3
7 7 8 7 7 8 1 7
Output
6
Note
In the first example Slastyona has only one box. She has to put all cakes in it, so that there are two types of cakes in the box, so the value is equal to 2.
In the second example it is profitable to put the first two cakes in the first box, and all the rest in the second. There are two distinct types in the first box, and three in the second box then, so the total value is 5.
Submitted Solution:
```
if 1>1:
print("NO")
else:
print("YES")
# dsajlf skfs lfjs fj safjsa fjals
``` | instruction | 0 | 3,865 | 9 | 7,730 |
No | output | 1 | 3,865 | 9 | 7,731 |
Provide a correct Python 3 solution for this coding contest problem.
The Patisserie AtCoder sells cakes with number-shaped candles. There are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively. Each cake has an integer value called deliciousness, as follows:
* The deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.
* The deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.
* The deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.
Takahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.
There are X \times Y \times Z such ways to choose three cakes.
We will arrange these X \times Y \times Z ways in descending order of the sum of the deliciousness of the cakes.
Print the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.
Constraints
* 1 \leq X \leq 1 \ 000
* 1 \leq Y \leq 1 \ 000
* 1 \leq Z \leq 1 \ 000
* 1 \leq K \leq \min(3 \ 000, X \times Y \times Z)
* 1 \leq A_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq B_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq C_i \leq 10 \ 000 \ 000 \ 000
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
X Y Z K
A_1 \ A_2 \ A_3 \ ... \ A_X
B_1 \ B_2 \ B_3 \ ... \ B_Y
C_1 \ C_2 \ C_3 \ ... \ C_Z
Output
Print K lines. The i-th line should contain the i-th value stated in the problem statement.
Examples
Input
2 2 2 8
4 6
1 5
3 8
Output
19
17
15
14
13
12
10
8
Input
3 3 3 5
1 10 100
2 20 200
1 10 100
Output
400
310
310
301
301
Input
10 10 10 20
7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488
1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338
4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736
Output
23379871545
22444657051
22302177772
22095691512
21667941469
21366963278
21287912315
21279176669
21160477018
21085311041
21059876163
21017997739
20703329561
20702387965
20590247696
20383761436
20343962175
20254073196
20210218542
20150096547 | instruction | 0 | 4,012 | 9 | 8,024 |
"Correct Solution:
```
x,y,z,K=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort(reverse=1)
b.sort(reverse=1)
c.sort(reverse=1)
m=[]
for i in range(x):
for j in range(y):
for k in range(z):
if (i+1)*(j+1)*(k+1)>K:
break
m.append(a[i]+b[j]+c[k])
m.sort(reverse=1)
for i in m[:K]:
print(i)
``` | output | 1 | 4,012 | 9 | 8,025 |
Provide a correct Python 3 solution for this coding contest problem.
The Patisserie AtCoder sells cakes with number-shaped candles. There are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively. Each cake has an integer value called deliciousness, as follows:
* The deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.
* The deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.
* The deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.
Takahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.
There are X \times Y \times Z such ways to choose three cakes.
We will arrange these X \times Y \times Z ways in descending order of the sum of the deliciousness of the cakes.
Print the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.
Constraints
* 1 \leq X \leq 1 \ 000
* 1 \leq Y \leq 1 \ 000
* 1 \leq Z \leq 1 \ 000
* 1 \leq K \leq \min(3 \ 000, X \times Y \times Z)
* 1 \leq A_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq B_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq C_i \leq 10 \ 000 \ 000 \ 000
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
X Y Z K
A_1 \ A_2 \ A_3 \ ... \ A_X
B_1 \ B_2 \ B_3 \ ... \ B_Y
C_1 \ C_2 \ C_3 \ ... \ C_Z
Output
Print K lines. The i-th line should contain the i-th value stated in the problem statement.
Examples
Input
2 2 2 8
4 6
1 5
3 8
Output
19
17
15
14
13
12
10
8
Input
3 3 3 5
1 10 100
2 20 200
1 10 100
Output
400
310
310
301
301
Input
10 10 10 20
7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488
1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338
4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736
Output
23379871545
22444657051
22302177772
22095691512
21667941469
21366963278
21287912315
21279176669
21160477018
21085311041
21059876163
21017997739
20703329561
20702387965
20590247696
20383761436
20343962175
20254073196
20210218542
20150096547 | instruction | 0 | 4,013 | 9 | 8,026 |
"Correct Solution:
```
X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
import itertools
AB = [a + b for a, b in itertools.product(A,B)]
AB.sort(reverse=True)
ABC = [ab + c for ab, c in itertools.product(AB[:3000],C)]
ABC.sort(reverse=True)
for i in range(K):
print(ABC[i])
``` | output | 1 | 4,013 | 9 | 8,027 |
Provide a correct Python 3 solution for this coding contest problem.
The Patisserie AtCoder sells cakes with number-shaped candles. There are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively. Each cake has an integer value called deliciousness, as follows:
* The deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.
* The deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.
* The deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.
Takahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.
There are X \times Y \times Z such ways to choose three cakes.
We will arrange these X \times Y \times Z ways in descending order of the sum of the deliciousness of the cakes.
Print the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.
Constraints
* 1 \leq X \leq 1 \ 000
* 1 \leq Y \leq 1 \ 000
* 1 \leq Z \leq 1 \ 000
* 1 \leq K \leq \min(3 \ 000, X \times Y \times Z)
* 1 \leq A_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq B_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq C_i \leq 10 \ 000 \ 000 \ 000
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
X Y Z K
A_1 \ A_2 \ A_3 \ ... \ A_X
B_1 \ B_2 \ B_3 \ ... \ B_Y
C_1 \ C_2 \ C_3 \ ... \ C_Z
Output
Print K lines. The i-th line should contain the i-th value stated in the problem statement.
Examples
Input
2 2 2 8
4 6
1 5
3 8
Output
19
17
15
14
13
12
10
8
Input
3 3 3 5
1 10 100
2 20 200
1 10 100
Output
400
310
310
301
301
Input
10 10 10 20
7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488
1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338
4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736
Output
23379871545
22444657051
22302177772
22095691512
21667941469
21366963278
21287912315
21279176669
21160477018
21085311041
21059876163
21017997739
20703329561
20702387965
20590247696
20383761436
20343962175
20254073196
20210218542
20150096547 | instruction | 0 | 4,014 | 9 | 8,028 |
"Correct Solution:
```
X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
AB = []
ABC = []
for i in A:
for j in B:
AB.append(i+j)
AB.sort(reverse=True)
AB_max = AB[:K]
for j in AB_max:
for h in C:
ABC.append(j+h)
ABC.sort(reverse=True)
for i in range(K):
print(ABC[i])
``` | output | 1 | 4,014 | 9 | 8,029 |
Provide a correct Python 3 solution for this coding contest problem.
The Patisserie AtCoder sells cakes with number-shaped candles. There are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively. Each cake has an integer value called deliciousness, as follows:
* The deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.
* The deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.
* The deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.
Takahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.
There are X \times Y \times Z such ways to choose three cakes.
We will arrange these X \times Y \times Z ways in descending order of the sum of the deliciousness of the cakes.
Print the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.
Constraints
* 1 \leq X \leq 1 \ 000
* 1 \leq Y \leq 1 \ 000
* 1 \leq Z \leq 1 \ 000
* 1 \leq K \leq \min(3 \ 000, X \times Y \times Z)
* 1 \leq A_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq B_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq C_i \leq 10 \ 000 \ 000 \ 000
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
X Y Z K
A_1 \ A_2 \ A_3 \ ... \ A_X
B_1 \ B_2 \ B_3 \ ... \ B_Y
C_1 \ C_2 \ C_3 \ ... \ C_Z
Output
Print K lines. The i-th line should contain the i-th value stated in the problem statement.
Examples
Input
2 2 2 8
4 6
1 5
3 8
Output
19
17
15
14
13
12
10
8
Input
3 3 3 5
1 10 100
2 20 200
1 10 100
Output
400
310
310
301
301
Input
10 10 10 20
7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488
1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338
4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736
Output
23379871545
22444657051
22302177772
22095691512
21667941469
21366963278
21287912315
21279176669
21160477018
21085311041
21059876163
21017997739
20703329561
20702387965
20590247696
20383761436
20343962175
20254073196
20210218542
20150096547 | instruction | 0 | 4,015 | 9 | 8,030 |
"Correct Solution:
```
from itertools import product
X, Y, Z, K = map(int, input().split())
AB = []
for ab in product(map(int, input().split()), map(int, input().split())):
AB.append(ab[0] + ab[1])
AB.sort(reverse=True)
AB = AB[:min(K,X*Y)]
ABC = []
for abc in product(AB, map(int, input().split())):
ABC.append(abc[0]+abc[1])
ABC.sort(reverse=True)
for i in range(K):
print(ABC[i])
``` | output | 1 | 4,015 | 9 | 8,031 |
Provide a correct Python 3 solution for this coding contest problem.
The Patisserie AtCoder sells cakes with number-shaped candles. There are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively. Each cake has an integer value called deliciousness, as follows:
* The deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.
* The deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.
* The deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.
Takahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.
There are X \times Y \times Z such ways to choose three cakes.
We will arrange these X \times Y \times Z ways in descending order of the sum of the deliciousness of the cakes.
Print the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.
Constraints
* 1 \leq X \leq 1 \ 000
* 1 \leq Y \leq 1 \ 000
* 1 \leq Z \leq 1 \ 000
* 1 \leq K \leq \min(3 \ 000, X \times Y \times Z)
* 1 \leq A_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq B_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq C_i \leq 10 \ 000 \ 000 \ 000
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
X Y Z K
A_1 \ A_2 \ A_3 \ ... \ A_X
B_1 \ B_2 \ B_3 \ ... \ B_Y
C_1 \ C_2 \ C_3 \ ... \ C_Z
Output
Print K lines. The i-th line should contain the i-th value stated in the problem statement.
Examples
Input
2 2 2 8
4 6
1 5
3 8
Output
19
17
15
14
13
12
10
8
Input
3 3 3 5
1 10 100
2 20 200
1 10 100
Output
400
310
310
301
301
Input
10 10 10 20
7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488
1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338
4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736
Output
23379871545
22444657051
22302177772
22095691512
21667941469
21366963278
21287912315
21279176669
21160477018
21085311041
21059876163
21017997739
20703329561
20702387965
20590247696
20383761436
20343962175
20254073196
20210218542
20150096547 | instruction | 0 | 4,016 | 9 | 8,032 |
"Correct Solution:
```
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = sorted(list(map(int, input().split())))[::-1]
a1 = sorted(a[i] + b[j] for i in range(x) for j in range(y))[::-1]
a2 = sorted(a1[i] + c[j] for i in range(min(len(a1), k))
for j in range(z))[::-1]
for i in range(k):
print(a2[i])
``` | output | 1 | 4,016 | 9 | 8,033 |
Provide a correct Python 3 solution for this coding contest problem.
The Patisserie AtCoder sells cakes with number-shaped candles. There are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively. Each cake has an integer value called deliciousness, as follows:
* The deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.
* The deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.
* The deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.
Takahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.
There are X \times Y \times Z such ways to choose three cakes.
We will arrange these X \times Y \times Z ways in descending order of the sum of the deliciousness of the cakes.
Print the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.
Constraints
* 1 \leq X \leq 1 \ 000
* 1 \leq Y \leq 1 \ 000
* 1 \leq Z \leq 1 \ 000
* 1 \leq K \leq \min(3 \ 000, X \times Y \times Z)
* 1 \leq A_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq B_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq C_i \leq 10 \ 000 \ 000 \ 000
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
X Y Z K
A_1 \ A_2 \ A_3 \ ... \ A_X
B_1 \ B_2 \ B_3 \ ... \ B_Y
C_1 \ C_2 \ C_3 \ ... \ C_Z
Output
Print K lines. The i-th line should contain the i-th value stated in the problem statement.
Examples
Input
2 2 2 8
4 6
1 5
3 8
Output
19
17
15
14
13
12
10
8
Input
3 3 3 5
1 10 100
2 20 200
1 10 100
Output
400
310
310
301
301
Input
10 10 10 20
7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488
1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338
4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736
Output
23379871545
22444657051
22302177772
22095691512
21667941469
21366963278
21287912315
21279176669
21160477018
21085311041
21059876163
21017997739
20703329561
20702387965
20590247696
20383761436
20343962175
20254073196
20210218542
20150096547 | instruction | 0 | 4,017 | 9 | 8,034 |
"Correct Solution:
```
from heapq import nlargest
x,y,z,k=map(int,input().split())
A,B,C=[list(map(int,input().split()))for _ in[0]*3]
D=nlargest(k,(a+b for a in A for b in B ))
E=nlargest(k,(d+c for c in C for d in D ))
for i in E:
print(i)
``` | output | 1 | 4,017 | 9 | 8,035 |
Provide a correct Python 3 solution for this coding contest problem.
The Patisserie AtCoder sells cakes with number-shaped candles. There are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively. Each cake has an integer value called deliciousness, as follows:
* The deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.
* The deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.
* The deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.
Takahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.
There are X \times Y \times Z such ways to choose three cakes.
We will arrange these X \times Y \times Z ways in descending order of the sum of the deliciousness of the cakes.
Print the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.
Constraints
* 1 \leq X \leq 1 \ 000
* 1 \leq Y \leq 1 \ 000
* 1 \leq Z \leq 1 \ 000
* 1 \leq K \leq \min(3 \ 000, X \times Y \times Z)
* 1 \leq A_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq B_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq C_i \leq 10 \ 000 \ 000 \ 000
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
X Y Z K
A_1 \ A_2 \ A_3 \ ... \ A_X
B_1 \ B_2 \ B_3 \ ... \ B_Y
C_1 \ C_2 \ C_3 \ ... \ C_Z
Output
Print K lines. The i-th line should contain the i-th value stated in the problem statement.
Examples
Input
2 2 2 8
4 6
1 5
3 8
Output
19
17
15
14
13
12
10
8
Input
3 3 3 5
1 10 100
2 20 200
1 10 100
Output
400
310
310
301
301
Input
10 10 10 20
7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488
1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338
4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736
Output
23379871545
22444657051
22302177772
22095691512
21667941469
21366963278
21287912315
21279176669
21160477018
21085311041
21059876163
21017997739
20703329561
20702387965
20590247696
20383761436
20343962175
20254073196
20210218542
20150096547 | instruction | 0 | 4,018 | 9 | 8,036 |
"Correct Solution:
```
X, Y, Z, K = map(int, input().split())
*A, = map(int, input().split())
*B, = map(int, input().split())
*C, = map(int, input().split())
A.sort(reverse=True)
D = [i+j for j in C for i in B]
D.sort(reverse=True)
E = [i+j for j in D[:K] for i in A[:K]]
E.sort(reverse=True)
print(*E[:K], sep="\n")
``` | output | 1 | 4,018 | 9 | 8,037 |
Provide a correct Python 3 solution for this coding contest problem.
The Patisserie AtCoder sells cakes with number-shaped candles. There are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively. Each cake has an integer value called deliciousness, as follows:
* The deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.
* The deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.
* The deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.
Takahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.
There are X \times Y \times Z such ways to choose three cakes.
We will arrange these X \times Y \times Z ways in descending order of the sum of the deliciousness of the cakes.
Print the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.
Constraints
* 1 \leq X \leq 1 \ 000
* 1 \leq Y \leq 1 \ 000
* 1 \leq Z \leq 1 \ 000
* 1 \leq K \leq \min(3 \ 000, X \times Y \times Z)
* 1 \leq A_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq B_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq C_i \leq 10 \ 000 \ 000 \ 000
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
X Y Z K
A_1 \ A_2 \ A_3 \ ... \ A_X
B_1 \ B_2 \ B_3 \ ... \ B_Y
C_1 \ C_2 \ C_3 \ ... \ C_Z
Output
Print K lines. The i-th line should contain the i-th value stated in the problem statement.
Examples
Input
2 2 2 8
4 6
1 5
3 8
Output
19
17
15
14
13
12
10
8
Input
3 3 3 5
1 10 100
2 20 200
1 10 100
Output
400
310
310
301
301
Input
10 10 10 20
7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488
1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338
4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736
Output
23379871545
22444657051
22302177772
22095691512
21667941469
21366963278
21287912315
21279176669
21160477018
21085311041
21059876163
21017997739
20703329561
20702387965
20590247696
20383761436
20343962175
20254073196
20210218542
20150096547 | instruction | 0 | 4,019 | 9 | 8,038 |
"Correct Solution:
```
x,y,z,k=map(int,input().split())
a=sorted(list(map(int,input().split())),reverse=True)
b=sorted(list(map(int,input().split())),reverse=True)
c=sorted(list(map(int,input().split())),reverse=True)
ab=[i+j for j in b for i in a]
ab.sort(reverse=True)
abc=[i+j for j in c[:k] for i in ab[:k]]
abc.sort(reverse=True)
print(*abc[:k],sep='\n')
``` | output | 1 | 4,019 | 9 | 8,039 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Patisserie AtCoder sells cakes with number-shaped candles. There are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively. Each cake has an integer value called deliciousness, as follows:
* The deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.
* The deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.
* The deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.
Takahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.
There are X \times Y \times Z such ways to choose three cakes.
We will arrange these X \times Y \times Z ways in descending order of the sum of the deliciousness of the cakes.
Print the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.
Constraints
* 1 \leq X \leq 1 \ 000
* 1 \leq Y \leq 1 \ 000
* 1 \leq Z \leq 1 \ 000
* 1 \leq K \leq \min(3 \ 000, X \times Y \times Z)
* 1 \leq A_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq B_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq C_i \leq 10 \ 000 \ 000 \ 000
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
X Y Z K
A_1 \ A_2 \ A_3 \ ... \ A_X
B_1 \ B_2 \ B_3 \ ... \ B_Y
C_1 \ C_2 \ C_3 \ ... \ C_Z
Output
Print K lines. The i-th line should contain the i-th value stated in the problem statement.
Examples
Input
2 2 2 8
4 6
1 5
3 8
Output
19
17
15
14
13
12
10
8
Input
3 3 3 5
1 10 100
2 20 200
1 10 100
Output
400
310
310
301
301
Input
10 10 10 20
7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488
1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338
4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736
Output
23379871545
22444657051
22302177772
22095691512
21667941469
21366963278
21287912315
21279176669
21160477018
21085311041
21059876163
21017997739
20703329561
20702387965
20590247696
20383761436
20343962175
20254073196
20210218542
20150096547
Submitted Solution:
```
X, Y, Z, K = map(int, input().split())
*A, = sorted(map(int, input().split()))
*B, = sorted(map(int, input().split()))
*C, = sorted(map(int, input().split()))
ab = [i+j for i in A for j in B]
ab = sorted(ab, reverse=True)[:K]
abc= [i+j for i in ab for j in C]
abc.sort(reverse=True)
for i in abc[:K]:
print(i)
``` | instruction | 0 | 4,020 | 9 | 8,040 |
Yes | output | 1 | 4,020 | 9 | 8,041 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Patisserie AtCoder sells cakes with number-shaped candles. There are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively. Each cake has an integer value called deliciousness, as follows:
* The deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.
* The deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.
* The deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.
Takahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.
There are X \times Y \times Z such ways to choose three cakes.
We will arrange these X \times Y \times Z ways in descending order of the sum of the deliciousness of the cakes.
Print the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.
Constraints
* 1 \leq X \leq 1 \ 000
* 1 \leq Y \leq 1 \ 000
* 1 \leq Z \leq 1 \ 000
* 1 \leq K \leq \min(3 \ 000, X \times Y \times Z)
* 1 \leq A_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq B_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq C_i \leq 10 \ 000 \ 000 \ 000
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
X Y Z K
A_1 \ A_2 \ A_3 \ ... \ A_X
B_1 \ B_2 \ B_3 \ ... \ B_Y
C_1 \ C_2 \ C_3 \ ... \ C_Z
Output
Print K lines. The i-th line should contain the i-th value stated in the problem statement.
Examples
Input
2 2 2 8
4 6
1 5
3 8
Output
19
17
15
14
13
12
10
8
Input
3 3 3 5
1 10 100
2 20 200
1 10 100
Output
400
310
310
301
301
Input
10 10 10 20
7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488
1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338
4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736
Output
23379871545
22444657051
22302177772
22095691512
21667941469
21366963278
21287912315
21279176669
21160477018
21085311041
21059876163
21017997739
20703329561
20702387965
20590247696
20383761436
20343962175
20254073196
20210218542
20150096547
Submitted Solution:
```
x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ab=[s+t for s in a for t in b]
ab.sort()
ab=ab[-1:-k-1:-1]
abc=[s+t for s in ab for t in c]
abc.sort()
abc=abc[-1:-k-1:-1]
for i in range(len(abc)):
print(abc[i])
``` | instruction | 0 | 4,021 | 9 | 8,042 |
Yes | output | 1 | 4,021 | 9 | 8,043 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Patisserie AtCoder sells cakes with number-shaped candles. There are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively. Each cake has an integer value called deliciousness, as follows:
* The deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.
* The deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.
* The deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.
Takahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.
There are X \times Y \times Z such ways to choose three cakes.
We will arrange these X \times Y \times Z ways in descending order of the sum of the deliciousness of the cakes.
Print the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.
Constraints
* 1 \leq X \leq 1 \ 000
* 1 \leq Y \leq 1 \ 000
* 1 \leq Z \leq 1 \ 000
* 1 \leq K \leq \min(3 \ 000, X \times Y \times Z)
* 1 \leq A_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq B_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq C_i \leq 10 \ 000 \ 000 \ 000
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
X Y Z K
A_1 \ A_2 \ A_3 \ ... \ A_X
B_1 \ B_2 \ B_3 \ ... \ B_Y
C_1 \ C_2 \ C_3 \ ... \ C_Z
Output
Print K lines. The i-th line should contain the i-th value stated in the problem statement.
Examples
Input
2 2 2 8
4 6
1 5
3 8
Output
19
17
15
14
13
12
10
8
Input
3 3 3 5
1 10 100
2 20 200
1 10 100
Output
400
310
310
301
301
Input
10 10 10 20
7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488
1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338
4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736
Output
23379871545
22444657051
22302177772
22095691512
21667941469
21366963278
21287912315
21279176669
21160477018
21085311041
21059876163
21017997739
20703329561
20702387965
20590247696
20383761436
20343962175
20254073196
20210218542
20150096547
Submitted Solution:
```
x , y ,z , k = map(int, input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
e = [i + j for i in a[:k] for j in b[:k]]
e.sort(reverse=True)
e = e[:k]
ans = [i + j for i in e for j in c[:k]]
ans.sort(reverse=True)
for i in range(k):
print(ans[i])
``` | instruction | 0 | 4,022 | 9 | 8,044 |
Yes | output | 1 | 4,022 | 9 | 8,045 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Patisserie AtCoder sells cakes with number-shaped candles. There are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively. Each cake has an integer value called deliciousness, as follows:
* The deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.
* The deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.
* The deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.
Takahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.
There are X \times Y \times Z such ways to choose three cakes.
We will arrange these X \times Y \times Z ways in descending order of the sum of the deliciousness of the cakes.
Print the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.
Constraints
* 1 \leq X \leq 1 \ 000
* 1 \leq Y \leq 1 \ 000
* 1 \leq Z \leq 1 \ 000
* 1 \leq K \leq \min(3 \ 000, X \times Y \times Z)
* 1 \leq A_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq B_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq C_i \leq 10 \ 000 \ 000 \ 000
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
X Y Z K
A_1 \ A_2 \ A_3 \ ... \ A_X
B_1 \ B_2 \ B_3 \ ... \ B_Y
C_1 \ C_2 \ C_3 \ ... \ C_Z
Output
Print K lines. The i-th line should contain the i-th value stated in the problem statement.
Examples
Input
2 2 2 8
4 6
1 5
3 8
Output
19
17
15
14
13
12
10
8
Input
3 3 3 5
1 10 100
2 20 200
1 10 100
Output
400
310
310
301
301
Input
10 10 10 20
7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488
1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338
4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736
Output
23379871545
22444657051
22302177772
22095691512
21667941469
21366963278
21287912315
21279176669
21160477018
21085311041
21059876163
21017997739
20703329561
20702387965
20590247696
20383761436
20343962175
20254073196
20210218542
20150096547
Submitted Solution:
```
from heapq import*
x,y,z,K=map(int,input().split())
a=(list(map(int,input().split())))
b=(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))[::-1]
d=sorted([q+p for q in a for p in b],reverse=True)[:K]
e=sorted([q+p for q in d for p in c],reverse=True)[:K]
for i in e:
print(i)
``` | instruction | 0 | 4,023 | 9 | 8,046 |
Yes | output | 1 | 4,023 | 9 | 8,047 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Patisserie AtCoder sells cakes with number-shaped candles. There are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively. Each cake has an integer value called deliciousness, as follows:
* The deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.
* The deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.
* The deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.
Takahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.
There are X \times Y \times Z such ways to choose three cakes.
We will arrange these X \times Y \times Z ways in descending order of the sum of the deliciousness of the cakes.
Print the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.
Constraints
* 1 \leq X \leq 1 \ 000
* 1 \leq Y \leq 1 \ 000
* 1 \leq Z \leq 1 \ 000
* 1 \leq K \leq \min(3 \ 000, X \times Y \times Z)
* 1 \leq A_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq B_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq C_i \leq 10 \ 000 \ 000 \ 000
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
X Y Z K
A_1 \ A_2 \ A_3 \ ... \ A_X
B_1 \ B_2 \ B_3 \ ... \ B_Y
C_1 \ C_2 \ C_3 \ ... \ C_Z
Output
Print K lines. The i-th line should contain the i-th value stated in the problem statement.
Examples
Input
2 2 2 8
4 6
1 5
3 8
Output
19
17
15
14
13
12
10
8
Input
3 3 3 5
1 10 100
2 20 200
1 10 100
Output
400
310
310
301
301
Input
10 10 10 20
7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488
1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338
4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736
Output
23379871545
22444657051
22302177772
22095691512
21667941469
21366963278
21287912315
21279176669
21160477018
21085311041
21059876163
21017997739
20703329561
20702387965
20590247696
20383761436
20343962175
20254073196
20210218542
20150096547
Submitted Solution:
```
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
# A.sort(reverse=True)
# B.sort(reverse=True)
# C.sort(reverse=True)
# m = A[0]+B[0]+C[0]
AB = []
for a in A:
for b in B:
AB.append(a+b)
ABC = []
for c in C:
for ab in AB:
ABC.append(c+ab)
ABC.sort(reverse=True)
for i in range(K):
print(ABC[i])
``` | instruction | 0 | 4,024 | 9 | 8,048 |
No | output | 1 | 4,024 | 9 | 8,049 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Patisserie AtCoder sells cakes with number-shaped candles. There are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively. Each cake has an integer value called deliciousness, as follows:
* The deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.
* The deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.
* The deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.
Takahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.
There are X \times Y \times Z such ways to choose three cakes.
We will arrange these X \times Y \times Z ways in descending order of the sum of the deliciousness of the cakes.
Print the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.
Constraints
* 1 \leq X \leq 1 \ 000
* 1 \leq Y \leq 1 \ 000
* 1 \leq Z \leq 1 \ 000
* 1 \leq K \leq \min(3 \ 000, X \times Y \times Z)
* 1 \leq A_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq B_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq C_i \leq 10 \ 000 \ 000 \ 000
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
X Y Z K
A_1 \ A_2 \ A_3 \ ... \ A_X
B_1 \ B_2 \ B_3 \ ... \ B_Y
C_1 \ C_2 \ C_3 \ ... \ C_Z
Output
Print K lines. The i-th line should contain the i-th value stated in the problem statement.
Examples
Input
2 2 2 8
4 6
1 5
3 8
Output
19
17
15
14
13
12
10
8
Input
3 3 3 5
1 10 100
2 20 200
1 10 100
Output
400
310
310
301
301
Input
10 10 10 20
7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488
1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338
4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736
Output
23379871545
22444657051
22302177772
22095691512
21667941469
21366963278
21287912315
21279176669
21160477018
21085311041
21059876163
21017997739
20703329561
20702387965
20590247696
20383761436
20343962175
20254073196
20210218542
20150096547
Submitted Solution:
```
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
x,y,z,k=MI()
A=LI()
B=LI()
C=LI()
lis=[]
for i in range(x):
for j in range(y):
lis.append(A[i]+B[j])
lis.sort(reverse=True)
lisan=[]
for i in range(min(k,x*y)):
for j in range(z):
lisan.append(lis[i]+C[j])
lisan.sort(reverse=True)
for i in range(k):
print(lisan[i])
``` | instruction | 0 | 4,025 | 9 | 8,050 |
No | output | 1 | 4,025 | 9 | 8,051 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Patisserie AtCoder sells cakes with number-shaped candles. There are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively. Each cake has an integer value called deliciousness, as follows:
* The deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.
* The deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.
* The deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.
Takahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.
There are X \times Y \times Z such ways to choose three cakes.
We will arrange these X \times Y \times Z ways in descending order of the sum of the deliciousness of the cakes.
Print the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.
Constraints
* 1 \leq X \leq 1 \ 000
* 1 \leq Y \leq 1 \ 000
* 1 \leq Z \leq 1 \ 000
* 1 \leq K \leq \min(3 \ 000, X \times Y \times Z)
* 1 \leq A_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq B_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq C_i \leq 10 \ 000 \ 000 \ 000
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
X Y Z K
A_1 \ A_2 \ A_3 \ ... \ A_X
B_1 \ B_2 \ B_3 \ ... \ B_Y
C_1 \ C_2 \ C_3 \ ... \ C_Z
Output
Print K lines. The i-th line should contain the i-th value stated in the problem statement.
Examples
Input
2 2 2 8
4 6
1 5
3 8
Output
19
17
15
14
13
12
10
8
Input
3 3 3 5
1 10 100
2 20 200
1 10 100
Output
400
310
310
301
301
Input
10 10 10 20
7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488
1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338
4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736
Output
23379871545
22444657051
22302177772
22095691512
21667941469
21366963278
21287912315
21279176669
21160477018
21085311041
21059876163
21017997739
20703329561
20702387965
20590247696
20383761436
20343962175
20254073196
20210218542
20150096547
Submitted Solution:
```
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
e = []
for va in a:
for vb in b:
e.append(va+vb)
e.sort(reverse=True)
e = e[:k]
d = []
for vc in c:
for ve in e:
d.append(vc+ve)
d.sort(reverse=True)
d = d[:k]
for vd in d:
print(vd)
``` | instruction | 0 | 4,026 | 9 | 8,052 |
No | output | 1 | 4,026 | 9 | 8,053 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Patisserie AtCoder sells cakes with number-shaped candles. There are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively. Each cake has an integer value called deliciousness, as follows:
* The deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.
* The deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.
* The deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.
Takahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.
There are X \times Y \times Z such ways to choose three cakes.
We will arrange these X \times Y \times Z ways in descending order of the sum of the deliciousness of the cakes.
Print the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.
Constraints
* 1 \leq X \leq 1 \ 000
* 1 \leq Y \leq 1 \ 000
* 1 \leq Z \leq 1 \ 000
* 1 \leq K \leq \min(3 \ 000, X \times Y \times Z)
* 1 \leq A_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq B_i \leq 10 \ 000 \ 000 \ 000
* 1 \leq C_i \leq 10 \ 000 \ 000 \ 000
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
X Y Z K
A_1 \ A_2 \ A_3 \ ... \ A_X
B_1 \ B_2 \ B_3 \ ... \ B_Y
C_1 \ C_2 \ C_3 \ ... \ C_Z
Output
Print K lines. The i-th line should contain the i-th value stated in the problem statement.
Examples
Input
2 2 2 8
4 6
1 5
3 8
Output
19
17
15
14
13
12
10
8
Input
3 3 3 5
1 10 100
2 20 200
1 10 100
Output
400
310
310
301
301
Input
10 10 10 20
7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488
1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338
4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736
Output
23379871545
22444657051
22302177772
22095691512
21667941469
21366963278
21287912315
21279176669
21160477018
21085311041
21059876163
21017997739
20703329561
20702387965
20590247696
20383761436
20343962175
20254073196
20210218542
20150096547
Submitted Solution:
```
def d_cake_123_binary_search(X, Y, Z, K, A, B, C):
# editionalの解法4 O(K^2log(max(P))
# 参考: https://atcoder.jp/contests/abc123/submissions/4871511
import bisect
ab = sorted([e1 + e2 for e2 in B for e1 in A]) # A, Bの要素は全部調べる
# rejected 以上の値は、美味しさの合計がそれ以上である個数がK個未満である
accepted, rejected = -1, 10**11
while abs(accepted - rejected) > 1:
mid = (accepted + rejected) // 2
count = sum([len(ab) - bisect.bisect_left(ab, mid - e) for e in C])
if count >= K:
accepted = mid
else:
rejected = mid
ans = []
for e in C:
idx = bisect.bisect_left(ab, accepted - e)
for i in range(idx, len(ab)):
ans.append(e + ab[i])
ans.sort(reverse=True)
return ' '.join(map(str, ans))
X, Y, Z, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
print(d_cake_123_binary_search(X, Y, Z, K, A, B, C))
``` | instruction | 0 | 4,027 | 9 | 8,054 |
No | output | 1 | 4,027 | 9 | 8,055 |
Provide a correct Python 3 solution for this coding contest problem.
In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions).
A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is three characters long, and if the first character in S is `o`, it means the ramen should be topped with boiled egg; if that character is `x`, it means the ramen should not be topped with boiled egg. Similarly, the second and third characters in S mean the presence or absence of sliced pork and green onions on top of the ramen.
Write a program that, when S is given, prints the price of the corresponding bowl of ramen.
Constraints
* S is a string of length 3.
* Each character in S is `o` or `x`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the price of the bowl of ramen corresponding to S.
Examples
Input
oxo
Output
900
Input
ooo
Output
1000
Input
xxx
Output
700 | instruction | 0 | 4,049 | 9 | 8,098 |
"Correct Solution:
```
n=list(input()).count("o")
print(700+(n*100))
``` | output | 1 | 4,049 | 9 | 8,099 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions).
A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is three characters long, and if the first character in S is `o`, it means the ramen should be topped with boiled egg; if that character is `x`, it means the ramen should not be topped with boiled egg. Similarly, the second and third characters in S mean the presence or absence of sliced pork and green onions on top of the ramen.
Write a program that, when S is given, prints the price of the corresponding bowl of ramen.
Constraints
* S is a string of length 3.
* Each character in S is `o` or `x`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the price of the bowl of ramen corresponding to S.
Examples
Input
oxo
Output
900
Input
ooo
Output
1000
Input
xxx
Output
700
Submitted Solution:
```
a=input()
print(700+100*int(a.count("o")))
``` | instruction | 0 | 4,052 | 9 | 8,104 |
Yes | output | 1 | 4,052 | 9 | 8,105 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions).
A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is three characters long, and if the first character in S is `o`, it means the ramen should be topped with boiled egg; if that character is `x`, it means the ramen should not be topped with boiled egg. Similarly, the second and third characters in S mean the presence or absence of sliced pork and green onions on top of the ramen.
Write a program that, when S is given, prints the price of the corresponding bowl of ramen.
Constraints
* S is a string of length 3.
* Each character in S is `o` or `x`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the price of the bowl of ramen corresponding to S.
Examples
Input
oxo
Output
900
Input
ooo
Output
1000
Input
xxx
Output
700
Submitted Solution:
```
S = input()
print(700 + S.count("o") * 100)
``` | instruction | 0 | 4,053 | 9 | 8,106 |
Yes | output | 1 | 4,053 | 9 | 8,107 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions).
A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is three characters long, and if the first character in S is `o`, it means the ramen should be topped with boiled egg; if that character is `x`, it means the ramen should not be topped with boiled egg. Similarly, the second and third characters in S mean the presence or absence of sliced pork and green onions on top of the ramen.
Write a program that, when S is given, prints the price of the corresponding bowl of ramen.
Constraints
* S is a string of length 3.
* Each character in S is `o` or `x`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the price of the bowl of ramen corresponding to S.
Examples
Input
oxo
Output
900
Input
ooo
Output
1000
Input
xxx
Output
700
Submitted Solution:
```
print(700 + 100 * input().strip().count('o'))
``` | instruction | 0 | 4,054 | 9 | 8,108 |
Yes | output | 1 | 4,054 | 9 | 8,109 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions).
A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is three characters long, and if the first character in S is `o`, it means the ramen should be topped with boiled egg; if that character is `x`, it means the ramen should not be topped with boiled egg. Similarly, the second and third characters in S mean the presence or absence of sliced pork and green onions on top of the ramen.
Write a program that, when S is given, prints the price of the corresponding bowl of ramen.
Constraints
* S is a string of length 3.
* Each character in S is `o` or `x`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the price of the bowl of ramen corresponding to S.
Examples
Input
oxo
Output
900
Input
ooo
Output
1000
Input
xxx
Output
700
Submitted Solution:
```
print(700 + 100 * list(input()).count("o"))
``` | instruction | 0 | 4,055 | 9 | 8,110 |
Yes | output | 1 | 4,055 | 9 | 8,111 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions).
A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is three characters long, and if the first character in S is `o`, it means the ramen should be topped with boiled egg; if that character is `x`, it means the ramen should not be topped with boiled egg. Similarly, the second and third characters in S mean the presence or absence of sliced pork and green onions on top of the ramen.
Write a program that, when S is given, prints the price of the corresponding bowl of ramen.
Constraints
* S is a string of length 3.
* Each character in S is `o` or `x`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the price of the bowl of ramen corresponding to S.
Examples
Input
oxo
Output
900
Input
ooo
Output
1000
Input
xxx
Output
700
Submitted Solution:
```
S = list(map(str, input()))
count = 0
for i in range(3):
if S[i] = "o":
count += 1
print(700+count*100)
``` | instruction | 0 | 4,056 | 9 | 8,112 |
No | output | 1 | 4,056 | 9 | 8,113 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions).
A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is three characters long, and if the first character in S is `o`, it means the ramen should be topped with boiled egg; if that character is `x`, it means the ramen should not be topped with boiled egg. Similarly, the second and third characters in S mean the presence or absence of sliced pork and green onions on top of the ramen.
Write a program that, when S is given, prints the price of the corresponding bowl of ramen.
Constraints
* S is a string of length 3.
* Each character in S is `o` or `x`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the price of the bowl of ramen corresponding to S.
Examples
Input
oxo
Output
900
Input
ooo
Output
1000
Input
xxx
Output
700
Submitted Solution:
```
N,C = map(int,input().split())
lists = [list(map(lambda x:int(x),input().split())) for i in range(N)]
cal = 0
cals = []
if lists[0][0] < lists[0][1]:
cal = cal - lists[0][0] + lists[0][1]
cals.append(cal)
for i in range(1,N):
cal = cal - (lists[i][0] - lists[i-1][0]) + lists[i][1]
cals.append(cal)
print(max(cals))
``` | instruction | 0 | 4,057 | 9 | 8,114 |
No | output | 1 | 4,057 | 9 | 8,115 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions).
A customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is three characters long, and if the first character in S is `o`, it means the ramen should be topped with boiled egg; if that character is `x`, it means the ramen should not be topped with boiled egg. Similarly, the second and third characters in S mean the presence or absence of sliced pork and green onions on top of the ramen.
Write a program that, when S is given, prints the price of the corresponding bowl of ramen.
Constraints
* S is a string of length 3.
* Each character in S is `o` or `x`.
Input
Input is given from Standard Input in the following format:
S
Output
Print the price of the bowl of ramen corresponding to S.
Examples
Input
oxo
Output
900
Input
ooo
Output
1000
Input
xxx
Output
700
Submitted Solution:
```
s=input()
print(500 + s.count("o")*100)
``` | instruction | 0 | 4,058 | 9 | 8,116 |
No | output | 1 | 4,058 | 9 | 8,117 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.