Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

import numpy as np

def solve():
    n = II()
    H = LI()
    d = np.array([])


    for i in range(0, n):
        hi = H[i]
        if i == 0:
            d = np.append(d, hi - 1)
            continue

        hp = H[i - 1]
        if hp < hi:
            d = np.append(d, hi - 1)
        else:
            d = np.append(d, hi)
    # print(d)

    flag = True
    for j in range(1, n):
        if d[j] - d[j - 1] < 0:
            flag = False

    print('Yes' if flag else 'No')







if __name__ == '__main__':
    solve()


### FIXED CODE ###

# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

from collections import deque

def solve():
    n = II()
    H = LI()
    d = deque([])

    flag = True
    for i in range(0, n):
        hi = H[i]
        if i == 0:
            d.append(hi - 1)
            continue

        hp = d.popleft()
        if hp < hi:
            d.append(hi - 1)
        elif hp == hi:
            d.append(hi)
        else:   # hp > hi
            flag = False
            break

    print('Yes' if flag else 'No')







if __name__ == '__main__':
    solve()
### BUGGY CODE ###

N = int(input())
c = []
ans = 1

import collections
ans = 1
all_ans = 0
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

for i in range(1, N):
  ans = 1
  c = collections.Counter(prime_factorize(N-i))
  for i in c.values():
    ans *= (i+1)
  all_ans += ans

print(all_ans)

### FIXED CODE ###

N = int(input())
c = []
ans = 1

import collections
ans = 1
all_ans = 0
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

for i in range(1, N):
  ans = 1
  c = collections.Counter(prime_factorize(N-i))
  for i in c.values():
    ans *= (i+1)
  all_ans += ans

print(all_ans)
### BUGGY CODE ###

n = int(input())
p = list(map(int, input().split()))
plist = []
for i in range(n):
  plist.append(p[:i + 1])
count = 0
for j in range(n):
  if min(plist[j]) >= p[j]:
    count += 1
print(count)

### FIXED CODE ###

n = int(input())
p = list(map(int, input().split()))
count = 0
minn = n
for j in range(len(p)):
  if minn >= p[j]:
    minn = p[j]
    count += 1
print(count)
### BUGGY CODE ###

input()
xs = list(map(int, input().split()))


possibles = set()
for x in xs:
    possibles.add(x - 1)
    possibles.add(x)
    possibles.add(x + 1)


ds = []
for p in possibles:
    d = 0
    for x in xs:
        c = abs(x - p)
        if c <= 1: d += 1
    ds.append(d)


print(max(ds))







### FIXED CODE ###


from collections import Counter


input()
xs = list(map(int, input().split()))


c = Counter(xs)


res = 0
for i in range(100000):
    res = max(res, c[i] + c[i - 1] + c[i + 1])

print(res)
### BUGGY CODE ###

def main():
    n = int(input())
    A = [int(x) for x in input().split()]
    money = 1000
    kabu_c = 0
    l = list()
    for i in range(n-1):
        if A[i+1] - A[i] > 0:
            l.append(1)
        else:
            l.append(0)
    for idx, i in enumerate(l):
        if i == 1:
            while  money - A[idx] >= 0:
                money = money - A[idx]
                kabu_c += 1
        if i == 0:
            money = money + (kabu_c * A[idx])
            kabu_c = 0
    if kabu_c > 0:
        money = money + (kabu_c * A[n-1])
    print(money)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n = int(input())
    A = [int(x) for x in input().split()]
    money = 1000
    kabu_c = 0
    l = list()
    for i in range(n-1):
        if A[i+1] - A[i] > 0:
            l.append(1)
        else:
            l.append(0)
    for idx, i in enumerate(l):
        if i == 1 and money - A[idx] >= 0:
            kabu_c = money // A[idx]
            money = money - (kabu_c * A[idx])
        if i == 0:
            money = money + (kabu_c * A[idx])
            kabu_c = 0
    if kabu_c > 0:
        money = money + (kabu_c * A[n-1])
    print(money)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

A, B, C = map(int, read().split())

if A == B == C:
    if A % 2 == 0:
        print(-1)
    else:
        print(0)
else:
    cnt = 0
    while True:
        A, B, C = (B + C) / 2, (A + C) / 2, (A + B) / 2
        cnt += 1

        if max([A % 2, B % 2, C % 2]) == 1:
            break

    print(cnt)


### FIXED CODE ###

#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

A, B, C = map(int, read().split())

if A == B == C:
    if A % 2 == 0:
        print(-1)
    else:
        print(0)
