problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02613
s391241134
Accepted
import sys from collections import Counter input = sys.stdin.readline N = int(input()) c = Counter() for _ in range(N): c[input()[: -1]] += 1 print("AC x", c["AC"]) print("WA x", c["WA"]) print("TLE x", c["TLE"]) print("RE x", c["RE"])
p02953
s590165989
Wrong Answer
N = int(input()) H = list(map(int,input().split())) hardle = 0 ans = "Yes" for i in H: if hardle>i: ans = "No" break else: if i>hardle: hardle-=1 print(ans)
p03767
s907476667
Accepted
n=int(input()) a=[0]*(3*n) a=list(map(int,input().split())) a=sorted(a,reverse=True) ans=0 #print(a) for i in range(n): ans+=a[2*i+1] print(ans)
p02570
s842974687
Accepted
d,t,s= map(int, input().split()) if d/s<=t: print('Yes') else: print('No')
p03317
s731089665
Wrong Answer
n, k = map(int, input().split()) a = [int(i) for i in input().split()] if len(a) == k: print(1) exit() print(((len(a)-1) //( k -1)) + 1)
p02833
s775269908
Accepted
n=int(input()) ans=0 if n%2==1: ans=0 else: tmp=10 while tmp<=n: ans+=n//tmp tmp*=5 print(ans)
p02988
s954034415
Accepted
n=int(input()) t = list(map(int,input().split())) count = 0 for i in range(n-2): A = t[i:i+3] #print(A) y = A[1] A.sort() if y == A[1]: count += 1 print(count)
p02696
s678370461
Wrong Answer
import math a, b, n = map(int, input().split()) ans = 0 for x in range(0, a * n, b): new = math.floor(x / b) - a * math.floor((x / a) / b) if new > ans: ans = new print(ans)
p02910
s779764340
Accepted
s = list(input()) n = len(s) ok = True for i in range(n): if i % 2 == 0: if s[i] == 'L': ok = False else: if s[i] == 'R': ok = False if ok: print('Yes') else: print('No')
p03475
s795077738
Accepted
#coding: utf-8 import math N = int(input()) L = [] for i in range(N-1): l = list(map(int,input().split())) L.append(l) for i in range(N-1): t = 0 for j in range(i,N-1): l = L[j] c = l[0] s = l[1] f = l[2] if t <= s: t = s+c else: n = math.ceil((t-s)/f) t = s+n*f+c print(t) print(0)
p03557
s751269385
Accepted
from bisect import bisect_left, bisect_right n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) a.sort() b.sort() c.sort() ans = 0 for j in b: i = bisect_left(a, j) k = bisect_right(c, j) ans += i*(n-k) #print(j, a, i) #print(j, c, k) print(ans)
p02789
s839991942
Accepted
n,m=map(int,input().split()) if n==m: print('Yes') else: print('No')
p03778
s711879860
Wrong Answer
w, a, b = map(int , input().split()) if b>=a and b<=w+a: print(0) if b+w<a: print(a-(b+w)) elif a+w<b: print(b-(a+w))
p03435
s119524887
Accepted
def m(a,b): n=3 L=[0]*3 for i in range(n): L[i]=a[i]-b[i] return L def f(L): return len(set(L))==1 C=[] for i in range(3): C.append(list(map(int,input().split()))) F=True for i,j in [(0,1),(1,2),(2,0)]: F&=f(m(C[i],C[j])) if F: print("Yes") else: print("No")
p03251
s295545896
Accepted
n,m,x,y=map(int,input().split()) a=list(map(int, input().split())) b=list(map(int, input().split())) res="War" for i in range(x+1,y+1): if max(a)<i<=min(b): res="No War" break print(res)
p02953
s761869392
Accepted
N=int(input()) W=list(map(int,input().split())) for i in range(N-1,0,-1): if W[i-1]>W[i]+1: print("No") exit() elif W[i-1]==W[i]+1: W[i-1]-=1 print("Yes")
p03854
s077645760
Accepted
s = 'HAKUTYUMU' + input() while s != 'HAKUTYUMU': next_s = s if s[-5:] == 'dream': next_s = s[:-5] if s[-7:] == 'dreamer': next_s = s[:-7] if s[-5:] == 'erase': next_s = s[:-5] if s[-6:] == 'eraser': next_s = s[:-6] if s == next_s: print('NO') exit() s = next_s print('YES')
p03377
s781347062
Accepted
a,b,x=map(int, input().split()) print("YES" if a<=x and a+b>=x else "NO")
p02797
s548081570
Accepted
n,k,s = map(int,input().split()) if n>=k: if s <10**9: print(*([s]*k+[10**9]*(n-k))) exit() else: print(*([s]*k+[1]*(n-k))) exit()
p04045
s802599503
Accepted
import sys n, k = map(int, input().split()) d = list(map(int, input().split())) nums = [i for i in range(10)] canuse = [] for i in nums: if i not in d: canuse.append(i) for i in range(n,n*10): x = 0 for j in str(i): if int(j) not in canuse: break else: x += 1 if x == len(str(i)): print(i) sys.exit()
p03359
s518147079
Accepted
a,b=map(int,input().split()) if a <=b: print(a) else: print(a-1)
p03759
s561195608
Accepted
a, b, c = map(int, input().split()) if b - a == c - b: print("YES") else: print("NO")
p03208
s224888717
Accepted
n, k = map(int, input().split()) h = sorted(int(input()) for _ in range(n)) ans = float('inf') for i in range(n-k+1): c = h[i+k-1] - h[i] ans = min(ans, c) print(ans)
p03286
s616995468
Accepted
n = int(input()) s = '' while True: if n % 2 == 0: s = '0' + s n = n // -2 else: s = '1' + s n = (n - 1) // -2 if n == 0: break print(s)
p02771
s430549054
Accepted
a=list(map(int, input().split())) lis=set(a) if len(lis) == 2: print("Yes") else: print("No")
p02639
s517426816
Accepted
X = list(map(int,input().split())) for i,x in enumerate(X): if x == 0: print(i+1) exit(0)
p02583
s767405068
Accepted
a=int(input()) A = sorted(list(map(int, input().split()))) ans =0 for i in range(a): for j in range(i): for k in range(j): if(A[k] != A[j] and A[i] != A[j] and A[k] + A[j]>A[i]): ans+=1 print(ans)
p02843
s600435557
Wrong Answer
x=int(input()) for i in range(1,1001): if 100*i<=x<105*i: print(1) break else: print(0)
p02783
s237533455
Wrong Answer
h,a=map(int,input().split()) i=h%a t=h-i print(int(t/a+1))
p03417
s089855136
Accepted
import sys def input(): return sys.stdin.readline().strip() def main(): n, m = map(int, input().split()) if n == 1 and m == 1: ans = 1 elif m == 1: ans = n - 2 elif n == 1: ans = m - 2 else: ans = (m - 2) * (n - 2) print(ans) if __name__ == "__main__": main()
p02775
s970028442
Accepted
n = input() dp = [0,1] ans = 0 for i in range(len(n)): cur1 = dp[0] cur2 = dp[1] if i != len(n)-1: dp[0] = min(cur1+int(n[i]), cur2+10-int(n[i])) dp[1] = min(cur1+int(n[i])+1, cur2+9-int(n[i])) else: ans = min(dp[0]+int(n[i]), dp[1]+10-int(n[i])) print(ans)
p03239
s573069130
Wrong Answer
n = list(map(int,input().split())) ans = 10**9 l = [] for i in range(n[0]): l.append(list(map(int,input().split()))) for i in range(n[0]): if l[i][1] <= n[1]: ans = min(l[i][0],ans) print(ans)
p04012
s797669830
Accepted
from collections import Counter w=list(input()) a=Counter(w) b=list(a.values()) for i in range(len(b)): if b[i]%2!=0: print("No") exit() else: print("Yes")
p02953
s981550249
Accepted
import sys, heapq N = int(input()) H = list(map(int, sys.stdin.readline().rsplit())) pre = H[0] - 1 for i in range(1, N): h = H[i] if h - pre > 0: pre = h - 1 elif h - pre == 0: pre = h else: print("No") exit() print("Yes")
p03639
s281304242
Wrong Answer
n = int(input()) al = list(map(int, input().split())) a_2 = 0 a_4 = 0 a_not4 = 0 for a in al: if a % 4 == 0: a_4 += 1 elif a == 2: a_2 += 1 else: a_not4 += 1 if n % 2 == 0: if (a_4 + a_2//2) >= a_not4: print('Yes') else: print('No') else: if (a_4 + a_2//2 + 1) == a_not4 or (a_4 + a_2//2) > a_not4: print('Yes') else: print('No')
p03160
s001013931
Accepted
n = int(input()) h = tuple(map(int, input().split())) c = [0] * n c[0] = 0 c[1] = abs(h[0] - h[1]) for i in range(2, n): c[i] = min(c[i - 1] + abs(h[i - 1] - h[i]), c[i - 2] + abs(h[i - 2] - h[i])) print(c[-1])
p02629
s506715324
Accepted
n = int(input()) def solve(n): string = "" i = 0 while n > 0: rem = n % 26 if rem == 0: string += 'z' i += 1 n = (n // 26) - 1 else: string += str(chr((rem - 1) + ord('a'))) i += 1 n = n // 26 string = string[::-1] print(string) solve(n)
p02771
s720753442
Wrong Answer
a, b, c = map(int, input().split()) my_list = [a, b, c] if (a == b != c) and (a != b == c): print("Yes") else: print("No")
p03076
s639589461
Accepted
import itertools a=[] for i in range(5): a.append(int(input())) out=sum(a)+50 ls = list(itertools.permutations(range(5))) for i in ls: t=0 for j in i: if t%10 != 0: t+=10-t%10 t+=a[j] if t <=out: out=t print(out)
p03962
s804442444
Accepted
A = map(int, input().split()) print(len(set(A)))
p02947
s338368048
Accepted
N = int(input()) s = [''.join(sorted(input())) for _ in range(N)] d = {} for i in s: if i not in d: d[i] = 1 else: d[i] += 1 ans = 0 for i in d.values(): ans += i*(i-1)//2 print(ans)
p03219
s049961558
Accepted
X,Y=map(int, input().split()) #複数数値入力 「A B」みたいなスペース空いた入力のとき print(X+Y//2)
p03282
s417604367
Accepted
s = input() k = int(input()) for i in range(k): if s[i] != "1": print(s[i]) exit() print(1)
p03457
s929069407
Wrong Answer
n = int(input()) t=[0] x=[0] y=[0] for i in range(n): _t, _x, _y = map(int, input().split()) t.append(_t) x.append(_x) y.append(_y) flag = 0 for i in range(1,n+1): dt = t[i] - t[i-1] dx = x[i] - x[i-1] dy = y[i] - y[i-1] dist = abs(dx) + abs(dy) if dist > dt: flag = flag +1 elif dist % 2 != 0 and dt % 2 != 0: flag = flag +1 else: print("Yes" if flag ==0 else "No")
p03680
s786523712
Wrong Answer
n=int(input()) arr=[int(input())-1 for _ in range(n)] if arr[0]==1: print(-1) else: step = 0 curr=arr[0] while True: if step>n: print(-1) break else: if curr == 1: print(step+1) break else: curr = arr[curr] step += 1
p03061
s600701621
Accepted
N=int(input()) A=list(map(int,input().split())) def gcd(a,b): return a if b==0 else gcd(b,a%b) L=[0]*(N+1) R=[0]*(N+1) for i in range(N-1): L[i+1]=gcd(L[i],A[i]) R[i+1]=gcd(R[i],A[N-i-1]) ans=1 for i in range(1,N+1): ans=max(ans,gcd(L[i-1],R[N-i])) print(ans)
p02879
s003441080
Accepted
(A,B)=input().split() (A,B)=(int(A),int(B)) if 1<=A<=9 and 1<=B<=9: print(A*B) else: print(-1)
p02995
s888390483
Accepted
import math a, b, c, d = map(int, input().split()) e = c*d//math.gcd(c,d) def ko(a,b,c): x = b//c-a//c if a%c==0: x+=1 return(x) print(b-a+1-ko(a,b,c)-ko(a,b,d)+ko(a,b,e))
p03760
s509950561
Accepted
from itertools import zip_longest s1=input() s2=input() ans='' for ss1,ss2 in zip_longest(s1,s2): if ss1 == None: ss1='' if ss2 == None: ss2='' ans+=ss1+ss2 print(ans)
p03289
s271434214
Accepted
s = input() ans = 1 if s[0] != 'A': ans = 0 if not 'C' in s[2:-1]: ans = 0 cnt = 0 for i in s: if i in [chr(i) for i in range(65, 65+26)]: cnt += 1 if cnt != 2: ans = 0 if ans == 1: print('AC') else: print('WA')
p03073
s083782343
Accepted
S = input() if S[0::2].count('0') > S[1::2].count('0'): print(S[0::2].count('1') + S[1::2].count('0')) else: print(S[0::2].count('0') + S[1::2].count('1'))
p02571
s447002751
Wrong Answer
s = input() t = input() l = len(t) for i in range(l): print(t[i:]) if t[i:] in s: a = i break else: a = l for j in range(1, l): print(t[:l-j]) if t[:l-j] in s: b = j break else: b = l print(min(a, b))
p02820
s324751639
Accepted
n,k = map(int,input().split(" ")) r,s,p = map(int,input().split(" ")) ar = list(input()) count = 0 for i in range(n): if i - k >= 0 and ar[i] == ar[i-k]: ar[i] = "." else: if ar[i] == 'r': count += p elif ar[i] == 's': count += r elif ar[i] == 'p': count += s print(count)
p02790
s350238631
Wrong Answer
a,b=map(int,input().split()) x=int(str(a)*b) y=int(str(b)*a) print(min(x,y))
p03281
s104717789
Accepted
n = int(input()) ans = 0 count = 0 for i in range(1,n+1,2): for j in range(1,i+1): if i%j == 0: count += 1 if count == 8: ans += 1 count = 0 print(ans)
p02608
s809836157
Accepted
# C XYZ Triplets n = int(input()) ans = {} for x in range(1, 99): for y in range(1, 99): for z in range(1, 99): k = (x+y)**2+(y+z)**2+(z+x)**2 if k > 20000: break if k % 2 == 0: if not k//2 in ans: ans[k//2] = 1 else: ans[k//2] += 1 for i in range(1, n+1): if i in ans: print(ans[i]) else: print(0)
p02948
s054063882
Accepted
from heapq import heappop, heapify, heappush from collections import defaultdict N, M = map(int,input().split()) d = defaultdict(list) for i in range(N): a, b = map(int, input().split()) d[a].append(b) h = [] ans = 0 for i in range(1, M+1): if len(d[i]) != 0: for x in d[i]: heappush(h, -x) if len(h) != 0: ans -= heappop(h) print(ans)
p03030
s062420603
Accepted
N, = map(int, input().split()) rs = [] for i in range(N): s, a = input().split() a = int(a) rs.append((i+1, s, -a)) rs.sort(key=lambda x : (x[1], x[2])) for i, s, a in rs: print(i)
p03109
s519259228
Accepted
S = input() Sint = int(S[:4])*10000 + int(S[5:7])*100 + int(S[8:]) if Sint > 20190430: print('TBD') else: print('Heisei')
p02664
s055571678
Accepted
s = input() s2 = s.replace('?','D') print(s2)
p02618
s639026274
Wrong Answer
for i in range(1, 366): print(i % 26)
p02597
s756810502
Accepted
def main(): N = int(input()) C = input() l, r = 0, N - 1 c = 0 while True: while l < r and C[l] == 'R': l += 1 while l < r and C[r] == 'W': r -= 1 if l >= r: break c += 1 l += 1 r -= 1 return c print(main())
p02714
s482630753
Accepted
n = int(input()) s = input() ans = s.count('R') * s.count('G') * s.count('B') for i in range(n): for j in range(i+1, n): k = j + (j - i) if j < k < n and s[i] != s[j] and s[j] != s[k] and s[i] != s[k]: ans -= 1 print(ans)
p02623
s671040871
Accepted
N, M, K = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) sum_a = sum(A) sum_b = 0 b_next_ind = 0 ans = 0 # 下からi冊減らす; i=0..N for i in range(N + 1): sum_b_max = K - sum_a if sum_b_max >= 0: while b_next_ind < M and sum_b + B[b_next_ind] <= sum_b_max: sum_b += B[b_next_ind] b_next_ind += 1 ans = max(ans, (N - i) + b_next_ind) sum_a -= A[N - 1 - i] print(ans)
p02712
s367160688
Wrong Answer
N = int(input()) ans = 0 for i in range(N): if i % 3 != 0 or i % 5 != 0: ans += i print(ans)
p03109
s014773094
Accepted
import datetime s = input().split("/") if datetime.date(2019,4,30) >= datetime.date(int(s[0]), int(s[1]), int(s[2])): print('Heisei') else: print('TBD')
p02606
s708249211
Wrong Answer
x, y, z = map(int, input().split()) t = 0 for i in range(x,y+1,1): if i % 2 == 0: t += 1 print(t)
p02982
s827250316
Wrong Answer
from math import sqrt n,d = map(int,input().split()) li = [list(map(int,input().split())) for i in range(n)] tmp = 0 ans = 0 for i in range(n): for j in range(d): if i==n-1: tmp += pow(abs(li[i][j]-li[0][j]),2) else: tmp += pow(abs(li[i][j]-li[i+1][j]),2) if sqrt(tmp)%1==0: ans += 1 tmp = 0 print(ans)
p02630
s100281029
Accepted
mod=pow(10,5)+2 N=int(input()) num=[0]*mod ans=0 A=list(map(int, input().split())) for i in range(N): num[A[i]]+=1 ans+=A[i] Q=int(input()) for i in range(Q): B,C=map(int, input().split()) cnt=num[B] num[C]+=num[B] num[B]=0 ans+=(C-B)*cnt print(ans)
p02678
s976983659
Accepted
import collections N, M = map(int, input().split()) G = collections.defaultdict(list) for _ in range(M): a, b = map(int, input().split()) G[a].append(b) G[b].append(a) dist = [-1] * (N + 1) que = collections.deque() dist[1] = 0 que.append(1) while len(que): v = que.popleft() for nv in G[v]: if dist[nv] != -1: continue dist[nv] = v que.append(nv) if -1 in dist[2:]: print('No') else: print('Yes') for value in dist[2:]: print(value)
p02963
s696878068
Accepted
from math import sqrt S=int(input()) if S==10**18: print(10**9,0,0,10**9,0,0) else: q=int(sqrt(S)) test=q*(q+1)-S if test>=0: print(0,0,q,1,test,q+1) else: print(0,1,q+1,0,-test,q+1)
p03206
s020653329
Accepted
l =['Christmas'] + ['Eve']*(25-int(input())) print(*l)
p02791
s431099045
Wrong Answer
N = int(input()) P = list(map(int,input().split())) count = 1 for i in range(1, N): isbreak = False for j in range(0,i): print(P[i]) print(P[j]) if (P[i] > P[j]): isbreak = True break if isbreak == False: count += 1 print(count)
p03838
s466431454
Accepted
def main(): x, y = map(int, input().split()) print(min(abs(x+y), abs(~x+y))+1) if __name__ == '__main__': main()
p03565
s946539021
Accepted
s = input() t = input() s = s[::-1] t = t[::-1] for i in range(len(s) - len(t) + 1): for j, v in enumerate(t): if s[j+i] == v or s[j+i] == "?": continue else: break else: l = len(t) s = s[0:i] + t + s[i+l:] break else: print("UNRESTORABLE") exit() s = s.replace("?", "a") print(s[::-1])
p02755
s737307823
Accepted
import math a, b = map(int, input().split()) for i in range(1001): if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b: print(i) exit(0) print(-1)
p02994
s688493509
Accepted
n, l = map(int, input().split()) p_list = [l + i - 1 for i in range(1, n+1)] s = sum(p_list) if l <= 0 and l >= 1 - n: print(s) elif l < 1 - n: print(s - p_list[-1]) else: print(s - p_list[0])
p02546
s601769239
Wrong Answer
S = input() if S[-1] == 'e': print(S+'s') else: print(S+'es')
p03679
s714227293
Wrong Answer
x,a,b=map(int,input().split()) if a>=b: print("delicious") elif x+a<=b: print("dangerous") else: print("safe")
p02791
s072885854
Accepted
N = int(input()) P = list(map(int, input().split())) count = 0 mini = P[0] for p in P: if p <= mini: count += 1 mini = min(mini, p) print(count)
p02725
s809717507
Accepted
K,N = map(int, input().split()) house = [int(i) for i in input().split()] answer = [0] for index, i in enumerate(house): if i == house[-1]: X = (K - i) + house[0] answer.append(X) else: X = house[index + 1] - i answer.append(X) print(K - max(answer))
p04031
s190962298
Accepted
ans=10**10 n=int(input()) a=list(map(int,input().split())) for i in range(-100,101): x=0 for j in range(n): x+=(i-a[j])**2 ans=min(x,ans) print(ans)
p03035
s605100107
Accepted
A, B = map(int,input().split()) if A > 12: print(B) elif A > 5 and A < 13: print(int(B/2)) elif A < 6: print(0)
p03105
s022066605
Wrong Answer
A, B, C = map(int, input().split()) print(min(A*C, B//A))
p02584
s555861368
Accepted
X, K, D = map(int, input().split()) X = abs(X) D = abs(D) if X > K * D: X = X - K*D else: quo = X//D X = X - D*quo res = K - quo if res % 2 == 1: X = X - D else: pass print(abs(X))
p03282
s141108494
Accepted
s=input() k=int(input()) ans="1" for i in range(k): if (int(s[i])!=1): ans=s[i] break print(ans)
p02911
s961752595
Wrong Answer
import sys input = sys.stdin.readline def main(): N, K, Q = map(int, input().split()) a = [0]*N for _ in range(Q): a[int(input())-1] += 1 print(a) for i in range(N): if a[i] - Q + K > 0: print('Yes') else: print('No') if __name__ == '__main__': main()
p03136
s997521599
Accepted
x = int(input()) y = sorted(list(map(int,input().split()))) l = 0 for i in range(x-1): l += y[i] #print(l) if y[x-1] < l: print("Yes") else: print("No")
p03011
s293146224
Wrong Answer
P, Q, R = map(int, input().split()) print(min(P+Q, Q+R, R+Q))
p02768
s516113003
Accepted
MOD = 10 **9 + 7 n,a,b = map(int,input().split()) all = pow(2,n,MOD) if all:# not 0 all -=1 for i in (a,b): sub = 1 for j in range(i): sub *= n-j sub %= MOD sub *= pow(j+1,MOD-2,MOD) sub %= MOD all -= sub if all < 0: all += MOD print(all)
p02959
s609920288
Accepted
N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) ans = 0 for i in range(N): if A[i] > B[i]: ans += B[i] else: ans += (A[i] + (A[i+1] - max(A[i+1] - (B[i]-A[i]), 0))) A[i+1] = max(A[i+1] - (B[i]-A[i]), 0) print(ans)
p02959
s756831363
Wrong Answer
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) cnt = 0 for i in range(n): t = min(a[i], b[i]) cnt += t a[i] -= t b[i] -= t s = min(a[i+1], b[i]) cnt += s a[i] -= s b[i] -= s print(cnt)
p03814
s690983248
Accepted
#python3 def main(): s = input() A_index = s.index('A') t = [i for i in reversed(s)] Z_index = len(s) - t.index('Z') - 1 if Z_index - A_index >= 0: print(Z_index - A_index + 1) main()
p02695
s157385648
Accepted
import itertools n, m, q = map(int, input().split()) query = [] for i in range(q): query.append(list(map(int, input().split()))) choices = list(itertools.combinations_with_replacement([i for i in range(1, m+1)], n)) ans = -1 for choice in choices: score = 0 for q in query: if choice[q[1]-1] - choice[q[0]-1] == q[2]: score += q[3] ans = max(ans, score) print(ans)
p02823
s374918551
Wrong Answer
n,a,b = map(int, input().split()) if (b-a)%2 == 0: print((b-a)//2) else: print(b-1)
p03665
s333473370
Wrong Answer
n, p = map(int, input().split()) a = list(map(int,input().split())) odd = [] even = [] for i, aa in enumerate(a): if aa % 2 == 0: even.append(aa) else: odd.append(aa) e = len(even) o = len(odd) ans = 2 ** e od_list = [0] bunsi = 1 bunbo = 1 for i in range(1,o): bunsi *= o - i + 1 bunbo *= i od_list.append(bunsi//bunbo) even_i = od_list[::2] odd_i = od_list[1::2] if p == 0: print(ans * sum(even_i)) else: print(ans * sum(odd_i))
p03323
s076918835
Accepted
A,B=map(int,input().split()) M=max(A,B) if M>8: print(':(') else: print('Yay!')
p02994
s065760158
Accepted
x = list(map(int, input().split())) count = 0 l = [] for i in range(1, x[0]+1): tmp = x[1] + i - 1 l.append(tmp) if (0 in l) == True: for i in l: count += i else: if l[0] > 0: for i in l[1:]: count += i else: for i in l[:-1]: count += i print(count)
p03456
s065661949
Wrong Answer
s=int("".join(map(str,input().split()))) i=1 while i<s: if s==i*2: print("Yes") else: i=i+1 else: print("No")
p02787
s471233787
Wrong Answer
h,n=map(int,input().split()) m=[[0,0,0] for _ in range(n)] L=100000000000 mina=1000000 minb=1000000 for i in range(n): a,b=map(int,input().split()) m[i]=[a,b] if b<minb: minb=b mina=a dp=[L for _ in range(h+1)] dp[0]=0 for i in range(1,h+1): for j in range(n): [a,b]=m[j] if i>=a: dp[i]=min(dp[i-a]+b,dp[i]) print(dp[-1])