Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

d = abs(A-B)
v = V - W
if d/v <= T:
    print('YES')
else:
    print('NO')



Fixed submission:
import sys

A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if V <= W:
    print('NO')
    sys.exit()

d = abs(A-B)
v = V - W
if d/v <= T:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
a = list(map(int, input().split()))
sum_a = 1

for e in a:
    sum_a *= e

if sum_a > 1e18:
    sum_a = -1

print(sum_a)

Fixed submission:
import sys

n = input()
a = list(map(int, input().split()))
sum_a = 1

if 0 in a:
    print(0)
    sys.exit()

for e in a:
    sum_a *= e
    if sum_a > 1e18:
        print(-1)
        sys.exit()

if sum_a > 1e18:
    sum_a = -1

print(sum_a)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

k = int(input())
ans = 0


def gcd(*numbers):
    return reduce(math.gcd, numbers)


for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1, k+1):
            ans += gcd(a, b, c)

print(ans)

Fixed submission:
import math

k = int(input())
ans = 0

for a in range(1, k+1):
    for b in range(1, k+1):
        tmp = math.gcd(a, b)
        for c in range(1, k+1):
            ans += math.gcd(tmp, c)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int, input().split())

total = 0
blue = 0

for i in range(int(10e100)):
    if i % 2 == 0:  # blue
        total += a
        blue += a
        if total >= n:
            mod = total - n
            print(blue - mod)
            break
    else:  # red
        total += b
        if total >= n:
            print(blue)
            break

Fixed submission:
n, a, b = map(int, input().split())

x, mod = divmod(n, a + b)

if x == 0:
    print(min(a, n))
else:
    print(a * x + min(mod, a))
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
divs = []

for i in range(1, min(a, b)):
    if a % i == 0:
        if b % i == 0:
            divs.append(i)
print(divs[-k])

Fixed submission:
a, b, k = map(int, input().split())

for i in range(min(a, b), 0, -1):
    if a % i == 0 and b % i == 0:
        k -= 1
        if k == 0:
            print(i)

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
divs = []

for i in range(1, max(min(a, b), 2)):
    if a % i == 0:
        if b % i == 0:
            divs.append(i)
print(divs[-k])

Fixed submission:
a, b, k = map(int, input().split())

for i in range(min(a, b), 0, -1):
    if a % i == 0 and b % i == 0:
        k -= 1
        if k == 0:
            print(i)

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
divs = []

for i in range(1, int(max(a, b))):
    if a % i == 0:
        if b % i == 0:
            divs.append(i)
print(divs[-k])

Fixed submission:
a, b, k = map(int, input().split())

for i in range(min(a, b), 0, -1):
    if a % i == 0 and b % i == 0:
        k -= 1
        if k == 0:
            print(i)

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
divs = []

for i in range(1, max(int(max(a, b)), 2)):
    if a % i == 0:
        if b % i == 0:
            divs.append(i)
print(divs[-k])

Fixed submission:
a, b, k = map(int, input().split())

for i in range(min(a, b), 0, -1):
    if a % i == 0 and b % i == 0:
        k -= 1
        if k == 0:
            print(i)

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
divs = []

for i in range(1, max(int(max(a, b) / 2), 2)):
    if a % i == 0:
        if b % i == 0:
            divs.append(i)
print(divs[-k])

Fixed submission:
a, b, k = map(int, input().split())

for i in range(min(a, b), 0, -1):
    if a % i == 0 and b % i == 0:
        k -= 1
        if k == 0:
            print(i)

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
divs = []

for i in range(1, max(int(max(a, b) / 2), 2)):
    if a % i == 0:
        if a % i == 0:
            divs.append(i)
print(divs[-k])

Fixed submission:
a, b, k = map(int, input().split())

for i in range(min(a, b), 0, -1):
    if a % i == 0 and b % i == 0:
        k -= 1
        if k == 0:
            print(i)

Buggy python submission (verdict: Runtime Error):

a, b, k = map(int, input().split())
divs = []

for i in range(1, int(max(a, b) / 2)):
    if a % i == 0:
        if a % i == 0:
            divs.append(i)
print(divs[-k])

Fixed submission:
a, b, k = map(int, input().split())

for i in range(min(a, b), 0, -1):
    if a % i == 0 and b % i == 0:
        k -= 1
        if k == 0:
            print(i)
Buggy python submission (verdict: Runtime Error):
a=input().split(" ")
b=int(a[0])
c=int(a[1])
if a>8 or b>8:
  print(":(")
else:
  print("Yay!")

Fixed submission:
a=input().split(" ")
b=int(a[0])
c=int(a[1])
if c>8 or b>8:
  print(":(")