else:
    cnt = 0
    while True:
        if (A % 2 + B % 2 + C % 2) >= 1:
            break
        cnt += 1
        A, B, C = (B + C) // 2, (A + C) // 2, (A + B) // 2

    print(cnt)
### BUGGY CODE ###

N, M = map(int, input().split())

D = []
d = 1
while M >= N * d:
	if M % d == 0:
		D.append(d)
	d += 1

print(max(D))

### FIXED CODE ###

N, M = map(int, input().split())

def divisible(n):
	divisors = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n // i)
	return divisors

div = divisible(M)

div = [d for d in div if d <= M / N]

print(max(div))
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np
# from numpy import cumsum  # accumulate

def solve():
    N, K = MI()
    A = LI()
    for i in range(K):
        B = [0] * N
        for idx, a in enumerate(A):
            l = max(0, idx - a)
            r = idx + a + 1
            # print(idx, a, l, r)
            B[l] += 1
            if N > r:
                B[r] -= 1
        # print(B)
        B = list(accumulate(B))
        # print(B)
        if A == B:
            printlist(A)
            return
        A = B
    printlist(A)



if __name__ == '__main__':
    solve()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np
# from numpy import cumsum  # accumulate

def solve():
    N, K = MI()
    A = LI()
    for i in range(K):
        B = [0] * N
        for idx, a in enumerate(A):
            l = max(0, idx - a)
            r = idx + a + 1
            # print(idx, a, l, r)
            B[l] += 1
            if N > r:
                B[r] -= 1
        # print(B)
        B = list(accumulate(B))
        # print(B)
        if all([j == N for j in B]):
            printlist(B)
            return
        A = B
    printlist(A)



if __name__ == '__main__':
    solve()
### BUGGY CODE ###

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

DP = [-1 for i in range(max(A)+1)]

A.sort()

for a in A:
  if DP[a] == -1:
    for i in range(2*a, max(A)+1, a):
      DP[i] = 0
    DP[a] = 1
  elif DP[a] == 1:
    DP[a] = 2
    
ans = 0
for i in DP:
  if i == 1:
    ans += 1
    
print(ans)

### FIXED CODE ###

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

A.sort()
maxA = A[-1]
DP = [-1 for i in range(maxA+1)]
for a in A:
  if DP[a] != 0:
    if DP[a] == 1:
      DP[a] = 0
      continue
    for i in range(2*a, maxA+1, a):
      DP[i] = 0
    DP[a] = 1
  
    
ans = 0
for i in DP:
  if i == 1:
    ans += 1
    
print(ans)
### BUGGY CODE ###

N, K = list(map(int, input().split()))
P = list(map(float, input().split()))

c = N - K + 1
dp = [0 for _ in range(c)]

for i in range(c):
    dp[i] = sum(map(lambda x: sum(range(1, int(x) + 1)) / x, P[i: i + K]))

print('{:.10f}'.format(max(dp)))


### FIXED CODE ###

N, K = list(map(int, input().split()))
P = list(map(float, input().split()))

p = [0]
for i in range(N):
    p.append(p[-1] + (P[i] + 1) / 2)

print(max(p[i+K] - p[i] for i in range(N-K+1)))
### BUGGY CODE ###

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

sm = 1
for i in range(K):
    sm *= A[i]

before = sm
for i in range(K, N):
    sm /= A[i-K]
    sm *= A[i]
    if sm > before:
        print('Yes')
    else:
        print('No')
    before = sm

### FIXED CODE ###

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

sm = 1
for i in range(K):
    sm += A[i]

before = sm
for i in range(K, N):
    sm -= A[i-K]
    sm += A[i]
    if sm > before:
        print('Yes')
    else:
        print('No')
    before = sm
### BUGGY CODE ###

import sys
def I(): return int(sys.stdin.readline().rstrip())
N = I()

ans = 0
for i in range(1,N+1):
    n = N//i
    a1,d = i,i
    an = a1+(n-1)*d
    ans += n*(a1+an)//2
print(ans)


### FIXED CODE ###

import sys
def I(): return int(sys.stdin.readline().rstrip())
N = I()

ans = 0
for i in range(1,N+1):
    n = N//i
    a1,d = i,i
    an = a1+(n-1)*d
    ans += n*(a1+an)//2
print(ans)
### BUGGY CODE ###

n,m=map(int,input().split())
MOD=10**9+7
dp=[0]*(n+1)
a=[]
for i in range(m):
    tmp=int(input())
    a.append(tmp)
