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

ans = 1

for a in A:
    ans *= a
    if a == 0:
        print(0)
        break

else:
    if ans > 1000000000000000000:
        print(-1)
    else:
        print(ans)


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

ans = 1

if 0 in A:
    print(0)
else:
    for a in A:
        ans *= a
        if ans > 1000000000000000000:
            print(-1)
            break
    else:
        print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = [[] for i in range(M)]
for i in range(M):
    AB[i] = list(map(int, input().split()))

cnt = 0
memo_loser = []
for bridge in AB:
    

    value = min(H[bridge[0]-1], H[bridge[1]-1])
    if value == H[bridge[0]-1] and not bridge[0] in memo_loser:
        memo_loser.append(bridge[0])
    if value == H[bridge[1] - 1] and not bridge[1] in memo_loser:
        memo_loser.append(bridge[1])
print(N - len(memo_loser))


Fixed submission:
S = input()
if S == "ABC":
  print("ARC")
else:
  print("ABC")
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = [[] for i in range(M)]
for i in range(M):
    AB[i] = list(map(int, input().split()))

cnt = 0
for i in range(N):
    for j in AB:
        if i + 1 in j:
            for k in j:
                if i + 1 == k:
                    continue
                if H[k-1] >= H[i]:
                    break
            else:
                continue
            break
    else:
        cnt += 1

print(cnt)



Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = [[] for i in range(M)]
for i in range(M):
    AB[i] = list(map(int, input().split()))

cnt = 0
memo_loser = []
for bridge in AB:
    

    value = min(H[bridge[0]-1], H[bridge[1]-1])
    if value == H[bridge[0]-1] and not bridge[0] in memo_loser:
        memo_loser.append(bridge[0])
    if value == H[bridge[1] - 1] and not bridge[1] in memo_loser:
        memo_loser.append(bridge[1])
print(N - len(memo_loser))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
count = 0
for i in range(N):
    s = input()
    if not s in S:
        S.append(s)
        count += 1
print(count)




Fixed submission:
N = int(input())
S = []

for i in range(N):
    S.append(input())

print(len(set(S)))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N = int(input())
S = list(input())
s = set(itertools.combinations(S, 3))
print(len(s))

Fixed submission:
import itertools
N = int(input())
S = list(input())
S = list(map(int, S))
first = [-1] * 10
#second = [-1] * 10
#third = [-1] * 10
ans = 0
for i in range(N):
    if first[S[i]] == 1:
        continue
    second = [-1] * 10
    for j in range(i + 1, N):
        if second[S[j]] == 1:
            continue
        third = [-1] * 10
        for k in range(j + 1, N):
            if third[S[k]] == 1:
                continue
            #print(S[i], S[j], S[k])
            ans += 1
            third[S[k]] = 1
        second[S[j]] = 1
    first[S[i]] = 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import lru_cache
from operator import mul
from functools import reduce

@lru_cache(maxsize=None)
def for_factorial(n):
    val = 1
    for i in range(2, n + 1):
        val = (val * i)
    return val



x, y = map(int, input().split())
mod = 1000000007
cnt = (x + y) // 3
if (x + y) % 3 != 0:
    print(0)
    exit()
m = min(x, y)
num_2 = m - cnt
num_1 = cnt - num_2
#print(cnt, num_1, num_2)
f_1 = for_factorial(num_1)
f_2 = for_factorial(num_2)
ans = for_factorial(cnt)
#print(ans, f_1, f_2)
f = f_1 * f_2
ans //= f
ans %= mod
print(ans)



Fixed submission:
import math
from functools import lru_cache
from operator import mul
from functools import reduce


def cmb(n, r, mod):
    numerator = reduce(lambda x, y: x * y % mod, [n - r + k + 1 for k in range(r)])
    denominator = reduce(lambda x, y: x * y % mod, [k + 1 for k in range(r)])
    return numerator * pow(denominator, mod - 2, mod) % mod


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def my_factorial(n, mod):
    if n == 1:
        return 1
    return (n * my_factorial(n-1, mod)) % mod


