Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import random

def main():
    N = int(input().strip())
    cand = []
    for i in range(30000 // 6):
        cand.append(6 * i + 2)
        cand.append(6 * i + 3)
        cand.append(6 * i + 4)
        cand.append(6 * i + 6)

    while True:
        S = random.choices(cand, k=N)
        if sum(S) % 6 == 0:
            break
    return ' '.join(map(str, S))


if __name__ == '__main__':
    print(main())


Fixed submission:


def main():
    N = int(input().strip())

    o = [6, 2, 10, 3, 9, 4, 8, 12]
    e = [2, 10, 3, 9, 4, 8, 6, 12]
    if N == 3:
        S = [2, 5, 63]
    else:
        l = o if N % 2 != 0 else e
        S = []
        for i in range(N):
            S.append(l[i % len(l)] + 12*(i//len(l)))

    return ' '.join(map(str, S))


if __name__ == '__main__':
    print(main())
Buggy python submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
print(min(A, B) + min(C, D))

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
print(min(A, B) + min(C, D))
Buggy python submission (verdict: Runtime Error):
A, B, C = map(int, input())
print('Yes' if A+2*B >= C else 'No')

Fixed submission:
A, B, C = map(int, input().split())
print('Yes' if A+B >= C else 'No')
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=int(input))
print(n*n-a)

Fixed submission:
n=int(input())
a=int(input())
print(n*n-a)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, AB):
    c = Counter(reduce(add, AB))
    for v in c.values():
        if v % 2 != 0:
            return 'NO'
    return 'YES'


def main():
    N, M = read_int_n()
    AB = [read_int_n() for _ in range(M)]
    print(slv(N, M, AB))


if __name__ == '__main__':
    main()


Fixed submission:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, AB):
    c = Counter()
    for a, b in AB:
        c[a] += 1
        c[b] += 1
    for v in c.values():
        if v % 2 != 0:
            return 'NO'
    return 'YES'


def main():
    N, M = read_int_n()
    AB = [read_int_n() for _ in range(M)]
    print(slv(N, M, AB))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
if A == B:
  print('Draw')
else:
  print( 'Alice' if A if A != 1 else A+13 > B if B != 1 else B+ 13 else 'Bob')

Fixed submission:
A, B = map(int, input().split())
if A == B:
  print('Draw')
else:
  print( 'Alice' if (A if A != 1 else A+13) > (B if B != 1 else B+13) else 'Bob')
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

A = [input() for _ in range(N)]
B = [input() for _ in range(M)]


def f(i, j):
  for k in range(i, i+M):
    for l in range(j, j+M):
      if A[i+k][j+l] != B[k][l]:
        return False
  return True

def slv():
  for i in range(N-M+1):
    for j in range(N-M+1):
      if f(i, j):
        return 'Yes'
  return 'No'
print(slv())
      


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

A = [input() for _ in range(N)]
B = [input() for _ in range(M)]


def f(i, j):
  for k in range(M):
    for l in range(M):
      if A[i+k][j+l] != B[k][l]:
        return False
  return True

def slv():
  for i in range(N-M+1):
    for j in range(N-M+1):
      if f(i, j):
        return 'Yes'
  return 'No'
print(slv())
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, AB):
    g = defaultdict(set)

    for a, b in AB:
        g[a].add(b)
        g[b].add(a)

    ans = 0
    for ns in permutations(range(2, N+1), N-1):
        ns = list(ns)
        ns.insert(0, 1)
        for i in range(N-1):
            if ns[i+1] not in g[ns[i]]:
                break
        else:
            ans += 1
    return ans


def main():
    N, M = read_int_n()
    AB = [read_int_n() for _ in range(N)]
    print(slv(N, M, AB))


if __name__ == '__main__':
    main()


Fixed submission:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, AB):
    g = defaultdict(set)

    for a, b in AB:
        g[a].add(b)
        g[b].add(a)

    ans = 0
    for ns in permutations(range(2, N+1), N-1):
        ns = list(ns)
        ns.insert(0, 1)
        for i in range(N-1):
            if ns[i+1] not in g[ns[i]]:
                break
        else:
            ans += 1
    return ans


def main():
    N, M = read_int_n()
    AB = [read_int_n() for _ in range(M)]
    print(slv(N, M, AB))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
