problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03479
s702403036
Accepted
n,m=map(int,input().split()) ans=0 now=n while now<=m: ans+=1 now*=2 print(ans)
p02556
s995915119
Wrong Answer
n = int(input()) xy = [] for i in range(n): l = list(map(int, input().split())) xy.append(l[0]+l[1]) print(max(xy)-min(xy))
p03435
s064777900
Wrong Answer
y1_list = list(map(int,input().split())) y2_list = list(map(int,input().split())) y3_list = list(map(int,input().split())) a1 = list() a2 = list() for i in range(3): a1.append(y1_list[i] - y2_list[i]) a2.append(y2_list[i] - y3_list[i]) if a1[0] == a1[1] and a1[2] == a1[0]: if a2[0] == a1[1] and a2[2] == a1[0]: print("Yes") else: print("No") else: print("Mo")
p04030
s680146579
Accepted
s = input() ans = [] for i in s: if i=='B': if ans != []: ans.pop(-1) else: ans.append(i) print(''.join(ans))
p03000
s505092486
Accepted
# B n,x = map(int, input().split()) d = 0 count = 1 l = list(map(int, input().split())) for i in range(n): d += l[i] if d <= x: count+=1 print(count)
p02823
s388947720
Wrong Answer
N, A, B = map(int, input().split()) ans = 0 if abs(B-A) % 2 == 0: ans = abs(B-A) // 2 else: if B > A: ans = min(N-A, B-1) if A > B: ans = min(N-B, A-1) print(ans)
p03998
s248213119
Accepted
S=list(input() for i in range(3)) i=0 while True: if S[i]=='': print(chr(i+65)) exit() c=S[i][0] S[i]=S[i][1:] i=ord(c)-97
p02646
s210712992
Wrong Answer
from decimal import Decimal a,v=map(int,input().split()) b,w=map(int,input().split()) t=int(input()) if a==b: print("YES") exit() elif v==w: print("NO") exit() a=abs(b-a)%abs(v-w) atai = Decimal(str(a)) if atai==0: for i in range(1,t+1): if i == Decimal(abs(b-a))/Decimal(abs(v-w)): print("YES") exit() print("NO")
p03721
s288204624
Accepted
N, K = map(int, input().split()) x = [] for i in range(N): a, b = map(int, input().split()) x.append([a, b]) x.sort(key=lambda x: x[0]) c = 0 for a, b in x: c += b if K <= c: print(a) exit()
p02570
s370175650
Accepted
D, T, S = map(int, input().split()) if D / S > T: print("No") else: print("Yes")
p02689
s473867253
Accepted
a=input().split() N=int(a[0]) M=int(a[1]) H=[int(x) for x in input().split()] way=[] for i in range(M): way.append([int(x) for x in input().split()]) dic={} for i in range(N): dic[i]=set() for h in way: dic[h[0]-1].add(h[1]-1) dic[h[1]-1].add(h[0]-1) print(sum(all([H[i]>H[hs] for hs in dic[i]])for i in range(N)))
p03607
s134719406
Wrong Answer
N = int(input()) arr = [ int(input()) for i in range(N)] arr.sort() cnt = 0 num = 1 a = arr[0] for i in range(1,N): if arr[i] == a: num += 1 else: num = 1 a = arr[i] if num % 2 == 1: cnt += 1 print(int(cnt))
p03437
s477076419
Accepted
x,y=map(int,input().split()) if x%y!=0: print(x) else: print(-1)
p02706
s891591387
Wrong Answer
import sys def main(): S = 0 N,M = map(int, input().split()) Lists = list(map(int, input().split())) count = 0 for List in Lists: S += List print(N-S) if __name__ == "__main__": main()
p03971
s139881648
Accepted
N, A, B = map(int, input().split()) C = input() D = [C[i:i+1] for i in range(N)] AA = 0 BB = 0 for i in(D): if i == 'c': print('No') elif i =='a' and A+B > AA+BB: print('Yes') AA += 1 elif i =='b' and A+B > AA+BB and BB < B: print('Yes') BB += 1 else: print('No')
p03673
s022267984
Wrong Answer
n = int(input()) a = list(map(int, input().split())) s = [] for i in a: s.append(i) s.reverse() print(s)
p02631
s918102796
Accepted
n = int(input()) a = [int(x) for x in input().split()] sm = 0 for x in a: sm ^= x ans = [a[i]^sm for i in range(n)] print(*ans)
p02909
s246764007
Accepted
s =input() print( ["Sunny","Cloudy","Rainy"][( ["Sunny","Cloudy","Rainy"].index(s)+1)%3])
p03221
s517399869
Accepted
import sys from operator import itemgetter read = sys.stdin.read N, M, *PY = map(int, read().split()) P = PY[::2] Y = PY[1::2] P, Y, I = zip(*sorted(zip(P, Y, range(M)), key=itemgetter(0, 1))) P = list(map(str, P)) answer = [] prev_p = '' n = 0 for p, i in zip(P, I): if prev_p == p: n += 1 else: prev_p = p n = 1 answer.append((p.zfill(6) + str(n).zfill(6), i)) answer.sort(key=itemgetter(1)) answer = [i for i, _ in answer] print('\n'.join(answer))
p02658
s037113182
Accepted
def main(): N = int(input()) A = list(map(int, input().split())) limit = pow(10, 18) A.sort() ans = 1 if A[0] == 0: print(0) else: for a in A: ans *= a if ans > limit: print(-1) break else: print(ans) if __name__ == "__main__": main()
p03774
s725123606
Wrong Answer
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): seq_min = 1e8 ans = -1 for j in range(m): seq = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]) if seq_min > seq: seq_min = seq ans = j print(ans + 1)
p02880
s265368851
Wrong Answer
N = int(input()) for i in range(1, 10): if N % i == 0: print("Yes") exit() print("No")
p02731
s171954762
Wrong Answer
l = int(input()) print((l**3)/9)
p02742
s450119640
Wrong Answer
H,W = map(int,input().split()) if H % 2 == 1 and W % 2 ==1: print((H*W+1)/2) else: print((H*W)/2)
p02690
s073615971
Accepted
x = int(input()) A=[] i=1 while i*i<=x: if x%i==0: A += [i, x//i] i += 1 for j in A: c= j//2 a = c while a**5-(a-j)**5 < x: a +=1 else: if a**5-(a-j)**5 == x: print(a,a-j) break
p03759
s590236541
Accepted
a, b, c = map(int, input().split()) print("YES" if b-a==c-b else "NO")
p02727
s451044672
Wrong Answer
x,y,a,b,c = (int(i_x) for i_x in input().split()) allredapple = input().split() allgreenapple = input().split() allnonapple =input().split() allredapple.sort(reverse=True) allgreenapple.sort(reverse=True) allnonapple.sort(reverse=True) zenalist = allredapple[:x] + allgreenapple[:y] zenalist.sort(reverse=True) for i in range(len(allnonapple)): for k in range(len(zenalist)): if int(zenalist[k]) < int(allnonapple[i]): zenalist[k] = allnonapple[i] break anser = 0 for i in range(len(zenalist)): anser += int(zenalist[i]) print(anser)
p03471
s428913568
Wrong Answer
N, Y = map(int, input().split()) def main(): if Y % 1000 != 0: print("-1 -1 -1") return cnt = Y // 1000 if 10000 * cnt < N: print("-1 -1 -1") return for i in range(N): for j in range(N): for k in range(N): if i + j + k != N: continue if Y == 10000 * i + 5000 * j + 1000 * k: print("%i %i %i".format(i, j, k)) if __name__ == "__main__": main()
p03627
s214087765
Accepted
from collections import Counter n = int(input()) a = list(map(int, input().split())) c = Counter(a) over4 = [] over2 = [] for k, v in c.items(): if v >= 4: over4.append(k) elif v >= 2: over2.append(k) over4.sort(reverse=True) over2.sort(reverse=True) x, y, z = 0, 0, 0 if len(over4) > 0: x = over4[0] ** 2 if len(over2) >= 2: y = over2[0] * over2[1] if len(over4) > 0 and len(over2) > 0: z = over4[0] * over2[0] print(max(x, y, z))
p03437
s744734219
Accepted
x, y = map(int, input().split()) if x%y == 0: print(-1) else: print(x)
p03486
s242853035
Wrong Answer
from collections import Counter s,t = open(0).read().split() ss = set(s) st = set(t) ls = [ord(x) for x in ss] lt = [ord(x) for x in st] cs = Counter([ord(x) for x in s]) ct = Counter([ord(x) for x in t]) if len(ls) == 1 and len(lt) == 1: if len(s) < len(t): print('Yes') else: print('No') else: if min(ls) >= max(lt): if cs[min(ls)] < ct[max(lt)]: print('Yes') else: print('No') else: print('Yes')
p03997
s793728281
Wrong Answer
import sys stdin = sys.stdin ns = lambda: stdin.readline().rstrip() ni = lambda: int(stdin.readline().rstrip()) nm = lambda: map(int, stdin.readline().split()) nl = lambda: list(map(int, stdin.readline().split())) p=[0]*3 p[0]=ns() p[1]=ns() p[2]=ns() turn='A' d={'A':0,'B':1,'C':2} while(len(p[d[turn]])==0): tmp=p[d[turn]][0] p[d[turn]][0]=[] turn=tmp print(turn)
p03721
s153059329
Accepted
n,k = list(map(int,input().strip().split())) dic= {} for i in range(n): a,b = list(map(int,input().strip().split())) if a in dic: dic[a] += b else: dic[a] = b arr = sorted(dic.items()) leng = 0 for i in arr: leng += i[1] if leng >= k: print(i[0]) exit()
p03835
s401663245
Wrong Answer
K,S = map(int,input().split()) cnt = 0 for x in range(K): for y in range(K): z = S - x - y if z <= K and x + y + z == S: cnt +=1 print(cnt)
p02791
s106556355
Accepted
N = int(input()) P = list(map(int, input().split())) ans = 0 min = P[0] for i in range(N): if min >= P[i]: ans += 1 min = P[i] print(ans)
p03106
s222954927
Accepted
a,b,k = map(int, input().split()) res = [] flg = 0 for i in range(1,101): if a % i == 0 and b % i == 0: res.append(i) print(res[-k])
p03592
s449683420
Accepted
import bisect,collections,copy,itertools,math,string import sys def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def main(): n, m, k = LI() for i in range(n): for j in range(m+1): if i*m + j*(n-2*i) == k: print("Yes") exit(0) else: print("No") main()
p02933
s192235032
Wrong Answer
a,s=int(input()),input() print(s if a<3200 else 'red')
p03861
s741144034
Accepted
#abc064 b a,b,x=map(int,input().split()) ans=b//x-(a-1)//x print(ans)
p03475
s003131184
Accepted
import sys readline = sys.stdin.readline N = int(readline()) CSF = [tuple(map(int, readline().split())) for _ in range(N-1)] for i in range(N): time = 0 for c, s, f in CSF[i:N-1]: if time < s: time = s else: time = (time+f-1)//f*f time += c print(time)
p03241
s877248406
Accepted
n,m=map(int,input().split()) yakusuu=[] for i in range(1,int(m**0.5)+1): if m%i==0: yakusuu.append(m//i) if m//i==i:continue yakusuu.append(i) ans=0 for y in yakusuu: if y<n:continue if m%y==0: ans=max(ans,m//y) print(ans)
p03427
s438904861
Accepted
N = list(map(int,list(input()))) ans = max(sum(N),N[0]-1+9*(len(N)-1)) print(ans)
p03262
s176914518
Accepted
N,X = map(int,input().split()) List = list(map(int,input().split())) abs_List = [abs(List[i] - X) for i in range(N)] import math from functools import reduce def gcd(*numbers): return reduce(math.gcd, numbers) def gcd_list(numbers): return reduce(math.gcd, numbers) print(gcd(*abs_List))
p02572
s011855489
Accepted
N=int(input()) A=list(map(int,input().split())) s=sum(A) res=0 for i in range(N-1): s-=A[i] res+=A[i]*s print(res%(10**9+7))
p02607
s870565264
Accepted
N = int(input()) a = list(map(int,input().split())) if(N%2 == 0): N = int(N/2) else: N = int(N/2)+1 count = 0 for i in range(1,N+1): if(a[(2*i-1)-1]%2 == 1): count += 1 print(count)
p03103
s823463102
Accepted
N, M = map(int, input().split()) Price = [tuple(map(int, input().split())) for _ in range(N)] Price.sort() ans = 0 for (a, b) in Price: if M >= b: ans += a * b M -= b else: ans += a * M M = 0 break print(ans)
p03385
s679088500
Accepted
S=input() if ('a' in S) and ('b' in S) and ('c' in S): print('Yes') else: print('No')
p02699
s018370485
Wrong Answer
s,w = map(int, input().split(' ')) if w >= s/2: print('unsafe') else: print('safe')
p03838
s430494951
Wrong Answer
def main(): x, y = map(int, input().split()) A = abs(abs(x) - abs(y)) if x < 0 and y < 0 and x < y: B = 0 elif x < 0 and y < 0 and x > y: B = 2 elif x >= 0 and y >= 0: if x < y: B = 0 else: B = 2 else: B = 1 print(A + B) if __name__ == "__main__": main()
p02814
s436019413
Accepted
def gcd(x, y): while y > 0: r = x % y x = y y = r return x def lcm(x, y): return x // gcd(x, y) * y n, m = map(int, input().split()) a = list(map(int, input().split())) l = 1 for i in range(n): a[i] //= 2 l = lcm(a[i], l) flg = True for x in a: if (l // x) % 2 == 0: flg = False break if flg: print(m // l - m // (l * 2)) else: print(0)
p03329
s009097525
Accepted
N = int(input()) dp = [N for i in range(N+1)] pow6 = [6**i for i in range(1,8)] pow9 = [9**i for i in range(1,7)] #print(pow6) #print(pow9) dp[0] = 0 for i in range(N+1): dp[i] = min(dp[i], dp[i-1]+1) for j in pow6: if i-j>=0: dp[i] = min(dp[i], dp[i-j] + 1) for j in pow9: if i-j>=0: dp[i] = min(dp[i], dp[i-j] + 1) #print(dp) print(dp[-1])
p03456
s225676270
Accepted
a=list(input().split()) aa=int(''.join(a)) for i in range(1,1000000): if i*i==aa: print('Yes') break else: print('No')
p03997
s572417215
Accepted
a = int(input()) b = int(input()) h = int(input()) print(int((b+a) * h / 2))
p03162
s723921251
Wrong Answer
N=int(input()) dp=[[0]*3 for i in range(N)] for i in range(1,N): a=list(map(int,input().split())) for j in range(3): for k in range(3): if j==k: continue dp[i][k]=max(dp[i][k],dp[i-1][j]+a[k]) print(max(dp[-1]))
p02584
s088121093
Accepted
X, K, D = map(int, input().split()) X = abs(X) a = X // D if K <= a: print(X - D * K) exit() X -= D * a K -= a if K % 2 == 1: print(abs(X - D)) else: print(X)
p02897
s339726323
Wrong Answer
n = int(input()) if n % 2 == 0: print(int(n/2)) else: print(-(-n//2))
p03699
s798235014
Accepted
n = int(input()) s = [] for i in range(n): s.append(int(input())) S = sum(s) if S % 10 != 0: print(S) exit() for a in sorted(s): if a % 10 != 0: print(S-a) exit() else: print(0)
p03437
s219517751
Wrong Answer
x,y=map(int,input().split()) if x==y: print(-1) else: for i in range(1,1000000): s=x*i if s%y!=0: print(s) exit()
p03617
s382704112
Wrong Answer
q,h,s,d=map(int,input().split()) n=int(input()) l=min(q*n*4,h*n*2,s*n,d*n/2) if l != d*n/2: print(l) else: m=min(q*4,h*2,s) print(int(d*(n-1)/2+m))
p02847
s259219900
Wrong Answer
S = input('Day of the week') print() if S== 'SUN': print(7) elif S == 'MON': print(6) elif S == 'TUE': print(5) elif S == 'WED': print(4) elif S == 'THU': print(3) elif S == 'FRI': print(2) elif S == 'SAT': print(1)
p02959
s786200224
Accepted
def main(): n = int(input()) a_list = list(map(int, input().split())) b_list = list(map(int, input().split())) ans = 0 for i in range(n): c = min(a_list[i], b_list[i]) ans += c d = min(b_list[i] - c, a_list[i + 1]) ans += d a_list[i + 1] -= d print(ans) if __name__ == "__main__": main()
p03107
s813850216
Wrong Answer
s=input() c=0 k=1 while(k!=0): b=s.replace('10','') c+=len(s)-len(b) s=b b=s.replace('01','') c+=len(s)-len(b) k=len(s)-len(b) s=b print(c)
p02959
s616348187
Accepted
N = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) ans = 0 for i in range(N): ans += min(A[i], B[i]) + min(A[i+1], max(B[i] - A[i], 0)) A[i+1] = max(0, A[i+1] - max(B[i] - A[i], 0)) print(ans)
p02622
s650304938
Accepted
s = input() t = input() ans=0 for i in range(len(s)): if t[i]!=s[i]: ans+=1 print(ans)
p03274
s250550584
Accepted
#!/usr/bin/env python3 import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 0 ;count = 0 ;pro = 1 n,k = map(int,input().split()) X = list(map(int,input().split())) for i in range(n-k+1): fi = X[i] en = X[i+k-1] if fi <= 0 and en >= 0: mans = min(mans,min(-fi,en)-fi+en) else: mans=min(mans,max(abs(fi),abs(en))) print(mans)
p02917
s348417656
Accepted
n=int(input()) b=list(map(int,input().split())) ans=b[0] for i in range(n-2): ans+=min(b[i],b[i+1]) ans+=b[n-2] print(ans)
p02983
s523020918
Accepted
L,R = list(map(int,input().split())) if R-L+1 >= 2019: ans = 0 else: ans = 2019 lis = [i%2019 for i in range(L,R+1)] for i in range(R-L): for j in range(i+1,R-L+1): s = (lis[i]*lis[j])%2019 ans = min(s,ans) print(ans)
p02760
s498588661
Accepted
import numpy as np bingo = [] for _ in range(3): l=list(map(int, input().split())) bingo.extend(l) N = int(input()) indices=[] for _ in range(N): num = int(input()) if num in bingo: indices.append(bingo.index(num)) candidates=[[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]] ans='No' for candidate in candidates: if len(list(set(indices)&set(candidate))) == 3: ans='Yes' break print(ans)
p02597
s920061566
Accepted
N=int(input()) S=input() rn,wn=0,0 for i in range(len(S)): if S[i]=='R': rn+=1 else: wn+=1 winr,rinw=0,0 for i in range(rn): if S[i]=='W': winr+=1 for i in range(rn,rn+wn): if S[i]=='R': rinw+=1 #print(rn,wn,rinw,winr) print(max(winr,rinw))
p03041
s788426064
Wrong Answer
s = input() if s == '0000' or (int(s[:2]) >= 13 and int(s[-2:]) >= 13): print('NA') elif 1 <= int(s[:2]) <= 12 and 1 <= int(s[-2:]) <= 12: print('AMBIGUOUS') elif 1 <= int(s[:2]) <= 12: print('MMYY') elif 1 <= int(s[-2:]) <= 12: print('YYMM')
p03087
s893661539
Accepted
N, Q = map(int, input().split(' ')) S = input() queries = tuple(tuple(map(int, input().split(' '))) for _ in range(Q)) cumsum = [0] * (N + 1) for i in range(N): cumsum[i + 1] = cumsum[i] if S[i:i + 2] == 'AC': cumsum[i + 1] += 1 for left, right in queries: print(cumsum[right - 1] - cumsum[left - 1])
p02832
s908811592
Accepted
from collections import deque N = int(input()) A = deque(map(int, input().split())) num = 1 ans = 0 while A: a = A.popleft() if a == num: num += 1 else: ans += 1 print(-1 if num == 1 else ans)
p03136
s620347129
Accepted
n=input() a=sorted([int(i) for i in input().split()])[::-1] if a[0]<sum(a[1:]): print("Yes") else: print("No")
p03860
s733446893
Accepted
# -*- coding: utf-8 -*- A, x, C = map(str, input().split()) print('A{}C'.format(x[0]))
p03607
s286787563
Accepted
import collections N = int(input()) A = list([int(input()) for _ in range(N)]) A = collections.Counter(A).values() ans = [x for x in A if x&1] print(len(ans))
p03998
s015637709
Wrong Answer
A = input() B = input() C = input() l = [A,B,C] i = [0,0,0] p = 0 while i[p] != len(l[p]): card = l[p][i[p]] if card == "a": i[0] += 1 p = 0 if card == "b": i[1] += 1 p = 1 if card == "c": i[2] += 1 p = 2 print(["A","B","C"][p])
p02988
s657133488
Accepted
n=int(input()) p=list(map(int,input().split())) ans=0 for i in range(n-2): if p[i]>p[i+1]>p[i+2] or p[i]<p[i+1]<p[i+2]: ans+=1 print(ans)
p03679
s393748353
Accepted
x,a,b=map(int,input().split()) if b-a<=0: print('delicious') elif b-a<=x: print('safe') else: print('dangerous')
p02939
s364788007
Accepted
s = input() n = len(s) now = '$' ans = 0 flg = True while s != '': if s[0] != now: ans += 1 now = s[0] s = s[1:] else: if now == s[:2]: now = s[:2] s = s[2:] else: ans += 1 now = s[:2] s = s[2:] print(ans)
p02596
s574163098
Accepted
import sys input = sys.stdin.readline k = int(input()) if k%2 == 0: print(-1) exit() if k == 7: print(1) exit() if k == 1: print(1) exit() if k % 5 == 0: print(-1) exit() seven = 7 d = 1 while seven != 0: seven += pow(7*pow(10,d,k),1,k) seven = pow(seven,1,k) d += 1 print(d)
p03241
s555187079
Accepted
N,M=map(int,input().split()) def divisor(n): divisors=[] for i in range(1,int(n**0.5+1)): if n%i==0: divisors.append(i) if i!=n//i: divisors.append(n//i) divisors.sort() return divisors a=divisor(M) ans=1 for i in a: if i *N<=M: ans=i print(ans)
p03220
s269808009
Accepted
n=int(input()) T,A=map(int,input().split()) H=list(map(int,input().split())) min_t=1000000 for x in H: res=abs(A-(T-x*0.006)) if min_t>=res: min_t=min(min_t,res) min_idx=H.index(x) print(min_idx+1)
p02881
s882291153
Accepted
import math N = int(input()) result1 = 0 result2 = 0 ans = float("inf") for count in range(1,int(math.sqrt(N))+1): if N % count == 0: ans = min(ans,count + N // count -2) print(ans)
p04045
s784124201
Accepted
n, k = map(int, input().split()) dlst = list(input().split()) while 1: for num in dlst: if num in str(n): break else: print(n) break n += 1
p03592
s642024448
Wrong Answer
N,M,K = map(int, input().split()) for i in range(N+1): b = i * M for j in range(M+1): b -= j * i b += j * (N-i) if b == K: print('Yes') exit() print('No')
p03059
s241344326
Accepted
A,B,T = map(int,input().split()) time = A biscuits = 0 while T+0.5 >= time: biscuits += B time += A print(biscuits)
p02600
s835151796
Accepted
x = int( input() ) if 400 <= x <= 599: print("8") elif 600 <= x <= 799: print("7") elif 800 <= x <= 999: print("6") elif 1000 <= x <= 1199: print("5") elif 1200 <= x <= 1399: print("4") elif 1400 <= x <= 1599: print("3") elif 1600 <= x <= 1799: print("2") elif 1800 <= x <= 1999: print("1")
p03262
s296287907
Accepted
import math import functools N,X = map(int,input().split()) A = list(map(int,input().split())) mylist=[abs(X-A[0])] for i in range(len(A)-1): mylist.append(abs(A[i+1]-A[i])) print(functools.reduce(math.gcd, mylist))
p03035
s484333017
Wrong Answer
A,B=map(int, input().split()) if A>=13: print(B) elif B>=6: print('{:.0f}'.format(B/2)) else: print(0)
p03239
s980573769
Accepted
n,t=map(int,input().split()) c=1001 for i in range(n): cn,tn=map(int,input().split()) if tn<=t: if cn<c: c=cn if c==1001: print("TLE") else: print(c)
p03994
s694853912
Wrong Answer
def main(): S = list(input()) k = int(input()) ans = [] for s in S: if k == 0: break if s != 'a' and ord(s) >= 123 - k: ans.append('a') k -= 123 - ord(s) else: ans.append(s) if k > 0: k %= 26 ans[-1] = chr((ord(ans[-1]) + k - 97) % 26 + 97) print(''.join(ans)) if __name__ == '__main__': main()
p03639
s220026566
Accepted
n = int(input()) a = list(map(int,input().split())) f = 0 t = 0 for ai in a: if ai%4 == 0: f += 1 elif ai%2 == 0: t += 1 e = n-f-t if t == 0: if f+1 >= e: print("Yes") else: print("No") else: if f >= e: print("Yes") else: print("No")
p03407
s295571704
Accepted
a, b, c = map(int, input().split()) if (a+b) >= c: print('Yes') else: print('No')
p02623
s215723238
Accepted
import bisect from itertools import accumulate N, M, K = map(int, input().split()) A = map(int, input().split()) B = map(int, input().split()) A_cumsum = list(accumulate(A)) B_cumsum = list(accumulate(B)) max_books = 0 for a, A_sum in enumerate([0] + A_cumsum): if A_sum > K: break else: b = bisect.bisect(B_cumsum, K - A_sum) max_books = max(a + b, max_books) print(max_books)
p02717
s142844546
Accepted
x,y,z = map(int,input().split()) a = z b = x c = y print(a,b,c)
p03944
s584083379
Accepted
w,h,n=map(int,input().split()) white_mostleft=0 white_mostright=w white_mostup=h white_mostdown=0 for _ in range(n): x,y,a=map(int,input().split()) if(a==1 and white_mostleft < x): white_mostleft=x elif(a==2 and white_mostright > x): white_mostright=x elif(a==3 and white_mostup > h-y): white_mostup = h-y elif(a==4 and white_mostdown < h-y): white_mostdown = h-y ans=max(0,white_mostright-white_mostleft) * max(0,white_mostup-white_mostdown) print(ans)
p02630
s766126302
Accepted
from collections import Counter N = int(input()) A = list(map(int, input().split())) Q = int(input()) query = [list(map(int, input().split())) for i in range(Q)] Asum = sum(A) Adict = Counter(A) for q in query: before = q[0] after = q[1] if before in Adict: Asum += (after-before) * Adict[before] if after in Adict: Adict[after] += Adict.pop(before) else: Adict[after] = Adict.pop(before) print(Asum)
p03943
s111794165
Accepted
a,b,c=map(int,input().split()) x=[a,b,c] y=sorted(x) if (y[0]+y[1])==y[2]: print('Yes') else: print('No')
p02866
s911118979
Accepted
from collections import defaultdict N = int(input()) D = list(map(int, input().split())) MOD = 998244353 p = defaultdict(int) for d in D: p[d] += 1 if p[0] == 1 and D[0] == 0: ans = 1 for i in range(N + 1): ans *= p[i] ** p[i + 1] ans %= MOD print(ans % MOD) else: print(0)
p03329
s182400604
Accepted
N = int(input()) cands = [1] for i in range(1, 7): if 6**i <= N: cands.append(6**i) if 9**i <= N: cands.append(9**i) dp = [10**6] * (N+1) dp[0] = 0 for i in range(1, N+1): for c in cands: if c <= i: dp[i] = min(dp[i], dp[i-c]+1) print(dp[-1])