@lru_cache(maxsize=None)
def for_factorial(n):
    val = 1
    for i in range(2, n + 1):
        val = (val * i)
    return val



x, y = map(int, input().split())
mod = 1000000007
cnt = (x + y) // 3
if (x + y) % 3 != 0:
    print(0)
    exit()
m = min(x, y)
num_2 = m - cnt
num_1 = cnt - num_2
ans = cmb(cnt, num_1, mod)
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import gcd
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    #return pow(2, q-1, q) == 1
    return (2 ** (q - 1)) % q == 1


A, B = map(int, input().split())
l = make_divisors(gcd(A, B))
ans = 0
for num in l:
    if is_prime(num):
        ans += 1
print(ans + 1)



Fixed submission:
from math import gcd
import random
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1


def is_prime3(q, k=50):
    q = abs(q)
    # 計算するまでもなく判定できるものははじく
    if q == 2: return True
    if q < 2 or q & 1 == 0: return False

    # n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める
    d = (q - 1) >> 1
    while d & 1 == 0:
        d >>= 1

    # 判定をk回繰り返す
    for i in range(k):
        a = random.randint(1, q - 1)
        t = d
        y = pow(a, t, q)
        # [0,s-1]の範囲すべてをチェック
        while t != q - 1 and y != 1 and y != q - 1:
            y = pow(y, 2, q)
            t <<= 1
        if y != q - 1 and t & 1 == 0:
            return False
    return True

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


A, B = map(int, input().split())
l = make_divisors(gcd(A, B))
_l = factorization(gcd(A, B))
ans = 0
#print(gcd(A, B))
#print(l)
#print(_l)
for num in l:
    if is_prime3(num):
        #print(num)
        ans += 1
print(ans + 1)
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int n,a[100000],b[100000],i=1,j,saidai=0,m=0,L=0;
    string s;
    cin >> n;
    for(i=0;i<n+1;i++)
    {
        cin >> a[i];
        saidai+=a[i];
    }
    for(i=0;i<n;i++)
    {
        cin >> b[i];
        L+=b[i];
    }
    for(i=0;i<n;i++)
    {
        if(a[i]<b[i])
        {
            a[i+1]-=b[i]-a[i];
            if(a[i+1]<0)
            {
                a[i+1]=0;
            }
            a[i]=0;
        }
        else
        {
            a[i]=a[i]-b[i];
        }
    }
        for(i=0;i<n+1;i++)
        {
            m+=a[i];
        }
    if(saidai-m>L)
    {
        cout << L << endl;
    }
    else
    {
        cout << saidai-m << endl;
    }
    
    
    return 0;

}


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
sum_a = sum(a)
b = list(map(int, input().split()))
for i in range(n):
    if b[i] >= a[i]:
        b[i] -= a[i]
        a[i] = 0
    else:
        a[i] -= b[i]
        continue
    a[i + 1] -= b[i]
    if a[i + 1] < 0:
        a[i + 1] = 0

if a[-1] < 0:
    a[-1] = 0
print(sum_a - sum(a))
Buggy python submission (verdict: Runtime Error):
l, r = map(int, input().split())
dif = r - l
ans = 0
if dif >= 2019:
    ans = 0
else:
    mod_l = l % 2019
    mod_r = r % 2019
    if mod_l < mod_r:
        if 3 >= mod_l and mod_r <= 673:
            ans = 0
        else:
            ans = mod_l * (mod_l + 1)
    else:
        ans = 0
print(dif, mod_l, mod_r)
print(ans%2019)

Fixed submission:
l, r = map(int, input().split())
dif = r - l
ans = 30000
if dif >= 2019:
    ans = 0
else:
    mod_l = l % 2019
    mod_r = r % 2019
    if mod_l < mod_r:
        if 3 >= mod_l and mod_r >= 673:
            ans = 0
        else:
            for i in range(mod_l, mod_r + 1):
                for j in range(i + 1, mod_r + 1):
                    ans = min(ans, (i * j) % 2019)
    else:
        ans = 0
