problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03059
s376087611
Wrong Answer
a,b,t = map(int,input().split()) t = t+0.5 cnt = t//a print(cnt*b)
p03329
s786528802
Accepted
#099_C n=int(input()) def Count(x,p): res=0 while x: res+=x%p x=x//p return res ans=10**6+1 for i in range(0,n+1): ans=min(ans,Count(i,6)+Count(n-i,9)) print(ans)
p02880
s004519891
Accepted
n=int(input()) ans="No" for i in range(1,10): for j in range(1,10): if i*j==n: ans="Yes" print(ans)
p03545
s653287472
Wrong Answer
s = input() l = len(s) for i in range(2**(l-1)): ans = 0 a = s[0] for j in range(l-1): if i >> j == 0: a += '+' + s[j+1] else: a += '-' + s[j+1] ans = eval(a) if ans == 7: print(a + '=7') exit()
p03105
s108653648
Accepted
a,b,c = map(int,input().split()) if b//a>=c: print(c) else: print(b//a)
p02973
s603341486
Accepted
import bisect from collections import deque n = int(input()) color = [-1]*n for i in range(n): a = int(input()) color[bisect.bisect_left(color,a) - 1] = a ans = n - bisect.bisect_right(color,-1) print(ans)
p02957
s417726611
Wrong Answer
a,b = map(int,input().split()) if a+b % 2 ==0: print(int((a+b)/2)) else: print("IMPOSSIBLE")
p03329
s099739303
Wrong Answer
from math import log n = int(input()) def make_list(n, x): return [x ** i for i in range(1, int(log(n, x))+1)] sixes = make_list(n, 6) nines = make_list(n, 9) nums = [1] + sixes + nines dp = [float('inf')] * (n+1) for num in nums: for i in range(1, n+1): if i <= num: dp[i] = min(dp[i], num) else: dp[i] = min(dp[i], dp[i-num]+1) print(dp[n])
p02688
s387236973
Wrong Answer
N, K = map(int, input().split()) sunu = [0] * (N + 1) for _ in range(0, K): a = list(map(int, input().split())) for s in a: sunu[s] += 1 print(sunu.count(0))
p03035
s713904493
Wrong Answer
a,b= list(map(int, input().split())) if a>13: print(b) if a>6<12: print(b/2) if a<5: print('0')
p03998
s770738152
Accepted
s=[input() for i in range(3)] t=0 while 1: if not s[t]: break if s[t][0]=="a": s[t],t=s[t][1:],0 elif s[t][0]=="b": s[t],t=s[t][1:],1 else: s[t],t=s[t][1:],2 if t==0: print("A") elif t==1: print("B") else: print("C")
p02953
s670942691
Accepted
n = int(input()) h = list(map(int,input().split())) height = h[0] q = 0 for i in h: if i < height: q = 1 break elif i > height: height = i-1 else: height = i if q == 1: print("No") else: print("Yes")
p03761
s438028652
Wrong Answer
from collections import Counter n = int(input()) s = [Counter(input()) for _ in range(n)] cnt = s[0] for scnt in s: for str in (scnt | cnt): print(str) cnt[str] = min(cnt[str], scnt[str]) a = ord('a') ans = [chr(a + i) * cnt[chr(a + i)] for i in range(25)] print(*ans, sep='')
p03951
s111478476
Accepted
n = int(input()) s = input() t = input() ans = 2 * n for i in range(n): if s[i:] == t[:n - i]: ans = n + i break print(ans)
p03637
s916198542
Accepted
n=int(input()) *a,=map(int, input().split( )) b4=0;od=0; for i in range(n): if a[i]%2: od+=1 elif a[i]%4==0: b4+=1 if od>b4+1: print("No") elif od==b4+1 and od+b4<n: print("No") else: print("Yes")
p02899
s039574881
Accepted
import sys n= int(input()) an = list(map(int, sys.stdin.readline().split())) ans = [0]*n for i in range(n): ans[an[i]-1] = i+1 print(*ans)
p02753
s465830519
Accepted
S = list(input()) if S[0] == S[1] and S[0] == S[2]: print("No") else: print("Yes")
p03150
s710588747
Accepted
import re S = input() k = 'keyence' for i in range(0, len(k)+1): rs = '^' + k[:i] + '.*' + k[i:] + '$' if re.match(rs, S) is not None: print('YES') break else: print('NO')
p03469
s218797619
Accepted
print("2018" + str(input())[4:])
p03745
s889307749
Wrong Answer
n, *lst = map(int, open(0).read().split()) if n < 3: print(0) quit() group = 1 start = lst[1] > lst[0] for i in range(2, n - 1): if (lst[i] > lst[i - 1]) == start: continue else: start = lst[i + 1] > lst[i] group += 1 if (lst[-1] > lst[-2]) != start: group += 1 print(group)
p03705
s637550625
Wrong Answer
N,A,B=map(int,input().split()) if A>B: print(0) elif A==B: print(1) else: if N==1: print(0) else: print((B*N-A*N)+1)
p02640
s935763681
Accepted
x ,y=map(int,input().split()) if x*2 <= y <= x*4 and y%2==0: print('Yes') else: print('No')
p03329
s632894938
Wrong Answer
list=[1, 1, 1, 1, 1] for i in range(1, 7): list.append(6**i) for j in range(1, 7): list.append(9**j) list=sorted(list, reverse=True) print(list) N=128 count=0 for i in list: if i <= N: N=N-i count+=1 if N == 0: print(count)
p02623
s755127967
Accepted
n, m, k = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) from bisect import bisect_right if n>m: a, b = b, a n, m = m, n c = [b[0]] for i in range(1, m): c.append(c[-1]+b[i]) a.insert(0,0) x = 0 result = [0] for i in range(n+1): x += a[i] if x > k: break y = k - x z = bisect_right(c, y) result.append(z+i) print(max(result))
p03943
s447208525
Accepted
a,b,c=map(int,input().split()) if a+b ==c or a+c ==b or b+c ==a: print('Yes') else: print('No')
p02675
s764519230
Accepted
N = int(input()) tmp = N % 10 if tmp == 2 or tmp == 4 or tmp == 5 or tmp == 7 or tmp == 9: print('hon') elif tmp == 0 or tmp == 1 or tmp == 6 or tmp == 8: print('pon') else: print('bon')
p03251
s641163881
Accepted
N,M,X,Y = map(int,input().split()) lx = list(map(int,input().split())) lx.append(X) ly = list(map(int,input().split())) ly.append(Y) if max(lx) < min(ly): print('No War') else: print('War')
p02554
s425124896
Accepted
N = int(input()) MOD_BY = 10**9 + 7 a = pow(10,N,MOD_BY) b = pow(9,N,MOD_BY) c = pow(8,N,MOD_BY) ans = a - 2*b + c print(ans%MOD_BY)
p02583
s520693025
Accepted
import itertools N = int(input()) L = list(map(int,input().split())) count = 0 for l in itertools.combinations(L,3): l = sorted(l) if l[1] == l[2] or l[0] == l[1]: continue if l[2] < l[1]+l[0]: count+=1 print(count)
p02785
s163942409
Wrong Answer
N = list(map(int,input().rstrip().split())) n = N[0] k = N[1] h = list(map(int,input().split())) h.sort(reverse=True) m = 0 hit = 0 if k >= n : m = 0 else: for i in range(k,n): hit += h[i] m = hit print(type(m)) print(m)
p03836
s550749592
Accepted
import sys sys.setrecursionlimit(10 ** 7) rl = sys.stdin.readline def solve(): sx, sy, tx, ty = map(int, rl().split()) dx, dy = tx - sx, ty - sy ans = 'U' * dy + 'R' * dx ans += 'D' * dy + 'L' * dx ans += 'L' + 'U' * (dy + 1) + 'R' * (dx + 1) + 'D' ans += 'R' + 'D' * (dy + 1) + 'L' * (dx + 1) + 'U' print(ans) if __name__ == '__main__': solve()
p02571
s468131135
Accepted
S = input() T = input() counter = 0 for i in range(len(S)): second = 0 group = S[i:i+len(T)] if len(group) < len(T): break for j in range(len(T)): if T[j] != group[j]: second += 1 if counter == 0: counter = second elif second < counter: counter = second print(counter)
p03211
s869971866
Accepted
d = input() dL = len(d) dE = dL - 3 Min = 10000000000 for i in range(0, dE+1): D = int(d[i:i+3]) J = abs(D - 753) if J < Min: Min = J print(Min)
p02882
s576302449
Accepted
from math import atan as arctan from math import degrees def main(): a, b, x = map(int, input().split(" ")) bottom_area = x / a if bottom_area >= a * b / 2: print(abs(degrees(arctan((2 * x / (a ** 3)) - (2 * b / a))))) else: print(90 - degrees(arctan(2 * x / a / (b ** 2)))) if __name__ == '__main__': main()
p02989
s585092019
Accepted
n=int(input()) a=list(map(int,input().split())) a.sort() b=a[n//2-1] c=a[n//2] print(max(c-b,0))
p02596
s190390845
Accepted
k = int(input()) x = 7 % k s = [0] * k i = 1 while s[x] == 0: if x == 0: print(i) exit() s[x] = 1 x = (x * 10 + 7) % k i += 1 print('-1')
p03433
s999142308
Accepted
n = int(input()) a = int(input()) if n % 500 <= a: print('Yes') else: print('No')
p02973
s617845704
Accepted
import bisect n = int(input()) A = list(int(input()) for _ in range(n)) B = [A[n-1]] for i in range(n-2,-1,-1): if A[i] >= B[-1]: B.append(A[i]) else: B[bisect.bisect_right(B,A[i])] = A[i] print(len(B))
p02847
s901557053
Accepted
l = ['SUN','MON','TUE','WED','THU','FRI','SAT'] s = input() i = l.index(s) print(7-i)
p02661
s107853628
Accepted
from operator import itemgetter, attrgetter N, *A = map(int, open(0).read().split()) *A, = zip(*[iter(A)]*2) if N % 2 == 0: A.sort() mid_l = A[N//2-1][0]+A[N//2][0] A.sort(key=itemgetter(1)) mid_r = A[N//2-1][1]+A[N//2][1] print(mid_r - mid_l+1) else: A.sort() mid_l = A[N//2][0] A.sort(key=itemgetter(1)) mid_r = A[N//2][1] print(mid_r - mid_l+1)
p02946
s981458416
Accepted
k,x=map(int,input().split()) for i in range(x-k+1,x+k): print(i,end=" ")
p02705
s316035963
Accepted
n=int(input()) import math print(n*math.pi*2)
p02624
s935070555
Accepted
N = int(input()) num = [] for _ in range(N + 1): num.append(1) for i in range(2, N + 1): cnt = 1 while cnt * i <= N: num[cnt * i] += 1 cnt += 1 ans = 0 for i in range(1, N + 1): ans += num[i] * i print(ans)
p02695
s424375789
Accepted
import itertools N, M, Q = map(int, input().split()) arr = [list(map(int, input().split())) for _ in range(Q)] ans = 0 for i in itertools.combinations_with_replacement(range(1,M+1),N): tmp = 0 for item in arr: if i[item[1]-1] - i[item[0]-1] == item[2]: tmp += item[3] ans = max(ans,tmp) print(ans)
p03860
s003965583
Wrong Answer
a, b, c = input().split() print("A", b[0], "C")
p02607
s109894956
Accepted
N=int(input()) a=[0]*N a=list(map(int,input().split())) ans=0 for i in range(1,N+5,2): if(N<i): break if(a[i-1]%2==1): ans=ans+1 print(ans)
p03814
s281830891
Wrong Answer
string = input() index = string.index("A") count = 0 i = index while string[i] != "Z": count +=1 i+=1 print(count)
p02647
s082490042
Accepted
n, K = map(int,input().split()) A = list(map(int,input().split())) b = [0 for _ in range(n+1)] for _ in range(K): for i,a in enumerate(A): b[max(0, i-a)] += 1 b[min(n, i+a+1)] -= 1 for i in range(n): b[i+1] += b[i] A = b[:-1] b = [0 for _ in range(n+1)] if sum(A) == n*n: break print(*A)
p02953
s914355493
Accepted
#<C> N = int(input()) H = list(map(int, input().split())) ans = 0 for n in range(N): if ans - 1 > H[n]: print("No") exit() ans = max(ans,H[n]) print("Yes")
p02629
s536735593
Accepted
N = int(input()) out = [] def Saiki(N): w = N // 26 z = N % 26 ca = 1 if(z == 0): w -= 1 z = 26 ca += z - 1 out.insert(0, chr(ca + 96)) if(w == 0): return Saiki(w) Saiki(N) print(''.join(out))
p03377
s135077922
Accepted
A, B, X = [int(i) for i in input().split()] print("YES" if A <= X <= A+B else "NO")
p03150
s939688379
Accepted
S = input() key = list("keyence") target = 'keyence' flg = False for i in range(len(S)): for j in range(len(S)): tmp = S[0:i]+S[j:] if tmp == target and not flg: print("YES") flg = True break if not flg: print("NO")
p03479
s432634029
Accepted
X,Y=map(int,input().split()) result = [] while Y >= X: result.append(X) X *= 2 print(len(result))
p03838
s200947135
Accepted
x, y = map(int, input().split()) f = lambda x: 10**10 if x < 0 else x print(min(f(y-x), f(y+x)+1, f(-y-x)+1, f(-y+x)+2))
p02601
s706261575
Accepted
a, b, c = map(int, input().split()) k = int(input()) from itertools import permutations, product comb_lst = list(product([0,1,2], repeat = k)) flag = False for comb in comb_lst: abc_lst = [a, b, c] for num in comb: abc_lst[num] *= 2 if abc_lst[0] < abc_lst[1] and abc_lst[1] < abc_lst[2]: flag = True print('Yes' if flag == True else 'No')
p03698
s221746173
Accepted
def resolve(): s = input() d = {} ans = 'yes' for i in s: if d.get(i): ans = 'no' break d[i] = True print(ans) resolve()
p03001
s748211598
Accepted
W, H, x, y = map(int, input().split()) if x == W/2 and y == H/2: flag = 1 else: flag = 0 print(W*H/2, flag)
p03719
s942933095
Accepted
a,b,c=map(int,input().split()) if(c>=a and c<=b): print("Yes") else: print("No")
p03607
s536426413
Accepted
def main(): N = int(input()) A = [int(input()) for i in range(N)] from collections import Counter c = Counter(A) ans = 0 for v in c.values(): if v % 2: ans += 1 print(ans) if __name__ == '__main__': main()
p03625
s163916634
Accepted
N = int(input()) A = list(map(int, input().split())) A.sort(key=lambda x: -x) l = [] a_old = -1 for a in A: if a_old == a: l.append(a) a_old = -1 else: a_old = a l.append(0) l.append(0) print(l[0] * l[1])
p02697
s509217566
Accepted
n, m = map(int, input().split()) gu = 1 ki = m - m%2 + 2 for i in range(1, m+1)[::-1]: if i % 2 == 0: print(gu, gu+i) gu += 1 else: print(ki, ki+i) ki += 1
p02744
s441518438
Wrong Answer
n = int(input()) def aa(nokori, str, nowID, firstID): if nokori == 1: print(str+chr(nowID)) return for i in range(nowID - firstID + 2): aa(nokori-1, str+chr(nowID), firstID + i, firstID) aa(n, "", 97, 97)
p03221
s994399361
Accepted
from heapq import heappush, heappop n,m=map(int,input().split()) data=[] pn=[0 for _ in range(n)] for i in range(m): p,y=map(int,input().split()) heappush(data,(y,p,i)) data2=[] while data: y,p,i=heappop(data) pn[p-1]+=1 cid=str(p).zfill(6)+str(pn[p-1]).zfill(6) data2.append((i,cid)) for i,cid in sorted(data2): print(cid)
p03971
s134898159
Accepted
n, a, b = map(int, input().split()) s = input() cnt = 1 memo = 1 for i in range(n): if s[i] == 'c': print('No') else: if cnt <= a + b: if s[i] == 'b' and memo <= b: memo += 1 cnt += 1 print('Yes') elif s[i] == 'a': cnt += 1 print('Yes') else: print('No') else: print('No')
p03086
s043776451
Accepted
S=input() ans=0 tmp=0 for i in range(len(S)): if S[i] in ("A","C","G","T"): tmp+=1 else: ans=max(ans,tmp) tmp=0 ans=max(ans,tmp) print(ans)
p02705
s965262168
Accepted
import math n = int(input()) print(n *2 * math.pi)
p03469
s835392402
Wrong Answer
S = list(map(str, input())) S[3] = "7" for s in S: print(s, end = "")
p02935
s123062762
Wrong Answer
N=int(input()) L=list(map(int,input().split())) L=sorted(L) s=(L[0]+L[1])/2 for i in range(2,N): s=(s+L[i])//2 print(s)
p02922
s419392265
Accepted
a,b = map(int,input().split()) cnt = 1 c = b-a if c >0: cnt += (c//(a-1)) d = c%(a-1) if d != 0: cnt += 1 if b == 1: cnt = 0 print(cnt)
p02982
s286167113
Accepted
n,d=map(int,input().split()) x=[] for _ in range(n): x.append(list(map(int,input().split()))) cnt=0 i=0 while i<n-1: j=i+1 while j<n: temp=0 for k in range(d): temp+=(x[i][k]-x[j][k])**2 if temp==int(temp**(1/2))*int(temp**(1/2)): cnt+=1 j+=1 i+=1 print(cnt)
p04005
s979948195
Accepted
import sys input = sys.stdin.readline def main(): A, B, C = map(int, input().split()) diff_1 = A * B * (C % 2) diff_2 = A * (B % 2) * C diff_3 = (A % 2) * B * C ans = min(diff_1, diff_2, diff_3) print(ans) if __name__ == "__main__": main()
p03607
s272925509
Accepted
N = int(input()) A = [int(input()) for _ in range(N)] dic = {} for i in range(N): data = A[i] if data in dic: dic[data] += 1 else: dic[data] = 1 ans = 0 for i in dic: if dic[i] % 2: ans += 1 print(ans)
p02832
s576243024
Accepted
N = int(input()) S = list(map(int, input().split())) cnt = 1 for i in range(N): if S[i] == cnt: cnt += 1 if cnt == 1: print(-1) else: print(N - cnt + 1)
p03017
s461252770
Wrong Answer
n, a, b, c, d = map(int, input().split()) s = ['S'] + list(input()) for i in range(2, max(c, d)): if s[i] == '#' and s[i-1] == '#': print('No') exit() if c < d: print('Yes') else: for i in range(b, d+1): if s[i-1] == '.' and s[i] == '.' and s[i+1] == '.': print('Yes') exit() print('No')
p03331
s712680412
Accepted
def ii():return int(input()) def iim():return map(int,input().split()) def iil():return list(map(int,input().split())) def ism():return map(str,input().split()) def isl():return list(map(str,input().split())) n = ii() ans = 100 def colsum(s): ret = 0 for i in s: ret += int(i) return ret for i in range(1,n): cand = colsum(str(i))+colsum(str(n-i)) ans = min(cand,ans) print(ans)
p02755
s271115637
Accepted
A, B = map(int, input().split()) for i in range(2000): if int(i * 0.08) == A and int(i * 0.1) == B: print(i) quit() print(-1)
p02696
s393178609
Accepted
a, b, n = map(int, input().split()) x = min(b-1, n) ans = (a * x // b) print(ans)
p02661
s637320335
Accepted
n=int(input()) a=[] b=[] for i in range(n): c,d=map(int,input().split()) a.append(c) b.append(d) a=sorted(a) b=sorted(b) if n%2==0: x=(a[n//2-1]+a[n//2]) y=(b[n//2-1]+b[n//2]) print(y-x+1) else: print(b[n//2]-a[n//2]+1)
p02755
s284845475
Accepted
a, b = map(int, input().split()) ans = -1 for v in range((100*10)+100): t8 = int(v * 0.08) t10 = int(v * 0.1) if t8 > a or t10 > b: break if t8 == a and t10 == b: ans = v break print(ans)
p02879
s041757916
Accepted
def main(): a, b = map(int, input().split()) if a >= 10 or b >= 10: print(-1) else: print(a*b) main()
p03605
s793586631
Accepted
N = input() if "9" in N: print("Yes") else: print("No")
p03338
s626199453
Wrong Answer
N=int(input()) S=input() s="" m="" ss=[] mm=[] s1=set() m1=set() res = 0 for i in range(N): s=S[0:i] m=S[i+1:N] ss=list(s) mm=list(m) s1=set(ss) m1=set(mm) s_intersection = s1 & m1 res= max(res,len(s_intersection)) print(res)
p03241
s314563334
Wrong Answer
N,M = map(int,input().split()) n = M // N import math m = math.ceil(M**0.5) for i in range(min(n,m)): x = n - i if M % x == 0: print(x) quit()
p02773
s083803333
Accepted
n = int(input()) s = {} count = 0 while n > count: st = input() if st not in s: s[st] = 1 count += 1 else: s[st] += 1 count += 1 sorteditems = sorted(s.items(), key = lambda x : x[1], reverse= True) max = 0 ans = [] for a, b in sorteditems: if max == 0: ans.append(a) max = b elif max == b: ans.append(a) for i in sorted(ans): print(i)
p03433
s409183917
Accepted
N=int(input()) A=int(input()) if N % 500 <= A: print("Yes") else: print("No")
p02630
s819704879
Accepted
n=int(input()) from collections import Counter as co g=list(map(int,input().split())) l=co(g) f=sum(g) q=int(input()) for i in range(q): b,c=map(int,input().split()) if b in l: v=l[b] l[b]=0 l[c]+=v f=f-v*b+c*v print(f)
p03061
s713353047
Accepted
import fractions N = int(input()) A = list(map(int, input().split())) right = [A[0]]*N left = [A[-1]]*N for i in range(1,N): right[i] = fractions.gcd(right[i-1],A[i]) left[N-1-i] = fractions.gcd(left[N-i],A[N-1-i]) ans = left[1] for i in range(N-2): ans = max(ans,fractions.gcd(right[i],left[i+2])) print(max(ans,right[N-2]))
p02833
s653931204
Wrong Answer
import math n = int(input()) if n%2==1: print(0) else: c = n//10 i = 1 while 10*5**i<n: c += n//(10*5**i) i+=1 print(c)
p02742
s348724395
Wrong Answer
H,W = map(int,input().split()) if H % 2 == 0: t = H // 2 u = H // 2 else: t = H // 2 + 1 u = H // 2 if W % 2 == 0: print ((t+u) * (W//2)) else: print (t * (W//2+1) + u * (W//2))
p02659
s056640395
Accepted
from math import floor from decimal import Decimal AB = input().split() A = Decimal(AB[0]) B = Decimal(AB[1]) c = floor(A * B) print(c)
p03075
s645052689
Accepted
west=124 east=-1 for _ in range(5): x=int(input()) west=min(x,west) east=max(x,east) k=int(input()) if east-west>k: print(":(") else: print("Yay!")
p03377
s279961158
Accepted
A, B, X = map(int, input().split()) r = X - A if r <= B and r >= 0: print('YES') else: print('NO')
p03352
s902548975
Wrong Answer
import math x = int(input()) for i in range(x,0,-1): if math.sqrt(i)%1 == 0 or (math.ceil(i ** (1/3)))**3 == i: print(i) break
p03696
s053128454
Wrong Answer
n = int(input()) s = input() l_cnt = 0 r_cnt = 0 for i in s: if i == '(': l_cnt += 1 else: r_cnt += 1 if l_cnt == r_cnt: print(s) if l_cnt < r_cnt: print('('*(r_cnt - l_cnt) +s) if l_cnt > r_cnt: print(s +')'*(l_cnt - r_cnt))
p03150
s030858555
Wrong Answer
KEY = "keyence" def main(): s = input() for i in range(1, len(KEY)): r = KEY[0:i] l = KEY[i:] if s.startswith(r) and s.endswith(l): print("YES") return print("No") main()
p02607
s364553440
Accepted
# coding: utf-8 import math import re import numpy as np import copy #読み込む N = int(input()) an = list(map(int, input().split(' '))) ans = 0 for i in range(N): if (i+1) % 2 == 0: continue elif an[i] % 2 != 0: ans += 1 print(ans)
p02578
s018383223
Wrong Answer
N = int(input()) A = list(map(int,input().split())) keep = 0 cnt =0 x=0 for a in A: if keep > a: cnt += keep -a x = keep -a print(x) keep = a + x else: keep = a print(cnt)
p03077
s251479661
Accepted
def main(): N = int(input()) G = [int(input()) for i in range(5)] G = [(N+g-1)//g for g in G] print(max(G)+4) if __name__ == '__main__': main()
p03438
s055149527
Wrong Answer
import sys input = sys.stdin.readline def main(): n = int(input()) A = [int(i) for i in input().strip().split()] B = [int(i) for i in input().strip().split()] _diff_A, _diff_B = 0, 0 for i in range(n): if A[i] > B[i]: _diff_A += A[i] - B[i] elif B[i] > A[i]: _diff_B += B[i] - A[i] if _diff_B > _diff_A * 2: print("Yes") else: print("No") if __name__ == "__main__": main()
p02912
s225063322
Accepted
import heapq n, m = map(int, input().split()) a = list(map(int, input().split())) a = [-1 * i for i in a] heapq.heapify(a) cnt = 0 while cnt < m: x = heapq.heappop(a) * -1 x = x // 2 cnt += 1 heapq.heappush(a, x * -1) print(sum(a) * -1)