N = int(input())
NM = 1000
fs = [list() for _ in range(NM+1)]

from collections import Counter
C = Count()
for i in range(2):
  if len(fs[i]) == 0:
    for j in range(i, NM+1, i):
      d = j
      while j % i == 0:
        fs[j].append(i)
        j //= i
        C[j] += 1

M = 10**9 + 7
ans = 1
for v in C.values():
  ans = (ans * v) % M
print(ans)
        
  

Fixed submission:
N = int(input())
NM = 1000
fs = [list() for _ in range(NM+1)]

from collections import Counter
C = Counter()
for i in range(2, N+1):
  if len(fs[i]) == 0:
    for j in range(i, N+1, i):
      d = j
      while j % i == 0:
        fs[j].append(i)
        j //= i
        C[i] += 1

M = 10**9 + 7
ans = 1
for v in C.values():
  ans = (ans * (v+1)) % M
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]

ma,mb = AB[0]
for a, b in AB:
  i = 0
  while i*a < ma:
    i += 1
  j = 0
  while j*b < mb:
    j += 1
  k = max(i, j)
  
  ma = k*a
  mb = k*b
  
print(ma + mb)
   

Fixed submission:
import math
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]

ma,mb = AB[0]
for a, b in AB[1:]:
  i = -(-ma //a)
  j = -(-mb //b)
  k = max(i, j)
  
  ma = k*a
  mb = k*b
  
print(ma + mb)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(W, H, P, Q):
    W += 1
    H += 1
    ans = 0
    for i, p in enumerate(P):
        ans += p

    for i, q in enumerate(Q):
        ans += q


    for i in range(1, H):
        for j in range(1, W):
            if P[j-1] < Q[i-1]:
                ans += P[j-1]
            else:
                ans += Q[i-1]

    return ans


def main():
    W, H = read_int_n()
    P = [read_int() for _ in range(W)]
    Q = [read_int() for _ in range(H)]
    print(slv(W, H, P, Q))


if __name__ == '__main__':
    main()


Fixed submission:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(W, H, P, Q):
    W += 1
    H += 1
    ans = sum(P) + sum(Q)

    P.sort()
    Q.sort()
    # print(P)
    for q in Q:
        i = bisect.bisect_left(P, q)
        # print(i, q)
        ans += q * (len(P)-i)
    for p in P:
        i = bisect.bisect_right(Q, p)
        # print(i, p)
        ans += p * (len(Q)-i)

    return ans


def main():
    W, H = read_int_n()
    P = [read_int() for _ in range(W)]
    Q = [read_int() for _ in range(H)]
    print(slv(W, H, P, Q))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
S = list(input())

for i in range(len(S)):
  n = ord(S[i])
  if ord('z') - n + 1 >= K:
    K -= ord('z') - n + 1
   	S[i] = 'a'

if K != 0:
  n = ord(S[-1])
  n -= ord('a')
  n += K
  n %= ord('z') - ord('a')
  n += ord('a')
  S[-1] = chr(n)
print(''.join(S))
    
    

Fixed submission:
S = list(input())
K = int(input())

for i in range(len(S)):
  n = ord(S[i])
  if S[i] == 'a':
    continue
  if ord('z') - n + 1 <= K:
    K -= ord('z') - n + 1
    S[i] = 'a'
assert K >= 0
if K != 0:
  n = ord(S[-1])
  n -= ord('a')
  n += K
  n %= 26
  n += ord('a')
  S[-1] = chr(n)
print(''.join(S))
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, X, A):

    ans = sys.maxsize
    mc = [(sys.maxsize, -1)] * N
    for k in range(N):
        ac = 0
        for i in range(N):
            mc[i] = min(mc[i], (A[i-k], k), key=lambda x: x[0])
            ac += A[i-mc[i][1]]
        ac += k*X
        ans = min(ans, ac)

    return ans


def main():
    N, X = read_int_n()
    A = read_int_n()
    print(slv(N, X, A))


if __name__ == '__main__':
    main()


Fixed submission:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, X, A):

    ans = sys.maxsize
    mc = [(sys.maxsize, -1)] * N
    for k in range(N):
        ac = 0
        for i in range(N):
            mc[i] = min(mc[i], (A[i-k], k), key=lambda x: x[0])
            ac += A[i-mc[i][1]]
        ac += k*X
        ans = min(ans, ac)

    return ans