#print(dif, mod_l, mod_r)
print(ans%2019)
Buggy python submission (verdict: Runtime Error):
N = int(input())
job = [[0] * N for _ in range(N)]
for i in range(N):
    job[i] = list(map(int, input().split()))
#print(job)
job.sort(key=lambda x: x[1])
#print(job)
#for i in range(1, N):
#    job[i][1] += job[i - 1][1]
rest = 0
for i in range(N):
    if job[i][0] > job[i][1] + rest:
        print("No")
        break
    rest += rest + (job[i][1] - job[i][0])
else:
    print("Yes")

Fixed submission:

N = int(input())
job = []
for i in range(N):
    a, b = map(int, input().split())
    job.append([a, b])
#print(job)
job.sort(key=lambda x: x[1])
#print(job)
for i in range(1, N):
    job[i][0] += job[i - 1][0]
for i in range(N):
    if job[i][0] > job[i][1]:
        print("No")
        break
else:
    print("Yes")

Buggy python submission (verdict: Runtime Error):
N = int(input())
job = [[0] * N for _ in range(N)]
for i in range(N):
    job[i] = list(map(int, input().split()))

job.sort(key = lambda x: x[1])
#print(job)
for i in range(1, N):
    job[i][0] += job[i - 1][0]
for i in range(N):
    if job[i][0] > job[i][1]:
        print("No")
        break
else:
    print("Yes")

Fixed submission:

N = int(input())
job = []
for i in range(N):
    a, b = map(int, input().split())
    job.append([a, b])
#print(job)
job.sort(key=lambda x: x[1])
#print(job)
for i in range(1, N):
    job[i][0] += job[i - 1][0]
for i in range(N):
    if job[i][0] > job[i][1]:
        print("No")
        break
else:
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
ans = 0
BC = []
for i in range(M):
    b, c = map(int, input().split())
    BC.append((b, c))
BC = sorted(BC, key=lambda x: x[1], reverse=True)
list = []
for bc in BC:
    for _ in range(bc[0]):
        list.append(bc[1])
        if len(list) == N:
            break
    else:
        continue
    break
#print(list)
ans = sum(A)
for i in range(min(N, len(list))):
    ans = max(ans, sum(A[:-(i + 1)]) + sum(list[:(i + 1)]))
print(ans)



Fixed submission:
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
ans = 0
BC = []
for i in range(M):
    b, c = map(int, input().split())
    BC.append((b, c))
BC = sorted(BC, key=lambda x: x[1], reverse=True)
list = []
for bc in BC:
    for _ in range(bc[0]):
        list.append(bc[1])
        if len(list) == N:
            break
    else:
        continue
    break
#print(list)
#for i in range(1, N):
#    A[i] += A[i-1]
#for i in range(1, len(list)):
#    list[i] += list[i-1]
for i in range(min(N, len(list))):
    if A[i] >= list[i]:
        break
    A[i] = list[i]
print(sum(A))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
x = [0] * M
y = [0] * M
G = [[] for _ in range(N + 1)]
for i in range(M):
    X, Y = map(int, input().split())
    x[i] = X
    y[i] = Y
    G[X] += [Y]

dp = [-1] * (N + 1)


def f(n):
    if dp[n] != -1:
        return dp[n]
    res = 0
    for m in G[n]:
        res = max(res, f(m) + 1)
    dp[n] = res
    return res


for i in range(1, N + 1):
    f(i)
print(max(dp))

Fixed submission:
import sys
sys.setrecursionlimit(2000)

N, M = map(int, input().split())
x = [0] * M
y = [0] * M
G = [[] for _ in range(N + 1)]
for i in range(M):
    X, Y = map(int, input().split())
    x[i] = X
    y[i] = Y
    G[X] += [Y]

dp = [-1] * (N + 1)


def f(n):
    if dp[n] != -1:
        return dp[n]
    res = 0
    for m in G[n]:
        res = max(res, f(m) + 1)
    dp[n] = res
    return res


for i in range(1, N + 1):
    f(i)
print(max(dp))

Buggy python submission (verdict: Runtime Error):

