Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
# coding:utf-8

n, y = [int(x) for x in input().split(' ')]

sen = y//1000

target = sen - n

if target < 0:
    print('-1 -1 -1')
else:
    if target % 9 % 4:
        print('-1 -1 -1')
    else:
    　iti_man = target // 9
    　go_sen = target % 9 // 4
        sen = sen - iti_man*10 - go_sen*5
        print('{} {} {}'.format(iti_man, go_sen, sen))






Fixed submission:
# coding:utf-8

n, y = [int(x) for x in input().split(' ')]

max_iti_man = y // 10000

for iti_man in range(max_iti_man + 1):
    for go_sen in range(int(n) - iti_man + 1):
        itigo = 5000 * go_sen + 10000 * iti_man
        sen = n - iti_man - go_sen
        if 1000 * sen + itigo == y:
            print("{} {} {}".format(iti_man,go_sen,sen))
            exit()

print("-1 -1 -1")

Buggy python submission (verdict: Runtime Error):
# coding:utf-8

n, y = [int(x) for x in input().split(' ')]

# 1000円札なら何枚か
sen = y//1000

# 減らさなきゃいけない枚数
# 1万円札なら9枚，5千円札なら4枚減る
target = sen - n

if target < 0:
    print('-1 -1 -1')
else:
    iti_man = target // 9
    go_sen = target % 9 // 4

    if target % 9 % 4:
        print('-1 -1 -1')
    else:
        sen = sen - iti_man*10 - go_sen*5
        print('{} {} {}'.format(iti_man, go_sen, sen))
Collapse





Fixed submission:
# coding:utf-8

n, y = [int(x) for x in input().split(' ')]

max_iti_man = y // 10000

for iti_man in range(max_iti_man + 1):
    for go_sen in range(int(n) - iti_man + 1):
        itigo = 5000 * go_sen + 10000 * iti_man
        sen = n - iti_man - go_sen
        if 1000 * sen + itigo == y:
            print("{} {} {}".format(iti_man,go_sen,sen))
            exit()

print("-1 -1 -1")

Buggy python submission (verdict: Runtime Error):
# coding:utf-8

n, y = [int(x) for x in input().split(' ')]

# 1000円札なら何枚か
sen = y//1000

# 減らさなきゃいけない枚数
# 1万円札なら9枚，5千円札なら4枚減る
target = sen - n

if target < 0:
    print('-1 -1 -1')
else:
    iti_man = target // 9
    go_sen = target % 9 // 4

    if target % 9 % 4:
        print('-1 -1 -1')
    else:
        sen = sen - iti_man*10 - go_sen*5
        print('{} {} {}'.format(iti_man, go_sen, sen))
Collapse





Fixed submission:
# coding:utf-8

n, y = [int(x) for x in input().split(' ')]

max_iti_man = y // 10000

for iti_man in range(max_iti_man + 1):
    for go_sen in range(int(n) - iti_man + 1):
        itigo = 5000 * go_sen + 10000 * iti_man
        sen = n - iti_man - go_sen
        if 1000 * sen + itigo == y:
            print("{} {} {}".format(iti_man,go_sen,sen))
            exit()

print("-1 -1 -1")
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split(" "))
xys = [tuple(map(int, input().split(" "))) for i in range(n)]
xys = sorted(xys, key=lambda x: (x[0], -x[1]))

ans = 0

for i in range(1, m + 1):
    cm = -1
    cmi = -1
    for j in range(len(xys)):
        if xys[j][0] <= i and xys[j][1] > cm:
            cm = xys[j][1]
            cmi = j
    if cmi >= 0:
        ans += cm
        xys.pop(cmi)

print(ans)


Fixed submission:
from heapq import heappush, heappop

n, m = map(int, input().split(" "))
xys = [tuple(map(int, input().split(" "))) for i in range(n)]
xys = sorted(xys, key=lambda x: (x[0], -x[1]))

ans = 0

