Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=[]
for i in range(n):
    s.append(input())

s=sorted(s)
t=0
c=0
ct=[]
for i in range(1,n):
    c+=1
    if s[t]!=s[i]:
        ct.append(c)
        c=0
        t=i
ct.append(c+1)
u=0
for i in ct:
    if i==max(ct):
        print(s[u])
    u+=i


Fixed submission:
n=int(input())
s=[]
for i in range(n):
    s.append(input())
s=sorted(s)
t=0
c=0
ct=[]
for i in range(1,n):
    c+=1
    if s[t]!=s[i]:
        ct.append(c)
        c=0
        t=i
ct.append(c+1)
u=0
cm=max(ct)
for i in ct:
    if i==cm:
        print(s[u])
    u+=i

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=[]
for i in range(n):
    s.append(input())

s=sorted(s)
t=0
c=1
ct=[]
for i in range(1,n):
    if i==n-1:
        if s[t]==s[i]:
            ct.append(c+1)
        else:
            ct.append(c)
            ct.append(1)
    else:
        if s[t]==s[i]:
            c+=1
        else:
            t=i
            ct.append(c)
            c=1
u=0
for i in ct:
    if i==max(ct):
        print(s[u])
    u+=i


Fixed submission:
n=int(input())
s=[]
for i in range(n):
    s.append(input())
s=sorted(s)
t=0
c=0
ct=[]
for i in range(1,n):
    c+=1
    if s[t]!=s[i]:
        ct.append(c)
        c=0
        t=i
ct.append(c+1)
u=0
cm=max(ct)
for i in ct:
    if i==cm:
        print(s[u])
    u+=i

Buggy python submission (verdict: Time Limit Exceeded):
import collections
n=int(input())
s=[]
for i in range(n):
    s.append(input())

ss=sorted(s)
t=0
c=1
count=[]
for i in range(1,n):
    if i==n-1:
        if ss[t]==ss[i]:
            count.append(c+1)
        else:
            count.append(c)
            count.append(1)
    else:
        if ss[t]==ss[i]:
            c+=1
        else:
            t=i
            count.append(c)
            c=1
u=0
for i in count:
    if i==max(count):
        print(ss[u])
    u+=i


Fixed submission:
n=int(input())
s=[]
for i in range(n):
    s.append(input())
s=sorted(s)
t=0
c=0
ct=[]
for i in range(1,n):
    c+=1
    if s[t]!=s[i]:
        ct.append(c)
        c=0
        t=i
ct.append(c+1)
u=0
cm=max(ct)
for i in ct:
    if i==cm:
        print(s[u])
    u+=i

Buggy python submission (verdict: Runtime Error):
import collections
n=int(input())
s=[]
for i in range(n):
    s.append(input())

ss=sorted(s)
t=0
c=1
count=[]
for i in range(1,n):
    if i==n-1:
        if ss[t]==ss[i]:
            count.append(c+1)
        else:
            count.append(c)
            count(1)
    else:
        if ss[t]==ss[i]:
            c+=1
        else:
            t=i
            count.append(c)
            c=1
u=0
for i in count:
    if i==max(count):
        print(ss[u])
    u+=i


Fixed submission:
n=int(input())
s=[]
for i in range(n):
    s.append(input())
s=sorted(s)
t=0
c=0
ct=[]
for i in range(1,n):
    c+=1
    if s[t]!=s[i]:
        ct.append(c)
        c=0
        t=i
ct.append(c+1)
u=0
cm=max(ct)
for i in ct:
    if i==cm:
        print(s[u])
    u+=i
Buggy python submission (verdict: Runtime Error):
red blue
5 5
blue

Fixed submission:
s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()
if s==u:
    a-=1
elif t==u:
    b-=1

print('{} {}'.format(a,b))
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort(reverse=True)
c=0
for i in range(k):
    h.pop(0)
    
for i in range(len(h)):
    c+=h[i]
print(c)


Fixed submission:
import math
h,a=map(int,input().split())
t=math.ceil(h/a)
print(t)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort(reverse=True)
c=0
for i in range(k):
    h.pop(0)

for i in range(len(h)):
    c+=h[i]
print(c)


Fixed submission:
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort(reverse=True)
c=0
for i in range(k,n):
    c+=h[i]

