problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02987
s831536692
Accepted
s = input() setslen = len(set(s)) if setslen == 2: print('Yes') else: print('No')
p02983
s091483103
Wrong Answer
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(): L, R = map(int, readline().split()) if R - L >= 10000: print(0) else: A = [i % 2019 for i in range(L, R + 1)] A.sort() print(A[0] * A[1]) return if __name__ == '__main__': main()
p03371
s622438354
Accepted
a, b, c, x, y = map(int, input().split()) if x < y: print(min(2*c*y, 2*c*x+b*(y-x), a*x+b*y)) else: print(min(2*c*x, 2*c*y+a*(x-y), a*x+b*y))
p03103
s723753738
Accepted
n,m = map(int,input().split()) ab_lst = [list(map(int,input().split())) for i in range(n)] ab_lst.sort() total_money = 0 total_number = 0 for i in range(n): money = ab_lst[i][0] number = ab_lst[i][1] number = min(number, m-total_number) total_money += number * money total_number += number if total_number==m: break print(total_money)
p04044
s536210086
Wrong Answer
N, L = [int(i) for i in input().split(' ')] words = [input() for i in range(N)] words.sort(key=lambda x: x[0]) for word in words: print(word)
p02918
s062684132
Wrong Answer
n,k=map(int,input().split()) S=input() c=0 d=0 for i in range(n-1): if S[i]==S[i+1]: c+=1 if S[i]!=S[i+1]: d+=1 print(c+2*d-1 if (d<=k and S[0]!=S[-1]) else c+2*min(d,k))
p02753
s872735400
Accepted
S = input() if S == 'AAA' or S == 'BBB': print('No') else: print('Yes')
p03475
s128124020
Wrong Answer
N = int(input()) C = [0] S = [0] F = [0] for i in range(N - 1): c, s, f = map(int, input().split()) C.append(c) S.append(s) F.append(f) for i in range(1, N): t = 0 for j in range(i, N): if j == i: t += S[j] if t >= S[j]: t += t % F[j] + C[j] else: t = S[j] + C[j] print(t) print(0)
p03038
s110832071
Accepted
from collections import Counter def main(): n, m = map(int, input().split()) a = Counter(list(map(int, input().split()))) cards = [] for i, v in a.items(): cards.append([i, v]) for _ in range(m): cards.append(list(map(int, input().split()))[::-1]) cards.sort(key=lambda x: x[0], reverse=True) ans = 0 for i, v in cards: ans += i * min(v, n) n -= min(v, n) print(ans) if __name__ == '__main__': main()
p02953
s748457976
Accepted
n = int(input()) A = list(map(int,input().split())) ans = 0 for i in range(n-1): if ans > A[i+1]: print('No') exit() if A[i+1]-A[i] >= -1: ans = max(A[i+1]-1,A[i]-1,ans) if A[i+1] >= A[i] and A[i+1] > ans : A[i+1] -=1 else: print('No') exit() print('Yes')
p03416
s327177585
Wrong Answer
n, m = map(int, input().split()) if n==1: print(m-2) elif m==1: print(n-2) else: print((n-2)*(m-2))
p03827
s297315000
Accepted
import sys input = sys.stdin.readline N = int(input()) S = list(input().rstrip()) ans = [0] x = 0 for i in S: if i == "I": x += 1 else: x -= 1 ans.append(x) print(max(ans))
p03087
s131222721
Accepted
N, Q = map(int, input().split()) S = str(input()) Cs = [] for _ in range(Q): l, r = map(int, input().split()) Cs.append((l, r)) det_idx = [] for i in range(N-1): if S[i:i+2] == 'AC': det_idx.append(i) from bisect import bisect_left for c in Cs: ans = bisect_left(det_idx, c[1]-1) - bisect_left(det_idx, c[0]-1) print(ans)
p03457
s397025663
Wrong Answer
N = int(input()) T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)] flag = 'Yes' i = 0 # while flag=='Yes' and i<len(T)-1: # t1,x1,y1 = T[i] # t2,x2,y2 = T[i+1] # dis = abs(x2-x1)+abs(y2-y1) # _t = t2-t1 # if dis > _t or _t%2 != dis%2: # flag = 'No' # i += 1 print(flag)
p02952
s215268206
Accepted
#B import math n = int(input()) count=0 for i in range(1, n + 1): if int(math.log10(i) + 1) % 2 != 0: count += 1 print(count)
p02707
s878772376
Wrong Answer
n = int(input()) a = list(map(int, input().split())) for i in range(1, n): print(a.count(i))
p02641
s242588474
Accepted
x ,n= list(map(int, input().split())) if n == 0: p = input() print(x) else: p = list(map(int, input().split())) d = 0 answer = 0 while True: if x-d not in p: answer = x-d break elif x+d not in p: answer = x+d break d += 1 print(answer)
p02631
s193296200
Wrong Answer
N = int(input()) a = [int(i) for i in input().split()] now = 1 print(now) for i in range(N-1): A = a[i]^a[i+1] now = A^now print(now)
p02600
s537032929
Accepted
x=int(input()) if 400<=x<600: print('8') elif 600<=x<800: print('7') elif 800<=x<1000: print('6') elif 1000<=x<1200: print('5') elif 1200<=x<1400: print('4') elif 1400<=x<1600: print('3') elif 1600<=x<1800: print('2') else: print('1')
p02641
s137234065
Accepted
x, n = map(int, input().split()) p = list(map(int, input().split())) i = 0 while True: if not (x - i) in p: print(x-i) exit() if not (x + i) in p: print(x+i) exit() i += 1
p03796
s813656753
Wrong Answer
n = int(input()) v = 1 for _ in range(n): v = v*v print(v%(1e9+7))
p02571
s436663671
Accepted
ni = lambda: int(input()) nm = lambda: map(int, input().split()) nl = lambda: list(map(int, input().split())) s = [_ for _ in input()] t = [_ for _ in input()] ans = 10**10 for i in range(len(s) - len(t)+1): a = 0 for j in range(len(t)): if s[i+j] != t[j]: a+=1 ans = min(a,ans) print(ans)
p03495
s854176062
Accepted
from collections import Counter def main(): N, K = list(map(int, input().split(' '))) A = list(map(int, input().split(' '))) counter = Counter(A) n_kind = len(counter.keys()) if n_kind <= K: print(0) else: counts = list(counter.values()) counts.sort() print(sum(counts[:(n_kind - K)])) if __name__ == '__main__': main()
p02727
s876051544
Accepted
X, Y, A, B, C = map(int, input().split()) p = sorted(map(int, input().split()), reverse=True)[:X] q = sorted(map(int, input().split()), reverse=True)[:Y] r = list(map(int, input().split())) ans = sum(sorted(p+q+r, reverse=True)[:X+Y]) print(ans)
p02778
s963347783
Accepted
S = input() answer = "" for s in S: answer += "x" print(answer)
p03220
s621935773
Accepted
#!/usr/bin/env python3 n, t, a, *h = map(int, open(0).read().split()) mni = 0 mn = 1e18 for i in range(n): if mn>=abs(t-h[i]*0.006 - a): mn = abs(t-h[i]*0.006 - a) mni = i print(mni+1)
p02995
s153266006
Accepted
from fractions import gcd lcm = lambda a, b: a * b // gcd(a, b) num_of_multi = lambda n: b // n - a // n - bool(a % n) + 1 a, b, c, d = map(int, input().split()) print(b - a + 1 - num_of_multi(c) - num_of_multi(d) + num_of_multi(lcm(c, d)))
p02797
s304045538
Accepted
n, k, s = map(int,input().split()) if s != 10**9: a = [s+1] * n else: a = [s-1] * n for i in range(k): a[i] = s print(*a)
p03146
s490849353
Accepted
def collatz(num): if num % 2 == 0: return num // 2 elif num % 2 == 1: return num * 3 + 1 n = int(input()) collatz_list = [n] for i in range(10**6): n = collatz(n) if not n in collatz_list: collatz_list.append(n) else: print(i+2) break
p02631
s384391610
Accepted
n=int(input()) l=list(map(int,input().split())) p=0 for i in l: p^=i ans=[] for i in l: ans.append(p^i) print(*ans)
p03417
s375195595
Accepted
import math import copy import time line1 = str(input()).split(" ") for index in range(len(line1)): line1[index] = int(line1[index]) if (line1[1] > 1 and line1[0] > 1): print( line1[0]*line1[1] - (2*line1[1] + 2*(line1[0]-2))) elif (line1[1] == 1 and line1[0] == 1): print(1) elif (line1[1] == 0 or line1[1] == 0): print(0) else: print(line1[0]*line1[1] - 2)
p03720
s575314815
Accepted
n, m = map(int, input().split()) ll = [[0]] + [ [] for _ in range(n)] for i in range(m): a, b = map(int, input().split()) ll[a].append(b) ll[b].append(a) for l in ll[1:]: print(len(l))
p02911
s833504755
Accepted
N, K, Q = map(int, input().split()) p = [0]*N for _ in range(Q): #p = list(map(lambda x : x-1, p)) A = int(input()) p[A-1] += 1 for ans in p: if ans <= Q-K: print("No") else: print("Yes")
p02719
s253591393
Wrong Answer
n,k=map(int,input().split()) t = int(n/k) tt = t + 1 a = n - t*k b = tt*k - n ans=min([a,b]) print(str(ans))
p03695
s891391710
Accepted
N = int(input()) a = [int(x) for x in input().split()] dict = {} ans = 0 count = 0 for i in range(N): if not( a[i]//400 in dict.keys() ): dict[a[i]//400] = 1 else: dict[a[i]//400] += 1 for key in dict.keys(): if key < 8: ans += 1 else: count += dict[key] if ans == 0: print(1, count) else: print(ans, ans+count)
p02866
s377909977
Accepted
from collections import Counter N = int(input()) *D, = map(int, input().split()) mod = 998244353 c = Counter(D) v = max(D) if c[0]!=1 or D[0]!=0: print(0) else: ans = 1 for i in range(1, v+1): ans *= pow(c[i-1], c[i], mod) ans %= mod print(ans)
p02712
s438397249
Accepted
n = int(input()) l = [i for i in range(1,n+1) if i%3!=0 and i%5!=0] print(sum(l))
p02711
s856518561
Wrong Answer
from sys import stdin, stdout def main(): n=stdin.readline().rstrip() if '7' in n: print('YES') return print('NO') return main()
p02767
s602674397
Accepted
def solve(): N = int(input()) A = list(map(int, input().split())) m = 10 ** 9 for i in range(1, 101): tmp = 0 for j in range(N): tmp += (i - A[j]) ** 2 m = min(tmp, m) return m print(solve())
p03126
s940333126
Wrong Answer
N, M = map(int,input().split()) like = [0 for i in range(M+1)] for i in range(N): KA = list(map(int,input().split())) for k in range(KA[0]): like[KA[k]] += 1 ans = 0 for i in range(M+1): if like[i] == N: ans += 1 print(ans)
p04031
s476182719
Accepted
def resolve(): n = int(input()) ans = 1000000 a = list(map(int, input().split())) for i in range(-100, 101): tmp = 0 for j in a: tmp += (j-i)**2 if tmp < ans: ans = tmp print(ans) resolve()
p03639
s134781060
Accepted
N = int(input()) A_list = list(map(int, input().split())) dic = {4: 0, 2: 0, 1: 0} for i in A_list: if i % 4 == 0: dic[4] += 1 elif i % 2 == 0: dic[2] += 1 else: dic[1] += 1 dic[4] += dic[2] // 2 if len(A_list) // 2 <= dic[4]: print('Yes') else: print('No')
p03679
s464249298
Accepted
import sys input = sys.stdin.readline X, A, B = [int(x) for x in input().split()] if (A - B) >= 0: print("delicious") elif (B - A) <= X: print("safe") else: print("dangerous")
p02658
s270256493
Accepted
n = int(input()) l = list(map(int, input().split())) l.sort() c = 1 i = 0 while i < n: c *= l[i] i += 1 if c > 1000000000000000000: break if c <= 1000000000000000000: print(c) else: print(-1)
p03011
s250659893
Accepted
p = [int(i) for i in input().split()] p.sort() print(p[0] + p[1])
p03380
s473741355
Accepted
N = int(input()) a = list(map(int, input().split())) a.sort() n = a[-1] diff = 10**18 r = -1 for ai in a: if abs(n-2*ai)<diff: diff = abs(n-2*ai) r = ai print(n, r)
p02817
s205886801
Accepted
def mainFunc(): S, T = input().split(" ") print(T + S) mainFunc()
p03862
s588114412
Accepted
n, x = map(int, input().split()) a = list(map(int, input().split())) ans = 0 for i in range(n-1): j = i + 1 if j < n and a[i]+a[j] > x: d = min(a[j], (a[i]+a[j]) - x) a[j] -= d ans += d if a[i]+a[j] > x: d = min(a[i], (a[i]+a[j]) - x) a[i] -= d ans += d print(ans)
p02571
s786393798
Accepted
s= input() t= input() atmp=2000 for i in range(len(s) - len(t) + 1): s1=s[i:i+len(t)] #print(s1) tmp=0 for j in range(len(t)): if s1[j]!=t[j]: tmp+=1 atmp=min(atmp,tmp) print(atmp)
p03286
s524095619
Accepted
#!/usr/bin/env python n = int(input()) if n == 0: print(0) exit() ans = '' while abs(n) > 0: r = n%2 ans += str(r) n //= 2 n = -n if abs(n)%2 == 1: print(ans) else: print(ans[::-1])
p03001
s321062205
Accepted
W, H, x, y = map(int,input().split()) print((H*W)/2, 1 if (x==W/2 and y==H/2) else 0)
p02817
s409437799
Wrong Answer
print(input().replace(' ',''))
p03435
s209816158
Accepted
C = [list(map(int, input().split())) for _ in range(3)] for i in range(2): for j in range(2): if C[i+1][j] - C[i][j] != C[i+1][j+1] - C[i][j+1]: print('No') exit() print('Yes')
p02678
s432215269
Accepted
#NEED RE-SOLVE LATER. from collections import deque n, m = map(int, input().split()) G = [[] for _ in range(n)] for i in range(m): a, b = map(lambda x: x-1, map(int, input().split())) G[a].append(b) G[b].append(a) q = deque([0]) visited = [None]+[-1]*(n-1) while q: nx = q.pop() for g in G[nx]: if visited[g] != -1: continue visited[g] = nx q.appendleft(g) print('Yes') print(*[visit+1 for visit in visited[1:]], sep='\n')
p02768
s875529673
Accepted
n,a,b=map(int,input().split()) mod = 1000000007 ans = pow(2,n,mod) - 1 def solve(nu): res = 1 for i in range(nu): res *= n-i res %= mod res *= pow(i+1,mod-2,mod) res%=mod return res ans -=solve(a) ans %= mod ans -= solve(b) ans %= mod print(ans)
p02756
s705156947
Accepted
from collections import deque import sys input = sys.stdin.readline S = input().rstrip() Q = int(input()) FTC = [tuple(input().split()) for _ in range(Q)] que = deque(['?']) cnt = 0 for query in FTC: if query[0] == '1': cnt ^= 1 continue sign = 0 if query[1] == '1' else 1 if sign ^ cnt == 0: que.appendleft(query[2]) else: que.append(query[2]) que = list(que) ans = ''.join(que[:: (-1)**cnt]) ans = ans.replace('?', S[:: (-1)**cnt]) print(ans)
p03387
s494227917
Accepted
abc=list(map(int,input().split())) abc.sort() ans=abc[2]-abc[1] abc[0]+=abc[2]-abc[1] abc[1]=abc[2] while True: if (abc[2]-abc[0])%2==0: break ans+=1 abc[2]+=1 ans+=(abc[2]-abc[0])//2 print(ans)
p02779
s007730359
Wrong Answer
def main(): n = int(input()) a = list(map(int,input().split())) a.sort() ans = 0 for i in range(len(a)-1): if a[i] == a[i+1]: ans = 1 if ans == 1: print("No") else: print("Yes") if __name__ == '__main__': main()
p02910
s915596391
Accepted
S=input() N=len(S) flag=True for i in range(N): if i%2==0: if S[i]=='L': flag=False break else: if S[i]=='R': flag=False break if flag:print('Yes') else:print('No')
p03479
s528335478
Accepted
x,y = map(int,input().split()) i = 0 while x <= y: x = x*2 i += 1 print(i)
p02988
s464151891
Wrong Answer
n=int(input()) p=list(map(int,input().split())) a = 0 for i in range(n-2): a += 1*(0<((p[i] < p[i+1])*(p[i+1] < p[i+2]))) print(a)
p02982
s270293381
Accepted
import numpy as np n, d = map(int, input().split()) x = [np.array(list(map(int, input().split()))) for _ in range(n)] cnt = 0 for i in range(len(x)-1): x_i = x[i] for j in x[i+1:]: m = x_i - j if float(np.linalg.norm(m)).is_integer(): cnt += 1 print(cnt)
p04020
s409755339
Accepted
def main(): N = int(input()) A = list(int(input()) for _ in range(N)) cnt = 0 for i in range(N): if i == N-1: cnt += A[i] // 2 break cnt += A[i] // 2 mod = A[i] % 2 if A[i+1] >= mod: cnt += mod A[i+1] -= mod print(cnt) if __name__ == "__main__": main()
p03206
s279632302
Wrong Answer
S=int(input()) if S==25: print("Crisitmas") if S==24: print("Christmas Eve") if S==23: print("Christmas Eve Eve") if S==22: print("Christmas Eve Eve Eve")
p02789
s254380112
Accepted
n, m = input().split() print('Yes' if n == m else 'No')
p02831
s494521973
Accepted
import fractions A, B = [int(i) for i in input().split()] C = fractions.gcd(A, B) print(int((A * B)/C))
p03323
s766747341
Accepted
a,b=map(int,input().split()) print('Yay!' if a<9 and b<9 else ':(')
p03785
s291078776
Accepted
N, C, K = list(map(int,input().split())) listT = [int(input()) for _ in range(N)] listT.sort() count=0 while listT != []: bus = [] time = listT[0] count += 1 while len(bus) != C and time+K>=listT[0]: bus.append(listT.pop(0)) if listT==[]: break print(count)
p02847
s458635310
Accepted
# coding: utf-8 # Your code here! if __name__ == '__main__': today=input() week=["SUN","MON","TUE","WED","THU","FRI","SAT"] week=week[::-1] print(week.index(today)+1)
p02608
s809408132
Wrong Answer
import itertools N = int(input()) for n in range(1,N+1): cnt = 0 for x,y in itertools.product(list(range(n)),repeat=2): z = n - x - y if n == x*x + y*y +z*z + x*y + y*z + z*x: cnt += 1 print(cnt)
p02756
s238279417
Wrong Answer
import sys input = sys.stdin.readline def main(): s = input() q = int(input()) ls = [input().split() for _ in range(q)] for t in ls: if t[0] == '1': s = s[::-1] elif t[0] == '2': if t[1] == '1': s = t[2] + s elif t[1] == '2': s = s + t[2] print(s[:-1]) if __name__ == '__main__': main()
p02777
s687708238
Wrong Answer
import sys def solve(): input = sys.stdin.readline mod = 10 ** 9 + 7 st = list(map(str, str(input().rstrip('\n')).split())) ab = list(map(str, str(input().rstrip('\n')).split())) d = {s: int(v) for s, v in zip(st, ab)} d[str(input().rstrip('\n'))] -= 1 print(*d.values()) if __name__ == '__main__': solve()
p03821
s026167318
Wrong Answer
n = int(input()) l = [[int(i) for i in input().split()] for _ in range(n)] ans = 0 p = 0 for i in l[::-1]: i[0] += p ans += i[1] - (i[0] % i[1]) if i[1] > 1 else 0 p += i[1] - (i[0] % i[1]) if i[1] > 1 else 0 print(ans)
p03487
s792422806
Accepted
from collections import Counter #l = ['a', 'a', 'a', 'a', 'b', 'c', 'c'] #c = Counter(l) #print(c) # Counter({'a': 4, 'c': 2, 'b': 1}) N = int(input()) a = list(map(int, input().split())) C = Counter(a) ans = 0 for k, v in C.items(): k = int(k) if k<v: ans += (v-k) elif k>v: ans += v print(ans)
p02583
s392526483
Accepted
N = int(input()) List = list(map(int, input().split())) res = 0 if N >=3: for i in range(N-2): for j in range(i+1,N-1): for k in range(j+1,N): if List[i]==List[j] or List[i]==List[k] or List[k]==List[j]: pass else: if List[i]+List[j] > List[k] and List[j]+List[k] > List[i] and List[k]+List[i] > List[j]: res += 1 print(res)
p02690
s219468425
Wrong Answer
X=int(input()) a=True for A in range(118+119): if(a): for B in range(118+119): if((A-118)**5-(B-118)**5==X): print(A-118,B-118) a=False break
p02608
s891953997
Accepted
from collections import defaultdict from sys import stdin def main(): input = lambda: stdin.readline()[:-1] N = int(input()) ans = defaultdict(int) for x in range(1, 101): for y in range(1, 101): for z in range(1, 101): n = x * x + y * y + z * z + x * y + y * z + z * x ans[n] += 1 for i in range(1, N + 1): print(ans[i]) main()
p02783
s210758824
Wrong Answer
H, A = map(int, input().split()) if H%A == 0: print(H/A) else: print(int(H/A) +1)
p02953
s935289301
Accepted
n = int(input()) h = list(map(int, input().split())) num = 0 for i in range(n): if h[i] < num-1: print("No") exit(0) num = max(num, h[i]) print("Yes")
p03817
s644760744
Accepted
import math x = int(input()) # 6,5,6,5 ・・・と得点していく # 答えはx/5.5付近 t = math.ceil(x/5.5) def f(n): return 6*n - n//2 if x <= f(t-1): print(t-1) elif x <= f(t): print(t) else: print(t+1)
p03852
s479576682
Accepted
#49 moji=input() boin=['a','e','i','o','u'] if (moji==boin[0] or moji==boin[1] or moji==boin[2] or moji==boin[3] or moji==boin[4]): print('vowel') else: print('consonant')
p03637
s833189972
Accepted
import sys import heapq, math from itertools import zip_longest, permutations, combinations, combinations_with_replacement from itertools import accumulate, dropwhile, takewhile, groupby from functools import lru_cache from copy import deepcopy N = int(input()) A = list(map(int, input().split())) cnt2 = 0 cnt4 = 0 for a in A: if a % 4 == 0: cnt4 += 1 elif a % 2 == 0: cnt2 += 1 if cnt2 // 2 + cnt4 >= N // 2: print("Yes") else: print("No")
p03449
s818636160
Accepted
import sys from collections import Counter from collections import deque import math import fractions def input(): return sys.stdin.readline().strip() def mp(): return map(int,input().split()) def lmp(): return list(map(int,input().split())) n=int(input()) au=lmp() ad=lmp() u=[0]*n d=[0]*n u[0]=au[0] d[0]=sum(ad) for i in range(1,n): u[i]=u[i-1]+au[i] d[i]=d[i-1]-ad[i-1] ans=[0]*n for i in range(n): ans[i]=u[i]+d[i] print(max(ans))
p02916
s605619656
Accepted
n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) c=list(map(int,input().split())) ans=0 for i in a: ans+=b[i-1] for i in range(n-1): if a[i]+1==a[i+1]:ans+=c[a[i]-1] print(ans)
p02778
s760539367
Accepted
S = input() for i in range(len(S)-1): print('x', end="") print('x')
p03435
s165340859
Wrong Answer
from unittest.mock import patch import numpy as np def takahashi_info(): A = [] for i in range(3): A += [int(j) for j in input().split()] if sum(A) % 3 == 0: print("Yes\n") else: print("No\n")
p02854
s013976319
Wrong Answer
N = int(input()) A = list(map(int,input().split())) B = A S = sum(A) B.reverse() cum1 = [0]*(N) cum2 = [0]*(N) now1 = 0 for i in range(N): now1 += A[i] cum1[i] = now1 cum2[i] = S-now1 minimum = 10**9 for i in range(N): if abs(cum1[i]-cum2[i]) < minimum: minimum = abs(cum1[i]-cum2[i]) print(minimum)
p02785
s905913875
Wrong Answer
N, K = map(int, input().split()) H = list( map(int, input().split()) ) H.sort() #h = H[:N-K] print(sum(H[0:N-K]))
p03086
s380878470
Accepted
S=[0]+list(input()) L=[0] SET=["A","G","C","T"] SET=set(SET) for i in range(1,len(S)): if S[i] not in SET: L.append(0) else: L.append(L[-1]+1) print(max(L))
p02787
s563312569
Accepted
w, h = (int(x) for x in input().split()) ab = [] for _ in range(h): a, b = (int(x) for x in input().split()) ab.append([a, b]) dp = [0] * (w + max(a for a, b in ab)) for j in range(1, w+1): dp[j] = min(dp[j-a]+b for a, b in ab) print(dp[w])
p02640
s021026301
Accepted
X,Y=map(int,input().split()) a=(4*X-Y)/2 if X<=Y and a.is_integer() and a>=0 and a<=50: print("Yes") else: print("No")
p03427
s464350647
Accepted
X = input() check = True ans = 0 for i, x in enumerate(X): if i > 0 and x != "9": check = False if i == 0: ans += int(x) else: ans += 9 print(ans if check else ans - 1)
p03821
s579998490
Accepted
n = int(input()) ab = [input().split() for _ in [0]*n] a = [int(i) for i, j in ab][::-1] b = [int(j) for i, j in ab][::-1] ans = 0 for i in range(n): a[i] += ans if a[i] % b[i] != 0: ans += b[i] - (a[i] % b[i]) print(ans)
p02789
s952725023
Wrong Answer
n,m = map(int, input().split()) if(n == m): print("AC") else: print("WA")
p02773
s245849519
Accepted
N = int(input()) count = dict() for _ in range(N): x = input() count[x] = count.get(x, 0) + 1 max_val = -float("infinity") for k, v in sorted(count.items(), key=lambda x: (-x[1], x[0])): max_val = max(v, max_val) if v == max_val: print(k) else: break
p02835
s949596267
Accepted
a ,b, c = map(int, input().split(" ")) if a + b + c <= 21: print("win") else: print("bust")
p02717
s454473748
Wrong Answer
s = list(map(int, input().split())) print(s[::-1])
p02594
s081423025
Wrong Answer
x = int (input()) if x == 30: print("Yes") else: print("No")
p03241
s831087104
Accepted
import math def make_divisors(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) return divisors N, M = map(int, input().split()) divisors = make_divisors(M) ans = 1 for d in divisors: if d*N <= M: ans = max(ans, d) print(ans)
p03317
s320115259
Wrong Answer
import math N,K = map(int,input().split()) lsA = list(map(int,input().split())) P = lsA.index(1) ans = math.ceil(P/(K-1)) + math.ceil((N-1-P)/(K-1)) print(ans)