else:
  print("Yay!")
Buggy python submission (verdict: Runtime Error):
MB_TLE = 0
MB_WA = 0
MB_RE = o
MB_AC = 0
n=int(input())
for i in range (n):
    ch = input ()
    if (ch =="TLE") :
     MB_TLE += 1
    if (ch =="WA") :
     MB_WA += 1
    if (ch =="RE") : 
     MB_RE += 1
    if (ch =="AC") :
     MB_AC += 1
print('TLE x ',MB_TLE)
print('WA x ',MB_WA)
print('RE x ',MB_RE)
print('AC x ',MB_AC)


Fixed submission:
N = int(input())
a = N//1000
b = ((a+1)*1000)-N
if b%1000 == 0:
	b = 0
    
print(b)

Buggy python submission (verdict: Runtime Error):
MB_TLE = 0
MB_WA = 0
MB_RE = o
MB_AC = 0
n=int(input())
for i in range (n):
    ch = input ()
    if: (ch =="TLE")
     MB_TLE += 1
    if: (ch =="WA")
     MB_WA += 1
    if: (ch =="RE")
     MB_RE += 1
    if: (ch =="AC")
     MB_AC += 1
print('TLE x ',MB_TLE)
print('WA x ',MB_WA)
print('RE x ',MB_RE)
print('AC x ',MB_AC)


Fixed submission:
N = int(input())
a = N//1000
b = ((a+1)*1000)-N
if b%1000 == 0:
	b = 0
    
print(b)

Buggy python submission (verdict: Runtime Error):
MB_TLE = 0
MB_WA = 0
MB_RE = o
MB_AC = 0
n=int(input())
for i in range (n):
    ch = input ()
    if (ch =="TLE")
     MB_TLE += 1
    if (ch =="WA")
     MB_WA += 1
    if (ch =="RE")
     MB_RE += 1
    if (ch =="AC")
     MB_AC += 1
print('TLE x ',MB_TLE)
print('WA x ',MB_WA)
print('RE x ',MB_RE)
print('AC x ',MB_AC)


Fixed submission:
N = int(input())
a = N//1000
b = ((a+1)*1000)-N
if b%1000 == 0:
	b = 0
    
print(b)
Buggy python submission (verdict: Runtime Error):
s = str(input())
t = str(input())
count = 0

for i in range(len(s)):
    if s[i] != t[i]:
        count +=1

print(count)


Fixed submission:
a = int(input())
print(a+a**2+a**3)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split())
a.sort()
print(sum(a[:k]))

Fixed submission:
value = input()
if value.isupper():
  print("A")
else:
  print("a")

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
print(sum(a[:k]))


Fixed submission:
value = input()
if value.isupper():
  print("A")
else:
  print("a")
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split())
a.sort()
print(sum(a[:k]))


Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
print(sum(a[:k]))
Buggy python submission (verdict: Runtime Error):
S,T = map(str,input().split())
if T[:-1]  == S :
    print ('Yes')
else :
    print ('No')
#st = st[:-1]



Fixed submission:
a  =input()
b =input()
c = 0
for i in range(len(a)):
	if a[i] != b[i]:
		c = 1
      
if c ==0:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Time Limit Exceeded):
A,B,C,K= map(int,input().split())
s0m = 0
for i in range(K) :
    if A > 0 :
        s0m +=1
        A -=1
    elif B > 0 :
        B -=1
    elif C > 0 :
        s0m -=1
        C -=1
print ( s0m)
        


Fixed submission:
A,B,C,K= map(int,input().split())
s0m = 0
x = max(0,A-K)
if x == 0 :
    s0m =+ A
    K = K-A
else :
    s0m =+ K
    K=0
if K==0 :
    print (s0m)
else :
    y = max (0 ,B-K)
    if y == 0 :
        K=K-B
    else :
        K = 0
    if K == 0:
        print (s0m)
    else:
        z = max (0,C-K)
        if z== 0 :
            s0m = s0m - C
        else :
            s0m -=K
        print (s0m)
Buggy python submission (verdict: Runtime Error):
A,B,C,D= map(int, input().split())
while (True):
    C = C - B
    if ( C <= 0 ):
        result = "Yes"
        break
    A = A - D
    if ( A <= 0 ) :
        result = "No"
        break
print ( result )


Fixed submission:
s,w  = map(int, input().split())

if w >= s:
    print("unsafe")
else:
    print("safe")
Buggy python submission (verdict: Runtime Error):
https://atcoder.jp/contests/abc160/tasks/abc160_a

Fixed submission:
S = input()
 