print(c)
Buggy python submission (verdict: Runtime Error):
import fractions
X = int(input())

def qprime(n):
    if n<2:return False
    elif n==2:return True
    elif n%2==0:return False
    for i in range(3,math.floor(math.sqrt(n))+1,2):
                   if n % i == 0:return False
    return True


for i in range(X,100000):
    if qprime(i):
        print(i)
        break


Fixed submission:
s,t = input().split()
print(t+s)
Buggy python submission (verdict: Runtime Error):
N=int(input())
if N%2 == 1:
    print(0)
else:
    d = 5
    count=0
    while N>1:
        n = N
        while n%d == 0:
            count+=1
            n/=d
    N-=2
print(count)


Fixed submission:
A=[1,2,3]
a=int(input())
b=int(input())
A.remove(a)
A.remove(b)
print(A[0])
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int(),input().split())
sum = a+b+c

if 22 <= sum:
    print('bust')
else:
    print('win')


Fixed submission:
a,b,c = map(int,input().split())
sum = a+b+c

if sum >= 22:
    print('bust')
else:
    print('win')

Buggy python submission (verdict: Runtime Error):
a,b,c = map(int(),input().split())
sum = a+b+c

if sum >= 22:
    print('bust')
else:
    print('win')


Fixed submission:
a,b,c = map(int,input().split())
sum = a+b+c

if sum >= 22:
    print('bust')
else:
    print('win')
Buggy python submission (verdict: Runtime Error):
S = input()
len_S = len(S)
c = 0
s = len_S // 2
for i in range(s-1):
    if S[i] == S[len_S -i]:
        c += 1
cal = s - c
print(cal)


Fixed submission:
S = input()
len_S = len(S)
c = 0
s = len_S // 2
for i in range(s):
    if S[i] is not S[len_S-1 -i]:
        c += 1
print(c)

Buggy python submission (verdict: Runtime Error):
S = input()
len_S = len(S)
c = 0
s = len_S // 2
for i in range(s):
    if S[i] == S[len_S -i]:
        c += 1
cal = s - c
print(cal)


Fixed submission:
S = input()
len_S = len(S)
c = 0
s = len_S // 2
for i in range(s):
    if S[i] is not S[len_S-1 -i]:
        c += 1
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
n, m, k = map(int, input().split())
a = list(map(int, input().split())) 
b = list(map(int, input().split())) 


sum_a = [0]
for i in range(n):
    sum_a.append(sum_a[i]+a[i])

sum_b = [0]
for i in range(m):
    sum_b.append(sum_b[i]+b[i])

max = 0 
for i in range(len(sum_a)):
    if sum_a[i] > k:
        max = i-1 if i-1 > max else max
        break
    else:
        for j in range(m+1):
            sum_ab = sum_a[i] + sum_b[j]
            if sum_ab > k:
                max = i+j-1 if i+j-1 > max else max
                break
            else:
                max = i+j if i+j > max else max

print(max)

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


sum_a = [0]
for i in range(n):
    sum_a.append(sum_a[i] + a[i])

sum_b = [0]
for i in range(m):
    sum_b.append(sum_b[i] + b[i])


a_i = 0
b_i = 0
for i in range(n+1):
    if sum_a[i] > k:
        break
    else:
        a_i = i

for i in range(m+1):
    if sum_a[a_i] + sum_b[i] > k:
        break
    else:
        b_i = i


ans = a_i + b_i
for i in range(a_i, -1, -1):
    for j in range(b_i, m+1):
        if sum_a[i] + sum_b[j] > k:
            b_i = j - 1
            break
        else:
            ans = max(ans, i+j)

print(ans)

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


max = 0
for i in range(n+1):
    sum_a = sum(a[ii] for ii in range(i+1))
    if sum_a > k:
        max = i-1 if i-1 > max else max
        break
    else:
        for j in range(m+1):
            sum_ab = sum_a + sum(b[jj] for jj in range(j+1))
            if sum_ab > k:
                max = i+j-1 if i+j-1 > max else max
                break
            else:
                max = i+j if i+j > max else max

print(max)

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


sum_a = [0]
for i in range(n):
    sum_a.append(sum_a[i] + a[i])

sum_b = [0]
for i in range(m):
    sum_b.append(sum_b[i] + b[i])


