Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, A = map(int, input().split())
xs = list(map(int, input().split()))

# 平均を A にしたいので、
# 先に A を引いて、平均を 0 にすることを目指す

xs = [x - A for x in xs]

count = 0

for i in range(2 ** N):
  string = "{:0" + str(N) + "b}"
  use = string.format(i)[::-1]

  ans = 0
  for i, flag in enumerate(use):
    if flag == "1":
      ans += xs[i]
    else:
      pass
  if ans == 0:
    count += 1
  
if A != 0:
  count -= 1
    
print(count)

Fixed submission:
# ABC044C - 高橋君とカード / Tak and Cards (ARC060C)
def main():
    N, A = tuple(map(int, input().split()))
    X = tuple(map(int, input().split()))
    # dp[i][j][k] := patterns to make k with j cards from X1, X2, ..., Xi
    dp = [[[0] * (N * 50 + 1) for _ in range(N + 1)] for _ in range(N + 1)]
    dp[0][0][0] = 1
    for i in range(N):
        for j in range(N):
            for k in range(N * 50 + 1):
                if dp[i][j][k]:
                    dp[i + 1][j][k] += dp[i][j][k]
                    dp[i + 1][j + 1][k + X[i]] += dp[i][j][k]
    ans = sum(dp[N][i][i * A] for i in range(1, N + 1))
    print(ans)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = tuple(map(int, input().split()))
scores = [k]*n
for i in range(q):
    answered = int(input()) - 1
    scores[answered] += 1
    scores = [v - 1 for v in scores]
for i in range(n):
    result = "Yes" if scores[i] > 0 else "No"
    print(result)

Fixed submission:
n, k, q = tuple(map(int, input().split()))
answereds = [0]*n
for i in range(q):
    answered = int(input()) - 1
    answereds[answered] += 1
for i in range(n):
    result = "Yes" if q-answereds[i] < k else "No"
    print(result)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
h = list(map(int, input().split()))
ans = 0
for i in h:
    ans += (h>=K)
print(ans)

Fixed submission:
N, K = map(int, input().split())
h = list(map(int, input().split()))
ans = 0
for i in h:
    ans += (i >= K)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math