dp[0]=1
dp[1]=1
for i in range(2,n+1):
    if i-1 in a:
        if i-2 in a:
            print(0)
            exit()
        dp[i]=dp[i-2]
    elif i-2 in a:
        dp[i]=dp[i-1]
    else:
        dp[i]=(dp[i-1]+dp[i-2])%MOD
print(dp[-1])

### FIXED CODE ###

n,m=map(int,input().split())
MOD=10**9+7
dp=[0]*(n+1)
breakstair=[False]*(n+1)
a=[]
for i in range(m):
    tmp=int(input())
    breakstair[tmp]=True
dp[0]=1
dp[1]=1
for i in range(2,n+1):
    if breakstair[i-1]:
        if breakstair[i-2]:
            print(0)
            exit()
        dp[i]=dp[i-2]
    elif breakstair[i-2]:
        dp[i]=dp[i-1]
    else:
        dp[i]=(dp[i-1]+dp[i-2])%MOD
print(dp[-1])
### BUGGY CODE ###

n, m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
for _ in range(m):
  a[a.index(max(a))] /= 2
for i in range(n):
  a[i] = int(a[i])
print(sum(a))

### FIXED CODE ###

import heapq
n, m = [int(i) for i in input().split()]
a = [-int(i) for i in input().split()]
heapq.heapify(a)
for _ in range(m):
  value = heapq.heappop(a)
  value /= 2
  heapq.heappush(a, value)
for i in range(n):
  a[i] = int(-a[i])
print(sum(a))
### BUGGY CODE ###

import itertools

K,S=map(int,input().split())
combi=[]
num=0
for i in range(K+1):
    for j in range(i,K+1):
        for k in range(j,K+1):
            if i+j+k==S:
                combi=[i,j,k]
                #print(combi)
                #print(set(itertools.permutations(combi)))
                t=set(itertools.permutations(combi))
                #print(len(t))
                num+=len(t)
print(num)

### FIXED CODE ###

K,S=map(int,input().split())
num=0
for i in range(K+1):
    for j in range(K+1):
        if 0<=S-i-j<=K:
            num+=1
print(num)
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
ans=1
for i in range(N):
    ans = ans * A[i]
if ans>1000000000000000000:
    ans = -1
print(ans)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
ans=1
for i in range(N):
    if A[i] == 0:
        ans = 0
for i in range(N):
    ans = ans * A[i]
    if ans>1000000000000000000:
        ans = -1
        break
print(ans)
### BUGGY CODE ###

import math,time
N = int(input())
S = input()
length = len(S)
ans = 0
# t1 = time.time()
for i in range(1000):
    locknum = str(i).zfill(3)
    digit = 0
    for j in range(length):
        if S[j] == locknum[digit]:
            if digit == 2:
                ans += 1
                # print(str(i).zfill(3))
                break
            else:
                digit += 1
# t2 = time.time()
# print(t2-t1)                 
print(ans)




                    


### FIXED CODE ###

import math,time
N = int(input())
S = input()
# length = len(S)
ans = 0
t1 = time.time()
for i in range(1000):
    locknum = str(i).zfill(3)
    a = S.find(locknum[0])
    b = S.find(locknum[1],a+1)
    c = S.find(locknum[2],b+1)
    if a!=-1 and b!=-1 and c!=-1:
        # print(i)
        ans +=1

t2 = time.time()
# print(t2-t1)                 
print(ans)
### BUGGY CODE ###

