problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03327
s325171820
Accepted
print(['ABC','ABD'][int(input())>=1000])
p02755
s999761004
Wrong Answer
import math A, B = list(map(int, input().split())) amax = math.ceil((A + 1) / 8 * 100) - 1 amin = math.ceil(A / 8 * 100) bmax = math.ceil((B + 1) / 10 * 100) - 1 bmin = math.ceil(B / 10 * 100) if amin > bmax or bmin > amax: print(-1) else: print(int(max(amin, bmin)))
p03011
s917973673
Accepted
P, Q, R = map(int, input().split()) print(P+Q+R-max(P,Q,R))
p03605
s793178207
Accepted
s=input() if('9' in s): print("Yes") else: print("No")
p03408
s181271411
Accepted
n = int(input()) Blue = [input() for _ in range(n)] m = int(input()) Red = [input() for _ in range(m)] l = list(set(Blue)) print(max(0,max(Blue.count(l[i])-Red.count(l[i]) for i in range(len(l)))))
p02780
s500009100
Accepted
n,k=map(int,input().split()) p=list(map(int,input().split())) b=[0] for i in range(1,n+1): b.append(b[i-1]+p[i-1]) max_i=-1 max_v=0 for i in range(1,n+1-k): if b[i+k]-b[i]>max_v: max_i=i max_v=b[i+k]-b[i] ans=0 for i in range(k): ans+=(p[max_i+i]+1)/2 print(ans)
p02924
s594152993
Accepted
n = int(input()) if n % 2 == 0: print(int((n+1)*(n//2)-n)) else: print(int(n*(n//2)))
p03145
s901195831
Accepted
a, b, c = map(int, input().split()) print(int(a*b*0.5))
p02777
s262789883
Accepted
S, T = input().split() A, B = map( int, input().split() ) U = input() if( S==U ): A-=1 if( T==U ): B-=1 print( str(A)+" "+str(B) )
p02963
s384189203
Accepted
s = int(input()) m = 10**9 x = (m-s%m)%m y = (s+x)//m print(0,0,m,1,x,y)
p03371
s782715565
Accepted
a, b, c, x, y = map(int, input().split()) # ABを買わない、AorBを買わない、AandBを買わない if x >= y: print(min(x*a + y*b, 2*y*c + (x - y)*a, 2*x*c)) else: print(min(x*a + y*b, 2*x*c + (y - x)*b, 2*y*c))
p03109
s129314538
Accepted
s = input() if int(s[5:7]) <=4: print("Heisei") else: print("TBD")
p03163
s275221079
Accepted
N,W = map(int,input().split()) dp = [0]*(W+1) for _ in range(N): w,v = map(int,input().split()) for k in reversed(range(w,W+1)): dp[k] = max(dp[k], dp[k-w]+v) print(dp[W])
p02748
s943155719
Accepted
A,B,M =map(int,input().split()) a = [int(i) for i in input().split()] b = [int(i) for i in input().split()] x = [] for m in range(M): x.append([int(i) for i in input().split()]) _min = min(a)+min(b) for i in x: _min = min( (a[i[0]-1]+b[i[1]-1] - i[2]),_min) print(_min)
p02847
s563149405
Accepted
print(7-['SUN','MON','TUE','WED','THU','FRI','SAT'].index(input()))
p02570
s458012168
Accepted
data=str(input("")).split(" ") D=int(data[0]) T=int(data[1]) S=int(data[2]) if D<=T*S: print("Yes") else: print("No")
p02630
s952623999
Accepted
N = int(input()) A = list(map(int,input().split())) Q = int(input()) BC=[] for i in range (0, Q): BC.append([int(i) for i in input().split()]) #print(BC) yoso_count=[] for i in range(1,10**5+1): yoso_count.append([i,0]) sum = 0 for a in A: yoso_count[int(a)-1][1] += 1 sum += a #print(yoso_count,sum) ...
p03264
s340585133
Wrong Answer
k = int(input()) if k%2==0: print((k/2)**2) else: print((k+1)*(k-1)/4)
p03835
s256621134
Wrong Answer
#B - Sum of Three Integers K,S = map(int,input().split()) #0<=S<=3K res = 0 for X in range(0,K+1): if X > S: break for Y in range(0,K+1): if X + Y > S: break elif 0<=(X + Y - S) and (X + Y - S) <= K: res += 1 print(res)
p03862
s066920416
Wrong Answer
n, x = map(int, input().split()) a = list(map(int, input().split())) c = 0 for i in range(n-1): if a[i] + a[i+1] > x: if x > a[i]: c += a[i+1]-x a[i+1] -= a[i+1]-x else: c += a[i+1] a[i+1] = 0 c += a[i]-x a[i] -= a[i]-x print (c)
p03556
s160526482
Wrong Answer
import sys N=int(input()) for i in range(1,N): if i**2>N: print((i-1)**2) sys.exit() else: pass
p02546
s586528664
Accepted
import sys def input(): return sys.stdin.readline().rstrip() def main(): s = input() if s[-1] != 's': print(s+'s') else: print(s+'es') if __name__=='__main__': main()
p02880
s633858790
Accepted
N=int(input()) def zent(N): for i in range(1,10): for j in range(1,10): if j*i==N: return print("Yes") return print("No") zent(N)
p02553
s623256582
Wrong Answer
a,b,c,d = map(int, input().split()) if a >=0: if c > 0: print(b * d) elif d < 0: print(a * d) else: print(b*d) else: if c > 0: print(b * c) elif d < 0: print(a * c) else: print(a * c)
p03323
s674153820
Wrong Answer
A,B = map(int, input().split()) if A > 8 or B > 8: print("Yay!") else: print(":(")
p03632
s027939044
Accepted
a,b,c,d = map(int,input().split()) print(max(min(b,d)-max(a,c),0))
p02555
s508761766
Wrong Answer
s = int(input()) dp = [1] + [0] * s for i in range(3, s + 1): dp[i] = dp[i - 1] + dp[i - 3] print(dp[s])
p03711
s063201373
Accepted
x,y = map(int,input().split()) if x == y: print("Yes") else: if (x == 4 or x == 6 or x == 9 or x == 11) and (y == 4 or y == 6 or y == 9 or y == 11): print("Yes") elif (x == 1 or x == 3 or x == 5 or x == 7 or x == 8 or x == 10 or x == 12) and (y == 1 or y == 3 or y == 5 or y == 7 or y == 8 or y == 10 or y == 1...
p02814
s731229146
Accepted
N, M = map(int, input().split()) A = list(set(map(int, input().split(" ")))) G = A.copy() while not any(x % 2 for x in G): G = [i // 2 for i in G] if not all(x % 2 for x in G): print(0) exit(0) def gcd(a, b): while b: a, b = b, a % b return a def lcm(a, b): return a * b //...
p03035
s926670255
Accepted
a, b = map(int, input().split()) if a <= 5: print('0') elif a <= 12: print(b // 2) else: print(b)
p02606
s951785837
Accepted
L,R,d = map(int,input().split()) cnt=0 for i in range(L,R+1): if i%d==0: cnt+=1 print(cnt)
p03136
s029805438
Wrong Answer
n = int(input()) a = list(map(int, input().split())) if max(a) < sum(a): print('Yes') else: print('No')
p02748
s497625472
Wrong Answer
a=input() a1=input() a2=input() a=a.split() a1=a1.split(" ") a1=sorted(list(map(int,a1))) a2=a2.split() a2=sorted(list(map(int,a2))) l=[] v=int(a1[0])+int(a2[0]) l.append(v) for i in range(int(a[2])): dis=input() dis=dis.split() c=int(a1[int(dis[0])-1])+int(a2[int(dis[1])-1])-int(dis[2]) l.append(c) l1...
p02627
s708707501
Accepted
x=input() if x.islower(): print('a') else: print('A')
p02718
s503095380
Accepted
from math import ceil n, m = map(int, input().split()) a = list(map(int, input().split())) c = ceil(sum(a) / (4 * m)) d = 0 for e in a: if e >= c: d += 1 if d == m: print('Yes') exit(0) print('No')
p03795
s375283707
Accepted
n = int(input()) x = 800 * n y = (n //15) * 200 print(x-y)
p03220
s568541729
Accepted
N=int(input()) T, A=map(int, input().split()) H=list(map(int, input().split())) def kion(x): return T-x*0.006 ans=[abs(A-kion(h)) for h in H] p=ans.index(min(ans))+1 print(p)
p02664
s139882348
Accepted
print(input().replace(*'?D'))
p03971
s213839326
Accepted
n, a, b = map(int, input().split()) t = a + b s = input() for c in s: if c=='a' and t>0: print('Yes') t -= 1 elif c=='b' and t>0 and b>0: print('Yes') t -= 1 b -= 1 else: print('No')
p03760
s541772473
Accepted
import sys O = list(input()) E = list(input()) if len(O) - len(E) == 1: E.append('') for o, e in zip(O, E): sys.stdout.write(o + e) print()
p02768
s014018072
Accepted
n,a,b = list(map(int,input().split())) MOD = 10**9+7 def comb(n,r,MOD): x = n+1 y = min(r,n-r) numer = 1 denom = 1 for i in range(1,r+1): numer = numer*(x-i)%MOD denom = denom*(i)%MOD return numer * pow(denom,MOD-2,MOD) % MOD nCa = comb(n,a,MOD) nCb = comb(n,b,M...
p03254
s246111904
Wrong Answer
n, k =map(int,input().split()) data = list(map(int,input().split())) data = sorted(data) cnt = 0 for var in data: if var <= k: cnt += 1 k = k-var else: continue print(cnt)
p03284
s885425405
Wrong Answer
n, k = map(int, input().split()) print(n % k)
p03456
s731037874
Wrong Answer
a,b = map(int,input().split()) num = int(str(a)+str(b)) ans = 'No' for i in range(101): if num == i*i: ans = 'Yes' break print(ans)
p02817
s128144804
Accepted
import sys row = sys.stdin.readline def read_ints(row): return list(map(int, row().split())) S, T = row().rstrip().split() print(T+S)
p03944
s360229526
Accepted
W, H, N = map(int, input().split()) sx, sy, gx, gy = 0, 0, W, H for i in range(N): x, y, a = map(int, input().split()) if a == 1: sx = max(sx, x) elif a == 2: gx = min(gx, x) elif a == 3: sy = max(sy, y) else: gy = min(gy, y) dx, dy = gx-sx, gy-sy if dx <= 0 or dy <...
p02571
s829553989
Accepted
s = input() t = input() ans = 0 for i in range(len(s) - len(t) + 1): cnt = 0 for check_t, work in zip(t, s[i:i+len(t)]): if check_t == work: cnt+=1 ans = max(ans, cnt) print(len(t) - ans)
p03862
s224470745
Accepted
n,x=map(int, input().split()) a=[0]+list(map(int, input().split())) ans=0 for i in range(n): eat=max(a[i]+a[i+1]-x,a[i+1]-2*x,0) ans+=eat a[i+1]-=eat print(ans)
p03639
s995864916
Accepted
n = n = int(input()) a = [int(_) for _ in input().split()] b1 = b2 = b4 = 0 for c in a: if c % 4 == 0: b4 += 1 elif c % 2 == 0: b2 = -1 else: b1 += 1 if b1 <= b4+b2+1: print("Yes") else: print("No")
p03774
s952528835
Accepted
N, M = map(int, input().split()) ab = [list(map(int, input().split())) for _ in range(N)] cd = [list(map(int, input().split())) for _ in range(M)] for i in range(N): d = [] for j in range(M): d.append(abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])) print(d.index(min(d)) + 1)
p02947
s562950859
Accepted
N=int(input()) s=["".join(sorted(input())) for i in range(N)] s.sort() ans=0 t=0 for i in range(N): if s[t]!=s[i]: ans+=(i-t)*(i-t-1)//2 t=i i+=1 ans+=(i-t)*(i-t-1)//2 print(ans)
p03069
s718660784
Accepted
N = int(input()) S = input() right_white = S.count(".") left_black = 0 ans = right_white + left_black for i in range(N): if S[i] == ".": right_white -= 1 else: left_black += 1 ans = min(ans, right_white + left_black) print(ans)
p03721
s889295123
Wrong Answer
n,k = map(int,input().split()) l = [list(map(int,input().split())) for i in range(n)] a,b = [list(i) for i in zip(*l)] p = 0 for i in range(n): p += b[i] if p >= k: print(a[i]) break
p03632
s257843843
Accepted
A,B,C,D=map(int,input().split()) if B<=C or D<=A: print(0) else: large=max(A,C) small=min(B,D) print(small-large)
p03943
s450732462
Accepted
a=list(sorted(map(int,input().split()))[::-1]) print("Yes" if a[0]==a[1]+a[2] else "No")
p02963
s797752809
Accepted
N = int(input()) a = N // (10**9) b = N % (10**9) if b != 0: print(0,0,1000000000,1,1000000000-b,a+1) else: print(0,0,1000000000,0,0,a)
p03478
s923875076
Accepted
n,a,b=map(int,input().split()) count=0 for i in range(1,n+1): j=i t=0 while(i//10>=0and i>0): t+=i%10 i=i//10 if(t>=a and t<=b): count+=j print(count)
p03624
s481974930
Wrong Answer
s=input() for i in range(26): if not chr(ord('a')+i) in s: print(chr(ord('a')+i)) break else: print('NONE')
p02873
s157032177
Wrong Answer
s = input() n = len(s) L = [0]*(n+1) for i in range(n-1): if s[i]=='>' and s[i+1]=='<': j = i+1 c = 1 while j<n and s[j]=='<': L[j+1] = max(c,L[j+1]) c += 1 j += 1 j = i+1 c = 1 while j>=0 and s[j]=='>': L[j] = max(c,L[j]) c += 1 j -= 1 prin...
p02731
s617460386
Accepted
L=int(input()) print(((10**6)*(L**3)//27)/(10**6))
p02971
s682407975
Wrong Answer
N = int(input()) A = list() for i in range(N): A.append(int(input())) ma = max(A) for i in range(N): if ma != A[i]: print(ma) else: A[i] = 0 print(max(A))
p02714
s671243603
Accepted
N=int(input()) S=str(input()) r=S.count('R') g=S.count('G') b=S.count('B') ans=r*g*b dib=0 m=0 for i in range(N-2): m=(N+i)//2+1 for j in range(i+1,m): dib=j-i if j+dib<=N-1: if S[i]!=S[j] and S[i]!=S[j+dib] and S[j]!=S[j+dib]: ans=ans-1 ...
p03799
s734882784
Accepted
import sys import os def file_input(): f = open('ARC069/input.txt', 'r') sys.stdin = f def main(): #file_input() N,M=map(int, input().split()) if N*2>=M: print(str(M//2)) else: M-=N*2 print(str(N+M//4)) if __name__ == '__main__': main()
p02823
s881588481
Accepted
N,A,B = map(int,input().split()) if (B - A) % 2 == 0: print((B - A) // 2) else: print(min(A+B-1,2*N-A-B+1) // 2)
p03433
s869426753
Accepted
n=int(input()) a=int(input()) print("Yes" if (n%500)<=a else "No")
p02843
s325846449
Wrong Answer
x = int(input()) if x//100 < x%100: print(0) else: print(1)
p03486
s991683981
Accepted
S = sorted(list(str(input()))) T = sorted(list(str(input())),reverse=True) if S < T: print('Yes') else: print('No')
p04012
s404024597
Accepted
from collections import Counter w = input() dic = Counter(w) if all(v%2==0 for v in dic.values()): print('Yes') else: print('No')
p03607
s177144470
Wrong Answer
n = int(input()) a = [int(input()) for i in range(n)] l = sorted(a) same = 1 count = 0 for i in range(1, n): if l[i] == l[i - 1]: same += 1 continue if same % 2 == 1: count += 1 same = 1 if l[n - 1] != l[n - 2]: count += 1 print(count)
p03773
s403381530
Accepted
a,b=map(int,input().split()) a=(a+b)%24 print(a)
p04044
s402264319
Wrong Answer
ins = list(map(int, input().split())) N = ins[0] L = ins[1] Ss = [] for i in range(N): Ss.append(input().strip()) Ss.sort() print(' '.join(Ss))
p02595
s225006778
Wrong Answer
n ,d = map(int,input().split()) ans = 0 for i in range(n): x,y = map(int,input().split()) if d**2 <= x**2 + y**2 : ans += 1 print(ans)
p02823
s332717183
Accepted
N,A,B = map(int,input().split()) if (B-A) % 2 == 0: print((B-A)//2) else: print(min(A-1,N-B)+1 + (B-A-1)//2)
p02613
s358243344
Accepted
n = int(input()) a = [0] * 4 for loop in range(n): s = input() if s == 'AC': a[0] += 1 if s == 'WA': a[1] += 1 if s == 'TLE': a[2] += 1 if s == 'RE': a[3] += 1 s = ['AC', 'WA', 'TLE', 'RE'] for i in range(4): print(s[i], 'x', a[i])
p02705
s245071203
Accepted
R = int(input()) import math print(2*R*math.pi)
p03795
s559829064
Wrong Answer
N = int(input()) x = N * 800 y = N / 15 * 200 print(int(x-y))
p03071
s075499735
Accepted
A, B = map(int,input().split()) X = 0 if A > B: X = A A -= 1 if A > B: X += A print(X) else: X += B print(X) else: X = B B -= 1 if A > B: X += A print(X) else: X += B print(X)
p02639
s663662268
Accepted
import sys import math import itertools import collections import heapq import re import numpy as np rr = lambda: sys.stdin.readline().rstrip() rs = lambda: sys.stdin.buffer.readline().split() ri = lambda: int(sys.stdin.readline()) rm = lambda: map(int, sys.stdin.buffer.readline().split()) rl = lambda: list(map(int, s...
p03137
s920716100
Accepted
import sys N, M = map(int, input().split()) X = list(map(int, sys.stdin.readline().rsplit())) X.sort() tmp = [0] * (M - 1) for i in range(M - 1): tmp[i] = X[i + 1] - X[i] tmp.sort() if N >= M: print(0) else: print(sum(tmp[0:M - N]))
p03962
s061248751
Accepted
print(len(set(input().split())))
p03386
s779162820
Accepted
A, B, K = map(int, input().split()) if 2*K-1 >= B-A+1: for i in range(A, B+1): print(i) else: for i in range(A, A+K): print(i) for i in range(B-K+1, B+1): print(i)
p02556
s865073985
Accepted
N = int(input()) xy = [map(int, input().split()) for _ in range(N)] x, y = [list(i) for i in zip(*xy)] x_c = [x + y for (x, y) in zip(x, y)] y_c = [x - y for (x, y) in zip(x, y)] ans = max(x_c) - min(x_c) ans_1 = max(y_c) - min(y_c) if ans < ans_1: ans = ans_1 print(ans)
p03910
s328682269
Accepted
n=int(input()) i=0 while i*(i+1)//2<n: i+=1 no=i*(i+1)//2-n for j in range(1,i+1): if j!=no: print(j)
p02786
s789574267
Accepted
h = int(input()) for i in range(41): if h < 2**i: print(2**i-1) quit()
p03814
s902351350
Wrong Answer
s = input() a = s.index('A') z = s.index('Z') print(len(s[a:z+1]))
p03387
s699059238
Accepted
import sys input = sys.stdin.readline a = [int(x) for x in input().split()] a.sort() a, b, c = a a += (c - b) ans = c - b if (c - a) % 2 == 0: ans += (c - a) // 2 else: ans += 1 ans += (c + 1 - a) // 2 print(ans)
p02777
s289629364
Accepted
s, t = input().split() a, b = map(int, input().split()) u = input() if u == s: print(a-1, b) else: print(a, b-1)
p03386
s111650635
Accepted
a, b, k = list(map(int, input().split())) if b - a + 1 > 2 * k: [print(i) for i in range(a, a + k)] [print(i) for i in range(b - k + 1, b + 1)] else: [print(i) for i in range(a, b + 1)]
p03208
s461710182
Accepted
N, K = map(int, input().split()) h = [int(input()) for _ in range(N)] h.sort() ans = 10**10 for i in range(N - K + 1): ans_ = h[i + K - 1] - h[i] ans = min(ans, ans_) print(ans)
p03086
s334681836
Accepted
S = input() ans = 0 for i in range(len(S)): for j in range(i, len(S)): c = True for k in range(i, j+1): if S[k]!='A' and S[k]!='C' and S[k]!='G' and S[k]!='T': c = False if c and ans < j-i+1: ans = j-i+1 print(ans)
p03910
s888533447
Wrong Answer
n=int(input()) if n==1: print(1) else: if n%2==0: print(n//2+1,n//2-1) else: print(n//2+1,n//2)
p03673
s913739895
Accepted
from collections import deque n=int(input()) a=list(map(int,input().split())) b=deque([]) for i in range(n): if i%2==0: b.appendleft(a[i]) else: b.append(a[i]) if n%2==0: b=list(b)[::-1] print(*b)
p02988
s052096883
Accepted
n = int(input()) p = list(map(int, input().split())) ans = 0 for i in range(1, n - 1): if p[i - 1] < p[i] < p[i + 1] or p[i - 1] > p[i] > p[i + 1]: ans += 1 print(ans)
p02594
s337230587
Wrong Answer
ret = "Yes" if int(input()) >= 30 else "No"
p02935
s542622447
Accepted
n = int(input()) v = list(map(int,input().split())) v.sort() max = v[0] for i in range(len(v)-1): max = (max + v[i+1])/2 print(max)
p02792
s745359535
Wrong Answer
n=int(input()) a=0 for i in range(1,n): for j in range(1,n): if str(i)[0]==str(j)[-1] and str(i)[-1]==str(j)[0]: a=a+1 print(a)
p03998
s022746592
Accepted
s = {i:list(input()) for i in "abc"} x = "a" while s[x]: x = s[x].pop(0) print(x.upper())
p02879
s283355045
Wrong Answer
a,b=list(map(int,input().split())) print(a*b)
p03435
s668661365
Accepted
[a,b,c]=[int(i) for i in input().split()] [d,e,f]=[int(j) for j in input().split()] [g,h,i]=[int(k) for k in input().split()] t=0 if d-a == e-b and e-b == f-c: t+=1 if g-d == h-e and h-e == i-f: t+=1 if b-a == e-d and e-d == h-g: t+=1 if c-b == f-e and f-e == i-h: t+=1 if t== 4: print("Yes") else: print("No...
p02689
s097243571
Accepted
def resolve(): N, M = map(int, input().split()) H = list(map(int, input().split())) not_good = [] for i in range(M): A, B = map(lambda x: int(x) - 1, input().split()) if H[A] > H[B]: not_good.append(B) elif H[A] < H[B]: not_good.append(A) elif H[A]...