Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import numpy as np
def resolve():
    N,M,K = map(int,input().split())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))

    Amax_idx = N
    Asum = np.zeros(N+1, dtype = int)
    for i in range(1,N+1):
        Asum[i] = Asum[i-1] + A[i-1]
        if Asum[i] > K:
            Amax_idx = i - 1
            break

    ans = Amax_idx
    ansmax = ans
    anssum = Asum[Amax_idx]
    Acount = 0
    for i in range(M):
        anssum += B[i]
        while anssum > K:
            anssum -= A[Amax_idx - Acount]
            Acount += 1
            if Acount > Amax_idx:
                print(ansmax)
                return
            ans -= 1
        ans += 1  
        ansmax = max(ansmax,ans)
    print(ansmax)
resolve()

Fixed submission:
def resolve():
    N,M,K = map(int,input().split())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))

    Asum, Bsum = [0], [0]
    for i in range(N):
        Asum.append(A[i] + Asum[i])
    for i in range(M):
        Bsum.append(B[i] + Bsum[i])   

    ans = 0
    j = M
    for i in range(N+1):
        if Asum[i] > K:
            break
        while Bsum[j] > K - Asum[i]:
            j-=1         
        ans = max(ans,i+j)
    print(ans)
resolve()

Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np
def resolve():
    N,M,K = map(int,input().split())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))

    Amax_idx = N
    Asum = np.zeros(N+1, dtype = int)
    for i in range(1,N+1):
        Asum[i] = Asum[i-1] + A[i-1]
        if Asum[i] > K:
            Amax_idx = i - 1
            break

    ans = Amax_idx
    ansmax = ans
    anssum = Asum[Amax_idx]
    Acount = 0
    for i in range(M):
        anssum += B[i]
        while anssum > K:
            anssum -= A[Amax_idx - Acount]
            Acount += 1
            if Acount < 0:
                print(ansmax)
                sys.exit()
            ans -= 1
        ans += 1  
        ansmax = max(ansmax,ans)
    print(ansmax)
resolve()

Fixed submission:
def resolve():
    N,M,K = map(int,input().split())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))

    Asum, Bsum = [0], [0]
    for i in range(N):
        Asum.append(A[i] + Asum[i])
    for i in range(M):
        Bsum.append(B[i] + Bsum[i])   

    ans = 0
    j = M
    for i in range(N+1):
        if Asum[i] > K:
            break
        while Bsum[j] > K - Asum[i]:
            j-=1         
        ans = max(ans,i+j)
    print(ans)
resolve()
Buggy python submission (verdict: Runtime Error):
X = list(map(int,input().split()))
for i in range(5):
  if X[i] = 0:
    print(i+1)
    break

Fixed submission:
X = list(map(int,input().split()))
for i in range(5):
  if X[i] == 0:
    print(i+1)
    break
Buggy python submission (verdict: Runtime Error):
def find_num(lst, value):
    return [i for i, x in enumerate(lst) if x == value]

def resolve():
    X,N = map(int,input().split())
    if N == 0:
        print(X)
    else:
        p = list(map(int,input().split()))
        p.sort()
        idx = find_num(p,X)
        if idx == []:
            print(X)
        else:
            for i in range(1,100):
                if p[idx[0] - i ] != X - i or idx[0] - i == -1:
                    print(X-i)
                    break
                if p[idx[0] + i ] != X + i or idx[0] + i == N:
                    print(X+i)
                    break
resolve()

Fixed submission:
def find_num(lst, value):
    return [i for i, x in enumerate(lst) if x == value]

def resolve():
    X,N = map(int,input().split())
    if N == 0:
        print(X)
    else:
        p = list(map(int,input().split()))
        p.sort()
        idx = find_num(p,X)
        if idx == []:
            print(X)
        else:
            for i in range(1,100):
                if p[idx[0] - i ] != X - i or idx[0] - i == -1:
                    print(X-i)
                    break
                if idx[0] + i == N:
                    print(X+i)
                    break
                elif p[idx[0] + i ] != X + i:
                    print(X+i)
                    break