a_i = 0
b_i = 0
for i in range(n+1):
    if sum_a[i] > k:
        break
    else:
        a_i = i

for i in range(m+1):
    if sum_a[a_i] + sum_b[i] > k:
        break
    else:
        b_i = i


ans = a_i + b_i
for i in range(a_i, -1, -1):
    for j in range(b_i, m+1):
        if sum_a[i] + sum_b[j] > k:
            b_i = j - 1
            break
        else:
            ans = max(ans, i+j)

print(ans)
Buggy python submission (verdict: Runtime Error):
a = map(int, input().split())

for i in range(5):
    if a[i] == 0:
        print(i+1)



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

for i in range(5):
    if a[i] == 0:
        print(i+1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

ans = 1
for i in a:
    ans *= i

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



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

ans = 1
if 0 in a:
    ans = 0
else :
    for i in a:
        if  ans * i > 10**18:
            ans = -1
            break
        else:
            ans *= i

print(ans)

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

ans = 1
for i in range(len(a)):
    ans *= a[i]

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



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

ans = 1
if 0 in a:
    ans = 0
else :
    for i in a:
        if  ans * i > 10**18:
            ans = -1
            break
        else:
            ans *= i

print(ans)
Buggy python submission (verdict: Runtime Error):

def solve():
    s = int(input())
    w = int(input())
    
    if (w >= s):
        print('unsafe')
    else :
        print('safe')
    
    return 

if __name__ == '__main__':
    solve()

Fixed submission:
import sys

def solve():
    i = input()
    s, w = i.split()
    s = int(s)
    w = int(w)
    
    if (w >= s):
        print('unsafe')
    else :
        print('safe')
    
    return 

if __name__ == '__main__':
    solve()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

cnt = 0
kei = [] 
for _ in range(n):
    tmp = input()
    if not tmp in kei:
        cnt += 1
        kei.append(tmp)

print(cnt)

Fixed submission:
n = int(input())

# TLE
#cnt = 0
#kei = [] 
#for _ in range(n):
#    tmp = input()
#    if not tmp in kei:
#        cnt += 1
#        kei.append(tmp)

s = set()
for _ in range(n):
    s.add(input())
cnt = len(s)

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):

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

for i in range(n):
    print(a.count(i+1))



Fixed submission:
import sys

n = int(input())
a = list(map(int, input().split()))
b = [0 for _ in range(n)]


asize = len(a)
for i in range(asize):
    b[a[i]-1] += 1

for i in range(n):
    print(b[i])
Buggy python submission (verdict: Runtime Error):
n = int(input())

s = {}
for i in range(n):
    temp = input()
    if temp in s:
        s[temp] += 1
    else:
        s[temp] = 1



max_s_val = max(s.value())
t = [k for k, v in s.items() if v == max_s_val]
t.sort()

for i in range(len(t)):
    print(t[i])



Fixed submission:
n = int(input())

s = {}
for i in range(n):
    temp = input()
    if temp in s:
        s[temp] += 1
    else:
        s[temp] = 1



max_s_val = max(s.values())
t = [k for k, v in s.items() if v == max_s_val]
t.sort()

for i in range(len(t)):
    print(t[i])

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

s = {}
for i in range(n):
    temp = input()
    if temp in s:
        s[temp] += 1
    else:
        s[temp] = 1

t = [k for k, v in s.items() if v == max(s.values())]
t.sort()

for i in range(len(t)):
    print(t[i])



Fixed submission:
n = int(input())

s = {}
for i in range(n):
    temp = input()
    if temp in s:
        s[temp] += 1
    else:
        s[temp] = 1



max_s_val = max(s.values())
t = [k for k, v in s.items() if v == max_s_val]
t.sort()

for i in range(len(t)):
    print(t[i])
Buggy python submission (verdict: Runtime Error):

def solve():
    n = int(input())
    s = input()
    t = input()

    str = ''
    for i in range(n):
        str += s[i] + t[i]
    else:
        print(str)



if __name__ == '__main__':
    solve()




Fixed submission:

def solve():
    n = int(input())
    s, t = input().split()

    ans = ''
    for i in range(n):
        ans += s[i] + t[i]
    else:
        print(ans)

if __name__ == '__main__':
    solve()
Buggy python submission (verdict: Runtime Error):
import math

