message stringlengths 2 44.5k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 42 109k | cluster float64 5 5 | __index_level_0__ int64 84 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let {\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If there are multiple pairs that maximize the value, any of them is accepted.
Constraints
* 2 \leq n \leq 10^5
* 0 \leq a_i \leq 10^9
* a_1,a_2,...,a_n are pairwise distinct.
* 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
Print a_i and a_j that you selected, with a space in between.
Examples
Input
5
6 9 4 2 11
Output
11 6
Input
2
100 0
Output
100 0
Submitted Solution:
```
from bisect import bisect_left
n = int(input())
A = list(map(int,input().split()))
A.sort()
y = max(A)
idx = bisect_left(A, y//2)
print(y,A[idx])
``` | instruction | 0 | 24,587 | 5 | 49,174 |
No | output | 1 | 24,587 | 5 | 49,175 |
Provide a correct Python 3 solution for this coding contest problem.
Sitting in a station waiting room, Joisino is gazing at her train ticket.
The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).
In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.
The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.
Constraints
* 0≤A,B,C,D≤9
* All input values are integers.
* It is guaranteed that there is a solution.
Input
Input is given from Standard Input in the following format:
ABCD
Output
Print the formula you made, including the part `=7`.
Use the signs `+` and `-`.
Do not print a space between a digit and a sign.
Examples
Input
1222
Output
1+2+2+2=7
Input
0290
Output
0-2+9+0=7
Input
3242
Output
3+2+4-2=7 | instruction | 0 | 24,590 | 5 | 49,180 |
"Correct Solution:
```
A=input()
for i in range(8):
f=A[0]
for j in range(3):
f+=("-+")[(i>>j)&1]+A[j+1]
if eval(f)==7:
print(f+"=7")
break
``` | output | 1 | 24,590 | 5 | 49,181 |
Provide a correct Python 3 solution for this coding contest problem.
Sitting in a station waiting room, Joisino is gazing at her train ticket.
The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).
In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.
The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.
Constraints
* 0≤A,B,C,D≤9
* All input values are integers.
* It is guaranteed that there is a solution.
Input
Input is given from Standard Input in the following format:
ABCD
Output
Print the formula you made, including the part `=7`.
Use the signs `+` and `-`.
Do not print a space between a digit and a sign.
Examples
Input
1222
Output
1+2+2+2=7
Input
0290
Output
0-2+9+0=7
Input
3242
Output
3+2+4-2=7 | instruction | 0 | 24,591 | 5 | 49,182 |
"Correct Solution:
```
def f(a,b,i):
if i==4:
if b==7:
print(a+"=7")
exit()
else:
return f(a+"+"+s[i],b+int(s[i]),i+1),f(a+"-"+s[i],b-int(s[i]),i+1)
s=input()
f(s[0],int(s[0]),1)
``` | output | 1 | 24,591 | 5 | 49,183 |
Provide a correct Python 3 solution for this coding contest problem.
Sitting in a station waiting room, Joisino is gazing at her train ticket.
The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).
In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.
The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.
Constraints
* 0≤A,B,C,D≤9
* All input values are integers.
* It is guaranteed that there is a solution.
Input
Input is given from Standard Input in the following format:
ABCD
Output
Print the formula you made, including the part `=7`.
Use the signs `+` and `-`.
Do not print a space between a digit and a sign.
Examples
Input
1222
Output
1+2+2+2=7
Input
0290
Output
0-2+9+0=7
Input
3242
Output
3+2+4-2=7 | instruction | 0 | 24,592 | 5 | 49,184 |
"Correct Solution:
```
def a(s,i):
if i == l-1:
if eval(s) == 7:
print(s+"=7")
exit()
return
a(s+"+"+N[i+1],i+1)
a(s+"-"+N[i+1],i+1)
N = input()
l = len(N)
a(N[0],0)
``` | output | 1 | 24,592 | 5 | 49,185 |
Provide a correct Python 3 solution for this coding contest problem.
Sitting in a station waiting room, Joisino is gazing at her train ticket.
The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).
In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.
The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.
Constraints
* 0≤A,B,C,D≤9
* All input values are integers.
* It is guaranteed that there is a solution.
Input
Input is given from Standard Input in the following format:
ABCD
Output
Print the formula you made, including the part `=7`.
Use the signs `+` and `-`.
Do not print a space between a digit and a sign.
Examples
Input
1222
Output
1+2+2+2=7
Input
0290
Output
0-2+9+0=7
Input
3242
Output
3+2+4-2=7 | instruction | 0 | 24,593 | 5 | 49,186 |
"Correct Solution:
```
s=input()
for i in range(8):
y="".join([s[k]+"+-"[i>>k&1]for k in range(3)]+[s[-1]])
if eval(y)==7:
print(y+"=7")
exit()
``` | output | 1 | 24,593 | 5 | 49,187 |
Provide a correct Python 3 solution for this coding contest problem.
Sitting in a station waiting room, Joisino is gazing at her train ticket.
The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).
In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.
The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.
Constraints
* 0≤A,B,C,D≤9
* All input values are integers.
* It is guaranteed that there is a solution.
Input
Input is given from Standard Input in the following format:
ABCD
Output
Print the formula you made, including the part `=7`.
Use the signs `+` and `-`.
Do not print a space between a digit and a sign.
Examples
Input
1222
Output
1+2+2+2=7
Input
0290
Output
0-2+9+0=7
Input
3242
Output
3+2+4-2=7 | instruction | 0 | 24,594 | 5 | 49,188 |
"Correct Solution:
```
a,b,c,d = tuple(input())
import itertools
n = 3
for i in itertools.product(['-','+'], repeat=n):
ans = a + i[0] + b + i[1] + c + i[2] + d
if eval(ans) == 7:
print(ans+'=7')
exit()
``` | output | 1 | 24,594 | 5 | 49,189 |
Provide a correct Python 3 solution for this coding contest problem.
Sitting in a station waiting room, Joisino is gazing at her train ticket.
The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).
In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.
The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.
Constraints
* 0≤A,B,C,D≤9
* All input values are integers.
* It is guaranteed that there is a solution.
Input
Input is given from Standard Input in the following format:
ABCD
Output
Print the formula you made, including the part `=7`.
Use the signs `+` and `-`.
Do not print a space between a digit and a sign.
Examples
Input
1222
Output
1+2+2+2=7
Input
0290
Output
0-2+9+0=7
Input
3242
Output
3+2+4-2=7 | instruction | 0 | 24,595 | 5 | 49,190 |
"Correct Solution:
```
A,B,C,D=input()
op=['+++','++-','+-+','-++','+--','-+-','--+','---']
for op1,op2,op3 in op:
ex=A+op1+B+op2+C+op3+D
if eval(ex)==7:
break
print(ex+'=7')
``` | output | 1 | 24,595 | 5 | 49,191 |
Provide a correct Python 3 solution for this coding contest problem.
Sitting in a station waiting room, Joisino is gazing at her train ticket.
The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).
In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.
The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.
Constraints
* 0≤A,B,C,D≤9
* All input values are integers.
* It is guaranteed that there is a solution.
Input
Input is given from Standard Input in the following format:
ABCD
Output
Print the formula you made, including the part `=7`.
Use the signs `+` and `-`.
Do not print a space between a digit and a sign.
Examples
Input
1222
Output
1+2+2+2=7
Input
0290
Output
0-2+9+0=7
Input
3242
Output
3+2+4-2=7 | instruction | 0 | 24,596 | 5 | 49,192 |
"Correct Solution:
```
n=input()
l=[1,-1]
l1=[0,"+","-"]
s=""
for i in l:
for j in l:
for k in l:
if int(n[0])+i*int(n[1])+j*int(n[2])+k*int(n[3])==7:
s=n[0]+l1[i]+n[1]+l1[j]+n[2]+l1[k]+n[3]+"=7"
print(s)
``` | output | 1 | 24,596 | 5 | 49,193 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sitting in a station waiting room, Joisino is gazing at her train ticket.
The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).
In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.
The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.
Constraints
* 0≤A,B,C,D≤9
* All input values are integers.
* It is guaranteed that there is a solution.
Input
Input is given from Standard Input in the following format:
ABCD
Output
Print the formula you made, including the part `=7`.
Use the signs `+` and `-`.
Do not print a space between a digit and a sign.
Examples
Input
1222
Output
1+2+2+2=7
Input
0290
Output
0-2+9+0=7
Input
3242
Output
3+2+4-2=7
Submitted Solution:
```
from itertools import product
A,B,C,D = list(input())
for x in product(("+","-"),repeat=3):
if eval(A+x[0]+B+x[1]+C+x[2]+D)==7:
print(A+x[0]+B+x[1]+C+x[2]+D+"=7")
break
``` | instruction | 0 | 24,597 | 5 | 49,194 |
Yes | output | 1 | 24,597 | 5 | 49,195 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sitting in a station waiting room, Joisino is gazing at her train ticket.
The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).
In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.
The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.
Constraints
* 0≤A,B,C,D≤9
* All input values are integers.
* It is guaranteed that there is a solution.
Input
Input is given from Standard Input in the following format:
ABCD
Output
Print the formula you made, including the part `=7`.
Use the signs `+` and `-`.
Do not print a space between a digit and a sign.
Examples
Input
1222
Output
1+2+2+2=7
Input
0290
Output
0-2+9+0=7
Input
3242
Output
3+2+4-2=7
Submitted Solution:
```
a,b,c,d=input()
for f in [a+p+b+q+c+r+d for p in'+-'for q in'+-'for r in'+-']:
if eval(f)==7:print(f+'=7');break
``` | instruction | 0 | 24,598 | 5 | 49,196 |
Yes | output | 1 | 24,598 | 5 | 49,197 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sitting in a station waiting room, Joisino is gazing at her train ticket.
The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).
In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.
The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.
Constraints
* 0≤A,B,C,D≤9
* All input values are integers.
* It is guaranteed that there is a solution.
Input
Input is given from Standard Input in the following format:
ABCD
Output
Print the formula you made, including the part `=7`.
Use the signs `+` and `-`.
Do not print a space between a digit and a sign.
Examples
Input
1222
Output
1+2+2+2=7
Input
0290
Output
0-2+9+0=7
Input
3242
Output
3+2+4-2=7
Submitted Solution:
```
from itertools import product
A, B, C, D = list(input())
for x, y, z in product(["+", "-"], repeat=3):
eqn = A + x + B + y + C + z + D
if eval(eqn) == 7:
print(f"{eqn}=7")
break
``` | instruction | 0 | 24,599 | 5 | 49,198 |
Yes | output | 1 | 24,599 | 5 | 49,199 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sitting in a station waiting room, Joisino is gazing at her train ticket.
The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).
In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.
The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.
Constraints
* 0≤A,B,C,D≤9
* All input values are integers.
* It is guaranteed that there is a solution.
Input
Input is given from Standard Input in the following format:
ABCD
Output
Print the formula you made, including the part `=7`.
Use the signs `+` and `-`.
Do not print a space between a digit and a sign.
Examples
Input
1222
Output
1+2+2+2=7
Input
0290
Output
0-2+9+0=7
Input
3242
Output
3+2+4-2=7
Submitted Solution:
```
import itertools
a,b,c,d = list(input())
for ops in itertools.product(['+','-'],repeat=3):
eq = a+ops[0]+b+ops[1]+c+ops[2]+d
x = eval(eq)
if x==7:
break
answer = eq+'=7'
print(answer)
``` | instruction | 0 | 24,600 | 5 | 49,200 |
Yes | output | 1 | 24,600 | 5 | 49,201 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sitting in a station waiting room, Joisino is gazing at her train ticket.
The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).
In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.
The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.
Constraints
* 0≤A,B,C,D≤9
* All input values are integers.
* It is guaranteed that there is a solution.
Input
Input is given from Standard Input in the following format:
ABCD
Output
Print the formula you made, including the part `=7`.
Use the signs `+` and `-`.
Do not print a space between a digit and a sign.
Examples
Input
1222
Output
1+2+2+2=7
Input
0290
Output
0-2+9+0=7
Input
3242
Output
3+2+4-2=7
Submitted Solution:
```
a = list(input())
op = ['-'] * 3
for i in range(2**3):
ans = int(a[0])
for j in range(3):
if 1 & (i>>j):
ans += int(a[3-j])
op[2-j] = '+'
else:
ans -= int(a[3-j])
if ans == 7:
break
print(a[0] + op[0] + a[1] + op[1] + a[2] + op[2] +a[3] + "=7")
``` | instruction | 0 | 24,602 | 5 | 49,204 |
No | output | 1 | 24,602 | 5 | 49,205 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sitting in a station waiting room, Joisino is gazing at her train ticket.
The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).
In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.
The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.
Constraints
* 0≤A,B,C,D≤9
* All input values are integers.
* It is guaranteed that there is a solution.
Input
Input is given from Standard Input in the following format:
ABCD
Output
Print the formula you made, including the part `=7`.
Use the signs `+` and `-`.
Do not print a space between a digit and a sign.
Examples
Input
1222
Output
1+2+2+2=7
Input
0290
Output
0-2+9+0=7
Input
3242
Output
3+2+4-2=7
Submitted Solution:
```
num = input()
ls = [0] * 3
for i in range(2 ** 3):
make7 = int(num[0])
for j in range(3):
if (i >> j) & 1:
make7 += int(num[j+1])
ls[j] = "+"
else:
make7 -= int(num[j+1])
ls[j] = "-"
if make7 == 7:
print(num[0] + ls[0] + num[1] + ls[1] + num[2] + ls[2] + num[3])
exit()
``` | instruction | 0 | 24,603 | 5 | 49,206 |
No | output | 1 | 24,603 | 5 | 49,207 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sitting in a station waiting room, Joisino is gazing at her train ticket.
The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).
In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with `+` or `-` so that the formula holds.
The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.
Constraints
* 0≤A,B,C,D≤9
* All input values are integers.
* It is guaranteed that there is a solution.
Input
Input is given from Standard Input in the following format:
ABCD
Output
Print the formula you made, including the part `=7`.
Use the signs `+` and `-`.
Do not print a space between a digit and a sign.
Examples
Input
1222
Output
1+2+2+2=7
Input
0290
Output
0-2+9+0=7
Input
3242
Output
3+2+4-2=7
Submitted Solution:
```
s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])
if a + b + c + d == 7:
print(str(a)+"+"+str(b)+"+"str(c)+"+"str(d)+"=7")
elif a + b + c - d == 7:
print(str(a)+"+"+str(b)+"+"str(c)+"-"str(d)+"=7")
elif a + b - c + d == 7:
print(str(a)+"+"+str(b)+"-"str(c)+"+"str(d)+"=7")
elif a - b + c + d == 7:
print(str(a)+"-"+str(b)+"+"str(c)+"+"str(d)+"=7")
elif a + b - c - d == 7:
print(str(a)+"+"+str(b)+"-"str(c)+"-"str(d)+"=7")
elif a - b + c - d == 7:
print(str(a)+"-"+str(b)+"+"str(c)+"-"str(d)+"=7")
elif a - b - c - d == 7:
print(str(a)+"+"+str(b)+"+"str(c)+"+"str(d)+"=7")
``` | instruction | 0 | 24,604 | 5 | 49,208 |
No | output | 1 | 24,604 | 5 | 49,209 |
Provide a correct Python 3 solution for this coding contest problem.
You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When you finish answering the questions, your answers will be immediately judged and your grade will be displayed... if everything goes well.
However, the examination system is actually flawed, and if your grade is a multiple of 10, the system displays 0 as your grade. Otherwise, your grade is displayed correctly. In this situation, what is the maximum value that can be displayed as your grade?
Constraints
* All input values are integers.
* 1 ≤ N ≤ 100
* 1 ≤ s_i ≤ 100
Input
Input is given from Standard Input in the following format:
N
s_1
s_2
:
s_N
Output
Print the maximum value that can be displayed as your grade.
Examples
Input
3
5
10
15
Output
25
Input
3
10
10
15
Output
35
Input
3
10
20
30
Output
0 | instruction | 0 | 24,605 | 5 | 49,210 |
"Correct Solution:
```
l=sorted(map(int,open(0).read().split()[1:]))
a=sum(l)
if a%10:print(a);exit()
for t in l:
if t%10:print(a-t);exit()
print(0)
``` | output | 1 | 24,605 | 5 | 49,211 |
Provide a correct Python 3 solution for this coding contest problem.
You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When you finish answering the questions, your answers will be immediately judged and your grade will be displayed... if everything goes well.
However, the examination system is actually flawed, and if your grade is a multiple of 10, the system displays 0 as your grade. Otherwise, your grade is displayed correctly. In this situation, what is the maximum value that can be displayed as your grade?
Constraints
* All input values are integers.
* 1 ≤ N ≤ 100
* 1 ≤ s_i ≤ 100
Input
Input is given from Standard Input in the following format:
N
s_1
s_2
:
s_N
Output
Print the maximum value that can be displayed as your grade.
Examples
Input
3
5
10
15
Output
25
Input
3
10
10
15
Output
35
Input
3
10
20
30
Output
0 | instruction | 0 | 24,606 | 5 | 49,212 |
"Correct Solution:
```
n=int(input())
li=[]
for i in range(n):
li.append(int(input()))
out=sum(li)
if out%10!=0:
print(out)
else:
li.sort()
for i in li:
if i%10!=0:
print(out-i)
break
else:
print(0)
``` | output | 1 | 24,606 | 5 | 49,213 |
Provide a correct Python 3 solution for this coding contest problem.
You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When you finish answering the questions, your answers will be immediately judged and your grade will be displayed... if everything goes well.
However, the examination system is actually flawed, and if your grade is a multiple of 10, the system displays 0 as your grade. Otherwise, your grade is displayed correctly. In this situation, what is the maximum value that can be displayed as your grade?
Constraints
* All input values are integers.
* 1 ≤ N ≤ 100
* 1 ≤ s_i ≤ 100
Input
Input is given from Standard Input in the following format:
N
s_1
s_2
:
s_N
Output
Print the maximum value that can be displayed as your grade.
Examples
Input
3
5
10
15
Output
25
Input
3
10
10
15
Output
35
Input
3
10
20
30
Output
0 | instruction | 0 | 24,607 | 5 | 49,214 |
"Correct Solution:
```
n=int(input())
a=[0]*n
for i in range(n):
a[i]=int(input())
a=sorted(a)
S=sum(a)
if S%10!=0:
print(S)
exit()
else:
for i in range(n):
if (S-a[i])%10:
print(S-a[i])
exit()
print(0)
``` | output | 1 | 24,607 | 5 | 49,215 |
Provide a correct Python 3 solution for this coding contest problem.
You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When you finish answering the questions, your answers will be immediately judged and your grade will be displayed... if everything goes well.
However, the examination system is actually flawed, and if your grade is a multiple of 10, the system displays 0 as your grade. Otherwise, your grade is displayed correctly. In this situation, what is the maximum value that can be displayed as your grade?
Constraints
* All input values are integers.
* 1 ≤ N ≤ 100
* 1 ≤ s_i ≤ 100
Input
Input is given from Standard Input in the following format:
N
s_1
s_2
:
s_N
Output
Print the maximum value that can be displayed as your grade.
Examples
Input
3
5
10
15
Output
25
Input
3
10
10
15
Output
35
Input
3
10
20
30
Output
0 | instruction | 0 | 24,608 | 5 | 49,216 |
"Correct Solution:
```
n=int(input())
a=[int(input()) for i in range(n)]
if sum(a)%10!=0:
print(sum(a))
else:
a=sorted(a)
for i in a:
if i%10!=0:
print(sum(a)-i)
exit()
print(0)
``` | output | 1 | 24,608 | 5 | 49,217 |
Provide a correct Python 3 solution for this coding contest problem.
You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When you finish answering the questions, your answers will be immediately judged and your grade will be displayed... if everything goes well.
However, the examination system is actually flawed, and if your grade is a multiple of 10, the system displays 0 as your grade. Otherwise, your grade is displayed correctly. In this situation, what is the maximum value that can be displayed as your grade?
Constraints
* All input values are integers.
* 1 ≤ N ≤ 100
* 1 ≤ s_i ≤ 100
Input
Input is given from Standard Input in the following format:
N
s_1
s_2
:
s_N
Output
Print the maximum value that can be displayed as your grade.
Examples
Input
3
5
10
15
Output
25
Input
3
10
10
15
Output
35
Input
3
10
20
30
Output
0 | instruction | 0 | 24,609 | 5 | 49,218 |
"Correct Solution:
```
n = int(input())
s = sorted([int(input()) for _ in range(n)])
a = sum(s)
if a % 10:
print(a)
else:
for si in s:
if si % 10:
print(a - si)
break
else:
print(0)
``` | output | 1 | 24,609 | 5 | 49,219 |
Provide a correct Python 3 solution for this coding contest problem.
You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When you finish answering the questions, your answers will be immediately judged and your grade will be displayed... if everything goes well.
However, the examination system is actually flawed, and if your grade is a multiple of 10, the system displays 0 as your grade. Otherwise, your grade is displayed correctly. In this situation, what is the maximum value that can be displayed as your grade?
Constraints
* All input values are integers.
* 1 ≤ N ≤ 100
* 1 ≤ s_i ≤ 100
Input
Input is given from Standard Input in the following format:
N
s_1
s_2
:
s_N
Output
Print the maximum value that can be displayed as your grade.
Examples
Input
3
5
10
15
Output
25
Input
3
10
10
15
Output
35
Input
3
10
20
30
Output
0 | instruction | 0 | 24,610 | 5 | 49,220 |
"Correct Solution:
```
import sys
n=int(input())
a=[int(input())for _ in range(n)]
a.sort()
ans=0
if sum(a)%10==0:
for i in a:
if i%10!=0:
print(sum(a)-i)
sys.exit()
print(0)
else:
print(sum(a))
``` | output | 1 | 24,610 | 5 | 49,221 |
Provide a correct Python 3 solution for this coding contest problem.
You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When you finish answering the questions, your answers will be immediately judged and your grade will be displayed... if everything goes well.
However, the examination system is actually flawed, and if your grade is a multiple of 10, the system displays 0 as your grade. Otherwise, your grade is displayed correctly. In this situation, what is the maximum value that can be displayed as your grade?
Constraints
* All input values are integers.
* 1 ≤ N ≤ 100
* 1 ≤ s_i ≤ 100
Input
Input is given from Standard Input in the following format:
N
s_1
s_2
:
s_N
Output
Print the maximum value that can be displayed as your grade.
Examples
Input
3
5
10
15
Output
25
Input
3
10
10
15
Output
35
Input
3
10
20
30
Output
0 | instruction | 0 | 24,611 | 5 | 49,222 |
"Correct Solution:
```
n = int(input())
notlist = []
s = 0
for i in range(n):
a = int(input())
if a%10 != 0:
notlist.append(a)
s += a
print(s if s%10 != 0 else s-min(notlist) if notlist != [] else 0)
``` | output | 1 | 24,611 | 5 | 49,223 |
Provide a correct Python 3 solution for this coding contest problem.
You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either "correct" or "incorrect", and your grade will be the sum of the points allocated to questions that are answered correctly. When you finish answering the questions, your answers will be immediately judged and your grade will be displayed... if everything goes well.
However, the examination system is actually flawed, and if your grade is a multiple of 10, the system displays 0 as your grade. Otherwise, your grade is displayed correctly. In this situation, what is the maximum value that can be displayed as your grade?
Constraints
* All input values are integers.
* 1 ≤ N ≤ 100
* 1 ≤ s_i ≤ 100
Input
Input is given from Standard Input in the following format:
N
s_1
s_2
:
s_N
Output
Print the maximum value that can be displayed as your grade.
Examples
Input
3
5
10
15
Output
25
Input
3
10
10
15
Output
35
Input
3
10
20
30
Output
0 | instruction | 0 | 24,612 | 5 | 49,224 |
"Correct Solution:
```
n=int(input())
s=sorted([int(input()) for _ in [0]*n])
ans=sum(s)
for i in s:
if ans%10>0:
print(ans)
exit()
else:
if i%10>0:
print(ans-i)
exit()
print(0)
``` | output | 1 | 24,612 | 5 | 49,225 |
Provide a correct Python 3 solution for this coding contest problem.
Set
Given the sequence a_1, a_2, .., a_N.
How many values are there in this sequence?
input
N
a_1 a_2 ... a_N
output
Output the number of types of values in the sequence.
Constraint
* 1 \ leq N \ leq 10 ^ 5
* 1 \ leq a_i \ leq 10 ^ 9
Input example
6
8 6 9 1 2 1
Output example
Five
Example
Input
6
8 6 9 1 2 1
Output
5 | instruction | 0 | 24,706 | 5 | 49,412 |
"Correct Solution:
```
n = int(input())
s = set()
l = list(map(int, input().split()))
for i in range(n):
s.add(l[i])
print(len(s))
``` | output | 1 | 24,706 | 5 | 49,413 |
Provide a correct Python 3 solution for this coding contest problem.
Set
Given the sequence a_1, a_2, .., a_N.
How many values are there in this sequence?
input
N
a_1 a_2 ... a_N
output
Output the number of types of values in the sequence.
Constraint
* 1 \ leq N \ leq 10 ^ 5
* 1 \ leq a_i \ leq 10 ^ 9
Input example
6
8 6 9 1 2 1
Output example
Five
Example
Input
6
8 6 9 1 2 1
Output
5 | instruction | 0 | 24,707 | 5 | 49,414 |
"Correct Solution:
```
N = int(input())
a = set([int(x) for x in input().split()])
print(len(a))
``` | output | 1 | 24,707 | 5 | 49,415 |
Provide a correct Python 3 solution for this coding contest problem.
Set
Given the sequence a_1, a_2, .., a_N.
How many values are there in this sequence?
input
N
a_1 a_2 ... a_N
output
Output the number of types of values in the sequence.
Constraint
* 1 \ leq N \ leq 10 ^ 5
* 1 \ leq a_i \ leq 10 ^ 9
Input example
6
8 6 9 1 2 1
Output example
Five
Example
Input
6
8 6 9 1 2 1
Output
5 | instruction | 0 | 24,708 | 5 | 49,416 |
"Correct Solution:
```
n = int(input())
l = [int(i) for i in input().split()]
print(len(set(l)))
``` | output | 1 | 24,708 | 5 | 49,417 |
Provide a correct Python 3 solution for this coding contest problem.
Set
Given the sequence a_1, a_2, .., a_N.
How many values are there in this sequence?
input
N
a_1 a_2 ... a_N
output
Output the number of types of values in the sequence.
Constraint
* 1 \ leq N \ leq 10 ^ 5
* 1 \ leq a_i \ leq 10 ^ 9
Input example
6
8 6 9 1 2 1
Output example
Five
Example
Input
6
8 6 9 1 2 1
Output
5 | instruction | 0 | 24,709 | 5 | 49,418 |
"Correct Solution:
```
input();print(len(set(list(map(int,input().split())))))
``` | output | 1 | 24,709 | 5 | 49,419 |
Provide a correct Python 3 solution for this coding contest problem.
Set
Given the sequence a_1, a_2, .., a_N.
How many values are there in this sequence?
input
N
a_1 a_2 ... a_N
output
Output the number of types of values in the sequence.
Constraint
* 1 \ leq N \ leq 10 ^ 5
* 1 \ leq a_i \ leq 10 ^ 9
Input example
6
8 6 9 1 2 1
Output example
Five
Example
Input
6
8 6 9 1 2 1
Output
5 | instruction | 0 | 24,710 | 5 | 49,420 |
"Correct Solution:
```
N = int(input())
a = list(map(int,input().split()))
ans = len(set(a))
print(ans)
``` | output | 1 | 24,710 | 5 | 49,421 |
Provide a correct Python 3 solution for this coding contest problem.
Set
Given the sequence a_1, a_2, .., a_N.
How many values are there in this sequence?
input
N
a_1 a_2 ... a_N
output
Output the number of types of values in the sequence.
Constraint
* 1 \ leq N \ leq 10 ^ 5
* 1 \ leq a_i \ leq 10 ^ 9
Input example
6
8 6 9 1 2 1
Output example
Five
Example
Input
6
8 6 9 1 2 1
Output
5 | instruction | 0 | 24,711 | 5 | 49,422 |
"Correct Solution:
```
def num():
return int(input())
def nums():
return list(map(int,input().split()))
"""
N = num()
A = nums()
print(A.index(min(A))+1)
"""
N = num()
A = set(nums())
print(len(A))
``` | output | 1 | 24,711 | 5 | 49,423 |
Provide a correct Python 3 solution for this coding contest problem.
Set
Given the sequence a_1, a_2, .., a_N.
How many values are there in this sequence?
input
N
a_1 a_2 ... a_N
output
Output the number of types of values in the sequence.
Constraint
* 1 \ leq N \ leq 10 ^ 5
* 1 \ leq a_i \ leq 10 ^ 9
Input example
6
8 6 9 1 2 1
Output example
Five
Example
Input
6
8 6 9 1 2 1
Output
5 | instruction | 0 | 24,712 | 5 | 49,424 |
"Correct Solution:
```
n=int(input())
print(len(set(map(int, input().split()))))
``` | output | 1 | 24,712 | 5 | 49,425 |
Provide a correct Python 3 solution for this coding contest problem.
Set
Given the sequence a_1, a_2, .., a_N.
How many values are there in this sequence?
input
N
a_1 a_2 ... a_N
output
Output the number of types of values in the sequence.
Constraint
* 1 \ leq N \ leq 10 ^ 5
* 1 \ leq a_i \ leq 10 ^ 9
Input example
6
8 6 9 1 2 1
Output example
Five
Example
Input
6
8 6 9 1 2 1
Output
5 | instruction | 0 | 24,713 | 5 | 49,426 |
"Correct Solution:
```
n = int(input())
a = list(map(int,input().split()))
print(len(set(a)))
``` | output | 1 | 24,713 | 5 | 49,427 |
Provide a correct Python 3 solution for this coding contest problem.
There is a sequence $A = a_0, a_1, ..., a_{n-1}$. You are given the following information and questions.
* relate$(x, y, z)$: $a_y$ is greater than $a_x$ by $z$
* diff$(x, y)$: report the difference between $a_x$ and $a_y$ $(a_y - a_x)$
Constraints
* $2 \leq n \leq 100,000$
* $1 \leq q \leq 200,000$
* $0 \leq x, y < n$
* $x \ne y$
* $0 \leq z \leq 10000$
* There are no inconsistency in the given information
Input
$n \; q$
$query_1$
$query_2$
:
$query_q$
In the first line, $n$ and $q$ are given. Then, $q$ information/questions are given in the following format.
0 $x \; y\; z$
or
1 $x \; y$
where '0' of the first digit denotes the relate information and '1' denotes the diff question.
Output
For each diff question, print the difference between $a_x$ and $a_y$ $(a_y - a_x)$.
Example
Input
5 6
0 0 2 5
0 1 2 3
1 0 1
1 1 3
0 1 4 8
1 0 4
Output
2
?
10 | instruction | 0 | 24,715 | 5 | 49,430 |
"Correct Solution:
```
[p, rank] = [[], []]
[n, q] = list(map(int, input().split()))
w = [0 for i in range(n)]
def findSet(x):
global p
if x != p[x]:
pre_parent = p[x]
p[x] = findSet(p[x])
w[x] += w[pre_parent]
return p[x]
def makeSet(x):
global p, rank
p.append(x)
rank.append(0)
def link(x, y, z):
global p, rank, w
if rank[x] > rank[y]:
p[y] = x
w[y] = z
else:
p[x] = y
w[x] = -z
if rank[x] == rank[y]:
rank[y] += 1
def relate(x, y, z):
global w
root_x = findSet(x)
root_y = findSet(y)
z += w[x]
z -= w[y]
link(root_x, root_y, z)
def same(x, y):
if findSet(x) == findSet(y):
return 1
else:
return 0
def difference(x, y):
if same(x, y) == 1:
global w
return w[y] - w[x]
else:
return "?"
for i in range(n):
makeSet(i)
for i in range(q):
data = list(map(int, input().split()))
if data[0] == 0:
relate(data[1], data[2], data[3])
else:
print(difference(data[1], data[2]))
``` | output | 1 | 24,715 | 5 | 49,431 |
Provide a correct Python 3 solution for this coding contest problem.
There is a sequence $A = a_0, a_1, ..., a_{n-1}$. You are given the following information and questions.
* relate$(x, y, z)$: $a_y$ is greater than $a_x$ by $z$
* diff$(x, y)$: report the difference between $a_x$ and $a_y$ $(a_y - a_x)$
Constraints
* $2 \leq n \leq 100,000$
* $1 \leq q \leq 200,000$
* $0 \leq x, y < n$
* $x \ne y$
* $0 \leq z \leq 10000$
* There are no inconsistency in the given information
Input
$n \; q$
$query_1$
$query_2$
:
$query_q$
In the first line, $n$ and $q$ are given. Then, $q$ information/questions are given in the following format.
0 $x \; y\; z$
or
1 $x \; y$
where '0' of the first digit denotes the relate information and '1' denotes the diff question.
Output
For each diff question, print the difference between $a_x$ and $a_y$ $(a_y - a_x)$.
Example
Input
5 6
0 0 2 5
0 1 2 3
1 0 1
1 1 3
0 1 4 8
1 0 4
Output
2
?
10 | instruction | 0 | 24,718 | 5 | 49,436 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(10000000)
input = sys.stdin.readline
def diff(node_a, node_b):
root_a, cost_a = node_a.root(0)
root_b, cost_b = node_b.root(0)
if root_a == root_b:
return True, cost_a - cost_b
else:
return False, cost_a - cost_b
def merge(node_a, node_b, weight):
root_a, cost_a = node_a.root(0)
root_b, cost_b = node_b.root(0)
root_a.weight = weight + cost_b - cost_a
root_a.is_root = False
root_a.parent = root_b
class Node:
def __init__(self):
self.is_root = True
self.parent = None
self.weight = 0
def root(self, cost):
if self.is_root:
return self, cost
root, max_ = self.parent.root(cost + self.weight)
self.parent = root
self.weight = max_ - cost
return root, max_
def main():
n, q = map(int, input().split())
nodes = [Node() for i in range(n)]
for i in range(q):
query = list(map(int, input().split()))
if query[0] == 0:
x, y, z = query[1:]
if not diff(nodes[x], nodes[y])[0]:
merge(nodes[x], nodes[y], z)
else:
x, y = query[1:]
jud, ans = diff(nodes[x], nodes[y])
if jud:
print(ans)
else:
print("?")
if __name__ == "__main__":
main()
``` | output | 1 | 24,718 | 5 | 49,437 |
Provide a correct Python 3 solution for this coding contest problem.
There is a sequence $A = a_0, a_1, ..., a_{n-1}$. You are given the following information and questions.
* relate$(x, y, z)$: $a_y$ is greater than $a_x$ by $z$
* diff$(x, y)$: report the difference between $a_x$ and $a_y$ $(a_y - a_x)$
Constraints
* $2 \leq n \leq 100,000$
* $1 \leq q \leq 200,000$
* $0 \leq x, y < n$
* $x \ne y$
* $0 \leq z \leq 10000$
* There are no inconsistency in the given information
Input
$n \; q$
$query_1$
$query_2$
:
$query_q$
In the first line, $n$ and $q$ are given. Then, $q$ information/questions are given in the following format.
0 $x \; y\; z$
or
1 $x \; y$
where '0' of the first digit denotes the relate information and '1' denotes the diff question.
Output
For each diff question, print the difference between $a_x$ and $a_y$ $(a_y - a_x)$.
Example
Input
5 6
0 0 2 5
0 1 2 3
1 0 1
1 1 3
0 1 4 8
1 0 4
Output
2
?
10 | instruction | 0 | 24,719 | 5 | 49,438 |
"Correct Solution:
```
MAX = 100003
ws = [0 for i in range(MAX)]
par = [-1 for i in range(MAX*2)]
def weight(x):
root(x)
return ws[x]
def root(x):
if par[x] < 0: return x
p = root(par[x])
ws[x] = ws[x] + ws[par[x]]
par[x] = p
return par[x]
def unite(y, x, z):
z = z + weight(x)
z = z - weight(y)
x = root(x)
y = root(y)
if x == y: return 0
if par[y] < par[x]:
tmp = x
x = y
y = tmp
z = -z
par[x] = par[x] + par[y]
par[y] = x
ws[y] = z
return 1
def diff(x,y):
if root(x) != root(y) :return 0
ans = ws[x] - ws[y]
return 1 ,ans
if __name__=='__main__':
global ans
N, Q = (int(x) for x in input().split())
for q in range(Q):
t, *cmd = (int(x) for x in input().split())
if t:
x, y = cmd
z = diff(x, y)
if z==False :print("?")
else :print(z[1])
else:
x, y, z = cmd
unite(x, y, z)
``` | output | 1 | 24,719 | 5 | 49,439 |
Provide a correct Python 3 solution for this coding contest problem.
There is a sequence $A = a_0, a_1, ..., a_{n-1}$. You are given the following information and questions.
* relate$(x, y, z)$: $a_y$ is greater than $a_x$ by $z$
* diff$(x, y)$: report the difference between $a_x$ and $a_y$ $(a_y - a_x)$
Constraints
* $2 \leq n \leq 100,000$
* $1 \leq q \leq 200,000$
* $0 \leq x, y < n$
* $x \ne y$
* $0 \leq z \leq 10000$
* There are no inconsistency in the given information
Input
$n \; q$
$query_1$
$query_2$
:
$query_q$
In the first line, $n$ and $q$ are given. Then, $q$ information/questions are given in the following format.
0 $x \; y\; z$
or
1 $x \; y$
where '0' of the first digit denotes the relate information and '1' denotes the diff question.
Output
For each diff question, print the difference between $a_x$ and $a_y$ $(a_y - a_x)$.
Example
Input
5 6
0 0 2 5
0 1 2 3
1 0 1
1 1 3
0 1 4 8
1 0 4
Output
2
?
10 | instruction | 0 | 24,721 | 5 | 49,442 |
"Correct Solution:
```
def union(x, y, t):
x, t_x = findSet(x)
y, t_y = findSet(y)
link(x, t_x, y, t_y, t)
def link(x, d_x, y, d_y, t):
#print('', 'x', 'y')
#print('', x, y)
#print('', d_x, d_y, t)
if r[x] > r[y]:
p[y] = x
d[y] = d_x - d_y - t
#print('', y, '->', p[y], '=', d[y], '\n')
else:
p[x] = y
d[x] = d_y - d_x + t
if r[x] == r[y]: r[y] = r[y] + 1
#print('', x, '->', p[x], '=', d[x], '\n')
def findSet(x):
if x != p[x]:
p[x], t = findSet(p[x])
d[x] += t
return p[x], d[x]
def diff(x, y):
x, d_x = findSet(x)
y, d_y = findSet(y)
if x == y:
return d_x - d_y
else:
return '?'
if __name__ == '__main__':
p, r, d = [], [], []
n_set, n_quare = map(int, input().split())
for i in range(n_set):
p.append(i)
r.append(0)
d.append(0)
for i in range(n_quare):
l = input().split()
if len(l) == 4:
_, x, y, t = map(int, l)
union(x, y, t)
else:
_, x, y = map(int, l)
print(diff(x, y))
``` | output | 1 | 24,721 | 5 | 49,443 |
Provide a correct Python 3 solution for this coding contest problem.
Multiplication of Big Integers II
Given two integers $A$ and $B$, compute the product, $A \times B$.
Input
Two integers $A$ and $B$ separated by a space character are given in a line.
Output
Print the product in a line.
Constraints
* $-1 \times 10^{200000} \leq A, B \leq 10^{200000}$
Sample Input 1
5 8
Sample Output 1
40
Sample Input 2
100 25
Sample Output 2
2500
Sample Input 3
-1 0
Sample Output 3
0
Sample Input 4
12 -3
Sample Output 4
-36
Example
Input
5 8
Output
40 | instruction | 0 | 24,730 | 5 | 49,460 |
"Correct Solution:
```
a=[int(i) for i in input().split()]
print(a[0]*a[1])
``` | output | 1 | 24,730 | 5 | 49,461 |
Provide a correct Python 3 solution for this coding contest problem.
Multiplication of Big Integers II
Given two integers $A$ and $B$, compute the product, $A \times B$.
Input
Two integers $A$ and $B$ separated by a space character are given in a line.
Output
Print the product in a line.
Constraints
* $-1 \times 10^{200000} \leq A, B \leq 10^{200000}$
Sample Input 1
5 8
Sample Output 1
40
Sample Input 2
100 25
Sample Output 2
2500
Sample Input 3
-1 0
Sample Output 3
0
Sample Input 4
12 -3
Sample Output 4
-36
Example
Input
5 8
Output
40 | instruction | 0 | 24,731 | 5 | 49,462 |
"Correct Solution:
```
print(eval(input().replace(' ','*')))
``` | output | 1 | 24,731 | 5 | 49,463 |
Provide a correct Python 3 solution for this coding contest problem.
Multiplication of Big Integers II
Given two integers $A$ and $B$, compute the product, $A \times B$.
Input
Two integers $A$ and $B$ separated by a space character are given in a line.
Output
Print the product in a line.
Constraints
* $-1 \times 10^{200000} \leq A, B \leq 10^{200000}$
Sample Input 1
5 8
Sample Output 1
40
Sample Input 2
100 25
Sample Output 2
2500
Sample Input 3
-1 0
Sample Output 3
0
Sample Input 4
12 -3
Sample Output 4
-36
Example
Input
5 8
Output
40 | instruction | 0 | 24,732 | 5 | 49,464 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
"""
Big Integers - Multiplication of Big Integers II
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_2_F&lang=jp
"""
import sys
def main(args):
A, B = map(int, input().split())
print(A * B)
if __name__ == '__main__':
main(sys.argv[1:])
``` | output | 1 | 24,732 | 5 | 49,465 |
Provide a correct Python 3 solution for this coding contest problem.
Multiplication of Big Integers II
Given two integers $A$ and $B$, compute the product, $A \times B$.
Input
Two integers $A$ and $B$ separated by a space character are given in a line.
Output
Print the product in a line.
Constraints
* $-1 \times 10^{200000} \leq A, B \leq 10^{200000}$
Sample Input 1
5 8
Sample Output 1
40
Sample Input 2
100 25
Sample Output 2
2500
Sample Input 3
-1 0
Sample Output 3
0
Sample Input 4
12 -3
Sample Output 4
-36
Example
Input
5 8
Output
40 | instruction | 0 | 24,733 | 5 | 49,466 |
"Correct Solution:
```
#標準入力
a,b = map(int,input().split())
#a*bを出力する
print(a * b)
``` | output | 1 | 24,733 | 5 | 49,467 |
Provide a correct Python 3 solution for this coding contest problem.
Multiplication of Big Integers II
Given two integers $A$ and $B$, compute the product, $A \times B$.
Input
Two integers $A$ and $B$ separated by a space character are given in a line.
Output
Print the product in a line.
Constraints
* $-1 \times 10^{200000} \leq A, B \leq 10^{200000}$
Sample Input 1
5 8
Sample Output 1
40
Sample Input 2
100 25
Sample Output 2
2500
Sample Input 3
-1 0
Sample Output 3
0
Sample Input 4
12 -3
Sample Output 4
-36
Example
Input
5 8
Output
40 | instruction | 0 | 24,734 | 5 | 49,468 |
"Correct Solution:
```
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l(): #intのlist
return list(map(int,input().split()))
def m(): #複数文字
return map(int,input().split())
def onem(): #Nとかの取得
return int(input())
def s(x): #圧縮
a = []
aa = x[0]
su = 1
for i in range(len(x)-1):
if aa == x[i+1]:
a.append([aa,su])
aa = x[i+1]
su = 1
else:
su += 1
a.append([aa,su])
return a
def jo(x): #listをスペースごとに分ける
return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
return max(map(max,x))
n,m= m()
print(n*m)
``` | output | 1 | 24,734 | 5 | 49,469 |
Provide a correct Python 3 solution for this coding contest problem.
Multiplication of Big Integers II
Given two integers $A$ and $B$, compute the product, $A \times B$.
Input
Two integers $A$ and $B$ separated by a space character are given in a line.
Output
Print the product in a line.
Constraints
* $-1 \times 10^{200000} \leq A, B \leq 10^{200000}$
Sample Input 1
5 8
Sample Output 1
40
Sample Input 2
100 25
Sample Output 2
2500
Sample Input 3
-1 0
Sample Output 3
0
Sample Input 4
12 -3
Sample Output 4
-36
Example
Input
5 8
Output
40 | instruction | 0 | 24,735 | 5 | 49,470 |
"Correct Solution:
```
a, b=input().split(' ')
a=int(a)
b=int(b)
print(a*b)
``` | output | 1 | 24,735 | 5 | 49,471 |
Provide a correct Python 3 solution for this coding contest problem.
Multiplication of Big Integers II
Given two integers $A$ and $B$, compute the product, $A \times B$.
Input
Two integers $A$ and $B$ separated by a space character are given in a line.
Output
Print the product in a line.
Constraints
* $-1 \times 10^{200000} \leq A, B \leq 10^{200000}$
Sample Input 1
5 8
Sample Output 1
40
Sample Input 2
100 25
Sample Output 2
2500
Sample Input 3
-1 0
Sample Output 3
0
Sample Input 4
12 -3
Sample Output 4
-36
Example
Input
5 8
Output
40 | instruction | 0 | 24,736 | 5 | 49,472 |
"Correct Solution:
```
a,b=input().split(" ")
a=int(a)
b=int(b)
print(a*b)
``` | output | 1 | 24,736 | 5 | 49,473 |
Provide a correct Python 3 solution for this coding contest problem.
Multiplication of Big Integers II
Given two integers $A$ and $B$, compute the product, $A \times B$.
Input
Two integers $A$ and $B$ separated by a space character are given in a line.
Output
Print the product in a line.
Constraints
* $-1 \times 10^{200000} \leq A, B \leq 10^{200000}$
Sample Input 1
5 8
Sample Output 1
40
Sample Input 2
100 25
Sample Output 2
2500
Sample Input 3
-1 0
Sample Output 3
0
Sample Input 4
12 -3
Sample Output 4
-36
Example
Input
5 8
Output
40 | instruction | 0 | 24,737 | 5 | 49,474 |
"Correct Solution:
```
from decimal import *
getcontext().prec = 2000001
a, b = map(Decimal, input().split())
ans = a * b
if a == 0 or b == 0:
ans = Decimal(0)
print(ans)
``` | output | 1 | 24,737 | 5 | 49,475 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Multiplication of Big Integers II
Given two integers $A$ and $B$, compute the product, $A \times B$.
Input
Two integers $A$ and $B$ separated by a space character are given in a line.
Output
Print the product in a line.
Constraints
* $-1 \times 10^{200000} \leq A, B \leq 10^{200000}$
Sample Input 1
5 8
Sample Output 1
40
Sample Input 2
100 25
Sample Output 2
2500
Sample Input 3
-1 0
Sample Output 3
0
Sample Input 4
12 -3
Sample Output 4
-36
Example
Input
5 8
Output
40
Submitted Solution:
```
a = [int(i) for i in input().split()];
print (a[0] * a[1]);
``` | instruction | 0 | 24,738 | 5 | 49,476 |
Yes | output | 1 | 24,738 | 5 | 49,477 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Multiplication of Big Integers II
Given two integers $A$ and $B$, compute the product, $A \times B$.
Input
Two integers $A$ and $B$ separated by a space character are given in a line.
Output
Print the product in a line.
Constraints
* $-1 \times 10^{200000} \leq A, B \leq 10^{200000}$
Sample Input 1
5 8
Sample Output 1
40
Sample Input 2
100 25
Sample Output 2
2500
Sample Input 3
-1 0
Sample Output 3
0
Sample Input 4
12 -3
Sample Output 4
-36
Example
Input
5 8
Output
40
Submitted Solution:
```
A,B = [int(i) for i in input().split()]
print(A*B)
``` | instruction | 0 | 24,739 | 5 | 49,478 |
Yes | output | 1 | 24,739 | 5 | 49,479 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Multiplication of Big Integers II
Given two integers $A$ and $B$, compute the product, $A \times B$.
Input
Two integers $A$ and $B$ separated by a space character are given in a line.
Output
Print the product in a line.
Constraints
* $-1 \times 10^{200000} \leq A, B \leq 10^{200000}$
Sample Input 1
5 8
Sample Output 1
40
Sample Input 2
100 25
Sample Output 2
2500
Sample Input 3
-1 0
Sample Output 3
0
Sample Input 4
12 -3
Sample Output 4
-36
Example
Input
5 8
Output
40
Submitted Solution:
```
def main():
A, B = map(int, input().split())
print(A*B)
if __name__ == '__main__':
main()
``` | instruction | 0 | 24,740 | 5 | 49,480 |
Yes | output | 1 | 24,740 | 5 | 49,481 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Multiplication of Big Integers II
Given two integers $A$ and $B$, compute the product, $A \times B$.
Input
Two integers $A$ and $B$ separated by a space character are given in a line.
Output
Print the product in a line.
Constraints
* $-1 \times 10^{200000} \leq A, B \leq 10^{200000}$
Sample Input 1
5 8
Sample Output 1
40
Sample Input 2
100 25
Sample Output 2
2500
Sample Input 3
-1 0
Sample Output 3
0
Sample Input 4
12 -3
Sample Output 4
-36
Example
Input
5 8
Output
40
Submitted Solution:
```
import math
n, m = map(int, input().split())
print(n * m)
``` | instruction | 0 | 24,741 | 5 | 49,482 |
Yes | output | 1 | 24,741 | 5 | 49,483 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Multiplication of Big Integers II
Given two integers $A$ and $B$, compute the product, $A \times B$.
Input
Two integers $A$ and $B$ separated by a space character are given in a line.
Output
Print the product in a line.
Constraints
* $-1 \times 10^{200000} \leq A, B \leq 10^{200000}$
Sample Input 1
5 8
Sample Output 1
40
Sample Input 2
100 25
Sample Output 2
2500
Sample Input 3
-1 0
Sample Output 3
0
Sample Input 4
12 -3
Sample Output 4
-36
Example
Input
5 8
Output
40
Submitted Solution:
```
a,b = map(int,input().split())
c = abs(a) // abs(b)
print(-c if a * b < 0 else c)
``` | instruction | 0 | 24,742 | 5 | 49,484 |
No | output | 1 | 24,742 | 5 | 49,485 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given n positive integers a_1, …, a_n, and an integer k ≥ 2. Count the number of pairs i, j such that 1 ≤ i < j ≤ n, and there exists an integer x such that a_i ⋅ a_j = x^k.
Input
The first line contains two integers n and k (2 ≤ n ≤ 10^5, 2 ≤ k ≤ 100).
The second line contains n integers a_1, …, a_n (1 ≤ a_i ≤ 10^5).
Output
Print a single integer — the number of suitable pairs.
Example
Input
6 3
1 3 9 8 24 1
Output
5
Note
In the sample case, the suitable pairs are:
* a_1 ⋅ a_4 = 8 = 2^3;
* a_1 ⋅ a_6 = 1 = 1^3;
* a_2 ⋅ a_3 = 27 = 3^3;
* a_3 ⋅ a_5 = 216 = 6^3;
* a_4 ⋅ a_6 = 8 = 2^3.
Submitted Solution:
```
n,k=map(int,input().split())
A=list(map(int,input().split()))
import math
from collections import Counter
C=Counter()
for x in A:
L=int(math.sqrt(x))
FACT=dict()
for i in range(2,L+2):
while x%i==0:
FACT[i]=FACT.get(i,0)+1
x=x//i
if x!=1:
FACT[x]=FACT.get(x,0)+1
for f in list(FACT):
FACT[f]%=k
if FACT[f]==0:
del FACT[f]
if FACT==dict():
C[(1,1)]+=1
else:
RET=1
ALL=1
for f in FACT:
RET*=f**FACT[f]
ALL*=f**k
C[(RET,ALL//RET)]+=1
ANS=0
ANS2=0
for x,y in C:
if x==y:
ANS+=C[(x,y)]
else:
ANS2+=C[(x,y)]*C[(y,x)]
print(ANS+ANS2//2)
``` | instruction | 0 | 24,867 | 5 | 49,734 |
No | output | 1 | 24,867 | 5 | 49,735 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a matrix a consisting of positive integers. It has n rows and m columns.
Construct a matrix b consisting of positive integers. It should have the same size as a, and the following conditions should be met:
* 1 ≤ b_{i,j} ≤ 10^6;
* b_{i,j} is a multiple of a_{i,j};
* the absolute value of the difference between numbers in any adjacent pair of cells (two cells that share the same side) in b is equal to k^4 for some integer k ≥ 1 (k is not necessarily the same for all pairs, it is own for each pair).
We can show that the answer always exists.
Input
The first line contains two integers n and m (2 ≤ n,m ≤ 500).
Each of the following n lines contains m integers. The j-th integer in the i-th line is a_{i,j} (1 ≤ a_{i,j} ≤ 16).
Output
The output should contain n lines each containing m integers. The j-th integer in the i-th line should be b_{i,j}.
Examples
Input
2 2
1 2
2 3
Output
1 2
2 3
Input
2 3
16 16 16
16 16 16
Output
16 32 48
32 48 64
Input
2 2
3 11
12 8
Output
327 583
408 664
Note
In the first example, the matrix a can be used as the matrix b, because the absolute value of the difference between numbers in any adjacent pair of cells is 1 = 1^4.
In the third example:
* 327 is a multiple of 3, 583 is a multiple of 11, 408 is a multiple of 12, 664 is a multiple of 8;
* |408 - 327| = 3^4, |583 - 327| = 4^4, |664 - 408| = 4^4, |664 - 583| = 3^4.
Submitted Solution:
```
# ========== //\\ //|| ||====//||
# || // \\ || || // ||
# || //====\\ || || // ||
# || // \\ || || // ||
# ========== // \\ ======== ||//====||
# code
inn = lambda : int(input())
inm = lambda : map(int, input().split())
ins = lambda : str(input())
ina = lambda : list(map(int, input().split()))
lcm = 720720
def solve():
n,m = inm()
a = [0 for i in range(n)]
for i,v in enumerate(a):
a[i] = ina()
for i in range(n):
for j in range(m):
a[i][j] = lcm + (a[i][j] ** 4 if (i + j) % 2 else 0)
for i in a:
print(*i)
def main():
t = 1
# t = int(input())
for _ in range(t):
solve()
if __name__ == "__main__":
main()
``` | instruction | 0 | 24,992 | 5 | 49,984 |
Yes | output | 1 | 24,992 | 5 | 49,985 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.