a,b,n=map(int, input().split())
print(max(list( int(a*x/b//1 - x/b//1*a) for x in range(1,n+1) )))

### FIXED CODE ###

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

x=min(b-1,n)

print(int(a*x/b))
### BUGGY CODE ###

n, m = map(int, input().split())
l, r = map(int, input().split())
tmp_l = [i for i in range(l, r + 1)]
tmp_set = set(tmp_l)
for _ in range(m - 1):
    l, r = map(int, input().split())
    tmp_l = [i for i in range(l, r + 1)]
    tmp_set = tmp_set.intersection(set(tmp_l))
 
print(len(tmp_set))

### FIXED CODE ###

n, m = map(int, input().split())
l_lst = [0] * m
r_lst = [0] * m
for i in range(m):
    l, r = map(int, input().split())
    l_lst[i] = l
    r_lst[i] = r

if max(l_lst) <= min(r_lst):
    print(min(r_lst) - max(l_lst) + 1)
else:
    print(0)
### BUGGY CODE ###

n = int(input())
l_list = list(map(int,input().split()))
l_list.sort(reverse=True)
count = 0
for a in range(n-2):
    x=0
    for b in range(a+1,n-1):
        for c in range(b+1,n):
            if (l_list[a]<l_list[b]+l_list[c]):
                count += 1
            else:
                if c==b+1 or c==b+2 or c==b+3:
                    x=1
                    break
        if x == 1:
            break
print(count)


### FIXED CODE ###

from bisect import bisect_left
n = int(input())
l_list = list(map(int,input().split()))
l_list.sort()
count = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        count += bisect_left(l_list,l_list[i]+l_list[j]) - j - 1

print(count)
### BUGGY CODE ###

def solve(n, m, work_list):
    # 1-origin
    dp = [[0] * (m + 1) for i in range(n + 1)]

    # time O(N log(N))
    work_list.sort()

    # time O(NM)
    for key, value in enumerate(work_list, 1):
        work_day, work_value = value[0], value[1]
        prev_key = key - 1
        for day in range(1, m + 1):
            prev_day = day - 1
            dp[key][day] = dp[prev_key][day]
            if day >= work_day:
                dp[key][day] = max(dp[key][day], dp[prev_key][prev_day] + work_value)

    return dp[n][m]


def main():
    n, m = map(int, input().split())

    work_list = []
    # time O(N)
    for i in range(n):
        work = list(map(int, input().split()))
        if work[0] > m:
            continue
        work_list.append(work)

    ans = solve(n, m, work_list)
    print(ans)


main()


### FIXED CODE ###

import heapq


def solve(m, work_map):
    days = work_map.keys()
    ans = 0
    priority_queue = []

    for day in range(1, m + 1):
        if day in days:
            for value in work_map[day]:
                heapq.heappush(priority_queue, -value)
        if len(priority_queue):
            value = -heapq.heappop(priority_queue)
            ans += value

    return ans


def main():
    n, m = map(int, input().split())

    work_map = {}
    # time O(N)
    for i in range(n):
        day, value = list(map(int, input().split()))
        if day > m:
            continue
        if day in work_map.keys():
            work_map[day].append(value)
        else:
            work_map[day] = [value]

    ans = solve(m, work_map)
    print(ans)


main()
### BUGGY CODE ###

from collections import deque
import sys
n,m = map(int,input().split())
 
turo = [[] for i in range(n)]
q = deque()
his = []

for i in range(m):
    a,b = map(int,input().split())
    turo[a-1].append(b-1)
    turo[b-1].append(a-1)
 
par = [i for i in range(n)]
rank = [sys.maxsize for i in range(n)]
rank[0] = 0
q.append(0)

 
while len(q) > 0:
    #print(q)
    room = q.popleft()
    if room not in his:
        his.append(0)
    else:
        continue
    for room2 in turo[room]:
        if rank[room] < rank[room2]:
            q.append(room2)
            par[room2] = room
            rank[room2] = rank[room]+1

if len(his) < n:
    print("No")
    exit()
 
print("Yes")
for i in range(1,n):
    print(par[i]+1)

### FIXED CODE ###

from collections import deque
import sys
n,m = map(int,input().split())
 
turo = [[] for i in range(n)]
q = deque()
his = [False]*n
for i in range(m):
    a,b = map(int,input().split())
    turo[a-1].append(b-1)
    turo[b-1].append(a-1)
 
par = [i for i in range(n)]
rank = [sys.maxsize for i in range(n)]
rank[0] = 0
q.append(0)
 
while len(q) > 0:
    #print(q)
    room = q.popleft()
    
    if not his[room] :
        his[room] = True
    else:
        continue
    for room2 in turo[room]:
        if rank[room] < rank[room2]:
            q.append(room2)
            par[room2] = room
            rank[room2] = rank[room]+1
 
if len(his) < n:
    print("No")
    exit()
 
print("Yes")
for i in range(1,n):
    print(par[i]+1)
### BUGGY CODE ###

n = int(input())
s = input()
r_list = []
g_list = []
b_list = []
cnt = 0
for i, j in enumerate(s):
    if j == 'R':
        r_list.append(i)
    if j == 'G':
        g_list.append(i)
    if j == 'B':
        b_list.append(i)
for r in r_list:
    for g in g_list:
        for b in b_list:
            if not(r * 2 == g + b or g * 2 == r + b or b * 2 == r + g):
                cnt += 1
print(cnt)

### FIXED CODE ###

n = int(input())
s = input()

r_cnt = s.count('R')
g_cnt = s.count('G')
b_cnt = s.count('B')

ans = r_cnt * g_cnt * b_cnt

for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1
print(ans)
### BUGGY CODE ###

#初期入力
S = input()
Q = int(input())
FQ_dic ={i:tuple() for i in range(Q)}
    
for i in range(Q):
    FQ_dic[i] =tuple(input().split())
    
#
rev =0
for fq in FQ_dic.values():
    if      fq[0] =="1": #逆転する
                rev +=1
    else:               #逆転なし   
        if      fq[1]=="1":     #後ろにつける
            if rev %2 ==0:
                    S = fq[2] + S
            else:
                    S = S +fq[2] 
        else: #                 #前につける
            if rev %2 ==0:
                    S = S + fq[2]
            else:        
                    S = fq[2] + S
if rev %2 ==0:
    print(S)
else:
    print(S[::-1])

### FIXED CODE ###

#前・左につける変数、後ろ・右につける変数を用意して最後に足す
#前・左は最後にひっくり返す（abc ⇒cba)

#初期入力
import sys
input = sys.stdin.readline
S = input()
S=S.strip("\n")
Q = int(input())
FQ_dic={}
for i in range(Q):
    FQ_dic[i] =input().split()

rev =0
front =""
back =""

for i in range(Q):
   # print(S) 

    if FQ_dic[i][0] =="1": #逆転する
                rev +=1
    else:                   #逆転なし  
        if FQ_dic[i][1]=="1":     #前=左につける 
            if rev %2 ==0:
                front += FQ_dic[i][2]
            else:
                back  += FQ_dic[i][2]  
        else: #                      #後ろ=右につける
            if rev %2 ==0:
                back  += FQ_dic[i][2]  
            else:        
                front += FQ_dic[i][2]
front =front[::-1]
S =front + S + back

if rev %2 ==0:
    print(*S,sep="")
else:
    print(*S[::-1],sep="")
### BUGGY CODE ###

N = int(input())
vlist = list(map(int, input().split()))
clist = list(map(int, input().split()))

ans = -100000000000
for num in range(2 ** N):
    value = cost = 0
    for i in range(N):
        if (num >> i) & 1 == 1:
            value += vlist[i]
            cost += clist[i]
    if value - cost > ans:
        ans = value - cost
print(ans)


### FIXED CODE ###

N = int(input())
vlist = list(map(int, input().split()))
clist = list(map(int, input().split()))
ans=0
for i in range(N):
    if vlist[i] - clist[i] > 0:
        ans += vlist[i] - clist[i]
print(ans)
### BUGGY CODE ###

A, B = map(int, input().split())

CommonDivs =[]
for i in range(1, min(A, B)+1): 
    if A%i==B%i==0: 
        CommonDivs.append(i)
        
#print(CommonDivs)

from collections import deque
CommonDivs.reverse()
q = deque(CommonDivs)
ans = [q.pop()]
while len(q) > 0:
    a = q.pop()
    ans.append(a)
    for _ in range(len(q)):
        b = q.pop()
        if b % a != 0:
            q.appendleft(b)
            
print(len(ans))

### FIXED CODE ###

A, B = map(int, input().split())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

import math

def is_prime(n):
    if n == 1: return True

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True

import fractions
x = fractions.gcd(A, B)
divisors = make_divisors(x)
ans = 0
for d in divisors:
    if is_prime(d):
        ans += 1
print(ans)
### BUGGY CODE ###

def count_num_light(a):
  ret = [0 for _ in range(len(a))]
  n = len(a)
  for i in range(n):
    start = max(0, i-a[i])
    end = min(n-1, i+a[i])
    ret[start] += 1
    if end+1 < n:
      ret[end+1] -= 1
  for i in range(1,n):
    ret[i] += ret[i-1]
  
  return ret
                  
n, k = map(int, input().split())
a = list(map(int, input().split()))
num_light = count_num_light(a)
 
for i in range(k-1):
  num_light = count_num_light(num_light)
  if sum(num_light) == n**2:
    break
    
print(*num_light)


### FIXED CODE ###

def count_num_light(a):
  ret = [0 for _ in range(len(a))]
  n = len(a)
  for i in range(n):
    start = max(0, i-a[i])
    end = min(n-1, i+a[i])
    ret[start] += 1
    if end+1 < n:
      ret[end+1] -= 1
  for i in range(1,n):
    ret[i] += ret[i-1]
  
  return ret
                  
n, k = map(int, input().split())
a = list(map(int, input().split()))
num_light = count_num_light(a)
 
for i in range(k-1):
  num_light = count_num_light(num_light)
  if sum(num_light) == n**2:
    break
    
print(*num_light)