if S[2]==S[3] and S[4]==S[5]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
S, T = input().split(" ")

for i in range(N):
    print(S[i]+T[i], end="")


Fixed submission:
a = int(input())
b = int(input())

print(6 - a - b)
Buggy python submission (verdict: Runtime Error):
r = int(input(''))
print (R*R)

Fixed submission:
r = int(input(''))
print (r*r)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,raw_input().split())
print(a+b,a-b,a*b)

Fixed submission:
a,b=map(int,input().split())
print(max(a+b,a-b,a*b))
Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split()
c = (a+b)/2
if c.is_integer():
  print(int(c))
else:
  print("impossible")

Fixed submission:
a,b=map(int, input().split())
c = (a+b)/2
if c.is_integer():
  print(int(c))
else:
  print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
b = input()
 
if b == 'A':
    b = 'T'
elif b == 'T':
    b = 'A'
elif b == 'C':
    b = 'G'
else:
    b = 'C'
 
print(b)
b = input ')
if b = a


Fixed submission:
b = input()

if b == 'A':
    b = 'T'
elif b == 'T':
    b = 'A'
elif b == 'C':
    b = 'G'
else:
    b = 'C'

print(b)

Buggy python submission (verdict: Runtime Error):
b = input()
 
if b = 'A':
    b = 'T'
elif b = 'T':
    b = 'A'
elif b = 'C':
    b = 'G'
else:
    b = 'C'
 
print(b)
b = input ')
if b = a


Fixed submission:
b = input()

if b == 'A':
    b = 'T'
elif b == 'T':
    b = 'A'
elif b == 'C':
    b = 'G'
else:
    b = 'C'

print(b)
Buggy python submission (verdict: Runtime Error):
t,x=map(int,input().split()))
print(t/x)


Fixed submission:
t,x=map(int,input().split())
print(t/x)

Buggy python submission (verdict: Runtime Error):
t,x=map(int,input().split()
print(t/x)


Fixed submission:
t,x=map(int,input().split())
print(t/x)
Buggy python submission (verdict: Runtime Error):
x,y=map(int,input().split()
print(int(X+y/2))

Fixed submission:
x,y=map(int,input().split())
print(int(x+y/2))
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
if A % 2 == 0 
  print("No")
else:
  print("Yes")

Fixed submission:
A, B = map(int, input().split())
if A % 2 == 0 or B % 2 == 0:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input().split()
print('Yes') if a<=c<=b else print('No')


Fixed submission:
a,b,c = map(int, input().split())
print('Yes') if a<=c<=b else print('No')
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
print('YES') if b-a==c-b 
else print ('NO')


Fixed submission:
a,b,c = map(int, input().split())
print('YES' if b-a==c-b else 'NO')
Buggy python submission (verdict: Runtime Error):
s1,s2,s3=map(str,input().split(","))
print(S1,S2,S3)


Fixed submission:
s1,s2,s3=map(str,input().split(","))
print(s1,s2,s3)
Buggy python submission (verdict: Runtime Error):
x,y=map(int,input().split())

#a+b=x
#2a+4b=y
#2a=4x-y

if ((y-(2*x))%2==0)&(x-((y-(2*x))/2))>0 :
  print("Yes")
else:
  print("No")

Fixed submission:
x,y=map(int,input().split())

if (y % 2 == 0) and (x * 2 <= y <= x * 4):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()

x=1

for i in a:
  x*=i
  if x>10**18:
    print("-1")
    exit()
  if x=0:
    print(0)
    exit()
print(x)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()

x=1

for i in a:
  x*=i
  if x>10**18:
    print("-1")
    exit()
print(x)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))

x=1

for i in a:
  x*=i

if x>10**18:
  print("-1")
else:
  print(x)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()

x=1

for i in a:
  x*=i
  if x>10**18:
    print("-1")
    exit()
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)


k=int(input())
c=0

for i in range(1,k+1):
  for j in range(1,k+1):
    for k in range(1,k+1):
#      print(i,j,k,gcd(i,j,k))
      c+=gcd(i,j,k)
print(c)


Fixed submission:
import math
k=int(input())
c=0

for i in range(1,k+1):
  for j in range(1,k+1):
    w=math.gcd(i,j)
    for k in range(1,k+1):
      c+=math.gcd(w,k)
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))

c=0
x=0

for i in range(1,n-k+1):
#  print(sum(p[x:x+k]),sum(p[i:i+k]))
  if sum(p[x:x+k])<sum(p[i:i+k]):
    x=i
#print(x)
for i in range(x,x+k):
  c+=((p[i]*(p[i]+1))/2)/p[i]
print(c)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))

