Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
A = list(map(lambda x: x//400, A))
#print(A)

import collections
c = collections.Counter(A)
#print(c)
f1 = f2 = 0
for k in c.keys():
    if k >= 8:
        f1 += 1
        f2 += c[k]
if f1 == 0:
    min_ = max_ = len(c.keys())

else:
    min_ = len(c.keys()) -f1
    max_ = len(c.keys()) -f1 +f2
if max_ >8:
    max_ = 8
if mix_ <0:
    min_ = 0
print(min_, max_)

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
A = list(map(lambda x: x//400, A))
#print(A)

import collections
c = collections.Counter(A)
#print(c)
f1 = f2 = 0
for k in c.keys():
    if k >= 8:
        f1 += 1
        f2 += c[k]
        
if f1 == 0:
    min_ = max_ = len(c.keys())

else:
    min_ = len(c.keys()) -f1
    max_ = len(c.keys()) -f1 +f2
'''if max_ >8:
    max_ = 8'''
if min_ <1:
    min_ = 1
print(min_, max_)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = []
for i in range(n):
    S.append(int(input()))
ans = []
import itertools
for i in itertools.product(range(2), repeat=n):
    scr = 0
    for j in range(n):
        if i[j]:
            scr += S[j]
    if scr%10 == 0:
        scr = 0
    ans.append(scr)
print(max(ans))

Fixed submission:
n = int(input())
S = sorted([int(input()) for _ in range(n)])

if sum(S)%10!=0:
    print(sum(S))
    exit()
for i in range(n):
    if S[i]%10==0:
        continue
    print(sum(S)-S[i])
    exit()
print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import time
N = list(map(int, input().split()))
N2 = [0,0,0]
ans = 0
while True:
    time.sleep(1)
    for i in range(3):
        if  not N[i] %2 == 0:
            print(ans)
            exit()
    N2[0] = (N[1] + N[2]) /2
    N2[1] = (N[0] + N[2]) /2
    N2[2] = (N[0] + N[1]) /2
    #print(N2)
    if N == N2:
        print('-1')
        exit()
    N = N2.copy()
    ans += 1


Fixed submission:
N = list(map(int, input().split()))
N2 = [0,0,0]
ans = 0
while True:
    for i in range(3):
        if  not N[i] %2 == 0:
            print(ans)
            exit()
    N2[0] = (N[1] + N[2]) /2
    N2[1] = (N[0] + N[2]) /2
    N2[2] = (N[0] + N[1]) /2
    #print(N2)
    if N == N2:
        print('-1')
        exit()
    N = N2.copy()
    ans += 1
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
from itertools import product
ans = 0
for x,y,z in product(range(k+1), repeat=3):
    #print(x,y,z)
    if x+y+z == s:
        ans += 1
print(ans)

Fixed submission:
k,s = map(int,input().split())
ans = 0

'''from itertools import product
for x,y,z in product(range(k+1), repeat=3):
    #print(x,y,z)
    if x+y+z == s:
        ans += 1'''
for x in range(k+1):
    for y in range(k+1):
        if 0 <= s-x-y <= k:
            ans +=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())

d = dict()
for i in range(1,n+1):
    d[str(i)] = 1

from collections import deque
ans = deque('1')
for _ in range(m):
    x,y = input().split()
    d[x] -= 1
    d[y] += 1
    if x in ans and y not in ans:
        ans.append(y)
    if d[x] == 0 and x in ans:
        ans.remove(x)
print(len(ans))


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

'''
d = dict()
for i in range(1,n+1):
    d[str(i)] = 1
from collections import deque
ans = deque('1')'''
box = [1 for i in range(n)]
ans = [0 for i in range(n)]
ans[0] = 1
for _ in range(m):
    x,y = map(int,input().split())
    box[x-1] -= 1
    box[y-1] += 1
    if ans[x-1]==1 and ans[y-1]==0:
        ans[y-1] = 1
    if box[x-1]==0 and ans[x-1]==1:
        ans[x-1] = 0
print(sum(ans))
Buggy python submission (verdict: Time Limit Exceeded):
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

s = iinp()
z = 10**9+7
ans = 0
stack = []
n = s

if s == 1 or s == 2:
    print(0)
    exit()

for i in range(s-3,3-1,-1):
    stack.append(i)

while stack:
    n = s
    x = stack.pop()
    y = x
    n -= x
    if n == 0:
        ans += 1
        ans %= z
        continue
    elif 0 < n < 3:
        continue
    for i in range(n,3-1,-1):
        x = y
        x += i
        stack.append(x)

ans += 1
print(ans)

Fixed submission:
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

s = iinp()
z = 10**9+7
ans = 0

dp =[0]*2001

dp[0] = 0
dp[1] = 0
dp[2] = 0
dp[3] = 1
dp[4] = 1
dp[5] = 1
dp[6] = dp[3]+1

for i in range(7,s+1):
    dp[i] = dp[i-1]+dp[i-3]

ans = dp[s] % z
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

n = iinp()
a = lmiinps()

ans = 0

for i in range(0,n-1):
    for j in range(i+1,n):
        k = ((a[i]%(10**9+7))*(a[j]%(10**9+7)))%(10**9+7)
        ans += k

ans %= (10**9+7)

print(ans)

Fixed submission:
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

n = iinp()
a = lmiinps()

ans = 0
count = 0

for i in range(n):
    count += (a[i]%(10**9+7))

for i in range(n):
    count -= a[i]
    ans += (a[i]%(10**9+7))*count


ans %= (10**9+7)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

n = inp()
m = int(n)

ans = 0

for i in range(len(n)):
    ans += (m % 10)
    m //= 10

ans %= 9

if ans == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

n = inp()
m = int(n)

ans = 0

for i in range(len(n)):
    ans += int(n[i])

ans %= 9

if ans == 0:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

n = inp()
m = int(n)

for i in range(len(n)):
    ans += (m % 10)
    m //= 10

ans %= 9

if ans == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

n = inp()
m = int(n)

ans = 0

for i in range(len(n)):
    ans += int(n[i])

ans %= 9

if ans == 0:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

n = inp()
m = int(n)

ans = m

while(len(n) != 1):
    n = str(ans)
    m = ans
    ans = 0
    for i in range(len(n)):
        ans += (m % 10)
        m //= 10

if ans == 9 or ans == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

n = inp()
m = int(n)

ans = 0

for i in range(len(n)):
    ans += int(n[i])

ans %= 9

if ans == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

s = deque(inp())
q = iinp()

l = deque()

p = 0
o = 1

for i in range(q):
  a = inps()
  if o == 1 and a[0] == 1:
    continue
  if a[0] == "2":
    if a[1] == "1":
      if p == 0:
        l.appendleft(a[2])
        o += 1
      else:
        s.appendleft(a[2])
        o += 1
    else:
      if p == 0:
        s.append(a[2])
        o += 1
      else:
        l.append(a[2])
        o += 1
  if a[0] == "1":
    if p == 0:
      p = 1
    else:
      p = 0
    s.reverse()
    l.reverse()

if p == 0:
  for i in l:
    print(i,end="")
  for i in s:
    print(i,end="")
  print("")
else:
  for i in s:
    print(i,end="")
  for i in l:
    print(i,end="")
  print("")

Fixed submission:
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

s = list(inp())
q = iinp()

l = []

p = 0
o = 1

for i in range(q):
  a = inps()
  if o == 1 and a[0] == 1:
    continue
  if a[0] == "2":
    if a[1] == "1":
      if p == 0:
        l.append(a[2])
        o += 1
      else:
        s.append(a[2])
        o += 1
    else:
      if p == 0:
        s.append(a[2])
        o += 1
      else:
        l.append(a[2])
        o += 1
  if a[0] == "1":
    if p == 0:
      p = 1
    else:
      p = 0

if p == 0:
  for i in range(len(l)):
    print(l[len(l)-1-i],end="")
  for i in s:
    print(i,end="")
  print("")
else:
  for i in range(len(s)):
    print(s[len(s)-1-i],end="")
  for i in l:
    print(i,end="")
  print("")
Buggy python submission (verdict: Runtime Error):
h,n = map(int,input().split())

x = []
y = []

for i in range(n):
    a,b = map(int,input().split())
    x.append(a)
    y.append(b)

def knapsack(N,W,weight,value):
  inf=float("inf")
  dp=[[inf for i in range(W+1)] for j in range(N+1)]
  for i in range(W+1): dp[0][i]=inf

  for i in range(N):
    for w in range(W+1):
        m = dp[i][w]
        p = value[i]
        q = weight[i]
        while w >= q:
            if w - q >= 0:
                m=min(dp[i][w-q]+p,m)
            p += value[i]
            q += weight[i]
        m=min(dp[i][w-q]+p,m,p)
        dp[i+1][w] = m
  return dp[N][W]

k = knapsack(n,h,x,y)
print(k)

Fixed submission:
h = int(input())

count = 1
ans = 0

while h != 0:
    ans += count
    h = h//2
    count *=2

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions

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

l = a[0]
for i in range(1, n):
    l = l * a[i] // fractions.gcd(l, a[i])

count = 0

for i in a:
  count += l//i
  count %= (10**9+7)

print(count)

Fixed submission:
import fractions

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

l = a[0]
for i in range(1, n):
    l = l * a[i] // fractions.gcd(l, a[i])

count = 0


for i in a:
  count += l//i
count %= (10**9+7)

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions

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

l = a[0]
for i in range(1, n):
    l = l * a[i] // fractions.gcd(l, a[i])

count = 0

for i in a:
  count += l//i
  count %= (10**9+7)

print(count)

Fixed submission:
import fractions

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

l = a[0]
for i in range(1, n):
    l = l * a[i] // fractions.gcd(l, a[i])

count = 0


for i in a:
  count += l//i
count %= (10**9+7)

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h = [list(map(int,input().split()))for _ in range(n)]

x = []*n
y = []*2

for i in range(n):
  y.append(h[i][0]-h[i][1]) #腕が届く地点の最小値
  y.append(h[i][0]+h[i][1]) #腕が届く地点の最大値
  x.append(y) #xに保存
  y = []*2 #yを初期化

x.sort(key = lambda x:x[1]) #腕が届く地点の最大値が小さい順にソート

k = 0 #配列xのtale
con = -10 ** 10

for i in range(n):
  if con > x[k][0]:
    x.pop(k)
  else:
    con = x[k][1]
    k += 1	#taleを一個後ろに下げる

print(len(x)) #要素数(残ったロボットの数)を出力

Fixed submission:
n = int(input())
h = [list(map(int,input().split()))for _ in range(n)]

x = []*n
y = []*2

for i in range(n):
  y.append(h[i][0]-h[i][1]) #腕が届く地点の最小値
  y.append(h[i][0]+h[i][1]) #腕が届く地点の最大値
  x.append(y) #xに保存
  y = []*2 #yを初期化

x.sort(key = lambda x:x[1]) #腕が届く地点の最大値が小さい順にソート

k = 0	#配列xのtale

for i in range(n-1):
  if x[k][1] > x[k+1][0]: #k番目の最大値よりもk+1の最小値の方が小さい時(つまり腕が重なる時)
    x.pop(k+1) #k+1番目を取り出す

  else:
    k += 1 #taleを一個後ろに下げる

print(len(x)) #要素数(残ったロボットの数)を出力
Buggy python submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split()))

if d[0] != 0:
  print(0)
  exit()

ans=1

a=[0]*n

for i in d:
  a[i] += 1

if a[0] != 1:
  print(0)
  exit()

for j in range(n):
  if j!=0 and a[j] == 0:
    for k in range(j+1,n):
      if a[k] != 0:
        print(0)
        exit()
    break
  else:
    ans*=(a[j]**a[j+1])
    ans%=998244353

print(ans)

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

if d[0] != 0:
  print(0)
  exit()

ans=1

a=[0]*(n+1)

for i in d:
  a[i] += 1

if a[0] != 1:
  print(0)
  exit()

for j in range(n):
  if j!=0 and a[j] == 0:
    for k in range(j+1,n):
      if a[k] != 0:
        print(0)
        exit()
    break
  else:
    ans*=(a[j]**a[j+1])
    ans%=998244353

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

w=k-q

for i in range(n):
  if a.count(i+1)+w>0:
    print("Yes")
  else:
    print("No")

Fixed submission:
n,k,q=map(int,input().split())
a=[int(input())for _ in range(q)]

w=k-q
e=abs(w)
b=[w]*n

if w>0:
  for _ in range(n):
    print("Yes")
  exit()

for i in a:
  b[i-1]+=1

for j in range(n):
  if b[j]>0:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
#include <stdio.h>

int main(){
  int a,b,c,s;
  scanf("%d %d %d",&a,&b,&c);
  s=a-b;
  
  if (s<c){
    printf("%d",c-s);
  }else{
    printf("0");
  }
  
  return 0;
}

Fixed submission:
a,b,c=map(int,input().split())
if c-(a-b)<0:
  print(0)
else:
  print(c-(a-b))
Buggy python submission (verdict: Time Limit Exceeded):
a=list(map(int,input().split()))
k=0
for i in range(a[0],a[1]+1):
  if i/a[2]!=i//a[2]:
    if i/a[3]!=i//a[3]:
      k+=1
  else:
    k+=0
print(k)


Fixed submission:
import math,fractions
a=list(map(int,input().split()))
A=a[1]-a[0]+1
B=(a[1]//a[2])-(a[0]-1)//a[2]
C=(a[1]//a[3])-(a[0]-1)//a[3]
d=(a[2]*a[3])//(fractions.gcd(a[2],a[3]))
D=(a[1]//d)-((a[0]-1)//d)
print(int(A-B-C+D))
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(max(2*a-1,2*b-1,a+b)

Fixed submission:
a,b=map(int,input().split())
k=0
for i in range(2):
  if a>b:
    k=k+a
    a-=1
  else:
    k=k+b
    b-=1
print(k)
Buggy python submission (verdict: Runtime Error):
import math

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

A=B=C=D=E=11

if a%10!=0:
  A=a%10
if b%10!=0:
  B=b%10
if c%10!=0:
  C=c%10
if d%10!=0:
  D=d%10
if e%10!=0:
  E=e%10

k=min(A,B,C,D,E)
if A=B=C=D=E=0:
  k=10
sum=(math.ceil(a/10)*10+math.ceil(b/10)*10+math.ceil(c/10)*10+math.ceil(d/10)*10+math.ceil(e/10)*10)

print(sum-10+k)

Fixed submission:
import math

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

k=min((a-1)%10,(b-1)%10,(c-1)%10,(d-1)%10,(e-1)%10)+1

sum=(math.ceil(a/10)*10+math.ceil(b/10)*10+math.ceil(c/10)*10+math.ceil(d/10)*10+math.ceil(e/10)*10)

print(sum-10+k)
Buggy python submission (verdict: Runtime Error):
x1,y1,x2,y2=map(int,input().split())

k1=x2-x1
k2=y2-y1

print(x2-k2,y2+k1,x3-k1,y3-k2)

Fixed submission:
x1,y1,x2,y2=map(int,input().split())

k1=x2-x1
k2=y2-y1

x3=x2-k2
y3=y2+k1

x4=x3-k1
y4=y3-k2

print(x3,y3,x4,y4)
Buggy python submission (verdict: Runtime Error):
x,a,b=map(int,inpur().split())
if min(abs(x-a),abs(x-b))==abs(x-a):
  print("A")
else:
  print("B")

Fixed submission:
x,a,b=map(int,input().split())
if min(abs(x-a),abs(x-b))==abs(x-a):
  print("A")
else:
  print("B")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ans=1
for i in range(n):
  ans*=i+1
print(int(ans%(10**9+7)))

Fixed submission:
n=int(input())
ans=1
for i in range(n):
  ans*=i+1
  ans%=10**9+7
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
c = [[int(i) for i in input().split()] for i in range(n)]
max_length = 0
for i in range(n-1):
    for j in range(i+1,n):
        length = abs(c[i][0] - c[j][0]) + abs(c[i][1] - c[j][1])
        max_length = max(max_length, length)
print(max_length)

Fixed submission:
n = int(input())
c = [[int(i) for i in input().split()] for i in range(n)]
z = []
w = []
for i in range(n):
    z.append(c[i][0] + c[i][1])
    w.append(c[i][1] - c[i][0])
ans = max(max(z)-min(z), max(w)-min(w))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
c = input()
min_count = n
for i in range(n):
    s = c.count('R')
    W = c[:s].count('W')
    R = c[s:].count('R')
    """
    if W <= R:
        count = R # W + (R - W) # 仕切りより左側の白い石W個と、右側に残った赤い石R-W個
    else: # W >R
        count = W # R + (W - R)
    # 結局のところ、count = max(W,R)
    """
    count = max(W,R)        
    if min_count > count:
        min_count = count   
print(min_count)

Fixed submission:
n = int(input())
c = input()
r = c.count('R')
w = c.count('W')
count = 0
for i in range(r):
    if c[i] == 'W':
        count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
ans = []
for i in range(n):
    ans = a.count(i+1)
    print(ans)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
ans = [0] * (n)
for i in a:
    ans[i-1] += 1
[print(i) for i in ans]
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [str(input()) for i in range(n)]
d = {}
for name in s:
    if name in d.keys():
        d[name] = d[name] + 1
    else:
        d.setdefault(name, 1)
max_k_list = [kv[0] for kv in d.items() if kv[1] == max(d.values())]
for i in sorted(max_k_list):
    print(i)

Fixed submission:
n = int(input())
s = [str(input()) for i in range(n)]
sorted_s = sorted(s)
count = 1
max = 1
ans_list = []
prev = sorted_s[0]
for i in sorted_s[1:]:
    if i == prev:
        count += 1
    else:
        if count > max:
            ans_list = [prev]
            max = count
        elif count == max:
            ans_list.append(prev)
        prev = i
        count = 1
if count > max:
    ans_list = [prev]
elif count == max:
    ans_list.append(prev)
for i in ans_list:
    print(i)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
if n == 1:
    ans = 1
else:
    l = a[0]
    for i in a[1:]:
        l = lcm(l, i)
    b = []
    for i in a:
        b.append(l//i)
    ans = sum(b) % (10 ** 9 + 7)
print(ans)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
def lcm(x, y):
    return (x * y) // gcd(x, y)

l = a[0]
for i in a[1:]:
    l = lcm(l, i)
b = []
for i in a:
    b.append(l//i)
ans = sum(b) % (10 ** 9 + 7)
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

n = int(input())
a = [int(i) for i in input().split()]
l = a[0]
for i in a[1:]:
    l = lcm(l,i)
b = []
for i in a:
    b.append(l//i)
ans = sum(b) % (10 ** 9 + 7)
print(ans)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
def lcm(x, y):
    return (x * y) // gcd(x, y)

l = a[0]
for i in a[1:]:
    l = lcm(l, i)
b = []
for i in a:
    b.append(l//i)
ans = sum(b) % (10 ** 9 + 7)
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k,s = (int(i) for i in input().split()) 
ans = []
for i in range(k):
    ans.append(s)
if n > k:
for j in range(n-k):
    ans.append(1)
print(ans)

Fixed submission:
n,k,s = (int(i) for i in input().split())
ans = ""
if s != 10**9:
    for i in range(k):
        ans += str(s) + " "
    if n > k:
        for j in range(n-k):
            ans += str(10**9) + " "
    print(ans)
else:
    for i in range(k):
        ans += str(s) + " "
    if n > k:
        for j in range(n-k):
            ans += str(1) + " "
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n, k, q = (int(i) for i in input().split())
a = [int(input()) for i in range(q)]
score = np.ones(n) * k
minus = np.zeros(n)
for point in a:
  minus[point-1] += 1
  minus -= 1
final = score + minus
for f in final:
  if f > 0:
    print("Yes")
  else:
    print("No")
  

Fixed submission:
n, k, q = (int(i) for i in input().split())
a = [int(input()) for i in range(q)]
score = [k] * n
if k > q:
    for i in range(n):
      print("Yes")

else:
    for i in a:
        score[i-1] += 1
    for i in score:
        if i - q > 0:
            print("Yes")
        else:
            print("No")
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 i in range(m):
    a[a.index(max(a))] = max(a)//2
print(sum(a))

Fixed submission:
import heapq
n, m = (int(i) for i in input().split())
a = [int(i) * (-1) for i in input().split()]
heapq.heapify(a)
for i in range(m):
    tmp_min = ((a[0] * (-1)) //2) * (-1)
    heapq.heappushpop(a,tmp_min)
print(abs(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()]
a.sort()
for i in range(m):
    a.sort()
    a[n - 1] = a[n - 1] // 2
print(sum(a))

Fixed submission:
import heapq
n, m = (int(i) for i in input().split())
a = [int(i) * (-1) for i in input().split()]
heapq.heapify(a)
for i in range(m):
    tmp_min = ((a[0] * (-1)) //2) * (-1)
    heapq.heappushpop(a,tmp_min)
print(abs(sum(a)))

Buggy python submission (verdict: Time Limit Exceeded):
import math
n, m = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
sorted_a = sorted(a, reverse=True)
for i in range(m):
    sorted_a[0] = math.floor(sorted_a[0]/2)
    new_a = sorted(sorted_a, reverse=True)
    sorted_a = new_a
print(sum(sorted_a))

Fixed submission:
import heapq
n, m = (int(i) for i in input().split())
a = [int(i) * (-1) for i in input().split()]
heapq.heapify(a)
for i in range(m):
    tmp_min = ((a[0] * (-1)) //2) * (-1)
    heapq.heappushpop(a,tmp_min)
print(abs(sum(a)))