problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03605
s587097693
Wrong Answer
N = str(input()) if N[0]== 9 or N[1]==9: print('Yes') else: print('No')
p02982
s714084962
Accepted
N, D = map(int, input().split()) X = [list(map(int, input().split())) for _ in range(N)] cnt = 0 for i in range(N-1): for j in range(i+1, N): a = 0 for l in range(D): a += (X[i][l] - X[j][l])**2 a = a ** 0.5 if a.is_integer(): cnt += 1 print(cnt)
p03127
s637653887
Accepted
N = int(input()) A = set(map(int,input().split())) def helper(A): v = min(A) ans = set() for a in A: if a%v!=0: ans.add(a%v) ans.add(v) return ans while len(A)>1: A = helper(A) print(min(A))
p03211
s091545451
Wrong Answer
S = input() mn = abs(753 - int(S[0:3])) for i in range(2, len(S)): mn = min(mn, abs(753 - int(S[i:i+3]))) print(mn)
p03323
s001253339
Accepted
A = max(list(map(int,input().split()))) if A <= 8: print("Yay!") else: print(":(")
p03693
s543061370
Accepted
r, g, b = map(int, input().split()) n = int(100 * r + 10 * g + b) if n % 4 == 0: print("YES") else: print("NO")
p03721
s702044543
Wrong Answer
N, K = map(int, input().split()) for i in range(N): a, b = map(int, input().split()) K -= b if K <= 0: print(a) exit()
p03481
s258921319
Wrong Answer
x,y = tuple(map(int,input().split())) for i in range(1,10*4): x<<=1 if x>y: print(i) break
p02607
s147500024
Accepted
n = int(input()) *a, = map(int, input().split()) print(sum(i%2 for i in a[::2]))
p02612
s963576284
Accepted
N = int(input()) M = (N+999)//1000 print(M*1000-N)
p02866
s268696208
Wrong Answer
N,*D=map(int,open(0).read().split()) c=[0]*N for i in D:c[i]+=1 m=max(D) if D[0]>0 or c[0]>1 or 0 in c[:m]:print(0);exit() a=1 for i in range(m):a*=c[i]**c[i+1] print(a)
p02699
s396304645
Accepted
s,w = map(int,input().split()) if s > w: print("safe") else: print("unsafe")
p03803
s214888718
Wrong Answer
a, b = map(int, input().split()) if a == 1 and b == 2: print('Alice') elif a == 2 and b == 1: print('Bob') elif a == 13 and b == 1: print('Bob') elif b == 1 and b == 13: print('Alice') elif a > b: print('Alice') elif a == b: print('Draw') else: print('Bob')
p03000
s624766406
Wrong Answer
import math import string def readints(): return list(map(int, input().split())) def nCr(n, r): return math.factorial(n)//math.factorial(n-r)*math.factorial(r) n, x = map(int, input().split()) l = list(map(int, input().split())) # print(l) ll = [0] sum = 0 for i in range(n): sum += l[i] ll.append(sum) # print(ll) cnt = 0 for i in range(n): if ll[i] <= x: cnt += 1 print(cnt)
p03001
s424620031
Accepted
W,H,x,y=map(int,input().split()) S=(W*H)/2 if 2*x==W and 2*y==H: f=1 else: f=0 print(S,f)
p02658
s613351442
Accepted
n = int(input()) a = list(map(int,input().split())) if 0 in a: print(0) else: ans = 1 for i in range(0,n): ans *= a[i] if ans >= 1000000000000000001: ans = -1 break print(ans)
p03605
s966218836
Accepted
N=input() if N[0]=='9' or N[1]=='9': print('Yes') else: print('No')
p02682
s731407248
Wrong Answer
from sys import stdin A,B,C,K=list(map(int,(stdin.readline().strip().split()))) if A+B>=K:print(A) else:print(A+(K-(A+B)*(-1)))
p03427
s554725069
Accepted
import sys def input(): return sys.stdin.readline().strip() def resolve(): n=input() keta=len(n) saileft=int(n[0]) if n[1:].count('9')==keta-1: print(saileft+(keta-1)*9) else: print(saileft-1+9*(keta-1)) resolve()
p02720
s214744692
Wrong Answer
K=int(input()) from collections import deque num=deque() for i in range(1,10): num.append(i) for j in range(K): l=num.popleft() if l%10 !=0: num.append(l*10+(l%10-1)) num.append(l*10) if l%10 != 9: num.append(l*10+(l%10+1)) print(l)
p03385
s878966124
Accepted
print("YNeos"[len(set(input()))!=3::2])
p03774
s233574294
Accepted
N, M = map(int, input().split()) ab = [list(map(int, input().split())) for x in range(N)] cd = [list(map(int, input().split())) for x in range(M)] for x in range(N): d1 = 999999999999999999 for y in range(M): d = abs(ab[x][0] - cd[y][0]) + \ abs(ab[x][1] - cd[y][1]) if d < d1: d1 = d ans = y + 1 print(ans)
p02768
s442862904
Accepted
n,a,b = map(int,input().split()) mod = pow(10,9)+7 ans = pow(2,n,mod) - 1 anu = 1 ade = 1 bnu = 1 bde = 1 for i in range(max(a,b)): if i < a: anu = (anu*(n-i))%mod ade = (ade*(a-i))%mod if i < b: bnu = (bnu*(n-i))%mod bde = (bde*(b-i))%mod ade = pow(ade,mod-2,mod) bde = pow(bde,mod-2,mod) ans -= (anu*ade)%mod ans -= (bnu*bde)%mod print(ans%mod)
p02862
s665996067
Accepted
X,Y = map(int,input().split()) MOD = 10**9+7 if (X+Y)%3: print(0) exit() n = (X+Y)//3 r = X-n if not 0 <= r <= n: print(0) exit() MAXN = r inv = [0,1] + [0]*MAXN for i in range(2,MAXN+2): inv[i] = -inv[MOD%i] * (MOD // i) % MOD def comb(n,r): ret = 1 for i in range(r): ret *= n-i ret *= inv[i+1] ret %= MOD return ret print(comb(n,r))
p03360
s139255935
Accepted
a,b,c=map(int,input().split()) k=int(input()) print(a+b+c+max(a,b,c)*(2**k-1))
p02897
s842659301
Accepted
# A,B,C = map(int, input().split()) N = int(input()) # s = int(input()) # C = int(input()) # s= input() print((N/2)/N if N%2 == 0 else (N//2+1)/N)
p02970
s085039359
Wrong Answer
a,b = map(int,input().split()) r = b*2+1 if a%b == 0: print(a//r) else: print(a//r+1)
p03448
s932880682
Accepted
#!/usr/bin/env python # -*- coding: utf-8 -*- (A, B, C, X) = [int(input()) for i in range(4)] r = 0 for a in range(A + 1): for b in range(B + 1): for c in range(C + 1): if 500 * a + 100 * b + 50 * c == X: r += 1 print(r)
p02795
s141085956
Wrong Answer
h = int(input()) w = int(input()) n = int(input()) print(n % max(h,w))
p03386
s138955578
Accepted
# -coding: utf-8 - a,b,k = map(int, input().split()) s = range(a,b+1) s_small = s[:k] s_large = s[-k:] ans = list(set(s_small)|set(s_large)) ans = sorted(ans) for i in ans: print(i)
p03254
s450869555
Accepted
def resolve(): n, x = map(int, input().split()) a = [int(i) for i in input().split()] a = sorted(a) ans = 0 for _a in a[:-1]: x = x - _a if x >= 0: ans += 1 if x == a[-1]: ans += 1 print(ans) resolve()
p02682
s955299622
Accepted
a, b, c, k = input().split() count = 0 if int(a) <= int(k): count += int(a) if int(k)-int(a) >= int(b): count -= int(k)-int(a)-int(b) else: count = int(k) print(count)
p02718
s361796341
Wrong Answer
N,M = input().split() A=list(map(int, input().split())) N=int(N) M=int(M) total=sum(A) cnt=0 for i in range(N): if A[i]>total*(1/(4*M)): cnt=cnt+1 if cnt>=M: print('Yes') else: print('No')
p03137
s767320193
Accepted
n, m = list(map(int, input().split())) #n, m = list(map(int, input().split())) x = list(map(int, input().split())) # abc = [int(input()) for i in range(5)] # n = int(input()) # n, m = list(map(int, input().split())) if n >= m: print(0) else: x.sort() ans = x[-1]-x[0] p = [] for i in range(m-1): p.append(x[i+1]-x[i]) p.sort(reverse=True) for i in range(n-1): ans -= p[i] print(ans)
p02641
s363603476
Wrong Answer
# coding: utf-8 X, N = map(int, input().split()) P = list(map(int, input().split())) Ans = X for i in range(N // 2): if not(X - i in P): Ans = X - i break elif not (X + i in P): Ans = X + i break print(Ans)
p03860
s895071010
Accepted
arr = list(input().split()) print( arr[0][0] + arr[1][0] + arr[2][0] )
p03379
s420522245
Accepted
import statistics n=int(input()) x=list(map(int,input().split())) y=statistics.median(x) xs=sorted(x) for i in x: if i<y: print(xs[n//2]) else: print(xs[n//2-1])
p02783
s733709180
Accepted
H, A = map(int, input().split()) count = 0 while(1): count += 1 H = H - A if H <= 0: break print(count)
p03821
s743149674
Accepted
def solve(): N = int(input()) AB = [list(map(int, input().split())) for _ in range(N)] ret = 0 total = 0 for i in range(N)[::-1]: diff = (-1*(AB[i][0]+ret))%AB[i][1] ret += diff print(ret) solve()
p02570
s702265152
Wrong Answer
D, T, S = map(int, input().split()) if (S * T >= D): print("Yes") else: print("NO")
p03251
s172975801
Wrong Answer
n,m,x,y = map(int,input().split()) A = list(map(int,input().split())) B = list(map(int,input().split())) ans = 0 #0 = War, 1= No War A.sort() B.sort() #print(A[-1]) #print(B[0]) for i in range(x+1,y+1): if A[-1]<i and B[0]>=i: print(i) pass else: ans = 1 print("ans") if ans == 1: print("No War") else: print("War")
p03494
s120893583
Accepted
n = int(input()) l = list(map(int,input().split())) ans = max(l) for i in l: count = 0 while i % 2 == 0: count += 1 i //= 2 ans = min(ans,count) if ans == 0: print(0) exit() print(ans)
p02743
s662669354
Accepted
a,b,c=map(int,input().split()) print("Yes" if c-a-b>=0 and 4*a*b<(c-a-b)**2 else "No")
p03711
s918376539
Accepted
x,y=map(int,input().split()) a=[1,3,5,7,8,10,12] b=[4,6,9,11] if x==y: print("Yes") else: if (x in a and y in a) or (y in b and x in b): print("Yes") else: print("No")
p02916
s398890677
Wrong Answer
n=int(input()) a=[int(n) for i in input().split()] b=[int(n) for i in input().split()] c=[int(n) for i in input().split()] s=sum(b) for i in range(n-1): if a[i+1]-a[i]==1: s+=c[a[i]-1] print(s)
p03328
s414003240
Wrong Answer
import sys import itertools sys.setrecursionlimit(1000000000) from heapq import heapify,heappop,heappush,heappushpop import collections a,b = map(int,input().split()) li = [] for i in range(1,1001): li.append((1/2)*i*(i+1)) for i in range(len(li)): if li[i]>=a and li[i]<=b: check = i break print(int(li[check]-a))
p04012
s435867619
Accepted
import collections w = input() c = collections.Counter(w).most_common() for i in c: if i[1] % 2 != 0: print('No') exit() print('Yes')
p03035
s731925723
Accepted
A, B = [int(i) for i in input().split()] if A < 6: print(0) elif A < 13: print(B // 2) else: print(B)
p03017
s176199019
Accepted
n,a,b,c,d = map(int,input().split()) s = input() a,b,c,d = a-1,b-1,c-1,d-1 if s[a:c+1].count('##') > 0 or s[b:d+1].count('##') >0: print('No') exit() if c > d: if s[b-1:d+2].count('...') == 0: print('No') exit() print('Yes')
p03385
s638860278
Accepted
S=input() if len(set(S))==3: print("Yes") else: print("No")
p03220
s166829754
Wrong Answer
n=int(input()) t,a=map(int,input().split()) h=list(map(int,input().split())) ans=[] for i in range(n): ans.append(a-(t-h[i]*0.006)) print(ans.index(min(ans))+1)
p03106
s906345636
Wrong Answer
K=list(map(int,input().split())) ans=0 for i in range(1,min(K[0],K[1]+1)): if K[0]%i==0 and K[1]%i==0:ans+=1 if ans==K[2]: print(i) break
p03251
s699751703
Accepted
n,m,X,Y = map(int,input().split()) x = list(map(int,input().split())) y = list(map(int,input().split())) s = 1 for i in range(-100,101): if X < i <= Y and max(x) < i <= min(y): s = 0 print(["No War","War"][s])
p02732
s857438192
Wrong Answer
from collections import Counter from copy import deepcopy n = int(input()) a = list(map(int, input().split())) c = Counter(a) for i in range(n): tmp_c = deepcopy(c) ans = 0 tmp_c[a[i]] -= 1 for v in tmp_c.values(): ans += v*(v-1)/2 print(ans)
p02576
s187612533
Accepted
n, x, t = map(int,input().split()) act = n // x if n % x != 0: act += 1 print(int(act * t))
p03705
s778067253
Wrong Answer
N, A, B = map(int, input().split()) min_ab = (N-1)*A+B max_ab = (N-1)*B+A print(max_ab-min_ab+1)
p02628
s552975428
Accepted
n,k = map(int, input().split()) num_list = list(map(int, input().split())) num_list.sort() min_list = num_list[:k] min = sum(min_list) print(min)
p02678
s879486566
Wrong Answer
n,m=map(int,input().split()) li=[[] for i in range(n)] for i in range(m): ai,bi=map(int,input().split()) print("No")
p02971
s093652618
Accepted
N = int(input()) A = [int(input()) for _ in range(N)] B = max(A) C = [B]*N D = sorted(A)[-2] i = A.index(B) if A.count(B) == 1: C[i] = D for a in C: print(a)
p02754
s275888855
Accepted
n,a,b=map(int,input().split()) q,r = n//(a+b),n%(a+b) print(q*a + min(r,a))
p03699
s183192874
Accepted
N=int(input()) s=[] sum=0 for i in range(N): s.append(int(input())) sum+=s[i] if(sum%10!=0): print(sum) exit() else: m=0 for i in range(N): t=sum-s[i] m=max(t,m) if t%10!=0 else m print(m)
p02911
s791677334
Wrong Answer
from collections import Counter N,K,Q = map(int,input().split()) A = [int(input()) for _ in range(Q)] c = dict(Counter(A)) print(c) for i in range(1,N+1): if i in c: t = Q - c[i] print('Yes' if t < K else 'No') else: print('Yes' if Q < K else 'No')
p03720
s571341238
Wrong Answer
import numpy as np n, m = map(int, input().split()) mat = [[0] * n] * n mat = np.array(mat) for i in range(m): a, b = map(int, input().split()) mat[a - 1, b - 1] = 1 mat[b - 1, a - 1] = 1 for i in range(n): ans = np.sum(mat[i, :]) print(ans)
p03623
s466164911
Wrong Answer
x, a, b = map(int, input().split()) print("A" if abs(a - x) < abs(a - x) else "B")
p03293
s975771065
Wrong Answer
print('YNeos'[input()==input()[::-1]::2])
p02717
s693819160
Accepted
a,b,c=map(int,input().split()) print(c,a,b)
p02681
s938175964
Wrong Answer
S = input() T = input() if len(T) - len(S) == 1: if S in T: print("Yes") else: print("No") else: print("No")
p03821
s752732601
Wrong Answer
def main(): N, *AB = map(int, open(0).read().split()) ans = 0 for i in range(N - 1, 0, -1): a = AB[i * 2 + 0] b = AB[i * 2 + 1] ans += (b - a - ans) % b print(ans) if __name__ == "__main__": main()
p02899
s827819798
Accepted
N = int(input()) A = {num: i+1 for i,num in enumerate(map(int, input().split()))} for i in range(1, N+1): if i == N: print(A[i]) else: print(A[i], end=" ")
p03773
s173033349
Accepted
_input = input().split(" ") _A = int(_input[0]) _B = int(_input[1]) if _A + _B < 24: print(_A + _B) else: print(_A + _B - 24)
p02811
s926321903
Wrong Answer
import sys # input=sys.stdin.readline val = [] val = input() arrays = val.split(' ') a = int(arrays[0])*500 if a>=int(arrays[1]): print("Yes") elif a<int(arrays[1]): print("No") print(arrays, a) sys.exit()
p03457
s263310008
Wrong Answer
n = int(input()) a,b,c=0,0,0 for i in range(n): t,x,y = map(int, input().split()) sa = t-a if sa<x+y: print("No") exit() else: tw = sa-x-y if tw%2!=0: print("No") exit() print("Yes")
p04045
s352300790
Accepted
fn=str n,k=map(int, input().split()) ds=list(map(fn, input().split())) while any(i in fn(n) for i in ds): n+=1 print(fn(n))
p02676
s673205619
Accepted
k=int(input()) s=input() if len(s)<=k: print(s) else: print(s[:k]+'...')
p02711
s192815391
Accepted
N = input() if "7" in N: print("Yes") else: print("No")
p02784
s935418622
Accepted
h, n = map(int, input().split()) a = [int(i) for i in input().split()] sum = 0 for i in range(n): sum += a[i] print("Yes" if h <= sum else "No")
p03557
s823616831
Wrong Answer
import bisect n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) c = list(map(int,input().split())) a.sort() c.sort() ans = 0 print(a) print(b) print(c) for i in range(n): ans += bisect.bisect_left(a,b[i])*n-(bisect.bisect_right(c,b[i])) print(ans)
p03327
s902112018
Wrong Answer
n = int(input()) if n >= 1000: print('ABC') else: print('ABD')
p02727
s638961934
Accepted
def main(): x,y,a,b,c=map(int,input().split()) P=list(map(int,input().split())) P.sort(reverse=True) Q=list(map(int,input().split())) Q.sort(reverse=True) R=list(map(int,input().split())) A=P[:x]+Q[:y]+R A.sort(reverse=True) print(sum(A[:x+y])) if __name__=='__main__': main()
p04043
s846156021
Accepted
a=sorted(list(map(int,input().split()))) print("YES" if a == [5,5,7] else "NO")
p03211
s158709254
Accepted
s = input() t = len(s) l = [999]*(t - 2) for i in range(t - 2): u = int(s[i:i+3]) if u <= 753: l[i] = 753 - u else: l[i] = u - 753 print(min(l))
p02795
s486877074
Accepted
h = int(input()) w = int(input()) n = int(input()) x = 0 y = 0 c = 1 if h > w: x = h y = h else: x = w y = w while x < n: c += 1 x += y print(c)
p03075
s536581526
Accepted
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): (*A,) = map(int, read().split()) k = A[-1] for i in range(5): for j in range(i + 1, 5): if A[j] - A[i] > k: print(':(') return print('Yay!') return if __name__ == '__main__': main()
p02843
s531091604
Accepted
X = int(input()) mod = X % 100 syou = X // 100 if (mod <= syou * 5): print('1') else: print('0')
p03037
s339379075
Wrong Answer
n,m = map(int,input().split()) l_max=0 r_min=n for i in range(m): l,r = map(int,input().split()) l_max = max(l_max,l) r_min = min(r_min,r) print(r_min - l_max+1)
p03274
s793816623
Wrong Answer
#!/usr/bin/env python3 n, k, *x = map(int, open(0).read().split()) ans = 10**18 neg = [] pos = [0] for i in x: if i < 0: neg.append(i) else: pos.append(i) neg.append(0) k += 1 c = len(neg) c -= k -min(k, len(pos)) k = min(k, len(pos)) while c > 0 and k > 1: c -= 1 k -= 1 ans = min(ans, -neg[c] * 2 + pos[k], -neg[c] + pos[k] * 2) print(ans)
p02570
s288846922
Wrong Answer
d, t, s = map(int, input().split()) res = d / t if s <= res: print("no") else: print("yes")
p02923
s297915083
Wrong Answer
N = int(input()) H = list(map(int, input().split())) ans = 0 cnt = 0 for i in range(N - 1): if H[i] >= H[i + 1]: cnt += 1 else: ans = max(cnt, ans) cnt = 0 print(ans)
p02753
s779762408
Accepted
st = input() if st == 'A'*3 or st == 'B'*3: print('No') else: print('Yes')
p03644
s091922997
Accepted
N = int(input()) for i in range(0,8): if 2**i <= N: ans = 2**i print(ans)
p02726
s331144095
Accepted
N,X,Y=map(int,input().split()) A=[0]*(N-1) for i in range(1,N): for j in range(i+1,N+1): A[min(j-i,abs(X-i)+1+abs(j-Y),abs(Y-i)+1+abs(j-X))-1]+=1 for a in A: print(a)
p02576
s121778370
Wrong Answer
#入力受け取り N=個数 X=焼ける数 T=時間 N,X,T = map(int, input().split()) #回数定義 count = 0 #NがXで割り切れなければ+1 if N % X == 0: count = N / X else: count = N // X + 1 #回数×時間 ans = count * T print(ans)
p03693
s238024833
Accepted
r, g, b = map(int, input().split()) if (g*10+b) % 4 == 0: print('YES') else: print('NO')
p02718
s304246092
Wrong Answer
import math N,M = (int(y) for y in input().split()) A = list(map(int, input().split())) X = math.ceil(sum(A)/(4*M)) B = [i for i in A if i >= X] print(sum(A)) print(X) print(B) if len(B) >= M: print("Yes") else: print("No")
p03416
s904395143
Accepted
a, b = map(int, input().split()) c = 0 for i in range(a, b+1): j = str(i) if j[0] == j[4] and j[1] == j[3]: c += 1 print(c)
p02765
s423177773
Accepted
N, R = map(int, input().split()) if N >= 10: print(R) else: print(R + (100 * (10 - N)))
p03556
s273683571
Wrong Answer
n=int(input()) max=0 for i in range(1,n): if i**2<=n: if i**2>max: max=i**2 else: break print(max)
p02678
s612797030
Wrong Answer
from scipy.sparse.csgraph import dijkstra from scipy.sparse import csr_matrix import numpy as np # D N, M = list(map(int, input().split())) ABs = np.array([list(map(int, input().split())) for i in range(M)]) row = list(ABs.T[0]-1) col = list(ABs.T[1]-1) data = [1] * (M) csr = csr_matrix((data, (row, col)), shape=(N, N)) from_starts, procs = dijkstra(csr, indices=[0], directed=False, return_predecessors=True) proc = procs[0]+1 if -9999 in proc[1:]: print('No') else: print('Yes') for i in range(N-1): print(proc[i+1])
p03328
s455189569
Wrong Answer
a,b = map(int,(input().split())) i = 1 result = 0 #雪の高さX #1 3 6 10 left = 0 right =0 while True: result = result + i i += 1 if result > a: left = result break while True: result = result + i i += 1 if result > b: right = result break print(left - a) #print(right)
p02546
s867927888
Accepted
word = input() if word[-1] == 's': print(word, end='es\n') else: print(word, end='s\n')