N, M = map(int, input().split())
x = [0] * (M)
y = [0] * (M)
G = [[] for _ in range(N + 1)]
for i in range(M):
    X, Y = map(int, input().split())
    x[i] = X
    y[i] = Y
    G[X] += [Y]

dp = [-1] * (N + 1)



def f(n):
    if dp[n] != -1:
        return dp[n]
    res = 0
    for m in G[n]:
        res = max(res, f(m) + 1)
    dp[n] = res
    return res


for i in range(1, N + 1):
    f(i)
print(max(dp))

Fixed submission:
import sys
sys.setrecursionlimit(2000)

N, M = map(int, input().split())
x = [0] * M
y = [0] * M
G = [[] for _ in range(N + 1)]
for i in range(M):
    X, Y = map(int, input().split())
    x[i] = X
    y[i] = Y
    G[X] += [Y]

dp = [-1] * (N + 1)


def f(n):
    if dp[n] != -1:
        return dp[n]
    res = 0
    for m in G[n]:
        res = max(res, f(m) + 1)
    dp[n] = res
    return res


for i in range(1, N + 1):
    f(i)
print(max(dp))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans_a = 0
ans_b = 0
ans_c = 0
for b in range(1, 3501):
    for c in range(1, 3501):
        sita = 4 * b * c - (n * (b + c))
        if sita <= 0:
            continue
        ue = n * b * c
        if ue % sita == 0:
            ans_a, ans_b, ans_c = ue // sita, b, c
            break
print(ans_a, ans_b, ans_c)

Fixed submission:
n = int(input())
ans_a = 0
ans_b = 0
ans_c = 0
for b in range(1, 3501):
    for c in range(1, 3501):
        sita = 4 * b * c - (n * (b + c))
        if sita <= 0:
            continue
        ue = n * b * c
        if ue % sita == 0:
            ans_a, ans_b, ans_c = ue // sita, b, c
            break
print(ans_a, ans_b, ans_c)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for _ in range(N):
    A.append(input())
sA = set(A)
ans = 0
for num in sA:
    if A.count(num) % 2 == 1:
        ans += 1
print(ans)

Fixed submission:
from collections import Counter
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))
#sA = set(A)
ans = 0
for num in Counter(A).values():
    #print(num)
    if num % 2 == 1:
        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))
sA = set(A)
ans = 0
for num in sA:
    if A.count(num) % 2 == 1:
        ans += 1
print(ans)

Fixed submission:
from collections import Counter
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))
#sA = set(A)
ans = 0
for num in Counter(A).values():
    #print(num)
    if num % 2 == 1:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [0]
for _ in range(N):
    a.append(int(input()))
memo = [1]
next = 1
cnt = 0
while True:
    cnt += 1
    next = a[next]
    if next == 2:
        print(cnt)
        break
    if next in memo:
        print(-1)
        break
    memo.append(next)

Fixed submission:
N = int(input())
a = [0]
for _ in range(N):
    a.append(int(input()))
memo = [-1] + [1] + [0] * (N-1)
next = 1
cnt = 0
while True:
    cnt += 1
    next = a[next]
    if next == 2:
        print(cnt)
        break
    if memo[next] == 1:
        print(-1)
        break
    memo[next] = 1
Buggy python submission (verdict: Time Limit Exceeded):
'''
Fuad Ashraful Mehmet
University of Asia Pacific,Bangladesh
Date:2nd june 2020
'''

def Solve():
    n=int(input())
    ar=[int(x) for x in input().split()]
    #print(ar)
    ans=1
    for x in ar:
        ans=ans*x
    print("-1" if ans>10**18 else ans)
Solve()

Fixed submission:
'''
Fuad Ashraful Mehmet
University of Asia Pacific,Bangladesh
Date:2nd june 2020
'''

def Solve():
    n=int(input())
    ar=[int(x) for x in input().split()]
    if 0 in ar:
        print(0)
        exit()
    ans=1
    for x in ar:
        ans=ans*x
        if ans>10**18:
            print("-1")
            return
    print(ans)