def cf(x1, x2):
    cf = []
    for i in range(1, min(x1, x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf


def isPrime(num):
    if num == 1 or num == 2:
        return True
    elif num % 2 == 0:
        return False

    for i in range(3, math.floor(math.sqrt(num))+1, 2):
        if num % i == 0:
            return False

    return True


def main():
    A, B = map(int, input().split())
    X = cf(A, B)
    ans = 0
    for i in X:
        ans += isPrime(i)
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    A, B = map(int, input().split())
    X = prime_decomposition(gcd(A, B))
    print(len(set(X))+1)


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
for i in range(1, N+1):
    if (K - (Q - A.count(i))) <= 0:
        print("No")
    else:
        print("Yes")


Fixed submission:
import collections
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
c = collections.Counter(A)
for i in range(1, N+1):
    if (K - (Q - c[i])) <= 0:
        print("No")
    else:
        print("Yes")
Buggy python submission (verdict: Runtime Error):
import collections

from operator import mul
from functools import reduce


def cmb(n, r):
    r = min(n-r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


N = int(input())
s = [" ".join(sorted(list(input()))) for _ in range(N)]
c = collections.Counter(s)
ans = 0
for i in c.values():
    ans += cmb(i, 2)
print(ans)


Fixed submission:
import collections

from operator import mul
from functools import reduce


def cmb(n, r):
    r = min(n-r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


N = int(input())
s = [" ".join(sorted(list(input()))) for _ in range(N)]
c = collections.Counter(s)
ans = 0
for i in c.values():
    if i > 1:
        ans += cmb(i, 2)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
s = [[collections.Counter(input())] for _ in range(N)]
ans = 0
for i in range(N):
    ans += s[:i].count(s[i])

print(ans)


Fixed submission:
import collections

from operator import mul
from functools import reduce


def cmb(n, r):
    r = min(n-r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


N = int(input())
s = [" ".join(sorted(list(input()))) for _ in range(N)]
c = collections.Counter(s)
ans = 0
for i in c.values():
    if i > 1:
        ans += cmb(i, 2)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
s = []
ans = 0
for _ in range(N):
    c = collections.Counter(input())
    ans += s.count(c)
    s.append(c)
print(ans)


Fixed submission:
import collections

from operator import mul
from functools import reduce


def cmb(n, r):
    r = min(n-r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


N = int(input())
s = [" ".join(sorted(list(input()))) for _ in range(N)]
c = collections.Counter(s)
ans = 0
for i in c.values():
    if i > 1:
        ans += cmb(i, 2)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
s = []
ans = 0
for _ in range(N):
    c = collections.Counter(input())
    ans += s.count(c)
    s.append(c)
print(ans)


Fixed submission:
import collections

from operator import mul
from functools import reduce


def cmb(n, r):
    r = min(n-r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


N = int(input())
s = [" ".join(sorted(list(input()))) for _ in range(N)]
c = collections.Counter(s)
ans = 0
for i in c.values():
    if i > 1:
        ans += cmb(i, 2)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N = int(input())
A = [int(input()) for _ in range(N)]
tmp = [A[0]]
for i in A[1:N]:
    index = bisect.bisect_left(tmp, i)
    if index == 0:
        tmp.insert(0, i)
    else:
        tmp[index-1] = i

print(len(tmp))


Fixed submission:
import bisect
N = int(input())
A = [-int(input()) for _ in range(N)]
tmp = [A[0]]
for i in A[1:N]:
    index = bisect.bisect(tmp, i)
    if index == len(tmp):
        tmp.append(i)
    else:
        tmp[index] = i

print(len(tmp))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N = int(input())
A = [int(input()) for _ in range(N)]
tmp = [A[0]]
for i in range(1, N):
    index = bisect.bisect_left(tmp, A[i])
    if index == 0:
        tmp.insert(0, A[i])
    else:
        tmp[index-1] = A[i]

print(len(tmp))


Fixed submission:
import bisect
N = int(input())
A = [-int(input()) for _ in range(N)]
tmp = [A[0]]
for i in A[1:N]:
    index = bisect.bisect(tmp, i)
    if index == len(tmp):
        tmp.append(i)
    else:
        tmp[index] = i

print(len(tmp))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N = int(input())
A = [int(input()) for _ in range(N)]
tmp = [A[0]]
ans = 0
for i in range(1, N):
    index = bisect.bisect_left(tmp, A[i])
    if index == 0:
        tmp.append(A[i])
        tmp.sort()
    else:
        tmp[index-1] = A[i]

print(len(tmp))


Fixed submission:
import bisect
N = int(input())
A = [-int(input()) for _ in range(N)]
tmp = [A[0]]
for i in A[1:N]:
    index = bisect.bisect(tmp, i)
    if index == len(tmp):
        tmp.append(i)
    else:
        tmp[index] = i

print(len(tmp))
Buggy python submission (verdict: Runtime Error):
import itertools
import numpy as np

def mod(n):
    return n % 2019


L, R = map(int, input().split())

a = list(range(L,R+1))
p = list(itertools.combinations(a, 2))
a1, a2 = map(list, zip(*p))
ans = np.array(a1)*np.array(a2)
ans = map(mod,ans)
print(min(ans))


Fixed submission:
N,A,B = map(int, input().split())
print((B < (N*A)) and B or N*A)

Buggy python submission (verdict: Runtime Error):
def mod(n):
    return n % 2019

import itertools
import numpy as np
import operator as op
L, R = map(int, input().split())

a = list(range(L,R+1))
p = list(itertools.combinations(a, 2))
a1, a2 = map(list, zip(*p))
ans = np.array(a1)*np.array(a2)
ans = map(mod,ans)
print(min(ans))



Fixed submission:
N,A,B = map(int, input().split())
print((B < (N*A)) and B or N*A)
Buggy python submission (verdict: Runtime Error):
import itertools
import numpy as np

def mod(n):
    return n % 2019


L, R = map(int, input().split())

a = list(range(L,R+1))
p = list(itertools.combinations(a, 2))
a1, a2 = map(list, zip(*p))
ans = np.array(a1)*np.array(a2)
ans = map(mod,ans)
print(min(ans))


Fixed submission:
L, R = map(int, input().split())
if R-L>=2019:
    print(0)
else:
    print(min([((i*j)%2019) for i in range(L,R) for j in range(i+1,R+1)]))

Buggy python submission (verdict: Runtime Error):
def mod(n):
    return n % 2019

import itertools
import numpy as np
import operator as op
L, R = map(int, input().split())

a = list(range(L,R+1))
p = list(itertools.combinations(a, 2))
a1, a2 = map(list, zip(*p))
ans = np.array(a1)*np.array(a2)
ans = map(mod,ans)
print(min(ans))



Fixed submission:
L, R = map(int, input().split())
if R-L>=2019:
    print(0)
else:
    print(min([((i*j)%2019) for i in range(L,R) for j in range(i+1,R+1)]))

Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())
print(min([((i*j)%2019) for i in range(L,R) for j in range(i+1,R+1)]))

Fixed submission:
L, R = map(int, input().split())
if R-L>=2019:
    print(0)
else:
    print(min([((i*j)%2019) for i in range(L,R) for j in range(i+1,R+1)]))

Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())
print(min([((i*j)%2019) for i in range(L,R) for j in range(i+1,R+1)]))

Fixed submission:
L, R = map(int, input().split())
if R-L>=2019:
    print(0)
else:
    print(min([((i*j)%2019) for i in range(L,R) for j in range(i+1,R+1)]))
Buggy python submission (verdict: Runtime Error):
import sys
import re
import math
from collections import Counter

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N,K=(int(x) for x in input().split())

for i in range(1,K+1):
    print((combinations_count(N-K+1, i)*combinations_count(K-1, i-1))%1000000007)



Fixed submission:
import sys
import re
import math
from collections import Counter

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N,K=(int(x) for x in input().split())

for i in range(1,K+1):
    if i < min(K+1,N-K+2):
        print((combinations_count(N-K+1, i)*combinations_count(K-1, i-1))%1000000007)
    else:
        print(0)

Buggy python submission (verdict: Runtime Error):
import sys
import re
import math
from collections import Counter

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N,K=(int(x) for x in input().split())

for i in range(1,K+1):
    print(combinations_count(N-K+1, i)*combinations_count(K-1, i-1))


Fixed submission:
import sys
import re
import math
from collections import Counter

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N,K=(int(x) for x in input().split())

for i in range(1,K+1):
    if i < min(K+1,N-K+2):
        print((combinations_count(N-K+1, i)*combinations_count(K-1, i-1))%1000000007)
    else:
        print(0)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())

ans = 0
for x in range(K + 1):
    for y in range(K + 1):
        for z in range(K + 1):
            ans += ((x + y + z) == S)
print(ans)   


Fixed submission:
K, S = map(int, input().split())

ans = 0
for x in range(K + 1):
    for y in range(K + 1):
        z = S - x - y
        ans += ((0<=z<=K))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
li = list(map(int, input().split()))

r = []
result = ""

for i in range(1, N + 1):
    a = li.index(i)
    result = result + str(a + 1) + " "

print(result)

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

r = [0]*N

for index in range(N):
    l = li[index]
    r[l-1] = str(index+1)

print(" ".join(r))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
 
N = int(input())
li = list(map(int,input().split()))
 
r = []
result = ""
 
for i in range(1,N+1):
    a = li.index(i)
    result = result + str(a+1) + " "
    
print(result)

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

r = [0]*N

for index in range(N):
    l = li[index]
    r[l-1] = str(index+1)

print(" ".join(r))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
li = list(map(int,input().split()))

r = []

for i in range(1,N+1):
    a = li.index(i)
    r.append(a)

result = ""

for t in r:
    result = result + str(t+1) + " "

print(result)

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

r = [0]*N

for index in range(N):
    l = li[index]
    r[l-1] = str(index+1)

print(" ".join(r))
Buggy python submission (verdict: Time Limit Exceeded):
import copy
n,m=map(int,input().split())

a=list(map(int,input().split()))
aorg=a[:]
waribiki=[0]*n

for i in range(m):
  maxindex=a.index(max(a))
  a[maxindex]=a[maxindex]/2
  waribiki[maxindex]+=1

total=0
for i in range(n):
  if waribiki[i]!=0:
    aorg[i]=aorg[i]//(2**waribiki[i])
  total+=aorg[i]
print (total)



Fixed submission:
import copy
import heapq
import math
n,m=map(int,input().split())
a=[0]*n
atmp=list(map(int,input().split()))
for i in range(n):
  a[i]=-atmp[i]

heapq.heapify(a)
for i in range(m):
  tmp=heapq.heappop(a)
  heapq.heappush(a,tmp/2)

total=0  
for i in range(n):
  total+=math.ceil(a[i])
print (-total)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
import math
n,m=map(int,input().split())

a=list(map(int,input().split()))
for i in range(m):
  a.sort(reverse=True)
  a[0]=a[0]/2
total=0  
for i in range(n):
  total+=math.floor(a[i])
print (total)



Fixed submission:
import copy
import heapq
import math
n,m=map(int,input().split())
a=[0]*n
atmp=list(map(int,input().split()))
for i in range(n):
  a[i]=-atmp[i]

heapq.heapify(a)
for i in range(m):
  tmp=heapq.heappop(a)
  heapq.heappush(a,tmp/2)

total=0  
for i in range(n):
  total+=math.ceil(a[i])
print (-total)

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

a=list(map(int,input().split()))
aorg=a[:]
waribiki=[0]*n

for i in range(m):
  maxindex=a.index(max(a))
  a[maxindex]=a[maxindex]/2
  waribiki[maxindex]+=1

total=0
for i in range(n):
  if waribiki[i]!=0:
    aorg[i]=aorg[i]//(2**waribiki[i])
  total+=aorg[i]
print (total)



Fixed submission:
import copy
import heapq
import math
n,m=map(int,input().split())
a=[0]*n
atmp=list(map(int,input().split()))
for i in range(n):
  a[i]=-atmp[i]

heapq.heapify(a)
for i in range(m):
  tmp=heapq.heappop(a)
  heapq.heappush(a,tmp/2)

total=0  
for i in range(n):
  total+=math.ceil(a[i])
print (-total)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=map(int,input().split())

ans=0
for i in range(n):
  ans+= 1/a[i]

print(1/ans)

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

ans=0
for i in range(n):
  ans+= 1/a[i]

print(1/ans)
Buggy python submission (verdict: Runtime Error):
S=input()

i=1
K=1
lastword=[]
lastword.append(S[0])
while i<= (len(S)-1):
  if i==len(S)-1:
    if len(lastword[-1])==1 and S[i]!=S[i-1] or len(lastword[-1])==2:
      K+=1
      break
    elif len(lastword[-1])==1 and S[i]==S[i-1]:
      if lastword[-3]==lastword[-1]:
        break
      else:
        K+=1
        break
  
  if len(lastword[-1])==1:
    if S[i]!=S[i-1]:
      lastword.append(S[i])
      i+=1
      K+=1
    else:
      lastword.append(S[i:i+2])  
      i+=2
      K+=1
  else:     # len(lastword)==2:
    lastword.append(S[i])
    i+=1
    K+=1
  print(i,K,lastword)

print(K)

Fixed submission:
S=input()

i=1
K=1
lastword=[]
lastword.append(S[0])
while i<= (len(S)-1):
  if i==len(S)-1:
    if len(lastword[-1])==1 and S[i]!=S[i-1] or len(lastword[-1])==2:
      K+=1
      break
    elif len(lastword[-1])==1 and S[i]==S[i-1]:
      if lastword[-3]==lastword[-1] or lastword[-1]!=lastword[-2]:
        break
      else:
        K+=1
        break
  
  if len(lastword[-1])==1:
    if S[i]!=S[i-1]:
      lastword.append(S[i])
      i+=1
      K+=1
    else:
      lastword.append(S[i:i+2])  
      i+=2
      K+=1
  else:     # len(lastword)==2:
    lastword.append(S[i])
    i+=1
    K+=1
#  print(i,K,lastword)

print(K)
Buggy python submission (verdict: Runtime Error):
n=int(input())

cnt=0
for i in range(1,n+1):
  if len(str(i))%2=1:
    cnt+=1
print (cnt)

Fixed submission:
import sys
n=int(input())

oddn=0
if n<10:
  oddn+=n
  print(oddn)
  sys.exit()
else:
  oddn+=9
if n<100:
  print(oddn)
  sys.exit()
  
if n<1000:
  oddn+= n-99
  print(oddn)
  sys.exit()
else:
  oddn+=900

if n>=10000:
  oddn+=n-9999
if n==100000:
  oddn-=1

print(oddn)
Buggy python submission (verdict: Runtime Error):
import sys
n=int(input())
a=list(map(int,input().split()))
if len(a)==1:
  print("Yes")
  sys.exit()

for i in range(1,n)[::-1]:
  if a[i]>=a[i-1]:
    a[i-1]-=1
  elif a[i]a[i-1]:
    continue
  else:
    print("No")
    sys.exit()

print("Yes")

Fixed submission:
import sys
n=int(input())
a=list(map(int,input().split()))
if len(a)==1:
  print("Yes")
  sys.exit()
if len(a)==2 and a[0]<=a[1]:
  print("Yes")
  sys.exit()
elif len(a)==2:
  print("No")
  sys.exit()
  
for i in range(1,n-1):
  if a[i+1]>=a[i]-1 and a[i]-1>=a[i-1]:
    a[i]=a[i]-1
    continue

  if a[i+1] >= a[i] and a[i] >=a [i-1]:
    continue
  else:
    print("No")
    sys.exit()
print("Yes")

Buggy python submission (verdict: Runtime Error):
import sys
n=int(input())
a=list(map(int,input().split()))
if n==1:
  print(Yes)
  sys.exit()
for i in range(1,n-1):
  if a[i+1] >= a[i] and a[i] >=a [i-1]:
    continue
  if a[i+1]>=a[i]-1 and a[i]-1>=a[i-1]:
    a[i]=a[i]-1
    continue
  elif i==1 and a[0]-1==a[1]:
    a[0]-=1
    continue
  else:
    print("No")
    sys.exit()
print("Yes")

Fixed submission:
import sys
n=int(input())
a=list(map(int,input().split()))
if len(a)==1:
  print("Yes")
  sys.exit()
if len(a)==2 and a[0]<=a[1]:
  print("Yes")
  sys.exit()
elif len(a)==2:
  print("No")
  sys.exit()
  
for i in range(1,n-1):
  if a[i+1]>=a[i]-1 and a[i]-1>=a[i-1]:
    a[i]=a[i]-1
    continue

  if a[i+1] >= a[i] and a[i] >=a [i-1]:
    continue
  else:
    print("No")
    sys.exit()
print("Yes")

Buggy python submission (verdict: Runtime Error):
import sys
n=int(input())
a=list(map(int,input().split()))
if n==0:
  print(Yes)
  sys.exit()
for i in range(1,n-1):
  if a[i+1] >= a[i] and a[i] >=a [i-1]:
    continue
  if a[i+1]>=a[i]-1 and a[i]-1>=a[i-1]:
    a[i]=a[i]-1
    continue
  else if i==1 and a[0]-1==a[1]:
    a[0]-=1
    continue
  else:
    print("No")
    sys.exit()
print("Yes")

Fixed submission:
import sys
n=int(input())
a=list(map(int,input().split()))
if len(a)==1:
  print("Yes")
  sys.exit()
if len(a)==2 and a[0]<=a[1]:
  print("Yes")
  sys.exit()
elif len(a)==2:
  print("No")
  sys.exit()
  
for i in range(1,n-1):
  if a[i+1]>=a[i]-1 and a[i]-1>=a[i-1]:
    a[i]=a[i]-1
    continue

  if a[i+1] >= a[i] and a[i] >=a [i-1]:
    continue
  else:
    print("No")
    sys.exit()
print("Yes")

Buggy python submission (verdict: Runtime Error):
import sys
n=int(input())
a=list(map(int,input().split()))

if n==0:
  print(Yes)
  sys.exit()
for i in range(1,n-1):
  if a[i+1]>=a[i] and a[i]>=a[i-1]:
    continue
  if a[i+1]>=a[i]-1 and a[i]-1>=a[i-1]:
    a[i]=a[i]-1
      continue
    else:
      print("No")
      sys.exit()
  else:
    print("No")
    sys.exit()
print("Yes")

 

Fixed submission:
import sys
n=int(input())
a=list(map(int,input().split()))
if len(a)==1:
  print("Yes")
  sys.exit()
if len(a)==2 and a[0]<=a[1]:
  print("Yes")
  sys.exit()
elif len(a)==2:
  print("No")
  sys.exit()
  
for i in range(1,n-1):
  if a[i+1]>=a[i]-1 and a[i]-1>=a[i-1]:
    a[i]=a[i]-1
    continue

  if a[i+1] >= a[i] and a[i] >=a [i-1]:
    continue
  else:
    print("No")
    sys.exit()
print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
import copy
n=int(input())
a=[]
for i in range(n):
  a.append(int(input()))
ma =max(a)
for i in range(n):
  if a[i]==ma:
    b=copy.deepcopy(a)
    del b[i]
    print(max(b))
  else:
    print(ma)

Fixed submission:
import copy
n=int(input())
a=[]
for i in range(n):
  a.append(int(input()))
ma =max(a)
cn =0
for i in range(n):
  if a[i]==ma and cn<2:
    b=copy.deepcopy(a)
    del b[i]
    print(max(b))
    cn +=1
  else:
    print(ma)

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

for i in range(n):
  if a[i]==max(a):
    b=copy.deepcopy(a)
    del b[i]
    print(max(b))
  else:
    print(max(a))

Fixed submission:
import copy
n=int(input())
a=[]
for i in range(n):
  a.append(int(input()))
ma =max(a)
cn =0
for i in range(n):
  if a[i]==ma and cn<2:
    b=copy.deepcopy(a)
    del b[i]
    print(max(b))
    cn +=1
  else:
    print(ma)
Buggy python submission (verdict: Runtime Error):
L,R = map(int, input().split())

#if R-L > 2019:
#  print (0)
#else:
#  mod1 = L%2019
#  mod2 = R%2019
#  if mod2 < mod1:
#    print (0)
#    sys.exit()
#  else:
  modmin =2019 -1
  for i in range(L,R):
    for j in range(i+1,R+1):
      mod3 = (i*j)%2019
      if mod3 =0:
        print(0)
        sys.exit()
      elif modmin > mod3:
        modmin = mod3

  print(modmin)
  

Fixed submission:
import sys
L,R = map(int, input().split())

#if R-L > 2019:
#  print (0)
#else:
#  mod1 = L%2019
#  mod2 = R%2019
#  if mod2 < mod1:
#    print (0)
#    sys.exit()
#  else:
modmin =2019 -1
for i in range(L,R):
  for j in range(i+1,R+1):
    mod3 = (i*j)%2019
    if mod3 == 0:
      print(0)
      sys.exit()
    elif modmin > mod3:
      modmin = mod3

print(modmin)
Buggy python submission (verdict: Runtime Error):
import sys
n = int(input())
a=[]
a=list(map(int, input().split()))
m=[0]*n
for i in list(reversed(range(a[0])):
  mn=0
  for j in range(n-1):
    if j==0:
      m[n-1]=i*2
      m[j]=(a[j]-m[n-1]/2)*2
    else:
      m[j]=(a[j]-m[j-1]/2)*2

  if m[n-2]/2+m[n-1]/2 ==a[n-1]:
    print(int(m[n-1]),sep=" ",end=" ")
    for i in range(n-1):
      print(int(m[i]),sep=" ",end=" ")


    sys.exit()
  

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

m=[0]*n

for i in range(n):
  if i%2 == 0:
    m[0]+=a[i]
  else:
    m[0]-=a[i]
for i in range(1,n):
  m[i] =(a[i-1]-m[i-1]/2)*2
  
for i in range(n):
  print(int(m[i]),end=" ")
Buggy python submission (verdict: Runtime Error):
n,x = map(int,input().split())
L=list(map(int,input().split()))

cnt =0
pos =0
jp=[]
for i in range(n+1):
  if pos<=x:
    cnt +=1
    jp.append(pos)
    pos +=L[i]
  else:
    break

print(cnt)

Fixed submission:
n,x = map(int,input().split())
L=list(map(int,input().split()))
 
cnt =0
pos =0
jp=[]
for i in range(len(L)+1):
  if pos<=x:
    cnt +=1
    jp.append(pos)
    if i<(len(L)):
      pos +=L[i]
    else:
      break
  else:
    break

print(cnt)
Buggy python submission (verdict: Runtime Error):
k,s=map(int,input().split())

count=0
for i in range(k):
  for j in range(k):
    if s-i-j=k:
      count+=1
      break
print(count)
    

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

count=0
for i in range(k+1):
  for j in range(k+1):
    if i+j>s:
      break
    if s-i-j<=k:
      count+=1

print(count)