problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p02879 | s848375484 | Accepted | A, B = map(int, input().split())
if A > 9 or B > 9:
print(-1)
else:
print(A*B)
|
p02570 | s814060700 | Accepted | data=list(map(int,input().split()))
if data[0]/data[1]<=data[2]:
print('Yes')
else:
print('No') |
p03338 | s269775279 | Accepted | def main():
n = int(input())
s = input()
ans = -float("inf")
for i in range(1, n):
s_union = set(s[:i]) & set(s[i:])
ans = max(ans, len(s_union))
print(ans)
if __name__ == "__main__":
main()
|
p03723 | s779717192 | Accepted | a, b, c = map(int, input().strip().split())
count = 0
while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
if a == b and b == c:
count = -1
break
count += 1
a1 = b // 2 + c // 2
b1 = c // 2 + a // 2
c1 = a // 2 + b // 2
a, b, c = a1, b1, c1
print(count)
|
p02696 | s091641288 | Accepted | a,b,n = list(map(int, input().split()))
if n>=b-1:
res = (a*(b-1))//b-a*((b-1)//b)
else:
res = (a*n)//b
print(res) |
p02748 | s469516671 | Wrong Answer | A,B,M = map(int,input().split())
from collections import defaultdict
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
MINB = min(b)
wari = defaultdict(list)
for _ in range(M):
x,y,c = map(int,input().split())
wari[x-1].append((y-1,c))
a.sort(); b.sort()
ans = float("inf")
for i in range(A):
tmp = a[i] + MINB
for y,c in wari[i]:
tmp = min(tmp, a[i] + b[y] - c)
ans = min(ans, tmp)
print(ans) |
p02687 | s090374737 | Accepted | if(input()=='ABC'):
print('ARC')
exit()
print('ABC')
|
p02641 | s209818856 | Accepted | x, n = map(int, input().split())
p = [int(_) for _ in input().split()]
arr = [0] * 1000
for i in p:
arr[i] = 1
ans1 = 0
for i in range(x, -1, -1):
if arr[i] == 0:
ans1 = i
break
# print(arr)
ans2 = 0
for i in range(x, 102):
if arr[i] == 0:
ans2 = i
break
if abs(ans1 - x) <= abs(x - ans2):
print(ans1)
else:
print(ans2)
|
p02665 | s106774864 | Wrong Answer | n=int(input())
a=list(map(int,input().split()))
ans=1
count=1
"""
for i in range(1,n+1):
ans+=count*2
count*=2
#print(ans)
"""
ans=1
count=1
now=1
for i in range(n):
count=(count-a[i])*2
if a[i]%2==1:
now=now*2-a[i]-1
else:
now=now*2-a[i]
ans+=count
#print(count,ans,now)
print(max(-1,ans)) |
p03289 | s666715872 | Accepted | A=input()
if A[0] != "A":
print("WA")
quit()
if A[2:-1].count("C") != 1:
print("WA")
quit()
for i in range(1,len(A)):
if A[i] !="C" and not A[i].islower():
print("WA")
break
else:
print("AC") |
p03254 | s892921183 | Wrong Answer | N, x = map(int, input().split())
children = sorted(list(map(int, input().split())))
count = 0
for child in children:
if x >= child:
x -= child
count += 1
else:
break
if x == 0:
print(count)
else:
if count != 0:
print(count - 1)
else:
print(0) |
p03548 | s100202814 | Accepted | z,y,x=map(int,input().split())
z-=x*2+y
count=1
while(1):
z-=y+x
if z<0:
break
count+=1
print(count) |
p02912 | s399190796 | Accepted | import heapq
N, M = map(int, input().split())
A = list(map(int, input().split()))
# N = 3
# M = 3
# A = [2, 13, 8]
A = [-a for a in A]
heapq.heapify(A)
for i in range(M):
price = heapq.heappop(A)*(-1)//2
heapq.heappush(A, -price)
# print(A)
print(-sum(A)) |
p03038 | s959536239 | Wrong Answer | n, m = map(int, input().split())
a = list(map(int, input().split()))
flag = False
c = []
for _ in range(m):
x,y = map(int, input().split())
for i in range(x):
c.append(y)
if len(c) == n:
flag = True
break
if flag:
break
e = sorted(a+c,reverse=True)
print(sum(e[:n])) |
p03699 | s654801374 | Accepted | n = int(input())
s_list = []
for i in range(n):
s_list.append(int(input()))
r = 0
total = sum(s_list)
if total % 10 != 0:
r = total
else:
s_list.sort()
for s in s_list:
if s % 10 != 0:
r = total - s
break
print(r) |
p03827 | s028479863 | Accepted | N = int(input())
S = input()
result = 0
x = 0
for i in S:
if i == 'I':
x += 1
else:
x -= 1
result = max(result, x)
print(result) |
p03998 | s120074742 | Wrong Answer | # ABC 045: B – 3人でカードゲームイージー / Card Game for Three (ABC Edit)
cards = ['a', 'b', 'c']
s = [input() for _ in range(3)]
turn = 0
previous = 0
while len(s[turn]) != 0:
previous = turn
turn = cards.index(s[turn][0])
s[previous] = s[previous][1:]
print(cards[previous].upper()) |
p03469 | s634755167 | Wrong Answer | S = input()
S_modified = S.replace('7','8')
print(S_modified) |
p02699 | s966704546 | Wrong Answer | S, W = map(int, input().split())
if S < W/2:
print("unsafe")
print("safe") |
p02790 | s016296293 | Wrong Answer | n, m = map(int,input().strip().split())
print('{}'.format(m)*n) |
p02555 | s199290469 | Wrong Answer | s = int(input())
a = s -3 + 1
aws = a - 3 + 1
print(aws % (7 + (10 * 9)))
|
p03211 | s408825221 | Wrong Answer | S = input()
print(min([753 - int(S[i:i+3]) for i in range(len(S)-3 + 2)]))
|
p03627 | s467753179 | Wrong Answer | n = int(input())
A = list(map(int, input().split()))
from collections import Counter
c = Counter(A)
multi = sorted([k for k, v in c.items() if v >= 2], reverse=True)
if len(multi) < 2:
print(0)
else:
print(multi[0]*multi[1]) |
p03011 | s039621511 | Accepted | a,b,c=map(int,input().split())
print(a+b+c-max(a,b,c)) |
p02664 | s844928121 | Accepted | t = input()
print(t.replace("?","D")) |
p03761 | s803009234 | Accepted | n=int(input())
l=[50]*26
d=set(list("abcdefghijklnmopqrstuvwxyz"))
from collections import Counter as co
for i in range(n):
x=input()
f=d-set(list(x))
for k,v in co(x).items():
l[ord(k)-ord("a")]=min(l[ord(k)-ord("a")],v)
for c in f:
l[ord(c)-ord("a")]=0
ans=""
for i in range(26):
ans+=chr(ord("a")+i)*l[i]
print(ans) |
p03943 | s578657111 | Accepted | a, b, c = map(int, input().split())
if a == b+c or b == c+a or c == a+b:
print('Yes')
else:
print('No') |
p03943 | s636082776 | Wrong Answer | C = list(map(int,input().split()))
C.sort()
if C[2]==C[0]+C[1]:
print('YES')
else:
print('NO') |
p02768 | s571349344 | Accepted | n, a, b = list(map(int, input().split()))
m = 10**9 + 7
def func(n, i):
x = 1
y = 1
for j in range(1, i+1):
x = (x * (n - (j - 1))) % m
y = (y * j) % m
return (x * pow(y, m-2, m)) % m
print(((pow(2, n, m) - 1 - func(n, a) - func(n, b)) % m))
|
p03592 | s625721056 | Accepted | import sys
n,m,k=map(int,input().split())
for p in range(n+1):
for q in range(m+1):
ans=p*m + q*n - 2*p*q
if(ans==k):
print('Yes')
sys.exit()
else:
print('No')
|
p03416 | s179236513 | Wrong Answer | A, B = map(int, input().split())
count=0
for i in range(10001, 100000, 1):
s = str(i)
a = int(s[4])
b = int(s[3])
c = int(s[1])
d = int(s[0])
if a==d and b==c:
count+=1
print(count) |
p03220 | s989072600 | Wrong Answer | n = int(input())
t, a = map(int, input().split())
h = [int(i) for i in input().split()]
x = 10 ** 5
b = 0
for i in range(n):
d = abs(a - t - h[i] * 0.006)
if d < x:
x = d
b = i + 1
print(b) |
p02743 | s686924805 | Accepted | a,b,c = map(int,input().split())
if c-a-b>0 and 4*a*b < (c-a-b)**2:
print('Yes')
else:
print('No')
|
p03705 | s880890839 | Accepted | N, A, B = list(map(int, input().split()))
if A > B:
ans = 0
elif A == B:
ans = 1
elif N == 1:
ans = 0
else:
mn = A + B + A * (N-2)
mx = A + B + B * (N-2)
ans = mx - mn + 1
print(ans) |
p02792 | s184559701 | Accepted | #!/usr/bin/env python3
from itertools import product, permutations, combinations
from bisect import bisect_right,bisect_left
N=int(input())
tbl = [[0] * 10 for i in range(10)]
for i in range(1, N+1):
num = str(i)
s = int(num[0])
e = int(num[-1])
tbl[s][e] += 1
cnt = 0
for i in range(10):
for j in range(10):
cnt += tbl[i][j] * tbl[j][i]
print(cnt) |
p03012 | s390794586 | Wrong Answer | N = int(input())
w = list(map(int,input().split()))
sumw = [0]*N
sumw[0] = w[0]
for i in range(1,N):
sumw[i] = sumw[i-1]+w[i]
ans = 10*5
for i in range(0,N-1):
ans = min(ans, abs(sumw[N-1]-2*sumw[i]))
print(ans) |
p02618 | s289321118 | Accepted | D = int(input())
c = [int(i) for i in input().split()]
s = []
for i in range(D):
tmp = [int(j) for j in input().split()]
s.append(tmp)
sat = 0
lst = [0 for i in range(26)]
for i in range(D):
satlst = [0 for j in range(26)]
for j in range(26):
sattmp = sat + s[i][j]
for k in range(26):
if j != k:
sattmp -= c[k] * ((i + 1) - lst[k])
satlst[j] = sattmp
sat = max(satlst)
lst[satlst.index(sat)] = (i + 1)
print(satlst.index(sat) + 1)
|
p02688 | s769279856 | Accepted | N,K = map(int,input().split())
sunuke = [0] * N
for i in range(K):
tmp = int(input())
tmp_lst = list(map(int,input().split()))
for j in tmp_lst:
sunuke[j-1] += 1
print(sunuke.count(0))
|
p02755 | s108157559 | Accepted | import math
from decimal import *
A,B = list(map(int, input().split()))
ans = -1
for x in range(1, 10001):
a = math.floor(x * Decimal(0.08))
b = math.floor(x * Decimal(0.1))
if a == A and b == B:
ans = x
break
print(ans) |
p03623 | s896115579 | Wrong Answer | x,a,b = map(int,input().split())
print(["B","A"][2*x<(b+a)]) |
p03106 | s586923410 | Accepted | A, B, K = map(int, input().split())
count = 0
for i in reversed(range(1,min(A, B)+1)):
if A%i == 0 and B%i == 0:
count+=1
if count == K:
print(i) |
p02700 | s898839266 | Accepted | import math
a, b, c, d = map(int, input().split())
if math.ceil(c / b) <= math.ceil(a / d):
print('Yes')
else:
print('No')
|
p04030 | s981768210 | Accepted | s=input()
t=''
for i in s:
if i!='B':
t+=i
else:
if t!='':
t=t[:-1]
print(t) |
p04044 | s161415411 | Accepted | number,length=map(int,input().split())
input_list=[]
out=''
for i in range(number):
input_list.append(input())
input_list.sort()
for i in input_list:
out+=i
print(out) |
p03760 | s875765290 | Accepted | o=input()
e=input()
ans=''
for i in range(len(o)):
ans+=o[i]
if i<len(e):
ans+=e[i]
print(ans) |
p02629 | s937110639 | Wrong Answer | import numpy as np
n = int(input())
li = [chr(i) for i in range(97, 97 + 26)]
lili = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B',
'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q']
ans = []
zzz = list(np.base_repr(n, base=26))
for i in zzz:
xxx = lili.index(i)
ans.append(li[xxx-1])
print(''.join(ans))
|
p02606 | s116304344 | Wrong Answer | L, R, d = map(int, input().split())
ans = (R - L + 1) // d
print(ans) |
p02624 | s989885382 | Accepted | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(input())
prime_cnt = [0] * (n + 1)
for i in range(1, n + 1):
for j in range(0, n + 1, i):
prime_cnt[j] += 1
res = 0
for i in range(1, n + 1):
res += i * prime_cnt[i]
print(res)
if __name__ == '__main__':
resolve()
|
p02771 | s781217674 | Wrong Answer | a=list(map(int, input().split()))
if len(a) != len(set(a)):
print("Yes")
else:
print("No") |
p02546 | s369400912 | Wrong Answer | S = input()
if S[-1]=='s':
s = S+'s'
else:
s = S+'es'
print(s) |
p02706 | s086107567 | Accepted | # input
inp_ls = input().split(" ")
n,m = [int(e) for e in inp_ls[:2]]
inp_a_ls = input().split(" ")
a_ls = [int(e) for e in inp_a_ls[:m]]
# calc
rest = n - sum(a_ls)
out = rest if rest >= 0 else -1
# result
print(out) |
p02933 | s685714656 | Accepted | a = input()
s = input()
b = int(a)
if 3200 <= b:
output_s = (s)
elif b <3200:
output_s = ("red")
print(output_s) |
p03639 | s689774585 | Accepted | N = int(input())
A = [int(i) for i in input().split()]
odd, four = 0, 0
for a in A:
if a & 1 == 1: odd += 1
if a & 3 == 0: four += 1
# 4の倍数の個数 == 奇数の個数
# すべて偶数
if odd == 0 or four >= odd or (four == odd - 1 and four + odd == N):
print('Yes')
else:
print('No')
|
p03623 | s993702805 | Accepted | x,a,b = map(int, input().split())
A = max(x,a) - min(x,a)
B = max(x,b) - min(x,b)
if A > B:
print("B")
else:
print("A")
|
p02657 | s666008716 | Accepted | # -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
a, b = map(int, input().split())
print(int(a*b)) |
p02819 | s344221227 | Accepted | def isPrime(num):
for i in range(2, int(num ** 0.5) + 1):
if num % i == 0:
return False
return True
X = int(input())
n = X
while True:
if isPrime(n):
break
n += 1
print(n)
|
p04029 | s309316378 | Wrong Answer | # 式:y = N*(N+1)/2
N = int(input()) # 人数Nを代入
candy = N * (N + 1) / 2
print(candy)
|
p02695 | s631068318 | Accepted | import itertools as it
n,m,q = map(int, input().split())
l = [list(map(int, input().split())) for i in range(q)]
ans = 0
for v in list(it.combinations_with_replacement(range(1,m+1),n)):
num = 0
for w in l:
x,y,z = w[0]-1,w[1]-1,w[2]
if v[y] - v[x] == z:
num += w[3]
if num > ans:
ans = num
print(ans) |
p03605 | s249590861 | Wrong Answer | n=input()
if n.count('9'):
print('Yes')
else:
print('NO') |
p03041 | s837097492 | Accepted | n,k=map(int, input("").split(' '))
assert n>=k>=1
assert 1<=n<=50
s=input('')
assert ("a","b","c" in s)
z=list((s))
z[k-1]=z[k-1].swapcase()
for i in z:
print(i, end='')
|
p03427 | s029030843 | Accepted | import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce
rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rf = lambda: map(float, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7
s = rr()
lens = len(s)
a = int(s[0])
b = s[1:]
t = '9'*(lens-1)
if b == t:
print((lens-1)*9+a)
else:
print((lens-1)*9+a-1)
|
p03821 | s287109297 | Accepted | n = int(input())
ab = [list(map(int, input().split())) for _i in range(n)][::-1]
r = 0
for i in range(n):
a, b = ab[i]
if (r+a)%b==0:
continue
r += b-(r+a)%b
print(r) |
p03693 | s201965665 | Accepted | r, g, b = input().split()
print('YES' if int(r+g+b)%4==0 else 'NO') |
p03835 | s448944368 | Accepted | K,S = input().strip().split()
K,S = int(K),int(S)
count = 0
for x in range(S+1):
for y in range(S+1-x):
z = S - x- y
#print( x,y,z)
if x <= K and y <= K and z <= K:
count += 1
print(count) |
p02760 | s154630636 | Accepted | a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
N = int(input())
B = {int(input()) for _ in range(N)}
A = a1+a2+a3
ijk = [ [0,1,2], [3,4,5], [6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]]
end = False
for i,j,k in ijk:
if {A[i], A[j], A[k]} <= B:
print('Yes')
end = True
break
else:
continue
if not end:
print('No')
|
p03852 | s491586476 | Accepted | c = str(input())
if c in 'aeiou':
print('vowel')
else:
print('consonant') |
p02783 | s398163442 | Wrong Answer | H,A=map(int,input().split())
if H%A==0:
print(H//A)
else:
print((round(H/A,0))+1) |
p03293 | s564011197 | Wrong Answer | S=list(str(input()))
T=list(str(input()))
for i in range(len(S)//2 +1):
if S==T:
print('Yes')
exit()
a=S.pop(-1)
S.insert(0,a)
print('No') |
p02583 | s107247219 | Accepted | from itertools import combinations as comb
def main():
N = int(input())
L = list(map(int, input().split()))
count = 0
for a, b, c in comb(L, 3):
a, b, c = sorted([a, b, c])
if a == b or b == c or c == a:
continue
if c < a + b:
count += 1
print(count)
if __name__ == '__main__':
main()
|
p02695 | s657358777 | Wrong Answer | import itertools
N, M, Q = map(int,input().split())
ABCD = [tuple(map(int, input().split())) for _ in range(Q)]
ans = 0
for s in itertools.combinations_with_replacement(range(1,N+1),N):
temp = 0
for i in range(Q):
if s[ABCD[i][1]-1] - s[ABCD[i][0]-1] == ABCD[i][2]:
temp += ABCD[i][3]
ans = max(ans,temp)
print(ans) |
p02707 | s617085005 | Accepted | n=int(input())
#list from 2 to n
alist=list(map(int,input().split()))
jodic={}
for i in alist:
if i in jodic:
jodic[i]=jodic[i]+1
else:
jodic[i]=1
for j in range(n):
if j+1 in jodic:
print(jodic[j+1])
else:
print("0")
|
p04044 | s244761873 | Accepted | N,L = map(int, input().split())
S = list(input() for i in range(N))
S = sorted(S)
print(''.join(S)) |
p02594 | s146894239 | Accepted | n = int(input())
print("Yes" if n >= 30 else "No") |
p02613 | s216928711 | Accepted | from collections import Counter
N = int(input())
li = []
for _ in range(N):
li.append(input())
a = Counter(li)
# print(a)
print("AC x " + str(a["AC"]))
print("WA x " + str(a["WA"]))
print("TLE x " + str(a["TLE"]))
print("RE x " + str(a["RE"])) |
p03385 | s600367649 | Accepted | S = input()
if S[0] != S[1] and S[1] != S[2] and S[2] != S[0]:
print("Yes")
else:
print("No") |
p03417 | s471591703 | Accepted | N, M = map(int, input().split())
ans = 0
if N == 1 and M == 1:
ans = 1
elif N == 1 and M > 1:
ans = M-2
elif N > 1 and M == 1:
ans = N-2
else:
ans = (N-2)*(M-2)
print(ans)
|
p03264 | s242587810 | Accepted | a = int(input())
print(int((a/2)**2) if a%2==0 else (a//2)**2+(a//2)) |
p02897 | s502664260 | Accepted | N = int(input())
print(((N+1)//2) / N) |
p03592 | s486664675 | Accepted | n, m, k = map(int, input().split())
val = []
for i in range(0, n + 1):
for j in range(1, m + 1):
x = i * j + (n - i) * (m - j)
val.append(x)
val = set(val)
print("Yes" if k in val else "No") |
p02796 | s379576532 | Accepted | # -*- coding: utf-8 -*-
N = int(input())
robo_dic = {}
for i in range(N):
X, L = map(int, input().split())
robo_dic[X] = L
robo_list = sorted(robo_dic.keys())
max_place = robo_list[0] + robo_dic[robo_list[0]]
ans = 1
for i in range(1, len(robo_list)):
x = robo_list[i]
l = robo_dic[x]
if max_place <= x - l:
ans += 1
max_place = x + l
else:
max_place = min(max_place, x + l)
print(ans) |
p02702 | s217906150 | Wrong Answer | s = input()
n = len(s)
count = 0
for i in range(n):
for j in range(i+4,n):
num = ""
for k in range(i,j+1):
num += s[k]
print(num)
if int(num)%2019 == 0:
count += 1
print(count) |
p02866 | s575997072 | Accepted | import collections
def main():
n = int(input())
D = list(map(int, input().split()))
mod = 998244353
if D[0] != 0:
print(0)
return
cnt = collections.Counter(D)
if cnt[0] > 1:
print(0)
return
ans = 1
for i in range(1, max(D)+1):
if cnt[i - 1] == 1:
continue
ans *= cnt[i - 1] ** cnt[i] % mod
ans %= mod
print(ans)
if __name__ == '__main__':
main()
|
p02572 | s536385392 | Accepted | n = int(input())
a = list(map(int, input().split()))
sum = sum(a) - a[0]
ans = 0
for i in range(n):
ans += a[i] * sum
if (i == n-1):
break
else:
sum -= a[i+1]
ans %= 10 ** 9 + 7
print(ans) |
p02646 | s806372114 | Accepted | a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if a < b:
if a + t * v >= b + t * w:
print('YES')
else:
print('NO')
else:
if a - t * v <= b - t * w:
print('YES')
else:
print('NO')
|
p03331 | s299986495 | Accepted | n = int(input())
min_sum = 99999999999999
if n == 2 :
print (2)
exit()
for i in range (1, n - 1):
first = i
second = n - i
first_sum = 0
second_sum = 0
while first > 0 :
last_digit_first = first % 10
first = first // 10
first_sum += last_digit_first
while second > 0 :
last_digit_second = second % 10
second = second // 10
second_sum += last_digit_second
if first_sum + second_sum <= min_sum :
min_sum = first_sum + second_sum
print(min_sum)
|
p02948 | s612803670 | Accepted | import sys
f=lambda:map(int,sys.stdin.readline().split())
n,m=f()
lt=sorted(tuple(map(int,input().split())) for _ in range(n))[::-1]
from heapq import *
q=[]
s=t=0
while t<m:
t+=1
while lt and lt[-1][0]==t:
a,b=lt.pop()
heappush(q,-b)
if q: s-=heappop(q)
print(s) |
p03438 | s810075607 | Wrong Answer | #!/usr/bin/env python3
# input
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b.sort()
for i in range(n):
if a[i] > b[i]:
print("No")
exit()
print("Yes")
|
p02594 | s056689115 | Wrong Answer | def aux(x):
if -40<=x<=40:
return 'Yes'
else:
return 'No' |
p03730 | s032540253 | Accepted | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
a, b, c = LI()
for i in range(a, a*b+1, a):
if i % b == c:
print('YES')
break
else:
print('NO') |
p03627 | s136079324 | Accepted | from collections import Counter
N=int(input())
A=Counter(list(map(int,input().split())))
x=[0,0]
for a in A:
if A[a]>1:x.append(a)
if A[a]>3:x.append(a)
x.sort()
print(x[-1]*x[-2]) |
p04033 | s902695405 | Accepted | import sys
import copy
import math
import itertools
import numpy as np
l = [int(c) for c in input().split()]
a = l[0]
b = l[1]
if a*b <= 0:
print("Zero")
elif a > 0 and b > 0:
print("Positive")
else:
if abs(b-a)%2==1:
print("Positive")
else:
print("Negative")
|
p03323 | s245969989 | Wrong Answer | a,b=map(int,input().split())
if a <= 8 and b <= 8:
print("yay")
else:
print(":(") |
p03657 | s535036767 | Wrong Answer | a,b = map(int,input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
print('Possible')
else:
print('Imossible') |
p03721 | s758213977 | Accepted | n,k = map(int,input().split())
a = [list(map(int,input().split())) for _ in range(n)]
a = sorted(a,key=lambda x:x[0])
ans = 0
for i in range(n):
ans += a[i][1]
if ans >= k:
print(a[i][0])
exit() |
p03061 | s176243823 | Accepted | import math
from itertools import accumulate
n = int(input())
a = list(map(int, input().split()))
fromleft = list(accumulate(a, math.gcd))
fromright = list(accumulate(a[::-1], math.gcd))[::-1]
gcd = []
gcd.append(fromright[1])
for i in range(1, n-1):
gcd.append(math.gcd(fromleft[i-1], fromright[i+1]))
gcd.append(fromleft[n-2])
print(max(gcd)) |
p03773 | s197745233 | Accepted | a,b = map(int,input().split())
print((a+b)%24) |
p02677 | s915665056 | Accepted | import math
A,B,h,m=map(int,input().split())
time=60*h+m
a=(0.5*time)%360
b=(6*time)%360
x=abs(a-b)
if x==0 or x==360:
c=abs(A-B)
elif x==180:
c=A+B
else:
c=math.sqrt(A**2+B**2-2*A*B*math.cos(math.radians(x)))
print(c) |
p02789 | s717788722 | Accepted | N, M = map(int, input().split())
if N == M:
print('Yes')
else:
print('No')
|
p02900 | s072739406 | Accepted | def prime_factorize(n):
a = []
while n % 2 == 0:
a.append(2)
n //= 2
f = 3
while f * f <= n:
if n % f == 0:
a.append(f)
n //= f
else:
f += 2
if n != 1:
a.append(n)
return a
from math import sqrt
from math import gcd
a, b = map(int, input().split())
x = gcd(a, b)
print(len(set(prime_factorize(x)))+1) |
p02823 | s175019901 | Accepted | # input
N, A, B = map(int, input().split())
# process
ans = 0
if A%2 == B%2:
ans = (B-A)//2
else:
if A-1 < N-B:
ans = A+(B-A-1)//2
else:
ans = N-B+1+(B-A-1)//2
# output
print(ans)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.