Solve()
Buggy python submission (verdict: Runtime Error):
X = int(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):
N,D =(int(x) for x in input().split())
xy = [map(int,input().split()) for _ int range(N)]
x,y = [list(i) for i in zip(*xy)]
n = 0

for i in range(N):
  if(x[i]**2 + y[i]**2 <= D**2):
    n += 1

print(n)

Fixed submission:
N,D =(int(x) for x in input().split())
xy = [map(int,input().split()) for _ in range(N)]
x,y = [list(i) for i in zip(*xy)]
n = 0
 
for i in range(N):
  if(x[i]**2 + y[i]**2 <= D**2):
    n += 1
 
print(n)
Buggy python submission (verdict: Runtime Error):
N = int(input())
s = list(map(int,input().split()))
 
t = 1
for i in range(N):
    t = t * s[i]
 
if( t > 10**18):
    print(-1)
else:
    print(t)


Fixed submission:
A,B = map(int,input().split())
print(A*B)
Buggy python submission (verdict: Runtime Error):
K = int(input())
S = input()

if (len(S) <= K):
    print(S)
else:
    print(S[:K] + "...")

Fixed submission:
n = input()
N = int(n)

m = N % 10

if (m == 3):
    print("bon")
elif (m == 0 or m == 1 or m == 6 or m == 8):
    print("pon")
else:
    print("hon")

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

if (len(S) <= K):
    print(S)
else:
    print(S[0:K] + "...")

Fixed submission:
n = input()
N = int(n)

m = N % 10

if (m == 3):
    print("bon")
elif (m == 0 or m == 1 or m == 6 or m == 8):
    print("pon")
else:
    print("hon")

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

m = N % 10

if (m == 3):
    print(bon)
elif (m == 0 or m == 1 or m == 6 or m == 8):
    print(pon)
else:
    print(hon)

Fixed submission:
n = input()
N = int(n)

m = N % 10

if (m == 3):
    print("bon")
elif (m == 0 or m == 1 or m == 6 or m == 8):
    print("pon")
else:
    print("hon")

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

m = N % 10

if (n == 3):
    print(bon)
elif (n == 0 or n == 1 or n == 6 or n == 8):
    print(pon)
else:
    print(hon)

Fixed submission:
n = input()
N = int(n)

m = N % 10

if (m == 3):
    print("bon")
elif (m == 0 or m == 1 or m == 6 or m == 8):
    print("pon")
else:
    print("hon")
Buggy python submission (verdict: Time Limit Exceeded):
n, k, *A = map(int, open(0).read().split())
s = 1
for a in A[:k]:
    s *= a
s0 = s
for i in range(k, n):
    s //= A[i-k]
    s *= A[i]
    if s0 < s:
        print('Yes')
    else:
        print('No')
    s0 = s

Fixed submission:
n, k, *A = map(int, open(0).read().split())
for i in range(k, n):
    if A[i-k] < A[i]:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n, k, *A = map(int, open(0).read().split())
s = 1
for a in A[:k]:
    s *= a
B = [s]
for i in range(k, n):
    s *= A[i]
    s //= A[i-k]
    B.append(s)

for b0, b1 in zip(B, B[1:]):
    if b0 < b1:
        print('Yes')
    else:
        print('No')

Fixed submission:
n, k, *A = map(int, open(0).read().split())
for i in range(k, n):
    if A[i-k] < A[i]:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n, k, *A = map(int, open(0).read().split())
s = 1
for a in A[:k]:
    s *= a
B = [s]
for i in range(k, n):
    s *= A[i]
    s //= A[i-k]
    B.append(s)

for b0, b1 in zip(B, B[1:]):
    if b0 < b1:
        print('Yes')
    else:
        print('No')    


Fixed submission:
n, k, *A = map(int, open(0).read().split())
for i in range(k, n):
    if A[i-k] < A[i]:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
x, n, *P = map(int, open(0).read().split())
P = set(P)
for i in range(51):
    Q = {x-i, x+i} - P
	if Q:
		print(min(Q))
		break