def main():
    N, X = read_int_n()
    A = read_int_n()
    print(slv(N, X, A))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
def input():
    return stdin.readline().strip()

h, w = map(int, input().split())
ch, cw = map(int, input().split())
ch += 1
cw += 1
dh, dw = map(int, input().split())
dh += 1
dw += 1
g = ['#' * (w + 4)] * 2 
for _ in range(h):
    g.append('##' + input() + '##')
g.append('#' * (w + 4))
g.append('#' * (w + 4))

d1 = [(-1, 0), (0, -1), (0, 1), (1, 0)]
d2 = [(-2, -2), (-2, -1), (-2, 0), (-2, 1), (-2, 2), (-1, -2), (-1, -1),
(-1, 1), (-1, 2), (0, -2), (0, 2), (1, -2), (1, -1), (1, 1), (1, 2),
(2, -2), (2, -1), (2, 0), (2, 1), (2, 2)]

import heapq
# Dijkstra
d = [-2, -1, 0, 1, 2]
seen = [[-1] * (w+2) for _ in range(h+2)]
todo = [(0, ch, cw)]
heapq.heapify(todo)
while len(todo) > 0:
    cost, x, y = heapq.heappop(todo)
    if seen[x][y] == -1:
        if x == dh and y == dw:
            print(cost)
            exit()
        seen[x][y] = cost

    for i in range(4):
        dx, dy = d1[i]
        if g[x+dx][y+dy] == '.' and seen[x+dx][y+dy] == -1:
            heapq.heappush(todo, (cost, x+dx, y+dy))
    for i in range(20):
        dx, dy = d2[i]
        if g[x+dx][y+dy] == '.' and seen[x+dx][y+dy] == -1:
            heapq.heappush(todo, (cost+1, x+dx, y+dy))

print(-1)

Fixed submission:
from sys import stdin
def input():
    return stdin.readline().strip()

h, w = map(int, input().split())
ch, cw = map(int, input().split())
ch += 1
cw += 1
dh, dw = map(int, input().split())
dh += 1
dw += 1
g = ['#' * (w + 4)] * 2 
for _ in range(h):
    g.append('##' + input() + '##')
g.append('#' * (w + 4))
g.append('#' * (w + 4))

d1 = [(-1, 0), (0, -1), (0, 1), (1, 0)]
d2 = [(-2, -2), (-2, -1), (-2, 0), (-2, 1), (-2, 2), (-1, -2), (-1, -1),
(-1, 1), (-1, 2), (0, -2), (0, 2), (1, -2), (1, -1), (1, 1), (1, 2),
(2, -2), (2, -1), (2, 0), (2, 1), (2, 2)]

from collections import deque
# BFS BFS
seen = [[-1] * (w+2) for _ in range(h+2)]
todo = deque([(0, ch, cw)])
while len(todo) > 0:
    history = []
    while len(todo) > 0:
        cost, x, y = todo.popleft()
        if seen[x][y] == -1:
            if x == dh and y == dw:
                print(cost)
                exit()
            seen[x][y] = cost
            history.append((cost, x, y))
        else:
            continue

        for i in range(4):
            dx, dy = d1[i]
            if g[x+dx][y+dy] == '.' and seen[x+dx][y+dy] == -1:
                todo.append((cost, x+dx, y+dy))

    for j in history:
        cost, x, y = j
        for i in range(20):
            dx, dy = d2[i]
            if g[x+dx][y+dy] == '.' and seen[x+dx][y+dy] == -1:
                todo.append((cost+1, x+dx, y+dy))

print(-1)
Buggy python submission (verdict: Runtime Error):
import heapq

def main2(l, n):
    ans = 0
    length = len(l[0])
    lis = heapq.heapify(l[0])
    while length > 1:
        length -= 1
        ans += heapq.heappop(lis)
    for i in range(1, n):
        length += len(l[i])
        for j in l[i]:
            heapq.heappush(lis, j)
        while length > i + 1:
            length -= 1
            ans += heapq.heappop(lis)
    return ans