def solve():
    a, b = map(int, input().split())
    ans = a * b / math.gcd(a, b)
    print(int(ans))

if __name__ == '__main__':
    solve()




Fixed submission:
import fractions

def solve():
    a, b = map(int, input().split())
    ans = a * b / fractions.gcd(a, b)
    print(int(ans))

if __name__ == '__main__':
    solve()

Buggy python submission (verdict: Runtime Error):
import math

def solve():
    a, b = map(int, input().split())
    ans = a * b / math.gcd(a, b)
    print(int(ans))

if __name__ == '__main__':
    solve()




Fixed submission:
import fractions

def solve():
    a, b = map(int, input().split())
    ans = a * b / fractions.gcd(a, b)
    print(int(ans))

if __name__ == '__main__':
    solve()
Buggy python submission (verdict: Runtime Error):
int(raw_input())
if x >30 :
    print('Yes')
else:
    print('No')

Fixed submission:
x = int(input())

if x >=30 :
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
S = input()
rain_d = 0
for s in S:
    if s == 'R':
        rain_d += 1
        max_rain_d = rain_d
    elif s == 'S':
        rain_d = 0
print(max_rain_d)


Fixed submission:
S = input()
rain_d = 0
max_rain_d = 0
for s in S:
    if s == 'R':
        rain_d += 1
        max_rain_d = rain_d
    elif s == 'S':
        rain_d = 0
print(max_rain_d)
Buggy python submission (verdict: Time Limit Exceeded):
X, K, D = map(int, input().split())
X = abs(X)
for i in range(K):
    X_ = min(X, abs(X-D))
    if X == X_:
        X = abs(X_ - (K - i)%2*D)
        break
    X = X_
print(X)