Fixed submission:
x, n, *P = map(int, open(0).read().split())
A = list(range(102))
P = set(P)
B = []
m = 10**4
for a in A:
    if a not in P:
        if abs(x-a) < m:
            m = abs(x-a)
            B.append((m, a))
B.sort()
print(min([k for v, k in B if v == B[0][0]]))
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
class Imos:
    def __init__(self, n):
        self.A = [0]*(n+1)
        self.n = n

    def __call__(self):
        
        dist = list(accumulate(self.A))[:self.n]
        self.A = [0] * (self.n+1)
        return dist

    def query(self, l, r):
        self.A[l] += 1
        self.A[r] -= 1

n, k, *A = map(int, open(0).read().split())
imos = Imos(n)
for _ in range(min(100, k)):
    for i in range(n):
        imos.query(max(0, i-A[i]), min(i+A[i]+1, n))
    A = imos()
print(*A)

Fixed submission:
from itertools import accumulate
n, k, *A = map(int, open(0).read().split())
for _ in range(min(k, 50)):
    B = [0] * (n+1)
    for i in range(n):
        B[max(0, i-A[i])] += 1
        B[min(n, i+A[i]+1)] -= 1
    *A, = accumulate(B)
print(*A[:n])

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
n, k, *A = map(int, open(0).read().split())
for _ in range(min(k, 50)):
    B = [0] * (n+1)
    for i in range(n):
        B[max(0, i-A[i])] += 1
        B[min(n, i+A[i]+1)] -= 1
    *A, = accumulate(B)
print(*A[:n])

Fixed submission:
from itertools import accumulate
n, k, *A = map(int, open(0).read().split())
for _ in range(min(k, 50)):
    B = [0] * (n+1)
    for i in range(n):
        B[max(0, i-A[i])] += 1
        B[min(n, i+A[i]+1)] -= 1
    *A, = accumulate(B)
print(*A[:n])

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
n, k, *A = map(int, open(0).read().split())
for _ in range(min(k, 50)):
    B = [0] * (n+1)
    for i in range(n):
        B[max(0, i-A[i])] += 1
        B[min(n, i+A[i]+1)] -= 1
    A = list(accumulate(B))[:n]
print(*A)

Fixed submission:
from itertools import accumulate
n, k, *A = map(int, open(0).read().split())
for _ in range(min(k, 50)):
    B = [0] * (n+1)
    for i in range(n):
        B[max(0, i-A[i])] += 1
        B[min(n, i+A[i]+1)] -= 1
    *A, = accumulate(B)
print(*A[:n])
Buggy python submission (verdict: Time Limit Exceeded):
from operator import mul
from functools import reduce
n, *A = map(int, open(0).read().split())
m = reduce(mul, A)
if m > 10**18:
    print(-1)
else:
    print(m)

Fixed submission:
n, *A = map(int, open(0).read().split())
A.sort()
s = 1
for a in A:
    s *= a
    if s > 10**18:
        print(-1)
        break
    elif s == 0:
        print(0)
        break
else:
    print(s)
Buggy python submission (verdict: Runtime Error):
from numba import njit
@njit
def factorint(n):
    d = {}
    for i in range(2, int(sqrt(n))+1):
        c = 0
        q, r = divmod(n, i)
        while not r:
            c += 1
            n = q
            q, r = divmod(n, i)
        if c:
            d[i] = c
    if n != 1:
        d[n] = 1
    return d

n = int(input())
if n == 1:
    print(0)
else:
    d = factorint(n)
    s = 0
    for v in d.values():
        s += int((sqrt(8*v+1)-1)/2)
    print(s)

Fixed submission:
from math import sqrt
def factorint(n):
    d = {}
    for i in range(2, int(sqrt(n))+1):
        c = 0
        q, r = divmod(n, i)
        while not r:
            c += 1
            n = q
            q, r = divmod(n, i)
        if c:
            d[i] = c
    if n != 1:
        d[n] = 1
    return d

n = int(input())
if n == 1:
    print(0)
else:
    d = factorint(n)
    s = 0
    for v in d.values():
        s += int((sqrt(8*v+1)-1)/2)
    print(s)