def main():
    from sys import stdin
    def input():
        return stdin.readline().strip()

    t = int(input())

    answer = []
    for _ in range(t):
        n = int(input())
        ans = 0
        l = [[] for _ in range(n)]
        r = [[] for _ in range(n)]
        for _ in range(n):
            i, j, k = map(int, input().split())
            if j > k:
                ans += j
                l[i-1].append(j-k)
            if j < k:
                ans += k
                r[n-i].append(k-j)
            ans -= main2(l, n) + main2(r, n)
            answer.append(ans)

    for i in answer:
        print(i)

main()

Fixed submission:
import heapq

def main2(l, n):
    ans = 0
    lis = []
    heapq.heapify(lis)
    for i in range(1, n):
        for j in l[i]:
            heapq.heappush(lis, j)
        while len(lis) > i:
            ans += heapq.heappop(lis)
    return ans

def main():
    from sys import stdin
    def input():
        return stdin.readline().strip()

    t = int(input())

    answer = []
    for _ in range(t):

        n = int(input())
        ans = 0
        l = [[] for _ in range(n+1)]
        r = [[] for _ in range(n+1)]
        for _ in range(n):
            i, j, k = map(int, input().split())
            if j > k:
                ans += j
                l[i].append(j-k)
            elif j < k:
                if i == n:
                    ans += j
                else:
                    ans += k
                    r[n-i].append(k-j)
            else:
                ans += j

        ans -= main2(l, n) + main2(r, n)
        answer.append(ans)

    for i in answer:
        print(i)

main()
Buggy python submission (verdict: Time Limit Exceeded):
class Combination:
    def __init__(self, n, mod):
        self.mod = mod

        # self.fac[i] ≡ i! (factorial:階乗)
        l = [1]
        num = 1
        for i in range(1, n+1):
            num *= i
            num %= mod
            l.append(num)
        self.fac = l.copy()

        # self.rec[i] ≡ 1 / i! (reciprocal:逆数)
        num = pow(num, mod-2, mod)
        l = [1 for i in range(n+1)]
        l[n] = num
        for i in range(n-1, 0, -1):
            num *= i + 1
            num %= mod
            l[i] = num
        self.rec = l.copy()

    # comb(n, r) ≡ nCr
    def comb(self, n, r):
        return self.fac[n] * self.rec[r] * self.rec[n - r] % self.mod

mod = 10**9 + 7

k = int(input())
s = input()
n = len(s)

c = Combination(k + n, mod)

pow25 = [1]
pow26 = [1]
for _ in range(k):
    pow25.append(25 * pow25[-1] % mod)
    pow26.append(26 * pow26[-1] % mod)

ans = 0
for i in range(k+1):
    ans += c.comb(n+i-1, i) * pow25[i] * pow26[k-i]
    ans %= mod

print(ans)

Fixed submission:
class Combination:
    def __init__(self, n, mod):
        self.mod = mod

        # self.fac[i] ≡ i! (factorial:階乗)
        l = [1]
        num = 1
        for i in range(1, n+1):
            num *= i
            num %= mod
            l.append(num)
        self.fac = l.copy()

        # self.rec[i] ≡ 1 / i! (reciprocal:逆数)
        num = pow(num, mod-2, mod)
        l = [1 for i in range(n+1)]
        l[n] = num
        for i in range(n-1, 0, -1):
            num *= i + 1
            num %= mod
            l[i] = num
        self.rec = l.copy()

    # comb(n, r) ≡ nCr
    def comb(self, n, r):
        return self.fac[n] * self.rec[r] * self.rec[n - r] % self.mod

mod = 10**9 + 7

k = int(input())
s = input()
n = len(s)

c = Combination(k + n, mod)

ans = 0
for i in range(k+1):
    ans += c.comb(n + i - 1, i) * pow(25, i, mod) * pow(26, k-i, mod)
    ans %= mod

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

while min(a) < n and k > 0:
  mark = [0] * (n + 1)
  for i in range(n):
    mark[max([0, i - a[i]])] += 1
    mark[min([n, i + a[i] + 1])] -= 1
  a = [mark[0]]
  for i in range(1, n):
    a.append(a[-1] + mark[i])
  k -= 1

print(' '.join(map(str, a)))

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

while min(a) < n and k > 0:
  mark = [0] * (n + 1)
  for i in range(n):
    mark[max([0, i - a[i]])] += 1
    mark[min([n, i + a[i] + 1])] -= 1
  a = [mark[0]]
  for i in range(1, n):
    a.append(a[-1] + mark[i])
  k -= 1

print(' '.join(map(str, a)))