j = 0
h = []
for i in range(1, m + 1):
    while j < len(xys) and xys[j][0] <= i:
        heappush(h, -xys[j][1])
        j += 1
    if h:
        x = -heappop(h)
        # print("Pick", x)
        ans += x

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split(" "))
xys = [tuple(map(int, input().split(" "))) for i in range(n)]
xys = sorted(xys, key=lambda x: (-x[0], x[1]))

dp = [[0 for x in range(m)] for y in range(n)]

for i in range(n):
    a, b = xys[i]
    # print(i, a, b)
    if i == 0:
        for j in range(0, m - a + 1):
            dp[i][j] = b
    else:
        dp[i][0] = max(dp[i - 1][0], b)
        for j in range(1, m - a + 1):
            dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - 1] + b)
    # print(dp[i])

# print(dp)
print(max(max(x) for x in dp))


Fixed submission:
from heapq import heappush, heappop

n, m = map(int, input().split(" "))
xys = [tuple(map(int, input().split(" "))) for i in range(n)]
xys = sorted(xys, key=lambda x: (x[0], -x[1]))

ans = 0

j = 0
h = []
for i in range(1, m + 1):
    while j < len(xys) and xys[j][0] <= i:
        heappush(h, -xys[j][1])
        j += 1
    if h:
        x = -heappop(h)
        # print("Pick", x)
        ans += x

print(ans)
Buggy python submission (verdict: Runtime Error):
l = input()

dp = [[0, 0] * len(l)]

dp[0][0] = 1
dp[0][1] = 2

MOD = 1000000007

for i in range(1, len(l)):
    if l[i] == '0':
        dp[i][0] = (dp[i-1][0] * 3) % MOD
        dp[i][1] = dp[i-1][1] % MOD
    else:
        dp[i][0] = (3*dp[i-1][0] + dp[i-1][1]) % MOD
        dp[i][1] = (dp[i-1][1] * 2) % MOD

print((dp[-1][0] + dp[-1][1]) % MOD)


Fixed submission:
l = input()

dp = [[0, 0]] * len(l)

dp[0][0] = 1
dp[0][1] = 2

MOD = 1000000007

for i in range(1, len(l)):
    if l[i] == '0':
        dp[i][0] = (dp[i-1][0] * 3) % MOD
        dp[i][1] = dp[i-1][1] % MOD
    else:
        dp[i][0] = (3*dp[i-1][0] + dp[i-1][1]) % MOD
        dp[i][1] = (dp[i-1][1] * 2) % MOD