c=0
x=0
m=sum(p[0:k])
z=m
for i in range(1,n-k+1):
#  print(z,p[i-1],p[i+k-1])
  z=z-p[i-1]+p[i+k-1]
#  print(m,z)
  if m<z:
    m=z
    x=i
#print(x)
for i in range(x,x+k):
#  print(p[i])
  c+=((p[i]*(p[i]+1))/2)/p[i]
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))

c=0

x=0

for i in range(1,n-k+1):
#  print(sum(p[x:x+k]),sum(p[i:i+k]))
  if sum(p[x:x+k])<sum(p[i:i+k]):
    x=i
#print(x)
for i in range(x,x+k):
  c+=((p[i]*(p[i]+1))/2)/p[i]
print(c)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))

c=0
x=0
m=sum(p[0:k])
z=m
for i in range(1,n-k+1):
#  print(z,p[i-1],p[i+k-1])
  z=z-p[i-1]+p[i+k-1]
#  print(m,z)
  if m<z:
    m=z
    x=i
#print(x)
for i in range(x,x+k):
#  print(p[i])
  c+=((p[i]*(p[i]+1))/2)/p[i]
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))

c=0

x=0

for i in range(1,n-k+1):
#  print(sum(p[x:x+k]),sum(p[i:i+k]))
  if sum(p[x:x+k])<sum(p[i:i+k]):
    x=i
#print(x)
for i in range(x,x+k):
  z=0
  for j in range(0,p[i]+1):
    z+=j
#  print(z)
#  print(p[i])
  c+=z/p[i]
print(c)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))

c=0
x=0
m=sum(p[0:k])
z=m
for i in range(1,n-k+1):
#  print(z,p[i-1],p[i+k-1])
  z=z-p[i-1]+p[i+k-1]
#  print(m,z)
  if m<z:
    m=z
    x=i
#print(x)
for i in range(x,x+k):
#  print(p[i])
  c+=((p[i]*(p[i]+1))/2)/p[i]
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))

c=0

x=0

for i in range(1,n-k+1):
#  print(sum(p[x:x+k]),sum(p[i:i+k]))
  if sum(p[x:x+k])<sum(p[i:i+k]):
    x=i
#print(x)
for i in range(x,x+k):
  z=0
  for j in range(0,p[i]+1):
    z+=j
#  print(z)
#  print(p[i])
  c+=z/p[i]
print(c)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))

c=0
x=0
m=sum(p[0:k])
z=m
for i in range(1,n-k+1):
#  print(z,p[i-1],p[i+k-1])
  z=z-p[i-1]+p[i+k-1]
#  print(m,z)
  if m<z:
    m=z
    x=i
#print(x)
for i in range(x,x+k):
#  print(p[i])
  c+=((p[i]*(p[i]+1))/2)/p[i]
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
c = 0

for i in range(0,n):
  if a[i] == min(a[0:i+1]):
   c+=1
print(c)


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
c = 0

x=a[0]

for i in range(0,n):
  if x >= a[i]:
#    print(a[i])
    x=a[i]
    c+=1
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

c = 0

for i in range(0,n):
#  print(i,a[i],a[0:i+1])
  if a[i] == min(a[0:i+1]):
   c+=1
print(c)


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
c = 0

x=a[0]

for i in range(0,n):
  if x >= a[i]:
#    print(a[i])
    x=a[i]
    c+=1
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions 
import math
from functools import reduce
#最大公約数
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

#インプット
n = int(input())
a = list(map(int,input().split()))

#最大公約数算出
z=lcm_list(a)