resolve()
Buggy python submission (verdict: Runtime Error):
#写経
#https://atcoder.jp/contests/abc168/submissions/13358850
from collections import deque

def resolve():
    N,M, *AB = map(int, open(0).read().split())
    graph = [[] for _ in range(N+1)]
    for a,b in zip(*[iter(AB)] * 2):
        graph[a].append(b)
        graph[b].append(a)
        print(graph)

    queue = deque([1])
    signposts = [0] * (N+1)
    signposts[1] = 1
    while queue:
        u = queue.popleft()
        for v in graph[u]:
            if not signposts[v]:
                signposts[v] = u
                queue.append(v)

    if all(signposts[2:]):
        print("Yes")
        print("\n".join(map(str,signposts[2:])))
    else:
        print("No")
resolve()

Fixed submission:
#写経
#https://atcoder.jp/contests/abc168/submissions/13358850
from collections import deque

def resolve():
    N,M, *AB = map(int, open(0).read().split())
    graph = [[] for _ in range(N+1)]
    for a,b in zip(*[iter(AB)] * 2):
        graph[a].append(b)
        graph[b].append(a)

    queue = deque([1])
    signposts = [0] * (N+1)
    signposts[1] = 1
    while queue:
        u = queue.popleft()
        for v in graph[u]:
            if not signposts[v]:
                signposts[v] = u
                queue.append(v)

    if all(signposts[2:]):
        print("Yes")
        print("\n".join(map(str,signposts[2:])))
    else:
        print("No")
resolve()
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
def resolve():
    N = int(input())
    A = list(map(int,input().split()))
    count = 0
    for i in range(1,N):
        A_roll = np.roll(A, i)
        count += sum((A + A_roll)[i:] == i)
    print(count)
resolve()

Fixed submission:
from collections import defaultdict
iim = lambda: map(int, input().rstrip().split())
 
def resolve():
    N = int(input())
    A = list(iim())
    ans = 0
    dp = [0]*N
    for i, ai in enumerate(A):
        x = i + ai
        if x < N:
            dp[x] += 1
        x = i - ai
        if x >= 0:
            ans += dp[x]
    print(ans)
resolve()

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import numpy as np
def resolve():
    N = int(input())
    A = list(map(int,input().split()))
    Aindex = np.array(list(itertools.combinations(range(N),2)))
    count = 0
    for i in range(len(Aindex)):
        if A[Aindex[i,0]] + A[Aindex[i,1]] == abs(Aindex[i,0] - Aindex[i,1]):
            count += 1
    print(count)
resolve()

Fixed submission:
from collections import defaultdict
iim = lambda: map(int, input().rstrip().split())
 
def resolve():
    N = int(input())
    A = list(iim())
    ans = 0
    dp = [0]*N
    for i, ai in enumerate(A):
        x = i + ai
        if x < N:
            dp[x] += 1
        x = i - ai
        if x >= 0:
            ans += dp[x]
    print(ans)
resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    N,M = map(int,input().split())
    for i in range(M):
        print(str(N//2 - i) + " " + str(N//2+1 + i))
resolve():

Fixed submission:
def resolve():
    N,M = map(int,input().split())
    if N % 2 == 1:
        for i in range(M):
            print(str(i+1) + " " + str(N-i))
    else:
        for i in range((M-1) // 2 + 1):
            print(str(i+1) + " " + str(N-i))
        for i in range((M-1) // 2 + 1 , M):
            print(str(i+1) + " " + str(N-i-1))
resolve()
Buggy python submission (verdict: Runtime Error):
N,M =  map(int,input().split())
A = list(map(int,input().split()))
ans = N
for i in range(M):
  ans = ans - A[i]
if ans < 0:
  print(-1)
else
	print(ans)

Fixed submission:
def resolve():
    N,M =  map(int,input().split())
    A = list(map(int,input().split()))
    ans = N
    for i in range(M):
        ans = ans - A[i]
    if ans < 0:
        print(-1)
    else:
        print(ans)
resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    N = int(input())
    strA = input()
    for i in range(1,N+1):
        print(strA.count(str(i)))
resolve()

Fixed submission:
import collections
def resolve():
    N = int(input())
    strA = input().split()
    ans = collections.Counter(strA)
    for i in range(1,N+1):
        print(ans[str(i)])
resolve()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
d = []
for n in range(N):
    s = input()
    if s not in d:
        d.append(s)
print(len(d))

Fixed submission:
N = int(input())
d = {}
for n in range(N):
    s = input()
    d[s] = True
print(len(d))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = 0
i = 1
while i <= N:
    if A[i] > A[i-1]:
        B += A[i] - A[i-1]
        A[i] = A[i-1]
print(B)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = 0
i = 1
while i < N:
    if A[i] - A[i-1] < 0:
        B += A[i-1] - A[i]
        A[i] = A[i-1]
    i += 1
print(B)
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
if (a[0] * 4) >= a[1] and (a[0] * 2) <= a[1] and A[1] % 2 == 0:
    print("Yes")
else:
  print("No")

Fixed submission:
a = list(map(int,input().split()))
if (a[0] * 4) >= a[1] and (a[0] * 2) <= a[1] and a[1] % 2 == 0:
    print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
if (a[0] * 4) <= a[1]:
  if (a[0] * 2) >= a[1]:
    print("Yes")
  else:
    print("No")
else:
print("No")

Fixed submission:
a = list(map(int,input().split()))
if (a[0] * 4) >= a[1] and (a[0] * 2) <= a[1] and a[1] % 2 == 0:
    print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n = input
R = 2*3.1415926535*n
print(R)

Fixed submission:
n = float(input())
R = 2*3.1415926535*n
print(R)

Buggy python submission (verdict: Runtime Error):
n = input 
R = n * 2 * 3.1415926535 

Fixed submission:
n = float(input())
R = 2*3.1415926535*n
print(R)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
print(max(N)-min(N))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
print(max(A)-min(A))
Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int, input().split())

m = 10 ** 9 + 7

def comb(n, r, m):
  ans = 1
  for i in range(r):
    ans *= (n-i) * pow(i+1, m-2, m) % m
  return ans
  
print((pow(2,n,m)-1-comb(n,a,m)-comb(n,b,m))%m)


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

m = 10 ** 9 + 7

def comb(n, r, m):
  ans = 1
  for i in range(r):
    #ans = ans * (n-i) * pow(i+1, m-2, m) % m
    ans *= (n-i) * pow(i+1, m-2, m) % m
    ans %= m
    # *= で書いてしまうとans自体にmod計算されないので
    # 大きな数が発生して遅くなる．
    # ans %= mを追加すれば早い？
    
  return ans
  
print((pow(2,n,m)-1-comb(n,a,m)-comb(n,b,m))%m)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = list(map(int, input().split()))
l = []
all_set = a
for _ in range(m):
#    l.append(list(map(int, input().split())))
    bi, ci = map(int, input().split())
    for _ in range(bi):
        all_set.append(ci)
    
print(sum(sorted(all_set, reverse=True)[:n]))

Fixed submission:
# coding: utf-8
# Your code here!

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

l = []
for _ in range(m):
    l.append(list(map(int, input().split())))
    
l = sorted(l, key=lambda x:x[1], reverse=True)

top_n = []
flag = False
for bi, ci in l:
    for _ in range(bi):
        if len(top_n) < n:
            top_n.append(ci)
        else:
            flag = True
    if flag:
        break
a.extend(top_n)

print(sum(sorted(a, reverse=True)[:n]))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
l = []
for _ in range(m):
    l.append(list(map(int, input().split())))
    
l = sorted(l, key=lambda x:x[1])

for bi, ci in l:
    for i in range(bi):
        if a[i] < ci:
            a[i] = ci
    a = sorted(a)
    
print(sum(a))

Fixed submission:
# coding: utf-8
# Your code here!

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

l = []
for _ in range(m):
    l.append(list(map(int, input().split())))
    
l = sorted(l, key=lambda x:x[1], reverse=True)

top_n = []
flag = False
for bi, ci in l:
    for _ in range(bi):
        if len(top_n) < n:
            top_n.append(ci)
        else:
            flag = True
    if flag:
        break
a.extend(top_n)

print(sum(sorted(a, reverse=True)[:n]))
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!

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

def gcd(x, y):
    if x == 0:
        return y
    if y == 0:
        return x
        
    if y > x:
        temp = y
        y = x
        x = temp
    amari = x % y
    if amari == 0:
        return y
    else:
        return gcd(y, amari)
        
L = [0]
for i in range(N):
    l = L[-1]
    L.append(gcd(l, A[i]))
    
R = [0]
for i in reversed(range(N)):
    r = R[0]
    R.insert(0, gcd(r, A[i]))

M = [gcd(L[i], R[i+1]) for i in range(N)] # i=1,...,N

print(max(M))


Fixed submission:
# coding: utf-8
# Your code here!

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

def gcd(x, y):
    if x == 0:
        return y
    if y == 0:
        return x
        
    if y > x:
        temp = y
        y = x
        x = temp
    amari = x % y
    if amari == 0:
        return y
    else:
        return gcd(y, amari)
        
L = list(range(N))
L[0] = 0
for i in range(N-1):
    L[i+1] = gcd(L[i], A[i])
    
R = list(range(N))
R.append(0)
for i in reversed(range(N)):
    R[i] = gcd(R[i+1], A[i])

M = [gcd(L[i], R[i+1]) for i in range(N)] # i=1,...,N

print(max(M))

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

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

def gcd(x, y):
    if x == 0:
        return y
    if y == 0:
        return x
        
    if y > x:
        temp = y
        y = x
        x = temp
    amari = x % y
    if amari == 0:
        return y
    else:
        return gcd(y, amari)
        
def L(i):
    if i == 0:
        return 0
    else:
        return gcd(L(i-1), A[i-2])
        
def R(i):
    if i == N+1:
        return 0
    else:
        return gcd(R(i+1), A[i-1])
        
M = [gcd(L(i), R(i+1)) for i in range(1, N+1)] # i=1,...,N

print(max(M))


Fixed submission:
# coding: utf-8
# Your code here!

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

def gcd(x, y):
    if x == 0:
        return y
    if y == 0:
        return x
        
    if y > x:
        temp = y
        y = x
        x = temp
    amari = x % y
    if amari == 0:
        return y
    else:
        return gcd(y, amari)
        
L = list(range(N))
L[0] = 0
for i in range(N-1):
    L[i+1] = gcd(L[i], A[i])
    
R = list(range(N))
R.append(0)
for i in reversed(range(N)):
    R[i] = gcd(R[i+1], A[i])

M = [gcd(L[i], R[i+1]) for i in range(N)] # i=1,...,N

print(max(M))
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

cooking_time = [a,b,c,d,e]

mindiv10 = min(list(filter(lambda n:n>0, [x%10 for x in cooking_time])))

# search
last_food = 0
for x in cooking_time:
    if x%10 == mindiv10:
        last_food = x
        
cooking_time.remove(last_food)

time = 0
for x in cooking_time:
    time += x + (0 if x%10==0 else 10-x%10)

time += last_food

print(time)

Fixed submission:
# coding: utf-8
# Your code here!

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

cooking_time = [a,b,c,d,e]

l = [x%10 for x in cooking_time]
if sum(l)==0:
    mindiv10=0
else:
    mindiv10 = min(list(filter(lambda n:n>0, l)))

# search
last_food = 0
for x in cooking_time:
    if x%10 == mindiv10:
        last_food = x
        
cooking_time.remove(last_food)

time = 0
for x in cooking_time:
    time += x + (0 if x%10==0 else 10-x%10)

time += last_food

print(time)
Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
l = [x for x in range(a, b+1)]
result = 0
for x in l:
    result = result ^ x
    
print(result)

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

def f(n):
    # XOR([o to n])
    if (n+1)%2 == 0: # 総数が偶数
        if ((n+1)//2)%2 == 0: # ペアが偶数
            return 0
        else: # ペアが奇数
            return 1
    else: # 総数が奇数
        if ((n+1)//2)%2 == 0: # 2つ1組のペアが偶数
            return n
        else: # ペアが奇数
            return n+1
        
        
result = f(a-1) ^ f(b)
    
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in itertools.combinations(a,2):
    ans+=(i[0]*i[1])%(10**9+7)
print(ans%(10**9+7))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=0
k=sum(a)
for i in a:
    k-=i
    ans+=i*k
print(ans%(10**9+7))
Buggy python submission (verdict: Runtime Error):
from decimal import *
n,m,k=map(Decimal,input().split())
a=list(map(Decimal,input().split()))
b=list(map(Decimal,input().split()))

a.append(10**9+1)
b.append(10**9+1)
k/=10**9
i,j,ans=0,0,0
while k>=0:
    if a[i]>10**9:
        k-=Decimal(b[j]/(10**9))
        j+=1
    elif b[i]>10**9:
        k-=Decimal(a[i]/(10**9))
        i+=1
    elif a[i]>b[j]:
        k-=Decimal(b[j]/(10**9))
        j+=1
    else:
        k-=Decimal(a[i]/(10**9))
        i+=1
    if k<0:
        break
    ans+=1

print(ans)
    

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

a,b=[0],[0]
for i in range(n):
    a.append(a[i]+A[i])
for i in range(m):
    b.append(b[i]+B[i])

j,ans=m,0
for i in range(n+1):
    if a[i]>k:
        break
    while b[j] > k-a[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

a.append(10**9+1)
b.append(10**9+1)

i,j,ans=0,0,0
while k>=0:
    if a[i]>10**9:
        k-=b[j]
        j+=1
    elif b[i]>10**9:
        k-=a[i]
        i+=1
    elif a[i]>b[j]:
        k-=b[j]
        j+=1
    else:
        k-=a[i]
        i+=1
    if k<0:
        break
    ans+=1

print(ans)
    

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

a,b=[0],[0]
for i in range(n):
    a.append(a[i]+A[i])
for i in range(m):
    b.append(b[i]+B[i])

j,ans=m,0
for i in range(n+1):
    if a[i]>k:
        break
    while b[j] > k-a[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

a.append(10**9+1)
b.append(10**9+1)

i,j,ans=0,0,0
while k>=0:
    print(i,j)
    if a[i]>10**9:
        k-=b[j]
        j+=1
    elif b[i]>10**9:
        k-=a[i]
        i+=1
    elif a[i]>b[j]:
        k-=b[j]
        j+=1
    else:
        k-=a[i]
        i+=1
    if k<0:
        break
    ans+=1

print(ans)
    

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

a,b=[0],[0]
for i in range(n):
    a.append(a[i]+A[i])
for i in range(m):
    b.append(b[i]+B[i])

j,ans=m,0
for i in range(n+1):
    if a[i]>k:
        break
    while b[j] > k-a[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))

def solve(k,n,a):
    for _ in range(k):
        Y = [0]*(n+1)
        for i, x in enumerate(a):
            Y[max(0, i-x)] += 1
            Y[min(n, i+x+1)] -= 1
        for j in range(1, n):
            Y[j] += Y[j-1]
        if a == Y[:-1]:
            break
        a = Y[:-1]
    return a

ans=solve(K,N,A)
print(*ans)

Fixed submission:
from numba import jit
N, K = map(int, input().split())
A = list(map(int, input().split()))

@jit
def solve(k,n,a):
    for _ in range(k):
        Y = [0]*(n+1)
        for i, x in enumerate(a):
            Y[max(0, i-x)] += 1
            Y[min(n, i+x+1)] -= 1
        for j in range(1, n):
            Y[j] += Y[j-1]
        if a == Y[:-1]:
            break
        a = Y[:-1]
    return a

ans=solve(K,N,A)
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
for _ in range(k):
    Y = [0]*(n+1)
    for i, x in enumerate(a):
        Y[max(0, i-x)] += 1
        Y[min(n, i+x+1)] -= 1
    for j in range(1, n):
        Y[j] += Y[j-1]
    if a == Y[:-1]:
        break
    a = Y[:-1]
print(*a)

Fixed submission:
from numba import jit
N, K = map(int, input().split())
A = list(map(int, input().split()))

@jit
def solve(k,n,a):
    for _ in range(k):
        Y = [0]*(n+1)
        for i, x in enumerate(a):
            Y[max(0, i-x)] += 1
            Y[min(n, i+x+1)] -= 1
        for j in range(1, n):
            Y[j] += Y[j-1]
        if a == Y[:-1]:
            break
        a = Y[:-1]
    return a

ans=solve(K,N,A)
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=[copy.copy(a)]
for i in range(1,k+1):
    for j in range(n):
        mn=j-ans[i-1][j]
        mx=j+ans[i-1][j]
        if mn<0:
            mn=0
        if mx>n-1:
            mx=n-1
        ans.append([0]*n)
        for l in range(mn,mx+1):
            ans[i][l]+=1
L=[str(a) for a in ans[k]]
L=" ".join(L)
print(L)

Fixed submission:
from numba import jit
N, K = map(int, input().split())
A = list(map(int, input().split()))

@jit
def solve(k,n,a):
    for _ in range(k):
        Y = [0]*(n+1)
        for i, x in enumerate(a):
            Y[max(0, i-x)] += 1
            Y[min(n, i+x+1)] -= 1
        for j in range(1, n):
            Y[j] += Y[j-1]
        if a == Y[:-1]:
            break
        a = Y[:-1]
    return a

ans=solve(K,N,A)
print(*ans)
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 a.count(0)==0 and ans>10**18:
        print(-1)
        exit()
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=1
a=sorted(a)
for i in a:
    ans*=i
    if i==0:
        print(0)
        exit()
    elif ans>10**18:
        print(-1)
        exit()
print(ans)

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)
    exit()
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=1
a=sorted(a)
for i in a:
    ans*=i
    if i==0:
        print(0)
        exit()
    elif ans>10**18:
        print(-1)
        exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
a,b=map(str,input().split())
print(int(int(a)*b))

Fixed submission:
import math
import decimal
a,b=map(str,input().split())
print(math.trunc(decimal.Decimal(a)*decimal.Decimal(b)))
Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=map(int,input().split())
ans=0
for i in range(n+1):
    ans=max(ans,int((a*i)/b)-a*int(i/b))
print(ans)

Fixed submission:
a,b,n=map(int,input().split())
k=min(n,b-1)
print(int((a*k)/b)-a*int(k/b))
Buggy python submission (verdict: Runtime Error):
import math
a=[input() for i in range(5)]
b,c=10,0
for i in range(5):
    if 0<int(a[i][-1])<b:
        b=int(a[i][-1])
        d=i
for i in range(5):
    if i==d:
        c+=int(a[i])
    else:
        if int(a[i][-1])==0:
            c+=int(a[i])
        elif int(a[i])<=10:
            c+=10
        else:
            c+=(int(a[i][0:-1])+1)*10
print(c)

Fixed submission:
import math
a=[input() for i in range(5)]
b,c=10,0
for i in range(5):
    if 0<int(a[i][-1])<b:
        b=int(a[i][-1])
        d=i
for i in range(5):
    if b!=10:
        if i==d:
            c+=int(a[i])
        else:
            if int(a[i][-1])==0:
                c+=int(a[i])
            elif int(a[i])<=10:
                c+=10
            else:
                c+=(int(a[i][0:-1])+1)*10
    else:
        c+=int(a[i])
print(c)