print((dp[-1][0] + dp[-1][1]) % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
l = input()

dp = [[0, 0] for _ in l]

dp[0][0] = 1
dp[0][1] = 2

for i in range(1, len(l)):
    if l[i] == '0':
        dp[i][0] = dp[i-1][0] * 3
        dp[i][1] = dp[i-1][1]
    else:
        dp[i][0] = 3*dp[i-1][0] + dp[i-1][1]
        dp[i][1] = dp[i-1][1] * 2

print((dp[-1][0] + dp[-1][1]) % 1000000007)


Fixed submission:
l = input()

dp = [[0, 0]] * len(l)

dp[0][0] = 1
dp[0][1] = 2

MOD = 1000000007

for i in range(1, len(l)):
    if l[i] == '0':
        dp[i][0] = (dp[i-1][0] * 3) % MOD
        dp[i][1] = dp[i-1][1] % MOD
    else:
        dp[i][0] = (3*dp[i-1][0] + dp[i-1][1]) % MOD
        dp[i][1] = (dp[i-1][1] * 2) % MOD

print((dp[-1][0] + dp[-1][1]) % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
l = input()

dp = [[0, 0] for _ in l]

dp[0][0] = 1
dp[0][1] = 2

for i in range(1, len(l)):
    if l[i] == '0':
        dp[i][0] = dp[i-1][0] * 3
        dp[i][1] = dp[i-1][1]
    else:
        dp[i][0] = 3*dp[i-1][0] + dp[i-1][1]
        dp[i][1] = dp[i-1][1] * 2

print((dp[-1][0] + dp[-1][1]) % 1000000007)


Fixed submission:
l = input()

dp = [[0, 0]] * len(l)

dp[0][0] = 1
dp[0][1] = 2

MOD = 1000000007

for i in range(1, len(l)):
    if l[i] == '0':
        dp[i][0] = (dp[i-1][0] * 3) % MOD
        dp[i][1] = dp[i-1][1] % MOD
    else:
        dp[i][0] = (3*dp[i-1][0] + dp[i-1][1]) % MOD
        dp[i][1] = (dp[i-1][1] * 2) % MOD

print((dp[-1][0] + dp[-1][1]) % MOD)
Buggy python submission (verdict: Runtime Error):
N, K = [int(x) for x in input().split(" ")]
D = [int(x) for x in input().split(" ")]
i = 0
j = len(D) - 1
memo = dict()

hands = set()

steps = 0

def maxSum(d, hands, k):
    if k == 0:
        return 0

    key = f"{str(d)}::{str(hands)}::{k}"
    if key in memo:
        return memo[key]
    
    patterns = [sum(hands)]

    if len(d) > 0:
        el = d[0]
        patterns.append(d[0] + maxSum(d[1:], hands.union(set([el])), k - 1))
        if len(d) > 1:
            el = d[-1]
            patterns.append(d[-1] + maxSum(d[:-1], hands.union(set([el])), k - 1))

    if hands:
        m = min(hands)
        newHand = hands.difference(set([m]))
        patterns.append(maxSum([m] + d, newHand, k - 1) - m)
        patterns.append(maxSum(d + [m], newHand, k - 1) - m)

    res = max(patterns)
    return res
        

print(maxSum(D, set(), K))
    


Fixed submission:
N, K = [int(x) for x in input().split(" ")]
D = [int(x) for x in input().split(" ")]

combs = []
lim = min(N, K)
for a in range(0, lim + 1):
    for b in range(0, lim - a + 1):
          combs.append((a, b))

maxres = 0
for a,b in combs:
    elems = sorted(D[:a] + D[N-b:])
    negative = len([e for e in elems if e < 0])
    drop = min(negative, max(0, K - a - b))
    res = sum(elems[drop:])
    maxres = max(maxres, res)
print(maxres)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l1 = 2
l2 = 1
for i in range(1, n):
    l3 = l1 + l2
    l1 = l2
    l2 = l3
print(l3)


Fixed submission:
n = int(input())
l1 = 2
l2 = 1
for i in range(1, n):
    l3 = l1 + l2
    l1 = l2
    l2 = l3
print(l2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = { (i + 1):int(input()) for i in range(n) }
s = 1
ans = 0
while True:
    if s == 2:
        break
    s = a[s]
    ans += 1
    if s == 1:
        ans = -1
        break
print(ans)


Fixed submission:
n = int(input())
a = { (i + 1):int(input()) for i in range(n) }
s = 1
ans = 0
seen = set()
while True:
    if s == 2:
        break
    seen.add(s)
    s = a[s]
    ans += 1
    if s == 1 or s in seen:
        ans = -1
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

def main():
    inputs = [input() for _ in range(2)]
    numbers = np.array([float(i) for i in inputs[1].split('\s')])
    numbers = np.reciprocal(numbers)
    answer = 1 / sum(numbers)
    print(answer)

if __name__ == '__main__':
    main()

Fixed submission:
import numpy as np

def main():
    inputs = [input() for _ in range(2)]
    numbers = np.array([float(i) for i in inputs[1].split(' ')])
    numbers = np.reciprocal(numbers)
    answer = 1 / sum(numbers)
    print(answer)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
S = raw_input().strip()
a, b = S[0:2], S[2:]

if a == '00' or b == '00':
    print('NA')
	exit()

ia = int(a)
ib = int(b)

if ia >= 1 and ia <= 12 and ib >=1 and ib <= 12:
    print('AMBIGUOUS')
	exit()

if ia >= 1 and ia <= 12 and ib > 12:
    print('MMYY')
    exit()
if ia > 12 and ib <= 12:
    print('YYMM')
	exit()

  


Fixed submission:
S = raw_input().strip()
a, b = S[0:2], S[2:]

ia = int(a)
ib = int(b)

if ib == 0:
    if ia >= 1 and ia <=12: 
        print('MMYY')
        exit()

if ia == 0:
    if ib >= 1 and ib <= 12:
        print('YYMM')
        exit()

if ia > 12:
    if ib > 12:
        print('NA')
    elif ib > 0:
        print('YYMM')
    else:
        print('NA')
elif ia >= 1:
    if ib >=1 and ib <= 12:
        print('AMBIGUOUS')
    elif ib > 12:
        print('MMYY')
    else:
        print('NA')
else:
    if ib == 0:
        print('NA')
    elif ib <= 12:
        print('YYMM')
    else:
        print('NA')
Buggy python submission (verdict: Runtime Error):
N = int(input())
list_L = map(int, input().split())

max_ = list_L.pop(list_L.index(max(list_L)))

if max_ > sum(list_L):
    print("Yes")
else:
    print("No")


Fixed submission:
N = int(input())
list_L = list(map(int, input().split()))

max_ = list_L.pop(list_L.index(max(list_L)))

if max_ >= sum(list_L):
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
N = int(input())
print((N//2 + N%2))/N

Fixed submission:
import math
n = int(input())
if n%2 == 0:
  print(1/2)
else:
  print(math.ceil(n/2)/n)

Buggy python submission (verdict: Runtime Error):
import math
if n%2 == 0:
  print(1/2)
else:
  print(math.ceil(n/2)/n)

Fixed submission:
import math
n = int(input())
if n%2 == 0:
  print(1/2)
else:
  print(math.ceil(n/2)/n)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = [ i for i in input().split() if i>m]
print(len(l))

Fixed submission:
n,k = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
print(len([i for i in l if i>=k]))
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=[0 for i in range(m)]
b=[0 for i in range(m)]
c=[[] for i in range(m)]
for i in range(m):
    a[i],b[i]=map(int,input().split())
    c[i]=list(map(int,input().split()))
dp = [float("inf") for i in range(2**n)]
dp[0] = 0
for i in range(m):
    now = 0
    for j in c[i]:
        jj = 1<< j-1
        now |= jj
    for k in range(2**n):
        kk = k | now
        dp[kk] = min(dp[kk], dp[k]+a[i])
if dp[-1]==float("inf"):
    print(-1)
else:
    print(dp[-1])

Fixed submission:
def main():
  n,m=map(int,input().split())
  a=[0 for i in range(m)]
  b=[0 for i in range(m)]
  c=[[] for i in range(m)]
  for i in range(m):
    a[i],b[i]=map(int,input().split())
    c[i]=list(map(int,input().split()))
  
  dp=[float("inf") for i in range(2**n)]
  dp[0]=0
  for i in range(m):
    now=0
    for j in c[i]:
      jj=1<<j-1
      now|=jj
    for k in range(2**n):
      kk=k|now
      dp[kk]=min(dp[kk],dp[k]+a[i])
    
 
  if dp[-1]==float("inf"):
    print(-1)
  else:
    print(dp[-1])
    
if __name__ == '__main__':  
  main()

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=[0 for i in range(m)]
b=[0 for i in range(m)]
c=[[] for i in range(m)]
for i in range(m):
    a[i],b[i]=map(int,input().split())
    c[i]=list(map(int,input().split()))
dp = [float("inf") for i in range(1<<n)]
dp[0] = 0
for i in range(m):
    now = 0
    for j in c[i]:
        jj = 1<< j-1
        now |= jj
    for k in range(1<<n):
        kk = k | now
        dp[kk] = min(dp[kk], dp[k]+a[i])
if dp[-1]==float("inf"):
    print(-1)
else:
    print(dp[-1])

Fixed submission:
def main():
  n,m=map(int,input().split())
  a=[0 for i in range(m)]
  b=[0 for i in range(m)]
  c=[[] for i in range(m)]
  for i in range(m):
    a[i],b[i]=map(int,input().split())
    c[i]=list(map(int,input().split()))
  
  dp=[float("inf") for i in range(2**n)]
  dp[0]=0
  for i in range(m):
    now=0
    for j in c[i]:
      jj=1<<j-1
      now|=jj
    for k in range(2**n):
      kk=k|now
      dp[kk]=min(dp[kk],dp[k]+a[i])
    
 
  if dp[-1]==float("inf"):
    print(-1)
  else:
    print(dp[-1])
    
if __name__ == '__main__':  
  main()
Buggy python submission (verdict: Runtime Error):
n,k,q=map(int,input().split())
L= [ int(input()) for i in range(q)]
N = [ k-q+L.count(i) for i in range(1,n+1) ]
for i in N:
    print('YES' if i>0 else 'NO')


Fixed submission:
n=input()
L=["Sunny","Cloudy","Rainy"]
if n == L[2]:
  print(L[0])
else:
  print(L[L.index(n)+1])
Buggy python submission (verdict: Runtime Error):
n= list(input())
print('No' if 'L' in n[::2] or 'R' in n[1::2] else 'Yes)


Fixed submission:
S = list(input())
print('No' if 'L' in S[::2] or 'R' in S[1::2] else 'Yes')
Buggy python submission (verdict: Runtime Error):
n,k,q=map(int,input().split())
L= [ int(input()) for i in range(q)]
N = [k]*n
j = 0
while(j<len(L)):
    for i in range(len(N)):
        if i+1 != L[j]:
            N[i] -= 1
    j +=1

for i in range(N):
    if i>0:
        print('YES')
    else:
        print('NO')

Fixed submission:
n, k, q = map(int, input().split())
N = [k]*n
L = [-q]*n
for _ in range(q): L[int(input())-1]+=1
N = map(lambda x,y:x+y, N,L)
for p in N: print("Yes" if p>0 else "No")
Buggy python submission (verdict: Runtime Error):
from heapq import heapify, heapreplace
n,m = map(int,input().split())
L = [  -i for i in map(int, input().split())]
heapify(L)
for _ in range(m):
    heapreplace(L,L[0]//2 + L[0]%2)
print(-sum)

Fixed submission:
from heapq import heapify, heapreplace
n,m = map(int,input().split())
L = [  -i for i in map(int, input().split())]
heapify(L)
for _ in range(m):
    heapreplace(L,L[0]//2 + L[0]%2)
print(-sum(L))

Buggy python submission (verdict: Runtime Error):
import heapq
n,m = map(int,input().split())
L = [  -i for i in map(int, input().split())]
heapify(L)
for _ in range(m):
    heapreplace(L,L[0]//2 + L[0]%2)
print(-sum(L))

Fixed submission:
from heapq import heapify, heapreplace
n,m = map(int,input().split())
L = [  -i for i in map(int, input().split())]
heapify(L)
for _ in range(m):
    heapreplace(L,L[0]//2 + L[0]%2)
print(-sum(L))

Buggy python submission (verdict: Runtime Error):
import heapq
n,m = map(int,input().split())
L = [  -i for i in map(int, input().split())]
heapify(L)
for _ in range(m):
    heapreplace(L,L[0]//2 + L[0]%2)
print(-sum)

Fixed submission:
from heapq import heapify, heapreplace
n,m = map(int,input().split())
L = [  -i for i in map(int, input().split())]
heapify(L)
for _ in range(m):
    heapreplace(L,L[0]//2 + L[0]%2)
print(-sum(L))
Buggy python submission (verdict: Runtime Error):
n = int(input())
L = [int(i) for i in input().split()]
c = sum(int(i) for i in input().split())
C = [int(i) for i in input().split()]
for i in range(len(L)):
  if L[i] == L[i+1]:
    c += C[i-1]
print(c)

Fixed submission:
n = int(input())
L = [int(i) for i in input().split()]
c = sum(int(i) for i in input().split())
C = [int(i) for i in input().split()]
for i in range(len(L)-1):
  if L[i]+1 == L[i+1]:
    c += C[L[i]-1]
print(c)
Buggy python submission (verdict: Runtime Error):
from heapq import heapify, heappush, heappop
n = int(input())
L = [int(i) for i in input().split()]
heapify(L)
for i in range(n-1):
    s = (L[0]+L[1])/2
    L = L[2:] 
    heappush(L,s)
ans = heapq.heappop(L)
print(ans)

Fixed submission:
a = int(input())
s = input()
print(s if a>=3200 else 'red')
Buggy python submission (verdict: Runtime Error):
from heapq import heapify, heappush, heappop
n = int(input())
L = [int(i) for i in input().split()]
heapify(L)
for i in range(n-1):
    s = (L[0]+L[1])/2
    L = L[2:] 
    heappush(L,s)
ans = heapq.heappop(L)
print(ans)

Fixed submission:
from heapq import heapify, heappush, heappop
n = int(input())
L = [int(i) for i in input().split()]
heapify(L)
for i in range(n-1):
    a= heappop(L)
    b= heappop(L)
    s=(a+b)/2
    heappush(L,s)
print(s)

Buggy python submission (verdict: Runtime Error):
from heapq import heapify, heappush
n = int(input())
L = [int(i) for i in input().split()]
heapify(L)
for i in range(n-1):
    s = (L[0]+L[1])/2
    L = L[2:] 
    heappush(L,s)
ans = heapq.heappop(L)
print(ans)

Fixed submission:
from heapq import heapify, heappush, heappop
n = int(input())
L = [int(i) for i in input().split()]
heapify(L)
for i in range(n-1):
    a= heappop(L)
    b= heappop(L)
    s=(a+b)/2
    heappush(L,s)
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

A = list(map(int, input().split()))
Ad = {}
for i in range(N):
    Ad[i] = A[i]

def get_keys_from_value(d, val):
    return [k for k, v in d.items() if v == val][0]

ans = ''
for j in range(len(Ad)):
    ans += ' ' + str(get_keys_from_value(Ad, j + 1) + 1)

print(ans.strip())

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

Ad = {}
for i in range(N):
    Ad[i] = A[i]

Ad_sorted = sorted(Ad.items(), key=lambda x:x[1])

ans = ''
for Adi in Ad_sorted:
    ans += ' ' + str(Adi[0] + 1)

print(ans.strip())
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(M):
  list.sort(A, reverse=True)
  A[0] = A[0] // 2
print(sum(A))

Fixed submission:
import heapq
import math

N, M = map(int, input().split())
A = list(map(int, input().split()))

hq = []
for a in A:
  heapq.heappush(hq, a * -1)

for i in range(M):
  n = math.ceil(heapq.heappop(hq) / 2)
  heapq.heappush(hq, n)

b = []
for hqi in hq:
  b.append(hqi * -1)
  
print(sum(b))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))

top = 0
for i in range(M):
  A = sorted(A, reverse=True)
  A[0] = A[0] // 2

print(sum(A))

Fixed submission:
import heapq
import math

N, M = map(int, input().split())
A = list(map(int, input().split()))

hq = []
for a in A:
  heapq.heappush(hq, a * -1)

for i in range(M):
  n = math.ceil(heapq.heappop(hq) / 2)
  heapq.heappush(hq, n)

b = []
for hqi in hq:
  b.append(hqi * -1)
  
print(sum(b))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))

top = 0
for i in range(M):
  list.sort(A, reverse=True)
  A[0] = A[0] // 2

print(sum(A))

Fixed submission:
import heapq
import math

N, M = map(int, input().split())
A = list(map(int, input().split()))

hq = []
for a in A:
  heapq.heappush(hq, a * -1)

for i in range(M):
  n = math.ceil(heapq.heappop(hq) / 2)
  heapq.heappush(hq, n)

b = []
for hqi in hq:
  b.append(hqi * -1)
  
print(sum(b))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))

top = 0
for i in range(M):
  for j in range(len(A)):
    if A[j] > A[top]:
      top = j
  A[top] = A[top] // 2

print(sum(A))

Fixed submission:
import heapq
import math

N, M = map(int, input().split())
A = list(map(int, input().split()))

hq = []
for a in A:
  heapq.heappush(hq, a * -1)

for i in range(M):
  n = math.ceil(heapq.heappop(hq) / 2)
  heapq.heappush(hq, n)

b = []
for hqi in hq:
  b.append(hqi * -1)
  
print(sum(b))
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
N = int(input())
ans = 0

for i in range(N):
  ans += i

print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
N = int(input())

print(N * (N - 1) // 2)
Buggy python submission (verdict: Runtime Error):
a = [input() for i in range(2)]

text = a[0]
iter = int(a[1])

text_list = list(text)
ren = []
start = text_list[0]
a = 0
for i in range(1,len(text_list)):
  if text_list[i] == start:
    a += 1
    if i == len(text_list)-1:
      ren.append(a)
  else:
    start = text_list[i]
    ren.append(a)
    a = 0

for i in range(len(ren)):
  ren[i] += 1

ans = 0
if text_list[0] == text_list[-1]:
  if ren[0] % 2 == 1 and ren[-1] % 2 == 1:
    for r in ren:
      ans += (r//2)
    ans *= iter
    ans += iter-1
  else:
    for r in ren:
      ans += (r//2)
    ans *= iter    
else:
  for r in ren:
    ans += (r//2)
  ans *= iter

print(ans)
    
  

Fixed submission:
a = [input() for i in range(2)]

text = a[0]
iter = int(a[1])

text_list = list(text)
ren = []
start = text_list[0]
a = 0
for i in range(1,len(text_list)):
  if text_list[i] == start:
    a += 1
    if i == len(text_list)-1:
      ren.append(a)
  else:
    start = text_list[i]
    ren.append(a)
    a = 0

for i in range(len(ren)):
  ren[i] += 1

if ren == []:
  ren = [1]
  
ans = 0
if len(ren) == 1:
  ans = ren[0] * iter // 2
elif text_list[0] == text_list[-1]:
  if ren[0] % 2 == 1 and ren[-1] % 2 == 1:
    for r in ren:
      ans += (r//2)
    ans *= iter
    ans += iter-1
  else:
    for r in ren:
      ans += (r//2)
    ans *= iter    
else:
  for r in ren:
    ans += (r//2)
  ans *= iter

print(ans)

Buggy python submission (verdict: Runtime Error):
a = [input() for i in range(2)]

text = a[0]
iter = int(a[1])

text_list = list(text)
ren = []
start = text_list[0]
a = 0
for i in range(1,len(text_list)):
  if text_list[i] == start:
    a += 1
    if i == len(text_list)-1:
      ren.append(a)
  else:
    start = text_list[i]
    ren.append(a)
    a = 0

for i in range(len(ren)):
  ren[i] += 1

ans = 0
if text_list[0] == text_list[-1]:
  if ren[0] % 2 == 1 and ren[-1] % 2 == 1:
    for r in ren:
      ans += (r//2)
    ans *= iter
    ans += iter-1
  else:
    for r in ren:
      ans += (r//2)
      ans *= iter    
else:
  for r in ren:
    ans += (r//2)
  ans *= iter

print(ans)
    
  

Fixed submission:
a = [input() for i in range(2)]

text = a[0]
iter = int(a[1])

text_list = list(text)
ren = []
start = text_list[0]
a = 0
for i in range(1,len(text_list)):
  if text_list[i] == start:
    a += 1
    if i == len(text_list)-1:
      ren.append(a)
  else:
    start = text_list[i]
    ren.append(a)
    a = 0

for i in range(len(ren)):
  ren[i] += 1

if ren == []:
  ren = [1]
  
ans = 0
if len(ren) == 1:
  ans = ren[0] * iter // 2
elif text_list[0] == text_list[-1]:
  if ren[0] % 2 == 1 and ren[-1] % 2 == 1:
    for r in ren:
      ans += (r//2)
    ans *= iter
    ans += iter-1
  else:
    for r in ren:
      ans += (r//2)
    ans *= iter    
else:
  for r in ren:
    ans += (r//2)
  ans *= iter

print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-

s = input().split()

if s[0] % 2 == 0 or s[1]%2 == 0:
  print("No")

else:
  print("Yes")

Fixed submission:
# -*- coding:utf-8 -*-

s = [int(i) for i in input().split()]


if s[0]*s[1]%2 == 0:
    print("No")

else:
    print("Yes")