print(sum([z//x for x in a])%((10**9)+7))


Fixed submission:
import fractions
 
import math
from functools import reduce
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
  
n = int(input())
a = list(map(int,input().split()))

c=0

z=lcm_list(a)

for i in range(0,n):
  c+=(z//a[i])
#print(z)
print(c%((10**9)+7))

Buggy python submission (verdict: Time Limit Exceeded):
import fractions 
import math
from functools import reduce

#最大公約数
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

#インプット
n = int(input())
a = list(map(int,input().split()))

print(sum([(lcm_list(a))//x for x in a])%((10**9)+7))

Fixed submission:
import fractions
 
import math
from functools import reduce
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
  
n = int(input())
a = list(map(int,input().split()))

c=0

z=lcm_list(a)

for i in range(0,n):
  c+=(z//a[i])
#print(z)
print(c%((10**9)+7))

Buggy python submission (verdict: Time Limit Exceeded):
import fractions 
import math
from functools import reduce
#最大公約数
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

#インプット
n = int(input())
a = list(map(int,input().split()))

#最大公約数算出
z=lcm_list(a)

print(sum([z//x for x in a])%((10**9)+7))

Fixed submission:
import fractions
 
import math
from functools import reduce
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
  
n = int(input())
a = list(map(int,input().split()))

c=0

z=lcm_list(a)

for i in range(0,n):
  c+=(z//a[i])
#print(z)
print(c%((10**9)+7))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n,k,q = map(int,input().split())
d = [int(input()) for i in range(q)]
 
p=np.full(n,k)
z=np.full(n,-1)
 
for a in range(0,q):
  p=p+z
  p[d[a]-1]+=1
 
for l in range(0,n):
  if p[l]>0:
    print('Yes')
  else:
    print('No')

Fixed submission:
import numpy as np

n,k,q = map(int,input().split())
d = [int(input()) for i in range(q)]
 
p=np.full(n,k)
z=np.full(n,-1*q)

p=p+z

for a in range(0,q):
  p[d[a]-1]+=1
 
for l in range(0,n):
  if p[l]>0:
    print('Yes')
  else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n,k,q = map(int,input().split())
d = [int(input()) for i in range(q)]

p=[k]*n

for a in range(0,q):
  for x in range(0,n):
    p[x]-=1
  p[d[a]-1]+=1

for l in range(0,n):
  if p[l]>0:
    print('Yes')
  else:
    print('No')

Fixed submission:
import numpy as np

n,k,q = map(int,input().split())
d = [int(input()) for i in range(q)]
 
p=np.full(n,k)
z=np.full(n,-1*q)

p=p+z

for a in range(0,q):
  p[d[a]-1]+=1
 
for l in range(0,n):
  if p[l]>0:
    print('Yes')
  else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = list(map(int,input().split()))
for i in range(0,m):
  b=a.index(max(a))
  a[b]=a[b]//2
print(sum(a))

Fixed submission:
import heapq as hq

n,m = map(int,input().split())

A = []
for a in [int(_) for _ in input().split()]:
    hq.heappush(A, -a)

for _ in range(m):
    t = hq.heappop(A)
    hq.heappush(A, t / 2)
print(-sum([int(a) for a in A]))

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = list(map(int,input().split()))

for i in range(0,m):
  a[a.index(max(a))]=a[a.index(max(a))]//2
print(sum(a))

Fixed submission:
import heapq as hq

n,m = map(int,input().split())

A = []
for a in [int(_) for _ in input().split()]:
    hq.heappush(A, -a)

for _ in range(m):
    t = hq.heappop(A)
    hq.heappush(A, t / 2)
print(-sum([int(a) for a in A]))
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    MOD = 10 ** 9 + 7
    sum = 0

    for i in range(len(A)):
        for j in range(i+1, len(A)):
            sum += A[i] * A[j]
    
    ans = sum % MOD
    print(ans)


if __name__ == '__main__':
    main()

Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    
    MOD = 10 ** 9 + 7
    
    sum_a = sum(A)
    sum_squares = sum([a * a for a in A])
    
    ans = (sum_a ** 2 - sum_squares) // 2
    ans %= MOD

    print(ans)
    
    
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    MOD = 10 ** 9 + 7
    sum = 0

    for i in range(len(A)):
        for j in range(i+1, len(A)):
            sum += A[i] * A[j]

    print(sum % MOD)


if __name__ == '__main__':
    main()

Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    
    MOD = 10 ** 9 + 7
    
    sum_a = sum(A)
    sum_squares = sum([a * a for a in A])
    
    ans = (sum_a ** 2 - sum_squares) // 2
    ans %= MOD

    print(ans)
    
    
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    count = 0
    max_height = 0

    for height in A:
        if max_height < height:
            max_height = height
        else:
            count += max_height - height
    print(count)


if __name__ == '__

Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    count = 0
    max_height = 0

    for height in A:
        if max_height < height:
            max_height = height
        else:
            count += max_height - height
    print(count)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())
    L = list(map(int, input().split()))
    L = sorted(L)
    print(L)
    count = 0

    for i in range(N-2):
        for j in range(i+1, N):
            for k in range(j+1, N):
                if L[i] + L[j] > L[k] and L[i] != L[j] != L[k]:
                    print(i,j,k)
                    count += 1
                    print(count)

    print(count)

if __name__ == '__main__':
    

Fixed submission:
def main():
    N = int(input())
    L = list(map(int, input().split()))
    L = sorted(L)
    count = 0

    for i in range(N-2):
        for j in range(i+1, N):
            for k in range(j+1, N):
                if L[i] + L[j] > L[k] and L[i] != L[j] != L[k]:
                    count += 1

    print(count)


if __name__ == '__main__':
    main()