Fixed submission:
X, K, D = map(int, input().split())
X = abs(X)
if X // D <= K:
    print(min(abs(X % D - (K - (X // D))%2*D), abs(X % D + (K - (X // D))%2*D)))
else:
    print(min(abs(X - K*D), abs(X + K*D)))
Buggy python submission (verdict: Runtime Error):
ls = list(map(int, input().split()))
nokori = ls[-1]
sum_max = 0
for i, j in zip(ls[:-1], [1, 0, -1]):
    nokori -= i
    if nokori > 0:
        sum_max += i*j
    elif nokori == 0:
        sum_max += i*j
        break
    else:
        sum_max += nokori_*j
        break
    nokori_ = nokori
print(sum_max)


Fixed submission:
ls = list(map(int, input().split()))
nokori = ls[-1]
nokori_ = ls[-1]
sum_max = 0
for i, j in zip(ls[:-1], [1, 0, -1]):
    nokori -= i
    if nokori > 0:
        sum_max += i*j
    elif nokori == 0:
        sum_max += i*j
        break
    else:
        sum_max += nokori_*j
        break
    nokori_ = nokori
print(sum_max)

Buggy python submission (verdict: Runtime Error):
ls = list(map(int, input().split()))
nokori = ls[-1]
sum_max = 0
for i, j in zip(ls[:-1], [1, 0, -1]):
    nokori -= i
    if nokori >= 0:
        sum_max += i*j
    else:
        sum_max += nokori_*j
        break
    nokori_ = nokori
print(sum_max)


Fixed submission:
ls = list(map(int, input().split()))
nokori = ls[-1]
nokori_ = ls[-1]
sum_max = 0
for i, j in zip(ls[:-1], [1, 0, -1]):
    nokori -= i
    if nokori > 0:
        sum_max += i*j
    elif nokori == 0:
        sum_max += i*j
        break
    else:
        sum_max += nokori_*j
        break
    nokori_ = nokori
print(sum_max)

Buggy python submission (verdict: Runtime Error):
ls = list(map(int, input().split()))
check = 0
for i, j in zip(ls[:-1], [1, 0 -1]):
    check+=i
    nokori = ls[-1] - check
    if check =< ls[-1]:
        sum_max += i*j
    else:
        sum_max += nokori*j
        break

print(sum_max)


Fixed submission:
ls = list(map(int, input().split()))
nokori = ls[-1]
nokori_ = ls[-1]
sum_max = 0
for i, j in zip(ls[:-1], [1, 0, -1]):
    nokori -= i
    if nokori > 0:
        sum_max += i*j
    elif nokori == 0:
        sum_max += i*j
        break
    else:
        sum_max += nokori_*j
        break
    nokori_ = nokori
print(sum_max)
Buggy python submission (verdict: Runtime Error):
import sys
import itertools
n, m, x=map(int, input().split())
text = [list(map(int, i.strip('\n').split())) for i in sys.stdin]
num_tex = [i for i in range(1, len(text) + 1)]
all_c = []
for comb in num_tex:
    for v in itertools.combinations(text, comb):
        sum_a = []
        for j in range(1, len(v[0])):
            sum_a.append(sum([v_[j] for v_ in v]))
        if all([x <= sum_a_ for sum_a_ in sum_a]):
            all_c.append(sum([v_[0] for v_ in v]))
print(sorted(all_c)[0])


Fixed submission:
import sys
import itertools
n, m, x=map(int, input().split())
text = [list(map(int, i.strip('\n').split())) for i in sys.stdin]
num_tex = [i for i in range(1, len(text) + 1)]
all_c = []
for comb in num_tex:
    for v in itertools.combinations(text, comb):
        sum_a = []
        for j in range(1, len(v[0])):
            sum_a.append(sum([v_[j] for v_ in v]))
        if all([x <= sum_a_ for sum_a_ in sum_a]):
            all_c.append(sum([v_[0] for v_ in v]))
if len(all_c)!=0:
    print(sorted(all_c)[0])
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
s = input()
s = s.replace('S', ' ').split()
print(max([len(i) for i in s]))

Fixed submission:
s = input()
s = s.split('S')
print(max([len(i) for i in s]))
Buggy python submission (verdict: Time Limit Exceeded):
x, k, d = [int(i) for i in input().split()]
for _ in range(k):
  if abs(x - d) >= abs(x + d):
    x += d
  else:
    x -= d
print(abs(x))

Fixed submission:
x, k, d = [int(i) for i in input().split()]
if x < 0:
  x = -x
l = min(k, x // d)
k -= l
x -= l * d
if k % 2 == 0:
  print(x)
else:
  print(d - x)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = sorted([int(i) for i in input().split()])
ndiv = []
cnt = 10**6 + 1 
while a:
  flg = True
  b = a.pop(0)
  if b % cnt == 0:
    continue
  if a:
    if b % a[0] == 0:
      cnt = b
      continue
  for k in ndiv:
    if b % k == 0:
      flg = False
      break
  if flg:
    ndiv.append(b)
print(len(ndiv))

Fixed submission:
import collections
n = int(input())
a = sorted([int(i) for i in input().split()])
cnt = collections.Counter(a)
max_i = a[-1] + 1
for i in a:
  if cnt[i] >= 2:
    del cnt[i]
  for j in range(i*2, max_i, i):
    del cnt[j]
print(len(cnt))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = sorted([int(i) for i in input().split()])
cnt = 1
for ai in a:
  cnt *= ai
  if cnt > 10 ** 18:
    print(-1)
    exit()
print(cnt)

Fixed submission:
a, b = [int(i) for i in input().split()]
print(a * b)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
cnt = 1
for ai in a:
  cnt *= ai
if cnt > 10 ** 18:
  print(-1)
else:
  print(cnt)

Fixed submission:
n = int(input())
a = sorted([int(i) for i in input().split()])
cnt = 1
for ai in a:
  cnt *= ai
  if cnt > 10 ** 18:
    print(-1)
    exit()
print(cnt)
Buggy python submission (verdict: Runtime Error):
n, k = [int(i) for i in input().split()]
r, s, p = [int(i) for i in input().split()]
t = list(input())
ans = 0
dic = {'p': s, 's': r, 'r': p}
for i in range(k):
  ans += dic[t[i]]
dic_ls = []
for i in range(k, n):
  if t[i] != t[i - k]:
    ans += dic[t[i]]
  else:
    t[i] = 'j'
print(ans)

Fixed submission:
s, t = input().split()
print("".join([t, s]))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = [int(i) for i in input().split()]
r, s, p = [int(i) for i in input().split()]
t = input()
ans = 0
dic = {'p': s, 's': r, 'r': p}
for i in range(k):
  ans += dic[t[i]]
dic_ls = []
for i in range(k, n):
  if t[i] != t[i - k] or (i - k) in dic_ls:
    ans += dic[t[i]]
  else:
    dic_ls.append(i)
print(ans)

Fixed submission:
n, k = [int(i) for i in input().split()]
r, s, p = [int(i) for i in input().split()]
t = list(input())
ans = 0
dic = {'p': s, 's': r, 'r': p}
for i in range(k):
  ans += dic[t[i]]
dic_ls = []
for i in range(k, n):
  if t[i] != t[i - k]:
    ans += dic[t[i]]
  else:
    t[i] = 'j'
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
k = 0
for _ in range(n):
  if a[k] == k+1:
    k += 1
  else:
    del a[k]
  print(a, k)
if k == 0:
  print(-1)
else:
  print(n - k)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
k = 0
flg = False
for ai in a:
  if ai == k + 1:
    k += 1
  else:
    flg = True
if k == 0 and flg:
  print(-1)
else:
  print(n - k)
Buggy python submission (verdict: Runtime Error):
mod = 10 ** 9 + 7
x, y = [int(i) for i in input().split()]
if (2*x - y) % 3 != 0 or (2*y - x) % 3 != 0:
  print(0)
a = (2*x - y) // 3
b = (2*y - x) // 3
def mygcd(a_b, b, mod):
    b = min(a_b, b)
    cnt = 1
    for i in range(b):
        cnt = cnt * (a_b - i) * pow(i+1, mod-2, mod) % mod
    return cnt
print(mygcd(a+b, b, mod))

Fixed submission:
r = int(input())
print(r**2)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
for _ in range(m):
  a[a.index(max(a))] /= 2
for i in range(n):
  a[i] = int(a[i])
print(sum(a))

Fixed submission:
import heapq
n, m = [int(i) for i in input().split()]
a = [-int(i) for i in input().split()]
heapq.heapify(a)
for _ in range(m):
  value = heapq.heappop(a)
  value /= 2
  heapq.heappush(a, value)
for i in range(n):
  a[i] = int(-a[i])
print(sum(a))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
for _ in range(m):
  a[a.index(max(a))] /= 2
for i in range(n):
  a[i] = int(a[i])
print(sum(a))

Fixed submission:
import heapq
n, m = [int(i) for i in input().split()]
a = [-int(i) for i in input().split()]
heapq.heapify(a)
for _ in range(m):
  value = heapq.heappop(a)
  value /= 2
  heapq.heappush(a, value)
for i in range(n):
  a[i] = int(-a[i])
print(sum(a))
Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    N = int(input())
    A = [int(i) for i in input().split()]
    ans = 1
    for num in A:
        ans *= num
    if ans > 10**18:
        ans = -1
    print(ans)

if __name__ == "__main__":
    solve()

Fixed submission:
def solve():
    N = int(input())
    A = [int(i) for i in input().split()]
    ans = 1
    for i in range(N):
        if ans == -1 and A[i] != 0:
            continue
        ans *= A[i]
        if ans > 10**18:
            ans = -1
    print(ans)

if __name__ == "__main__":
    solve()

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    N = int(input())
    A = [int(i) for i in input().split()]
    ans = 1
    for i in range(N):
        ans *= A[i]
    if ans > 10**18:
        ans = -1
    print(ans)

if __name__ == "__main__":
    solve()

Fixed submission:
def solve():
    N = int(input())
    A = [int(i) for i in input().split()]
    ans = 1
    for i in range(N):
        if ans == -1 and A[i] != 0:
            continue
        ans *= A[i]
        if ans > 10**18:
            ans = -1
    print(ans)

if __name__ == "__main__":
    solve()
Buggy python submission (verdict: Runtime Error):
def solve():
    X = int(input())
    memo = {}
    for A in range(100):
        for B in range(100):
            memo[A**5-B**5] = (A,B)
            memo[A**5+B**5] = (A,-B)
    A,B = memo[X]
    print(A, B)

if __name__ == "__main__":
    solve()

Fixed submission:
def solve():
    X = int(input())
    memo = {}
    for A in range(500):
        for B in range(500):
            memo[A**5-B**5] = (A,B)
            memo[A**5+B**5] = (A,-B)
    A,B = memo[X]
    print(A, B)

if __name__ == "__main__":
    solve()