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 |
|---|---|---|---|---|---|
Provide a correct Python 3 solution for this coding contest problem.
We have N logs of lengths A_1,A_2,\cdots A_N.
We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t.
Find the shortest possible length of the longest log after at most K cuts, and print it after rounding up to an integer.
Constraints
* 1 \leq N \leq 2 \times 10^5
* 0 \leq K \leq 10^9
* 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 K
A_1 A_2 \cdots A_N
Output
Print an integer representing the answer.
Examples
Input
2 3
7 9
Output
4
Input
3 0
3 4 5
Output
5
Input
10 10
158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 262703497 211047202
Output
292638192 | instruction | 0 | 102,690 | 5 | 205,380 |
"Correct Solution:
```
n, k = map(int, input().split())
a = list(map(int, input().split()))
def c(x):
cnt=0
for i in a:
cnt += (i - 1) // x
return cnt <= k
l, r = 0, max(a)
while l + 1 < r:
mid = (l + r) // 2
if c(mid):
r = mid
else:
l = mid
print(r)
``` | output | 1 | 102,690 | 5 | 205,381 |
Provide a correct Python 3 solution for this coding contest problem.
We have N logs of lengths A_1,A_2,\cdots A_N.
We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t.
Find the shortest possible length of the longest log after at most K cuts, and print it after rounding up to an integer.
Constraints
* 1 \leq N \leq 2 \times 10^5
* 0 \leq K \leq 10^9
* 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 K
A_1 A_2 \cdots A_N
Output
Print an integer representing the answer.
Examples
Input
2 3
7 9
Output
4
Input
3 0
3 4 5
Output
5
Input
10 10
158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 262703497 211047202
Output
292638192 | instruction | 0 | 102,691 | 5 | 205,382 |
"Correct Solution:
```
n,k = map(int,input().split())
a = list(map(int,input().split()))
def ok(arg):
cnt = 0
for log in a:
cnt += -(-log//arg)
cnt -= 1
return cnt<=k
st,en = 0,max(a)
mid = 0
while en-st>1:
mid = (en+st)//2
if ok(mid):
en = mid
else:
st = mid
print(en)
``` | output | 1 | 102,691 | 5 | 205,383 |
Provide a correct Python 3 solution for this coding contest problem.
We have N logs of lengths A_1,A_2,\cdots A_N.
We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t.
Find the shortest possible length of the longest log after at most K cuts, and print it after rounding up to an integer.
Constraints
* 1 \leq N \leq 2 \times 10^5
* 0 \leq K \leq 10^9
* 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 K
A_1 A_2 \cdots A_N
Output
Print an integer representing the answer.
Examples
Input
2 3
7 9
Output
4
Input
3 0
3 4 5
Output
5
Input
10 10
158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 262703497 211047202
Output
292638192 | instruction | 0 | 102,692 | 5 | 205,384 |
"Correct Solution:
```
import math
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
l, r = (A[0], 1)
def is_ok(c):
x = sum([math.ceil(a/c)-1 for a in A])
return x <= K
l, r = max(A), 0
while l - r > 1:
c = (l + r) // 2
if is_ok(c):
l = c
else:
r = c
print(l)
``` | output | 1 | 102,692 | 5 | 205,385 |
Provide a correct Python 3 solution for this coding contest problem.
We have N logs of lengths A_1,A_2,\cdots A_N.
We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t.
Find the shortest possible length of the longest log after at most K cuts, and print it after rounding up to an integer.
Constraints
* 1 \leq N \leq 2 \times 10^5
* 0 \leq K \leq 10^9
* 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 K
A_1 A_2 \cdots A_N
Output
Print an integer representing the answer.
Examples
Input
2 3
7 9
Output
4
Input
3 0
3 4 5
Output
5
Input
10 10
158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 262703497 211047202
Output
292638192 | instruction | 0 | 102,693 | 5 | 205,386 |
"Correct Solution:
```
n,k=map(int,input().split())
A=list(map(int,input().split()))
ng=0
ok=10**10
while ok-ng>1:
mid=(ok+ng)//2
c=0
for i in range(n):
c=c+(A[i]+mid-1)//mid
if c>k+n:
ng=mid
else:
ok=mid
print(ok)
``` | output | 1 | 102,693 | 5 | 205,387 |
Provide a correct Python 3 solution for this coding contest problem.
We have N logs of lengths A_1,A_2,\cdots A_N.
We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t.
Find the shortest possible length of the longest log after at most K cuts, and print it after rounding up to an integer.
Constraints
* 1 \leq N \leq 2 \times 10^5
* 0 \leq K \leq 10^9
* 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 K
A_1 A_2 \cdots A_N
Output
Print an integer representing the answer.
Examples
Input
2 3
7 9
Output
4
Input
3 0
3 4 5
Output
5
Input
10 10
158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 262703497 211047202
Output
292638192 | instruction | 0 | 102,694 | 5 | 205,388 |
"Correct Solution:
```
n, k, *aa = map(int, open(0).read().split())
imp = 0
psbl = 10**9
while psbl - imp > 1:
mid = (psbl + imp) // 2
cost = sum(0--a//mid - 1 for a in aa)
if cost <= k:
psbl = mid
else:
imp = mid
print(psbl)
``` | output | 1 | 102,694 | 5 | 205,389 |
Provide a correct Python 3 solution for this coding contest problem.
We have N logs of lengths A_1,A_2,\cdots A_N.
We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t.
Find the shortest possible length of the longest log after at most K cuts, and print it after rounding up to an integer.
Constraints
* 1 \leq N \leq 2 \times 10^5
* 0 \leq K \leq 10^9
* 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 K
A_1 A_2 \cdots A_N
Output
Print an integer representing the answer.
Examples
Input
2 3
7 9
Output
4
Input
3 0
3 4 5
Output
5
Input
10 10
158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 262703497 211047202
Output
292638192 | instruction | 0 | 102,695 | 5 | 205,390 |
"Correct Solution:
```
import bisect
n,k = map(int, input().split())
a = sorted(list(map(int, input().split())))
def cnt(x):
ret = 0
for ai in a:
ret += (ai+(x-1))//x - 1
return ret
ok, ng = a[-1], 0
while ok - ng > 1:
nw = (ok + ng) // 2
if cnt(nw)<=k:
ok = nw
else:
ng = nw
print(ok)
``` | output | 1 | 102,695 | 5 | 205,391 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N logs of lengths A_1,A_2,\cdots A_N.
We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t.
Find the shortest possible length of the longest log after at most K cuts, and print it after rounding up to an integer.
Constraints
* 1 \leq N \leq 2 \times 10^5
* 0 \leq K \leq 10^9
* 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 K
A_1 A_2 \cdots A_N
Output
Print an integer representing the answer.
Examples
Input
2 3
7 9
Output
4
Input
3 0
3 4 5
Output
5
Input
10 10
158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 262703497 211047202
Output
292638192
Submitted Solution:
```
f=lambda:[*map(int,input().split())]
n,k=f()
a=f()
a=[i*100 for i in a]
# Binary Search
def ok(x):
c=0
for i in a:
c+=0--i//x
return c<=n+k
l,r=0,10**11+1
while r-l>1:
m=l+r>>1
if ok(m): r=m
else: l=m
t=0--r//100
print(t-ok(t-1) if t>1 else t)
``` | instruction | 0 | 102,696 | 5 | 205,392 |
Yes | output | 1 | 102,696 | 5 | 205,393 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N logs of lengths A_1,A_2,\cdots A_N.
We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t.
Find the shortest possible length of the longest log after at most K cuts, and print it after rounding up to an integer.
Constraints
* 1 \leq N \leq 2 \times 10^5
* 0 \leq K \leq 10^9
* 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 K
A_1 A_2 \cdots A_N
Output
Print an integer representing the answer.
Examples
Input
2 3
7 9
Output
4
Input
3 0
3 4 5
Output
5
Input
10 10
158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 262703497 211047202
Output
292638192
Submitted Solution:
```
import math
n, k = map(int, input().split())
a = list(map(int, input().split()))
def solve(x):
kk = k
for i in a:
kk -= (i+x-1)//x - 1
return kk>=0
ok = 10**9
ng = 0
while abs(ok-ng)>1:
mid = (ok+ng)//2
if solve(mid):
ok = mid
else:
ng = mid
print(ok)
``` | instruction | 0 | 102,697 | 5 | 205,394 |
Yes | output | 1 | 102,697 | 5 | 205,395 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N logs of lengths A_1,A_2,\cdots A_N.
We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t.
Find the shortest possible length of the longest log after at most K cuts, and print it after rounding up to an integer.
Constraints
* 1 \leq N \leq 2 \times 10^5
* 0 \leq K \leq 10^9
* 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 K
A_1 A_2 \cdots A_N
Output
Print an integer representing the answer.
Examples
Input
2 3
7 9
Output
4
Input
3 0
3 4 5
Output
5
Input
10 10
158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 262703497 211047202
Output
292638192
Submitted Solution:
```
import heapq
import bisect
n,k=map(int, input().split())
A=[int(i) for i in input().split()]
ng=0
ok = max(A)
while(ng+1!=ok):
mid = (ok+ng)//2
ans = 0
for i in A:
ans += 0--i//mid-1
if(ans<=k):
ok = mid
else:
ng = mid
print(ok)
``` | instruction | 0 | 102,698 | 5 | 205,396 |
Yes | output | 1 | 102,698 | 5 | 205,397 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N logs of lengths A_1,A_2,\cdots A_N.
We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t.
Find the shortest possible length of the longest log after at most K cuts, and print it after rounding up to an integer.
Constraints
* 1 \leq N \leq 2 \times 10^5
* 0 \leq K \leq 10^9
* 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 K
A_1 A_2 \cdots A_N
Output
Print an integer representing the answer.
Examples
Input
2 3
7 9
Output
4
Input
3 0
3 4 5
Output
5
Input
10 10
158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 262703497 211047202
Output
292638192
Submitted Solution:
```
N,K = map(int,input().split())
A = list(map(int,input().split()))
l = 1
r = 10**9 + 1
while l < r:
mid = (l + r) // 2
counter = 0
for i in range(N):
if A[i] > mid:
counter += A[i] // mid
if counter <= K:
r = mid
else:
l = mid + 1
print(l)
``` | instruction | 0 | 102,699 | 5 | 205,398 |
Yes | output | 1 | 102,699 | 5 | 205,399 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N logs of lengths A_1,A_2,\cdots A_N.
We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t.
Find the shortest possible length of the longest log after at most K cuts, and print it after rounding up to an integer.
Constraints
* 1 \leq N \leq 2 \times 10^5
* 0 \leq K \leq 10^9
* 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 K
A_1 A_2 \cdots A_N
Output
Print an integer representing the answer.
Examples
Input
2 3
7 9
Output
4
Input
3 0
3 4 5
Output
5
Input
10 10
158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 262703497 211047202
Output
292638192
Submitted Solution:
```
# Binary Search
def isOK(i, key):
'''
問題に応じて返り値を設定
'''
cnt = 0
for v in a:
cnt += (v + i - 1) // i - 1
return cnt <= key
def binary_search(key):
'''
条件を満たす最小/最大のindexを求める
O(logN)
'''
ok = 10 ** 9 # 条件を満たすindexの上限値/下限値
ng = -1 # 条件を満たさないindexの下限値-1/上限値+1
while abs(ok - ng) > 1:
mid = (ok + ng) // 2
if isOK(mid, key): # midが条件を満たすか否か
ok = mid
else:
ng = mid
return ok
n, k = map(int, input().split())
a = list(map(int, input().split()))
print(binary_search(k))
``` | instruction | 0 | 102,701 | 5 | 205,402 |
No | output | 1 | 102,701 | 5 | 205,403 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N logs of lengths A_1,A_2,\cdots A_N.
We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t.
Find the shortest possible length of the longest log after at most K cuts, and print it after rounding up to an integer.
Constraints
* 1 \leq N \leq 2 \times 10^5
* 0 \leq K \leq 10^9
* 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 K
A_1 A_2 \cdots A_N
Output
Print an integer representing the answer.
Examples
Input
2 3
7 9
Output
4
Input
3 0
3 4 5
Output
5
Input
10 10
158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 262703497 211047202
Output
292638192
Submitted Solution:
```
n, k = map(int, input().split())
a = list(map(int, input().split()))
def check(x):
c = 0
for i in range(n):
c += a[i]//x
if c <= k:
return True
else:
return False
mx = max(a)
mn = 0
ans = [mx]
while mn <= mx:
m = (mx+mn)//2
if check(m):
mx = m - 1
ans.append(m)
else:
mn = m + 1
print (min(ans))
``` | instruction | 0 | 102,703 | 5 | 205,406 |
No | output | 1 | 102,703 | 5 | 205,407 |
Provide a correct Python 3 solution for this coding contest problem.
We have N+M balls, each of which has an integer written on it.
It is known that:
* The numbers written on N of the balls are even.
* The numbers written on M of the balls are odd.
Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.
It can be shown that this count does not depend on the actual values written on the balls.
Constraints
* 0 \leq N,M \leq 100
* 2 \leq N+M
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N M
Output
Print the answer.
Examples
Input
2 1
Output
1
Input
4 3
Output
9
Input
1 1
Output
0
Input
13 3
Output
81
Input
0 3
Output
3 | instruction | 0 | 102,704 | 5 | 205,408 |
"Correct Solution:
```
N,M=map(int,input().split())
print((M*(M-1)+N*(N-1))//2)
``` | output | 1 | 102,704 | 5 | 205,409 |
Provide a correct Python 3 solution for this coding contest problem.
We have N+M balls, each of which has an integer written on it.
It is known that:
* The numbers written on N of the balls are even.
* The numbers written on M of the balls are odd.
Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.
It can be shown that this count does not depend on the actual values written on the balls.
Constraints
* 0 \leq N,M \leq 100
* 2 \leq N+M
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N M
Output
Print the answer.
Examples
Input
2 1
Output
1
Input
4 3
Output
9
Input
1 1
Output
0
Input
13 3
Output
81
Input
0 3
Output
3 | instruction | 0 | 102,705 | 5 | 205,410 |
"Correct Solution:
```
N,M = map(int,input().split())
all = (M*(M-1)+N*(N-1))//2
print(all)
``` | output | 1 | 102,705 | 5 | 205,411 |
Provide a correct Python 3 solution for this coding contest problem.
We have N+M balls, each of which has an integer written on it.
It is known that:
* The numbers written on N of the balls are even.
* The numbers written on M of the balls are odd.
Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.
It can be shown that this count does not depend on the actual values written on the balls.
Constraints
* 0 \leq N,M \leq 100
* 2 \leq N+M
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N M
Output
Print the answer.
Examples
Input
2 1
Output
1
Input
4 3
Output
9
Input
1 1
Output
0
Input
13 3
Output
81
Input
0 3
Output
3 | instruction | 0 | 102,706 | 5 | 205,412 |
"Correct Solution:
```
n,m = map(int,input().split())
print((m*(m-1))//2+(n*(n-1))//2)
``` | output | 1 | 102,706 | 5 | 205,413 |
Provide a correct Python 3 solution for this coding contest problem.
We have N+M balls, each of which has an integer written on it.
It is known that:
* The numbers written on N of the balls are even.
* The numbers written on M of the balls are odd.
Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.
It can be shown that this count does not depend on the actual values written on the balls.
Constraints
* 0 \leq N,M \leq 100
* 2 \leq N+M
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N M
Output
Print the answer.
Examples
Input
2 1
Output
1
Input
4 3
Output
9
Input
1 1
Output
0
Input
13 3
Output
81
Input
0 3
Output
3 | instruction | 0 | 102,707 | 5 | 205,414 |
"Correct Solution:
```
a,b=map(int,input().split())
print(int(a*(a-1)/2+b*(b-1)//2))
``` | output | 1 | 102,707 | 5 | 205,415 |
Provide a correct Python 3 solution for this coding contest problem.
We have N+M balls, each of which has an integer written on it.
It is known that:
* The numbers written on N of the balls are even.
* The numbers written on M of the balls are odd.
Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.
It can be shown that this count does not depend on the actual values written on the balls.
Constraints
* 0 \leq N,M \leq 100
* 2 \leq N+M
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N M
Output
Print the answer.
Examples
Input
2 1
Output
1
Input
4 3
Output
9
Input
1 1
Output
0
Input
13 3
Output
81
Input
0 3
Output
3 | instruction | 0 | 102,708 | 5 | 205,416 |
"Correct Solution:
```
m,n = map(int, input().split())
print(n*(n-1)//2+m*(m-1)//2)
``` | output | 1 | 102,708 | 5 | 205,417 |
Provide a correct Python 3 solution for this coding contest problem.
We have N+M balls, each of which has an integer written on it.
It is known that:
* The numbers written on N of the balls are even.
* The numbers written on M of the balls are odd.
Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.
It can be shown that this count does not depend on the actual values written on the balls.
Constraints
* 0 \leq N,M \leq 100
* 2 \leq N+M
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N M
Output
Print the answer.
Examples
Input
2 1
Output
1
Input
4 3
Output
9
Input
1 1
Output
0
Input
13 3
Output
81
Input
0 3
Output
3 | instruction | 0 | 102,709 | 5 | 205,418 |
"Correct Solution:
```
N,M = map(int,input().split())
print(((N-1)*N+(M-1)*M)//2)
``` | output | 1 | 102,709 | 5 | 205,419 |
Provide a correct Python 3 solution for this coding contest problem.
We have N+M balls, each of which has an integer written on it.
It is known that:
* The numbers written on N of the balls are even.
* The numbers written on M of the balls are odd.
Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.
It can be shown that this count does not depend on the actual values written on the balls.
Constraints
* 0 \leq N,M \leq 100
* 2 \leq N+M
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N M
Output
Print the answer.
Examples
Input
2 1
Output
1
Input
4 3
Output
9
Input
1 1
Output
0
Input
13 3
Output
81
Input
0 3
Output
3 | instruction | 0 | 102,710 | 5 | 205,420 |
"Correct Solution:
```
n,m = map(int,input().split())
print(((n*(n-1)) + m*(m-1))//2)
``` | output | 1 | 102,710 | 5 | 205,421 |
Provide a correct Python 3 solution for this coding contest problem.
We have N+M balls, each of which has an integer written on it.
It is known that:
* The numbers written on N of the balls are even.
* The numbers written on M of the balls are odd.
Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.
It can be shown that this count does not depend on the actual values written on the balls.
Constraints
* 0 \leq N,M \leq 100
* 2 \leq N+M
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N M
Output
Print the answer.
Examples
Input
2 1
Output
1
Input
4 3
Output
9
Input
1 1
Output
0
Input
13 3
Output
81
Input
0 3
Output
3 | instruction | 0 | 102,711 | 5 | 205,422 |
"Correct Solution:
```
a, b = map(int, input().split())
y=a*(a-1)/2+b*(b-1)/2
print(int(y))
``` | output | 1 | 102,711 | 5 | 205,423 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N+M balls, each of which has an integer written on it.
It is known that:
* The numbers written on N of the balls are even.
* The numbers written on M of the balls are odd.
Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.
It can be shown that this count does not depend on the actual values written on the balls.
Constraints
* 0 \leq N,M \leq 100
* 2 \leq N+M
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N M
Output
Print the answer.
Examples
Input
2 1
Output
1
Input
4 3
Output
9
Input
1 1
Output
0
Input
13 3
Output
81
Input
0 3
Output
3
Submitted Solution:
```
m, n = map(int, input().split())
print((m*(m-1) + n*(n-1))//2)
``` | instruction | 0 | 102,712 | 5 | 205,424 |
Yes | output | 1 | 102,712 | 5 | 205,425 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N+M balls, each of which has an integer written on it.
It is known that:
* The numbers written on N of the balls are even.
* The numbers written on M of the balls are odd.
Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.
It can be shown that this count does not depend on the actual values written on the balls.
Constraints
* 0 \leq N,M \leq 100
* 2 \leq N+M
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N M
Output
Print the answer.
Examples
Input
2 1
Output
1
Input
4 3
Output
9
Input
1 1
Output
0
Input
13 3
Output
81
Input
0 3
Output
3
Submitted Solution:
```
n,m=list(map(int,input().split()))
print(int((n**2+m**2-n-m)/2))
``` | instruction | 0 | 102,713 | 5 | 205,426 |
Yes | output | 1 | 102,713 | 5 | 205,427 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N+M balls, each of which has an integer written on it.
It is known that:
* The numbers written on N of the balls are even.
* The numbers written on M of the balls are odd.
Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.
It can be shown that this count does not depend on the actual values written on the balls.
Constraints
* 0 \leq N,M \leq 100
* 2 \leq N+M
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N M
Output
Print the answer.
Examples
Input
2 1
Output
1
Input
4 3
Output
9
Input
1 1
Output
0
Input
13 3
Output
81
Input
0 3
Output
3
Submitted Solution:
```
e,o = map(int,input().split())
print(e*(e-1)//2+o*(o-1)//2)
``` | instruction | 0 | 102,714 | 5 | 205,428 |
Yes | output | 1 | 102,714 | 5 | 205,429 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N+M balls, each of which has an integer written on it.
It is known that:
* The numbers written on N of the balls are even.
* The numbers written on M of the balls are odd.
Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.
It can be shown that this count does not depend on the actual values written on the balls.
Constraints
* 0 \leq N,M \leq 100
* 2 \leq N+M
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N M
Output
Print the answer.
Examples
Input
2 1
Output
1
Input
4 3
Output
9
Input
1 1
Output
0
Input
13 3
Output
81
Input
0 3
Output
3
Submitted Solution:
```
a,b=map(int,input().split())
print(int(a*(a-1)/2)+int(b*(b-1)/2))
``` | instruction | 0 | 102,715 | 5 | 205,430 |
Yes | output | 1 | 102,715 | 5 | 205,431 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N+M balls, each of which has an integer written on it.
It is known that:
* The numbers written on N of the balls are even.
* The numbers written on M of the balls are odd.
Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.
It can be shown that this count does not depend on the actual values written on the balls.
Constraints
* 0 \leq N,M \leq 100
* 2 \leq N+M
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N M
Output
Print the answer.
Examples
Input
2 1
Output
1
Input
4 3
Output
9
Input
1 1
Output
0
Input
13 3
Output
81
Input
0 3
Output
3
Submitted Solution:
```
n, m = input().split()
n = int(n)
m = int(m)
print(n!/(2 * (n-2)!) + m!/(2 * (n-2)!))
``` | instruction | 0 | 102,716 | 5 | 205,432 |
No | output | 1 | 102,716 | 5 | 205,433 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N+M balls, each of which has an integer written on it.
It is known that:
* The numbers written on N of the balls are even.
* The numbers written on M of the balls are odd.
Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.
It can be shown that this count does not depend on the actual values written on the balls.
Constraints
* 0 \leq N,M \leq 100
* 2 \leq N+M
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N M
Output
Print the answer.
Examples
Input
2 1
Output
1
Input
4 3
Output
9
Input
1 1
Output
0
Input
13 3
Output
81
Input
0 3
Output
3
Submitted Solution:
```
from math import factorial
def f(n, r):
return int(factorial(n) / factorial(r) / factorial(n - r))
N, M = map(int, input().split())
res = 0
if N >= 2:
res += f(N, 2)
if M >= 2:
res += f(M, 2)
print(res)
``` | instruction | 0 | 102,717 | 5 | 205,434 |
No | output | 1 | 102,717 | 5 | 205,435 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N+M balls, each of which has an integer written on it.
It is known that:
* The numbers written on N of the balls are even.
* The numbers written on M of the balls are odd.
Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.
It can be shown that this count does not depend on the actual values written on the balls.
Constraints
* 0 \leq N,M \leq 100
* 2 \leq N+M
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N M
Output
Print the answer.
Examples
Input
2 1
Output
1
Input
4 3
Output
9
Input
1 1
Output
0
Input
13 3
Output
81
Input
0 3
Output
3
Submitted Solution:
```
S = input()
L=len(S)
ans=0
if S[:int((L-1)/2)]==S[int((L-1)/2-1)::-1] and S[int((L+3)/2-1):]==S[:int((L+3)/2-2):-1]:
ans='Yes'
else:
ans='No'
print(ans)
``` | instruction | 0 | 102,718 | 5 | 205,436 |
No | output | 1 | 102,718 | 5 | 205,437 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have N+M balls, each of which has an integer written on it.
It is known that:
* The numbers written on N of the balls are even.
* The numbers written on M of the balls are odd.
Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.
It can be shown that this count does not depend on the actual values written on the balls.
Constraints
* 0 \leq N,M \leq 100
* 2 \leq N+M
* All values in input are integers.
Input
Input is given from Standard Input in the following format:
N M
Output
Print the answer.
Examples
Input
2 1
Output
1
Input
4 3
Output
9
Input
1 1
Output
0
Input
13 3
Output
81
Input
0 3
Output
3
Submitted Solution:
```
A = list(map(int, input().strip().split(' ')))
ans = (A[0] * (A[0] - 1)) / 2 + ((A[1] * (A[1] - 1)) / 2)
print(ans)
``` | instruction | 0 | 102,719 | 5 | 205,438 |
No | output | 1 | 102,719 | 5 | 205,439 |
Provide a correct Python 3 solution for this coding contest problem.
You are given positive integers X and Y. If there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it. If it does not exist, print -1.
Constraints
* 1 ≤ X,Y ≤ 10^9
* X and Y are integers.
Input
Input is given from Standard Input in the following format:
X Y
Output
Print a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.
Examples
Input
8 6
Output
16
Input
3 3
Output
-1 | instruction | 0 | 102,784 | 5 | 205,568 |
"Correct Solution:
```
X, Y = [int(i) for i in input().split()]
if X % Y == 0:
print(-1)
else:
print(X)
``` | output | 1 | 102,784 | 5 | 205,569 |
Provide a correct Python 3 solution for this coding contest problem.
You are given positive integers X and Y. If there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it. If it does not exist, print -1.
Constraints
* 1 ≤ X,Y ≤ 10^9
* X and Y are integers.
Input
Input is given from Standard Input in the following format:
X Y
Output
Print a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.
Examples
Input
8 6
Output
16
Input
3 3
Output
-1 | instruction | 0 | 102,785 | 5 | 205,570 |
"Correct Solution:
```
x,y=map(int,input().split())
print(-1 if x%y==0 else x*(y-1))
``` | output | 1 | 102,785 | 5 | 205,571 |
Provide a correct Python 3 solution for this coding contest problem.
You are given positive integers X and Y. If there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it. If it does not exist, print -1.
Constraints
* 1 ≤ X,Y ≤ 10^9
* X and Y are integers.
Input
Input is given from Standard Input in the following format:
X Y
Output
Print a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.
Examples
Input
8 6
Output
16
Input
3 3
Output
-1 | instruction | 0 | 102,786 | 5 | 205,572 |
"Correct Solution:
```
x,y=map(int,input().split())
a=x*(y-1)
if a%y==0:
print(-1)
else:
print(a)
``` | output | 1 | 102,786 | 5 | 205,573 |
Provide a correct Python 3 solution for this coding contest problem.
You are given positive integers X and Y. If there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it. If it does not exist, print -1.
Constraints
* 1 ≤ X,Y ≤ 10^9
* X and Y are integers.
Input
Input is given from Standard Input in the following format:
X Y
Output
Print a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.
Examples
Input
8 6
Output
16
Input
3 3
Output
-1 | instruction | 0 | 102,787 | 5 | 205,574 |
"Correct Solution:
```
x, y = input().split()
x = int(x)
y = int(y)
if x % y == 0:
print(-1)
else:
print(x * (y + 1))
``` | output | 1 | 102,787 | 5 | 205,575 |
Provide a correct Python 3 solution for this coding contest problem.
You are given positive integers X and Y. If there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it. If it does not exist, print -1.
Constraints
* 1 ≤ X,Y ≤ 10^9
* X and Y are integers.
Input
Input is given from Standard Input in the following format:
X Y
Output
Print a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.
Examples
Input
8 6
Output
16
Input
3 3
Output
-1 | instruction | 0 | 102,788 | 5 | 205,576 |
"Correct Solution:
```
x, y=map(int, input().split())
print(-1 if x%y==0 else x)
``` | output | 1 | 102,788 | 5 | 205,577 |
Provide a correct Python 3 solution for this coding contest problem.
You are given positive integers X and Y. If there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it. If it does not exist, print -1.
Constraints
* 1 ≤ X,Y ≤ 10^9
* X and Y are integers.
Input
Input is given from Standard Input in the following format:
X Y
Output
Print a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.
Examples
Input
8 6
Output
16
Input
3 3
Output
-1 | instruction | 0 | 102,789 | 5 | 205,578 |
"Correct Solution:
```
X, Y = map(int, input().split())
a = X / Y
if a == int(a):
ans = -1
else:
ans = X
print(ans)
``` | output | 1 | 102,789 | 5 | 205,579 |
Provide a correct Python 3 solution for this coding contest problem.
You are given positive integers X and Y. If there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it. If it does not exist, print -1.
Constraints
* 1 ≤ X,Y ≤ 10^9
* X and Y are integers.
Input
Input is given from Standard Input in the following format:
X Y
Output
Print a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.
Examples
Input
8 6
Output
16
Input
3 3
Output
-1 | instruction | 0 | 102,790 | 5 | 205,580 |
"Correct Solution:
```
X, Y = map(int, input().split())
ans = (Y - 1) * X
if ans % Y == 0:
print(-1)
else:
print(ans)
``` | output | 1 | 102,790 | 5 | 205,581 |
Provide a correct Python 3 solution for this coding contest problem.
You are given positive integers X and Y. If there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it. If it does not exist, print -1.
Constraints
* 1 ≤ X,Y ≤ 10^9
* X and Y are integers.
Input
Input is given from Standard Input in the following format:
X Y
Output
Print a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.
Examples
Input
8 6
Output
16
Input
3 3
Output
-1 | instruction | 0 | 102,791 | 5 | 205,582 |
"Correct Solution:
```
#15:15
x,y = map(int,input().split())
if x % y == 0:
print(-1)
else:
print(x)
``` | output | 1 | 102,791 | 5 | 205,583 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given positive integers X and Y. If there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it. If it does not exist, print -1.
Constraints
* 1 ≤ X,Y ≤ 10^9
* X and Y are integers.
Input
Input is given from Standard Input in the following format:
X Y
Output
Print a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.
Examples
Input
8 6
Output
16
Input
3 3
Output
-1
Submitted Solution:
```
def abc():
x, y = map(int, input().rstrip().split())
if x % y == 0:
print(-1)
return
print(x)
abc()
``` | instruction | 0 | 102,792 | 5 | 205,584 |
Yes | output | 1 | 102,792 | 5 | 205,585 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given positive integers X and Y. If there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it. If it does not exist, print -1.
Constraints
* 1 ≤ X,Y ≤ 10^9
* X and Y are integers.
Input
Input is given from Standard Input in the following format:
X Y
Output
Print a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.
Examples
Input
8 6
Output
16
Input
3 3
Output
-1
Submitted Solution:
```
x,y=map(int,input().split())
if x%y==0:
print("-1")
else:
for i in range(1,x*y):
if x*i%y!=0:
print(x*i)
exit()
``` | instruction | 0 | 102,793 | 5 | 205,586 |
Yes | output | 1 | 102,793 | 5 | 205,587 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given positive integers X and Y. If there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it. If it does not exist, print -1.
Constraints
* 1 ≤ X,Y ≤ 10^9
* X and Y are integers.
Input
Input is given from Standard Input in the following format:
X Y
Output
Print a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.
Examples
Input
8 6
Output
16
Input
3 3
Output
-1
Submitted Solution:
```
x,y=map(int,input().split());print((x+1)*(x%y>0)-1)
``` | instruction | 0 | 102,794 | 5 | 205,588 |
Yes | output | 1 | 102,794 | 5 | 205,589 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given positive integers X and Y. If there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it. If it does not exist, print -1.
Constraints
* 1 ≤ X,Y ≤ 10^9
* X and Y are integers.
Input
Input is given from Standard Input in the following format:
X Y
Output
Print a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.
Examples
Input
8 6
Output
16
Input
3 3
Output
-1
Submitted Solution:
```
X, Y = map(int, input().split())
if X < Y or not(X%Y == 0):
print(X)
else:
print(-1)
``` | instruction | 0 | 102,795 | 5 | 205,590 |
Yes | output | 1 | 102,795 | 5 | 205,591 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given positive integers X and Y. If there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it. If it does not exist, print -1.
Constraints
* 1 ≤ X,Y ≤ 10^9
* X and Y are integers.
Input
Input is given from Standard Input in the following format:
X Y
Output
Print a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.
Examples
Input
8 6
Output
16
Input
3 3
Output
-1
Submitted Solution:
```
x,y=map(int,input().split())
print(-1 if x%y else x)
``` | instruction | 0 | 102,796 | 5 | 205,592 |
No | output | 1 | 102,796 | 5 | 205,593 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given positive integers X and Y. If there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it. If it does not exist, print -1.
Constraints
* 1 ≤ X,Y ≤ 10^9
* X and Y are integers.
Input
Input is given from Standard Input in the following format:
X Y
Output
Print a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.
Examples
Input
8 6
Output
16
Input
3 3
Output
-1
Submitted Solution:
```
x,y=map(int,input().split())
print(x if x%y==0 else -1)
``` | instruction | 0 | 102,797 | 5 | 205,594 |
No | output | 1 | 102,797 | 5 | 205,595 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given positive integers X and Y. If there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it. If it does not exist, print -1.
Constraints
* 1 ≤ X,Y ≤ 10^9
* X and Y are integers.
Input
Input is given from Standard Input in the following format:
X Y
Output
Print a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.
Examples
Input
8 6
Output
16
Input
3 3
Output
-1
Submitted Solution:
```
x, y = map(int,input().split())
if x*(y-1)//y != 0:
print(x*(y-1))
else:
print(-1)
``` | instruction | 0 | 102,798 | 5 | 205,596 |
No | output | 1 | 102,798 | 5 | 205,597 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given positive integers X and Y. If there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it. If it does not exist, print -1.
Constraints
* 1 ≤ X,Y ≤ 10^9
* X and Y are integers.
Input
Input is given from Standard Input in the following format:
X Y
Output
Print a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.
Examples
Input
8 6
Output
16
Input
3 3
Output
-1
Submitted Solution:
```
x,y = input().split(' ')
x = int(x)
y = int(y)
if y == 1:
print(-1)
else:
if 0 < x and x <= 1e18:
print(x)
else :
print(-1)
``` | instruction | 0 | 102,799 | 5 | 205,598 |
No | output | 1 | 102,799 | 5 | 205,599 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Input Format
The input format is following:
n m q
a_1 a_2 ... a_q
Output Format
Print the number of connected part in one line.
Constraints
* n ≤ 10^{12}
* 7n is divisible by m.
* 1 ≤ q ≤ m ≤ 10^5
* 0 ≤ a_1 < a_2 < ... < a_q < m
Scoring
Subtask 1 [100 points]
* n ≤ 100000.
Subtask 2 [90 points]
* m is divisible by 7.
* a_{i + 1} - a_i = 1.
Subtask 3 [200 points]
* m is divisible by 7.
Subtask 4 [110 points]
* There are no additional constraints.
Sample Input 1
7 7 3
1 3 5
Sample Output 1
4
The calendar looks like this:
<image>
Sample Input 2
10 14 8
5 6 7 8 9 10 11 12
Sample Output 2
10
The calendar looks like this:
<image>
Output Format
Print the number of connected part in one line.
Constraints
* n ≤ 10^{12}
* 7n is divisible by m.
* 1 ≤ q ≤ m ≤ 10^5
* 0 ≤ a_1 < a_2 < ... < a_q < m
Scoring
Subtask 1 [100 points]
* n ≤ 100000.
Subtask 2 [90 points]
* m is divisible by 7.
* a_{i + 1} - a_i = 1.
Subtask 3 [200 points]
* m is divisible by 7.
Subtask 4 [110 points]
* There are no additional constraints.
Input Format
The input format is following:
n m q
a_1 a_2 ... a_q
Examples
Input
7 7 3
1 3 5
Output
4
Input
10 14 8
5 6 7 8 9 10 11 12
Output
10
Submitted Solution:
```
n,m,q=map(int,input().split())
a=list(map(int,input().split()))
def count_group(size):
cc = [False]*size
for i in range(q):
j = 0
while a[i]+m*j < size:
cc[a[i]+m*j] = True
j += 1
gg = [0]*size
ox = [-1, 0, 1, 0]
oy = [0, -7, 0, 7]
def dfs(i, g):
if cc[i] or gg[i] != 0: return
gg[i] = g
for t in range(4):
if i % 7 == 0 and ox[t] == -1: continue
if (i+1) % 7 == 0 and ox[t] == 1: continue
j = i+ox[t]+oy[t]
if 0 <= j < size:
dfs(j, g)
maxg = 0
for i in range(size):
if not cc[i] and gg[i] == 0:
maxg += 1
dfs(i, maxg)
return maxg
block = (m+7)//7*7*7
if n <= block:
print(count_group(n*7))
exit(0)
c1 = count_group(block)
c2 = count_group(block*2)
c3 = count_group(block+((n*7)%block))
print(c1 + ((n*7-block)//block)*(c2-c1) + (c3-c1))
``` | instruction | 0 | 102,802 | 5 | 205,604 |
No | output | 1 | 102,802 | 5 | 205,605 |
Provide a correct Python 3 solution for this coding contest problem.
Example
Input
2 10 6
4 4 E
6 4 W
Output
2 | instruction | 0 | 102,846 | 5 | 205,692 |
"Correct Solution:
```
N, W, D = map(int, input().split())
def calc(x0, y0, dx, dy):
s = min(W - x0 if dx >= 0 else x0, D - y0 if dy >= 0 else y0)
x = x0 + dx*s; y = y0 + dy*s
assert x in [0, W] or y in [0, D], (x, y)
if y == 0:
return x
if x == W:
return W+y
if y == D:
return 2*W+D-x
return 2*W+2*D-y
S = []
for i in range(N):
x, y, f = input().split(); x = int(x); y = int(y)
if f == 'N':
t1 = calc(x, y, 1, 1)
t2 = calc(x, y, -1, 1)
elif f == 'E':
t1 = calc(x, y, 1, -1)
t2 = calc(x, y, 1, 1)
elif f == 'S':
t1 = calc(x, y, -1, -1)
t2 = calc(x, y, 1, -1)
else:
t1 = calc(x, y, -1, 1)
t2 = calc(x, y, -1, -1)
if t1 >= t2:
t1 -= 2*(W+D)
S.append((t1, t2))
S.sort(key=lambda x: x[1])
ans = N
INF = 10**9
for i in range(N):
r = 0
cur = -INF
base = 0
for j in range(N):
a, b = S[(i+j) % N]
if (i+j) % N == 0:
base += 2*(W+D)
if a + base <= cur:
continue
cur = b + base
r += 1
ans = min(r, ans)
print(ans)
``` | output | 1 | 102,846 | 5 | 205,693 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which prints small/large/equal relation of given two integers a and b.
Constraints
* -1000 ≤ a, b ≤ 1000
Input
Two integers a and b separated by a single space are given in a line.
Output
For given two integers a and b, print
a < b
if a is less than b,
a > b
if a is greater than b, and
a == b
if a equals to b.
Examples
Input
1 2
Output
a
Input
4 3
Output
a > b
Input
5 5
Output
a == b | instruction | 0 | 102,869 | 5 | 205,738 |
"Correct Solution:
```
a,b = list(map(int,input().split()))
if a > b:
print("a > b")
elif a == b:
print("a == b")
else:
print("a < b")
``` | output | 1 | 102,869 | 5 | 205,739 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which prints small/large/equal relation of given two integers a and b.
Constraints
* -1000 ≤ a, b ≤ 1000
Input
Two integers a and b separated by a single space are given in a line.
Output
For given two integers a and b, print
a < b
if a is less than b,
a > b
if a is greater than b, and
a == b
if a equals to b.
Examples
Input
1 2
Output
a
Input
4 3
Output
a > b
Input
5 5
Output
a == b | instruction | 0 | 102,870 | 5 | 205,740 |
"Correct Solution:
```
a, b = map(int, input().split())
c = "=="
if a < b:
c = '<'
elif a > b:
c = '>'
print ('a', c, 'b')
``` | output | 1 | 102,870 | 5 | 205,741 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which prints small/large/equal relation of given two integers a and b.
Constraints
* -1000 ≤ a, b ≤ 1000
Input
Two integers a and b separated by a single space are given in a line.
Output
For given two integers a and b, print
a < b
if a is less than b,
a > b
if a is greater than b, and
a == b
if a equals to b.
Examples
Input
1 2
Output
a
Input
4 3
Output
a > b
Input
5 5
Output
a == b | instruction | 0 | 102,871 | 5 | 205,742 |
"Correct Solution:
```
a,b=map(int,input().split())
print('a','<'if a<b else'>'if a>b else'==','b')
``` | output | 1 | 102,871 | 5 | 205,743 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which prints small/large/equal relation of given two integers a and b.
Constraints
* -1000 ≤ a, b ≤ 1000
Input
Two integers a and b separated by a single space are given in a line.
Output
For given two integers a and b, print
a < b
if a is less than b,
a > b
if a is greater than b, and
a == b
if a equals to b.
Examples
Input
1 2
Output
a
Input
4 3
Output
a > b
Input
5 5
Output
a == b | instruction | 0 | 102,872 | 5 | 205,744 |
"Correct Solution:
```
a,b = list(map(int, input().split()))
if (a < b):
print("a < b")
elif (a > b):
print("a > b")
else :
print("a == b")
``` | output | 1 | 102,872 | 5 | 205,745 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.